1import{n as rs,g as Yb,y as Kb,v as Iv,m as _d,b as Av,a as Mv,d as Xa,k as I_,E as A_,at as Zo,i as Jb,c as bv,F as Cv,l as Pv,au as Qb,af as is,aa as En,G as fd,aj as Ur,av as w_,p as zv,s as ew,t as ff,aw as tw,an as Rv,am as y_,ak as Ho,u as nc,H as T_,ab as x_,aq as v_,a9 as b_,as as iw,ao as rw,ap as nw,al as sw}from"./_MbA3FA0.js";import{e as ow,f as md,h as aw,a as M_,p as lw,b as cw,c as uw,u as hw}from"./D7enOkY_.js";import{_ as dw,u as pw}from"./CL-6es_X.js";import{r as fw}from"./BPXnh4oF.js";import{_ as mw}from"./DlAUqK2U.js";function _w(ht){return Yb()?(Kb(ht),!0):!1}const gw=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const yw=ht=>typeof ht<"u";function xw(ht){return Array.isArray(ht)?ht:[ht]}function vw(ht,Et,mt={}){const{flush:xi="sync",deep:ji=!1,immediate:gt=!0}=mt,jt=xw(Et);return rs(ht,o=>jt.forEach(Gt=>Gt.value=o),{flush:xi,deep:ji,immediate:gt})}function S_(ht,Et,mt){return rs(ht,Et,{...mt,once:!0})}function bw(ht,Et,mt){const xi=rs(ht,(ji,gt,jt)=>{ji&&(mt!=null&&mt.once&&Iv(()=>xi()),Et(ji,gt,jt))},{...mt,once:!1});return xi}const ww=gw?window:void 0;function wv(ht){var Et;const mt=Av(ht);return(Et=mt==null?void 0:mt.$el)!=null?Et:mt}function Tw(){const ht=I_(!1),Et=Mv();return Et&&A_(()=>{ht.value=!0},Et),ht}function Sw(ht){const Et=Tw();return _d(()=>(Et.value,!!ht()))}function Ew(ht){return JSON.parse(JSON.stringify(ht))}function Iw(ht,Et,mt={}){const{window:xi=ww,...ji}=mt;let gt;const jt=Sw(()=>xi&&"ResizeObserver"in xi),o=()=>{gt&&(gt.disconnect(),gt=void 0)},Gt=_d(()=>{const oi=Av(ht);return Array.isArray(oi)?oi.map(sr=>wv(sr)):[wv(oi)]}),ft=rs(Gt,oi=>{if(o(),jt.value&&xi){gt=new ResizeObserver(Et);for(const sr of oi)sr&>.observe(sr,ji)}},{immediate:!0,flush:"post"}),ri=()=>{o(),ft()};return _w(ri),{isSupported:jt,stop:ri}}function Aw(ht,Et,mt,xi={}){var ji,gt,jt;const{clone:o=!1,passive:Gt=!1,eventName:ft,deep:ri=!1,defaultValue:oi,shouldEmit:sr}=xi,pr=Mv(),Kr=mt||(pr==null?void 0:pr.emit)||((ji=pr==null?void 0:pr.$emit)==null?void 0:ji.bind(pr))||((jt=(gt=pr==null?void 0:pr.proxy)==null?void 0:gt.$emit)==null?void 0:jt.bind(pr==null?void 0:pr.proxy));let Dt=ft;Dt=Dt||`update:${Et.toString()}`;const Tr=dr=>o?typeof o=="function"?o(dr):Ew(dr):dr,zi=()=>yw(ht[Et])?Tr(ht[Et]):oi,Fr=dr=>{sr?sr(dr)&&Kr(Dt,dr):Kr(Dt,dr)};if(Gt){const dr=zi(),Dn=Xa(dr);let cn=!1;return rs(()=>ht[Et],mn=>{cn||(cn=!0,Dn.value=Tr(mn),Iv(()=>cn=!1))}),rs(Dn,mn=>{!cn&&(mn!==ht[Et]||ri)&&Fr(mn)},{deep:ri}),Dn}else return _d({get(){return zi()},set(dr){Fr(dr)}})}var mf={exports:{}},Mw=mf.exports,Tv;function Cw(){return Tv||(Tv=1,function(ht,Et){(function(mt,xi){ht.exports=xi()})(Mw,function(){var mt,xi,ji;function gt(o,Gt){if(!mt)mt=Gt;else if(!xi)xi=Gt;else{var ft="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 = {}; ("+mt+")(sharedChunk); ("+xi+")(sharedChunk); self.onerror = null;",ri={};mt(ri),ji=Gt(ri),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(ji.workerUrl=window.URL.createObjectURL(new Blob([ft],{type:"text/javascript"})))}}gt(["exports"],function(o){var Gt=1e-6,ft=typeof Float32Array<"u"?Float32Array:Array;function ri(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=i*u-a*s;return h?(r[0]=u*(h=1/h),r[1]=-s*h,r[2]=-a*h,r[3]=i*h,r):null}function oi(){var r=new ft(9);return ft!=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 sr(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=e[4],f=e[5],_=e[6],g=e[7],v=e[8];return r[0]=h*v-f*g,r[1]=a*g-s*v,r[2]=s*f-a*h,r[3]=f*_-u*v,r[4]=i*v-a*_,r[5]=a*u-i*f,r[6]=u*g-h*_,r[7]=s*_-i*g,r[8]=i*h-s*u,r}function pr(r,e,i){var s=e[0],a=e[1],u=e[2],h=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=i[0],E=i[1],A=i[2],P=i[3],D=i[4],k=i[5],j=i[6],G=i[7],z=i[8];return r[0]=w*s+E*h+A*g,r[1]=w*a+E*f+A*v,r[2]=w*u+E*_+A*b,r[3]=P*s+D*h+k*g,r[4]=P*a+D*f+k*v,r[5]=P*u+D*_+k*b,r[6]=j*s+G*h+z*g,r[7]=j*a+G*f+z*v,r[8]=j*u+G*_+z*b,r}function Kr(){var r=new ft(16);return ft!=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 Dt(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 Tr(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=e[4],f=e[5],_=e[6],g=e[7],v=e[8],b=e[9],w=e[10],E=e[11],A=e[12],P=e[13],D=e[14],k=e[15],j=i*f-s*h,G=i*_-a*h,z=i*g-u*h,N=s*_-a*f,q=s*g-u*f,H=a*g-u*_,oe=v*P-b*A,re=v*D-w*A,ae=v*k-E*A,he=b*D-w*P,Te=b*k-E*P,Oe=w*k-E*D,ze=j*Oe-G*Te+z*he+N*ae-q*re+H*oe;return ze?(r[0]=(f*Oe-_*Te+g*he)*(ze=1/ze),r[1]=(a*Te-s*Oe-u*he)*ze,r[2]=(P*H-D*q+k*N)*ze,r[3]=(w*q-b*H-E*N)*ze,r[4]=(_*ae-h*Oe-g*re)*ze,r[5]=(i*Oe-a*ae+u*re)*ze,r[6]=(D*z-A*H-k*G)*ze,r[7]=(v*H-w*z+E*G)*ze,r[8]=(h*Te-f*ae+g*oe)*ze,r[9]=(s*ae-i*Te-u*oe)*ze,r[10]=(A*q-P*z+k*j)*ze,r[11]=(b*z-v*q-E*j)*ze,r[12]=(f*re-h*he-_*oe)*ze,r[13]=(i*he-s*re+a*oe)*ze,r[14]=(P*G-A*N-D*j)*ze,r[15]=(v*N-b*G+w*j)*ze,r):null}function zi(r,e,i){var s=e[0],a=e[1],u=e[2],h=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=e[9],E=e[10],A=e[11],P=e[12],D=e[13],k=e[14],j=e[15],G=i[0],z=i[1],N=i[2],q=i[3];return r[0]=G*s+z*f+N*b+q*P,r[1]=G*a+z*_+N*w+q*D,r[2]=G*u+z*g+N*E+q*k,r[3]=G*h+z*v+N*A+q*j,r[4]=(G=i[4])*s+(z=i[5])*f+(N=i[6])*b+(q=i[7])*P,r[5]=G*a+z*_+N*w+q*D,r[6]=G*u+z*g+N*E+q*k,r[7]=G*h+z*v+N*A+q*j,r[8]=(G=i[8])*s+(z=i[9])*f+(N=i[10])*b+(q=i[11])*P,r[9]=G*a+z*_+N*w+q*D,r[10]=G*u+z*g+N*E+q*k,r[11]=G*h+z*v+N*A+q*j,r[12]=(G=i[12])*s+(z=i[13])*f+(N=i[14])*b+(q=i[15])*P,r[13]=G*a+z*_+N*w+q*D,r[14]=G*u+z*g+N*E+q*k,r[15]=G*h+z*v+N*A+q*j,r}function Fr(r,e,i){var s,a,u,h,f,_,g,v,b,w,E,A,P=i[0],D=i[1],k=i[2];return e===r?(r[12]=e[0]*P+e[4]*D+e[8]*k+e[12],r[13]=e[1]*P+e[5]*D+e[9]*k+e[13],r[14]=e[2]*P+e[6]*D+e[10]*k+e[14],r[15]=e[3]*P+e[7]*D+e[11]*k+e[15]):(a=e[1],u=e[2],h=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=e[9],E=e[10],A=e[11],r[0]=s=e[0],r[1]=a,r[2]=u,r[3]=h,r[4]=f,r[5]=_,r[6]=g,r[7]=v,r[8]=b,r[9]=w,r[10]=E,r[11]=A,r[12]=s*P+f*D+b*k+e[12],r[13]=a*P+_*D+w*k+e[13],r[14]=u*P+g*D+E*k+e[14],r[15]=h*P+v*D+A*k+e[15]),r}function dr(r,e,i){var s=i[0],a=i[1],u=i[2];return r[0]=e[0]*s,r[1]=e[1]*s,r[2]=e[2]*s,r[3]=e[3]*s,r[4]=e[4]*a,r[5]=e[5]*a,r[6]=e[6]*a,r[7]=e[7]*a,r[8]=e[8]*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 Dn(r,e,i){var s=Math.sin(i),a=Math.cos(i),u=e[4],h=e[5],f=e[6],_=e[7],g=e[8],v=e[9],b=e[10],w=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=u*a+g*s,r[5]=h*a+v*s,r[6]=f*a+b*s,r[7]=_*a+w*s,r[8]=g*a-u*s,r[9]=v*a-h*s,r[10]=b*a-f*s,r[11]=w*a-_*s,r}function cn(r,e,i){var s=Math.sin(i),a=Math.cos(i),u=e[0],h=e[1],f=e[2],_=e[3],g=e[8],v=e[9],b=e[10],w=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=u*a-g*s,r[1]=h*a-v*s,r[2]=f*a-b*s,r[3]=_*a-w*s,r[8]=u*s+g*a,r[9]=h*s+v*a,r[10]=f*s+b*a,r[11]=_*s+w*a,r}function mn(r,e,i){var s=Math.sin(i),a=Math.cos(i),u=e[0],h=e[1],f=e[2],_=e[3],g=e[4],v=e[5],b=e[6],w=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=u*a+g*s,r[1]=h*a+v*s,r[2]=f*a+b*s,r[3]=_*a+w*s,r[4]=g*a-u*s,r[5]=v*a-h*s,r[6]=b*a-f*s,r[7]=w*a-_*s,r}function Xo(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 ks(r,e,i){var s,a,u,h=i[0],f=i[1],_=i[2],g=Math.hypot(h,f,_);return g<Gt?null:(h*=g=1/g,f*=g,_*=g,s=Math.sin(e),a=Math.cos(e),r[0]=h*h*(u=1-a)+a,r[1]=f*h*u+_*s,r[2]=_*h*u-f*s,r[3]=0,r[4]=h*f*u-_*s,r[5]=f*f*u+a,r[6]=_*f*u+h*s,r[7]=0,r[8]=h*_*u+f*s,r[9]=f*_*u-h*s,r[10]=_*_*u+a,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function ns(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=i+i,f=s+s,_=a+a,g=i*h,v=s*h,b=s*f,w=a*h,E=a*f,A=a*_,P=u*h,D=u*f,k=u*_;return r[0]=1-b-A,r[1]=v+k,r[2]=w-D,r[3]=0,r[4]=v-k,r[5]=1-g-A,r[6]=E+P,r[7]=0,r[8]=w+D,r[9]=E-P,r[10]=1-g-b,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});var sc=zi;function yr(){var r=new ft(3);return ft!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function mo(r){var e=new ft(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function Jr(r){return Math.hypot(r[0],r[1],r[2])}function Ai(r,e,i){var s=new ft(3);return s[0]=r,s[1]=e,s[2]=i,s}function xr(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function Cr(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r}function ps(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r}function fs(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 qn(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 Xi(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function In(r,e,i,s){return r[0]=e[0]+i[0]*s,r[1]=e[1]+i[1]*s,r[2]=e[2]+i[2]*s,r}function $n(r,e){var i=e[0]-r[0],s=e[1]-r[1],a=e[2]-r[2];return i*i+s*s+a*a}function Yo(r){var e=r[0],i=r[1],s=r[2];return e*e+i*i+s*s}function Ko(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function tr(r,e){var i=e[0],s=e[1],a=e[2],u=i*i+s*s+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 _r(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function Pr(r,e,i){var s=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-s*_,r[2]=s*f-a*h,r}function Ln(r,e,i,s){var a=e[0],u=e[1],h=e[2];return r[0]=a+s*(i[0]-a),r[1]=u+s*(i[1]-u),r[2]=h+s*(i[2]-h),r}function Gi(r,e,i){var s=e[0],a=e[1],u=e[2],h=i[3]*s+i[7]*a+i[11]*u+i[15];return r[0]=(i[0]*s+i[4]*a+i[8]*u+i[12])/(h=h||1),r[1]=(i[1]*s+i[5]*a+i[9]*u+i[13])/h,r[2]=(i[2]*s+i[6]*a+i[10]*u+i[14])/h,r}function Jo(r,e,i){var s=e[0],a=e[1],u=e[2];return r[0]=s*i[0]+a*i[3]+u*i[6],r[1]=s*i[1]+a*i[4]+u*i[7],r[2]=s*i[2]+a*i[5]+u*i[8],r}function ms(r,e,i){var s=i[0],a=i[1],u=i[2],h=e[0],f=e[1],_=e[2],g=a*_-u*f,v=u*h-s*_,b=s*f-a*h,w=a*b-u*v,E=u*g-s*b,A=s*v-a*g,P=2*i[3];return v*=P,b*=P,E*=2,A*=2,r[0]=h+(g*=P)+(w*=2),r[1]=f+v+E,r[2]=_+b+A,r}function Zn(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}var gr=Cr,Qo=ps,Os=Jr;function Qr(){var r=new ft(4);return ft!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function _o(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 Ya(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=i*i+s*s+a*a+u*u;return h>0&&(h=1/Math.sqrt(h)),r[0]=i*h,r[1]=s*h,r[2]=a*h,r[3]=u*h,r}function en(r,e,i){var s=e[0],a=e[1],u=e[2],h=e[3];return r[0]=i[0]*s+i[4]*a+i[8]*u+i[12]*h,r[1]=i[1]*s+i[5]*a+i[9]*u+i[13]*h,r[2]=i[2]*s+i[6]*a+i[10]*u+i[14]*h,r[3]=i[3]*s+i[7]*a+i[11]*u+i[15]*h,r}function _n(){var r=new ft(4);return ft!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Bs(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function Ns(r,e,i){i*=.5;var s=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=s*_+h*f,r[1]=a*_+u*f,r[2]=u*_-a*f,r[3]=h*_-s*f,r}function Vs(r,e,i){i*=.5;var s=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=s*_-u*f,r[1]=a*_+h*f,r[2]=u*_+s*f,r[3]=h*_-a*f,r}yr(),Qr();var tn,ea,ta,gn,Ka,_s=Ya,ia=(tn=yr(),ea=Ai(1,0,0),ta=Ai(0,1,0),function(r,e,i){var s=_r(e,i);return s<-.999999?(Pr(tn,ea,e),Os(tn)<1e-6&&Pr(tn,ta,e),tr(tn,tn),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,tn,Math.PI),r):s>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Pr(tn,e,i),r[0]=tn[0],r[1]=tn[1],r[2]=tn[2],r[3]=1+s,_s(r,r))});function $r(){var r=new ft(2);return ft!=Float32Array&&(r[0]=0,r[1]=0),r}function Fn(r,e){var i=new ft(2);return i[0]=r,i[1]=e,i}function go(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r}function Us(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r}function yo(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r}function js(r){return Math.hypot(r[0],r[1])}function ra(r,e){var i=e[0],s=e[1],a=i*i+s*s;return a>0&&(a=1/Math.sqrt(a)),r[0]=e[0]*a,r[1]=e[1]*a,r}function Yi(r,e){return r[0]*e[0]+r[1]*e[1]}function Gs(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}_n(),_n(),oi(),$r();var na,yn,Eu=function(){if(Ka)return gn;function r(e,i,s,a){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=a}return Ka=1,gn=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,a=0;a<8;a++){var u=this.sampleCurveX(s)-e;if(Math.abs(u)<i)return s;var h=this.sampleCurveDerivativeX(s);
1if(Math.abs(h)<1e-6)break;s-=u/h}var f=0,_=1;for(s=e,a=0;a<20&&(u=this.sampleCurveX(s),!(Math.abs(u-e)<i));a++)e>u?f=s:_=s,s=.5*(_-f)+f;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},gn}(),oc=Gs(Eu);function xo(){if(yn)return na;function r(e,i){this.x=e,this.y=i}return yn=1,na=r,r.prototype={clone:function(){return new r(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,i){return this.clone()._rotateAround(e,i)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var i=e.x-this.x,s=e.y-this.y;return i*i+s*s},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,i){return Math.atan2(this.x*i-this.y*e,this.x*e+this.y*i)},_matMult:function(e){var i=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=i,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var i=Math.cos(e),s=Math.sin(e),a=s*this.x+i*this.y;return this.x=i*this.x-s*this.y,this.y=a,this},_rotateAround:function(e,i){var s=Math.cos(e),a=Math.sin(e),u=i.y+a*(this.x-i.x)+s*(this.y-i.y);return this.x=i.x+s*(this.x-i.x)-a*(this.y-i.y),this.y=u,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(e){return e instanceof r?e:Array.isArray(e)?new r(e[0],e[1]):e},na}var He=Gs(xo());function gs(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(!gs(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(!gs(r[i],e[i]))return!1;return!0}return r===e}const Iu=Math.PI/180,Ja=180/Math.PI;function ni(r){return r*Iu}function xe(r){return r*Ja}const O=[[0,0],[1,0],[1,1],[0,1]];function U(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 X(r,e,i,s){const a=new oc(r,e,i,s);return function(u){return a.solve(u)}}const se=X(.25,.1,.25,1);function Q(r,e,i){return Math.min(i,Math.max(e,r))}function ce(r,e,i){return(i=Q((i-r)/(e-r),0,1))*i*(3-2*i)}function _e(r,e,i){const s=i-e,a=((r-e)%s+s)%s+e;return a===e?i:a}function ue(r,e,i){if(!r.length)return i(null,[]);let s=r.length;const a=new Array(r.length);let u=null;r.forEach((h,f)=>{e(h,(_,g)=>{_&&(u=_),a[f]=g,--s==0&&i(u,a)})})}function ge(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}let Re=1;function ve(){return Re++}function Ze(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function at(r,e){r.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function ct(r,e,i){const s={};for(const a in r)s[a]=e.call(this,r[a],a,r);return s}function At(r,e,i){const s={};for(const a in r)e.call(this,r[a],a,r)&&(s[a]=r[a]);return s}function Ct(r){return Array.isArray(r)?r.map(Ct):typeof r=="object"&&r?ct(r,Ct):r}function zt(r,e){for(let i=0;i<r.length;i++)if(e.indexOf(r[i])>=0)return!0;return!1}const Ht={};function kt(r){Ht[r]||(typeof console<"u"&&console.warn(r),Ht[r]=!0)}function Ii(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function qi(r){let e=0;for(let i,s,a=0,u=r.length,h=u-1;a<u;h=a++)i=r[a],s=r[h],e+=(s.x-i.x)*(i.y+s.y);return e}function $i([r,e,i]){const s=ni(e+90),a=ni(i);return{x:r*Math.cos(s)*Math.sin(a),y:r*Math.sin(s)*Math.sin(a),z:r*Math.cos(a),azimuthal:e,polar:i}}function _i(r){return(typeof self<"u"||r!==void 0)&&typeof WorkerGlobalScope<"u"&&(r!==void 0?r:self)instanceof WorkerGlobalScope}function ai(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,s,a,u)=>{const h=a||u;return e[s]=!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 cr=null;function ir(r,e){return[r[4*e],r[4*e+1],r[4*e+2],r[4*e+3]]}function Ki(r,e,i,s){for(;e<i;){const a=e+i>>1;r[a]<s?e=a+1:i=a}return e}function Rr(r,e,i,s){for(;e<i;){const a=e+i>>1;r[a]<=s?e=a+1:i=a}return e}function un(r){return r>0?1/(1.001-r):1+r}function Zr(r){return r>0?1-1/(1.001-r):-r}function Qa(r,e,i){return(r-e.min)*(i.max-i.min)/(e.max-e.min)+i.min}const kr={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(!kr.API_URL)return null;
1try{const r=new URL(kr.API_URL);return r.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":r.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v0.3.0.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function qs(r){return kr.API_URL_REGEX.test(r)}function ac(r){return kr.API_SPRITE_REGEX.test(r)}let el,tl,lc,cc,vo,il;function uc(){return el==null&&(el=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),el}const Hn={now:()=>cc!==void 0?cc:performance.now(),setNow(r){cc=r},restoreNow(){cc=void 0},frame(r){const e=requestAnimationFrame(r);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(r,e=0){const{width:i,height:s}=r;vo||(vo=document.createElement("canvas"));const a=vo.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return(i>vo.width||s>vo.height)&&(vo.width=i,vo.height=s),a.clearRect(-e,-e,i+2*e,s+2*e),a.drawImage(r,0,0,i,s),a.getImageData(-e,-e,i+2*e,s+2*e)},resolveURL:r=>(tl||(tl=document.createElement("a")),tl.href=r,tl.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(lc==null&&(lc=window.matchMedia("(prefers-reduced-motion: reduce)")),lc.matches)},hasCanvasFingerprintNoise(){if(il!==void 0)return il;if(!uc())return il=!1,!1;const r=new OffscreenCanvas(85,1),e=r.getContext("2d",{willReadFrequently:!0});let i=0;for(let a=0;a<r.width;++a)e.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,e.fillRect(a,0,1,1);const s=e.getImageData(0,0,r.width,r.height);i=0;for(let a=0;a<s.data.length;++a)if(a%4!=3&&i++!==s.data[a])return il=!0,!0;return il=!1,!1}};function An(r,e){const i=r.indexOf("?");if(i<0)return`${r}?${new URLSearchParams(e).toString()}`;
1const s=new URLSearchParams(r.slice(i));for(const a in e)s.set(a,e[a]);return`${r.slice(0,i)}?${s.toString()}`}function kn(r,e={persistentParams:[]}){const i=r.indexOf("?");if(i<0)return r;const s=new URLSearchParams,a=new URLSearchParams(r.slice(i));for(const h of e.persistentParams){const f=a.get(h);f&&s.set(h,f)}const u=s.toString();return`${r.slice(0,i)}${u.length>0?`?${u}`:""}`}const ys="mapbox-tiles";let Wn=500,xs=50;const rl=["language","worldview","jobid"];let ss,nl;function bo(){try{return caches}catch{}}function sa(){const r=bo();r&&ss==null&&(ss=r.open(ys))}let Au=1/0;const Mu={supported:!1,testSupport:function(r){!sl&&wo&&(oa?yd(r):hn=r)}};let hn,wo,sl=!1,oa=!1;const gd=typeof self<"u"?self:{};function yd(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,wo),r.isContextLost())return;Mu.supported=!0}catch{}r.deleteTexture(e),sl=!0}gd.document&&(wo=gd.document.createElement("img"),wo.onload=function(){hn&&yd(hn),hn=null,oa=!0},wo.onerror=function(){sl=!0,hn=null},wo.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const ol={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(ol);class ti extends Error{constructor(e,i,s){i===401&&qs(s)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=s}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const hc=_i()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,aa=function(r,e){if(!(/^file:/.test(i=r.url)||/^file:/.test(hc())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(s,a){const u=new AbortController,h=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,referrer:hc(),referrerPolicy:s.referrerPolicy,signal:u.signal});let f=!1,_=!1;const g=(v=h.url).indexOf("sku=")>0&&qs(v);var v;s.type==="json"&&h.headers.set("Accept","application/json");const b=(E,A,P)=>{if(_)return;if(E&&E.message!=="SecurityError"&&kt(E.toString()),A&&P)return w(A);const D=Date.now();fetch(h).then(k=>{if(k.ok){const j=g?k.clone():null;return w(k,j,D)}return a(new ti(k.statusText,k.status,s.url))}).catch(k=>{k.name!=="AbortError"&&a(new Error(`${k.message} ${s.url}`))})},w=(E,A,P)=>{(s.type==="arrayBuffer"?E.arrayBuffer():s.type==="json"?E.json():E.text()).then(D=>{_||(A&&P&&function(k,j,G){if(sa(),ss==null)return;const z=ai(j.headers.get("Cache-Control")||"");if(z["no-store"])return;const N={status:j.status,statusText:j.statusText,headers:new Headers};j.headers.forEach((oe,re)=>N.headers.set(re,oe)),z["max-age"]&&N.headers.set("Expires",new Date(G+1e3*z["max-age"]).toUTCString());const q=N.headers.get("Expires");if(!q||new Date(q).getTime()-G<42e4)return;
1let H=kn(k.url,{persistentParams:rl});if(j.status===206){const oe=k.headers.get("Range");if(!oe)return;N.status=200,H=An(H,{range:oe})}(function(oe,re){if(nl===void 0)try{new Response(new ReadableStream),nl=!0}catch{nl=!1}nl?re(oe.body):oe.blob().then(re).catch(ae=>kt(ae.message))})(j,oe=>{const re=new Response((ae=j.status)!==200&&ae!==404&&[101,103,204,205,304].includes(ae)?null:oe,N);var ae;sa(),ss!=null&&ss.then(he=>he.put(H,re)).catch(he=>kt(he.message))})}(h,A,P),f=!0,a(null,D,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(D=>{_||a(new Error(D.message))})};return g?function(E,A){if(sa(),ss==null)return A(null);ss.then(P=>{let D=kn(E.url,{persistentParams:rl});const k=E.headers.get("Range");k&&(D=An(D,{range:k})),P.match(D).then(j=>{const G=function(z){if(!z)return!1;const N=new Date(z.headers.get("Expires")||0),q=ai(z.headers.get("Cache-Control")||"");return Number(N)>Date.now()&&!q["no-cache"]}(j);P.delete(D).catch(A),G&&P.put(D,j.clone()).catch(A),A(null,j,G)}).catch(A)}).catch(A)}(h,b):b(null,null),{cancel:()=>{_=!0,f||u.abort()}}}(r,e);if(_i(self)&&self.worker.actor)return self.worker.actor.send("getResource",r,e,void 0,!0)}var i;return function(s,a){const u=new XMLHttpRequest;u.open(s.method||"GET",s.url,!0),s.type==="arrayBuffer"&&(u.responseType="arraybuffer");for(const h in s.headers)u.setRequestHeader(h,s.headers[h]);return s.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=s.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(s.type==="json")try{h=JSON.parse(u.response)}catch(f){return a(f)}a(null,h,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else a(new ti(u.statusText,u.status,s.url))},u.send(s.body),{cancel:()=>u.abort()}}(r,e)},al=function(r,e){return aa(ge(r,{type:"arrayBuffer"}),e)};function yf(r){const e=document.createElement("a");return e.href=r,e.protocol===location.protocol&&e.host===location.host}const ll="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let To,$s;To=[],$s=0;const Cu=function(r,e){if(Mu.supported&&(r.headers||(r.headers={}),r.headers.accept="image/webp,*/*"),$s>=kr.MAX_PARALLEL_IMAGE_REQUESTS){const u={requestParameters:r,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return To.push(u),u}$s++;let i=!1;const s=()=>
1{if(!i)for(i=!0,$s--;To.length&&$s<kr.MAX_PARALLEL_IMAGE_REQUESTS;){const u=To.shift(),{requestParameters:h,callback:f,cancelled:_}=u;_||(u.cancel=Cu(h,f).cancel)}},a=al(r,(u,h,f,_)=>{s(),u?e(u):h&&(self.createImageBitmap?function(g,v){const b=new Blob([new Uint8Array(g)],{type:"image/png"});createImageBitmap(b).then(w=>{v(null,w)}).catch(w=>{v(new Error(`Could not load image because of ${w.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(h,(g,v)=>e(g,v,f,_)):function(g,v){const b=new Image;b.onload=()=>{v(null,b),URL.revokeObjectURL(b.src),b.onload=null,requestAnimationFrame(()=>{b.src=ll})},b.onerror=()=>v(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const w=new Blob([new Uint8Array(g)],{type:"image/png"});b.src=g.byteLength?URL.createObjectURL(w):ll}(h,(g,v)=>e(g,v,f,_)))});return{cancel:()=>{a.cancel(),s()}}};var Pu,So,xd,vs={exports:{}},dc={exports:{}},pc={exports:{}},Xn=function(){if(xd)return vs.exports;xd=1;var r=(Pu||(Pu=1,dc.exports=function(i,s){var a,u,h,f,_,g,v,b;for(u=i.length-(a=3&i.length),h=s,_=3432918353,g=461845907,b=0;b<u;)v=255&i.charCodeAt(b)|(255&i.charCodeAt(++b))<<8|(255&i.charCodeAt(++b))<<16|(255&i.charCodeAt(++b))<<24,++b,h=27492+(65535&(f=5*(65535&(h=(h^=v=(65535&(v=(v=(65535&v)*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*g+(((v>>>16)*g&65535)<<16)&4294967295)<<13|h>>>19))+((5*(h>>>16)&65535)<<16)&4294967295))+((58964+(f>>>16)&65535)<<16);switch(v=0,a){case 3:v^=(255&i.charCodeAt(b+2))<<16;case 2:v^=(255&i.charCodeAt(b+1))<<8;case 1:h^=v=(65535&(v=(v=(65535&(v^=255&i.charCodeAt(b)))*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*g+(((v>>>16)*g&65535)<<16)&4294967295}return h^=i.length,h=2246822507*(65535&(h^=h>>>16))+((2246822507*(h>>>16)&65535)<<16)&4294967295,h=3266489909*(65535&(h^=h>>>13))+((3266489909*(h>>>16)&65535)<<16)&4294967295,(h^=h>>>16)>>>0}),dc.exports),e=(So||(So=1,pc.exports=function(i,s){for(var a,u=i.length,h=s^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}
1),pc.exports);return vs.exports=r,vs.exports.murmur3=r,vs.exports.murmur2=e,vs.exports}(),cl=Gs(Xn);class Eo{constructor(e,...i){ge(this,i[0]||{}),this.type=e}}class fc extends Eo{constructor(e,i={}){super("error",ge({error:e},i))}}function zu(r,e,i){i[r]&&i[r].indexOf(e)!==-1||(i[r]=i[r]||[],i[r].push(e))}function mc(r,e,i){if(i&&i[r]){const s=i[r].indexOf(e);s!==-1&&i[r].splice(s,1)}}class Io{on(e,i){return this._listeners=this._listeners||{},zu(e,i,this._listeners),this}off(e,i){return mc(e,i,this._listeners),mc(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},zu(e,i,this._oneTimeListeners),this):new Promise(s=>{this.once(e,s)})}fire(e,i){const s=typeof e=="string"?new Eo(e,i):e,a=s.type;if(this.listens(a)){s.target=this;const u=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const _ of u)_.call(this,s);const h=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const _ of h)mc(a,_,this._oneTimeListeners),_.call(this,s);const f=this._eventedParent;f&&(ge(s,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),f.fire(s))}else s instanceof fc&&console.error(s.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}class xn{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new xn(e)}static toString(e){return e.iconsetId?`${e.name}�${e.iconsetId}`:e.name}static parse(e){const[i,s]=e.split("�");return new xn({name:i,iconsetId:s})}static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return xn.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var Ru,la={},Ao=function(){if(Ru)return la;Ru=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 s(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{la.parseCSSColor=function(u){var h,f=u.replace(/ /g,"").toLowerCase();if(f in r)return r[f].slice();if(f[0]==="#")return f.length===4?(h=parseInt(f.substr(1),16))>=0&&h<=4095?[(3840&h)>>4|(3840&h)>>8,240&h|(240&h)>>4,15&h|(15&h)<<4,1]:null:f.length===7&&(h=parseInt(f.substr(1),16))>=0&&h<=16777215?[(16711680&h)>>16,(65280&h)>>8,255&h,1]:null;var _=f.indexOf("("),g=f.indexOf(")");if(_!==-1&&g+1===f.length){var v=f.substr(0,_),b=f.substr(_+1,g-(_+1)).split(","),w=1;switch(v){case"rgba":if(b.length!==4)return null;w=s(b.pop());case"rgb":return b.length!==3?null:[i(b[0]),i(b[1]),i(b[2]),w];case"hsla":if(b.length!==4)return null;w=s(b.pop());case"hsl":if(b.length!==3)return null;var E=(parseFloat(b[0])%360+360)%360/360,A=s(b[1]),P=s(b[2]),D=P<=.5?P*(A+1):P+A-P*A,k=2*P-D;return[e(255*a(k,D,E+1/3)),e(255*a(k,D,E)),e(255*a(k,D,E-1/3)),w];default:return null}}return null}}catch{}return la}();class hi{constructor(e,i,s,a=1){this.r=e,this.g=i,this.b=s,this.a=a}static parse(e){if(!e)return;if(e instanceof hi)return e;if(typeof e!="string")return;const i=Ao.parseCSSColor(e);return i?new hi(i[0]/255,i[1]/255,i[2]/255,i[3]):void 0}toString(){const[e,i,s,a]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*s)},${a})`}toNonPremultipliedRenderColor(e){const{r:i,g:s,b:a,a:u}=this;return new xf(e,i,s,a,u)}toPremultipliedRenderColor(e){const{r:i,g:s,b:a,a:u}=this;return new Du(e,i*u,s*u,a*u,u)}clone(){return new hi(this.r,this.g,this.b,this.a)}}class Yn{constructor(e,i,s,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),s=u===0?0:s/u*(f-1),a=u===0?0:a/u*(f-1)):(i*=f-1,s*=f-1,a*=f-1);const g=Math.floor(i),v=Math.floor(s),b=Math.floor(a),w=Math.ceil(i),E=Math.ceil(s),A=Math.ceil(a),P=i-g,D=s-v,k=a-b,j=e.image.data,G=4*(g+v*_+b*f),z=4*(g+v*_+A*f),N=4*(g+E*_+b*f),q=4*(g+E*_+A*f),H=4*(w+v*_+b*f),oe=4*(w+v*_+A*f),re=4*(w+E*_+b*f),ae=4*(w+E*_+A*f);if(G<0||ae>=j.length)throw new Error("out of range");this.r=Tt(Tt(Tt(j[G],j[z],k),Tt(j[N],j[q],k),D),Tt(Tt(j[H],j[oe],k),Tt(j[re],j[ae],k),D),P)/255*(this.premultiplied?u:1),this.g=Tt(Tt(Tt(j[G+1],j[z+1],k),Tt(j[N+1],j[q+1],k),D),Tt(Tt(j[H+1],j[oe+1],k),Tt(j[re+1],j[ae+1],k),D),P)/255*(this.premultiplied?u:1),this.b=Tt(Tt(Tt(j[G+2],j[z+2],k),Tt(j[N+2],j[q+2],k),D),Tt(Tt(j[H+2],j[oe+2],k),Tt(j[re+2],j[ae+2],k),D),P)/255*(this.premultiplied?u:1),this.a=u}else this.r=i,this.g=s,this.b=a,this.a=u}toArray(){const{r:e,g:i,b:s,a}=this;return[255*e,255*i,255*s,a]}toHslaArray(){let{r:e,g:i,b:s,a}=this;if(this.premultiplied){if(a===0)return[0,0,0,0];e/=a,i/=a,s/=a}const u=Math.min(Math.max(e,0),1),h=Math.min(Math.max(i,0),1),f=Math.min(Math.max(s,0),1),_=Math.min(u,h,f),g=Math.max(u,h,f),v=(_+g)/2;if(_===g)return[0,0,100*v,a];const b=g-_,w=v>.5?b/(2-g-_):b/(g+_);let E=0;return g===u?E=(h-f)/b+(h<f?6:0):g===h?E=(f-u)/b+2:g===f&&(E=(u-h)/b+4),E*=60,[Math.min(Math.max(E,0),360),Math.min(Math.max(100*w,0),100),Math.min(Math.max(100*v,0),100),a]}toArray01(){const{r:e,g:i,b:s,a}=this;return[e,i,s,a]}toArray01Scaled(e){const{r:i,g:s,b:a}=this;return[i*e,s*e,a*e]}toArray01Linear(){const{r:e,g:i,b:s,a}=this;return[Math.pow(e,2.2),Math.pow(i,2.2),Math.pow(s,2.2),a]}}class xf extends Yn{constructor(e,i,s,a,u){super(e,i,s,a,u,!1)}}class Du extends Yn{constructor(e,i,s,a,u){super(e,i,s,a,u,!0)}}function Tt(r,e,i){return r*(1-i)+e*i}function _c(r,e,i){return r.map((s,a)=>Tt(s,e[a],i))}hi.black=new hi(0,0,0,1),hi.white=new hi(1,1,1,1),hi.transparent=new hi(0,0,0,0),hi.red=new hi(1,0,0,1),hi.blue=new hi(0,0,1,1);var ul=Object.freeze({__proto__:null,array:_c,color:function(r,e,i){return new hi(Tt(r.r,e.r,i),Tt(r.g,e.g,i),Tt(r.b,e.b,i),Tt(r.a,e.a,i))},number:Tt});function Mo(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}class Mn extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class Lu{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[s,a]of i)this.bindings[s]=a}concat(e){return new Lu(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 ca={kind:"null"},dt={kind:"number"},vi={kind:"string"},ci={kind:"boolean"},vn={kind:"color"},bs={kind:"object"},di={kind:"value"},gc={kind:"collator"},hl={kind:"formatted"},dl={kind:"resolvedImage"};function rn(r,e){return{kind:"array",itemType:r,N:e}}function Sr(r){if(r.kind==="array"){const e=Sr(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const vf=[ca,dt,vi,ci,vn,hl,bs,rn(di),dl];function ua(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!ua(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 vf)if(!ua(i,e))return null}}return`Expected ${Sr(r)} but found ${Sr(e)} instead.`}function Zs(r,e){return e.some(i=>i.kind===r.kind)}function pl(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 yc(r,e){return r.kind==="array"&&e.kind==="array"?r.N===e.N&&yc(r.itemType,e.itemType):r.kind===e.kind}class fl{constructor(e,i,s){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class xc{constructor(e,i,s,a,u){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=s,this.fontStack=a,this.textColor=u}}class nn{constructor(e){this.sections=e}static fromString(e){return new nn([new xc(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 nn?e:nn.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const i of this.sections){if(i.image){const a=i.image.getPrimary().id.toString();e.push(["image",a]);continue}e.push(i.text);const s={};i.fontStack&&(s["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(s["font-scale"]=i.scale),i.textColor&&(s["text-color"]=["rgba"].concat(i.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(s)}return e}}class ws{constructor(e,i={}){if(this.id=xn.from(e),this.options=Object.assign({},i),i.transform){const{a:s,b:a,c:u,d:h,e:f,f:_}=i.transform;this.options.transform=new DOMMatrix([s,a,u,h,f,_])}else this.options.transform=new DOMMatrix([1,0,0,1,0,0])}toString(){const{a:e,b:i,c:s,d:a,e:u,f:h}=this.options.transform;return JSON.stringify({name:this.id.name,iconsetId:this.id.iconsetId,params:this.options.params,transform:{a:e,b:i,c:s,d:a,e:u,f:h}})}static parse(e){let i,s,a,u;
vendor: 12,987 bytes, line 1
1try{({name:i,iconsetId:s,params:a,transform:u}=JSON.parse(e)||{})}catch{return null}if(!i)return null;const{a:h,b:f,c:_,d:g,e:v,f:b}=u||{};return new ws({name:i,iconsetId:s},{params:a,transform:new DOMMatrix([h,f,_,g,v,b])})}scaleSelf(e,i){return this.options.transform.scaleSelf(e,i),this}}class dn{constructor(e,i,s,a,u=!1){this.primaryId=xn.from(e),this.primaryOptions=i,s&&(this.secondaryId=xn.from(s)),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 ws(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new ws(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e=="string"?dn.build({name:e}):e}static build(e,i,s,a){return!e||typeof e=="object"&&!("name"in e)?null:new dn(e,s,i,a)}}function Co(r,e,i,s){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[r,e,i,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[r,e,i,s]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function qt(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof hi||r instanceof fl||r instanceof nn||r instanceof dn)return!0;if(Array.isArray(r)){for(const e of r)if(!qt(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!qt(r[e]))return!1;return!0}return!1}function et(r){if(r===null)return ca;if(typeof r=="string")return vi;if(typeof r=="boolean")return ci;if(typeof r=="number")return dt;if(r instanceof hi)return vn;if(r instanceof fl)return gc;if(r instanceof nn)return hl;if(r instanceof dn)return dl;if(Array.isArray(r)){const e=r.length;let i;for(const s of r){const a=et(s);if(i){if(i===a)continue;i=di;break}i=a}return rn(i||di,e)}return bs}function On(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof nn||r instanceof dn||r instanceof hi?r.toString():JSON.stringify(r)}class Mt{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(!qt(e[1]))return i.error("invalid value");const s=e[1];let a=et(s);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 Mt(a,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof hi?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof nn?this.value.serialize():this.value}}class vr{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const ml={string:vi,number:dt,boolean:ci,object:bs};class bt{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let s,a=1;const u=e[0];if(u==="array"){let f,_;if(e.length>2){const g=e[1];if(typeof g!="string"||!(g in ml)||g==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);f=ml[g],a++}else f=di;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);_=e[2],a++}s=rn(f,_)}else s=ml[u];const h=[];for(;a<e.length;a++){const f=i.parse(e[a],a,di);if(!f)return null;h.push(f)}return new bt(s,h)}evaluate(e){for(let i=0;i<this.args.length;i++){const s=this.args[i].evaluate(e);if(!ua(this.type,et(s)))return s;if(i===this.args.length-1)throw new vr(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${Sr(et(s))} but was expected to be of type ${Sr(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,i=[e.kind];if(e.kind==="array"){const s=e.itemType;if(s.kind==="string"||s.kind==="number"||s.kind==="boolean"){i.push(s.kind);const a=e.N;(typeof a=="number"||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map(s=>s.serialize()))}}class ha{constructor(e){this.type=hl,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return i.error("First argument must be an image or text section.");const a=[];let 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",dt),!_))return null;let g=null;if(f["text-font"]&&(g=i.parseObjectValue(f["text-font"],h,"text-font",rn(vi)),!g))return null;let v=null;if(f["text-color"]&&(v=i.parseObjectValue(f["text-color"],h,"text-color",vn),!v))return null;const b=a[a.length-1];b.scale=_,b.font=g,b.textColor=v}else{const _=i.parse(e[h],h,di);if(!_)return null;const g=_.type.kind;if(g!=="string"&&g!=="value"&&g!=="null"&&g!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,a.push({content:_,scale:null,font:null,textColor:null})}}return new ha(a)}evaluate(e){return new nn(this.sections.map(i=>{const s=i.content.evaluate(e);return yc(et(s),dl)?new xc("",s,null,null,null):new xc(On(s),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const i of this.sections){e.push(i.content.serialize());const s={};i.scale&&(s["font-scale"]=i.scale.serialize()),i.font&&(s["text-font"]=i.font.serialize()),i.textColor&&(s["text-color"]=i.textColor.serialize()),e.push(s)}return e}}class da{constructor(e,i,s,a){this._imageWarnHistory={},this.type=dl,this.namePrimary=e,this.nameSecondary=i,s&&(this.paramsPrimary=s.params,this.iconsetIdPrimary=s.iconset?s.iconset.id:void 0),a&&(this.paramsSecondary=a.params,this.iconsetIdSecondary=a.iconset?a.iconset.id:void 0)}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let s=1;const a=[];function u(){if(s<e.length){const f=i.parse(e[s],s++,vi);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(s<e.length){const _=e[s];if((f=_)===null||typeof f!="object"||Array.isArray(f))return!0;const g=_.params,v=_.iconset,b=i.concat(s);if(!g&&!v)return s++,!0;if(g){if(typeof g!="object"||g.constructor!==Object)return b.error('Image options "params" should be an object'),!1;const w={},E=b.concat(void 0,"params");for(const A in g){if(!A)return E.error("Image parameter name should be non-empty"),!1;const P=E.concat(void 0,A).parse(g[A],void 0,vn,void 0,{typeAnnotation:"coerce"});if(!P)return!1;w[A]=P}a[a.length-1].options.params=w}if(v){if(typeof v!="object"||v.constructor!==Object)return b.error('Image options "iconset" should be an object'),!1;if(!v.id)return b.error('Image options "iconset" should have an "id" property'),!1;a[a.length-1].options.iconset=v}return s++,!0}var f;return!0}for(let f=0;f<2;f++)if(!u()||!h())return;return new da(a[0].image,a[1]?a[1].image:void 0,a[0].options,a[1]?a[1].options:void 0)}evaluateParams(e,i){const s={};if(i){for(const a in i)if(i[a])try{s[a]=i[a].evaluate(e)}catch{continue}if(Object.keys(s).length!==0)return{params:s}}}evaluate(e){const i={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},s=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,a=dn.build(i,s,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(a&&e.availableImages){const u=a.getPrimary().id;if(a.available=e.availableImages.some(h=>xn.isEqual(h,u)),a.available){const h=a.getSecondary()?a.getSecondary().id:null;h&&(a.available=e.availableImages.some(f=>xn.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 s={};if(i&&(s.iconset={id:i}),e){s.params={};for(const a in e)e[a]&&(s.params[a]=e[a].serialize())}return Object.keys(s).length>0?s:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const i=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);i&&e.push(i)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const i=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);i&&e.push(i)}return e}}function Hs(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}const vd={"to-boolean":ci,"to-color":vn,"to-number":dt,"to-string":vi};class Bn{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[0],a=[];let u=ca;if(s==="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=rn(i.expectedType.itemType,h)}else{if(!(h>0&&qt(e[1][0])))return null;u=rn(et(e[1][0]),h)}for(let f=0;f<h;f++){const _=e[1][f];let g;if(Hs(_)==="array")g=i.parse(_,void 0,u.itemType);else{const v=Hs(_);if(v!==u.itemType.kind)return i.error(`Expected ${u.itemType.kind} but found ${v}.`);g=i.registry.literal.parse(["literal",_===void 0?null:_],i)}if(!g)return null;a.push(g)}}else{if((s==="to-boolean"||s==="to-string")&&e.length!==2)return i.error("Expected one argument.");u=vd[s];for(let h=1;h<e.length;h++){const f=i.parse(e[h],h,di);if(!f)return null;a.push(f)}}return new Bn(u,a)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,s;for(const a of this.args){if(i=a.evaluate(e),s=null,i instanceof hi)return i;if(typeof i=="string"){const u=e.parseColor(i);if(u)return u}else if(Array.isArray(i)&&(s=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:Co(i[0],i[1],i[2],i[3]),!s))return new hi(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new vr(s||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const s of this.args){if(i=s.evaluate(e),i===null)return 0;const a=Number(i);if(!isNaN(a))return a}throw new vr(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?nn.fromString(On(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?dn.build(On(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):On(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 ha([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new da(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const sn=["Unknown","Point","LineString","Polygon"];class _l{constructor(e,i){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?sn[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:s,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(s*i-e[0])+this.featureDistanceData.bearing[1]*(a*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];
1return i||(i=this._parseColorCache[e]=hi.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class Dr{constructor(e,i,s,a,u){this.name=e,this.type=i,this._evaluate=s,this.args=a,this._overloadIndex=u}evaluate(e){if(!this._evaluate){const i=Dr.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,i){const s=e[0],a=Dr.definitions[s];if(!a)return i.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(a)?a[0]:a.type,h=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,f=[];let _=null,g=-1;for(const[v,b]of h){if(Array.isArray(v)&&v.length!==e.length-1)continue;f.push(v),g++,_=new zc(i.registry,i.path,null,i.scope,void 0,i._scope,i.options);const w=[];let E=!1;for(let A=1;A<e.length;A++){const P=e[A],D=Array.isArray(v)?v[A-1]:v.type,k=_.parse(P,1+w.length,D);if(!k){E=!0;break}w.push(k)}if(!E)if(Array.isArray(v)&&v.length!==w.length)_.error(`Expected ${v.length} arguments, but found ${w.length} instead.`);else{for(let A=0;A<w.length;A++){const P=Array.isArray(v)?v[A]:v.type,D=w[A];_.concat(A+1).checkSubtype(P,D.type)}if(_.errors.length===0)return new Dr(s,u,b,w,g)}}if(f.length===1)i.errors.push(..._.errors);else{const v=(f.length?f:h.map(([w])=>w)).map(Fu).join(" | "),b=[];for(let w=1;w<e.length;w++){const E=i.parse(e[w],1+b.length);if(!E)return null;b.push(Sr(E.type))}i.error(`Expected arguments of type ${v}, but found (${b.join(", ")}) instead.`)}return null}static register(e,i){Dr.definitions=i;for(const s in i)e[s]=Dr}}function Fu(r){return Array.isArray(r)?`(${r.map(Sr).join(", ")})`:`(${Sr(r.type)}...)`}class os{constructor(e,i,s){this.type=gc,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return i.error("Collator options argument must be an object.");const a=s["case-sensitive"]===void 0?i.parse(!1,1,ci):i.parseObjectValue(s["case-sensitive"],1,"case-sensitive",ci);if(!a)return null;const u=s["diacritic-sensitive"]===void 0?i.parse(!1,1,ci):i.parseObjectValue(s["diacritic-sensitive"],1,"diacritic-sensitive",ci);if(!u)return null;let h=null;return s.locale&&(h=i.parseObjectValue(s.locale,1,"locale",vi),!h)?null:new os(a,u,h)}evaluate(e){return new fl(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 Hr(r,e,i=0,s=r.length-1,a=bf){for(;s>i;){if(s-i>600){const _=s-i+1,g=e-i+1,v=Math.log(_),b=.5*Math.exp(2*v/3),w=.5*Math.sqrt(v*b*(_-b)/_)*(g-_/2<0?-1:1);Hr(r,e,Math.max(i,Math.floor(e-g*b/_+w)),Math.min(s,Math.floor(e+(_-g)*b/_+w)),a)}const u=r[e];let h=i,f=s;for(gl(r,i,e),a(r[s],u)>0&&gl(r,i,s);h<f;){for(gl(r,h,f),h++,f--;a(r[h],u)<0;)h++;for(;a(r[f],u)>0;)f--}a(r[i],u)===0?gl(r,i,f):(f++,gl(r,f,s)),f<=e&&(i=f+1),e<=f&&(s=f-1)}}function gl(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function bf(r,e){return r<e?-1:r>e?1:0}function wf(r){let e=0;for(let i,s,a=0,u=r.length,h=u-1;a<u;h=a++)i=r[a],s=r[h],e+=(s.x-i.x)*(i.y+s.y);return e}function Ws(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 pa(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function Po(r,e,i){const s=r[0]-e[0],a=r[1]-e[1],u=r[0]-i[0],h=r[1]-i[1];return s*h-u*a==0&&s*u<=0&&a*h<=0}function fa(r,e,i=!1){let s=!1;for(let f=0,_=e.length;f<_;f++){const g=e[f];for(let v=0,b=g.length,w=b-1;v<b;w=v++){const E=g[w],A=g[v];if(Po(r,E,A))return i;(u=E)[1]>(a=r)[1]!=(h=A)[1]>a[1]&&a[0]<(h[0]-u[0])*(a[1]-u[1])/(h[1]-u[1])+u[0]&&(s=!s)}}var a,u,h;return s}function bd(r,e,i,s){const a=s[0]-i[0],u=s[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 vc(r,e,i,s){return(a=[s[0]-i[0],s[1]-i[1]])[0]*(u=[e[0]-r[0],e[1]-r[1]])[1]-a[1]*u[0]!=0&&!(!bd(r,e,i,s)||!bd(i,s,r,e));var a,u}function ku(r){const e=new He(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new He(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const s of r[0])e.x>s.x&&(e.x=s.x),e.y>s.y&&(e.y=s.y),i.x<s.x&&(i.x=s.x),i.y<s.y&&(i.y=s.y);return{min:e,max:i}}const Ts=8192;function Tf(r,e){const i=(180+r[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,a=Math.pow(2,e.z);return[Math.round(i*a*Ts),Math.round(s*a*Ts)]}function Sf(r,e){for(let i=0;i<e.length;i++)if(fa(r,e[i]))return!0;return!1}function wd(r,e,i){for(const s of i)for(let a=0,u=s.length,h=u-1;a<u;h=a++)if(vc(r,e,s[h],s[a]))return!0;return!1}function Td(r,e){for(let i=0;i<r.length;++i)if(!fa(r[i],e))return!1;for(let i=0;i<r.length-1;++i)if(wd(r[i],r[i+1],e))return!1;return!0}function zo(r,e){for(let i=0;i<e.length;i++)if(Td(r,e[i]))return!0;return!1}function Ou(r,e,i){const s=[];for(let a=0;a<r.length;a++){const u=[];for(let h=0;h<r[a].length;h++){const f=Tf(r[a][h],i);Ws(e,f),u.push(f)}s.push(u)}return s}function Sd(r,e,i){const s=[];for(let a=0;a<r.length;a++){const u=Ou(r[a],e,i);s.push(u)}return s}function bc(r,e,i,s){if(r[0]<i[0]||r[0]>i[2]){const a=.5*s;let u=r[0]-i[0]>a?-s:i[0]-r[0]>a?s:0;u===0&&(u=r[0]-i[2]>a?-s:i[2]-r[0]>a?s:0),r[0]+=u}Ws(e,r)}
1function Bu(r,e,i,s){const a=Math.pow(2,s.z)*Ts,u=[s.x*Ts,s.y*Ts],h=[];if(!r)return h;for(const f of r)for(const _ of f){const g=[_.x+u[0],_.y+u[1]];bc(g,e,i,a),h.push(g)}return h}function Nu(r,e,i,s){const a=Math.pow(2,s.z)*Ts,u=[s.x*Ts,s.y*Ts],h=[];if(!r)return h;for(const _ of r){const g=[];for(const v of _){const b=[v.x+u[0],v.y+u[1]];Ws(e,b),g.push(b)}h.push(g)}if(e[2]-e[0]<=a/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const _ of h)for(const g of _)bc(g,e,i,a)}var f;return h}class Wr{constructor(e,i){this.type=ci,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(qt(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let a=0;a<s.features.length;++a){const u=s.features[a].geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new Wr(s,s.features[a].geometry)}else if(s.type==="Feature"){const a=s.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new Wr(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new Wr(s,s)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(i,s){const a=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(s.type==="Polygon"){const f=Ou(s.coordinates,u,h),_=Bu(i.geometry(),a,u,h);if(!pa(a,u))return!1;for(const g of _)if(!fa(g,f))return!1}if(s.type==="MultiPolygon"){const f=Sd(s.coordinates,u,h),_=Bu(i.geometry(),a,u,h);if(!pa(a,u))return!1;for(const g of _)if(!Sf(g,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(i,s){const a=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(s.type==="Polygon"){const f=Ou(s.coordinates,u,h),_=Nu(i.geometry(),a,u,h);if(!pa(a,u))return!1;for(const g of _)if(!Td(g,f))return!1}if(s.type==="MultiPolygon"){const f=Sd(s.coordinates,u,h),_=Nu(i.geometry(),a,u,h);if(!pa(a,u))return!1;for(const g of _)if(!zo(g,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const yl={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},Vu=1/298.257223563,Uu=Vu*(2-Vu),ma=Math.PI/180;class _a{static fromTile(e,i,s){const a=Math.PI*(1-2*(e+.5)/Math.pow(2,i)),u=Math.atan(.5*(Math.exp(a)-Math.exp(-a)))/ma;return new _a(u,s)}static get units(){return yl}constructor(e,i){if(e===void 0)throw new Error("No latitude given.");if(i&&!yl[i])throw new Error(`Unknown unit ${i}. Use one of: ${Object.keys(yl).join(", ")}`);const s=6378.137*ma*(i?yl[i]:1),a=Math.cos(e*ma),u=1/(1-Uu*(1-a*a)),h=Math.sqrt(u);this.kx=s*h*a,this.ky=s*h*u*(1-Uu)}distance(e,i){const s=Cn(e[0]-i[0])*this.kx,a=(e[1]-i[1])*this.ky;return Math.sqrt(s*s+a*a)}bearing(e,i){const s=Cn(i[0]-e[0])*this.kx;return Math.atan2(s,(i[1]-e[1])*this.ky)/ma}destination(e,i,s){const a=s*ma;return this.offset(e,Math.sin(a)*i,Math.cos(a)*i)}offset(e,i,s){return[e[0]+i/this.kx,e[1]+s/this.ky]}lineDistance(e){let i=0;for(let s=0;s<e.length-1;s++)i+=this.distance(e[s],e[s+1]);return i}area(e){let i=0;for(let s=0;s<e.length;s++){const a=e[s];for(let u=0,h=a.length,f=h-1;u<h;f=u++)i+=Cn(a[u][0]-a[f][0])*(a[u][1]+a[f][1])*(s?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let s=0;if(i<=0)return e[0];for(let a=0;a<e.length-1;a++){const u=e[a],h=e[a+1],f=this.distance(u,h);if(s+=f,s>i)return wc(u,h,(i-(s-f))/f)}return e[e.length-1]}pointToSegmentDistance(e,i,s){let[a,u]=i,h=Cn(s[0]-a)*this.kx,f=(s[1]-u)*this.ky;if(h!==0||f!==0){const _=(Cn(e[0]-a)*this.kx*h+(e[1]-u)*this.ky*f)/(h*h+f*f);_>1?(a=s[0],u=s[1]):_>0&&(a+=h/this.kx*_,u+=f/this.ky*_)}return h=Cn(e[0]-a)*this.kx,f=(e[1]-u)*this.ky,Math.sqrt(h*h+f*f)}pointOnLine(e,i){let s=1/0,a=e[0][0],u=e[0][1],h=0,f=0;for(let _=0;_<e.length-1;_++){let g=e[_][0],v=e[_][1],b=Cn(e[_+1][0]-g)*this.kx,w=(e[_+1][1]-v)*this.ky,E=0;b===0&&w===0||(E=(Cn(i[0]-g)*this.kx*b+(i[1]-v)*this.ky*w)/(b*b+w*w),E>
11?(g=e[_+1][0],v=e[_+1][1]):E>0&&(g+=b/this.kx*E,v+=w/this.ky*E)),b=Cn(i[0]-g)*this.kx,w=(i[1]-v)*this.ky;const A=b*b+w*w;A<s&&(s=A,a=g,u=v,h=_,f=E)}return{point:[a,u],index:h,t:Math.max(0,Math.min(1,f))}}lineSlice(e,i,s){let a=this.pointOnLine(s,e),u=this.pointOnLine(s,i);if(a.index>u.index||a.index===u.index&&a.t>u.t){const g=a;a=u,u=g}const h=[a.point],f=a.index+1,_=u.index;!ju(s[f],h[0])&&f<=_&&h.push(s[f]);for(let g=f+1;g<=_;g++)h.push(s[g]);return ju(s[_],u.point)||h.push(u.point),h}lineSliceAlong(e,i,s){let a=0;const u=[];for(let h=0;h<s.length-1;h++){const f=s[h],_=s[h+1],g=this.distance(f,_);if(a+=g,a>e&&u.length===0&&u.push(wc(f,_,(e-(a-g))/g)),a>=i)return u.push(wc(f,_,(i-(a-g))/g)),u;a>e&&u.push(_)}return u}bufferPoint(e,i){const s=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-s,e[0]+a,e[1]+s]}bufferBBox(e,i){const s=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-s,e[2]+a,e[3]+s]}insideBBox(e,i){return Cn(e[0]-i[0])>=0&&Cn(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function ju(r,e){return r[0]===e[0]&&r[1]===e[1]}function wc(r,e,i){const s=Cn(e[0]-r[0]);return[r[0]+s*i,r[1]+(e[1]-r[1])*i]}function Cn(r){for(;r<-180;)r+=360;for(;r>180;)r-=360;return r}class Tc{constructor(e=[],i=(s,a)=>s<a?-1:s>a?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:s}=this,a=i[e];for(;e>0;){const u=e-1>>1,h=i[u];if(s(a,h)>=0)break;i[e]=h,e=u}i[e]=a}_down(e){const{data:i,compare:s}=this,a=this.length>>1,u=i[e];for(;e<a;){let h=1+(e<<1);const f=h+1;if(f<this.length&&s(i[f],i[h])<0&&(h=f),s(i[h],u)>=0)break;i[e]=i[h],e=h}i[e]=u}}var We=8192;function Gu(r,e){return e.dist-r.dist}const ga=100,ya=50;function xl(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 vl(r){return r[1]-r[0]+1}function as(r,e){const i=r[1]>=r[0]&&r[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function Sc(r,e){if(r[0]>r[1])return[null,null];const i=vl(r);if(e){if(i===2)return[r,null];const s=Math.floor(i/2);return[[r[0],r[0]+s],[r[0]+s,r[1]]]}{if(i===1)return[r,null];const s=Math.floor(i/2)-1;return[[r[0],r[0]+s],[r[0]+s+1,r[1]]]}}function Nn(r,e){const i=[1/0,1/0,-1/0,-1/0];if(!as(e,r.length))return i;for(let s=e[0];s<=e[1];++s)Ws(i,r[s]);return i}function Jt(r){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<r.length;++i)for(let s=0;s<r[i].length;++s)Ws(e,r[i][s]);return e}function xa(r,e,i){if(xl(r)||xl(e))return NaN;let s=0,a=0;return r[2]<e[0]&&(s=e[0]-r[2]),r[0]>e[2]&&(s=r[0]-e[2]),r[1]>e[3]&&(a=r[1]-e[3]),r[3]<e[1]&&(a=e[1]-r[3]),i.distance([0,0],[s,a])}function Ef(r){return 360*r-180}function If(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Ec(r,e){const i=Math.pow(2,e.z),s=(r.y/We+e.y)/i;return[Ef((r.x/We+e.x)/i),If(s)]}function Af(r,e){const i=[];for(let s=0;s<r.length;++s)i.push(Ec(r[s],e));return i}function Ji(r,e,i){const s=i.pointOnLine(e,r).point;return i.distance(r,s)}function Ed(r,e,i,s,a){const u=i.slice(s[0],s[1]+1);let h=1/0;for(let f=e[0];f<=e[1];++f)if((h=Math.min(h,Ji(r[f],u,a)))===0)return 0;return h}function qu(r,e,i,s,a){const u=Math.min(a.pointToSegmentDistance(r,i,s),a.pointToSegmentDistance(e,i,s)),h=Math.min(a.pointToSegmentDistance(i,r,e),a.pointToSegmentDistance(s,r,e));return Math.min(u,h)}function Mf(r,e,i,s,a){if(!as(e,r.length)||!as(s,i.length))return NaN;let u=1/0;for(let h=e[0];h<e[1];++h)for(let f=s[0];f<s[1];++f){if(vc(r[h],r[h+1],i[f],i[f+1]))return 0;u=Math.min(u,qu(r[h],r[h+1],i[f],i[f+1],a))}return u}function Cf(r,e,i,s,a){if(!as(e,r.length)||!as(s,i.length))return NaN;let u=1/0;for(let h=e[0];h<=e[1];++h)for(let f=s[0];f<=s[1];++f)if((u=Math.min(u,a.distance(r[h],i[f])))===0)return u;return u}function Pf(r,e,i){if(fa(r,e,!0))return 0;let s=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]&&(s=Math.min(s,i.pointToSegmentDistance(r,a[u-1],a[0])))===0||(s=Math.min(s,Ji(r,a,i)))===0)return s}return s}function zf(r,e,i,s){if(!as(e,r.length))return NaN;for(let u=e[0];u<=e[1];++u)if(fa(r[u],i,!0))return 0;let a=1/0;for(let u=e[0];u<e[1];++u)for(const h of i)for(let f=0,_=h.length,g=_-1;f<_;g=f++){if(vc(r[u],r[u+1],h[g],h[f]))return 0;a=Math.min(a,qu(r[u],r[u+1],h[g],h[f],s))}return a}function Id(r,e){for(const i of r)for(let s=0;s<=i.length-1;++s)if(fa(i[s],e,!0))return!0;return!1}function Rf(r,e,i,s=1/0){const a=Jt(r),u=Jt(e);if(s!==1/0&&xa(a,u,i)>=s)return s;if(pa(a,u)){if(Id(r,e))return 0}else if(Id(e,r))return 0;let h=s;for(const f of r)for(let _=0,g=f.length,v=g-1;_<g;v=_++)for(const b of e)for(let w=0,E=b.length,A=E-1;w<E;A=w++){if(vc(f[v],f[_],b[A],b[w]))return 0;h=Math.min(h,qu(f[v],f[_],b[A],b[w],i))}return h}function Ic(r,e,i,s,a,u,h){if(u===null||h===null)return;const f=xa(Nn(s,u),Nn(a,h),i);f<e&&r.push({dist:f,range1:u,range2:h})}function Df(r,e,i,s,a=1/0){let u=Math.min(s.distance(r[0],i[0][0]),a);if(u===0)return u;const h=new Tc([{dist:0,range1:[0,r.length-1],range2:[0,0]}],Gu),f=e?ya:ga,_=Jt(i);for(;h.length;){const g=h.pop();if(g.dist>=u)continue;const v=g.range1;if(vl(v)<=f){if(!as(v,r.length))return NaN;if(e){const b=zf(r,v,i,s);if((u=Math.min(u,b))===0)return u}else for(let b=v[0];b<=v[1];++b){const w=Pf(r[b],i,s);if((u=Math.min(u,w))===0)return u}}else{const b=Sc(v,e);if(b[0]!==null){const w=xa(Nn(r,b[0]),_,s);w<u&&h.push({dist:w,range1:b[0],range2:[0,0]})}if(b[1]!==null){const w=xa(Nn(r,b[1]),_,s);w<u&&h.push({dist:w,range1:b[1],range2:[0,0]})}}}return u}function Ad(r,e,i,s,a,u=1/0){let h=Math.min(u,a.distance(r[0],i[0]));if(h===0)return h;const f=new Tc([{dist:0,range1:[0,r.length-1],range2:[0,i.length-1]}],Gu),_=e?ya:ga,g=s?ya:ga;for(;f.length;){const v=f.pop();if(v.dist>=h)continue;const b=v.range1,w=v.range2;if(vl(b)<=_&&vl(w)<=g){if(!as(b,r.length)||!as(w,i.length))return NaN;if(e&&s?h=Math.min(h,Mf(r,b,i,w,a)):e||s?e&&!s?h=Math.min(h,Ed(i,w,r,b,a)):!e&&s&&(h=Math.min(h,Ed(r,b,i,w,a))):h=Math.min(h,Cf(r,b,i,w,a)),h===0)return h}else{const E=Sc(b,e),A=Sc(w,s);Ic(f,h,a,r,i,E[0],A[0]),Ic(f,h,a,r,i,E[0],A[1]),Ic(f,h,a,r,i,E[1],A[0]),Ic(f,h,a,r,i,E[1],A[1])}}return h}function $u(r,e,i,s,a=1/0){let u=a;const h=Nn(r,[0,r.length-1]);for(const f of i)if(!(u!==1/0&&xa(h,Nn(f,[0,f.length-1]),s)>=u)&&(u=Math.min(u,Ad(r,e,f,!0,s,u)),u===0))return u;return u}function Ac(r,e,i,s,a=1/0){let u=a;const h=Nn(r,[0,r.length-1]);for(const f of i){if(u!==1/0&&xa(h,Jt(f),s)>=u)continue;const _=Df(r,e,f,s,u);if(isNaN(_))return _;if((u=Math.min(u,_))===0)return u}return u}function Zu(r){return r==="Point"||r==="MultiPoint"||r==="LineString"||r==="MultiLineString"||r==="Polygon"||r==="MultiPolygon"}class Ro{constructor(e,i){this.type=dt,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(qt(e[1])){const s=e[1];if(s.type==="FeatureCollection"){for(let a=0;a<s.features.length;++a)if(Zu(s.features[a].geometry.type))return new Ro(s,s.features[a].geometry)}else if(s.type==="Feature"){if(Zu(s.geometry.type))return new Ro(s,s.geometry)}else if(Zu(s.type))return new Ro(s,s)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),s=e.canonicalID();if(i!=null&&s!=null){if(e.geometryType()==="Point")return function(a,u,h){const f=[];for(const g of a)for(const v of g)f.push(Ec(v,u));const _=new _a(f[0][1],"meters");return h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString"?Ad(f,!1,h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",_):h.type==="MultiLineString"?$u(f,!1,h.coordinates,_):h.type==="Polygon"||h.type==="MultiPolygon"?Ac(f,!1,h.type==="Polygon"?[h.coordinates]:h.coordinates,_):null}(i,s,this.geometries);if(e.geometryType()==="LineString")return function(a,u,h){const f=[];for(const g of a){const v=[];for(const b of g)v.push(Ec(b,u));f.push(v)}const _=new _a(f[0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return $u(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",f,_);if(h.type==="MultiLineString"){let g=1/0;for(let v=0;v<h.coordinates.length;v++){const b=$u(h.coordinates[v],!0,f,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}if(h.type==="Polygon"||h.type==="MultiPolygon"){let g=1/0;for(let v=0;v<f.length;v++){const b=Ac(f[v],!0,h.type==="Polygon"?[h.coordinates]:h.coordinates,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return null}(i,s,this.geometries);if(e.geometryType()==="Polygon")return function(a,u,h){const f=[];for(const g of function(v,b){const w=v.length;if(w<=1)return[v];const E=[];let A,P;for(let D=0;D<w;D++){const k=wf(v[D]);k!==0&&(v[D].area=Math.abs(k),P===void 0&&(P=k<0),P===k<0?(A&&E.push(A),A=[v[D]]):A.push(v[D]))}return A&&E.push(A),E}(a)){const v=[];for(let b=0;b<g.length;++b)v.push(Af(g[b],u));f.push(v)}const _=new _a(f[0][0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return Ac(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",f,_);if(h.type==="MultiLineString"){let g=1/0;for(let v=0;v<h.coordinates.length;v++){const b=Ac(h.coordinates[v],!0,f,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return h.type==="Polygon"||h.type==="MultiPolygon"?function(g,v,b){let w=1/0;
1for(const E of g)for(const A of v){const P=Rf(E,A,b,w);if(isNaN(P))return P;if((w=Math.min(w,P))===0)return w}return w}(h.type==="Polygon"?[h.coordinates]:h.coordinates,f,_):null}(i,s,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function va(r){if(r instanceof Dr&&(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 Wr||r instanceof Ro)return!1;if(r instanceof wa)return r.featureConstant;let e=!0;return r.eachChild(i=>{e&&!va(i)&&(e=!1)}),e}function Mc(r){if(r instanceof Dr&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(i=>{e&&!Mc(i)&&(e=!1)}),e}function Cc(r){if(r instanceof wa)return new Set([r.key]);let e=new Set;return r.eachChild(i=>{e=new Set([...e,...Cc(i)])}),e}function ba(r,e){if(r instanceof Dr&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild(s=>{i&&!ba(s,e)&&(i=!1)}),i}function Md(r,e,i){return[r,e,i].filter(Boolean).join("�")}function Hu(r,e){switch(r){case"string":return On(e);case"number":return+e;case"boolean":return!!e;case"color":return hi.parse(e);case"formatted":return nn.fromString(On(e));case"resolvedImage":return dn.build(On(e))}return e}function Cd(r,e,i,s){return s!==void 0&&(r=s*Math.round(r/s)),e!==void 0&&r<e&&(r=e),i!==void 0&&r>i&&(r=i),r}class wa{constructor(e,i,s,a=!1){this.type=e,this.key=i,this.scope=s,this.featureConstant=a}static parse(e,i){let s=i.expectedType;if(s==null&&(s=di),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 Mt))return i.error("Key name of 'config' expression must be a string literal.");let u,h=!0;const f=On(a.value);if(e.length>=3){const _=i.parse(e[2],2);if(!(_ instanceof Mt))return i.error("Scope of 'config' expression must be a string literal.");u=On(_.value)}if(i.options){const _=Md(f,u,i._scope),g=i.options.get(_);g&&(h=va(g.value||g.default))}return new wa(s,f,u,h)}evaluate(e){const i=Md(this.key,this.scope,e.scope),s=e.getConfig(i);if(!s)return null;const{type:a,value:u,values:h,minValue:f,maxValue:_,stepValue:g}=s,v=s.default.evaluate(e);let b=v;if(u){const w=e.scope;e.scope=(w||"").split("�").slice(1).join("�"),b=u.evaluate(e),e.scope=w}return a&&(b=Hu(a,b)),b===void 0||f===void 0&&_===void 0&&g===void 0||(typeof b=="number"?b=Cd(b,f,_,g):Array.isArray(b)&&(b=b.map(w=>typeof w=="number"?Cd(w,f,_,g):w))),u!==void 0&&b!==void 0&&h&&!h.includes(b)&&(b=v,a&&(b=Hu(a,b))),(a&&a!==this.type||b!==void 0&&!yc(et(b),this.type))&&(b=Hu(this.type.kind,b)),b}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class Pc{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const s=e[1];return i.scope.has(s)?new Pc(s,i.scope.get(s)):i.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class zc{constructor(e,i=[],s,a=new Lu,u=[],h,f){this.registry=e,this.path=i,this.key=i.map(_=>typeof _=="string"?`['${_}']`:`[${_}]`).join(""),this.scope=a,this.errors=u,this.expectedType=s,this._scope=h,this.options=f}parse(e,i,s,a,u={}){return i||s?this.concat(i,null,s,a)._parse(e,u):this._parse(e,u)}parseObjectValue(e,i,s,a,u,h={}){return this.concat(i,s,a,u)._parse(e,h)}_parse(e,i){function s(a,u,h){return h==="assert"?new bt(u,[a]):h==="coerce"?new Bn(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=s(u,h,i.typeAnnotation||"coerce");else u=s(u,h,i.typeAnnotation||"assert")}if(!(u instanceof Mt)&&u.type.kind!=="resolvedImage"&&Wu(u)){const h=new _l(this._scope,this.options);try{u=new Mt(u.type,u.evaluate(h))}catch(f){return this.error(f.message),null}}return u}return Bn.parse(["to-array",e],this)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,s,a){let 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 zc(this.registry,u,s||null,h,this.errors,this._scope,this.options)}error(e,...i){const s=`${this.key}${i.map(a=>`[${a}]`).join("")}`;this.errors.push(new Mn(s,e))}checkSubtype(e,i){const s=ua(e,i);return s&&this.error(s),s}}function Wu(r){if(r instanceof Pc)return Wu(r.boundExpression);if(r instanceof Dr&&r.name==="error"||r instanceof os||r instanceof Wr||r instanceof Ro||r instanceof wa)return!1;const e=r instanceof Bn||r instanceof bt;let i=!0;return r.eachChild(s=>{i=e?i&&Wu(s):i&&s instanceof Mt}),!!i&&va(r)&&ba(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 Rc(r,e){const i=r.length-1;let s,a,u=0,h=i,f=0;for(;u<=h;)if(f=Math.floor((u+h)/2),s=r[f],a=r[f+1],s<=e){if(f===i||e<a)return f;u=f+1}else{if(!(s>e))throw new vr("Input is not a number.");h=f-1}return 0}class bl{constructor(e,i,s){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[a,u]of s)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 s=i.parse(e[1],1,dt);if(!s)return null;const a=[];let u=null;i.expectedType&&i.expectedType.kind!=="value"&&(u=i.expectedType);for(let h=1;h<e.length;h+=2){const f=h===1?-1/0:e[h],_=e[h+1],g=h,v=h+1;if(typeof f!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',g);if(a.length&&a[a.length-1][0]>=f)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',g);const b=i.parse(_,v,u);if(!b)return null;u=u||b.type,a.push([f,b])}return new bl(u,s,a)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return s[0].evaluate(e);const u=i.length;return a>=i[u-1]?s[u-1].evaluate(e):s[Rc(i,a)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}const Pd=.95047,zd=1.08883,Rd=4/29,Xs=6/29,Dd=3*Xs*Xs,Ld=Xs*Xs*Xs,Lf=Math.PI/180,Ff=180/Math.PI;function Xu(r){return r>Ld?Math.pow(r,1/3):r/Dd+Rd}function Dc(r){return r>Xs?r*r*r:Dd*(r-Rd)}function Lc(r){return 255*(r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)}function Ys(r){return(r/=255)<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Yu(r){const e=Ys(r.r),i=Ys(r.g),s=Ys(r.b),a=Xu((.4124564*e+.3575761*i+.1804375*s)/Pd),u=Xu((.2126729*e+.7151522*i+.072175*s)/1);return{l:116*u-16,a:500*(a-u),b:200*(u-Xu((.0193339*e+.119192*i+.9503041*s)/zd)),alpha:r.a}}function Ku(r){let e=(r.l+16)/116,i=isNaN(r.a)?e:e+r.a/500,s=isNaN(r.b)?e:e-r.b/200;return e=1*Dc(e),i=Pd*Dc(i),s=zd*Dc(s),new hi(Lc(3.2404542*i-1.5371385*e-.4985314*s),Lc(-.969266*i+1.8760108*e+.041556*s),Lc(.0556434*i-.2040259*e+1.0572252*s),r.alpha)}function kf(r,e,i){const s=e-r;return r+i*(s>180||s<-180?s-360*Math.round(s/360):s)}const Do={forward:Yu,reverse:Ku,interpolate:function(r,e,i){return{l:Tt(r.l,e.l,i),a:Tt(r.a,e.a,i),b:Tt(r.b,e.b,i),alpha:Tt(r.alpha,e.alpha,i)}}},Lo={forward:function(r){const{l:e,a:i,b:s}=Yu(r),a=Math.atan2(s,i)*Ff;return{h:a<0?a+360:a,c:Math.sqrt(i*i+s*s),l:e,alpha:r.a}},reverse:function(r){const e=r.h*Lf,i=r.c;return Ku({l:r.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:r.alpha})},interpolate:function(r,e,i){return{h:kf(r.h,e.h,i),c:Tt(r.c,e.c,i),l:Tt(r.l,e.l,i),alpha:Tt(r.alpha,e.alpha,i)}}};var Fd=Object.freeze({__proto__:null,hcl:Lo,lab:Do});class Pn{constructor(e,i,s,a,u){this.type=e,this.operator=i,this.interpolation=s,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,s,a){let u=0;if(e.name==="exponential")u=Fc(i,e.base,s,a);else if(e.name==="linear")u=Fc(i,1,s,a);else if(e.name==="cubic-bezier"){const h=e.controlPoints;u=new oc(h[0],h[1],h[2],h[3]).solve(Fc(i,1,s,a))}return u}static parse(e,i){let[s,a,u,...h]=e;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){const g=a[1];if(typeof g!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:g}}else{if(a[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{const g=a.slice(1);if(g.length!==4||g.some(v=>typeof v!="number"||v<0||v>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:g}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(u=i.parse(u,2,dt),!u)return null;const f=[];let _=null;s==="interpolate-hcl"||s==="interpolate-lab"?_=vn:i.expectedType&&i.expectedType.kind!=="value"&&(_=i.expectedType);for(let g=0;g<h.length;g+=2){const v=h[g],b=h[g+1],w=g+3,E=g+4;if(typeof v!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',w);if(f.length&&f[f.length-1][0]>=v)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',w);const A=i.parse(b,E,_);if(!A)return null;_=_||A.type,f.push([v,A])}return _.kind==="number"||_.kind==="color"||_.kind==="array"&&_.itemType.kind==="number"&&typeof _.N=="number"?new Pn(_,s,a,u,f):i.error(`Type ${Sr(_)} is not interpolatable.`)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return s[0].evaluate(e);const u=i.length;if(a>=i[u-1])return s[u-1].evaluate(e);const h=Rc(i,a),f=Pn.interpolationFactor(this.interpolation,a,i[h],i[h+1]),_=s[h].evaluate(e),g=s[h+1].evaluate(e);return this.operator==="interpolate"?ul[this.type.kind.toLowerCase()](_,g,f):this.operator==="interpolate-hcl"?Lo.reverse(Lo.interpolate(Lo.forward(_),Lo.forward(g),f)):Do.reverse(Do.interpolate(Do.forward(_),Do.forward(g),f))}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const i=[this.operator,e,this.input.serialize()];for(let s=0;s<this.labels.length;s++)i.push(this.labels[s],this.outputs[s].serialize());return i}}function Fc(r,e,i,s){const a=s-i,u=r-i;return a===0?0:e===1?u/a:(Math.pow(e,u)-1)/(Math.pow(e,a)-1)}class wl{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument.");let s=null;const a=i.expectedType;a&&a.kind!=="value"&&(s=a);const u=[];for(const f of e.slice(1)){const _=i.parse(f,1+u.length,s,void 0,{typeAnnotation:"omit"});if(!_)return null;s=s||_.type,u.push(_)}const h=a&&u.some(f=>ua(a,f.type));return new wl(h?di:s,u)}evaluate(e){let i,s=null,a=0;for(const u of this.args){if(a++,s=u.evaluate(e),s&&s instanceof dn&&!s.available&&(i||(i=s),s=null,a===this.args.length))return i;if(s!==null)break}return s}
1eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class kc{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let 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;s.push([h,f])}const a=i.parse(e[e.length-1],e.length-1,i.expectedType,s);return a?new kc(s,a):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,s]of this.bindings)e.push(i,s.serialize());return e.push(this.result.serialize()),e}}class Ju{constructor(e,i,s){this.type=e,this.index=i,this.input=s}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,dt),a=i.parse(e[2],2,rn(i.expectedType||di));return s&&a?new Ju(a.type.itemType,s,a):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new vr(`Array index out of bounds: ${i} < 0.`);if(i>=s.length)throw new vr(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i!==Math.floor(i))throw new vr(`Array index must be an integer, but found ${i} instead. Use at-interpolated to retrieve interpolated result with a fractional index.`);return s[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Qu{constructor(e,i,s){this.type=e,this.index=i,this.input=s}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,dt),a=i.parse(e[2],2,rn(i.expectedType||di));return s&&a?new Qu(a.type.itemType,s,a):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new vr(`Array index out of bounds: ${i} < 0.`);if(i>s.length-1)throw new vr(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i===Math.floor(i))return s[i];const a=Math.floor(i),u=Math.ceil(i),h=s[a],f=s[u];if(typeof h!="number"||typeof f!="number")throw new vr(`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 Oc{constructor(e,i){this.type=ci,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,di),a=i.parse(e[2],2,di);return s&&a?Zs(s.type,[ci,vi,dt,ca,di])?new Oc(s,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Sr(s.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(s==null)return!1;if(!pl(i,["boolean","string","number","null"]))throw new vr(`Expected first argument to be of type boolean, string, number or null, but found ${Sr(et(i))} instead.`);if(!pl(s,["string","array"]))throw new vr(`Expected second argument to be of type array or string, but found ${Sr(et(s))} instead.`);return s.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class Tl{constructor(e,i,s){this.type=dt,this.needle=e,this.haystack=i,this.fromIndex=s}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,di),a=i.parse(e[2],2,di);if(!s||!a)return null;if(!Zs(s.type,[ci,vi,dt,ca,di]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Sr(s.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,dt);return u?new Tl(s,a,u):null}return new Tl(s,a)}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!pl(i,["boolean","string","number","null"]))throw new vr(`Expected first argument to be of type boolean, string, number or null, but found ${Sr(et(i))} instead.`);if(!pl(s,["string","array"]))throw new vr(`Expected second argument to be of type array or string, but found ${Sr(et(s))} instead.`);if(this.fromIndex){const a=this.fromIndex.evaluate(e);return s.indexOf(i,a)}return s.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Ta{constructor(e,i,s,a,u,h){this.inputType=e,this.type=i,this.input=s,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 s,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const u={},h=[];for(let g=2;g<e.length-1;g+=2){let v=e[g];const b=e[g+1];Array.isArray(v)||(v=[v]);const w=i.concat(g);if(v.length===0)return w.error("Expected at least one branch label.");for(const A of v){if(typeof A!="number"&&typeof A!="string")return w.error("Branch labels must be numbers or strings.");if(typeof A=="number"&&Math.abs(A)>Number.MAX_SAFE_INTEGER)return w.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof A=="number"&&Math.floor(A)!==A)return w.error("Numeric branch labels must be integer values.");if(s){if(w.checkSubtype(s,et(A)))return null}else s=et(A);
1if(u[String(A)]!==void 0)return w.error("Branch labels must be unique.");u[String(A)]=h.length}const E=i.parse(b,g,a);if(!E)return null;a=a||E.type,h.push(E)}const f=i.parse(e[1],1,di);if(!f)return null;const _=i.parse(e[e.length-1],e.length-1,a);return _?f.type.kind!=="value"&&i.concat(1).checkSubtype(s,f.type)?null:new Ta(s,a,f,u,h,_):null}evaluate(e){const i=this.input.evaluate(e);return(yc(et(i),this.inputType)&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),s=[],a={};for(const h of i){const f=a[this.cases[h]];f===void 0?(a[this.cases[h]]=s.length,s.push([this.cases[h],[h]])):s[f][1].push(h)}const u=h=>this.inputType.kind==="number"?Number(h):h;for(const[h,f]of s)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 eh{constructor(e,i,s){this.type=e,this.branches=i,this.otherwise=s}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let s;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);const a=[];for(let h=1;h<e.length-1;h+=2){const f=i.parse(e[h],h,ci);if(!f)return null;const _=i.parse(e[h+1],h+1,s);if(!_)return null;a.push([f,_]),s=s||_.type}const u=i.parse(e[e.length-1],e.length-1,s);return u?new eh(s,a,u):null}evaluate(e){for(const[i,s]of this.branches)if(i.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,s]of this.branches)e(i),e(s);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class Sl{constructor(e,i,s,a){this.type=e,this.input=i,this.beginIndex=s,this.endIndex=a}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,di),a=i.parse(e[2],2,dt);if(!s||!a)return null;if(!Zs(s.type,[rn(di),vi,di]))return i.error(`Expected first argument to be of type array or string, but found ${Sr(s.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,dt);return u?new Sl(s.type,s,a,u):null}return new Sl(s.type,s,a)}evaluate(e){const i=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!pl(i,["string","array"]))throw new vr(`Expected first argument to be of type array or string, but found ${Sr(et(i))} instead.`);if(this.endIndex){const a=this.endIndex.evaluate(e);return i.slice(s,a)}return i.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function kd(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Od(r,e,i,s){return s.compare(e,i)===0}function Fo(r,e,i){const s=r!=="=="&&r!=="!=";return class Dv{constructor(u,h,f){this.type=ci,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,di);if(!_)return null;if(!kd(f,_.type))return h.concat(1).error(`"${f}" comparisons are not supported for type '${Sr(_.type)}'.`);let g=h.parse(u[2],2,di);if(!g)return null;if(!kd(f,g.type))return h.concat(2).error(`"${f}" comparisons are not supported for type '${Sr(g.type)}'.`);if(_.type.kind!==g.type.kind&&_.type.kind!=="value"&&g.type.kind!=="value")return h.error(`Cannot compare types '${Sr(_.type)}' and '${Sr(g.type)}'.`);s&&(_.type.kind==="value"&&g.type.kind!=="value"?_=new bt(g.type,[_]):_.type.kind!=="value"&&g.type.kind==="value"&&(g=ne
vendor: 14,247 bytes, line 1
1w bt(_.type,[g])));let v=null;if(u.length===4){if(_.type.kind!=="string"&&g.type.kind!=="string"&&_.type.kind!=="value"&&g.type.kind!=="value")return h.error("Cannot use collator to compare non-string types.");if(v=h.parse(u[3],3,gc),!v)return null}return new Dv(_,g,v)}evaluate(u){const h=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){const _=et(h),g=et(f);if(_.kind!==g.kind||_.kind!=="string"&&_.kind!=="number")throw new vr(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${_.kind}, ${g.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const _=et(h),g=et(f);if(_.kind!=="string"||g.kind!=="string")return e(u,h,f)}return this.collator?i(u,h,f,this.collator.evaluate(u)):e(u,h,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}serialize(){const u=[r];return this.eachChild(h=>{u.push(h.serialize())}),u}}}const Bd=Fo("==",function(r,e,i){return e===i},Od),Of=Fo("!=",function(r,e,i){return e!==i},function(r,e,i,s){return!Od(0,e,i,s)}),Bf=Fo("<",function(r,e,i){return e<i},function(r,e,i,s){return s.compare(e,i)<0}),Nf=Fo(">",function(r,e,i){return e>i},function(r,e,i,s){return s.compare(e,i)>0}),Bc=Fo("<=",function(r,e,i){return e<=i},function(r,e,i,s){return s.compare(e,i)<=0}),Vf=Fo(">=",function(r,e,i){return e>=i},function(r,e,i,s){return s.compare(e,i)>=0});class Nc{constructor(e,i,s,a,u,h){this.type=vi,this.number=e,this.locale=i,this.currency=s,this.unit=a,this.minFractionDigits=u,this.maxFractionDigits=h}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const s=i.parse(e[1],1,dt);if(!s)return null;const a=e[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let u=null;if(a.locale&&(u=i.parseObjectValue(a.locale,2,"locale",vi),!u))return null;let h=null;if(a.currency&&(h=i.parseObjectValue(a.currency,2,"currency",vi),!h))return null;let f=null;if(a.unit&&(f=i.parseObjectValue(a.unit,2,"unit",vi),!f))return null;let _=null;if(a["min-fraction-digits"]&&(_=i.parseObjectValue(a["min-fraction-digits"],2,"min-fraction-digits",dt),!_))return null;let g=null;return a["max-fraction-digits"]&&(g=i.parseObjectValue(a["max-fraction-digits"],2,"max-fraction-digits",dt),!g)?null:new Nc(s,u,h,f,_,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class th{constructor(e){this.type=dt,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=i.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${Sr(s.type)} instead.`):new th(s):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new vr(`Expected value to be of type string or array, but found ${Sr(et(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function Nd(r){return function(){r=1831565813+(r|=0)|0;let e=Math.imul(r^r>>>15,1|r);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const ko={"==":Bd,"!=":Of,">":Nf,"<":Bf,">=":Vf,"<=":Bc,array:bt,at:Ju,"at-interpolated":Qu,boolean:bt,case:eh,coalesce:wl,collator:os,format:ha,image:da,in:Oc,"index-of":Tl,interpolate:Pn,"interpolate-hcl":Pn,"interpolate-lab":Pn,length:th,let:kc,literal:Mt,match:Ta,number:bt,"number-format":Nc,object:bt,slice:Sl,step:bl,string:bt,"to-boolean":Bn,"to-color":Bn,"to-number":Bn,"to-string":Bn,var:Pc,within:Wr,distance:Ro,config:wa};function ih(r,[e,i,s,a]){e=e.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const u=a?a.evaluate(r):1,h=Co(e,i,s,u);if(h)throw new vr(h);return new hi(e/255,i/255,s/255,u)}function rh(r,[e,i,s,a]){e=e.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const u=a?a.evaluate(r):1,h=function(g,v,b,w){return typeof g=="number"&&g>=0&&g<=360?typeof v=="number"&&v>=0&&v<=100&&typeof b=="number"&&b>=0&&b<=100?w===void 0||typeof w=="number"&&w>=0&&w<=1?null:`Invalid hsla value [${[g,v,b,w].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof w=="number"?[g,v,b,w]:[g,v,b]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof w=="number"?[g,v,b,w]:[g,v,b]).join(", ")}]: 'h' must be between 0 and 360.`}(e,i,s,u);if(h)throw new vr(h);const f=`hsla(${e}, ${i}%, ${s}%, ${u})`,_=hi.parse(f);if(!_)throw new vr(`Failed to parse HSLA color: ${f}`);return _}function Vd(r,e){return r in e}function Ks(r,e){const i=e[r];return i===void 0?null:i}function Oo(r){return{type:r}}function Ud(r){return{result:"success",value:r}}function Js(r){return{result:"error",value:r}}function Vc(r,e){return!!r&&!!r.parameters&&r.parameters.indexOf(e)>-1}function El(r){return r["property-type"]==="data-driven"}function nh(r){return Vc(r.expression,"measure-light")}function sh(r){return Vc(r.expression,"zoom")}function Il(r){return!!r.expression&&r.expression.interpolated}function Al(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function jd(r){return r}function Gd(r,e){const i=e.type==="color",s=r.stops&&typeof r.stops[0][0]=="object",a=s||!(s||r.property!==void 0),u=r.type||(Il(e)?"exponential":"interval");if(i&&((r=Mo({},r)).stops&&(r.stops=r.stops.map(g=>[g[0],hi.parse(g[1])])),r.default=hi.parse(r.default?r.default:e.default)),r.colorSpace&&r.colorSpace!=="rgb"&&!Fd[r.colorSpace])throw new Error(`Unknown color space: ${r.colorSpace}`);let h,f,_;if(u==="exponential")h=oh;else if(u==="interval")h=jf;else if(u==="categorical"){h=Uf,f=Object.create(null);for(const g of r.stops)f[g[0]]=g[1];_=typeof r.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);h=Gf}if(s){const g={},v=[];for(let E=0;E<r.stops.length;E++){const A=r.stops[E],P=A[0].zoom;g[P]===void 0&&(g[P]={zoom:P,type:r.type,property:r.property,default:r.default,stops:[]},v.push(P)),g[P].stops.push([A[0].value,A[1]])}const b=[];for(const E of v)b.push([g[E].zoom,Gd(g[E],e)]);const w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:Pn.interpolationFactor.bind(void 0,w),zoomStops:b.map(E=>E[0]),evaluate:({zoom:E},A)=>oh({stops:b,base:r.base},e,E).evaluate(E,A)}}if(a){const g=u==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:g,interpolationFactor:Pn.interpolationFactor.bind(void 0,g),zoomStops:r.stops.map(v=>v[0]),evaluate:({zoom:v})=>h(r,e,v,f,_)}}return{kind:"source",evaluate(g,v){const b=v&&v.properties?v.properties[r.property]:void 0;return b===void 0?Vn(r.default,e.default):h(r,e,b,f,_)}}}function Vn(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function Uf(r,e,i,s,a){return Vn(typeof i===a?s[i]:void 0,r.default,e.default)}function jf(r,e,i){if(Hs(i)!=="number")return Vn(r.default,e.default);const s=r.stops.length;if(s===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[s-1][0])return r.stops[s-1][1];const a=Rc(r.stops.map(u=>u[0]),i);return r.stops[a][1]}function oh(r,e,i){const s=r.base!==void 0?r.base:1;if(Hs(i)!=="number")return Vn(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=Rc(r.stops.map(v=>v[0]),i),h=function(v,b,w,E){const A=E-w,P=v-w;return A===0?0:b===1?P/A:(Math.pow(b,P)-1)/(Math.pow(b,A)-1)}(i,s,r.stops[u][0],r.stops[u+1][0]),f=r.stops[u][1],_=r.stops[u+1][1];let g=ul[e.type]||jd;if(r.colorSpace&&r.colorSpace!=="rgb"){const v=Fd[r.colorSpace];g=(b,w)=>v.reverse(v.interpolate(v.forward(b),v.forward(w),h))}return typeof f.evaluate=="function"?{evaluate(...v){const b=f.evaluate.apply(void 0,v),w=_.evaluate.apply(void 0,v);if(b!==void 0&&w!==void 0)return g(b,w,h)}}:g(f,_,h)}function Gf(r,e,i){return e.type==="color"?i=hi.parse(i):e.type==="formatted"?i=nn.fromString(i.toString()):e.type==="resolvedImage"?i=dn.build(i.toString()):Hs(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),Vn(i,r.default,e.default)}Dr.register(ko,{error:[{kind:"error"},[vi],(r,[e])=>{throw new vr(e.evaluate(r))}],typeof:[vi,[di],(r,[e])=>Sr(et(e.evaluate(r)))],"to-rgba":[rn(dt,4),[vn],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[rn(dt,4),[vn],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[vn,[dt,dt,dt],ih],rgba:[vn,[dt,dt,dt,dt],ih],hsl:[vn,[dt,dt,dt],rh],hsla:[vn,[dt,dt,dt,dt],rh],has:{type:ci,overloads:[[[vi],(r,[e])=>Vd(e.evaluate(r),r.properties())],[[vi,bs],(r,[e,i])=>Vd(e.evaluate(r),i.evaluate(r))]]},get:{type:di,overloads:[[[vi],(r,[e])=>Ks(e.evaluate(r),r.properties())],[[vi,bs],(r,[e,i])=>Ks(e.evaluate(r),i.evaluate(r))]]},"feature-state":[di,[vi],(r,[e])=>Ks(e.evaluate(r),r.featureState||{})],properties:[bs,[],r=>r.properties()],"geometry-type":[vi,[],r=>r.geometryType()],worldview:[vi,[],r=>r.globals.worldview||""],id:[di,[],r=>r.id()],zoom:[dt,[],r=>r.globals.zoom],pitch:[dt,[],r=>r.globals.pitch||0],"distance-from-center":[dt,[],r=>r.distanceFromCenter()],"measure-light":[dt,[vi],(r,[e])=>r.measureLight(e.evaluate(r))],"heatmap-density":[dt,[],r=>r.globals.heatmapDensity||0],"line-progress":[dt,[],r=>r.globals.lineProgress||0],"raster-value":[dt,[],r=>r.globals.rasterValue||0],"raster-particle-speed":[dt,[],r=>r.globals.rasterParticleSpeed||0],"sky-radial-progress":[dt,[],r=>r.globals.skyRadialProgress||0],accumulated:[di,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[dt,Oo(dt),(r,e)=>{let i=0;for(const s of e)i+=s.evaluate(r);return i}],"*":[dt,Oo(dt),(r,e)=>{let i=1;for(const s of e)i*=s.evaluate(r);return i}],"-":{type:dt,overloads:[[[dt,dt],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[dt],(r,[e])=>-e.evaluate(r)]]},"/":[dt,[dt,dt],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[dt,[dt,dt],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[dt,[],()=>Math.LN2],pi:[dt,[],()=>Math.PI],e:[dt,[],()=>Math.E],"^":[dt,[dt,dt],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[dt,[dt],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[dt,[dt],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[dt,[dt],(r,[e])=>Math.log(e.evaluate(r))],log2:[dt,[dt],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[dt,[dt],(r,[e])=>Math.sin(e.evaluate(r))],cos:[dt,[dt],(r,[e])=>Math.cos(e.evaluate(r))],tan:[dt,[dt],(r,[e])=>Math.tan(e.evaluate(r))],asin:[dt,[dt],(r,[e])=>Math.asin(e.evaluate(r))],acos:[dt,[dt],(r,[e])=>Math.acos(e.evaluate(r))],atan:[dt,[dt],(r,[e])=>Math.atan(e.evaluate(r))],min:[dt,Oo(dt),(r,e)=>Math.min(...e.map(i=>i.evaluate(r)))],max:[dt,Oo(dt),(r,e)=>Math.max(...e.map(i=>i.evaluate(r)))],abs:[dt,[dt],(r,[e])=>Math.abs(e.evaluate(r))],round:[dt,[dt],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[dt,[dt],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[dt,[dt],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[ci,[vi,di],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[ci,[di],(r,[e])=>r.id()===e.value],"filter-type-==":[ci,[vi],(r,[e])=>r.geometryType()===e.value],"filter-<":[ci,[vi,di],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s<a}],"filter-id-<":[ci,[di],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<s}],"filter->":[ci,[vi,di],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s>a}],"filter-id->":[ci,[di],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>s}],"filter-<=":[ci,[vi,di],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s<=a}],"filter-id-<=":[ci,[di],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<=s}],"filter->=":[ci,[vi,di],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s>=a}],"filter-id->=":[ci,[di],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>=s}],"filter-has":[ci,[di],(r,[e])=>e.value in r.properties()],"filter-has-id":[ci,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[ci,[rn(vi)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[ci,[rn(di)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[ci,[vi,rn(di)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[ci,[vi,rn(di)],(r,[e,i])=>function(s,a,u,h){for(;u<=h;){const f=u+h>>1;if(a[f]===s)return!0;a[f]>s?h=f-1:u=f+1}return!1}(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:ci,overloads:[[[ci,ci],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[Oo(ci),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:ci,overloads:[[[ci,ci],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[Oo(ci),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[ci,[ci],(r,[e])=>!e.evaluate(r)],"is-supported-script":[ci,[vi],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[vi,[vi],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[vi,[vi],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[vi,Oo(di),(r,e)=>e.map(i=>On(i.evaluate(r))).join("")],"resolved-locale":[vi,[gc],(r,[e])=>e.evaluate(r).resolvedLocale()],random:[dt,[dt,dt,di],(r,e)=>{const[i,s,a]=e.map(h=>h.evaluate(r));if(i>s||i===s)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 vr(`Invalid seed input: ${a}`);u=a}return i+Nd(u)()*(s-i)}]});class Sa{constructor(e,i,s,a){this.expression=e,this._warningHistory={},this._evaluator=new _l(s,a),this._defaultValue=i?function(u){return u.type==="color"&&(Al(u.default)||Array.isArray(u.default))?new hi(0,0,0,0):u.type==="color"?hi.parse(u.default)||null:u.default===void 0?null:u.default}(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this.configDependencies=Cc(e)}evaluateWithoutErrorHandling(e,i,s,a,u,h,f,_){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=s,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,s,a,u,h,f,_){this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=s||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;try{const g=this.expression.evaluate(this._evaluator);if(g==null||typeof g=="number"&&g!=g)return this._defaultValue;if(this._enumValues&&!(g in this._enumValues))throw new vr(`Expected value to be one of ${Object.keys(this._enumValues).map(v=>JSON.stringify(v)).join(", ")}, but found ${JSON.stringify(g)} instead.`);return g}catch(g){return this._warningHistory[g.message]||(this._warningHistory[g.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${g.message}`)),this._defaultValue}}}function Uc(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in ko}function Ss(r,e,i,s){const a=new zc(ko,[],e?function(h){const f={color:vn,string:vi,number:dt,enum:vi,boolean:ci,formatted:hl,resolvedImage:dl};return h.type==="array"?rn(f[h.value]||di,h.length):f[h.type]}(e):void 0,void 0,void 0,i,s),u=a.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return u?Ud(new Sa(u,e,i,s)):Js(a.errors)}class Ml{constructor(e,i,s,a){this.kind=e,this._styleExpression=i,this.isLightConstant=s,this.isLineProgressConstant=a,this.isStateDependent=e!=="constant"&&!Mc(i.expression),this.configDependencies=Cc(i.expression)}evaluateWithoutErrorHandling(e,i,s,a,u,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,s,a,u,h)}evaluate(e,i,s,a,u,h){return this._styleExpression.evaluate(e,i,s,a,u,h)}}class Cl{constructor(e,i,s,a,u,h){this.kind=e,this.zoomStops=s,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Mc(i.expression),this.isLightConstant=u,this.isLineProgressConstant=h,this.configDependencies=Cc(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,s,a,u,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,s,a,u,h)}evaluate(e,i,s,a,u,h){return this._styleExpression.evaluate(e,i,s,a,u,h)}interpolationFactor(e,i,s){return this.interpolationType?Pn.interpolationFactor(this.interpolationType,e,i,s):0}}function qd(r,e,i,s){if((r=Ss(r,e,i,s)).result==="error")return r;const a=r.value.expression,u=va(a);if(!u&&!El(e))return Js([new Mn("","data expressions not supported")]);const h=ba(a,["zoom","pitch","distance-from-center"]);if(!h&&!sh(e))return Js([new Mn("","zoom expressions not supported")]);const f=ba(a,["measure-light"]);if(!f&&!nh(e))return Js([new Mn("","measure-light expression not supported")]);const _=ba(a,["line-progress"]);if(!_&&!function(b){return Vc(b.expression,"line-progress")}(e))return Js([new Mn("","line-progress expression not supported")]);const g=e.expression&&e.expression.relaxZoomRestriction,v=Ia(a);return v||h||g?v instanceof Mn?Js([v]):v instanceof Pn&&!Il(e)?Js([new Mn("",'"interpolate" expressions cannot be used with this property')]):Ud(v?new Cl(u&&_?"camera":"composite",r.value,v.labels,v instanceof Pn?v.interpolation:void 0,f,_):new Ml(u&&_?"constant":"source",r.value,f,_)):Js([new Mn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Ea{constructor(e,i){this._parameters=e,this._specification=i,Mo(this,Gd(this._parameters,this._specification))}static deserialize(e){return new Ea(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ia(r){let e=null;if(r instanceof kc)e=Ia(r.result);else if(r instanceof wl){for(const i of r.args)if(e=Ia(i),e)break}
1else(r instanceof bl||r instanceof Pn)&&r.input instanceof Dr&&r.input.name==="zoom"&&(e=r);return e instanceof Mn||r.eachChild(i=>{const s=Ia(i);s instanceof Mn?e=s:e&&s&&e!==s&&(e=new Mn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}var jc,ah,lh=function(){if(ah)return jc;ah=1,jc=e;var r=3;function e(i,s,a){var u=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var h=new Int32Array(this.arrayBuffer);i=h[0],this.d=(s=h[1])+2*(a=h[2]);for(var f=0;f<this.d*this.d;f++){var _=h[r+f],g=h[r+f+1];u.push(_===g?null:h.subarray(_,g))}var v=h[r+u.length+1];this.keys=h.subarray(h[r+u.length],v),this.bboxes=h.subarray(v),this.insert=this._insertReadonly}else{this.d=s+2*a;for(var b=0;b<this.d*this.d;b++)u.push([]);this.keys=[],this.bboxes=[]}this.n=s,this.extent=i,this.padding=a,this.scale=s/i,this.uid=0;var w=a/s*i;this.min=-w,this.max=i+w}return e.prototype.insert=function(i,s,a,u,h){this._forEachCell(s,a,u,h,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(s),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,s,a,u,h,f){this.cells[h].push(f)},e.prototype.query=function(i,s,a,u,h){var f=this.min,_=this.max;if(i<=f&&s<=f&&_<=a&&_<=u&&!h)return Array.prototype.slice.call(this.keys);var g=[];return this._forEachCell(i,s,a,u,this._queryCell,g,{},h),g},e.prototype._queryCell=function(i,s,a,u,h,f,_,g){var v=this.cells[h];if(v!==null)for(var b=this.keys,w=this.bboxes,E=0;E<v.length;E++){var A=v[E];if(_[A]===void 0){var P=4*A;(g?g(w[P+0],w[P+1],w[P+2],w[P+3]):i<=w[P+2]&&s<=w[P+3]&&a>=w[P+0]&&u>=w[P+1])?(_[A]=!0,f.push(b[A])):_[A]=!1}}},e.prototype._forEachCell=function(i,s,a,u,h,f,_,g){for(var v=this._convertToCellCoord(i),b=this._convertToCellCoord(s),w=this._convertToCellCoord(a),E=this._convertToCellCoord(u),A=v;A<=w;A++)for(var P=b;P<=E;P++){var D=this.d*P+A;if((!g||g(this._convertFromCellCoord(A),this._convertFromCellCoord(P),this._convertFromCellCoord(A+1),this._convertFromCellCoord(P+1)))&&h.call(this,i,s,a,u,D,f,_,g))return}},e.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},e.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},e.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,s=r+this.cells.length+1+1,a=0,u=0;u<this.cells.length;u++)a+=this.cells[u].length;var h=new Int32Array(s+a+this.keys.length+this.bboxes.length);h[0]=this.extent,h[1]=this.n,h[2]=this.padding;for(var f=s,_=0;_<i.length;_++){var g=i[_];h[r+_]=f,h.set(g,f),f+=g.length}return h[r+i.length]=f,h.set(this.keys,f),h[r+i.length+1]=f+=this.keys.length,h.set(this.bboxes,f),f+=this.bboxes.length,h.buffer},jc}(),Es=Gs(lh);const Is={};function tt(r,e,i={}){Object.defineProperty(r,"_classRegistryKey",{value:e,writable:!1}),Is[e]={klass:r,omit:i.omit||[]}}tt(Object,"Object"),Es.serialize=function(r,e){const i=r.toArrayBuffer();return e&&e.add(i),{buffer:i}},Es.deserialize=function(r){return new Es(r.buffer)},Object.defineProperty(Es,"name",{value:"Grid"}),tt(Es,"Grid"),typeof DOMMatrix<"u"&&tt(DOMMatrix,"DOMMatrix"),tt(hi,"Color"),tt(Error,"Error"),tt(nn,"Formatted"),tt(xc,"FormattedSection"),tt(ti,"AJAXError"),tt(dn,"ResolvedImage"),tt(Ea,"StylePropertyFunction"),tt(Sa,"StyleExpression",{omit:["_evaluator"]}),tt(xn,"ImageId"),tt(ws,"ImageVariant"),tt(Cl,"ZoomDependentExpression"),tt(Ml,"ZoomConstantExpression"),tt(Dr,"CompoundExpression",{omit:["_evaluate"]});for(const r in ko)Is[ko[r]._classRegistryKey]||tt(ko[r],`Expression${r}`);function $d(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function Zd(r){return self.ImageBitmap&&r instanceof ImageBitmap}function Qs(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($d(r)||Zd(r))return e&&e.add(r),r;if(ArrayBuffer.isView(r))return e&&e.add(r.buffer),r;if(r instanceof ImageData)return e&&e.add(r.data.buffer),r;if(Array.isArray(r)){const i=[];for(const s of r)i.push(Qs(s,e));return i}if(r instanceof Map){const i={$name:"Map",entries:[]};for(const[s,a]of r.entries())i.entries.push(Qs(s),Qs(a,e));return i}if(r instanceof Set){const i={$name:"Set"};let s=0;for(const a of r.values())i[++s]=Qs(a);return i}if(r instanceof DOMMatrix){const i={$name:"DOMMatrix"},s=["is2D","m11","m12","m13","m14","m21","m22","m23","m24","m31","m32","m33","m34","m41","m42","m43","m44","a","b","c","d","e","f"];for(const a of s)i[a]=r[a];return i}if(typeof r=="bigint")return{$name:"BigInt",value:r.toString()};if(typeof r=="object"){const i=r.constructor,s=i._classRegistryKey;if(!s)throw new Error(`Can't serialize object of unregistered class "${i.name}".`);const a=i.serialize?i.serialize(r,e):{};if(!i.serialize){for(const u in r)r.hasOwnProperty(u)&&(Is[s].omit.indexOf(u)>=0||(a[u]=Qs(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 s!=="Object"&&(a.$name=s),a}throw new Error("can't serialize object of type "+typeof r)}function eo(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||$d(r)||Zd(r)||ArrayBuffer.isView(r)||r instanceof ImageData)return r;if(Array.isArray(r))return r.map(eo);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(eo(a[h]),eo(a[h+1]));return u}if(e==="Set"){const a=new Set;for(const u of Object.keys(r))u!=="$name"&&a.add(eo(r[u]));return a}if(e==="DOMMatrix"){let a;return a=r.is2D?[r.a,r.b,r.c,r.d,r.e,r.f]:[r.m11,r.m12,r.m13,r.m14,r.m21,r.m22,r.m23,r.m24,r.m31,r.m32,r.m33,r.m34,r.m41,r.m42,r.m43,r.m44],new DOMMatrix(a)}if(e==="BigInt")return BigInt(r.value);const{klass:i}=Is[e];if(!i)throw new Error(`Can't deserialize unregistered class "${e}".`);if(i.deserialize)return i.deserialize(r);const s=Object.create(i.prototype);for(const a of Object.keys(r))a!=="$name"&&(s[a]=eo(r[a]));return s}throw new Error("can't deserialize object of type "+typeof r)}const xt={"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 Pl(r){for(const e of r)if(ch(e.charCodeAt(0)))return!0;return!1}function qf(r){for(const e of r)if(!$f(e.charCodeAt(0)))return!1;return!0}function $f(r){return!(xt.Arabic(r)||xt["Arabic Supplement"](r)||xt["Arabic Extended-A"](r)||xt["Arabic Presentation Forms-A"](r)||xt["Arabic Presentation Forms-B"](r))}function ch(r){return!(r!==746&&r!==747&&(r<4352||!(xt["Bopomofo Extended"](r)||xt.Bopomofo(r)||xt["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||xt["CJK Compatibility Ideographs"](r)||xt["CJK Compatibility"](r)||xt["CJK Radicals Supplement"](r)||xt["CJK Strokes"](r)||!(!xt["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||xt["CJK Unified Ideographs Extension A"](r)||xt["CJK Unified Ideographs"](r)||xt["Enclosed CJK Letters and Months"](r)||xt["Hangul Compatibility Jamo"](r)||xt["Hangul Jamo Extended-A"](r)||xt["Hangul Jamo Extended-B"](r)||xt["Hangul Jamo"](r)||xt["Hangul Syllables"](r)||xt.Hiragana(r)||xt["Ideographic Description Characters"](r)||xt.Kanbun(r)||xt["Kangxi Radicals"](r)||xt["Katakana Phonetic Extensions"](r)||xt.Katakana(r)&&r!==12540||!(!xt["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)||!(!xt["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||xt["Unified Canadian Aboriginal Syllabics"](r)||xt["Unified Canadian Aboriginal Syllabics Extended"](r)||xt["Vertical Forms"](r)||xt["Yijing Hexagram Symbols"](r)||xt["Yi Syllables"](r)||xt["Yi Radicals"](r))))}function Hd(r){return!(ch(r)||function(e){return!!(xt["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||xt["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)||xt["Letterlike Symbols"](e)||xt["Number Forms"](e)||xt["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)||xt["Control Pictures"](e)&&e!==9251||xt["Optical Character Recognition"](e)||xt["Enclosed Alphanumerics"](e)||xt["Geometric Shapes"](e)||xt["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||xt["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||xt["CJK Symbols and Punctuation"](e)||xt.Katakana(e)||xt["Private Use Area"](e)||xt["CJK Compatibility Forms"](e)||xt["Small Form Variants"](e)||xt["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 Zf(r){return xt.Arabic(r)||xt["Arabic Supplement"](r)||xt["Arabic Extended-A"](r)||xt["Arabic Presentation Forms-A"](r)||xt["Arabic Presentation Forms-B"](r)}function Wd(r){return r>=1424&&r<=2303||xt["Arabic Presentation Forms-A"](r)||xt["Arabic Presentation Forms-B"](r)}function Hf(r,e){return!(!e&&Wd(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||xt.Khmer(r))}function Wf(r){for(const e of r)if(Wd(e.charCodeAt(0)))return!0;return!1}const bn={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let uh=null,on=bn.unavailable,As=null;const Bo=function(r){r&&typeof r=="string"&&r.indexOf("NetworkError")>-1&&(on=bn.error),uh&&uh(r)};function Gc(){qc.fire(new Eo("pluginStateChange",{pluginStatus:on,pluginURL:As}))}const qc=new Io,Aa=function(){return on},Xd=function(){if(on!==bn.deferred||!As)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");on=bn.loading,Gc(),As&&al({url:As},r=>{r?Bo(r):(on=bn.loaded,Gc())})},Ms={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>on===bn.loaded||Ms.applyArabicShaping!=null,isLoading:()=>on===bn.loading,setState(r){on=r.pluginStatus,As=r.pluginURL},isParsing:()=>on===bn.parsing,isParsed:()=>on===bn.parsed,getPluginURL:()=>As};class Ti{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness,this.worldview=i.worldview):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(i,s){for(const a of i)if(!Hf(a.charCo
1deAt(0),s))return!1;return!0}(e,Ms.isLoaded())}}class zl{constructor(e,i,s,a){this.property=e,this.value=i,this.expression=function(u,h,f,_){if(Al(u))return new Ea(u,h);if(Uc(u)||Array.isArray(u)&&u.length>0){const g=qd(u,h,f,_);if(g.result==="error")throw new Error(g.value.map(v=>`${v.key}: ${v.message}`).join(", "));return g.value}{let g=u;return typeof u=="string"&&h.type==="color"&&(g=hi.parse(u)),{kind:"constant",configDependencies:new Set,evaluate:()=>g}}}(i===void 0?e.specification.default:i,e.specification,s,a)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,s){return this.property.possiblyEvaluate(this,e,i,s)}}class to{constructor(e,i,s){this.property=e,this.value=new zl(e,void 0,i,s)}transitioned(e,i){return new Kd(this.property,this.value,i,ge({},e.transition,this.transition),e.now)}untransitioned(){return new Kd(this.property,this.value,null,{},0)}}class Yd{constructor(e,i,s){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=s,this.configDependencies=new Set}getValue(e){return Ct(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new to(this._values[e].property,this._scope,this._options)),this._values[e].value=new zl(this._values[e].property,i===null?void 0:Ct(i),this._scope,this._options),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]))}setTransitionOrValue(e,i){i&&(this._options=i);const s=this._properties.properties;if(e)for(const a in e){const u=e[a];if(a.endsWith("-transition")){const h=a.slice(0,-11);s[h]&&this.setTransition(h,u)}else s.hasOwnProperty(a)&&this.setValue(a,u)}}getTransition(e){return Ct(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new to(this._values[e].property)),this._values[e].transition=Ct(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s);const a=this.getTransition(i);a!==void 0&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){const s=new Jd(this._properties);for(const a of Object.keys(this._values))s._values[a]=this._values[a].transitioned(e,i._values[a]);return s}untransitioned(){const e=new Jd(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class Kd{constructor(e,i,s,a,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=s)}possiblyEvaluate(e,i,s){const a=e.now||0,u=this.value.possiblyEvaluate(e,i,s),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,s);{const f=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(h.possiblyEvaluate(e,i,s),u,U(f))}}return u}}class Jd{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,s){const a=new No(this._properties);for(const u of Object.keys(this._values))a._values[u]=this._values[u].possiblyEvaluate(e,i,s);return a}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Xf{constructor(e,i,s){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=s,this.configDependencies=new Set}getValue(e){return Ct(this._values[e].value)}setValue(e,i){this._values[e]=new zl(this._values[e].property,i===null?void 0:Ct(i),this._scope,this._options),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]))}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s)}return e}possiblyEvaluate(e,i,s){const a=new No(this._properties);for(const u of Object.keys(this._values))a._values[u]=this._values[u].possiblyEvaluate(e,i,s);return a}}class Ma{constructor(e,i,s){this.property=e,this.value=i,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,s,a){return this.property.evaluate(this.value,this.parameters,e,i,s,a)}}class No{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ne{constructor(e){this.specification=e}
vendor: 5,672 bytes, line 1
1possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,s){const a=ul[this.specification.type];return a?a(e,i,s):e}}class Je{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,s,a){return new Ma(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},s,a)}:e.expression,i)}interpolate(e,i,s){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new Ma(this,{kind:"constant",value:void 0},e.parameters);const a=ul[this.specification.type];return a?new Ma(this,{kind:"constant",value:a(e.value.value,i.value.value,s)},e.parameters):e}evaluate(e,i,s,a,u,h){return e.kind==="constant"?e.value:e.evaluate(i,s,a,u,h)}}class Vo{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,a){return!!e.expression.evaluate(i,null,{},s,a)}interpolate(){return!1}}class rr{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new Ti(0,{});for(const s in e){const a=e[s];a.specification.overridable&&this.overridableProperties.push(s);const u=this.defaultPropertyValues[s]=new zl(a,void 0),h=this.defaultTransitionablePropertyValues[s]=new to(a);this.defaultTransitioningPropertyValues[s]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[s]=u.possiblyEvaluate(i)}}}tt(Je,"DataDrivenProperty"),tt(Ne,"DataConstantProperty"),tt(Vo,"ColorRampProperty");var pe=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}}
1,"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"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-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
1,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor":{"floorplanFeaturesetId":{"type":"string","expression":{}},"buildingFeaturesetId":{"type":"string","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"ty
1pe":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-wall-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"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"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
1,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"int
1erpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function Kn(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function $c(r){if(Array.isArray(r))return r.map($c);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=$c(r[i]);return e}return Kn(r)}function Zc(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(!Zc(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function hh(r,e="",i=null,s="fill"){if(r==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Zc(r)||(r=Hc(r));const a=r;let u=!0;try{u=function(v){if(!Ca(v))return v;let b=$c(v);return ep(b),b=Qd(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(s!=="background"&&s!=="sky"&&s!=="slot"){f=pe[`filter_${s}`];const v=Ss(u,f,e,i);if(v.result==="error")throw new Error(v.value.map(b=>`${b.key}: ${b.message}`).join(", "));h=(b,w,E)=>v.value.evaluate(b,w,{},E)}let _=null,g=null;if(u!==a){const v=Ss(a,f,e,i);if(v.result==="error")throw new Error(v.value.map(b=>`${b.key}: ${b.message}`).join(", "));_=(b,w,E,A,P)=>v.value.evaluate(b,w,{},E,void 0,void 0,A,P),g=!va(v.value.expression)}return{filter:h,dynamicFilter:_||void 0,needGeometry:tp(u),needFeature:!!g}}function Qd(r){if(!Array.isArray(r))return r;const e=function(i){if(Yf.has(i[0])){for(let s=1;s<i.length;s++)if(Ca(i[s]))return!0}return i}(r);return e===!0?e:e.map(i=>Qd(i))}function ep(r){let e=!1;const i=[];if(r[0]==="case"){for(let s=1;s<r.length-1;s+=2)e=e||Ca(r[s]),i.push(r[s+1]);i.push(r[r.length-1])}else if(r[0]==="match"){e=e||Ca(r[1]);for(let s=2;s<r.length-1;s+=2)i.push(r[s+1]);i.push(r[r.length-1])}else if(r[0]==="step"){e=e||Ca(r[1]);for(let s=1;s<r.length-1;s+=2)i.push(r[s+1])}e&&(r.length=0,r.push("any",...i));for(let s=1;s<r.length;s++)ep(r[s])}function Ca(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(Ca(r[i]))return!0;return!1}const Yf=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Kf(r,e){return r<e?-1:r>e?1:0}function tp(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(tp(r[e]))return!0;return!1}function Hc(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?dh(r[1],r[2],"=="):e==="!="?Wc(dh(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?dh(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(Hc))):e==="all"?["all"].concat(r.slice(1).map(Hc)):e==="none"?["all"].concat(r.slice(1).map(Hc).map(Wc)):e==="in"?ph(r[1],r.slice(2)):e==="!in"?Wc(ph(r[1],r.slice(2))):e==="has"?ip(r[1]):e!=="!has"||Wc(ip(r[1]));var i}function dh(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 ph(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(Kf)]]:["filter-in-small",r,["literal",e]]}}function ip(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Wc(r){return["!",r]}const Rl="�";function Uo(r,e){return e?`${r}${Rl}${e}`:r}const fh="-transition",io=new Set(["fill","line","background","hillshade","raster"]);class Xr extends Io{constructor(e,i,s,a,u){if(super(),this.id=e.id,this.fqid=Uo(this.id,s),this.type=e.type,this.scope=s,this.lut=a,this.options=u,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,e.type!=="custom"){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const h=Ss(this.filter,pe[`filter_${e.type}`]);h.result!=="error"&&(this.configDependencies=new Set([...this.configDependencies,...h.value.configDependencies]))}if(e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new Xf(i.layout,this.scope,u),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),i.paint){this._transitionablePaint=new Yd(i.paint,this.scope,u);for(const h in e.paint)this.setPaintProperty(h,e.paint[h]);for(const h in e.layout)this.setLayoutProperty(h,e.layout[h]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new No(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&io.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const s=this._unevaluatedLayout;s._properties.properties[e]&&(s.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...s.configDependencies]),e==="visibility"&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(fh)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){const s=this._transitionablePaint,a=s._properties.properties;if(e.endsWith(fh)){const b=e.slice(0,-11);return a[b]&&s.setTransition(b,i||void 0),!1}if(!a[e])return!1;const u=s._values[e],h=u.value.isDataDriven(),f=u.value;s.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...s.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);const _=s._values[e].value,g=_.isDataDriven(),v=e.endsWith("pattern")||e==="line-dasharray";return g||h||v||this._handleOverridablePaintPropertyUpdate(e,f,_)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,s){return null}_handleOverridablePaintPropertyUpdate(e,i,s){return!1}
vendor: 16,384 bytes, line 7
7isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){return At({id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},(e,i)=>!(e===void 0||i==="layout"&&!Object.keys(e).length||i==="paint"&&!Object.keys(e).length))}is3D(e){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof Ma&&El(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=hh(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,i,s,a,u,h,f,_,g){}}const Jf={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Dl{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Zi{constructor(){this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&i.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function ii(r,e=1){let i=0,s=0;return{members:r.map(a=>{const u=Jf[a.type].BYTES_PER_ELEMENT,h=i=mh(i,Math.max(e,u)),f=a.components||1;return s=Math.max(s,u),i+=u*f,{name:a.name,type:a.type,components:f,offset:h}}),size:mh(i,Math.max(s,e)),alignment:e}}function mh(r,e){return Math.ceil(r/e)*e}class Cs extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.int16[a+0]=i,this.int16[a+1]=s,e}}Cs.prototype.bytesPerElement=4,tt(Cs,"StructArrayLayout2i4");class Ll extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=3*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.int16[u+2]=a,e}}Ll.prototype.bytesPerElement=6,tt(Ll,"StructArrayLayout3i6");class Pa extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a)}emplace(e,i,s,a,u){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=s,this.int16[h+2]=a,this.int16[h+3]=u,e}}Pa.prototype.bytesPerElement=8,tt(Pa,"StructArrayLayout4i8");class ro extends Zi{_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}}ro.prototype.bytesPerElement=4,tt(ro,"StructArrayLayout1f4");class _h extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=4*e,h=2*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.float32[h+1]=a,e}}_h.prototype.bytesPerElement=8,tt(_h,"StructArrayLayout2i1f8");class Xc extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.int16[u+2]=a,e}}Xc.prototype.bytesPerElement=8,tt(Xc,"StructArrayLayout3i8");class za extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,u)}emplace(e,i,s,a,u,h){const f=5*e;return this.int16[f+0]=i,this.int16[f+1]=s,this.int16[f+2]=a,this.int16[f+3]=u,this.int16[f+4]=h,e}}za.prototype.bytesPerElement=10,tt(za,"StructArrayLayout5i10");class gh extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,a,u,h,f)}emplace(e,i,s,a,u,h,f,_){const g=6*e,v=12*e,b=3*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.uint8[v+4]=a,this.uint8[v+5]=u,this.uint8[v+6]=h,this.uint8[v+7]=f,this.float32[b+2]=_,e}}gh.prototype.bytesPerElement=12,tt(gh,"StructArrayLayout2i4ub1f12");class ls extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=3*e;return this.float32[u+0]=i,this.float32[u+1]=s,this.float32[u+2]=a,e}}ls.prototype.bytesPerElement=12,tt(ls,"StructArrayLayout3f12");class no extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,u)}emplace(e,i,s,a,u,h){const f=6*e,_=3*e;return this.uint16[f+0]=i,this.uint16[f+1]=s,this.uint16[f+2]=a,this.uint16[f+3]=u,this.float32[_+2]=h,e}}no.prototype.bytesPerElement=12,tt(no,"StructArrayLayout4ui1f12");class Fl extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a)}emplace(e,i,s,a,u){const h=4*e;return this.uint16[h+0]=i,this.uint16[h+1]=s,this.uint16[h+2]=a,this.uint16[h+3]=u,e}}Fl.prototype.bytesPerElement=8,tt(Fl,"StructArrayLayout4ui8");class Yc extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,s,a,u,h)}emplace(e,i,s,a,u,h,f){const _=6*e;return this.int16[_+0]=i,this.int16[_+1]=s,this.int16[_+2]=a,this.int16[_+3]=u,this.int16[_+4]=h,this.int16[_+5]=f,e}}Yc.prototype.bytesPerElement=12,tt(Yc,"StructArrayLayout6i12");class Ra extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f,_,g,v,b,w){const E=this.length;return this.resize(E+1),this.emplace(E,e,i,s,a,u,h,f,_,g,v,b,w)}emplace(e,i,s,a,u,h,f,_,g,v,b,w,E){const A=12*e;return this.int16[A+0]=i,this.int16[A+1]=s,this.int16[A+2]=a,this.int16[A+3]=u,this.uint16[A+4]=h,this.uint16[A+5]=f,this.uint16[A+6]=_,this.uint16[A+7]=g,this.int16[A+8]=v,this.int16[A+9]=b,this.int16[A+10]=w,this.int16[A+11]=E,e}}Ra.prototype.bytesPerElement=24,tt(Ra,"StructArrayLayout4i4ui4i24");class Da extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,s,a,u,h)}emplace(e,i,s,a,u,h,f){const _=10*e,g=5*e;return this.int16[_+0]=i,this.int16[_+1]=s,this.int16[_+2]=a,this.float32[g+2]=u,this.float32[g+3]=h,this.float32[g+4]=f,e}}Da.prototype.bytesPerElement=20,tt(Da,"StructArrayLayout3i3f20");class Or extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a)}emplace(e,i,s,a,u){const h=4*e;return this.float32[h+0]=i,this.float32[h+1]=s,this.float32[h+2]=a,this.float32[h+3]=u,e}}Or.prototype.bytesPerElement=16,tt(Or,"StructArrayLayout4f16");class La extends Zi{_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}}La.prototype.bytesPerElement=4,tt(La,"StructArrayLayout1ul4");class so extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=s,e}}so.prototype.bytesPerElement=4,tt(so,"StructArrayLayout2ui4");class yh extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f,_,g,v,b,w,E){const A=this.length;return this.resize(A+1),this.emplace(A,e,i,s,a,u,h,f,_,g,v,b,w,E)}emplace(e,i,s,a,u,h,f,_,g,v,b,w,E,A){const P=20*e,D=10*e;return this.int16[P+0]=i,this.int16[P+1]=s,this.int16[P+2]=a,this.int16[P+3]=u,this.int16[P+4]=h,this.float32[D+3]=f,this.float32[D+4]=_,this.float32[D+5]=g,this.float32[D+6]=v,this.int16[P+14]=b,this.uint32[D+8]=w,this.uint16[P+18]=E,this.uint16[P+19]=A,e}}yh.prototype.bytesPerElement=40,tt(yh,"StructArrayLayout5i4f1i1ul2ui40");class Kc extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,a,u,h,f)}emplace(e,i,s,a,u,h,f,_){const g=8*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=a,this.int16[g+4]=u,this.int16[g+5]=h,this.int16[g+6]=f,this.int16[g+7]=_,e}}Kc.prototype.bytesPerElement=16,tt(Kc,"StructArrayLayout3i2i2i16");class xh extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,u)}emplace(e,i,s,a,u,h){const f=4*e,_=8*e;return this.float32[f+0]=i,this.float32[f+1]=s,this.float32[f+2]=a,this.int16[_+6]=u,this.int16[_+7]=h,e}}xh.prototype.bytesPerElement=16,tt(xh,"StructArrayLayout2f1f2i16");class kl extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,s,a,u,h)}emplace(e,i,s,a,u,h,f){const _=20*e,g=5*e;return this.uint8[_+0]=i,this.uint8[_+1]=s,this.float32[g+1]=a,this.float32[g+2]=u,this.float32[g+3]=h,this.float32[g+4]=f,e}}kl.prototype.bytesPerElement=20,tt(kl,"StructArrayLayout2ub4f20");class Br extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const u=3*e;return this.uint16[u+0]=i,this.uint16[u+1]=s,this.uint16[u+2]=a,e}}Br.prototype.bytesPerElement=6,tt(Br,"StructArrayLayout3ui6");class Ol extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,k,j,G,z,N){const q=this.length;return this.resize(q+1),this.emplace(q,e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,k,j,G,z,N)}emplace(e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,k,j,G,z,N,q){const H=30*e,oe=15*e,re=60*e;return this.int16[H+0]=i,this.int16[H+1]=s,this.int16[H+2]=a,this.float32[oe+2]=u,this.float32[oe+3]=h,this.uint16[H+8]=f,this.uint16[H+9]=_,this.uint32[oe+5]=g,this.uint32[oe+6]=v,this.uint32[oe+7]=b,this.uint16[H+16]=w,this.uint16[H+17]=E,this.uint16[H+18]=A,this.float32[oe+10]=P,this.float32[oe+11]=D,this.uint8[re+48]=k,this.uint8[re+49]=j,this.uint8[re+50]=G,this.uint32[oe+13]=z,this.int16[H+28]=N,this.uint8[re+58]=q,e}}Ol.prototype.bytesPerElement=60,tt(Ol,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class vh extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,k,j,G,z,N,q,H,oe,re,ae,he,Te,Oe,ze,ke,Be,Ee){const Le=this.length;return this.resize(Le+1),this.emplace(Le,e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,k,j,G,z,N,q,H,oe,re,ae,he,Te,Oe,ze,ke,Be,Ee)}emplace(e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,k,j,G,z,N,q,H,oe,re,ae,he,Te,Oe,ze,ke,Be,Ee,Le){const be=20*e,Se=40*e,Ue=80*e;return this.float32[be+0]=i,this.float32[be+1]=s,this.int16[Se+4]=a,this.int16[Se+5]=u,this.int16[Se+6]=h,this.int16[Se+7]=f,this.int16[Se+8]=_,this.int16[Se+9]=g,this.int16[Se+10]=v,this.int16[Se+11]=b,this.int16[Se+12]=w,this.uint16[Se+13]=E,this.uint16[Se+14]=A,this.uint16[Se+15]=P,this.uint16[Se+16]=D,this.uint16[Se+17]=k,this.uint16[Se+18]=j,this.uint16[Se+19]=G,this.uint16[Se+20]=z,this.uint16[Se+21]=N,this.uint16[Se+22]=q,this.uint16[Se+23]=H,this.uint16[Se+24]=oe,this.uint16[Se+25]=re,this.uint16[Se+26]=ae,this.uint16[Se+27]=he,this.uint32[be+14]=Te,this.float32[be+15]=Oe,this.float32[be+16]=ze,this.float32[be+17]=ke,this.float32[be+18]=Be,this.uint8[Ue+76]=Ee,this.uint16[Se+39]=Le,e}}vh.prototype.bytesPerElement=80,tt(vh,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class bh extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,s,a,u,h)}emplace(e,i,s,a,u,h,f){const _=6*e;return this.float32[_+0]=i,this.float32[_+1]=s,this.float32[_+2]=a,this.float32[_+3]=u,this.float32[_+4]=h,this.float32[_+5]=f,e}}bh.prototype.bytesPerElement=24,tt(bh,"StructArrayLayout6f24");class oo extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u){const h=this.length;return this.resize(h+1),this.emplace
vendor: 6,155 bytes, line 7
7(h,e,i,s,a,u)}emplace(e,i,s,a,u,h){const f=5*e;return this.float32[f+0]=i,this.float32[f+1]=s,this.float32[f+2]=a,this.float32[f+3]=u,this.float32[f+4]=h,e}}oo.prototype.bytesPerElement=20,tt(oo,"StructArrayLayout5f20");class Bl extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,a,u,h,f)}emplace(e,i,s,a,u,h,f,_){const g=7*e;return this.float32[g+0]=i,this.float32[g+1]=s,this.float32[g+2]=a,this.float32[g+3]=u,this.float32[g+4]=h,this.float32[g+5]=f,this.float32[g+6]=_,e}}Bl.prototype.bytesPerElement=28,tt(Bl,"StructArrayLayout7f28");class wh extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f,_,g,v,b){const w=this.length;return this.resize(w+1),this.emplace(w,e,i,s,a,u,h,f,_,g,v,b)}emplace(e,i,s,a,u,h,f,_,g,v,b,w){const E=11*e;return this.float32[E+0]=i,this.float32[E+1]=s,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]=g,this.float32[E+8]=v,this.float32[E+9]=b,this.float32[E+10]=w,e}}wh.prototype.bytesPerElement=44,tt(wh,"StructArrayLayout11f44");class Jc extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f,_,g){const v=this.length;return this.resize(v+1),this.emplace(v,e,i,s,a,u,h,f,_,g)}emplace(e,i,s,a,u,h,f,_,g,v){const b=9*e;return this.float32[b+0]=i,this.float32[b+1]=s,this.float32[b+2]=a,this.float32[b+3]=u,this.float32[b+4]=h,this.float32[b+5]=f,this.float32[b+6]=_,this.float32[b+7]=g,this.float32[b+8]=v,e}}Jc.prototype.bytesPerElement=36,tt(Jc,"StructArrayLayout9f36");class jo extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.float32[a+0]=i,this.float32[a+1]=s,e}}jo.prototype.bytesPerElement=8,tt(jo,"StructArrayLayout2f8");class Th extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a)}emplace(e,i,s,a,u){const h=6*e;return this.uint32[3*e+0]=i,this.uint16[h+2]=s,this.uint16[h+3]=a,this.uint16[h+4]=u,e}}Th.prototype.bytesPerElement=12,tt(Th,"StructArrayLayout1ul3ui12");class Nl extends Zi{_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}}Nl.prototype.bytesPerElement=2,tt(Nl,"StructArrayLayout1ui2");class Fa extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D){const k=this.length;return this.resize(k+1),this.emplace(k,e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D)}emplace(e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,k){const j=16*e;return this.float32[j+0]=i,this.float32[j+1]=s,this.float32[j+2]=a,this.float32[j+3]=u,this.float32[j+4]=h,this.float32[j+5]=f,this.float32[j+6]=_,this.float32[j+7]=g,this.float32[j+8]=v,this.float32[j+9]=b,this.float32[j+10]=w,this.float32[j+11]=E,this.float32[j+12]=A,this.float32[j+13]=P,this.float32[j+14]=D,this.float32[j+15]=k,e}}Fa.prototype.bytesPerElement=64,tt(Fa,"StructArrayLayout16f64");class Vl extends Zi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,a,u,h,f)}emplace(e,i,s,a,u,h,f,_){const g=10*e,v=5*e;return this.uint16[g+0]=i,this.uint16[g+1]=s,this.uint16[g+2]=a,this.uint16[g+3]=u,this.float32[v+2]=h,this.float32[v+3]=f,this.float32[v+4]=_,e}}Vl.prototype.bytesPerElement=20,tt(Vl,"StructArrayLayout4ui3f20");class Sh extends Zi{_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}}Sh.prototype.bytesPerElement=2,tt(Sh,"StructArrayLayout1i2");class Qc extends Zi{_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}}Qc.prototype.bytesPerElement=1,tt(Qc,"StructArrayLayout1ub1");class rp extends Dl{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]}}rp.prototype.size=40;class eu extends yh{get(e){return new rp(this,e)}}tt(eu,"CollisionBoxArray");class np extends Dl{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]}
vendor: 6,396 bytes, line 7
7get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}np.prototype.size=60;class sp extends Ol{get(e){return new np(this,e)}}tt(sp,"PlacedSymbolArray");class op extends Dl{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]}}op.prototype.size=80;class ap extends vh{get(e){return new op(this,e)}}tt(ap,"SymbolInstanceArray");class Eh extends ro{getoffsetX(e){return this.float32[1*e+0]}}tt(Eh,"GlyphOffsetArray");class lp extends Cs{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}tt(lp,"SymbolLineVertexArray");class cp extends Dl{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]}}cp.prototype.size=12;class up extends Th{get(e){return new cp(this,e)}}tt(up,"FeatureIndexArray");class hp extends so{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}tt(hp,"FillExtrusionCentroidArray");class dp extends Dl{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]}}dp.prototype.size=6;class pp extends Ll{get(e){return new dp(this,e)}}tt(pp,"FillExtrusionWallArray");const Qf=ii([{name:"a_pos",components:2,type:"Int16"}],4),em=ii([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),tu=ii([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class or{constructor(e=[]){this.segments=e}_prepareSegment(e,i,s,a){let u=this.segments[this.segments.length-1];return e>or.MAX_VERTEX_ARRAY_LENGTH&&kt(`Max vertices per segment is ${or.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>or.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==a)&&(u={vertexOffset:i,primitiveOffset:s,vertexLength:0,primitiveLength:0},a!==void 0&&(u.sortKey=a),this.segments.push(u)),u}prepareSegment(e,i,s,a){return this._prepareSegment(e,i.length,s.length,a)}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,s,a){return new or([{vertexOffset:e,primitiveOffset:i,vertexLength:s,primitiveLength:a,vaos:{},sortKey:0}])}}function fp(r,e){return 256*(r=Q(Math.floor(r),0,255))+Q(Math.floor(e),0,255)}or.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,tt(or,"SegmentVector");const iu=ii([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Ih=ii([{name:"a_pattern_b",components:4,type:"Uint16"}]),mp=ii([{name:"a_dash",components:4,type:"Uint16"}]);class Ul{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}
7add(e,i,s,a){this.ids.push(Ah(e)),this.positions.push(i,s,a)}eachPosition(e,i){const s=Ah(e);let a=0,u=this.ids.length-1;for(;a<u;){const h=a+u>>1;this.ids[h]>=s?u=h:a=h+1}for(;this.ids[a]===s;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){const s=new Float64Array(e.ids),a=new Uint32Array(e.positions);return ru(s,a,0,s.length-1),i&&(i.add(s.buffer),i.add(a.buffer)),{ids:s,positions:a}}static deserialize(e){const i=new Ul;let s;i.ids=e.ids,i.positions=e.positions;for(const a of i.ids)a!==s&&i.uniqueIds.push(a),s=a;return i.indexed=!0,i}}function Ah(r){const e=+r;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:cl(String(r))}function ru(r,e,i,s){for(;i<s;){const a=r[i+s>>1];let u=i-1,h=s+1;for(;;){do u++;while(r[u]<a);do h--;while(r[h]>a);if(u>=h)break;jl(r,u,h),jl(e,3*u,3*h),jl(e,3*u+1,3*h+1),jl(e,3*u+2,3*h+2)}h-i<s-h?(ru(r,e,i,h),i=h+1):(ru(r,e,h+1,s),s=h)}}function jl(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}tt(Ul,"FeaturePositionMap");class Ps{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}set(e,i,s){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class nu extends Ps{constructor(e){super(e),this.current=0}set(e,i,s){this.fetchUniformLocation(e,i)&&this.current!==s&&(this.current=s,this.gl.uniform1i(this.location,s))}}class fr extends Ps{constructor(e){super(e),this.current=0}set(e,i,s){this.fetchUniformLocation(e,i)&&this.current!==s&&(this.current=s,this.gl.uniform1f(this.location,s))}}class cs extends Ps{constructor(e){super(e),this.current=[0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]||(this.current=s,this.gl.uniform2f(this.location,s[0],s[1])))}}class Gl extends Ps{constructor(e){super(e),this.current=[0,0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]||(this.current=s,this.gl.uniform3f(this.location,s[0],s[1],s[2])))}}class su extends Ps{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]&&s[3]===this.current[3]||(this.current=s,this.gl.uniform4f(this.location,s[0],s[1],s[2],s[3])))}}class _p extends Ps{constructor(e){super(e),this.current=hi.transparent.toPremultipliedRenderColor(null)}set(e,i,s){this.fetchUniformLocation(e,i)&&(s.r===this.current.r&&s.g===this.current.g&&s.b===this.current.b&&s.a===this.current.a||(this.current=s,this.gl.uniform4f(this.location,s.r,s.g,s.b,s.a)))}}const tm=new Float32Array(16);class ka extends Ps{constructor(e){super(e),this.current=tm}set(e,i,s){if(this.fetchUniformLocation(e,i)){if(s[12]!==this.current[12]||s[0]!==this.current[0])return this.current=s,void this.gl.uniformMatrix4fv(this.location,!1,s);for(let a=1;a<16;a++)if(s[a]!==this.current[a]){this.current=s,this.gl.uniformMatrix4fv(this.location,!1,s);break}}}}const Mh=new Float32Array(9),us=new Float32Array(4);class ql extends Ps{constructor(e){super(e),this.current=us}set(e,i,s){if(this.fetchUniformLocation(e,i)){for(let a=0;a<4;a++)if(s[a]!==this.current[a]){this.current=s,this.gl.uniformMatrix2fv(this.location,!1,s);break}}}}function Ch(r){return[fp(255*r.r,255*r.g),fp(255*r.b,255*r.a)]}class $l{constructor(e,i,s,a){this.value=e,this.uniformNames=i.map(u=>`u_${u}`),this.type=s,this.context=a}setUniform(e,i,s,a,u){const h=a.constantOr(this.value);i.set(e,u,h instanceof hi?h.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.value==="none"?null:this.context.lut):h)}getBinding(e,i){return this.type==="color"?new _p(e):new fr(e)}}class Oa{constructor(e,i){this.uniformNames=i.map(s=>`u_${s}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,i){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=i?i.tl.concat(i.br):this.pattern}setUniform(e,i,s,a,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 su(e):new fr(e)}}class zs{constructor(e,i,s,a){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=i.map(u=>({name:`a_${u}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,i,s,a,u,h,f,_){const g=this.paintVertexArray.length,v=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Ti(0,{brightness:h,worldview:_}),i,{},u,a,f):this.expression.kind==="constant"&&this.expression.value,b=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Ti(0,{brightness:h,worldview:_}),i,{},u,a,f):this.lutExpression.value)==="none";this.paintVertexArray.resize(e),this._setPaintValue(g,e,v,b?null:this.context.lut)}updatePaintArray(e,i,s,a,u,h,f,_){const g=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:f,worldview:_},s,a,void 0,u):this.expression.kind==="constant"&&this.expression.value,v=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Ti(0,{brightness:f,worldview:_}),s,a,void 0,u):this.lutExpression.value)==="none";this._setPaintValue(e,i,g,v?null:this.context.lut)}
vendor: 15,781 bytes, line 7
7_setPaintValue(e,i,s,a){if(this.type==="color"){const u=Ch(s.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,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&this.lutExpression.kind!=="constant"&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||this.expression.kind!=="constant"&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Jn{constructor(e,i,s,a,u,h){this.expression=e,this.uniformNames=i.map(f=>`u_${f}_t`),this.type=s,this.useIntegerZoom=a,this.context=u,this.maxValue=0,this.paintVertexAttributes=i.map(f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new h}populatePaintArray(e,i,s,a,u,h,f,_){const g=this.expression.evaluate(new Ti(this.context.zoom,{brightness:h,worldview:_}),i,{},u,a,f),v=this.expression.evaluate(new Ti(this.context.zoom+1,{brightness:h,worldview:_}),i,{},u,a,f),b=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Ti(0,{brightness:h,worldview:_}),i,{},u,a,f):this.lutExpression.value)==="none",w=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(w,e,g,v,b?null:this.context.lut)}updatePaintArray(e,i,s,a,u,h,f,_){const g=this.expression.evaluate({zoom:this.context.zoom,brightness:f,worldview:_},s,a,void 0,u),v=this.expression.evaluate({zoom:this.context.zoom+1,brightness:f,worldview:_},s,a,void 0,u),b=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Ti(0,{brightness:f,worldview:_}),s,a,void 0,u):this.lutExpression.value)==="none";this._setPaintValue(e,i,g,v,b?null:this.context.lut)}_setPaintValue(e,i,s,a,u){if(this.type==="color"){const h=Ch(s.toPremultipliedRenderColor(u)),f=Ch(s.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,s,a);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i,s,a,u){const h=this.useIntegerZoom?Math.floor(s.zoom):s.zoom,f=Q(this.expression.interpolationFactor(h,this.context.zoom,this.context.zoom+1),0,1);i.set(e,u,f)}getBinding(e,i){return new fr(e)}}class Un{constructor(e,i,s,a,u){this.expression=e,this.layerId=u,this.paintVertexAttributes=(s==="array"?mp:iu).members;for(let h=0;h<i.length;++h);this.paintVertexArray=new a,this.paintTransitionVertexArray=new Fl}populatePaintArray(e,i,s,a){const u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(u,e,i.patterns&&i.patterns[this.layerId],s)}updatePaintArray(e,i,s,a,u,h,f){this._setPaintValues(e,i,s.patterns&&s.patterns[this.layerId],h)}_setPaintValues(e,i,s,a){if(!a||!s)return;const u=a[s[0]],h=a[s[1]];if(u){if(u){const{tl:f,br:_,pixelRatio:g}=u;for(let v=e;v<i;v++)this.paintVertexArray.emplace(v,f[0],f[1],_[0],_[1],g)}if(h){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:f,br:_}=h;for(let g=e;g<i;g++)this.paintTransitionVertexArray.emplace(g,f[0],f[1],_[0],_[1])}}}upload(e){const i=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,i)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,Ih.members,i))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class Ba{constructor(e,i,s=()=>!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")||!s(u)||!(h instanceof Ma&&El(h.property.specification)))continue;const f=n(u,e.type),_=h.value,g=h.property.specification.type,v=!!h.property.useIntegerZoom,b=u==="line-dasharray"||u.endsWith("pattern"),w=e.paint.get(`${u}-use-theme`),E=u==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant"||w&&w.value.kind!=="constant";if(_.kind!=="constant"||E)if(_.kind==="source"||E||b){const A=p(u,g,"source");this.binders[u]=b?new Un(_,f,g,A,e.id):new zs(_,f,g,A),a.push(`/a_${u}`)}else{const A=p(u,g,"composite");this.binders[u]=new Jn(_,f,g,v,i,A),a.push(`/z_${u}`)}else this.binders[u]=b?new Oa(_.value,f):new $l(_.value,f,g,i),a.push(`/u_${u}`);w&&(this.binders[u].lutExpression=w.value)}this.cacheKey=a.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof zs||i instanceof Jn?i.maxValue:0}populatePaintArrays(e,i,s,a,u,h,f,_){for(const g in this.binders){const v=this.binders[g];v.context=this.context,(v instanceof zs||v instanceof Jn||v instanceof Un)&&v.populatePaintArray(e,i,s,a,u,h,f,_)}}setConstantPatternPositions(e,i){for(const s in this.binders){const a=this.binders[s];a instanceof Oa&&a.setConstantPatternPositions(e,i)}}getPatternTransitionVertexBuffer(e){const i=this.binders[e];return i instanceof Un?i.paintTransitionVertexBuffer:null}updatePaintArrays(e,i,s,a,u,h,f,_,g,v){let b=!1;const w=Object.keys(e),E=w.length!==0&&!_,A=E?w:i.uniqueIds;this.context.lut=u.lut;for(const P in this.binders){const D=this.binders[P];if(D.context=this.context,(D instanceof zs||D instanceof Jn||D instanceof Un)&&D.expression&&D.expression.kind&&D.expression.kind!=="constant"&&(D.expression.isStateDependent===!0||D.expression.isLightConstant===!1)){const k=u.paint.get(P);D.expression=k.value;for(const j of A){const G=e[j.toString()];i.eachPosition(j,(z,N,q)=>{const H=a.feature(z);D.updatePaintArray(N,q,H,G,h,f,g,v)})}if(!E)for(const j of s.uniqueIds){const G=e[j.toString()];s.eachPosition(j,(z,N,q)=>{const H=a.feature(z);D.updatePaintArray(N,q,H,G,h,f,g,v)})}b=!0}}return b}defines(){const e=[];for(const i in this.binders){const s=this.binders[i];(s instanceof $l||s instanceof Oa)&&e.push(...s.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof zs||s instanceof Jn||s instanceof Un)for(let a=0;a<s.paintVertexAttributes.length;a++)e.push(s.paintVertexAttributes[a].name);if(s instanceof Un)for(let a=0;a<Ih.members.length;a++)e.push(Ih.members[a].name)}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof $l||s instanceof Oa||s instanceof Jn)for(const a of s.uniformNames)e.push(a)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const s in this.binders){const a=this.binders[s];if(a instanceof $l||a instanceof Oa||a instanceof Jn)for(const u of a.uniformNames)i.push({name:u,property:s,binding:a.getBinding(e,u)})}return i}setUniforms(e,i,s,a,u){for(const{name:h,property:f,binding:_}of s)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 zs||i instanceof Jn||i instanceof Un)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof Un&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(e){for(const i in this.binders){const s=this.binders[i];(s instanceof zs||s instanceof Jn||s instanceof Un)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof zs||i instanceof Jn||i instanceof Un)&&i.destroy()}}}class l{constructor(e,i,s=()=>!0){this.programConfigurations={};for(const a of e)this.programConfigurations[a.id]=new Ba(a,i,s);this.needsUpload=!1,this._featureMap=new Ul,this._featureMapWithoutIds=new Ul,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,s,a,u,h,f,_,g){for(const v in this.programConfigurations)this.programConfigurations[v].populatePaintArrays(e,i,a,u,h,f,_,g);i.id!==void 0?this._featureMap.add(i.id,s,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,s,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,s,a,u,h,f,_){for(const g of s)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,g,a,u,h,f||0,_)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const t={"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 n(r,e){return t[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}const c={"line-pattern":{source:no,composite:no},"fill-pattern":{source:no,composite:no},"fill-extrusion-pattern":{source:no,composite:no},"line-dasharray":{source:Fl,composite:Fl}},d={color:{source:jo,composite:Or},number:{source:ro,composite:jo}};function p(r,e,i){const s=c[r];return s&&s[i]||d[e][i]}tt($l,"ConstantBinder"),tt(Oa,"PatternConstantBinder"),tt(zs,"SourceExpressionBinder"),tt(Un,"PatternCompositeBinder"),tt(Jn,"CompositeExpressionBinder"),tt(Ba,"ProgramConfiguration",{omit:["_buffers"]}),tt(l,"ProgramConfigurationSet");const m=We/Math.PI/2,y=5,x=6,T=16383,S=64,M=[S,32,16],I=-m,C=m;function L(r,e,i,s=m){return i=ni(i),[r*Math.sin(i)*s,-e*s,r*Math.cos(i)*s]}function R(r,e,i){return L(Math.cos(ni(r)),Math.sin(ni(r)),e,i)}const F=63710088e-1,B=2*Math.PI*F;class V{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 V(_e(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,s=this.lat*i,a=e.lat*i,u=Math.sin(s)*Math.sin(a)+Math.cos(s)*Math.cos(a)*Math.cos((e.lng-this.lng)*i);return F*Math.acos(Math.min(u,1))}toBounds(e=0){const i=360*e/40075017,s=i/Math.cos(Math.PI/180*this.lat);return new Z({lng:this.lng-s,lat:this.lat-i},{lng:this.lng+s,lat:this.lat+i})}toEcef(e){return R(this.lat,this.lng,m+e*m/F)}static convert(e){if(e instanceof V)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new V(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new V(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 Z{constructor(e,i){if(e)if(i)this.setSouthWest(e).setNorthEast(i);else if(e.length===4){const s=e;this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]])}else{const s=e;this.setSouthWest(s[0]).setNorthEast(s[1])}}setNorthEast(e){return this._ne=e instanceof V?new V(e.lng,e.lat):V.convert(e),this}setSouthWest(e){return this._sw=e instanceof V?new V(e.lng,e.lat):V.convert(e),this}extend(e){const i=this._sw,s=this._ne;let a,u;if(e instanceof V)a=e,u=e;else{if(!(e instanceof Z))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Z.convert(e)):this.extend(V.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(V.convert(e)):this;if(a=e._sw,u=e._ne,!a||!u)return this}return i||s?(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),s.lng=Math.max(u.lng,s.lng),s.lat=Math.max(u.lat,s.lat)):(this._sw=new V(a.lng,a.lat),this._ne=new V(u.lng,u.lat)),this}getCenter(){return new V((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 V(this.getWest(),this.getNorth())}getSouthEast(){return new V(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:s}=V.convert(e);let a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&a}static convert(e){if(e)return e instanceof Z?e:new Z(e)}}const Y=0,te=25.5;function ee(r){return B*Math.cos(r*Math.PI/180)}function J(r){return(180+r)/360}function K(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function ie(r,e){return r/ee(e)}function ne(r){return 360*r-180}function fe(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function me(r,e){return r*ee(fe(e))}const Ae=85.051129;function Me(r){return Math.cos(ni(Q(r,-85.051129,Ae)))}function Fe(r,e){const i=Q(e,Y,te),s=Math.pow(2,i);return Me(r)*B/(512*s)}function de(r){return 1/Math.cos(r*Math.PI/180)}function we(r,e=0){const i=Math.exp(Math.PI*(1-(r.y+e/We)/(1<<r.z)*2));return 80150034*i/(i*i+1)/We/(1<<r.z)}class le{constructor(e,i,s=0){this.x=+e,this.y=+i,this.z=+s}static fromLngLat(e,i=0){const s=V.convert(e);return new le(J(s.lng),K(s.lat),ie(i,s.lat))}toLngLat(){return new V(ne(this.x),fe(this.y))}toAltitude(){return me(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/B*de(fe(this.y))}}function Pe(r,e,i,s,a,u,h,f,_){const g=(e+s)/2,v=(i+a)/2,b=new He(g,v);f(b),function(w,E,A,P,D,k){const j=A-D,G=P-k;return Math.abs((P-E)*j-(A-w)*G)/Math.hypot(j,G)}(b.x,b.y,u.x,u.y,h.x,h.y)>=_?(Pe(r,e,i,g,v,u,b,f,_),Pe(r,g,v,s,a,b,h,f,_)):r.push(h)}function ye(r,e,i){let s=r[0],a=s.x,u=s.y;e(s);const h=[s];for(let f=1;f<r.length;f++){const _=r[f],{x:g,y:v}=_;e(_),Pe(h,a,u,g,v,s,_,e,i),a=g,u=v,s=_}return h}function De(r,e,i,s){if(s(e,i)){const a=e.add(i)._mult(.5);De(r,e,a,s),De(r,a,i,s)}else r.push(i)}function qe(r,e){let i=r[0];const s=[i];for(let a=1;a<r.length;a++){const u=r[a];De(s,i,u,e),i=u}return s}const Ce=Math.pow(2,14)-1,je=-Ce-1;function it(r,e){const i=Math.round(r.x*e),s=Math.round(r.y*e);
7return r.x=Q(i,je,Ce),r.y=Q(s,je,Ce),(i<r.x||i>r.x+1||s<r.y||s>r.y+1)&&kt("Geometry exceeds allowed extent, reduce your vector tile buffer size"),r}function rt(r,e,i){const s=r.loadGeometry(),a=r.extent,u=We/a;if(e&&i&&i.projection.isReprojectedInTileSpace){const h=1<<e.z,{scale:f,x:_,y:g,projection:v}=i,b=w=>{const E=ne((e.x+w.x/a)/h),A=fe((e.y+w.y/a)/h),P=v.project(E,A);w.x=(P.x*f-_)*a,w.y=(P.y*f-g)*a};for(let w=0;w<s.length;w++)if(r.type!==1)s[w]=ye(s[w],b,1);else{const E=[];for(const A of s[w])A.x<0||A.x>=a||A.y<0||A.y>=a||(b(A),E.push(A));s[w]=E}}for(const h of s)for(const f of h)it(f,u);return s}function Qe(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?rt(r):[]}}var ut,pt,yt,It,Ot,pi,Ri,gi={};function bi(){if(pt)return ut;pt=1;var r=xo();function e(a,u,h,f,_){this.properties={},this.extent=h,this.type=0,this._pbf=a,this._geometry=-1,this._keys=f,this._values=_,a.readFields(i,this,u)}function i(a,u,h){a==1?u.id=h.readVarint():a==2?function(f,_){for(var g=f.readVarint()+f.pos;f.pos<g;){var v=_._keys[f.readVarint()],b=_._values[f.readVarint()];_.properties[v]=b}}(h,u):a==3?u.type=h.readVarint():a==4&&(u._geometry=h.pos)}function s(a){for(var u,h,f=0,_=0,g=a.length,v=g-1;_<g;v=_++)f+=((h=a[v]).x-(u=a[_]).x)*(u.y+h.y);return f}return ut=e,e.types=["Unknown","Point","LineString","Polygon"],e.prototype.loadGeometry=function(){var a=this._pbf;a.pos=this._geometry;for(var u,h=a.readVarint()+a.pos,f=1,_=0,g=0,v=0,b=[];a.pos<h;){if(_<=0){var w=a.readVarint();f=7&w,_=w>>3}if(_--,f===1||f===2)g+=a.readSVarint(),v+=a.readSVarint(),f===1&&(u&&b.push(u),u=[]),u.push(new r(g,v));else{if(f!==7)throw new Error("unknown command "+f);u&&u.push(u[0].clone())}}return u&&b.push(u),b},e.prototype.bbox=function(){var a=this._pbf;a.pos=this._geometry;for(var u=a.readVarint()+a.pos,h=1,f=0,_=0,g=0,v=1/0,b=-1/0,w=1/0,E=-1/0;a.pos<u;){if(f<=0){var A=a.readVarint();h=7&A,f=A>>3}if(f--,h===1||h===2)(_+=a.readSVarint())<v&&(v=_),_>b&&(b=_),(g+=a.readSVarint())<w&&(w=g),g>E&&(E=g);else if(h!==7)throw new Error("unknown command "+h)}return[v,w,b,E]},e.prototype.toGeoJSON=function(a,u,h){var f,_,g=this.extent*Math.pow(2,h),v=this.extent*a,b=this.extent*u,w=this.loadGeometry(),E=e.types[this.type];function A(k){for(var j=0;j<k.length;j++){var G=k[j];k[j]=[360*(G.x+v)/g-180,360/Math.PI*Math.atan(Math.exp((180-360*(G.y+b)/g)*Math.PI/180))-90]}}switch(this.type){case 1:var P=[];for(f=0;f<w.length;f++)P[f]=w[f][0];A(w=P);break;case 2:for(f=0;f<w.length;f++)A(w[f]);break;case 3:for(w=function(k){var j=k.length;if(j<=1)return[k];for(var G,z,N=[],q=0;q<j;q++){var H=s(k[q]);H!==0&&(z===void 0&&(z=H<0),z===H<0?(G&&N.push(G),G=[k[q]]):G.push(k[q]))}return G&&N.push(G),N}(w),f=0;f<w.length;f++)for(_=0;_<w[f].length;_++)A(w[f][_])}w.length===1?w=w[0]:E="Multi"+E;var D={type:"Feature",geometry:{type:E,coordinates:w},properties:this.properties};return"id"in this&&(D.id=this.id),D},ut}function ur(){if(It)return yt;It=1;var r=bi();function e(s,a){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=s,this._keys=[],this._values=[],this._features=[],s.readFields(i,this,a),this.length=this._features.length}function i(s,a,u){s===15?a.version=u.readVarint():s===1?a.name=u.readString():s===5?a.extent=u.readVarint():s===2?a._features.push(u.pos):s===3?a._keys.push(u.readString()):s===4&&a._values.push(function(h){for(var f=null,_=h.readVarint()+h.pos;h.pos<_;){var g=h.readVarint()>>3;f=g===1?h.readString():g===2?h.readFloat():g===3?h.readDouble():g===4?h.readVarint64():g===5?h.readVarint():g===6?h.readSVarint():g===7?h.readBoolean():null}return f}(u))}return yt=e,e.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var a=this._pbf.readVarint()+this._pbf.pos;return new r(this._pbf,a,this.extent,this._keys,this._values)},yt}function Rt(){return Ri||(Ri=1,gi.VectorTile=function(){if(pi)return Ot;pi=1;var r=ur();function e(i,s,a){if(i===3){var u=new r(a,a.readVarint()+a.pos);u.length&&(s[u.name]=u)}}return Ot=function(i,s){this.layers=i.readFields(e,{},s)},Ot}(),gi.VectorTileFeature=bi(),gi.VectorTileLayer=ur()),gi}var Vt=Rt();const Wt="3d_elevation_id",Oi="level";
7class br{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(e,i){return this._valid&&e(i(this._geometry)),this}require(e,i,s){return this.get(e,!0,i,s)}optional(e,i,s){return this.get(e,!1,i,s)}success(){return this._valid}get(e,i,s,a){const u=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&u!==void 0&&!Number.isNaN(u)?s(a?a(u):u):i&&(this._valid=!1),this}}class Di{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,s){return this.featureFunc(e,i,s)}parseVertex(e,i,s){return this.vertexFunc(e,i,s)}}const li=new Di((r,e,i)=>r.reset(e).require(Wt,s=>{i.id=s}).optional("fixed_height_relative",s=>{i.constantHeight=s},Qt.decodeRelativeHeight).geometry(s=>{i.bounds=s},ku).success(),(r,e,i)=>r.reset(e).require(Wt,s=>{i.id=s}).require("elevation_idx",s=>{i.idx=s}).require("extent",s=>{i.extent=s}).require("height_relative",s=>{i.height=s},Qt.decodeRelativeHeight).geometry(s=>{i.position=s},Qt.getPoint).success()),nr=new Di((r,e,i)=>r.reset(e).require(Wt,s=>{i.id=s}).optional("fixed_height",s=>{i.constantHeight=s},Qt.decodeMetricHeight).geometry(s=>{i.bounds=s},ku).success(),(r,e,i)=>r.reset(e).require(Wt,s=>{i.id=s}).require("elevation_idx",s=>{i.idx=s}).require("extent",s=>{i.extent=s}).require("height",s=>{i.height=s},Qt.decodeMetricHeight).geometry(s=>{i.position=s},Qt.getPoint).success());class Qt{static getPoint(e){return Fn(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static parse(e){const i=[],s=[],a=e.length,u=new br;for(let f=0;f<a;f++){const _=e.feature(f),g=_.properties.hasOwnProperty("version")?String(_.properties.version):void 0,v=(h=g)?h==="1.0.1"?nr:void 0:li;if(v===void 0){kt(`Unknown elevation feature version number ${g||"(unknown)"}`);continue}const b=_.properties.hasOwnProperty("type")?_.properties.type:void 0;if(b){if(Vt.VectorTileFeature.types[_.type]==="Point"&&b==="curve_point"){const w={};v.parseVertex(u,_,w)&&i.push(w)}else if(Vt.VectorTileFeature.types[_.type]==="Polygon"&&b==="curve_meta"){const w={};v.parseFeature(u,_,w)&&s.push(w)}}}var h;return{vertices:i,features:s}}}class mr{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,s){const a=Yi(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 s[0]=this.pos[0]+this.dir[0]*u,s[1]=this.pos[1]+this.dir[1]*u,!0}}class Bi{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,s){const a=_r(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 s[0]=this.pos[0]+this.dir[0]*u,s[1]=this.pos[1]+this.dir[1]*u,s[2]=this.pos[2]+this.dir[2]*u,!0}closestPointOnSphere(e,i,s){if(function(E,A){var P=E[0],D=E[1],k=E[2],j=A[0],G=A[1],z=A[2];return Math.abs(P-j)<=Gt*Math.max(1,Math.abs(P),Math.abs(j))&&Math.abs(D-G)<=Gt*Math.max(1,Math.abs(D),Math.abs(G))&&Math.abs(k-z)<=Gt*Math.max(1,Math.abs(k),Math.abs(z))}(this.pos,e)||i===0)return s[0]=s[1]=s[2]=0,!1;const[a,u,h]=this.dir,f=this.pos[0]-e[0],_=this.pos[1]-e[1],g=this.pos[2]-e[2],v=a*a+u*u+h*h,b=2*(f*a+_*u+g*h),w=b*b-4*v*(f*f+_*_+g*g-i*i);if(w<0){const E=Math.max(-b/2,0),A=f+a*E,P=_+u*E,D=g+h*E,k=Math.hypot(A,P,D);return s[0]=A*i/k,s[1]=P*i/k,s[2]=D*i/k,!1}{const E=(-b-Math.sqrt(w))/(2*v);if(E<0){const A=Math.hypot(f,_,g);return s[0]=f*i/A,s[1]=_*i/A,s[2]=g*i/A,!1}return s[0]=f+a*E,s[1]=_+u*E,s[2]=g+h*E,!0}}}class Mi{constructor(e,i,s,a,u){this.TL=e,this.TR=i,this.BR=s,this.BL=a,this.horizon=u}static fromInvProjectionMatrix(e,i,s){const a=[-1,1,1],u=[1,1,1],h=[1,-1,1],f=[-1,-1,1],_=Gi(a,a,e),g=Gi(u,u,e),v=Gi(h,h,e),b=Gi(f,f,e);return new Mi(_,g,v,b,i/s)}}function Ni(r,e,i){let s=1/0,a=-1/0;const u=[];for(const h of r){gr(u,h,e);const f=_r(u,i);s=Math.min(s,f),a=Math.max(a,f)}return[s,a]}function ui(r,e){let i=!0;for(let s=0;s<r.planes.length;s++){const a=r.planes[s];let u=0;for(let h=0;h<e.length;h++)u+=_r(a,e[h])+a[3]>=0;if(u===0)return 0;u!==e.length&&(i=!1)}return i?2:1}function ar(r,e){for(const i of r.projections){const s=Ni(e,r.points[0],i.axis);if(i.projection[1]<s[0]||i.projection[0]>s[1])return 0}return 1}function Nr(r,e){let i=0;const s=[0,0,0,0];for(let h=0;h<r.length;
vendor: 7,669 bytes, line 7
7h++)s[0]=r[h][0],s[1]=r[h][1],s[2]=r[h][2],s[3]=1,(a=s)[0]*(u=e)[0]+a[1]*u[1]+a[2]*u[2]+a[3]*u[3]>=0&&i++;var a,u;return i}class Hi{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=si.fromPoints(this.points),this.projections=[],this.frustumEdges=[gr([],this.points[2],this.points[3]),gr([],this.points[0],this.points[3]),gr([],this.points[4],this.points[0]),gr([],this.points[5],this.points[1]),gr([],this.points[6],this.points[2]),gr([],this.points[7],this.points[3])];for(const s of this.frustumEdges){const a=[0,-s[2],s[1]],u=[s[2],0,-s[0]];this.projections.push({axis:a,projection:Ni(this.points,this.points[0],a)}),this.projections.push({axis:u,projection:Ni(this.points,this.points[0],u)})}}static fromInvProjectionMatrix(e,i,s,a){const u=Math.pow(2,s),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(g=>{const v=en([],g,e),b=1/v[3]/i*u;return(w=v)[0]=(E=v)[0]*(A=[b,b,a?1/v[3]:b,b])[0],w[1]=E[1]*A[1],w[2]=E[2]*A[2],w[3]=E[3]*A[3],w;var w,E,A}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(g=>{const v=tr([],Pr([],gr([],h[g[0]],h[g[1]]),gr([],h[g[2]],h[g[1]]))),b=-_r(v,h[g[1]]);return v.concat(b)}),_=[];for(let g=0;g<h.length;g++)_.push([h[g][0],h[g][1],h[g][2]]);return new Hi(_,f)}intersectsPrecise(e,i,s){for(let a=0;a<i.length;a++)if(!Nr(e,i[a]))return 0;for(let a=0;a<this.planes.length;a++)if(!Nr(e,this.planes[a]))return 0;for(const a of s)for(const u of this.frustumEdges){const h=Pr([],a,u),f=Jr(h);if(f===0)continue;Xi(h,h,1/f);const _=Ni(this.points,this.points[0],h),g=Ni(e,this.points[0],h);if(_[0]>g[1]||g[0]>_[1])return 0}return 1}containsPoint(e){for(const i of this.planes){const s=i[3];if(_r([i[0],i[1],i[2]],e)+s<0)return!1}return!0}}class si{static fromPoints(e){const i=[1/0,1/0,1/0],s=[-1/0,-1/0,-1/0];for(const a of e)fs(i,i,a),qn(s,s,a);return new si(i,s)}static fromTileIdAndHeight(e,i,s){const a=1<<e.canonical.z,u=e.canonical.x,h=e.canonical.y;return new si([u/a,h/a,i],[(u+1)/a,(h+1)/a,s])}static applyTransform(e,i){const s=e.getCorners();for(let a=0;a<s.length;++a)Gi(s[a],s[a],i);return si.fromPoints(s)}static applyTransformFast(e,i){const s=[i[12],i[13],i[14]],a=[...s];for(let u=0;u<3;u++)for(let h=0;h<3;h++){const f=i[4*h+u],_=f*e.min[h],g=f*e.max[h];s[u]+=Math.min(_,g),a[u]+=Math.max(_,g)}return new si(s,a)}static projectAabbCorners(e,i){const s=e.getCorners();for(let a=0;a<s.length;++a)Gi(s[a],s[a],i);return s}constructor(e,i){this.min=e,this.max=i,this.center=Xi([],xr([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],s=mo(this.min),a=mo(this.max);for(let u=0;u<i.length;u++)s[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 si(s,a)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?ui(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?ui(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)?ar(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?ar(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])]}}tt(si,"Aabb");class wn{constructor(e,i){this.feature=e,this.metersToTile=i,this.index=0}get(){const e=this.feature.vertices[this.index],i=this.feature.vertexProps[this.index].dir,s=i[1],a=-i[0],u=(e.extent+1)*this.metersToTile;return[new He(Math.trunc(e.position[0]+s*u),Math.trunc(e.position[1]+a*u)),new He(Math.trunc(e.position[0]-s*u),Math.trunc(e.position[1]-a*u))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class pn{constructor(e,i,s,a,u,h){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this.id=e,this.heightRange={min:s,max:s},this.safeArea=i,this.constantHeight=s,this.constantHeight==null&&(this.constantHeight!=null||a.length!==0)){this.vertices=a,this.edges=u,this.edges=this.edges.filter(f=>{return f.a<this.vertices.length&&f.b<this.vertices.length&&!((_=this.vertices[f.a].position)[0]===(g=this.vertices[f.b].position)[0]&&_[1]===g[1]);var _,g}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const f of this.vertices)this.vertexProps.push({dir:Fn(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,f.height),this.heightRange.max=Math.max(this.heightRange.max,f.height);for(const f of this.edges){const _=this.vertices[f.a].position,g=this.vertices[f.b].position,v=Us($r(),g,_),b=js(v),w=yo($r(),v,1/b);this.edgeProps.push({vec:v,dir:w,len:b});const E=this.vertexProps[f.a].dir,A=this.vertexProps[f.b].dir;go(E,E,w),go(A,A,w)}for(const f of this.vertexProps)f.dir[0]===0&&f.dir[1]===0||ra(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[s,a]=i;return Tt(this.vertices[this.edges[s].a].height,this.vertices[this.edges[s].b].height,a)}computeSlopeNormal(e,i){const s=this.getClosestEdge(e);if(!s)return Ai(0,0,1);const a=s[0],u=this.edges[a],h=this.edgeProps[a].vec,f=Ai(h[0],h[1],(this.vertices[u.b].height-this.vertices[u.a].height)*i),_=Ai(f[1],-f[0],0);Pr(_,_,f);const g=Jr(_);return g>0?Xi(_,_,1/g):Ai(0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let i=0,s=Number.POSITIVE_INFINITY,a=0;const u=Fn(e.x,e.y);for(let h=0;h<this.edges.length;h++){const f=this.edges[h],_=this.edgeProps[h].dir,g=new mr(u,this.edgeProps[h].dir),v=this.vertices[f.a].position,b=this.vertices[f.b].position,w=$r(),E=$r(),A=g.intersectsPlane(v,this.vertexProps[f.a].dir,w),P=g.intersectsPlane(b,this.vertexProps[f.b].dir,E);if(!A||!P)continue;const D=Us($r(),E,w),k=Us($r(),u,w),j=Yi(D,D),G=j>0?Yi(k,D)/j:0,z=Q(G,0,1),N=Math.abs((G-z)*this.edgeProps[h].len),q=Us($r(),u,v),H=N+Math.abs(Yi(q,Fn(_[1],-_[0])));H<s&&(i=h,s=H,a=z)}return[i,a]}tessellate(e){for(let i=this.edges.length-1;i>=0;--i){const s=this.edges[i].a,a=this.edges[i].b,{position:u,height:h,extent:f}=this.vertices[s],{position:_,height:g,extent:v}=this.vertices[a],b=this.vertexProps[s].dir,w=this.vertexProps[a].dir,E=Ai(u[0]/e,u[1]/e,h),A=Ai(_[0]/e,_[1]/e,g),P=Ai(b[1],-b[0],0);Xi(P,P,f);const D=Ai(w[1],-w[0],0);if(Xi(D,D,v),this.distSqLines(Ai(E[0]+.5*P[0],E[1]+.5*P[1],E[2]+.5*P[2]),Ai(A[0]-.5*D[0],A[1]-.5*D[1],A[2]-.5*D[2]),Ai(E[0]-.5*P[0],E[1]-.5*P[1],E[2]-.5*P[2]),Ai(A[0]+.5*D[0],A[1]+.5*D[1],A[2]+.5*D[2]))<=.0025000000000000005)continue;
7const k=this.vertices.length,j=go($r(),u,_);this.vertices.push({position:yo(j,j,.5),height:.5*(h+g),extent:.5*(f+v)});const G=go($r(),b,w);this.vertexProps.push({dir:ra(G,G)}),this.edges.splice(i,1),this.edgeProps.splice(i,1),this.edges.push({a:s,b:k}),this.edges.push({a:k,b:a});const z=Us($r(),this.vertices[k].position,u),N=js(z),q={vec:z,dir:yo($r(),z,1/N),len:N};this.edgeProps.push(q),this.edgeProps.push(q)}}distSqLines(e,i,s,a){const u=Cr(yr(),i,e),h=Cr(yr(),a,s),f=Cr(yr(),e,s),_=_r(u,u),g=_r(u,h),v=_r(u,f),b=_r(h,h),w=_r(h,f),E=_*b-g*g;if(E===0){const D=_r(f,h)/_r(h,h);return $n(Ln(yr(),s,a,D),e)}const A=(g*w-v*b)/E,P=(_*w-g*v)/E;return $n(Ln(yr(),e,i,A),Ln(yr(),s,a,P))}}class zn{static parseFrom(e,i){const s=Qt.parse(e);if(!s)return[];let{vertices:a,features:u}=s;const h=1/we(i);u.sort((v,b)=>v.id-b.id),a.sort((v,b)=>v.id-b.id||v.idx-b.idx),a=a.filter((v,b,w)=>b===w.findIndex(E=>E.id===v.id&&E.idx===v.idx));const f=new Array;let _=0;const g=a.length;for(const v of u){if(v.constantHeight){f.push(new pn(v.id,v.bounds,v.constantHeight));continue}for(;_!==g&&a[_].id<v.id;)_++;if(_===g||a[_].id!==v.id)continue;const b=new Array,w=new Array,E=_;for(;_!==g&&a[_].id===v.id;){const A=a[_];if(b.push({position:A.position,height:A.height,extent:A.extent}),_!==E&&a[_-1].idx===A.idx-1){const P=_-E;w.push({a:P-1,b:P})}_++}f.push(new pn(v.id,v.bounds,void 0,b,w,h))}return f}static getElevationFeature(e,i){if(!i)return;const s=+e.properties[Wt];return Number.isNaN(s)?void 0:i.find(a=>a.id===s)}}class Qn{constructor(e,i){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(i)||(this.zScale=Math.pow(2,i.z-e.z),this.xOffset=(e.x*this.zScale-i.x)*We,this.yOffset=(e.y*this.zScale-i.y)*We)}constantElevation(e,i){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,s){const a=this.constantElevation(i,s);return a??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),s))}computeBiasedHeight(e,i){return i<=0?e:e+i*ce(0,i,e>=0?e:Math.abs(.5*e))}}tt(pn,"ElevationFeature");class jn{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 Cs,this.indexArray=new Br,this.segments=new or,this.programConfigurations=new l(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new ro),this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,s,a){const u=this.layers[0],h=[];let f=null;u.type==="circle"&&(f=u.layout.get("circle-sort-key"));for(const{feature:g,id:v,index:b,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,A=Qe(g,E);if(!this.layers[0]._featureFilter.filter(new Ti(this.zoom,{worldview:this.worldview}),A,s))continue;const P=f?f.evaluate(A,{},s):void 0,D={id:v,properties:g.properties,type:g.type,sourceLayerIndex:w,index:b,geometry:E?A.geometry:rt(g,s,a),patterns:{},sortKey:P};h.push(D)}f&&h.sort((g,v)=>g.sortKey-v.sortKey);let _=null;a.projection.name==="globe"&&(this.globeExtVertexArray=new Yc,_=a.projection);for(const g of h){const{geometry:v,index:b,sourceLayerIndex:w}=g,E=e[b].feature;this.addFeature(g,v,b,i.availableImages,s,_,i.brightness,i.elevationFeatures),i.featureIndex.insert(E,v,b,w,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(e,i,s,a,u,h,f){this.programConfigurations.updatePaintArrays(e,i,u,s,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,Qf.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,tu.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,em.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(e,i,s,a,u,h,f,_){let g;this.elevationMode!=="none"&&(g=zn.getElevationFeature(e,_));for(const v of i)for(const b of v){const w=b.x,E=b.y;if(w<0||w>=We||E<0||E>=We)continue;if(h){const D=h.projectTilePoint(w,E,u),k=h.upVector(u,w,E);this.addGlobeExtVertex(D,k),this.addGlobeExtVertex(D,k),this.addGlobeExtVertex(D,k),this.addGlobeExtVertex(D,k)}const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),P=A.vertexLength;if(this.addCircleVertex(w,E,-1,-1),this.addCircleVertex(w,E,1,-1),this.addCircleVertex(w,E,1,1),this.addCircleVertex(w,E,-1,1),this.elevationMode!=="none"){const D=g?g.pointElevation(new He(w,E)):0;this.hasElevation=this.hasElevation||D!==0;for(let k=0;k<4;k++)this.elevatedLayoutVertexArray.emplaceBack(D)}this.indexArray.emplaceBack(P,P+1,P+2),this.indexArray.emplaceBack(P,P+2,P+3),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},a,u,f,void 0,this.worldview)}addCircleVertex(e,i,s,a){this.layoutVertexArray.emplaceBack(2*e+(s+1)/2,2*i+(a+1)/2)}addGlobeExtVertex(e,i){this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}}function fn(r,e){for(let i=0;i<r.length;i++)if(hs(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(hs(r,e[i]))return!0;return!!Zl(r,e)}function ao(r,e,i){return!!hs(r,e)||!!Hl(e,r,i)}function es(r,e){if(r.length===1)return au(e,r[0]);for(let i=0;i<e.length;i++){const s=e[i];for(let a=0;a<s.length;a++)if(hs(r,s[a]))return!0}for(let i=0;i<r.length;
vendor: 12,175 bytes, line 7
7i++)if(au(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Zl(r,e[i]))return!0;return!1}function lo(r,e,i){if(r.length>1){if(Zl(r,e))return!0;for(let s=0;s<e.length;s++)if(Hl(e[s],r,i))return!0}for(let s=0;s<r.length;s++)if(Hl(r[s],e,i))return!0;return!1}function Zl(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const s=r[i],a=r[i+1];for(let u=0;u<e.length-1;u++)if(Ph(s,a,e[u],e[u+1]))return!0}return!1}function Ph(r,e,i,s){return Ii(r,i,s)!==Ii(e,i,s)&&Ii(r,e,i)!==Ii(r,e,s)}function Na(r,e,i){return(r.x-i.x)*(e.y-i.y)-(r.y-i.y)*(e.x-i.x)}function zh(r,e,i,s){const a=Na(r,e,s),u=Na(r,e,i);if(Math.sign(a)===Math.sign(u))return;const h=Na(i,s,r),f=h+u-a;return Math.sign(h)!==Math.sign(f)?[h/(h-f),u/(u-a)]:void 0}function Hl(r,e,i){const s=i*i;if(e.length===1)return r.distSqr(e[0])<s;for(let a=1;a<e.length;a++)if(ou(r,e[a-1],e[a])<s)return!0;return!1}function ou(r,e,i){const s=e.distSqr(i);if(s===0)return r.distSqr(e);const a=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/s;return r.distSqr(a<0?e:a>1?i:i.sub(e)._mult(a)._add(e))}function au(r,e){let i,s,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++)s=i[f],a=i[_],s.y>e.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(u=!u)}return u}function hs(r,e){let i=!1;for(let s=0,a=r.length-1;s<r.length;a=s++){const u=r[s],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 Va(r,e,i,s,a){for(const h of r)if(e<=h.x&&i<=h.y&&s>=h.x&&a>=h.y)return!0;const u=[new He(e,i),new He(e,a),new He(s,a),new He(s,i)];if(r.length>2){for(const h of u)if(hs(r,h))return!0}for(let h=0;h<r.length-1;h++)if(Go(r[h],r[h+1],u))return!0;return!1}function Go(r,e,i){const s=i[0],a=i[2];if(r.x<s.x&&e.x<s.x||r.x>a.x&&e.x>a.x||r.y<s.y&&e.y<s.y||r.y>a.y&&e.y>a.y)return!1;const u=Ii(r,e,i[0]);return u!==Ii(r,e,i[1])||u!==Ii(r,e,i[2])||u!==Ii(r,e,i[3])}function co(r,e,i,s,a,u){let h=e.y-r.y,f=r.x-e.x;if(u=u||0){const _=h*h+f*f;if(_===0)return!0;const g=Math.sqrt(_);h/=g,f/=g}return!((i.x-r.x)*h+(i.y-r.y)*f-u<0||(s.x-r.x)*h+(s.y-r.y)*f-u<0||(a.x-r.x)*h+(a.y-r.y)*f-u<0)}function im(r,e,i,s,a,u,h){return!(co(r,e,s,a,u,h)||co(e,i,s,a,u,h)||co(i,r,s,a,u,h)||co(s,a,r,e,i,h)||co(a,u,r,e,i,h)||co(u,s,r,e,i,h))}function lu(r,e,i){const s=e.paint.get(r).value;return s.kind==="constant"?s.value:i.programConfigurations.get(e.id).getMaxValue(r)}function gp(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function C_(r,e,i,s,a){if(!e[0]&&!e[1])return r;const u=He.convert(e)._mult(a);i==="viewport"&&u._rotate(-s);const h=[];for(let f=0;f<r.length;f++)h.push(r[f].sub(u));return h}function P_(r,e,i,s){const a=He.convert(r)._mult(s);return e==="viewport"&&a._rotate(-i),a}let z_,R_;function D_(r,e,i){var s=2*Math.PI*6378137/256/Math.pow(2,i);return[r*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}tt(jn,"CircleBucket",{omit:["layers"]});class Wl{constructor(e,i,s){this.z=e,this.x=i,this.y=s,this.key=cu(0,e,e,i,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i){const s=function(u,h,f){var _=D_(256*u,256*(h=Math.pow(2,f)-h-1),f),g=D_(256*(u+1),256*(h+1),f);return _[0]+","+_[1]+","+g[0]+","+g[1]}(this.x,this.y,this.z),a=function(u,h,f){let _,g="";for(let v=u;v>0;v--)_=1<<v-1,g+=(h&_?1:0)+(f&_?2:0);return g}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",a).replace("{bbox-epsg-3857}",s)}toString(){return`${this.z}/${this.x}/${this.y}`}}class L_{constructor(e,i){this.wrap=e,this.canonical=i,this.key=cu(e,i.z,i.z,i.x,i.y)}}class an{constructor(e,i,s,a,u){this.overscaledZ=e,this.wrap=i,this.canonical=new Wl(s,+a,+u),this.key=i===0&&e===s?this.canonical.key:cu(i,e,s,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 an(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new an(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 cu(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const s=this.canonical.z-e;return cu(this.wrap*+i,e,e,this.canonical.x>>s,this.canonical.y>>s)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const i=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new an(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,s=2*this.canonical.x,a=2*this.canonical.y;return[new an(i,this.wrap,i,s,a),new an(i,this.wrap,i,s+1,a),new an(i,this.wrap,i,s,a+1),new an(i,this.wrap,i,s+1,a+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new an(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new an(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 L_(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function cu(r,e,i,s,a){const u=1<<Math.min(i,22);let h=u*(a%u)+s%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 Lv=[r=>{let e=r.canonical.x-1,i=r.wrap;return e<0&&(e=(1<<r.canonical.z)-1,i--),new an(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 an(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>new an(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(r.canonical.y===0?1<<r.canonical.z:r.canonical.y)-1),r=>new an(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<<r.canonical.z)-1?0:r.canonical.y+1)];tt(Wl,"CanonicalTileID"),tt(an,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const Fv=ii([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:yp}=Fv,kv=ii([{name:"a_pos_3",components:3,type:"Int16"}]);var F_=ii([{name:"a_pos",type:"Int16",components:2}]);function xp(r){return r*m/F}const Ov=[new si([I,I,I],[C,C,C]),new si([I,I,I],[0,0,C]),new si([0,I,I],[C,0,C]),new si([I,0,I],[0,C,C]),new si([0,0,I],[C,C,C])];function k_(r,e,i,s=!0){const a=Xi([],r._camera.position,r.worldSize),u=[e,i,1,1];en(u,u,r.pixelMatrixInverse),_o(u,u,1/u[3]);const h=tr([],gr([],u,a)),f=r.globeMatrix,_=[f[12],f[13],f[14]],g=gr([],_,a),v=Jr(g),b=tr([],g),w=r.worldSize/(2*Math.PI),E=_r(b,h),A=Math.asin(w/v);if(A<Math.acos(E)){if(!s)return null;const ae=[],he=[];Xi(ae,h,v/E),tr(he,gr(he,ae,g)),tr(h,xr(h,g,Xi(h,he,Math.tan(A)*v)))}const P=[];new Bi(a,h).closestPointOnSphere(_,w,P);const D=tr([],ir(f,0)),k=tr([],ir(f,1)),j=tr([],ir(f,2)),G=_r(D,P),z=_r(k,P),N=_r(j,P),q=xe(Math.asin(-z/w));let H=xe(Math.atan2(G,N));H=r.center.lng+function(ae,he){const Te=(he-ae+180)%360-180;return Te<-180?Te+360:Te}(r.center.lng,H);const oe=J(H),re=Q(K(q),0,1);return new le(oe,re)}class Bv{constructor(e,i,s){this.a=gr([],e,s),this.b=gr([],i,s),this.center=s;const a=tr([],this.a),u=tr([],this.b);this.angle=Math.acos(_r(a,u))}}function rm(r,e){if(r.angle===0)return null;let i;return i=r.a[e]===0?1/r.angle*.5*Math.PI:1/r.angle*Math.atan(r.b[e]/r.a[e]/Math.sin(r.angle)-1/Math.tan(r.angle)),i<0||i>1?null:function(s,a,u,h){const f=Math.sin(u);return s*(Math.sin((1-h)*u)/f)+a*(Math.sin(h*u)/f)}(r.a[e],r.b[e],r.angle,Q(i,0,1))+r.center[e]}function uo(r){if(r.z<=1)return Ov[r.z+2*r.y+r.x];const e=nm(vp(r));return si.fromPoints(e)}function qo(r,e,i){return Xi(r,r,1-i),In(r,r,e,i)}function O_(r,e,i){for(const s of r)Gi(s,s,e),Xi(s,s,i)}function B_(r,e,i,s){const a=e/r.worldSize,u=r.globeMatrix;if(i.z<=1){const re=uo(i).getCorners();return O_(re,u,a),si.fromPoints(re)}const h=vp(i,s),f=nm(h,m+xp(r._tileCoverLift));O_(f,u,a);const _=Number.MAX_VALUE,g=[-_,-_,-_],v=[_,_,_];if(h.contains(r.center)){for(const he of f)fs(v,v,he),qn(g,g,he);g[2]=0;const re=r.point,ae=[re.x*a,re.y*a,0];return fs(v,v,ae),qn(g,g,ae),new si(v,g)}if(r._tileCoverLift>0){for(const re of f)fs(v,v,re),qn(g,g,re);return new si(v,g)}const b=[u[12]*a,u[13]*a,u[14]*a],w=h.getCenter(),E=Q(r.center.lat,-85.051129,Ae),A=Q(w.lat,-85.051129,Ae),P=J(r.center.lng),D=K(E);let k=P-J(w.lng);const j=D-K(A);k>.5?k-=1:k<-.5&&(k+=1);let G=0;Math.abs(k)>Math.abs(j)?G=k>=0?1:3:(G=j>=0?0:2,In(b,b,[u[4]*a,u[5]*a,u[6]*a],-Math.sin(ni(j>=0?h.getSouth():h.getNorth()))*m));const z=f[G],N=f[(G+1)%4],q=new Bv(z,N,b),H=[rm(q,0)||z[0],rm(q,1)||z[1],rm(q,2)||z[2]],oe=Ua(r.zoom);if(oe>0){const re=function({x:he,y:Te,z:Oe},ze,ke,Be,Ee){const Le=1/(1<<Oe);let be=he*Le,Se=be+Le,Ue=Te*Le,Ge=Ue+Le,_t=0;const ot=(be+Se)/2-Be;return ot>.5?_t=-1:ot<-.5&&(_t=1),be=((be+_t)*ze-(Be*=ze))*ke+Be,Se=((Se+_t)*ze-Be)*ke+Be,Ue=(Ue*ze-(Ee*=ze))*ke+Ee,Ge=(Ge*ze-Ee)*ke+Ee,[[be,Ge,0],[Se,Ge,0],[Se,Ue,0],[be,Ue,0]]}(i,e,r._pixelsPerMercatorPixel,P,D);for(let he=0;he<f.length;he++)qo(f[he],re[he],oe);const ae=xr([],re[G],re[(G+1)%4]);Xi(ae,ae,.5),qo(H,ae,oe)}for(const re of f)fs(v,v,re),qn(g,g,re);return v[2]=Math.min(z[2],N[2]),fs(v,v,H),qn(g,g,H),new si(v,g)}function vp({x:r,y:e,z:i},s=!1){const a=1/(1<<i),u=new V(ne(r*a),e===(1<<i)-1&&s?-90:fe((e+1)*a)),h=new V(ne((r+1)*a),e===0&&s?90:fe(e*a));return new Z(u,h)}function nm(r,e=m){const i=ni(r.getNorth()),s=ni(r.getSouth()),a=Math.cos(i),u=Math.cos(s),h=Math.sin(i),f=Math.sin(s),_=r.getWest(),g=r.getEast();return[L(u,f,_,e),L(u,f,g,e),L(a,h,g,e),L(a,h,_,e)]}function Rh(r,e,i,s){const a=1<<i.z,u=(r/We+i.x)/a;return R(fe((e/We+i.y)/a),ne(u),s)}function bp({min:r,max:e}){return T/Math.max(e[0]-r[0],e[1]-r[1],e[2]-r[2])}const N_=new Float64Array(16);function wp(r){const e=bp(r),i=Xo(N_,[e,e,e]);return Fr(i,i,Ko([],r.min))}function sm(r){const e=(s=r.min,(i=N_)[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=s[0],i[13]=s[1],i[14]=s[2],i[15]=1,i);var i,s;const a=1/bp(r);return dr(e,e,[a,a,a])}function om(r){const e=We/(2*Math.PI);return r/(2*Math.PI)/e}function V_(r,e){return We/(512*Math.pow(2,r))*bp(uo(e))}function U_(r,e,i,s,a){const u=om(i),h=[r,e,-i/(2*Math.PI)],f=Dt(new Float64Array(16));return Fr(f,f,h),dr(f,f,[u,u,u]),Dn(f,f,ni(-a)),cn(f,f,ni(-s)),f}function Ua(r){return ce(y,x,r)}function j_(r,e){const i=R(e.lat,e.lng),s=function(A){const P=R(A._center.lat,A._center.lng);let D=Pr([],Ai(0,1,0),P);const k=ks([],-A.angle,P);D=Gi(D,D,k),ks(k,-A._pitch,D);const j=tr([],P);return Xi(j,j,xp(A.cameraToCenterDistance/A.pixelsPerMeter)),Gi(j,j,k),xr([],P,j)}(r);return h=(a=Cr([],s,i))[0],f=a[1],_=a[2],g=(u=i)[0],v=u[1],b=u[2],E=(w=Math.sqrt(h*h+f*f+_*_)*Math.sqrt(g*g+v*v+b*b))&&_r(a,u)/w,Math.acos(Math.min(Math.max(E,-1),1));var a,u,h,f,_,g,v,b,w,E}function am(r,e){return j_(r,e)>Math.PI/2*1.01}const G_=ni(85),Nv=Math.cos(G_),Vv=Math.sin(G_),Uv=Kr(),q_=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 $_(r,e,i,s,a,u,h,f,_){if(u&&r.queryGeometry.isAboveHorizon)return!1;u&&(_*=r.pixelToTileUnitsFactor);const g=r.tileID.canonical,v=i.projection.upVectorScale(g,i.center.lat,i.worldSize).metersToTile;for(const b of e)for(const w of b){const E=w.add(f),A=a&&i.elevation?i.elevation.exaggeration()*a.getElevationAt(E.x,E.y,!0):0,P=i.projection.projectTilePoint(E.x,E.y,g);if(A>0){const G=i.projection.upVector(g,E.x,E.y);P.x+=G[0]*v*A,P.y+=G[1]*v*A,P.z+=G[2]*v*A}const D=u?E:jv(P.x,P.y,P.z,s),k=u?r.tilespaceRays.map(G=>qv(G,A)):r.queryGeometry.screenGeometry,j=en([],[P.x,P.y,P.z,1],s);if(!h&&u?_*=j[3]/i.cameraToCenterDistance:h&&!u&&(_*=i.cameraToCenterDistance/j[3]),u){const G=fe((w.y/We+g.y)
7/(1<<g.z));_/=i.projection.pixelsPerMeter(G,1)/ie(1,G)}if(ao(k,D,_))return!0}return!1}function jv(r,e,i,s){const a=en([],[r,e,i,1],s);return new He(a[0]/a[3],a[1]/a[3])}const Z_=Ai(0,0,0),Gv=Ai(0,0,1);function qv(r,e){const i=yr();return Z_[2]=e,r.intersectsPlane(Z_,Gv,i),new He(i[0],i[1])}class H_ extends jn{}let W_,X_,Y_,K_;function J_(r,{width:e,height:i},s,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==e*i*s)throw new RangeError("mismatched image size")}else a=new Uint8Array(e*i*s);return r.width=e,r.height=i,r.data=a,r}function Q_(r,e,i){const{width:s,height:a}=e;s===r.width&&a===r.height||(lm(r,e,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,s),height:Math.min(r.height,a)},i,null),r.width=s,r.height=a,r.data=e.data)}function lm(r,e,i,s,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||s.x>e.width-a.width||s.y>e.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const _=r.data,g=e.data,v=u===4&&f;for(let b=0;b<a.height;b++){const w=((i.y+b)*r.width+i.x)*u,E=((s.y+b)*e.width+s.x)*u;if(v)for(let A=0;A<a.width;A++){const P=w+A*u+3,D=E+A*u;g[D+0]=255,g[D+1]=255,g[D+2]=255,g[D+3]=_[P]}else if(h)for(let A=0;A<a.width;A++){const P=w+A*u,D=E+A*u,k=new hi(_[P+0]/255,_[P+1]/255,_[P+2]/255,_[P+3]).toNonPremultipliedRenderColor(h).toArray();g[D+0]=k[0],g[D+1]=k[1],g[D+2]=k[2],g[D+3]=k[3]}else for(let A=0;A<a.width*u;A++)g[E+A]=_[w+A]}return e}tt(H_,"HeatmapBucket",{omit:["layers"]});class ja{constructor(e,i){J_(this,e,1,i)}resize(e){Q_(this,new ja(e),1)}clone(){return new ja({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,a,u){lm(e,i,s,a,u,1,null)}}class jr{constructor(e,i){J_(this,e,4,i)}resize(e){Q_(this,new jr(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new jr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,a,u,h,f){lm(e,i,s,a,u,4,h,f)}}class eg{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function Dh(r){const e={},i=r.resolution||256,s=r.clips?r.clips.length:1,a=r.image||new jr({width:i,height:s}),u=(h,f,_)=>{e[r.evaluationKey]=_;const g=r.expression.evaluate(e),v=g?g.toNonPremultipliedRenderColor(null):null;v&&(a.data[h+f+0]=Math.floor(255*v.r),a.data[h+f+1]=Math.floor(255*v.g),a.data[h+f+2]=Math.floor(255*v.b),a.data[h+f+3]=Math.floor(255*v.a))};if(r.clips)for(let h=0,f=0;h<s;++h,f+=4*i)for(let _=0,g=0;_<i;_++,g+=4){const v=_/(i-1),{start:b,end:w}=r.clips[h];u(f,g,b*(1-v)+w*v)}else for(let h=0,f=0;h<i;h++,f+=4)u(0,f,h/(i-1));return a}tt(ja,"AlphaImage"),tt(jr,"RGBAImage");const $v=ii([{name:"a_pos",components:2,type:"Int16"}],4),Zv=ii([{name:"a_road_z_offset",components:1,type:"Float32"}],4),Hv=ii([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),Wv=ii([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function Lh(r,e,i=2){const s=e&&e.length,a=s?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,_,g;if(s&&(u=function(v,b,w,E){const A=[];for(let P=0,D=b.length;P<D;P++){const k=tg(v,b[P]*E,P<D-1?b[P+1]*E:v.length,E,!1);k===k.next&&(k.steiner=!0),A.push(i0(k))}A.sort(Qv);for(let P=0;P<A.length;P++)w=e0(A[P],w);return w}(r,e,u,i)),r.length>80*i){f=1/0,_=1/0;let v=-1/0,b=-1/0;for(let w=i;w<a;w+=i){const E=r[w],A=r[w+1];E<f&&(f=E),A<_&&(_=A),E>v&&(v=E),A>b&&(b=A)}g=Math.max(v-f,b-_),g=g!==0?32767/g:0}return Fh(u,h,i,f,_,g,0),h}function tg(r,e,i,s,a){let u;if(a===function(h,f,_,g){let v=0;for(let b=f,w=_-g;b<_;b+=g)v+=(h[w]-h[b])*(h[b+1]+h[w+1]),w=b;return v}(r,e,i,s)>0)for(let h=e;h<i;h+=s)u=sg(h/s|0,r[h],r[h+1],u);else for(let h=i-s;h>=e;h-=s)u=sg(h/s|0,r[h],r[h+1],u);return u&&uu(u,u.next)&&(Bh(u),u=u.next),u}function Xl(r,e){if(!r)return r;e||(e=r);let i,s=r;do if(i=!1,s.steiner||!uu(s,s.next)&&zr(s.prev,s,s.next)!==0)s=s.next;else{if(Bh(s),s=e=s.prev,s===s.next)break;
vendor: 2,268 bytes, line 7
7i=!0}while(i||s!==e);return e}function Fh(r,e,i,s,a,u,h){if(!r)return;!h&&u&&function(_,g,v,b){let w=_;do w.z===0&&(w.z=cm(w.x,w.y,g,v,b)),w.prevZ=w.prev,w.nextZ=w.next,w=w.next;while(w!==_);w.prevZ.nextZ=null,w.prevZ=null,function(E){let A,P=1;do{let D,k=E;E=null;let j=null;for(A=0;k;){A++;let G=k,z=0;for(let q=0;q<P&&(z++,G=G.nextZ,G);q++);let N=P;for(;z>0||N>0&&G;)z!==0&&(N===0||!G||k.z<=G.z)?(D=k,k=k.nextZ,z--):(D=G,G=G.nextZ,N--),j?j.nextZ=D:E=D,D.prevZ=j,j=D;k=G}j.nextZ=null,P*=2}while(A>1)}(w)}(r,s,a,u);let f=r;for(;r.prev!==r.next;){const _=r.prev,g=r.next;if(u?Yv(r,s,a,u):Xv(r))e.push(_.i,r.i,g.i),Bh(r),r=g.next,f=g.next;else if((r=g)===f){h?h===1?Fh(r=Kv(Xl(r),e),e,i,s,a,u,2):h===2&&Jv(r,e,i,s,a,u):Fh(Xl(r),e,i,s,a,u,1);break}}}function Xv(r){const e=r.prev,i=r,s=r.next;if(zr(e,i,s)>=0)return!1;const a=e.x,u=i.x,h=s.x,f=e.y,_=i.y,g=s.y,v=Math.min(a,u,h),b=Math.min(f,_,g),w=Math.max(a,u,h),E=Math.max(f,_,g);let A=s.next;for(;A!==e;){if(A.x>=v&&A.x<=w&&A.y>=b&&A.y<=E&&kh(a,f,u,_,h,g,A.x,A.y)&&zr(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function Yv(r,e,i,s){const a=r.prev,u=r,h=r.next;if(zr(a,u,h)>=0)return!1;const f=a.x,_=u.x,g=h.x,v=a.y,b=u.y,w=h.y,E=Math.min(f,_,g),A=Math.min(v,b,w),P=Math.max(f,_,g),D=Math.max(v,b,w),k=cm(E,A,e,i,s),j=cm(P,D,e,i,s);let G=r.prevZ,z=r.nextZ;for(;G&&G.z>=k&&z&&z.z<=j;){if(G.x>=E&&G.x<=P&&G.y>=A&&G.y<=D&&G!==a&&G!==h&&kh(f,v,_,b,g,w,G.x,G.y)&&zr(G.prev,G,G.next)>=0||(G=G.prevZ,z.x>=E&&z.x<=P&&z.y>=A&&z.y<=D&&z!==a&&z!==h&&kh(f,v,_,b,g,w,z.x,z.y)&&zr(z.prev,z,z.next)>=0))return!1;z=z.nextZ}for(;G&&G.z>=k;){if(G.x>=E&&G.x<=P&&G.y>=A&&G.y<=D&&G!==a&&G!==h&&kh(f,v,_,b,g,w,G.x,G.y)&&zr(G.prev,G,G.next)>=0)return!1;G=G.prevZ}for(;z&&z.z<=j;){if(z.x>=E&&z.x<=P&&z.y>=A&&z.y<=D&&z!==a&&z!==h&&kh(f,v,_,b,g,w,z.x,z.y)&&zr(z.prev,z,z.next)>=0)return!1;z=z.nextZ}return!0}function Kv(r,e){let i=r;do{const s=i.prev,a=i.next.next;!uu(s,a)&&rg(s,i,i.next,a)&&Oh(s,a)&&Oh(a,s)&&(e.push(s.i,i.i,a.i),Bh(i),Bh(i.next),i=r=a),i=i.next}while(i!==r);return Xl(i)}function Jv(r,e,i,s,a,u){let h=r;do{let f=h.next.next;for(;f!==h.prev;){if(h.i!==f.i&&r0(h,f)){let _=ng(h,f);return h=Xl(h,h.next),_=Xl(_,_.next),Fh(h,e,i,s,a,u,0),void Fh(_,e,i,s,a,u,0)}f=f.next}h=h.next}while(h!==r)}function Qv(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 e0(r,e){const i=function(a,u){let h=u;const f=a.x,_=a.y;let g,v=-1/0;if(uu(a,h))return h;do{if(uu(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,g=h.x<h.next.x?h:h.next,P===f))return g}h=h.next}while(h!==u);if(!g)return null;const b=g,w=g.x,E=g.y;let A=1/0;h=g;do{if(f>=h.x&&h.x>=w&&f!==h.x&&ig(_<E?f:v,_,w,E,_<E?v:f,_,h.x,h.y)){const P=Math.abs(_-h.y)/(f-h.x);Oh(h,a)&&(P<A||P===A&&(h.x>g.x||h.x===g.x&&t0(g,h)))&&(g=h,A=P)}h=h.next}while(h!==b);return g}(r,e);if(!i)return e;const s=ng(i,r);return Xl(s,s.next),Xl(i,i.next)}function t0(r,e){return zr(r.prev,r,e.prev)<0&&zr(e.next,r,r.next)<0}function cm(r,e,i,s,a){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*a|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function i0(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 ig(r,e,i,s,a,u,h,f){return(a-h)*(e-f)>=(r-h)*(u-f)&&(r-h)*(s-f)>=(i-h)*(e-f)&&(i-h)*(u-f)>=(a-h)*(s-f)}function kh(r,e,i,s,a,u,h,f){return!(r===h&&e===f)&&ig(r,e,i,s,a,u,h,f)}function r0(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!function(i,s){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==s.i&&a.next.i!==s.i&&rg(a,a.next,i,s))return!0;a=a.next}while(a!==i);return!1}(r,e)&&(Oh(r,e)&&Oh(e,r)&&function(i,s){let a=i,u=!1;const h=(i.x+s.x)/2,f=(i.y+s.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)&&(zr(r.prev,r,e.prev)||zr(r,e.prev,e))||uu(r,e)&&zr(r.prev,r,r.next)>0&&zr(e.prev,e,e.next)>0)}function zr(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function uu(r,e){return r.x===e.x&&r.y===e.y}function rg(r,e,i,s){const a=Sp(zr(r,e,i)),u=Sp(zr(r,e,s)),h=Sp(zr(i,s,r)),f=Sp(zr(i,s,e));return a!==u&&h!==f||!(a!==0||!Tp(r,i,e))||!(u!==0||!Tp(r,s,e))||!(h!==0||!Tp(i,r,s))||!(f!==0||!Tp(i,e,s))}function Tp(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 Sp(r){return r>0?1:r<0?-1:0}function Oh(r,e){return zr(r.prev,r,r.next)<0?zr(r,e,r.next)>=0&&zr(r,r.prev,e)>=0:zr(r,e,r.prev)<0||zr(r,r.next,e)<0}function ng(r,e){const i=um(r.i,r.x,r.y),s=um(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,s.next=i,i.prev=s,u.next=s,s.prev=u,s}function sg(r,e,i,s){const a=um(r,e,i);return s?(a.next=s.next,a.prev=s,s.next.prev=a,s.next=a):(a.prev=a,a.next=a),a}function Bh(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 um(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Ep(r,e){const i=r.length;if(i<=1)return[r];const s=[];let a,u;for(let h=0;h<i;h++){const f=qi(r[h]);f!==0&&(r[h].area=Math.abs(f),u===void 0&&(u=f<0),u===f<0?(a&&s.push(a),a=[r[h]]):a.push(r[h]))}if(a&&s.push(a),e>1)for(let h=0;h<s.length;h++)s[h].length<=e||(Hr(s[h],e,1,s[h].length-1,n0),s[h]=s[h].slice(0,e));return s}function n0(r,e){return e.area-r.area}function og(r,e,i=1){if(!r)return null;const s=typeof r=="string"?dn.from(r).getPrimary():r.getPrimary(),a=typeof r=="string"?null:r.getSecondary();for(const u of[s,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:s.toString(),secondary:a?a.toString():null}}function hm(r,e,i,s){const a=s.patternDependencies;let u=!1;for(const h of e){const f=h.paint.get(`${r}-pattern`);f.isConstant()||(u=!0),og(f.constantOr(null),a,i)&&(u=!0)}return u}function dm(r,e,i,s,a,u){const h=u.patternDependencies;for(const f of e){const _=f.paint.get(`${r}-pattern`).value;if(_.kind!=="constant"){let g=_.evaluate({zoom:s},i,{},u.availableImages);g=g&&g.name?g.name:g;const v=og(g,h,a);if(!v)continue;const{primary:b,secondary:w}=v;b&&(i.patterns[f.id]=[b,w].filter(Boolean))}}return i}class ag{constructor(){this.polygons=new Map}add(e,...i){this.polygons.has(e)?this.polygons.get(e).push(...i):this.polygons.set(e,i)}merge(e){for(const[i,s]of e.polygons)this.add(i,...s)}}class Yl{constructor(){this.portals=[]}static evaluate(e){if(e.length===0)return new Yl;let i=[];for(const g of e)i.push(...g.portals);if(i.length===0)return new Yl;const s=(g,v)=>g<=0&&v<=0||g>=We&&v>=We;for(const g of i){const v=g.va,b=g.vb;(s(v.x,b.x)||s(v.y,b.y))&&(g.type="border")}const a=i.filter(g=>g.type!=="unevaluated"),u=i.filter(g=>g.type==="unevaluated");if(u.length===0)return new Yl;u.sort((g,v)=>g.hash===v.hash?g.isTunnel===v.isTunnel?0:g.isTunnel?-1:1:g.hash<v.hash?1:-1),i=a.concat(u);let h=a.length,f=h,_=h;
7do if(f++,f===i.length||i[h].hash!==i[f].hash){if(f-h==2){_<h&&(i[_]=i[h],i[h]=null);const g=i[_],v=i[f-1];g.type=g.isTunnel!==v.isTunnel?"tunnel":"polygon",g.connection={a:g.connection.a,b:v.connection.a},_++}h=f}while(h!==i.length);return i.splice(_),i.sort((g,v)=>g.hash<v.hash?1:-1),{portals:i}}}tt(Yl,"ElevationPortalGraph"),tt(ag,"ElevationPolygons");class s0{constructor(e,i,s){this.outPositions=e,this.outNormals=i,this.outIndices=s,this.vertexLookup=new Map,this.buffer=new ArrayBuffer(4),this.view=new DataView(this.buffer)}addVertex(e,i,s){let a=e[2];s!=null&&(a*=s);const u=this.getVec3Bits(e)<<96n|this.getVec3Bits(i),h=this.vertexLookup.get(u);if(h!=null)return h;const f=this.outPositions.length;this.vertexLookup.set(u,f);const _=Math.trunc(16384*i[0]),g=Math.trunc(16384*i[1]),v=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(e[0],e[1],a),this.outNormals.emplaceBack(_,g,v),f}addVertices(e,i,...s){const a=[];for(const u of s){const h=this.addVertex(u,e,i);a.push(h)}return a}addTriangles(e,i,s){if(i&&s){const a=s.length===1,u=Ai(0,0,0);for(let h=0;h<e.length;h+=3){const f=i[e[h+0]],_=i[e[h+1]],g=i[e[h+2]],v=a?s[0]:s[e[h+1]],b=a?s[0]:s[e[h+2]],w=this.addVertex(Ai(f.x,f.y,a?s[0]:s[e[h+0]]),u),E=this.addVertex(Ai(_.x,_.y,v),u),A=this.addVertex(Ai(g.x,g.y,b),u);this.outIndices.emplaceBack(w,E,A)}}else for(let a=0;a<e.length;a+=3)this.outIndices.emplaceBack(e[a+0],e[a+1],e[a+2])}addQuad(e,i){const s=this.addVertices(i,void 0,...e.map(_=>Ai(_.coord.x,_.coord.y,_.height))),[a,u,h,f]=s;this.addTriangles([a,u,h,h,f,a])}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}getBits(e){return this.view.setFloat32(0,e),BigInt(this.view.getUint32(0))}getVec3Bits(e){return this.getBits(e[0])<<64n|this.getBits(e[1])<<32n|this.getBits(e[2])}}class Gn{constructor(e,i,s,a){this.unevaluatedPortals=new Yl,this.portalPolygons=new ag,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new _h,this.vertexNormals=new Xc,this.indexArray=new Br,this.tileToMeters=we(e),this.bridgeProgramConfigurations=new l(i,{zoom:s,lut:a},u=>u!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new l(i,{zoom:s,lut:a},u=>u!=="fill-bridge-guard-rail-color")}addVertices(e,i){const s=this.unevalVertices.length;for(let a=0;a<e.length;a++)this.unevalVertices.push(e[a]),this.unevalHeights.push(i[a]);return s}addTriangles(e,i,s){const a=s?this.unevalTunnelTriangles:this.unevalTriangles;for(const u of e)a.push(u+i)}addRenderableRing(e,i,s,a,u,h){const f=[new He(u.min.x,u.min.y),new He(u.max.x,u.min.y),new He(u.max.x,u.max.y),new He(u.min.x,u.max.y)];for(let _=0;_<s-1;_++){const g=i+_,v=g+1,b=this.unevalVertices[g],w=this.unevalVertices[v];if(!(b.x>=u.min.x&&b.x<=u.max.x&&b.y>=u.min.y&&b.y<=u.max.y||w.x>=u.min.x&&w.x<=u.max.x&&w.y>=u.min.y&&w.y<=u.max.y||Go(b,w,f))||this.isOnBorder(b.x,w.x)||this.isOnBorder(b.y,w.y))continue;const E=Gn.computeEdgeHash(this.unevalVertices[g],this.unevalVertices[v]);let A,P=this.vertexHashLookup.get(Gn.computePosHash(b));P!=null?A=P.next:(P=this.vertexHashLookup.get(Gn.computePosHash(w)),A=P!=null?P.prev:E),this.unevalEdges.push({polygonIdx:e,a:g,b:v,hash:E,portalHash:A,isTunnel:a,type:"unevaluated",featureInfo:h})}}addPortalCandidates(e,i,s,a,u){if(i.length===0)return;this.portalPolygons.add(e,{geometry:i,zLevel:u});const h=i[0];this.vertexHashLookup.clear();let f=Gn.computeEdgeHash(h[h.length-2],h[h.length-1]);for(let _=0;_<h.length-1;_++){const g=h[_+0],v=h[_+1],b=Fn(v.x-g.x,v.y-g.y),w=js(b);if(w===0)continue;let E="unevaluated";const A=a.pointElevation(g),P=a.pointElevation(v);Math.abs(A)<.01&&Math.abs(P)<.01?E="entrance":(this.isOnBorder(g.x,v.x)||this.isOnBorder(g.y,v.y))&&(E="border");const D=Gn.computeEdgeHash(g,v);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:g,vb:v,vab:b,length:w,hash:D,isTunnel:s,type:E});const k=Gn.computePosHash(g);this.vertexHashLookup.set(k,{prev:f,next:D}),f=D}}construct(e){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),s=w=>{w.primitiveLength=this.indexArray.length-w.primitiveOffset},a=new s0(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const u=i(),h=i(),f=i(),_=(w,E)=>{w.sort((P,D)=>P.type===E&&D.type!==E?-1:P.type!==E&&D.type===E?1:0);const A=w.findIndex(P=>P.type!==E);return A>=0?A:w.length};let g=0;this.unevalEdges.length>0&&(g=_(this.unevalEdges,"none"),this.constructBridgeStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:g},this.tileToMeters)),s(f);const v=i(),b=i();if(this.unevalEdges.length>0){const w=this.unevalEdges.splice(g),E=_(w,"tunnel")+g;this.unevalEdges.push(...w),this.constructTunnelStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:g},{min:g,max:E})}s(v),a.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),s(b),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),s(h),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),s(u),this.maskSegments=or.simpleSegment(0,b.primitiveOffset,0,b.primitiveLength),this.depthSegments=or.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength),this.renderableBridgeSegments=or.simpleSegment(0,f.primitiveOffset,0,f.primitiveLength),this.renderableTunnelSegments=or.simpleSegment(0,v.primitiveOffset,0,v.primitiveLength),this.shadowCasterSegments=or.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength)}update(e,i,s,a,u,h,f,_){this.bridgeProgramConfigurations.updatePaintArrays(e,i,u,s,a,h,f,_),this.tunnelProgramConfigurations.updatePaintArrays(e,i,u,s,a,h,f,_)}
7upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,Hv.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,Wv.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(e),this.tunnelProgramConfigurations.upload(e))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(e,i,s,a,u){const h=(f,_)=>{for(let g=0;g<_.length-1;g++){const v=_[g].featureIndex,b=_[g+1].vertexStart,w=e.feature(v);f.populatePaintArrays(b,w,v,{},s,i,a,void 0,u)}};h(this.bridgeProgramConfigurations,this.bridgeFeatureSections),h(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,i,s,a,u){const h=new Map;for(let f=a;f<u;f++){const _=s[f],g=_.a,v=_.b,b=Gn.computePosHash(e[g]),w=Gn.computePosHash(e[v]);h.has(b)||h.set(b,{}),h.has(w)||h.set(w,{});const E=h.get(b),A=h.get(w);i[g]<=0&&i[v]<=0||(E.to=v,A.from=g)}return h}constructBridgeStructures(e,i,s,a,u,h){e.clearVertexLookup();const f=this.computeVertexConnections(i,s,a,u.min,u.max),_=1/h,g=.5*_,v=E=>Ai(i[E].x,i[E].y,s[E]*_),b=E=>{const A=f.get(Gn.computePosHash(i[E])),P=A.from,D=A.to;if(!P||!D)return;const k=v(P),j=v(E),G=v(D),z=Ai(0,0,0);if(!Zn(k,j)){const q=gr(yr(),j,k);xr(z,z,tr(q,q))}if(!Zn(G,j)){const q=gr(yr(),G,j);xr(z,z,tr(q,q))}const N=Os(z);return N>0?Xi(z,z,1/N):void 0};let w=Number.POSITIVE_INFINITY;this.sortSubarray(a,u.min,u.max,(E,A)=>E.featureInfo.featureIndex-A.featureInfo.featureIndex);for(let E=u.min;E<u.max;E++){const A=a[E];if(!A.featureInfo.guardRailEnabled)continue;const P=this.prepareEdgePoints(i,s,A,(Pt,st)=>Pt>st);if(P==null)continue;const D=P[0],k=P[1],j=Ai(D.coord.x,D.coord.y,_*D.height),G=Ai(k.coord.x,k.coord.y,_*k.height);if(Zn(j,G))continue;const z=gr(yr(),G,j);tr(z,z);const N=Pt=>tr(Pt,Pt),q=b(A.a)||z,H=b(A.b)||z,oe=N(Ai(q[1],-q[0],0)),re=N(Ai(H[1],-H[0],0)),ae=N(Pr(yr(),oe,q)),he=N(Pr(yr(),re,H)),Te=yr(),Oe=[xr(yr(),j,Xi(Te,gr(Te,oe,ae),g)),xr(yr(),j,Xi(Te,xr(Te,oe,ae),g)),xr(yr(),j,Xi(Te,ae,g)),j],ze=[xr(yr(),G,Xi(Te,gr(Te,re,he),g)),xr(yr(),G,Xi(Te,xr(Te,re,he),g)),xr(yr(),G,Xi(Te,he,g)),G];w=this.addFeatureSection(A.featureInfo.featureIndex,w,this.bridgeFeatureSections,e);const[ke,Be]=e.addVertices(oe,h,Oe[0],Oe[1]),[Ee,Le]=e.addVertices(re,h,ze[0],ze[1]);e.addTriangles([ke,Be,Ee,Be,Le,Ee]);const[be,Se]=e.addVertices(ae,h,Oe[1],Oe[2]),[Ue,Ge]=e.addVertices(he,h,ze[1],ze[2]);e.addTriangles([be,Se,Ue,Se,Ge,Ue]);const[_t,ot]=e.addVertices(Ko(oe,oe),h,Oe[2],Oe[3]),[Ye,Ve]=e.addVertices(Ko(re,re),h,ze[2],ze[3]);e.addTriangles([_t,ot,Ye,ot,Ve,Ye])}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,i,s,a,u,h){e.clearVertexLookup();let f=Number.POSITIVE_INFINITY;const _=(v,b)=>v.featureInfo.featureIndex-b.featureInfo.featureIndex;this.sortSubarray(a,u.min,u.max,_),this.sortSubarray(a,h.min,h.max,_);const g=v=>tr(v,v);for(let v=u.min;v<u.max;v++){const b=this.prepareEdgePoints(i,s,a[v],(P,D)=>P<D);if(b==null)continue;const[w,E]=b,A=g(Ai(-(E.coord.y-w.coord.y),E.coord.x-w.coord.x,0));f=this.addFeatureSection(a[v].featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad([w,E,{coord:E.coord,height:a[v].isTunnel?-.1:0},{coord:w.coord,height:a[v].isTunnel?-.1:0}],A)}for(let v=h.min;v<h.max;v++){const b=a[v];b.isTunnel&&([b.a,b.b]=[b.b,b.a]);const w=i[b.a],E=i[b.b],A=g(Ai(-(E.y-w.y),E.x-w.x,0));f=this.addFeatureSection(b.featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad([{coord:E,height:0},{coord:w,height:0},{coord:w,height:s[b.a]+4},{coord:E,height:s[b.b]+4}],A),e.addQuad([{coord:w,height:0},{coord:E,height:0},{coord:E,height:s[b.b]+4},{coord:w,height:s[b.a]+4}],A)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}prepareEdgePoints(e,i,s,a){let u=i[s.a],h=i[s.b];const f=a(u,0),_=a(h,0);if(f&&_)return[{coord:e[s.a],height:u},{coord:e[s.b],height:h}];if(!f&&!_)return;const g=e[s.a].clone(),v=e[s.b].clone();if(f){if(!_){const b=h/(h-u);v.x=Tt(v.x,g.x,b),v.y=Tt(v.y,g.y,b),h=Tt(h,u,b)}}else{const b=u/(u-h);g.x=Tt(g.x,v.x,b),g.y=Tt(g.y,v.y,b),u=Tt(u,h,b)}return[{coord:g,height:u},{coord:v,height:h}]}prepareEdges(e,i){if(i.length===0)return;i.sort((f,_)=>f.hash===_.hash?_.polygonIdx-f.polygonIdx:_.hash>f.hash?1:-1);let s=0,a=0,u=0,h=i[s].polygonIdx;do a++,(a===i.length||i[s].hash!==i[a].hash)&&((a-s==1||i[a-1].polygonIdx!==h)&&
7(u<s&&(i[u]=i[s],i[s]=null),i[u].type="none",u++),s=a,s!==i.length&&(h=i[s].polygonIdx));while(s!==i.length);if(i.splice(u),i.length!==0&&e.length!==0){i.sort((g,v)=>g.portalHash<v.portalHash?1:-1);let f=0,_=0;for(;f!==i.length&&_!==e.length;){const g=i[f],v=e[_];g.portalHash>v.hash?f++:v.hash>g.portalHash?_++:(g.type=v.type,f++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=We&&i>=We}addFeatureSection(e,i,s,a){return e!==i&&(i=e,s.push({featureIndex:e,vertexStart:a.getVertexCount()}),a.clearVertexLookup()),i}sortSubarray(e,i,s,a){const u=e.slice(i,s);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(Gn.computePosHash(e))<<32n|BigInt(Gn.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}var lg,cg={exports:{}},ug=(lg||(lg=1,function(r,e){(function(i){function s($,W){return $>W?1:$<W?-1:0}var a=function($,W){$===void 0&&($=s),W===void 0&&(W=!1),this._compare=$,this._root=null,this._size=0,this._noDuplicates=!!W},u={size:{configurable:!0}};function h($,W,Ie,$e,Ke){var Xe=Ke-$e;if(Xe>0){var nt=$e+Math.floor(Xe/2),wt={key:W[nt],data:Ie[nt],parent:$};return wt.left=h(wt,W,Ie,$e,nt),wt.right=h(wt,W,Ie,nt+1,Ke),wt}return null}function f($,W,Ie,$e,Ke){if(!(Ie>=$e)){for(var Xe=$[Ie+$e>>1],nt=Ie-1,wt=$e+1;;){do nt++;while(Ke($[nt],Xe)<0);do wt--;while(Ke($[wt],Xe)>0);if(nt>=wt)break;var Xt=$[nt];$[nt]=$[wt],$[wt]=Xt,Xt=W[nt],W[nt]=W[wt],W[wt]=Xt}f($,W,Ie,wt,Ke),f($,W,wt+1,$e,Ke)}}a.prototype.rotateLeft=function($){var W=$.right;W&&($.right=W.left,W.left&&(W.left.parent=$),W.parent=$.parent),$.parent?$===$.parent.left?$.parent.left=W:$.parent.right=W:this._root=W,W&&(W.left=$),$.parent=W},a.prototype.rotateRight=function($){var W=$.left;W&&($.left=W.right,W.right&&(W.right.parent=$),W.parent=$.parent),$.parent?$===$.parent.left?$.parent.left=W:$.parent.right=W:this._root=W,W&&(W.right=$),$.parent=W},a.prototype._splay=function($){for(;$.parent;){var W=$.parent;W.parent?W.left===$&&W.parent.left===W?(this.rotateRight(W.parent),this.rotateRight(W)):W.right===$&&W.parent.right===W?(this.rotateLeft(W.parent),this.rotateLeft(W)):W.left===$&&W.parent.right===W?(this.rotateRight(W),this.rotateLeft(W)):(this.rotateLeft(W),this.rotateRight(W)):W.left===$?this.rotateRight(W):this.rotateLeft(W)}},a.prototype.splay=function($){for(var W,Ie,$e,Ke,Xe;$.parent;)(Ie=(W=$.parent).parent)&&Ie.parent?(($e=Ie.parent).left===Ie?$e.left=$:$e.right=$,$.parent=$e):($.parent=null,this._root=$),Ke=$.left,Xe=$.right,$===W.left?(Ie&&(Ie.left===W?(W.right?(Ie.left=W.right,Ie.left.parent=Ie):Ie.left=null,W.right=Ie,Ie.parent=W):(Ke?(Ie.right=Ke,Ke.parent=Ie):Ie.right=null,$.left=Ie,Ie.parent=$)),Xe?(W.left=Xe,Xe.parent=W):W.left=null,$.right=W,W.parent=$):(Ie&&(Ie.right===W?(W.left?(Ie.right=W.left,Ie.right.parent=Ie):Ie.right=null,W.left=Ie,Ie.parent=W):(Xe?(Ie.left=Xe,Xe.parent=Ie):Ie.left=null,$.right=Ie,Ie.parent=$)),Ke?(W.right=Ke,Ke.parent=W):W.right=null,$.left=W,W.parent=$)},a.prototype.replace=function($,W){$.parent?$===$.parent.left?$.parent.left=W:$.parent.right=W:this._root=W,W&&(W.parent=$.parent)},a.prototype.minNode=function($){if($===void 0&&($=this._root),$)for(;$.left;)$=$.left;return $},a.prototype.maxNode=function($){if($===void 0&&($=this._root),$)for(;$.right;)$=$.right;return $},a.prototype.insert=function($,W){var Ie=this._root,$e=null,Ke=this._compare;if(this._noDuplicates)for(;Ie;){if($e=Ie,Ke(Ie.key,$)===0)return;Ie=Ke(Ie.key,$)<0?Ie.right:Ie.left}else for(;Ie;)$e=Ie,Ie=Ke(Ie.key,$)<0?Ie.right:Ie.left;return Ie={key:$,data:W,left:null,right:null,parent:$e},$e?Ke($e.key,Ie.key)<0?$e.right=Ie:$e.left=Ie:this._root=Ie,this.splay(Ie),this._size++,Ie},a.prototype.find=function($){for(var W=this._root,Ie=this._compare;W;){var $e=Ie(W.key,$);if($e<0)W=W.right;else{if(!($e>0))return W;W=W.left}}return null},a.prototype.contains=function($){for(var W=this._root,Ie=this._compare;W;){var $e=Ie($,W.key);if($e===0)return!0;W=$e<0?W.left:W.right}return!1},a.prototype.remove=function($){var W=this.find($);if(!W)return!1;if(this.splay(W),W.left)if(W.right){var Ie=this.minNode(W.right);Ie.parent!==W&&(this.replace(Ie,Ie.right),Ie.right=W.right,Ie.right.parent=Ie),this.replace(W,Ie),Ie.left=W.left,Ie.left.parent=Ie}else this.replace(W,W.left);else this.replace(W,W.right);return this._size--,!0},a.prototype.removeNode=function($){if(!$)return!1;if(this.splay($),$.left)if($.right){var W=this.minNode($.right);W.parent!==$&&(this.replace(W,W.right),W.right=$.right,W.right.parent=W),this.replace($,W),W.left=$.left,W.left.parent=W}else this.replace($,$.left);else this.replace($,$.right);return this._size--,!0}
7,a.prototype.erase=function($){var W=this.find($);if(W){this.splay(W);var Ie=W.left,$e=W.right,Ke=null;Ie&&(Ie.parent=null,Ke=this.maxNode(Ie),this.splay(Ke),this._root=Ke),$e&&(Ie?Ke.right=$e:this._root=$e,$e.parent=Ke),this._size--}},a.prototype.pop=function(){var $=this._root,W=null;if($){for(;$.left;)$=$.left;W={key:$.key,data:$.data},this.remove($.key)}return W},a.prototype.next=function($){var W=$;if(W)if(W.right)for(W=W.right;W&&W.left;)W=W.left;else for(W=$.parent;W&&W.right===$;)$=W,W=W.parent;return W},a.prototype.prev=function($){var W=$;if(W)if(W.left)for(W=W.left;W&&W.right;)W=W.right;else for(W=$.parent;W&&W.left===$;)$=W,W=W.parent;return W},a.prototype.forEach=function($){for(var W=this._root,Ie=[],$e=!1,Ke=0;!$e;)W?(Ie.push(W),W=W.left):Ie.length>0?($(W=Ie.pop(),Ke++),W=W.right):$e=!0;return this},a.prototype.range=function($,W,Ie,$e){for(var Ke=[],Xe=this._compare,nt=this._root;Ke.length!==0||nt;)if(nt)Ke.push(nt),nt=nt.left;else{if(Xe((nt=Ke.pop()).key,W)>0)break;if(Xe(nt.key,$)>=0&&Ie.call($e,nt))return this;nt=nt.right}return this},a.prototype.keys=function(){for(var $=this._root,W=[],Ie=[],$e=!1;!$e;)$?(W.push($),$=$.left):W.length>0?($=W.pop(),Ie.push($.key),$=$.right):$e=!0;return Ie},a.prototype.values=function(){for(var $=this._root,W=[],Ie=[],$e=!1;!$e;)$?(W.push($),$=$.left):W.length>0?($=W.pop(),Ie.push($.data),$=$.right):$e=!0;return Ie},a.prototype.at=function($){for(var W=this._root,Ie=[],$e=!1,Ke=0;!$e;)if(W)Ie.push(W),W=W.left;else if(Ie.length>0){if(W=Ie.pop(),Ke===$)return W;Ke++,W=W.right}else $e=!0;return null},a.prototype.load=function($,W,Ie){if($===void 0&&($=[]),W===void 0&&(W=[]),Ie===void 0&&(Ie=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var $e=$.length;return Ie&&f($,W,0,$e-1,this._compare),this._root=h(null,$,W,0,$e),this._size=$e,this},a.prototype.min=function(){var $=this.minNode(this._root);return $?$.key:null},a.prototype.max=function(){var $=this.maxNode(this._root);return $?$.key:null},a.prototype.isEmpty=function(){return this._root===null},u.size.get=function(){return this._size},a.createTree=function($,W,Ie,$e,Ke){return new a(Ie,Ke).load($,W,$e)},Object.defineProperties(a.prototype,u);var _=0,g=1,v=2,b=3,w=0,E=1,A=2,P=3;function D($,W,Ie){W===null?($.inOut=!1,$.otherInOut=!0):($.isSubject===W.isSubject?($.inOut=!W.inOut,$.otherInOut=W.otherInOut):($.inOut=!W.otherInOut,$.otherInOut=W.isVertical()?!W.inOut:W.inOut),W&&($.prevInResult=!k(W,Ie)||W.isVertical()?W.prevInResult:W));var $e=k($,Ie);$.resultTransition=$e?function(Ke,Xe){var nt,wt=!Ke.inOut,Xt=!Ke.otherInOut;switch(Xe){case w:nt=wt&&Xt;break;case E:nt=wt||Xt;break;case P:nt=wt^Xt;break;case A:nt=Ke.isSubject?wt&&!Xt:Xt&&!wt}return nt?1:-1}($,Ie):0}function k($,W){switch($.type){case _:switch(W){case w:return!$.otherInOut;case E:return $.otherInOut;case A:return $.isSubject&&$.otherInOut||!$.isSubject&&!$.otherInOut;case P:return!0}break;case v:return W===w||W===E;case b:return W===A;case g:return!1}return!1}var j=function($,W,Ie,$e,Ke){this.left=W,this.point=$,this.otherEvent=Ie,this.isSubject=$e,this.type=Ke||_,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},G={inResult:{configurable:!0}};function z($,W){return $[0]===W[0]&&$[1]===W[1]}j.prototype.isBelow=function($){var W=this.point,Ie=this.otherEvent.point;return this.left?(W[0]-$[0])*(Ie[1]-$[1])-(Ie[0]-$[0])*(W[1]-$[1])>0:(Ie[0]-$[0])*(W[1]-$[1])-(W[0]-$[0])*(Ie[1]-$[1])>0},j.prototype.isAbove=function($){return!this.isBelow($)},j.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},G.inResult.get=function(){return this.resultTransition!==0},j.prototype.clone=function(){var $=new j(this.point,this.left,this.otherEvent,this.isSubject,this.type);return $.contourId=this.contourId,$.resultTransition=this.resultTransition,$.prevInResult=this.prevInResult,$.isExteriorRing=this.isExteriorRing,$.inOut=this.inOut,$.otherInOut=this.otherInOut,$},Object.defineProperties(j.prototype,G);var N=11102230246251565e-32,q=134217729,H=(3+8*N)*N;function oe($,W,Ie,$e,Ke){var Xe,nt,wt,Xt,Yt=W[0],Nt=$e[0],yi=0,Ci=0;Nt>Yt==Nt>
7-Yt?(Xe=Yt,Yt=W[++yi]):(Xe=Nt,Nt=$e[++Ci]);var Kt=0;if(yi<$&&Ci<Ie)for(Nt>Yt==Nt>-Yt?(wt=Xe-((nt=Yt+Xe)-Yt),Yt=W[++yi]):(wt=Xe-((nt=Nt+Xe)-Nt),Nt=$e[++Ci]),Xe=nt,wt!==0&&(Ke[Kt++]=wt);yi<$&&Ci<Ie;)Nt>Yt==Nt>-Yt?(wt=Xe-((nt=Xe+Yt)-(Xt=nt-Xe))+(Yt-Xt),Yt=W[++yi]):(wt=Xe-((nt=Xe+Nt)-(Xt=nt-Xe))+(Nt-Xt),Nt=$e[++Ci]),Xe=nt,wt!==0&&(Ke[Kt++]=wt);for(;yi<$;)wt=Xe-((nt=Xe+Yt)-(Xt=nt-Xe))+(Yt-Xt),Yt=W[++yi],Xe=nt,wt!==0&&(Ke[Kt++]=wt);for(;Ci<Ie;)wt=Xe-((nt=Xe+Nt)-(Xt=nt-Xe))+(Nt-Xt),Nt=$e[++Ci],Xe=nt,wt!==0&&(Ke[Kt++]=wt);return Xe===0&&Kt!==0||(Ke[Kt++]=Xe),Kt}function re($){return new Float64Array($)}var ae=33306690738754716e-32,he=22204460492503146e-32,Te=11093356479670487e-47,Oe=re(4),ze=re(8),ke=re(12),Be=re(16),Ee=re(4);function Le($,W,Ie){var $e=function(Ke,Xe,nt,wt,Xt,Yt){var Nt=(Xe-Yt)*(nt-Xt),yi=(Ke-Xt)*(wt-Yt),Ci=Nt-yi;if(Nt===0||yi===0||Nt>0!=yi>0)return Ci;var Kt=Math.abs(Nt+yi);return Math.abs(Ci)>=ae*Kt?Ci:-function(Qi,Fi,mi,hr,Vi,Pi,ki){var wi,Ut,Si,er,vt,ei,Ui,lr,Wi,Er,Ei,wr,Tn,Gr,Vr,Sn,fo,Ir,Mr=Qi-Vi,qr=mi-Vi,ln=Fi-Pi,Yr=hr-Pi;Oe[0]=(Vr=(lr=Mr-(Ui=(ei=q*Mr)-(ei-Mr)))*(Er=Yr-(Wi=(ei=q*Yr)-(ei-Yr)))-((Gr=Mr*Yr)-Ui*Wi-lr*Wi-Ui*Er))-((Ei=Vr-(fo=(lr=ln-(Ui=(ei=q*ln)-(ei-ln)))*(Er=qr-(Wi=(ei=q*qr)-(ei-qr)))-((Sn=ln*qr)-Ui*Wi-lr*Wi-Ui*Er)))+(vt=Vr-Ei))+(vt-fo),Oe[1]=(Tn=Gr-((wr=Gr+Ei)-(vt=wr-Gr))+(Ei-vt))-((Ei=Tn-Sn)+(vt=Tn-Ei))+(vt-Sn),Oe[2]=wr-((Ir=wr+Ei)-(vt=Ir-wr))+(Ei-vt),Oe[3]=Ir;var Wa=function(dT,xv){for(var vv=xv[0],g_=1;g_<4;g_++)vv+=xv[g_];return vv}(0,Oe),dd=he*ki;if(Wa>=dd||-Wa>=dd||(wi=Qi-(Mr+(vt=Qi-Mr))+(vt-Vi),Si=mi-(qr+(vt=mi-qr))+(vt-Vi),Ut=Fi-(ln+(vt=Fi-ln))+(vt-Pi),er=hr-(Yr+(vt=hr-Yr))+(vt-Pi),wi===0&&Ut===0&&Si===0&&er===0)||(dd=Te*ki+H*Math.abs(Wa),(Wa+=Mr*er+Yr*wi-(ln*Si+qr*Ut))>=dd||-Wa>=dd))return Wa;Ee[0]=(Vr=(lr=wi-(Ui=(ei=q*wi)-(ei-wi)))*(Er=Yr-(Wi=(ei=q*Yr)-(ei-Yr)))-((Gr=wi*Yr)-Ui*Wi-lr*Wi-Ui*Er))-((Ei=Vr-(fo=(lr=Ut-(Ui=(ei=q*Ut)-(ei-Ut)))*(Er=qr-(Wi=(ei=q*qr)-(ei-qr)))-((Sn=Ut*qr)-Ui*Wi-lr*Wi-Ui*Er)))+(vt=Vr-Ei))+(vt-fo),Ee[1]=(Tn=Gr-((wr=Gr+Ei)-(vt=wr-Gr))+(Ei-vt))-((Ei=Tn-Sn)+(vt=Tn-Ei))+(vt-Sn),Ee[2]=wr-((Ir=wr+Ei)-(vt=Ir-wr))+(Ei-vt),Ee[3]=Ir;var Hb=oe(4,Oe,4,Ee,ze);Ee[0]=(Vr=(lr=Mr-(Ui=(ei=q*Mr)-(ei-Mr)))*(Er=er-(Wi=(ei=q*er)-(ei-er)))-((Gr=Mr*er)-Ui*Wi-lr*Wi-Ui*Er))-((Ei=Vr-(fo=(lr=ln-(Ui=(ei=q*ln)-(ei-ln)))*(Er=Si-(Wi=(ei=q*Si)-(ei-Si)))-((Sn=ln*Si)-Ui*Wi-lr*Wi-Ui*Er)))+(vt=Vr-Ei))+(vt-fo),Ee[1]=(Tn=Gr-((wr=Gr+Ei)-(vt=wr-Gr))+(Ei-vt))-((Ei=Tn-Sn)+(vt=Tn-Ei))+(vt-Sn),Ee[2]=wr-((Ir=wr+Ei)-(vt=Ir-wr))+(Ei-vt),Ee[3]=Ir;var Wb=oe(Hb,ze,4,Ee,ke);Ee[0]=(Vr=(lr=wi-(Ui=(ei=q*wi)-(ei-wi)))*(Er=er-(Wi=(ei=q*er)-(ei-er)))-((Gr=wi*er)-Ui*Wi-lr*Wi-Ui*Er))-((Ei=Vr-(fo=(lr=Ut-(Ui=(ei=q*Ut)-(ei-Ut)))*(Er=Si-(Wi=(ei=q*Si)-(ei-Si)))-((Sn=Ut*Si)-Ui*Wi-lr*Wi-Ui*Er)))+(vt=Vr-Ei))+(vt-fo),Ee[1]=(Tn=Gr-((wr=Gr+Ei)-(vt=wr-Gr))+(Ei-vt))-((Ei=Tn-Sn)+(vt=Tn-Ei))+(vt-Sn),Ee[2]=wr-((Ir=wr+Ei)-(vt=Ir-wr))+(Ei-vt),Ee[3]=Ir;var Xb=oe(Wb,ke,4,Ee,Be);return Be[Xb-1]}(Ke,Xe,nt,wt,Xt,Yt,Kt)}($[0],$[1],W[0],W[1],Ie[0],Ie[1]);return $e>0?-1:$e<0?1:0}function be($,W){var Ie=$.point,$e=W.point;return Ie[0]>$e[0]?1:Ie[0]<$e[0]?-1:Ie[1]!==$e[1]?Ie[1]>$e[1]?1:-1:function(Ke,Xe,nt,wt){return Ke.left!==Xe.left?Ke.left?1:-1:Le(nt,Ke.otherEvent.point,Xe.otherEvent.point)!==0?Ke.isBelow(Xe.otherEvent.point)?-1:1:!Ke.isSubject&&Xe.isSubject?1:-1}($,W,Ie)}function Se($,W,Ie){var $e=new j(W,!1,$,$.isSubject),Ke=new j(W,!0,$.otherEvent,$.isSubject);return z($.point,$.otherEvent.point)&&console.warn("what is that, a collapsed segment?",$),$e.contourId=Ke.contourId=$.contourId,be(Ke,$.otherEvent)>0&&($.otherEvent.left=!0,Ke.left=!1),$.otherEvent.otherEvent=Ke,$.otherEvent=$e,Ie.push(Ke),Ie.push($e),Ie}function Ue($,W){return $[0]*W[1]-$[1]*W[0]}function Ge($,W){return $[0]*W[0]+$[1]*W[1]}function _t($,W,Ie){var $e=function(Xt,Yt,Nt,yi,Ci){var Kt=[Yt[0]-Xt[0],Yt[1]-Xt[1]],Qi=[yi[0]-Nt[0],yi[1]-Nt[1]];function Fi(ei,Ui,lr){return[ei[0]+Ui*lr[0],ei[1]+Ui*lr[1]]}var mi=[Nt[0]-Xt[0],Nt[1]-Xt[1]],hr=Ue(Kt,Qi),Vi=hr*hr,Pi=Ge(Kt,Kt);if(Vi>0){var ki=Ue(mi,Qi)/hr;if(ki<0||ki>1)return null;var wi=Ue(mi,Kt)/hr;return wi<0||wi>1?null:ki===0||ki===1?[Fi(Xt,ki,Kt)]:wi===0||wi===1?[Fi(Nt,wi,Qi)]:[Fi(Xt,ki,Kt)]}if((Vi=(hr=Ue(mi,Kt))*hr)>0)return null;
7var Ut=Ge(Kt,mi)/Pi,Si=Ut+Ge(Kt,Qi)/Pi,er=Math.min(Ut,Si),vt=Math.max(Ut,Si);return er<=1&&vt>=0?er===1?[Fi(Xt,er>0?er:0,Kt)]:vt===0?[Fi(Xt,vt<1?vt:1,Kt)]:[Fi(Xt,er>0?er:0,Kt),Fi(Xt,vt<1?vt:1,Kt)]:null}($.point,$.otherEvent.point,W.point,W.otherEvent.point),Ke=$e?$e.length:0;if(Ke===0||Ke===1&&(z($.point,W.point)||z($.otherEvent.point,W.otherEvent.point))||Ke===2&&$.isSubject===W.isSubject)return 0;if(Ke===1)return z($.point,$e[0])||z($.otherEvent.point,$e[0])||Se($,$e[0],Ie),z(W.point,$e[0])||z(W.otherEvent.point,$e[0])||Se(W,$e[0],Ie),1;var Xe=[],nt=!1,wt=!1;return z($.point,W.point)?nt=!0:be($,W)===1?Xe.push(W,$):Xe.push($,W),z($.otherEvent.point,W.otherEvent.point)?wt=!0:be($.otherEvent,W.otherEvent)===1?Xe.push(W.otherEvent,$.otherEvent):Xe.push($.otherEvent,W.otherEvent),nt&&wt||nt?(W.type=g,$.type=W.inOut===$.inOut?v:b,nt&&!wt&&Se(Xe[1].otherEvent,Xe[0].point,Ie),2):wt?(Se(Xe[0],Xe[1].point,Ie),3):Xe[0]!==Xe[3].otherEvent?(Se(Xe[0],Xe[1].point,Ie),Se(Xe[1],Xe[2].point,Ie),3):(Se(Xe[0],Xe[1].point,Ie),Se(Xe[3].otherEvent,Xe[2].point,Ie),3)}function ot($,W){if($===W)return 0;if(Le($.point,$.otherEvent.point,W.point)!==0||Le($.point,$.otherEvent.point,W.otherEvent.point)!==0)return z($.point,W.point)?$.isBelow(W.otherEvent.point)?-1:1:$.point[0]===W.point[0]?$.point[1]<W.point[1]?-1:1:be($,W)===1?W.isAbove($.point)?-1:1:$.isBelow(W.point)?-1:1;if($.isSubject!==W.isSubject)return $.isSubject?-1:1;var Ie=$.point,$e=W.point;return Ie[0]===$e[0]&&Ie[1]===$e[1]?(Ie=$.otherEvent.point)[0]===($e=W.otherEvent.point)[0]&&Ie[1]===$e[1]?0:$.contourId>W.contourId?1:-1:be($,W)===1?1:-1}var Ye=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function Ve($,W,Ie,$e){var Ke,Xe=$+1,nt=W[$].point,wt=W.length;for(Xe<wt&&(Ke=W[Xe].point);Xe<wt&&Ke[0]===nt[0]&&Ke[1]===nt[1];){if(!Ie[Xe])return Xe;++Xe<wt&&(Ke=W[Xe].point)}for(Xe=$-1;Ie[Xe]&&Xe>$e;)Xe--;return Xe}Ye.prototype.isExterior=function(){return this.holeOf==null};var Pt=lt,st=lt;function lt($,W){if(!(this instanceof lt))return new lt($,W);if(this.data=$||[],this.length=this.data.length,this.compare=W||St,this.length>0)for(var Ie=(this.length>>1)-1;Ie>=0;Ie--)this._down(Ie)}function St($,W){return $<W?-1:$>W?1:0}lt.prototype={push:function($){this.data.push($),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var $=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),$}},peek:function(){return this.data[0]},_up:function($){for(var W=this.data,Ie=this.compare,$e=W[$];$>0;){var Ke=$-1>>1,Xe=W[Ke];if(Ie($e,Xe)>=0)break;W[$]=Xe,$=Ke}W[$]=$e},_down:function($){for(var W=this.data,Ie=this.compare,$e=this.length>>1,Ke=W[$];$<$e;){var Xe=1+($<<1),nt=Xe+1,wt=W[Xe];if(nt<this.length&&Ie(W[nt],wt)<0&&(Xe=nt,wt=W[nt]),Ie(wt,Ke)>=0)break;W[$]=wt,$=Xe}W[$]=Ke}},Pt.default=st;var Ft=Math.max,Lt=Math.min,$t=0;function Bt($,W,Ie,$e,Ke,Xe){var nt,wt,Xt,Yt,Nt,yi;for(nt=0,wt=$.length-1;nt<wt;nt++)if(Yt=$[nt+1],Nt=new j(Xt=$[nt],!1,void 0,W),yi=new j(Yt,!1,Nt,W),Nt.otherEvent=yi,Xt[0]!==Yt[0]||Xt[1]!==Yt[1]){Nt.contourId=yi.contourId=Ie,Xe||(Nt.isExteriorRing=!1,yi.isExteriorRing=!1),be(Nt,yi)>0?yi.left=!0:Nt.left=!0;var Ci=Xt[0],Kt=Xt[1];Ke[0]=Lt(Ke[0],Ci),Ke[1]=Lt(Ke[1],Kt),Ke[2]=Ft(Ke[2],Ci),Ke[3]=Ft(Ke[3],Kt),$e.push(Nt),$e.push(yi)}}var Zt=[];function fi($,W,Ie){typeof $[0][0][0]=="number"&&($=[$]),typeof W[0][0][0]=="number"&&(W=[W]);var $e=function(Kt,Qi,Fi){var mi=null;return Kt.length*Qi.length==0&&(Fi===w?mi=Zt:Fi===A?mi=Kt:Fi!==E&&Fi!==P||(mi=Kt.length===0?Qi:Kt)),mi}($,W,Ie);if($e)return $e===Zt?null:$e;var Ke=[1/0,1/0,-1/0,-1/0],Xe=[1/0,1/0,-1/0,-1/0],nt=function(Kt,Qi,Fi,mi,hr){var Vi,Pi,ki,wi,Ut,Si,er=new Pt(null,be);for(ki=0,wi=Kt.length;ki<wi;ki++)for(Ut=0,Si=(Vi=Kt[ki]).length;Ut<Si;Ut++)(Pi=Ut===0)&&$t++,Bt(Vi[Ut],!0,$t,er,Fi,Pi);for(ki=0,wi=Qi.length;ki<wi;ki++)for(Ut=0,Si=(Vi=Qi[ki]).length;Ut<Si;Ut++)Pi=Ut===0,hr===A&&(Pi=!1),Pi&&$t++,Bt(Vi[Ut],!1,$t,er,mi,Pi);return er}($,W,Ke,Xe,Ie);if($e=function(Kt,Qi,Fi,mi,hr){var Vi=null;return(Fi[0]>mi[2]||mi[0]>Fi[2]||Fi[1]>mi[3]||mi[1]>Fi[3])&&(hr===w?Vi=Zt:hr===A?Vi=Kt:hr!==E&&hr!==P||(Vi=Kt.concat(Qi))),Vi}($,W,Ke,Xe,Ie))return $e===Zt?null:$e;for(var wt=function(Kt){var Qi,Fi,mi=function(ki){var wi,Ut,Si,er,vt=[];for(Ut=0,Si=ki.length;Ut<Si;Ut++)((wi=ki[Ut]).left&&wi.inResult||!wi.left&&wi.otherEvent.inResult)&&vt.push(wi);for(var ei=!1;!ei;)for(ei=!0,Ut=0,Si=vt.length;Ut<Si;Ut++)Ut+1<Si&&be(vt[Ut],vt[Ut+1])===1&&(er=vt[Ut],vt[Ut]=vt[Ut+1],vt[Ut+1]=er,ei=!1);for(Ut=0,Si=vt.length;Ut<Si;Ut++)(wi=vt[Ut]).otherPos=Ut;for(Ut=0,Si=vt.length;Ut<Si;Ut++)(wi=vt[Ut]).left||(er=wi.otherPos,wi.otherPos=wi.otherEvent.otherPos,wi.otherEvent.otherPos=er);return vt}(Kt),hr={},Vi=[],Pi=function(){if(!hr[Qi]){var ki=Vi.length,wi=function(vt,ei,Ui){var lr=new Ye;if(vt.prevInResult!=null){var Wi=vt.prevInResult,Er=Wi.outputContourId;if(Wi.resultTransition>0){var Ei=ei[Er];if(Ei.holeOf!=null){var wr=Ei.holeOf;ei[wr].holeIds.push(Ui),lr.holeOf=wr,lr.depth=ei[Er].depth}else ei[Er].holeIds.push(Ui),lr.holeOf=Er,lr.depth=ei[Er].depth+1}else lr.holeOf=null,lr.depth=ei[Er].depth}else lr.holeOf=null,lr.depth=0;return lr}(mi[Qi],Vi,ki),Ut=function(vt){hr[vt]=!0,vt<mi.length&&mi[vt]&&(mi[vt].outputContourId=ki)},Si=Qi,er=Qi;for(wi.points.push(mi[Qi].point);Ut(Si),Ut(Si=mi[Si].otherPos),wi.points.push(mi[Si].point),!((Si=Ve(Si,mi,hr,er))==er||Si>=mi.length)&&mi[Si];);Vi.push(wi)}};for(Qi=0,Fi=mi.length;Qi<Fi;Qi++)Pi();return Vi}(function(Kt,Qi,Fi,mi,hr,Vi){for(var Pi,ki,wi,Ut=new a(ot),Si=[],er=Math.min(mi[2],hr[2]);Kt.length!==0;){var vt=Kt.pop();if(Si.push(vt),Vi===w&&vt.point[0]>er||Vi===A&&vt.point[0]>mi[2])break;if(vt.left){ki=Pi=Ut.insert(vt),Pi=Pi!==(wi=Ut.minNode())?Ut.prev(Pi):null,ki=Ut.next(ki);var ei=Pi?Pi.key:null;if(D(vt,ei,Vi),ki&&_t(vt,ki.key,Kt)===2&&(D(vt,ei,Vi),D(ki.key,vt,Vi)),Pi&&_t(Pi.key,vt,Kt)===2){var Ui=Pi;D(ei,(Ui=Ui!==wi?Ut.prev(Ui):null)?Ui.key:null,Vi),D(vt,ei,Vi)}}else ki=Pi=Ut.find(vt=vt.otherEvent),Pi&&ki&&(Pi=Pi!==wi?Ut.prev(Pi):null,ki=Ut.next(ki),Ut.remove(vt),ki&&Pi&&_t(Pi.key,ki.key,Kt))}return Si}(nt,0,0,Ke,Xe,Ie)),Xt=[],Yt=0;Yt<wt.length;Yt++){var Nt=wt[Yt];if(Nt.isExterior()){for(var yi=[Nt.points],Ci=0;Ci<Nt.holeIds.length;Ci++)yi.push(wt[Nt.holeIds[Ci]].points);Xt.push(yi)}}return Xt}var Li={UNION:E,DIFFERENCE:A,INTERSECTION:w,XOR:P};i.diff=function($,W){return fi($,W,A)},i.intersection=function($,W){return fi($,W,w)},i.operations=Li,i.union=function($,W){return fi($,W,E)},i.xor=function($,W){return fi($,W,P)},Object.defineProperty(i,"__esModule",{value:!0})})(e)}(0,cg.exports)),cg.exports);/** 8 * martinez v0.7.4 9 * Martinez polygon clipping algorithm, does boolean operation on polygons (multipolygons, polygons with holes etc): intersection, union, difference, xor 10 * 11 * @author Alex Milevski <[email protected]> 12 * @license MIT 13 * @preserve 14 */function Ip(r,e,i,s){const a=[],u=s===0?(h,f,_,g,v,b)=>
14{h.push(new He(b,_+(b-f)/(g-f)*(v-_)))}:(h,f,_,g,v,b)=>{h.push(new He(f+(b-_)/(v-_)*(g-f),b))};for(const h of r){const f=[];for(const _ of h){if(_.length<=2)continue;const g=[];for(let w=0;w<_.length-1;w++){const E=_[w].x,A=_[w].y,P=_[w+1].x,D=_[w+1].y,k=s===0?E:A,j=s===0?P:D;k<e?j>e&&u(g,E,A,P,D,e):k>i?j<i&&u(g,E,A,P,D,i):g.push(_[w]),j<e&&k>=e&&u(g,E,A,P,D,e),j>i&&k<=i&&u(g,E,A,P,D,i)}let v=_[_.length-1];const b=s===0?v.x:v.y;b>=e&&b<=i&&g.push(v),g.length&&(v=g[g.length-1],g[0].x===v.x&&g[0].y===v.y||g.push(g[0]),f.push(g))}f.length&&a.push(f)}return a}function o0(r,e){const i=pm(r),s=pm([e]),a=ug.intersection(i,s);return a==null?[]:hg(a)}function a0(r,e){let s=pm(r,65536);for(;e.valid();e.next()){const[a,u]=e.get(),h=a.x*65536,f=a.y*65536,_=u.x*65536,g=u.y*65536,v=_-h,b=g-f,w=Math.hypot(v,b),E=Math.trunc(b/w*3),A=-Math.trunc(v/w*3);s=ug.diff(s,[[[h,f],[_,g],[_+E,g+A],[h+E,f+A],[h,f]]])}return hg(s,1/65536)}function pm(r,e=1){return[r.map(i=>i.map(s=>[s.x*e,s.y*e]))]}function hg(r,e=1){return r.map(i=>i.map((s,a)=>{const u=s.map(h=>new He(h[0]*e,h[1]*e).round());return a>0&&u.reverse(),u}))}class fm{constructor(e,i){this.layoutVertexArray=new Cs,this.indexArray=new Br,this.lineIndexArray=new so,this.triangleSegments=new or,this.lineSegments=new or,this.programConfigurations=new l(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new ro)}update(e,i,s,a,u,h,f,_){this.programConfigurations.updatePaintArrays(e,i,u,s,a,h,f,_)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,$v.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,Zv.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,i,s,a,u,h,f){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,s,a,u,h,void 0,f)}}class mm{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 fm(e,!1),this.elevationBufferData=new fm(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}updateFootprints(e,i){}populate(e,i,s,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:g,sourceLayerIndex:v}of e){const b=this.layers[0]._featureFilter.needGeometry,w=Qe(f,b);if(!this.layers[0]._featureFilter.filter(new Ti(this.zoom,{worldview:this.worldview}),w,s))continue;const E=u?u.evaluate(w,{},s,i.availableImages):void 0,A={id:_,properties:f.properties,type:f.type,sourceLayerIndex:v,index:g,geometry:b?w.geometry:rt(f,s,a),patterns:{},sortKey:E};h.push(A)}u&&h.sort((f,_)=>f.sortKey-_.sortKey);for(const f of h){const{geometry:_,index:g,sourceLayerIndex:v}=f;if(this.hasPattern){const b=dm("fill",this.layers,f,this.zoom,this.pixelRatio,i);this.patternFeatures.push(b)}else this.addFeature(f,_,g,s,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[g].feature,_,g,v,this.index)}}update(e,i,s,a,u,h,f){this.bufferData.update(e,i,s,a,u,h,f,this.worldview),this.elevationBufferData.update(e,i,s,a,u,h,f,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,i,s,a,u,h,f,this.worldview)}addFeatures(e,i,s,a,u,h){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,s,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()}
14addFeature(e,i,s,a,u,h=[],f,_){const g=Ep(i,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(e,g,a,s,_):this.addGeometry(g,this.bufferData),this.bufferData.populatePaintArrays(e,s,u,h,a,f,this.worldview),this.elevationBufferData.populatePaintArrays(e,s,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,s,a,u){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(i,s,a,u,this.worldview))}addElevatedRoadFeature(e,i,s,a,u){const h=new Array,f=zn.getElevationFeature(e,u);if(!f)return void this.addGeometry(i,this.bufferData);{const g=this.clipPolygonsToTile(i,1);g.length>0&&h.push({polygons:g,elevationFeature:f,elevationTileID:s})}const _={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},s),featureIndex:a};for(const g of h)if(g.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new Gn(g.elevationTileID,this.layers,this.zoom,this.lut));const b=g.elevationFeature.isTunnel();let w=0;e.properties.hasOwnProperty(Oi)&&(w=+e.properties[Oi]);for(const E of g.polygons)this.elevatedStructures.addPortalCandidates(g.elevationFeature.id,E,b,g.elevationFeature,w)}g.elevationFeature.constantHeight==null&&(g.polygons=this.prepareElevatedPolygons(g.polygons,g.elevationFeature,g.elevationTileID));const v=new Qn(s,g.elevationTileID);this.addElevatedGeometry(g.polygons,v,g.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,a,_)}}addElevatedGeometry(e,i,s,a,u,h){const f={elevation:s,elevationSampler:i,bias:a,index:u,featureInfo:h},[_,g]=this.addGeometry(e,this.elevationBufferData,f);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:_,max:g}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,_),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,g))}addGeometry(e,i,s){let a=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,h=null;s&&(h=s.elevationSampler.constantElevation(s.elevation,s.bias),h!=null&&(a=h,u=h));const f=(_,g,v)=>{if(s!=null)if(g.push(_),h!=null)i.elevatedLayoutVertexArray.emplaceBack(h),v.push(h);else{const b=s.elevationSampler.pointElevation(_,s.elevation,s.bias);i.elevatedLayoutVertexArray.emplaceBack(b),v.push(b),a=Math.min(a,b),u=Math.max(u,b)}};for(const _ of e){let g=0;for(const G of _)g+=G.length;const v=i.triangleSegments.prepareSegment(g,i.layoutVertexArray,i.indexArray),b=v.vertexLength,w=[],E=[],A=[],P=[],D=[],k=i.layoutVertexArray.length;for(const G of _){if(G.length===0)continue;G!==_[0]&&E.push(w.length/2);const z=i.lineSegments.prepareSegment(G.length,i.layoutVertexArray,i.lineIndexArray),N=z.vertexLength;s&&D.push(i.layoutVertexArray.length-k),f(G[0],A,P),i.layoutVertexArray.emplaceBack(G[0].x,G[0].y),i.lineIndexArray.emplaceBack(N+G.length-1,N),w.push(G[0].x),w.push(G[0].y);for(let q=1;q<G.length;q++)f(G[q],A,P),i.layoutVertexArray.emplaceBack(G[q].x,G[q].y),i.lineIndexArray.emplaceBack(N+q-1,N+q),w.push(G[q].x),w.push(G[q].y);z.vertexLength+=G.length,z.primitiveLength+=G.length}const j=Lh(w,E);for(let G=0;G<j.length;G+=3)i.indexArray.emplaceBack(b+j[G],b+j[G+1],b+j[G+2]);if(j.length>0&&s&&this.elevationMode==="hd-road-base"){const G=s.elevation.isTunnel(),z=s.elevation.safeArea,N=this.elevatedStructures.addVertices(A,P);this.elevatedStructures.addTriangles(j,N,G);const q=D.length;if(q>0){for(let H=0;H<q-1;H++)this.elevatedStructures.addRenderableRing(s.index,D[H]+N,D[H+1]-D[H],G,z,s.featureInfo);this.elevatedStructures.addRenderableRing(s.index,D[q-1]+N,A.length-D[q-1],G,z,s.featureInfo)}}v.vertexLength+=g,v.primitiveLength+=j.length/3}return[a,u]}prepareElevatedPolygons(e,i,s){const a=1/we(s),u=[];for(const h of e){const f=a0(h,new wn(i,a));u.push(...f)}return u}clipPolygonsToTile(e,i){const s=-i,a=-i,u=We+i,h=We+i;let f=0;const _=[],g=[];for(;f<e.length;f++){const w=e[f],E=ku(w);(E.min.x>=s&&E.max.x<=u&&E.min.y>=a&&E.max.y<=h?_:g).push(w)}if(_.length===e.length)return e;const v=[new He(s,a),new He(u,a),new He(u,h),new He(s,h),new He(s,a)],b=_;for(const w of g)b.push(...o0(w,v));return b}}let dg,pg,fg,mg;tt(mm,"FillBucket",{omit:["layers","patternFeatures"]}),tt(fm,"FillBufferData"),tt(Gn,"ElevatedStructures");class _m{constructor(e,i,s,a){if(this.triangleCount=i.length/3,this.min=new He(0,0),this.max=new He(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||e.length===0)return;const[u,h]=[e[0].clone(),e[0].clone()];for(let b=1;b<e.length;++b){const w=e[b];u.x=Math.min(u.x,w.x),u.y=Math.min(u.y,w.y),h.x=Math.max(h.x,w.x),h.y=Math.max(h.y,w.y)}
vendor: 30,999 bytes, line 14
14if(a){const b=Math.ceil(Math.max(h.x-u.x,h.y-u.y)/a);s=Math.max(s,b)}if(s===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)/s;this.cellsX=Math.max(1,Math.ceil(f.x/_)),this.cellsY=Math.max(1,Math.ceil(f.y/_)),this.xScale=1/_,this.yScale=1/_;const g=[];for(let b=0;b<this.triangleCount;b++){const w=e[i[3*b+0]].sub(this.min),E=e[i[3*b+1]].sub(this.min),A=e[i[3*b+2]].sub(this.min),P=ho(Math.floor(Math.min(w.x,E.x,A.x)),this.xScale,this.cellsX),D=ho(Math.floor(Math.max(w.x,E.x,A.x)),this.xScale,this.cellsX),k=ho(Math.floor(Math.min(w.y,E.y,A.y)),this.yScale,this.cellsY),j=ho(Math.floor(Math.max(w.y,E.y,A.y)),this.yScale,this.cellsY),G=new He(0,0),z=new He(0,0),N=new He(0,0),q=new He(0,0);for(let H=k;H<=j;++H){G.y=z.y=H*_,N.y=q.y=(H+1)*_;for(let oe=P;oe<=D;++oe)G.x=N.x=oe*_,z.x=q.x=(oe+1)*_,(im(w,E,A,G,z,q)||im(w,E,A,G,q,N))&&g.push({cellIdx:H*this.cellsX+oe,triIdx:b})}}if(g.length===0)return;g.sort((b,w)=>b.cellIdx-w.cellIdx||b.triIdx-w.triIdx);let v=0;for(;v<g.length;){const b=g[v].cellIdx,w={start:this.payload.length,len:0};for(;v<g.length&&g[v].cellIdx===b;)++w.len,this.payload.push(g[v++].triIdx);this.cells[b]=w}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const s=ho(e.x-this.min.x,this.xScale,this.cellsX),a=ho(e.y-this.min.y,this.yScale,this.cellsY),u=this.cells[a*this.cellsX+s];if(u){this._lazyInitLookup();for(let h=0;h<u.len;h++){const f=this.payload[u.start+h],_=Math.floor(f/8),g=1<<f%8;if(!(this.lookup[_]&g)&&(this.lookup[_]|=g,i.push(f),i.length===this.triangleCount))return}}}query(e,i,s){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();const a=ho(e.x-this.min.x,this.xScale,this.cellsX),u=ho(i.x-this.min.x,this.xScale,this.cellsX),h=ho(e.y-this.min.y,this.yScale,this.cellsY),f=ho(i.y-this.min.y,this.yScale,this.cellsY);for(let _=h;_<=f;_++)for(let g=a;g<=u;g++){const v=this.cells[_*this.cellsX+g];if(v)for(let b=0;b<v.len;b++){const w=this.payload[v.start+b],E=Math.floor(w/8),A=1<<w%8;if(!(this.lookup[E]&A)&&(this.lookup[E]|=A,s.push(w),s.length===this.triangleCount))return}}}}function ho(r,e,i){return Math.max(0,Math.min(i-1,Math.floor(r*e)))}tt(_m,"TriangleGridIndex");class _g{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[],this.worldview=e.worldview}updateFootprints(e,i){for(const s of this.footprints)i.push({footprint:s,id:e})}populate(e,i,s,a){const u=[];for(const{feature:h,id:f,index:_,sourceLayerIndex:g}of e){const v=this.layers[0]._featureFilter.needGeometry,b=Qe(h,v);if(!this.layers[0]._featureFilter.filter(new Ti(this.zoom,{worldview:this.worldview}),b,s))continue;const w={id:f,properties:h.properties,type:h.type,sourceLayerIndex:g,index:_,geometry:v?b.geometry:rt(h,s,a),patterns:{}};u.push(w)}for(const h of u){const{geometry:f,index:_,sourceLayerIndex:g}=h;this.addFeature(h,f,_,s,{},i.availableImages,i.brightness),i.featureIndex.insert(e[_].feature,f,_,g,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,s,a,u,h,f){}destroy(){}addFeature(e,i,s,a,u,h=[],f){for(const _ of Ep(i,2)){const g=[],v=[],b=[],w=new He(1/0,1/0),E=new He(-1/0,-1/0);for(const D of _)if(D.length!==0){D!==_[0]&&b.push(v.length/2);for(let k=0;k<D.length;k++)v.push(D[k].x),v.push(D[k].y),g.push(D[k]),w.x=Math.min(w.x,D[k].x),w.y=Math.min(w.y,D[k].y),E.x=Math.max(E.x,D[k].x),E.y=Math.max(E.y,D[k].y)}const A=Lh(v,b),P=new _m(g,A,8,256);this.footprints.push({vertices:g,indices:A,grid:P,min:w,max:E})}}}tt(_g,"ClipBucket",{omit:["layers"]});const l0=ii([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),c0=ii([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),u0=ii([{name:"a_centroid_pos",components:2,type:"Uint16"}]),h0=ii([{name:"a_join_normal_inside",components:3,type:"Int16"}]),d0=ii([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),p0=ii([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:f0}=l0,Ap=Number.MAX_SAFE_INTEGER;function gg(r,e,i,s){return r.order<e||r.order===Ap||!(r.clipMask&i)||function(a,u){return u.length!==0&&u.find(h=>h===a)===void 0}(s,r.clipScope)}function Mp(r,e){return r.x-e.x||r.y-e.y}function yg(r,e){return Mp(r.min,e.min)===0&&Mp(r.max,e.max)===0}function gm(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 ym(r,e){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(r[i].sourceId!==e[i].sourceId||!yg(r[i],e[i])||r[i].order!==e[i].order||r[i].clipMask!==e[i].clipMask||!gs(r[i].clipScope,e[i].clipScope))return!1;return!0}function xg(r,e,i){const s=1/We,a=1/(1<<i.canonical.z),u=(e.x*s+i.canonical.x)*a+i.wrap,h=(e.y*s+i.canonical.y)*a;return{min:new He((r.x*s+i.canonical.x)*a+i.wrap,(r.y*s+i.canonical.y)*a),max:new He(u,h)}}function m0(r,e,i){const s=1<<i.canonical.z,a=((e.x-i.wrap)*s-i.canonical.x)*We,u=(e.y*s-i.canonical.y)*We;return{min:new He(((r.x-i.wrap)*s-i.canonical.x)*We,(r.y*s-i.canonical.y)*We),max:new He(a,u)}}function vg(r,e,i,s,a,u,h){const f=r.indices,_=r.vertices,g=[];for(let v=s;v<s+a;v+=3){const b=e[i[v+0]+u],w=e[i[v+1]+u],E=e[i[v+2]+u],A=Math.min(b.x,w.x,E.x),P=Math.max(b.x,w.x,E.x),D=Math.min(b.y,w.y,E.y),k=Math.max(b.y,w.y,E.y);g.length=0,r.grid.query(new He(A,D),new He(P,k),g);for(let j=0;j<g.length;j++){const G=g[j];if(im(_[f[3*G+0]],_[f[3*G+1]],_[f[3*G+2]],b,w,E,h))return!0}}return!1}function bg(r,e,i,s){if(!r||!i)return!1;let a=r.vertices;if(!e.canonical.equals(s.canonical)||e.wrap!==s.wrap){if(i.vertices.length<r.vertices.length)return bg(i,s,r,e);const u=e.canonical,h=s.canonical,f=Math.pow(2,h.z-u.z);a=r.vertices.map(_=>new He((_.x+u.x*We)*f-h.x*We,(_.y+u.y*We)*f-h.y*We))}return vg(i,a,r.indices,0,r.indices.length,0,0)}function wg(r,e,i,s){const a=Math.pow(2,s.z-i.z);return new He((r+i.x*We)*a-s.x*We,(e+i.y*We)*a-s.y*We)}function Tg(r,e){const i=[];e.grid.queryPoint(r,i);const s=e.indices,a=e.vertices;for(let u=0;u<i.length;u++){const h=i[u];if(hs([a[s[3*h+0]],a[s[3*h+1]],a[s[3*h+2]]],r))return!0}return!1}const xm=[new He(0,0),new He(We,0),new He(We,We),new He(0,We)];function Sg(r,e){const i=[];let s=[];if(!e||r.length<2)return[r];if(r.length===2)return Go(r[0],r[1],xm)?[r]:[];for(let a=0;a<r.length+2;a++){const u=r[a%r.length],h=r[(a+1)%r.length],f=Go(a===0?r[r.length-1]:r[(a-1)%r.length],u,xm),_=Go(u,h,xm),g=f||_;g&&s.push(u),g&&_||s.length>0&&(s.length>1&&i.push(s),s=[])}return s.length>1&&i.push(s),i}const vm=Vt.VectorTileFeature.types,_0=["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"],g0=["fill-extrusion-flood-light-ground-radius"],y0=Math.pow(2,13),x0=Math.pow(2,15)-1,Eg=new He(0,1),Ga=2147483648;function Nh(r,e,i,s,a,u,h,f){r.emplaceBack((e<<1)+h,(i<<1)+u,(Math.floor(s*y0)<<1)+a,Math.round(f))}function Vh(r,e,i){r.emplaceBack(e.x*We,e.y*We,i?1:0)}function Cp(r,e,i,s,a,u){r.emplaceBack(e.x,e.y,(i.x<<1)+s,(i.y<<1)+a,u)}function Uh(r,e,i){r.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class Ig{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class Ag{constructor(){this.centroidXY=new He(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 He(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new He(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new He(this.max.x-this.min.x,this.max.y-this.min.y)}}class Mg{constructor(){this.acc=new He(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,s){this.accCount++,this.acc._add(i);let a=!!this.borders;i.x<e.min.x?(e.min.x=i.x,a=!0):i.x>e.max.x&&(e.max.x=i.x,a=!0),i.y<e.min.y?(e.min.y=i.y,a=!0):i.y>e.max.y&&(e.max.y=i.y,a=!0),((i.x===0||i.x===We)&&i.x===s.x)!=((i.y===0||i.y===We)&&i.y===s.y)&&this.processBorderOverlap(i,s),a&&this.checkBorderIntersection(i,s)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,Tt(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>We!=e.x>We&&this.addBorderIntersection(1,Tt(i.y,e.y,(We-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,Tt(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>We!=e.y>We&&this.addBorderIntersection(3,Tt(i.x,e.x,(We-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const s=this.borders[e];i<s[0]&&(s[0]=i),i>s[1]&&(s[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const s=e.x===0?0:1;this.addBorderIntersection(s,i.y),this.addBorderIntersection(s,e.y)}else{const s=e.y===0?2:3;this.addBorderIntersection(s,i.x),this.addBorderIntersection(s,e.x)}}centroid(){return this.accCount===0?new He(0,0):new He(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 Cg(r,e){const i=r.add(e)._unit(),s=Q(r.x*i.x+r.y*i.y,-1,1);var a,u,h;return a=Math.acos(s),Math.min(4,Math.max(-4,Math.tan(a)))/4*x0*((u=r).x*(h=e).y-u.y*h.x<0?-1:1)}const v0=[r=>r.x<0,r=>r.x>We,r=>r.y<0,r=>r.y>We];function b0(r,e,i,s){const a=[4];if(s===0)return a;i._mult(s);const u=r.sub(i),h=e.sub(i),f=[r,e,u,h];for(let _=0;_<4;_++)for(const g of f)if(v0[_](g)){a.push(_);break}return a}class Pg{constructor(e){this.vertexArray=new za,this.indexArray=new Br,this.programConfigurations=new l(e.layers,{zoom:e.zoom,lut:e.lut},i=>g0.includes(i)),this._segments=new or,this.hiddenByLandmarkVertexArray=new Qc,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new or}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,s,a=!1){const u=e.length;if(u>2){let h=Math.max(0,this._segments.get().length-1);const f=this._segments._prepareSegment(4*u,this.vertexArray.length,2*this._segmentToGroundQuads[h].length);let _;h!==this._segments.get().length-1&&(h++,this._segmentToGroundQuads[h]=[],this._segmentToRegionTriCounts[h]=[0,0,0,0,0]);{const g=e[0],v=e[1];_=Cg(g.sub(e[u-1])._perp()._unit(),v.sub(g)._perp()._unit())}for(let g=0;g<u;g++){const v=g===u-1?0:g+1,b=e[g],w=e[v],E=e[v===u-1?0:v+1],A=w.sub(b)._perp()._unit(),P=Cg(A,E.sub(w)._perp()._unit()),D=_,k=P;if(bm(b,w,i)||a&&Dg(b,i)&&Dg(w,i)){_=P;continue}const j=f.vertexLength;Cp(this.vertexArray,b,w,1,1,D),Cp(this.vertexArray,b,w,1,0,D),Cp(this.vertexArray,b,w,0,1,k),Cp(this.vertexArray,b,w,0,0,k),f.vertexLength+=4;const G=b0(b,w,A,s);for(const z of G)this._segmentToGroundQuads[h].push({id:j,region:z}),this._segmentToRegionTriCounts[h][z]+=2,f.primitiveLength+=2;_=P}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let s=0;s<i;s++)this._segmentToGroundQuads[s].sort((a,u)=>a.region-u.region);for(let s=0;s<i;s++){const a=this._segmentToGroundQuads[s],u=e[s],h=this._segmentToRegionTriCounts[s];h.reduce((_,g)=>_+g,0);let f=0;for(let _=0;_<=4;_++){const g=h[_];if(g!==0){let v=this.regionSegments[_];v||(v=this.regionSegments[_]=new or);const b={vertexOffset:u.vertexOffset,primitiveOffset:u.primitiveOffset+f,vertexLength:u.vertexLength,primitiveLength:g};v.get().push(b)}f+=g}for(let _=0;_<a.length;_++){const g=a[_].id;this.indexArray.emplaceBack(g,g+1,g+3),this.indexArray.emplaceBack(g,g+3,g+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,s,a,u,h,f){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,s,a,u,h,void 0,f)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,c0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,s,a,u,h,f,_){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,s,a,u,h,f,_)}updateHiddenByLandmark(e){if(!this.hasData())return;const i=e.groundVertexCount+e.groundVertexArrayOffset;if(e.groundVertexCount===0)return;const s=e.flags&Ga?1:0;for(let a=e.groundVertexArrayOffset;a<i;++a)this.hiddenByLandmarkVertexArray.emplace(a,s);this._needsHiddenByLandmarkUpdate=!0}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,d0.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class 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 Br,this.footprintVertices=new Cs,this.footprintSegments=[],this.layoutVertexArray=new Pa,this.centroidVertexArray=new hp,this.wallVertexArray=new pp,this.indexArray=new Br,this.programConfigurations=new l(e.layers,{zoom:e.zoom,lut:e.lut},i=>_0.includes(i)),this.segments=new or,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new Pg(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,s,a){this.features=[],this.hasPattern=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=we(s),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:u,id:h,index:f,sourceLayerIndex:_}of e){const g=this.layers[0]._featureFilter.needGeometry,v=Qe(u,g);if(!this.layers[0]._featureFilter.filter(new Ti(this.zoom,{worldview:this.worldview}),v,s))continue;const b={id:h,sourceLayerIndex:_,index:f,geometry:g?v.geometry:rt(u,s,a),properties:u.properties,type:u.type,patterns:{}},w=this.layoutVertexArray.length,E=vm[b.type]==="Polygon";if(this.hasPattern)this.features.push(dm("fill-extrusion",this.layers,b,this.zoom,this.pixelRatio,i));else if(this.wallMode)for(const A of b.geometry)for(const P of Sg(A,E))this.addFeature(b,[P],f,s,{},i.availableImages,a,i.brightness);else this.addFeature(b,b.geometry,f,s,{},i.availableImages,a,i.brightness);i.featureIndex.insert(u,b.geometry,f,_,this.index,w)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,s,a,u,h){for(const f of this.features){const _=vm[f.type]==="Polygon",{geometry:g}=f;if(this.wallMode)for(const v of g)for(const b of Sg(v,_))this.addFeature(f,[b],f.index,i,s,a,u,h);else this.addFeature(f,g,f.index,i,s,a,u,h)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,s,a,u,h,f){this.programConfigurations.updatePaintArrays(e,i,u,s,a,h,f,this.worldview),this.groundEffect.update(e,i,u,s,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,f0),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,h0.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,p0.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,u0.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,s,a,u,h,f,_){const g=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,v=[new He(0,0),new He(We,We)],b=f.projection,w=b.name==="globe",E=this.wallMode||vm[e.type]==="Polygon",A=new Mg;A.centroidDataIndex=this.centroidData.length;const P=new Ag,D=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},a)<=0,k=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},a);let j;if(P.height=k,P.vertexArrayOffset=this.layoutVertexArray.length,P.groundVertexArrayOffset=this.groundEffect.vertexArray.length,w&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Yc),this.wallMode){if(w)return void kt("Non zero fill-extrusion-line-width is not yet supported on globe.");if(i.length!==1)return;j=function(ae){const he=ae[0].x===ae[ae.length-1].x&&ae[0].y===ae[ae.length-1].y;(function(Ye){let Ve=0;const Pt=Ye.length;for(let st=0;st<Pt;st++)Ve+=(Ye[(st+1)%Pt].x-Ye[st].x)*(Ye[(st+1)%Pt].y+Ye[st].y);return Ve>=0})(ae)||(ae=ae.reverse());const Oe={geometry:[],joinNormals:[],indices:[]},ze=[],ke=[],Be=[];let Ee=ae.length;for(;Ee>=2&&ae[Ee-1].equals(ae[Ee-2]);)Ee--;if(Ee<(he?3:2))return Oe;let Le,be,Se,Ue,Ge,_t=0;for(;_t<Ee-1&&ae[_t].equals(ae[_t+1]);)_t++;he&&(Le=ae[Ee-2],Ge=ae[_t].sub(Le)._unit()._perp());for(let Ye=_t;Ye<Ee;Ye++){if(Se=Ye===Ee-1?he?ae[_t+1]:void 0:ae[Ye+1],Se&&ae[Ye].equals(Se))continue;Ge&&(Ue=Ge),Le&&(be=Le),Le=ae[Ye],Ge=Se?Se.sub(Le)._unit()._perp():Ue,Ue=Ue||Ge;let Ve=Ue.add(Ge);Ve.x===0&&Ve.y===0||Ve._unit();const Pt=Ve.x*Ge.x+Ve.y*Ge.y,st=Pt!==0?1/Pt:1/0,lt=Ue.x*Ge.y-Ue.y*Ge.x>0;let St="miter";const Ft=2;St==="miter"&&st>Ft&&(St="bevel"),St==="bevel"&&(st>100&&(St="flipbevel"),st<Ft&&(St="miter"));const Lt=($t,Bt,Zt,fi)=>{const Li=new He($t.x,$t.y),$=new He($t.x,$t.y);Li.x+=Bt.x*fi,Li.y+=Bt.y*fi,$.x-=Bt.x*Math.max(Zt,1),$.y-=Bt.y*Math.max(Zt,1),Be.push(Bt),ze.push(Li),ke.push($)};if(St==="miter")Ve._mult(st),Lt(Le,Ve,0,0);else if(St==="flipbevel")Ve=Ge.mult(-1),Lt(Le,Ve,0,0),Lt(Le,Ve.mult(-1),0,0);else{const $t=-Math.sqrt(st*st-1),Bt=lt?$t:0,Zt=lt?0:$t;be&&Lt(Le,Ue,Bt,Zt),Se&&Lt(Le,Ge,Bt,Zt)}}Oe.geometry=[...ze,...ke.reverse(),ze[0]],Oe.joinNormals=[...Be,...Be.reverse(),Be[Be.length-1]];const ot=Oe.geometry.length-1;for(let Ye=0;Ye<ot/2;Ye++)if(Ye+1<ot/2){let Ve=Ye,Pt=Ye+1,st=ot-1-Ye,lt=ot-2-Ye;Ve=Ve===0?ot-1:Ve-1,Pt=Pt===0?ot-1:Pt-1,st=st===0?ot-1:st-1,lt=lt===0?ot-1:lt-1,Oe.indices.push(st),Oe.indices.push(Pt),Oe.indices.push(Ve),Oe.indices.push(st),Oe.indices.push(lt),Oe.indices.push(Pt)}return Oe}(i[0]),i=[j.geometry]}const G=(ae,he)=>ae<(he.length-1)/2||ae===he.length-1,z=this.wallMode?[i]:Ep(i,500);for(let ae=z.length-1;ae>=0;ae--){const he=z[ae];(he.length===0||(N=he[0]).every(Te=>Te.x<=0)||N.every(Te=>Te.x>=We)||N.every(Te=>Te.y<=0)||N.every(Te=>Te.y>=We))&&z.splice(ae,1)}var N;let q;if(w)q=Og(z,v,a);else{q=[];for(const ae of z)q.push({polygon:ae,bounds:v})}const H=E?this.edgeRadius:0,oe=H>0&&this.zoom<17,re=(ae,he)=>{if(ae.length===0)return!1;const Te=ae[ae.length-1];return he.x===Te.x&&he.y===Te.y};for(const{polygon:ae,bounds:he}of q){let Te=0,Oe=0;for(const Ee of ae)E&&!Ee[0].equals(Ee[Ee.length-1])&&Ee.push(Ee[0]),Oe+=E?Ee.length-1:Ee.length;const ze=this.segments.prepareSegment((E?5:4)*Oe,this.layoutVertexArray,this.indexArray);P.footprintSegIdx<0&&(P.footprintSegIdx=this.footprintSegments.length),P.polygonSegIdx<0&&(P.polygonSegIdx=this.polygonSegments.length);const ke={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},Be=new Ig;if(Be.vertexOffset=this.footprintVertices.length,Be.indexOffset=3*this.footprintIndices.length,Be.ringIndices=[],E){const Ee=[],Le=[];Te=ze.vertexLength;for(let Se=0;Se<ae.length;Se++){const Ue=ae[Se];Ue.length&&Se!==0&&Le.push(Ee.length/2);const Ge=[];let _t,ot;_t=Ue[1].sub(Ue[0])._perp()._unit(),Be.ringIndices.push(Ue.length-1);for(let Ye=1;Ye<Ue.length;Ye++){const Ve=Ue[Ye],Pt=Ue[Ye===Ue.length-1?1:Ye+1],st=Ve.clone();if(H){ot=Pt.sub(Ve)._perp()._unit();const lt=_t.add(ot)._unit(),St=H*Math.min(4,1/(_t.x*lt.x+_t.y*lt.y));st.x+=St*lt.x,st.y+=St*lt.y,st.x=Math.round(st.x),st.y=Math.round(st.y),_t=ot}if(!D||H!==0&&!oe||re(Ge,st)||Ge.push(st),Nh(this.layoutVertexArray,st.x,st.y,0,0,1,1,0),this.wallMode){const lt=G(Ye,Ue);Vh(this.wallVertexArray,j.joinNormals[Ye],!lt)}ze.vertexLength++,this.footprintVertices.emplaceBack(Ve.x,Ve.y),Ee.push(Ve.x,Ve.y),w&&Uh(this.layoutVertexExtArray,b.projectTilePoint(st.x,st.y,a),b.upVector(a,st.x,st.y))}D&&(H===0||oe)&&(Ge.length!==0&&re(Ge,Ge[0])&&Ge.pop(),this.groundEffect.addData(Ge,he,g))}const be=this.wallMode?j.indices:Lh(Ee,Le);for(let Se=0;Se<be.length;Se+=3)this.footprintIndices.emplaceBack(Be.vertexOffset+be[Se+0],Be.vertexOffset+be[Se+1],Be.vertexOffset+be[Se+2]),this.indexArray.emplaceBack(Te+be[Se],Te+be[Se+2],Te+be[Se+1]),ze.primitiveLength++;Be.indexCount+=be.length,Be.vertexCount+=this.footprintVertices.length-Be.vertexOffset}for(let Ee=0;Ee<ae.length;Ee++){const Le=ae[Ee];A.startRing(P,Le[0]);let be=Le.length>4&&Lg(Le[Le.length-2],Le[0],Le[1]),Se=H?w0(Le[Le.length-2],Le[0],Le[1],H):0;const Ue=[];let Ge,_t,ot;_t=Le[1].sub(Le[0])._perp()._unit();let Ye=!0;for(let Ve=1,Pt=0;Ve<Le.length;Ve++){let st=Le[Ve-1],lt=Le[Ve];const St=Le[Ve===Le.length-1?1:Ve+1];if(A.appendEdge(P,lt,st),bm(lt,st,he)){H&&(_t=St.sub(lt)._perp()._unit(),Ye=!Ye);continue}const Ft=lt.sub(st)._perp(),Lt=Ft.x/(Math.abs(Ft.x)+Math.abs(Ft.y)),$t=Ft.y>0?1:0,Bt=st.dist(lt);if(Pt+Bt>32768&&(Pt=0),H){ot=St.sub(lt)._perp()._unit();let $=Rg(st,lt,St,zg(_t,ot),H);isNaN($)&&($=0);const W=lt.sub(st)._unit();st=st.add(W.mult(Se))._round(),lt=lt.add(W.mult(-$))._round(),Se=$,_t=ot,D&&this.zoom>=17&&(re(Ue,st)||Ue.push(st),re(Ue,lt)||Ue.push(lt))}const Zt=ze.vertexLength,fi=Le.length>4&&Lg(st,lt,St);let Li=Fg(Pt,be,Ye);if(Nh(this.layoutVertexArray,st.x,st.y,Lt,$t,0,0,Li),Nh(this.layoutVertexArray,st.x,st.y,Lt,$t,0,1,Li),this.wallMode){const $=G(Ve-1,Le),W=j.joinNormals[Ve-1];Vh(this.wallVertexArray,W,$),Vh(this.wallVertexArray,W,$)}if(Pt+=Bt,Li=Fg(Pt,fi,!Ye),be=fi,Nh(this.layoutVertexArray,lt.x,lt.y,Lt,$t,0,0,Li),Nh(this.layoutVertexArray,lt.x,lt.y,Lt,$t,0,1,Li),this.wallMode){const $=G(Ve,Le),W=j.joinNormals[Ve];Vh(this.wallVertexArray,W,$),Vh(this.wallVertexArray,W,$)}if(ze.vertexLength+=4,this.indexArray.emplaceBack(Zt+0,Zt+1,Zt+2),this.indexArray.emplaceBack(Zt+1,Zt+3,Zt+2),ze.primitiveLength+=2,H){const $=Te+(Ve===1?Le.length-2:Ve-2),W=Ve===1?Te:$+1;if(this.indexArray.emplaceBack(Zt+1,$,Zt+3),this.indexArray.emplaceBack($,W,Zt+3),ze.primitiveLength+=2,Ge===void 0&&(Ge=Zt),!bm(St,Le[Ve],he)){const Ie=Ve===Le.length-1?Ge:ze.vertexLength;this.indexArray.emplaceBack(Zt+2,Zt+3,Ie),this.indexArray.emplaceBack(Zt+3,Ie+1,Ie),this.indexArray.emplaceBack(Zt+3,W,Ie+1),ze.primitiveLength+=3}Ye=!Ye}if(w){const $=this.layoutVertexExtArray,W=b.projectTilePoint(st.x,st.y,a),Ie=b.projectTilePoint(lt.x,lt.y,a),$e=b.upVector(a,st.x,st.y),Ke=b.upVector(a,lt.x,lt.y);Uh($,W,$e),Uh($,W,$e),Uh($,Ie,Ke),Uh($,Ie,Ke)}}E&&(Te+=Le.length-1),D&&H&&this.zoom>=17&&(Ue.length!==0&&re(Ue,Ue[0])&&Ue.pop(),this.groundEffect.addData(Ue,he,g,H>0))}this.footprintSegments.push(Be),ke.triangleCount=this.indexArray.length-ke.triangleArrayOffset,this.polygonSegments.push(ke),++P.footprintSegLen,++P.polygonSegLen}if(P.vertexCount=this.layoutVertexArray.length-P.vertexArrayOffset,P.groundVertexCount=this.groundEffect.vertexArray.length-P.groundVertexArrayOffset,P.vertexCount!==0){if(P.centroidXY=A.borders?Eg:this.encodeCentroid(A,P),this.centroidData.push(P),A.borders){this.featuresOnBorder.push(A);const ae=this.featuresOnBorder.length-1;for(let he=0;he<A.borders.length;he++)A.borders[he][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[he].push(ae)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,h,a,_,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(e,s,u,h,a,_,this.worldview),this.maxHeight=Math.max(this.maxHeight,k)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,s)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[s].borders[e][0])}splitToSubtiles(){const e=[];for(let f=0;f<this.centroidData.length;f++){const _=this.centroidData[f],g=+(_.min.y+_.max.y>We),v=2*g+(+(_.min.x+_.max.x>We)^g);for(let b=0;b<_.polygonSegLen;b++){const w=_.polygonSegIdx+b;e.push({centroidIdx:f,subtile:v,polygonSegmentIdx:w,triangleSegmentIdx:this.polygonSegments[w].triangleSegIdx})}}const i=new Br;e.sort((f,_)=>f.triangleSegmentIdx===_.triangleSegmentIdx?f.subtile-_.subtile:f.triangleSegmentIdx-_.triangleSegmentIdx);let s=0,a=0,u=0;for(const f of e){if(f.triangleSegmentIdx!==s)break;u++}const h=e.length;for(;a!==e.length;){s=e[a].triangleSegmentIdx;let f=0,_=a,g=a;for(let v=_;v<u&&e[v].subtile===f;v++)g++;for(;_!==u;){const v=e[_];f=v.subtile;const b=this.centroidData[v.centroidIdx].min.clone(),w=this.centroidData[v.centroidIdx].max.clone(),E={vertexOffset:this.segments.segments[s].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[s].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let A=_;A<g;A++){const P=e[A],D=this.polygonSegments[P.polygonSegmentIdx],k=this.centroidData[P.centroidIdx].min,j=this.centroidData[P.centroidIdx].max,G=this.indexArray.uint16;for(let z=D.triangleArrayOffset;z<D.triangleArrayOffset+D.triangleCount;z++)i.emplaceBack(G[3*z],G[3*z+1],G[3*z+2]);E.primitiveLength+=D.triangleCount,b.x=Math.min(b.x,k.x),b.y=Math.min(b.y,k.y),w.x=Math.max(w.x,j.x),w.y=Math.max(w.y,j.y)}E.primitiveLength>0&&this.triangleSubSegments.push({segment:E,min:b,max:w}),_=g;for(let A=_;A<u&&e[A].subtile===e[_].subtile;A++)g++}a=u;for(let v=a;v<h&&e[v].triangleSegmentIdx===e[a].triangleSegmentIdx;v++)u++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,s){const a=new or;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 g;const v=[_.canonical.x/f+_.wrap,_.canonical.y/f],b=[(_.canonical.x+1)/f+_.wrap,(_.canonical.y+1)/f],w=(P,D,k)=>[P[0]*(1-k[0])+D[0]*k[0],P[1]*(1-k[1])+D[1]*k[1]],E=[],A=[];for(const P of this.triangleSubSegments){E[0]=P.min.x/We,E[1]=P.min.y/We,A[0]=P.max.x/We,A[1]=P.max.y/We;const D=w(v,b,E),k=w(v,b,A);if(new si([D[0],D[1],u],[k[0],k[1],h]).intersectsPrecise(s)===0){g&&(a.segments.push(g),g=void 0);continue}const j=P.segment;g&&g.vertexOffset!==j.vertexOffset&&(a.segments.push(g),g=void 0),g?(g.vertexLength+=j.vertexLength,g.primitiveLength+=j.primitiveLength):g={vertexOffset:j.vertexOffset,primitiveLength:j.primitiveLength,vertexLength:j.vertexLength,primitiveOffset:j.primitiveOffset,sortKey:void 0,vaos:{}}}return g&&a.segments.push(g),a}encodeCentroid(e,i){const s=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 He(Q(s.x,1,We-1)<<3|u,Q(s.y,1,We-1)<<3|h)}encodeBorderCentroid(e){if(!e.borders)return new He(0,0);const i=e.borders,s=Number.MAX_VALUE;if(i[0][0]!==s||i[1][0]!==s){const a=i[0][0]!==s?0:1;return new He(6|(i[0][0]!==s?0:65528),(i[a][0]+i[a][1])/2<<3|6)}{const a=i[2][0]!==s?2:3;return new He((i[a][0]+i[a][1])/2<<3|6,6|(i[2][0]!==s?0:65528))}}showCentroid(e){const i=this.centroidData[e.centroidDataIndex];i.flags&=Ga,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,s=e.vertexCount+e.vertexArrayOffset,a=e.flags&Ga?Eg: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<s;++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,s){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(ym(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<s)continue;const f=Math.max(1,Math.pow(2,h.footprintTileId.canonical.z-e.canonical.z));for(const _ of this.centroidData)if(!(_.flags&Ga||h.min.x>_.max.x||_.min.x>h.max.x||h.min.y>_.max.y||_.min.y>h.max.y))for(let g=0;g<_.footprintSegLen;g++){const v=this.footprintSegments[_.footprintSegIdx+g];if(u.length=0,T0(this.footprintVertices,v.vertexOffset,v.vertexCount,h.footprintTileId.canonical,e.canonical,u),vg(h.footprint,u,this.footprintIndices.uint16,v.indexOffset,v.indexCount,-v.vertexOffset,
14-f)){_.flags|=Ga;break}}}for(const h of this.centroidData)this.writeCentroidToBuffer(h);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,s){let a=!1;for(let u=0;u<s.footprintSegLen;u++){const h=this.footprintSegments[s.footprintSegIdx+u];let f=0;for(const _ of h.ringIndices){for(let g=f,v=_+f-1;g<_+f;v=g++){const b=this.footprintVertices.int16[2*(g+h.vertexOffset)+0],w=this.footprintVertices.int16[2*(g+h.vertexOffset)+1],E=this.footprintVertices.int16[2*(v+h.vertexOffset)+1];w>i!=E>i&&e<(this.footprintVertices.int16[2*(v+h.vertexOffset)+0]-b)*(i-w)/(E-w)+b&&(a=!a)}f=_}}return a}getHeightAtTileCoord(e,i){let s=Number.NEGATIVE_INFINITY,a=!0;const u=4*(e+We)*We+(i+We);if(this.partLookup.hasOwnProperty(u)){const h=this.partLookup[u];return h?{height:h.height,hidden:!!(h.flags&Ga)}:void 0}for(const h of this.centroidData)e>h.max.x||h.min.x>e||i>h.max.y||h.min.y>i||this.footprintContainsPoint(e,i,h)&&h&&h.height>s&&(s=h.height,this.partLookup[u]=h,a=!!(h.flags&Ga));if(s!==Number.NEGATIVE_INFINITY)return{height:s,hidden:a};this.partLookup[u]=void 0}}function zg(r,e){const i=r.add(e)._unit();return r.x*i.x+r.y*i.y}function w0(r,e,i,s){const a=e.sub(r)._perp()._unit(),u=i.sub(e)._perp()._unit();return Rg(r,e,i,zg(a,u),s)}function Rg(r,e,i,s,a){const u=Math.sqrt(1-s*s);return Math.min(r.dist(e)/3,e.dist(i)/3,a*u/s)}function bm(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 Dg(r,e){return r.x<e[0].x||r.x>e[1].x||r.y<e[0].y||r.y>e[1].y}function Lg(r,e,i){if(r.x<0||r.x>=We||e.x<0||e.x>=We||i.x<0||i.x>=We)return!1;const s=i.sub(e),a=s.perp(),u=r.sub(e);return(s.x*u.x+s.y*u.y)/Math.sqrt((s.x*s.x+s.y*s.y)*(u.x*u.x+u.y*u.y))>-.866&&a.x*u.x+a.y*u.y<0}function Fg(r,e,i){const s=e?2|r:-3&r;return i?1|s:-2&s}function kg(){const r=Math.PI/32,e=Math.tan(r),i=F;return i*Math.sqrt(1+2*e*e)-i}function Og(r,e,i){const s=1<<i.z,a=ne(i.x/s),u=ne((i.x+1)/s),h=fe(i.y/s),f=fe((i.y+1)/s);return function(_,g,v,b,w=0,E){const A=[];if(!_.length||!v||!b)return A;const P=(q,H)=>{for(const oe of q)A.push({polygon:oe,bounds:H})},D=Math.ceil(Math.log2(v)),k=Math.ceil(Math.log2(b)),j=D-k,G=[];for(let q=0;q<Math.abs(j);q++)G.push(j>0?0:1);for(let q=0;q<Math.min(D,k);q++)G.push(0),G.push(1);let z=_;if(z=Ip(z,g[0].y-w,g[1].y+w,1),z=Ip(z,g[0].x-w,g[1].x+w,0),!z.length)return A;const N=[];for(G.length?N.push({polygons:z,bounds:g,depth:0}):P(z,g);N.length;){const q=N.pop(),H=q.depth,oe=G[H],re=q.bounds[0],ae=q.bounds[1],he=oe===0?re.x:re.y,Te=oe===0?ae.x:ae.y,Oe=E?E(oe,he,Te):.5*(he+Te),ze=Ip(q.polygons,he-w,Oe+w,oe),ke=Ip(q.polygons,Oe-w,Te+w,oe);if(ze.length){const Be=[re,new He(oe===0?Oe:ae.x,oe===1?Oe:ae.y)];G.length>H+1?N.push({polygons:ze,bounds:Be,depth:H+1}):P(ze,Be)}if(ke.length){const Be=[new He(oe===0?Oe:re.x,oe===1?Oe:re.y),ae];G.length>H+1?N.push({polygons:ke,bounds:Be,depth:H+1}):P(ke,Be)}}return A}(r,e,Math.ceil((u-a)/11.25),Math.ceil((h-f)/11.25),1,(_,g,v)=>{if(_===0)return .5*(g+v);{const b=fe((i.y+g/We)/s);return(K(.5*(fe((i.y+v/We)/s)+b))*s-i.y)*We}})}function T0(r,e,i,s,a,u){const h=Math.pow(2,s.z-a.z);for(let f=0;f<i;f++){let _=r.int16[2*(f+e)+0],g=r.int16[2*(f+e)+1];_=(_+a.x*We)*h-s.x*We,g=(g+a.y*We)*h-s.y*We,u.push(new He(_,g))}}let Bg,Ng;tt(Pp,"FillExtrusionBucket",{omit:["layers","features"]}),tt(Ag,"PartData"),tt(Ig,"FootprintSegment"),tt(Mg,"BorderCentroidData"),tt(Pg,"GroundEffect");class Kl extends He{constructor(e,i,s){super(e,i),this.z=s}}class Vg extends Kl{constructor(e,i,s,a){super(e,i,s),this.w=a}}function Ug(r,e,i,s){const a=i==="x"?"y":"x",u=(s-r[i])/(e[i]-r[i]);r[a]=Math.round(r[a]+(e[a]-r[a])*u),r[i]=s,r.hasOwnProperty("z")&&(r.z=Tt(r.z,e.z,u)),r.hasOwnProperty("w")&&(r.w=Tt(r.w,e.w,u))}function jg(r,e,i,s){const a=i,u=s;for(const h of["x","y"]){let f=r,_=e;f[h]>=_[h]&&(f=e,_=r),f[h]<a&&_[h]>a&&Ug(f,_,h,a),f[h]<u&&_[h]>u&&Ug(_,f,h,u)}}function zp(r,e,i,s,a,u){const h=[];for(let f=0;f<r.length;f++){const _=r[f];let g;const v=h.length;let b=0;for(let w=0;w<_.length-1;w++){let E=_[w],A=_[w+1],P=0;const D=b;let k,j;u&&(P=Math.hypot(A.x-E.x,A.y-E.y),b+=P,k=E,j=A),E.x<e&&A.x<e||(E.x<e?E=new He(e,E.y+(e-E.x)/(A.x-E.x)*(A.y-E.y))._round():A.x<e&&(A=new He(e,E.y+(e-E.x)/(A.x-E.x)*(A.y-E.y))._round()),E.y<i&&A.y<i||(E.y<i?E=new He(E.x+(i-E.y)/(A.y-E.y)*(A.x-E.x),i)._round():A.y<i&&(A=new He(E.x+(i-E.y)/(A.y-E.y)*(A.x-E.x),i)._round()),E.x>=s&&A.x>=s||(E.x>=s?E=new He(s,E.y+(s-E.x)/(A.x-E.x)*(A.y-E.y))._round():A.x>=s&&(A=new He(s,E.y+(s-E.x)/(A.x-E.x)*(A.y-E.y))._round()),E.y>=a&&A.y>=a||(E.y>=a?E=new He(E.x+(a-E.y)/(A.y-E.y)*(A.x-E.x),a)._round():A.y>=a&&(A=new He(E.x+(a-E.y)/(A.y-E.y)*(A.x-E.x),a)._round()),g&&E.equals(g[g.length-1])||(g=[E],h.push(g),u&&u.push({progress:{min:D+Gg(k,j,E)*P,max:1},parentIndex:f,prevPoint:k,nextPoint:j})),g.push(A),u&&(u[u.length-1].progress.max=D+Gg(k,j,A)*P,u[u.length-1].nextPoint=j)))))}if(u&&b>0)for(let w=v;w<h.length;w++)u[w].progress.min/=b,u[w].progress.max/=b}return h}function S0(r,e,i,s,a){if(r.length<2)return void s.push(r);const u=[];for(;e.valid();){const[g,v]=e.get();for(let b=0;b<r.length-1;b++){const w=r[b],E=r[b+1],A=zh(w,E,g,v);if(A){const[P]=A,D=new He(Tt(w.x,E.x,P),Tt(w.y,E.y,P));u.push({t:b+P,distance:0,point:D})}}e.next()}if(u.length===0)return void s.push(r);u.sort((g,v)=>g.t-v.t);let h=0,f=0,_=[];for(s.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 Gg(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 jh(r,e){return r.x*e.x+r.y*e.y}function qg(r,e){if(r.length===1){let i=0;const s=e[i++];let a;for(;!a||s.equals(a);)if(a=e[i++],!a)return 1/0;for(;i<e.length;i++){const u=e[i],h=r[0],f=a.sub(s),_=u.sub(s),g=h.sub(s),v=jh(f,f),b=jh(f,_),w=jh(_,_),E=jh(g,f),A=jh(g,_),P=v*w-b*b,D=(w*E-b*A)/P,k=(v*A-b*E)/P,j=s.z*(1-D-k)+a.z*D+u.z*k;if(isFinite(j))return j}return 1/0}{let i=1/0;for(const s of e)i=Math.min(i,s.z);return i}}function $g(r,e,i,s,a,u,h,f){const _=h*a.getElevationAt(r,e,!0,!0),g=u[0]!==0,v=g?u[1]===0?h*(u[0]/7-450):h*function(b,w,E){const A=Math.floor(w[0]/8),P=Math.floor(w[1]/8),D=10*(w[0]-8*A),k=10*(w[1]-8*P),j=b.getElevationAt(A,P,!0,!0),G=b.getMeterToDEM(E),z=Math.floor(.5*(D*G-1)),N=Math.floor(.5*(k*G-1)),q=b.tileCoordToPixel(A,P),H=2*z+1,oe=2*N+1,re=function(ke,Be,Ee,Le,be){return[ke.getElevationAtPixel(Be,Ee,!0),ke.getElevationAtPixel(Be+be,Ee,!0),ke.getElevationAtPixel(Be,Ee+be,!0),ke.getElevationAtPixel(Be+Le,Ee+be,!0)]}(b,q.x-z,q.y-N,H,oe),ae=Math.abs(re[0]-re[1]),he=Math.abs(re[2]-re[3]),Te=Math.abs(re[0]-re[2])+Math.abs(re[1]-re[3]),Oe=Math.min(.25,.5*G*(ae+he)/H),ze=Math.min(.25,.5*G*Te/oe);return j+Math.max(Oe*D,ze*k)}(a,u,f):_;return{base:_+(i===0?-1:i),top:g?Math.max(v+s,_+i+2):_+s}}class E0{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 I0{constructor(){this.tasks={},this.taskQueue=[],at(["process"],this),this.invoker=new E0(this.process),this.nextId=0}add(e,i){const s=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);if(a===0){try{e()}finally{}return null}return this.tasks[s]={fn:e,metadata:i,priority:a,id:s},this.taskQueue.push(s),this.invoker.trigger(),{cancel:()=>{delete this.tasks[s]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(s=>!!this.tasks[s]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}}pick(){let e=null,i=1/0;for(let a=0;a<this.taskQueue.length;a++){const u=this.tasks[this.taskQueue[a]];u.priority<i&&(i=u.priority,e=a)}if(e===null)return null;const s=this.taskQueue[e];return this.taskQueue.splice(e,1),s}remove(){this.invoker.remove()}}class Zg{constructor(e,i,s){this.target=e,this.parent=i,this.mapId=s,this.callbacks={},this.cancelCallbacks={},at(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler
14=new I0}send(e,i,s,a,u=!1,h){const f=Math.round(1e18*Math.random()).toString(36).substring(0,10);s&&(s.metadata=h,this.callbacks[f]=s);const _=new Set;return this.target.postMessage({id:f,type:e,hasCallback:!!s,targetMapId:a,mustQueue:u,sourceMapId:this.mapId,data:Qs(i,_)},_),{cancel:()=>{s&&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 s=i.id;if(s&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const a=this.cancelCallbacks[s];delete this.cancelCallbacks[s],a&&a.cancel()}else if(i.mustQueue||_i(self)){const a=this.callbacks[s],u=this.scheduler.add(()=>this.processTask(s,i),a&&a.metadata||{type:"message"});u&&(this.cancelCallbacks[s]=u)}else this.processTask(s,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type==="<response>"){const s=this.callbacks[e];delete this.callbacks[e],s&&(i.error?s(eo(i.error)):s(null,eo(i.data)))}else{const s=new Set,a=i.hasCallback?(h,f)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:h?Qs(h):null,data:Qs(f,s)},s)}:()=>{},u=eo(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 Gh={workerUrl:"",workerClass:null,workerParams:void 0};const wm="mapboxgl_preloaded_worker_pool";class Jl{constructor(){this.active={}}acquire(e,i=Jl.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<i;)this.workers.push(Gh.workerClass!=null?new Gh.workerClass:new self.Worker(Gh.workerUrl,Gh.workerParams));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[wm]}numActive(){return Object.keys(this.active).length}}Jl.workerCount=2;class hu{constructor(e,i,s="Worker",a=Jl.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=ve();const u=this.workerPool.acquire(this.id,a);for(let h=0;h<u.length;h++){const f=new hu.Actor(u[h],i,this.id);f.name=`${s} ${h}`,this.actors.push(f)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,s){ue(this.actors,(a,u)=>{a.send(e,i,u)},s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}let qh,Tm;function Rp(){return qh||(qh=new Jl),qh}hu.Actor=Zg;class A0{constructor(e){this.module=e}createIntArray(e){const i=new Int32Array(e),s=this.module.malloc(i.length*i.BYTES_PER_ELEMENT);return this.module.heap32.set(i,s/i.BYTES_PER_ELEMENT),s}createFloatArray(e){const i=new Float32Array(e),s=this.module.malloc(i.length*i.BYTES_PER_ELEMENT);return this.module.heapF32.set(i,s/i.BYTES_PER_ELEMENT),s}createStringBuffer(e){const i=this.module.malloc(e.length+1);for(let s=0;s<e.length;++s)this.module.heapU8[i+s]=e.charCodeAt(s);return this.module.heapU8[i+e.length]=0,i}readStringBuffer(e){let i="";for(;this.module.heapU8[e]!==0;)i+=String.fromCharCode(this.module.heapU8[e]),++e;return i}setStyle(e){const i=e.entranceColorRgb,s=e.facadeGlazingColorRgb,a=e.roofColorRgb,u=e.wallColorRgb,h=e.normalScale;this.module.setStyle(i[0],i[1],i[2],s[0],s[1],s[2],a[0],a[1],a[2],u[0],u[1],u[2],h[0],h[1],h[2],e.tileToMeters)}setAOOptions(e,i){this.module.setAOOptions(e?1:0,i)}setMetricOptions(e,i){this.module.setMetricOptions(e?1:0,i)}setFacadeOptions(e,i,s){this.module.setFacadeOptions(e,i,s)}generateMesh(e,i){for(const f of e){const _=this.createStringBuffer(f.roofType),g=[0],v=[];for(const E of f.coordinates)if(Array.isArray(E)){for(const A of E)v.push(A.x),v.push(A.y);g.push(v.length)}const b=this.createIntArray(g),w=this.createFloatArray(v);this.module.addFeature(f.id,f.sourceId,f.minHeight,f.height,_,f.roofType.length,w,b,g.length-1),this.module.free(_),this.module.free(b),this.module.free(w)}for(const f of i){let _;_=f.entrances?JSON.parse(f.entrances):[];const g=this.createFloatArray(_),v=[];for(const w of f.coordinates)v.push(w.x),v.push(w.y);const b=this.createFloatArray(v);this.module.addFacade(f.sourceId,f.crossPerc,f.distanceToRoad,g,_.length,b,v.length),this.module.free(g),this.module.free(b)}if(!this.module.generateMesh()){const f=this.module.getLastError();return this.readStringBuffer(f)}
14const s=this.module.getMeshCount(),a=new Array(s);for(let f=0;f<s;f++){const _=this.module.getPositionsPtr(f),g=this.module.getPositionsLength(f),v=new Float32Array(this.module.heapF32.buffer,_,g),b=this.module.getNormalsPtr(f),w=this.module.getNormalsLength(f),E=new Float32Array(this.module.heapF32.buffer,b,w),A=this.module.getColorsPtr(f),P=this.module.getColorsLength(f),D=new Uint8Array(this.module.heapU8.buffer,A,P),k=this.module.getAOPtr(f),j=this.module.getAOLength(f),G=new Float32Array(this.module.heapF32.buffer,k,j),z=this.module.getIndicesPtr(f),N=this.module.getIndicesLength(f),q=new Int32Array(this.module.heap32.buffer,z,N),H=this.module.getBuildingPart(f),oe=this.readStringBuffer(H);a[f]={positions:v,normals:E,colors:D,ao:G,indices:q,buildingPart:oe}}const u=this.module.getRingCount(),h=[];for(let f=0;f<u;f++){const _=this.module.getRingPtr(f),g=this.module.getRingLength(f),v=new Float32Array(this.module.heapF32.buffer,_,g);h.push(v)}return{meshes:a,modifiedPolygonRings:h}}}let $h,Sm,Rs,du,Em,pu=null,fu=null,Hg=null,Im=null;function Wg(){return _i(self)&&self.worker.dracoUrl?self.worker.dracoUrl:Sm||kr.DRACO_URL}function Xg(){if(_i(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(du)return du;const 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 du=WebAssembly.validate(r)?kr.MESHOPT_SIMD_URL:kr.MESHOPT_URL,du}const Dp={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},M0={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},Zh={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function Yg(r,e,i){const s=i.json.bufferViews.length,a=i.buffers.length;e.bufferView=s,i.json.bufferViews[s]={buffer:a,byteLength:r.byteLength},i.buffers[a]=r}const Am="KHR_draco_mesh_compression";function C0(r,e){const i=r.extensions&&r.extensions[Am];if(!i)return;const s=new Rs.Decoder,a=ey(e,i.bufferView),u=new Rs.Mesh;if(!s.DecodeArrayToMesh(a,a.byteLength,u))throw new Error("Failed to decode Draco mesh");const h=e.json.accessors[r.indices],f=Dp[h.componentType],_=h.count*f.BYTES_PER_ELEMENT,g=Rs._malloc(_);f===Uint16Array?s.GetTrianglesUInt16Array(u,_,g):s.GetTrianglesUInt32Array(u,_,g),Yg(Rs.memory.buffer.slice(g,g+_),h,e),Rs._free(g);for(const v of Object.keys(i.attributes)){const b=s.GetAttributeByUniqueId(u,i.attributes[v]),w=e.json.accessors[r.attributes[v]],E=M0[w.componentType],A=w.count*Zh[w.type]*Dp[w.componentType].BYTES_PER_ELEMENT,P=Rs._malloc(A);s.GetAttributeDataArrayForAllPoints(u,b,Rs[E],A,P),Yg(Rs.memory.buffer.slice(P,P+A),w,e),Rs._free(P)}s.destroy(),u.destroy(),delete r.extensions[Am]}const Lp="EXT_meshopt_compression";function P0(r,e){if(!r.extensions||!r.extensions[Lp])return;const i=r.extensions[Lp],s=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),a=new Uint8Array(i.count*i.byteStride);Em.decodeGltfBuffer(a,i.count,i.byteStride,s,i.mode,i.filter),r.buffer=e.buffers.length,r.byteOffset=0,e.buffers[r.buffer]=a.buffer,delete r.extensions[Lp]}const Kg=1179937895,Jg=new TextDecoder("utf8");function Qg(r,e){return new URL(r,e).href}function z0(r,e,i,s){return fetch(Qg(r.uri,s)).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 R0(r,e,i,s){if(r.uri){const a=Qg(r.uri,s);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 ty(r,e=0,i){const s={json:null,images:[],buffers:[]};if(new Uint32Array(r,e,1)[0]===Kg){const v=new Uint32Array(r,e);let b=2;const w=(v[b++]>>2)-3,E=v[b++]>>2;if(b++,s.json=JSON.parse(Jg.decode(v.subarray(b,b+E))),b+=E,b<w){const A=v[b++];b++;const P=e+(b<<2);s.buffers[0]=r.slice(P,P+A)}}else s.json=JSON.parse(Jg.decode(new Uint8Array(r,e)));const{buffers:a,images:u,meshes:h,extensionsUsed:f,bufferViews:_}=s.json;let g=Promise.resolve();if(a){const v=[];for(let b=0;b<a.length;b++){const w=a[b];
14w.uri?v.push(z0(w,s,b,i)):s.buffers[b]||(s.buffers[b]=null)}g=Promise.all(v)}return g.then(()=>{const v=[],b=f&&f.includes(Am),w=f&&f.includes(Lp);if(b&&v.push(function(){if(!Rs)return $h??($h=function(E){let A,P=null;function D(){A=new Uint8Array(P.buffer)}function k(){throw new Error("Unexpected Draco error.")}const j={a:{a:k,d:function(G,z,N){return A.copyWithin(G,z,z+N)},c:function(G){const z=A.length,N=Math.max(G>>>0,Math.ceil(1.2*z)),q=Math.ceil((N-z)/65536);try{return P.grow(q),D(),!0}catch{return!1}},b:k}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(E,j):E.then(G=>G.arrayBuffer()).then(G=>WebAssembly.instantiate(G,j))).then(G=>{const{Rb:z,Qb:N,P:q,T:H,X:oe,Ja:re,La:ae,Qa:he,Va:Te,Wa:Oe,eb:ze,jb:ke,f:Be,e:Ee,yb:Le,zb:be,Ab:Se,Bb:Ue,Db:Ge,Gb:_t}=G.instance.exports;P=Ee;const ot=(()=>{let Ye=0,Ve=0,Pt=0,st=0;return lt=>{Pt&&(z(st),z(Ye),Ve+=Pt,Pt=Ye=0),Ye||(Ve+=128,Ye=N(Ve));const St=lt.length+7&-8;let Ft=Ye;St>=Ve&&(Pt=St,Ft=st=N(St));for(let Lt=0;Lt<lt.length;Lt++)A[Ft+Lt]=lt[Lt];return Ft}})();return D(),Be(),{memory:Ee,_free:z,_malloc:N,Mesh:class{constructor(){this.ptr=q()}destroy(){H(this.ptr)}},Decoder:class{constructor(){this.ptr=re()}destroy(){ke(this.ptr)}DecodeArrayToMesh(Ye,Ve,Pt){const st=ot(Ye),lt=ae(this.ptr,st,Ve,Pt.ptr);return!!oe(lt)}GetAttributeByUniqueId(Ye,Ve){return{ptr:he(this.ptr,Ye.ptr,Ve)}}GetTrianglesUInt16Array(Ye,Ve,Pt){Te(this.ptr,Ye.ptr,Ve,Pt)}GetTrianglesUInt32Array(Ye,Ve,Pt){Oe(this.ptr,Ye.ptr,Ve,Pt)}GetAttributeDataArrayForAllPoints(Ye,Ve,Pt,st,lt){ze(this.ptr,Ye.ptr,Ve.ptr,Pt,st,lt)}},DT_INT8:Le(),DT_UINT8:be(),DT_INT16:Se(),DT_UINT16:Ue(),DT_UINT32:Ge(),DT_FLOAT32:_t()}})}(fetch(Wg())),$h.then(E=>{Rs=E,$h=void 0}))}()),w&&v.push(function(){if(Em)return;const E=function(A){let P;const D=WebAssembly.instantiateStreaming(A,{}).then(G=>{P=G.instance,P.exports.__wasm_call_ctors()}),k={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},j={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:D,supported:!0,decodeGltfBuffer(G,z,N,q,H,oe){(function(re,ae,he,Te,Oe,ze,ke){const Be=re.exports.sbrk,Ee=Te+3&-4,Le=Be(Ee*Oe),be=Be(ze.length),Se=new Uint8Array(re.exports.memory.buffer);Se.set(ze,be);const Ue=ae(Le,Te,Oe,be,ze.length);if(Ue===0&&ke&&ke(Le,Ee,Oe),he.set(Se.subarray(Le,Le+Te*Oe)),Be(Le-Be(0)),Ue!==0)throw new Error(`Malformed buffer data: ${Ue}`)})(P,P.exports[j[H]],G,z,N,q,P.exports[k[oe]])}}}(fetch(Xg()));return E.ready.then(()=>{Em=E})}()),u)for(let E=0;E<u.length;E++)v.push(R0(u[E],s,E,i));return(v.length?Promise.all(v):Promise.resolve()).then(()=>{if(b&&h)for(const{primitives:E}of h)for(const A of E)C0(A,s);if(w&&h&&_)for(const E of _)P0(E,s);return s})})}class iy{constructor(e){this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.hasPattern=!1,this.worldview=e.worldview}updateFootprints(e,i){}prepare(){return function(){if(Im!=null||Hg!=null)return null;if(fu!=null)return fu;const e=fetch(kr.BUILDING_GEN_URL);return fu=function(i){let s,a,u,h;function f(){s=new Uint8Array(h.buffer),a=new Int32Array(h.buffer),u=new Float32Array(h.buffer)}function _(){throw new Error("Unexpected BuildingGen error.")}const g=()=>{},v={a:{a:_,f:function(b){const w=s.length,E=Math.max(b>>>0,Math.ceil(1.2*w)),A=Math.ceil((E-w)/65536);try{return h.grow(A),f(),!0}catch{return!1}},g:_,b:g,c:g,d:g,e:g}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(i,v):i.then(b=>b.arrayBuffer()).then(b=>WebAssembly.instantiate(b,v))).then(b=>{const w=b.instance.exports;return(0,w.g)(),h=w.f,f(),new A0({setStyle:w.h,setAOOptions:w.i,setMetricOptions:w.j,setFacadeOptions:w.k,addFeature:w.l,addFacade:w.m,generateMesh:w.n,getLastError:w.o,getMeshCount:w.p,getPositionsPtr:w.q,getPositionsLength:w.r,getNormalsPtr:w.s,getNormalsLength:w.t,getColorsPtr:w.u,getColorsLength:w.v,getAOPtr:w.w,getAOLength:w.x,getIndicesPtr:w.y,getIndicesLength:w.z,getBuildingPart:w.A,getRingCount:w.B,getRingPtr:w.C,getRingLength:w.D,free:w.E,malloc:w.F,heapU8:s,heap32:a,heapF32:u})})}(e).then(i=>(fu=null,Im=i,Im)).catch(i=>{kt("Could not load building-gen"),fu=null,Hg=i}),fu}()}populate(e,i,s,a){}update(e,i,s,a,u,h,f){}isEmpty(){return!1}uploadPending(){return!1}upload(e){}destroy(){}getHeightAtTileCoord(e,i){return{height:Number.NEGATIVE_INFINITY,hidden:!0}}}let ry,ny;tt(iy,"BuildingBucket",{omit:["layers"]});const D0=ii([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),L0=ii([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:F0}=D0,k0=ii([{name:"a_packed",components:3,type:"Float32"}]),{members:O0}=k0,B0=ii([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:N0}=B0;class sy{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new ja({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const s=this.getKey(e,i);return this.positions[s]}trim(){const e=this.width,i=this.height=Ze(this.nextRow);this.image.resize({width:e,height:i})}
vendor: 5,096 bytes, line 14
14getKey(e,i){return e.join(",")+i}getDashRanges(e,i,s){const a=[];let u=e.length%2==1?-e[e.length-1]*s:0,h=e[0]*s,f=!0;a.push({left:u,right:h,isDash:f,zeroLength:e[0]===0});let _=e[0];for(let g=1;g<e.length;g++){f=!f;const v=e[g];u=_*s,_+=v,h=_*s,a.push({left:u,right:h,isDash:f,zeroLength:v===0})}return a}addRoundDash(e,i,s){const a=i/2;for(let u=-s;u<=s;u++){const h=this.width*(this.nextRow+s+u);let f=0,_=e[f];for(let g=0;g<this.width;g++){g/_.right>1&&(_=e[++f]);const v=Math.abs(g-_.left),b=Math.abs(g-_.right),w=Math.min(v,b);let E;const A=u/s*(a+1);if(_.isDash){const P=a-Math.abs(A);E=Math.sqrt(w*w+P*P)}else E=a-Math.sqrt(w*w+A*A);this.image.data[h+g]=Math.max(0,Math.min(255,E+128))}}}addRegularDash(e,i){for(let _=e.length-1;_>=0;--_){const g=e[_],v=e[_+1];g.zeroLength?e.splice(_,1):v&&v.isDash===g.isDash&&(v.left=g.left,e.splice(_,1))}const s=e[0],a=e[e.length-1];s.isDash===a.isDash&&(s.left=a.left-this.width,a.right=s.right+this.width);const u=this.width*this.nextRow;let h=0,f=e[h];for(let _=0;_<this.width;_++){_/f.right>1&&(f=e[++h]);const g=Math.abs(_-f.left),v=Math.abs(_-f.right),b=Math.min(g,v);this.image.data[u+_]=Math.max(0,Math.min(255,(f.isDash?b:-b)+i+128))}}addDash(e,i){const s=this.getKey(e,i);if(this.positions[s])return this.positions[s];const a=i==="round",u=a?7:0,h=2*u+1;if(this.nextRow+h>this.height)return kt("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&&(kt("Negative value is found in line dasharray, replacing values with 0"),e[v]=0),f+=e[v];if(f!==0){const v=this.width/f,b=this.getDashRanges(e,this.width,v);a?this.addRoundDash(b,v,u):this.addRegularDash(b,i==="square"?.5*v:0)}const _=this.nextRow+u;this.nextRow+=h;const g={tl:[_,u],br:[f,0]};return this.positions[s]=g,g}}tt(sy,"LineAtlas");const V0=Vt.VectorTileFeature.types,U0=Math.cos(Math.PI/180*37.5),j0=Math.cos(Math.PI/180*5);class Mm{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 gh,this.layoutVertexArray2=new ls,this.patternVertexArray=new ls,this.indexArray=new Br,this.programConfigurations=new l(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new or,this.maxLineLength=0,this.zOffsetVertexArray=new ls,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:We/64,this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,s,a){this.hasPattern=hm("line",this.layers,this.pixelRatio,i);const u=this.layers[0].layout.get("line-sort-key");this.tileToMeter=we(s);const h=this.layers[0].layout.get("line-elevation-reference");if(h==="hd-road-markup")this.elevationType="road";else{const w=this.layers[0].layout.get("line-z-offset"),E=w.isConstant()&&!w.constantOr(0);this.elevationType=h!=="sea"&&h!=="ground"&&E?"none":"offset",this.elevationType==="offset"&&h==="none"&&kt(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const f=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&f!==void 0;const _=[];for(const{feature:w,id:E,index:A,sourceLayerIndex:P}of e){const D=this.layers[0]._featureFilter.needGeometry,k=Qe(w,D);if(!this.layers[0]._featureFilter.filter(new Ti(this.zoom,{worldview:this.worldview}),k,s))continue;const j=u?u.evaluate(k,{},s):void 0,G={id:E,properties:w.properties,type:w.type,sourceLayerIndex:P,index:A,geometry:D?k.geometry:rt(w,s,a),patterns:{},sortKey:j};_.push(G)}u&&_.sort((w,E)=>w.sortKey-E.sortKey);const{lineAtlas:g,featureIndex:v}=i,b=this.addConstantDashes(g);for(const w of _){const{geometry:E,index:A,sourceLayerIndex:P}=w;if(b&&this.addFeatureDashes(w,g),this.hasPattern){const D=dm("line",this.layers,w,this.zoom,this.pixelRatio,i);this.patternFeatures.push(D)}else this.addFeature(w,E,A,s,g.positions,i.availableImages,i.brightness,i.elevationFeatures);v.insert(e[A].feature,E,A,P,this.index)}}addConstantDashes(e){let i=!1;for(const s of this.layers){const a=s.paint.get("line-dasharray").value,u=s.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 s=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:s},e);_=h.kind==="constant"?h.value:h.evaluate({zoom:s},e),i.addDash(f,_),e.patterns[a.id]=[i.getKey(f,_)]}}update(e,i,s,a,u,h,f,_){this.programConfigurations.updatePaintArrays(e,i,u,s,a,h,f,_)}
14addFeatures(e,i,s,a,u,h){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,s,a,h)}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,O0)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,N0)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,L0.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,F0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,s,a,u,h,f,_){const g=this.layers[0].layout,v=g.get("line-join").evaluate(e,{}),b=g.get("line-cap").evaluate(e,{}),w=g.get("line-miter-limit"),E=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e,this.zOffsetValue=g.get("line-z-offset").value;const A=this.layers[0].paint.get("line-width").value;if(A.kind!=="constant"&&A.isLineProgressConstant===!1&&(this.variableWidthValue=A),this.elevationType==="road"){const P=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,i,a,_,v,b,w,E)){const[D,k]=this.clipRuntimeLinesToTile(i,1);for(let j=0;j<D.length;j++){const G=D[j],z=k[j],N={progress:{min:z.progress.min,max:z.progress.max},nextDir:this.computeSegNextDir(z,G),prevDir:this.computeSegPrevDir(z,G)};this.addLine(G,e,a,v,b,w,E,N)}this.fillNonElevatedRoadSegment(P)}}else for(const P of i)this.addLine(P,e,a,v,b,w,E);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,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 zp(e,-i,-i,We+i,We+i)}clipRuntimeLinesToTile(e,i){const s=[];return[zp(e,-i,-i,We+i,We+i,s),s]}addElevatedRoadFeature(e,i,s,a,u,h,f,_){const g=[],v=zn.getElevationFeature(e,a);if(v){const b=this.clipLinesToTile(i,1),w=this.prepareElevatedLines(b,v,s);for(const E of w)g.push({geometry:E,elevation:v,elevationTileID:s,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(g.length===0)return!1;for(const b of g){const w=this.layoutVertexArray.length;this.addLine(b.geometry,e,s,u,h,f,_);const E=new Qn(s,b.elevationTileID);if(b.elevation)for(let A=w;A<this.layoutVertexArray.length;A++){const P=new He(this.layoutVertexArray.int16[6*A]>>1,this.layoutVertexArray.int16[6*A+1]>>1),D=E.pointElevation(P,b.elevation,.05);this.updateHeightRange(D),this.zOffsetVertexArray.emplaceBack(D,0,0)}else this.fillNonElevatedRoadSegment(w)}return!0}prepareElevatedLines(e,i,s){if(i.constantHeight!=null)return e;const a=[],u=1/we(s);for(const h of e)S0(h,new wn(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,s,a,u,h,f,_){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0;const g=a==="none";this.patternJoinNone=this.hasPattern&&g,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const v=_&&_.progress.min>0,b=_&&_.progress.max<1;if(this.lineClips){let oe={min:this.lineClips.start,max:this.lineClips.end},re=1;
vendor: 4,674 bytes, line 14
14if(_){const Te=this.lineClips.end-this.lineClips.start;oe=function(Oe,ze,ke){return{min:Qa(Oe.min,ze,ke),max:Qa(Oe.max,ze,ke)}}(_.progress,{min:0,max:1},oe),Te>0&&(re=(oe.max-oe.min)/Te)}const ae=+i.properties.mapbox_clip_feature_len,he=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(ae)||Number.isNaN(he)){for(let Oe=0;Oe<e.length-1;Oe++)this.totalDistance+=e[Oe].dist(e[Oe+1]);const Te=this.totalDistance/(oe.max-oe.min);this.totalFeatureLength=Number.isFinite(Te)?Te:0,this.lineClips.start=oe.min,this.lineClips.end=oe.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=ae,this.distance=he*re,this.lineClips.start=oe.min,this.lineClips.end=oe.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const w=V0[i.type]==="Polygon";let E=e.length;for(;E>=2&&e[E-1].equals(e[E-2]);)E--;let A=0;for(;A<E-1&&e[A].equals(e[A+1]);)A++;if(E<(w?3:2))return;a==="bevel"&&(h=1.05);const P=this.segments.prepareSegment(10*E,this.layoutVertexArray,this.indexArray);let D,k,j,G,z,N,q,H;_&&_.prevDir&&(N=_.prevDir.perp()),_&&_.nextDir&&(q=_.nextDir.perp()),this.e1=this.e2=-1,w&&(D=e[E-2],z=e[A].sub(D)._unit()._perp());for(let oe=A;oe<E;oe++){if(j=oe===E-1?w?e[A+1]:void 0:e[oe+1],j&&e[oe].equals(j))continue;z&&(G=z),D&&(k=D),D=e[oe],H=this.evaluateLineProgressFeatures(k?k.dist(D):0),z=j?j.sub(D)._unit()._perp():G,G=G||z;const re=k&&j;let ae=re?a:w||g?"butt":u;const he=G.x*z.x+G.y*z.y;if(g){const be=function(Se){if(Se.patternJoinNone){const Ue=Se.segmentPoints.length/2,Ge=Se.lineSoFar-Se.segmentStart;for(let _t=0;_t<Ue;++_t){const ot=Se.segmentPoints[2*_t+1],Ye=Math.round(Se.segmentPoints[2*_t])+.5+.25*ot;Se.patternVertexArray.emplaceBack(Ye,Ge,Se.segmentStart),Se.patternVertexArray.emplaceBack(Ye,Ge,Se.segmentStart)}Se.segmentPoints.length=0}Se.e1=Se.e2=-1};if(re&&he<j0){this.updateDistance(k,D),this.addCurrentVertex(D,G,1,1,P,H),be(this),this.addCurrentVertex(D,z,-1,-1,P,H);continue}if(k){if(!j){this.updateDistance(k,D),this.addCurrentVertex(D,G,1,1,P,H),be(this);continue}ae="miter"}}let Te=G.add(z);Te.x===0&&Te.y===0||Te._unit();const Oe=Te.x*z.x+Te.y*z.y,ze=Oe!==0?1/Oe:1/0,ke=2*Math.sqrt(2-2*Oe),Be=Oe<U0&&k&&j,Ee=G.x*z.y-G.y*z.x>0,Le=this.overscaling<=16?15*We/(512*this.overscaling):0;if(re&&ae==="round"){if(ze<f)ae="miter";else if(ze<=2){const be=Cm(D,-10,We+10);ae=this.elevationType==="offset"&&(be||this.hasCrossSlope)?"miter":"fakeround"}}if(ae==="miter"&&ze>h&&(ae="bevel"),ae==="bevel"&&(ze>2&&(ae="flipbevel"),ze<h&&(ae="miter")),k&&!(ae==="miter"&&Be)&&this.updateDistance(k,D),ae==="miter")if(Be){const be=D.dist(k);if(be>2*Le){const Ue=D.sub(D.sub(k)._mult(Le/be)._round());this.updateDistance(k,Ue),this.addCurrentVertex(Ue,G,0,0,P,H),k=Ue}this.updateDistance(k,D),Te._mult(ze),this.addCurrentVertex(D,Te,0,0,P,H);const Se=D.dist(j);if(Se>2*Le){const Ue=D.add(j.sub(D)._mult(Le/Se)._round());this.updateDistance(D,Ue),this.addCurrentVertex(Ue,z,0,0,P,H),D=Ue}}else Te._mult(ze),this.addCurrentVertex(D,Te,0,0,P,H);else if(ae==="flipbevel"){if(ze>100)Te=z.mult(-1);else{const be=ze*G.add(z).mag()/G.sub(z).mag();Te._perp()._mult(be*(Ee?-1:1))}this.addCurrentVertex(D,Te,0,0,P,H),this.addCurrentVertex(D,Te.mult(-1),0,0,P,H)}else if(ae==="bevel"||ae==="fakeround"){H!=null&&k&&this.addCurrentVertex(D,q||G,-1,-1,P,H);const be=D.dist(k)<=2*Le&&ae!=="bevel",Se=Te.mult(Ee?1:-1);Se._mult(ze);const Ue=z.mult(Ee?-1:1),Ge=G.mult(Ee?-1:1),_t=this.evaluateLineProgressFeatures(this.distance);if(H==null&&(this.addHalfVertex(D,Se.x,Se.y,!1,!Ee,0,P,_t),be||this.addHalfVertex(D,Se.x+2*Ge.x,Se.y+2*Ge.y,!1,Ee,0,P,_t)),ae==="fakeround"){const ot=Math.round(180*ke/Math.PI/20);this.addHalfVertex(D,Ge.x,Ge.y,!1,Ee,0,P,_t);for(let Ye=0;Ye<ot;Ye++){let Ve=Ye/ot;if(Ve!==.5){const st=Ve-.5;Ve+=Ve*st*(Ve-1)*((1.0904+he*(he*(3.55645-1.43519*he)-3.2452))*st*st+(.848013+he*(.215638*he-1.06021)))}const Pt=Ue.sub(Ge)._mult(Ve)._add(Ge)._unit();this.addHalfVertex(D,Pt.x,Pt.y,!1,Ee,0,P,_t)}this.addHalfVertex(D,Ue.x,Ue.y,!1,Ee,0,P,_t)}be||H!=null||this.addHalfVertex(D,Se.x+2*Ue.x,Se.y+2*Ue.y,!1,Ee,0,P,_t),H!=null&&j&&this.addCurrentVertex(D,N||z,1,1,P,H)}else if(ae==="butt")this.addCurrentVertex(D,Te,0,0,P,H);else if(ae==="square"){if(!k){const be=v?0:-1;this.addCurrentVertex(D,Te,be,be,P,H)}if(this.addCurrentVertex(D,Te,0,0,P,H),k){const be=b?0:1;this.addCurrentVertex(D,Te,be,be,P,H)}}else if(ae==="round"){if(k){const be=!re&&q?q:G;this.addCurrentVertex(D,be,0,0,P,H),!re&&b||this.addCurrentVertex(D,be,1,1,P,H,!0)}if(j){const be=!re&&N?N:z;!re&&v||this.addCurrentVertex(D,be,-1,-1,P,H,!0),this.addCurrentVertex(D,be,0,0,P,H)}}}}
14addVerticesTo(e,i,s,a,u,h,f,_,g,v){const b=(i.w-e.w)/this.tessellationStep|0;let w=0;const E=this.scaledDistance;if(b>1){this.lineSoFar=e.w;const P=(i.x-e.x)/b,D=(i.y-e.y)/b,k=(i.z-e.z)/b,j=(i.w-e.w)/b;for(let G=1;G<b;++G){e.x+=P,e.y+=D,e.z+=k,this.lineSoFar+=j,w+=j;const z=this.evaluateLineProgressFeatures(this.prevDistance+w);this.scaledDistance=(this.prevDistance+w)/this.totalDistance,this.addHalfVertex(e,s,a,v,!1,f,g,z),this.addHalfVertex(e,u,h,v,!0,-_,g,z)}}this.lineSoFar=i.w,this.scaledDistance=E;const A=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,s,a,v,!1,f,g,A),this.addHalfVertex(i,u,h,v,!0,-_,g,A)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&this.elevationType!=="offset")return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):kt(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let i=0;return this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(i=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.elevationType!=="offset"?{zOffset:0,variableWidth:i}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:i}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i}}addCurrentVertex(e,i,s,a,u,h,f=!1){const _=i.x+i.y*s,g=i.y-i.x*s,v=i.y*a-i.x,b=-i.y-i.x*a;if(h!=null){const w=this.elevationType==="offset",E=-10,A=We+10,P=h.zOffset,D=new Vg(e.x,e.y,P,this.lineSoFar),k=!!w&&Cm(e,E,A),j=this.lineS
14oFar,G=this.distance;if(this.currentVertex)if(k){const z=this.currentVertexIsOutside,N=this.currentVertex,q=new Vg(e.x,e.y,P,this.lineSoFar);if(jg(N,q,E,A),!Cm(q,E,A)){if(z){this.e1=this.e2=-1,this.distance-=N.dist(D),this.lineSoFar=N.w;const H=this.evaluateLineProgressFeatures(N.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(N,_,g,f,!1,s,u,H),this.addHalfVertex(N,v,b,f,!0,-a,u,H),this.prevDistance=this.distance}this.distance=this.prevDistance+N.dist(q),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(N,q,_,g,v,b,s,a,u,f),this.distance=G,this.scaledDistance=this.distance/this.totalDistance}}else{const z=this.currentVertex;if(this.currentVertexIsOutside){jg(z,D,E,A),this.e1=this.e2=-1,this.distance-=z.dist(D),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=z.w;const N=this.evaluateLineProgressFeatures(z.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(z,_,g,f,!1,s,u,N),this.addHalfVertex(z,v,b,f,!0,-a,u,N),this.prevDistance=this.distance,this.distance=G,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(z,D,_,g,v,b,s,a,u,f)}else k||(this.addHalfVertex(e,_,g,f,!1,s,u,h),this.addHalfVertex(e,v,b,f,!0,-a,u,h));this.currentVertex=D,this.currentVertexIsOutside=k,this.lineSoFar=j}else this.addHalfVertex(e,_,g,f,!1,s,u,h),this.addHalfVertex(e,v,b,f,!0,-a,u,h)}addHalfVertex({x:e,y:i},s,a,u,h,f,_,g){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),h||this.segmentPoints.push(this.lineSoFar-this.segmentStart,f)),this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(i<<1)+(h?1:0),Math.round(63*s)+128,Math.round(63*a)+128,1+(f===0?0:f<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const b=Tt(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,b)}const v=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,v),_.primitiveLength++),h?this.e2=v:this.e1=v,g!=null&&this.zOffsetVertexArray.emplaceBack(g.zOffset,g.variableWidth,g.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,i){this.prevDistance=this.distance,this.distance+=e.dist(i),this.updateScaledDistance()}}function Cm(r,e,i){return r.x<e||r.x>i||r.y<e||r.y>i}let oy,ay;function ly(r,e,i){return e*(We/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}tt(Mm,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const cy=(r,e,i)=>(1-i)*r+i*e;function uy(r,e){return 1/ly(r,1,e.tileZoom)}function hy(r,e,i,s){return r.translatePosMatrix(s||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const dy=r=>{const e=[];py(r)&&e.push("RENDER_LINE_DASH"),r.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=r.paint.get("line-trim-offset");i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),r.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const s=r.layout.get("line-join").constantOr("miter")==="none",a=!!r.paint.get("line-pattern").constantOr(1);return s&&a&&e.push("LINE_JOIN_NONE"),e};function py(r){const e=r.paint.get("line-dasharray").value;return e.value||e.kind!=="constant"}let Pm;const fy=()=>Pm||(Pm={layout:oy||(oy=new rr({"line-cap":new Je(pe.layout_line["line-cap"]),"line-join":new Je(pe.layout_line["line-join"]),"line-miter-limit":new Ne(pe.layout_line["line-miter-limit"]),"line-round-limit":new Ne(pe.layout_line["line-round-limit"]),"line-sort-key":new Je(pe.layout_line["line-sort-key"]),"line-z-offset":new Je(pe.layout_line["line-z-offset"]),"line-elevation-reference":new Ne(pe.layout_line["line-elevation-reference"]),"line-cross-slope":new Ne(pe.layout_line["line-cross-slope"]),visibility:new Ne(pe.layout_line.visibility),"line-width-unit":new Ne(pe.layout_line["line-width-unit"])})),paint:ay||(ay=new rr({"line-opacity":new Je(pe.paint_line["line-opacity"]),"line-color":new Je(pe.paint_line["line-color"]),"line-translate":new Ne(pe.paint_line["line-translate"]),"line-translate-anchor":new Ne(pe.paint_line["line-translate-anchor"]),"line-width":new Je(pe.paint_line["line-width"]),"line-gap-width":new Je(pe.paint_line["line-gap-width"]),"line-offset":new Je(pe.paint_line["line-offset"]),"line-blur"
vendor: 5,335 bytes, line 14
14:new Je(pe.paint_line["line-blur"]),"line-dasharray":new Je(pe.paint_line["line-dasharray"]),"line-pattern":new Je(pe.paint_line["line-pattern"]),"line-pattern-cross-fade":new Ne(pe.paint_line["line-pattern-cross-fade"]),"line-gradient":new Vo(pe.paint_line["line-gradient"]),"line-trim-offset":new Ne(pe.paint_line["line-trim-offset"]),"line-trim-fade-range":new Ne(pe.paint_line["line-trim-fade-range"]),"line-trim-color":new Ne(pe.paint_line["line-trim-color"]),"line-emissive-strength":new Ne(pe.paint_line["line-emissive-strength"]),"line-border-width":new Je(pe.paint_line["line-border-width"]),"line-border-color":new Je(pe.paint_line["line-border-color"]),"line-occlusion-opacity":new Ne(pe.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},Pm);class G0 extends Je{possiblyEvaluate(e,i){return i=new Ti(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition,worldview:i.worldview}),super.possiblyEvaluate(e,i)}evaluate(e,i,s,a){return i=ge({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,s,a)}}let Hh;function my(r,e){return e>0?e+2*r:r}const q0=ii([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),$0=ii([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Z0=ii([{name:"a_projected_pos",components:4,type:"Float32"}],4);ii([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const H0=ii([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),W0=ii([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),X0=ii([{name:"a_texb",components:2,type:"Uint16"}]),Y0=ii([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),K0=ii([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);ii([{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 _y=ii([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),J0=ii([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);ii([{name:"triangle",components:3,type:"Uint16"}]),ii([{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"}]),ii([{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"}
14]),ii([{type:"Float32",name:"offsetX"}]),ii([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Lr=24;function Q0(r,e,i){return r.sections.forEach(s=>{s.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()),Ms.applyArabicShaping&&(a=Ms.applyArabicShaping(a)),a}(s.text,e,i)}),r}const Wh={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"};function e1(r){return r==="︶"||r==="ï¹"||r==="︸"||r==="ï¹"||r==="ï¹"||r==="︾"||r==="︼"||r==="︺"||r==="ï¸"||r==="ï¹"||r==="ï¸"||r==="ï¸"||r==="ï¸"||r==="ï½"||r==="ï¿£"||r==="ï¸"||r==="ï¸"}function t1(r){return r==="︵"||r==="ï¹"||r==="︷"||r==="ï¹"||r==="ï¹"||r==="︽"||r==="︻"||r==="︹"||r==="ï¸"||r==="︿"}var gy,zm,yy,Rm={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function i1(){return gy||(gy=1,Rm.read=function(r,e,i,s,a){var u,h,f=8*a-s-1,_=(1<<f)-1,g=_>>1,v=-7,b=i?a-1:0,w=i?-1:1,E=r[e+b];for(b+=w,u=E&(1<<-v)-1,E>>=-v,v+=f;v>0;u=256*u+r[e+b],b+=w,v-=8);for(h=u&(1<<-v)-1,u>>=-v,v+=s;v>0;h=256*h+r[e+b],b+=w,v-=8);if(u===0)u=1-g;else{if(u===_)return h?NaN:1/0*(E?-1:1);h+=Math.pow(2,s),u-=g}return(E?-1:1)*h*Math.pow(2,u-s)},Rm.write=function(r,e,i,s,a,u){var h,f,_,g=8*u-a-1,v=(1<<g)-1,b=v>>1,w=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=s?0:u-1,A=s?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,h=v):(h=Math.floor(Math.log(e)/Math.LN2),e*(_=Math.pow(2,-h))<1&&(h--,_*=2),(e+=h+b>=1?w/_:w*Math.pow(2,1-b))*_>=2&&(h++,_/=2),h+b>=v?(f=0,h=v):h+b>=1?(f=(e*_-1)*Math.pow(2,a),h+=b):(f=e*Math.pow(2,b-1)*Math.pow(2,a),h=0));a>=8;r[i+E]=255&f,E+=A,f/=256,a-=8);for(h=h<<a|f,g+=a;g>0;r[i+E]=255&h,E+=A,h/=256,g-=8);r[i+E-A]|=128*P}),Rm}function xy(){if(yy)return zm;yy=1,zm=e;var r=i1();function e(z){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(z)?z:new Uint8Array(z||0),this.pos=0,this.type=0,this.length=this.buf.length}e.Varint=0,e.Fixed64=1,e.Bytes=2,e.Fixed32=5;var i=4294967296,s=1/i,a=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function u(z){return z.type===e.Bytes?z.readVarint()+z.pos:z.pos+1}function h(z,N,q){return q?4294967296*N+(z>>>0):4294967296*(N>>>0)+(z>>>0)}function f(z,N,q){var H=N<=16383?1:N<=2097151?2:N<=268435455?3:Math.floor(Math.log(N)/(7*Math.LN2));q.realloc(H);for(var oe=q.pos-1;oe>=z;oe--)q.buf[oe+H]=q.buf[oe]}function _(z,N){for(var q=0;q<z.length;q++)N.writeVarint(z[q])}function g(z,N){for(var q=0;q<z.length;q++)N.writeSVarint(z[q])}function v(z,N){for(var q=0;q<z.length;q++)N.writeFloat(z[q])}function b(z,N){for(var q=0;q<z.length;q++)N.writeDouble(z[q])}function w(z,N){for(var q=0;q<z.length;q++)N.writeBoolean(z[q])}function E(z,N){for(var q=0;q<z.length;q++)N.writeFixed32(z[q])}function A(z,N){for(var q=0;q<z.length;q++)N.writeSFixed32(z[q])}function P(z,N){for(var q=0;q<z.length;q++)N.writeFixed64(z[q])}function D(z,N){for(var q=0;q<z.length;q++)N.writeSFixed64(z[q])}function k(z,N){return(z[N]|z[N+1]<<8|z[N+2]<<16)+16777216*z[N+3]}function j(z,N,q){z[q]=N,z[q+1]=N>>>8,z[q+2]=N>>>16,z[q+3]=N>>>24}function G(z,N){return(z[N]|z[N+1]<<8|z[N+2]<<16)+(z[N+3]<<24)}
vendor: 8,253 bytes, line 14
14return e.prototype={destroy:function(){this.buf=null},readFields:function(z,N,q){for(q=q||this.length;this.pos<q;){var H=this.readVarint(),oe=H>>3,re=this.pos;this.type=7&H,z(oe,N,this),this.pos===re&&this.skip(H)}return N},readMessage:function(z,N){return this.readFields(z,N,this.readVarint()+this.pos)},readFixed32:function(){var z=k(this.buf,this.pos);return this.pos+=4,z},readSFixed32:function(){var z=G(this.buf,this.pos);return this.pos+=4,z},readFixed64:function(){var z=k(this.buf,this.pos)+k(this.buf,this.pos+4)*i;return this.pos+=8,z},readSFixed64:function(){var z=k(this.buf,this.pos)+G(this.buf,this.pos+4)*i;return this.pos+=8,z},readFloat:function(){var z=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,z},readDouble:function(){var z=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,z},readVarint:function(z){var N,q,H=this.buf;return N=127&(q=H[this.pos++]),q<128?N:(N|=(127&(q=H[this.pos++]))<<7,q<128?N:(N|=(127&(q=H[this.pos++]))<<14,q<128?N:(N|=(127&(q=H[this.pos++]))<<21,q<128?N:function(oe,re,ae){var he,Te,Oe=ae.buf;if(he=(112&(Te=Oe[ae.pos++]))>>4,Te<128||(he|=(127&(Te=Oe[ae.pos++]))<<3,Te<128)||(he|=(127&(Te=Oe[ae.pos++]))<<10,Te<128)||(he|=(127&(Te=Oe[ae.pos++]))<<17,Te<128)||(he|=(127&(Te=Oe[ae.pos++]))<<24,Te<128)||(he|=(1&(Te=Oe[ae.pos++]))<<31,Te<128))return h(oe,he,re);throw new Error("Expected varint not more than 10 bytes")}(N|=(15&(q=H[this.pos]))<<28,z,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var z=this.readVarint();return z%2==1?(z+1)/-2:z/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var z=this.readVarint()+this.pos,N=this.pos;return this.pos=z,z-N>=12&&a?function(q,H,oe){return a.decode(q.subarray(H,oe))}(this.buf,N,z):function(q,H,oe){for(var re="",ae=H;ae<oe;){var he,Te,Oe,ze=q[ae],ke=null,Be=ze>239?4:ze>223?3:ze>191?2:1;if(ae+Be>oe)break;Be===1?ze<128&&(ke=ze):Be===2?(192&(he=q[ae+1]))==128&&(ke=(31&ze)<<6|63&he)<=127&&(ke=null):Be===3?(Te=q[ae+2],(192&(he=q[ae+1]))==128&&(192&Te)==128&&((ke=(15&ze)<<12|(63&he)<<6|63&Te)<=2047||ke>=55296&&ke<=57343)&&(ke=null)):Be===4&&(Te=q[ae+2],Oe=q[ae+3],(192&(he=q[ae+1]))==128&&(192&Te)==128&&(192&Oe)==128&&((ke=(15&ze)<<18|(63&he)<<12|(63&Te)<<6|63&Oe)<=65535||ke>=1114112)&&(ke=null)),ke===null?(ke=65533,Be=1):ke>65535&&(ke-=65536,re+=String.fromCharCode(ke>>>10&1023|55296),ke=56320|1023&ke),re+=String.fromCharCode(ke),ae+=Be}return re}(this.buf,N,z)},readBytes:function(){var z=this.readVarint()+this.pos,N=this.buf.subarray(this.pos,z);return this.pos=z,N},readPackedVarint:function(z,N){if(this.type!==e.Bytes)return z.push(this.readVarint(N));var q=u(this);for(z=z||[];this.pos<q;)z.push(this.readVarint(N));return z},readPackedSVarint:function(z){if(this.type!==e.Bytes)return z.push(this.readSVarint());var N=u(this);for(z=z||[];this.pos<N;)z.push(this.readSVarint());return z},readPackedBoolean:function(z){if(this.type!==e.Bytes)return z.push(this.readBoolean());var N=u(this);for(z=z||[];this.pos<N;)z.push(this.readBoolean());return z},readPackedFloat:function(z){if(this.type!==e.Bytes)return z.push(this.readFloat());var N=u(this);for(z=z||[];this.pos<N;)z.push(this.readFloat());return z},readPackedDouble:function(z){if(this.type!==e.Bytes)return z.push(this.readDouble());var N=u(this);for(z=z||[];this.pos<N;)z.push(this.readDouble());return z},readPackedFixed32:function(z){if(this.type!==e.Bytes)return z.push(this.readFixed32());var N=u(this);for(z=z||[];this.pos<N;)z.push(this.readFixed32());return z},readPackedSFixed32:function(z){if(this.type!==e.Bytes)return z.push(this.readSFixed32());var N=u(this);for(z=z||[];this.pos<N;)z.push(this.readSFixed32());return z},readPackedFixed64:function(z){if(this.type!==e.Bytes)return z.push(this.readFixed64());var N=u(this);for(z=z||[];this.pos<N;)z.push(this.readFixed64());return z},readPackedSFixed64:function(z){if(this.type!==e.Bytes)return z.push(this.readSFixed64());var N=u(this);for(z=z||[];this.pos<N;)z.push(this.readSFixed64());return z},skip:function(z){var N=7&z;if(N===e.Varint)for(;this.buf[this.pos++]>127;);else if(N===e.Bytes)this.pos=this.readVarint()+this.pos;else if(N===e.Fixed32)this.pos+=4;else{if(N!==e.Fixed64)throw new Error("Unimplemented type: "+N);this.pos+=8}},writeTag:function(z,N){this.writeVarint(z<<3|N)},realloc:function(z){for(var N=this.length||16;N<this.pos+z;)N*=2;if(N!==this.length){var q=new Uint8Array(N);q.set(this.buf),this.buf=q,this.length=N}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(z){this.realloc(4),j(this.buf,z,this.pos),this.pos+=4},writeSFixed32:function(z){this.realloc(4),j(this.buf,z,this.pos),this.pos+=4},writeFixed64:function(z){this.realloc(8),j(this.buf,-1&z,this.pos),j(this.buf,Math.floor(z*s),this.pos+4),this.pos+=8},writeSFixed64:function(z){this.realloc(8),j(this.buf,-1&z,this.pos),j(this.buf,Math.floor(z*s),this.pos+4),this.pos+=8},writeVarint:function(z){(z=+z||0)>268435455||z<0?function(N,q){var H,oe;if(N>=0?(H=N%4294967296|0,oe=N/4294967296|0):(oe=~(-N/4294967296),4294967295^(H=~(-N%4294967296))?H=H+1|0:(H=0,oe=oe+1|0)),N>=18446744073709552e3||N<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");q.realloc(10),function(re,ae,he){he.buf[he.pos++]=127&re|128,re>>>=7,he.buf[he.pos++]=127&re|128,re>>>=7,he.buf[he.pos++]=127&re|128,re>>>=7,he.buf[he.pos++]=127&re|128,he.buf[he.pos]=127&(re>>>=7)}(H,0,q),function(re,ae){var he=(7&re)<<4;ae.buf[ae.pos++]|=he|((re>>>=3)?128:0),re&&(ae.buf[ae.pos++]=127&re|((re>>>=7)?128:0),re&&(ae.buf[ae.pos++]=127&re|((re>>>=7)?128:0),re&&(ae.buf[ae.pos++]=127&re|((re>>>=7)?128:0),re&&(ae.buf[ae.pos++]=127&re|((re>>>=7)?128:0),re&&(ae.buf[ae.pos++]=127&re)))))}(oe,q)}(z,this):(this.realloc(4),this.buf[this.pos++]=127&z|(z>127?128:0),z<=127||(this.buf[this.pos++]=127&(z>>>=7)|(z>127?128:0),z<=127||(this.buf[this.pos++]=127&(z>>>=7)|(z>127?128:0),z<=127||(this.buf[this.pos++]=z>>>7&127))))},writeSVarint:function(z){this.writeVarint(z<0?2*-z-1:2*z)},writeBoolean:function(z){this.writeVarint(!!z)},writeString:function(z){z=String(z),this.realloc(4*z.length),this.pos++;var N=this.pos;this.pos=function(H,oe,re){for(var ae,he,Te=0;Te<oe.length;Te++){if((ae=oe.charCodeAt(Te))>55295&&ae<57344){if(!he){ae>56319||Te+1===oe.length?(H[re++]=239,H[re++]=191,H[re++]=189):he=ae;continue}if(ae<56320){H[re++]=239,H[re++]=191,H[re++]=189,he=ae;continue}ae=he-55296<<10|ae-56320|65536,he=null}else he&&(H[re++]=239,H[re++]=191,H[re++]=189,he=null);ae<128?H[re++]=ae:(ae<2048?H[re++]=ae>>6|192:(ae<65536?H[re++]=ae>>12|224:(H[re++]=ae>>18|240,H[re++]=ae>>12&63|128),H[re++]=ae>>6&63|128),H[re++]=63&ae|128)}return re}(this.buf,z,this.pos);var q=this.pos-N;q>=128&&f(N,q,this),this.pos=N-1,this.writeVarint(q),this.pos+=q},writeFloat:function(z){this.realloc(4),r.write(this.buf,z,this.pos,!0,23,4),this.pos+=4},writeDouble:function(z){this.realloc(8),r.write(this.buf,z,this.pos,!0,52,8),this.pos+=8},writeBytes:function(z){var N=z.length;this.writeVarint(N),this.realloc(N);for(var q=0;q<N;q++)this.buf[this.pos++]=z[q]},writeRawMessage:function(z,N){this.pos++;var q=this.pos;z(N,this);var H=this.pos-q;H>=128&&f(q,H,this),this.pos=q-1,this.writeVarint(H),this.pos+=H},writeMessage:function(z,N,q){this.writeTag(z,e.Bytes),this.writeRawMessage(N,q)},writePackedVarint:function(z,N){N.length&&this.writeMessage(z,_,N)},writePackedSVarint:function(z,N){N.length&&this.writeMessage(z,g,N)},writePackedBoolean:function(z,N){N.length&&this.writeMessage(z,w,N)},writePackedFloat:function(z,N){N.length&&this.writeMessage(z,v,N)},writePackedDouble:function(z,N){N.length&&this.writeMessage(z,b,N)},writePackedFixed32:function(z,N){N.length&&this.writeMessage(z,E,N)},writePackedSFixed32:function(z,N){N.length&&this.writeMessage(z,A,N)},writePackedFixed64:function(z,N){N.length&&this.writeMessage(z,P,N)},writePackedSFixed64:function(z,N){N.length&&this.writeMessage(z,D,N)},writeBytesField:function(z,N){this.writeTag(z,e.Bytes),this.writeBytes(N)},writeFixed32Field:function(z,N){this.writeTag(z,e.Fixed32),this.writeFixed32(N)},writeSFixed32Field:function(z,N){this.writeTag(z,e.Fixed32),this.writeSFixed32(N)},writeFixed64Field:function(z,N){this.writeTag(z,e.Fixed64),this.writeFixed64
14(N)},writeSFixed64Field:function(z,N){this.writeTag(z,e.Fixed64),this.writeSFixed64(N)},writeVarintField:function(z,N){this.writeTag(z,e.Varint),this.writeVarint(N)},writeSVarintField:function(z,N){this.writeTag(z,e.Varint),this.writeSVarint(N)},writeStringField:function(z,N){this.writeTag(z,e.Bytes),this.writeString(N)},writeFloatField:function(z,N){this.writeTag(z,e.Fixed32),this.writeFloat(N)},writeDoubleField:function(z,N){this.writeTag(z,e.Fixed64),this.writeDouble(N)},writeBooleanField:function(z,N){this.writeVarintField(z,!!N)}},zm}var Fp=Gs(xy());const Dm=3;function r1(r,e,i){e.glyphs=[],r===1&&i.readMessage(n1,e)}function n1(r,e,i){if(r===3){const{id:s,bitmap:a,width:u,height:h,left:f,top:_,advance:g}=i.readMessage(s1,{});e.glyphs.push({id:s,bitmap:new ja({width:u+2*Dm,height:h+2*Dm},a),metrics:{width:u,height:h,left:f,top:_,advance:g}})}else r===4?e.ascender=i.readSVarint():r===5&&(e.descender=i.readSVarint())}function s1(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 o1=Dm,Rn={horizontal:1,vertical:2,horizontalOnly:3};class Xh{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){const s=new Xh;return s.scale=e||1,s.fontStack=i,s}static forImage(e){const i=new Xh;return i.image=e,i}}class mu{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,s){const a=new mu;for(let u=0;u<e.sections.length;u++){const h=e.sections[u];h.image?a.addImageSection(h,s):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,s){let a="";for(let u=0;u<i.length;u++){const h=i.charCodeAt(u+1)||null,f=i.charCodeAt(u-1)||null;a+=!s&&(h&&Hd(h)&&!Wh[i[u+1]]||f&&Hd(f)&&!Wh[i[u-1]])||!Wh[i[u]]?i[u]:Wh[i[u]]}return a}(this.text,e)}trim(){let e=0;for(let s=0;s<this.text.length&&kp[this.text.charCodeAt(s)];s++)e++;let i=this.text.length;for(let s=this.text.length-1;s>=0&&s>=e&&kp[this.text.charCodeAt(s)];s--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const s=new mu;return s.text=this.text.substring(e,i),s.sectionIndex=this.sectionIndex.slice(e,i),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(Xh.forText(e.scale,e.fontStack||i));const s=this.sections.length-1;for(let a=0;a<e.text.length;++a)this.sectionIndex.push(s)}addImageSection(e,i){const s=e.image?e.image.getPrimary():null;if(!s)return void kt("Can't add FormattedSection with an empty image.");s.scaleSelf(i);const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCodePoint(a),this.sections.push(Xh.forImage(s)),this.sectionIndex.push(this.sections.length-1)):kt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Lm(r,e,i,s,a,u,h,f,_,g,v,b,w,E,A,P=1){const D=mu.fromFeature(r,a,P);
14b===Rn.vertical&&D.verticalizePunctuation(w);let k=[];const j=function(H,oe,re,ae,he,Te){if(!H)return[];const Oe=[],ze=function(Le,be,Se,Ue,Ge,_t){let ot=0;for(let Ye=0;Ye<Le.length();Ye++){const Ve=Le.getSection(Ye);ot+=vy(Le.getCodePoint(Ye),Ve,Ue,Ge,be,_t)}return ot/Math.max(1,Math.ceil(ot/Se))}(H,oe,re,ae,he,Te),ke=H.text.indexOf("â")>=0;let Be=0;for(let Le=0;Le<H.length();Le++){const be=H.getSection(Le),Se=H.getCodePoint(Le);if(kp[Se]||(Be+=vy(Se,be,ae,he,oe,Te)),Le<H.length()-1){const Ue=!((Ee=Se)<11904||!(xt["Bopomofo Extended"](Ee)||xt.Bopomofo(Ee)||xt["CJK Compatibility Forms"](Ee)||xt["CJK Compatibility Ideographs"](Ee)||xt["CJK Compatibility"](Ee)||xt["CJK Radicals Supplement"](Ee)||xt["CJK Strokes"](Ee)||xt["CJK Symbols and Punctuation"](Ee)||xt["CJK Unified Ideographs Extension A"](Ee)||xt["CJK Unified Ideographs"](Ee)||xt["Enclosed CJK Letters and Months"](Ee)||xt["Halfwidth and Fullwidth Forms"](Ee)||xt.Hiragana(Ee)||xt["Ideographic Description Characters"](Ee)||xt["Kangxi Radicals"](Ee)||xt["Katakana Phonetic Extensions"](Ee)||xt.Katakana(Ee)||xt["Vertical Forms"](Ee)||xt["Yi Radicals"](Ee)||xt["Yi Syllables"](Ee)));(a1[Se]||Ue||be.image)&&Oe.push(wy(Le+1,Be,ze,Oe,l1(Se,H.getCodePoint(Le+1),Ue&&ke),!1))}}var Ee;return Ty(wy(H.length(),Be,ze,Oe,0,!0))}(D,g,u,e,s,E),{processBidirectionalText:G,processStyledBidirectionalText:z}=Ms;if(G&&D.sections.length===1){const H=G(D.toString(),j);for(const oe of H){const re=new mu;re.text=oe,re.sections=D.sections;for(let ae=0;ae<oe.length;ae++)re.sectionIndex.push(0);k.push(re)}}else if(z){const H=z(D.text,D.sectionIndex,j);for(const oe of H){const re=new mu;re.text=oe[0],re.sectionIndex=oe[1],re.sections=D.sections,k.push(re)}}else k=function(H,oe){const re=[],ae=H.text;let he=0;for(const Te of oe)re.push(H.substring(he,Te)),he=Te;return he<ae.length&&re.push(H.substring(he,ae.length)),re}(D,j);const N=[],q={positionedLines:N,text:D.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:b,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(H,oe,re,ae,he,Te,Oe,ze,ke,Be,Ee,Le){let be=0,Se=0,Ue=0;const Ge=ze==="right"?1:ze==="left"?0:.5;let _t=!1;for(const lt of he){const St=lt.getSections();for(const Ft of St){if(Ft.image)continue;const Lt=oe[Ft.fontStack];if(Lt&&(_t=Lt.ascender!==void 0&&Lt.descender!==void 0,!_t))break}if(!_t)break}let ot=0;for(const lt of he){lt.trim();const St=lt.getMaxScale(),Ft=(St-1)*Lr,Lt={positionedGlyphs:[],lineOffset:0};H.positionedLines[ot]=Lt;const $t=Lt.positionedGlyphs;let Bt=0;if(!lt.length()){Se+=Te,++ot;continue}let Zt=0,fi=0;for(let $=0;$<lt.length();$++){const W=lt.getSection($),Ie=lt.getSectionIndex($),$e=lt.getCodePoint($);let Ke=W.scale,Xe=null,nt=null,wt=null,Xt=Lr,Yt=0;ke===Rn.vertical&&((Ye=$e)===12312||Ye===12313||Ye===12316||Ye===12540||Ye===12448)&&(ke=Rn.horizontal);const Nt=!(ke===Rn.horizontal||!Ee&&!ch($e)||Ee&&(kp[$e]||Zf($e)));if(W.image){const yi=ae.get(W.image.toString());if(!yi)continue;wt=W.image,H.iconsInText=H.iconsInText||!0,nt=yi.paddedRect;const Ci=yi.displaySize;Ke=Ke*Lr/Le,Xe={width:Ci[0],height:Ci[1],left:0,top:-3,advance:Nt?Ci[1]:Ci[0],localGlyph:!1},Yt=_t?-Xe.height*Ke:St*Lr-17-Ci[1]*Ke,Xt=Xe.advance;const Kt=(Nt?Ci[0]:Ci[1])*Ke-Lr*St;Kt>0&&Kt>Bt&&(Bt=Kt)}else{const yi=re[W.fontStack];if(!yi)continue;yi[$e]&&(nt=yi[$e]);const Ci=oe[W.fontStack];if(!Ci)continue;const Kt=Ci.glyphs[$e];if(!Kt)continue;if(Xe=Kt.metrics,Xt=$e!==8203?Lr:0,_t){const Qi=Ci.ascender!==void 0?Math.abs(Ci.ascender):0,Fi=Ci.descender!==void 0?Math.abs(Ci.descender):0,mi=(Qi+Fi)*Ke;Zt<mi&&(Zt=mi,fi=(Qi-Fi)/2*Ke),Yt=-Qi*Ke}else Yt=(St-Ke)*Lr-17}Nt?(H.verticalizable=!0,$t.push({glyph:$e,image:wt,x:be,y:Se+Yt,vertical:Nt,scale:Ke,localGlyph:Xe.localGlyph,fontStack:W.fontStack,sectionIndex:Ie,metrics:Xe,rect:nt}),be+=Xt*Ke+Be):($t.push({glyph:$e,image:wt,x:be,y:Se+Yt,vertical:Nt,scale:Ke,localGlyph:Xe.localGlyph,fontStack:W.fontStack,sectionIndex:Ie,metrics:Xe,rect:nt}),be+=Xe.advance*Ke+Be)}$t.length!==0&&(Ue=Math.max(be-Be,Ue),_t?Sy($t,Ge,Bt,fi,Te*St/2):Sy($t,Ge,Bt,0,Te/2)),be=0;const Li=Te*St+Bt;Lt.lineOffset=Math.max(Bt,Ft),Se+=Li,++ot}var Ye;const Ve=Se,{horizontalAlign:Pt,verticalAlign:st}=Fm(Oe);(function(lt,St,Ft,Lt,$t,Bt){const Zt=(St-Ft)*$t,fi=-Bt*Lt;for(const Li of lt)for(const $ of Li.positionedGlyphs)$.x+=Zt,$.y+=fi})(H.positionedLines,Ge,Pt,st,Ue,Ve),H.top+=-st*Ve,H.bottom=H.top+Ve,H.left+=-Pt*Ue,H.right=H.left+Ue,H.hasBaseline=_t}(q,e,i,s,k,h,f,_,b,g,w,A),!function(H){for(const oe of H)if(oe.positionedGlyphs.length!==0)return!1;return!0}(N))return q}const kp={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},a1={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 vy(r,e,i,s,a,u){if(e.image){const h=s.get(e.image.toString());return h?h.displaySize[0]*e.scale*Lr/u+a:0}{const h=i[e.fontStack],f=h&&h.glyphs[r];return f?f.metrics.advance*e.scale+a:0}}function by(r,e,i,s){const a=Math.pow(r-e,2);return s?r<e?a/2:2*a:a+Math.abs(i)*i}function l1(r,e,i){let s=0;return r===10&&(s-=1e4),i&&(s+=150),r!==40&&r!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function wy(r,e,i,s,a,u){let h=null,f=by(e,i,a,u);for(const _ of s){const g=by(e-_.x,i,a,u)+_.badness;g<=f&&(h=_,f=g)}return{index:r,x:e,priorBreak:h,badness:f}}function Ty(r){return r?Ty(r.priorBreak).concat(r.index):[]}function Fm(r){let e=.5,i=.5;
vendor: 4,212 bytes, line 14
14switch(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 Sy(r,e,i,s,a){if(!(e||i||s||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+s+a}function Ey(r){return r.imagePrimary!==void 0&&r.top!==void 0&&r.bottom!==void 0&&r.left!==void 0&&r.right!==void 0}function c1(r,e,i,s){const{horizontalAlign:a,verticalAlign:u}=Fm(s),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 Iy(r,e,i,s,a,u){const h=r.imagePrimary;let f;if(h.content){const D=h.content,k=h.pixelRatio||1;f=[D[0]/k,D[1]/k,h.displaySize[0]-D[2]/k,h.displaySize[1]-D[3]/k]}const _=e.left*u,g=e.right*u;let v,b,w,E;i==="width"||i==="both"?(E=a[0]+_-s[3],b=a[0]+g+s[1]):(E=a[0]+(_+g-h.displaySize[0])/2,b=E+h.displaySize[0]);const A=e.top*u,P=e.bottom*u;return i==="height"||i==="both"?(v=a[1]+A-s[0],w=a[1]+P+s[2]):(v=a[1]+(A+P-h.displaySize[1])/2,w=v+h.displaySize[1]),{imagePrimary:h,imageSecondary:void 0,top:v,right:b,bottom:w,left:E,collisionPadding:f}}function Ay(r){return!r.imagePrimary.stretchX}function My(r){return!r.imagePrimary.stretchY}function Cy(r){return{width:r.right-r.left,height:r.bottom-r.top}}const po=128;function Py(r,e,i){const{expression:s}=e;if(s.kind==="constant")return{kind:"constant",layoutSize:s.evaluate(new Ti(r+1,{worldview:i}))};if(s.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:u}=s;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],g=a[f];return s.kind==="composite"?{kind:"composite",minZoom:_,maxZoom:g,interpolationType:u}:{kind:"camera",minZoom:_,maxZoom:g,minSize:s.evaluate(new Ti(_,{worldview:i})),maxSize:s.evaluate(new Ti(g,{worldview:i})),interpolationType:u}}}function km(r,{uSize:e,uSizeT:i},{lowerSize:s,upperSize:a}){return r.kind==="source"?s/po:r.kind==="composite"?Tt(s/po,a/po,i):e}function Yh(r,e,i=1){let s=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?Q(Pn.interpolationFactor(u,e,h,f),0,1):0;r.kind==="camera"?a=Tt(r.minSize,r.maxSize,_)*i:s=_*i}return{uSizeT:s,uSize:a}}class $o extends He{constructor(e,i,s,a,u){super(e,i),this.angle=a,this.z=s,u!==void 0&&(this.segment=u)}clone(){return new $o(this.x,this.y,this.z,this.angle,this.segment)}}function zy(r,e,i,s,a){if(e.segment===void 0)return!0;let u=e,h=e.segment+1,f=0;for(;f>-i/2;){if(h--,h<0)return!1;f-=r[h].dist(u),u=r[h]}f+=r[h].dist(r[h+1]),h++;const _=[];let g=0;for(;f<i/2;){const v=r[h],b=r[h+1];if(!b)return!1;let w=r[h-1].angleTo(v)-v.angleTo(b);for(w=Math.abs((w+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:f,angleDelta:w}),g+=w;f-_[0].distance>s;)g-=_.shift().angleDelta;if(g>a)return!1;h++,f+=v.dist(b)}return!0}function Ry(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function Dy(r,e,i){return r?.6*e*i:0}function Ly(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function u1(r,e,i,s,a,u){const h=Dy(i,a,u),f=Ly(i,s)*u;let _=0;const g=Ry(r)/2;for(let v=0;v<r.length-1;v++){const b=r[v],w=r[v+1],E=b.dist(w);if(_+E>g){const A=(g-_)/E,P=Tt(b.x,w.x,A),D=Tt(b.y,w.y,A),k=new $o(P,D,0,w.angleTo(b),v);return!h||zy(r,k,f,h,e)?k:void 0}_+=E}}function h1(r,e,i,s,a,u,h,f,_){const g=Dy(s,u,h),v=Ly(s,a),b=v*h,w=r[0].x===0||r[0].x===_||r[0].y===0||r[0].y===_;return e-b<e/4&&(e=b+e/4),Fy(r,w?e/2*f%e:(v/2+2*u)*h*f%e,e,g,i,b,w,!1,_)}function Fy(r,e,i,s,a,u,h,f,_){const g=u/2,v=Ry(r);let b=0,w=e-i,E=[];for(let A=0;A<r.length-1;A++){const P=r[A],D=r[A+1],k=P.dist(D),j=D.angleTo(P);for(;w+i<b+k;){w+=i;const G=(w-b)/k,z=Tt(P.x,D.x,G),N=Tt(P.y,D.y,G);if(z>=0&&z<_&&N>=0&&N<_&&w-g>=0&&w+g<=v){const q=new $o(z,N,0,j,A);s&&!zy(r,q,u,s,a)||E.push(q)}}b+=k}return f||E.length||h||(E=Fy(r,b/2,i,s,a,u,h,!0,_)),E}function ky(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)=>
14f.h-h.h);const s=[{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=s.length-1;f>=0;f--){const _=s[f];if(!(h.w>_.w||h.h>_.h)){if(h.x=_.x,h.y=_.y,u=Math.max(u,h.y+h.h),a=Math.max(a,h.x+h.w),h.w===_.w&&h.h===_.h){const g=s.pop();f<s.length&&(s[f]=g)}else h.h===_.h?(_.x+=h.w,_.w-=h.w):h.w===_.w?(_.y+=h.h,_.h-=h.h):(s.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}}tt($o,"Anchor");const Ql=1;class Kh{static getImagePositionScale(e,i,s){if(i&&e&&e.options&&e.options.transform){const a=e.options.transform;return{x:a.a,y:a.d}}return{x:s,y:s}}constructor(e,i,s,a){this.paddedRect=e;const{pixelRatio:u,version:h,stretchX:f,stretchY:_,content:g,sdf:v,usvg:b}=i;this.pixelRatio=u,this.stretchX=f,this.stretchY=_,this.content=g,this.version=h,this.padding=s,this.sdf=v,this.usvg=b,this.scale=Kh.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 Om(r,e,i){const s=ws.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,[s.options.transform.a,s.options.transform.d]);return{bin:a,imagePosition:new Kh(a,e,i,s),imageVariant:s}}class Oy{constructor(e,i,s){const a=new Map,u=new Map;this.haveRenderCallbacks=[];const h=[];this.addImages(e,a,Ql,h),this.addImages(i,u,2,h);const{w:f,h:_}=ky(h),g=new jr({width:f||1,height:_||1});for(const[v,b]of e.entries()){const w=a.get(v).paddedRect;jr.copy(b.data,g,{x:0,y:0},{x:w.x+Ql,y:w.y+Ql},b.data,s,b.sdf)}for(const[v,b]of i.entries()){const w=u.get(v),E=w.paddedRect;let A=w.padding;const P=E.x+A,D=E.y+A,k=b.data.width,j=b.data.height;A=A>1?A-1:A,jr.copy(b.data,g,{x:0,y:0},{x:P,y:D},b.data,s),jr.copy(b.data,g,{x:0,y:j-A},{x:P,y:D-A},{width:k,height:A},s),jr.copy(b.data,g,{x:0,y:0},{x:P,y:D+j},{width:k,height:A},s),jr.copy(b.data,g,{x:k-A,y:0},{x:P-A,y:D},{width:A,height:j},s),jr.copy(b.data,g,{x:0,y:0},{x:P+k,y:D},{width:A,height:j},s),jr.copy(b.data,g,{x:k-A,y:j-A},{x:P-A,y:D-A},{width:A,height:A},s),jr.copy(b.data,g,{x:0,y:j-A},{x:P+k,y:D-A},{width:A,height:A},s),jr.copy(b.data,g,{x:0,y:0},{x:P+k,y:D+j},{width:A,height:A},s),jr.copy(b.data,g,{x:k-A,y:0},{x:P-A,y:D+j},{width:A,height:A},s)}this.lut=s,this.image=g,this.iconPositions=a,this.patternPositions=u}addImages(e,i,s,a){for(const[u,h]of e.entries()){const{bin:f,imagePosition:_,imageVariant:g}=Om(u,h,s);i.set(u,_),a.push(f),h.hasRenderCallback&&this.haveRenderCallbacks.push(g.id)}}patchUpdatedImages(e,i,s){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(a=>e.hasImage(a,s)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,s);for(const a of e.getUpdatedImages(s)){for(const u of this.iconPositions.keys()){const h=ws.parse(u);if(xn.isEqual(h.id,a)){const f=e.getImage(a,s);this.patchUpdatedImage(this.iconPositions.get(u),f,i)}}for(const u of this.patternPositions.keys()){const h=ws.parse(u);if(xn.isEqual(h.id,a)){const f=e.getImage(a,s);this.patchUpdatedImage(this.patternPositions.get(u),f,i)}}}}patchUpdatedImage(e,i,s){if(!e||!i||e.version===i.version)return;e.version=i.version;const[a,u]=e.tl,h=e.sdf;if(this.lut||h){const f={width:i.data.width,height:i.data.height},_=new jr(f);jr.copy(i.data,_,{x:0,y:0},{x:0,y:0},f,this.lut,h),s.update(_,{position:{x:a,y:u}})}else s.update(i.data,{position:{x:a,y:u}})}}tt(Kh,"ImagePosition"),tt(Oy,"ImageAtlas");const Op=1e20;function By(r,e,i,s,a,u,h,f,_){for(let g=e;g<e+s;g++)Ny(r,i*u+g,u,a,h,f,_);for(let g=i;g<i+a;g++)Ny(r,g*u+e,1,s,h,f,_)}function Ny(r,e,i,s,a,u,h){u[0]=0,h[0]=-1e20,h[1]=Op,a[0]=r[e];for(let f=1,_=0,g=0;f<s;f++){a[f]=r[e+f*i];const v=f*f;do{const b=u[_];g=(a[f]-a[b]+v-b*b)/(f-b)/2}while(g<=h[_]&&--_>-1);_++,u[_]=f,h[_]=g,h[_+1]=Op}for(let f=0,_=0;f<s;f++){for(;h[_+1]<f;)_++;const g=u[_],v=f-g;r[e+f*i]=a[g]+v*v}}const Ds=2,Bm={none:0,ideographs:1,all:2};class _u{constructor(e,i,s){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=s,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e,i){this.urls[i]=e}getGlyphs(e,i,s){const a=[],u=this.urls[i]||kr.GLYPHS_URL;for(const h in e)for(const f of e[h])a.push({stack:h,id:f});ue(a,({stack:h,id:f},_)=>{let g=this.entries[h];g||(g=this.entries[h]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let v=g.glyphs[f];if(v!==void 0)return void _(null,{stack:h,id:f,glyph:v});if(v=this._tinySDF(g,h,f),v)return g.glyphs[f]=v,void _(null,{stack:h,id:f,glyph:v});const b=Math.floor(f/256);if(256*b>65535)return kt("glyphs > 65535 not supported"),void _(null,{stack:h,id:f,glyph:v});if(g.ranges[b])return void _(null,{stack:h,id:f,glyph:v});let w=g.requests[b];w||(w=g.requests[b]=[],_u.loadGlyphRange(h,b,u,this.requestManager,(E,A)=>
14{if(A){g.ascender=A.ascender,g.descender=A.descender;for(const P in A.glyphs)this._doesCharSupportLocalGlyph(+P)||(g.glyphs[+P]=A.glyphs[+P]);g.ranges[b]=!0}for(const P of w)P(E,A);delete g.requests[b]})),w.push((E,A)=>{E?_(E):A&&_(null,{stack:h,id:f,glyph:A.glyphs[f]||null})})},(h,f)=>{if(h)s(h);else if(f){const _={};for(const{stack:g,id:v,glyph:b}of f)_[g]===void 0&&(_[g]={}),_[g].glyphs===void 0&&(_[g].glyphs={}),_[g].glyphs[v]=b&&{id:b.id,bitmap:b.bitmap.clone(),metrics:b.metrics},_[g].ascender=this.entries[g].ascender,_[g].descender=this.entries[g].descender;s(null,_)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==Bm.none&&(this.localGlyphMode===Bm.all?!!this.localFontFamily:!!this.localFontFamily&&(xt["CJK Unified Ideographs"](e)||xt["Hangul Syllables"](e)||xt.Hiragana(e)||xt.Katakana(e)||xt["CJK Symbols and Punctuation"](e)||xt["CJK Unified Ideographs Extension A"](e)||xt["CJK Unified Ideographs Extension B"](e)||xt.Osage(e)))}_tinySDF(e,i,s){const a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(s))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*Ds,buffer:3*Ds,radius:8*Ds}),u.fontWeight=P}if(this.localGlyphs[u.fontWeight][s])return this.localGlyphs[u.fontWeight][s];const h=String.fromCodePoint(s),{data:f,width:_,height:g,glyphWidth:v,glyphHeight:b,glyphLeft:w,glyphTop:E,glyphAdvance:A}=u.draw(h);return this.localGlyphs[u.fontWeight][s]={id:s,bitmap:new ja({width:_,height:g},f),metrics:{width:v/Ds,height:b/Ds,left:w/Ds,top:E/Ds-27,advance:A/Ds,localGlyph:!0}}}}_u.loadGlyphRange=function(r,e,i,s,a){const u=256*e,h=u+255,f=s.transformRequest(s.normalizeGlyphsURL(i).replace("{fontstack}",r).replace("{range}",`${u}-${h}`),ol.Glyphs);al(f,(_,g)=>{if(_)a(_);else if(g){const v={},b=function(w){return new Fp(w).readFields(r1,{})}(g);for(const w of b.glyphs)v[w.id]=w;a(null,{glyphs:v,ascender:b.ascender,descender:b.descender})}})},_u.TinySDF=class{constructor({fontSize:r=24,buffer:e=3,radius:i=8,cutoff:s=.25,fontFamily:a="sans-serif",fontWeight:u="normal",fontStyle:h="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=i;const f=this.size=r+4*e,_=this._createCanvas(f),g=this.ctx=_.getContext("2d",{willReadFrequently:!0});g.font=`${h} ${u} ${r}px ${a}`,g.textBaseline="alphabetic",g.textAlign="left",g.fillStyle="black",this.gridOuter=new Float64Array(f*f),this.gridInner=new Float64Array(f*f),this.f=new Float64Array(f),this.z=new Float64Array(f+1),this.v=new Uint16Array(f)}_createCanvas(r){const e=document.createElement("canvas");return e.width=e.height=r,e}draw(r){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:a,actualBoundingBoxRight: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(s)),g=f+2*this.buffer,v=_+2*this.buffer,b=Math.max(g*v,0),w=new Uint8ClampedArray(b),E={data:w,width:g,height:v,glyphWidth:f,glyphHeight:_,glyphTop:h,glyphLeft:0,glyphAdvance:e};if(f===0||_===0)return E;const{ctx:A,buffer:P,gridInner:D,gridOuter:k}=this;A.clearRect(P,P,f,_),A.fillText(r,P,P+h);const j=A.getImageData(P,P,f,_);k.fill(Op,0,b),D.fill(0,0,b);for(let G=0;G<_;G++)for(let z=0;z<f;z++){const N=j.data[4*(G*f+z)+3]/255;if(N===0)continue;const q=(G+P)*g+z+P;if(N===1)k[q]=0,D[q]=Op;else{const H=.5-N;k[q]=H>0?H*H:0,D[q]=H<0?H*H:0}}By(k,0,0,g,v,g,this.f,this.v,this.z),By(D,P,P,f,_,g,this.f,this.v,this.z);for(let G=0;G<b;G++){const z=Math.sqrt(k[G])-Math.sqrt(D[G]);w[G]=Math.round(255-255*(z/this.radius+this.cutoff))}return E}};const ec=Ql;function Vy(r,e){return r+e[1]-e[0]}function Uy(r,e,i,s,a=1){const u=[],h=r.imagePrimary,f=h.pixelRatio,_=h.paddedRect.w-2*ec,g=h.paddedRect.h-2*ec,v=(r.right-r.left)*a,b=(r.bottom-r.top)*a,w=h.stretchX||[[0,_]],E=h.stretchY||[[0,g]],A=w.reduce(Vy,0),P=E.reduce(Vy,0),D=_-A,k=g-P;let j=0,G=A,z=0,N=P,q=0,H=D,oe=0,re=k;if(h.content&&s){const he=h.content;j=Bp(w,0,he[0]),z=Bp(E,0,he[1]),G=Bp(w,he[0],he[2]),N=Bp(E,he[1],he[3]),q=he[0]-j,oe=he[1]-z,H=he[2]-he[0]-G,re=he[3]-he[1]-N}
14const ae=(he,Te,Oe,ze)=>{const ke=Np(he.stretch-j,G,v,r.left*a),Be=Vp(he.fixed-q,H,he.stretch,A),Ee=Np(Te.stretch-z,N,b,r.top*a),Le=Vp(Te.fixed-oe,re,Te.stretch,P),be=Np(Oe.stretch-j,G,v,r.left*a),Se=Vp(Oe.fixed-q,H,Oe.stretch,A),Ue=Np(ze.stretch-z,N,b,r.top*a),Ge=Vp(ze.fixed-oe,re,ze.stretch,P),_t=new He(ke,Ee),ot=new He(be,Ee),Ye=new He(be,Ue),Ve=new He(ke,Ue),Pt=new He(Be/f,Le/f),st=new He(Se/f,Ge/f),lt=e*Math.PI/180;if(lt){const Zt=Math.sin(lt),fi=Math.cos(lt),Li=[fi,-Zt,Zt,fi];_t._matMult(Li),ot._matMult(Li),Ve._matMult(Li),Ye._matMult(Li)}const St=he.stretch+he.fixed,Ft=Oe.stretch+Oe.fixed,Lt=Te.stretch+Te.fixed,$t=ze.stretch+ze.fixed,Bt=r.imageSecondary;return{tl:_t,tr:ot,bl:Ve,br:Ye,texPrimary:{x:h.paddedRect.x+ec+St,y:h.paddedRect.y+ec+Lt,w:Ft-St,h:$t-Lt},texSecondary:Bt?{x:Bt.paddedRect.x+ec+St,y:Bt.paddedRect.y+ec+Lt,w:Ft-St,h:$t-Lt}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Pt,pixelOffsetBR:st,minFontScaleX:H/f/v,minFontScaleY:re/f/b,isSDF:i}};if(s&&(h.stretchX||h.stretchY)){const he=jy(w,D,A),Te=jy(E,k,P);for(let Oe=0;Oe<he.length-1;Oe++){const ze=he[Oe],ke=he[Oe+1];for(let Be=0;Be<Te.length-1;Be++)u.push(ae(ze,Te[Be],ke,Te[Be+1]))}}else u.push(ae({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:_+1},{fixed:0,stretch:g+1}));return u}function Bp(r,e,i){let s=0;for(const a of r)s+=Math.max(e,Math.min(i,a[1]))-Math.max(e,Math.min(i,a[0]));return s}function jy(r,e,i){const s=[{fixed:-1,stretch:0}];for(const[a,u]of r){const h=s[s.length-1];s.push({fixed:a-h.stretch,stretch:h.stretch}),s.push({fixed:a-h.stretch,stretch:h.stretch+(u-a)})}return s.push({fixed:e+ec,stretch:i}),s}function Np(r,e,i,s){return r/e*i+s}function Vp(r,e,i,s){return r-e*i/s}function d1(r,e,i,s){const a=e+r.positionedLines[s].lineOffset;return s===0?i+a/2:i+(a+(e+r.positionedLines[s-1].lineOffset))/2}function p1(r,e=1,i=!1){let s=1/0,a=1/0,u=-1/0,h=-1/0;const f=r[0];for(let E=0;E<f.length;E++){const A=f[E];(!E||A.x<s)&&(s=A.x),(!E||A.y<a)&&(a=A.y),(!E||A.x>u)&&(u=A.x),(!E||A.y>h)&&(h=A.y)}const _=Math.min(u-s,h-a);let g=_/2;const v=new Tc([],f1);if(_===0)return new He(s,a);for(let E=s;E<u;E+=_)for(let A=a;A<h;A+=_)v.push(new gu(E+g,A+g,g,r));let b=function(E){let A=0,P=0,D=0;const k=E[0];for(let j=0,G=k.length,z=G-1;j<G;z=j++){const N=k[j],q=k[z],H=N.x*q.y-q.x*N.y;P+=(N.x+q.x)*H,D+=(N.y+q.y)*H,A+=3*H}return new gu(P/A,D/A,0,E)}(r),w=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,w)),E.max-b.d<=e||(g=E.h/2,v.push(new gu(E.p.x-g,E.p.y-g,g,r)),v.push(new gu(E.p.x+g,E.p.y-g,g,r)),v.push(new gu(E.p.x-g,E.p.y+g,g,r)),v.push(new gu(E.p.x+g,E.p.y+g,g,r)),w+=4)}return i&&(console.log(`num probes: ${w}`),console.log(`best distance: ${b.d}`)),b.p}function f1(r,e){return e.max-r.max}class gu{constructor(e,i,s,a){this.p=new He(e,i),this.h=s,this.d=function(u,h){let f=!1,_=1/0;for(let g=0;g<h.length;g++){const v=h[g];for(let b=0,w=v.length,E=w-1;b<w;E=b++){const A=v[b],P=v[E];A.y>u.y!=P.y>u.y&&u.x<(P.x-A.x)*(u.y-A.y)/(P.y-A.y)+A.x&&(f=!f),_=Math.min(_,ou(u,A,P))}}return(f?1:-1)*Math.sqrt(_)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}}const m1=Object.keys,Nm=Number.POSITIVE_INFINITY,_1=Math.sqrt(2);function Gy(r,[e,i]){let s=0,a=0;if(i===Nm){e<0&&(e=0);const u=e/_1;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":s=-u;break;case"top-left":case"bottom-left":s=u;break;case"left":s=e;break;case"right":s=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),r){case"top-right":case"top-left":case"top":a=i-7;break;case"bottom-right":case"bottom-left":case"bottom":a=7-i}switch(r){case"top-right":case"bottom-right":case"right":s=-e;break;case"top-left":case"bottom-left":case"left":s=e}}return[s,a]}function Up(r,e,i,s,a,u,h,f,_){if(!e||!e.usvg)return;const g=Cy(s),v=Cy(a),b=u!=="both"&&u!=="width"||!Ay(s)?1:v.width/g.width,w=u!=="both"&&u!=="height"||!My(s)?1:v.height/g.height;i.scaleSelf(b,w);const E=i.toString();h.set(E,i),f.set(E,e);const{imagePosition:A}=Om(E,e,Ql);_.set(E,A)}function qy(r,e,i,s,a,u,h,f,_){if(!r)return;const g=function(v,b,w,E,A,P){if(v.kind==="camera")return v.maxSize;if(v.kind==="composite"){const D=b.possiblyEvaluate(new Ti(v.maxZoom,{worldview:P}),w).evaluate(A,{},w),k=b.possiblyEvaluate(new Ti(v.minZoom,{worldview:P}),w).evaluate(A,{},w);return Math.max(D,k)}return b.possiblyEvaluate(new Ti(E,{worldview:P})).evaluate(A,{},w)}(e,i,s,a,u,_);return r.scaleSelf(g*f*h)}function $y(r,e,i,s,a,u,h,f,_){return{iconPrimary:qy(r.getPrimary(),e,i,s,a,u,h,f,_),iconSecondary:qy(r.getSecondary(),e,i,s,a,u,h,f,_)}}function g1(r,e,i){if(!e)return;const s=i.get(r.toString()),a=i.get(e.toString());a&&(s.paddedRect.w===a.paddedRect.w&&s.paddedRect.h===a.paddedRect.h||kt(`Mismatch in icon variant sizes: ${r.toString()} and ${e.toString()}`),s.usvg!==a.usvg&&kt(`Mismatch in icon variant image types: ${r.id} and ${e.id}`))}function Zy(r,e,i,s){if(!r)return;const a=e.get(i.toString());if(r.imagePrimary=a,s){const u=e.get(s.toString());r.imageSecondary=u}}function y1(r,e){for(const i in r.horizontal)Hy(r.horizontal[i],e);Hy(r.vertical,e)}function Hy(r,e){if(r){for(const i of r.positionedLines)for(const s of i.positionedGlyphs)if(s.image!==null){const a=s.image.toString();s.rect=e.get(a).paddedRect}}}function Vm(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 x1(r,e,i,s,a,u,h,f,_){const g=Um(u.horizontal)||u.vertical,v=i.get("icon-text-fit-padding").evaluate(s,{},a);let b,w=e;return e&&_!=="none"&&(r.allowVerticalPlacement&&u.vertical&&(b=Iy(e,u.vertical,_,v,f,h)),g&&(w=Iy(e,g,_,v,f,h))),{defaultShapedIcon:w,verticallyShapedIcon:b}}function v1(r,e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,k,j,G){let z=h.textMaxSize.evaluate(e,{},w);z===void 0?z=f*h.textScaleFactor:z*=h.textScaleFactor;const N=r.layers[0].layout,q=Um(i.horizontal)||i.vertical,H=E.name==="globe",oe=Lr,re=r.tilePixelRatio*z/oe,ae=(Be=r.overscaling,r.zoom>18&&Be>2&&(Be>>=1),Math.max(We/(512*Be),1)*N.get("symbol-spacing")),he=N.get("text-padding")*r.tilePixelRatio,Te=N.get("icon-padding")*r.tilePixelRatio,Oe=ni(N.get("text-max-angle")),ze=N.get("icon-rotation-alignment")==="map"&&G!=="point",ke=ae/2;var Be;r.hasAnyIconTextFit===!1&&D!=="none"&&(r.hasAnyIconTextFit=!0);
14const Ee=e.properties?+e.properties[Wt]:null,Le=Ee&&r.elevationFeatureIdToIndex?r.elevationFeatureIdToIndex.get(Ee):65535,be=(Se,Ue,Ge)=>{if(Ue.x<0||Ue.x>=We||Ue.y<0||Ue.y>=We)return;let _t=null;if(H){const{x:ot,y:Ye,z:Ve}=E.projectTilePoint(Ue.x,Ue.y,Ge);_t={anchor:new $o(ot,Ye,Ve,0,void 0),up:E.upVector(Ge,Ue.x,Ue.y)}}(function(ot,Ye,Ve,Pt,st,lt,St,Ft,Lt,$t,Bt,Zt,fi,Li,$,W,Ie,$e,Ke,Xe,nt,wt,Xt,Yt,Nt,yi,Ci,Kt,Qi){const Fi=ot.addToLineVertexArray(Ye,Pt);let mi,hr,Vi,Pi,ki,wi,Ut,Si=0,er=0,vt=0,ei=0,Ui=-1,lr=-1;const Wi={};let Er=cl("");const Ei=Ve?Ve.anchor:Ye,wr=Kt!=="none";let Tn=0,Gr=0;if(Lt._unevaluatedLayout.getValue("text-radial-offset")===void 0){const Ir=Lt.layout.get("text-offset").evaluate(nt,{},Nt);Tn=Ir[0]*Lr,Gr=Ir[1]*Lr}else Tn=Lt.layout.get("text-radial-offset").evaluate(nt,{},Nt)*Lr,Gr=Nm;if(ot.allowVerticalPlacement&&st.vertical){const Ir=st.vertical;if($)wi=jm(Ir),Ft&&(Ut=jm(Ft));else{const Mr=Lt.layout.get("text-rotate").evaluate(nt,{},Nt)+90;Vi=jp($t,Ei,Ye,Bt,Zt,fi,Ir,Li,Mr,W),Ft&&(Pi=jp($t,Ei,Ye,Bt,Zt,fi,Ft,$e,Mr))}}if(lt){const Ir=ot.iconSizeData,Mr=Lt.layout.get("icon-rotate").evaluate(nt,{},Nt),qr=Uy(lt,Mr,Xt,wr,wt.iconScaleFactor),ln=Ft?Uy(Ft,Mr,Xt,wr,wt.iconScaleFactor):void 0;hr=jp($t,Ei,Ye,Bt,Zt,fi,lt,$e,Mr,null),Si=4*qr.length;let Yr=null;Ir.kind==="source"?(Yr=[po*Lt.layout.get("icon-size").evaluate(nt,{},Nt)*wt.iconScaleFactor],Yr[0]>qa&&kt(`${ot.layerIds[0]}: Value for "icon-size" is >= ${Jh}. Reduce your "icon-size".`)):Ir.kind==="composite"&&(Yr=[po*wt.compositeIconSizes[0].evaluate(nt,{},Nt)*wt.iconScaleFactor,po*wt.compositeIconSizes[1].evaluate(nt,{},Nt)*wt.iconScaleFactor],(Yr[0]>qa||Yr[1]>qa)&&kt(`${ot.layerIds[0]}: Value for "icon-size" is >= ${Jh}. Reduce your "icon-size".`)),ot.addSymbols(ot.icon,qr,Yr,Xe,Ke,nt,void 0,Ve,Ye,Fi.lineStartIndex,Fi.lineLength,-1,Yt,Nt,yi,Ci),Ui=ot.icon.placedSymbolArray.length-1,ln&&(er=4*ln.length,ot.addSymbols(ot.icon,ln,Yr,Xe,Ke,nt,Rn.vertical,Ve,Ye,Fi.lineStartIndex,Fi.lineLength,-1,Yt,Nt,yi,Ci),lr=ot.icon.placedSymbolArray.length-1)}for(const Ir in st.horizontal){const Mr=Ir,qr=st.horizontal[Mr];mi||(Er=cl(qr.text),$?ki=jm(qr):mi=jp($t,Ei,Ye,Bt,Zt,fi,qr,Li,Lt.layout.get("text-rotate").evaluate(nt,{},Nt),W));const ln=qr.positionedLines.length===1;if(vt+=Wy(ot,Ve,Ye,qr,St,Lt,$,nt,W,Fi,st.vertical?Rn.horizontal:Rn.horizontalOnly,ln?m1(st.horizontal):[Mr],Wi,Ui,wt,Yt,Nt,yi),ln)break}st.vertical&&(ei+=Wy(ot,Ve,Ye,st.vertical,St,Lt,$,nt,W,Fi,Rn.vertical,["vertical"],Wi,lr,wt,Yt,Nt,yi));let Vr=-1;const Sn=(Ir,Mr)=>Ir?Math.max(Ir,Mr):Mr;Vr=Sn(ki,Vr),Vr=Sn(wi,Vr),Vr=Sn(Ut,Vr);const fo=Vr>-1?1:0;ot.glyphOffsetArray.length>=65535&&kt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),nt.sortKey!==void 0&&ot.addToSortKeyRanges(ot.symbolInstances.length,nt.sortKey),ot.symbolInstances.emplaceBack(Ye.x,Ye.y,Ei.x,Ei.y,Ei.z,Wi.right>=0?Wi.right:-1,Wi.center>=0?Wi.center:-1,Wi.left>=0?Wi.left:-1,Wi.vertical>=0?Wi.vertical:-1,Ui,lr,Er,mi!==void 0?mi:ot.collisionBoxArray.length,mi!==void 0?mi+1:ot.collisionBoxArray.length,Vi!==void 0?Vi:ot.collisionBoxArray.length,Vi!==void 0?Vi+1:ot.collisionBoxArray.length,hr!==void 0?hr:ot.collisionBoxArray.length,hr!==void 0?hr+1:ot.collisionBoxArray.length,Pi||ot.collisionBoxArray.length,Pi?Pi+1:ot.collisionBoxArray.length,Bt,vt,ei,Si,er,fo,0,Tn,Gr,Vr,0,wr?1:0,Qi)})(r,Ue,_t,Se,i,s,u,a,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,he,j,g,0,Te,ze,k,e,h,v,b,w,A,P,D,Le)};if(G==="line")for(const Se of zp(e.geometry,0,0,We,We)){const Ue=h1(Se,ae,Oe,i.vertical||q,s,oe,re,r.overscaling,We);for(const Ge of Ue)q&&b1(r,q.text,ke,Ge)||be(Se,Ge,w)}else if(G==="line-center"){for(const Se of e.geometry)if(Se.length>1){const Ue=u1(Se,Oe,i.vertical||q,s,oe,re);Ue&&be(Se,Ue,w)}}else if(e.type==="Polygon")for(const Se of Ep(e.geometry,0)){const Ue=p1(Se,16);be(Se[0],new $o(Ue.x,Ue.y,0,0,void 0),w)}else if(e.type==="LineString")for(const Se of e.geometry)be(Se,new $o(Se[0].x,Se[0].y,0,0,void 0),w);else if(e.type==="Point")for(const Se of e.geometry)for(const Ue of Se)be([Ue],new $o(Ue.x,Ue.y,0,0,void 0),w)}const Jh=255,qa=Jh*po;function Wy(r,e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D,k){const j=function(N,q,H,oe,re,ae,he,Te){const Oe=[];if(q.positionedLines.length===0)return Oe;const ze=oe.layout.get("text-rotate").evaluate(ae,{})*Math.PI/180,ke=function(Se){const Ue=Se[0],Ge=Se[1],_t=Ue*Ge;return _t>0?[Ue,-Ge]:_t<0?[-Ue,Ge]:Ue===0?[Ge,Ue]:[Ge,-Ue]}(H);let Be=Math.abs(q.top-q.bottom);for(const Se of q.positionedLines)Be-=Se.lineOffset;const Ee=q.positionedLines.length,Le=Be/Ee;let be=q.top-H[1];for(let Se=0;Se<Ee;++Se){const Ue=q.positionedLines[Se];be=d1(q,Le,be,Se);for(const Ge of Ue.positionedGlyphs){if(!Ge.rect)continue;const _t=Ge.rect||{};let ot=o1+1,Ye=!0,Ve=1,Pt=0;if(Ge.image){const nt=he.get(Ge.image.toString());if(!nt)continue;if(nt.sdf){kt("SDF images are not supported in formatted text and will be ignored.");continue}Ye=!1,Ve=nt.pixelRatio,ot=Ql/Ve}const st=(re||Te)&&Ge.vertical,lt=Ge.metrics.advance*Ge.scale/2,St=Ge.metrics,Ft=Ge.rect;if(Ft===null)continue;Te&&q.verticalizable&&(Pt=Ge.image?lt-Ge.metrics.width*Ge.scale/2:0);const Lt=re?[Ge.x+lt,Ge.y]:[0,0];let $t=[0,0],Bt=[0,0],Zt=!1;re||(st?(Bt=[Ge.x+lt+ke[0],Ge.y+ke[1]-Pt],Zt=!0):$t=[Ge.x+lt+H[0],Ge.y+H[1]-Pt]);const fi=Ft.w*Ge.scale/(Ve*(Ge.localGlyph?Ds:1)),Li=Ft.h*Ge.scale/(Ve*(Ge.localGlyph?Ds:1));let $,W,Ie,$e;if(st){const nt=Ge.y-be,wt=new He(-lt,lt-nt),Xt=-Math.PI/2,Yt=new He(...Bt);
vendor: 6,703 bytes, line 14
14$=new He(-lt+$t[0],$t[1]),$._rotateAround(Xt,wt)._add(Yt),$.x+=-nt+lt,$.y-=(St.left-ot)*Ge.scale;const Nt=Ge.image?St.advance*Ge.scale:Lr*Ge.scale,yi=String.fromCodePoint(Ge.glyph);e1(yi)?$.x+=(1-ot)*Ge.scale:t1(yi)?$.x+=Nt-St.height*Ge.scale+(-ot-1)*Ge.scale:$.x+=Ge.image||St.width+2*ot===Ft.w&&St.height+2*ot===Ft.h?(Nt-Li)/2:(Nt-(St.height+2*ot)*Ge.scale)/2,W=new He($.x,$.y-fi),Ie=new He($.x+Li,$.y),$e=new He($.x+Li,$.y-fi)}else{const nt=(St.left-ot)*Ge.scale-lt+$t[0],wt=(-St.top-ot)*Ge.scale+$t[1],Xt=nt+fi,Yt=wt+Li;$=new He(nt,wt),W=new He(Xt,wt),Ie=new He(nt,Yt),$e=new He(Xt,Yt)}if(ze){let nt;nt=re?new He(0,0):Zt?new He(ke[0],ke[1]):new He(H[0],H[1]),$._rotateAround(ze,nt),W._rotateAround(ze,nt),Ie._rotateAround(ze,nt),$e._rotateAround(ze,nt)}const Ke=new He(0,0),Xe=new He(0,0);Oe.push({tl:$,tr:W,bl:Ie,br:$e,texPrimary:_t,texSecondary:void 0,writingMode:q.writingMode,glyphOffset:Lt,sectionIndex:Ge.sectionIndex,isSDF:Ye,pixelOffsetTL:Ke,pixelOffsetBR:Xe,minFontScaleX:0,minFontScaleY:0})}}return Oe}(0,s,_,u,h,f,a,r.allowVerticalPlacement),G=r.textSizeData;let z=null;G.kind==="source"?(z=[po*u.layout.get("text-size").evaluate(f,{},D)*A.textScaleFactor],z[0]>qa&&kt(`${r.layerIds[0]}: Value for "text-size" is >= ${Jh}. Reduce your "text-size".`)):G.kind==="composite"&&(z=[po*A.compositeTextSizes[0].evaluate(f,{},D)*A.textScaleFactor,po*A.compositeTextSizes[1].evaluate(f,{},D)*A.textScaleFactor],(z[0]>qa||z[1]>qa)&&kt(`${r.layerIds[0]}: Value for "text-size" is >= ${Jh}. Reduce your "text-size".`)),r.addSymbols(r.text,j,z,_,h,f,v,e,i,g.lineStartIndex,g.lineLength,E,P,D,k,!1);for(const N of b)w[N]=r.text.placedSymbolArray.length-1;return 4*j.length}function Um(r){for(const e in r)return r[e];return null}function jp(r,e,i,s,a,u,h,f,_,g){let v=h.top,b=h.bottom,w=h.left,E=h.right;if(Ey(h)&&h.collisionPadding){const A=h.collisionPadding;w-=A[0],v-=A[1],E+=A[2],b+=A[3]}if(_){const A=new He(w,v),P=new He(E,v),D=new He(w,b),k=new He(E,b),j=ni(_);let G=new He(0,0);g&&(G=new He(g[0],g[1])),A._rotateAround(j,G),P._rotateAround(j,G),D._rotateAround(j,G),k._rotateAround(j,G),w=Math.min(A.x,P.x,D.x,k.x),E=Math.max(A.x,P.x,D.x,k.x),v=Math.min(A.y,P.y,D.y,k.y),b=Math.max(A.y,P.y,D.y,k.y)}return r.emplaceBack(e.x,e.y,e.z,i.x,i.y,w,v,E,b,f,s,a,u),r.length-1}function jm(r){Ey(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 b1(r,e,i,s){const a=r.compareText;if(e in a){const u=a[e];for(let h=u.length-1;h>=0;h--)if(s.dist(u[h])<i)return!0}else a[e]=[];return a[e].push(s),!1}function Xy(r,e){const i=r.fovAboveCenter,s=r.elevation?r.elevation.getMinElevationBelowMSL()*e:0,a=(r._camera.position[2]*r.worldSize-s)/Math.cos(r._pitch),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 Qh(r,e){if(!e.isReprojectedInTileSpace)return{scale:1<<r.z,x:r.x,y:r.y,x2:r.x+1,y2:r.y+1,projection:e};const i=Math.pow(2,-r.z),s=r.x*i,a=(r.x+1)*i,u=r.y*i,h=(r.y+1)*i,f=ne(s),_=ne(a),g=fe(u),v=fe(h),b=e.project(f,g),w=e.project(_,g),E=e.project(_,v),A=e.project(f,v);let P=Math.min(b.x,w.x,E.x,A.x),D=Math.min(b.y,w.y,E.y,A.y),k=Math.max(b.x,w.x,E.x,A.x),j=Math.max(b.y,w.y,E.y,A.y);const G=i/16;function z(q,H,oe,re,ae,he){const Te=(oe+ae)/2,Oe=(re+he)/2,ze=e.project(ne(Te),fe(Oe)),ke=Math.max(0,P-ze.x,D-ze.y,ze.x-k,ze.y-j);P=Math.min(P,ze.x),k=Math.max(k,ze.x),D=Math.min(D,ze.y),j=Math.max(j,ze.y),ke>G&&(z(q,ze,oe,re,Te,Oe),z(ze,H,Te,Oe,ae,he))}z(b,w,s,u,a,u),z(w,E,a,u,a,h),z(E,A,a,h,s,h),z(A,b,s,h,s,u),P-=G,D-=G,k+=G,j+=G;const N=1/Math.max(k-P,j-D);return{scale:N,x:P*N,y:D*N,x2:k*N,y2:j*N,projection:e}}function Yy(r,{x:e,y:i},s=0){return new He(((e-s)*r.scale-r.x)*We,(i*r.scale-r.y)*We)}const w1=Dt(new Float32Array(16));class $a{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 V(0,0)}projectTilePoint(e,i,s){return{x:e,y:i,z:0}}locationPoint(e,i,s,a=!0){return e._coordinatePoint(e.locationCoordinate(i,s),a)}pixelsPerMeter(e,i){return ie(1,e)*i}pixelSpaceConversion(e,i,s){return 1}farthestPixelDistance(e){return Xy(e,e.pixelsPerMeter)}pointCoordinate(e,i,s,a){const u=e.horizonLineFromTop(!1),h=new He(i,Math.max(u,s));return e.rayIntersectionCoordinate(e.pointRayIntersection(h,a))}pointCoordinate3D(e,i,s){const a=new He(i,s);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 s=e.horizonLineFromTop();return i.y<s}createInversionMatrix(e,i){return w1}createTileMatrix(e,i,s){let a,u,h;const f=s.canonical,_=Dt(new Float64Array(16));if(this.isReprojectedInTileSpace){const g=Qh(f,this);a=1,u=g.x+s.wrap*g.scale,h=g.y,dr(_,_,[a/g.scale,a/g.scale,e.pixelsPerMeter/i])}else a=i/e.zoomScale(f.z),u=(f.x+Math.pow(2,f.z)*s.wrap)*a,h=f.y*a;return Fr(_,_,[u,h,0]),dr(_,_,[a/We,a/We,1]),_}upVector(e,i,s){return[0,0,1]}upVectorScale(e,i,s){return{metersToTile:1}}}class T1 extends $a{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,s]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(ni(i));this.n=(a+Math.sin(ni(s)))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n:s,c:a,r0:u}=this,h=ni(e-this.center[0]),f=ni(i),_=Math.sqrt(a-2*s*Math.sin(f))/s;return{x:_*Math.sin(h*s),y:_*Math.cos(h*s)-u,z:0}}unproject(e,i){const{n:s,c:a,r0:u}=this,h=u+i;let f=Math.atan2(e,Math.abs(h))*Math.sign(h);h*s<0&&(f-=Math.PI*Math.sign(e)*Math.sign(h));const _=ni(this.center[0])*s;f=_e(f,-Math.PI-_,Math.PI-_);const g=Q(xe(f/s)+this.center[0],-180,180),v=Math.asin(Q((a-(e*e+h*h)*s*s)/(2*s),-1,1)),b=Q(xe(v),-85.051129,Ae);return new V(g,b)}}const ed=1.340264,td=-.081106,id=893e-6,rd=.003796,Gp=Math.sqrt(3)/2;class S1 extends $a{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const s=Math.asin(Gp*Math.sin(i)),a=s*s,u=a*a*a;return{x:.5*(e*Math.cos(s)/(Gp*(ed+3*td*a+u*(7*id+9*rd*a)))/Math.PI+.5),y:1-.5*(s*(ed+td*a+u*(id+rd*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let s=i=(2*(1-i)-1)*Math.PI,a=s*s,u=a*a*a;for(let v,b,w,E=0;E<12&&(b=s*(ed+td*a+u*(id+rd*a))-i,w=ed+3*td*a+u*(7*id+9*rd*a),v=b/w,s=Q(s-v,
vendor: 5,503 bytes, line 14
14-Math.PI/3,Math.PI/3),a=s*s,u=a*a*a,!(Math.abs(v)<1e-12));++E);const h=Gp*e*(ed+3*td*a+u*(7*id+9*rd*a))/Math.cos(s),f=Math.asin(Math.sin(s)/Gp),_=Q(180*h/Math.PI,-180,180),g=Q(180*f/Math.PI,-85.051129,Ae);return new V(_,g)}}class E1 extends $a{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){const s=360*(e-.5),a=Q(360*(.5-i),-85.051129,Ae);return new V(s,a)}}const yu=Math.PI/2;function qp(r){return Math.tan((yu+r)/2)}class I1 extends $a{constructor(e){super(e),this.center=e.center||[0,30];const[i,s]=this.parallels=e.parallels||[30,30];let a=ni(i),u=ni(s);this.southernCenter=a+u<0,this.southernCenter&&(a=-a,u=-u);const h=Math.cos(a),f=qp(a);this.n=a===u?Math.sin(a):Math.log(h/Math.cos(u))/Math.log(qp(u)/f),this.f=h*Math.pow(qp(a),this.n)/this.n}project(e,i){i=ni(i),this.southernCenter&&(i=-i),e=ni(e-this.center[0]);const s=1e-6,{n:a,f:u}=this;u>0?i<-yu+s&&(i=-yu+s):i>yu-s&&(i=yu-s);const h=u/Math.pow(qp(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:s,f:a}=this,u=a-i,h=Math.sign(u),f=Math.sign(s)*Math.sqrt(e*e+u*u);let _=Math.atan2(e,Math.abs(u))*h;u*s<0&&(_-=Math.PI*Math.sign(e)*h);const g=Q(xe(_/s)+this.center[0],-180,180),v=Q(xe(2*Math.atan(Math.pow(a/f,1/s))-yu),-85.051129,Ae);return new V(g,this.southernCenter?-v:v)}}class Ky extends $a{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:J(e),y:K(i),z:0}}unproject(e,i){const s=ne(e),a=fe(i);return new V(s,a)}}const Jy=ni(Ae);class A1 extends $a{project(e,i){const s=(i=ni(i))*i,a=s*s;return{x:.5*((e=ni(e))*(.8707-.131979*s+a*(a*(.003971*s-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+s*(.015085+a*(.028874*s-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let s=i=(2*(1-i)-1)*Math.PI,a=25,u=0,h=s*s;do{h=s*s;const g=h*h;u=(s*(1.007226+h*(.015085+g*(.028874*h-.044475-.005916*g)))-i)/(1.007226+h*(.045255+g*(.259866*h-.311325-.005916*11*g))),s=Q(s-u,-Jy,Jy)}while(Math.abs(u)>1e-6&&--a>0);h=s*s;const f=Q(xe(e/(.8707+h*(h*(h*h*h*(.003971-.001529*h)-.013791)-.131979))),-180,180),_=xe(s);return new V(f,_)}}const Qy=ni(Ae);class M1 extends $a{project(e,i){i=ni(i),e=ni(e);const s=Math.cos(i),a=2/Math.PI,u=Math.acos(s*Math.cos(e/2)),h=Math.sin(u)/u,f=.5*(e*a+2*s*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 s=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,u=25;const h=1e-6;let f=0,_=0;do{const g=Math.cos(a),v=Math.sin(a),b=2*v*g,w=v*v,E=g*g,A=Math.cos(s/2),P=Math.sin(s/2),D=2*A*P,k=P*P,j=1-E*A*A,G=j?1/j:0,z=j?Math.acos(g*A)*Math.sqrt(1/j):0,N=.5*(2*z*g*P+2*s/Math.PI)-e,q=.5*(z*v+a)-i,H=.5*G*(E*k+z*g*A*w)+1/Math.PI,oe=G*(D*b/4-z*v*P),re=.125*G*(b*P-z*v*E*D),ae=.5*G*(w*A+z*k*g)+.5,he=oe*re-ae*H;f=(q*oe-N*ae)/he,_=(N*re-q*H)/he,s=Q(s-f,-Math.PI,Math.PI),a=Q(a-_,-Qy,Qy)}while((Math.abs(f)>h||Math.abs(_)>h)&&--u>0);return new V(xe(s),xe(a))}}class ex extends $a{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(ni(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){const{scale:s,cosPhi:a}=this;return{x:ni(e)*a*s+.5,y:-Math.sin(ni(i))/a*s+.5,z:0}}unproject(e,i){const{scale:s,cosPhi:a}=this,u=-(i-.5)/s,h=Q(xe((e-.5)/s)/a,-180,180),f=Math.asin(Q(u*a,-1,1)),_=Q(xe(f),-85.051129,Ae);return new V(h,_)}}class C1 extends Ky{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,i,s){const a=Rh(e,i,s);return Gi(a,a,wp(uo(s))),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i,s){const a=R(i.lat,i.lng),u=tr([],a),h=s?e._centerAltitude+s:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude;In(a,a,u,ie(1,0)*We*h);const f=Dt(new Float64Array(16));return zi(f,e.pixelMatrix,e.globeMatrix),Gi(a,a,f),new He(a[0],a[1])}pixelsPerMeter(e,i){return ie(1,0)*i}pixelSpaceConversion(e,i,s){const a=ie(1,e)*i,u=Tt(ie(1,45)*i,a,s);return this.pixelsPerMeter(e,i)/u}createTileMatrix(e,i,s){const a=sm(uo(s.canonical));return zi(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){const{center:s}=e,a=wp(uo(i));return cn(a,a,ni(s.lng)),Dn(a,a,ni(s.lat)),dr(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,s,a){return k_(e,i,s,!0)||new le(0,0)}pointCoordinate3D(e,i,s){const a=this.pointCoordinate(e,i,s,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!k_(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=function(a,u){const h=a.cameraToCenterDistance,f=a._centerAltitude*u,_=a._camera,g=a._camera.forward(),v=xr([],Xi([],g,-h),[0,0,f]),b=a.worldSize/(2*Math.PI),w=[0,0,-b],E=a.width/a.height,A=Math.tan(a.fovAboveCenter),P=Xi([],_.up(),A),D=Xi([],_.right(),A*E),k=tr([],xr([],xr([],g,P),D)),j=[];let G;if(new Bi(v,k).closestPointOnSphere(w,b,j)){const z=xr([],j,w),N=gr([],z,v);G=Math.cos(a.fovAboveCenter)*Jr(N)}else{const z=gr([],v,w),N=gr([],w,v);tr(N,N);const q=Jr(z)-b;G=Math.sqrt(q*(q+2*b));
vendor: 4,406 bytes, line 14
14const H=Math.acos(G/(b+q))-Math.acos(_r(g,N));G*=Math.cos(H)}return 1.01*G}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),s=Ua(e.zoom);if(s>0){const a=Xy(e,ie(1,e.center.lat)*e.worldSize),u=e.worldSize/(2*Math.PI),h=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Tt(i,a+u*(1-Math.cos(h)),Math.pow(s,10))}return i}upVector(e,i,s){return Rh(i,s,e,1)}upVectorScale(e){return{metersToTile:xp(bp(uo(e)))}}}function tx(r){const e=r.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(r.name){case"mercator":return new Ky(r);case"equirectangular":return new E1(r);case"naturalEarth":return new A1(r);case"equalEarth":return new S1(r);case"winkelTripel":return new M1(r);case"albers":return i?new ex(r):new T1(r);case"lambertConformalConic":return i?new ex(r):new I1(r);case"globe":return new C1(r)}throw new Error(`Invalid projection name: ${r.name}`)}const P1=Vt.VectorTileFeature.types,z1=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function $p(r,e,i,s,a,u,h,f,_,g,v,b,w){const E=f?Math.min(qa,Math.round(f[0])):0,A=f?Math.min(qa,Math.round(f[1])):0;r.emplaceBack(e,i,Math.round(32*s),Math.round(32*a),u,h,(E<<1)+(_?1:0),A,16*g,16*v,256*b,256*w)}function Zp(r,e,i){r.emplaceBack(e,i)}function Hp(r,e,i,s,a,u,h){r.emplaceBack(e,i,s,a,u,h)}const Wp=(r,e,i,s)=>{for(let a=0;a<e;a++)r.emplaceBack(i[0],i[1],i[2],s[0],s[1],s[2])};function Xp(r,e,i,s,a){r.emplaceBack(e,i,s,a),r.emplaceBack(e,i,s,a),r.emplaceBack(e,i,s,a),r.emplaceBack(e,i,s,a)}function R1(r){for(const e of r.sections)if(Wf(e.text))return!0;return!1}class Gm{constructor(e){this.layoutVertexArray=new Ra,this.indexArray=new Br,this.programConfigurations=e,this.segments=new or,this.dynamicLayoutVertexArray=new Or,this.opacityVertexArray=new La,this.placedSymbolArray=new sp,this.iconTransitioningVertexArray=new so,this.globeExtVertexArray=new Da,this.zOffsetVertexArray=new ro,this.orientationVertexArray=new bh}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}upload(e,i,s,a,u){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,q0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Z0.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,z1,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,X0.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,$0.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||u)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,H0.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,W0.members,!0)),this.opacityVertexBuffer.itemSize=1),(s||a)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}tt(Gm,"SymbolBuffers");class qm{constructor(e,i,s){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new s,this.segments=new or,this.collisionVertexArray=new kl,this.collisionVertexArrayExt=new Or}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Y0.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,K0.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
14stroy())}}tt(qm,"CollisionBuffers");class Yp{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(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=Dt([]),this.placementViewportMatrix=Dt([]);const i=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.textSizeData=Py(this.zoom,i["text-size"],this.worldview),this.iconSizeData=Py(this.zoom,i["icon-size"],this.worldview);const s=this.layers[0].layout,a=s.get("symbol-sort-key"),u=s.get("symbol-z-order");this.canOverlap=s.get("text-allow-overlap")||s.get("icon-allow-overlap")||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&a.constantOr(1)!==void 0,this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=s.get("text-writing-mode").map(h=>Rn[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}createArrays(){this.text=new Gm(new l(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new Gm(new l(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new Eh,this.lineVertexArray=new lp,this.symbolInstances=new ap}calculateGlyphDependencies(e,i,s,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 _=Wh[h];_&&(i[_.charCodeAt(0)]=!0)}}}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const s=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!ym(this.activeReplacements,s)&&(this.activeReplacements=s,!0)}populate(e,i,s,a){const u=this.layers[0],h=u.layout,f=this.projection.name==="globe",_=h.get("text-font"),g=h.get("text-field"),v=h.get("icon-image"),[b,w]=h.get("icon-size-scale-range"),E=Q(i.scaleFactor||1,b,w),A=(g.value.kind!=="constant"||g.value.value instanceof nn&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(_.value.kind!=="constant"||_.value.value.length>0),P=v.value.kind!=="constant"||!!v.value.value||Object.keys(v.parameters).length>0,D=h.get("symbol-sort-key");if(this.features=[],!A&&!P)return;const k=i.iconDependencies,j=i.glyphDependencies,G=i.availableImages,z=new Ti(this.zoom,{worldview:this.worldview});for(const{feature:N,id:q,index:H,sourceLayerIndex:oe}of e){const re=u._featureFilter.needGeometry,ae=Qe(N,re);if(!u._featureFilter.filter(z,ae,s))continue;if(re||(ae.geometry=rt(N,s,a)),f&&N.type!==1&&s.z<=5){const ke=ae.geometry,Be=.98078528056,Ee=(Le,be)=>_r(Rh(Le.x,Le.y,s,1),Rh(be.x,be.y,s,1))<Be;for(let Le=0;Le<ke.length;Le++)ke[Le]=qe(ke[Le],Ee)}let he,Te;if(A){const ke=u.getValueAndResolveTokens("text-field",ae,s,G),Be=nn.factory(ke);R1(Be)&&(this.hasRTLText=!0),(!this.hasRTLText||Aa()==="unavailable"||this.hasRTLText&&Ms.isParsed())&&(he=Q0(Be,u,ae))}if(P){const ke=u.getValueAndResolveTokens("icon-image",ae,s,G);Te=typeof ke=="string"?dn.build(ke):ke}if(!he&&!Te)continue;const Oe=this.sortFeaturesByKey?D.evaluate(ae,{},s):void 0,ze={id:q,text:he,icon:Te,index:H,sourceLayerIndex:oe,geometry:ae.geometry,properties:N.properties,type:P1[N.type],sortKey:Oe};if(this.features.push(ze),Te){const ke=this.layers[0]._unevaluatedLayout._values,{iconPrimary:Be,iconSecondary:Ee}=$y(Te,this.iconSizeData,ke["icon-size"],s,this.zoom,ze,this.pixelRatio,E,this.worldview),Le=Be.id.toString();if(k.has(Le)?k.get(Le).push(Be):k.set(Le,[Be]),Ee){const be=Ee.id.toString();k.has(be)?k.get(be).push(Ee):k.set(be,[Ee])}}if(he){const ke=_.evaluate(ae,{},s).join(","),Be=h.get("text-rotation-alignment")==="map"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Rn.vertical)>=0;for(const Ee of he.sections)if(Ee.image){const Le=Ee.image.getPrimary().scaleSelf(this.pixelRatio),be=Le.id.toString(),Se=k.get(be)||[];Se.push(Le),k.set(be,Se)}else{const Le=Pl(he.toString()),be=Ee.fontStack||ke,Se=j[be]=j[be]||{};this.calculateGlyphDependencies(Ee.text,Se,Be,this.allowVerticalPlacement,Le)}}}if(h.get("symbol-placement")==="line"&&(this.features=function(N){const q={},H={},oe=[];let re=0;function ae(ze){oe.push(N[ze]),re++}function he(ze,ke,Be){const Ee=H[ze];return delete H[ze],H[ke]=Ee,oe[Ee].geometry[0].pop(),oe[Ee].geometry[0]=oe[Ee].geometry[0].concat(Be[0]),Ee}function Te(ze,ke,Be){const Ee=q[ke];return delete q[ke],q[ze]=Ee,oe[Ee].geometry[0].shift(),oe[Ee].geometry[0]=Be[0].concat(oe[Ee].geometry[0]),Ee}function Oe(ze,ke,Be){const Ee=Be?ke[0][ke[0].length-1]:ke[0][0];return`${ze}:${Ee.x}:${Ee.y}`}for(let ze=0;ze<N.length;ze++){const ke=N[ze],Be=ke.geometry,Ee=ke.text?ke.text.toString():null;if(!Ee){ae(ze);continue}const Le=Oe(Ee,Be),be=Oe(Ee,Be,!0);if(Le in H&&be in q&&H[Le]!==q[be]){const Se=Te(Le,be,Be),Ue=he(Le,be,oe[Se].geometry);delete q[Le],delete H[be],H[Oe(Ee,oe[Ue].geometry,!0)]=Ue,oe[Se].geometry=null}else Le in H?he(Le,be,Be):be in q?Te(Le,be,Be):(ae(ze),q[Le]=re-1,H[be]=re-1)}return oe.filter(ze=>ze.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 N of i.elevationFeatures)this.elevationFeatureIdToIndex.set(N.id,this.elevationFeatures.length),this.elevationFeatures.push(N)}}else h.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((N,q)=>
14N.sortKey-q.sortKey)}update(e,i,s,a,u,h,f){this.text.programConfigurations.updatePaintArrays(e,i,u,s,a,h,f,this.worldview),this.icon.programConfigurations.updatePaintArrays(e,i,u,s,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 s=we(e),a=1/s;let u=!1,h=!1;for(let f=0;f<this.symbolInstances.length;f++){const _=this.symbolInstances.get(f),g=Ai(1,0,0),v=Ai(0,1,0),{numHorizontalGlyphVertices:b,numVerticalGlyphVertices:w,numIconVertices:E,numVerticalIconVertices:A}=_,P=b>0||w>0,D=E>0,k=this.elevationFeatures[_.elevationFeatureIndex];if(k){const j=new He(_.tileAnchorX,_.tileAnchorY),G=.075+k.pointElevation(j);_.zOffset!==G&&(i=!0,_.zOffset=G);const z=k.computeSlopeNormal(j,a),N=ia(_n(),Ai(0,0,1),z);ms(g,g,N),ms(v,v,N),g[2]*=s,v[2]*=s,g[0]===1&&g[1]===0&&g[2]===0&&v[0]===0&&v[1]===1&&v[2]===0||(u=u||P,h=h||D)}if(P&&(Wp(this.text.orientationVertexArray,b,g,v),Wp(this.text.orientationVertexArray,w,g,v)),D){const{placedIconSymbolIndex:j,verticalPlacedIconSymbolIndex:G}=_;j>=0&&Wp(this.icon.orientationVertexArray,E,g,v),G>=0&&Wp(this.icon.orientationVertexArray,A,g,v)}}u||(this.text.orientationVertexArray=void 0),h||(this.icon.orientationVertexArray=void 0),i&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(u,h,f)=>{s+=h,s>u.length&&u.resize(s);for(let _=-h;_<0;_++)u.emplace(_+s,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 s=0,a=0;for(let u=0;u<this.symbolInstances.length;u++){const h=this.symbolInstances.get(u),{numHorizontalGlyphVertices:f,numVerticalGlyphVertices:_,numIconVertices:g}=h,v=h.zOffset,b=g>0;if((f>0||_>0)&&(e(this.text.zOffsetVertexArray,f,v),e(this.text.zOffsetVertexArray,_,v)),b){const{placedIconSymbolIndex:w,verticalPlacedIconSymbolIndex:E}=h;w>=0&&i(this.icon.zOffsetVertexArray,g,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){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=tx(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const s=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:a,y:u}of i)this.lineVertexArray.emplaceBack(a,u);return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,i,s,a,u,h,f,_,g,v,b,w,E,A,P,D){const k=e.indexArray,j=e.layoutVertexArray,G=e.globeExtVertexArray,z=e.segments.prepareSegment(4*i.length,j,k,this.canOverlap?h.sortKey:void 0),N=this.glyphOffsetArray.length,q=z.vertexLength,H=this.allowVerticalPlacement&&f===Rn.vertical?Math.PI/2:0,oe=h.text&&h.text.sections;for(let ae=0;ae<i.length;ae++){const{tl:he,tr:Te,bl:Oe,br:ze,texPrimary:ke,texSecondary:Be,pixelOffsetTL:Ee,pixelOffsetBR:Le,minFontScaleX:be,minFontScaleY:Se,glyphOffset:Ue,isSDF:Ge,sectionIndex:_t}=i[ae],ot=z.vertexLength,Ye=Ue[1];if($p(j,g.x,g.y,he.x,Ye+he.y,ke.x,ke.y,s,Ge,Ee.x,Ee.y,be,Se),$p(j,g.x,g.y,Te.x,Ye+Te.y,ke.x+ke.w,ke.y,s,Ge,Le.x,Ee.y,be,Se),$p(j,g.x,g.y,Oe.x,Ye+Oe.y,ke.x,ke.y+ke.h,s,Ge,Ee.x,Le.y,be,Se),$p(j,g.x,g.y,ze.x,Ye+ze.y,ke.x+ke.w,ke.y+ke.h,s,Ge,Le.x,Le.y,be,Se),_){const{x:Ve,y:Pt,z:st}=_.anchor,[lt,St,Ft]=_.up;Hp(G,Ve,Pt,st,lt,St,Ft),Hp(G,Ve,Pt,st,lt,St,Ft),Hp(G,Ve,Pt,st,lt,St,Ft),Hp(G,Ve,Pt,st,lt,St,Ft),Xp(e.dynamicLayoutVertexArray,Ve,Pt,st,H)}else Xp(e.dynamicLayoutVertexArray,g.x,g.y,g.z,H);if(D){const Ve=Be||ke;Zp(e.iconTransitioningVertexArray,Ve.x,Ve.y),Zp(e.iconTransitioningVertexArray,Ve.x+Ve.w,Ve.y),Zp(e.iconTransitioningVertexArray,Ve.x,Ve.y+Ve.h),Zp(e.iconTransitioningVertexArray,Ve.x+Ve.w,Ve.y+Ve.h)}k.emplaceBack(ot,ot+1,ot+2),k.emplaceBack(ot+1,ot+2,ot+3),z.vertexLength+=4,z.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Ue[0]),ae!==i.length-1&&_t===i[ae+1].sectionIndex||e.programConfigurations.populatePaintArrays(j.length,h,h.index,{},E,A,P,oe&&oe[_t],this.worldview)}const re=_?_.anchor:g;e.placedSymbolArray.emplaceBack(re.x,re.y,re.z,g.x,g.y,N,this.glyphOffsetArray.length-N,q,v,b,g.segment,s?s[0]:0,s?s[1]:0,a[0],a[1],f,0,0,0,w,0)}_commitLayoutVertex(e,i,s,a,u,h,f){e.emplaceBack(i,s,a,u,h,Math.round(f.x),Math.round(f.y))}_addCollisionDebugVertices(e,i,s,a,u,h,f){const _=s.segments.prepareSegment(4,s.layoutVertexArray,s.indexArray),g=_.vertexLength,v=f.tileAnchorX,b=f.tileAnchorY;for(let E=0;E<4;E++)s.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(s.collisionVertexArrayExt,i,e.padding,f.zOffset),this._commitLayoutVertex(s.layoutVertexArray,a,u,h,v,b,new He(e.x1,e.y1)),this._commitLayoutVertex(s.layoutVertexArray,a,u,h,v,b,new He(e.x2,e.y1)),this._commitLayoutVertex(s.layoutVertexArray,a,u,h,v,b,new He(e.x2,e.y2)),this._commitLayoutVertex(s.layoutVertexArray,a,u,h,v,b,new He(e.x1,e.y2)),_.vertexLength+=4;const w=s.indexArray;w.emplaceBack(g,g+1),w.emplaceBack(g+1,g+2),w.emplaceBack(g+2,g+3),w.emplaceBack(g+3,g),_.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,s,a,u,h){for(let f=a;f<u;f++){const _=s.get(f),g=this.getSymbolInstanceTextSize(e,h,i,f);this._addCollisionDebugVertices(_,g,this.textCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,h)}}_addIconDebugCollisionBoxes(e,i,s,a,u,h){for(let f=a;f<u;f++){const _=s.get(f),g=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._addCollisionDebugVertices(_,g,this.iconCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,h)}}generateCollisionDebugBuffers(e,i,s){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new qm(Kc,_y.members,so
vendor: 5,101 bytes, line 14
14),this.iconCollisionBox=new qm(Kc,_y.members,so);const a=Yh(this.iconSizeData,e),u=Yh(this.textSizeData,e,s);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,s,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=km(this.textSizeData,e,u)/Lr;return this.tilePixelRatio*h}getSymbolInstanceIconSize(e,i,s){const a=this.icon.placedSymbolArray.get(s),u=km(this.iconSizeData,e,a);return this.tilePixelRatio*u}_commitDebugCollisionVertexUpdate(e,i,s,a){e.emplaceBack(i,-s,-s,a),e.emplaceBack(i,s,-s,a),e.emplaceBack(i,s,s,a),e.emplaceBack(i,-s,s,a)}_updateTextDebugCollisionBoxes(e,i,s,a,u,h,f){for(let _=a;_<u;_++){const g=s.get(_),v=this.getSymbolInstanceTextSize(e,h,i,_);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,v,g.padding,h.zOffset)}}_updateIconDebugCollisionBoxes(e,i,s,a,u,h,f){for(let _=a;_<u;_++){const g=s.get(_),v=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,v,g.padding,h.zOffset)}}updateCollisionDebugBuffers(e,i,s,a){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const u=Yh(this.iconSizeData,e,a),h=Yh(this.textSizeData,e,s);for(let f=0;f<this.symbolInstances.length;f++){const _=this.symbolInstances.get(f);this._updateTextDebugCollisionBoxes(h,e,i,_.textBoxStartIndex,_.textBoxEndIndex,_,s),this._updateTextDebugCollisionBoxes(h,e,i,_.verticalTextBoxStartIndex,_.verticalTextBoxEndIndex,_,s),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,s,a,u,h,f,_,g){const v={};if(i<s){const{x1:b,y1:w,x2:E,y2:A,padding:P,projectedAnchorX:D,projectedAnchorY:k,projectedAnchorZ:j,tileAnchorX:G,tileAnchorY:z,featureIndex:N}=e.get(i);v.textBox={x1:b,y1:w,x2:E,y2:A,padding:P,projectedAnchorX:D,projectedAnchorY:k,projectedAnchorZ:j,tileAnchorX:G,tileAnchorY:z},v.textFeatureIndex=N}if(a<u){const{x1:b,y1:w,x2:E,y2:A,padding:P,projectedAnchorX:D,projectedAnchorY:k,projectedAnchorZ:j,tileAnchorX:G,tileAnchorY:z,featureIndex:N}=e.get(a);v.verticalTextBox={x1:b,y1:w,x2:E,y2:A,padding:P,projectedAnchorX:D,projectedAnchorY:k,projectedAnchorZ:j,tileAnchorX:G,tileAnchorY:z},v.verticalTextFeatureIndex=N}if(h<f){const{x1:b,y1:w,x2:E,y2:A,padding:P,projectedAnchorX:D,projectedAnchorY:k,projectedAnchorZ:j,tileAnchorX:G,tileAnchorY:z,featureIndex:N}=e.get(h);v.iconBox={x1:b,y1:w,x2:E,y2:A,padding:P,projectedAnchorX:D,projectedAnchorY:k,projectedAnchorZ:j,tileAnchorX:G,tileAnchorY:z},v.iconFeatureIndex=N}if(_<g){const{x1:b,y1:w,x2:E,y2:A,padding:P,projectedAnchorX:D,projectedAnchorY:k,projectedAnchorZ:j,tileAnchorX:G,tileAnchorY:z,featureIndex:N}=e.get(_);v.verticalIconBox={x1:b,y1:w,x2:E,y2:A,padding:P,projectedAnchorX:D,projectedAnchorY:k,projectedAnchorZ:j,tileAnchorX:G,tileAnchorY:z},v.verticalIconFeatureIndex=N}return v}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){const s=e.placedSymbolArray.get(i),a=s.vertexStartIndex+4*s.numGlyphs;for(let u=s.vertexStartIndex;
vendor: 16,384 bytes, line 14
14u<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),s=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+s*_.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 s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===i?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const s=this.symbolInstances.get(i);this.featureSortOrder.push(s.featureIndex);const{rightJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:u,leftJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:f,placedIconSymbolIndex:_,verticalPlacedIconSymbolIndex:g}=s;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),u>=0&&u!==a&&this.addIndicesForPlacedSymbol(this.text,u),h>=0&&h!==u&&h!==a&&this.addIndicesForPlacedSymbol(this.text,h),f>=0&&this.addIndicesForPlacedSymbol(this.text,f),_>=0&&this.addIndicesForPlacedSymbol(this.icon,_),g>=0&&this.addIndicesForPlacedSymbol(this.icon,g)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let ix,rx,$m;tt(Yp,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),Yp.addDynamicAttributes=Xp;class nx{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:ca,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}}tt(nx,"FormatSectionOverride",{omit:["defaultValue"]});const Zm=()=>$m||($m={layout:ix||(ix=new rr({"symbol-placement":new Ne(pe.layout_symbol["symbol-placement"]),"symbol-spacing":new Ne(pe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ne(pe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Je(pe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ne(pe.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Ne(pe.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new Ne(pe.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new Ne(pe.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Ne(pe.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ne(pe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ne(pe.layout_symbol["icon-rotation-alignment"]),"icon-size":new Je(pe.layout_symbol["icon-size"]),"icon-size-scale-range":new Ne(pe.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Je(pe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Je(pe.layout_symbol["icon-text-fit-padding"]),"icon-image":new Je(pe.layout_symbol["icon-image"]),"icon-rotate":new Je(pe.layout_symbol["icon-rotate"]),"icon-padding":new Ne(pe.layout_symbol["icon-padding"]),"icon-keep-upright":new Ne(pe.layout_symbol["icon-keep-upright"]),"icon-offset":new Je(pe.layout_symbol["icon-offset"]),"icon-anchor":new Je(pe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ne(pe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ne(pe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ne(pe.layout_symbol["text-rotation-alignment"]),"text-field":new Je(pe.layout_symbol["text-field"]),"text-font":new Je(pe.layout_symbol["text-font"]),"text-size":new Je(pe.layout_symbol["text-size"]),"text-size-scale-range":new Ne(pe.layout_symbol["text-size-scale-range"]),"text-max-width":new Je(pe.layout_symbol["text-max-width"]),"text-line-height":new Je(pe.layout_symbol["text-line-height"]),"text-letter-spacing":new Je(pe.layout_symbol["text-letter-spacing"]),"text-justify":new Je(pe.layout_symbol["text-justify"]),"text-radial-offset":new Je(pe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ne(pe.layout_symbol["text-variable-anchor"]),"text-anchor":new Je(pe.layout_symbol["text-anchor"]),"text-max-angle":new Ne(pe.layout_symbol["text-max-angle"]),"text-writing-mode":new Ne(pe.layout_symbol["text-writing-mode"]),"text-rotate":new Je(pe.layout_symbol["text-rotate"]),"text-padding":new Ne(pe.layout_symbol["text-padding"]),"text-keep-upright":new Ne(pe.layout_symbol["text-keep-upright"]),"text-transform":new Je(pe.layout_symbol["text-transform"]),"text-offset":new Je(pe.layout_symbol["text-offset"]),"text-allow-overlap":new Ne(pe.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Ne(pe.layout_symbol["text-ignore-placement"]),"text-optional":new Ne(pe.layout_symbol["text-optional"]),visibility:new Ne(pe.layout_symbol.visibility)})),paint:rx||(rx=new rr({"icon-opacity":new Je(pe.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Je(pe.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Je(pe.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Je(pe.paint_symbol["text-emissive-strength"]),"icon-color":new Je(pe.paint_symbol["icon-color"]),"icon-halo-color":new Je(pe.paint_symbol["icon-halo-color"]),"icon-halo-width":new Je(pe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Je(pe.paint_symbol["icon-halo-blur"]),"icon-translate":new Ne(pe.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ne(pe.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Ne(pe.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Je(pe.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Je(pe.paint_symbol["text-occlusion-opacity"]),"text-color":new Je(pe.paint_symbol["text-color"],{runtimeType:vn,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Je(pe.paint_symbol["text-halo-color"]),"text-halo-width":new Je(pe.paint_symbol["text-halo-width"]),"text-halo-blur":new Je(pe.paint_symbol["text-halo-blur"]),"text-translate":new Ne(pe.paint_symbol["text-translate"]),"text-translate-anchor":new Ne(pe.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Ne(pe.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Ne(pe.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Ne(pe.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Ne(pe.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Je(pe.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},$m);class Kp extends Xr{constructor(e,i,s,a){super(e,Zm(),i,s,a),this._colorAdjustmentMatrix=Dt([]),this.hasInitialOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,i){super.recalculate(e,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const s=this.layout.get("text-writing-mode");if(s){const a=[];for(const u of s)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,s,a){return this._saturation===e&&this._contrast===i&&this._brightnessMin===s&&this._brightnessMax===a||(this._colorAdjustmentMatrix=function(u,h,f,_){u=Zr(u),h=un(h);const g=Kr(),v=u/3,b=1-2*v,w=[b,v,v,0,v,b,v,0,v,v,b,0,0,0,0,1],E=.5-.5*h,A=_-f;return zi(g,[A,0,0,0,0,A,0,0,0,0,A,0,f,f,f,1],[h,0,0,0,0,h,0,0,0,0,h,0,E,E,E,1]),zi(g,g,w),g}(e,i,s,a),this._saturation=e,this._contrast=i,this._brightnessMin=s,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,s,a){const u=this.layout.get(e).evaluate(i,{},s,a),h=this._unevaluatedLayout._values[e];return h.isDataDriven()||Uc(h.value)||!u?u:function(f,_){return _.replace(/{([^{}]+)}/g,(g,v)=>v in f?String(f[v]):"")}(i.properties,u)}createBucket(e){return new Yp(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of Zm().paint.overridableProperties){if(!Kp.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),s=new nx(i),a=new Sa(s,i.property.specification,this.scope,this.options);let u=null;u=i.value.kind==="constant"||i.value.kind==="source"?new Ml("source",a):new Cl("composite",a,i.value.zoomStops,i.value.interpolationType),this.paint._values[e]=new Ma(i.property,u,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,s){return!(!this.layout||i.isDataDriven()||s.isDataDriven())&&Kp.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const s=e.get("text-field"),a=Zm().paint.properties[i];let u=!1;const h=f=>{for(const _ of f)if(a.overrides&&a.overrides.hasOverride(_))return void(u=!0)};if(s.value.kind==="constant"&&s.value.value instanceof nn)h(s.value.value.sections);else if(s.value.kind==="source"){const f=g=>{u||(g instanceof Mt&&et(g.value)===hl?h(g.value.sections):g instanceof ha?h(g.sections):g.eachChild(f))},_=s.value;_._styleExpression&&f(_._styleExpression.expression)}return u}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,s){return{config:new Ba(this,{zoom:i,lut:s}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let sx,ox,ax,lx;var Hm=ii([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function Wm(r){switch(r){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function Xm(r){switch(r){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class Ym{constructor(e,i,s,a){this.context=e,this.format=s,this.useMipmap=a&&a.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:a&&a.premultiply})}update(e,i){const s=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,a=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:u}=this,{gl:h}=u,{x:f,y:_}=i&&i.position?i.position:{x:0,y:0},g=f+s,v=_+a;!this.size||this.size[0]===g&&this.size[1]===v||(h.bindTexture(h.TEXTURE_2D,null),h.deleteTexture(this.texture),this.texture=h.createTexture(),this.size=null),h.bindTexture(h.TEXTURE_2D,this.texture),u.pixelStoreUnpackFlipY.set(!1),u.pixelStoreUnpack.set(1),u.pixelStoreUnpackPremultiplyAlpha.set(this.format===h.RGBA8&&(!i||i.premultiply!==!1));const b=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&g>0&&v>0){const w=this.useMipmap?Math.floor(Math.log2(Math.max(g,v)))+1:1;h.texStorage2D(h.TEXTURE_2D,w,this.format,g,v),this.size=[g,v]}if(this.size)if(b)h.texSubImage2D(h.TEXTURE_2D,0,f,_,Wm(this.format),Xm(this.format),e);else{const w=e.data;w&&h.texSubImage2D(h.TEXTURE_2D,0,f,_,s,a,Wm(this.format),Xm(this.format),w)}this.useMipmap&&h.generateMipmap(h.TEXTURE_2D)}bind(e,i,s=!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&&!s?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,s,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),s!==this.wrapS&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,s),this.wrapS=s),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 Jp{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:s}=this,{gl:a}=s;a.bindTexture(a.TEXTURE_2D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}}function Qp(r,e,i,s,a,u,h,f){const _=[r,e,1,i,s,1,a,u,1],g=[h,f,1],v=sr([],_),[b,w,E]=Jo(g,g,v);return pr(_,_,[b,0,0,0,w,0,0,0,E])}function cx(r,e,i,s,a,u,h,f){const _=function(g,v,b,w,E,A,P,D){const k=Qp(0,0,1,0,1,1,0,1),j=Qp(g,v,b,w,E,A,P,D);return pr(j,j,sr([],k))}(r,e,i,s,a,u,h,f);return[_[2]/_[8]/We,_[5]/_[8]/We]}function ef(r){return[r[0],Math.min(Math.max(r[1],-85.051129),Ae)]}class ux extends Io{constructor(e,i,s,a){super(),this.id=e,this.dispatcher=s,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(a),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new Eo("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=Cu(this.map._requestManager.transformRequest(this.url,ol.Image),(s,a)=>{this._imageRequest=null,this._loaded=!0,s?this.fire(new fc(s)):a&&(this.image=a instanceof HTMLImageElement?Hn.getImageData(a):a,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}lo
vendor: 4,996 bytes, line 14
14aded(){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 Jp(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 Eo("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 Jp||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],s=e[0][1];for(const u of e)u[1]>s&&(s=u[1]),u[1]<i&&(i=u[1]);const a=(s+i)/2;if(a>Ae?this.onNorthPole=!0:a<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const u=e.map(le.fromLngLat);this.tileID=function(h){let f=1/0,_=1/0,g=-1/0,v=-1/0;for(const P of h)f=Math.min(f,P.x),_=Math.min(_,P.y),g=Math.max(g,P.x),v=Math.max(v,P.y);const b=Math.max(g-f,v-_),w=Math.max(0,Math.floor(-Math.log(b)/Math.LN2)),E=Math.pow(2,w);let A=Math.floor((f+g)/2*E);return A>1&&(A-=1),new Wl(w,A,Math.floor((_+v)/2*E))}(u),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Eo("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const k in this.tiles){const j=this.tiles[k];j.state!=="loaded"&&(j.state="loaded",j.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=Qh(new Wl(0,0,0),this.map.transform.projection),s=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(k){const j=k[1].x-k[0].x,G=k[1].y-k[0].y,z=k[2].x-k[1].x,N=k[2].y-k[1].y,q=k[3].x-k[2].x,H=k[3].y-k[2].y,oe=k[0].x-k[3].x,re=k[0].y-k[3].y,ae=j*N-z*G,he=z*H-q*N,Te=q*re-oe*H,Oe=oe*G-j*re;return ae>0&&he>0&&Te>0&&Oe>0||ae<0&&he<0&&Te<0&&Oe<0}(s))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const a=Qh(this.tileID,this.map.transform.projection),[u,h,f,_]=this.coordinates.map(k=>{const j=a.projection.project(k[0],k[1]);return Yy(a,j)._round()});this.perspectiveTransform=cx(u.x,u.y,h.x,h.y,f.x,f.y,_.x,_.y);const g=this._boundsArray=new Pa;g.emplaceBack(u.x,u.y,0,0),g.emplaceBack(h.x,h.y,We,0),g.emplaceBack(_.x,_.y,0,We),g.emplaceBack(f.x,f.y,We,We),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(g,Hm.members),this.boundsSegments=or.simpleSegment(0,0,4,2);const v=[],b=[ef((w=this.coordinates)[0]),ef(w[1]),ef(w[2]),ef(w[3])];var w;const[E,A,P,D]=function(k){let j=k[0][0],G=j,z=k[0][1],N=z;for(let q=1;q<k.length;q++)k[q][0]<j?j=k[q][0]:k[q][0]>G&&(G=k[q][0]),k[q][1]<z?z=k[q][1]:k[q][1]>N&&(N=k[q][1]);return[j,z,G-j,N-z]}(b);{const k=new Pa,[j,G,z,N]=function(Ee){let Le=Ee[0].x,be=Le,Se=Ee[0].y,Ue=Se;for(let Ge=1;Ge<Ee.length;Ge++)Ee[Ge].x<Le?Le=Ee[Ge].x:Ee[Ge].x>be&&(be=Ee[Ge].x),Ee[Ge].y<Se?Se=Ee[Ge].y:Ee[Ge].y>Ue&&(Ue=Ee[Ge].y);return[Le,Se,be-Le,Ue-Se]}(s),q=Ee=>[(Ee.x-j)/z,(Ee.y-G)/N],[H,oe,re,ae]=s.map(q),he=function(Ee,Le,be,Se,Ue,Ge,_t,ot){const Ye=Qp(0,0,1,0,1,1,0,1);return pr(Ye,Ye,sr([],Qp(Ee,Le,be,Se,Ue,Ge,_t,ot)))}(H[0],H[1],oe[0],oe[1],re[0],re[1],ae[0],ae[1]);this.elevatedGlobePerspectiveTransform=cx(H[0],H[1],oe[0],oe[1],re[0],re[1],ae[0],ae[1]);const Te=(Ee,Le)=>{v.push(Ee.lng);const be=Math.round((Ee.lng-E)/P*We),Se=Math.round((Ee.lat-A)/D*We),Ue=q(Le),Ge=Jo([],[Ue[0],Ue[1],1],he),_t=Math.round(Ge[0]/Ge[2]*We),ot=Math.round(Ge[1]/Ge[2]*We);k.emplaceBack(be,Se,_t,ot)},Oe=s[3].x-s[0].x,ze=s[3].y-s[0].y,ke=s[2].x-s[1].x,Be=s[2].y-s[1].y;for(let Ee=0;Ee<65;Ee++){const Le=Ee/64,be=[s[0].x+Le*Oe,s[0].y+Le*ze],Se=[s[1].x+Le*ke,s[1].y+Le*Be],Ue=Se[0]-be[0],Ge=Se[1]-be[1];for(let _t=0;_t<65;_t++){const ot=_t/64,Ye={x:be[0]+Ue*ot,y:be[1]+Ge*ot};Te(i.projection.unproject(Ye.x,Ye.y),Ye)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(k,Hm.members)}{this.maxLongitudeTriangleSize=0;let k=[],j=new Br;
14const G=(z,N,q)=>{j.emplaceBack(z,N,q);const H=v[z],oe=v[N],re=v[q],ae=Math.min(Math.min(H,oe),re),he=Math.max(Math.max(H,oe),re)-ae;he>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=he),k.push(ae+he/2)};for(let z=0;z<64;z++)for(let N=0;N<64;N++){const q=65*z+N,H=q+1,oe=q+65,re=oe+1;G(q,oe,H),G(H,oe,re)}[k,j]=function(z,N){const q=Array.from({length:z.length},(re,ae)=>ae);q.sort((re,ae)=>z[re]-z[ae]);const H=[],oe=new Br;for(let re=0;re<q.length;re++){const ae=q[re];H.push(z[ae]);const he=3*ae,Te=he+1;oe.emplaceBack(N.uint16[he],N.uint16[Te],N.uint16[Te+1])}return[H,oe]}(k,j),this.elevatedGlobeTrianglesCenterLongitudes=k,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(j)}this.elevatedGlobeSegments=or.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,P/We,0,D/We,0,0,A,E,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,s=i.gl;!this._dirty||this.texture instanceof Jp||(this.texture?this.texture.update(this.image):(this.texture=new Ym(i,this.image,s.RGBA8),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},i(null)):(e.state="errored",i(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const i=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!i)return null;const s=this.elevatedGlobeTrianglesCenterLongitudes;let a=(u=e+180)+360*Math.round((s[0]-u)/360);var u;const h=new or,f=(b,w)=>{h.segments.push({vertexOffset:0,primitiveOffset:b,vertexLength:i.segments[0].vertexLength,primitiveLength:w,sortKey:void 0,vaos:{}})},_=.51*this.maxLongitudeTriangleSize;if(Math.abs(s[0]-a)<=_){const b=Rr(s,0,s.length,a+_);return b===s.length||f(b,Ki(s,b+1,s.length,a+360-_)-b),h}a<s[0]&&(a+=360);const g=Ki(s,0,s.length,a-_);if(g===s.length)return f(0,s.length),h;f(0,g-0);const v=Rr(s,g+1,s.length,a+_);return v!==s.length&&f(v,s.length-v),h}}const D1=(Math.pow(256,2)-1)/16907520;class hx extends Xr{constructor(e,i,s,a){super(e,{layout:ax||(ax=new rr({visibility:new Ne(pe.layout_raster.visibility)})),paint:lx||(lx=new rr({"raster-opacity":new Ne(pe.paint_raster["raster-opacity"]),"raster-color":new Vo(pe.paint_raster["raster-color"]),"raster-color-mix":new Ne(pe.paint_raster["raster-color-mix"]),"raster-color-range":new Ne(pe.paint_raster["raster-color-range"]),"raster-hue-rotate":new Ne(pe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ne(pe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ne(pe.paint_raster["raster-brightness-max"]),"raster-saturation":new Ne(pe.paint_raster["raster-saturation"]),"raster-contrast":new Ne(pe.paint_raster["raster-contrast"]),"raster-resampling":new Ne(pe.paint_raster["raster-resampling"]),"raster-fade-duration":new Ne(pe.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new Ne(pe.paint_raster["raster-emissive-strength"]),"raster-array-band":new Ne(pe.paint_raster["raster-array-band"]),"raster-elevation":new Ne(pe.paint_raster["raster-elevation"]),"raster-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},i,s,a),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof ux&&(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())}updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[s,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(s)&&isNaN(a)||s===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=Dh({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:s,end:a}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[s,a])}}let dx,px,fx,mx,_x;class gx extends Xr{constructor(e,i,s,a){super(e,{layout:dx||(dx=new rr({visibility:new Ne(pe["layout_raster-particle"].visibility)})),paint:px||(px=new rr({"raster-particle-array-band":new Ne(pe["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new Ne(pe["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new Vo(pe["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new Ne(pe["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new Ne(pe["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new Ne(pe["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new Ne(pe["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new Ne(pe["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},i,s,a),this._updateColorRamp(),this.lastInvalidatedAt=Hn.now()}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=Dh({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}
vendor: 2,999 bytes, line 14
14_invalidateAnimationState(){this.lastInvalidatedAt=Hn.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class L1 extends Xr{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 Km(r,e,i){const s=[0,0,1],a=Bs([]);return Vs(a,a,i?-ni(r)+Math.PI:ni(r)),Ns(a,a,-ni(e)),ms(s,s,a),tr(s,s)}function yx(r,e){const i=tf(r.projection,r.zoom,r.width,r.height),s=function(u,h,f,_,g){const v=new V(f.lng-180*Za,f.lat),b=new V(f.lng+180*Za,f.lat),w=u.project(v.lng,v.lat),E=u.project(b.lng,b.lat),A=-Math.atan2(E.y-w.y,E.x-w.x),P=le.fromLngLat(f);P.y=Q(P.y,-1+Za,1-Za);const D=P.toLngLat(),k=u.project(D.lng,D.lat),j=le.fromLngLat(D);j.x+=Za;const G=j.toLngLat(),z=u.project(G.lng,G.lat),N=vx(z.x-k.x,z.y-k.y,A),q=le.fromLngLat(D);q.y+=Za;const H=q.toLngLat(),oe=u.project(H.lng,H.lat),re=vx(oe.x-k.x,oe.y-k.y,A),ae=Math.abs(N.x)/Math.abs(re.y),he=Dt([]);mn(he,he,-A*(1-(g?0:_)));const Te=Dt([]);return dr(Te,Te,[1,1-(1-ae)*_,1]),Te[4]=-re.x/re.y*_,mn(Te,Te,A),zi(Te,he,Te),Te}(r.projection,0,r.center,i,e),a=xx(r);return dr(s,s,[a,a,1]),s}function xx(r){const e=r.projection,i=tf(r.projection,r.zoom,r.width,r.height),s=Jm(e,r.center),a=Jm(e,V.convert(e.center));return Math.pow(2,s*i+(1-i)*a)}function tf(r,e,i,s,a=1/0){const u=r.range;if(!u)return 0;const h=Math.min(a,Math.max(i,s)),f=Math.log(h/1024)/Math.LN2;return ce(u[0]+f,u[1]+f,e)}const Za=1/4e4;function Jm(r,e){const i=Q(e.lat,-85.051129,Ae),s=new V(e.lng-180*Za,i),a=new V(e.lng+180*Za,i),u=r.project(s.lng,i),h=r.project(a.lng,i),f=le.fromLngLat(s),_=le.fromLngLat(a),g=h.x-u.x,v=h.y-u.y,b=_.x-f.x,w=_.y-f.y,E=Math.sqrt((b*b+w*w)/(g*g+v*v));return Math.log(E)/Math.LN2}function vx(r,e,i){const s=Math.cos(i),a=Math.sin(i);return{x:r*s-e*a,y:r*a+e*s}}function bx(r,e,i){Dt(r),mn(r,r,ni(e[2])),Dn(r,r,ni(e[0])),cn(r,r,ni(e[1])),dr(r,r,i),zi(r,r,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function rf(r,e,i,s,a,u,h,f){const _=[i[0]-e[0],i[1]-e[1],0],g=[s[0]-e[0],s[1]-e[1],0];if(Jr(_)<1e-12||Jr(g)<1e-12)return Bs(r);const v=Pr([],_,g);tr(v,v),Cr(g,s,e),_[2]=(u-a)*f,g[2]=(h-a)*f;const b=_;return Pr(b,_,g),tr(b,b),ia(r,v,b)}function Qm(r,e,i=!1){const s=Ua(e.zoom),a=function(u,h,f){const _=h.worldSize,g=[u[12],u[13],u[14]],v=fe(g[1]/_),b=ne(g[0]/_),w=Dt([]),E=ie(1,v)*_,A=ie(1,0)*_*Fe(v,h.zoom),P=1/om(_);let D=A*P;if(f){const z=tf(h.projection,h.zoom,h.width,h.height,1024);D=P*h.projection.pixelSpaceConversion(h.center.lat,_,z)}const k=R(v,b);
14xr(k,k,Xi([],tr([],k),E*D*g[2]));const j=function(z){const N=[z[0],z[1],z[2]];let q=[0,1,0];const H=Pr([],q,N);return Pr(q,N,H),Yo(q)===0&&(q=[0,1,0],Pr(H,N,q)),tr(H,H),tr(q,q),tr(N,N),[H[0],H[1],H[2],0,q[0],q[1],q[2],0,N[0],N[1],N[2],0,z[0],z[1],z[2],1]}(k);dr(w,w,[D,D,D*E]),Fr(w,w,[-g[0],-g[1],-g[2]]);const G=zi([],h.globeMatrix,j);return zi(G,G,w),zi(G,G,u),G}(r,e,i);if(s>0){const u=function(h,f){const _=f.worldSize,g=ie(1,0)*_*Fe(f.center.lat,f.zoom)/om(_),v=ie(1,f.center.lat)*_,b=Dt([]);return cn(b,b,ni(f.center.lng)),Dn(b,b,ni(f.center.lat)),Fr(b,b,[0,0,m]),dr(b,b,[g,g,g*v]),Fr(b,b,[f.point.x-.5*_,f.point.y-.5*_,0]),zi(b,b,h),zi(b,f.globeMatrix,b)}(r,e);return function(h,f,_){const g=(A,P,D)=>{const k=Jr(A),j=Jr(P),G=qo(A,P,D);return Xi(G,G,1/Jr(G)*Tt(k,j,D))},v=g([h[0],h[1],h[2]],[f[0],f[1],f[2]],_),b=g([h[4],h[5],h[6]],[f[4],f[5],f[6]],_),w=g([h[8],h[9],h[10]],[f[8],f[9],f[10]],_),E=qo([h[12],h[13],h[14]],[f[12],f[13],f[14]],_);return[v[0],v[1],v[2],0,b[0],b[1],b[2],0,w[0],w[1],w[2],0,E[0],E[1],E[2],1]}(a,u,s)}return a}function wx(r,e,i,s){const a=si.projectAabbCorners(s,i);let u=Number.MAX_VALUE,h=-1;for(let g=0;g<a.length;++g){const v=a[g];v[0]=(.5*v[0]+.5)*e.width,v[1]=(.5-.5*v[1])*e.height,v[2]<u&&(h=g,u=v[2])}const f=g=>new He(a[g][0],a[g][1]);let _;switch(h){case 0:case 6:_=[f(1),f(5),f(4),f(7),f(3),f(2),f(1)];break;case 1:case 7:_=[f(0),f(4),f(5),f(6),f(2),f(3),f(0)];break;case 3:case 5:_=[f(1),f(0),f(4),f(7),f(6),f(2),f(1)];break;default:_=[f(1),f(5),f(6),f(7),f(3),f(0),f(1)]}if(fn(r,_))return u}const F1=ii([{name:"a_pos_3f",components:3,type:"Float32"}]),k1=ii([{name:"a_color_3f",components:3,type:"Float32"}]),O1=ii([{name:"a_color_4f",components:4,type:"Float32"}]),B1=ii([{name:"a_uv_2f",components:2,type:"Float32"}]),N1=ii([{name:"a_normal_3f",components:3,type:"Float32"}]),V1=ii([{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=ii([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]),Tx={None:0,Model:1,Symbol:2,FillExtrusion:4};class nf{constructor(e,i,s,a){this.message=(e?`${e}: `:"")+s,a&&(this.identifier=a),i!=null&&i.__line__&&(this.line=i.__line__)}}function e_(r,e){const i=r.indexOf("://")===-1;try{return new URL(r,i&&e?"http://example.com":void 0),!0}catch{return!1}}class Sx{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 Ex{constructor(){this.instancedDataArray=new Fa,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class t_{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=e.styleDefinedModelURLs}updateFootprints(e,i){}populate(e,i,s,a){this.tileToMeter=we(s);const u=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:h,id:f,index:_,sourceLayerIndex:g}of e){const v=f??(h.properties&&h.properties.hasOwnProperty("id")?h.properties.id:void 0),b=Qe(h,u);if(!this.layers[0]._featureFilter.filter(new Ti(this.zoom,{worldview:this.worldview}),b,s))continue;const w={id:v,sourceLayerIndex:g,index:_,geometry:u?b.geometry:rt(h,s,a),properties:h.properties,type:h.type,patterns:{}},E=this.addFeature(w,w.geometry,b);E&&i.featureIndex.insert(h,w.geometry,_,g,this.index,this.instancesPerModel[E].instancedDataArray.length,We/32)}this.lookup=null}update(e,i,s,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 s=this.instancesPerModel[i];for(const a of s.features){const u=this.layers[0],h=a.feature,f=this.canonical,_=u.paint.get("model-rotation").evaluate(h,{},f),g=u.paint.get("model-scale").evaluate(h,{},f),v=u.paint.get("model-translation").evaluate(h,{},f);Zn(a.rotation,_)&&Zn(a.scale,g)&&Zn(a.translation,v)||(this.evaluate(a,a.featureStates,s,!0),e=!0)}}return e}updateReplacement(e,i,s,a){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const u=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(ym(this.activeReplacements,u))return!1;this.activeReplacements=u;let h=!1;for(const f in this.instancesPerModel){const _=this.instancesPerModel[f],g=_.instancedDataArray;for(const v of _.features){const b=v.instancedDataOffset,w=v.instancedDataCount;for(let E=0;E<w;E++){const A=16*(E+b);let P=g.float32[A+0];const D=P>We;P=D?P-We:P;
14const k=Math.floor(P),j=g.float32[A+1];let G=!1;for(const z of this.activeReplacements)if(!gg(z,s,Tx.Model,a)&&!(z.min.x>k||k>z.max.x||z.min.y>j||j>z.max.y)&&(G=Tg(wg(k,j,e.canonical,z.footprintTileId.canonical),z.footprint),G))break;g.float32[A]=G?P+We:P,h=h||G!==D}}}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 s=this.instancesPerModel[i];s.instancedDataArray.length<0||s.instancedDataArray.length===0||(s.instancedDataBuffer?s.instancedDataBuffer.updateData(s.instancedDataArray):s.instancedDataBuffer=e.createVertexBuffer(s.instancedDataArray,V1.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const i in this.instancesPerModel){const s=this.instancesPerModel[i];s.instancedDataArray.length!==0&&s.instancedDataBuffer&&s.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris&&this.modelsRequested)for(const i of this.modelUris)e.removeModel(i,"",!0)}addFeature(e,i,s){const a=this.layers[0],u=a.layout.get("model-id").evaluate(s,{},this.canonical);if(!u)return kt(`modelId is not evaluated for layer ${a.id} and it is not going to get rendered.`),u;(e_(u,!1)||this.styleDefinedModelURLs[u]!==void 0)&&(this.modelUris.includes(u)||this.modelUris.push(u)),this.instancesPerModel[u]||(this.instancesPerModel[u]=new Ex);const h=this.instancesPerModel[u],f=h.instancedDataArray,_=new Sx(s,f.length);for(const g of i)for(const v of g){if(v.x<0||v.x>=We||v.y<0||v.y>=We)continue;const b=(this.lookupDim-1)/We,w=this.lookupDim*(v.y*b|0)+v.x*b|0;if(this.lookup){if(this.lookup[w]!==0)continue;this.lookup[w]=1}this.instanceCount++;const E=f.length;f.resize(E+1),h.instancesEvaluatedElevation.push(0),f.float32[16*E]=v.x,f.float32[16*E+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,s,a){const u=this.layers[0],h=e.feature,f=this.canonical,_=e.rotation=u.paint.get("model-rotation").evaluate(h,i,f),g=e.scale=u.paint.get("model-scale").evaluate(h,i,f),v=e.translation=u.paint.get("model-translation").evaluate(h,i,f),b=u.paint.get("model-color").evaluate(h,i,f);b.a=u.paint.get("model-color-mix-intensity").evaluate(h,i,f);const w=[];this.maxVerticalOffset<v[2]&&(this.maxVerticalOffset=v[2]),this.maxScale=Math.max(Math.max(this.maxScale,g[0]),Math.max(g[1],g[2])),bx(w,_,g);const E=Math.round(100*b.a)+b.b/1.05;for(let A=0;A<e.instancedDataCount;++A){const P=e.instancedDataOffset+A,D=16*P,k=s.instancedDataArray.float32;let j=0;a&&(j=k[D+6]-s.instancesEvaluatedElevation[P]);const G=0|k[D+1];k[D]=(0|k[D])+b.r/1.05,k[D+1]=G+b.g/1.05,k[D+2]=E,k[D+3]=1/(f.z>10?this.tileToMeter:we(f,G)),k[D+4]=v[0],k[D+5]=v[1],k[D+6]=v[2]+j,k[D+7]=w[0],k[D+8]=w[1],k[D+9]=w[2],k[D+10]=w[4],k[D+11]=w[5],k[D+12]=w[6],k[D+13]=w[8],k[D+14]=w[9],k[D+15]=w[10],s.instancesEvaluatedElevation[P]=v[2]}}}let Ix,Ax;tt(t_,"ModelBucket",{omit:["layers"]}),tt(Ex,"PerModelAttributes"),tt(Sx,"ModelFeature");const tc=64,xu={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function Mx(r,e,i,s,a,u,h,f,_,g=!1){const v=i.zoom,b=i.project(s),w=Fe(s.lat,v),E=1/w;Dt(r),Fr(r,r,[b.x+h[0]*E,b.y+h[1]*E,h[2]]);let A=1,P=1;const D=i.worldSize;if(g){if(i.projection.name==="mercator"){let z=0;i.elevation&&(z=i.elevation.getAtPointOrZero(new le(b.x/D,b.y/D),0));const N=en([],[b.x,b.y,z,1],i.projMatrix)[3]/i.cameraToCenterDistance;A=N,P=N*Fe(i.center.lat,v)}else if(i.projection.name==="globe"){const z=Qm(r,i),N=[0,0,0,1];en(N,N,zi([],i.projMatrix,z));const q=N[3]/i.cameraToCenterDistance,H=Ua(v),oe=i.projection.pixelsPerMeter(s.lat,D)*Fe(s.lat,v),re=i.projection.pixelsPerMeter(i.center.lat,D)*Fe(i.center.lat,v);A=q/Tt(oe,Me(i.center.lat),H),P=q*w/oe,A*=re,P*=re}}else A=E;dr(r,r,[A,A,P]);const k=[...r],j=e.orientation,G=[];if(bx(G,[j[0]+a[0],j[1]+a[1],j[2]+a[2]],u),zi(r,k,G),f&&i.elevation){let z=0;const N=[];if(_&&i.elevation){z=function(H,oe,re,ae,he){const Te=oe.elevation;if(!Te)return 0;const Oe=si.projectAabbCorners(re,ae),ze=ie(1,he.lat)*oe.worldSize,ke=function(Ve,Pt){const st=[0,0,1],lt=[{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 St of lt){const Ft=Ve[St.corners[0]],Lt=Ve[St.corners[1]],$t=Ve[St.corners[2]],Bt=[Lt[0]-Ft[0],Lt[1]-Ft[1],Pt*(Lt[2]-Ft[2])],Zt=Pr(Bt,Bt,[$t[0]-Ft[0],$t[1]-Ft[1],Pt*($t[2]-Ft[2])]);tr(Zt,Zt),St.dotProductWithUp=_r(Zt,st)}return lt.sort((St,Ft)=>St.dotProductWithUp-Ft.dotProductWithUp),lt[0].corners}(Oe,ze),Be=Oe[ke[0]],Ee=Oe[ke[1]],Le=Oe[ke[2]],be=Oe[ke[3]],Se=Te.getAtPointOrZero(new le(Be[0]/oe.worldSize,Be[1]/oe.worldSize),0),Ue=Te.getAtPointOrZero(new le(Ee[0]/oe.worldSize,Ee[1]/oe.worldSize),0),Ge=Te.getAtPointOrZero(new le(Le[0]/oe.worldSize,Le[1]/oe.worldSize),0),_t=Te.getAtPointOrZero(new le(be[0]/oe.worldSize,be[1]/
vendor: 5,272 bytes, line 14
14oe.worldSize),0),ot=(Se+_t)/2,Ye=(Ue+Ge)/2;return ot>Ye?Ue<Ge?rf(H,Ee,be,Be,Ue,_t,Se,ze):rf(H,Le,Be,be,Ge,Se,_t,ze):Se<_t?rf(H,Be,Ee,Le,Se,Ue,Ge,ze):rf(H,be,Le,Ee,_t,Ge,Ue,ze),Math.max(ot,Ye)}(N,i,e.aabb,r,s);const q=zi([],ns([],N),G);zi(r,k,q)}else z=i.elevation.getAtPointOrZero(new le(b.x/D,b.y/D),0);z!==0&&(r[14]+=z)}}function nd(r,e,i=!1){r.uploaded||(r.gfxTexture=new Ym(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)}function j1(r,e,i){r.indexBuffer=e.createIndexBuffer(r.indexArray,!1,!0),r.vertexBuffer=e.createVertexBuffer(r.vertexArray,F1.members,!1,!0),r.normalArray&&(r.normalBuffer=e.createVertexBuffer(r.normalArray,N1.members,!1,!0)),r.texcoordArray&&(r.texcoordBuffer=e.createVertexBuffer(r.texcoordArray,B1.members,!1,!0)),r.colorArray&&(r.colorBuffer=e.createVertexBuffer(r.colorArray,(r.colorArray.bytesPerElement===12?k1:O1).members,!1,!0)),r.featureArray&&(r.pbrBuffer=e.createVertexBuffer(r.featureArray,U1.members,!0)),r.segments=or.simpleSegment(0,0,r.vertexArray.length,r.indexArray.length);const s=r.material;s.pbrMetallicRoughness.baseColorTexture&&nd(s.pbrMetallicRoughness.baseColorTexture,e),s.pbrMetallicRoughness.metallicRoughnessTexture&&nd(s.pbrMetallicRoughness.metallicRoughnessTexture,e),s.normalTexture&&nd(s.normalTexture,e),s.occlusionTexture&&nd(s.occlusionTexture,e,i),s.emissionTexture&&nd(s.emissionTexture,e)}function i_(r,e,i){if(r.meshes)for(const s of r.meshes)j1(s,e,i);if(r.children)for(const s of r.children)i_(s,e,i)}function sf(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)sf(e)}function r_(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)r_(i)}class vu{constructor(e,i,s){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=s}static create(e,i,s){const a=s||e.findDEMTileFor(i);if(!a||!a.dem)return;const u=a.dem,h=a.tileID,f=1<<i.canonical.z-h.canonical.z;return new vu(a,u.dim/We/f,[(i.canonical.x/f-h.canonical.x)*u.dim,(i.canonical.y/f-h.canonical.y)*u.dim])}tileCoordToPixel(e,i){const s=i*this._scale+this._offset[1],a=Math.floor(e*this._scale+this._offset[0]),u=Math.floor(s);return new He(a,u)}getElevationAt(e,i,s,a){const u=e*this._scale+this._offset[0],h=i*this._scale+this._offset[1],f=Math.floor(u),_=Math.floor(h),g=this._dem;return a=!!a,s?Tt(Tt(g.get(f,_,a),g.get(f,_+1,a),h-_),Tt(g.get(f+1,_,a),g.get(f+1,_+1,a),h-_),u-f):g.get(f,_,a)}getElevationAtPixel(e,i,s){return this._dem.get(e,i,!!s)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*ie(1,e)*this._dem.stride}}const n_=new Float32Array(262144),ic=new Uint8Array(262144);function Cx(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,Cx(i));return e}function Px(r,e,i){if(r.meshes)for(const s of r.meshes){if(s.aabb.min[0]===1/0)continue;const a=si.applyTransform(s.aabb,r.matrix);i.insert(e,a.min[0],a.min[1],a.max[0],a.max[1])}if(r.children)for(const s of r.children)Px(s,e,i)}const zx=["","wall","door","roof","window","lamp","logo"];class Rx{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:Cx(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new si([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new si([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const s of this.node.meshes)this.node.lightMeshIndex!==e&&(s.transformedAabb=si.applyTransformFast(s.aabb,this.node.matrix),i.encapsulate(s.transformedAabb)),e++;this.aabb=i}return this.aabb}}class of{constructor(e,i,s,a,u,h,f,_){this.id=s,this.layers=e,this.layerIds=this.layers.map(g=>g.fqid),this.stateDependentLayerIds=this.layers.filter(g=>g.isStateDependent()).map(g=>g.id),this.modelTraits|=xu.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,a&&(this.modelTraits|=xu.HasMapbox
14MeshFeatures),u&&(this.modelTraits|=xu.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=h,this.worldview=_,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const g of i)this.nodesInfo.push(new Rx(g)),Px(g,f.featureIndexArray.length,f.grid),f.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,f.bucketLayerIDs.length-1,0);this.states={}}updateFootprints(e,i){for(const s of this.getNodesInfo()){const a=s.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}update(e){const i=Object.keys(e).length!==0;if(i&&!this.stateDependentLayers.length)return;const s=i?this.stateDependentLayers:this.layers;if(!gs(e,this.states))for(const a of s)this.evaluate(a,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const s of i){const a=s.node;this.uploaded?this.updatePbrBuffer(a):i_(a,e,!0)}for(const s of i)sf(s.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const s of e.meshes)s.pbrBuffer&&(s.pbrBuffer.updateData(s.featureArray),i=!0);return i}needsReEvaluation(e,i,s){const a=e.transform.projectionOptions,u=e.style.getBrightness(),h=this.brightness!==u;if(!this.uploaded||this.dirty||a.name!==this.projection.name||sd(s.paint.get("model-color").value,h)||sd(s.paint.get("model-color-mix-intensity").value,h)||sd(s.paint.get("model-roughness").value,h)||sd(s.paint.get("model-emissive-strength").value,h)||sd(s.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 s=this.getNodesInfo(),a=this.id.canonical;for(const u of s){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 s=this.getNodesInfo();for(const a of s){if(!a.node.meshes)continue;const u=a.feature,h=i&&i[u.id];if(gs(h,a.state))continue;a.state=structuredClone(h);const f=a.node.meshes&&a.node.meshes[0].featureData,_=a.evaluatedColor[2],g=a.evaluatedRMEA[2],v=this.id.canonical;if(a.hasTranslucentParts=!1,f){for(let b=0;b<zx.length;b++){const w=zx[b];w.length&&(u.properties.part=w);const E=e.paint.get("model-color").evaluate(u,h,v).toPremultipliedRenderColor(null),A=e.paint.get("model-color-mix-intensity").evaluate(u,h,v);a.evaluatedColor[b]=[E.r,E.g,E.b,A],a.evaluatedRMEA[b][0]=e.paint.get("model-roughness").evaluate(u,h,v),a.evaluatedRMEA[b][2]=e.paint.get("model-emissive-strength").evaluate(u,h,v),a.evaluatedRMEA[b][3]=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,q1(a,_!==a.evaluatedColor[2]||g!==a.evaluatedRMEA[2],this.modelTraits)}else a.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(u,h,v);a.evaluatedTranslation=e.paint.get("model-translation").evaluate(u,h,v),a.evaluatedScale=e.paint.get("model-scale").evaluate(u,h,v),this.updatePbrBuffer(a.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,s,a){const u=e.findDEMTileFor(s);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=vu.create(e,s,u);if(!h)return;this.modelTraits&xu.HasMapboxMeshFeatures&&this.updateDEM(e,h,s,a);for(const f of this.getNodesInfo()){const _=f.node;if(!_.footprint||!_.footprint.vertices||!_.footprint.vertices.length)continue;const g=_.footprint.vertices;let v=h.getElevationAt(g[0].x,g[0].y,!0,!0);for(let b=1;b<g.length;b++)v=Math.min(v,h.getElevationAt(g[b].x,g[b].y,!0,!0));_.elevation=v}}this.terrainTile=u.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,s,a){let u=i._dem._modifiedForSources[a];if(u===void 0&&(i._dem._modifiedForSources[a]=[],u=i._dem._modifiedForSources[a]),u.includes(s.canonical))return;const h=i._dem.dim;u.push(s.canonical);let f=!1;for(const _ of this.getNodesInfo()){const g=_.node;if(!g.footprint||!g.footprint.grid)continue;const v=g.footprint.grid,b=i.tileCoordToPixel(v.min.x,v.min.y),w=i.tileCoordToPixel(v.max.x,v.max.y),E=Math.min(Math.min(h-w.y,b.x),Math.min(b.y,h-w.x));if(E<0)continue;const A=Q(E,2,5);let P=Math.max(0,b.x-A),D=Math.max(0,b.y-A),k=Math.min(w.x+A,h-1),j=Math.min(w.y+A,h-1);for(let q=D;q<=j;++q)for(let H=P;H<=k;++H)ic[q*h+H]=255;let G=0,z=0;for(let q=0;q<v.cellsY;++q)for(let H=0;H<v.cellsX;++H){if(!v.cells[q*v.cellsX+H])continue;const oe=i.tileCoordToPixel(v.min.x+H/v.xScale,v.min.y+q/v.yScale),re=i.tileCoordToPixel(v.min.x+(H+1)/v.xScale,v.min.y+(q+1)/v.yScale);for(let ae=oe.y;ae<=Math.min(re.y+1,h-1);++ae)for(let he=oe.x;he<=Math.min(re.x+1,h-1);++he)ic[ae*h+he]===255&&(ic[ae*h+he]=0,G+=i.getElevationAtPixel(he,ae),z++)}const N=G/z;P=Math.max(1,b.x-A),D=Math.max(1,b.y-A),k=Math.min(w.x+A,h-2),j=Math.min(w.y+A,h-2),f=!0;for(let q=D;q<=j;++q)for(let H=P;H<=k;++H)ic[q*h+H]===0&&(n_[q*h+H]=i._dem.set(H,q,N));for(let q=1;q<A;++q){P=Math.max(1,b.x-q),D=Math.max(1,b.y-q),k=Math.min(w.x+q,h-2),j=Math.min(w.y+q,h-2);for(let H=D;H<=j;++H)for(let oe=P;oe<=k;++oe){const re=H*h+oe;if(ic[re]===255){let ae=0,he=0,Te=-1,Oe=-1;for(let ze=-1;ze<=1;++ze)for(let ke=-1;ke<=1;++ke){const Be=(H+ze)*h+oe+ke;if(ic[Be]>=q)continue;const Ee=n_[Be],Le=Math.abs(Ee);Le>he&&(ae=Ee,he=Le,Te=ke,Oe=ze)}if(he>.1){const ze=1-(q+.5*Math.abs(Te*Oe))/A;let ke=i._dem.get(oe,H)+ae*ze;const Be=i._dem.get(oe+Te,H+Oe),Ee=i._dem.get(oe-Te,H-Oe,!0);(ke-Be)*(ke-Ee)>0&&(ke=(Be+Ee)/2),n_[re]=i._dem.set(oe,H,ke),ic[re]=q}}}}}f&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=Hn.now())}setFilter(e){this.filter=e?hh(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new Ti(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)sf(i.node),r_(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const s=i.getReplacementRegionsForTile(e.toUnwrapped());for(const a of this.getNodesInfo()){const u=a.node.footprint;a.hiddenByReplacement=!!u&&!s.find(h=>h.footprint===u)}}getHeightAtTileCoord(e,i){const s=[],a=[0,0,0],u=Dt([]);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]};Tr(u,h.node.matrix),a[0]=e,a[1]=i,Gi(a,a,u);const g=(a[0]-f.aabb.min[0])/(f.aabb.max[0]-f.aabb.min[0])*tc|0,v=Math.min(63,(a[1]-f.aabb.min[1])/(f.aabb.max[1]-f.aabb.min[1])*tc|0)*tc+Math.min(63,g),b=f.heightmap[v];if(!(b<0&&h.node.footprint))return h.hiddenByReplacement?void 0:{height:b,maxHeight:h.feature.properties.height,hidden:!1,verticalScale:h.evaluatedScale[2]};if(h.node.footprint.grid.query(new He(e,i),new He(e,i),s),s.length>0)return{height:void 0,maxHeight:h.feature.properties.height,hidden:h.hiddenByReplacement,verticalScale:h.evaluatedScale[2]}}}}function sd(r,e){return r instanceof Ml&&!r.isLightConstant&&e}function G1(r,e,i,s,a,u,h,f){let _=(61440&e|(61440&e)>>4)>>8,g=(3840&e|(3840&e)>>4)>>4,v=240&e|(240&e)>>4;i[3]>0&&(_=Tt(_,255*i[0],i[3]),g=Tt(g,255*i[1],i[3]),v=Tt(v,255*i[2],i[3]));const b=_<<8|g,w=v<<8|Math.floor(255*s[3]),E=function(q){const H=Q(q,0,2);return Math.min(Math.round(.5*H*255),255)}(s[2])<<8|15*s[0]<<4|15*s[1],A=Q(a[0],0,1),P=Q(a[1],0,1),D=Q(a[2],0,1),k=Q(a[3],0,1);let j,G,z,N;if(A!==P&&h!==u&&P!==A){const q=h-u;G=1/(q*(P-A)),z=-(u+q*A)/(q*(P-A));const H=Q(a[4],-1,1);N=Math.pow(10,H),j=255*D<<8|255*k}else j=65535,G=0,z=1,N=1;if(r.emplaceBack(b,w,E,j,G,z,N),f){const q=f.length;f.clear();for(let H=0;H<q;H++)f.emplaceBack(b,w,E,j,G,z,N)}}function q1(r,e,i){const s=r.node;let a=0;const u=i&xu.HasMeshoptCompression;for(const h of s.meshes){if(s.lights&&s.lightMeshIndex===a||!h.featureData)continue;h.featureArray=new Vl,h.featureArray.reserve(h.featureData.length);let f=e;for(const _ of h.featureData){const g=u?65535&_:_>>16&65535,v=u?_>>16&65535:65535&_,b=(15&v)<8?15&v:0,w=r.evaluatedRMEA[b],E=r.evaluatedColor[b],A=r.emissionHeightBasedParams[b];let P;if(f&&b===2&&s.lights&&(P=new Vl,P.resize(10*s.lights.length)),G1(h.featureArray,g,E,w,A,h.aabb.min[2],h.aabb.max[2],P),P&&f){f=!1;const D=s.meshes[s.lightMeshIndex];D.featureArray=P,D.featureArray._trim()}}h.featureArray._trim(),a++}}function Dx(r,e,i,s){const a=1<<r.z;e.lat=fe((s/We+r.y)/a),e.lng=ne((i/We+r.x)/a)}function $1(r,e,i,s){const a=r.getNodesInfo()[e];
vendor: 17,846 bytes, line 14
14if(!a||a.hiddenByReplacement||!a.node.meshes)return;let u=Number.MAX_VALUE;const h=a.node,f=i.tile,_=s.calculatePosMatrix(f.tileID.toUnwrapped(),s.worldSize),g=a.evaluatedScale;let v=0;s.elevation&&h.elevation&&(v=h.elevation*s.elevation.exaggeration()),Fr(_,_,[(h.anchor?h.anchor[0]:0)*(g[0]-1),(h.anchor?h.anchor[1]:0)*(g[1]-1),v]),dr(_,_,g);const b=i.queryGeometry,w=b.isPointQuery()?b.screenBounds:b.screenGeometry,E=function(P){const D=zi([],_,P.matrix);zi(D,s.expandedFarZProjMatrix,D);for(let k=0;k<P.meshes.length;++k){const j=P.meshes[k];if(k===P.lightMeshIndex)continue;const G=wx(w,s,D,j.aabb);G!=null&&(u=Math.min(G,u))}if(P.children)for(const k of P.children)E(k)};if(E(h),u===Number.MAX_VALUE)return;const A=new V(0,0);return Dx(f.tileID.canonical,A,a.node.anchor[0],a.node.anchor[1]),{intersectionZ:u,position:A,feature:a.feature}}tt(of,"Tiled3dModelBucket",{omit:["layers"]}),tt(Rx,"Tiled3dModelFeature");const Z1={circle:class extends Xr{constructor(r,e,i,s){super(r,{layout:z_||(z_=new rr({"circle-sort-key":new Je(pe.layout_circle["circle-sort-key"]),"circle-elevation-reference":new Ne(pe.layout_circle["circle-elevation-reference"]),visibility:new Ne(pe.layout_circle.visibility)})),paint:R_||(R_=new rr({"circle-radius":new Je(pe.paint_circle["circle-radius"]),"circle-color":new Je(pe.paint_circle["circle-color"]),"circle-blur":new Je(pe.paint_circle["circle-blur"]),"circle-opacity":new Je(pe.paint_circle["circle-opacity"]),"circle-translate":new Ne(pe.paint_circle["circle-translate"]),"circle-translate-anchor":new Ne(pe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ne(pe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ne(pe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Je(pe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Je(pe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Je(pe.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new Ne(pe.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}createBucket(r){return new jn(r)}queryRadius(r){const e=r;return lu("circle-radius",this,e)+lu("circle-stroke-width",this,e)+gp(this.paint.get("circle-translate"))}queryIntersectsFeature(r,e,i,s,a,u,h,f){const _=P_(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),g=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return $_(r,s,u,h,f,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",_,g)}getProgramIds(){return["circle"]}getDefaultProgramParams(r,e,i){const s=q_(this);return{config:new Ba(this,{zoom:e,lut:i}),defines:s,overrideFog:!1}}is3D(r){return!r&&!!this.layout&&this.layout.get("circle-elevation-reference")!=="none"}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}},heatmap:class extends Xr{createBucket(r){return new H_(r)}constructor(r,e,i,s){super(r,{layout:W_||(W_=new rr({visibility:new Ne(pe.layout_heatmap.visibility)})),paint:X_||(X_=new rr({"heatmap-radius":new Je(pe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Je(pe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ne(pe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Vo(pe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ne(pe.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Dh({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(r){return lu("heatmap-radius",this,r)}queryIntersectsFeature(r,e,i,s,a,u,h,f){const _=this.paint.get("heatmap-radius").evaluate(e,i);return $_(r,s,u,h,f,!0,!0,new He(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 Ba(this,{zoom:e,lut:i}),overrideFog:!1}:{}}},hillshade:class extends Xr{constructor(r,e,i,s){super(r,{layout:Y_||(Y_=new rr({visibility:new Ne(pe.layout_hillshade.visibility)})),paint:K_||(K_=new rr({"hillshade-illumination-direction":new Ne(pe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ne(pe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ne(pe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ne(pe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ne(pe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ne(pe.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new Ne(pe.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}shouldRedrape(){return this.hasOffscreenPass()&&this.paint.get("hillshade-illumination-anchor")==="viewport"}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}},fill:class extends Xr{constructor(r,e,i,s){super(r,{layout:dg||(dg=new rr({"fill-sort-key":new Je(pe.layout_fill["fill-sort-key"]),visibility:new Ne(pe.layout_fill.visibility),"fill-elevation-reference":new Ne(pe.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new Je(pe.layout_fill["fill-construct-bridge-guard-rail"])})),paint:pg||(pg=new rr({"fill-antialias":new Ne(pe.paint_fill["fill-antialias"]),"fill-opacity":new Je(pe.paint_fill["fill-opacity"]),"fill-color":new Je(pe.paint_fill["fill-color"]),"fill-outline-color":new Je(pe.paint_fill["fill-outline-color"]),"fill-translate":new Ne(pe.paint_fill["fill-translate"]),"fill-translate-anchor":new Ne(pe.paint_fill["fill-translate-anchor"]),"fill-pattern":new Je(pe.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new Ne(pe.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new Ne(pe.paint_fill["fill-emissive-strength"]),"fill-z-offset":new Je(pe.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new Je(pe.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new Je(pe.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}getProgramIds(){const r=this.paint.get("fill-pattern"),e=r&&r.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(r,e,i){return{config:new Ba(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 mm(r)}queryRadius(){return gp(this.paint.get("fill-translate"))}queryIntersectsFeature(r,e,i,s,a,u){return!r.queryGeometry.isAboveHorizon&&es(C_(r.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),s)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(r){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const e=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return r!=null?e&&!r:e}hasElevation(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends Xr{constructor(r,e,i,s){super(r,{layout:Bg||(Bg=new rr({visibility:new Ne(pe["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new Ne(pe["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:Ng||(Ng=new rr({"fill-extrusion-opacity":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Je(pe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Je(pe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new Je(pe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Je(pe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new Je(pe["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new Je(pe["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new Je(pe["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new Je(pe["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new Ne(pe["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new Pp(r)}queryRadius(){return gp(this.paint.get("fill-extrusion-translate"))}is3D(r){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(r,e,i,s,a,u,h,f,_){const g=P_(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),v=this.paint.get("fill-extrusion-height").evaluate(e,i),b=this.paint.get("fill-extrusion-base").evaluate(e,i),w=[0,0],E=f&&u.elevation,A=u.elevation?u.elevation.exaggeration():1,P=r.tile.getBucket(this);if(E&&P instanceof Pp){const z=P.centroidVertexArray,N=_+1;N<z.length&&(w[0]=z.geta_centroid_pos0(N),w[1]=z.geta_centroid_pos1(N))}if(w[0]===0&&w[1]===1)return!1;u.projection.name==="globe"&&(s=Og([s],[new He(0,0),new He(We,We)],r.tileID.canonical).map(z=>z.polygon).flat());const D=E?f:null,[k,j]=function(z,N,q,H,oe,re,ae,he,Te,Oe,ze){return z.projection.name==="globe"?function(ke,Be,Ee,Le,be,Se,Ue,Ge,_t,ot,Ye){const Ve=[],Pt=[],st=ke.projection.upVectorScale(Ye,ke.center.lat,ke.worldSize).metersToTile,lt=[0,0,0,1],St=[0,0,0,1],Ft=($t,Bt,Zt,fi)=>{$t[0]=Bt,$t[1]=Zt,$t[2]=fi,$t[3]=1},Lt=kg();Ee>0&&(Ee+=Lt),Le+=Lt;for(const $t of Be){const Bt=[],Zt=[];for(const fi of $t){const Li=fi.x+be.x,$=fi.y+be.y,W=ke.projection.projectTilePoint(Li,$,Ye),Ie=ke.projection.upVector(Ye,fi.x,fi.y);let $e=Ee,Ke=Le;if(Ue){const Xe=$g(Li,$,Ee,Le,Ue,Ge,_t,ot);$e+=Xe.base,Ke+=Xe.top}Ee!==0?Ft(lt,W.x+Ie[0]*st*$e,W.y+Ie[1]*st*$e,W.z+Ie[2]*st*$e):Ft(lt,W.x,W.y,W.z),Ft(St,W.x+Ie[0]*st*Ke,W.y+Ie[1]*st*Ke,W.z+Ie[2]*st*Ke),Gi(lt,lt,Se),Gi(St,St,Se),Bt.push(new Kl(lt[0],lt[1],lt[2])),Zt.push(new Kl(St[0],St[1],St[2]))}Ve.push(Bt),Pt.push(Zt)}return[Ve,Pt]}(z,N,q,H,oe,re,ae,he,Te,Oe,ze):ae?function(ke,Be,Ee,Le,be,Se,Ue,Ge,_t){const ot=[],Ye=[],Ve=[0,0,0,1];for(const Pt of ke){const st=[],lt=[];for(const St of Pt){const Ft=St.x+Le.x,Lt=St.y+Le.y,$t=$g(Ft,Lt,Be,Ee,Se,Ue,Ge,_t);Ve[0]=Ft,Ve[1]=Lt,Ve[2]=$t.base,Ve[3]=1,en(Ve,Ve,be),Ve[3]=Math.max(Ve[3],1e-5);const Bt=new Kl(Ve[0]/Ve[3],Ve[1]/Ve[3],Ve[2]/Ve[3]);Ve[0]=Ft,Ve[1]=Lt,Ve[2]=$t.top,Ve[3]=1,en(Ve,Ve,be),Ve[3]=Math.max(Ve[3],1e-5);const Zt=new Kl(Ve[0]/Ve[3],Ve[1]/Ve[3],Ve[2]/Ve[3]);st.push(Bt),lt.push(Zt)}ot.push(st),Ye.push(lt)}return[ot,Ye]}(N,q,H,oe,re,ae,he,Te,Oe):function(ke,Be,Ee,Le,be){const Se=[],Ue=[],Ge=be[8]*Be,_t=be[9]*Be,ot=be[10]*Be,Ye=be[11]*Be,Ve=be[8]*Ee,Pt=be[9]*Ee,st=be[10]*Ee,lt=be[11]*Ee;for(const St of ke){const Ft=[],Lt=[];for(const $t of St){const Bt=$t.x+Le.x,Zt=$t.y+Le.y,fi=be[0]*Bt+be[4]*Zt+be[12],Li=be[1]*Bt+be[5]*Zt+be[13],$=be[2]*Bt+be[6]*Zt+be[14],W=be[3]*Bt+be[7]*Zt+be[15],Ie=fi+Ge,$e=Li+_t,Ke=$+ot,Xe=Math.max(W+Ye,1e-5),nt=fi+Ve,wt=Li+Pt,Xt=$+st,Yt=Math.max(W+lt,1e-5);Ft.push(new Kl(Ie/Xe,$e/Xe,Ke/Xe)),Lt.push(new Kl(nt/Yt,wt/Yt,Xt/Yt))}Se.push(Ft),Ue.push(Lt)}return[Se,Ue]}(N,q,H,oe,re)}(u,s,b,v,g,h,D,w,A,u.center.lat,r.tileID.canonical),G=r.queryGeometry;return function(z,N,q){let H=1/0;es(q,N)&&(H=qg(q,N[0]));for(let oe=0;oe<N.length;oe++){const re=N[oe],ae=z[oe];for(let he=0;he<re.length-1;he++){const Te=re[he],Oe=[Te,re[he+1],ae[he+1],ae[he],Te];fn(q,Oe)&&(H=Math.min(H,qg(q,Oe)))}}return H!==1/0&&H}(k,j,G.isPointQuery()?G.screenBounds:G.screenGeometry)}},building:class extends Xr{constructor(r,e,i,s){super(r,{layout:ry||(ry=new rr({visibility:new Ne(pe.layout_building.visibility),"building-roof-shape":new Je(pe.layout_building["building-roof-shape"]),"building-height":new Je(pe.layout_building["building-height"]),"building-base":new Je(pe.layout_building["building-base"])})),paint:ny||(ny=new rr({"building-opacity":new Ne(pe.paint_building["building-opacity"]),"building-ambient-occlusion-wall-intensity":new Ne(pe.paint_building["building-ambient-occlusion-wall-intensity"]),"building-ambient-occlusion-ground-intensity":new Ne(pe.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new Ne(pe.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new Ne(pe.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new Ne(pe.paint_building["building-vertical-scale"]),"building-cast-shadows":new Ne(pe.paint_building["building-cast-shadows"]),"building-color":new Je(pe.paint_building["building-color"]),"building-emissive-strength":new Je(pe.paint_building["building-emissive-strength"]),"building-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new iy(r)}},line:class extends Xr{constructor(r,e,i,s){const a=fy();super(r,a,e,i,s),a.layout&&(this.layout=new No(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 bl,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(r,e){super.recalculate(r,e),this.paint._values["line-floorwidth"]=(()=>
14{if(Hh)return Hh;const i=fy();return Hh=new G0(i.paint.properties["line-width"].specification),Hh.useIntegerZoom=!0,Hh})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new Mm(r)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(r,e,i){const s=dy(this);return{config:new Ba(this,{zoom:e,lut:i}),defines:s,overrideFog:!1}}queryRadius(r){const e=r,i=my(lu("line-width",this,e),lu("line-gap-width",this,e)),s=lu("line-offset",this,e);return i/2+Math.abs(s)+gp(this.paint.get("line-translate"))}queryIntersectsFeature(r,e,i,s,a,u){if(r.queryGeometry.isAboveHorizon)return!1;const h=C_(r.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),f=r.pixelToTileUnitsFactor/2*my(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),_=this.paint.get("line-offset").evaluate(e,i);return _&&(s=function(g,v){const b=[],w=new He(0,0);for(let E=0;E<g.length;E++){const A=g[E],P=[];for(let D=0;D<A.length;D++){const k=A[D],j=A[D+1],G=D===0?w:k.sub(A[D-1])._unit()._perp(),z=D===A.length-1?w:j.sub(k)._unit()._perp(),N=G._add(z)._unit();N._mult(1/(N.x*z.x+N.y*z.y)),P.push(N._mult(v)._add(k))}b.push(P)}return b}(s,_*r.pixelToTileUnitsFactor)),function(g,v,b){for(let w=0;w<v.length;w++){const E=v[w];if(g.length>=3){for(let A=0;A<E.length;A++)if(hs(g,E[A]))return!0}if(lo(g,E,b))return!0}return!1}(h,s,f)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(r){return!this.hasElevatedBuckets}hasElevation(){return this.layout&&this.layout.get("line-elevation-reference")!=="none"}},symbol:Kp,background:class extends Xr{constructor(r,e,i,s){super(r,{layout:sx||(sx=new rr({visibility:new Ne(pe.layout_background.visibility)})),paint:ox||(ox=new rr({"background-pitch-alignment":new Ne(pe.paint_background["background-pitch-alignment"]),"background-color":new Ne(pe.paint_background["background-color"]),"background-pattern":new Ne(pe.paint_background["background-pattern"]),"background-opacity":new Ne(pe.paint_background["background-opacity"]),"background-emissive-strength":new Ne(pe.paint_background["background-emissive-strength"]),"background-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}is3D(r){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:hx,"raster-particle":gx,sky:class extends Xr{constructor(r,e,i,s){super(r,{layout:fx||(fx=new rr({visibility:new Ne(pe.layout_sky.visibility)})),paint:mx||(mx=new rr({"sky-type":new Ne(pe.paint_sky["sky-type"]),"sky-atmosphere-sun":new Ne(pe.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Ne(pe.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Ne(pe.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Ne(pe.paint_sky["sky-gradient-radius"]),"sky-gradient":new Vo(pe.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Ne(pe.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Ne(pe.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Ne(pe.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="sky-gradient"?this._updateColorRamp():r!=="sky-atmosphere-sun"&&r!=="sky-atmosphere-halo-color"&&r!=="sky-atmosphere-color"&&r!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Dh({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}
14needsSkyboxCapture(r){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=r.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(r,e){if(this.paint.get("sky-type")==="atmosphere"){const s=this.paint.get("sky-atmosphere-sun"),a=!s,u=r.style.light,h=u.properties.get("position");return a&&u.properties.get("anchor")==="viewport"&&kt("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?Km(h.azimuthal,90-h.polar,e):Km(s[0],90-s[1],e)}const i=this.paint.get("sky-gradient-center");return Km(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 Xr{constructor(r,e,i,s){super(r,{paint:_x||(_x=new rr({}))},e,null)}},model:class extends Xr{constructor(r,e,i,s){super(r,{layout:Ix||(Ix=new rr({visibility:new Ne(pe.layout_model.visibility),"model-id":new Je(pe.layout_model["model-id"])})),paint:Ax||(Ax=new rr({"model-opacity":new Je(pe.paint_model["model-opacity"]),"model-rotation":new Je(pe.paint_model["model-rotation"]),"model-scale":new Je(pe.paint_model["model-scale"]),"model-translation":new Je(pe.paint_model["model-translation"]),"model-color":new Je(pe.paint_model["model-color"]),"model-color-mix-intensity":new Je(pe.paint_model["model-color-mix-intensity"]),"model-type":new Ne(pe.paint_model["model-type"]),"model-cast-shadows":new Ne(pe.paint_model["model-cast-shadows"]),"model-receive-shadows":new Ne(pe.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new Ne(pe.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new Je(pe.paint_model["model-emissive-strength"]),"model-roughness":new Je(pe.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new Je(pe.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new Ne(pe.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new Ne(pe.paint_model["model-front-cutoff"]),"model-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new t_(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 of?We-1:0}queryIntersectsFeature(r,e,i,s,a,u){if(!this.modelManager)return!1;const h=this.modelManager,f=r.tile.getBucket(this);if(!(f&&f instanceof t_))return!1;for(const _ in f.instancesPerModel){const g=f.instancesPerModel[_],v=e.id!==void 0?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(g.idToFeaturesIndex.hasOwnProperty(v)){const b=g.features[g.idToFeaturesIndex[v]],w=h.getModel(_,this.scope);if(!w)return!1;let E=Kr();const A=new V(0,0),P=f.canonical;let D=Number.MAX_VALUE;for(let k=0;k<b.instancedDataCount;++k){const j=16*(b.instancedDataOffset+k),G=g.instancedDataArray.float32,z=[G[j+4],G[j+5],G[j+6]];Dx(P,A,G[j],0|G[j+1]),Mx(E,w,u,A,b.rotation,b.scale,z,!1,!1,!1),u.projection.name==="globe"&&(E=Qm(E,u));const N=zi([],u.projMatrix,E),q=r.queryGeometry,H=wx(q.isPointQuery()?q.screenBounds:q.screenGeometry,u,N,w.aabb);H!=null&&(D=Math.min(H,D))}return D!==Number.MAX_VALUE&&D}}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 Cl}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends Xr{constructor(r,e,i,s){super(r,{layout:fg||(fg=new rr({"clip-layer-types":ne
14w Ne(pe.layout_clip["clip-layer-types"]),"clip-layer-scope":new Ne(pe.layout_clip["clip-layer-scope"])})),paint:mg||(mg=new rr({}))},e,i,s)}recalculate(r,e){super.recalculate(r,e)}createBucket(r){return new _g(r)}is3D(r){return!0}}},s_=new hi(0,0,0),o_={PATH_RULE_NON_ZERO:1,PATH_RULE_EVEN_ODD:2},a_={LINE_CAP_BUTT:1,LINE_CAP_ROUND:2,LINE_CAP_SQUARE:3},af={LINE_JOIN_MITER:1,LINE_JOIN_MITER_CLIP:2,LINE_JOIN_ROUND:3,LINE_JOIN_BEVEL:4},H1={PAINT_ORDER_FILL_AND_STROKE:1},od={PATH_COMMAND_MOVE:1,PATH_COMMAND_LINE:2,PATH_COMMAND_QUAD:3,PATH_COMMAND_CUBIC:4,PATH_COMMAND_CLOSE:5},Lx={MASK_TYPE_LUMINANCE:1};function W1(r,e,i){r===1&&e.icons.push(function(s,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.top==null&&(f.top=f.left),f.width==null&&(f.width=u.usvg_tree.width),f.height==null&&(f.height=f.width)}return h.stretch_x&&h.stretch_x.length&&Fx(h,"x"),h.stretch_y&&h.stretch_y.length&&Fx(h,"y"),u}(s.readFields(X1,{name:void 0},a))}(i,i.readVarint()+i.pos))}function Fx(r,e){const i=[],s=r[`stretch_${e}`];let a=null;for(let u=0;u<s.length;u++)a===null?a=i.length===0?s[0]:i[i.length-1][1]+s[u]:(i.push([a,a+s[u]]),a=null);r[`stretch_${e}_areas`]=i}function X1(r,e,i){r===1?e.name=i.readString():r===2?e.metadata=function(s,a){return s.readFields(Y1,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},a)}(i,i.readVarint()+i.pos):r===3&&(e.usvg_tree=function(s,a){return s.readFields(Q1,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},a)}(i,i.readVarint()+i.pos),e.data="usvg_tree")}function Y1(r,e,i){r===1?e.stretch_x=i.readPackedVarint():r===2?e.stretch_y=i.readPackedVarint():r===3?e.content_area=function(s,a){return s.readFields(K1,{left:0},a)}(i,i.readVarint()+i.pos):r===4&&e.variables.push(function(s,a){return s.readFields(J1,{name:void 0},a)}(i,i.readVarint()+i.pos))}function K1(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 J1(r,e,i){r===1?e.name=i.readString():r===2&&(e.rgb_color=uf(i.readVarint()),e.value="rgb_color")}function Q1(r,e,i){r===1?e.width=e.height=i.readVarint():r===2?e.height=i.readVarint():r===3?e.children.push(lf(i,i.readVarint()+i.pos)):r===4?e.linear_gradients.push(function(s,a){return s.readFields(ob,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},a)}(i,i.readVarint()+i.pos)):r===5?e.radial_gradients.push(function(s,a){return s.readFields(lb,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},a)}(i,i.readVarint()+i.pos)):r===7?e.clip_paths.push(function(s,a){return s.readFields(cb,{children:[]},a)}(i,i.readVarint()+i.pos)):r===8&&e.masks.push(function(s,a){const u=s.readFields(ub,{left:0,width:20,mask_type:Lx.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 lf(r,e){return r.readFields(eb,{},e)}function eb(r,e,i){r===1?(e.group=function(s,a){return s.readFields(tb,{opacity:255,children:[]},a)}(i,i.readVarint()+i.pos),e.node="group"):r===2&&(e.path=function(s,a){return s.readFields(rb,{paint_order:1,commands:[],step:1,diffs:[],rule:o_.PATH_RULE_NON_ZERO},a)}(i,i.readVarint()+i.pos),e.node="path")}function tb(r,e,i){r===1?e.transform=cf(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(lf(i,i.readVarint()+i.pos))}function cf(r,e){return r.readFields(ib,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},e)}function ib(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 rb(r,e,i){r===1?e.fill=function(s,a){return s.readFields(nb,{rgb_color:s_,paint:"rgb_color",opacity:255},a)}(i,i.readVarint()+i.pos):r===2?e.stroke=function(s,a){return s.readFields(sb,{rgb_color:s_,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},a)}(i,i.readVarint()+i.pos):r===3?e.paint_order=i.readVarint():r===5?i.readPackedVarint(e.commands):r===6?e.
14step=i.readFloat():r===7?i.readPackedSVarint(e.diffs):r===8&&(e.rule=i.readVarint())}function nb(r,e,i){r===1?(e.rgb_color=uf(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 uf(r){return new hi((r>>16&255)/255,(r>>8&255)/255,(255&r)/255,1)}function sb(r,e,i){r===1?(e.rgb_color=uf(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 ob(r,e,i){r===1?e.transform=cf(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(kx(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 kx(r,e){return r.readFields(ab,{offset:0,opacity:255,rgb_color:s_},e)}function ab(r,e,i){r===1?e.offset=i.readFloat():r===2?e.opacity=i.readVarint():r===3&&(e.rgb_color=uf(i.readVarint()))}function lb(r,e,i){r===1?e.transform=cf(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(kx(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 cb(r,e,i){r===1?e.transform=cf(i,i.readVarint()+i.pos):r===2?e.clip_path_idx=i.readVarint():r===3&&e.children.push(lf(i,i.readVarint()+i.pos))}function ub(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(lf(i,i.readVarint()+i.pos))}class hb{static calculate(e={},i=[]){const s=new Map,a=new Map;if(Object.keys(e).length===0)return s;i.forEach(u=>{a.set(u.name,u.rgb_color||new hi(0,0,0))});for(const[u,h]of Object.entries(e))a.has(u)?s.set(a.get(u).toString(),h):console.warn(`Ignoring unknown image variable "${u}"`);return s}}function bu(r,e=255,i){const s=e/255,a=r.toString(),u=i.has(a)?i.get(a).clone():r.clone();return u.a*=s,u.toString()}function ad(r,e){if(!uc()){const i=document.createElement("canvas");return i.width=r,i.height=e,i}return new OffscreenCanvas(r,e)}function db(r,e){const i=hb.calculate(e.params,r.metadata?r.metadata.variables:[]),s=r.usvg_tree,a=s.width,u=s.height,h=e.transform?e.transform:new DOMMatrix,f=Math.max(1,Math.round(a*h.a)),_=Math.max(1,Math.round(u*h.d)),g=new DOMMatrix([f/a,0,0,_/u,0,0]),v=ad(f,_).getContext("2d");return l_(v,g,s,s,i),v.getImageData(0,0,f,_)}function l_(r,e,i,s,a){for(const u of s.children)Ox(r,e,i,u,a)}function Ox(r,e,i,s,a){s.group?(r.save(),function(u,h,f,_,g){const v=_.mask_idx!=null?f.masks[_.mask_idx]:null,b=_.clip_path_idx!=null?f.clip_paths[_.clip_path_idx]:null;if(_.transform&&(h=wu(_.transform).preMultiplySelf(h)),!function(A,P,D){return A.opacity!==255||P||D}(_,b!=null,v!=null))return void l_(u,h,f,_,g);const w=ad(u.canvas.width,u.canvas.height),E=w.getContext("2d");l_(E,h,f,_,g),b&&qx(E,h,f,b),v&&$x(E,h,f,v,g),u.globalAlpha=_.opacity/255,u.drawImage(w,0,0)}(r,e,i,s.group,a),r.restore()):s.path&&(r.save(),function(u,h,f,_,g){u.setTransform(h),_.paint_order===H1.PAINT_ORDER_FILL_AND_STROKE?(Bx(u,f,_,g),Vx(u,f,_,g)):(Vx(u,f,_,g),Bx(u,f,_,g))}(r,e,i,s.path,a),r.restore())}function Bx(r,e,i,s){const a=i.fill;if(!a)return;const u=a.opacity/255;switch(r.save(),r.beginPath(),Zx(i,r),a.paint){case"rgb_color":r.fillStyle=bu(a.rgb_color,a.opacity,s);break;case"linear_gradient_idx":{const h=e.linear_gradients[a.linear_gradient_idx];h.transform&&r.setTransform(wu(h.transform).preMultiplySelf(r.getTransform())),r.fillStyle=Ux(r,h,u,s);break}case"radial_gradient_idx":{const h=e.radial_gradients[a.radial_gradient_idx];h.transform&&r.setTransform(wu(h.transform).preMultiplySelf(r.getTransform())),r.fillStyle=jx(r,h,u,s)}}
14r.fill(Nx(i)),r.restore()}function Nx(r){return r.rule===o_.PATH_RULE_NON_ZERO?"nonzero":r.rule===o_.PATH_RULE_EVEN_ODD?"evenodd":void 0}function Vx(r,e,i,s){const a=i.stroke;if(!a)return;const u=Hx(i);r.lineWidth=a.width,r.miterLimit=a.miterlimit,r.setLineDash(a.dasharray),r.lineDashOffset=a.dashoffset;const h=a.opacity/255;switch(a.paint){case"rgb_color":r.strokeStyle=bu(a.rgb_color,a.opacity,s);break;case"linear_gradient_idx":r.strokeStyle=Ux(r,e.linear_gradients[a.linear_gradient_idx],h,s,!0);break;case"radial_gradient_idx":r.strokeStyle=jx(r,e.radial_gradients[a.radial_gradient_idx],h,s,!0)}switch(a.linejoin){case af.LINE_JOIN_MITER_CLIP:case af.LINE_JOIN_MITER:r.lineJoin="miter";break;case af.LINE_JOIN_ROUND:r.lineJoin="round";break;case af.LINE_JOIN_BEVEL:r.lineJoin="bevel"}switch(a.linecap){case a_.LINE_CAP_BUTT:r.lineCap="butt";break;case a_.LINE_CAP_ROUND:r.lineCap="round";break;case a_.LINE_CAP_SQUARE:r.lineCap="square"}r.stroke(u)}function Ux(r,e,i,s,a=!1){if(e.stops.length===1){const w=e.stops[0];return bu(w.rgb_color,w.opacity*i,s)}const{x1:u,y1:h,x2:f,y2:_}=e;let g=new DOMPoint(u,h),v=new DOMPoint(f,_);if(a){const w=wu(e.transform);g=w.transformPoint(g),v=w.transformPoint(v)}const b=r.createLinearGradient(g.x,g.y,v.x,v.y);for(const w of e.stops)b.addColorStop(w.offset,bu(w.rgb_color,w.opacity*i,s));return b}function jx(r,e,i,s,a=!1){if(e.stops.length===1){const k=e.stops[0];return bu(k.rgb_color,k.opacity*i,s)}const u=wu(e.transform),{fx:h,fy:f,fr:_,cx:g,cy:v,r:b}=e;let w=new DOMPoint(h,f),E=new DOMPoint(g,v),A=_,P=b;if(a){w=u.transformPoint(w),E=u.transformPoint(E);const k=(u.a+u.d)/2;A=_*k,P=e.r*k}const D=r.createRadialGradient(w.x,w.y,A,E.x,E.y,P);for(const k of e.stops)D.addColorStop(k.offset,bu(k.rgb_color,k.opacity*i,s));return D}function Gx(r,e,i,s){const a=s.transform?wu(s.transform).preMultiplySelf(e):e,u=ad(r.canvas.width,r.canvas.height),h=u.getContext("2d");for(const _ of s.children)if(_.group)Gx(h,a,i,_.group);else if(_.path){const g=_.path,v=new Path2D;v.addPath(Hx(g),a),h.fill(v,Nx(g))}const f=s.clip_path_idx!=null?i.clip_paths[s.clip_path_idx]:null;f&&qx(h,a,i,f),r.globalCompositeOperation="source-over",r.drawImage(u,0,0)}function qx(r,e,i,s){const a=ad(r.canvas.width,r.canvas.height);Gx(a.getContext("2d"),e,i,s),r.globalCompositeOperation="destination-in",r.drawImage(a,0,0)}function $x(r,e,i,s,a){if(s.children.length===0)return;const u=s.mask_idx!=null?i.masks[s.mask_idx]:null;u&&$x(r,e,i,u,a);const h=r.canvas.width,f=r.canvas.height,_=ad(h,f),g=_.getContext("2d"),v=s.width,b=s.height,w=s.left,E=s.top,A=new Path2D,P=new Path2D;P.rect(w,E,v,b),A.addPath(P,e),g.clip(A);for(const j of s.children)Ox(g,e,i,j,a);const D=g.getImageData(0,0,h,f),k=D.data;if(s.mask_type===Lx.MASK_TYPE_LUMINANCE)for(let j=0;j<k.length;j+=4)k[j+3]=k[j+3]/255*(.2126*k[j]+.7152*k[j+1]+.0722*k[j+2]);g.putImageData(D,0,0),r.globalCompositeOperation="destination-in",r.drawImage(_,0,0)}function wu(r){return r?new DOMMatrix([r.sx,r.ky,r.kx,r.sy,r.tx,r.ty]):new DOMMatrix}function Zx(r,e){const i=r.step;let s=r.diffs[0]*i,a=r.diffs[1]*i;e.moveTo(s,a);for(let u=0,h=2;u<r.commands.length;u++)switch(r.commands[u]){case od.PATH_COMMAND_MOVE:s+=r.diffs[h++]*i,a+=r.diffs[h++]*i,e.moveTo(s,a);break;case od.PATH_COMMAND_LINE:s+=r.diffs[h++]*i,a+=r.diffs[h++]*i,e.lineTo(s,a);break;case od.PATH_COMMAND_QUAD:{const f=s+r.diffs[h++]*i,_=a+r.diffs[h++]*i;s=f+r.diffs[h++]*i,a=_+r.diffs[h++]*i,e.quadraticCurveTo(f,_,s,a);break}case od.PATH_COMMAND_CUBIC:{const f=s+r.diffs[h++]*i,_=a+r.diffs[h++]*i,g=f+r.diffs[h++]*i,v=_+r.diffs[h++]*i;s=g+r.diffs[h++]*i,a=v+r.diffs[h++]*i,e.bezierCurveTo(f,_,g,v,s,a);break}case od.PATH_COMMAND_CLOSE:e.closePath()}return e}function Hx(r){return Zx(r,new Path2D)}class hf{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)}}tt(hf,"LRUCache");class c_{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new jr(e,e.data)}getFromCache(e,i,s){return this.cacheMap.has(s)||this.cacheMap.set(s,new hf(150)),this.cacheMap.get(s).get(Uo(e.toString(),i))}setInCache(e,i,s,a){this.cacheDependenciesMap.has(a)||this.cacheDependenciesMap.set(a,new Map),this.cacheMap.has(a)||this.cacheMap.set(a,new hf(150));const u=this.cacheDependenciesMap.get(a),h=Uo(e.id.toString(),s);u.get(h)||u.set(h,new Set);const f=this.cacheMap.get(a),_=e.toString();u.get(h).add(_),f.put(Uo(e.toString(),s),i)}removeImagesFromCacheByIds(e,i,s=0){if(!this.cacheMap.has(s)||!this.cacheDependenciesMap.has(s))return;const a=this.cacheMap.get(s),u=this.cacheDependenciesMap.get(s);for(const h of e){const f=Uo(h.toString(),i);if(u.has(f)){for(const _ of u.get(f))a.delete(_);u.delete(f)}}}rasterize(e,i,s,a,u=db){const h=this.getFromCache(e,s,a);if(h)return h.clone();const f=u(i.icon,e.options),_=c_._getImage(f);return this.setInCache(e,_,s,a),_.clone()}}class Wx{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const s=this.toIdx(e,i);return{min:this.minimums[s],max:this.maximums[s]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function Xx(r,e,i,s){let a=0,u=Number.MAX_VALUE;for(let h=0;h<3;h++)if(Math.abs(s[h])<1e-15){if(i[h]<r[h]||i[h]>e[h])return null}else{const f=1/s[h];let _=(r[h]-i[h])*f,g=(e[h]-i[h])*f;if(_>g){const v=_;_=g,g=v}if(_>a&&(a=_),g<u&&(u=g),a>u)return null}return a}function Yx(r,e,i,s,a,u,h,f,_,g,v){const b=s-r,w=a-e,E=u-i,A=h-r,P=f-e,D=_-i,k=v[1]*D-v[2]*P,j=v[2]*A-v[0]*D,G=v[0]*P-v[1]*A,z=b*k+w*j+E*G;if(Math.abs(z)<1e-15)return null;const N=1/z,q=g[0]-r,H=g[1]-e,oe=g[2]-i,re=(q*k+H*j+oe*G)*N;if(re<0||re>1)return null;const ae=H*E-oe*w,he=oe*b-q*E,Te=q*w-H*b,Oe=(v[0]*ae+v[1]*he+v[2]*Te)*N;return Oe<0||re+Oe>1?null:(A*ae+P*he+D*Te)*N}function Kx(r,e,i){return(r-e)/(i-e)}function Jx(r,e,i,s,a,u,h,f,_){const g=1<<i,v=u-s,b=h-a,w=(r+1)/g*v+s,E=(e+0)/g*b+a,A=(e+1)/g*b+a;f[0]=(r+0)/g*v+s,f[1]=E,_[0]=w,_[1]=A}class Qx{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const i=function(u){const h=Math.ceil(Math.log2(u.dim/8)),f=[];let _=Math.ceil(Math.pow(2,h));const g=1/_,v=(E,A,P,D,k)=>{const j=D?1:0,G=(E+1)*P-j,z=A*P,N=(A+1)*P-j;k[0]=E*P,k[1]=z,k[2]=G,k[3]=N};let b=new Wx(_);const w=[];for(let E=0;E<_*_;E++){v(E%_,Math.floor(E/_),g,!1,w);const A=Ha(w[0],w[1],u),P=Ha(w[2],w[1],u),D=Ha(w[2],w[3],u),k=Ha(w[0],w[3],u);b.minimums.push(Math.min(A,P,D,k)),b.maximums.push(Math.max(A,P,D,k)),b.leaves.push(1)}for(f.push(b),_/=2;_>=1;_/=2){const E=f[f.length-1];b=new Wx(_);for(let A=0;A<_*_;A++){v(A%_,Math.floor(A/_),2,!0,w);const P=E.getElevation(w[0],w[1]),D=E.getElevation(w[2],w[1]),k=E.getElevation(w[2],w[3]),j=E.getElevation(w[0],w[3]),G=E.isLeaf(w[0],w[1]),z=E.isLeaf(w[2],w[1]),N=E.isLeaf(w[2],w[3]),q=E.isLeaf(w[0],w[3]),H=Math.min(P.min,D.min,k.min,j.min),oe=Math.max(P.max,D.max,k.max,j.max),re=G&&z&&N&&q;b.maximums.push(oe),b.minimums.push(H),b.leaves.push(oe-H<=5&&re?1:0)}f.push(b)}return f}(this.dem),s=i.length-1,a=i[s];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,
vendor: 13,754 bytes, line 14
140,0,s,0)}raycastRoot(e,i,s,a,u,h,f=1){return Xx([e,i,-100],[s,a,this.maximums[0]*f],u,h)}raycast(e,i,s,a,u,h,f=1){if(!this.nodeCount)return null;const _=this.raycastRoot(e,i,s,a,u,h,f);if(_==null)return null;const g=[],v=[],b=[],w=[],E=[{idx:0,t:_,nodex:0,nodey:0,depth:0}];for(;E.length>0;){const{idx:A,t:P,nodex:D,nodey:k,depth:j}=E.pop();if(this.leaves[A]){Jx(D,k,j,e,i,s,a,b,w);const z=1<<j,N=(D+0)/z,q=(D+1)/z,H=(k+0)/z,oe=(k+1)/z,re=Ha(N,H,this.dem)*f,ae=Ha(q,H,this.dem)*f,he=Ha(q,oe,this.dem)*f,Te=Ha(N,oe,this.dem)*f,Oe=Yx(b[0],b[1],re,w[0],b[1],ae,w[0],w[1],he,u,h),ze=Yx(w[0],w[1],he,b[0],w[1],Te,b[0],b[1],re,u,h),ke=Math.min(Oe!==null?Oe:Number.MAX_VALUE,ze!==null?ze:Number.MAX_VALUE);if(ke!==Number.MAX_VALUE)return ke;{const Be=In([],u,h,P);if(ev(re,ae,Te,he,Kx(Be[0],b[0],w[0]),Kx(Be[1],b[1],w[1]))>=Be[2])return P}continue}let G=0;for(let z=0;z<this._siblingOffset.length;z++){Jx((D<<1)+this._siblingOffset[z][0],(k<<1)+this._siblingOffset[z][1],j+1,e,i,s,a,b,w),b[2]=-100,w[2]=this.maximums[this.childOffsets[A]+z]*f;const N=Xx(b,w,u,h);if(N!=null){const q=N;g[z]=q;let H=!1;for(let oe=0;oe<G&&!H;oe++)q>=g[v[oe]]&&(v.splice(oe,0,z),H=!0);H||(v[G]=z),G++}}for(let z=0;z<G;z++){const N=v[z];E.push({idx:this.childOffsets[A]+N,t:g[N],nodex:(D<<1)+this._siblingOffset[N][0],nodey:(k<<1)+this._siblingOffset[N][1],depth:j+1})}}return null}_addNode(e,i,s){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(s),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,s,a,u){if(e[a].isLeaf(i,s)===1)return;this.childOffsets[u]||(this.childOffsets[u]=this.nodeCount);const h=a-1,f=e[h];let _=0,g=0;for(let v=0;v<this._siblingOffset.length;v++){const b=2*i+this._siblingOffset[v][0],w=2*s+this._siblingOffset[v][1],E=f.getElevation(b,w),A=f.isLeaf(b,w),P=this._addNode(E.min,E.max,A);A&&(_|=1<<v),g||(g=P)}for(let v=0;v<this._siblingOffset.length;v++)_&1<<v||this._construct(e,2*i+this._siblingOffset[v][0],2*s+this._siblingOffset[v][1],h,g+v)}}function ev(r,e,i,s,a,u){return Tt(Tt(r,i,u),Tt(e,s,u),a)}function Ha(r,e,i){const s=i.dim,a=Q(r*s-.5,0,s-1),u=Q(e*s-.5,0,s-1),h=Math.floor(a),f=Math.floor(u),_=Math.min(h+1,s-1),g=Math.min(f+1,s-1);return ev(i.get(h,f),i.get(_,f),i.get(h,g),i.get(_,g),a-h,u-f)}const pb={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function fb(r,e,i){return(256*r*256+256*e+i)/10-1e4}function mb(r,e,i){return 256*r+e+i/256-32768}class df{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,s,a=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(s&&s!=="mapbox"&&s!=="terrarium")return void kt(`"${s}" 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=s==="terrarium"?mb:fb;for(let _=0;_<h.length;++_){const g=4*_;this.floatView[_]=f(this.pixels[g],this.pixels[g+1],this.pixels[g+2])}this._timestamp=Hn.now()}_buildQuadTree(){this._tree=new Qx(this)}get(e,i,s=!1){s&&(e=Q(e,-1,this.dim),i=Q(i,-1,this.dim));const a=this._idx(e,i);return this.floatView[a]}set(e,i,s){const a=this._idx(e,i),u=this.floatView[a];return this.floatView[a]=s,s-u}static getUnpackVector(e){return pb[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){const s=[0,0,0,0],a=df.getUnpackVector(i);let u=Math.floor((e+a[3])/a[2]);return s[2]=u%256,u=Math.floor(u/256),s[1]=u%256,u=Math.floor(u/256),s[0]=u,s}getPixels(){return new eg({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let a=i*this.dim,u=i*this.dim+this.dim,h=s*this.dim,f=s*this.dim+this.dim;switch(i){case-1:a=u-1;break;case 1:u=a+1}switch(s){case-1:h=f-1;break;case 1:f=h+1}const _=-i*this.dim,g=-s*this.dim;for(let v=h;v<f;v++)for(let b=a;b<u;b++){const w=4*this._idx(b,v),E=4*this._idx(b+_,v+g);this.pixels[w+0]=e.pixels[E+0],this.pixels[w+1]=e.pixels[E+1],this.pixels[w+2]=e.pixels[E+2],this.pixels[w+3]=e.pixels[E+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function _b(r,e,i){r===1?e.headerLength=i.readFixed32():r===2?e.x=i.readVarint():r===3?e.y=i.readVarint():r===4?e.z=i.readVarint():r===5&&e.layers.push(function(s,a){return s.readFields(bb,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},a)}(i,i.readVarint()+i.pos))}function gb(r,e,i){r===1?(e.delta_filter=function(s,a){return s.readFields(yb,{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 yb(r,e,i){r===1&&(e.blockSize=i.readVarint())}function xb(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 vb(r,e,i){let s=0,a=0;r===1?e.firstByte=i.readFixed64():r===2?e.lastByte=i.readFixed64():r===3?e.filters.push(function(u,h){return u.readFields(gb,{},h)}(i,i.readVarint()+i.pos)):r===4?e.codec=function(u,h){return u.readFields(xb,{},h)}(i,i.readVarint()+i.pos):r===5?a=i.readFloat():r===6?s=i.readFloat():r===7?e.bands.push(i.readString()):r===8?e.offset=i.readDouble():r===9&&(e.scale=i.readDouble()),e.offset===0&&(e.offset=a),e.scale===0&&(e.scale=s)}function bb(r,e,i){r===1?e.version=i.readVarint():r===2?e.name=i.readString():r===3?e.units=i.readString():r===4?e.tileSize=i.readVarint():r===5?e.buffer=i.readVarint():r===6?e.pixelFormat=i.readVarint():r===7&&e.dataIndex.push(function(s,a){return s.readFields(vb,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},a)}(i,i.readVarint()+i.pos))}function wb(r,e,i){if(r===2)(function(s,a,u){s.readFields(Tb,u,a)})(i,i.readVarint()+i.pos,e);else if(r===3)throw new Error("Not implemented")}function Tb(r,e,i){if(r===1){let s=0;const a=i.readVarint()+i.pos;for(;i.pos<a;)e[s++]=i.readVarint()}}function Sb(r,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let s=2;s>=1;s--){const a=s===1?1:0,u=s===2?1:0;for(let h=0;h<e[0];h++){const f=e[1]*h;for(let _=a;_<e[1];_++){const g=e[2]*(_+f);for(let v=u;v<e[2];v++){const b=e[3]*(v+g);for(let w=0;w<e[3];w++){const E=b+w;r[E]+=r[E-i]}}}}i*=e[s]}return r}function Eb(r){for(let e=0,i=r.length;e<i;e++)r[e]=r[e]>>>1^-(1&r[e]);return r}function Ib(r,e){switch(e){case"uint32":return r;case"uint16":for(let i=0;i<r.length;i+=2){const s=r[i],a=r[i+1];r[i]=(240&s)>>4|(61440&s)>>8|(240&a)<<4|61440&a,r[i+1]=15&s|(3840&s)>>4|(15&a)<<8|(3840&a)<<4}return r;case"uint8":for(let i=0;i<r.length;i+=4){const s=r[i],a=r[i+1],u=r[i+2],h=r[i+3];r[i+0]=(192&s)>>6|(192&a)>>4|(192&u)>>2|192&h,r[i+1]=(48&s)>>4|(48&a)>>2|48&u|(48&h)<<2,r[i+2]=(12&s)>>2|12&a|(12&u)<<2|(12&h)<<4,r[i+3]=3&s|(3&a)<<2|(3&u)<<4|(3&h)<<6}return r;default:throw new Error(`Invalid pixel format, "${e}"`)}}tt(df,"DEMData"),tt(Qx,"DemMinMaxQuadTree",{omit:["dem"]});var ts=Uint8Array,ld=Uint16Array,Ab=Int32Array,tv=new ts([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]),iv=new ts([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]),Mb=new ts([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 ld(31),s=0;s<31;++s)i[s]=e+=1<<r[s-1];var a=new Ab(i[30]);for(s=1;s<30;++s)for(var u=i[s];u<i[s+1];++u)a[u]=u-i[s]<<5|s;return{b:i,r:a}},nv=rv(tv,2),sv=nv.b,Cb=nv.r;sv[28]=258,Cb[258]=28;for(var Pb=rv(iv,0).b,ov=new ld(32768),Ar=0;Ar<32768;++Ar){var Tu=(43690&Ar)>>1|(21845&Ar)<<1;ov[Ar]=((65280&(Tu=(61680&(Tu=(52428&Tu)>>2|(13107&Tu)<<2))>>4|(3855&Tu)<<4))>>8|(255&Tu)<<8)>>1}var cd=function(r,e,i){for(var s=r.length,a=0,u=new ld(e);a<s;++a)r[a]&&++u[r[a]-1];var h,f=new ld(e);for(a=1;a<e;++a)f[a]=f[a-1]+u[a-1]<<1;h=new ld(1<<e);var _=15-e;for(a=0;a<s;++a)if(r[a])for(var g=a<<4|r[a],v=e-r[a],b=f[r[a]-1]++<<v,w=b|(1<<v)-1;b<=w;++b)h[ov[b]>>_]=g;return h},ud=new ts(288);for(Ar=0;Ar<144;++Ar)ud[Ar]=8;for(Ar=144;Ar<256;++Ar)ud[Ar]=9;for(Ar=256;Ar<280;++Ar)ud[Ar]=7;for(Ar=280;Ar<288;++Ar)ud[Ar]=8;var av=new ts(32);for(Ar=0;Ar<32;++Ar)av[Ar]=5;var zb=cd(ud,9),Rb=cd(av,5),u_=function(r){for(var e=r[0],i=1;i<r.length;++i)r[i]>e&&(e=r[i]);return e},Ls=function(r,e,i){var s=e/8|0;return(r[s]|r[s+1]<<8)>>(7&e)&i},h_=function(r,e){var i=e/8|0;return(r[i]|r[i+1]<<8|r[i+2]<<16)>>(7&e)},Db=["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"],Fs=function(r,e,i){var s=new Error(e||Db[r]);if(s.code=r,Error.captureStackTrace&&Error.captureStackTrace(s,Fs),!i)throw s;return s},Lb=new ts(0),Fb=typeof TextDecoder<"u"&&new TextDecoder;try{Fb.decode(Lb,{stream:!0})}catch{}const kb={gzip_data:"gzip"};class ds extends Error{constructor(e){super(e),this.name="MRTError"}}const Ob={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},lv={uint32:1,uint16:2,uint8:4},Bb={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let d_;class pf{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 ds(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),s=new DataView(e);if(i[0]!==13)throw new ds("File is not a valid MRT.");return s.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),s=this.getHeaderLength(e);if(i.length<s)throw new ds(`Expected header with length >= ${s} but got buffer of length ${i.length}`);const a=function(u,h){return u.readFields(_b,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0)}(new d_(i.subarray(0,s)));if(!isNaN(this.x)&&(this.x!==a.x||this.y!==a.y||this.z!==a.z))throw new ds(`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 cv(u,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],s=this.getLayer(e.layerName);for(let a of e.blockIndices){const u=s.dataIndex[a],h=u.firstByte-e.firstByte,f=u.lastByte-e.firstByte;if(s._blocksInProgress.has(a))continue;const _={layerName:s.name,firstByte:h,lastByte:f,pixelFormat:s.pixelFormat,blockIndex:a,blockShape:[u.bands.length].concat(s.bandShape),buffer:s.buffer,codec:u.codec.codec,filters:u.filters.map(g=>g.filter)};s._blocksInProgress.add(a),i.push(_)}return new uv(i,()=>{i.forEach(a=>s._blocksInProgress.delete(a.blockIndex))},(a,u)=>{if(i.forEach(h=>s._blocksInProgress.delete(h.blockIndex)),a)throw a;u.forEach(h=>{this.getLayer(h.layerName).processDecodedData(h)})})}}class cv{constructor({version:e,name:i,units:s,tileSize:a,pixelFormat:u,buffer:h,dataIndex:f},_){if(this.version=e,this.version!==1)throw new ds(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=s,this.tileSize=a,this.buffer=h,this.pixelFormat=Ob[u],this.dataIndex=f,this.bandShape=[a+2*h,a+2*h,lv[this.pixelFormat]],this._decodedBlocks=new hf(_?_.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return lv[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(const[s,a]of this.dataIndex.entries()){for(const[u,h]of a.bands.entries())if(h===e)return{bandIndex:i+u,blockIndex:s,blockBandIndex:u};i+=a.bands.length}break;case"number":for(const[s,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:s,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new ds(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let i=1/0,s=-1/0;const a=[],u=new Set;for(const h of e){const{blockIndex:f}=this.getBlockForBand(h);if(f<0)throw new ds(`Invalid band: ${JSON.stringify(h)}`);const _=this.dataIndex[f];a.includes(f)||a.push(f),u.add(f),i=Math.min(i,_.firstByte),s=Math.max(s,_.lastByte)}if(u.size>this.cacheSize)throw new ds(`Number of blocks to decode (${u.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:s,blockIndices:a}}hasBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){const{blockIndex:i,blockBandIndex:s}=this.getBlockForBand(e);if(i<0)throw new ds(`Band not found: ${JSON.stringify(e)}`);const a=this._decodedBlocks.get(i.toString());if(!a)throw new ds(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const u=this.dataIndex[i],h=this.bandShape.reduce((g,v)=>g*v,1),f=s*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}}}
14pf.setPbf=function(r){d_=r};class uv{constructor(e,i,s){this.tasks=e,this._onCancel=i,this._onComplete=s,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}function rc(r,e){const i=r.json.bufferViews[e.bufferView],s=Dp[e.componentType];return new s(r.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==Zh[e.type]*s.BYTES_PER_ELEMENT?i.byteStride/s.BYTES_PER_ELEMENT:Zh[e.type]))}function p_(r,e,i,s){const a=Dp[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:Zh[e.type],_=i.float32,g=_.length/i.capacity;for(let v=0,b=0;v<e.count*f;v+=f,b+=g)for(let w=0;w<g;w++)_[b+w]=s[v+w]*u;i._trim()}function Nb(r,e,i){const s=r.indices,a=r.attributes,u={};u.indexArray=new Br;const h=e.json.accessors[s],f=h.count/3;u.indexArray.reserve(f);const _=rc(e,h);for(let w=0;w<f;w++)u.indexArray.emplaceBack(_[3*w],_[3*w+1],_[3*w+2]);u.indexArray._trim(),u.vertexArray=new ls;const g=e.json.accessors[a.POSITION];u.vertexArray.reserve(g.count);const v=rc(e,g);for(let w=0;w<g.count;w++)u.vertexArray.emplaceBack(v[3*w],v[3*w+1],v[3*w+2]);if(u.vertexArray._trim(),u.aabb=new si(g.min,g.max),u.centroid=function(w,E){const A=[0,0,0],P=w.length;if(P>0){for(let D=0;D<P;D++){const k=3*w[D];A[0]+=E[k],A[1]+=E[k+1],A[2]+=E[k+2]}A[0]/=P,A[1]/=P,A[2]/=P}return A}(_,v),a.COLOR_0!==void 0){const w=e.json.accessors[a.COLOR_0],E=Zh[w.type],A=rc(e,w);u.colorArray=E===3?new ls:new Or,u.colorArray.resize(w.count),p_(e,w,u.colorArray,A)}if(a.NORMAL!==void 0){u.normalArray=new ls;const w=e.json.accessors[a.NORMAL];u.normalArray.resize(w.count);const E=rc(e,w);p_(e,w,u.normalArray,E)}if(a.TEXCOORD_0!==void 0&&i.length>0){u.texcoordArray=new jo;const w=e.json.accessors[a.TEXCOORD_0];u.texcoordArray.resize(w.count);const E=rc(e,w);p_(e,w,u.texcoordArray,E)}if(a._FEATURE_ID_RGBA4444!==void 0){const w=e.json.accessors[a._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(u.featureData=rc(e,w))}a._FEATURE_RGBA4444!==void 0&&(u.featureData=new Uint32Array(rc(e,e.json.accessors[a._FEATURE_RGBA4444]).buffer));const b=r.material;return u.material=function(w,E){const{emissiveFactor:A=[0,0,0],alphaMode:P="OPAQUE",alphaCutoff:D=.5,normalTexture:k,occlusionTexture:j,emissiveTexture:G,doubleSided:z}=w,{baseColorFactor:N=[1,1,1,1],metallicFactor:q=1,roughnessFactor:H=1,baseColorTexture:oe,metallicRoughnessTexture:re}=w.pbrMetallicRoughness||{},ae=j?E[j.index]:void 0;if(j&&j.extensions&&j.extensions.KHR_texture_transform&&ae){const he=j.extensions.KHR_texture_transform;ae.offsetScale=[he.offset[0],he.offset[1],he.scale[0],he.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new hi(...N),metallicFactor:q,roughnessFactor:H,baseColorTexture:oe?E[oe.index]:void 0,metallicRoughnessTexture:re?E[re.index]:void 0},doubleSided:z,emissiveFactor:new hi(...A),alphaMode:P,alphaCutoff:D,normalTexture:k?E[k.index]:void 0,occlusionTexture:ae,emissionTexture:G?E[G.index]:void 0,defined:w.defined===void 0}}(b!==void 0?e.json.materials[b]:{defined:!1},i),u}function hv(r,e,i){const{matrix:s,rotation:a,translation:u,scale:h,mesh:f,extras:_,children:g}=r,v={};if(v.matrix=s||function(b,w,E,A){var P=w[0],D=w[1],k=w[2],j=w[3],G=P+P,z=D+D,N=k+k,q=P*G,H=P*z,oe=P*N,re=D*z,ae=D*N,he=k*N,Te=j*G,Oe=j*z,ze=j*N,ke=A[0],Be=A[1],Ee=A[2];return b[0]=(1-(re+he))*ke,b[1]=(H+ze)*ke,b[2]=(oe-Oe)*ke,b[3]=0,b[4]=(H-ze)*Be,b[5]=(1-(q+he))*Be,b[6]=(ae+Te)*Be,b[7]=0,b[8]=(oe+Oe)*Ee,b[9]=(ae-Te)*Ee,b[10]=(1-(q+re))*Ee,b[11]=0,b[12]=E[0],b[13]=E[1],b[14]=E[2],b[15]=1,b}([],a||[0,0,0,1],u||[0,0,0],h||[1,1,1]),f!==void 0){v.meshes=i[f];const b=v.anchor=[0,0];for(const w of v.meshes){const{min:E,max:A}=w.aabb;b[0]+=E[0]+A[0],b[1]+=E[1]+A[1]}b[0]=Math.floor(b[0]/v.meshes.length/2),b[1]=Math.floor(b[1]/v.meshes.length/2)}if(_&&(_.id&&(v.id=_.id),_.lights&&(v.lights=function(b){if(!b.length)return[];const w=function(k){const j=atob(k),G=new Uint8Array(j.length);for(let z=0;z<j.length;z++)G[z]=j.codePointAt(z);return G}
14(b),E=[],A=w.length/24,P=new Uint16Array(w.buffer),D=new Float32Array(w.buffer);for(let k=0;k<A;k++){const j=P[2*k*6]/30,G=P[2*k*6+1]/30,z=P[2*k*6+10]/100,N=D[6*k+1],q=D[6*k+2],H=D[6*k+3],oe=D[6*k+4],re=H-N,ae=oe-q,he=Math.hypot(re,ae);E.push({pos:[N+.5*re,q+.5*ae,G],normal:[ae/he,-re/he,0],width:he,height:j,depth:z,points:[N,q,H,oe]})}return E}(_.lights))),g){const b=[];for(const w of g)b.push(hv(e.json.nodes[w],e,i));v.children=b}return v}function Vb(r){if(r.vertices.length===0||r.indices.length===0)return null;const e=new _m(r.vertices,r.indices,8,256),[i,s]=[e.min.clone(),e.max.clone()];return{vertices:r.vertices,indices:r.indices,grid:e,min:i,max:s}}function Ub(r){if(!r.extras||!r.extras.ground)return null;const e=r.extras.ground;if(!e||!Array.isArray(e)||e.length===0)return null;const i=e[0];if(!i||!Array.isArray(i)||i.length===0)return null;const s=[];for(const h of i){if(!Array.isArray(h)||h.length!==2)continue;const f=h[0],_=h[1];typeof f=="number"&&typeof _=="number"&&s.push(new He(f,_))}if(s.length<3)return null;s.length>1&&s[s.length-1].equals(s[0])&&s.pop();let a=0;for(let h=0;h<s.length;h++){const f=s[h],_=s[(h+1)%s.length],g=s[(h+2)%s.length];a+=(f.x-_.x)*(g.y-_.y)-(g.x-_.x)*(f.y-_.y)}a>0&&s.reverse();const u=Lh(s.flatMap(h=>[h.x,h.y]),[]);return u.length===0?null:{vertices:s,indices:u}}function jb(r,e){const i=[],s=[];let a=0;const u=[];for(const h of r){a=i.length;const f=h.vertexArray.float32,_=h.indexArray.uint16;for(let g=0;g<h.vertexArray.length;g++)u[0]=f[3*g+0],u[1]=f[3*g+1],u[2]=f[3*g+2],Gi(u,u,e),i.push(new He(u[0],u[1]));for(let g=0;g<3*h.indexArray.length;g++)s.push(_[g]+a)}if(s.length%3!=0)return null;for(let h=0;h<s.length;h+=3){const f=i[s[h+0]],_=i[s[h+1]],g=i[s[h+2]];(f.x-_.x)*(g.y-_.y)-(g.x-_.x)*(f.y-_.y)>0&&([s[h+1],s[h+2]]=[s[h+2],s[h+1]])}return{vertices:i,indices:s}}function dv(r){const e=function(_,g){const v=[],b=WebGL2RenderingContext;if(_.json.textures)for(const w of _.json.textures){const E={magFilter:b.LINEAR,minFilter:b.NEAREST,wrapS:b.REPEAT,wrapT:b.REPEAT};w.sampler!==void 0&&Object.assign(E,_.json.samplers[w.sampler]),v.push({image:g[w.source],sampler:E,uploaded:!1})}return v}(r,r.images),i=function(_,g){const v=[];for(const b of _.json.meshes){const w=[];for(const E of b.primitives)w.push(Nb(E,_,g));v.push(w)}return v}(r,e),{scenes:s,scene:a,nodes:u}=r.json,h=s?s[a||0].nodes:u,f=[];for(const _ of h)f.push(hv(u[_],r,i));return function(_,g,v){const b={},w=new Set;for(let E=0;E<_.length;E++){const A=v[g[E]];if(!A.extras)continue;const P=A.extras["mapbox:footprint:version"],D=A.extras["mapbox:footprint:id"];(P||D)&&w.add(E),P==="1.0.0"&&D&&(b[D]=E)}for(let E=0;E<_.length;E++){if(w.has(E))continue;const A=_[E],P=v[g[E]];if(!P.extras)continue;let D=null;A.id in b&&(D=jb(_[b[A.id]].meshes,A.matrix)),D||(D=Ub(P)),D&&(A.footprint=Vb(D))}if(w.size>0){const E=Array.from(w.values()).sort((A,P)=>A-P);for(let A=E.length-1;A>=0;A--)_.splice(E[A],1)}}(f,h,r.json.nodes),f}function Gb(r){r.heightmap=new Float32Array(4096),r.heightmap.fill(-1);const e=r.vertexArray.float32,i=r.aabb.min[0]-1,s=r.aabb.min[1]-1,a=tc/(r.aabb.max[0]-i+2),u=tc/(r.aabb.max[1]-s+2);for(let h=0;h<e.length;h+=3){const f=e[h+2],_=(e[h+0]-i)*a|0,g=(e[h+1]-s)*u|0;f>r.heightmap[g*tc+_]&&(r.heightmap[g*tc+_]=f)}}function qb(r,e){const i={};i.indexArray=new Br,i.indexArray.reserve(4*r.length),i.vertexArray=new ls,i.vertexArray.reserve(10*r.length),i.colorArray=new Or,i.vertexArray.reserve(10*r.length);let s=0;for(const h of r){const f=Math.min(10,Math.max(4,1.3*h.height))*e,_=[-h.normal[1],h.normal[0],0],g=Math.min(.29,.1*h.width/h.depth),v=h.width-2*h.depth*e*(g+.01),b=In([],h.pos,_,v/2),w=In([],h.pos,_,-v/2),E=[b[0],b[1],b[2]+h.height],A=[w[0],w[1],w[2]+h.height],P=In([],h.normal,_,g);Xi(P,P,f);const D=In([],h.normal,_,-g);Xi(D,D,f),xr(P,b,P),xr(D,w,D),b[2]+=.1,w[2]+=.1,i.vertexArray.emplaceBack(P[0],P[1],P[2]),i.vertexArray.emplaceBack(D[0],D[1],D[2]),i.vertexArray.emplaceBack(b[0],b[1],b[2]),i.vertexArray.emplaceBack(w[0],w[1],w[2]),i.vertexArray.emplaceBack(E[0],E[1],E[2]),i.vertexArray.emplaceBack(A[0],A[1],A[2]),i.vertexArray.emplaceBack(b[0],b[1],b[2]),i.vertexArray.emplaceBack(w[0],w[1],w[2]),i.vertexArray.emplaceBack(P[0],P[1],P[2]),i.vertexArray.emplaceBack(D[0],D[1],D[2]);const k=v/f/2;i.colorArray.emplaceBack(-k-g,-1,k,.8),i.colorArray.emplaceBack(k+g,-1,k,.8),i.colorArray.emplaceBack(-k,0,k,1.3),i.colorArray.emplaceBack(k,0,k,1.3),i.colorArray.emplaceBack(k+g,-.8,k,.7),i.colorArray.emplaceBack(k+g,-.8,k,.7),i.colorArray.emplaceBack(0,0,k,1.3),i.colorArray.emplaceBack(0,0,k,1.3),i.colorArray.emplaceBack(k+g,-1.2,k,.8),i.colorArray.emplaceBack(k+g,-1.2,k,.8),i.indexArray.emplaceBack(6+s,4+s,8+s),i.indexArray.emplaceBack(7+s,9+s,5+s),i.indexArray.emplaceBack(0+s,1+s,2+s),i.indexArray.emplaceBack(1+s,3+s,2+s),s+=10}const a={defined:!0};a.emissiveFactor=hi.black;const u={};return u.baseColorFactor=hi.white,a.pbrMetallicRoughness=u,i.material=a,i.aabb=new si([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}pf.performDecoding=function(r,e){const i=new Uint8Array(r);return Promise.all(e.tasks.map(s=>{const{layerName:a,firstByte:u,lastByte:h,pixelFormat:f,blockShape:_,blockIndex:g,filters:v,codec:b}=s,w=i.subarray(u,h+1),E=new Uint32Array(_[0]*_[1]*_[2]);let A;if(b!=="gzip_data")throw new ds(`Unhandled codec: ${b}`);return A=function(P,D){if(!globalThis.DecompressionStream&&D==="gzip_data")return Promise.resolve(((z=function(H){H[0]==31&&H[1]==139&&H[2]==8||Fs(6,"invalid gzip data");var oe=H[3],re=10;4&oe&&(re+=2+(H[10]|H[11]<<8));for(var ae=(oe>>3&1)+(oe>>4&1);ae>0;ae-=!H[re++]);return re+(2&oe)}(G=P))+8>G.length&&Fs(6,"invalid gzip data"),function(H,oe,re,ae){var he=H.length;
14if(!he||oe.f&&!oe.l)return re||new ts(0);var Te=!re,Oe=Te||oe.i!=2,ze=oe.i;Te&&(re=new ts(3*he));var ke,Be,Ee=function(hr){var Vi=re.length;if(hr>Vi){var Pi=new ts(Math.max(2*Vi,hr));Pi.set(re),re=Pi}},Le=oe.f||0,be=oe.p||0,Se=oe.b||0,Ue=oe.l,Ge=oe.d,_t=oe.m,ot=oe.n,Ye=8*he;do{if(!Ue){Le=Ls(H,be,1);var Ve=Ls(H,be+1,3);if(be+=3,!Ve){var Pt=H[($=4+((be+7)/8|0))-4]|H[$-3]<<8,st=$+Pt;if(st>he){ze&&Fs(0);break}Oe&&Ee(Se+Pt),re.set(H.subarray($,st),Se),oe.b=Se+=Pt,oe.p=be=8*st,oe.f=Le;continue}if(Ve==1)Ue=zb,Ge=Rb,_t=9,ot=5;else if(Ve==2){var lt=Ls(H,be,31)+257,St=Ls(H,be+10,15)+4,Ft=lt+Ls(H,be+5,31)+1;be+=14;for(var Lt=new ts(Ft),$t=new ts(19),Bt=0;Bt<St;++Bt)$t[Mb[Bt]]=Ls(H,be+3*Bt,7);be+=3*St;var Zt=u_($t),fi=(1<<Zt)-1,Li=cd($t,Zt);for(Bt=0;Bt<Ft;){var $,W=Li[Ls(H,be,fi)];if(be+=15&W,($=W>>4)<16)Lt[Bt++]=$;else{var Ie=0,$e=0;for($==16?($e=3+Ls(H,be,3),be+=2,Ie=Lt[Bt-1]):$==17?($e=3+Ls(H,be,7),be+=3):$==18&&($e=11+Ls(H,be,127),be+=7);$e--;)Lt[Bt++]=Ie}}var Ke=Lt.subarray(0,lt),Xe=Lt.subarray(lt);_t=u_(Ke),ot=u_(Xe),Ue=cd(Ke,_t),Ge=cd(Xe,ot)}else Fs(1);if(be>Ye){ze&&Fs(0);break}}Oe&&Ee(Se+131072);for(var nt=(1<<_t)-1,wt=(1<<ot)-1,Xt=be;;Xt=be){var Yt=(Ie=Ue[h_(H,be)&nt])>>4;if((be+=15&Ie)>Ye){ze&&Fs(0);break}if(Ie||Fs(2),Yt<256)re[Se++]=Yt;else{if(Yt==256){Xt=be,Ue=null;break}var Nt=Yt-254;Yt>264&&(Nt=Ls(H,be,(1<<(Kt=tv[Bt=Yt-257]))-1)+sv[Bt],be+=Kt);var yi=Ge[h_(H,be)&wt],Ci=yi>>4;if(yi||Fs(3),be+=15&yi,Xe=Pb[Ci],Ci>3){var Kt=iv[Ci];Xe+=h_(H,be)&(1<<Kt)-1,be+=Kt}if(be>Ye){ze&&Fs(0);break}Oe&&Ee(Se+131072);var Qi=Se+Nt;if(Se<Xe){var Fi=0-Xe,mi=Math.min(Xe,Qi);for(Fi+Se<0&&Fs(3);Se<mi;++Se)re[Se]=(void 0)[Fi+Se]}for(;Se<Qi;++Se)re[Se]=re[Se-Xe]}}oe.l=Ue,oe.p=Xt,oe.b=Se,oe.f=Le,Ue&&(Le=1,oe.m=_t,oe.d=Ge,oe.n=ot)}while(!Le);return Se!=re.length&&Te?(ke=re,((Be=Se)==null||Be>ke.length)&&(Be=ke.length),new ts(ke.subarray(0,Be))):re.subarray(0,Se)}(G.subarray(z,-8),{i:2},new ts(((k=G)[(j=k.length)-4]|k[j-3]<<8|k[j-2]<<16|k[j-1]<<24)>>>0))));var k,j,G,z;const N=kb[D];if(!N)throw new Error(`Unhandled codec: ${D}`);const q=new globalThis.DecompressionStream(N);return new Response(new Blob([P]).stream().pipeThrough(q)).arrayBuffer().then(H=>new Uint8Array(H))}(w,b).then(P=>(function(D,k){D.readFields(wb,k)}(new d_(P),E),new Bb[f](E.buffer))),A.then(P=>{for(let D=v.length-1;D>=0;D--)switch(v[D]){case"delta_filter":Sb(P,_);break;case"zigzag_filter":Eb(P);break;case"bitshuffle_filter":Ib(P,f);break;default:throw new ds(`Unhandled filter "${v[D]}"`)}return{layerName:a,blockIndex:g,data:P}}).catch(P=>{throw P})}))},tt(uv,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),tt(pf,"MapboxRasterTile"),tt(cv,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class pv{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const s=e[i];this._stringToNumber[s]=i,this._numberToString[i]=s}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}const $b=["id","tile","layer","source","sourceLayer","state"];class Su{constructor(e,i,s,a,u){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=s,this._y=a,this.properties=e.properties,this.id=u}clone(){const e=new Su(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state=Object.assign({},this.state)),this.layer&&(e.layer=Object.assign({},this.layer)),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const i of $b)this[i]!==void 0&&(e[i]=this[i]);return e}}class fv{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Es(We,16,0),this.featureIndexArray=new up,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,s,a,u,h=0,f=0){const _=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,a,u,h);const g=this.grid;for(let v=0;v<i.length;v++){const b=i[v],w=[1/0,1/0,-1/0,-1/0];for(let E=0;E<b.length;E++){const A=b[E];w[0]=Math.min(w[0],A.x),w[1]=Math.min(w[1],A.y),w[2]=Math.max(w[2],A.x),w[3]=Math.max(w[3],A.y)}f!==0&&(w[0]-=f,w[1]-=f,w[2]+=f,w[3]+=f),w[0]<We&&w[1]<We&&w[2]>=0&&w[3]>=0&&g.insert(_,w[0],w[1],w[2],w[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Vt.VectorTile(new Fp(this.rawTileData)).layers,this.sourceLayerCoder=new pv(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,i){const{tilespaceGeometry:s,transform:a,tileTransform:u,pixelPosMatrix:h,availableImages:f,worldview:_}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const g=s.bufferedTilespaceBounds,v=this.grid.query(g.min.x,g.min.y,g.max.x,g.max.y,(A,P,D,k)=>Va(s.bufferedTilespaceGeometry,A,P,D,k));v.sort(Zb);let b=null;a.elevation&&v.length>0&&(b=vu.create(a.elevation,this.tileID));const w={};let E;for(let A=0;A<v.length;A++){const P=v[A];if(P===E)continue;E=P;const D=this.featureIndexArray.get(P);let k=null;
vendor: 4,734 bytes, line 14
14this.is3DTile?this.loadMatchingModelFeature(w,D,e,s,a,_):this.loadMatchingFeature(w,D,e,f,_,(j,G,z,N=0)=>(k||(k=rt(j,this.tileID.canonical,u)),G.queryIntersectsFeature(s,j,z,k,this.z,a,h,b,N)))}return w}loadMatchingFeature(e,i,s,a,u,h){const{featureIndex:f,bucketIndex:_,sourceLayerIndex:g,layoutVertexArrayOffset:v}=i,b=this.bucketLayerIDs[_],w=s.layers,E=Object.keys(w);if(E.length&&!zt(E,b))return;const A=s.sourceCache,P=this.sourceLayerCoder.decode(g),D=this.vtLayers[P].feature(f),k=this.getId(D,P);for(let j=0;j<b.length;j++){const G=b[j];if(!w[G])continue;const{styleLayer:z,targets:N}=w[G];let q={};k!==void 0&&(q=A.getFeatureState(z.sourceLayer,k));const H=!h||h(D,z,q,v);if(!H)continue;const oe=new Su(D,this.z,this.x,this.y,k);oe.tile=this.tileID.canonical,oe.state=q;let re=this.serializedLayersCache.get(G);re||(re=z.serialize(),re.id=G,this.serializedLayersCache.set(G,re)),oe.source=re.source,oe.sourceLayer=re["source-layer"],oe.layer=ge({},re),oe.layer.paint=mv(re.paint,z.paint,D,q,a),oe.layer.layout=mv(re.layout,z.layout,D,q,a);let ae=!1;for(const he of N){this.updateFeatureProperties(oe,he);const{filter:Te}=he;if(Te){if(D.properties=oe.properties,Te.needGeometry){const Oe=Qe(D,!0);if(!Te.filter(new Ti(this.tileID.overscaledZ,{worldview:u}),Oe,this.tileID.canonical))continue}else if(!Te.filter(new Ti(this.tileID.overscaledZ,{worldview:u}),D))continue}ae=!0,he.targetId&&this.addFeatureVariant(oe,he)}ae&&this.appendToResult(e,G,f,oe,H)}}loadMatchingModelFeature(e,i,s,a,u,h){const{featureIndex:f,bucketIndex:_}=i,g=this.bucketLayerIDs[_],v=s.layers,b=Object.keys(v);if(!b.length||zt(b,g))for(let w=0;w<g.length;w++){const E=g[w],{styleLayer:A,targets:P}=v[E];if(A.type!=="model")continue;const D=a.tile,k=D.getBucket(A);if(!(k&&k instanceof of))continue;const j=$1(k,f,a,u);if(!j)continue;const{z:G,x:z,y:N}=D.tileID.canonical,{feature:q,intersectionZ:H,position:oe}=j;let re={};q.id!==void 0&&(re=s.sourceCache.getFeatureState(A.sourceLayer,q.id));const ae=new Su({},G,z,N,q.id);ae.tile=this.tileID.canonical,ae.state=re,ae.properties=q.properties,ae.geometry={type:"Point",coordinates:[oe.lng,oe.lat]};let he=this.serializedLayersCache.get(E);he||(he=A.serialize(),he.id=E,this.serializedLayersCache.set(E,he)),ae.source=he.source,ae.sourceLayer=he["source-layer"],ae.layer=ge({},he);let Te=!1;for(const Oe of P){this.updateFeatureProperties(ae,Oe);const{filter:ze}=Oe;if(ze){if(q.properties=ae.properties,ze.needGeometry){if(!ze.filter(new Ti(this.tileID.overscaledZ,{worldview:h}),q,this.tileID.canonical))continue}else if(!ze.filter(new Ti(this.tileID.overscaledZ,{worldview:h}),q))continue}Te=!0,Oe.targetId&&this.addFeatureVariant(ae,Oe)}Te&&this.appendToResult(e,E,f,ae,H)}}updateFeatureProperties(e,i,s){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,s);h!=null&&(a[u]=h)}e.properties=a}}addFeatureVariant(e,i,s){const a={target:i.target,namespace:i.namespace,uniqueFeatureID:i.uniqueFeatureID};i.properties&&(a.properties=e.properties),e.variants=e.variants||{},e.variants[i.targetId]=e.variants[i.targetId]||[],e.variants[i.targetId].push(a)}appendToResult(e,i,s,a,u){let h=e[i];h===void 0&&(h=e[i]=[]),h.push({featureIndex:s,feature:a,intersectionZ:u})}lookupSymbolFeatures(e,i,s,a,u,h){const f={};this.loadVTLayers();for(const _ of e)this.loadMatchingFeature(f,{bucketIndex:i,sourceLayerIndex:s,featureIndex:_,layoutVertexArrayOffset:0},a,u,h);return f}loadFeature(e){const{featureIndex:i,sourceLayerIndex:s}=e;this.loadVTLayers();const a=this.sourceLayerCoder.decode(s),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 s of i)if(e===s)return!0;return!1}getId(e,i){let s=e.id;if(this.promoteId){const a=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[i];if(a!=null)if(Array.isArray(a)){if(!this.promoteIdExpression){const u=Ss(a);if(u.result!=="success"){const h=u.value.map(f=>`${f.key}: ${f.message}`).join(", ");return void kt(`Failed to create expression for promoteId: ${h}`)}this.promoteIdExpression=u.value}this.promoteIdExpression._evaluator||(this.promoteIdExpression._evaluator=new _l),s=this.promoteIdExpression.evaluate({zoom:0},e)}else s=e.properties[a];typeof s=="boolean"&&(s=Number(s))}return s}}function mv(r,e,i,s,a){return ct(r,(u,h)=>{const f=e instanceof No?e.get(h):null;return f&&f.evaluate?f.evaluate(i,s,void 0,a):f})}function Zb(r,e){return e-r}tt(fv,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const _v=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
vendor: 4,391 bytes, line 14
14];class f_{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,s]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const a=s>>4;if(a!==1)throw new Error(`Got v${a} data when expected v1.`);const u=_v[15&s];if(!u)throw new Error("Unrecognized array type.");const[h]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new f_(f,h,u,e)}constructor(e,i=64,s=Float64Array,a){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=_v.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: ${s}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+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 s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=i,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return m_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,s,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:h,nodeSize:f}=this,_=[0,u.length-1,0],g=[];for(;_.length;){const v=_.pop()||0,b=_.pop()||0,w=_.pop()||0;if(b-w<=f){for(let D=w;D<=b;D++){const k=h[2*D],j=h[2*D+1];k>=e&&k<=s&&j>=i&&j<=a&&g.push(u[D])}continue}const E=w+b>>1,A=h[2*E],P=h[2*E+1];A>=e&&A<=s&&P>=i&&P<=a&&g.push(u[E]),(v===0?e<=A:i<=P)&&(_.push(w),_.push(E-1),_.push(1-v)),(v===0?s>=A:a>=P)&&(_.push(E+1),_.push(b),_.push(1-v))}return g}within(e,i,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:u,nodeSize:h}=this,f=[0,a.length-1,0],_=[],g=s*s;for(;f.length;){const v=f.pop()||0,b=f.pop()||0,w=f.pop()||0;if(b-w<=h){for(let D=w;D<=b;D++)yv(u[2*D],u[2*D+1],e,i)<=g&&_.push(a[D]);continue}const E=w+b>>1,A=u[2*E],P=u[2*E+1];yv(A,P,e,i)<=g&&_.push(a[E]),(v===0?e-s<=A:i-s<=P)&&(f.push(w),f.push(E-1),f.push(1-v)),(v===0?e+s>=A:i+s>=P)&&(f.push(E+1),f.push(b),f.push(1-v))}return _}}function m_(r,e,i,s,a,u){if(a-s<=i)return;const h=s+a>>1;gv(r,e,h,s,a,u),m_(r,e,i,s,h-1,1-u),m_(r,e,i,h+1,a,1-u)}function gv(r,e,i,s,a,u){for(;a>s;){if(a-s>600){const g=a-s+1,v=i-s+1,b=Math.log(g),w=.5*Math.exp(2*b/3),E=.5*Math.sqrt(b*w*(g-w)/g)*(v-g/2<0?-1:1);gv(r,e,i,Math.max(s,Math.floor(i-v*w/g+E)),Math.min(a,Math.floor(i+(g-v)*w/g+E)),u)}const h=e[2*i+u];let f=s,_=a;for(hd(r,e,s,i),e[2*a+u]>h&&hd(r,e,s,a);f<_;){for(hd(r,e,f,_),f++,_--;e[2*f+u]<h;)f++;for(;e[2*_+u]>h;)_--}e[2*s+u]===h?hd(r,e,s,_):(_++,hd(r,e,_,a)),_<=i&&(s=_+1),i<=_&&(a=_-1)}}function hd(r,e,i,s){__(r,i,s),__(e,2*i,2*s),__(e,2*i+1,2*s+1)}function __(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function yv(r,e,i,s){const a=r-i,u=e-s;return a*a+u*u}o.$=Dr,o.A=Eo,o.B=ws,o.C=Uo,o.D=hu,o.E=Io,o.F=2,o.G=Kh,o.H=ky,o.I=xn,o.J=Hs,o.K=class extends nf{},o.L=Mo,o.M=Kn,o.N=Il,o.O=El,o.P=He,o.Q=sh,o.R=ol,o.S=Uc,o.T=Ym,o.U=$c,o.V=nf,o.W=qd,o.X=Ss,o.Y=Mc,o.Z=ba,o._=va,o.a=function(r){return kr.API_CDN_URL_REGEX.test(r)},o.a$=ve,o.a0=Ao,o.a1=Zc,o.a2=Al,o.a3=nh,o.a4=function(r){const e=r.value;let i=[];if(!e)return i;const s=Hs(e);return s!=="string"?(i=i.concat([new nf(r.key,e,`string expected, "${s}" found`)]),i):(e_(e,!0)||(i=i.concat([new nf(r.key,e,`invalid url "${e}"`)])),i)},o.a5=pe,o.a6=Yd,o.a7=rr,o.a8=Ne,o.a9=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return $i(r.expression.evaluate(e))}interpolate(r,e,i){return{x:Tt(r.x,e.x,i),y:Tt(r.y,e.y,i),z:Tt(r.z,e.z,i),azimuthal:Tt(r.azimuthal,e.azimuthal,i),polar:Tt(r.polar,e.polar,i)}}},o.aA=en,o.aB=m,o.aC=hs,o.aD=J,o.aE=ye,o.aF=function(r,e){const i={};for(let s=0;s<e.length;s++){const a=e[s];a in r&&(i[a]=r[a])}return i},o.aG=Z,o.aH=K,o.aI=class{constructor(r){this.entries={}
14,this.scheduler=r}request(r,e,i,s){const a=this.entries[r]=this.entries[r]||{callbacks:[]};if(a.result){const[u,h]=a.result;return this.scheduler?this.scheduler.add(()=>{s(u,h)},e):s(u,h),()=>{}}return a.callbacks.push(s),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!==s),a.callbacks.length||(a.cancel(),delete this.entries[r]))}}},o.aJ=function(r,e,i){const s=JSON.stringify(r.request);return r.data&&(this.deduped.entries[s]={result:[null,r.data]}),this.deduped.request(s,{type:"parseTile",isSymbolTile:r.isSymbolTile,zoom:r.tileZoom},a=>{const u=al(r.request,(h,f,_,g)=>{h?a(h):f&&a(null,{vectorTile:i?void 0:new Vt.VectorTile(new Fp(f)),rawData:f,cacheControl:_,expires:g})});return()=>{u.cancel(),a()}},e)},o.aK=function(r){Au++,Au>xs&&(r.getActor().send("enforceCacheSizeLimit",Wn),Au=0)},o.aL=function(r){return r<=1?1:Math.pow(2,Math.floor(Math.log(r)/Math.LN2))},o.aM=an,o.aN=hx,o.aO=gx,o.aP=ux,o.aQ=function(r,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let s=0;s<r.length;s++){const a=document.createElement("source");yf(r[s])||(i.crossOrigin="Anonymous"),a.src=r[s],i.appendChild(a)}return{cancel:()=>{}}},o.aR=Jp,o.aS=function(r){return fetch(r).then(e=>e.arrayBuffer()).then(e=>ty(e,0,r))},o.aT=dv,o.aU=class{constructor(r,e,i,s){this.id=r,this.position=e!=null?new V(e[0],e[1]):new V(0,0),this.orientation=i??[0,0,0],this.nodes=s,this.uploaded=!1,this.aabb=new si([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(r,e){if(zi(r.matrix,e,r.matrix),r.meshes)for(const i of r.meshes){const s=si.applyTransformFast(i.aabb,r.matrix);this.aabb.encapsulate(s)}if(r.children)for(const i of r.children)this._applyTransformations(i,r.matrix)}computeBoundsAndApplyParent(){const r=Dt([]);for(const e of this.nodes)this._applyTransformations(e,r)}computeModelMatrix(r,e,i,s,a,u,h=!1){Mx(this.matrix,this,r.transform,this.position,e,i,s,a,u,h)}upload(r){if(!this.uploaded){for(const e of this.nodes)i_(e,r);for(const e of this.nodes)sf(e);this.uploaded=!0}}destroy(){for(const r of this.nodes)r_(r)}},o.aV=at,o.aW=Qh,o.aX=ne,o.aY=fe,o.aZ=Pa,o.a_=Br,o.aa=Ti,o.ab=Cl,o.ac=le,o.ad=Gi,o.ae=Jr,o.af=ce,o.ag=No,o.ah=Ua,o.ai=Tt,o.aj=We,o.ak=_c,o.al=ni,o.am=hi,o.an=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return function([i,s]){const a=$i([1,i,s]);return{x:a.x,y:a.y,z:a.z}}(r.expression.evaluate(e))}interpolate(r,e,i){return{x:Tt(r.x,e.x,i),y:Tt(r.y,e.y,i),z:Tt(r.z,e.z,i)}}},o.ao=function(r,e,i=0,s=!0){const a=new He(i,i),u=r.sub(a),h=e.add(a),f=[u,new He(h.x,u.y),h,new He(u.x,h.y)];return s&&f.push(u.clone()),f},o.ap=function(r,e){const i=[];for(let s=0;s<r.length;s++){const a=_e(s-1,-1,r.length-1),u=_e(s+1,-1,r.length-1),h=r[s],f=r[u],_=r[a].sub(h).unit(),g=f.sub(h).unit(),v=g.angleWithSep(_.x,_.y),b=_.add(g).unit().mult(-1*e/Math.sin(v/2));i.push(h.add(b))}return i},o.aq=Yy,o.ar=Va,o.as=function(r,e,i=0){return Ai(((e.x-i)*r.scale-r.x)*We,(e.y*r.scale-r.y)*We,me(e.z,e.y))},o.at=gr,o.au=tr,o.av=Bi,o.aw=ly,o.ax=function(r){let e=1/0,i=1/0,s=-1/0,a=-1/0;for(const u of r)e=Math.min(e,u.x),i=Math.min(i,u.y),s=Math.max(s,u.x),a=Math.max(a,u.y);return{min:new He(e,i),max:new He(s,a)}},o.ay=Q,o.az=zi,o.b=function(r){return kr.API_FONTS_REGEX.test(r)},o.b$=function(r,e,i){i*=.5;var s=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=s*_+a*f,r[1]=a*_-s*f,r[2]=u*_+h*f,r[3]=h*_-u*f,r},o.b0=eu,o.b1=Yp,o.b2=function(){Ms.isLoading()||Ms.isLoaded()||Aa()!=="deferred"||Xd()},o.b3=hh,o.b4=Qe,o.b5=Su,o.b6=ai,o.b7=Mm,o.b8=mm,o.b9=rt,o.bA=function(r,e){const{x:i,y:s}=r.point,a=U_(i,s,r.worldSize/r._pixelsPerMercatorPixel,0,0);return zi(a,a,sm(uo(e)))},o.bB=ri,o.bC=function(r){return r[0]=0,r[1]=0,r[2]=0,r},o.bD=function(r,e){return Math.hypot(e[0]-r[0],e[1]-r[1],e[2]-r[2])},o.bE=In,o.bF=Pr,o.bG=_r,o.bH=Yh,o.bI=Rn,o.bJ=km,o.bK=function(r,e,i,s,a){const u=5*e+2;r.float32[u+0]=i,r.float32[u+1]=s,r.float32[u+2]=a},o.bL=Xp,o.bM=zp,o.bN=fn,o.bO=Lr,o.bP=gg,o.bQ=Tx,o.bR=wg,o.bS=Tg,o.bT=Fm,o.bU=Gy,o.bV=Vm,o.bW=f_,o.bX=_e,o.bY=Xi,o.bZ=Os,o.b_=Bs,o.ba=Cs,o.bb=Nl,o.bc=F_,o.bd=or,o.be=Lh,o.bf=Hm,o.bg=function(r,e){const i=Ua(e.zoom);if(i===0)return uo(r);const s=vp(r),a=nm(s),u=J(s.getWest())*e.worldSize,h=J(s.getEast())*e.worldSize,f=K(s.getNorth())*e.worldSize,_=K(s.getSouth())*e.worldSize,g=[u,f,0],v=[h,f,0],b=[u,_,0],w=[h,_,0],E=Tr([],e.globeMatrix);return Gi(g,g,E),Gi(v,v,E),Gi(b,b,E),Gi(w,w,E),a[0]=qo(a[0],b,i),a[1]=qo(a[1],w,i),a[2]=qo(a[2],v,i),a[3]=qo(a[3],g,i),si.fromPoints(a)},o.bh=wp,o.bi=Tr,o.bj=Rh,o.bk=qo,o.bl=Ll,o.bm=kv,o.bn=Xo,o.bo=Fr,o.bp=pf,o.bq=Fp,o.br=al,o.bs=function(r,e){const i=[];for(const s in r)s in e||i.push(s);return i},o.bt=ue,o.bu=["type","source","source-layer","minzoom","maxzoom","filter","layout"],o.bv=gs,o.bw=function(r){var e=new ft(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e},o.bx=Dt,o.by=mn,o.bz=Kr,o.c=ac,o.c$=Rp,o.c0=Ns,o.c1=ir,o.c2=function(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r},o.c3=ns,o.c4=function(r,e,i,s,a){var u,h=1/Math.tan(e/2);return r[0]=h/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=h,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,a!=null&&a!==1/0?(r[10]=(a+s)*(u=1/(s-a)),r[14]=2*a*s*u):(r[10]=-1,r[14]=-2*s),r},o.c5=function(r,e,i,s,a,u,h){var f=1/(e-i),_=1/(s-a),g=1/(u-h);return r[0]=-2*f,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*_,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*g,r[11]=0,r[12]=(e+i)*f,r[13]=(a+s)*_,r[14]=(h+u)*g,r[15]=1,r},o.c6=ie,o.c7=function(r,e,i){r[4*e+0]=i[0],r[4*e+1]=i[1],r[4*e+2]=i[2],r[4*e+3]=i[3]},o.c8=nu,o.c9=Gl,o.cA=tf,o.cB=sc,o.cC=yx,o.cD=function(r){const e=yx(r,!0);return ri([],[e[0],e[1],e[4],e[5]])},o.cE=dr,o.cF=Mi,o.cG=Dn,o.cH=function(r){const{x:e,y:i}=r.point,{lng:s,lat:a}=r._center;return U_(e,i,r.worldSize,s,a)},o.cI=ps,o.cJ=xe,o.cK=cu,o.cL=y,o.cM=function(r,e,i){let s=0;for(let a=0;a<2;++a)r[a]>0&&(s+=(r[a]-0)*(r[a]-0)),e[a]<0&&(s+=(0-e[a])*(0-e[a]));return s},o.cN=function(r){return r*r*r*r*r},o.cO=ee,o.cP=45,o.cQ=su,o.cR=function(r,e,i){const s=Math.sqrt(r*r+e*e+i*i),a=s>0?Math.acos(i/s)*Ja:0;let u=r!==0||e!==0?Math.atan2(-e,-r)*Ja+90:0;return u<0&&(u+=360),[s,u,a]},o.cS=Ai,o.cT=$i,o.cU=we,o.cV=xr,o.cW=si,o.cX=Cr,o.cY=function(r){return[Math.pow(r[0],1/2.2),Math.pow(r[1],1/2.2),Math.pow(r[2],1/2.2)]},o.cZ=e_,o.c_=function(r,e){return r.readFields(W1,{icons:[]},e)},o.ca=fr,o.cb=cs,o.cc=ka,o.cd=V,o.ce=tx,o.cf=function(){var r=new ft(4);return ft!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r},o.cg=function(r,e,i){var s=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=s*_+u*f,r[1]=a*_+h*f,r[2]=s*-f+u*_,r[3]=a*-f+h*_,r},o.ch=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]},o.ci=Zn,o.cj=function(r){return Math.hypot(r[0],r[1],r[2],r[3])},o.ck=_s,o.cl=ms,o.cm=L_,o.cn=Hi,o.co=xx,o.cp=Wl,o.cq=B_,o.cr=function(r,e,i,s,a,u,h,f,_){if(_.name==="globe")return B_(r,e,new Wl(i,s,a),!1);const g=Qh({z:i,x:s,y:a},_);
14return new si([(u+g.x/g.scale)*e,e*(g.y/g.scale),h],[(u+g.x2/g.scale)*e,e*(g.y2/g.scale),f])},o.cs=function(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r[3]=Math.min(e[3],i[3]),r},o.ct=function(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r[3]=Math.max(e[3],i[3]),r},o.cu=function(r){const e=Math.round((r+45+360)%360/90)%4;return O[e]},o.cv=Ae,o.cw=_o,o.cx=x,o.cy=function(r){const e=Dt(new Float64Array(16));zi(e,r.pixelMatrix,r.globeMatrix);const i=[0,I,0],s=[0,C,0];return Gi(i,i,e),Gi(s,s,e),[i[0]>0&&i[0]<=r.width&&i[1]>0&&i[1]<=r.height&&!am(r,new V(r.center.lat,90)),s[0]>0&&s[0]<=r.width&&s[1]>0&&s[1]<=r.height&&!am(r,new V(r.center.lat,-90))]},o.cz=function(r,e){const{scale:i}=r.tileTransform,s=i*We/(r.tileSize*Math.pow(2,e.zoom-r.tileID.overscaledZ+r.tileID.canonical.z));return function(a,u,h){var f=u[1],_=u[2],g=u[3],v=h[0],b=h[1];return a[0]=u[0]*v,a[1]=f*v,a[2]=_*b,a[3]=g*b,a}(new Float32Array(4),e.inverseAdjustmentMatrix,[s,s])},o.d=function(r){return kr.API_TILEJSON_REGEX.test(r)},o.d$=Sh,o.d0=_u,o.d1=Bm,o.d2=hc,o.d3=Bo,o.d4=kn,o.d5=cl,o.d6=Ct,o.d7=function(r){const e=r.indexOf(Rl);return e>=0?r.slice(0,e):r},o.d8=function(r){return r.indexOf(Rl)>=0},o.d9=function(r){const e=r.lastIndexOf(Rl);return e>=0?r.slice(e+1):""},o.dA=V_,o.dB=un,o.dC=Zr,o.dD=256,o.dE=function(r,e){const i=[0,0,0];return Gi(i,i,wp(uo(e.canonical))),Gi(i,i,r),i},o.dF=r=>({u_matrix:new ka(r),u_texsize:new cs(r),u_pixels_to_tile_units:new ql(r),u_device_pixel_ratio:new fr(r),u_width_scale:new fr(r),u_floor_width_scale:new fr(r),u_image:new nu(r),u_units_to_pixels:new cs(r),u_tile_units_to_pixels:new fr(r),u_alpha_discard_threshold:new fr(r),u_trim_offset:new cs(r),u_trim_fade_range:new cs(r),u_trim_color:new su(r),u_emissive_strength:new fr(r),u_zbias_factor:new fr(r),u_tile_to_meter:new fr(r),u_ground_shadow_factor:new Gl(r),u_pattern_transition:new fr(r)}),o.dG=r=>({u_matrix:new ka(r),u_pixels_to_tile_units:new ql(r),u_device_pixel_ratio:new fr(r),u_width_scale:new fr(r),u_floor_width_scale:new fr(r),u_units_to_pixels:new cs(r),u_dash_image:new nu(r),u_gradient_image:new nu(r),u_image_height:new fr(r),u_texsize:new cs(r),u_tile_units_to_pixels:new fr(r),u_alpha_discard_threshold:new fr(r),u_trim_offset:new cs(r),u_trim_fade_range:new cs(r),u_trim_color:new su(r),u_emissive_strength:new fr(r),u_zbias_factor:new fr(r),u_tile_to_meter:new fr(r),u_ground_shadow_factor:new Gl(r)}),o.dH=r=>({u_camera_to_center_distance:new fr(r),u_extrude_scale:new ql(r),u_device_pixel_ratio:new fr(r),u_matrix:new ka(r),u_inv_rot_matrix:new ka(r),u_merc_center:new cs(r),u_tile_id:new Gl(r),u_zoom_transition:new fr(r),u_up_dir:new Gl(r),u_emissive_strength:new fr(r)}),o.dI=xh,o.dJ=J0,o.dK=q_,o.dL=(r,e,i,s,a,u)=>{const h=r.transform,f=h.projection.name==="globe";let _;if(u.paint.get("circle-pitch-alignment")==="map")if(f){const v=V_(h.zoom,e.canonical)*h._pixelsPerMercatorPixel;_=Float32Array.from([v,0,0,v])}else _=h.calculatePixelsToTileUnitsMatrix(i);else _=new Float32Array([h.pixelsToGLUnits[0],0,0,h.pixelsToGLUnits[1]]);const g={u_camera_to_center_distance:r.transform.getCameraToCenterDistance(h.projection),u_matrix:r.translatePosMatrix(e.projMatrix,i,u.paint.get("circle-translate"),u.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Hn.devicePixelRatio,u_extrude_scale:_,u_inv_rot_matrix:Uv,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:u.paint.get("circle-emissive-strength")};if(f){g.u_inv_rot_matrix=s,g.u_merc_center=a,g.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],g.u_zoom_transition=Ua(h.zoom);const v=a[0]*We,b=a[1]*We;g.u_up_dir=h.projection.upVector(new Wl(0,0,0),v,b)}return g},o.dM=dy,o.dN=dn,o.dO=(r,e,i,s,a,u,h,f,_,g)=>{const v=r.transform,b=v.pitch<15?cy(.07,.7,Q((14-v.zoom)/5,0,1)):.07,w=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:hy(r,e,i,s),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:v.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:a,u_width_scale:u,u_floor_width_scale:h,u_image:0,u_tile_units_to_pixels:uy(e,v),u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]],u_alph
vendor: 18,462 bytes, line 14
14a_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(w?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:b,u_tile_to_meter:we(e.tileID.canonical,0),u_ground_shadow_factor:_,u_pattern_transition:g}},o.dP=(r,e,i,s,a,u,h,f,_,g)=>{const v=r.transform,b=v.calculatePixelsToTileUnitsMatrix(e),w=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none",E=v.pitch<15?cy(.07,.7,Q((14-v.zoom)/5,0,1)):.07;return{u_matrix:hy(r,e,i,s),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:py(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:uy(e,r.transform),u_alpha_discard_threshold:0,u_trim_offset:_,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:E,u_tile_to_meter:we(e.tileID.canonical,0),u_ground_shadow_factor:g}},o.dQ=Ze,o.dR=Dh,o.dS=me,o.dT=Lv,o.dU=Pp,o.dV=kg,o.dW=Ga,o.dX=450,o.dY=7,o.dZ=D1,o.d_=ii,o.da=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},o.db=function(r,e,i,s){return r.type==="custom"?new L1(r,e):new Z1[r.type](r,e,i,s)},o.dc=At,o.dd=function(r){const e=r.indexOf(Rl);return e>=0?r.slice(e+1):""},o.de=class extends Su{constructor(r,e){super(r._vectorTileFeature,r._z,r._x,r._y,r.id),r.state&&(this.state=Object.assign({},r.state)),this.target=e.target,this.namespace=e.namespace,e.properties&&(this.properties=e.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=r.source,this.sourceLayer=r.sourceLayer,this.layer=r.layer)}toJSON(){const r=super.toJSON();return r.target=this.target,r.namespace=this.namespace,r}},o.df=qc,o.dg=aa,o.dh=function(r){return r({pluginStatus:on,pluginURL:As}),qc.on("pluginStateChange",r),r},o.di=_p,o.dj=class extends Ps{constructor(r){super(r),this.current=Mh}set(r,e,i){if(this.fetchUniformLocation(r,e)){for(let s=0;s<9;s++)if(i[s]!==this.current[s]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},o.dk=U,o.dl=function(r,e,i){const s=Ua(i.zoom),a=r.style.map._antialias,u=r.terrain&&r.terrain.exaggeration()>0;return s===0&&!a&&!u},o.dm=function(r){const e=r.pixelsPerMeter,i=e/ie(1,r.center.lat),s=Dt(new Float64Array(16));return Fr(s,s,[r.point.x,r.point.y,0]),dr(s,s,[i,i,e]),Float32Array.from(s)},o.dn=vp,o.dp=function(r){const e=Ae-5;r=Q(r,-80.051129,e)/e*90;const i=Math.pow(Math.abs(Math.sin(ni(r))),3);return Math.round(i*(M.length-1))},o.dq=function(r,e,i,s){const a=e.getNorth(),u=e.getSouth(),h=e.getWest(),f=e.getEast(),_=1<<r.z,g=f-h,v=a-u,b=g/S,w=-v/M[i],E=[0,b,0,w,0,0,a,h,0];if(r.z>0){const A=180/s;pr(E,E,[A/g+1,0,0,0,A/v+1,0,-.5*A/b,.5*A/w,1])}return E[2]=_,E[5]=r.x,E[8]=r.y,E},o.dr=uo,o.ds=function(r,e,i){const s=Dt(new Float64Array(16)),a=(e/(1<<r)-.5)*Math.PI*2;return cn(s,i.globeMatrix,a),Float32Array.from(s)},o.dt=class{isDataAvailableAtPoint(r){const e=this._source();if(this.isUsingMockSource()||!e||r.y<0||r.y>1)return!1;const i=e.getSource().maxzoom,s=1<<i,a=Math.floor(r.x),u=Math.floor((r.x-a)*s),h=Math.floor(r.y*s),f=this.findDEMTileFor(new an(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 s=this._source();if(!s||r.y<0||r.y>1)return e;const a=s.getSource().maxzoom,u=1<<a,h=Math.floor(r.x),f=r.x-h,_=new an(a,h,a,Math.floor(f*u),Math.floor(r.y*u)),g=this.findDEMTileFor(_);if(!g||!g.dem)return e;const v=g.dem,b=1<<g.tileID.canonical.z,w=(f*b-g.tileID.canonical.x)*v.dim,E=(r.y*b-g.tileID.canonical.y)*v.dim,A=Math.floor(w),P=Math.floor(E);return(i?this.exaggeration():1)*Tt(Tt(v.get(A,P),v.get(A,P+1),E-P),Tt(v.get(A+1,P),v.get(A+1,P+1),E-P),w-A)}getAtTileOffset(r,e,i){const s=1<<r.canonical.z;return this.getAtPointOrZero(new le(r.wrap+(r.canonical.x+e/We)/s,(r.canonical.y+i/We)/s))}getAtTileOffsetFunc(r,e,i,s){return a=>{const u=this.getAtTileOffset(r,a.x,a.y),h=s.upVector(r.canonical,a.x,a.y);return Xi(h,h,u*s.upVectorScale(r.canonical,e,i).metersToTile),h}}getForTilePoints(r,e,i,s){if(this.isUsingMockSource())return!1;const a=vu.create(this,r,s);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,s=e.tileID,a=1<<r.canonical.z-s.canonical.z;let u=r.canonical.x/a-s.canonical.x,h=r.canonical.y/a-s.canonical.y,f=0;for(let _=0;_<r.canonical.z-s.canonical.z&&!i.leaves[f];_++){u*=2,h*=2;const g=2*Math.floor(h)+Math.floor(u);f=i.childOffsets[f]+g,u%=1,h%=1}return{min:this.exaggeration()*i.minimums[f],max:this.exaggeration()*i.maximums[f]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(r,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(r){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(r){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const r=this.visibleDemTiles;if(r.length===0)return null;let e=!1,i=Number.MAX_VALUE,s=Number.MIN_VALUE;for(const a of r){const u=this.getMinMaxForTile(a.tileID);u&&(i=Math.min(i,u.min),s=Math.max(s,u.max),e=!0)}return e?{min:i,max:s}:null}},o.du=eg,o.dv=xp,o.dw=function(r,e){return[Math.pow(r[0],2.2)*e,Math.pow(r[1],2.2)*e,Math.pow(r[2],2.2)*e]},o.dx=oi,o.dy=function(r,e){var i=Math.sin(e),s=Math.cos(e);return r[0]=s,r[1]=i,r[2]=0,r[3]=-i,r[4]=s,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},o.dz=Jo,o.e=kr,o.e$=pv,o.e0=256,o.e1=sm,o.e2=ls,o.e3=cn,o.e4=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r},o.e5=oo,o.e6=Bl,o.e7=Nd,o.e8=function(r,e,i,s,a){return Q((r-e)/(i-e)*(a-s)+s,s,a)},o.e9=Vs,o.eA=function(r,e,i){return r[0]=e[0]/i[0],r[1]=e[1]/i[1],r[2]=e[2]/i[2],r},o.eB=Qo,o.eC=R,o.eD=Yo,o.eE=function(r,e,i,s){return r[0]=e,r[1]=i,r[2]=s,r},o.eF=function([r,e,i]){const s=Math.hypot(r,e,i),a=Math.atan2(r,i),u=.5*Math.PI-Math.acos(-e/s);return new V(xe(a),xe(u))},o.eG=Ya,o.eH=Jm,o.eI=function(r){const e=r.navigator?r.navigator.userAgent:null;return!!function(i){if(cr==null){const s=i.navigator?i.navigator.userAgent:null;cr=!!i.safari||!(!s||!(/\b(iPad|iPhone|iPod)\b/.test(s)||s.match("Safari")&&!s.match("Chrome")))}return cr}(r)&&!(!e||!(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},o.eJ=function(r,e){Wn=r,xs=e},o.eK=am,o.eL=j_,o.eM=function(r){const e=[0,0,0],i=Dt(new Float64Array(16));return zi(i,r.pixelMatrix,r.globeMatrix),Gi(e,e,i),new He(e[0],e[1])},o.eN=function(){const r=qh;r&&(r.isPreloaded()&&r.numActive()===1?(r.release(wm),qh=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},o.eO=function(){Rp().acquire(wm)},o.eP=Aa,o.eQ=function(r,e,i=!1){if(on===bn.deferred||on===bn.loading||on===bn.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");As=Hn.resolveURL(r),on=bn.deferred,uh=e,Gc(),i||Xd()},o.eR=function(r){du=Hn.resolveURL(r),pu||(pu=new hu(Rp(),new Io)),pu.broadcast("setMeshoptUrl",du)},o.eS=Xg,o.eT=function(r){Sm=Hn.resolveURL(r),pu||(pu=new hu(Rp(),new Io)),pu.broadcast("setDracoUrl",Sm)},o.eU=Wg,o.eV=Gh,o.eW=function(r){const e=bo();if(!e)return;const i=e.delete(ys);r&&i.then(()=>r()).catch(r)},o.eX=Jl,o.eY=tt,o.eZ=ja,o.e_=Ds,o.ea=function(r,e){var i=e[0],s=e[1],a=e[2],u=e[3],h=e[4],f=e[5],_=e[6],g=e[7],v=e[8],b=v*h-f*g,w=-v*u+f*_,E=g*u-h*_,A=i*b+s*w+a*E;return A?(r[0]=b*(A=1/A),r[1]=(-v*s+a*g)*A,r[2]=(f*s-a*h)*A,r[3]=w*A,r[4]=(v*i-a*_)*A,r[5]=(-f*i+a*u)*A,r[6]=E*A,r[7]=(-g*i+s*_)*A,r[8]=(h*i-s*u)*A,r):null},o.eb=Ko,o.ec=Fe,o.ed=Qm,o.ee=function(r,e){if(r===e){var i=e[1],s=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]=s,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},o.ef=yr,o.eg=[1,1,1],o.eh=class{constructor(r,e,i,s){this.context=r,this.format=s,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),f.texImage3D(f.TEXTURE_3D,0,this.format,a,u,h,0,Wm(this.format),Xm(this.format),e.data)}bind(r,e){const{context:i}=this,{gl:s}=i;s.bindTexture(s.TEXTURE_3D,this.texture),r!==this.minFilter&&(s.texParameteri(s.TEXTURE_3D,s.TEXTURE_MAG_FILTER,r),s.texParameteri(s.TEXTURE_3D,s.TEXTURE_MIN_FILTER,r),this.minFilter=r),e!==this.wrapS&&(s.texParameteri(s.TEXTURE_3D,s.TEXTURE_WRAP_S,e),s.texParameteri(s.TEXTURE_3D,s.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}},o.ei=vu,o.ej=function(r,e,i,s){var a=new ft(4);return a[0]=r,a[1]=e,a[2]=i,a[3]=s,a},o.ek=Qr,o.el=function(r,e,i,s){var a=e[0],u=e[1],h=e[2],f=e[3];return r[0]=a+s*(i[0]-a),r[1]=u+s*(i[1]-u),r[2]=h+s*(i[2]-h),r[3]=f+s*(i[3]-f),r},o.em=xu,o.en=so,o.eo=jo,o.ep=function(r,e,i,s,a,u,h,f,_,g,v,b,w,E,A,P){var D=new ft(16);return D[0]=r,D[1]=e,D[2]=i,D[3]=s,D[4]=a,D[5]=u,D[6]=h,D[7]=f,D[8]=_,D[9]=g,D[10]=v,D[11]=b,D[12]=w,D[13]=E,D[14]=A,D[15]=P,D},o.eq=F,o.er=Jc,o.es=wh,o.et=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new He(1/0,1/0),max:new He(-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=xg(new He(0,0),new He(We,We),r),s=[];if(e&&!gm(i,this._globalClipBounds))return s;for(const a of this._activeRegions){if(a.hiddenByOverlap||!gm(i,a))continue;const u=m0(a.min,a.max,r);s.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 s}setSources(r){this._setSources(r.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const s of e.cache.getVisibleCoordinates()){const a=e.cache.getTile(s).buckets[e.layer];a&&a.updateFootprints(s.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(r){const e=r.getFootprints();if(e.length===0)return;const i=r.getOrder(),s=r.getClipMask(),a=r.getClipScope();for(const u of e){if(!u.footprint)continue;const h=xg(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:s,clipScope:a})}this._sourceIds.push(r.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||Mp(e.min,i.min)||Mp(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||function(s,a){const u=(h,f)=>h+f;return s.length-a.length||s.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],s=this._prevRegions[e];r=i.priority!==s.priority||!yg(i,s)||i.order!==s.order||i.clipMask!==s.clipMask||!gs(i.clipScope,s.clipScope),++e}}if(r){++this._updateTime;for(const i of this._activeRegions)i.order!==Ap&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));const e=i=>{const s=this._activeRegions;if(i>=s.length)return i;const a=s[i].priority;for(;i<s.length&&s[i].priority===a;)++i;return i};if(this._sourceIds.length>1){let i=0,s=e(i);for(;i!==s;){let a=i;const u=i;for(;a!==s;){const h=this._activeRegions[a];h.hiddenByOverlap=!1;for(let f=0;f<u;f++){const _=this._activeRegions[f];if(!_.hiddenByOverlap&&h.order===Ap&&gm(h,_)&&(h.hiddenByOverlap=bg(h.footprint,h.tileId,_.footprint,_.tileId),h.hiddenByOverlap))break}++a}i=s,s=e(i)}}}}_setSources(r){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=r.length-1;e>=0;e--)this._addSource(r[e]);this._computeReplacement()}},o.eu=Ap,o.ev=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 Cs,s=new Br,a=[],u=r+1+2,h=e[0]+1,f=e[0]+1+(1+e.length),_=(g,v,b)=>{let w=g===u-1?g-2:g===0?g:g-1;return w+=b?24575:0,[w,v]};for(let g=0;g<u;++g)i.emplaceBack(..._(g,0,!0));for(let g=0;g<h;++g)for(let v=0;v<u;++v)i.emplaceBack(..._(v,g,(v===0||v===u-1)&&!0));for(let g=0;g<e.length;++g){const v=e[g];for(let b=0;b<u;++b)i.emplaceBack(..._(b,v,!0))}for(let g=0;g<e.length;++g){const v=s.length,b=e[g]+1+2,w=new Br;for(let P=0;P<b-1;P++){const D=P===b-2,k=D?u*(f-e.length+g-P):u;for(let j=0;j<u-1;j++){const G=P*u+j;P===0||D||j===0||j===u-2?(w.emplaceBack(G+1,G,G+k),w.emplaceBack(G+k,G+k+1,G+1)):(s.emplaceBack(G+1,G,G+k),s.emplaceBack(G+k,G+k+1,G+1))}}const E=or.simpleSegment(0,v,i.length,s.length-v);for(let P=0;P<w.uint16.length;P+=3)s.emplaceBack(w.uint16[P],w.uint16[P+1],w.uint16[P+2]);const A=or.simpleSegment(0,v,i.length,s.length-v);a.push({withoutSkirts:E,withSkirts:A})}return{vertices:i,indices:s,segments:a}}_createGrid(r){const e=this._fillGridMeshWithLods(S,M);this._gridSegments=e.segments,this._gridBuffer=r.createVertexBuffer(e.vertices,F_.members),this._gridIndexBuffer=r.createIndexBuffer(e.indices,!0)}_createPoles(r){const e=new Br;for(let h=0;h<=S;h++)e.emplaceBack(0,h+1,h+2);this._poleIndexBuffer=r.createIndexBuffer(e,!0);const i=new oo,s=new oo,a=new oo,u=new oo;this._poleSegments=[];for(let h=0,f=0;h<y;h++){const _=360/(1<<h);i.emplaceBack(0,-m,0,.5,0),s.emplaceBack(0,-m,0,.5,1),a.emplaceBack(0,-m,0,.5,.5),u.emplaceBack(0,-m,0,.5,.5);for(let g=0;g<=S;g++){let v=g/S,b=0;const w=Tt(0,_,v),[E,A,P]=L(Nv,Vv,w,m);i.emplaceBack(E,A,P,v,b),s.emplaceBack(E,A,P,v,1-b);const D=ni(w);v=.5+.5*Math.sin(D),b=.5+.5*Math.cos(D),a.emplaceBack(E,A,P,v,b),u.emplaceBack(E,A,P,v,1-b)}this._poleSegments.push(or.simpleSegment(f,0,66,64)),f+=66}this._poleNorthVertexBuffer=r.createVertexBuffer(i,yp,!1),this._poleSouthVertexBuffer=r.createVertexBuffer(s,yp,!1),this._texturedPoleNorthVertexBuffer=r.createVertexBuffer(a,yp,!1),this._texturedPoleSouthVertexBuffer=r.createVertexBuffer(u,yp,!1)}getGridBuffers(r,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[r].withSkirts:this._gridSegments[r].withoutSkirts]}getPoleBuffers(r,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[r]]}},o.ew=X,o.ex=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},o.ey=se,o.ez=de,o.f=function(r){return btoa(encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(+("0x"+i))))},o.f0=fv,o.f1=sy,o.f2=Wt,o.f3="hd_road_elevation",o.f4=zn,o.f5=ct,o.f6=Yl,o.f7=Om,o.f8=Ql,o.f9=function(r,e,i,s,a,u,h,f=1,_,g,v){r.createArrays(),r.tilePixelRatio=We/(512*r.overscaling),r.compareText={},r.iconsNeedLinear=!1;const b=r.layers[0].layout,w=r.layers[0]._unevaluatedLayout._values,E={};E.scaleFactor=f,E.textSizeScaleRange=b.get("text-size-scale-range"),E.iconSizeScaleRange=b.get("icon-size-scale-range");const[A,P]=E.textSizeScaleRange,[D,k]=E.iconSizeScaleRange;E.textScaleFactor=Q(E.scaleFactor,A,P),E.iconScaleFactor=Q(E.scaleFactor,D,k);const j=w["text-size"],G=w["icon-size"];if(r.textSizeData.kind==="composite"){const{minZoom:re,maxZoom:ae}=r.textSizeData;E.compositeTextSizes=[j.possiblyEvaluate(new Ti(re,{worldview:v}),u),j.possiblyEvaluate(new Ti(ae,{worldview:v}),u)]}if(r.iconSizeData.kind==="composite"){const{minZoom:re,maxZoom:ae}=r.iconSizeData;E.compositeIconSizes=[G.possiblyEvaluate(new Ti(re,{worldview:v}),u),G.possiblyEvaluate(new Ti(ae,{worldview:v}),u)]}E.layoutTextSize=j.possiblyEvaluate(new Ti(h+1,{worldview:v}),u),E.layoutIconSize=G.possiblyEvaluate(new Ti(h+1,{worldview:v}),u),E.textMaxSize=j.possiblyEvaluate(new Ti(18,{worldview:v}),u);const z=b.get("symbol-placement"),N=b.get("text-rotation-alignment")==="map"&&z!=="point",q=b.get("text-size");let H=!1;const oe=[];for(const re of r.features){const ae=b.get("text-font").evaluate(re,{},u).join(","),he=q.evaluate(re,{},u)*E.textScaleFactor,Te=E.layoutTextSize.evaluate(re,{},u)*E.textScaleFactor,Oe=E.layoutIconSize.evaluate(re,{},u)*E.iconScaleFactor,ze={horizontal:{},vertical:void 0},ke=re.text;let Be,Ee=[0,0];if(ke){const St=ke.toString(),Ft=b.get("text-letter-spacing").evaluate(re,{},u)*Lr,Lt=b.get("text-line-height").evaluate(re,{},u)*Lr,$t=qf(St)?Ft:0,Bt=b.get("text-anchor").evaluate(re,{},u),Zt=b.get("text-variable-anchor");if(!Zt){const Ie=b.get("text-radial-offset").evaluate(re,{},u);if(Ie)Ee=Gy(Bt,[Ie*Lr,Nm]);else{const $e=b.get("text-offset").evaluate(re,{},u);Ee=[$e[0]*Lr,$e[1]*Lr]}}
14let fi=N?"center":b.get("text-justify").evaluate(re,{},u);const Li=z==="point",$=Li?b.get("text-max-width").evaluate(re,{},u)*Lr:1/0,W=Ie=>{r.allowVerticalPlacement&&Pl(St)&&(ze.vertical=Lm(ke,e,i,a,ae,$,Lt,Bt,Ie,$t,Ee,Rn.vertical,!0,Te,he,_))};if(!N&&Zt){const Ie=fi==="auto"?Zt.map(Ke=>Vm(Ke)):[fi];let $e=!1;for(let Ke=0;Ke<Ie.length;Ke++){const Xe=Ie[Ke];if(!ze.horizontal[Xe])if($e)ze.horizontal[Xe]=ze.horizontal[0];else{const nt=Lm(ke,e,i,a,ae,$,Lt,"center",Xe,$t,Ee,Rn.horizontal,!1,Te,he,_);nt&&(ze.horizontal[Xe]=nt,$e=nt.positionedLines.length===1)}}W("left")}else{if(fi==="auto"&&(fi=Vm(Bt)),Li||b.get("text-writing-mode").indexOf("horizontal")>=0||!Pl(St)){const Ie=Lm(ke,e,i,a,ae,$,Lt,Bt,fi,$t,Ee,Rn.horizontal,!1,Te,he,_);Ie&&(ze.horizontal[fi]=Ie)}W(Li?"left":fi)}}let Le,be,Se,Ue,Ge,_t,ot=!1;const Ye=b.get("icon-text-fit").evaluate(re,{},u);if(re.icon&&re.icon.hasPrimary()){const St=$y(re.icon,r.iconSizeData,w["icon-size"],u,r.zoom,re,_,E.iconScaleFactor,v);Le=St.iconPrimary,Se=St.iconSecondary;const Ft=Le.toString();if(be=s.get(Ft),be&&(Ge=b.get("icon-offset").evaluate(re,{},u),_t=b.get("icon-anchor").evaluate(re,{},u),Be=c1(a.get(Ft),Se?a.get(Se.toString()):void 0,Ge,_t),ot=be.sdf,r.sdfIcons===void 0?r.sdfIcons=be.sdf:r.sdfIcons!==be.sdf&&kt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(be.pixelRatio!==r.pixelRatio||b.get("icon-rotate").constantOr(1)!==0)&&(r.iconsNeedLinear=!0)),Se){const Lt=Se.toString();Ue=s.get(Lt)}}H=H||!(!re.icon||!re.icon.hasSecondary());const Ve=Um(ze.horizontal)||ze.vertical;r.iconsInText||(r.iconsInText=!!Ve&&Ve.iconsInText);const Pt=Te*E.textScaleFactor/Lr,{defaultShapedIcon:st,verticallyShapedIcon:lt}=x1(r,Be,b,re,u,ze,Pt,Ge,Ye);Ye!=="none"&&Be&&(Ay(Be)||My(Be))&&(Up(0,be,Le,Be,st,Ye,g,s,a),Up(0,Ue,Se,Be,st,Ye,g,s,a),lt&&(Up(0,be,Le,Be,lt,Ye,g,s,a),Up(0,Ue,Se,Be,lt,Ye,g,s,a))),Be=st,oe.push({feature:re,shapedTextOrientations:ze,shapedText:Ve,shapedIcon:Be,iconPrimary:Le,iconSecondary:Se,iconOffset:Ge,iconAnchor:_t,verticallyShapedIcon:lt,layoutTextSize:Te,layoutIconSize:Oe,textOffset:Ee,isSDFIcon:ot,iconTextFit:Ye})}return{featureData:oe,sizes:E,hasAnySecondaryIcon:H,textAlongLine:N,symbolPlacement:z}},o.fa=Oy,o.fb=function(r,e,i,s,a,u,h,f,_,g){const{featureData:v,hasAnySecondaryIcon:b,sizes:w,textAlongLine:E,symbolPlacement:A}=e;for(const P of v){const{shapedIcon:D,verticallyShapedIcon:k,feature:j,shapedTextOrientations:G,shapedText:z,layoutTextSize:N,textOffset:q,isSDFIcon:H,iconPrimary:oe,iconSecondary:re,iconTextFit:ae,iconOffset:he}=P;Zy(D,g.iconPositions,oe,re),Zy(k,g.iconPositions,oe,re),y1(G,g.iconPositions),g1(oe,re,g.iconPositions),(z||D)&&v1(r,j,G,D,k,_,w,N,0,q,H,s,a,h,f,b,ae,he,E,A)}i&&r.generateCollisionDebugBuffers(u,r.collisionBoxArray,w.textScaleFactor)},o.fc=Vt,o.fd=df,o.fe=xo,o.ff=Rt,o.fg=xy,o.fh=Gs,o.fi=function(r){let e=0;if(new Uint32Array(r,0,1)[0]!==Kg){const i=new Uint32Array(r,0,7),[,,s,a,u,h]=i;e=i.byteLength+a+u+h+u,(s!==r.byteLength||e>=r.byteLength)&&kt("Invalid b3dm header information.")}return ty(r,e)},o.fj=function(r,e){const i=dv(r);for(const s of i){for(const a of s.meshes)Gb(a);s.lights&&(s.lightMeshIndex=s.meshes.length,s.meshes.push(qb(s.lights,e)))}return i},o.fk=of,o.fl=_i,o.fm=Zg,o.fn=Ms,o.fo=bn,o.fp=function(r){sa(),ss!=null&&ss.then(e=>{e.keys().then(i=>{for(let s=0;s<i.length-r;s++)e.delete(i[s]).catch(a=>kt(a.message))}).catch(i=>kt(i.message))}).catch(e=>kt(e.message))},o.g=function(r,e){return aa(ge(r,{method:"GET"}),e)},o.h=ge,o.i=function(r){return kr.API_STYLE_REGEX.test(r)&&!ac(r)},o.j=function(r){return r.indexOf("mapbox:")===0},o.k=qs,o.l=Mu,o.m=function(r){return decodeURIComponent(atob(r).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},o.n=function(r,e){return aa(ge(r,{type:"json"}),e)},o.o=Cu,o.p=function(r,e){return aa(ge(r,{method:"POST"}),e)},o.q=Hn,o.r=jr,o.s=function(r){try{const e=self[r];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},o.t=uc,o.u=function(){return function r(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,r)}()},o.v=function(r){return!!r&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(r)},o.w=kt,o.x=function(){return Tm||(Tm=new Jl),Tm},o.y=c_,o.z=fc}),gt(["./shared"],function(o){function Gt(xe){const O=xe?xe.url.toString():void 0;return O?performance.getEntriesByName(O):[]}function ft(xe){if(typeof xe=="number"||typeof xe=="boolean"||typeof xe=="string"||xe==null)return JSON.stringify(xe);if(Array.isArray(xe)){let U="[";for(const X of xe)U+=`${ft(X)},`;return`${U}]`}let O="{";for(const U of Object.keys(xe).sort())O+=`${U}:${ft(xe[U])},`;return`${O}}`}function ri(xe){let O="";for(const U of o.bu)O+=`/${ft(xe[U])}`;return O}class oi{constructor(O){this.keyCache={},this._layers={},this._layerConfigs={},O&&this.replace(O)}replace(O,U){this._layerConfigs={},this._layers={},this.update(O,[],U)}update(O,U,X){this._options=X;for(const Q of O)this._layerConfigs[Q.id]=Q,(this._layers[Q.id]=o.db(Q,this.scope,null,this._options)).compileFilter(X),this.keyCache[Q.id]&&delete this.keyCache[Q.id];for(const Q of U)delete this.keyCache[Q],delete this._layerConfigs[Q],delete this._layers[Q];this.familiesBySource={};const se=function(Q,ce){const _e={};for(let ge=0;ge<Q.length;ge++){const Re=Q[ge];let ve=ce&&ce[Re.id];ve||(Re.type==="symbol"?ve=Re.id:(ve=ri(Re),Re.type==="line"&&Re.paint&&function at(ct){return typeof ct=="string"&&ct==="line-progress"||(Array.isArray(ct)?ct.some(at):!(!ct||typeof ct!="object")&&Object.values(ct).some(at))}(Re.paint["line-width"])&&(ve+=`/${ft(Re.paint["line-width"])}`))),ce&&(ce[Re.id]=ve);let Ze=_e[ve];Ze||(Ze=_e[ve]=[]),Ze.push(Re)}const ue=[];for(const ge in _e)ue.push(_e[ge]);return ue}(Object.values(this._layerConfigs),this.keyCache);for(const Q of se){const ce=Q.map(Ze=>this._layers[Ze.id]),_e=ce[0];if(_e.visibility==="none")continue;const ue=_e.source||"";let ge=this.familiesBySource[ue];ge||(ge=this.familiesBySource[ue]={});const Re=_e.sourceLayer||"_geojsonTileLayer";let ve=ge[Re];ve||(ve=ge[Re]=[]),ve.push(ce)}}}const sr=1*o.e_;class pr{constructor(O){const U={},X=[];for(const _e in O){const ue=O[_e],ge=U[_e]={};for(const Re in ue.glyphs){const ve=ue.glyphs[+Re];if(!ve||ve.bitmap.width===0||ve.bitmap.height===0)continue;const Ze=ve.metrics.localGlyph?sr:1,at={x:0,y:0,w:ve.bitmap.width+2*Ze,h:ve.bitmap.height+2*Ze};X.push(at),ge[Re]=at}}const{w:se,h:Q}=o.H(X),ce=new o.eZ({width:se||1,height:Q||1});for(const _e in O){const ue=O[_e];for(const ge in ue.glyphs){const Re=ue.glyphs[+ge];if(!Re||Re.bitmap.width===0||Re.bitmap.height===0)continue;const ve=U[_e][ge],Ze=Re.metrics.localGlyph?sr:1;o.eZ.copy(Re.bitmap,ce,{x:0,y:0},{x:ve.x+Ze,y:ve.y+Ze},Re.bitmap)}}this.image=ce,this.positions=U}}o.eY(pr,"GlyphAtlas");class Kr{constructor(O){this.tileID=new o.aM(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=o.aW(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}parse(O,U,X,se,Q,ce){this.status="parsing",this.data=O,this.collisionBoxArray=new o.b0;const _e=new o.e$(Object.keys(O.layers).sort()),ue=new o.f0(this.tileID,this.promoteId);ue.bucketLayerIDs=[];const ge={},Re=new o.f1(256,256),ve={featureIndex:ue,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:Re,availableImages:X,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0},Ze=[],at=U.familiesBySource[this.source];for(const At in at){const Ct=O.layers[At];if(!Ct)continue;let zt=!1,Ht=!1,kt=!1;for(const _i of at[At])_i[0].type==="symbol"?zt=!0:Ht=!0,_i[0].is3D()&&_i[0].type!=="model"&&(kt=!0);if(this.extraShadowCaster&&!kt||this.isSymbolTile===!0&&!zt||this.isSymbolTile===!1&&!Ht)continue;Ct.version===1&&o.w(`Vector tile source "${this.source}" layer "${At}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ii=_e.encode(At),qi=[];let $i=!1;for(let _i=0,ai=0;_i<Ct.length;_i++){const cr=Ct.feature(_i),ir=ue.getId(cr,At);if(this.localizableLayerIds&&this.localizableLayerIds.has(At)){const Ki=cr.properties?cr.properties.worldview:null;
14if(this.worldview&&typeof Ki=="string")if(Ki==="all")cr.properties.$localized=!0;else{if(!Ki.split(",").includes(this.worldview))continue;cr.properties.$localized=!0,cr.properties.worldview=this.worldview}}!$i&&cr.properties&&cr.properties.hasOwnProperty(o.f2)&&($i=!0),qi.push({feature:cr,id:ir,index:ai,sourceLayerIndex:Ii}),ai++}$i&&!ve.elevationFeatures&&O.layers.hasOwnProperty(o.f3)&&(ve.elevationFeatures=o.f4.parseFrom(O.layers[o.f3],this.canonical));for(const _i of at[At]){const ai=_i[0];if(this.extraShadowCaster&&(!ai.is3D()||ai.type==="model")||this.isSymbolTile!==void 0&&ai.type==="symbol"!==this.isSymbolTile||ai.minzoom&&this.zoom<Math.floor(ai.minzoom)||ai.maxzoom&&this.zoom>=ai.maxzoom||ai.visibility==="none")continue;Dt(_i,this.zoom,ve.brightness,X,this.worldview);const cr=ge[ai.id]=ai.createBucket({index:ue.bucketLayerIDs.length,layers:_i,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ii,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:se,worldview:this.worldview});ue.bucketLayerIDs.push(_i.map(Ki=>o.C(Ki.id,Ki.scope)));let ir=cr.prepare?cr.prepare():null;ir!=null?(ir=ir.then(()=>cr.populate(qi,ve,this.tileID.canonical,this.tileTransform)),Ze.push(ir)):cr.populate(qi,ve,this.tileID.canonical,this.tileTransform)}}const ct=()=>{let At,Ct,zt,Ht,kt,Ii;Re.trim();const qi={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},$i=()=>{if(At)return this.status="done",ce(At);if(this.extraShadowCaster)this.status="done",ce(null,{buckets:Object.values(ge).filter(ai=>!ai.isEmpty()),featureIndex:ue,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:ve.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(Ct&&zt&&Ht){const ai=new pr(Ct),cr=new Map;for(const[Rr,un]of zt.entries()){const{imagePosition:Zr}=o.f7(Rr,un,o.f8);cr.set(Rr,Zr)}const ir={};for(const Rr in ge){const un=ge[Rr];un instanceof o.b1&&(Dt(un.layers,this.zoom,ve.brightness,X,this.worldview),ir[Rr]=o.f9(un,Ct,ai.positions,zt,cr,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,kt,this.worldview))}const Ki={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(Q,zt,kt,()=>{Ki.iconsPending=!1,_i(ir,ai,Ki)}),this.rasterizeIfNeeded(Q,Ht,Ii,()=>{Ki.patternsPending=!1,_i(ir,ai,Ki)})}},_i=(ai,cr,ir,Ki)=>{if(ir.iconsPending||ir.patternsPending)return;const Rr=new o.fa(zt,Ht,this.lut);for(const un in ge){const Zr=ge[un];if(un in ai)o.fb(Zr,ai[un],this.showCollisionBoxes,X,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,zt,Rr);else if(Zr.hasPattern&&(Zr instanceof o.b7||Zr instanceof o.b8||Zr instanceof o.dU)){Dt(Zr.layers,this.zoom,ve.brightness,X,this.worldview);const Qa=Object.fromEntries(Rr.patternPositions);Zr.addFeatures(ve,this.tileID.canonical,Qa,X,this.tileTransform,this.brightness)}}this.status="done",ce(null,{buckets:Object.values(ge).filter(un=>!un.isEmpty()),featureIndex:ue,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:cr.image,lineAtlas:Re,imageAtlas:Rr,brightness:ve.brightness})};if(!this.extraShadowCaster){const ai=o.f5(ve.glyphDependencies,Ki=>Object.keys(Ki).map(Number));Object.keys(ai).length?Q.send("getGlyphs",{uid:this.uid,stacks:ai,scope:this.scope},(Ki,Rr)=>{At||(At=Ki,Ct=Rr,$i())},void 0,!1,qi):Ct={};const cr=Array.from(ve.iconDependencies.keys()).map(Ki=>o.I.parse(Ki));cr.length?Q.send("getImages",{images:cr,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Ki,Rr)=>{At||(At=Ki,zt=new Map,kt=this.updateImageMapAndGetImageTaskQueue(zt,Rr,ve.iconDependencies),$i())},void 0,!1,qi):(zt=new Map,kt=new Map);const ir=Array.from(ve.patternDependencies.keys()).map(Ki=>o.I.parse(Ki));ir.length?Q.send("getImages",{images:ir,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Ki,Rr)=>{At||(At=Ki,Ht=new Map,Ii=this.updateImageMapAndGetImageTaskQueue(Ht,Rr,ve.patternDependencies),$i())},void 0,!1,qi):(Ht=new Map,Ii=new Map)}if(ve.elevationFeatures&&ve.elevationFeatures.length>0){const ai=[];for(const ir of Object.values(ge))if(ir instanceof o.b8){const Ki=ir.getUnevaluatedPortalGraph();Ki&&ai.push(Ki)}const cr=o.f6.evaluate(ai);for(const ir of Object.values(ge))if(ir instanceof o.b8){const Ki=O.layers[_e.decode(ir.sourceLayerIndex)];ir.setEvaluatedPortalGraph(cr,Ki,this.tileID.canonical,ve.availableImages,ve.brightness)}}$i()};Ze.length>0?Promise.allSettled(Ze).then(ct).catch(ce):ct()}rasterizeIfNeeded(O,U,X,se){Array.from(U.values()).some(Q=>Q.usvg)?this.rasterize(O,U,X,se):se()}updateImageMapAndGetImageTaskQueue(O,U,X){const se=new Map;for(const Q of U.keys()){const ce=X.get(Q)||[];for(const _e of ce){const ue=_e.toString(),ge=U.get(_e.id.toString());ge.usvg?se.has(ue)||(se.set(ue,_e),O.set(ue,Object.assign({},ge))):O.set(ue,ge)}}return se}rasterize(O,U,X,se){this.rasterizeTask=O.send("rasterizeImages",{scope:this.scope,tasks:X},(Q,ce)=>{if(!Q)for(const[_e,ue]of ce.entries()){const ge=Object.assign(U.get(_e),{data:ue});U.set(_e,ge)}se()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function Dt(xe,O,U,X,se){const Q=new o.aa(O,{brightness:U,worldview:se});
14for(const ce of xe)ce.recalculate(Q,X)}class Tr extends o.E{constructor(O,U,X,se,Q,ce,_e){super(),this.actor=O,this.layerIndex=U,this.availableImages=X,this.availableModels=se,this.loadVectorData=ce||o.aJ,this.loading={},this.loaded={},this.deduped=new o.aI(O.scheduler),this.isSpriteLoaded=Q,this.scheduler=O.scheduler,this.brightness=_e}loadTile(O,U){const X=O.uid,se=O&&O.request,Q=se&&se.collectResourceTiming,ce=this.loading[X]=new Kr(O);ce.abort=this.loadVectorData(O,(_e,ue)=>{const ge=!this.loading[X];if(delete this.loading[X],ce.cancelRasterize(),ge||_e||!ue)return ce.status="done",ge||(this.loaded[X]=ce),U(_e);const Re=ue.rawData,ve={};ue.expires&&(ve.expires=ue.expires),ue.cacheControl&&(ve.cacheControl=ue.cacheControl),ce.vectorTile=ue.vectorTile||new o.fc.VectorTile(new o.bq(Re));const Ze=()=>{ce.parse(ce.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(at,ct)=>{if(at||!ct)return U(at);const At={};if(Q){const Ct=Gt(se);Ct.length>0&&(At.resourceTiming=JSON.parse(JSON.stringify(Ct)))}U(null,o.h({rawTileData:Re.slice(0)},ct,ve,At))})};this.isSpriteLoaded?Ze():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(Ze,{type:"parseTile",isSymbolTile:O.isSymbolTile,zoom:O.tileZoom}):Ze()}),this.loaded=this.loaded||{},this.loaded[X]=ce})}reloadTile(O,U){const X=this.loaded,se=O.uid;if(X&&X[se]){const Q=X[se];Q.scaleFactor=O.scaleFactor,Q.showCollisionBoxes=O.showCollisionBoxes,Q.projection=O.projection,Q.brightness=O.brightness,Q.tileTransform=o.aW(O.tileID.canonical,O.projection),Q.extraShadowCaster=O.extraShadowCaster,Q.lut=O.lut,Q.worldview=O.worldview;const ce=(_e,ue)=>{const ge=Q.reloadCallback;ge&&(delete Q.reloadCallback,Q.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ge)),U(_e,ue)};Q.status==="parsing"?Q.reloadCallback=ce:Q.status==="done"&&(Q.vectorTile?Q.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ce):ce())}else U(null,void 0)}abortTile(O,U){const X=O.uid,se=this.loading[X];se&&(se.abort&&se.abort(),delete this.loading[X]),U()}removeTile(O,U){const X=this.loaded,se=O.uid;X&&X[se]&&delete X[se],U()}}class zi{loadTile(O,U){const{uid:X,encoding:se,rawImageData:Q,padding:ce}=O,_e=ImageBitmap&&Q instanceof ImageBitmap?this.getImageData(Q,ce):Q;U(null,new o.fd(X,_e,se,ce<1))}reloadTile(O,U){U(null,null)}abortTile(O,U){U()}removeTile(O,U){U()}getImageData(O,U){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 X=this.offscreenCanvasContext.getImageData(-U,-U,O.width+2*U,O.height+2*U);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),X}}o.bp.setPbf(o.bq);class Fr{constructor(O){this._mrt=new o.bp(O.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=O.uid,this.tileID=O.tileID,this.source=O.source}parse(O,U){const X=this._mrt;this.status="parsing",this._entireBuffer=O;try{X.parseHeader(O),this._isHeaderLoaded=!0;const se=[];for(const Q in X.layers){const ce=X.getLayer(Q),_e=ce.getDataRange(ce.getBandList()),ue=X.createDecodingTask(_e),ge=O.slice(_e.firstByte,_e.lastByte+1),Re=o.bp.performDecoding(ge,ue).then(ve=>ue.complete(null,ve)).catch(ve=>ue.complete(ve,null));se.push(Re)}Promise.allSettled(se).then(()=>U(null,X)).catch(Q=>U(Q))}catch(se){U(se)}}}class dr{constructor(O){this.actor=O,this.loading={},this.loaded={}}loadTile(O,U){const X=O.uid,se=O.request,Q=this.loading[X]=new Fr(O),{cancel:ce}=o.br(se,(_e,ue,ge,Re)=>{const ve=!this.loading[X];if(delete this.loading[X],ve||_e||!ue)return Q.status="done",ve||(this.loaded[X]=Q),U(_e);Q.parse(ue,(Ze,at)=>{if(Ze||!at)return U(Ze);U(null,at,ge,Re)}),this.loaded[X]=Q});Q.abort=ce}reloadTile(O,U){U(null,void 0)}abortTile(O,U){const X=O.uid,se=this.loading[X];se&&(se.abort&&se.abort(),delete this.loading[X]),U()}removeTile(O,U){const X=O.uid;this.loaded[X]&&delete this.loaded[X],U()}decodeRasterArray(O,U){o.bp.performDecoding(O.buffer,O.task).then(X=>U(null,X)).catch(X=>U(X))}}const Dn=o.fc.VectorTileFeature.prototype.toGeoJSON;class cn{constructor(O){this._feature=O,this.extent=o.aj,this.type=O.type,this.properties=O.tags,"id"in O&&!isNaN(O.id)&&
14(this.id=parseInt(O.id,10))}loadGeometry(){if(this._feature.type===1){const O=[];for(const U of this._feature.geometry)O.push([new o.P(U[0],U[1])]);return O}{const O=[];for(const U of this._feature.geometry){const X=[];for(const se of U)X.push(new o.P(se[0],se[1]));O.push(X)}return O}}toGeoJSON(O,U,X){return Dn.call(this,O,U,X)}}class mn{constructor(O){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=o.aj,this.length=O.length,this._features=O}feature(O){return new cn(this._features[O])}}class Xo{constructor(O,U){this.name=O,this.extent=o.aj,this.length=U.length,this._features=U}feature(O){return new cn(this._features[O])}}class ks extends mn{constructor(O){super([]),this.layers={};for(const U in O)this.layers[U]=new Xo(U,O[U])}}const ns=64/4096,sc=128;class yr{constructor(){this.features=new Map}clear(){this.features.clear()}load(O=[],U){for(const X of O){const se=X.id;if(se==null)continue;let Q=this.features.get(se);Q&&this.updateCache(Q,U),X.geometry?(Q=Jr(X),this.updateCache(Q,U),this.features.set(se,Q)):this.features.delete(se),this.updateCache(Q,U)}}updateCache(O,U){for(const{canonical:X,uid:se}of Object.values(U)){const{z:Q,x:ce,y:_e}=X;mo(O,Math.pow(2,Q),ce,_e)&&delete U[se]}}getTile(O,U,X){const se=Math.pow(2,O),Q=[];for(const ce of this.features.values())mo(ce,se,U,X)&&Q.push(ps(ce,se,U,X));return{features:Q}}getFeatures(){return[...this.features.values()]}}function mo({minX:xe,minY:O,maxX:U,maxY:X},se,Q,ce){return xe<(Q+1+ns)/se&&O<(ce+1+ns)/se&&U>(Q-ns)/se&&X>(ce-ns)/se}function Jr(xe){const{id:O,geometry:U,properties:X}=xe;if(!U)return;if(U.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:se,coordinates:Q}=U,ce={id:O,type:1,geometry:[],tags:X,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},_e=ce.geometry;if(se==="Point")Ai(Q,_e,ce);else if(se==="MultiPoint")for(const ue of Q)Ai(ue,_e,ce);else if(se==="LineString")ce.type=2,xr(Q,_e,ce);else if(se==="MultiLineString")ce.type=2,Cr(Q,_e,ce);else if(se==="Polygon")ce.type=3,Cr(Q,_e,ce,!0);else{if(se!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");ce.type=3;for(const ue of Q)Cr(ue,_e,ce,!0)}return ce}function Ai([xe,O],U,X){const se=o.aD(xe);let Q=o.aH(O);Q=Q<0?0:Q>1?1:Q,U.push(se,Q),X.minX=Math.min(X.minX,se),X.minY=Math.min(X.minY,Q),X.maxX=Math.max(X.maxX,se),X.maxY=Math.max(X.maxY,Q)}function xr(xe,O,U,X=!1,se=!1){const Q=[];for(const ce of xe)Ai(ce,Q,U);O.push(Q),X&&function(ce,_e){let ue=0;for(let ge=0,Re=ce.length,ve=Re-2;ge<Re;ve=ge,ge+=2)ue+=(ce[ge]-ce[ve])*(ce[ge+1]+ce[ve+1]);if(ue>0===_e)for(let ge=0,Re=ce.length;ge<Re/2;ge+=2){const ve=ce[ge],Ze=ce[ge+1];ce[ge]=ce[Re-2-ge],ce[ge+1]=ce[Re-1-ge],ce[Re-2-ge]=ve,ce[Re-1-ge]=Ze}}(Q,se)}function Cr(xe,O,U,X=!1){for(let se=0;se<xe.length;se++)xr(xe[se],O,U,X,se===0)}function ps(xe,O,U,X){const{id:se,type:Q,geometry:ce,tags:_e}=xe,ue=[];if(Q===1)(function(ge,Re,ve,Ze,at){for(let ct=0;ct<ge.length;ct+=2){const At=Math.round(o.aj*(ge[ct+0]*Re-ve)),Ct=Math.round(o.aj*(ge[ct+1]*Re-Ze));at.push([At,Ct])}})(ce,O,U,X,ue);else for(const ge of ce)fs(ge,O,U,X,ue);return{id:se,type:Q,geometry:ue,tags:_e}}function fs(xe,O,U,X,se){const ce=o.aj+sc;let _e;for(let ue=0;ue<xe.length-2;ue+=2){let ge=Math.round(o.aj*(xe[ue+0]*O-U)),Re=Math.round(o.aj*(xe[ue+1]*O-X)),ve=Math.round(o.aj*(xe[ue+2]*O-U)),Ze=Math.round(o.aj*(xe[ue+3]*O-X));const at=ve-ge,ct=Ze-Re;ge<-128&&ve<-128||(ge<-128?(Re+=Math.round(ct*((-128-ge)/at)),ge=-128):ve<-128&&(Ze=Re+Math.round(ct*((-128-ge)/at)),ve=-128),Re<-128&&Ze<-128||(Re<-128?(ge+=Math.round(at*((-128-Re)/ct)),Re=-128):Ze<-128&&(ve=ge+Math.round(at*((-128-Re)/ct)),Ze=-128),ge>=ce&&ve>=ce||(ge>=ce?(Re+=Math.round(ct*((ce-ge)/at)),ge=ce):ve>=ce&&(Ze=Re+Math.round(ct*((ce-ge)/at)),ve=ce),Re>=ce&&Ze>=ce||(Re>=ce?(ge+=Math.round(at*((ce-Re)/ct)),Re=ce):Ze>=ce&&(ve=ge+Math.round(at*((ce-Re)/ct)),Ze=ce),_e&&ge===_e[_e.length-1][0]&&Re===_e[_e.length-1][1]||(_e=[[ge,Re]],se.push(_e)),_e.push([ve,Ze])))))}}var qn,Xi,In,$n={exports:{}},Yo=function(){if(In)return $n.exports;In=1;var xe=o.fg(),O=function(){if(Xi)return qn;Xi=1;var Re=o.fe(),ve=o.ff().VectorTileFeature;function Ze(ct,At){this.options=At||{},this.features=ct,this.length=ct.length}function at(ct,At){this.id=typeof ct.id=="number"?ct.id:void 0,this.type=ct.type,this.rawGeometry=ct.type===1?[ct.geometry]:ct.geometry,this.properties=ct.tags,this.extent=At||4096}return qn=Ze,Ze.prototype.feature=function(ct){return new at(this.features[ct],this.options.extent)},at.prototype.loadGeometry=function(){var ct=this.rawGeometry;this.geometry=[];for(var At=0;At<ct.length;At++){for(var Ct=ct[At],zt=[],Ht=0;Ht<Ct.length;Ht++)zt.push(new Re(Ct[Ht][0],Ct[Ht][1]));this.geometry.push(zt)}return this.geometry},at.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var ct=this.geometry,At=1/0,Ct=-1/0,zt=1/0,Ht=-1/0,kt=0;kt<ct.length;kt++)for(var Ii=ct[kt],qi=0;qi<Ii.length;qi++){var $i=Ii[qi];At=Math.min(At,$i.x),Ct=Math.max(Ct,$i.x),zt=Math.min(zt,$i.y),Ht=Math.max(Ht,$i.y)}return[At,zt,Ct,Ht]},at.prototype.toGeoJSON=ve.prototype.toGeoJSON,qn}();function U(Re){var ve=new xe;
14return function(Ze,at){for(var ct in Ze.layers)at.writeMessage(3,X,Ze.layers[ct])}(Re,ve),ve.finish()}function X(Re,ve){var Ze;ve.writeVarintField(15,Re.version||1),ve.writeStringField(1,Re.name||""),ve.writeVarintField(5,Re.extent||4096);var at={keys:[],values:[],keycache:{},valuecache:{}};for(Ze=0;Ze<Re.length;Ze++)at.feature=Re.feature(Ze),ve.writeMessage(2,se,at);var ct=at.keys;for(Ze=0;Ze<ct.length;Ze++)ve.writeStringField(3,ct[Ze]);var At=at.values;for(Ze=0;Ze<At.length;Ze++)ve.writeMessage(4,ge,At[Ze])}function se(Re,ve){var Ze=Re.feature;Ze.id!==void 0&&ve.writeVarintField(1,Ze.id),ve.writeMessage(2,Q,Re),ve.writeVarintField(3,Ze.type),ve.writeMessage(4,ue,Ze)}function Q(Re,ve){var Ze=Re.feature,at=Re.keys,ct=Re.values,At=Re.keycache,Ct=Re.valuecache;for(var zt in Ze.properties){var Ht=Ze.properties[zt],kt=At[zt];if(Ht!==null){kt===void 0&&(at.push(zt),At[zt]=kt=at.length-1),ve.writeVarint(kt);var Ii=typeof Ht;Ii!=="string"&&Ii!=="boolean"&&Ii!=="number"&&(Ht=JSON.stringify(Ht));var qi=Ii+":"+Ht,$i=Ct[qi];$i===void 0&&(ct.push(Ht),Ct[qi]=$i=ct.length-1),ve.writeVarint($i)}}}function ce(Re,ve){return(ve<<3)+(7&Re)}function _e(Re){return Re<<1^Re>>31}function ue(Re,ve){for(var Ze=Re.loadGeometry(),at=Re.type,ct=0,At=0,Ct=Ze.length,zt=0;zt<Ct;zt++){var Ht=Ze[zt],kt=1;at===1&&(kt=Ht.length),ve.writeVarint(ce(1,kt));for(var Ii=at===3?Ht.length-1:Ht.length,qi=0;qi<Ii;qi++){qi===1&&at!==1&&ve.writeVarint(ce(2,Ii-1));var $i=Ht[qi].x-ct,_i=Ht[qi].y-At;ve.writeVarint(_e($i)),ve.writeVarint(_e(_i)),ct+=$i,At+=_i}at===3&&ve.writeVarint(ce(7,1))}}function ge(Re,ve){var Ze=typeof Re;Ze==="string"?ve.writeStringField(1,Re):Ze==="boolean"?ve.writeBooleanField(7,Re):Ze==="number"&&(Re%1!=0?ve.writeDoubleField(3,Re):Re<0?ve.writeSVarintField(6,Re):ve.writeVarintField(5,Re))}return $n.exports=U,$n.exports.fromVectorTileJs=U,$n.exports.fromGeojsonVt=function(Re,ve){ve=ve||{};var Ze={};for(var at in Re)Ze[at]=new O(Re[at].features,ve),Ze[at].name=at,Ze[at].version=ve.version,Ze[at].extent=ve.extent;return U({layers:Ze})},$n.exports.GeoJSONWrapper=O,$n.exports}(),Ko=o.fh(Yo);const tr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:xe=>xe},_r=Math.fround||(Pr=new Float32Array(1),xe=>(Pr[0]=+xe,Pr[0]));var Pr;const Ln=3,Gi=5,Jo=6;class ms{constructor(O){this.options=Object.assign(Object.create(tr),O),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(O){const{log:U,minZoom:X,maxZoom:se}=this.options;U&&console.time("total time");const Q=`prepare ${O.length} points`;U&&console.time(Q),this.points=O;const ce=[];for(let ue=0;ue<O.length;ue++){const ge=O[ue];if(!ge.geometry)continue;const[Re,ve]=ge.geometry.coordinates,Ze=_r(Qo(Re)),at=_r(Os(ve));ce.push(Ze,at,1/0,ue,-1,1),this.options.reduce&&ce.push(0)}let _e=this.trees[se+1]=this._createTree(ce);U&&console.timeEnd(Q);for(let ue=se;ue>=X;ue--){const ge=+Date.now();_e=this.trees[ue]=this._createTree(this._cluster(_e,ue)),U&&console.log("z%d: %d clusters in %dms",ue,_e.numItems,+Date.now()-ge)}return U&&console.timeEnd("total time"),this}getClusters(O,U){let X=((O[0]+180)%360+360)%360-180;const se=Math.max(-90,Math.min(90,O[1]));let Q=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)X=-180,Q=180;else if(X>Q){const ve=this.getClusters([X,se,180,ce],U),Ze=this.getClusters([-180,se,Q,ce],U);return ve.concat(Ze)}const _e=this.trees[this._limitZoom(U)],ue=_e.range(Qo(X),Os(ce),Qo(Q),Os(se)),ge=_e.data,Re=[];for(const ve of ue){const Ze=this.stride*ve;Re.push(ge[Ze+Gi]>1?Zn(ge,Ze,this.clusterProps):this.points[ge[Ze+Ln]])}return Re}getChildren(O){const U=this._getOriginId(O),X=this._getOriginZoom(O),se="No cluster with the specified id.",Q=this.trees[X];if(!Q)throw new Error(se);const ce=Q.data;if(U*this.stride>=ce.length)throw new Error(se);const _e=this.options.radius/(this.options.extent*Math.pow(2,X-1)),ue=Q.within(ce[U*this.stride],ce[U*this.stride+1],_e),ge=[];for(const Re of ue){const ve=Re*this.stride;ce[ve+4]===O&&ge.push(ce[ve+Gi]>1?Zn(ce,ve,this.clusterProps):this.points[ce[ve+Ln]])}if(ge.length===0)throw new Error(se);return ge}getLeaves(O,U,X){const se=[];return this._appendLeaves(se,O,U=U||10,X=X||0,0),se}getTile(O,U,X){const se=this.trees[this._limitZoom(O)],Q=Math.pow(2,O),{extent:ce,radiu
vendor: 11,442 bytes, line 14
14s:_e}=this.options,ue=_e/ce,ge=(X-ue)/Q,Re=(X+1+ue)/Q,ve={features:[]};return this._addTileFeatures(se.range((U-ue)/Q,ge,(U+1+ue)/Q,Re),se.data,U,X,Q,ve),U===0&&this._addTileFeatures(se.range(1-ue/Q,ge,1,Re),se.data,Q,X,Q,ve),U===Q-1&&this._addTileFeatures(se.range(0,ge,ue/Q,Re),se.data,-1,X,Q,ve),ve.features.length?ve:null}getClusterExpansionZoom(O){let U=this._getOriginZoom(O)-1;for(;U<=this.options.maxZoom;){const X=this.getChildren(O);if(U++,X.length!==1)break;O=X[0].properties.cluster_id}return U}_appendLeaves(O,U,X,se,Q){const ce=this.getChildren(U);for(const _e of ce){const ue=_e.properties;if(ue&&ue.cluster?Q+ue.point_count<=se?Q+=ue.point_count:Q=this._appendLeaves(O,ue.cluster_id,X,se,Q):Q<se?Q++:O.push(_e),O.length===X)break}return Q}_createTree(O){const U=new o.bW(O.length/this.stride|0,this.options.nodeSize,Float32Array);for(let X=0;X<O.length;X+=this.stride)U.add(O[X],O[X+1]);return U.finish(),U.data=O,U}_addTileFeatures(O,U,X,se,Q,ce){for(const _e of O){const ue=_e*this.stride,ge=U[ue+Gi]>1;let Re,ve,Ze;if(ge)Re=gr(U,ue,this.clusterProps),ve=U[ue],Ze=U[ue+1];else{const At=this.points[U[ue+Ln]];Re=At.properties;const[Ct,zt]=At.geometry.coordinates;ve=Qo(Ct),Ze=Os(zt)}const at={type:1,geometry:[[Math.round(this.options.extent*(ve*Q-X)),Math.round(this.options.extent*(Ze*Q-se))]],tags:Re};let ct;ct=ge||this.options.generateId?U[ue+Ln]:this.points[U[ue+Ln]].id,ct!==void 0&&(at.id=ct),ce.features.push(at)}}_limitZoom(O){return Math.max(this.options.minZoom,Math.min(Math.floor(+O),this.options.maxZoom+1))}_cluster(O,U){const{radius:X,extent:se,reduce:Q,minPoints:ce}=this.options,_e=X/(se*Math.pow(2,U)),ue=O.data,ge=[],Re=this.stride;for(let ve=0;ve<ue.length;ve+=Re){if(ue[ve+2]<=U)continue;ue[ve+2]=U;const Ze=ue[ve],at=ue[ve+1],ct=O.within(ue[ve],ue[ve+1],_e),At=ue[ve+Gi];let Ct=At;for(const zt of ct){const Ht=zt*Re;ue[Ht+2]>U&&(Ct+=ue[Ht+Gi])}if(Ct>At&&Ct>=ce){let zt,Ht=Ze*At,kt=at*At,Ii=-1;const qi=(ve/Re<<5)+(U+1)+this.points.length;for(const $i of ct){const _i=$i*Re;if(ue[_i+2]<=U)continue;ue[_i+2]=U;const ai=ue[_i+Gi];Ht+=ue[_i]*ai,kt+=ue[_i+1]*ai,ue[_i+4]=qi,Q&&(zt||(zt=this._map(ue,ve,!0),Ii=this.clusterProps.length,this.clusterProps.push(zt)),Q(zt,this._map(ue,_i)))}ue[ve+4]=qi,ge.push(Ht/Ct,kt/Ct,1/0,qi,-1,Ct),Q&&ge.push(Ii)}else{for(let zt=0;zt<Re;zt++)ge.push(ue[ve+zt]);if(Ct>1)for(const zt of ct){const Ht=zt*Re;if(!(ue[Ht+2]<=U)){ue[Ht+2]=U;for(let kt=0;kt<Re;kt++)ge.push(ue[Ht+kt])}}}}return ge}_getOriginId(O){return O-this.points.length>>5}_getOriginZoom(O){return(O-this.points.length)%32}_map(O,U,X){if(O[U+Gi]>1){const ce=this.clusterProps[O[U+Jo]];return X?Object.assign({},ce):ce}const se=this.points[O[U+Ln]].properties,Q=this.options.map(se);return X&&Q===se?Object.assign({},Q):Q}}function Zn(xe,O,U){return{type:"Feature",id:xe[O+Ln],properties:gr(xe,O,U),geometry:{type:"Point",coordinates:[(X=xe[O],360*(X-.5)),Qr(xe[O+1])]}};var X}function gr(xe,O,U){const X=xe[O+Gi],se=X>=1e4?`${Math.round(X/1e3)}k`:X>=1e3?Math.round(X/100)/10+"k":X,Q=xe[O+Jo],ce=Q===-1?{}:Object.assign({},U[Q]);return Object.assign(ce,{cluster:!0,cluster_id:xe[O+Ln],point_count:X,point_count_abbreviated:se})}function Qo(xe){return xe/360+.5}function Os(xe){const O=Math.sin(xe*Math.PI/180),U=.5-.25*Math.log((1+O)/(1-O))/Math.PI;return U<0?0:U>1?1:U}function Qr(xe){const O=(180-360*xe)*Math.PI/180;return 360*Math.atan(Math.exp(O))/Math.PI-90}function _o(xe,O,U,X){let se=X;const Q=O+(U-O>>1);let ce,_e=U-O;const ue=xe[O],ge=xe[O+1],Re=xe[U],ve=xe[U+1];for(let Ze=O+3;Ze<U;Ze+=3){const at=Ya(xe[Ze],xe[Ze+1],ue,ge,Re,ve);if(at>se)ce=Ze,se=at;else if(at===se){const ct=Math.abs(Ze-Q);ct<_e&&(ce=Ze,_e=ct)}}se>X&&(ce-O>3&&_o(xe,O,ce,X),xe[ce+2]=se,U-ce>3&&_o(xe,ce,U,X))}function Ya(xe,O,U,X,se,Q){let ce=se-U,_e=Q-X;if(ce!==0||_e!==0){const ue=((xe-U)*ce+(O-X)*_e)/(ce*ce+_e*_e);ue>1?(U=se,X=Q):ue>0&&(U+=ce*ue,X+=_e*ue)}return ce=xe-U,_e=O-X,ce*ce+_e*_e}function en(xe,O,U,X){const se={id:xe??null,type:O,geometry:U,tags:X,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(O==="Point"||O==="MultiPoint"||O==="LineString")_n(se,U);else if(O==="Polygon")_n(se,U[0]);else if(O==="MultiLineString")for(const Q of U)_n(se,Q);else if(O==="MultiPolygon")for(const Q of U)_n(se,Q[0]);return se}function _n(xe,O){for(let U=0;U<O.length;U+=3)xe.minX=Math.min(xe.minX,O[U]),xe.minY=Math.min(xe.minY,O[U+1]),xe.maxX=Math.max(xe.maxX,O[U]),xe.maxY=Math.max(xe.maxY,O[U+1])}function Bs(xe,O,U,X){if(!O.geometry)return;const se=O.geometry.coordinates;if(se&&se.length===0)return;const Q=O.geometry.type,ce=Math.pow(U.tolerance/((1<<U.maxZoom)*U.extent),2);let _e=[],ue=O.id;if(U.promoteId?ue=O.properties[U.promoteId]:U.generateId&&(ue=X||0),Q==="Point")Ns(se,_e);else if(Q==="MultiPoint")for(const ge of se)Ns(ge,_e);else if(Q==="LineString")Vs(se,_e,ce,!1);else if(Q==="MultiLineString"){if(U.lineMetrics){for(const ge of se)_e=[],Vs(ge,_e,ce,!1),xe.push(en(ue,"LineString",_e,O.properties));return}tn(se,_e,ce,!1)}else if(Q==="Polygon")tn(se,_e,ce,!0);else{if(Q!=="MultiPolygon"){if(Q==="GeometryCollection"){for(const ge of O.geometry.geometries)Bs(xe,{id:ue,geometry:ge,properties:O.properties},U,X);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const ge of se){const Re=[];tn(ge,Re,ce,!0),_e.push(Re)}}xe.push(en(ue,Q,_e,O.properties))}function Ns(xe,O){O.push(ea(xe[0]),ta(xe[1]),0)}function Vs(xe,O,U,X){let se,Q,ce=0;for(let ue=0;ue<xe.length;ue++){const ge=ea(xe[ue][0]),Re=ta(xe[ue][1]);O.push(ge,Re,0),ue>0&&(ce+=X?(se*Re-ge*Q)/2:Math.sqrt(Math.pow(ge-se,2)+Math.pow(Re-Q,2))),se=ge,Q=Re}const _e=O.length-3;O[2]=1,_o(O,0,_e,U),O[_e+2]=1,O.size=Math.abs(ce),O.start=0,O.end=O.size}function tn(xe,O,U,X){for(let se=0;se<xe.length;se++){const Q=[];Vs(xe[se],Q,U,X),O.push(Q)}}function ea(xe){return xe/360+.5}function ta(xe){const O=Math.sin(xe*Math.PI/180),U=.5-.25*Math.log((1+O)/(1-O))/Math.PI;return U<0?0:U>1?1:U}function gn(xe,O,U,X,se,Q,ce,_e){if(X/=O,Q>=(U/=O)&&ce<X)return xe;if(ce<U||Q>=X)return null;const ue=[];for(const ge of xe){const Re=ge.geometry;let ve=ge.type;const Ze=se===0?ge.minX:ge.minY,at=se===0?ge.maxX:ge.maxY;if(Ze>=U&&at<X){ue.push(ge);continue}if(at<U||Ze>=X)continue;let ct=[];if(ve==="Point"||ve==="MultiPoint")Ka(Re,ct,U,X,se);else if(ve==="LineString")_s(Re,ct,U,X,se,!1,_e.lineMetrics);else if(ve==="MultiLineString")$r(Re,ct,U,X,se,!1);else if(ve==="Polygon")$r(Re,ct,U,X,se,!0);else if(ve==="MultiPolygon")for(const At of Re){const Ct=[];$r(At,Ct,U,X,se,!0),Ct.length&&ct.push(Ct)}if(ct.length){if(_e.lineMetrics&&ve==="LineString"){for(const At of ct)ue.push(en(ge.id,ve,At,ge.tags));continue}ve!=="LineString"&&ve!=="MultiLineString"||(ct.length===1?(ve="LineString",ct=ct[0]):ve="MultiLineString"),ve!=="Point"&&ve!=="MultiPoint"||(ve=ct.length===3?"Point":"MultiPoint"),ue.push(en(ge.id,ve,ct,ge.tags))}}return ue.length?ue:null}function Ka(xe,O,U,X,se){for(let Q=0;Q<xe.length;Q+=3){const ce=xe[Q+se];ce>=U&&ce<=X&&Fn(O,xe[Q],xe[Q+1],xe[Q+2])}}function _s(xe,O,U,X,se,Q,ce){let _e=ia(xe);const ue=se===0?go:Us;let ge,Re,ve=xe.start;for(let Ct=0;Ct<xe.length-3;Ct+=3){const zt=xe[Ct],Ht=xe[Ct+1],kt=xe[Ct+2],Ii=xe[Ct+3],qi=xe[Ct+4],$i=se===0?zt:Ht,_i=se===0?Ii:qi;let ai=!1;ce&&(ge=Math.sqrt(Math.pow(zt-Ii,2)+Math.pow(Ht-qi,2))),$i<U?_i>U&&(Re=ue(_e,zt,Ht,Ii,qi,U),ce&&(_e.start=ve+ge*Re)):$i>X?_i<X&&(Re=ue(_e,zt,Ht,Ii,qi,X),ce&&(_e.start=ve+ge*Re)):Fn(_e,zt,Ht,kt),_i<U&&$i>=U&&(Re=ue(_e,zt,Ht,Ii,qi,U),ai=!0),_i>X&&$i<=X&&(Re=ue(_e,zt,Ht,Ii,qi,X),ai=!0),!Q&&ai&&(ce&&(_e.end=ve+ge*Re),O.push(_e),_e=ia(xe)),ce&&(ve+=ge)}let Ze=xe.length-3;const at=xe[Ze],ct=xe[Ze+1],At=se===0?at:ct;At>=U&&At<=X&&Fn(_e,at,ct,xe[Ze+2]),Ze=_e.length-3,Q&&Ze>=3&&(_e[Ze]!==_e[0]||_e[Ze+1]!==_e[1])&&Fn(_e,_e[0],_e[1],_e[2]),_e.length&&O.push(_e)}function ia(xe){const O=[];return O.size=xe.size,O.start=xe.start,O.end=xe.end,O}function $r(xe,O,U,X,se,Q){for(const ce of xe)_s(ce,O,U,X,se,Q,!1)}function Fn(xe,O,U,X){xe.push(O,U,X)}function go(xe,O,U,X,se,Q){const ce=(Q-O)/(X-O);return Fn(xe,Q,U+(se-U)*ce,1),ce}function Us(xe,O,U,X,se,Q){const ce=(Q-U)/(se-U);return Fn(xe,O+(X-O)*ce,Q,1),ce}function yo(xe,O){const U=[];for(let X=0;X<xe.length;X++){const se=xe[X],Q=se.type;let ce;if(Q==="Point"||Q==="MultiPoint"||Q==="LineString")ce=js(se.geometry,O);else if(Q==="MultiLineString"||Q==="Polygon"){ce=[];for(const _e of se.geometry)ce.push(js(_e,O))}else if(Q==="MultiPolygon"){ce=[];for(const _e of se.geometry){const ue=[];for(const ge of _e)ue.push(js(ge,O));ce.push(ue)}}U.push(en(se.id,Q,ce,se.tags))}return U}function js(xe,O){const U=[];U.size=xe.size,xe.start!==void 0&&(U.start=xe.start,U.end=xe.end);for(let X=0;X<xe.length;X+=3)U.push(xe[X]+O,xe[X+1],xe[X+2]);return U}function ra(xe,O){if(xe.transformed)return xe;const U=1<<xe.z,X=xe.x,se=xe.y;for(const Q of xe.features){const ce=Q.geometry,_e=Q.type;if(Q.geometry=[],_e===1)for(let ue=0;ue<ce.length;ue+=2)Q.geometry.push(Yi(ce[ue],ce[ue+1],O,U,X,se));else for(let ue=0;ue<ce.length;ue++){const ge=[];for(let Re=0;Re<ce[ue].length;Re+=2)ge.push(Yi(ce[ue][Re],ce[ue][Re+1],O,U,X,se));Q.geometry.push(ge)}}return xe.transformed=!0,xe}function Yi(xe,O,U,X,se,Q){return[Math.round(U*(xe*X-se)),Math.round(U*(O*X-Q))]}function Gs(xe,O,U,X,se){const Q=O===se.maxZoom?0:se.tolerance/((1<<O)*se.extent),ce={features:[],numPoints:0,numSimplified:0,numFeatures:xe.length,source:null,x:U,y:X,z:O,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const _e of xe)na(ce,_e,Q,se);return ce}function na(xe,O,U,X){const se=O.geometry,Q=O.type,ce=[];if(xe.minX=Math.min(xe.minX,O.minX),xe.minY=Math.min(xe.minY,O.minY),xe.maxX=Math.max(xe.maxX,O.maxX),xe.maxY=Math.max(xe.maxY,O.maxY),Q==="Point"||Q==="MultiPoint")for(let _e=0;_e<se.length;_e+=3)ce.push(se[_e],se[_e+1]),xe.numPoints++,xe.numSimplified++;else if(Q==="LineString")yn(ce,se,xe,U,!1,!1);else if(Q==="MultiLineString"||Q==="Polygon")for(let _e=0;_e<se.length;_e++)yn(ce,se[_e],xe,U,Q==="Polygon",_e===0);else if(Q==="MultiPolygon")for(let _e=0;_e<se.length;_e++){const ue=se[_e];for(let ge=0;ge<ue.length;ge++)yn(ce,ue[ge],xe,U,!0,ge===0)}if(ce.length){let _e=O.tags||null;if(Q==="LineString"&&X.lineMetrics){_e={};for(const ge in O.tags)_e[ge]=O.tags[ge];_e.mapbox_clip_start=se.start/se.size,_e.mapbox_clip_end=se.end/se.size}const ue={geometry:ce,type:Q==="Polygon"||Q==="MultiPolygon"?3:Q==="LineString"||Q==="MultiLineString"?2:1,tags:_e};O.id!==null&&(ue.id=O.id),xe.features.push(ue)}}function yn(xe,O,U,X,se,Q){const ce=X*X;if(X>0&&O.size<(se?ce:X))return void(U.numPoints+=O.length/3);const _e=[];for(let ue=0;ue<O.length;ue+=3)(X===0||O[ue+2]>ce)&&(U.numSimplified++,_e.push(O[ue],O[ue+1])),U.numPoints++;se&&function(ue,ge){let Re=0;for(let ve=0,Ze=ue.length,at=Ze-2;ve<Ze;at=ve,ve+=2)Re+=(ue[ve]-ue[at])*(ue[ve+1]+ue[at+1]);if(Re>0===ge)for(let ve=0,Ze=ue.length;ve<Ze/2;ve+=2){const at=ue[ve],ct=ue[ve+1];ue[ve]=ue[Ze-2-ve],ue[ve+1]=ue[Ze-1-ve],ue[Ze-2-ve]=at,ue[Ze-1-ve]=ct}}(_e,Q),xe.push(_e)}const Eu={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class oc{constructor(O,U){const X=(U=this.options=function(Q,ce){for(const _e in ce)Q[_e]=ce[_e];return Q}(Object.create(Eu),U)).debug;if(X&&console.time("preprocess data"),U.maxZoom<0||U.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(U.promoteId&&U.generateId)throw new Error("promoteId and generateId cannot be used together.");let se=function(Q,ce){const _e=[];
14if(Q.type==="FeatureCollection")for(let ue=0;ue<Q.features.length;ue++)Bs(_e,Q.features[ue],ce,ue);else Bs(_e,Q.type==="Feature"?Q:{geometry:Q},ce);return _e}(O,U);this.tiles={},this.tileCoords=[],X&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",U.indexMaxZoom,U.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),se=function(Q,ce){const _e=ce.buffer/ce.extent;let ue=Q;const ge=gn(Q,1,-1-_e,_e,0,-1,2,ce),Re=gn(Q,1,1-_e,2+_e,0,-1,2,ce);return(ge||Re)&&(ue=gn(Q,1,-_e,1+_e,0,-1,2,ce)||[],ge&&(ue=yo(ge,1).concat(ue)),Re&&(ue=ue.concat(yo(Re,-1)))),ue}(se,U),se.length&&this.splitTile(se,0,0,0),X&&(se.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,U,X,se,Q,ce,_e){const ue=[O,U,X,se],ge=this.options,Re=ge.debug;for(;ue.length;){se=ue.pop(),X=ue.pop(),U=ue.pop(),O=ue.pop();const ve=1<<U,Ze=xo(U,X,se);let at=this.tiles[Ze];if(!at&&(Re>1&&console.time("creation"),at=this.tiles[Ze]=Gs(O,U,X,se,ge),this.tileCoords.push({z:U,x:X,y:se}),Re)){Re>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",U,X,se,at.numFeatures,at.numPoints,at.numSimplified),console.timeEnd("creation"));const ai=`z${U}`;this.stats[ai]=(this.stats[ai]||0)+1,this.total++}if(at.source=O,Q==null){if(U===ge.indexMaxZoom||at.numPoints<=ge.indexMaxPoints)continue}else{if(U===ge.maxZoom||U===Q)continue;if(Q!=null){const ai=Q-U;if(X!==ce>>ai||se!==_e>>ai)continue}}if(at.source=null,O.length===0)continue;Re>1&&console.time("clipping");const ct=.5*ge.buffer/ge.extent,At=.5-ct,Ct=.5+ct,zt=1+ct;let Ht=null,kt=null,Ii=null,qi=null,$i=gn(O,ve,X-ct,X+Ct,0,at.minX,at.maxX,ge),_i=gn(O,ve,X+At,X+zt,0,at.minX,at.maxX,ge);O=null,$i&&(Ht=gn($i,ve,se-ct,se+Ct,1,at.minY,at.maxY,ge),kt=gn($i,ve,se+At,se+zt,1,at.minY,at.maxY,ge),$i=null),_i&&(Ii=gn(_i,ve,se-ct,se+Ct,1,at.minY,at.maxY,ge),qi=gn(_i,ve,se+At,se+zt,1,at.minY,at.maxY,ge),_i=null),Re>1&&console.timeEnd("clipping"),ue.push(Ht||[],U+1,2*X,2*se),ue.push(kt||[],U+1,2*X,2*se+1),ue.push(Ii||[],U+1,2*X+1,2*se),ue.push(qi||[],U+1,2*X+1,2*se+1)}}getTile(O,U,X){O=+O,U=+U,X=+X;const se=this.options,{extent:Q,debug:ce}=se;if(O<0||O>24)return null;const _e=1<<O,ue=xo(O,U=U+_e&_e-1,X);if(this.tiles[ue])return ra(this.tiles[ue],Q);ce>1&&console.log("drilling down to z%d-%d-%d",O,U,X);let ge,Re=O,ve=U,Ze=X;for(;!ge&&Re>0;)Re--,ve>>=1,Ze>>=1,ge=this.tiles[xo(Re,ve,Ze)];return ge&&ge.source?(ce>1&&(console.log("found parent tile z%d-%d-%d",Re,ve,Ze),console.time("drilling down")),this.splitTile(ge.source,Re,ve,Ze,O,U,X),ce>1&&console.timeEnd("drilling down"),this.tiles[ue]?ra(this.tiles[ue],Q):null):null}}function xo(xe,O,U){return 32*((1<<xe)*U+O)+xe}function He(xe,O){const U=xe.tileID.canonical;if(!this._geoJSONIndex)return void O(null,null);const X=this._geoJSONIndex.getTile(U.z,U.x,U.y);if(!X)return void O(null,null);const se=ue=>ue.tags&&"3d_elevation_id"in ue.tags&&"source"in ue.tags&&ue.tags.source==="elevation",Q=X.features.filter(ue=>se(ue));let ce;if(Q.length>0){const ue=X.features.filter(ge=>!se(ge));ce=new ks({_geojsonTileLayer:ue,hd_road_elevation:Q})}else ce=new mn(X.features);let _e=Ko(ce);_e.byteOffset===0&&_e.byteLength===_e.buffer.byteLength||(_e=new Uint8Array(_e)),O(null,{vectorTile:ce,rawData:_e.buffer})}class gs extends Tr{constructor(O,U,X,se,Q,ce,_e){super(O,U,X,se,Q,He,_e),ce&&(this.loadGeoJSON=ce),this._dynamicIndex=new yr}loadData(O,U){const X=O&&O.request,se=X&&X.collectResourceTiming;this.loadGeoJSON(O,(Q,ce)=>{if(Q||!ce)return U(Q);if(typeof ce!="object")return U(new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`));{try{if(O.filter){const ue=o.X(O.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ue.result==="error")throw new Error(ue.value.map(ge=>`${ge.key}: ${ge.message}`).join(", "));ce.features=ce.features.filter(ge=>ue.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 ms(function({superclusterOptions:ue,clusterProperties:ge}){if(!ge||!ue)return ue;const Re={},ve={},Ze={accumulated:null,zoom:0},at={properties:null},ct=Object.keys(ge);for(const At of ct){const[Ct,zt]=ge[At],Ht=o.X(zt),kt=o.X(typeof Ct=="string"?[Ct,["accumulated"],["get",At]]:Ct);Re[At]=Ht.value,ve[At]=kt.value}return ue.map=At=>{at.properties=At;const Ct={};for(const zt of ct)Ct[zt]=Re[zt].evaluate(Ze,at);return Ct},ue.reduce=(At,Ct)=>{at.properties=Ct;for(const zt of ct)Ze.accumulated=At[zt],At[zt]=ve[zt].evaluate(Ze,at)},ue}(O)).load(ce.features):O.dynamic?this._dynamicIndex:function(ue,ge){return new oc(ue,ge)}(ce,O.geojsonVtOptions)}catch(ue){return U(ue)}const _e={};if(se){const ue=Gt(X);ue&&(_e.resourceTiming={},_e.resourceTiming[O.source]=JSON.parse(JSON.stringify(ue)))}U(null,_e)}})}reloadTile(O,U){const X=this.loaded;return X&&X[O.uid]?O.partial?U(null,void 0):super.reloadTile(O,U):this.loadTile(O,U)}loadGeoJSON(O,U){if(O.request)o.n(O.request,U);else{if(typeof O.data!="string")return U(new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`));try{return U(null,JSON.parse(O.data))}catch{return U(new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(O,U){try{U(null,this._geoJSONIndex.getClusterExpansionZoom(O.clusterId))}catch(X){U(X)}}
14getClusterChildren(O,U){try{U(null,this._geoJSONIndex.getChildren(O.clusterId))}catch(X){U(X)}}getClusterLeaves(O,U){try{U(null,this._geoJSONIndex.getLeaves(O.clusterId,O.limit,O.offset))}catch(X){U(X)}}}class Iu{constructor(O,U,X){this.tileID=new o.aM(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=U,this.worldview=X}parse(O,U,X,se){this.status="parsing";const Q=new o.aM(X.tileID.overscaledZ,X.tileID.wrap,X.tileID.canonical.z,X.tileID.canonical.x,X.tileID.canonical.y),ce=[],_e=U.familiesBySource[X.source],ue=new o.f0(Q,X.promoteId);ue.bucketLayerIDs=[],ue.is3DTile=!0,o.fi(O).then(ge=>{if(!ge)return se(new Error("Could not parse tile"));const Re=ge.json.extensionsUsed&&ge.json.extensionsUsed.includes("MAPBOX_mesh_features")||ge.json.asset.extras&&ge.json.asset.extras.MAPBOX_mesh_features,ve=ge.json.extensionsUsed&&ge.json.extensionsUsed.includes("EXT_meshopt_compression"),Ze=new o.aa(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const at in _e)for(const ct of _e[at]){const At=ct[0];ue.bucketLayerIDs.push(ct.map(Ht=>o.C(Ht.id,Ht.scope))),At.recalculate(Ze,[]);const Ct=o.fj(ge,1/o.cU(X.tileID.canonical)),zt=new o.fk(ct,Ct,Q,Re,ve,this.brightness,ue,this.worldview);Re||(zt.needsUpload=!0),ce.push(zt),zt.evaluate(At)}this.status="done",se(null,{buckets:ce,featureIndex:ue,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(ge=>se(new Error(ge.message)))}}class Ja{constructor(O,U,X,se,Q,ce,_e,ue){this.actor=O,this.layerIndex=U,this.availableImages=X,this.availableModels=se,this.brightness=_e,this.loading={},this.loaded={},this.worldview=ue}loadTile(O,U){const X=O.uid,se=this.loading[X]=new Iu(O,this.brightness,this.worldview);o.br(O.request,(Q,ce)=>{const _e=!this.loading[X];return delete this.loading[X],_e||Q?(se.status="done",_e||(this.loaded[X]=se),U(Q)):ce&&ce.byteLength!==0?void se.parse(ce,this.layerIndex,O,(ue,ge)=>{se.status="done",this.loaded=this.loaded||{},this.loaded[X]=se,ue||!ge?U(ue):U(null,ge)}):(se.status="done",this.loaded[X]=se,U())})}reloadTile(O,U){const X=this.loaded,se=O.uid;if(X&&X[se]){const Q=X[se];Q.projection=O.projection,Q.brightness=O.brightness;const ce=(_e,ue)=>{Q.reloadCallback&&(delete Q.reloadCallback,this.loadTile(O,U)),U(_e,ue)};Q.status==="parsing"?Q.reloadCallback=ce:Q.status==="done"&&this.loadTile(O,U)}}abortTile(O,U){const X=O.uid;this.loading[X]&&delete this.loading[X],U()}removeTile(O,U){const X=this.loaded,se=O.uid;X&&X[se]&&delete X[se],U()}}class ni{constructor(O){this.self=O,this.actor=new o.fm(O,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new o.y,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=o.ce({name:"mercator"}),this.workerSourceTypes={vector:Tr,geojson:gs,"raster-dem":zi,"raster-array":dr,"batched-model":Ja},this.workerSources={},this.self.registerWorkerSource=(U,X)=>{if(this.workerSourceTypes[U])throw new Error(`Worker source with name "${U}" already registered.`);this.workerSourceTypes[U]=X},this.self.registerRTLTextPlugin=U=>{if(o.fn.isParsed())throw new Error("RTL text plugin already registered.");o.fn.setState({pluginStatus:o.fo.parsed,pluginURL:o.fn.getPluginURL()}),o.fn.applyArabicShaping=U.applyArabicShaping,o.fn.processBidirectionalText=U.processBidirectionalText,o.fn.processStyledBidirectionalText=U.processStyledBidirectionalText;for(const X of this.rtlPluginParsingListeners)X(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(O,U,X){delete this.layerIndexes[O],delete this.availableImages[O],delete this.availableModels[O],delete this.workerSources[O],X()}checkIfReady(O,U,X){X()}setReferrer(O,U){this.referrer=U}spriteLoaded(O,U){this.isSpriteLoaded[O]||(this.isSpriteLoaded[O]={});const{scope:X,isLoaded:se}=U;if(this.isSpriteLoaded[O][X]=se,this.workerSources[O]&&this.workerSources[O][X])for(const Q in this.workerSources[O][X]){const ce=this.workerSources[O][X][Q];for(const _e in ce){const ue=ce[_e];ue instanceof Tr&&(ue.isSpriteLoaded=se,ue.fire(new o.A("isSpriteLoaded")))}}}setImages(O,U,X){this.availableImages[O]||(this.availableImages[O]={});const{scope:se,images:Q}=U;if(this.availableImages[O][se]=Q,this.workerSources[O]&&this.workerSources[O][se]){for(const ce in this.workerSources[O][se]){const _e=this.workerSources[O][se][ce];for(const ue in _e)_e[ue].availableImages=Q}X()}else X()}setModels(O,{scope:U,models:X}
14,se){if(this.availableModels[O]||(this.availableModels[O]={}),this.availableModels[O][U]=X,this.workerSources[O]&&this.workerSources[O][U]){for(const Q in this.workerSources[O][U]){const ce=this.workerSources[O][U][Q];for(const _e in ce)ce[_e].availableModels=X}se()}else se()}setProjection(O,U){this.projections[O]=o.ce(U)}setBrightness(O,U,X){this.brightness=U,X()}setWorldview(O,U,X){this.worldview=U,X()}setLayers(O,U,X){this.getLayerIndex(O,U.scope).replace(U.layers,U.options),X()}updateLayers(O,U,X){this.getLayerIndex(O,U.scope).update(U.layers,U.removedIds,U.options),X()}loadTile(O,U,X){U.projection=this.projections[O]||this.defaultProjection,this.getWorkerSource(O,U.type,U.source,U.scope).loadTile(U,X)}decodeRasterArray(O,U,X){this.getWorkerSource(O,U.type,U.source,U.scope).decodeRasterArray(U,X)}reloadTile(O,U,X){U.projection=this.projections[O]||this.defaultProjection,this.getWorkerSource(O,U.type,U.source,U.scope).reloadTile(U,X)}abortTile(O,U,X){this.getWorkerSource(O,U.type,U.source,U.scope).abortTile(U,X)}removeTile(O,U,X){this.getWorkerSource(O,U.type,U.source,U.scope).removeTile(U,X)}removeSource(O,U,X){if(!(this.workerSources[O]&&this.workerSources[O][U.scope]&&this.workerSources[O][U.scope][U.type]&&this.workerSources[O][U.scope][U.type][U.source]))return;const se=this.workerSources[O][U.scope][U.type][U.source];delete this.workerSources[O][U.scope][U.type][U.source],se.removeSource!==void 0?se.removeSource(U,X):X()}loadWorkerSource(O,U,X){try{this.self.importScripts(U.url),X()}catch(se){X(se.toString())}}syncRTLPluginState(O,U,X){if(o.fn.isParsed())X(null,!0);else if(o.fn.isParsing())this.rtlPluginParsingListeners.push(X);else try{o.fn.setState(U);const se=o.fn.getPluginURL();!o.fn.isLoaded()||o.fn.isParsed()||o.fn.isParsing()||se==null||(o.fn.setState({pluginStatus:o.fo.parsing,pluginURL:o.fn.getPluginURL()}),this.self.importScripts(se),o.fn.isParsed()?X(null,!0):this.rtlPluginParsingListeners.push(X))}catch(se){X(se.toString())}}setDracoUrl(O,U){this.dracoUrl=U}getAvailableImages(O,U){this.availableImages[O]||(this.availableImages[O]={});let X=this.availableImages[O][U];return X||(X=[]),X}getAvailableModels(O,U){this.availableModels[O]||(this.availableModels[O]={});let X=this.availableModels[O][U];return X||(X={}),X}getLayerIndex(O,U){this.layerIndexes[O]||(this.layerIndexes[O]={});let X=this.layerIndexes[O][U];return X||(X=this.layerIndexes[O][U]=new oi,X.scope=U),X}getWorkerSource(O,U,X,se){const Q=this.workerSources;return Q[O]||(Q[O]={}),Q[O][se]||(Q[O][se]={}),Q[O][se][U]||(Q[O][se][U]={}),this.isSpriteLoaded[O]||(this.isSpriteLoaded[O]={}),Q[O][se][U][X]||(Q[O][se][U][X]=new this.workerSourceTypes[U]({send:(ce,_e,ue,ge,Re,ve)=>this.actor.send(ce,_e,ue,O,Re,ve),scheduler:this.actor.scheduler},this.getLayerIndex(O,se),this.getAvailableImages(O,se),this.getAvailableModels(O,se),this.isSpriteLoaded[O][se],void 0,this.brightness,this.worldview)),Q[O][se][U][X]}rasterizeImagesWorker(O,U,X){const se=new Map;for(const[Q,{image:ce,imageVariant:_e}]of U.tasks.entries()){const ue=this.imageRasterizer.rasterize(_e,ce,U.scope,O);se.set(Q,ue)}X(void 0,se)}removeRasterizedImages(O,U,X){this.imageRasterizer.removeImagesFromCacheByIds(U.imageIds,U.scope,O),X()}enforceCacheSizeLimit(O,U){o.fp(U)}getWorkerPerformanceMetrics(O,U,X){X(void 0,void 0)}}return o.fl(self)&&(self.worker=new ni(self)),ni}),gt(["./shared"],function(o){var Gt="3.13.0";const ft={create:"create",load:"load",fullLoad:"fullLoad"},ri={mark(l){performance.mark(l)},measure(l,t,n){performance.measure(l,t,n)}};function oi(l){const t=l.name.split("?")[0];return o.a(t)&&t.includes("mapbox-gl.js")?"javascript":o.a(t)&&t.includes("mapbox-gl.css")?"css":o.b(t)?"fontRange":o.c(t)?"sprite":o.i(t)?"style":o.d(t)?"tilejson":"other"}var sr,pr={},Kr=function(){if(sr)return pr;function l(c){return!t(c)}function t(c){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var p,m,y=new Blob([""],{type:"text/javascript"}),x=URL.createObjectURL(y);try{m=new Worker(x),p=!0}catch{p=!1}return m&&m.terminate(),URL.revokeObjectURL(x),p}()?function(){var p=document.createElement("canvas");p.width=p.height=1;var m=p.getContext("2d");if(!m)return!1;var y=m.getImageData(0,0,1,1);return y&&y.width===p.width}()?(n[d=c&&c.failIfMajorPerformanceCaveat]===void 0&&(n[d]=function(p){var m,y=function(x){var T=document.createElement("canvas"),S=Object.create(l.webGLContextAttributes);return S.failIfMajorPerformanceCaveat=x,T.getContext("webgl2",S)}(p);if(!y)return!1;try{m=y.createShader(y.VERTEX_SHADER)}catch{return!1}return!(!m||y.isContextLost())&&(y.shaderSource(m,"void main() {}"),y.compileShader(m),y.getShaderParameter(m,y.COMPILE_STATUS)===!0)}(d)),n[d]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var d}sr=1,pr.supported=l,pr.notSupportedReason=t;var n={};return l.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},pr}();function Dt(l,t,n){const c=document.createElement(l);return t!=null&&(c.className=t),n&&n.appendChild(c),c}function Tr(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 zi=typeof document<"u"?document.documentElement&&document.documentElement.style:null,Fr=zi&&zi.userSelect!==void 0?"userSelect":"WebkitUserSelect";let dr;function Dn(){zi&&Fr&&(dr=zi[Fr],zi[Fr]="none")}function cn(){zi&&Fr&&(zi[Fr]=dr)}function mn(l){l.preventDefault(),l.stopPropagation(),window.removeEventListener("click",mn,!0)}function Xo(){window.addEventListener("click",mn,!0),window.setTimeout(()=>{window.removeEventListener("click",mn,!0)},0)}function ks(l,t){const n=l.getBoundingClientRect();return yr(l,n,t)}function ns(l,t){const n=l.getBoundingClientRect(),c=[];for(let d=0;d<t.length;d++)c.push(yr(l,n,t[d]));return c}function sc(l){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&l.button===2&&l.ctrlKey?0:l.button}function yr(l,t,n){const c=l.offsetWidth===t.width?1:l.offsetWidth/t.width;return new o.P((n.clientX-t.left)*c,(n.clientY-t.top)*c)}const mo="01",Jr="NO_ACCESS_TOKEN";class Ai{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",mo,n].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeStyleURL(t,n){if(!o.j(t))return t;const c=Cr(t);return c.params.push(`sdk=js-${Gt}`),c.path=`/styles/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeGlyphsURL(t,n){if(!o.j(t))return t;const c=Cr(t);return c.path=`/fonts/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeModelURL(t,n){if(!o.j(t))return t;const c=Cr(t);return c.path=`/models/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeSourceURL(t,n,c,d){if(!o.j(t))return t;const p=Cr(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=Cr(t);return o.j(t)?(c.path=`/styles/v1${c.path}/iconset.pbf`,this._makeAPIURL(c,this._customAccessToken||n)):ps(c)}normalizeSpriteURL(t,n,c,d){const p=Cr(t);return o.j(t)?(p.path=`/styles/v1${p.path}/sprite${n}${c}`,this._makeAPIURL(p,this._customAccessToken||d)):(p.path+=`${n}${c}`,ps(p))}normalizeTileURL(t,n,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!o.j(t))return t;const d=Cr(t);d.path=d.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${n||c&&d.authority!=="raster"&&c===512?"@2x":""}${o.l.supported?".webp":"$1"}`),d.authority==="raster"?d.path=`/${o.e.RASTER_URL_PREFIX}${d.path}`:d.authority==="rasterarrays"?d.path=`/${o.e.RASTERARRAYS_URL_PREFIX}${d.path}`:d.authority==="3dtiles"?d.path=`/${o.e.TILES3D_URL_PREFIX}${d.path}`:(d.path=d.path.replace(/^.+\/v4\//,"/"),d.path=`/${o.e.TILE_URL_VERSION}${d.path}`);const p=this._customAccessToken||function(m){for(const y of m){const x=y.match(/^access_token=(.*)$/);if(x)return x[1]}return null}(d.params)||o.e.ACCESS_TOKEN;return o.e.REQUIRE_ACCESS_TOKEN&&p&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,p)}canonicalizeTileURL(t,n){const c=Cr(t);if(!c.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!c.path.match(/\.[\w]+$/))return t;let d="mapbox://";c.path.match(/^\/raster\/v1\//)?d+=`raster/${c.path.replace(`/${o.e.RASTER_URL_PREFIX}/`,"")}`:c.path.match(/^\/rasterarrays\/v1\//)?d+=`rasterarrays/${c.path.replace(`/${o.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:d+=`tiles/${c.path.replace(`/${o.e.TILE_URL_VERSION}/`,"")}`;let 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&&o.j(n),d=[];
14for(const p of t.tiles||[])o.k(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=Cr(o.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}`),!o.e.REQUIRE_ACCESS_TOKEN)return ps(t);if(n=n||o.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!n)throw new Error(`An API access token is required to use Mapbox GL. ${c}`);if(n[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${c}`)}return t.params=t.params.filter(p=>p.indexOf("access_token")===-1),t.params.push(`access_token=${n||""}`),ps(t)}}const xr=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Cr(l){const t=l.match(xr);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 ps(l){const t=l.params.length?`?${l.params.join("&")}`:"";return`${l.protocol}://${l.authority}${l.path}${t}`}const fs="mapbox.eventData";function qn(l){if(!l)return null;const t=l.split(".");if(!t||t.length!==3)return null;try{return JSON.parse(o.m(t[1]))}catch{return null}}class Xi{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const n=qn(o.e.ACCESS_TOKEN);let c="";return c=n&&n.u?o.f(n.u):o.e.ACCESS_TOKEN||"",t?`${fs}.${t}:${c}`:`${fs}:${c}`}fetchEventData(){const t=o.s("localStorage"),n=this.getStorageKey(),c=this.getStorageKey("uuid");if(t)try{const d=localStorage.getItem(n);d&&(this.eventData=JSON.parse(d));const p=localStorage.getItem(c);p&&(this.anonId=p)}catch{o.w("Unable to read from LocalStorage")}}saveEventData(){const t=o.s("localStorage"),n=this.getStorageKey(),c=this.getStorageKey("uuid"),d=this.anonId;if(t&&d)try{localStorage.setItem(c,d),Object.keys(this.eventData).length>=1&&localStorage.setItem(n,JSON.stringify(this.eventData))}catch{o.w("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,n,c,d){if(!o.e.EVENTS_URL)return;const p=Cr(o.e.EVENTS_URL);p.params.push(`access_token=${d||o.e.ACCESS_TOKEN||""}`);const m={event:this.type,created:new Date(t).toISOString()},y=n?o.h(m,n):m,x={url:ps(p),headers:{"Content-Type":"text/plain"},body:JSON.stringify([y])};this.pendingRequest=o.p(x,T=>{this.pendingRequest=null,c(T),this.saveEventData(),this.processRequests(d)})}queueRequest(t,n){this.queue.push(t),this.processRequests(n)}}const In=new class extends Xi{constructor(l){super("appUserTurnstile"),this._customAccessToken=l}postTurnstileEvent(l,t){o.e.EVENTS_URL&&o.e.ACCESS_TOKEN&&Array.isArray(l)&&l.some(n=>o.j(n)||o.k(n))&&this.queueRequest(Date.now(),t)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=qn(o.e.ACCESS_TOKEN),n=t?t.u:o.e.ACCESS_TOKEN;let c=n!==this.eventData.tokenU;o.v(this.anonId)||(this.anonId=o.u(),c=!0);const d=this.queue.shift();if(this.eventData.lastSuccess){const p=new Date(this.eventData.lastSuccess),m=new Date(d),y=(d-this.eventData.lastSuccess)/864e5;c=c||y>=1||y<-1||p.getDate()!==m.getDate()}else c=!0;c?this.postEvent(d,{sdkIdentifier:"mapbox-gl-js",sdkVersion:Gt,skuId:mo,"enabled.telemetry":!1,userId:this.anonId},p=>{p||(this.eventData.lastSuccess=d,this.eventData.tokenU=n)},l):this.processRequests()}},$n=In.postTurnstileEvent.bind(In),Yo=new class extends Xi{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(l,t,n,c){this.skuToken=t,this.errorCb=c,o.e.EVENTS_URL&&(n||o.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},n):this.errorCb(new Error(Jr)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||(this.anonId||this.fetchEventData(),o.v(this.anonId)||(this.anonId=o.u()),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:Gt,skuId:mo,skuToken:this.skuToken,userId:this.anonId},c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l))}remove(){this.errorCb=null}},Ko=Yo.postMapLoadEvent.bind(Yo),tr=new class extends Xi{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(l){let t=this.mapInstanceIdMap.get(l);return t||(t=o.u(),this.mapInstanceIdMap.set(l,t)),t}getEventId(l){const t=this.eventIdPerMapInstanceMap.get(l)||0;return this.eventIdPerMapInstanceMap.set(l,t+1),t}postStyleLoadEvent(l,t){const{map:n,style:c,importedStyles:d}=t;if(!o.e.EVENTS_URL||!l&&!o.e.ACCESS_TOKEN)return;const 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)}},_r=tr.postStyleLoadEvent.bind(tr),Pr=new class extends Xi{constructor(){super("gljs.performance")}postPerformanceEvent(l,t){o.e.EVENTS_URL&&(l||o.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,performanceData:n}=this.queue.shift(),c=function(d){const p=performance.getEntriesByType("resource"),m=performance.getEntriesByType("mark"),y=function(C){const L={};if(C){for(const R in C)if(R!=="other")for(const F of C[R]){const B=`${R}ResolveRangeMin`,V=`${R}ResolveRangeMax`,Z=`${R}RequestCount`,Y=`${R}RequestCachedCount`;L[B]=Math.min(L[B]||1/0,F.startTime),L[V]=Math.max(L[V]||-1/0,F.responseEnd);const te=ee=>{L[ee]===void 0&&(L[ee]=0),++L[ee]};F.transferSize!==void 0&&F.transferSize===0&&te(Y),te(Z)}}return L}(function(C,L){const R={};if(C)for(const F of C){const B=L(F);R[B]===void 0&&(R[B]=[]),R[B].push(F)}return R}(p,oi)),x=window.devicePixelRatio,T=navigator.connection||navigator.mozConnection||navigator.webkitConnection,S=T?T.effectiveType:void 0,M={counters:[],metadata:[],attributes:[]},I=(C,L,R)=>{R!=null&&C.push({name:L,value:R.toString()})};for(const C in y)I(M.counters,C,y[C]);if(d.interactionRange[0]!==1/0&&d.interactionRange[1]!==-1/0&&(I(M.counters,"interactionRangeMin",d.interactionRange[0]),I(M.counters,"interactionRangeMax",d.interactionRange[1])),m)for(const C of Object.keys(ft)){const L=ft[C],R=m.find(F=>F.name===L);R&&I(M.counters,L,R.startTime)}return I(M.counters,"visibilityHidden",d.visibilityHidden),I(M.attributes,"style",function(C){if(C)for(const L of C){const R=L.name.split("?")[0];if(o.i(R)){const F=R.split("/").slice(-2);if(F.length===2)return`mapbox://styles/${F[0]}/${F[1]}`}}}(p)),I(M.attributes,"terrainEnabled",d.terrainEnabled?"true":"false"),I(M.attributes,"fogEnabled",d.fogEnabled?"true":"false"),I(M.attributes,"projection",d.projection),I(M.attributes,"zoom",d.zoom),I(M.metadata,"devicePixelRatio",x),I(M.metadata,"connectionEffectiveType",S),I(M.metadata,"navigatorUserAgent",navigator.userAgent),I(M.metadata,"screenWidth",window.screen.width),I(M.metadata,"screenHeight",window.screen.height),I(M.metadata,"windowWidth",window.innerWidth),I(M.metadata,"windowHeight",window.innerHeight),I(M.metadata,"mapWidth",d.width/x),I(M.metadata,"mapHeight",d.height/x),I(M.metadata,"webglRenderer",d.renderer),I(M.metadata,"webglVendor",d.vendor),I(M.metadata,"sdkVersion",Gt),I(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)}},Ln=Pr.postPerformanceEvent.bind(Pr),Gi=new class extends Xi{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(l,t,n,c){if(!o.e.API_URL||!o.e.SESSION_PATH)return;const d=Cr(o.e.API_URL+o.e.SESSION_PATH);d.params.push(`sku=${t||""}`),d.params.push(`access_token=${c||o.e.ACCESS_TOKEN||""}`);const p={url:ps(d),headers:{"Content-Type":"text/plain"}};this.pendingRequest=o.g(p,m=>{this.pendingRequest=null,n(m),this.saveEventData(),this.processRequests(c)})}getSessionAPI(l,t,n,c){this.skuToken=t,this.errorCb=c,o.e.SESSION_PATH&&o.e.API_URL&&(n||o.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},n):this.errorCb(new Error(Jr)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:n}=this.queue.shift();
14t&&this.success[t]||this.getSession(n,this.skuToken,c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l)}remove(){this.errorCb=null}},Jo=Gi.getSessionAPI.bind(Gi),ms=new Set;function Zn(l,t){t?ms.add(l):ms.delete(l)}class gr{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(t,n){this._updatedSourceCaches[t]=n,this.setDirty()}discardSourceCacheUpdate(t){delete this._updatedSourceCaches[t]}updateLayer(t){const n=t.scope;this._updatedLayers[n]=this._updatedLayers[n]||new Set,this._updatedLayers[n].add(t.id),this.setDirty()}removeLayer(t){const n=t.scope;this._removedLayers[n]=this._removedLayers[n]||{},this._updatedLayers[n]=this._updatedLayers[n]||new Set,this._removedLayers[n][t.id]=t,this._updatedLayers[n].delete(t.id),this._updatedPaintProps.delete(t.fqid),this.setDirty()}getRemovedLayer(t){return this._removedLayers[t.scope]?this._removedLayers[t.scope][t.id]:null}discardLayerRemoval(t){this._removedLayers[t.scope]&&delete this._removedLayers[t.scope][t.id]}getLayerUpdatesByScope(){const t={};for(const n in this._updatedLayers)t[n]=t[n]||{},t[n].updatedIds=Array.from(this._updatedLayers[n].values());for(const n in this._removedLayers)t[n]=t[n]||{},t[n].removedIds=Object.keys(this._removedLayers[n]);return t}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(t){this._updatedPaintProps.add(t.fqid),this.setDirty()}getUpdatedImages(t){return this._updatedImages[t]?Array.from(this._updatedImages[t].values()):[]}updateImage(t,n){this._updatedImages[n]=this._updatedImages[n]||new Set,this._updatedImages[n].add(o.I.toString(t)),this.setDirty()}resetUpdatedImages(t){this._updatedImages[t]&&this._updatedImages[t].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function Qo(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class Os extends o.E{constructor(t){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=t,t!=="raster"&&o.t()&&(this.imageRasterizerDispatcher=new o.D(o.x(),this,"Image Rasterizer Worker",1))}addScope(t){this.loaded.set(t,!1),this.imageProviders.set(t,new Map),this.images.set(t,new Map),this.updatedImages.set(t,new Set),this.callbackDispatchedThisFrame.set(t,new Set),this.patterns.set(t,new Map),this.atlasImage.set(t,new o.r({width:1,height:1}))}removeScope(t){this.loaded.delete(t),this.imageProviders.delete(t),this.images.delete(t),this.updatedImages.delete(t),this.callbackDispatchedThisFrame.delete(t),this.patterns.delete(t),this.atlasImage.delete(t);const n=this.atlasTexture.get(t);n&&(n.destroy(),this.atlasTexture.delete(t))}addImageProvider(t,n){this.imageProviders.has(n)||this.imageProviders.set(n,new Map),this.imageProviders.get(n).set(t.id,t)}removeImageProvider(t,n){this.imageProviders.has(n)&&this.imageProviders.get(n).delete(t)}getPendingImageProviders(){const t=[];for(const n of this.imageProviders.values())for(const c of n.values())c.hasPendingRequests()&&t.push(c);return t}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new o.y),this._imageRasterizer}isLoaded(){for(const t of this.loaded.keys())if(!this.loaded.get(t))return!1;return!0}setLoaded(t,n){if(this.loaded.get(n)!==t&&(this.loaded.set(n,t),t)){for(const{ids:c,callback:d}of this.requestors)this._notify(c,n,d);this.requestors=[]}}hasImage(t,n){return!!this.getImage(t,n)}getImage(t,n){return this.images.get(n).get(t.toString())}addImage(t,n,c){this._validate(t,c)&&this.images.get(n).set(t.toString(),c)}_validate(t,n){let c=!0;
vendor: 5,603 bytes, line 14
14return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "stretchX" value`))),c=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "stretchY" value`))),c=!1),this._validateContent(n.content,n)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "content" value`))),c=!1),c}_validateStretch(t,n){if(!t)return!0;let c=0;for(const d of t){if(d[0]<c||d[1]<d[0]||n<d[1])return!1;c=d[1]}return!0}_validateContent(t,n){return t?t.length!==4||!n.usvg&&(t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3])?!1:!(t[2]<t[0]||t[3]<t[1]):!0}updateImage(t,n,c){const d=this.images.get(n).get(t.toString());c.version=d.version+1,this.images.get(n).set(t.toString(),c),this.updatedImages.get(n).add(t),this.removeFromImageRasterizerCache(t,n)}clearUpdatedImages(t){this.updatedImages.get(t).clear()}removeFromImageRasterizerCache(t,n){this.spriteFormat!=="raster"&&(o.t()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[t],scope:n}):this.imageRasterizer.removeImagesFromCacheByIds([t],n))}removeImage(t,n){const c=this.images.get(n),d=c.get(t.toString());c.delete(t.toString()),this.patterns.get(n).delete(t.toString()),this.removeFromImageRasterizerCache(t,n),d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(t){return Array.from(this.images.get(t).keys()).map(n=>o.I.from(n))}getImages(t,n,c){const d=[],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 y=!0;const x=!!this.loaded.get(n),T=this.images.get(n);if(!x)for(const S of d)T.has(S.toString())||(y=!1);x||y?this._notify(d,n,c):this.requestors.push({ids:d,scope:n,callback:c})}rasterizeImages(t,n){const c=new Map,{tasks:d,scope:p}=t;for(const[m,y]of d.entries()){const x=this.getImage(y.id,p);x&&c.set(m,{image:x,imageVariant:y})}this._rasterizeImages(p,c,n)}_rasterizeImages(t,n,c){if(o.t())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:n,scope:t},c);else{const d=new Map;for(const[p,{image:m,imageVariant:y}]of n.entries())d.set(p,this.imageRasterizer.rasterize(y,m,t,0));c(void 0,d)}}getUpdatedImages(t){return this.updatedImages.get(t)||new Set}_notify(t,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 o.A("styleimagemissing",{id:m.name}))}const y=d.get(m.toString());if(!y){o.w(`Image "${m.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const x={data:y.usvg?null:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,usvg:y.usvg,version:y.version,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,hasRenderCallback:!!(y.userImage&&y.userImage.render)};y.usvg&&Object.assign(x,{width:y.icon.usvg_tree.width,height:y.icon.usvg_tree.height}),p.set(o.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),y=this.getImage(t,n);if(!y)return null;if(m){if(m.position.version===y.version)return m.position;m.position.version=y.version}else{if(y.usvg&&!y.data){const x=this.getPatternInFlightId(d,n);if(this.patternsInFlight.has(x))return null;this.patternsInFlight.add(x);const T=new o.B(t).scaleSelf(o.q.devicePixelRatio),S=new Map([[T.toString(),{image:y,imageVariant:T}]]);return this._rasterizeImages(n,S,(M,I)=>this.storePatternImage(T,n,y,c,I)),null}this.storePattern(t,n,y)}return this._updatePatternAtlas(n,c),p.get(d).position}getPatternInFlightId(t,n){return o.C(t,n)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(t,n,c,d,p){const m=t.toString(),y=p?p.get(m):void 0;y&&(c.data=y,this.storePattern(t.id,n,c),this._updatePatternAtlas(n,d),this.patternsInFlight.delete(this.getPatternInFlightId(t.id.toString(),n)))}storePattern(t,n,c){const d={w:c.data.width+2*o.F,h:c.data.height+2*o.F,x:0,y:0},p=new o.G(d,c,o.F);this.patterns.get(n).set(t.toString(),{bin:d,position:p})}bind(t,n){const c=t.gl;let d=this.atlasTexture.get(n);d?this.dirty&&(d.update(this.atlasImage.get(n)),this.dirty=!1):(d=new o.T(t,this.atlasImage.get(n),c.RGBA8),this.atlasTexture.set(n,d)),d.bind(c.LINEAR,c.CLAMP_TO_EDGE)}_updatePatternAtlas(t,n){const c=this.patterns.get(t),d=Array.from(c.values()).map(({bin:T})=>T),{w:p,h:m}=o.H(d),y=this.atlasImage.get(t);y.resize({width:p||1,height:m||1});const x=this.images.get(t);for(const[T,{bin:S,position:M}]of c.entries()){let I=M.padding;const C=S.x+I,L=S.y+I,R=x.get(T).data,F=R.width,B=R.height;I=I>1?I-1:I,o.r.copy(R,y,{x:0,y:0},{x:C,y:L},{width:F,height:B},n),o.r.copy(R,y,{x:0,y:B-I},{x:C,y:L-I},{width:F,height:I},n),o.r.copy(R,y,{x:0,y:0},{x:C,y:L+B},{width:F,height:I},n),o.r.copy(R,y,{x:F-I,y:0},{x:C-I,y:L},{width:I,height:B},n),o.r.copy(R,y,{x:0,y:0},{x:C+F,y:L},{width:I,height:B},n),o.r.copy(R,y,{x:F-I,y:B-I},{x:C-I,y:L-I},{width:I,height:I},n),o.r.copy(R,y,{x:0,y:B-I},{x:C+F,y:L-I},{width:I,height:I},n),o.r.copy(R,y,{x:0,y:0},{x:C+F,y:L+B},{width:I,height:I},n),o.r.copy(R,y,{x:F-I,y:0},{x:C-I,y:L+B},{width:I,height:I},n)}this.dirty=!0}beginFrame(){for(const t of this.images.keys())this.callbackDispatchedThisFrame.set(t,new Set)}
14dispatchRenderCallbacks(t,n){const c=this.images.get(n);for(const d of t){if(this.callbackDispatchedThisFrame.get(n).has(d.toString()))continue;this.callbackDispatchedThisFrame.get(n).add(d.toString());const p=c.get(d.toString());Qo(p)&&this.updateImage(d,n,p)}}}function Qr(l){const t=l.key,n=l.value,c=l.valueSpec||{},d=l.objectElementValidators||{},p=l.style,m=l.styleSpec;let y=[];const x=o.J(n);if(x!=="object")return[new o.V(t,n,`object expected, ${x} found`)];for(const T in n){const S=T.split(".")[0];let M;d[S]?M=d[S]:c[S]?M=Yi:d["*"]?M=d["*"]:c["*"]&&(M=Yi),M?y=y.concat(M({key:(t&&`${t}.`)+T,value:n[T],valueSpec:c[S]||c["*"],style:p,styleSpec:m,object:n,objectKey:T},n)):y.push(new o.K(t,n[T],`unknown property "${T}"`))}for(const T in c)d[T]||c[T].required&&c[T].default===void 0&&n[T]===void 0&&y.push(new o.V(t,n,`missing required property "${T}"`));return y}function _o(l){const t=l.value,n=l.valueSpec,c=l.style,d=l.styleSpec,p=l.key,m=l.arrayElementValidator||Yi;if(o.J(t)!=="array")return[new o.V(p,t,`array expected, ${o.J(t)} found`)];if(n.length&&t.length!==n.length)return[new o.V(p,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new o.V(p,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let y={type:n.value,values:n.values,minimum:n.minimum,maximum:n.maximum,function:void 0};d.$version<7&&(y.function=n.function),o.J(n.value)==="object"&&(y=n.value);let x=[];for(let T=0;T<t.length;T++)x=x.concat(m({array:t,arrayIndex:T,value:t[T],valueSpec:y,style:c,styleSpec:d,key:`${p}[${T}]`},!0));return x}function Ya(l){const t=l.key,n=l.value,c=l.valueSpec;let d=o.J(n);if(d==="number"&&n!=n&&(d="NaN"),d!=="number")return[new o.V(t,n,`number expected, ${d} found`)];if("minimum"in c){let p=c.minimum;if(o.J(c.minimum)==="array"&&(p=c.minimum[l.arrayIndex]),n<p)return[new o.V(t,n,`${n} is less than the minimum value ${p}`)]}if("maximum"in c){let p=c.maximum;if(o.J(c.maximum)==="array"&&(p=c.maximum[l.arrayIndex]),n>p)return[new o.V(t,n,`${n} is greater than the maximum value ${p}`)]}return[]}function en(l){const t=l.valueSpec,n=o.M(l.value.type);let c,d,p,m={};const y=n!=="categorical"&&l.value.property===void 0,x=!y,T=o.J(l.value.stops)==="array"&&o.J(l.value.stops[0])==="array"&&o.J(l.value.stops[0][0])==="object",S=Qr({key:l.key,value:l.value,valueSpec:l.styleSpec.function,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(C){if(n==="identity")return[new o.V(C.key,C.value,'identity function may not have a "stops" property')];let L=[];const R=C.value;return L=L.concat(_o({key:C.key,value:R,valueSpec:C.valueSpec,style:C.style,styleSpec:C.styleSpec,arrayElementValidator:M})),o.J(R)==="array"&&R.length===0&&L.push(new o.V(C.key,R,"array must have at least one stop")),L},default:function(C){return Yi({key:C.key,value:C.value,valueSpec:t,style:C.style,styleSpec:C.styleSpec})}}});return n==="identity"&&y&&S.push(new o.V(l.key,l.value,'missing required property "property"')),n==="identity"||l.value.stops||S.push(new o.V(l.key,l.value,'missing required property "stops"')),n==="exponential"&&l.valueSpec.expression&&!o.N(l.valueSpec)&&S.push(new o.V(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(x&&!o.O(l.valueSpec)?S.push(new o.V(l.key,l.value,"property functions not supported")):y&&!o.Q(l.valueSpec)&&S.push(new o.V(l.key,l.value,"zoom functions not supported"))),n!=="categorical"&&!T||l.value.property!==void 0||S.push(new o.V(l.key,l.value,'"property" property is required')),S;function M(C){let L=[];const R=C.value,F=C.key;if(o.J(R)!=="array")return[new o.V(F,R,`array expected, ${o.J(R)} found`)];if(R.length!==2)return[new o.V(F,R,`array length 2 expected, length ${R.length} found`)];if(T){if(o.J(R[0])!=="object")return[new o.V(F,R,`object expected, ${o.J(R[0])} found`)];if(R[0].zoom===void 0)return[new o.V(F,R,"object stop key must have zoom")];if(R[0].value===void 0)return[new o.V(F,R,"object stop key must have value")];const B=o.M(R[0].zoom);if(typeof B!="number")return[new o.V(F,R[0].zoom,"stop zoom values must be numbers")];if(p&&p>B)return[new o.V(F,R[0].zoom,"stop zoom values must appear in ascending order")];B!==p&&(p=B,d=void 0,m={}),L=L.concat(Qr({key:`${F}[0]`,value:R[0],valueSpec:{zoom:{}},style:C.style,styleSpec:C.styleSpec,objectElementValidators:{zoom:Ya,value:
14I}}))}else L=L.concat(I({key:`${F}[0]`,value:R[0],style:C.style,styleSpec:C.styleSpec},R));return o.S(o.U(R[1]))?L.concat([new o.V(`${F}[1]`,R[1],"expressions are not allowed in function stops.")]):L.concat(Yi({key:`${F}[1]`,value:R[1],valueSpec:t,style:C.style,styleSpec:C.styleSpec}))}function I(C,L){const R=o.J(C.value),F=o.M(C.value),B=C.value!==null?C.value:L;if(c){if(R!==c)return[new o.V(C.key,B,`${R} stop domain type must match previous stop domain type ${c}`)]}else c=R;if(R!=="number"&&R!=="string"&&R!=="boolean"&&typeof F!="number"&&typeof F!="string"&&typeof F!="boolean")return[new o.V(C.key,B,"stop domain value must be a number, string, or boolean")];if(R!=="number"&&n!=="categorical"){let V=`number expected, ${R} found`;return o.O(t)&&n===void 0&&(V+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new o.V(C.key,B,V)]}return n!=="categorical"||R!=="number"||typeof F=="number"&&isFinite(F)&&Math.floor(F)===F?n!=="categorical"&&R==="number"&&typeof F=="number"&&typeof d=="number"&&d!==void 0&&F<d?[new o.V(C.key,B,"stop domain values must appear in ascending order")]:(d=F,n==="categorical"&&F in m?[new o.V(C.key,B,"stop domain values must be unique")]:(m[F]=!0,[])):[new o.V(C.key,B,`integer expected, found ${String(F)}`)]}}function _n(l){const t=(l.expressionContext==="property"?o.W:o.X)(o.U(l.value),l.valueSpec);if(t.result==="error")return t.value.map(c=>new o.V(`${l.key}${c.key}`,l.value,c.message));const n=t.value.expression||t.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!n.outputDefined())return[new o.V(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!o.Y(n))return[new o.V(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter")return Bs(n,l);if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!o.Z(n,["zoom","feature-state"]))return[new o.V(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!o._(n))return[new o.V(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Bs(l,t){const n=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const d of t.valueSpec.expression.parameters)n.delete(
14d);if(n.size===0)return[];const c=[];return l instanceof o.$&&n.has(l.name)?[new o.V(t.key,t.value,`["${l.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(l.eachChild(d=>{c.push(...Bs(d,t))}),c)}function Ns(l){const t=l.key,n=l.value,c=l.valueSpec,d=[];return Array.isArray(c.values)?c.values.indexOf(o.M(n))===-1&&d.push(new o.V(t,n,`expected one of [${c.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(c.values).indexOf(o.M(n))===-1&&d.push(new o.V(t,n,`expected one of [${Object.keys(c.values).join(", ")}], ${JSON.stringify(n)} found`)),d}function Vs(l){return o.a1(o.U(l.value))?_n(o.L({},l,{expressionContext:"filter",valueSpec:l.styleSpec[`filter_${l.layerType||"fill"}`]})):tn(l)}function tn(l){const t=l.value,n=l.key;if(o.J(t)!=="array")return[new o.V(n,t,`array expected, ${o.J(t)} found`)];const c=l.styleSpec;let d,p=[];if(t.length<1)return[new o.V(n,t,"filter array must have at least 1 element")];switch(p=p.concat(Ns({key:`${n}[0]`,value:t[0],valueSpec:c.filter_operator,style:l.style,styleSpec:l.styleSpec})),o.M(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&o.M(t[1])==="$type"&&p.push(new o.V(n,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&p.push(new o.V(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(d=o.J(t[1]),d!=="string"&&p.push(new o.V(`${n}[1]`,t[1],`string expected, ${d} found`)));for(let m=2;m<t.length;m++)d=o.J(t[m]),o.M(t[1])==="$type"?p=p.concat(Ns({key:`${n}[${m}]`,value:t[m],valueSpec:c.geometry_type,style:l.style,styleSpec:l.styleSpec})):d!=="string"&&d!=="number"&&d!=="boolean"&&p.push(new o.V(`${n}[${m}]`,t[m],`string, number, or boolean expected, ${d} found`));break;case"any":case"all":case"none":for(let m=1;m<t.length;m++)p=p.concat(tn({key:`${n}[${m}]`,value:t[m],style:l.style,styleSpec:l.styleSpec}));break;case"has":case"!has":d=o.J(t[1]),t.length!==2?p.push(new o.V(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):d!=="string"&&p.push(new o.V(`${n}[1]`,t[1],`string expected, ${d} found`))}return p}function ea(l,t){const n=l.key,c=l.style,d=l.layer,p=l.styleSpec,m=l.value,y=l.objectKey,x=p[`${t}_${l.layerType}`];if(!x)return[];const T=y.match(/^(.*)-use-theme$/);if(t==="paint"&&T&&x[T[1]])return o.S(m)?[].concat(Yi({key:l.key,value:m,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:c,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:y})):Yi({key:n,value:m,valueSpec:{type:"string"},style:c,styleSpec:p});const S=y.match(/^(.*)-transition$/);if(t==="paint"&&S&&x[S[1]]&&x[S[1]].transition)return Yi({key:n,value:m,valueSpec:p.transition,style:c,styleSpec:p});const M=l.valueSpec||x[y];if(!M)return[new o.K(n,m,`unknown property "${y}"`)];let I;if(o.J(m)==="string"&&o.O(M)&&!M.tokens&&(I=/^{([^}]+)}$/.exec(m))){const L=`\`{ "type": "identity", "property": ${I?JSON.stringify(I[1]):'"_"'} }\``;return[new o.V(n,m,`"${y}" does not support interpolation syntax 15Use an identity property function instead: ${L}.`)]}const C=[];if(l.layerType==="symbol")y!=="text-field"||!c||c.glyphs||c.imports||C.push(new o.V(n,m,'use of "text-field" requires a style "glyphs" property')),y==="text-font"&&o.a2(o.U(m))&&o.M(m.type)==="identity"&&C.push(new o.V(n,m,'"text-font" does not support identity functions'));else if(l.layerType==="model"&&t==="paint"&&d&&d.layout&&d.layout.hasOwnProperty("model-id")&&o.O(M)&&(o.a3(M)||o.Q(M))){const L=o.W(o.U(m),M),R=L.value.expression||L.value._styleExpression.expression;R&&!o.Z(R,["measure-light"])&&(y==="model-emissive-strength"&&o._(R)&&o.Y(R)||C.push(new o.V(n,m,`${y} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return C.concat(Yi({key:l.key,value:m,valueSpec:M,style:c,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:y}))}function ta(l){return ea(l,"paint")}function gn(l){return ea(l,"layout")}function Ka(l){let t=[];const n=l.value,c=l.key,d=l.style,p=l.styleSpec;n.type||n.ref||t.push(new o.V(c,n,'either "type" or "ref" is required'));let m=o.M(n.type);const y=o.M(n.ref);
15if(n.id){const x=o.M(n.id);for(let T=0;T<l.arrayIndex;T++){const S=d.layers[T];o.M(S.id)===x&&t.push(new o.V(c,n.id,`duplicate layer id "${n.id}", previously used at line ${S.id.__line__}`))}}if("ref"in n){let x;["type","source","source-layer","filter","layout"].forEach(T=>{T in n&&t.push(new o.V(c,n[T],`"${T}" is prohibited for ref layers`))}),d.layers.forEach(T=>{o.M(T.id)===y&&(x=T)}),x?x.ref?t.push(new o.V(c,n.ref,"ref cannot reference another ref layer")):m=o.M(x.type):typeof y=="string"&&t.push(new o.V(c,n.ref,`ref layer "${y}" not found`))}else if(m!=="background"&&m!=="sky"&&m!=="slot")if(n.source){const x=d.sources&&d.sources[n.source],T=x&&o.M(x.type);x?T==="vector"&&m==="raster"?t.push(new o.V(c,n.source,`layer "${n.id}" requires a raster source`)):T==="raster"&&m!=="raster"?t.push(new o.V(c,n.source,`layer "${n.id}" requires a vector source`)):T!=="vector"||n["source-layer"]?T==="raster-dem"&&m!=="hillshade"?t.push(new o.V(c,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):T!=="raster-array"||["raster","raster-particle"].includes(m)?m==="line"&&n.paint&&(n.paint["line-gradient"]||n.paint["line-trim-offset"])&&T==="geojson"&&!x.lineMetrics?t.push(new o.V(c,n,`layer "${n.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):m==="raster-particle"&&T!=="raster-array"&&t.push(new o.V(c,n.source,`layer "${n.id}" requires a 'raster-array' source.`)):t.push(new o.V(c,n.source,"raster-array source can only be used with layer type 'raster'.")):t.push(new o.V(c,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new o.V(c,n.source,`source "${n.source}" not found`))}else t.push(new o.V(c,n,'missing required property "source"'));return t=t.concat(Qr({key:c,value:n,valueSpec:p.layer,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Yi({key:`${c}.type`,value:n.type,valueSpec:p.layer.type,style:l.style,styleSpec:l.styleSpec,object:n,objectKey:"type"}),filter:x=>Vs(o.L({layerType:m},x)),layout:x=>Qr({layer:n,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":T=>gn(o.L({layerType:m},T))}}),paint:x=>Qr({layer:n,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":T=>ta(o.L({layerType:m,layer:n},T))}})}})),t}function _s(l){const t=l.value,n=l.key,c=o.J(t);return c!=="string"?[new o.V(n,t,`string expected, ${c} found`)]:[]}const ia={promoteId:function l({key:t,value:n}){if(o.J(n)==="string")return _s({key:t,value:n});if(Array.isArray(n)){const c=[],d=o.U(n),p=o.X(d);return p.result==="error"&&p.value.forEach(m=>{c.push(new o.V(`${t}${m.key}`,null,`${m.message}`))}),o.Z(p.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||c.push(new o.V(`${t}`,null,"promoteId expression should be only feature dependent")),c}{const c=[];for(const d in n)c.push(...l({key:`${t}.${d}`,value:n[d]}));return c}}};function $r(l){const t=l.value,n=l.key,c=l.styleSpec,d=l.style;if(!t.type)return[new o.V(n,t,'"type" is required')];const p=o.M(t.type);let m=[];switch(["vector","raster","raster-dem","raster-array"].includes(p)&&(t.url||t.tiles||m.push(new o.K(n,t,'Either "url" or "tiles" is required.'))),p){case"vector":case"raster":case"raster-dem":case"raster-array":return m=m.concat(Qr({key:n,value:t,valueSpec:c[`source_${p.replace("-","_")}`],style:l.style,styleSpec:c,objectElementValidators:ia})),m;case"geojson":if(m=Qr({key:n,value:t,valueSpec:c.source_geojson,style:d,styleSpec:c,objectElementValidators:ia}),t.cluster)for(const y in t.clusterProperties){const[x,T]=t.clusterProperties[y],S=typeof x=="string"?[x,["accumulated"],["get",y]]:x;m.push(..._n({key:`${n}.${y}.map`,value:T,expressionContext:"cluster-map"})),m.push(..._n({key:`${n}.${y}.reduce`,value:S,expressionContext:"cluster-reduce"}))}return m;case"video":return Qr({key:n,value:t,valueSpec:c.source_video,style:d,styleSpec:c});case"image":return Qr({key:n,value:t,valueSpec:c.source_image,style:d,styleSpec:c});case"canvas":return[new o.V(n,null,"Please use runtime APIs to add canvas sources, rather than
15including them in stylesheets.","source.canvas")];default:return Ns({key:`${n}.type`,value:t.type,valueSpec:{values:Fn(c)}})}}function Fn(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 go(l){const t=l.value,n=l.styleSpec,c=n.light,d=l.style;let p=[];const m=o.J(t);if(t===void 0)return p;if(m!=="object")return p=p.concat([new o.V("light",t,`object expected, ${m} found`)]),p;for(const y in t){const x=y.match(/^(.*)-transition$/),T=y.match(/^(.*)-use-theme$/);p=p.concat(T&&c[T[1]]?Yi({key:y,value:t[y],valueSpec:{type:"string"},style:d,styleSpec:n}):x&&c[x[1]]&&c[x[1]].transition?Yi({key:y,value:t[y],valueSpec:n.transition,style:d,styleSpec:n}):c[y]?Yi({key:y,value:t[y],valueSpec:c[y],style:d,styleSpec:n}):[new o.V(y,t[y],`unknown property "${y}"`)])}return p}function Us(l){const t=l.value;let n=[];if(!t)return n;const c=o.J(t);if(c!=="object")return n=n.concat([new o.V("light-3d",t,`object expected, ${c} found`)]),n;const d=l.styleSpec,p=d["light-3d"],m=l.key,y=l.style,x=l.style.lights;for(const M of["type","id"])if(!(M in t))return n=n.concat([new o.V("light-3d",t,`missing property ${M} on light`)]),n;if(t.type&&x)for(let M=0;M<l.arrayIndex;M++){const I=o.M(t.type),C=x[M];o.M(C.type)===I&&n.push(new o.V(m,t.id,`duplicate light type "${t.type}", previously defined at line ${C.id.__line__}`))}const T=`properties_light_${t.type}`;if(!(T in d))return n=n.concat([new o.V("light-3d",t,`Invalid light type ${t.type}`)]),n;const S=d[T];for(const M in t)if(M==="properties"){const I=t[M],C=o.J(I);if(C!=="object")return n=n.concat([new o.V("properties",I,`object expected, ${C} found`)]),n;for(const L in I){const R=L.match(/^(.*)-transition$/),F=L.match(/^(.*)-use-theme$/);n=n.concat(F&&S[F[1]]?Yi({key:M,value:I[L],valueSpec:{type:"string"},style:y,styleSpec:d}):R&&S[R[1]]&&S[R[1]].transition?Yi({key:M,value:t[M],valueSpec:d.transition,style:y,styleSpec:d}):S[L]?Yi({key:L,value:I[L],valueSpec:S[L],style:y,styleSpec:d}):[new o.K(l.key,I[L],`unknown property "${L}"`)])}}else n=n.concat(p[M]?Yi({key:M,value:t[M],valueSpec:p[M],style:y,styleSpec:d}):[new o.K(M,t[M],`unknown property "${M}"`)]);return n}function yo(l){const t=l.value,n=l.key,c=l.style,d=l.styleSpec,p=d.terrain;let m=[];const y=o.J(t);if(t===void 0||y==="null")return m;if(y!=="object")return m=m.concat([new o.V("terrain",t,`object expected, ${y} found`)]),m;for(const x in t){const T=x.match(/^(.*)-transition$/),S=x.match(/^(.*)-use-theme$/);m=m.concat(S&&p[S[1]]?Yi({key:x,value:t[x],valueSpec:{type:"string"},style:c,styleSpec:d}):T&&p[T[1]]&&p[T[1]].transition?Yi({key:x,value:t[x],valueSpec:d.transition,style:c,styleSpec:d}):p[x]?Yi({key:x,value:t[x],valueSpec:p[x],style:c,styleSpec:d}):[new o.K(x,t[x],`unknown property "${x}"`)])}if(t.source){const x=c.sources&&c.sources[t.source],T=x&&o.M(x.type);x?T!=="raster-dem"&&m.push(new o.V(n,t.source,`terrain cannot be used with a source of type ${String(T)}, it only be used with a "raster-dem" source type`)):m.push(new o.V(n,t.source,`source "${t.source}" not found`))}else m.push(new o.V(n,t,'terrain is missing required property "source"'));return m}function js(l){const t=l.value,n=l.style,c=l.styleSpec,d=c.fog;let p=[];const m=o.J(t);if(t===void 0)return p;if(m!=="object")return p=p.concat([new o.V("fog",t,`object expected, ${m} found`)]),p;for(const y in t){const x=y.match(/^(.*)-transition$/),T=y.match(/^(.*)-use-theme$/);p=p.concat(T&&d[T[1]]?Yi({key:y,value:t[y],valueSpec:{type:"string"},style:n,styleSpec:c}):x&&d[x[1]]&&d[x[1]].transition?Yi({key:y,value:t[y],valueSpec:c.transition,style:n,styleSpec:c}):d[y]?Yi({key:y,value:t[y],valueSpec:d[y],style:n,styleSpec:c}):[new o.K(y,t[y],`unknown property "${y}"`)])}return p}const ra={"*":()=>[],array:_o,boolean:function(l){const t=l.value,n=l.key,c=o.J(t);return c!=="boolean"?[new o.V(n,t,`boolean expected, ${c} found`)]:[]},number:Ya,color:function(l){const t=l.key,n=l.value,c=o.J(n);return c!=="string"?[new o.V(t,n,`color expected, ${c} found`)]:o.a0.parseCSSColor(n)===null?[new o.V(t,n,`color expected, "${n}" found`)]:[]},enum:Ns,filter:Vs,function:en,layer:Ka,object:Qr,source:$r,model:o.a4,light:go,"light-3d":Us,terrain:yo,fog:js,string:_s,formatted:function(l){return _s(l).length===0?[]:_n(l)},resolvedImage:function(l){return _s(l).length===0?[]:_n(l)},projection:function(l){const t=l.value,n=l.styleSpec,c=n.projection,d=l.style;let p=[];const m=o.J(t);if(m==="object")for(const y in t)p=p.concat(Yi({key:y,value:t[y],valueSpec:c[y],style:d,styleSpec:n}));else m!=="string"&&(p=p.concat([new o.V("projection",t,`object or string expected, ${m}
15 found`)]));return p},import:function(l){const{value:t,styleSpec:n}=l,{data:c,...d}=t;Object.defineProperty(d,"__line__",{value:t.__line__,enumerable:!1});let p=Qr(o.L({},l,{value:d,valueSpec:n.import}));return o.M(d.id)===""&&p.push(new o.V(`${l.key}.id`,d,"import id can't be an empty string")),c&&(p=p.concat(na(c,n,{key:`${l.key}.data`}))),p},iconset:function(l){const t=l.value,n=l.key,c=l.styleSpec,d=l.style;if(!t.type)return[new o.V(n,t,'"type" is required')];const p=o.M(t.type);let m=[];if(m=m.concat(Qr({key:n,value:t,valueSpec:c[`iconset_${p}`],style:d,styleSpec:c})),p==="source"&&t.source){const y=d.sources&&d.sources[t.source],x=y&&o.M(y.type);y?x!=="raster-array"&&m.push(new o.V(n,t.source,`iconset cannot be used with a source of type ${String(x)}, it only be used with a "raster-array" source type`)):m.push(new o.V(n,t.source,`source "${t.source}" not found`))}return m}};function Yi(l,t=!1){const n=l.value,c=l.valueSpec,d=l.styleSpec;if(c.expression&&o.a2(o.M(n)))return en(l);if(c.expression&&o.S(o.U(n)))return _n(l);if(c.type&&ra[c.type]){const p=ra[c.type](l);return t===!0&&p.length>0&&o.J(l.value)==="array"?_n(l):p}return Qr(o.L({},l,{valueSpec:c.type?d[c.type]:c}))}function Gs(l){const t=l.value,n=l.key,c=_s(l);return c.length||(t.indexOf("{fontstack}")===-1&&c.push(new o.V(n,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&c.push(new o.V(n,t,'"glyphs" url must include a "{range}" token'))),c}function na(l,t=o.a5,n={}){return Yi({key:n.key||"",value:l,valueSpec:t.$root,styleSpec:t,style:l,objectElementValidators:{glyphs:Gs,"*":()=>[]}})}function yn(l,t=o.a5){return se(na(l,t))}const Eu=l=>se($r(l)),oc=l=>se(go(l)),xo=l=>se(Us(l)),He=l=>se(yo(l)),gs=l=>se(js(l)),Iu=l=>se(function(t){const n=t.value,c=t.style,d=t.styleSpec,p=d.snow;let m=[];const y=o.J(n);if(n===void 0)return m;if(y!=="object")return m=m.concat([new o.V("snow",n,`object expected, ${y} found`)]),m;for(const x in n){const T=x.match(/^(.*)-transition$/);m=m.concat(T&&p[T[1]]&&p[T[1]].transition?Yi({key:x,value:n[x],valueSpec:d.transition,style:c,styleSpec:d}):p[x]?Yi({key:x,value:n[x],valueSpec:p[x],style:c,styleSpec:d}):[new o.K(x,n[x],`unknown property "${x}"`)])}return m}(l)),Ja=l=>se(function(t){const n=t.value,c=t.style,d=t.styleSpec,p=d.rain;let m=[];const y=o.J(n);if(n===void 0)return m;if(y!=="object")return m=m.concat([new o.V("rain",n,`object expected, ${y} found`)]),m;for(const x in n){const T=x.match(/^(.*)-transition$/);m=m.concat(T&&p[T[1]]&&p[T[1]].transition?Yi({key:x,value:n[x],valueSpec:d.transition,style:c,styleSpec:d}):p[x]?Yi({key:x,value:n[x],valueSpec:p[x],style:c,styleSpec:d}):[new o.K(x,n[x],`unknown property "${x}"`)])}return m}(l)),ni=l=>se(Ka(l)),xe=l=>se(Vs(l)),O=l=>se(ta(l)),U=l=>se(gn(l)),X=l=>se(o.a4(l));function se(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 o.K?o.w(c.message):(l.fire(new o.z(new Error(c.message))),n=!0);return n}let ce;class _e extends o.E{constructor(t,n="flat"){super(),this._transitionable=new o.a6(ce||(ce=new o.a7({anchor:new o.a8(o.a5.light.anchor),position:new o.a9(o.a5.light.position),color:new o.a8(o.a5.light.color),intensity:new o.a8(o.a5.light.intensity)}))),this.setLight(t,n),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n,c={}){this._validate(oc,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(yn,o.h({value:n,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}}let ue=class extends o.E{constructor(l,t,n,c,d){super(),this.scope=n,this._transitionable=new o.a6(new o.a7({source:new o.a8(o.a5.terrain.source),exaggeration:new o.a8(o.a5.terrain.exaggeration)}),n,c),this._transitionable.setTransitionOrValue(l,c),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=t,this.worldview=d}get(){return this._transitionable.serialize()}set(l,t){this._transitionable.setTransitionOrValue(l,t)}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}getExaggeration(l){return this._transitioning.possiblyEvaluate(new o.aa(l,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const l=this._transitionable._values.exaggeration;if(!l)return null;const t=l.value.expression;if(!t)return null;let n=-1,c=-1,d=1;for(const p of t.zoomStops)d=t.evaluate(new o.aa(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 o.ab}};const ge=45,Re=65,ve=.05;function Ze(l,t,n,c){const d=o.af(ge,Re,n),[p,m]=at(l,c);let y=1-Math.min(1,Math.exp((t-p)/(m-p)*-6));return y*=y*y,y=Math.min(1,1.00747*y),y*d*l.alpha}function at(l,t){const n=.5/Math.tan(.5*t);return[l.range[0]+n,l.range[1]+n]}function ct(l,t,n,c,d){const p=o.ad([],[t,n,c],d.mercatorFogMatrix);return Ze(l,o.ae(p),d.pitch,d._fov)}function At(l,t,n,c,d,p,m){const y=[[n,c,0],[d,c,0],[d,p,0],[n,p,0]];let x=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(const S of y){const M=o.ad([],S,t),I=o.ae(M);x=Math.min(x,I),T=Math.max(T,I)}return[Ze(l,x,m.pitch,m._fov),Ze(l,T,m.pitch,m._fov)]}class Ct extends o.E{constructor(t,n,c,d){super();const p=new o.a7({range:new o.a8(o.a5.fog.range),color:new o.a8(o.a5.fog.color),"color-use-theme":new o.a8({type:"string","property-type":"data-constant",default:"default"}),"high-color":new o.a8(o.a5.fog["high-color"]),"high-color-use-theme":new o.a8({type:"string","property-type":"data-constant",default:"default"}),"space-color":new o.a8(o.a5.fog["space-color"]),"space-color-use-theme":new o.a8({type:"string","property-type":"data-constant",default:"default"}
15),"horizon-blend":new o.a8(o.a5.fog["horizon-blend"]),"star-intensity":new o.a8(o.a5.fog["star-intensity"]),"vertical-range":new o.a8(o.a5.fog["vertical-range"])});this._transitionable=new o.a6(p,c,new Map(d)),this.set(t,d),this._transitioning=this._transitionable.untransitioned(),this._transform=n,this.properties=new o.ag(p),this.scope=c}get state(){const t=this._transform,n=t.projection.name==="globe",c=o.ah(t.zoom),d=this.properties.get("range"),p=[.5,3];return{range:n?[o.ai(p[0],d[0],c),o.ai(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(gs,t,c))return;const d=o.h({},t);for(const p of Object.keys(o.a5.fog))d[p]===void 0&&(d[p]=o.a5.fog[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:o.af(ge,Re,t))*n.a}getOpacityAtLatLng(t,n){return this._transform.projection.supportsFog?function(c,d,p){const m=o.ac.fromLngLat(d),y=p.elevation?p.elevation.getAtPointOrZero(m):0;return ct(c,m.x,m.y,y,p)}(this.state,t,n):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const n=this._transform.calculateFogTileMatrix(t.toUnwrapped());return At(this.state,n,0,0,o.aj,o.aj,this._transform)}getOpacityForBounds(t,n,c,d,p){return this._transform.projection.supportsFog?At(this.state,t,n,c,d,p,this._transform):[1,1]}getFovAdjustedRange(t){return this._transform.projection.supportsFog?at(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=o.ak(m,d,m[2]/(m[2]-d[2]))}if(ct(this.state,p[0],p[1],0,this._transform)>=ve)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(yn,o.h({value:n,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}}let zt,Ht,kt,Ii,qi=class extends o.E{constructor(l,t,n,c){super();const d=zt||(zt=new o.a7({density:new o.a8(o.a5.snow.density),intensity:new o.a8(o.a5.snow.intensity),color:new o.a8(o.a5.snow.color),opacity:new o.a8(o.a5.snow.opacity),vignette:new o.a8(o.a5.snow.vignette),"vignette-color":new o.a8(o.a5.snow["vignette-color"]),"center-thinning":new o.a8(o.a5.snow["center-thinning"]),direction:new o.a8(o.a5.snow.direction),"flake-size":new o.a8(o.a5.snow["flake-size"])}));this._transitionable=new o.a6(d,n,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new o.ag(d),this.scope=n}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),n=this.properties.get("direction"),c=o.al(n[0]),d=-Math.max(o.al(n[1]),.01),p=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],m=this.properties.get("vignette"),y=this.properties.get("vignette-color");return y.a=m,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new o.am(t.r,t.g,t.b,t.a*l),direction:p,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:y}}get(){return this._transitionable.serialize()}set(l,t,n={}){if(this._validate(Iu,l,n))return;const c=o.h({},l);for(const d of Object.keys(o.a5.snow))c[d]===void 0&&(c[d]=o.a5.snow[d].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,n){return(!n||n.validate!==!1)&&Q(this,l.call(yn,o.h({value:t,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}},$i=class extends o.E{constructor(l,t,n,c){super();const d=Ht||(Ht=new o.a7({density:new o.a8(o.a5.rain.density),intensity:new o.a8(o.a5.rain.intensity),color:new o.a8(o.a5.rain.color),opacity:new o.a8(o.a5.rain.opacity),vignette:new o.a8(o.a5.rain.vignette),"vignette-color":new o.a8(o.a5.rain["vignette-color"]),"center-thinning":new o.a8(o.a5.rain["center-thinning"]),direction:new o.a8(o.a5.rain.direction),"droplet-size":new o.a8(o.a5.rain["droplet-size"]),"distortion-strength":new o.a8(o.a5.rain["distortion-strength"])}));this._transitionable=new o.a6(d,n,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new o.ag(d),this.scope=n}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),n=this.properties.get("direction"),c=o.al(n[0]),d=-Math.max(o.al(n[1]),.01),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 o.am(t.r,t.g,t.b,t.a*l),direction:p,centerThinning:this.properties.get("center-thinning"),droplet
15Size:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:m}}get(){return this._transitionable.serialize()}set(l,t,n={}){if(this._validate(Ja,l,n))return;const c=o.h({},l);for(const d of Object.keys(o.a5.rain))c[d]===void 0&&(c[d]=o.a5.rain[d].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,n){return(!n||n.validate!==!1)&&Q(this,l.call(yn,o.h({value:t,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}};class _i extends o.E{constructor(t,n,c,d){super(),this.scope=c,this._options=t,this.properties=new o.ag(n),this._transitionable=new o.a6(n,c,new Map(d)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(t){this._transitionable.setTransitionOrValue(this._options.properties,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(t,n){this._options=t,this._transitionable.setTransitionOrValue(t.properties,n)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class ai{constructor(t,n,c,d){this.screenBounds=t,this.cameraPoint=n,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=c,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,d)}static createFromScreenPoints(t,n){let c,d;if(t instanceof o.P||typeof t[0]=="number"){const p=o.P.convert(t);c=[p],d=n.isPointAboveHorizon(p)}else{const p=o.P.convert(t[0]),m=o.P.convert(t[1]),y=p.add(m)._div(2);c=[p,m],d=o.ao(p,m).every(x=>n.isPointAboveHorizon(x))&&n.isPointAboveHorizon(y)}return new ai(c,n.getCameraPoint(),d,n)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(t){return o.ao(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const n=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new o.P(1,1)):this.screenBounds[1],d=o.ao(n,c,0,!1);return this.cameraPoint.y>c.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x<c.x?d.splice(3,0,this.cameraPoint):this.cameraPoint.x>=c.x?d[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(d[3]=this.cameraPoint)),o.ap(d,t)}bufferedCameraGeometryGlobe(t){const n=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new o.P(1,1)):this.screenBounds[1],d=o.ao(n,c,t),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=t.queryPadding/n._pixelsPerMercatorPixel+1,m=c?this._bufferedCameraMercator(p,n):this._bufferedScreenMercator(p,n);let y=t.tileID.wrap+(m.unwrapped?d:0);const x=m.polygon.map(F=>o.aq(t.tileTransform,F,y));if(!o.ar(x,0,0,o.aj,o.aj))return;y=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?d:0);const T=this.screenGeometryMercator.polygon.map(F=>o.as(t.tileTransform,F,y)),S=T.map(F=>new o.P(F[0],F[1])),M=n.getFreeCameraOptions().position||new o.ac(0,0,0),I=o.as(t.tileTransform,M,y),C=T.map(F=>{const B=o.at(F,F,I);return o.au(B,B),new o.av(I,B)}),L=o.aw(t,1,n.zoom)*n._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:S,tilespaceRays:C,bufferedTilespaceGeometry:x,bufferedTilespaceBounds:(R=o.ax(x),R.min.x=o.ay(R.min.x,0,o.aj),R.min.y=o.ay(R.min.y,0,o.aj),R.max.x=o.ay(R.max.x,0,o.aj),R.max.y=o.ay(R.max.y,0,o.aj),R),tile:t,t
15ileID:t.tileID,pixelToTileUnitsFactor:L};var R}_bufferedScreenMercator(t,n){const c=Ki(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=Ki(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 y=o.az([],m.pixelMatrix,m.globeMatrix),x=[0,-o.aB,0,1],T=[0,o.aB,0,1],S=[0,0,0,1];o.aA(x,x,y),o.aA(T,T,y),o.aA(S,S,y);const M=new o.P(x[0]/x[3],x[1]/x[3]),I=new o.P(T[0]/T[3],T[1]/T[3]),C=o.aC(p,M)&&x[3]<S[3],L=o.aC(p,I)&&T[3]<S[3];if(!C&&!L)return null;const R=function(J,K,ie){for(let ne=1;ne<J.length;ne++){const fe=ir(K.pointCoordinate3D(J[ne-1]).x),me=ir(K.pointCoordinate3D(J[ne]).x);if(ie<0){if(fe<me)return{idx:ne,t:-fe/(me-1-fe)}}else if(me<fe)return{idx:ne,t:(1-fe)/(me+1-fe)}}return null}(p,m,C?-1:1);if(!R)return null;const{idx:F,t:B}=R;let V=F>1?cr(p.slice(0,F),m):[],Z=F<p.length?cr(p.slice(F),m):[];V=V.map(J=>new o.P(ir(J.x),J.y)),Z=Z.map(J=>new o.P(ir(J.x),J.y));const Y=[...V];Y.length===0&&Y.push(Z[Z.length-1]);const te=o.ai(Y[Y.length-1].y,(Z.length===0?V[0]:Z[0]).y,B);let ee;return ee=C?[new o.P(0,te),new o.P(0,0),new o.P(1,0),new o.P(1,te)]:[new o.P(1,te),new o.P(1,1),new o.P(0,1),new o.P(0,te)],Y.push(...ee),Z.length===0?Y.push(V[0]):Y.push(...Z),{polygon:Y.map(J=>new o.ac(J.x,J.y)),unwrapped:!1}}(t,n);if(c)return c;const d=function(p,m){let y=!1,x=-1/0,T=0;for(let M=0;M<p.length-1;M++)p[M].x>x&&(x=p[M].x,T=M);for(let M=0;M<p.length-1;M++){const I=(T+M)%(p.length-1),C=p[I],L=p[I+1];Math.abs(C.x-L.x)>.5&&(C.x<L.x?(C.x+=1,I===0&&(p[p.length-1].x+=1)):(L.x+=1,I+1===p.length-1&&(p[0].x+=1)),y=!0)}const S=o.aD(m.center.lng);return y&&S<Math.abs(S-1)&&p.forEach(M=>{M.x-=1}),{polygon:p,unwrapped:y}}(cr(t,n).map(p=>new o.P(ir(p.x),p.y)),n);return{polygon:d.polygon.map(p=>new o.ac(p.x,p.y)),unwrapped:d.unwrapped}}}function cr(l,t){return o.aE(l,n=>{const c=t.pointCoordinate3D(n);n.x=c.x,n.y=c.y},1/256)}function ir(l){return l<0?1+l%1:l%1}function Ki(l){return 100*l|0}function Rr(l,t,n,c,d){const p=function(y,x){if(y)return d(y);if(x){if(l.url&&x.tiles&&l.tiles&&delete l.tiles,x.variants){if(!Array.isArray(x.variants))return d(new Error("variants must be an array"));for(const S of x.variants){if(S==null||typeof S!="object"||S.constructor!==Object)return d(new Error("variant must be an object"));if(!Array.isArray(S.capabilities))return d(new Error("capabilities must be an array"));if(S.capabilities.length===1&&S.capabilities[0]==="meshopt"){x=o.h(x,S);break}}}const T=o.aF(o.h({},x,l),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);T.tiles=t.canonicalizeTileset(T,l.url),d(null,T)}},m=function(y,x,T){if(!y)return null;if(!x&&!T)return y;T=T||y.worldview_default;const S=Object.values(y.language||{});if(S.length===0)return null;const M=Object.values(y.worldview||{});if(M.length===0)return null;const I=S.every(L=>L===x),C=M.every(L=>L===T);return I&&C?y:x in(y.language_options||{})||T in(y.worldview_options||{})?null:y.language_options&&y.worldview_options?y:null}(l.data,n,c);return m?o.q.frame(()=>p(null,m)):l.url?o.n(t.transformRequest(t.normalizeSourceURL(l.url,null,n,c),o.R.Source),p):o.q.frame(()=>{const{data:y,...x}=l;p(null,x)})}function un(l,t){const n=Math.pow(2,t.z),c=Math.floor(o.aD(l.getWest())*n),d=Math.floor(o.aH(l.getNorth())*n),p=Math.ceil(o.aD(l.getEast())*n),m=Math.ceil(o.aH(l.getSouth())*n);return t.x>=c&&t.x<p&&t.y>=d&&t.y<m}class Zr{constructor(t,n,c){this.bounds=t?o.aG.convert(this.validateBounds(t)):null,this.minzoom=n||0,this.maxzoom=c||24}
15validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}addExtraBounds(t){if(t){this.extraBounds||(this.extraBounds=[]);for(const n of t)this.extraBounds.push(o.aG.convert(this.validateBounds(n)))}}contains(t){if(t.z>this.maxzoom||t.z<this.minzoom||this.bounds&&!un(this.bounds,t))return!1;if(!this.extraBounds)return!0;for(const n of this.extraBounds)if(un(n,t))return!0;return!1}static fromTileJSON(t){if(!t.bounds&&!t.extra_bounds)return null;const n=new Zr(t.bounds,t.minzoom,t.maxzoom);return n.addExtraBounds(t.extra_bounds),n}}class Qa extends o.E{constructor(t,n,c,d){if(super(),this.id=t,this.dispatcher=c,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,o.h(this,o.aF(n,["url","scheme","tileSize","promoteId"])),this._options=o.h({type:"vector"},n),this._collectResourceTiming=!!n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d),this._tileWorkers={},this._deduped=new o.aI}load(t){this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"}));const n=Array.isArray(this.map._language)?this.map._language.join():this.map._language,c=this.map.getWorldview();this._tileJSONRequest=Rr(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 o.z(d));else if(p){if(o.h(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=Zr.fromTileJSON(p),$n(p.tiles,this.map._requestManager._customAccessToken),this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))}t&&t(d)})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=o.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return o.h({},this._options)}loadTile(t,n){const c=t.tileID.canonical.url(this.tiles,this.scheme),d=this.map._requestManager.normalizeTileURL(c),p=this.map._requestManager.transformRequest(d,o.R.Tile),m=this.map.style?this.map.style.getLut(this.scope):null,y=m?{image:m.image.clone()}:null,x={request:p,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:y,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
15ype,source:this.id,scope:this.scope,pixelRatio:o.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault};if(this.hasWorldviews&&o.j(c)&&(x.localizableLayerIds=this.localizableLayerIds),x.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired")t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",x,T.bind(this));else if(t.actor=this._tileWorkers[d]=this._tileWorkers[d]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",x,T.bind(this),void 0,!0);else{const S=o.aJ.call({deduped:this._deduped},x,(M,I)=>{M||!I?T.call(this,M):(x.data={cacheControl:I.cacheControl,expires:I.expires,rawData:I.rawData.slice(0)},t.actor&&t.actor.send("loadTile",x,T.bind(this),void 0,!0))},!0);t.request={cancel:S}}function T(S,M){return delete t.request,t.aborted?n(null):S&&S.status!==404?n(S):(M&&M.resourceTiming&&(t.resourceTiming=M.resourceTiming),this.map._refreshExpiredTiles&&M&&t.setExpiryData(M),t.loadVectorData(M,this.map.painter),o.aK(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.t
15ype,source:this.id,scope:this.scope})}unloadTile(t,n){t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope}),t.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class kr extends o.E{constructor(t,n,c,d){super(),this.id=t,this.dispatcher=c,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=o.h({type:"raster"},n),o.h(this,o.aF(n,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"}));const n=this.map.getWorldview();this._tileJSONRequest=Rr(this._options,this.map._requestManager,null,n,(c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?this.fire(new o.z(c)):d&&(o.h(this,d),d.raster_layers&&(this.rasterLayers=d.raster_layers,this.rasterLayerIds=this.rasterLayers.map(p=>p.id)),this.tileBounds=Zr.fromTileJSON(d),$n(d.tiles),this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))),t&&t(c)})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=o.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return o.h({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const c=o.q.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),c,this.tileSize);t.request=o.o(this.map._requestManager.transformRequest(d,o.R.Tile),(p,m,y,x)=>(delete t.request,t.aborted?(t.state="unloaded",n(null)):p?(t.state="errored",n(p)):m?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:y,expires:x}),t.setTexture(m,this.map.painter),t.state="loaded",o.aK(this.dispatcher),void n(null)):n(null)))}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n&&n()}unloadTile(t,n){t.texture&&t.texture instanceof o.T?(t.destroy(!0),t.texture&&t.texture instanceof o.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),n&&n()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class qs extends kr{constructor(t,n,c,d){super(t,n,c,d),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._options=o.h({type:"raster-array"},n)}triggerRepaint(t){const n=this.map.painter._terrain,c=this.map.style.getSourceCache(this.id);n&&n.enabled&&c&&n._clearRenderCacheForTile(c.id,t.tileID),this.map.triggerRepaint()}loadTile(t,n){const c=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(c,o.R.Tile),p={request:d,uid:t.uid,tileID:t.tileID,type:this.t
15ype,source:this.id,scope:this.scope,partial:this.partial};t.source=this.id,t.scope=this.scope,t.requestParams=d,t.actor||(t.actor=this.dispatcher.getActor());const m=(y,x,T,S)=>{if(delete t.request,t.aborted)return t.state="unloaded",n(null);if(y)return y.name==="AbortError"?void 0:(t.state="errored",n(y));if(this.map._refreshExpiredTiles&&x&&t.setExpiryData({cacheControl:T,expires:S}),this.partial)t.state="empty";else{if(!x)return n(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=x}n(null)};t.request=this.partial?t.fetchHeader(void 0,m.bind(this)):t.actor.send("loadTile",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.texture;c&&c instanceof o.T?(t.destroy(!0),this.map.painter.saveTileTexture(c)):(t.destroy(),t.flushQueues(),t._isHeaderLoaded=!1,delete t._mrt,delete t.textureDescriptor),t.fbo&&(t.fbo.destroy(),delete t.fbo),delete t.request,delete t.requestParams,delete t.neighboringTiles,t.state="unloaded"}prepareTile(t,n,c){t._isHeaderLoaded&&(t.state!=="empty"&&(t.state="reloading"),t.fetchBand(n,c,(d,p)=>{if(d)return t.state="errored",this.fire(new o.z(d)),void this.triggerRepaint(t);p&&(t._isHeaderLoaded=!0,t.setTexture(p,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 o.aN?p=n.paint.get("raster-array-band"):n instanceof o.aO&&(p=n.paint.get("raster-particle-array-band"));const m=p||this.getInitialBand(d);if(m!=null)if(t.textureDescriptor){if(!t.updateNeeded(d,m)||c)return Object.assign({},t.textureDescriptor,{texture:t.texture})}else this.prepareTile(t,d,m)}getImages(t,n){const c=new Map;for(const d of t)for(const p of n){const[m,y]=p.split("/"),x=d.getLayer(m);if(!x||!x.hasBand(y)||!x.hasDataForBand(y))continue;const{bytes:T,tileSize:S,buffer:M}=x.getBandView(y),I=S+2*M,C={data:new o.r({width:I,height:I},T),pixelRatio:2,sdf:!1,usvg:!1,version:0};c.set(p,C)}return c}}const ac={vector:Qa,raster:kr,"raster-dem":class extends kr{constructor(l,t,n,c){super(l,t,n,c),this.type="raster-dem",this.maxzoom=22,this._options=o.h({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}loadTile(l,t){const n=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function c(d,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=o.o(this.map._requestManager.transformRequest(n,o.R.Tile),(function(d,p,m,y){if(delete l.request,l.aborted)l.state="unloaded",t(null);else if(d)l.state="errored",t(d);else if(p){this.map._refreshExpiredTiles&&l.setExpiryData({cacheControl:m,expires:y});const x=ImageBitmap&&p instanceof ImageBitmap&&o.t(),T=1-(p.width-o.aL(p.width))/2;T<1||l.neighboringTiles||(l.neighboringTiles=this._getNeighboringTiles(l.tileID));const S=x?p:o.q.getImageData(p,T),M={uid:l.uid,tileID:l.tileID,source:this.id,type:this.t
15ype,scope:this.scope,rawImageData:S,encoding:this.encoding,padding:T};l.actor&&l.state!=="expired"||(l.actor=this.dispatcher.getActor(),l.actor.send("loadTile",M,c.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(l){const t=l.canonical,n=Math.pow(2,t.z),c=(t.x-1+n)%n,d=t.x===0?l.wrap-1:l.wrap,p=(t.x+1+n)%n,m=t.x+1===n?l.wrap+1:l.wrap,y={};return y[new o.aM(l.overscaledZ,d,t.z,c,t.y).key]={backfilled:!1},y[new o.aM(l.overscaledZ,m,t.z,p,t.y).key]={backfilled:!1},t.y>0&&(y[new o.aM(l.overscaledZ,d,t.z,c,t.y-1).key]={backfilled:!1},y[new o.aM(l.overscaledZ,l.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},y[new o.aM(l.overscaledZ,m,t.z,p,t.y-1).key]={backfilled:!1}),t.y+1<n&&(y[new o.aM(l.overscaledZ,d,t.z,c,t.y+1).key]={backfilled:!1},y[new o.aM(l.overscaledZ,l.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},y[new o.aM(l.overscaledZ,m,t.z,p,t.y+1).key]={backfilled:!1}),y}},"raster-array":qs,geojson:class extends o.E{constructor(l,t,n,c){super(),this.id=l,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=n.getActor(),this.setEventedParent(c),this._data=t.data,this._options=o.h({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.minzoom!==void 0&&(this.minzoom=t.minzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;const d=o.aj/this.tileSize;this.workerOptions=o.h({source:this.id,scope:this.scope,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*d,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*d,extent:o.aj,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:o.aj,radius:(t.clusterRadius!==void 0?t.clusterRadius:50)*d,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter,dynamic:t.dynamic},t.workerOptions)}onAdd(l){this.map=l,this.setData(this._data)}setData(l){return this._data=l,this._updateWorkerData(),this}updateData(l){if(!this._options.dynamic)return this.fire(new o.z(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof l!="string"&&(l.type==="Feature"&&(l={type:"FeatureCollection",features:[l]}),l.type!=="FeatureCollection"))return this.fire(new o.z(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof l!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const t=new Map;for(const n of this._data.features)t.set(n.id,n);for(const n of l.features)t.set(n.id,n);this._data.features=[...t.values()]}else this._data=l;return this._updateWorkerData(!0),this}getClusterExpansionZoom(l,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:l,source:this.id,scope:this.scope},t),this}getClusterChildren(l,t){return this.actor.send("geojson.getClusterChildren",{clusterId:l,source:this.id,scope:this.scope},t),this}getClusterLeaves(l,t,n,c){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:l,limit:t,offset:n},c),this}_updateWorkerData(l=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new o.A("dataloading",{dataType:"source"})),this._loaded=!1;const t=o.h({append:l},this.workerOptions);t.scope=this.scope;const n=this._data;typeof n=="string"?(t.request=this.map._requestManager.transformRequest(o.q.resolveURL(n),o.R.Source),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(n),this._pendingLoad=this.actor.send(`${this.type}.loadData`,t,(c,d)=>{if(this._loaded=!0,this._pendingLoad=null,c)this.fire(new o.z(c));else{const 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 o.A("data",p)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(l),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const l=o.C(this.id,this.scope);this.map.style.clearSource(l),this._updateWorkerData()}loadTile(l,t){const n=l.actor?"reloadTile":"loadTile";l.actor=this.actor;const c=this.map.style?this.map.style.getLut(this.scope):null,d=c?{image:c.image.clone()}
15:null,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:o.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:l.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:p,worldview:this.map.getWorldview()};l.request=this.actor.send(n,m,(y,x)=>p&&!x?(l.state="loaded",t(null)):(delete l.request,l.destroy(),l.aborted?t(null):y?t(y):(l.loadVectorData(x,this.map.painter,n==="reloadTile"),t(null))),void 0,n==="loadTile")}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.aborted=!0}unloadTile(l,t){this.actor.send("removeTile",{uid:l.uid,type:this.type,source:this.id,scope:this.scope}),l.destroy()}onRemove(l){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return o.h({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends o.aP{constructor(l,t,n,c){super(l,t,n,c),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const l=this.options;this.urls=[];for(const t of l.urls)this.urls.push(this.map._requestManager.transformRequest(t,o.R.Source).url);o.aQ(this.urls,(t,n)=>{this._loaded=!0,t?this.fire(new o.z(t)):n&&(this.video=n,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(l){if(this.video){const t=this.video.seekable;l<t.start(0)||l>t.end(0)?this.fire(new o.z(new o.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=l}}getVideo(){return this.video}onAdd(l){this.map||(this.map=l,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const l=this.map.painter.context,t=l.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new o.T(l,this.video,t.RGBA8),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(l)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:o.aP,model:class extends o.E{constructor(l,t,n,c){super(),this.id=l,this.type="model",this.models=[],this._loaded=!1,this._options=t}load(){const l=[];for(const t in this._options.models){const n=this._options.models[t],c=o.aS(this.map._requestManager.transformRequest(n.uri,o.R.Model).url).then(d=>{if(!d)return;const p=o.aT(d),m=new o.aU(t,n.position,n.orientation,p);m.computeBoundsAndApplyParent(),this.models.push(m)}).catch(d=>{this.fire(new o.z(new Error(`Could not load model ${t} from ${n.uri}: ${d.message}`)))});l.push(c)}Promise.allSettled(l).then(()=>{this._loaded=!0,this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(t=>{this._loaded=!0,this.fire(new o.z(new Error(`Could not load models: ${t.message}`)))})}onAdd(l){this.map=l,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(l,t){}serialize(){return this._options}},"batched-model":class extends o.E{constructor(l,t,n,c){super(),this.type="batched-model",this.id=l,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=n,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(c)}onAdd(l){this.map=l,this.load()}reload(){this.cancelTileJSONRequest();const l=o.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(l))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(l){this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map.getWorldview();this._tileJSONRequest=Rr(this._options,this.map._requestManager,t,n,(c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?(t&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${t}`),n&&n.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new o.z(c))):d&&(o.h(this,d),d.bounds&&(this.tileBounds=new Zr(d.bounds,this.minzoom,this.maxzoom)),$n(d.tiles,this.map._requestManager._customAccessToken),this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))),l&&l(c)})}hasTransition(){return!1}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}loaded(){return this._loaded}loadTile(l,t){const n=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme)),c={request:this.map._requestManager.transformRequest(n,o.R.Tile),data:void 0,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,tileSize:this.tileSize*l.tileID.overscaleFactor(),type:this.t
15ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:l.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:o.q.devicePixelRatio,promoteId:this.promoteId};if(l.actor&&l.state!=="expired")if(l.state==="loading")l.reloadCallback=t;else{if(l.buckets){const 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 o.h({},this._options)}},canvas:class extends o.aP{constructor(l,t,n,c){super(l,t,n,c),t.coordinates?Array.isArray(t.coordinates)&&t.coordinates.length===4&&!t.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(p=>typeof p!="number"))||this.fire(new o.z(new o.V(`sources.${l}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.z(new o.V(`sources.${l}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new o.z(new o.V(`sources.${l}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas=="string"||t.canvas instanceof HTMLCanvasElement||this.fire(new o.z(new o.V(`sources.${l}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new o.z(new o.V(`sources.${l}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new o.z(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(l){this.map=l,this.load(),this.canvas&&this.animate&&this.play()}onRemove(l){this.pause()}prepare(){let l=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,l=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,l=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const t=this.map.painter.context;this.texture?!l&&!this._playing||this.texture instanceof o.aR||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new o.T(t,this.canvas,t.gl.RGBA8,{premultiply:!0}),this._prepareData(t)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const l of[this.canvas.width,this.canvas.height])if(isNaN(l)||l<=0)return!0;return!1}},custom:class extends o.E{constructor(l,t,n,c){super(),this.id=l,this.type="custom",this._dataType="raster",this._dispatcher=n,this._implementation=t,this.setEventedParent(c),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new o.z(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new o.z(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Zr(this._implementation.bounds,this.minzoom,this.maxzoom)),t.update=this._update.bind(this),t.clearTiles=this._clearTiles.bind(this),t.coveringTiles=this._coveringTiles.bind(this),o.h(this,o.aF(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return o.aF(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(l){this.map=l,this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(l),this.load()}onRemove(l){this._implementation.onRemove&&this._implementation.onRemove(l)}hasTile(l){if(this._implementation.hasTile){const{x:t,y:n,z:c}=l.canonical;return this._implementation.hasTile({x:t,y:n,z:c})}return!this.tileBounds||this.tileBounds.contains(l.canonical)}loadTile(l,t){const{x:n,y:c,z:d}=l.tileID.canonical,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(y){return y instanceof ImageData||y instanceof HTMLCanvasElement||y instanceof ImageBitmap||y instanceof HTMLImageElement}(m)?(this.loadTileData(l,m),l.state="loaded",void t(null)):(l.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(m=>{m.name!=="AbortError"&&(l.state="errored",t(m))}),l.request.cancel=()=>p.abort()}loadTileData(l,t){l.setTexture(t,this.map.painter)}unloadTile(l,t){if(l.texture&&l.texture instanceof o.T?(l.destroy(!0),l.texture&&l.texture instanceof o.T&&this.map.painter.saveTileTexture(l.texture)):l.destroy(),this._implementation.unloadTile){const{x:n,y:c,z:d}=l.tileID.canonical;this._implementation.unloadTile({x:n,y:c,z:d})}t&&t()}abortTile(l,t){l.request&&l.request.cancel&&(l.request.cancel(),delete l.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}
15).map(l=>({x:l.canonical.x,y:l.canonical.y,z:l.canonical.z}))}_clearTiles(){const l=o.C(this.id,this.scope);this.map.style.clearSource(l)}_update(){this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))}}},el=function(l,t,n,c){const d=new ac[t.type](l,t,n,c);if(d.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${d.id}`);return o.aV(["load","abort","unload","serialize","prepare"],d),d};function tl(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 lc(l,t,n,c=""){if(l.uniqueFeatureID){const d=tl(l,t,c);if(n.has(d))return!0;n.add(d)}return!1}function cc(l,t,n,c,d=!1){const p=t.sourceCache.transform,m=t.sourceCache.tilesIn(l,t.has3DLayers,d);m.sort(uc);const y=[];for(const x of m){const T=x.tile.queryRenderedFeatures(t,x,n,c,p,d);Object.keys(T).length&&y.push({wrappedTileID:x.tile.tileID.wrapped().key,queryResults:T})}return y.length===0?{}:function(x){const T={},S={};for(const M of x){const I=M.queryResults,C=M.wrappedTileID,L=S[C]=S[C]||{};for(const R in I){const F=I[R],B=L[R]=L[R]||{},V=T[R]=T[R]||[];for(const Z of F)B[Z.featureIndex]||(B[Z.featureIndex]=!0,V.push(Z))}}return T}(y)}function vo(l,t,n,c,d,p){const m={},y=c.queryRenderedSymbols(l),x=[];for(const T of Object.keys(y).map(Number))x.push(d[T]);x.sort(uc);for(const T of x){const S=T.featureIndex.lookupSymbolFeatures(y[T.bucketInstanceId],T.bucketIndex,T.sourceLayerIndex,t,n,p);for(const M in S){const I=m[M]=m[M]||[],C=S[M];C.sort((L,R)=>{const F=T.featureSortOrder;if(F){const B=F.indexOf(L.featureIndex);return F.indexOf(R.featureIndex)-B}return R.featureIndex-L.featureIndex});for(const L of C)I.push(L)}}return m}function il(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],y=m.tileID.canonical.key;d[y]||(d[y]=!0,m.querySourceFeatures(c,t))}return c}function uc(l,t){const n=l.tileID,c=t.tileID;return n.overscaledZ-c.overscaledZ||n.canonical.y-c.canonical.y||n.wrap-c.wrap||n.canonical.x-c.canonical.x}function Hn(l,t){const n={};if(!t)return n;for(const c of l){const d=c.layerIds.map(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 An=32,kn=33,ys=new Uint16Array(8184);for(let l=0;l<2046;l++){let t=l+2,n=0,c=0,d=0,p=0,m=0,y=0;for(1&t?d=p=m=An:n=c=y=An;(t>>=1)>1;){const T=n+d>>1,S=c+p>>1;1&t?(d=n,p=c,n=m,c=y):(n=d,c=p,d=m,p=y),m=T,y=S}const x=4*l;ys[x+0]=n,ys[x+1]=c,ys[x+2]=d,ys[x+3]=p}const Wn=new Uint16Array(2178),xs=new Uint8Array(1089),rl=new Uint16Array(1089);function ss(l){return l===0?-.03125:l===32?.03125:0}const nl={type:2,extent:o.aj,loadGeometry:()=>[[new o.P(0,0),new o.P(o.aj+1,0),new o.P(o.aj+1,o.aj+1),new o.P(0,o.aj+1),new o.P(0,0)]]};class bo{constructor(t,n,c,d,p,m){this.tileID=t,this.uid=o.a$(),this.uses=0,this.tileSize=n,this.tileZoom=c,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=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}registerFadeDuration(t){const n=t+this.timeAdded;n<o.q.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=o.aW(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,n,c){if(this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=Hn(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const p=this.buckets[d];
15if(p instanceof o.b1){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 o.b1&&p.hasRTLText){this.hasRTLText=!0,o.b2();break}}this.queryPadding=0;for(const d in this.buckets){const p=this.buckets[d],m=n.style.getOwnLayer(d);if(!m)continue;const y=m.queryRadius(p);this.queryPadding=Math.max(this.queryPadding,y)}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas),this._lastUpdatedBrightness=t.brightness}else this.collisionBoxArray=new o.b0}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(t,n,c){t&&(t.resourceTiming&&(this.resourceTiming=t.resourceTiming),this.buckets=Object.assign({},this.buckets,Hn(t.buckets,n.style)),t.featureIndex&&(this.latestFeatureIndex=t.featureIndex))}getBucket(t){return this.buckets[t.fqid]}upload(t){for(const d in this.buckets){const p=this.buckets[d];p.uploadPending()&&p.upload(t)}const n=t.gl,c=this.imageAtlas;c&&!c.uploaded&&(this.imageAtlasTexture=new o.T(t,c.image,n.RGBA8,{useMipmap:!!c.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new o.T(t,this.glyphAtlasImage,n.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new o.T(t,this.lineAtlas.image,n.R8),this.lineAtlas.uploaded=!0)}prepare(t,n,c){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture,c),!n||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const d=n.style.getBrightness();(this._lastUpdatedBrightness||d)&&(this._lastUpdatedBrightness&&d&&Math.abs(this._lastUpdatedBrightness-d)<.001||(this.updateBuckets(n,this._lastUpdatedBrightness!==d),this._lastUpdatedBrightness=d))}queryRenderedFeatures(t,n,c,d,p,m){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const y=function(x,T){const S=o.bn([],[.5*x.width,.5*-x.height,1]);return o.bo(S,S,[1,-1,0]),o.az(S,S,x.calculateProjMatrix(T.toUnwrapped())),Float32Array.from(S)}(p,this.tileID);return this.latestFeatureIndex.query(t,{tilespaceGeometry:n,pixelPosMatrix:y,transform:d,availableImages:c,tileTransform:this.tileTransform,worldview:this.worldview})}querySourceFeatures(t,n){const c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;const d=c.loadVTLayers(),p=n?n.sourceLayer:"",m=d._geojsonTileLayer||d[p];if(!m)return;const y=o.b3(n&&n.filter),{z:x,x:T,y:S}=this.tileID.canonical,M={z:x,x:T,y:S};for(let I=0;I<m.length;I++){const C=m.feature(I);if(y.needGeometry){const F=o.b4(C,!0);if(!y.filter(new o.aa(this.tileID.overscaledZ,{worldview:this.worldview}),F,this.tileID.canonical))continue}else if(!y.filter(new o.aa(this.tileID.overscaledZ,{worldview:this.worldview}),C))continue;const L=c.getId(C,p),R=new o.b5(C,x,T,S,L);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=o.b6(t.cacheControl);c["max-age"]&&(this.expirationTime=Date.now()+1e3*c["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const c=Date.now();let d=!1;if(this.expirationTime>c)d=!1;else if(n)if(this.expirationTime<n)d=!0;else{const 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)}updateBuckets(t,n){if(!this.latestFeatureIndex||!t.style)return;const c=this.latestFeatureIndex.loadVTLayers(),d=t.style.listImages(),p=t.style.getBrightness();for(const m in this.buckets){if(!t.style.hasLayer(m))continue;const y=this.buckets[m],x=y.layers[0],T=x.sourceLayer||"_geojsonTileLayer",S=c[T],M=t.style.getLayerSourceCache(x);let I={};M&&(I=M._state.getState(T,void 0));const C=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},L=Object.keys(I).length>0&&!n;L&&!y.stateDependentLayers.length&&!n||y.update(I,S,d,C,L?y.stateDependentLayers:y.layers,n,p),(y instanceof o.b7||y instanceof o.b8)&&t._terrain&&t._terrain.enabled&&M&&y.uploadPending()&&t._terrain._clearRenderCacheForTile(M.id,this.tileID);const R=t&&t.style&&t.style.getOwnLayer(m);R&&(this.queryPadding=Math.max(this.queryPadding,R.queryRadius(y)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<o.q.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=o.q.now()+t}setTexture(t,n){const c=n.context,d=c.gl;this.texture=this.texture||n.getTileTexture(t.width),this.texture&&this.texture instanceof o.T?this.texture.update(t):(this.texture=new o.T(c,t,d.RGBA8,{useMipmap:!0}),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE))}
vendor: 6,115 bytes, line 15
15setDependencies(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=o.b9(nl,this.tileID.canonical,this.tileTransform)[0],d=new o.ba,p=new o.bb;for(let m=0;m<c.length;m++){const{x:y,y:x}=c[m];d.emplaceBack(y,x),p.emplaceBack(m)}p.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(p),this._tileDebugBuffer=t.createVertexBuffer(d,o.bc.members),this._tileDebugSegments=o.bd.simpleSegment(0,0,d.length,p.length)}_makeTileBoundsBuffers(t,n){if(this._tileBoundsBuffer||!n||n.name==="mercator")return;const c=o.b9(nl,this.tileID.canonical,this.tileTransform)[0];let d,p;if(this.isRaster){const m=function(y,x){const T=o.aW(y,x),S=Math.pow(2,y.z);for(let F=0;F<kn;F++)for(let B=0;B<kn;B++){const V=o.aX((y.x+(B+ss(B))/An)/S),Z=o.aY((y.y+(F+ss(F))/An)/S),Y=x.project(V,Z),te=F*kn+B;Wn[2*te+0]=Math.round((Y.x*T.scale-T.x)*o.aj),Wn[2*te+1]=Math.round((Y.y*T.scale-T.y)*o.aj)}xs.fill(0),rl.fill(0);for(let F=2045;F>=0;F--){const B=4*F,V=ys[B+0],Z=ys[B+1],Y=ys[B+2],te=ys[B+3],ee=V+Y>>1,J=Z+te>>1,K=ee+J-Z,ie=J+V-ee,ne=Z*kn+V,fe=te*kn+Y,me=J*kn+ee,Ae=Math.hypot((Wn[2*ne+0]+Wn[2*fe+0])/2-Wn[2*me+0],(Wn[2*ne+1]+Wn[2*fe+1])/2-Wn[2*me+1])>=16;xs[me]=xs[me]||(Ae?1:0),F<1022&&(xs[me]=xs[me]||xs[(Z+ie>>1)*kn+(V+K>>1)]||xs[(te+ie>>1)*kn+(Y+K>>1)])}const M=new o.aZ,I=new o.a_;let C=0;function L(F,B){const V=B*kn+F;return rl[V]===0&&(M.emplaceBack(Wn[2*V+0],Wn[2*V+1],F*o.aj/An,B*o.aj/An),rl[V]=++C),rl[V]-1}function R(F,B,V,Z,Y,te){const ee=F+V>>1,J=B+Z>>1;if(Math.abs(F-Y)+Math.abs(B-te)>1&&xs[J*kn+ee])R(Y,te,F,B,ee,J),R(V,Z,Y,te,ee,J);else{const K=L(F,B),ie=L(V,Z),ne=L(Y,te);I.emplaceBack(K,ie,ne)}}return R(0,0,An,An,An,0),R(An,An,0,0,0,An),{vertices:M,indices:I}}(this.tileID.canonical,n);d=m.vertices,p=m.indices}else{d=new o.aZ,p=new o.a_;for(const{x:y,y:x}of c)d.emplaceBack(y,x,0,0);const m=o.be(d.int16.subarray(0,4*d.length),void 0,4);for(let y=0;y<m.length;y+=3)p.emplaceBack(m[y],m[y+1],m[y+2])}this._tileBoundsBuffer=t.createVertexBuffer(d,o.bf.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(p),this._tileBoundsSegments=o.bd.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=o.bg(d,n),m=o.bh(p),y=o.ah(n.zoom);let x;y>0&&(x=o.bi(new Float64Array(16),n.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,d,n,m,x,y),this._makeGlobeTileDebugTextBuffer(t,d,n,m,x,y)}_globePoint(t,n,c,d,p,m,y){let x=o.bj(t,n,c);if(m){const T=1<<c.z,S=o.aD(d.center.lng),M=o.aH(d.center.lat),I=(c.x+.5)/T-S;let C=0;I>.5?C=-1:I<-.5&&(C=1);let L=(t/o.aj+c.x)/T+C,R=(n/o.aj+c.y)/T;L=(L-S)*d._pixelsPerMercatorPixel+S,R=(R-M)*d._pixelsPerMercatorPixel+M;const F=[L*d.worldSize,R*d.worldSize,0];o.ad(F,F,m),x=o.bk(x,F,y)}return o.ad(x,x,p)}_makeGlobeTileDebugBorderBuffer(t,n,c,d,p,m){const y=new o.ba,x=new o.bb,T=new o.bl,S=(I,C,L,R,F)=>{const B=(L-I)/(F-1),V=(R-C)/(F-1),Z=y.length;for(let Y=0;Y<F;Y++){const te=I+Y*B,ee=C+Y*V;y.emplaceBack(te,ee);const J=this._globePoint(te,ee,n,c,d,p,m);T.emplaceBack(J[0],J[1],J[2]),x.emplaceBack(Z+Y)}},M=o.aj;S(0,0,M,0,16),S(M,0,M,M,16),S(M,M,0,M,16),S(0,M,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(x),this._tileDebugBuffer=t.createVertexBuffer(y,o.bc.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(T,o.bm.members),this._tileDebugSegments=o.bd.simpleSegment(0,0,y.length,x.length)}_makeGlobeTileDebugTextBuffer(t,n,c,d,p,m){const y=o.aj/4,x=new o.ba,T=new o.a_,S=new o.bl,M=25;T.reserve(32),x.reserve(M),S.reserve(M);const I=(C,L)=>M*C+L;for(let C=0;C<M;C++){const L=C*y;for(let R=0;R<M;R++){const F=R*y;x.emplaceBack(F,L);const B=this._globePoint(F,L,n,c,d,p,m);S.emplaceBack(B[0],B[1],B[2])}}for(let C=0;C<4;C++)for(let L=0;L<4;L++){const R=I(C,L),F=I(C,L+1),B=I(C+1,L),V=I(C+1,L+1);T.emplaceBack(R,F,B),T.emplaceBack(B,F,V)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(T),this._tileDebugTextBuffer=t.createVertexBuffer(x,o.bc.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(S,o.bm.members),this._tileDebugTextSegments=o.bd.simpleSegment(0,0,M,32)}destroy(t=!1){for(const n in this.buckets)this.buckets[n].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!t&&this.texture&&this.texture instanceof o.T&&(this.texture.destroy(),delete this.texture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}o.bp.setPbf(o.bq);class sa extends bo{constructor(t,n,c,d,p){super(t,n,c,d,p),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}
15getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(t){return this._mrt&&this._mrt.getLayer(t)}setTexture(t,n){const c=n.context,d=c.gl;this.texture=this.texture||n.getTileTexture(t.width),this.texture&&this.texture instanceof o.T?this.texture.update(t,{premultiply:!1}):this.texture=new o.T(c,t,d.RGBA8,{premultiply:!1})}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()()}fetchHeader(t=16384,n){const c=this._mrt=new o.bp(30),d=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(t-1)}});return this.entireBuffer=null,this.request=o.br(d,(p,m,y,x)=>{if(p)n(p);else try{const T=c.getHeaderLength(m);if(T>t)return void(this.request=this.fetchHeader(T,n));c.parseHeader(m),this._isHeaderLoaded=!0;let S=0;for(const M of Object.values(c.layers))S=Math.max(S,M.dataIndex[M.dataIndex.length-1].lastByte);m.byteLength>=S&&(this.entireBuffer=m),n(null,this.entireBuffer||m,y,x)}catch(T){n(T)}}),this.request}fetchBand(t,n,c){const d=this._mrt;if(!this._isHeaderLoaded||!d)return void c(new Error("Tile header is not ready"));const p=this.actor;if(!p)return void c(new Error("Can't fetch tile band without an actor"));let m;const y=(M,I)=>{m.complete(M,I),M?c(M):(this.updateTextureDescriptor(t,n),c(null,this.textureDescriptor&&this.textureDescriptor.img))},x=(M,I)=>{if(M)return c(M);const C=p.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:I,task:m},y,void 0,!0);this._workQueue.push(()=>{C&&C.cancel(),m.cancel()})},T=d.getLayer(t);if(!T)return void c(new Error(`Unknown sourceLayer "${t}"`));if(T.hasDataForBand(n))return this.updateTextureDescriptor(t,n),void c(null,this.textureDescriptor?this.textureDescriptor.img:null);const S=T.getDataRange([n]);if(m=d.createDecodingTask(S),!m||m.tasks.length)if(this.flushQueues(),this.entireBuffer)x(null,this.entireBuffer.slice(S.firstByte,S.lastByte+1));else{const M=Object.assign({},this.requestParams,{headers:{Range:`bytes=${S.firstByte}-${S.lastByte}`}}),I=o.br(M,x);this._fetchQueue.push(()=>{I.cancel(),m.cancel()})}else c(null)}updateNeeded(t,n){return(!this.textureDescriptor||this.textureDescriptor.band!==n||this.textureDescriptor.layer!==t)&&this.state!=="errored"}updateTextureDescriptor(t,n){if(!this._mrt)return;const c=this._mrt.getLayer(t);if(!c||!c.hasBand(n)||!c.hasDataForBand(n))return;const{bytes:d,tileSize:p,buffer:m,offset:y,scale:x}=c.getBandView(n),T=p+2*m,S=new o.r({width:T,height:T},d),M=this.texture;M&&M instanceof o.T&&M.update(S,{premultiply:!1}),this.textureDescriptor={layer:t,band:n,img:S,buffer:m,offset:y,tileSize:p,format:c.pixelFormat,mix:[x,256*x,65536*x,16777216*x]}}}class Au{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 Mu{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,c){const d=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][d]=this.stateChanges[t][d]||{},o.h(this.stateChanges[t][d],c),this.deletedStates[t]===null){this.deletedStates[t]={};for(const 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 y=String(n),x=o.h({},c[y],d[y]);if(p){const T=p[n];if(T===null)return{};for(const S in T)delete x[S]}return x}const m=o.h({},c,d);if(p)for(const y in p)delete m[y];return m}initializeTileState(t,n){t.refreshFeatureState(n)}coalesceChanges(t,n){const c={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const p={};for(const m in this.stateChanges[d])this.state[d][m]||(this.state[d][m]={}),o.h(this.state[d][m],this.stateChanges[d][m]),p[m]=this.state[d][m];c[d]=p}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const p={};if(this.deletedStates[d]===null)for(const m in this.state[d])p[m]={},this.state[d][m]={};else for(const m in this.deletedStates[d]){if(this.deletedStates[d][m]===null)this.state[d][m]={};else if(this.state[d][m])for(const y of Object.keys(this.deletedStates[d][m]))delete this.state[d][m][y];p[m]=this.state[d][m]}c[d]=c[d]||{},o.h(c[d],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(c).length!==0)for(const d in t)t[d].refreshFeatureState(n)}}class hn extends o.E{constructor(t,n,c){super(),this.id=t,this._onlySymbols=c,n.on("data",d=>{d.dataType==="source"&&d.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&d.dataType==="source"&&d.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),n.on("error",()=>{this._sourceErrored=!0}),this._source=n,this._tiles={},this._cache=new Au(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
vendor: 5,309 bytes, line 15
15,this._minTileCacheSize=n.minTileCacheSize,this._maxTileCacheSize=n.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Mu,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(t){this.map=t,this._minTileCacheSize=this._minTileCacheSize===void 0&&t?t._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&t?t._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles)if(!this._tiles[t].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,n){return t.isSymbolTile=this._onlySymbols,t.isExtraShadowCaster=this._shadowCasterTiles[t.tileID.key],this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t)}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t)}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const c=this._tiles[n];c.upload(t),c.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(wo).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,y=p.tileID,x=new o.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle),T=new o.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle);return m.overscaledZ-y.overscaledZ||T.y-x.y||T.x-x.x}).map(d=>d.tileID.key):c.map(d=>d.tileID).sort(wo).map(d=>d.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n,c){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())&&(c||!this._shadowCasterTiles[t])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(+t,"reloading")}}_reloadTile(t,n){const c=this._tiles[t];c&&(c.state!=="loading"&&(c.state=n),this._loadTile(c,this._tileLoaded.bind(this,c,t,n)))}_tileLoaded(t,n,c,d){if(d)if(t.state="errored",d.status!==404)this._source.fire(new o.z(d,{tile:t}));else{if(this._source.fire(new o.A("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const p=this.map.painter.terrain;this.update(this.transform,p.getScaledDemTileSize(),!0),p.resetTileLookupCache(this.id)}else this.update(this.transform)}else t.timeAdded=o.q.now(),c==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this._source.type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new o.A("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(t){const n=this.getRenderableIds();for(let d=0;d<n.length;d++){const 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 y=p.tileID.canonical.y-d.tileID.canonical.y,x=Math.pow(2,d.tileID.canonical.z),T=p.tileID.key;m===0&&y===0||Math.abs(y)>1||(Math.abs(m)>1&&(Math.abs(m+x)===1?m+=x:Math.abs(m-x)===1&&(m-=x)),p.dem&&d.dem&&(d.dem.backfillBorder(p.dem,m,y),d.neighboringTiles&&d.neighboringTiles[T]&&(d.neighboringTiles[T].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,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 y=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const T=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[T.key],m&&m.hasData()&&(y=T)}let x=y;for(;x.overscaledZ>n;)if(x=x.scaledTo(x.overscaledZ-1),t[x.key]){d[y.key]=y;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const c=this._loadedParentTiles[t.key];return c&&c.tileID.overscaledZ>=n?c:null}for(let c=t.overscaledZ-1;c>=n;c--){const d=t.scaledTo(c),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,y=typeof this._maxTileC
15acheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(y)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const c={};for(const d in this._tiles){const 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 y,x=this._source.maxzoom;const T=this.map&&this.map.painter?this.map.painter._terrain:null;if(T&&T.sourceCache===this&&T.attenuationRange()){const I=T.attenuationRange()[0],C=Math.floor(I)-Math.log2(T.getDemUpscale());x>C&&(x=C)}if(this.used||this.usedForTerrain){if(this._source.tileID)y=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(I=>new o.aM(I.canonical.z,I.wrap,I.canonical.z,I.canonical.x,I.canonical.y));else if(this.tileCoverLift!==0){const I=t.clone();I.tileCoverLift=this.tileCoverLift,y=I.coveringTiles({tileSize:n||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:x,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:m}),this._source.minzoom<=1&&t.projection.name==="globe"&&(y.push(new o.aM(1,0,1,0,0)),y.push(new o.aM(1,0,1,1,0)),y.push(new o.aM(1,0,1,0,1)),y.push(new o.aM(1,0,1,1,1)))}else if(y=t.coveringTiles({tileSize:n||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:x,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:m}),this._source.hasTile){const I=this._source.hasTile.bind(this._source);y=y.filter(C=>I(C))}}else y=[];if(y.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!sl(this._source.type)){const I=t.coveringZoomLevel({tileSize:n||this._source.tileSize,roundZoom:this._source.roundZoom&&!c}),C=Math.min(I,this._source.maxzoom);if(m){const L=t.extendTileCover(y,C);for(const R of L)y.push(R)}else if(p){const L=t.extendTileCover(y,C,this.transform._camera.forward());for(const R of L)y.push(R)}else if(this.castsShadows&&d){const L=t.extendTileCover(y,C,d);for(const R of L)this._shadowCasterTiles[R.key]=!0,y.push(R)}}const S=this._updateRetainedTiles(y);if(sl(this._source.type)&&y.length!==0){const I={},C={},L=Object.keys(S);for(const F of L){const B=S[F],V=this._tiles[F];if(!V||V.fadeEndTime&&V.fadeEndTime<=o.q.now())continue;const Z=this.findLoadedParent(B,Math.max(B.overscaledZ-hn.maxOverzooming,this._source.minzoom));Z&&(this._addTile(Z.tileID),I[Z.tileID.key]=Z.tileID),C[F]=B}const R=y[y.length-1].overscaledZ;for(const F in this._tiles){const B=this._tiles[F];if(S[F]||!B.hasData())continue;let V=B.tileID;for(;V.overscaledZ>R;){V=V.scaledTo(V.overscaledZ-1);const Z=this._tiles[V.key];if(Z&&Z.hasData()&&C[V.key]){S[F]=B.tileID;break}}}for(const F in I)S[F]||(this._coveredTiles[F]=!0,S[F]=I[F])}for(const I in S)this._tiles[I].clearFadeHold();const M=o.bs(this._tiles,S);for(const I of M){const C=this._tiles[I];C.hasSymbolBuckets&&!C.holdingForFade()?C.setHoldDuration(this.map._fadeDuration):C.hasSymbolBuckets&&!C.symbolFadeFinished()||this._removeTile(+I)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const n={};if(t.length===0)return n;const c={},d=t.reduce((T,S)=>Math.min(T,S.overscaledZ),1/0),p=t[0].overscaledZ,m=Math.max(p-hn.maxOverzooming,this._source.minzoom),y=Math.max(p+hn.maxUnderzooming,this._source.minzoom),x={};for(const T of t){const S=this._addTile(T);n[T.key]=T,S.hasData()||d<this._source.maxzoom&&(x[T.key]=T)}this._retainLoadedChildren(x,d,y,n);for(const T of t){let S=this._tiles[T.key];if(S.hasData())continue;if(T.canonical.z>=this._source.maxzoom){const I=T.children(this._source.maxzoom)[0],C=this.getTile(I);if(C&&C.hasData()){n[I.key]=I;continue}}else{const I=T.children(this._source.maxzoom);
vendor: 4,163 bytes, line 15
15if(n[I[0].key]&&n[I[1].key]&&n[I[2].key]&&n[I[3].key])continue}let M=S.wasRequested();for(let I=T.overscaledZ-1;I>=m;--I){const C=T.scaledTo(I);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 sa(t,p,this.transform.tileZoom,d,this._isRaster):new bo(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 o.A("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const c=n.getExpiryTimeout();c&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},c))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"||n.state==="empty"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(t,n,c){const d=[],p=this.transform;if(!p)return d;const m=p.projection.name==="globe",y=o.aD(p.center.lng);for(const x in this._tiles){const T=this._tiles[x];if(c&&T.clearQueryDebugViz(),T.holdingForFade())continue;let S;if(m){const M=T.tileID.canonical;if(M.z===0){const I=[Math.abs(o.ay(y,...oa(M,-1))-y),Math.abs(o.ay(y,...oa(M,1))-y)];S=[0,2*I.indexOf(Math.min(...I))-1]}else{const I=[Math.abs(o.ay(y,...oa(M,-1))-y),Math.abs(o.ay(y,...oa(M,0))-y),Math.abs(o.ay(y,...oa(M,1))-y)];S=[I.indexOf(Math.min(...I))-1]}}else S=[0];for(const M of S){const I=t.containsTile(T,p,n,M);I&&d.push(I)}}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 y=1/(1<<m.canonical.z);p[m.key]=((m.canonical.x+.5)*y+m.wrap-c[0])*d[0]+((m.canonical.y+.5)*y-c[1])*d[1]-c[2]*d[2]}return n.sort((m,y)=>p[m.key]-p[y.key]),n}hasTransition(){if(this._source.hasTransition())return!0;if(sl(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=o.q.now())return!0}return!1}setFeatureState(t,n,c){this._state.updateState(t=t||"_geojsonTileLayer",n,c)}removeFeatureState(t,n,c){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,c)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}
15setDependencies(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 T=x.coveringTiles({tileSize:m,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const S of T)c.set(S.key,S);this.usedForTerrain&&x.updateElevation(!1)}const y=Array.from(c.values());o.bt(y,(x,T)=>{const S=new bo(x,this._source.tileSize*x.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(S,M=>{this._source.type==="raster-dem"&&S.dem&&this._backfillDEM(S),T(M,S)})},n)}}function wo(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 sl(l){return l==="raster"||l==="image"||l==="video"||l==="custom"}function oa(l,t){const n=1<<l.z;return[l.x/n+t,(l.x+1)/n+t]}hn.maxOverzooming=10,hn.maxUnderzooming=3;class gd{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 y=1;p.type==="fill-extrusion"?y=d.visible?p.paint.get("fill-extrusion-vertical-scale"):0:p.type==="building"&&(y=d.visible?p.paint.get("building-vertical-scale"):0);let x=m?m.getTile(n):null;if(!x&&m&&n.canonical.z>m.getSource().minzoom){let T=n.scaledTo(Math.min(m.getSource().maxzoom,n.overscaledZ-1));for(;T.overscaledZ>=m.getSource().minzoom&&(x=m.getTile(T),!x&&T.overscaledZ!==0);)T=T.scaledTo(T.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:x?x.getBucket(p):null,tileID:x?x.tileID:n,verticalScale:y})}t.hasAnyZOffset=!1;let c=!1;for(let d=0;d<t.symbolInstances.length;d++){const p=t.symbolInstances.get(d),m=p.zOffset,y=this._getHeightAtTileOffset(n,p.tileAnchorX,p.tileAnchorY);p.zOffset=y!==Number.NEGATIVE_INFINITY?y:m,c||m===p.zOffset||(c=!0),t.hasAnyZOffset||p.zOffset===0||(t.hasAnyZOffset=!0)}c&&(t.zOffsetBuffersNeedUpload=!0,t.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,n,c,d){let p=n,m=c;if(t.canonical.z!==d.canonical.z){const y=d.canonical,x=1/(1<<t.canonical.z-y.z);p=(n+t.canonical.x*o.aj)*x-y.x*o.aj|0,m=(c+t.canonical.y*o.aj)*x-y.y*o.aj|0}return{tileX:p,tileY:m}}_getHeightAtTileOffset(t,n,c){let d,p;for(let m=0;m<this.layers.length;++m){const y=this.layers[m].layer;if(y.type!=="fill-extrusion"&&y.type!=="building")continue;const{bucket:x,tileID:T,verticalScale:S}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:M,tileY:I}=this._mapCoordToOverlappingTile(t,n,c,T),C=x.getHeightAtTileCoord(M,I);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 y=this.layers[m];if(y.layer.type!=="model"||!y.visible)continue;const{bucket:x,tileID:T}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:S,tileY:M}=this._mapCoordToOverlappingTile(t,n,c,T),I=x.getHeightAtTileCoord(S,M);if(I&&!I.hidden)return I.height===void 0&&d!==void 0?Math.min(I.maxHeight,d)*I.verticalScale:I.height?I.height*I.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function yd(l,t){const n={};for(const c in l)c!=="ref"&&(n[c]=l[c]);return o.bu.forEach(c=>{c in t&&(n[c]=t[c])}),n}function ol(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]=yd(l[n],t[l[n].ref]));return l}const ti={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function hc(l,t,n){n.push({command:ti.addSource,args:[l,t[l]]})}
vendor: 4,335 bytes, line 15
15function aa(l,t,n){t.push({command:ti.removeSource,args:[l]}),n[l]=!0}function al(l,t,n,c){aa(l,n,c),hc(l,t,n)}function yf(l,t,n){let c;for(c in l[n])if(l[n].hasOwnProperty(c)&&c!=="data"&&!o.bv(l[n][c],t[n][c]))return!1;for(c in t[n])if(t[n].hasOwnProperty(c)&&c!=="data"&&!o.bv(l[n][c],t[n][c]))return!1;return!0}function ll(l,t,n,c,d,p){let m;for(m in t=t||{},l=l||{})l.hasOwnProperty(m)&&(o.bv(l[m],t[m])||n.push({command:p,args:[c,m,t[m],d]}));for(m in t)t.hasOwnProperty(m)&&!l.hasOwnProperty(m)&&(o.bv(l[m],t[m])||n.push({command:p,args:[c,m,t[m],d]}))}function To(l){return l.id}function $s(l,t){return l[t.id]=t,l}class Cu{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let c=1;c<this.points.length;c++)this._distances[c]=this._distances[c-1]+this.points[c].dist(this.points[c-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=o.ay(t,0,1);let n=1,c=this._distances[n];const d=t*this.paddedLength+this.padding;for(;c<d&&n<this._distances.length;)c=this._distances[++n];const p=n-1,m=this._distances[p],y=c-m,x=y>0?(d-m)/y:0;return this.points[p].mult(1-x).add(this.points[n].mult(x))}}class Pu{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 y=[];if(t<=0&&n<=0&&this.width<=c&&this.height<=d){if(p)return!0;for(let x=0;x<this.boxKeys.length;x++)y.push({key:this.boxKeys[x],x1:this.bboxes[4*x],y1:this.bboxes[4*x+1],x2:this.bboxes[4*x+2],y2:this.bboxes[4*x+3]});for(let x=0;x<this.circleKeys.length;x++){const T=this.circles[3*x],S=this.circles[3*x+1],M=this.circles[3*x+2];y.push({key:this.circleKeys[x],x1:T-M,y1:S-M,x2:T+M,y2:S+M})}return m?y.filter(m):y}return this._forEachCell(t,n,c,d,this._queryCell,y,{hitTest:p,seenUids:{box:{},circle:{}}},m),p?y.length>0:y}_queryCircle(t,n,c,d,p){const m=t-c,y=t+c,x=n-c,T=n+c;if(y<0||m>this.width||T<0||x>this.height)return!d&&[];const S=[];return this._forEachCell(m,x,y,T,this._queryCellCircle,S,{hitTest:d,circle:{x:t,y:n,radius:c},seenUids:{box:{},circle:{}}},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,y,x){const T=y.seenUids,S=this.boxCells[p];if(S!==null){const I=this.bboxes;for(const C of S)if(!T.box[C]){T.box[C]=!0;const L=4*C;if(t<=I[L+2]&&n<=I[L+3]&&c>=I[L+0]&&d>=I[L+1]&&(!x||x(this.boxKeys[C]))){if(y.hitTest)return m.push(!0),!0;m.push({key:this.boxKeys[C],x1:I[L],y1:I[L+1],x2:I[L+2],y2:I[L+3]})}}}const M=this.circleCells[p];if(M!==null){const I=this.circles;for(const C of M)if(!T.circle[C]){T.circle[C]=!0;const L=3*C;if(this._circleAndRectCollide(I[L],I[L+1],I[L+2],t,n,c,d)&&(!x||x(this.circleKeys[C]))){if(y.hitTest)return m.push(!0),!0;{const R=I[L],F=I[L+1],B=I[L+2];m.push({key:this.circleKeys[C],x1:R-B,y1:F-B,x2:R+B,y2:F+B})}}}}}_queryCellCircle(t,n,c,d,p,m,y,x){const T=y.circle,S=y.seenUids,M=this.boxCells[p];if(M!==null){const C=this.bboxes;for(const L of M)if(!S.box[L]){S.box[L]=!0;const R=4*L;if(this._circleAndRectCollide(T.x,T.y,T.radius,C[R+0],C[R+1],C[R+2],C[R+3])&&(!x||x(this.boxKeys[L])))return m.push(!0),!0}}const I=this.circleCells[p];if(I!==null){const C=this.circles;for(const L of I)if(!S.circle[L]){S.circle[L]=!0;const R=3*L;
15if(this._circlesCollide(C[R],C[R+1],C[R+2],T.x,T.y,T.radius)&&(!x||x(this.circleKeys[L])))return m.push(!0),!0}}}_forEachCell(t,n,c,d,p,m,y,x){const T=this._convertToXCellCoord(t),S=this._convertToYCellCoord(n),M=this._convertToXCellCoord(c),I=this._convertToYCellCoord(d);for(let C=T;C<=M;C++)for(let L=S;L<=I;L++)if(p.call(this,t,n,c,d,this.xCellCount*L+C,m,y,x))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,c,d,p,m){const y=d-t,x=p-n,T=c+m;return T*T>y*y+x*x}_circleAndRectCollide(t,n,c,d,p,m,y){const x=(m-d)/2,T=Math.abs(t-(d+x));if(T>x+c)return!1;const S=(y-p)/2,M=Math.abs(n-(p+S));if(M>S+c)return!1;if(T<=x||M<=S)return!0;const I=T-x,C=M-S;return I*I+C*C<=c*c}}const So={unknown:0,flipRequired:1,flipNotRequired:2},xd=Math.tan(85*Math.PI/180);function vs(l,t,n,c,d,p,m){const y=o.bz();if(n)if(p.name==="globe"){const x=o.bA(d,t);o.az(y,y,x)}else{const x=o.bB([],m);y[0]=x[0],y[1]=x[1],y[4]=x[2],y[5]=x[3],c||o.by(y,y,d.angle)}else o.az(y,d.labelPlaneMatrix,l);return y}function dc(l,t,n,c,d,p,m){const y=vs(l,t,n,c,d,p,m);return p.name==="globe"&&n||(y[2]=y[6]=y[10]=y[14]=0),y}function pc(l,t,n,c,d,p,m){if(n){if(p.name==="globe"){const y=vs(l,t,n,c,d,p,m);return o.bi(y,y),o.az(y,l,y),y}{const y=o.bw(l),x=o.bx([]);return x[0]=m[0],x[1]=m[1],x[4]=m[2],x[5]=m[3],o.az(y,y,x),c||o.by(y,y,-d.angle),y}}return d.glCoordMatrix}function Xn(l,t,n,c){const d=[l,t,n,1];n?o.aA(d,d,c):hi(d,d,c);const p=d[3];return d[0]/=p,d[1]/=p,d[2]/=p,d}function cl(l,t){return Math.min(.5+l/t*.5,1.5)}function Eo(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 fc(l,t,n,c,d,p,m,y,x,T){const S=n.transform,M=c?l.textSizeData:l.iconSizeData,I=o.bH(M,n.transform.zoom),C=S.projection.name==="globe",L=[256/n.width*2+1,256/n.height*2+1],R=c?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;R.clear();let F=null;C&&(F=c?l.text.globeExtVertexArray:l.icon.globeExtVertexArray);const B=l.lineVertexArray,V=c?l.text.placedSymbolArray:l.icon.placedSymbolArray,Z=n.transform.width/n.transform.height;let Y,te=!1;for(let ee=0;ee<V.length;ee++){const J=V.get(ee),{numGlyphs:K,writingMode:ie}=J;if(ie!==o.bI.vertical||te||Y===o.bI.horizontal||(te=!0),Y=ie,(J.hidden||ie===o.bI.vertical)&&!te){Ao(K,R);continue}te=!1;const ne=new o.P(J.tileAnchorX,J.tileAnchorY);let{x:fe,y:me,z:Ae}=S.projection.projectTilePoint(ne.x,ne.y,T.canonical);if(x){const[it,rt,Qe]=x(ne);fe+=it,me+=rt,Ae+=Qe}const Me=[fe,me,Ae,1];if(o.aA(Me,Me,t),!Eo(Me,L)){Ao(K,R);continue}const Fe=Me[3],de=cl(n.transform.getCameraToCenterDistance(S.projection),Fe),we=o.bJ(M,I,J),le=m?we/de:we*de,Pe=Xn(fe,me,Ae,d);if(Pe[3]<=0){Ao(K,R);continue}let ye={};const De=o.al(l.layers[0].layout.get("text-max-angle")),qe=Math.cos(De),Ce=m?null:x,je=Io(J,le,!1,y,t,d,p,l.glyphOffsetArray,B,R,F,Pe,ne,ye,Z,Ce,S.projection,T,m,qe);te=je.useVertical,Ce&&je.needsFlipping&&(ye={}),(je.notEnoughRoom||te||je.needsFlipping&&Io(J,le,!0,y,t,d,p,l.glyphOffsetArray,B,R,F,Pe,ne,ye,Z,Ce,S.projection,T,m,qe).notEnoughRoom)&&Ao(K,R)}c?(l.text.dynamicLayoutVertexBuffer.updateData(R),F&&l.text.globeExtVertexBuffer&&l.text.globeExtVertexBuffer.updateData(F)):(l.icon.dynamicLayoutVertexBuffer.updateData(R),F&&l.icon.globeExtVertexBuffer&&l.icon.globeExtVertexBuffer.updateData(F))}function zu(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,R,F){const{lineStartIndex:B,glyphStartIndex:V,segment:Z}=y,Y=V+y.numGlyphs,te=B+y.lineLength,ee=t.getoffsetX(V),J=t.getoffsetX(Y-1),K=la(l*ee,n,c,d,p,m,Z,B,te,x,T,S,M,I,!0,C,L,R,F);if(!K)return null;const ie=la(l*J,n,c,d,p,m,Z,B,te,x,T,S,M,I,!0,C,L,R,F);return ie?{first:K,last:ie}:null}function mc(l,t,n,c){return l===o.bI.horizontal&&Math.abs(c)>Math.abs(n)?{useVertical:!0}:l===o.bI.vertical?c>0?{needsFlipping:!0}:null:t!==So.unknown&&function(d,p){return d===0||Math.abs(p/d)>xd}(n,c)?t===So.flipRequired?{needsFlipping:!0}:null:n<0?{needsFlipping:!0}:null}function Io(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,R,F,B,V,Z){const Y=t/24,te=l.lineOffsetX*Y,ee=l.lineOffsetY*Y,{lineStartIndex:J,glyphStartIndex:K,numGlyphs:ie,segment:ne,writingMode:fe,flipState:me}=l,Ae=J+l.lineLength,Me=Fe=>{if(S){const[Pe,ye,De]=Fe.up,qe=T.length;o.bK(S,qe+0,Pe,ye,De),o.bK(S,qe+1,Pe,ye,De),o.bK(S,qe+2,Pe,ye,De),o.bK(S,qe+3,Pe,ye,De)}const[de,we,le]=Fe.point;o.bL(T,de,we,le,Fe.angle)};if(ie>1){const Fe=zu(Y,y,te,ee,n,M,I,l,x,p,C,R,!1,F,B,V,Z);if(!Fe)return{notEnoughRoom:!0};if(c&&!n){let[de,we,le]=Fe.first.point,[Pe,ye,De]=Fe.last.point;[de,we]=Xn(de,we,le,m),[Pe,ye]=Xn(Pe,ye,De,m);const qe=mc(fe,me,(Pe-de)*L,ye-we);if(l.flipState=qe&&qe.needsFlipping?So.flipRequired:So.flipNotRequired,qe)return qe}Me(Fe.first);for(let de=K+1;de<K+ie-1;de++){const we=la(Y*y.getoffsetX(de),te,ee,n,M,I,ne,J,Ae,x,p,C,R,!1,!1,F,B,V,Z);if(!we)return T.length-=4*(de-K),{notEnoughRoom:!0};Me(we)}Me(Fe.last)}else{if(c&&!n){const de=Xn(I.x,I.y,0,d),we=J+ne+1,le=new o.P(x.getx(we),x.gety(we)),Pe=Xn(le.x,le.y,0,d),ye=Pe[3]>0?Pe:Ru(I,le,de,1,d,void 0,F,B.canonical),De=mc(fe,me,(ye[0]-de[0])*L,ye[1]-de[1]);if(l.flipState=De&&De.needsFlipping?So.flipRequired:So.flipNotRequired,De)return De}const Fe=la(Y*y.getoffsetX(K),te,ee,n,M,I,ne,J,Ae,x,p,C,R,!1,!1,F,B,V,Z);if(!Fe)return{notEnoughRoom:!0};Me(Fe)}return{}}function xn(l,t,n,c,d){const{x:p,y:m,z:y}=c.projectTilePoint(l.x,l.y,t);if(!d)return Xn(p,m,y,n);const[x,T,S]=d(l);return Xn(p+x,m+T,y+S,n)}
15function Ru(l,t,n,c,d,p,m,y){const x=xn(l.sub(t)._unit()._add(l),y,d,m,p);return o.at(x,n,x),o.au(x,x),o.bE(x,n,x,c)}function la(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,R,F,B,V){const Z=c?l-t:l+t;let Y=Z>0?1:-1,te=0;c&&(Y*=-1,te=Math.PI),Y<0&&(te+=Math.PI);let ee=y+m+(Y>0?0:1)|0,J=d,K=d,ie=0,ne=0;const fe=Math.abs(Z),me=[],Ae=[];let Me=p,Fe=Me,de=o.bC([]);const we=()=>Ru(Fe,Me,K,fe-ie+1,S,I,R,F.canonical);for(;ie+ne<=fe;){if(ee+=Y,ee<y||ee>=x)return null;if(K=J,Fe=Me,me.push(K),C&&Ae.push(Fe),Me=new o.P(T.getx(ee),T.gety(ee)),J=M[ee],!J){const Qe=xn(Me,F.canonical,S,R,I);J=Qe[3]>0?M[ee]=Qe:we()}ie+=ne;const it=o.at([],J,K),rt=o.bD(K,J);if(n&&rt>0&&ne>0&&o.bG(de,it)/(ne*rt)<V)return null;ne=rt,de=it}L&&I&&(M[ee]&&(J=we(),ne=o.bD(K,J),de=o.at([],J,K)),M[ee]=J);const le=(fe-ie)/ne,Pe=Me.sub(Fe)._mult(le)._add(Fe),ye=o.bE([],K,de,le);let De=[0,0,1],qe=de[0],Ce=de[1];if(B&&(De=R.upVector(F.canonical,Pe.x,Pe.y),De[0]!==0||De[1]!==0||De[2]!==1)){const it=[De[2],0,-De[0]],rt=o.bF([],De,it);o.au(it,it),o.au(rt,rt),qe=o.bG(de,it),Ce=o.bG(de,rt)}if(n){const it=o.bF([],De,de);o.au(it,it),o.bE(ye,ye,it,n*Y)}const je=te+Math.atan2(Ce,qe);return me.push(ye),C&&Ae.push(Pe),{point:ye,angle:je,path:me,tilePath:Ae,up:De}}function Ao(l,t){const n=t.length,c=n+4*l;t.resize(c),t.float32.fill(-1/0,4*n,4*c)}function hi(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 Yn=100;class xf{constructor(t,n,c=new Pu(t.width+200,t.height+200,25),d=new Pu(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+Yn,this.screenBottomBoundary=t.height+Yn,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=n}placeCollisionBox(t,n,c,d,p,m,y,x){let T=c.projectedAnchorX,S=c.projectedAnchorY,M=c.projectedAnchorZ;const I=c.elevation,C=c.tileID,L=t.getProjection();if(I&&C){const[ee,J,K]=L.upVector(C.canonical,c.tileAnchorX,c.tileAnchorY),ie=L.upVectorScale(C.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;T+=ee*I*ie,S+=J*I*ie,M+=K*I*ie}const R=this.projectAndGetPerspectiveRatio(y,T,S,M,c.tileID,L.name==="globe"||!!I||this.transform.pitch>0,L),F=m*R.perspectiveRatio,B=(c.x1*n+d.x-c.padding)*F+R.point.x,V=(c.y1*n+d.y-c.padding)*F+R.point.y,Z=(c.x2*n+d.x+c.padding)*F+R.point.x,Y=(c.y2*n+d.y+c.padding)*F+R.point.y,te=R.perspectiveRatio<=.55||R.occluded;return!this.isInsideGrid(B,V,Z,Y)||!p&&this.grid.hitTest(B,V,Z,Y,x)||te?{box:[],offscreen:!1,occluded:R.occluded}:{box:[B,V,Z,Y],offscreen:this.isOffscreen(B,V,Z,Y),occluded:!1}}placeCollisionCircles(t,n,c,d,p,m,y,x,T,S,M,I,C,L,R){const F=[],B=this.transform.elevation,V=t.getProjection(),Z=B?B.getAtTileOffsetFunc(R,this.transform.center.lat,this.transform.worldSize,V):null,Y=new o.P(c.tileAnchorX,c.tileAnchorY);let{x:te,y:ee,z:J}=V.projectTilePoint(Y.x,Y.y,R.canonical);if(Z){const[De,qe,Ce]=Z(Y);te+=De,ee+=qe,J+=Ce}const K=V.name==="globe",ie=this.projectAndGetPerspectiveRatio(y,te,ee,J,R,K||!!B||this.transform.pitch>0,V),{perspectiveRatio:ne}=ie,fe=(M?m/ne:m*ne)/o.bO,me=Xn(te,ee,J,x),Ae=c.lineOffsetX*fe,Me=c.lineOffsetY*fe,Fe=o.al(t.layers[0].layout.get("text-max-angle")),de=Math.cos(Fe),we=ie.signedDistanceFromCamera>0?zu(fe,p,Ae,Me,!1,me,Y,c,d,x,{},B&&!M?Z:null,M&&!!B,V,R,M,de):null;let le=!1,Pe=!1,ye=!0;if(we&&!ie.occluded){const De=.5*C*ne+L,qe=new o.P(-100,-100),Ce=new o.P(this.screenRightBoundary,this.screenBottomBoundary),je=new Cu,{first:it,last:rt}=we,Qe=it.path.length;let ut=[];for(let It=Qe-1;It>=1;It--)ut.push(it.path[It]);for(let It=1;It<rt.path.length;It++)ut.push(rt.path[It]);const pt=2.5*De;T&&(ut=ut.map(([It,Ot,pi],Ri)=>(Z&&!K&&(pi=Z(Ri<Qe-1?it.tilePath[Qe-1-Ri]:rt.tilePath[Ri-Qe+2])[2]),Xn(It,Ot,pi,T))),ut.some(It=>It[3]<=0)&&(ut=[]));let yt=[];if(ut.length>0){let It=1/0,Ot=-1/0,pi=1/0,Ri=-1/0;for(const gi of ut)It=Math.min(It,gi[0]),pi=Math.min(pi,gi[1]),Ot=Math.max(Ot,gi[0]),Ri=Math.max(Ri,gi[1]);Ot>=qe.x&&It<=Ce.x&&Ri>=qe.y&&pi<=Ce.y&&(yt=[ut.map(gi=>new o.P(gi[0],gi[1]))],(It<qe.x||Ot>Ce.x||pi<qe.y||Ri>
vendor: 4,756 bytes, line 15
15Ce.y)&&(yt=o.bM(yt,qe.x,qe.y,Ce.x,Ce.y)))}for(const It of yt){je.reset(It,.25*De);let Ot=0;Ot=je.length<=.5*De?1:Math.ceil(je.paddedLength/pt)+1;for(let pi=0;pi<Ot;pi++){const Ri=pi/Math.max(Ot-1,1),gi=je.lerp(Ri),bi=gi.x+Yn,ur=gi.y+Yn;F.push(bi,ur,De,0);const Rt=bi-De,Vt=ur-De,Wt=bi+De,Oi=ur+De;if(ye=ye&&this.isOffscreen(Rt,Vt,Wt,Oi),Pe=Pe||this.isInsideGrid(Rt,Vt,Wt,Oi),!n&&this.grid.hitTestCircle(bi,ur,De,I)&&(le=!0,!S))return{circles:[],offscreen:!1,collisionDetected:le,occluded:!1}}}}return{circles:!S&&le||!Pe?[]:F,offscreen:ye,collisionDetected:le,occluded:ie.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 o.P(S.x+Yn,S.y+Yn);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 y=this.grid.query(c,d,p,m).concat(this.ignoredGrid.query(c,d,p,m)),x={},T={};for(const S of y){const M=S.key;if(x[M.bucketInstanceId]===void 0&&(x[M.bucketInstanceId]={}),x[M.bucketInstanceId][M.featureIndex])continue;const I=[new o.P(S.x1,S.y1),new o.P(S.x2,S.y1),new o.P(S.x2,S.y2),new o.P(S.x1,S.y2)];o.bN(n,I)&&(x[M.bucketInstanceId][M.featureIndex]=!0,T[M.bucketInstanceId]===void 0&&(T[M.bucketInstanceId]=[]),T[M.bucketInstanceId].push(M.featureIndex))}return T}insertCollisionBox(t,n,c,d,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,y={bucketInstanceId:c,featureIndex:d,collisionGroupID:p};for(let x=0;x<t.length;x+=4)m.insertCircle(y,t[x],t[x+1],t[x+2])}projectAndGetPerspectiveRatio(t,n,c,d,p,m,y){const x=[n,c,d,1];let T=!1;d||this.transform.pitch>0?(o.aA(x,x,t),this.fogState&&p&&y.name!=="globe"&&(T=function(I,C,L,R,F,B){const V=B.calculateFogTileMatrix(F),Z=[C,L,R];return o.ad(Z,Z,V),Ze(I,o.ae(Z),B.pitch,B._fov)}(this.fogState,n,c,d,p.toUnwrapped(),this.transform)>.9)):hi(x,x,t);const S=x[3];return{point:new o.P((x[0]/S+1)/2*this.transform.width+Yn,(-x[1]/S+1)/2*this.transform.height+Yn),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(y)/S*.5,1.5),signedDistanceFromCamera:S,occluded:m&&x[2]>S||T}}isOffscreen(t,n,c,d){return c<Yn||t>=this.screenRightBoundary||d<Yn||n>this.screenBottomBoundary}isInsideGrid(t,n,c,d){return c>=0&&t<this.gridRightBoundary&&d>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=o.bx([]);return o.bo(t,t,[-100,-100,0]),t}}function Du(l,t,n){const c=t.createTileMatrix(l,l.worldSize,n.toUnwrapped());return o.az(new Float32Array(16),l.projMatrix,c)}function Tt(l,t,n){if(t.projection.name===n.projection.name)return l.projMatrix;const c=n.clone();return c.setProjection(t.projection),Du(c,t.getProjection(),l)}function _c(l,t,n){return t.name===n.projection.name?l.projMatrix:Du(n,t,l)}class ul{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 Mo{constructor(t,n,c,d,p,m=!1){this.text=new ul(t?t.text:null,n,c,p),this.icon=new ul(t?t.icon:null,n,d,p),this.clipped=m}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Mn{constructor(t,n,c,d=!1){this.text=t,this.icon=n,this.skipFade=c,this.clipped=d}}class Lu{constructor(){this.invProjMatrix=o.bz(),this.viewportMatrix=o.bz(),this.circles=[]}}class ca{constructor(t,n,c,d,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=c,this.bucketIndex=d,this.tileID=p}}class dt{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 vi(l,t,n,c,d){const{horizontalAlign:p,verticalAlign:m}=o.bT(l),y=-(p-.5)*t,x=-(m-.5)*n,T=o.bU(l,c);return new o.P(y+T[0]*d,x+T[1]*d)}function ci(l,t,n,c,d){const p=new o.P(l,t);return n&&p._rotate(c?d:-d),p}class vn{constructor(t,n,c,d,p,m){this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new xf(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 dt(c),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,c,d,p=1){const m=c.getBucket(n),y=c.latestFeatureIndex;if(!m||!y||n.fqid!==m.layerIds[0])return;const x=m.layers[0].layout,T=m.layers[0].paint,S=c.collisionBoxArray,M=Math.pow(2,this.transform.zoom-c.tileID.overscaledZ
15),I=c.tileSize/o.aj,C=c.tileID.toUnwrapped();this.transform.setProjection(m.projection);const L=(R=c.tileID,F=m.getProjection(),B=this.transform,F.name===this.projection?B.calculateProjMatrix(R.toUnwrapped()):Du(B,F,R));var R,F,B;const V=x.get("text-pitch-alignment")==="map",Z=x.get("text-rotation-alignment")==="map";n.compileFilter(n.options);const Y=n.dynamicFilter(),te=n.dynamicFilterNeedsFeature(),ee=this.transform.calculatePixelsToTileUnitsMatrix(c),J=dc(L,c.tileID.canonical,V,Z,this.transform,m.getProjection(),ee);let K=null;if(V){const we=pc(L,c.tileID.canonical,V,Z,this.transform,m.getProjection(),ee);K=o.az([],this.transform.labelPlaneMatrix,we)}let ie=null;Y&&c.latestFeatureIndex&&(ie={unwrappedTileID:C,dynamicFilter:Y,dynamicFilterNeedsFeature:te}),this.retainedQueryData[m.bucketInstanceId]=new ca(m.bucketInstanceId,y,m.sourceLayerIndex,m.index,c.tileID);const[ne,fe]=m.layers[0].layout.get("text-size-scale-range"),me=o.ay(p,ne,fe),[Ae,Me]=x.get("icon-size-scale-range"),Fe=o.ay(p,Ae,Me),de={bucket:m,layout:x,paint:T,posMatrix:L,textLabelPlaneMatrix:J,labelToScreenMatrix:K,clippingData:ie,scale:M,textPixelRatio:I,holdingForFade:c.holdingForFade(),collisionBoxArray:S,partiallyEvaluatedTextSize:o.bH(m.textSizeData,this.transform.zoom,me),partiallyEvaluatedIconSize:o.bH(m.iconSizeData,this.transform.zoom,Fe),collisionGroup:this.collisionGroups.get(m.sourceID),latestFeatureIndex:c.latestFeatureIndex};if(d)for(const we of m.sortKeyRanges){const{sortKey:le,symbolInstanceStart:Pe,symbolInstanceEnd:ye}=we;t.push({sortKey:le,symbolInstanceStart:Pe,symbolInstanceEnd:ye,parameters:de})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:m.symbolInstances.length,parameters:de})}attemptAnchorPlacement(t,n,c,d,p,m,y,x,T,S,M,I,C,L,R,F,B,V){const{textOffset0:Z,textOffset1:Y,crossTileID:te}=I,ee=[Z,Y],J=vi(t,c,d,ee,p),K=this.collisionIndex.placeCollisionBox(L,p,n,ci(J.x,J.y,m,y,this.transform.angle),M,x,T,S.predicate);if(F){const ie=L.getSymbolInstanceIconSize(V,this.transform.zoom,I.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(L,ie,F,ci(J.x,J.y,m,y,this.transform.angle),M,x,T,S.predicate).box.length===0)return}if(K.box.length>0){let ie;return this.prevPlacement&&this.prevPlacement.variableOffsets[te]&&this.prevPlacement.placements[te]&&this.prevPlacement.placements[te].text&&(ie=this.prevPlacement.variableOffsets[te].anchor),this.variableOffsets[te]={textOffset:ee,width:c,height:d,anchor:t,textScale:p,prevAnchor:ie},this.markUsedJustification(L,t,I,R),L.allowVerticalPlacement&&(this.markUsedOrientation(L,R,I),this.placedOrientations[te]=R),{shift:J,placedGlyphBoxes:K}}}placeLayerBucketPart(t,n,c,d,p=1){const{bucket:m,layout:y,paint:x,posMatrix:T,textLabelPlaneMatrix:S,labelToScreenMatrix:M,clippingData:I,textPixelRatio:C,holdingForFade:L,collisionBoxArray:R,partiallyEvaluatedTextSize:F,partiallyEvaluatedIconSize:B,collisionGroup:V,latestFeatureIndex:Z}=t.parameters,Y=y.get("text-optional"),te=y.get("icon-optional"),ee=y.get("text-allow-overlap"),J=y.get("icon-allow-overlap"),K=y.get("text-rotation-alignment")==="map",ie=y.get("text-pitch-alignment")==="map",ne=x.get("symbol-z-offset"),fe=y.get("symbol-elevation-reference")==="sea",[me,Ae]=y.get("text-size-scale-range"),[Me,Fe]=y.get("icon-size-scale-range"),de=o.ay(p,me,Ae),we=o.ay(p,Me,Fe);this.transform.setProjection(m.projection);let le=ee&&(J||!m.hasIconData()||te),Pe=J&&(ee||!m.hasTextData()||Y);const ye=!ne.isConstant();!m.collisionArrays&&R&&m.deserializeCollisionBoxes(R),c&&d&&m.updateCollisionDebugBuffers(this.transform.zoom,R,de,we);const De=(Ce,je,it)=>{const{crossTileID:rt,numVerticalGlyphVertices:Qe}=Ce;let ut=null;if(I&&I.dynamicFilterNeedsFeature||ye){const Mi=this.retainedQueryData[m.bucketInstanceId];ut=Z.loadFeature({featureIndex:Ce.featureIndex,bucketIndex:Mi.bucketIndex,sourceLayerIndex:Mi.sourceLayerIndex,layoutVertexArrayOffset:0})}if(I&&!(0,I.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},ut,this.retainedQueryData[m.bucketInstanceId].tileID.canonical,new o.P(Ce.tileAnchorX,Ce.tileAnchorY),this.transform.calculateDistanceTileData(I.unwrappedTileID)))return this.placements[rt]=new Mn(!1,!1,!1,!0),void n.add(rt);const pt=ne.evaluate(ut,{});if(n.has(rt))return;if(L)return void(this.placements[rt]=new Mn(!1,!1,!1));let yt=!1,It=!1,Ot=!0,pi=!1,Ri=!1,gi=null,bi={box:null,offscreen:null,occluded:null},ur={box:null},Rt=null,Vt=null,Wt=null,Oi=0,br=0,Di=0;it.textFeatureIndex?Oi=it.textFeatureIndex:Ce.useRuntimeCollisionCircles&&(Oi=Ce.featureIndex),it.verticalTextFeatureIndex&&(br=it.verticalTextFeatureIndex);const li=Mi=>{Mi.tileID=this.retainedQueryData[m.bucketInstanceId].tileID;const Ni=this.transform.elevation;Mi.elevation=fe?pt:pt+(Ni?Ni.getAtTileOffset(Mi.tileID,Mi.tileAnchorX,Mi.tileAnchorY):0),Mi.elevation+=Ce.zOffset},nr=it.textBox;if(nr){li(nr);const Mi=ui=>{let ar=o.bI.horizontal;if(m.allowVerticalPlacement&&!ui&&this.prevPlacement){const Nr=this.prevPlacement.placedOrientations[rt];Nr&&(this.placedOrientations[rt]=Nr,ar=Nr,this.markUsedOrientation(m,ar,Ce))}return ar},Ni=(ui,ar)=>{if(m.allowVerticalPlacement&&Qe>0&&it.verticalTextBox){for(const Nr of m.writingModes)if(Nr===o.bI.vertical?(bi=ar(),ur=bi):bi=ui(),bi&&bi.box&&bi.box.length)break}else bi=ui()};if(y.get("text-variable-anchor")){let ui=y.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[rt]){const Hi=this.prevPlacement.variableOffsets[rt];
vendor: 19,755 bytes, line 15
15ui.indexOf(Hi.anchor)>0&&(ui=ui.filter(si=>si!==Hi.anchor),ui.unshift(Hi.anchor))}const ar=(Hi,si,wn)=>{const pn=m.getSymbolInstanceTextSize(F,Ce,this.transform.zoom,je),zn=(Hi.x2-Hi.x1)*pn+2*Hi.padding,Qn=(Hi.y2-Hi.y1)*pn+2*Hi.padding,jn=Ce.hasIconTextFit&&!J?si:null;jn&&li(jn);let fn={box:[],offscreen:!1,occluded:!1};const ao=ee?2*ui.length:ui.length;for(let es=0;es<ao;++es){const lo=this.attemptAnchorPlacement(ui[es%ui.length],Hi,zn,Qn,pn,K,ie,C,T,V,es>=ui.length,Ce,je,m,wn,jn,F,B);if(lo&&(fn=lo.placedGlyphBoxes,fn&&fn.box&&fn.box.length)){yt=!0,gi=lo.shift;break}}return fn};Ni(()=>ar(nr,it.iconBox,o.bI.horizontal),()=>{const Hi=it.verticalTextBox;return Hi&&li(Hi),m.allowVerticalPlacement&&!(bi&&bi.box&&bi.box.length)&&Qe>0&&Hi?ar(Hi,it.verticalIconBox,o.bI.vertical):{box:null,offscreen:null,occluded:null}}),bi&&(yt=bi.box,Ot=bi.offscreen,pi=bi.occluded);const Nr=Mi(!(!bi||!bi.box));if(!yt&&this.prevPlacement){const Hi=this.prevPlacement.variableOffsets[rt];Hi&&(this.variableOffsets[rt]=Hi,this.markUsedJustification(m,Hi.anchor,Ce,Nr))}}else{const ui=(ar,Nr)=>{const Hi=m.getSymbolInstanceTextSize(F,Ce,this.transform.zoom,je,p),si=this.collisionIndex.placeCollisionBox(m,Hi,ar,new o.P(0,0),ee,C,T,V.predicate);return si&&si.box&&si.box.length&&(this.markUsedOrientation(m,Nr,Ce),this.placedOrientations[rt]=Nr),si};Ni(()=>ui(nr,o.bI.horizontal),()=>{const ar=it.verticalTextBox;return m.allowVerticalPlacement&&Qe>0&&ar?(li(ar),ui(ar,o.bI.vertical)):{box:null,offscreen:null,occluded:null}}),Mi(!!(bi&&bi.box&&bi.box.length))}}if(Rt=bi,yt=Rt&&Rt.box&&Rt.box.length>0,Ot=Rt&&Rt.offscreen,pi=Rt&&Rt.occluded,Ce.useRuntimeCollisionCircles){const Mi=m.text.placedSymbolArray.get(Ce.centerJustifiedTextSymbolIndex>=0?Ce.centerJustifiedTextSymbolIndex:Ce.verticalPlacedTextSymbolIndex),Ni=o.bJ(m.textSizeData,F,Mi),ui=y.get("text-padding");Vt=this.collisionIndex.placeCollisionCircles(m,ee,Mi,m.lineVertexArray,m.glyphOffsetArray,Ni,T,S,M,c,ie,V.predicate,Ce.collisionCircleDiameter*Ni/o.bO,ui,this.retainedQueryData[m.bucketInstanceId].tileID),yt=ee||Vt.circles.length>0&&!Vt.collisionDetected,Ot=Ot&&Vt.offscreen,pi=Vt.occluded}if(it.iconFeatureIndex&&(Di=it.iconFeatureIndex),it.iconBox){const Mi=Ni=>{li(Ni);const ui=Ce.hasIconTextFit&&gi?ci(gi.x,gi.y,K,ie,this.transform.angle):new o.P(0,0),ar=m.getSymbolInstanceIconSize(B,this.transform.zoom,Ce.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(m,ar,Ni,ui,J,C,T,V.predicate)};ur&&ur.box&&ur.box.length&&it.verticalIconBox?(Wt=Mi(it.verticalIconBox),It=Wt.box.length>0):(Wt=Mi(it.iconBox),It=Wt.box.length>0),Ot=Ot&&Wt.offscreen,Ri=Wt.occluded}const Qt=Y||Ce.numHorizontalGlyphVertices===0&&Qe===0,mr=te||Ce.numIconVertices===0;if(Qt||mr?mr?Qt||(It=It&&yt):yt=It&&yt:It=yt=It&&yt,yt&&Rt&&Rt.box&&this.collisionIndex.insertCollisionBox(Rt.box,y.get("text-ignore-placement"),m.bucketInstanceId,ur&&ur.box&&br?br:Oi,V.ID),It&&Wt&&this.collisionIndex.insertCollisionBox(Wt.box,y.get("icon-ignore-placement"),m.bucketInstanceId,Di,V.ID),Vt&&(yt&&this.collisionIndex.insertCollisionCircles(Vt.circles,y.get("text-ignore-placement"),m.bucketInstanceId,Oi,V.ID),c)){const Mi=m.bucketInstanceId;let Ni=this.collisionCircleArrays[Mi];Ni===void 0&&(Ni=this.collisionCircleArrays[Mi]=new Lu);for(let ui=0;ui<Vt.circles.length;ui+=4)Ni.circles.push(Vt.circles[ui+0]),Ni.circles.push(Vt.circles[ui+1]),Ni.circles.push(Vt.circles[ui+2]),Ni.circles.push(Vt.collisionDetected?1:0)}const Bi=m.projection.name!=="globe";le=le&&(Bi||!pi),Pe=Pe&&(Bi||!Ri),this.placements[rt]=new Mn(yt||le,It||Pe,Ot||m.justReloaded),n.add(rt)},qe=this.retainedQueryData[m.bucketInstanceId].tileID;if(m.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(m,qe),m.elevationType==="road"&&m.updateRoadElevation(qe.canonical),m.updateZOffset(),m.sortFeaturesByY){const Ce=m.getSortedSymbolIndexes(this.transform.angle);for(let je=Ce.length-1;je>=0;--je){const it=Ce[je];De(m.symbolInstances.get(it),it,m.collisionArrays[it])}m.hasAnyZOffset&&o.w(`${m.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(m.hasAnyZOffset){const Ce=m.getSortedIndexesByZOffset();for(let je=0;je<Ce.length;++je){const it=Ce[je];De(m.symbolInstances.get(it),it,m.collisionArrays[it])}}else for(let Ce=t.symbolInstanceStart;Ce<t.symbolInstanceEnd;Ce++)De(m.symbolInstances.get(Ce),Ce,m.collisionArrays[Ce]);if(c&&m.bucketInstanceId in this.collisionCircleArrays){const Ce=this.collisionCircleArrays[m.bucketInstanceId];o.bi(Ce.invProjMatrix,T),Ce.viewportMatrix=this.collisionIndex.getViewportMatrix()}m.justReloaded=!1}markUsedJustification(t,n,c,d){const{leftJustifiedTextSymbolIndex:p,centerJustifiedTextSymbolIndex:m,rightJustifiedTextSymbolIndex:y,verticalPlacedTextSymbolIndex:x,crossTileID:T}=c,S=o.bV(n),M=d===o.bI.vertical?x:S==="left"?p:S==="center"?m:S==="right"?y:-1;p>=0&&(t.text.placedSymbolArray.get(p).crossTileID=M>=0&&p!==M?0:T),m>=0&&(t.text.placedSymbolArray.get(m).crossTileID=M>=0&&m!==M?0:T),y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=M>=0&&y!==M?0:T),x>=0&&(t.text.placedSymbolArray.get(x).crossTileID=M>=0&&x!==M?0:T)}markUsedOrientation(t,n,c){const d=n===o.bI.horizontal||n===o.bI.horizontalOnly?n:0,p=n===o.bI.vertical?n:0,{leftJustifiedTextSymbolIndex:m,centerJustifiedTextSymbolIndex:y,rightJustifiedTextSymbolIndex:x,verticalPlacedTextSymbolIndex:T}=c,S=t.text.placedSymbolArray;m>=0&&(S.get(m).placedOrientation=d),y>=0&&(S.get(y).placedOrientation=d),x>=0&&(S.get(x).placedOrientation=d),T>=0&&(S.get(T).placedOrientation=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:{},y=n?n.placedOrientations:{};for(const x in this.placements){const T=this.placements[x],S=p[x];S?(this.opacities[x]=new Mo(S,d,T.text,T.icon,null,T.clipped),c=c||T.text!==S.text.placed||T.icon!==S.icon.placed):(this.opacities[x]=new Mo(null,d,T.text,T.icon,T.skipFade,T.clipped),c=c||T.text||T.icon)}for(const x in p){const T=p[x];if(!this.opacities[x]){const S=new Mo(T,d,!1,!1);S.isHidden()||(this.opacities[x]=S,c=c||T.text.placed||T.icon.placed)}}for(const x in m)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=m[x]);for(const x in y)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=y[x]);c?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n,c,d){const p=new Set;for(const m of n){const y=m.getBucket(t);y&&m.latestFeatureIndex&&t.fqid===y.layerIds[0]&&(this.updateBucketOpacities(y,p,m,m.collisionBoxArray,c,d,m.tileID,t.scope),y.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(y,m.tileID),y.elevationType==="road"&&y.updateRoadElevation(m.tileID.canonical),y.updateZOffset())}}updateBucketOpacities(t,n,c,d,p,m,y,x){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const T=t.layers[0].layout,S=t.layers[0].paint,M=!!t.layers[0].dynamicFilter(),I=new Mo(null,0,!1,!1,!0),C=T.get("text-allow-overlap"),L=T.get("icon-allow-overlap"),R=T.get("text-variable-anchor"),F=T.get("text-rotation-alignment")==="map",B=T.get("text-pitch-alignment")==="map",V=S.get("symbol-z-offset"),Z=T.get("symbol-elevation-reference")==="sea",Y=!V.isConstant(),te=new Mo(null,0,C&&(L||!t.hasIconData()||T.get("icon-optional")),L&&(C||!t.hasTextData()||T.get("text-optional")),!0);!t.collisionArrays&&d&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(d);const ee=(K,ie,ne)=>{for(let fe=0;fe<ie/4;fe++)K.opacityVertexArray.emplaceBack(ne)};let J=0;m&&t.updateReplacement(y,m);for(let K=0;K<t.symbolInstances.length;K++){const ie=t.symbolInstances.get(K),{numHorizontalGlyphVertices:ne,numVerticalGlyphVertices:fe,crossTileID:me,numIconVertices:Ae,tileAnchorX:Me,tileAnchorY:Fe}=ie;let de=null;const we=this.retainedQueryData[t.bucketInstanceId];Y&&ie&&we&&(de=c.latestFeatureIndex.loadFeature({featureIndex:ie.featureIndex,bucketIndex:we.bucketIndex,sourceLayerIndex:we.sourceLayerIndex,layoutVertexArrayOffset:0}));const le=V.evaluate(de,{}),Pe=n.has(me);let ye=this.opacities[me];Pe?ye=I:ye||(ye=te,this.opacities[me]=ye),n.add(me);const De=ne>0||fe>0,qe=Ae>0,Ce=this.placedOrientations[me],je=Ce===o.bI.vertical,it=Ce===o.bI.horizontal||Ce===o.bI.horizontalOnly;!De&&!qe||ye.isHidden()||J++;let rt=!1;if((De||qe)&&m)for(const Qe of t.activeReplacements){if(o.bP(Qe,p,o.bQ.Symbol,x)||Qe.min.x>Me||Me>Qe.max.x||Qe.min.y>Fe||Fe>Qe.max.y)continue;const ut=o.bR(Me,Fe,y.canonical,Qe.footprintTileId.canonical);if(rt=o.bS(ut,Qe.footprint),rt)break}if(De){const Qe=rt?Zs:ua(ye.text);ee(t.text,ne,je?Zs:Qe),ee(t.text,fe,it?Zs:Qe);const ut=ye.text.isHidden(),{leftJustifiedTextSymbolIndex:pt,centerJustifiedTextSymbolIndex:yt,rightJustifiedTextSymbolIndex:It,verticalPlacedTextSymbolIndex:Ot}=ie,pi=t.text.placedSymbolArray,Ri=ut||je?1:0;pt>=0&&(pi.get(pt).hidden=Ri),yt>=0&&(pi.get(yt).hidden=Ri),It>=0&&(pi.get(It).hidden=Ri),Ot>=0&&(pi.get(Ot).hidden=ut||it?1:0);const gi=this.variableOffsets[me];gi&&this.markUsedJustification(t,gi.anchor,ie,Ce);const bi=this.placedOrientations[me];bi&&(this.markUsedJustification(t,"left",ie,bi),this.markUsedOrientation(t,bi,ie))}if(qe){const Qe=rt?Zs:ua(ye.icon),{placedIconSymbolIndex:ut,verticalPlacedIconSymbolIndex:pt}=ie,yt=t.icon.placedSymbolArray,It=ye.icon.isHidden()?1:0;ut>=0&&(ee(t.icon,Ae,je?Zs:Qe),yt.get(ut).hidden=It),pt>=0&&(ee(t.icon,ie.numVerticalIconVertices,it?Zs:Qe),yt.get(pt).hidden=It)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const Qe=t.collisionArrays[K];if(Qe){let ut=new o.P(0,0),pt=!0;if(Qe.textBox||Qe.verticalTextBox){if(R){const It=this.variableOffsets[me];It?(ut=vi(It.anchor,It.width,It.height,It.textOffset,It.textScale),F&&ut._rotate(B?this.transform.angle:-this.transform.angle)):pt=!1}M&&(pt=!ye.clipped),Qe.textBox&&bs(t.textCollisionBox.collisionVertexArray,ye.text.placed,!pt||je,le,Z,ut.x,ut.y),Qe.verticalTextBox&&bs(t.textCollisionBox.collisionVertexArray,ye.text.placed,!pt||it,le,Z,ut.x,ut.y)}const yt=pt&&!!(!it&&Qe.verticalIconBox);Qe.iconBox&&bs(t.iconCollisionBox.collisionVertexArray,ye.icon.placed,yt,le,Z,ie.hasIconTextFit?ut.x:0,ie.hasIconTextFit?ut.y:0),Qe.verticalIconBox&&bs(t.iconCollisionBox.collisionVertexArray,ye.icon.placed,!yt,le,Z,ie.hasIconTextFit?ut.x:0,ie.hasIconTextFit?ut.y:0)}}}if(t.fullyClipped=J===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 K=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=K.invProjMatrix,t.placementViewportMatrix=K.viewportMatrix,t.collisionCircleArray=K.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const c=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*c>t}setStale(){this.stale=!0}}function bs(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 di=Math.pow(2,25),gc=Math.pow(2,24),hl=Math.pow(2,17),dl=Math.pow(2,16),rn=Math.pow(2,9),Sr=Math.pow(2,8),vf=Math.pow(2,1);function ua(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*di+t*gc+n*hl+t*dl+n*rn+t*Sr+n*vf+t}const Zs=0;class pl{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 y=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(y,d,t[this._currentTileIndex],this._sortAcrossTiles,m),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,y.sort((x,T)=>x.sortKey-T.sortKey));this._currentPartIndex<y.length;){const x=y[this._currentPartIndex];if(n.placeLayerBucketPart(x,this._seenCrossTileIDs,c,x.symbolInstanceStart===0,m),this._currentPartIndex++,p())return!0}return!1}}class yc{constructor(t,n,c,d,p,m,y,x,T){this.placement=new vn(t,p,m,y,x,T),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(t,n,c,d,p){const m=o.q.now(),y=()=>{const x=o.q.now()-m;return!this._forceFullPlacement&&x>2};for(;this._currentPlacementIndex>=0;){const x=n[t[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(x.type==="symbol"&&(!x.minzoom||x.minzoom<=T)&&(!x.maxzoom||x.maxzoom>T)){const S=x,M=S.layout.get("symbol-z-elevate"),I=S.layout.get("symbol-sort-key").constantOr(1)!==void 0,C=S.layout.get("symbol-z-order"),L=C==="viewport-y"||C==="auto"&&!(C!=="viewport-y"&&I),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"),F=L&&R,B=this._inProgressLayer=this._inProgressLayer||new pl(S),V=o.C(x.source,x.scope);if(B.continuePlacement(M||F?d[V]:c[V],this.placement,this._showCollisionBoxes,x,y,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const fl=512/o.aj/2;class xc{constructor(t,n,c){this.tileID=t,this.bucketInstanceId=c,this.index=new o.bW(n.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const d=t.canonical.x*o.aj,p=t.canonical.y*o.aj;for(let m=0;m<n.length;m++){const{key:y,crossTileID:x,tileAnchorX:T,tileAnchorY:S}=n.get(m),M=Math.floor((d+T)*fl),I=Math.floor((p+S)*fl);this.index.add(M,I),this.keys.push(y),this.crossTileIDs.push(x)}this.index.finish()}findMatches(t,n,c){const d=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z),p=fl/Math.pow(2,n.canonical.z-this.tileID.canonical.z),m=n.canonical.x*o.aj,y=n.canonical.y*o.aj;for(let x=0;x<t.length;x++){const T=t.get(x);if(T.crossTileID)continue;const{key:S,tileAnchorX:M,tileAnchorY:I}=T,C=Math.floor((m+M)*p),L=Math.floor((y+I)*p),R=this.index.range(C-d,L-d,C+d,L+d).sort((F,B)=>F-B);for(const F of R){const B=this.crossTileIDs[F];if(this.keys[F]===S&&!c.has(B)){c.add(B),T.crossTileID=B;break}}}}}class nn{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ws{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 y=d[m];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+n),p[y.tileID.key]=y}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 y in m){const x=m[y];x.tileID.isChildOf(t)&&x.findMatches(n.symbolInstances,t,d)}else{const y=m[t.scaledTo(Number(p)).key];y&&y.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 xc(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 dn{constructor(){this.layerIndexes={},this.crossTileIDs=new nn,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 ws);let m=!1;const y={};d.name!=="globe"&&p.handleWrapJump(c);for(const x of n){const T=x.getBucket(t);T&&t.fqid===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),p.addBucket(x.tileID,T,this.crossTileIDs)&&(m=!0),y[T.bucketInstanceId]=!0)}return p.removeStaleBuckets(y)&&(m=!0),m}pruneUnusedLayers(t){const n={};t.forEach(c=>{n[c]=!0});for(const c in this.layerIndexes)n[c]||delete this.layerIndexes[c]}}const Co=771;class qt{constructor(t,n,c,d){this.blendFunction=t,this.blendColor=n.toNonPremultipliedRenderColor(null),this.mask=c,this.blendEquation=d}}qt.Replace=[1,0,1,0],qt.disabled=new qt(qt.Replace,o.am.transparent,[!1,!1,!1,!1]),qt.unblended=new qt(qt.Replace,o.am.transparent,[!0,!0,!0,!0]),qt.alphaBlended=new qt([1,Co,1,Co],o.am.transparent,[!0,!0,!0,!0]),qt.alphaBlendedNonPremultiplied=new qt([770,Co,770,Co],o.am.transparent,[!0,!0,!0,!0]),qt.multiply=new qt([774,0,774,0],o.am.transparent,[!0,!0,!0,!0]);class et{constructor(t,n,c){this.func=t,this.mask=n,this.range=c}}et.ReadOnly=!1,et.ReadWrite=!0,et.disabled=new et(519,et.ReadOnly,[0,1]);const On=7680;class Mt{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}}Mt.disabled=new Mt({func:519,mask:0},0,0,On,On,On);const vr=1029,ml=2305;class bt{constructor(t,n,c){this.enable=t,this.mode=n,this.frontFace=c}}function ha(l,t){const n=o.c1(l,3);o.c3(l,t),o.c7(l,3,n)}function da(l,t){const n=o.b_([]);return o.b$(n,n,-t),o.c0(n,n,-l),n}function Hs(l,t){const n=[l[0],l[1],0],c=[t[0],t[1],0];if(o.ae(n)>=1e-15){const m=o.au([],n);o.bY(c,m,o.bG(c,m)),t[0]=c[0],t[1]=c[1]}const d=o.bF([],t,l);if(o.bZ(d)<1e-15)return null;const p=Math.atan2(-d[1],d[0]);return da(Math.atan2(Math.sqrt(l[0]*l[0]+l[1]*l[1]),-l[2]),p)}bt.disabled=new bt(!1,vr,ml),bt.backCCW=new bt(!0,vr,ml),bt.backCW=new bt(!0,vr,2304),bt.frontCW=new bt(!0,1028,2304),bt.frontCCW=new bt(!0,1028,ml);class vd{constructor(t,n){this.position=t,this.orientation=n}get position(){return this._position}set position(t){if(t){const n=t instanceof o.ac?t:new o.ac(t[0],t[1],t[2]);
15this._renderWorldCopies&&(n.x=o.bX(n.x,0,1)),this._position=n}else this._position=null}lookAtPoint(t,n){if(this.orientation=null,!this.position)return;const c=this.position,d=this._elevation?this._elevation.getAtPointOrZero(o.ac.fromLngLat(t)):0,p=o.ac.fromLngLat(t,d),m=[p.x-c.x,p.y-c.y,p.z-c.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=Hs(m,n)}setPitchBearing(t,n){this.orientation=da(o.al(t),o.al(-n))}}class Bn{constructor(t,n){this._transform=o.bx([]),this.orientation=n,this.position=t}get mercatorPosition(){const t=this.position;return new o.ac(t[0],t[1],t[2])}get position(){const t=o.c1(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var n;t&&o.c7(this._transform,3,[(n=t)[0],n[1],n[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||o.b_([]),t&&ha(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=da(t,n),ha(this._transform,this._orientation)}forward(){const t=o.c1(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=o.c1(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=o.c1(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,n){const c=new Float64Array(16);return o.bi(c,this.getWorldToCamera(t,n)),c}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,n,c){const d=this.position;o.bY(d,d,-t);const p=new Float64Array(16);return o.bn(p,[c,c,c]),o.bo(p,p,d),p[10]*=n,p}getWorldToCamera(t,n){const c=new Float64Array(16),d=new Float64Array(4),p=this.position;return o.c2(d,this._orientation),o.bY(p,p,-t),o.c3(c,d),o.bo(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 o.c4(p,t,n,c,d),p}getCameraToClipOrthographic(t,n,c,d,p,m){const y=new Float64Array(16);return o.c5(y,t,n,c,d,p,m),y}getDistanceToElevation(t,n=!1){const c=t===0?0:o.c6(t,n?o.aY(this.position[1]):this.position[1]),d=this.forward();return(c-this.position[2])/d[2]}clone(){return new Bn([...this.position],[...this.orientation])}}const sn={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class _l{constructor(t=0,n=0,c=0,d=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(c)||c<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=c,this.right=d}interpolate(t,n,c){return n.top!=null&&t.top!=null&&(this.top=o.ai(t.top,n.top,c)),n.bottom!=null&&t.bottom!=null&&(this.bottom=o.ai(t.bottom,n.bottom,c)),n.left!=null&&t.left!=null&&(this.left=o.ai(t.left,n.left,c)),n.right!=null&&t.right!=null&&(this.right=o.ai(t.right,n.right,c)),this}getCenter(t,n){const c=o.ay((this.left+t-this.right)/2,0,t),d=o.ay((this.top+n-this.bottom)/2,0,n);return new o.P(c,d)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new _l(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Dr=15;class Fu{constructor(t,n,c,d,p,m,y){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(y),this.width=0,this.height=0,this._center=new o.cd(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 _l,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Bn,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const t=new Fu(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t._centerAltitudeValidForE
vendor: 1,249 bytes, line 15
15xaggeration=this._centerAltitudeValidForExaggeration,t.tileSize=this.tileSize,t.mercatorFromTransition=this.mercatorFromTransition,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._seaLevelZoom=this._seaLevelZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._nearZ=this._nearZ,t._farZ=this._farZ,t._averageElevation=this._averageElevation,t._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t.frustumCorners=this.frustumCorners,t._allowWorldUnderZoom=this._allowWorldUnderZoom,t}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<Dr}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
15xaggeration;(this._seaLevelZoom==null||c)&&this._updateCameraOnTerrain(),(t||c)&&this._constrainCamera(n),this._calcMatrices()}getProjection(){return o.aF(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const n=this.projection?this.getProjection():void 0;this.projection=o.ce(this.projectionOptions);const c=this.getProjection(),d=!o.bv(n,c);return d&&this._calcMatrices(),this.mercatorFromTransition=!1,d}setOrthographicProjectionAtLowPitch(t){return this._orthographicProjectionAtLowPitch!==t&&(this._orthographicProjectionAtLowPitch=t,this._calcMatrices(),!0)}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=o.ce({name:"mercator"});const n=t!==this.projection.name;return n&&this._calcMatrices(),n}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get cameraWorldSize(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return o.c6(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new o.P(this.width,this.height)}get bearing(){return o.bX(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const n=-t*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=o.cf(),o.cg(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=o.ay(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=o.al(t),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const t=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/t)}get averageElevation(){return this._averageElevation}set averageElevation(t){this._averageElevation=t,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._setZoom(n),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(t){this._tileCoverLift!==t&&(this._tileCoverLift=t)}_updateCameraOnTerrain(){const t=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,n=this.elevation&&t===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
150&&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 y=new o.P(n[m][0]*this.width,c+n[m][1]*(this.height-c)),x=t.pointCoordinate(y);if(!x)continue;const T=1/Math.hypot(x[0]-this._camera.position[0],x[1]-this._camera.position[1]);d+=x[3]*T,p+=T}return p===0?NaN:d/p}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const t=this._seaLevelZoom,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())}computeZoomRelativeTo(t){const n=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let c;c=t.z<this._camera.position[2]?[n.x,n.y,n.z]:[t.x,t.y,t.z];const d=o.ae(o.at([],this._camera.position,c));return o.ay(this._zoomFromMercatorZ(d),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height||!t.position&&!t.orientation)return;this._updateCameraState();let n=!1;if(t.orientation&&!o.ch(t.orientation,this._camera.orientation)&&(n=this._setCameraOrientation(t.orientation)),t.position){const c=[t.position.x,t.position.y,t.position.z];o.ci(c,this._camera.position)||(this._setCameraPosition(c),n=!0)}n&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,n=new vd;return n.position=new o.ac(t[0],t[1],t[2]),n.orientation=this._camera.orientation,n._elevation=this.elevation,n._renderWorldCopies=this.renderWorldCopies,n}_setCameraOrientation(t){if(!o.cj(t))return!1;o.ck(t,t);const n=o.cl([],[0,0,-1],t),c=o.cl([],[0,-1,0],t);if(c[2]<0)return!1;const d=Hs(n,c);return!!d&&(this._camera.orientation=d,!0)}_setCameraPosition(t){const n=this.zoomScale(this.minZoom)*this.tileSize,c=this.zoomScale(this.maxZoom)*this.tileSize,d=this.cameraToCenterDistance;t[2]=o.ay(t[2],d/c,d/n),this._camera.position=t}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,c){this._unmodified=!1,this._edgeInsets.interpolate(t,n,c),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new o.cm(0,t)];if(this.renderWorldCopies){const c=this.pointCoordinate(new o.P(0,0)),d=this.pointCoordinate(new o.P(this.width,0)),p=this.pointCoordinate(new o.P(this.width,this.height)),m=this.pointCoordinate(new o.P(0,this.height)),y=Math.floor(Math.min(c.x,d.x,p.x,m.x)),x=Math.floor(Math.max(c.x,d.x,p.x,m.x)),T=1;for(let S=y-T;S<=x+T;S++)S!==0&&n.push(new o.cm(S,t))}return n}isLODDisabled(t){return(!t||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(t,n,c){let d=[];const p=c!=null,m=!p;if(m&&this.zoom<n||p&&c[0]===0&&c[1]===0)return d;const y=new Set,x=(S,M,I,C,L)=>{const R=o.cK(M,S,I,C,L);y.has(R)||(d.push(new o.aM(S,M,I,C,L)),y.add(R))};for(let S=0;S<t.length;S++){const M=t[S];if(m&&M.canonical.z!==n)continue;const I=M.canonical,C=M.overscaledZ,L=M.wrap,R=1<<I.z,F=I.x+1<R,B=I.x>0,V=I.y+1<R,Z=I.y>0,Y=M.wrap-(B?0:1),te=M.wrap+(F?0:1),ee=B?I.x-1:R-1,J=F?I.x+1:0;if(p)c[0]<0?(x(C,te,I.z,J,I.y),c[1]<0&&V&&(x(C,L,I.z,I.x,I.y+1),x(C,te,I.z,J,I.y+1)),c[1]>0&&Z&&(x(C,L,I.z,I.x,I.y-1),x(C,te,I.z,J,I.y-1))):c[0]>0?(x(C,Y,I.z,ee,I.y),c[1]<0&&V&&(x(C,L,I.z,I.x,I.y+1),x(C,Y,I.z,ee,I.y+1)),c[1]>0&&Z&&(x(C,L,I.z,I.x,I.y-1),x(C,Y,I.z,ee,I.y-1))):c[1]<0&&V?x(C,L,I.z,I.x,I.y+1):Z&&x(C,L,I.z,I.x,I.y-1);else{const K=M.visibleQuadrants;
151&K&&(x(C,Y,I.z,ee,I.y),Z&&(x(C,L,I.z,I.x,I.y-1),x(C,Y,I.z,ee,I.y-1))),2&K&&(x(C,te,I.z,J,I.y),Z&&(x(C,L,I.z,I.x,I.y-1),x(C,te,I.z,J,I.y-1))),4&K&&(x(C,Y,I.z,ee,I.y),V&&(x(C,L,I.z,I.x,I.y+1),x(C,Y,I.z,ee,I.y+1))),8&K&&(x(C,te,I.z,J,I.y),V&&(x(C,L,I.z,I.x,I.y+1),x(C,te,I.z,J,I.y+1)))}}const T=[];for(const S of d)d.some(M=>S.isChildOf(M))||T.push(S);if(d=T.filter(S=>!t.some(M=>!!(S.overscaledZ<n&&M.isChildOf(S))||S.equals(M)||S.isChildOf(M))),m){const S=1<<n,M=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),I=[S*M.x,S*M.y],C=4,L=C*C;d=d.filter(R=>{const F=R.canonical.x+.5-I[0],B=R.canonical.y+.5-I[1];return F*F+B*B<L})}return d}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 y=this.locationCoordinate(this.center),x=this.center.lat,T=1<<n,S=[T*y.x,T*y.y,0],M=this.projection.name==="globe",I=!M,C=o.cn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n,I),L=M?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),R=T*o.c6(1,this.center.lat),F=this._camera.position[2]/o.c6(1,this.center.lat),B=[T*L.x,T*L.y,F*(I?1:R)],V=M||d,Z=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),Y=this.isLODDisabled(!0)?n:0;let te;if(this._elevation&&t.isTerrainDEM)te=1e4*this._elevation.exaggeration();else if(this._elevation){const le=this._elevation.getMinMaxForVisibleTiles();te=le?le.max:this._centerAltitude}else te=this._centerAltitude;const ee=t.isTerrainDEM?-te:this._elevation?this._elevation.getMinElevationBelowMSL():0,J=this.projection.isReprojectedInTileSpace?o.co(this):1,K=le=>{const ye=new o.ac(le.x+25e-6,le.y,le.z),De=new o.ac(le.x,le.y+25e-6,le.z),qe=le.toLngLat(),Ce=ye.toLngLat(),je=De.toLngLat(),it=this.locationCoordinate(qe),rt=this.locationCoordinate(Ce),Qe=this.locationCoordinate(je),ut=Math.hypot(rt.x-it.x,rt.y-it.y),pt=Math.hypot(Qe.x-it.x,Qe.y-it.y);return Math.sqrt(ut*pt)*J/25e-6},ie=le=>{const Pe=te,ye=ee;return{aabb:o.cr(this,T,0,0,0,le,ye,Pe,this.projection),zoom:0,x:0,y:0,minZ:ye,maxZ:Pe,wrap:le,fullyVisible:!1}},ne=[];let fe=[];const me=n,Ae=t.reparseOverscaled?c:n,Me=(F-this._centerAltitude)*R,Fe=le=>{if(!this._elevation||!le.tileID||!m)return;const Pe=this._elevation.getMinMaxForTile(le.tileID),ye=le.aabb;Pe?(ye.min[2]=Pe.min,ye.max[2]=Pe.max,ye.center[2]=(ye.min[2]+ye.max[2])/2):(le.shouldSplit=we(le),le.shouldSplit||(ye.min[2]=ye.max[2]=ye.center[2]=this._centerAltitude))},de=(le,Pe)=>{if(.707*Pe<le)return 1;const ye=Pe/le;return ye/(1.4144271570014144+(Math.pow(1.1,ye-1.4144271570014144+1)-1)/(1.1-1)-1)},we=le=>{if(le.zoom<Y)return!0;if(le.zoom===me)return!1;if(le.shouldSplit!=null)return le.shouldSplit;const Pe=le.aabb.distanceX(B),ye=le.aabb.distanceY(B);let De=Me,qe=1;if(M){De=le.aabb.distanceZ(B);const pt=Math.pow(2,le.zoom),yt=o.aY((le.y+1)/pt),It=o.aY(le.y/pt),Ot=Math.min(Math.max(x,yt),It),pi=o.cO(Ot)/o.cO(x);if(qe=Ot===x?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,pi/this._mercatorScaleRatio),this.zoom<=o.cL&&le.zoom===me-1&&pi>=.9)return!0}else if(p&&(De=le.aabb.distanceZ(B)*R),this.projection.isReprojectedInTileSpace&&c<=5){const pt=Math.pow(2,le.zoom),yt=K(new o.ac((le.x+.5)/pt,(le.y+.5)/pt));qe=yt>.85?1:yt}if(!m){const pt=Math.sqrt(Pe*Pe+ye*ye+De*De);let yt=(1<<me-le.zoom)*Z*qe;return yt*=de(Math.max(De,Me),pt),pt<yt}let Ce=Number.MAX_VALUE,je=0;const it=le.aabb.getCorners(),rt=[];for(const pt of it){o.at(rt,pt,B),M||(p?rt[2]*=R:rt[2]=Me);const yt=o.bG(rt,this._camera.forward());yt<Ce&&(Ce=yt,je=Math.abs(rt[2]))}let Qe=(1<<me-le.zoom)*Z*qe;if(Qe*=de(Math.max(je,Me),Ce),Ce<Qe)return!0;const ut=le.aabb.closestPoint(S);return ut[0]===S[0]&&ut[1]===S[1]};if(this.renderWorldCopies)for(let le=1;le<=3;le++)ne.push(ie(-le)),ne.push(ie(le));for(ne.push(ie(0));ne.length>0;){const le=ne.pop(),Pe=le.x,ye=le.y;let De=le.fullyVisible;const qe=()=>this.projection.name==="globe"&&(le.y===0||le.y===(1<<le.zoom)-1);if(!De){let Ce=V?le.aabb.intersects(C):le.aabb.intersectsFlat(C);if(Ce===0&&qe()){const je=new o.cp(le.zoom,Pe,ye);Ce=o.cq(this,T,je,!0).intersects(C)}if(Ce===0)continue;De=Ce===2}if(le.zoom!==me&&we(le))for(let Ce=0;Ce<4;Ce++){const je=(Pe<<1)+Ce%2,it=(ye<<1)+(Ce>>1),rt={aabb:m?le.aabb.quadrant(Ce):o.cr(this,T,le.zoom+1,je,it,le.wrap,le.minZ,le.maxZ,this.projection),zoom:le.zoom+1,x:je,y:it,wrap:le.wrap,fullyVisible:De,tileID:void 0,shouldSplit:void 0,minZ:le.minZ,maxZ:le.maxZ};p&&!M&&(rt.tileID=new o.aM(le.zoom+1===me?Ae:le.zoom+1,le.wrap,le.zoom+1,je,it),Fe(rt)),ne.push(rt)}else{const Ce=le.zoom===me?Ae:le.zoom;if(t.minzoom&&t.minzoom>Ce)continue;let je=0;if(!De){let ut=V?le.aabb.intersectsPrecise(C):le.aabb.intersectsPreciseFlat(C);if(ut===0&&qe()){const pt=new o.cp(le.zoom,Pe,ye);
15ut=o.cq(this,T,pt,!0).intersectsPrecise(C)}if(ut===0)continue;if(t.calculateQuadrantVisibility)if(C.containsPoint(le.aabb.center))je=15;else for(let pt=0;pt<4;pt++)le.aabb.quadrant(pt).intersects(C)!==0&&(je|=1<<pt)}const it=S[0]-(.5+Pe+(le.wrap<<le.zoom))*(1<<n-le.zoom),rt=S[1]-.5-ye,Qe=le.tileID?le.tileID:new o.aM(Ce,le.wrap,le.zoom,Pe,ye);t.calculateQuadrantVisibility&&(Qe.visibleQuadrants=je),fe.push({tileID:Qe,distanceSq:it*it+rt*rt})}}if(this.fogCullDistSq){const le=this.fogCullDistSq,Pe=this.horizonLineFromTop();fe=fe.filter(ye=>{const De=[0,0,0,1],qe=[o.aj,o.aj,0,1],Ce=this.calculateFogTileMatrix(ye.tileID.toUnwrapped());o.aA(De,De,Ce),o.aA(qe,qe,Ce);const je=o.cs([],De,qe),it=o.ct([],De,qe),rt=o.cM(je,it);if(rt===0)return!0;let Qe=!1;const ut=this._elevation;if(ut&&rt>le&&Pe!==0){const pt=this.calculateProjMatrix(ye.tileID.toUnwrapped());let yt;t.isTerrainDEM||(yt=ut.getMinMaxForTile(ye.tileID)),yt||(yt={min:ee,max:te});const It=o.cu(this.rotation),Ot=[It[0]*o.aj,It[1]*o.aj,yt.max];o.ad(Ot,Ot,pt),Qe=(1-Ot[1])*this.height*.5<Pe}return rt<le||Qe})}return fe.sort((le,Pe)=>le.distanceSq-Pe.distanceSq).map(le=>le.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=o.ay(t.lat,-85.051129,o.cv),c=this.projection.project(t.lng,n);return new o.P(c.x*this.worldSize,c.y*this.worldSize)}unproject(t){return this.projection.unproject(t.x/this.worldSize,t.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/o.c6(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,n){let c,d;const p=this.centerPoint;if(this.projection.name==="globe"){const y=this.worldSize;c=(n.x-p.x)/y,d=(n.y-p.y)/y}else{const y=this.pointCoordinate(n),x=this.pointCoordinate(p);c=y.x-x.x,d=y.y-x.y}const m=this.locationCoordinate(t);this.setLocation(new o.ac(m.x-c,m.y-d))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(t,n){return this.projection.locationPoint(this,t,n)}locationPoint3D(t,n){return this.projection.locationPoint(this,t,n,!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t,n){return this.coordinateLocation(this.pointCoordinate3D(t,n))}locationCoordinate(t,n){const c=n?o.c6(n,t.lat):void 0,d=this.projection.project(t.lng,t.lat);return new o.ac(d.x,d.y,c)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(t,n){const c=n??this._centerAltitude,d=[t.x,t.y,0,1],p=[t.x,t.y,1,1];o.aA(d,d,this.pixelMatrixInverse),o.aA(p,p,this.pixelMatrixInverse);const m=p[3];o.cw(d,d,1/d[3]),o.cw(p,p,1/m);const y=d[2],x=p[2];return{p0:d,p1:p,t:y===x?0:(c-y)/(x-y)}}screenPointToMercatorRay(t){const n=[t.x,t.y,0,1],c=[t.x,t.y,1,1];return o.aA(n,n,this.pixelMatrixInverse),o.aA(c,c,this.pixelMatrixInverse),o.cw(n,n,1/n[3]),o.cw(c,c,1/c[3]),n[2]=o.c6(n[2],this._center.lat)*this.worldSize,c[2]=o.c6(c[2],this._center.lat)*this.worldSize,o.cw(n,n,1/this.worldSize),o.cw(c,c,1/this.worldSize),new o.av([n[0],n[1],n[2]],o.au([],o.at([],c,n)))}rayIntersectionCoordinate(t){const{p0:n,p1:c,t:d}=t,p=o.c6(n[2],this._center.lat),m=o.c6(c[2],this._center.lat);return new o.ac(o.ai(n[0],c[0],d)/this.worldSize,o.ai(n[1],c[1],d)/this.worldSize,o.ai(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 o.ac(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,y=t.clone();for(let x=0;x<10&&p-d>m;x++){y.y=o.ai(d,p,.66);const T=this.projection.pointCoordinate3D(this,y.x,y.y);T?(p=y.y,c=T):d=y.y}return c?new o.ac(c[0],c[1],c[2]):this.pointCoordinate(t)}isPointAboveHorizon(t){return this.projection.isPointAboveHorizon(this,t)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=o.cx)return!this.isPointAboveHorizon(t);const n=this.pointCoordinate(t);return n.y>=0&&n.y<=1}_coordinatePoint(t,n){const c=n&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,d=[t.x*this.worldSize,t.y*this.worldSize,c+t.toAltitude(),1];return o.aA(d,d,this.pixelMatrix),d[3]>0?new o.P(d[0]/d[3],d[1]/d[3]):new o.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:n}=this._edgeInsets,c=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,p=this.pointLocation3D(new o.P(n,t)),m=this.pointLocation3D(new o.P(d,t)),y=this.pointLocation3D(new o.P(d,c)),x=this.pointLocation3D(new o.P(n,c));let T=Math.min(p.lng,m.lng,y.lng,x.lng),S=Math.max(p.lng,m.lng,y.lng,x.lng),M=Math.min(p.lat,m.lat,y.lat,x.lat),I=Math.max(p.lat,m.lat,y.lat,x.lat);const C=Math.pow(2,-this.zoom)/16*270,L=this.projection.name==="globe"?1:4,R=(F,B,V,Z,Y)=>{const te=(F+V)/2,ee=(B+Z)/2,J=new o.P(te,ee),{lng:K,lat:ie}=this.pointLocation3D(J),ne=Math.max(0,T-K,M-ie,K-S,ie-I);T=Math.min(T,K),S=Math.max(S,K),M=Math.min(M,ie),I=Math.max(I,ie),(Y<L||ne>C)&&(R(F,B,te,ee,Y+1),R(te,ee,V,Z,Y+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[F,B]=o.cy(this);F?(I=90,S=180,T=-180):B&&(M=-90,S=180,T=-180)}return new o.aG(new o.cd(T,M),new o.cd(S,I))}_getBoundsRectangular(t,n){const{top:c,left:d}=this._edgeInsets,p=this.height-this._edgeInsets.bottom,m=this.width-this._edgeInsets.right,y=new o.P(d,c),x=new o.P(m,c),T=new o.P(m,p),S=new o.P(d,p);let M=this.pointCoordinate(y,t),I=this.pointCoordinate(x,t);const C=this.pointCoordinate(T,n),L=this.pointCoordinate(S,n),R=(F,B)=>(B.y-F.y)/(B.x-F.x);return M.y>1&&I.y>=0?M=new o.ac((1-L.y)/R(L,M)+L.x,1):M.y<0&&I.y<=1&&(M=new o.ac(-L.y/R(L,M)+L.x,0)),I.y>1&&M.y>
15=0?I=new o.ac((1-C.y)/R(C,I)+C.x,1):I.y<0&&M.y<=1&&(I=new o.ac(-C.y/R(C,I)+C.x,0)),new o.aG().extend(this.coordinateLocation(M)).extend(this.coordinateLocation(I)).extend(this.coordinateLocation(L)).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=-85.051129,this.maxLat=o.cv,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=o.aD(this.minLng)*this.tileSize,this.worldMaxX=o.aD(this.maxLng)*this.tileSize,this.worldMinY=o.aH(this.maxLat)*this.tileSize,this.worldMaxY=o.aH(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,n){return this.projection.createTileMatrix(this,n,t)}calculateDistanceTileData(t){const n=t.key,c=this._distanceTileDataCache;if(c[n])return c[n];const d=t.canonical,p=1/this.height,m=this.cameraWorldSize,y=m/this.zoomScale(d.z),x=(d.x+Math.pow(2,d.z)*t.wrap)*y,T=d.y*y,S=this.point;S.x*=m/this.worldSize,S.y*=m/this.worldSize;const M=this.angle,I=Math.sin(-M),C=-Math.cos(-M);return c[n]={bearing:[I,C],center:[(S.x-x)*p,(S.y-T)*p],scale:y/o.aj*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 o.az(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 y;return y=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:c?this.expandedFarZProjMatrix:n?this.alignedProjMatrix:this.projMatrix,o.az(m,y,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=o.cz(t,this);return c[n]=d,c[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const t=1/this.worldSize,n=o.bn([],[t,t,t]);return o.az(n,n,this.globeMatrix),n}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const t=this._elevation;this._updateCameraState();const n=o.c6(1,this._center.lat)*this.worldSize,c=this._computeCameraPosition(n),d=this._camera.forward(),p=o.c6(1,this._center.lat);c[2]/=p,d[2]/=p,o.au(d,d);const m=t.raycast(c,d,t.exaggeration());if(m){const y=o.bE([],c,d,m),x=new o.ac(y[0],y[1],o.c6(y[2],o.aY(y[1]))),T=(x.z+o.ae([x.x-c[0],x.y-c[1],x.z-c[2]*p]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(T),this._centerAltitude=x.toAltitude(),this._center=this.coordinateLocation(x),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(t=!1){if(!this._elevation)return;const n=this._elevation,c=o.c6(1,this._center.lat)*this.worldSize,d=this._computeCameraPosition(c),p=n.getAtPointOrZero(new o.ac(...d)),m=this.pixelsPerMeter/this.worldSize*p,y=this._minimumHeightOverTerrain(),x=d[2]-m;if(x<=y)if(x<0||t){const T=this.locationCoordinate(this._center,this._centerAltitude),S=[d[0],d[1],T.z-d[2]],M=o.ae(S);S[2]-=(y-x)/this._pixelsPerMercatorPixel;const I=o.ae(S);if(I===0)return;o.bY(S,S,M/I*this._pixelsPerMercatorPixel),this._camera.position=[d[0],d[1],T.z*this._pixelsPerMercatorPixel-S[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){const I=this.center;return I.lat=o.ay(I.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(I.lng=o.ay(I.lng,this.minLng,this.maxLng)),this.center=I,void(this._constraining=!1)}const n=this._unmodified,{x:c,y:d}=this.point;let p=0,m=c,y=d;const x=this.width/2,T=this.height/2,S=this.worldMinY*this.scale,M=this.worldMaxY*this.scale;if(d-T<S&&(y=S+T),d+T>M&&(y=M-T),M-S<this.height&&(p=Math.max(p,this.height/(M-S)),y=(M+S)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const I=this.worldMinX*this.scale,C=this.worldMaxX*this.scale,L=this.worldSize/2-(I+C)/2;m=(c+L+this.worldSize)%this.worldSize-L,m-x<I&&(m=I+x),m+x>C&&(m=C-x),C-I<this.width&&(p=Math.max(p,this.width/(C-I)),m=(C+I)/2)}m===c&&y===d||this._allowWorldUnderZoom||(this.center=this.unproject(new o.P(m,y))),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())}
15_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.projection.name==="globe",c=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=o.c6(1,this.center.lat)/o.c6(1,o.cP));const d=o.cA(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,d),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const p=this.projection.zAxisUnit==="meters"?c:1,m=this._camera.getWorldToCamera(this.worldSize,p);let y;const x=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(x[8]=2*-t.x/this.width,x[9]=2*t.y/this.height,this.isOrthographic){let ie=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),ne=ie*this.aspect,fe=-ne,me=-ie;ne-=t.x,fe-=t.x,ie+=t.y,me+=t.y,y=this._camera.getCameraToClipOrthographic(fe,ne,me,ie,this._nearZ,this._farZ),((Ae,Me,Fe,de)=>{for(let we=0;we<16;we++)Ae[we]=o.ai(Me[we],Fe[we],de)})(y,y,x,o.cN(this.pitch>=Dr?1:this.pitch/Dr))}else y=x;const T=o.cB([],x,m);let S=o.cB([],y,m);if(this.projection.isReprojectedInTileSpace){const ie=this.locationCoordinate(this.center),ne=o.bx([]);o.bo(ne,ne,[ie.x*this.worldSize,ie.y*this.worldSize,0]),o.az(ne,ne,o.cC(this)),o.bo(ne,ne,[-ie.x*this.worldSize,-ie.y*this.worldSize,0]),o.az(S,S,ne),o.az(T,T,ne),this.inverseAdjustmentMatrix=o.cD(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=o.cE([],S,[this.worldSize,this.worldSize,this.worldSize/p,1]),this.projMatrix=S,this.invProjMatrix=o.bi(new Float64Array(16),this.projMatrix),n){const ie=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);ie[8]=2*-t.x/this.width,ie[9]=2*t.y/this.height,this.expandedFarZProjMatrix=o.cB([],ie,m)}else this.expandedFarZProjMatrix=this.projMatrix;const M=o.bi([],y);this.frustumCorners=o.cF.fromInvProjectionMatrix(M,this.horizonLineFromTop(),this.height),this.cameraFrustum=o.cn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!n);const I=new Float32Array(16);o.bx(I),o.cE(I,I,[1,-1,1]),o.cG(I,I,this._pitch),o.by(I,I,this.angle);const C=o.c4(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=o.bw(C);const L=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;C[8]=2*-t.x/this.width,C[9]=2*(t.y+L)/this.height,this.skyboxMatrix=o.az(I,C,I);const R=this.point,F=R.x,B=R.y,V=this.width%2/2,Z=this.height%2/2,Y=Math.cos(this.angle),te=Math.sin(this.angle),ee=F-Math.round(F)+Y*V+te*Z,J=B-Math.round(B)+Y*Z+te*V,K=new Float64Array(S);if(o.bo(K,K,[ee>.5?ee-1:ee,J>.5?J-1:J,0]),this.alignedProjMatrix=K,S=o.bz(),o.cE(S,S,[this.width/2,-this.height/2,1]),o.bo(S,S,[1,-1,0]),this.labelPlaneMatrix=S,S=o.bz(),o.cE(S,S,[1,-1,1]),o.bo(S,S,[-1,-1,0]),o.cE(S,S,[2/this.width,2/this.height,1]),this.glCoordMatrix=S,this.pixelMatrix=o.az(new Float64Array(16),this.labelPlaneMatrix,T),this._calcFogMatrices(),this._distanceTileDataCache={},S=o.bi(new Float64Array(16),this.pixelMatrix),!S)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=S,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=o.cH(this);const ie=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=o.ad(ie,ie,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];o.bY(p,p,d),o.bY(c,c,-1),o.cI(c,c,p);const m=o.bz();o.bo(m,m,c),o.cE(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=o.bE([],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=o.c6(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,m=this._mercatorZfromZoom(this._maxZoom)*Math.cos(o.al(this._maxPitch)),y=Math.max((t[2]-p)/Math.cos(c),m),x=this._zoomFromMercatorZ(y);o.bE(t,t,n,y),this._pitch=o.ay(c,o.al(this.minPitch),o.al(this.maxPitch)),this.angle=o.bX(d,-Math.PI,Math.PI),this._setZoom(o.ay(x,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new o.ac(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,t)*this.tileSize))}zoomFromMercatorZAdjusted(t){let n=0,c=o.cx,d=0,p=1/0;for(;c-n>1e-6&&c>n;){const m=n+.5*(c-n),y=this.tileSize*Math.pow(2,m),x=this.getCameraToCenterDistance(this.projection,m,y),T=this.scaleZoom(x/(Math.max(0,t)*this.tileSize)),S=Math.abs(m-T);S<p&&(p=S,d=m),m<T?n=m:c=m}return d}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(o.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,n){const c=Math.min(t.x,n.x),d=Math.max(t.x,n.x),p=Math.min(t.y,n.y),m=Math.max(t.y,n.y);if(p<this.horizonLineFromTop(!1))return!0;
15if(this.projection.name!=="mercator")return!1;const y=[new o.P(c,p),new o.P(d,m),new o.P(c,m),new o.P(d,p)],x=this.renderWorldCopies?-3:0,T=this.renderWorldCopies?4:1;for(const S of y){const M=this.pointRayIntersection(S);if(M.t<0)return!0;const I=this.rayIntersectionCoordinate(M);if(I.x<x||I.y<0||I.x>T||I.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+o.cJ(this.fovAboveCenter)>88||this.anyCornerOffEdge(new o.P(0,0),new o.P(this.width,this.height))}zoomDeltaToMovement(t,n){const c=o.ae(o.at([],this._camera.position,t)),d=this._zoomFromMercatorZ(c)+n;return c-this._mercatorZfromZoom(d)}getCameraPoint(){if(this.projection.name==="globe"){const t=function([n,c,d],p){const m=[n,c,d,1];o.aA(m,m,p);const y=m[3]=Math.max(m[3],1e-6);return m[0]/=y,m[1]/=y,m[2]/=y,m}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new o.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new o.P(0,t))}}getCameraToCenterDistance(t,n=this.zoom,c=this.worldSize){const d=o.cA(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=o.ai(1,m,o.cN(this.pitch>=Dr?1:this.pitch/Dr))),m}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&o.az(t,t,this.globeMatrix),t}getFrustum(t){return o.cn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,this.projection.zAxisUnit==="meters")}}const os=(l,t)=>{if(t>0&&l.terrain&&o.w("Cutoff is currently disabled on terrain"),t<=0||l.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const n=l.transform,c=Math.max(Math.abs(n._zoom-(l.minCutoffZoom-1)),1),d=n.isLODDisabled(!1)?o.af(60,45,n.pitch):o.af(30,15,n.pitch),p=n._farZ-n._nearZ,m=t*n.height,y=((1-(x=d))*n.cameraToCenterDistance+x*(n._farZ+m))*c;var x;return{shouldRenderCutoff:d<1,uniformValues:{u_cutoff_params:[n._nearZ,n._farZ,(y-n._nearZ)/p,(y-m-n._nearZ)/p]}}},Hr={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class gl{constructor(t,n){this.aabb=t,this.lastCascade=n}}class bf{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 gl(n,null)}clear(){this.receivers={}}get(t){return this.receivers[t.key]}computeRequiredCascades(t,n,c){const d=o.cW.fromPoints(t.points);let p=0;for(const m in this.receivers){const y=this.receivers[m];if(!y||!d.intersectsAabb(y.aabb))continue;y.aabb.min=d.closestPoint(y.aabb.min),y.aabb.max=d.closestPoint(y.aabb.max);const x=y.aabb.getCorners();for(let T=0;T<c.length;T++){let S=!0;for(const M of x){const I=[M[0]*n,M[1]*n,M[2]];if(o.ad(I,I,c[T].matrix),I[0]<-1||I[0]>1||I[1]<-1||I[1]>1){S=!1;break}}if(y.lastCascade=T,p=Math.max(p,T),S)break}}return p+1}}class wf{constructor(t){this.painter=t,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new bf,this._depthMode=new et(t.context.gl.LEQUAL,et.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,t.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},()=>{this.painter.style.map.triggerRepaint()}),t.tp.registerParameter(Hr,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),t.tp.registerParameter(Hr,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),t.tp.registerParameter(Hr,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),t.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const t of this._cascades)t.texture.destroy(),t.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,n){const c=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!n||!n.properties)return;const d=n.properties.get("shadow-intensity");if(!n.shadowsEnabled()||d<=0||(this._shadowLayerCount=c.style.order.reduce((L,R)=>{const F=c.style._mergedLayers[R];return L+(F.hasShadowPass()&&!F.isHidden(t.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const p=c.context,m=Hr.shadowMapResolution,y=Hr.shadowMapResolution;if(this._cascades.length===0||Hr.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let L=0;L<Hr.cascadeCount;++L){const R=c._shadowMapDebug,F=p.gl,B=p.createFramebuffer(m,y,R,"texture"),V=new o.T(p,{width:m,height:y,data:null},F.DEPTH_COMPONENT16);if(B.depthAttachment.set(V.texture),R){const Z=new o.T(p,{width:m,height:y,data:null},F.RGBA8);B.colorAttachment.set(Z.texture)}this._cascades.push({framebuffer:B,texture:V,matrix:[],far:0,boundingSphereRadius:0,frustum:new o.cn,scale:0})}}this.shadowDirection=pa(n);let x=0;if(t.elevation){const L=t.elevation,R=[1e4,-1e4];L.visibleDemTiles.filter(F=>F.dem).forEach(F=>{const B=F.dem.tree;R[0]=Math.min(R[0],B.minimums[0]),R[1]=Math.max(R[1],B.maximums[0])}),R[0]!==1e4&&(x=(R[1]-R[0])*L.exaggeration())}const T=1.5*t.cameraToCenterDistance,S=3*T,M=new Float64Array(16);for(let L=0;L<this._cascades.length;++L){const R=this._cascades[L];let F=t.height/50,B=1;Hr.cascadeCount===1?B=S:L===0?B=T:(F=T,B=S);const[V,Z]=fa(t,this.shadowDirection,F,B,Hr.shadowMapResolution,x);R.scale=t.scale,R.matrix=V,R.boundingSphereRadius=Z,o.bi(M,R.matrix
15),R.frustum=o.cn.fromInvProjectionMatrix(M,1,0,!0),R.far=B}const I=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[I].far,this._cascades[I].far],this._uniformValues.u_shadow_intensity=d,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/Hr.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=Hr.shadowMapResolution,this._uniformValues.u_shadowmap_0=sn.ShadowMap0,this._uniformValues.u_shadowmap_1=sn.ShadowMap0+1,this._groundShadowTiles=c.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const C=c.transform.elevation;for(const L of this._groundShadowTiles){let R={min:0,max:0};if(C){const F=C.getMinMaxForTile(L);F&&(R=F)}this.addShadowReceiver(L.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,Hr.shadowMapResolution,Hr.shadowMapResolution]);for(let p=0;p<this._numCascadesToRender;++p){c.currentShadowCascade=p,d.bindFramebuffer.set(this._cascades[p].framebuffer.framebuffer),d.clear({color:o.am.white,depth:1});for(const m of t.order){const y=t._mergedLayers[m];if(!y.hasShadowPass()||y.isHidden(c.transform.zoom))continue;const x=t.getLayerSourceCache(y),T=x?n[x.id]:void 0;(y.type==="model"||T&&T.length)&&c.renderLayer(c,x,y,T)}}c.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const t=this.painter,n=t.style,c=t.context,d=c.gl,p=n.directionalLight,m=n.ambientLight;if(!p||!m)return;const y=[],x=os(t,t.longestCutoffRange);x.shouldRenderCutoff&&y.push("RENDER_CUTOFF"),y.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&y.push("NORMAL_OFFSET");const T=Po(n,p,m),S=new et(d.LEQUAL,et.ReadOnly,t.depthRangeFor3D),M=new Mt({func:d.EQUAL,mask:255},0,255,d.KEEP,d.KEEP,d.KEEP);for(const I of this._groundShadowTiles){const C=I.toUnwrapped(),L=t.isTileAffectedByFog(I),R=t.getOrCreateProgram("groundShadow",{defines:y,overrideFog:L});this.setupShadows(C,R),t.uploadCommonUniforms(c,R,C,null,x);const F={u_matrix:t.transform.calculateProjMatrix(C),u_ground_shadow_factor:T};R.draw(t,d.TRIANGLES,S,M,qt.multiply,bt.disabled,F,"ground_shadow",t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments,null,t.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?qt.unblended:qt.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(t){const n=this.painter.transform,c=n.calculatePosMatrix(t,n.worldSize);return o.az(c,this._cascades[this.painter.currentShadowCascade].matrix,c),Float32Array.from(c)}calculateShadowPassMatrixFromMatrix(t){return o.az(t,this._cascades[this.painter.currentShadowCascade].matrix,t),Float32Array.from(t)}setupShadows(t,n,c,d=0){if(!this.enabled)return;const p=this.painter.transform,m=this.painter.context,y=m.gl,x=this._uniformValues,T=new Float64Array(16),S=p.calculatePosMatrix(t,p.worldSize);for(let M=0;M<this._cascades.length;M++)o.az(T,this._cascades[M].matrix,S),x[M===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(T),m.activeTexture.set(y.TEXTURE0+sn.ShadowMap0+M),this._cascades[M].texture.bindExtraParam(y.LINEAR,y.LINEAR,y.CLAMP_TO_EDGE,y.CLAMP_TO_EDGE,y.GREATER);if(this.useNormalOffset=!!c,this.useNormalOffset){const M=o.cU(t.canonical),I=2/p.tileSize*o.aj/Hr.shadowMapResolution,C=I*this._cascades[0].boundingSphereRadius,L=I*this._cascades[this._cascades.length-1].boundingSphereRadius,R=(c==="vector-tile"?1:3)/Math.pow(2,d-t.canonical.z-(1-p.zoom+Math.floor(p.zoom)));x.u_shadow_normal_offset=[M,C*R,L*R],x.u_shadow_bias=[6e-5,.0012,.012]}else x.u_shadow_bias=[36e-5,.0012,.012];n.setShadowUniformValues(m,x)}setupShadowsFromMatrix(t,n,c=!1){if(!this.enabled)return;const d=this.painter.context,p=d.gl,m=this._uniformValues,y=new Float64Array(16);for(let x=0;x<Hr.cascadeCount;x++)o.az(y,this._cascades[x].matrix,t),m[x===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(y),d.activeTexture.set(p.TEXTURE0+sn.ShadowMap0+x),this._cascades[x].texture.bindExtraParam(p.LINEAR,p.LINEAR,p.CLAMP_TO_EDGE,p.CLAMP_TO_EDGE,p.GREATER);if(this.useNormalOffset=c,c){const x=Hr.normalOffset;m.u_shadow_normal_offset=[1,x,x],m.u_shadow_bias=[6e-5,.0012,.012]}else m.u_shadow_bias=[36e-5,.0012,.012];n.setShadowUniformValues(d,m)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,n,c,d){if(d[2]>=0)return{};const p=function(x,T,S){const M=S/(1<<x.canonical.z);return new o.cW([x.canonical.x*M+x.wrap*S,x.canonical.y*M+x.wrap*S,0],[(x.canonical.x+1)*M+x.wrap*S,(x.canonical.y+1)*M+x.wrap*S,T])}(t,n,c).getCorners(),m=n/-d[2];d[0]<0?(o.cV(p[0],p[0],[d[0]*m,0,0]),o.cV(p[3],p[3],[d[0]*m,0,0])):d[0]>0&&(o.cV(p[1],p[1],[d[0]*m,0,0]),o.cV(p[2],p[2],[d[0]*m,0,0])),d[1]<0?(o.cV(p[0],p[0],[0,d[1]*m,0]),o.cV(p[1],p[1],[0,d[1]*m,0])
15):d[1]>0&&(o.cV(p[2],p[2],[0,d[1]*m,0]),o.cV(p[3],p[3],[0,d[1]*m,0]));const y={};return y.vertices=p,y.planes=[Ws(p[1],p[0],p[4]),Ws(p[2],p[1],p[5]),Ws(p[3],p[2],p[6]),Ws(p[0],p[3],p[7])],y}addShadowReceiver(t,n,c){this._receivers.add(t,o.cW.fromTileIdAndHeight(t,n,c))}getMaxCascadeForTile(t){const n=this._receivers.get(t);return n&&n.lastCascade?n.lastCascade:0}}function Ws(l,t,n){const c=o.at([],n,t),d=o.at([],l,t),p=o.bF([],c,d),m=o.ae(p);return m===0?[0,0,1,0]:(o.bY(p,p,1/m),[p[0],p[1],p[2],-o.bG(p,t)])}function pa(l){const t=l.properties.get("direction"),n=o.cR(t.x,t.y,t.z);n[2]=o.ay(n[2],0,75);const c=o.cT([n[0],n[1],n[2]]);return o.cS(c.x,c.y,c.z)}function Po(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"),y=[m.x,m.y,m.z],x=n.properties.get("color-use-theme")==="none",T=n.properties.get("color"),S=n.properties.get("intensity"),M=Math.max(o.bG([0,0,1],y),0),I=[0,0,0];o.bY(I,T.toPremultipliedRenderColor(x?null:l.getLut(t.scope)).toArray01Linear().slice(0,3),S);const C=[0,0,0];return o.bY(C,d.toPremultipliedRenderColor(c?null:l.getLut(n.scope)).toArray01Linear().slice(0,3),M*p),o.cY([I[0]>0?I[0]/(I[0]+C[0]):0,I[1]>0?I[1]/(I[1]+C[1]):0,I[2]>0?I[2]/(I[2]+C[2]):0])}function fa(l,t,n,c,d,p){const m=l.zoom,y=l.scale,x=l.worldSize,T=1/x,S=l.aspect,M=Math.sqrt(1+S*S)*Math.tan(.5*l.fovX),I=M*M,C=c-n,L=c+n;let R,F;I>C/L?(R=c,F=c*M):(R=.5*L*(1+I),F=.5*Math.sqrt(C*C+2*(c*c+n*n)*I+L*L*I*I));const B=l.projection.pixelsPerMeter(l.center.lat,x),V=l._camera.getCameraToWorldMercator(),Z=[0,0,-R*T];o.ad(Z,Z,V);let Y=F*T;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 De=l._camera.getWorldToCamera(l.worldSize,l.projection.zAxisUnit==="meters"?B:1),qe=l._camera.getCameraToClipPerspective(l._fov,l.width/l.height,n,c);qe[8]=2*-l.centerOffset.x/l.width,qe[9]=2*l.centerOffset.y/l.height;const Ce=new Float64Array(16);o.cB(Ce,qe,De);const je=new Float64Array(16);o.bi(je,Ce);const it=o.cn.fromInvProjectionMatrix(je,x,m,!0);for(const rt of it.points){const Qe=((ee=rt)[0]/=y,ee[1]/=y,ee[2]=o.c6(ee[2],l._center.lat),ee);Y=Math.max(Y,o.bZ(o.cX([],Z,Qe)))}}var ee;Y*=d/(d-1);const J=Math.acos(t[2]),K=Math.atan2(-t[0],-t[1]),ie=new Bn;ie.position=Z,ie.setPitchBearing(J,K);const ne=ie.getWorldToCamera(x,B),fe=Y*x,me=Math.min(l._mercatorZfromZoom(17)*x*-2,-2*fe),Ae=ie.getCameraToClipOrthographic(-fe,fe,-fe,fe,me,(fe+p*B)/t[2]),Me=new Float64Array(16);o.az(Me,Ae,ne);const Fe=o.cS(Math.floor(1e6*Z[0])/1e6*x,Math.floor(1e6*Z[1])/1e6*x,0),de=.5*d,we=[0,0,0];o.ad(we,Fe,Me),o.bY(we,we,de);const le=[Math.floor(we[0]),Math.floor(we[1]),Math.floor(we[2])],Pe=[0,0,0];o.at(Pe,we,le),o.bY(Pe,Pe,-1/de);const ye=new Float64Array(16);return o.bx(ye),o.bo(ye,ye,Pe),o.az(Me,ye,Me),[Me,fe]}class bd extends o.E{constructor(t){super(),this.requestManager=t,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(t,n){return o.aS(this.requestManager.transformRequest(n,o.R.Model).url).then(c=>{if(!c)return;const d=o.aT(c),p=new o.aU(t,void 0,void 0,d);return p.computeBoundsAndApplyParent(),p}).catch(c=>{if(c&&c.status===404)return null;this.fire(new o.z(new Error(`Could not load model ${t} from ${n}: ${c.message}`)))})}load(t,n,c={forceReload:!1}){this.models[n]||(this.models[n]={});const d=Object.keys(t),p=[],m=[];for(const y of d){const x=t[y];this.hasURLBeenRequested(x)&&!c.forceReload||(this.modelByURL[x]={modelId:y,scope:n},p.push(this.loadModel(y,x)),m.push(y)),this.models[n][y]||(this.models[n][y]={model:null,numReferences:1})}this.numModelsLoading[n]=(this.numModelsLoading[n]||0)+m.length,Promise.allSettled(p).then(y=>{for(let x=0;x<y.length;x++){const{status:T}=y[x];if(T==="rejected")continue;const{value:S}=y[x];this.models[n][m[x]]||(this.models[n][m[x]]={model:null,numReferences:1}),this.models[n][m[x]].model=S}this.numModelsLoading[n]-=m.length,this.fire(new o.A("data",{dataType:"style"}))}).catch(y=>{this.fire(new o.z(new Error(`Could not load models: ${y.message}`)))})}isLoaded(){for(const t in this.numModelsLoading)if(this.numModelsLoading[t]>0)return!1;return!0}hasModel(t,n,c={exactIdMatch:!1}){return!!(c.exactIdMatch?this.getModel(t,n):this.getModelByURL(this.modelUris[n][t]))}getModel(t,n){return this.models[n]||(this.models[n]={}),this.models[n][t]?this.models[n][t].model:void 0}getModelByURL(t){if(!t)return null;const n=this.modelByURL[t];return n?this.models[n.scope][n.modelId].model:null}hasModelBeenAdded(t,n){return this.models[n]&&this.models[n][t]!==void 0}getModelURIs(t){return this.modelUris[t]||{}}addModel(t,n,c){this.models[c]||(this.models[c]={}),this.modelUris[c]||(this.modelUris[c]={});const d=this.requestManager.normalizeModelURL(n);if((this.hasModel(t,c,{exactIdMatch:!0})||this.hasModelBeenAdded(t,c))&&this.modelUris[c][t]===d)this.models[c][t].numReferences++;else if(this.hasURLBeenRequested(d)){const{scope: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])}
15reloadModels(t){this.load(this.modelUris[t],t,{forceReload:!0})}addModelsFromBucket(t,n){this.models[n]||(this.models[n]={}),this.modelUris[n]||(this.modelUris[n]={});const c={};for(const d of t)this.hasModel(d,n,{exactIdMatch:!0})||this.hasURLBeenRequested(d)?this.models[n][d].numReferences++:this.modelUris[n][d]&&!this.hasURLBeenRequested(d)?c[d]=this.modelUris[n][d]:!this.hasURLBeenRequested(d)&&o.cZ(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){if(this.models[n]&&this.models[n][t]&&(this.models[n][t].numReferences--,this.models[n][t].numReferences===0)){const d=this.modelUris[n][t];c||delete this.modelUris[n][t],delete this.modelByURL[d];const p=this.models[n][t].model;if(!p)return;delete this.models[n][t],p.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 vc=new o.a7({data:new o.a8(o.a5.colorTheme.data)}),ku={"mbx-indoor-active-floorplans":{default:["literal",[]]},"mbx-indoor-underground":{default:["literal",!1]},"mbx-indoor-loaded-levels":{default:["literal",[]]},"mbx-indoor-level-height":{default:["literal",{}]},"mbx-indoor-level-base":{default:["literal",{}]},"mbx-indoor-level-selected":{default:["literal",{}]},"mbx-indoor-level-overlapped":{default:["literal",{}]}};function Ts(l){return l=l||{},Object.assign(l,ku)}class Tf extends o.E{constructor(t){super(),this.mergeFloors=!0,this._scope=void 0,this._queryFeatureSetId=void 0,this._buildingEntryFeatureSetId=void 0,this._selectedFloorplan=void 0,this._indoorData=void 0,this._floorplanStates={},o.aV(["_onLoad","_onMove","_checkFloorplanVisible"],this),this._map=t,this._checkFloorplanVisible(),this._map.on("load",this._onLoad),this._map.on("move",this._onMove)}destroy(){this._map.indoor.off("load",this._onLoad),this._map.indoor.off("move",this._onMove),this._map=void 0}_onLoad(){this._map.style.forEachFragmentStyle(t=>{t.stylesheet.indoor&&(this._queryFeatureSetId?this.fire(new o.z(new Error("Multiple indoor map styles detected, simultaneous usage is not allowed currently."))):(this._queryFeatureSetId=t.stylesheet.indoor.floorplanFeaturesetId,this._buildingEntryFeatureSetId=t.stylesheet.indoor.buildingFeaturesetId,this._scope=t.scope))}),this._queryFeatureSetId&&this._buildingEntryFeatureSetId&&this._map.addInteraction("mbx-indoor-buildingclick",{type:"click",target:{featuresetId:this._buildingEntryFeatureSetId,importId:this._scope},handler:t=>(t.feature&&t.feature.properties.floorplan&&this.selectFloorplan(t.feature.properties.floorplan),!0)}),this._checkFloorplanVisible()}_onMove(){this._checkFloorplanVisible()}_checkFloorplanVisible(){if(!this._queryFeatureSetId||!this._map.isStyleLoaded())return;const t=()=>{this._indoorData=void 0,this._selectedFloorplan=void 0,this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!1),this._map.setConfigProperty(this._scope,"mbx-indoor-active-floorplans",["literal",[]]),this.fire(new o.A("floorplangone"))};if(this._map.transform.zoom<13)return void t();const n={target:{featuresetId:this._queryFeatureSetId,importId:this._scope}},c=this._map.transform.width,d=this._map.transform.height,p=c*(2/3),m=d*(2/3),y=.5*(c-p),x=.5*(d-m),T=[new o.P(y,x),new o.P(y+p,x+m)],S=this._map.queryRenderedFeatures(T,n);S.length>0?this._selectedFloorplan&&S[0].properties.id===this._selectedFloorplan.properties.id||(this._selectedFloorplan=S[0],this._floorplanSelected()):t()}_floorplanSelected(){this._indoorData=JSON.parse(this._selectedFloorplan.properties["indoor-data"]),this._indoorData.id=this._selectedFloorplan.properties.id,this._floorplanStates[this._indo
15orData.id]=this._floorplanStates[this._indoorData.id]||{},this._map.setConfigProperty(this._scope,"mbx-indoor-active-floorplans",["literal",[this._indoorData.id]]);const t=this._floorplanStates[this._indoorData.id].selectedBuilding,n=t?this._indoorData.buildings.find(y=>y.id===t):this._indoorData.buildings.length>0?this._indoorData.buildings[0]:null,c=this._floorplanStates[this._indoorData.id].selectedLevel,d=this._indoorData.levels.find(y=>y.id===c),p=this._indoorData.levels.find(y=>!(!n||!n.levels)&&Number(y.levelOrder)===0&&n.levels.includes(y.id)),m=d?d.id:p?p.id:void 0;this.fire(new o.A("floorplanselected",{buildings:this._indoorData.buildings,levels:this._indoorData.levels,selectedLevelId:m})),n&&this._buildingSelected(n,!1),m&&this._levelSelected(m)}_buildingSelected(t,n){if(!t||!t.id)return void console.warn("IndoorManager: Building or building id is undefined");n&&t.extent&&this._map.fitBounds(t.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}),this._floorplanStates[this._indoorData.id].selectedBuilding=t?t.id:void 0;const c=this._indoorData.levels.filter(d=>t.levels.includes(d.id));this.fire(new o.A("buildingselected",{buildingId:t.id,levels:c}))}_levelSelected(t){const n=this._indoorData.levels.find(c=>c.id===t);n?(this._updateLevels(n,!0),this.fire(new o.A("levelselected",{levelId:n.id}))):console.warn(`IndoorManager: Level with ID ${t} not found in the current floorplan.`)}_updateLevels(t,n){if(!t||!t.id)throw new Error("IndoorManager: Selected level or level ID is undefined");function c(T){const S=T.indexOf("/floor/");if(S===-1)return T;const M=S+7,I=T.indexOf("/",M);return I===-1?T.slice(M):T.slice(M,I)}this._floorplanStates[this._indoorData.id].selectedLevel=t.id;const d=[],p={},m={},y={},x={};for(const T of this._indoorData.levels){if(d.push(T.id),p[T.id]=T.levelOrder>=0?3*Math.abs(T.levelOrder+1):3*Math.abs(T.levelOrder),m[T.id]=T.levelOrder>=0?3*T.levelOrder:0,this.mergeFloors){const S=c(t.id),M=c(T.id);y[T.id]=M===S?"true":"false"}else y[T.id]=T.id===t.id?"true":"false";x[T.id]=T.levelOrder<t.levelOrder?"true":"false"}this._map.setConfigProperty(this._scope,"mbx-indoor-loaded-levels",["literal",d]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-height",["literal",p]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-base",["literal",m]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-selected",["literal",y]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-overlapped",["literal",x]),this._map.setConfigProperty(this._scope,"mbx-indoor-underground",t.levelOrder<0)}selectFloorplan(t){const n={target:{featuresetId:this._queryFeatureSetId,importId:this._scope}},c=[new o.P(0,0),new o.P(this._map.transform.width,this._map.transform.height)],d=this._map.queryRenderedFeatures(c,n);if(d.length>0){for(const p of d)if(JSON.parse(p.properties["indoor-data"]).id===t){this._selectedFloorplan=p,this._floorplanSelected();break}}}selectBuilding(t){const n=this._indoorData.buildings.find(c=>c.id===t);this._buildingSelected(n,!0)}selectLevel(t){this._levelSelected(t)}}function Sf(l){if(!l.metadata||!l.metadata.content_area)return;const t=o.q.devicePixelRatio,{left:n,top:c,width:d,height:p}=l.metadata.content_area,m=n*t,y=c*t;return[m,y,m+d*t,y+p*t]}function wd(l){if(l)return l.map(([t,n])=>[t*o.q.devicePixelRatio,n*o.q.devicePixelRatio])}class Td{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 qs))return t;const d=n.map(m=>this.sourceCache.getTile(m)),p=c.getImages(d,Array.from(this.pendingRequests));for(const[m,y]of p)t.set(o.I.from({name:m,iconsetId:this.id}),y),this.pendingRequests.delete(m);for(const m of this.pendingRequests)this.missingRequests.add(m);return this.pendingRequests.clear(),t}}const zo=(l,t)=>Q(l,t&&t.filter(n=>n.identifier!=="source.canvas")),Ou=o.aF(ti,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),Sd=o.aF(ti,["setCenter","setZoom","setBearing","setP
15itch"]),bc=new Set(["background","sky","slot","custom"]),Bu={version:8,layers:[],sources:{}},Nu={duration:300,delay:0};class Wr extends o.E{constructor(t,n={}){super(),this.map=t,this.scope=n.scope||"",this.globalId=null,this.fragments=[],this.importDepth=n.importDepth||0,this.importsCache=n.importsCache||new Map,this.resolvedImports=n.resolvedImports||new Set,this.transition=o.h({},Nu),this._buildingIndex=new gd(this),this.crossTileSymbolIndex=new dn,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=n.styleChanges||new gr,this.dispatcher=n.dispatcher?n.dispatcher:new o.D(o.c$(),this),n.imageManager?this.imageManager=n.imageManager:(this.imageManager=new Os(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=n.glyphManager?n.glyphManager:new o.d0(t._requestManager,n.localFontFamily?o.d1.all:n.localIdeographFontFamily?o.d1.ideographs:o.d1.none,n.localFontFamily||n.localIdeographFontFamily),n.modelManager?this.modelManager=n.modelManager:(this.modelManager=new bd(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={},this._order=[],this._markersNeedUpdate=!1,this.options=n.configOptions?n.configOptions:new Map,this._configDependentLayers=n.configDependentLayers?n.configDependentLayers:new Set,this._config=n.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:n.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=n.initialConfig,this.dispatcher.broadcast("setReferrer",o.d2());const c=this;this._rtlTextPluginCallback=Wr.registerForPluginStateChange(d=>{c.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(p,m)=>{if(o.d3(p),m&&m.every(y=>y))for(const y in c._sourceCaches){const x=c._sourceCaches[y],T=x.getSource().type;T!=="vector"&&T!=="geojson"||x.reload()}})}),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const p=this.getOwnSource(d.sourceId);if(p&&p.vectorLayerIds)for(const m in this._layers){const y=this._layers[m];y.source===p.id&&this._validateLayer(y)}})}load(t){return t?(typeof t=="string"?this.loadURL(t):this.loadJSON(t),this):this}_getGlobalId(t){if(!t)return null;if(typeof t=="string"){if(o.j(t))return t;const n=o.d4(t);if(!n.startsWith("http"))try{return new URL(n,location.href).toString()}catch{return n}return n}return`json://${o.d5(JSON.stringify(t))}`}_diffStyle(t,n,c){this.globalId=this._getGlobalId(t);const d=(p,m)=>{try{m(null,this.setState(p,c))}catch(y){m(y,!1)}};if(typeof t=="string"){const p=this.map._requestManager.normalizeStyleURL(t),m=this.map._requestManager.transformRequest(p,o.R.Style);o.n(m,(y,x)=>{y?this.fire(new o.z(y)):x&&d(x,n)})}else typeof t=="object"&&d(t,n)}loadURL(t,n={}){this.fire(new o.A("dataloading",{dataType:"style"}));const c=typeof n.validate=="boolean"?n.validate:!o.j(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,n.accessToken),this.resolvedImports.add(t);const d=this.importsCache.get(t);if(d)return this._load(d,c);const p=this.map._requestManager.transformRequest(t,o.R.Style);this._request=o.n(p,(m,y)=>{if(this._request=null,m)this.fire(new o.z(m));else if(y)return this.importsCache.set(t,y),this._load(y,c)})}loadJSON(t,n={}){this.fire(new o.A("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=o.q.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new o.A("dataloading",{dataType:"style"})),this._load(Bu,!1)}_loadImports(t,n,c){if(this.importDepth>=4)return o.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const d=[];for(const p of t){const m=this._createFragmentStyle(p),y=new Promise(S=>{m.once("style.import.load",S),m.once("error",S)}).then(()=>this.mergeAll());if(d.push(y),this.resolvedImports.has(p.url)){m.loadEmpty();continue}const x=p.data||this.importsCache.get(p.url);x?(m.loadJSON(x,{validate:n}),this._isInternalStyle(x)&&(m.globalId=null)):p.url?m.loadURL(p.url,{validate:n}):m.loadEmpty();const T={style:m,id:p.id,config:p.config};if(c){const S=this.fragments.findIndex(({id:M})=>M===c);
15this.fragments=this.fragments.slice(0,S).concat(T).concat(this.fragments.slice(S))}else this.fragments.push(T)}return Promise.allSettled(d)}getImportGlobalIds(t=this,n=new Set){for(const c of t.fragments)c.style.globalId&&n.add(c.style.globalId),this.getImportGlobalIds(c.style,n);return[...n.values()]}_createFragmentStyle(t){const n=this.scope?o.C(t.id,this.scope):t.id;let c;const d=this._initialConfig&&this._initialConfig[n];(t.config||d)&&(c=o.h({},t.config,d));const p=new Wr(this.map,{scope:n,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:c,configOptions:this.options,colorThemeOverride:t["color-theme"],configDependentLayers:this._configDependentLayers});return p.setEventedParent(this.map,{style:p}),p}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(t){return this.isRootStyle()&&(t.fragment||!!t.schema&&t.fragment!==!1)}_load(t,n){const c=t.indoor?Ts(t.schema):t.schema;if(this._isInternalStyle(t)){const m=o.h({},Bu,{imports:[{id:"basemap",data:t,url:""}]});return void this._load(m,n)}if(this.updateConfig(this._config,c),n&&zo(this,yn(t)))return;this._loaded=!0,this.stylesheet=o.d6(t);const d=()=>{for(const T in t.sources)this.addSource(T,t.sources[T],{validate:!1,isInitialLoad:!0});if(t.iconsets)for(const T in t.iconsets)this.addIconset(T,t.iconsets[T]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.setGlyphsUrl(t.glyphs);const m=ol(this.stylesheet.layers);if(this._order=m.map(T=>T.id),this.stylesheet.light&&o.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const T=this.stylesheet.lights[0];this.light=new _e(T.properties,T.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new _e(this.stylesheet.light)),this._layers={};for(const T of m){const S=o.db(T,this.scope,this._styleColorTheme.lut,this.options);S.configDependencies.size!==0&&this._configDependentLayers.add(S.fqid),S.setEventedParent(this,{layer:{id:S.id}}),this._layers[S.id]=S;const M=this.getOwnLayerSourceCache(S),I=!!this.directionalLight&&this.directionalLight.shadowsEnabled();M&&S.canCastShadows()&&I&&(M.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const y=this.stylesheet.terrain;y&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(y,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new o.A("data",{dataType:"style"}));const x=this.isRootStyle();t.imports?this._loadImports(t.imports,n).then(()=>{this._reloadImports(),this.fire(new o.A(x?"style.load":"style.import.load"))}).catch(T=>{this.fire(new o.z(new Error("Failed to load imports",T))),this.fire(new o.A(x?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new o.A(x?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const p=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(p){const m=this._evaluateColorThemeData(p);this._loadColorTheme(m).then(()=>{d()}).catch(y=>{o.w(`Couldn't load color theme from the stylesheet: ${y}`),d()})}else this._styleColorTheme.lut=null,d()}isRootStyle(){return this.importDepth===0}mergeAll(){let t,n,c,d,p,m,y,x,T,S;const M={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(I=>{if(I.stylesheet){if(I.light!=null&&(t=I.light),I.stylesheet.lights)for(const C of I.stylesheet.lights)C.type==="ambient"&&I.ambientLight!=null&&(n=I.ambientLight),C.type==="directional"&&I.directionalLight!=null&&(c=I.directionalLight);d=this._prioritizeTerrain(d,I.terrain,I.stylesheet.terrain),I.stylesheet.fog&&I.fog!=null&&(p=I.fog),I.stylesheet.snow&&I.snow!=null&&(m=I.snow),I.stylesheet.rain&&I.rain!=null&&(y=I.rain),I.stylesheet.camera!=null&&(S=I.stylesheet.camera),I.stylesheet.projection!=null&&(x=I.stylesheet.projection),I.stylesheet.transition!=null&&(T=I.stylesheet.transition),M[I.scope]=I._styleColorTheme}}),this.light=t,this.ambientLight=n,this.directionalLight=c,this.fog=p,this.snow=m,this.rain=y,this._styleColorThemeForScope=M,d===null?delete this.terrain:this.terrain=d,this.camera=S||{"camera-projection":"perspective"},this.projection=x||{name:"mercator"},this.transition=o.h({},Nu,T),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(t){const n=c=>{for(const d of c.fragments)n(d.style);t(c)};n(this)}_prioritizeTerrain(t,n,c){const d=t&&t.drapeRenderMode===0;return c===null?n&&n.drapeRenderMode===0?n:d?t:null:n!=null&&(!t||d||n&&n.drapeRenderMode===1)?n:t}mergeTerrain(){let t;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(n=>{t=this._prioritizeTerrain(t,n.terrain,n.stylesheet.terrain)}),t===null?delete this.terrain:this.terrain=t}mergeProjection(){let t;this.forEachFragmentStyle(n=>{n.stylesheet.projection!=null&&(t=n.stylesheet.projection)}),this.projection=t||{name:"mercator"}}mergeSources(){const t={},n={},c={};this.forEachFragmentStyle(d=>{for(const p in d._sourceCaches){const m=o.C(p,d.scope);t[m]=d._sourceCaches[p]}for(const p in d._otherSourceCaches){const m=o.C(p,d.scope);n[m]=d._otherSourceCaches[p]}for(const p in d._symbolSourceCaches){const m=o.C(p,d.scope);c[m]=d._symbolSourceCaches[p]}}),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=n,this._mergedSymbolSourceCaches=c}mergeLayers(){const t={},n=[],c={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(p=>{for(const m of p._order){const y=p._layers[m];if(y.type==="slot"){const x=o.d7(m);if(t[x])continue;t[x]=[]}y.slot&&t[y.slot]?t[y.slot].push(y):n.push(y)}}),this._mergedOrder=[];const d=(p=[])=>{for(const m of p)if(m.type==="slot"){const y=o.d7(m.id);t[y]&&d(t[y]),this._mergedSlots.push(y)}else{const y=o.C(m.id,m.scope);this._mergedOrder.push(y),c[y]=m,m.is3D(!!this.terrain)&&(this._has3DLayers=!0),m.type==="circle"&&(this._hasCircleLayers=!0),m.type==="symbol"&&(this._hasSymbolLayers=!0),m.type==="clip"&&(this._clipLayerPresent=!0)}};d(n),this._mergedOrder.sort((p,m)=>{const y=c[p],x=c[m];return y.hasInitialOcclusionOpacityProperties?x.is3D(!!this.terrain)?1:0:y.is3D(!!this.terrain)&&x.hasInitialOcclusionOpacityProperties?-1:0}),this._mergedLayers=c,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=o.h({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?function(n,c,d,p){const m=o.h({},c);for(const x of Object.keys(o.a5.colorTheme))m[x]===void 0&&(m[x]=o.a5.colorTheme[x].default);const y=new o.a6(vc,n,new Map(d));return y.setTransitionOrValue(m,d),y.untransitioned().possiblyEvaluate(new o.aa(0,{worldview:void 0}))}(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const n=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((c,d)=>{const p="data:image/png;base64,";if(!t||t.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void c();let m=t;m.startsWith(p)||(m=p+m);const y=o.I.from("mapbox-reserved-lut"),x=new Image;x.src=m,x.onerror=()=>{this._styleColorTheme.lutLoading=!1,d(new Error("Failed to load image data"))},x.onload=()=>
15{if(this._styleColorTheme.lutLoadingCorrelationID!==n)return void c();this._styleColorTheme.lutLoading=!1;const{width:T,height:S,data:M}=o.q.getImageData(x);if(S>32)return void d(new Error("The height of the image must be less than or equal to 32 pixels."));if(T!==S*S)return void d(new Error("The width of the image must be equal to the height squared."));this.getImage(y)&&this.removeImage(y),this.addImage(y,{data:new o.r({width:T,height:S},M),pixelRatio:1,sdf:!1,usvg:!1,version:0});const I=this.imageManager.getImage(y,this.scope);I?(this._styleColorTheme.lut={image:I.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,y;const x=o.q.devicePixelRatio>1?"@2x":"";let T=o.n(c.transformRequest(c.normalizeSpriteURL(n,x,".json"),o.R.SpriteJSON),(I,C)=>{T=null,y||(y=I,p=C,M())}),S=o.o(c.transformRequest(c.normalizeSpriteURL(n,x,".png"),o.R.SpriteImage),(I,C)=>{S=null,y||(y=I,m=C,M())});function M(){if(y)d(y);else if(p&&m){const I=o.q.getImageData(m),C={};for(const L in p){const{width:R,height:F,x:B,y:V,sdf:Z,pixelRatio:Y,stretchX:te,stretchY:ee,content:J}=p[L],K=new o.r({width:R,height:F});o.r.copy(I,K,{x:B,y:V},{x:0,y:0},{width:R,height:F},null),C[L]={data:K,pixelRatio:Y,sdf:Z,stretchX:te,stretchY:ee,content:J,usvg:!1}}d(null,C)}}return{cancel(){T&&(T.cancel(),T=null),S&&(S.cancel(),S=null)}}}(t,this.map._requestManager,(n,c)=>{if(this._spriteRequest=null,n)this.fire(new o.z(n));else if(c){const d=new Map;for(const p in c)d.set(o.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 o.A("data",{dataType:"style"}))})}addIconset(t,n){if(n.type==="sprite")return void this._loadSprite(n.url);const c=this.getOwnSourceCache(n.source);if(!c)return void this.fire(new o.z(new Error(`Source "${n.source}" as specified by iconset "${t}" does not exist and cannot be used as an iconset source`)));const d=c.getSource();if(d.type!=="raster-array")return void this.fire(new o.z(new Error(`Source "${n.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));d.partial=!1;const p=new Td(t,this.scope,c);this.imageManager.addImageProvider(p,this.scope)}removeIconset(t){this.imageManager.removeImageProvider(t,this.scope)}_loadIconset(t){if(!o.j(t)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(t);const n=this.map._spriteFormat==="auto";var c,d;this._spriteRequest=(d=(p,m)=>{if(this._spriteRequest=null,p)n?this._loadSprite(t):this.fire(new o.z(p));else if(m){const y=new Map;for(const x in m)y.set(o.I.from(x),m[x]);this.addImages(y)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new o.A("data",{dataType:"style"}))},o.br((c=this.map._requestManager).transformRequest(c.normalizeIconsetURL(t),o.R.Iconset),(p,m)=>{if(p)return void d(p);const y={},x=o.c_(new o.bq(m));for(const T of x.icons){const S={version:1,pixelRatio:o.q.devicePixelRatio,content:Sf(T),stretchX:T.metadata?wd(T.metadata.stretch_x_areas):void 0,stretchY:T.metadata?wd(T.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:T};y[T.name]=S}d(null,y)}))}_validateLayer(t){const n=this.getOwnSource(t.source);if(!n)return;const c=t.sourceLayer;c&&(n.type==="geojson"||n.vectorLayerIds&&n.vectorLayerIds.indexOf(c)===-1)&&this.fire(new o.z(ne
15w Error(`Source layer "${c}" does not exist on source "${n.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:t}of this.fragments)if(!t.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((t,n)=>{const c=this.fragments[n];return c&&c.style&&(t.data=c.style.serialize()),t})}_serializeSources(){const t={};for(const n in this._sourceCaches){const c=this._sourceCaches[n].getSource();t[c.id]||(t[c.id]=c.serialize())}return t}_serializeLayers(t){const n=[];for(const c of t){const d=this._layers[c];d&&d.type!=="custom"&&n.push(d.serialize())}return n}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(const t in this._sourceCaches)if(this._sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(t){return t?this.order:this._mergedOrder}isLayerDraped(t){return!!this.terrain&&t.isDraped(this.getLayerSourceCache(t))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const n=this.getOwnLayer(t);if(n)return n;this.fire(new o.z(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const n=this.getOwnSource(t);if(n)return n;this.fire(new o.z(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(t,n){const c=this.map.painter;if(c)for(let d=t.minzoom||0;d<(t.maxzoom||25.5);d++){const p=t.getProgramIds();if(p)for(const m of p){const y=t.getDefaultProgramParams(m,n.zoom,this._styleColorTheme.lut);y&&(c.style=this,this.fog&&(c._fogVisible=!0,y.overrideFog=!0,c.getOrCreateProgram(m,y)),c._fogVisible=!1,y.overrideFog=!1,c.getOrCreateProgram(m,y),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(y.overrideRtt=!0,c.getOrCreateProgram(m,y)))}}}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const n=this.calculateLightsBrightness();t.brightness=n||0,n!==this._brightness&&(this._brightness=n,this.dispatcher.broadcast("setBrightness",n)),t.worldview!==this._worldview&&(this._worldview=t.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const c=this._changes.isDirty();let d=!1;if(this._changes.isDirty()){const y=this._changes.getLayerUpdatesByScope();for(const x in y){const{updatedIds:T,removedIds:S}=y[x];(T||S)&&(this._updateWorkerLayers(x,T,S),d=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this.snow&&this.snow.updateTransitions(t),this.rain&&this.rain.updateTransitions(t),this._changes.reset()}const p={};for(const y in this._mergedSourceCaches){const x=this._mergedSourceCaches[y];p[y]=x.used,x.used=!1,x.tileCoverLift=0}for(const y of this._mergedOrder){const x=this._mergedLayers[y];if(x.recalculate(t,this._availableImages),!x.isHidden(t.zoom)){const T=this.getLayerSourceCache(x);T&&(T.used=!0,T.tileCoverLift=Math.max(T.tileCoverLift,x.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>
15{this.precompilePrograms(x,t)}):this.precompilePrograms(x,t))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&d&&this.mergeLayers();const m=this.imageManager.getPendingImageProviders();for(const y of m)y.sourceCache.used=!0;for(const y in p){const x=this._mergedSourceCaches[y];p[y]!==x.used&&x.getSource().fire(new o.A("data",{sourceDataType:"visibility",dataType:"source",sourceId:x.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.snow&&this.snow.recalculate(t),this.rain&&this.rain.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),c&&this.fire(new o.A("data",{dataType:"style"}))}updateImageProviders(){const t=this.imageManager.getPendingImageProviders();for(const n of t){const c=n.resolvePendingRequests(),d=this.getFragmentStyle(n.scope);d&&d.addImages(c)}}_updateTilesForChangedImages(){const t={};for(const n in this._mergedSourceCaches){const c=this._mergedSourceCaches[n].getSource().scope;t[c]=t[c]||this._changes.getUpdatedImages(c),t[c].length!==0&&this._mergedSourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t[c])}for(const n in t)this._changes.resetUpdatedImages(n)}_updateWorkerLayers(t,n,c){const d=this.getFragmentStyle(t);d&&this.dispatcher.broadcast("updateLayers",{layers:n?d._serializeLayers(n):[],scope:t,removedIds:c||[],options:d.options})}setState(t,n){if(this._checkLoaded(),zo(this,yn(t)))return!1;(t=o.d6(t)).layers=ol(t.layers);const c=function(m,y){if(!m)return[{command:ti.setStyle,args:[y]}];let x=[];try{if(!o.bv(m.version,y.version))return[{command:ti.setStyle,args:[y]}];if(o.bv(m.center,y.center)||x.push({command:ti.setCenter,args:[y.center]}),o.bv(m.zoom,y.zoom)||x.push({command:ti.setZoom,args:[y.zoom]}),o.bv(m.bearing,y.bearing)||x.push({command:ti.setBearing,args:[y.bearing]}),o.bv(m.pitch,y.pitch)||x.push({command:ti.setPitch,args:[y.pitch]}),o.bv(m.sprite,y.sprite)||x.push({command:ti.setSprite,args:[y.sprite]}),o.bv(m.glyphs,y.glyphs)||x.push({command:ti.setGlyphs,args:[y.glyphs]}),o.bv(m.imports,y.imports)||function(C=[],L=[],R){L=L||[];const F=(C=C||[]).map(To),B=L.map(To),V=C.reduce($s,{}),Z=L.reduce($s,{}),Y=F.slice();let te,ee,J,K;for(te=0,ee=0;te<F.length;te++)J=F[te],Z.hasOwnProperty(J)?ee++:(R.push({command:ti.removeImport,args:[J]}),Y.splice(Y.indexOf(J,ee),1));for(te=0,ee=0;te<B.length;te++)J=B[B.length-1-te],Y[Y.length-1-te]!==J&&(V.hasOwnProperty(J)?(R.push({command:ti.removeImport,args:[J]}),Y.splice(Y.lastIndexOf(J,Y.length-ee),1)):ee++,K=Y[Y.length-te],R.push({command:ti.addImport,args:[Z[J],K]}),Y.splice(Y.length-te,0,J));for(const ie of L){const ne=V[ie.id];ne&&(delete ne.data,o.bv(ne,ie)||R.push({command:ti.updateImport,args:[ie.id,ie]}))}}(m.imports,y.imports,x),o.bv(m.transition,y.transition)||x.push({command:ti.setTransition,args:[y.transition]}),o.bv(m.light,y.light)||x.push({command:ti.setLight,args:[y.light]}),o.bv(m.fog,y.fog)||x.push({command:ti.setFog,args:[y.fog]}),o.bv(m.snow,y.snow)||x.push({command:ti.setSnow,args:[y.snow]}),o.bv(m.rain,y.rain)||x.push({command:ti.setRain,args:[y.rain]}),o.bv(m.projection,y.projection)||x.push({command:ti.setProjection,args:[y.projection]}),o.bv(m.lights,y.lights)||x.push({command:ti.setLights,args:[y.lights]}),o.bv(m.camera,y.camera)||x.push({command:ti.setCamera,args:[y.camera]}),o.bv(m.iconsets,y.iconsets)||function(C,L,R){let F;for(F in L=L||{},C=C||{})C.hasOwnProperty(F)&&(L.hasOwnProperty(F)||R.push({command:ti.removeIconset,args:[F]}));for(F in L){if(!L.hasOwnProperty(F))continue;const B=L[F];C.hasOwnProperty(F)?o.bv(C[F],B)||(R.push({command:ti.removeIconset,args:[F]}),R.push({command:ti.addIconset,args:[F,B]})):R.push({command:ti.addIconset,args:[F,B]})}}(m.iconsets,y.iconsets,x),!o.bv(m["color-theme"],y["color-theme"]))return[{command:ti.setStyle,args:[y]}];const T={},S=[];(function(C,L,R,F){let B;for(B in L=L||{},C=C||{})C.hasOwnProperty(B)&&(L.hasOwnProperty(B)||aa(B,R,F));for(B in L){if(!L.hasOwnProperty(B))continue;const V=L[B];C.hasOwnProperty(B)?o.bv(C[B],V)||(C[B].type==="geojson"&&V.type==="geojson"&&yf(C,L,B)?R.push({command:ti.setGeoJSONSourceData,args:[B,V.data]}):al(B,L,R,F)):hc(B,L,R)}})(m.sources,y.sources,S,T);const M=[];
15m.layers&&m.layers.forEach(C=>{C.source&&T[C.source]?x.push({command:ti.removeLayer,args:[C.id]}):M.push(C)});let I=m.terrain;I&&T[I.source]&&(x.push({command:ti.setTerrain,args:[void 0]}),I=void 0),x=x.concat(S),o.bv(I,y.terrain)||x.push({command:ti.setTerrain,args:[y.terrain]}),function(C,L,R){L=L||[];const F=(C=C||[]).map(To),B=L.map(To),V=C.reduce($s,{}),Z=L.reduce($s,{}),Y=F.slice(),te=Object.create(null);let ee,J,K,ie,ne,fe,me;for(ee=0,J=0;ee<F.length;ee++)K=F[ee],Z.hasOwnProperty(K)?J++:(R.push({command:ti.removeLayer,args:[K]}),Y.splice(Y.indexOf(K,J),1));for(ee=0,J=0;ee<B.length;ee++)K=B[B.length-1-ee],Y[Y.length-1-ee]!==K&&(V.hasOwnProperty(K)?(R.push({command:ti.removeLayer,args:[K]}),Y.splice(Y.lastIndexOf(K,Y.length-J),1)):J++,fe=Y[Y.length-ee],R.push({command:ti.addLayer,args:[Z[K],fe]}),Y.splice(Y.length-ee,0,K),te[K]=!0);for(ee=0;ee<B.length;ee++)if(K=B[ee],ie=V[K],ne=Z[K],!te[K]&&!o.bv(ie,ne))if(o.bv(ie.source,ne.source)&&o.bv(ie["source-layer"],ne["source-layer"])&&o.bv(ie.type,ne.type)){for(me in ll(ie.layout,ne.layout,R,K,null,ti.setLayoutProperty),ll(ie.paint,ne.paint,R,K,null,ti.setPaintProperty),o.bv(ie.slot,ne.slot)||R.push({command:ti.setSlot,args:[K,ne.slot]}),o.bv(ie.filter,ne.filter)||R.push({command:ti.setFilter,args:[K,ne.filter]}),o.bv(ie.minzoom,ne.minzoom)&&o.bv(ie.maxzoom,ne.maxzoom)||R.push({command:ti.setLayerZoomRange,args:[K,ne.minzoom,ne.maxzoom]}),ie)ie.hasOwnProperty(me)&&me!=="layout"&&me!=="paint"&&me!=="filter"&&me!=="metadata"&&me!=="minzoom"&&me!=="maxzoom"&&me!=="slot"&&(me.indexOf("paint.")===0?ll(ie[me],ne[me],R,K,me.slice(6),ti.setPaintProperty):o.bv(ie[me],ne[me])||R.push({command:ti.setLayerProperty,args:[K,me,ne[me]]}));for(me in ne)ne.hasOwnProperty(me)&&!ie.hasOwnProperty(me)&&me!=="layout"&&me!=="paint"&&me!=="filter"&&me!=="metadata"&&me!=="minzoom"&&me!=="maxzoom"&&me!=="slot"&&(me.indexOf("paint.")===0?ll(ie[me],ne[me],R,K,me.slice(6),ti.setPaintProperty):o.bv(ie[me],ne[me])||R.push({command:ti.setLayerProperty,args:[K,me,ne[me]]}))}else R.push({command:ti.removeLayer,args:[K]}),fe=Y[Y.lastIndexOf(K)+1],R.push({command:ti.addLayer,args:[ne,fe]})}(M,y.layers,x)}catch(T){console.warn("Unable to compute style diff:",T),x=[{command:ti.setStyle,args:[y]}]}return x}(this.serialize(),t).filter(m=>!(m.command in Sd));if(c.length===0)return!1;const d=c.filter(m=>!(m.command in Ou));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){for(const[n,c]of t.entries()){if(this.getImage(n))return this.fire(new o.z(new Error(`An image with the name "${n.name}" already exists.`)));this.imageManager.addImage(n,this.scope,c),this._changes.updateImage(n,this.scope)}return this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"})),this}addImage(t,n){return this.getImage(t)?this.fire(new o.z(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,this.scope,n),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"})),this)}updateImage(t,n,c=!1){this.imageManager.updateImage(t,this.scope,n),c&&(this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"})))}getImage(t){return this.imageManager.getImage(t,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"}
vendor: 6,406 bytes, line 15
15)),this):this.fire(new o.z(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModelURLs(t){return this.modelManager.addModelURLs(t,this.scope),this._updateWorkerModels(),this.fire(new o.A("data",{dataType:"style"})),this}addModel(t,n,c={}){return this._checkLoaded(),this._validate(X,`models.${t}`,n,null,c)||(this.modelManager.addModel(t,n,this.scope),this.fire(new o.A("data",{dataType:"style"}))),this}hasModel(t){return this.modelManager.hasModel(t,this.scope)}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.scope),this.fire(new o.A("data",{dataType:"style"})),this):this.fire(new o.z(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(t,n,c={}){if(this._checkLoaded(),this.getOwnSource(t)!==void 0)throw new Error(`There is already a source with ID "${t}".`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(Eu,`sources.${t}`,n,null,c))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const d=el(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=>{const y=(m?"symbol:":"other:")+d.id,x=o.C(y,this.scope),T=this._sourceCaches[y]=new hn(x,d,m);(m?this._symbolSourceCaches:this._otherSourceCaches)[d.id]=T,T.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 o.z(new Error(`Source "${t}" cannot be removed while layer "${d}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new o.z(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const d=Object.entries(this.stylesheet.iconsets).find(([p,m])=>m.type==="source"&&m.source===t);if(d)return this.fire(new o.z(new Error(`Source "${t}" cannot be removed while iconset "${d[0]}" is using it.`)))}const c=this.getOwnSourceCaches(t);for(const d of c){const p=o.d7(d.id);delete this._sourceCaches[p],this._changes.discardSourceCacheUpdate(d.id),d.fire(new o.A("data",{sourceDataType:"metadata",dataType:"source",sourceId:d.getSource().id})),d.setEventedParent(null),d.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),n.setEventedParent(null),n.onRemove&&n.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(t,n){this._checkLoaded(),this.getOwnSource(t).setData(n),this._changes.setDirty()}getOwnSource(t){const n=this.getOwnSourceCache(t);return n&&n.getSource()}getOwnSources(){const t=[];for(const n in this._otherSourceCaches){const c=this.getOwnSourceCache(n);c&&t.push(c.getSource())}return t}areTilesLoaded(){const t=this._mergedSourceCaches;for(const n in t){const c=t[n]._tiles;for(const d in c){const 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(xo,"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 _i(p,kt||(kt=new o.a7({color:new o.a8(o.a5.properties_light_ambient.color),"color-use-theme":new o.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new o.a8(o.a5.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const m=this.directionalLight;m.set(p),m.updateTransitions(n)}else this.directionalLight=new _i(p,Ii||(Ii=new o.a7({direction:new o.an(o.a5.properties_light_directional.direction),color:new o.a8(o.a5.properties_light_directional.color),"color-use-theme":new o.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new o.a8(o.a5.properties_light_directional.intensity),"cast-shadows":new o.a8(o.a5.properties_light_directional["cast-shadows"]),"shadow-quality":new o.a8(o.a5.properties_light_directional["shadow-quality"]),"shadow-intensity":new o.a8(o.a5.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const c=Object.assign(n,{worldview:this.map.getWorldview()}),d=new o.aa(this.z||0,c);this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,n=this.ambientLight;if(!t||!n)return;const c=I=>.2126*(I[0]<=.03928?I[0]/12.92:Math.pow((I[0]+.055)/1.055,2.4))+.7152*(I[1]<=.03928?I[1]/12.92:Math.pow((I[1]+.055)/1.055,2.4))+.0722*(I[2]<=.03928?I[2]/12.92:Math.pow((I[2]+.055)/1.055,2.4)),d=t.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),p=t.properties.get("intensity"),m=t.properties.get("direction"),y=1-o.cR(m.x,m.y,m.z)[2]/90,x=c(d)*p*y,T=n.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),S=n.properties.get("intensity"),M=c(T)*S;return Number(((x+M)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const t=[];return this.directionalLight&&t.push(this.directionalLight.get()),this.ambientLight&&t.push(this.ambientLight.get()),t}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(t==null||t===""&&this.isRootStyle())return this;if(o.d8(t)){const n=o.d9(t),c=this.fragments.find(({id:p})=>p===n);if(!c)return;const d=o.d7(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]=[];
15for(const m of t[d].selectors){if(m.featureNamespace){const x=this.getOwnLayer(m.layer);if(!x){o.w(`Layer is undefined for selector: ${m.layer}`);continue}const T=c(x.source,x.sourceLayer);if(T in n&&n[T]!==m.featureNamespace){o.w(`"featureNamespace ${m.featureNamespace} of featureset ${d}'s selector is not associated to the same source, skip this selector`);continue}n[T]=m.featureNamespace}let y;if(m.properties)for(const x in m.properties){const T=o.X(m.properties[x]);T.result==="success"&&(y=y||{},y[x]=T.value)}p.push({layerId:m.layer,namespace:m.featureNamespace,properties:y,uniqueFeatureID:m._uniqueFeatureID})}}}getFeaturesetDescriptors(t){const n=this.getFragmentStyle(t);if(!n||!n.stylesheet.featuresets)return[];const c=[];for(const d in n.stylesheet.featuresets)c.push({featuresetId:d,importId:n.scope?n.scope:void 0});return c}getFeaturesetLayers(t,n){const c=this.getFragmentStyle(n),d=c.stylesheet.featuresets;if(!d||!d[t])return this.fire(new o.z(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const p=[];for(const m of d[t].selectors){const y=c.getOwnLayer(m.layer);y&&p.push(y)}return p}getConfigProperty(t,n){const c=this.getFragmentStyle(t);if(!c)return null;const d=o.C(n,c.scope),p=c.options.get(d),m=p?p.value||p.default:null;return m?m.serialize():null}setConfigProperty(t,n,c){const d=this.getFragmentStyle(t);if(!d)return;const p=d.stylesheet.indoor?Ts(d.stylesheet.schema):d.stylesheet.schema;if(!p||!p[n])return;const m=o.X(c);if(m.result!=="success")return void zo(this,m.value);const y=m.value.expression,x=o.C(n,d.scope),T=d.options.get(x);if(!T)return;let S;const{minValue:M,maxValue:I,stepValue:C,type:L,values:R}=p[n],F=o.X(p[n].default);F.result==="success"&&(S=F.value.expression),S?(this.options.set(x,Object.assign({},T,{value:y,default:S,minValue:M,maxValue:I,stepValue:C,type:L,values:R})),this.updateConfigDependencies(n)):this.fire(new o.z(new Error(`No schema defined for the config option "${n}" in the "${t}" fragment.`)))}getConfig(t){const n=this.getFragmentStyle(t);if(!n)return null;const c=n.stylesheet.schema;if(!c)return null;const d={};for(const p in c){const m=o.C(p,n.scope),y=n.options.get(m),x=y?y.value||y.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=o.X(n[c].default);if(m.result==="success"&&(d=m.value.expression),t&&t[c]!==void 0){const I=o.X(t[c]);I.result==="success"&&(p=I.value.expression)}const{minValue:y,maxValue:x,stepValue:T,type:S,values:M}=n[c];if(d){const I=o.C(c,this.scope);this.options.set(I,{default:d,value:p,minValue:y,maxValue:x,stepValue:T,type:S,values:M})}else this.fire(new o.z(new Error(`No schema defined for config option "${c}".`)))}else this.fire(new o.z(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(t){for(const n of this._configDependentLayers){const c=this.getLayer(n);if(c){if(t&&!c.configDependencies.has(t))continue;c.possiblyEvaluateVisibility(),this._updateLayer(c)}}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(n=>{const c=n._styleColorTheme.colorThemeOverride?n._styleColorTheme.colorThemeOverride:n._styleColorTheme.colorTheme;if(c){const d=n._evaluateColorThemeData(c);(!n._styleColorTheme.lut&&d!==""||n._styleColorTheme.lut&&d!==n._styleColorTheme.lut.data)&&n.setColorTheme(c)}}),this._changes.setDirty()}addLayer(t,n,c={}){this._checkLoaded();const d=t.id;if(this._layers[d])return void this.fire(new o.z(new Error(`Layer with i
15d "${d}" already exists on this map`)));let p;if(t.type==="custom"){if(zo(this,o.da(t)))return;p=o.db(t,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof t.source=="object"&&(this.addSource(d,t.source),t=o.d6(t),t=o.h(t,{source:d})),this._validate(ni,`layers.${d}`,t,{arrayIndex:-1},c))return;p=o.db(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(p),p.setEventedParent(this,{layer:{id:d}})}p.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid);let m=this._order.length;if(n){const S=this._order.indexOf(n);if(S===-1)return void this.fire(new o.z(new Error(`Layer with id "${n}" does not exist on this map.`)));p.slot===this._layers[n].slot?m=S:o.w(`Layer with id "${n}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(m,0,d),this._layerOrderChanged=!0,this._layers[d]=p;const y=this.getOwnLayerSourceCache(p),x=!!this.directionalLight&&this.directionalLight.shadowsEnabled();y&&p.canCastShadows()&&x&&(y.castsShadows=!0);const T=this._changes.getRemovedLayer(p);if(T&&p.source&&y&&p.type!=="custom"){this._changes.discardLayerRemoval(p);const S=o.C(p.source,p.scope);T.type!==p.type?this._changes.updateSourceCache(S,"clear"):(this._changes.updateSourceCache(S,"reload"),y.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);
15if(m===-1)return void this.fire(new o.z(new Error(`Layer with id "${n}" does not exist on this map.`)));c.slot===this._layers[n].slot?p=m:o.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._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&&!o.bv(d.filter,n))return n==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(xe,`layers.${d.id}.filter`,n,{layerType:d.type},c)||(d.filter=o.d6(n),this._updateLayer(d)))}getFilter(t){const n=this._checkLayer(t);if(n)return o.d6(n.filter)}setLayoutProperty(t,n,c,d={}){this._checkLoaded();const p=this._checkLayer(t);if(p&&!o.bv(p.getLayoutProperty(n),c)){if(c!=null&&(!d||d.validate!==!1)&&zo(p,U.call(yn,{key:`layers.${t}.layout.${n}`,layerType:p.type,objectKey:n,value:c,styleSpec:o.a5,style:{glyphs:!0,sprite:!0}})))return;p.setLayoutProperty(n,c),p.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid),this._updateLayer(p)}}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||o.bv(p.getPaintProperty(n),c)||c!=null&&(!d||d.validate!==!1)&&zo(p,O.call(yn,{key:`layers.${t}.paint.${n}`,layerType:p.type,objectKey:n,value:c,styleSpec:o.a5})))return;const m=p.setPaintProperty(n,c);p.configDependencies.size!==0&&this._configDependentLayers.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:T}=t.target,S=this.getFragmentStyle(T),M=S.getFeaturesetLayers(x);for(const{source:I,sourceLayer:C}of M)S.setFeatureState({id:t.id,source:I,sourceLayer:C},n)}else if("layerId"in t.target){const{layerId:x}=t.target,T=this.getLayer(x);this.setFeatureState({id:t.id,source:T.source,sourceLayer:T.sourceLayer},n)}return}const c=t.source,d=t.sourceLayer,p=this._checkSource(c);if(!p)return;const m=p.type;if(m==="geojson"&&d)return void this.fire(new o.z(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(m==="vector"&&!d)return void this.fire(new o.z(new Error("The sourceLayer parameter must be provided for vector source types.")));t.id===void 0&&this.fire(new o.z(new Error("The feature id parameter must be provided.")));const y=this.getOwnSourceCaches(c);for(const x of y)x.setFeatureState(d,t.id,n)}removeFeatureState(t,n){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:x,importId:T}=t.target,S=this.getFragmentStyle(T),M=S.getFeaturesetLayers(x);for(const{source:I,sourceLayer:C}of M)S.removeFeatureState({id:t.id,source:I,sourceLayer:C},n)}else if("layerId"in t.target){const{layerId:x}=t.target,T=this.getLayer(x);this.removeFeatureState({id:t.id,source:T.source,sourceLayer:T.sourceLayer},n)}return}const c=t.source,d=this._checkSource(c);if(!d)return;const p=d.type,m=p==="vector"?t.sourceLayer:void 0;
vendor: 4,419 bytes, line 15
15if(p==="vector"&&!m)return void this.fire(new o.z(new Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&typeof t.id!="string"&&typeof t.id!="number")return void this.fire(new o.z(new Error("A feature id is required to remove its specific state property.")));const y=this.getOwnSourceCaches(c);for(const x of y)x.removeFeatureState(m,t.id,n)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let p;if("featuresetId"in t.target){const{featuresetId:m,importId:y}=t.target,x=this.getFragmentStyle(y),T=x.getFeaturesetLayers(m);for(const{source:S,sourceLayer:M}of T){const I=x.getFeatureState({id:t.id,source:S,sourceLayer:M});if(I&&!p)p=I;else if(!o.bv(p,I))return void this.fire(new o.z(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in t.target){const{layerId:m}=t.target,y=this.getLayer(m);p=this.getFeatureState({id:t.id,source:y.source,sourceLayer:y.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 o.z(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(n)[0].getFeatureState(c,t.id);this.fire(new o.z(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=o.h({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return o.h({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),n=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return o.dc({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:n,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},c=>c!==void 0)}_updateFilteredLayers(t){for(const n of Object.values(this._mergedLayers))t(n)&&this._updateLayer(n)}_updateLayer(t){this._changes.updateLayer(t);const n=this.getLayerSourceCache(t),c=o.C(t.source,t.scope),d=this._changes.getUpdatedSourceCaches();t.source&&!d[c]&&n&&n.getSource().type!=="raster"&&(this._changes.updateSourceCache(c,"reload"),n.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const n=y=>this._mergedLayers[y].is3D(!!this.terrain),c=this.order,d={},p=[];for(let y=c.length-1;y>=0;y--){const x=c[y];if(n(x)){d[x]=y;for(const T of t){const S=T[x];if(S)for(const M of S)p.push(M)}}}p.sort((y,x)=>x.intersectionZ-y.intersectionZ);const m=[];for(let y=c.length-1;y>=0;y--){const x=c[y];if(n(x))for(let T=p.length-1;T>=0;T--){const S=p[T].feature;if(S.layer&&d[S.layer.id]<y)break;m.push(S),p.pop()}else for(const T of t){const S=T[x];if(S)for(const M of S)m.push(M.feature)}}return m}queryRenderedFeatures(t,n,c){let d;n&&!Array.isArray(n)&&n.filter&&(this._validate(xe,"queryRenderedFeatures.filter",n.filter,null,n),d=o.b3(n.filter));const p={},m=S=>{if(bc.has(S.type))return;const M=this.getOwnLayerSourceCache(S),I=p[M.id]=p[M.id]||{sourceCache:M,layers:{},has3DLayers:!1};S.is3D(!!this.terrain)&&(I.has3DLayers=!0),I.layers[S.fqid]=I.layers[S.fqid]||{styleLayer:S,targets:[]},I.layers[S.fqid].targets.push({filter:d})};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new o.z(new Error("parameters.layers must be an Array."))),[];for(const S of n.layers){const M=this._layers[S];if(!M)return this.fire(new o.z(new Error(`The layer '${S}' does not exist in the map's style and cannot be queried for features.`))),[];m(M)}}else for(const S in this._layers)m(this._layers[S]);const y=this._queryRenderedFeatures(t,p,c),x=this._flattenAndSortRenderedFeatures(y),T=[];for(const S of x)o.dd(S.layer.id)===this.scope&&T.push(S);return T}queryRenderedFeatureset(t,n,c){let d;
15n&&!Array.isArray(n)&&n.filter&&(this._validate(xe,"queryRenderedFeatures.filter",n.filter,null,n),d=o.b3(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 I=M.getFeaturesetDescriptors();for(const C of I)m.push({targetId:p,filter:d,target:C})}}const y=this.queryRenderedTargets(t,m,c),x=[],T=new Set;for(const S of y)for(const M of S.variants[p])lc(M,S,T)||x.push(new o.de(S,M));return x}queryRenderedTargets(t,n,c){const d={},p=(y,x,T,S)=>{const M=d[x.id]=d[x.id]||{sourceCache:x,layers:{},has3DLayers:!1};if(M.layers[y.fqid]=M.layers[y.fqid]||{styleLayer:y,targets:[]},y.is3D(!!this.terrain)&&(M.has3DLayers=!0),!S)return T.uniqueFeatureID=!1,void M.layers[y.fqid].targets.push(T);M.layers[y.fqid].targets.push(Object.assign({},T,{namespace:S.namespace,properties:S.properties,uniqueFeatureID:S.uniqueFeatureID}))};for(const y of n)if("featuresetId"in y.target){const{featuresetId:x,importId:T}=y.target,S=this.getFragmentStyle(T);if(!S||!S._featuresetSelectors)continue;const M=S._featuresetSelectors[x];if(!M){this.fire(new o.z(new Error(`The featureset '${x}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const I of M){const C=S.getOwnLayer(I.layerId);C&&!bc.has(C.type)&&p(C,S.getOwnLayerSourceCache(C),y,I)}}else if("layerId"in y.target){const{layerId:x}=y.target,T=this.getLayer(x);if(!T||bc.has(T.type))continue;p(T,this.getLayerSourceCache(T),y)}const m=this._queryRenderedFeatures(t,d,c);return this._flattenAndSortRenderedFeatures(m)}_queryRenderedFeatures(t,n,c){const d=[],p=!!this.map._showQueryGeometry,m=ai.createFromScreenPoints(t,c);for(const y in n){const x=cc(m,n[y],this._availableImages,c,p);Object.keys(x).length&&d.push(x)}if(this.placement)for(const y in n){if(!n[y].sourceCache._onlySymbols)continue;const x=vo(m.screenGeometry,n[y],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(x).length&&d.push(x)}return d}querySourceFeatures(t,n){const c=n&&n.filter;c&&this._validate(xe,"querySourceFeatures.filter",c,null,n);let d=[];const p=this.getOwnSourceCaches(t);for(const m of p)d=d.concat(il(m,n));return d}addSourceType(t,n,c){return Wr.getSourceType(t)?c(new Error(`A source type called "${t}" already exists.`)):(Wr.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 y in t)if(!o.bv(t[y],d[y])){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=o.q.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&o.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,n=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),n===0&&delete this.terrain,t===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let c=t;const d=t.source==null;if(n===1){if(this.disableElevatedTerrain)return;if(typeof c.source=="object"){const y="terrain-dem-src";this.addSource(y,c.source),c=o.d6(c),c=o.h(c,{source:y})}const p=o.h({},c),m={};if(this.terrain&&d){p.source=this.terrain.get().source;const y=this.terrain?this.getFragmentStyle(this.terrain.scope):null;y&&(m.style=y.serialize())}if(this._validate(He,"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 o.A("data",{dataType:"style"}))}else{const p=this.terrain,m=p.get();for(const y of Object.keys(o.a5.terrain))!c.hasOwnProperty(y)&&o.a5.terrain[y].default&&(c[y]=o.a5.terrain[y].default);for(const y in t)if(!o.bv(t[y],m[y])){p.set(t,this.options),this.stylesheet.terrain=t;const x=this._getTransitionParameters({duration:0});p.updateTransitions(x),this.fire(new o.A("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedU
15pdate=!0}_createFog(t){const n=this.fog=new Ct(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 qi(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 $i(t,this.map.transform,this.scope,this.options);this.stylesheet.rain=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const t of this.map._markers)t._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const n=this.fog;if(!o.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.fog=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}}else this._createFog(t);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(t){if(this._checkLoaded(),!t)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const n=this.snow;if(!o.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.snow=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}}else this._createSnow(t);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(t){if(this._checkLoaded(),!t)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const n=this.rain;if(!o.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.rain=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}}else this._createRain(t);this._markersNeedUpdate=!0}_reloadColorTheme(){const t=()=>{for(const d in this._layers)this._layers[d].lut=this._styleColorTheme.lut;for(const d in this._sourceCaches)this._sourceCaches[d].clearTiles()},n=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!n)return this._styleColorTheme.lut=null,void t();const c=this._evaluateColorThemeData(n);this._loadColorTheme(c).then(()=>{this.fire(new o.A("colorthemeset")),t()}).catch(d=>{o.w(`Couldn't set color theme: ${d}`)})}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&o.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=t,this._reloadColorTheme()}setImportColorTheme(t,n){const c=this.getFragmentStyle(t);c&&(c._styleColorTheme.colorThemeOverride=n,c._reloadColorTheme())}_getTransitionParameters(t){return{now:o.q.now(),transition:o.h(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const t=[],n=[];for(const c of this._mergedOrder)this.isLayerDraped(this._mergedLayers[c])?t.push(c):n.push(c);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...n)}_createTerrain(t,n){const c=this.terrain=new ue(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=o.h({},this.serialize());return zo(this,t.call(yn,o.h({key:n,style:m,value:c,styleSpec:o.a5},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),o.df.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.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()}reloadSource(t){const n=this.getSourceCaches(t);for(const c of n)c.resume(),c.reload()}
15reloadSources(){for(const t of this.getSources())t.reload&&t.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(t=>{t.modelManager.reloadModels(t.scope)})}updateSources(t){let n;this.directionalLight&&(n=pa(this.directionalLight));const c=new Set;for(const d in this._mergedLayers){const p=this._mergedLayers[d];p.hasElevation()&&!c.has(p.source)&&c.add(p.source)}for(const d in this._mergedSourceCaches){const p=this._mergedSourceCaches[d],m=c.has(p._source.id);p.update(t,void 0,void 0,n,m)}}_generateCollisionBoxes(){for(const t in this._sourceCaches){const n=this._sourceCaches[t];n.resume(),n.reload()}}_updatePlacement(t,n,c,d,p,m,y=!1){let x=!1,T=!1;const S={},M={};for(const I of this._mergedOrder){const C=this._mergedLayers[I];if(C.type!=="symbol")continue;const L=o.C(C.source,C.scope);let R=S[L];if(!R){const B=this.getLayerSourceCache(C);if(!B)continue;const V=B.getRenderableIds(!0).map(Z=>B.getTileByID(Z));M[L]=V.slice(),R=S[L]=V.sort((Z,Y)=>Y.tileID.overscaledZ-Z.tileID.overscaledZ||(Z.tileID.isLessThan(Y.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(C,R,n.center.lng,n.projection);x=x||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),y=y||this._layerOrderChanged||d===0,this._layerOrderChanged&&this.fire(new o.A("neworder")),(y||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(o.q.now(),n.zoom))&&(this.pauseablePlacement=new yc(n,this._mergedOrder,y,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(o.q.now()),T=!0),x&&this.pauseablePlacement.placement.setStale()),T||x){this._buildingIndex.onNewFrame(n.zoom);for(let I=0;I<this._mergedOrder.length;I++){const C=this._mergedLayers[this._mergedOrder[I]];if(C.type!=="symbol")continue;const L=this.isLayerClipped(C);this.placement.updateLayerOpacities(C,S[o.C(C.source,C.scope)],I,L?m:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(o.q.now())}}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}addImport(t,n){this._checkLoaded();const c=this.stylesheet.imports=this.stylesheet.imports||[];if(c.findIndex(({id:p})=>p===t.id)!==-1)return void this.fire(new o.z(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!n)return c.push(t),this._loadImports([t],!0);const d=c.findIndex(({id:p})=>p===n);return d===-1&&this.fire(new o.z(new Error(`Import with id "${n}" does not exist on this map.`))),this.stylesheet.imports=c.slice(0,d).concat(t).concat(c.slice(d)),this._loadImports([t],!0,n)}updateImport(t,n){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);return d===-1?this:typeof n=="string"?(this.setImportUrl(t,n),this):(n.url&&n.url!==c[d].url&&this.setImportUrl(t,n.url),o.bv(n.config,c[d].config)||this.setImportConfig(t,n.config,n.data.schema),o.bv(n.data,c[d].data)||this.setImportData(t,n.data),this)}moveImport(t,n){this._checkLoaded();let c=this.stylesheet.imports||[];const d=this.getImportIndex(t);if(d===-1)return this;const p=this.getImportIndex(n);if(p===-1)return this;const m=c[d],y=this.fragments[d];return c=c.filter(({id:x})=>x!==t),this.fragments=this.fragments.filter(({id:x})=>x!==t),this.stylesheet.imports=c.slice(0,p).concat(m).concat(c.slice(p)),this.fragments=this.fragments.slice(0,p).concat(y).concat(this.fragments.slice(p)),this.mergeLayers(),this}setImportUrl(t,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 y=m.style.stylesheet&&m.style.stylesheet.schema;return m.config=n,m.style.updateConfig(n,y),this.updateConfigDependencies(),this}removeImport(t){this._checkLoaded();const n=this.stylesheet.imports||[],c=this.getImportIndex(t);c!==-1&&(n.splice(c,1),this.fragments[c].style._remove(),this.fragments.splice(c,1),this._reloadImports())}getImportIndex(t){const n=(this.stylesheet.imports||[]).findIndex(c=>c.id===t);
15return n===-1&&this.fire(new o.z(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),n}getLayer(t){return this._mergedLayers[t]}getSources(){const t=[];for(const n in this._mergedOtherSourceCaches){const c=this._mergedOtherSourceCaches[n];c&&t.push(c.getSource())}return t}getSource(t,n){const c=this.getSourceCache(t,n);return c&&c.getSource()}getLayerSource(t){const n=this.getLayerSourceCache(t);return n&&n.getSource()}getSourceCache(t,n){const c=o.C(t,n);return this._mergedOtherSourceCaches[c]}getLayerSourceCache(t){const n=o.C(t.source,t.scope);return t.type==="symbol"?this._mergedSymbolSourceCaches[n]:this._mergedOtherSourceCaches[n]}getSourceCaches(t){if(t==null)return Object.values(this._mergedSourceCaches);const n=[];return this._mergedOtherSourceCaches[t]&&n.push(this._mergedOtherSourceCaches[t]),this._mergedSymbolSourceCaches[t]&&n.push(this._mergedSymbolSourceCaches[t]),n}updateSourceCaches(){const t=this._changes.getUpdatedSourceCaches();for(const n in t){const c=t[n];c==="reload"?this.reloadSource(n):c==="clear"&&this.clearSource(n)}}updateLayers(t){const n=this._changes.getUpdatedPaintProperties();for(const c of n){const d=this.getLayer(c);d&&d.updateTransitions(t)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(t){this.stylesheet.glyphs=t,this.glyphManager.setURL(t,this.scope)}getImages(t,n,c){this.imageManager.getImages(n.images,n.scope,c),this._updateTilesForChangedImages();const d=m=>{if(m){const y=n.images.map(x=>o.I.toString(x));m.setDependencies(n.tileID.key,n.type,y)}},p=o.C(n.source,n.scope);d(this._mergedOtherSourceCaches[p]),d(this._mergedSymbolSourceCaches[p])}rasterizeImages(t,n,c){this.imageManager.rasterizeImages(n,c)}getGlyphs(t,n,c){this.glyphManager.getGlyphs(n.stacks,n.scope,c)}getResource(t,n,c){return o.dg(n,c)}getOwnSourceCache(t){return this._otherSourceCaches[t]}getOwnLayerSourceCache(t){return t.type==="symbol"?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]}getOwnSourceCaches(t){const n=[];return this._otherSourceCaches[t]&&n.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&n.push(this._symbolSourceCaches[t]),n}_isSourceCacheLoaded(t){const n=this.getOwnSourceCaches(t);return n.length===0?(this.fire(new o.z(new Error(`There is no source with ID '${t}'`))),!1):n.every(c=>c.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(t,n){if(!this._clipLayerPresent&&t.type!=="fill-extrusion"&&t.type!=="building")return!1;const c=t.type==="fill-extrusion"&&t.sourceLayer==="building",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)}}Wr.getSourceType=function(l){return ac[l]},Wr.setSourceType=function(l,t){ac[l]=t},Wr.registerForPluginStateChange=o.dh;var yl=` 16#define EPSILON 0.0000001 17#define PI 3.141592653589793 18#ifdef RENDER_CUTOFF 19float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);} 20#endif`,Vu=` 21out vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth) 22{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;} 23#ifdef INDICATOR_CUTOUT 24uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params; 25#endif 26vec4 applyCutout(vec4 color,float height) { 27#ifdef INDICATOR_CUTOUT 28float verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;
28float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0); 29#else 30return color; 31#endif 32} 33#ifdef DEBUG_WIREFRAME 34#define HANDLE_WIREFRAME_DEBUG \\ 35glFragColor=vec4(0.7,0.0,0.0,0.7); \\ 36gl_FragDepth=gl_FragCoord.z-0.0001; 37#else 38#define HANDLE_WIREFRAME_DEBUG 39#endif 40#ifdef RENDER_CUTOFF 41uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity; 42#endif 43vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,Uu=` 44#define EXTENT 8192.0 45#define RAD_TO_DEG 180.0/PI 46#define DEG_TO_RAD PI/180.0 47#define GLOBE_RADIUS EXTENT/PI/2.0 48float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;} 49#ifdef PROJECTION_GLOBE_VIEW 50vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { 51#ifndef PROJECTED_POS_ON_VIEWPORT 52float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz; 53#else 54return vec3(0.0); 55#endif 56}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);} 57#endif 58vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4( 59unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 60);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);} 61#ifdef RENDER_CUTOFF 62uniform vec4 u_cutoff_params;out float v_cutoff_opacity; 63#endif 64const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt) 65{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}`,ma="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;
65void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",_a=` 66#define ELEVATION_SCALE 7.0 67#define ELEVATION_OFFSET 450.0 68#ifdef PROJECTION_GLOBE_VIEW 69uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix( 70mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;} 71#else 72vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } 73#endif 74#ifdef TERRAIN 75uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) { 76#ifdef TERRAIN_DEM_FLOAT_FORMAT 77vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r; 78#else 79float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); 80#endif 81}float prevElevation(vec2 apos) { 82#ifdef TERRAIN_DEM_FLOAT_FORMAT 83vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r; 84#else 85float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); 86#endif 87} 88#ifdef TERRAIN_VERTEX_MORPHING 89float elevation(vec2 apos) { 90#ifdef ZERO_EXAGGERATION 91return 0.0; 92#endif 93float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} 94#else 95float elevation(vec2 apos) { 96#ifdef ZERO_EXAGGERATION 97return 0.0; 98#endif 99return currentElevation(apos);} 100#endif 101vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);} 102#else 103float elevation(vec2 pos) { return 0.0; } 104#endif 105#ifdef DEPTH_OCCLUSION 106uniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset; 107#ifdef DEPTH_D24 108float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);} 109#else 110highp float unpack_depth_rgba(vec4 rgba_depth) 111{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} 112#endif 113bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w; 114#ifdef DEPTH_D24 115float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r); 116#else 117float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5)); 118#endif 119return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
119size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5; 120#ifdef DEPTH_D24 121highp vec4 depth=vec4( 122texture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r 123);depth=unpack_depth4(depth); 124#else 125highp vec4 depth=vec4( 126unpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy)) 127); 128#endif 129return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) { 130#ifdef DEPTH_D24 131highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r); 132#else 133highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y))); 134#endif 135res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));} 136#else 137bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; } 138#endif//DEPTH_OCCLUSION`,ju=`#ifdef FOG 139uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} 140#endif`,wc=`#ifdef FOG 141uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( 142mix(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;}
142vec3 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);} 143#endif`,Cn=`#ifdef RASTER_ARRAY 144uniform 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) 145);}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) 146);}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);} 147#endif`,Tc=`#ifdef RASTER_ARRAY 148uniform 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;} 149#endif 150uniform 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;}`,We=`#ifdef RENDER_SHADOWS 151uniform 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];} 152#endif//RENDER_SHADOWS`,Gu=`#ifdef RENDER_SHADOWS 153precision 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
153p float bias) {highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);return 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; 154#ifdef SHADOWS_SINGLE_CASCADE 155vec2 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); 156#else 157light_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); 158#endif 159}highp float calculate_shadow_bias(float NDotL) { 160#ifdef NORMAL_OFFSET 161return 0.5*u_shadow_bias.x; 162#else 163return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z)); 164#endif 165}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) 166{highp vec2 biasUV=vec2( 167pos_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);} 168#endif`;const ga=[];Nn(yl,ga),Nn(Uu,ga),Nn(Vu,ga);const ya={"_prelude_fog.vertex.glsl":ju,"_prelude_terrain.vertex.glsl":_a,"_prelude_shadow.vertex.glsl":We,"_prelude_fog.fragment.glsl":wc,"_prelude_shadow.fragment.glsl":Gu,"_prelude_lighting.glsl":` 169#ifdef LIGHTING_3D_MODE 170uniform 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
170));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);} 171#endif//LIGHTING_3D_MODE`,"_prelude_raster_array.glsl":Cn,"_prelude_raster_particle.glsl":Tc},xl={};Jt("",_a),Jt(wc,ju),Jt(Gu,We),Jt(Cn,""),Jt(Tc,"");const vl=Jt(Vu,Uu),as=yl;var Sc={background:Jt(`#include "_prelude_fog.fragment.glsl" 172#include "_prelude_lighting.glsl" 173uniform vec4 u_color;uniform float u_opacity; 174#ifdef LIGHTING_3D_MODE 175in vec4 v_color; 176#endif 177void main() {vec4 out_color; 178#ifdef LIGHTING_3D_MODE 179out_color=v_color; 180#else 181out_color=u_color; 182#endif 183#ifdef FOG 184out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 185#endif 186glFragColor=out_color*u_opacity; 187#ifdef OVERDRAW_INSPECTOR 188glFragColor=vec4(1.0); 189#endif 190HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 191#include "_prelude_lighting.glsl" 192in vec2 a_pos;uniform mat4 u_matrix; 193#ifdef LIGHTING_3D_MODE 194uniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength; 195#endif 196void main() {gl_Position=u_matrix*vec4(a_pos,0,1); 197#ifdef LIGHTING_3D_MODE 198v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength); 199#endif 200#ifdef FOG 201v_fog_pos=fog_position(a_pos); 202#endif 203}`),backgroundPattern:Jt(`#include "_prelude_fog.fragment.glsl" 204#include "_prelude_lighting.glsl" 205uniform 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); 206#ifdef LIGHTING_3D_MODE 207out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 208#endif 209#ifdef FOG 210out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 211#endif 212glFragColor=out_color*u_opacity; 213#ifdef OVERDRAW_INSPECTOR 214glFragColor=vec4(1.0); 215#endif 216HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 217uniform 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); 218#ifdef FOG 219v_fog_pos=fog_position(a_pos); 220#endif 221}`),building:Jt(`#include "_prelude_fog.fragment.glsl" 222#include "_prelude_shadow.fragment.glsl" 223#include "_prelude_lighting.glsl" 224in vec4 v_color;in highp vec3 v_normal;in highp float v_height; 225#ifdef RENDER_SHADOWS 226in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; 227#endif 228uniform lowp float u_opacity;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}
228vec3 apply_lighting_linear(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 color*(ambient_contrib+directional_contrib);}void main() {vec4 color=vec4(v_color.rgb,1.0);vec3 normal=normalize(v_normal);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0; 229#ifdef RENDER_SHADOWS 230shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 231#else 232shadowed_lighting_factor=dot(normal,u_lighting_directional_dir); 233#endif 234color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=mix(color.rgb,v_color.rgb,v_color.a); 235#ifdef FOG 236color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_height)); 237#endif 238color.rgb=linearTosRGB(color.rgb);color*=u_opacity; 239#ifdef RENDER_CUTOFF 240color*=v_cutoff_opacity; 241#endif 242#ifdef INDICATOR_CUTOUT 243color=applyCutout(color,v_height); 244#endif 245glFragColor=color; 246#ifdef DEBUG_SHOW_NORMALS 247color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color; 248#endif 249#ifdef OVERDRAW_INSPECTOR 250glFragColor=vec4(1.0); 251#endif 252HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 253#include "_prelude_shadow.vertex.glsl" 254in vec3 a_pos_3f;in vec3 a_normal_3f;out vec4 v_color;out highp vec3 v_normal;out highp float v_height;uniform mat4 u_matrix;uniform mat4 u_normal_matrix; 255#ifdef RENDER_SHADOWS 256uniform 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; 257#endif 258vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} 259#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive 260void main() { 261#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive 262vec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));vec3 pos=a_pos_3f;v_height=pos.z;gl_Position=u_matrix*vec4(pos,1.0); 263#ifdef RENDER_SHADOWS 264vec3 shadow_pos=pos; 265#ifdef NORMAL_OFFSET 266vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0(); 267#endif 268v_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0);v_depth_shadows=gl_Position.w; 269#endif 270#ifdef FOG 271v_fog_pos=fog_position(pos); 272#endif 273#ifdef RENDER_CUTOFF 274v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 275#endif 276}`),buildingDepth:Jt(`in highp float v_depth;void main() { 277#ifndef DEPTH_TEXTURE 278glFragColor=pack_depth(v_depth); 279#endif 280}`,"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" 281#include "_prelude_lighting.glsl" 282in vec3 v_data;in float v_visibility; 283#pragma mapbox: define highp vec4 color 284#pragma mapbox: define mediump float radius 285#pragma mapbox: define lowp float blur 286#pragma mapbox: define lowp float opacity 287#pragma mapbox: define highp vec4 stroke_color 288#pragma mapbox: define mediump float stroke_width 289#pragma mapbox: define lowp float stroke_opacity 290uniform float u_emissive_strength;void main() { 291#pragma mapbox: initialize highp vec4 color 292#pragma mapbox: initialize mediump float radius 293#pragma mapbox: initialize lowp float blur 294#pragma mapbox: initialize lowp float opacity 295#pragma mapbox: initialize highp vec4 stroke_color 296#pragma mapbox: initialize mediump float stroke_width 297#pragma mapbox: initialize lowp float stroke_opacity 298vec2 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 ? 299smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : 300smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_op
300acity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( 301antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) 302);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); 303#ifdef LIGHTING_3D_MODE 304out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 305#endif 306#ifdef FOG 307out_color=fog_apply_premultiplied(out_color,v_fog_pos); 308#endif 309glFragColor=out_color*(v_visibility*opacity_t); 310#ifdef OVERDRAW_INSPECTOR 311glFragColor=vec4(1.0); 312#endif 313}`,`#include "_prelude_fog.vertex.glsl" 314#include "_prelude_terrain.vertex.glsl" 315#define NUM_VISIBILITY_RINGS 2 316#define INV_SQRT2 0.70710678 317#define ELEVATION_BIAS 0.0001 318#define NUM_SAMPLES_PER_RING 16 319uniform 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; 320#ifdef PROJECTION_GLOBE_VIEW 321in 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; 322#endif 323#ifdef ELEVATED_ROADS 324in float a_circle_z_offset; 325#endif 326out vec3 v_data;out float v_visibility; 327#pragma mapbox: define highp vec4 color 328#pragma mapbox: define mediump float radius 329#pragma mapbox: define lowp float blur 330#pragma mapbox: define lowp float opacity 331#pragma mapbox: define highp vec4 stroke_color 332#pragma mapbox: define mediump float stroke_width 333#pragma mapbox: define lowp float stroke_opacity 334vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) { 335#if defined(TERRAIN) 336return elevation(pos)+ELEVATION_BIAS; 337#else 338return 0.0; 339#endif 340}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); 341#ifdef PITCH_WITH_MAP 342#ifdef PROJECTION_GLOBE_VIEW 343return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); 344#else 345return u_matrix*( world_center+vec4(sample_offset,0,0) ); 346#endif 347#else 348return projected_center+vec4(sample_offset,0,0); 349#endif 350}float get_sample_step() { 351#ifdef PITCH_WITH_MAP 352return 2.0*PI/float(NUM_SAMPLES_PER_RING); 353#else 354return PI/float(NUM_SAMPLES_PER_RING); 355#endif 356}void main(void) { 357#pragma mapbox: initialize highp vec4 color 358#pragma mapbox: initialize mediump float radius 359#pragma mapbox: initialize lowp float blur 360#pragma mapbox: initialize lowp float opacity 361#pragma mapbox: initialize highp vec4 stroke_color 362#pragma mapbox: initialize mediump float stroke_width 363#pragma mapbox: initialize lowp float stroke_opacity 364vec2 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; 365#ifdef PROJECTION_GLOBE_VIEW 366vec3 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); 367#else
368surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1); 369#endif 370#ifdef ELEVATED_ROADS 371world_center.z+=a_circle_z_offset+ELEVATION_BIAS; 372#endif 373vec4 projected_center=u_matrix*world_center;float view_scale=0.0; 374#ifdef PITCH_WITH_MAP 375#ifdef SCALE_WITH_MAP 376view_scale=1.0; 377#else 378view_scale=projected_center.w/u_camera_to_center_distance; 379#endif 380#else 381#ifdef SCALE_WITH_MAP 382view_scale=u_camera_to_center_distance; 383#else 384view_scale=projected_center.w; 385#endif 386#endif 387gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; 388#ifdef TERRAIN 389float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; 390#ifdef PITCH_WITH_MAP 391float 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; 392#else 393occlusion_world_center=world_center;occlusion_projected_center=projected_center; 394#endif 395for(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); 396#else 397visibility=1.0; 398#endif 399#ifdef PROJECTION_GLOBE_VIEW 400visibility=1.0; 401#endif 402v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); 403#ifdef FOG 404v_fog_pos=fog_position(world_center.xyz); 405#endif 406}`),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" 407uniform highp float u_intensity;in vec2 v_extrude; 408#pragma mapbox: define highp float weight 409#define GAUSS_COEF 0.3989422804014327 410void main() { 411#pragma mapbox: initialize highp float weight 412float 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); 413#ifdef FOG 414if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} 415#endif 416#ifdef OVERDRAW_INSPECTOR 417glFragColor=vec4(1.0); 418#endif 419HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 420#include "_prelude_fog.vertex.glsl" 421uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos; 422#ifdef PROJECTION_GLOBE_VIEW 423in 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; 424#endif 425out vec2 v_extrude; 426#pragma mapbox: define highp float weight 427#pragma mapbox: define mediump float radius 428const highp float ZERO=1.0/255.0/16.0; 429#define GAUSS_COEF 0.3989422804014327 430void main(void) { 431#pragma mapbox: initialize highp float weight 432#pragma mapbox: initialize mediump float radius 433vec2 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; 434#ifdef PROJECTION_GLOBE_VIEW 435vec3 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); 436#else 437pos=vec3(tilePos+extrude,elevation(tilePos)); 438#endif 439gl_Position=u_matrix*vec4(pos,1); 440#ifdef FOG 441v_fog_pos=fog_position(pos); 442#endif 443}`),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; 444#ifdef OVERDRAW_INSPECTOR 445glFragColor=vec4(0.0); 446#endif 447HANDLE_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" 448in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( 4490.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( 450mix(-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( 4510.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" 452in vec2 a_pos; 453#ifdef PROJECTION_GLOBE_VIEW 454in vec3 a_pos_3; 455#endif 456out 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; 457#ifdef PROJECTION_GLOBE_VIEW
458gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); 459#else 460gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); 461#endif 462}`),elevatedStructuresDepth:Jt(`void main() { 463#ifndef DEPTH_TEXTURE 464glFragColor=vec4(0.); 465#endif 466}`,"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 467in float v_height; 468#endif 469void main() { 470#ifdef DEPTH_RECONSTRUCTION 471if (v_height >=0.0) 472discard; 473#endif 474glFragColor=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; 475#ifdef DEPTH_RECONSTRUCTION 476out float v_height; 477#endif 478void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale); 479#ifdef DEPTH_RECONSTRUCTION 480if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height; 481#endif 482gl_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" 483#include "_prelude_lighting.glsl" 484#include "_prelude_shadow.fragment.glsl" 485in vec3 v_normal;in float v_height; 486#ifdef RENDER_SHADOWS 487in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth; 488#endif 489vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
489vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color) 490{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; 491#pragma mapbox: define highp vec4 structure_color 492void main() { 493#pragma mapbox: initialize highp vec4 structure_color 494vec3 color=structure_color.xyz; 495#ifdef LIGHTING_3D_MODE 496vec3 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); 497#ifdef RENDER_SHADOWS 498float 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); 499#else 500color=apply_lighting(color,transformed_normal); 501#endif 502color=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);} 503#endif 504#ifdef FOG 505color=fog_apply(color,v_fog_pos); 506#endif 507vec4 out_color=vec4(color,1.0); 508#ifdef INDICATOR_CUTOUT 509out_color=applyCutout(out_color,v_height); 510#endif 511glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 512#include "_prelude_shadow.vertex.glsl" 513in 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; 514#ifdef RENDER_SHADOWS 515uniform 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; 516#endif 517#pragma mapbox: define highp vec4 structure_color 518void main() { 519#pragma mapbox: initialize highp vec4 structure_color 520v_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); 521#ifdef RENDER_SHADOWS 522vec3 shd_pos0=pos;vec3 shd_pos1=pos; 523#ifdef NORMAL_OFFSET 524vec3 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(); 525#endif 526v_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; 527#endif 528#ifdef FOG 529v_fog_pos=fog_position(a_pos); 530#endif 531}`),fill:Jt(`#include "_prelude_fog.fragment.glsl" 532#include "_prelude_lighting.glsl" 533#include "_prelude_shadow.fragment.glsl" 534#pragma mapbox: define highp vec4 color 535#pragma mapbox: define lowp float opacity 536uniform float u_emissive_strength; 537#ifdef RENDER_SHADOWS 538uniform 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; 539#endif 540#ifdef ELEVATED_ROADS 541in highp float v_road_z_offset; 542#endif 543#ifdef INDICATOR_CUTOUT 544in highp float v_z_offset; 545#endif 546void main() { 547#pragma mapbox: initialize highp vec4 color 548#pragma mapbox: initialize lowp float opacity 549vec4 out_color=color; 550#ifdef LIGHTING_3D_MODE 551out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 552#ifdef RENDER_SHADOWS 553float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 554#ifdef ELEVATED_ROADS 555out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 556#else 557out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 558#endif 559#endif 560#endif 561#ifdef FOG 562out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 563#endif 564out_color*=opacity; 565#ifdef INDICATOR_CUTOUT 566if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);} 567#endif 568glFragColor=out_color; 569#ifdef OVERDRAW_INSPECTOR 570glFragColor=vec4(1.0); 571#endif 572HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 573#include "_prelude_shadow.vertex.glsl" 574in vec2 a_pos; 575#ifdef ELEVATED_ROADS 576in float a_road_z_offset;out highp float v_road_z_offset; 577#endif 578#ifdef RENDER_SHADOWS 579uniform 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; 580#endif 581#ifdef INDICATOR_CUTOUT 582out highp float v_z_offset; 583#endif 584uniform mat4 u_matrix; 585#pragma mapbox: define highp vec4 color 586#pragma mapbox: define lowp float opacity 587#pragma mapbox: define highp float z_offset 588void main() { 589#pragma mapbox: initialize highp vec4 color 590#pragma mapbox: initialize lowp float opacity 591#pragma mapbox: initialize highp float z_offset 592#ifdef ELEVATED_ROADS 593z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 594#endif 595float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); 596#ifdef RENDER_SHADOWS 597vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 598#ifdef NORMAL_OFFSET 599vec3 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(); 600#endif 601v_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; 602#endif 603#ifdef FOG 604v_fog_pos=fog_position(a_pos); 605#endif 606#ifdef INDICATOR_CUTOUT 607v_z_offset=z_offset; 608#endif 609}`),fillOutline:Jt(`#include "_prelude_fog.fragment.glsl" 610#include "_prelude_lighting.glsl" 611#include "_prelude_shadow.fragment.glsl" 612in highp vec2 v_pos;uniform float u_emissive_strength; 613#ifdef RENDER_SHADOWS 614uniform 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; 615#endif 616#pragma mapbox: define highp vec4 outline_color 617#pragma mapbox: define lowp float opacity 618void main() { 619#pragma mapbox: initialize highp vec4 outline_color 620#pragma mapbox: initialize lowp float opacity 621float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color; 622#ifdef LIGHTING_3D_MODE 623out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 624#ifdef RENDER_SHADOWS 625float 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); 626#endif 627#endif 628#ifdef FOG 629out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 630#endif 631glFragColor=out_color*(alpha*opacity); 632#ifdef OVERDRAW_INSPECTOR 633glFragColor=vec4(1.0); 634#endif 635HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 636#include "_prelude_shadow.vertex.glsl" 637in vec2 a_pos; 638#ifdef ELEVATED_ROADS 639in float a_road_z_offset; 640#endif 641#ifdef RENDER_SHADOWS 642uniform 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; 643#endif 644uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos; 645#pragma mapbox: define highp vec4 outline_color 646#pragma mapbox: define lowp float opacity 647#pragma mapbox: define highp float z_offset 648void main() { 649#pragma mapbox: initialize highp vec4 outline_color 650#pragma mapbox: initialize lowp float opacity 651#pragma mapbox: initialize highp float z_offset 652#ifdef ELEVATED_ROADS 653z_offset+=a_road_z_offset; 654#endif 655float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 656#ifdef RENDER_SHADOWS 657vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 658#ifdef NORMAL_OFFSET 659vec3 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(); 660#endif 661v_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; 662#endif 663#ifdef FOG 664v_fog_pos=fog_position(a_pos); 665#endif 666}`),fillOutlinePattern:Jt(`#include "_prelude_fog.fragment.glsl" 667#include "_prelude_lighting.glsl" 668#include "_prelude_shadow.fragment.glsl" 669uniform vec2 u_texsize;uniform sampler2D u_image; 670#ifdef FILL_PATTERN_TRANSITION 671uniform float u_pattern_transition; 672#endif 673uniform float u_emissive_strength; 674#ifdef RENDER_SHADOWS 675uniform 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; 676#endif 677in highp vec2 v_pos;in highp vec2 v_pos_world; 678#pragma mapbox: define lowp float opacity 679#pragma mapbox: define lowp vec4 pattern 680#ifdef FILL_PATTERN_TRANSITION 681#pragma mapbox: define mediump vec4 pattern_b 682#endif 683void main() { 684#pragma mapbox: initialize lowp float opacity 685#pragma mapbox: initialize mediump vec4 pattern 686#ifdef FILL_PATTERN_TRANSITION 687#pragma mapbox: initialize mediump vec4 pattern_b 688#endif 689vec2 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); 690#ifdef FILL_PATTERN_TRANSITION 691vec2 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; 692#endif 693#ifdef LIGHTING_3D_MODE 694out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 695#ifdef RENDER_SHADOWS 696float 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); 697#endif 698#endif 699#ifdef FOG 700out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 701#endif 702glFragColor=out_color*(alpha*opacity); 703#ifdef OVERDRAW_INSPECTOR 704glFragColor=vec4(1.0); 705#endif 706HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 707#include "_prelude_shadow.vertex.glsl" 708uniform 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; 709#ifdef ELEVATED_ROADS 710in float a_road_z_offset; 711#endif 712#ifdef RENDER_SHADOWS 713uniform 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; 714#endif 715out highp vec2 v_pos;out highp vec2 v_pos_world; 716#pragma mapbox: define lowp float opacity 717#pragma mapbox: define lowp vec4 pattern 718#ifdef FILL_PATTERN_TRANSITION 719#pragma mapbox: define mediump vec4 pattern_b 720#endif 721#pragma mapbox: define lowp float pixel_ratio 722#pragma mapbox: define highp float z_offset 723void main() { 724#pragma mapbox: initialize lowp float opacity 725#pragma mapbox: initialize mediump vec4 pattern 726#ifdef FILL_PATTERN_TRANSITION 727#pragma mapbox: initialize mediump vec4 pattern_b 728#endif 729#pragma mapbox: initialize lowp float pixel_ratio 730#pragma mapbox: initialize highp float z_offset 731vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw; 732#ifdef ELEVATED_ROADS 733z_offset+=a_road_z_offset; 734#endif 735float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 736#ifdef RENDER_SHADOWS 737vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 738#ifdef NORMAL_OFFSET 739vec3 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(); 740#endif 741v_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; 742#endif 743#ifdef FOG 744v_fog_pos=fog_position(a_pos); 745#endif 746}`),fillPattern:Jt(`#include "_prelude_fog.fragment.glsl" 747#include "_prelude_lighting.glsl" 748#include "_prelude_shadow.fragment.glsl" 749uniform vec2 u_texsize;uniform sampler2D u_image; 750#ifdef FILL_PATTERN_TRANSITION 751uniform float u_pattern_transition; 752#endif 753in highp vec2 v_pos;uniform float u_emissive_strength; 754#ifdef RENDER_SHADOWS 755uniform 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; 756#endif 757#ifdef ELEVATED_ROADS 758in highp float v_road_z_offset; 759#endif 760#pragma mapbox: define lowp float opacity 761#pragma mapbox: define lowp vec4 pattern 762#ifdef FILL_PATTERN_TRANSITION 763#pragma mapbox: define mediump vec4 pattern_b 764#endif 765void main() { 766#pragma mapbox: initialize lowp float opacity 767#pragma mapbox: initialize mediump vec4 pattern 768#ifdef FILL_PATTERN_TRANSITION 769#pragma mapbox: initialize mediump vec4 pattern_b 770#endif 771vec2 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); 772#ifdef FILL_PATTERN_TRANSITION 773vec2 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; 774#endif 775#ifdef LIGHTING_3D_MODE 776out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 777#ifdef RENDER_SHADOWS 778float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 779#ifdef ELEVATED_ROADS 780out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 781#else 782out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 783#endif 784#endif 785#endif 786#ifdef FOG 787out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 788#endif 789glFragColor=out_color*opacity; 790#ifdef OVERDRAW_INSPECTOR 791glFragColor=vec4(1.0); 792#endif 793HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 794#include "_prelude_shadow.vertex.glsl" 795uniform 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; 796#ifdef ELEVATED_ROADS 797in float a_road_z_offset;out highp float v_road_z_offset; 798#endif 799#ifdef RENDER_SHADOWS 800uniform 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; 801#endif 802out highp vec2 v_pos; 803#pragma mapbox: define lowp float opacity 804#pragma mapbox: define lowp vec4 pattern 805#ifdef FILL_PATTERN_TRANSITION 806#pragma mapbox: define mediump vec4 pattern_b 807#endif 808#pragma mapbox: define lowp float pixel_ratio 809#pragma mapbox: define highp float z_offset 810void main() { 811#pragma mapbox: initialize lowp float opacity 812#pragma mapbox: initialize mediump vec4 pattern 813#pragma mapbox: initialize lowp float pixel_ratio 814#pragma mapbox: initialize highp float z_offset 815#ifdef FILL_PATTERN_TRANSITION 816#pragma mapbox: initialize mediump vec4 pattern_b 817#endif 818vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio; 819#ifdef ELEVATED_ROADS 820z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 821#endif 822float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); 823#ifdef RENDER_SHADOWS 824vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 825#ifdef NORMAL_OFFSET 826vec3 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(); 827#endif 828v_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; 829#endif 830#ifdef FOG 831v_fog_pos=fog_position(a_pos); 832#endif 833}`),fillExtrusion:Jt(`#include "_prelude_fog.fragment.glsl" 834#include "_prelude_shadow.fragment.glsl" 835#include "_prelude_lighting.glsl" 836in vec4 v_color;in vec4 v_flat; 837#ifdef RENDER_SHADOWS 838in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; 839#endif 840uniform lowp float u_opacity; 841#ifdef FAUX_AO 842uniform lowp vec2 u_ao;in vec2 v_ao; 843#endif 844#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 845in vec4 v_roof_color; 846#endif 847#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 848in highp vec3 v_normal; 849#endif 850uniform vec3 u_flood_light_color;uniform highp float u_vertical_scal
850e;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor; 851#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) 852in float v_flood_radius;in float v_has_floodlight; 853#endif 854in float v_height; 855#pragma mapbox: define highp float emissive_strength 856void main() { 857#pragma mapbox: initialize highp float emissive_strength 858#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 859vec3 normal=normalize(v_normal); 860#endif 861float z;vec4 color=v_color; 862#ifdef ZERO_ROOF_RADIUS 863z=float(normal.z > 0.00001); 864#ifdef LIGHTING_3D_MODE 865normal=mix(normal,vec3(0.0,0.0,1.0),z); 866#else 867color=mix(v_color,v_roof_color,z); 868#endif 869#endif 870float h=max(0.0,v_height);float ao_shade=1.0; 871#ifdef FAUX_AO 872float 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; 873#ifdef ZERO_ROOF_RADIUS 874concave*=(1.0-z); 875#endif 876float 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); 877#ifdef LIGHTING_3D_MODE 878#ifdef FLOOD_LIGHT 879color.rgb*=mix(ao_shade,1.0,v_has_floodlight); 880#else 881color.rgb*=ao_shade; 882#endif 883#else 884color.rgb*=ao_shade; 885#endif 886#endif 887#ifdef LIGHTING_3D_MODE 888float flood_radiance=0.0; 889#ifdef FLOOD_LIGHT 890flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight; 891#endif 892#ifdef RENDER_SHADOWS 893#ifdef FLOOD_LIGHT 894float 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); 895#else 896float shadowed_lighting_factor; 897#ifdef RENDER_CUTOFF 898shadowed_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;} 899#else 900shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); 901#endif 902color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); 903#endif 904#else 905color.rgb=apply_lighting(color.rgb,normal); 906#ifdef FLOOD_LIGHT 907color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance); 908#endif 909#endif 910color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity; 911#endif 912#ifdef FOG 913color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h)); 914#endif 915#ifdef INDICATOR_CUTOUT 916color=applyCutout(color,h); 917#endif 918glFragColor=color; 919#ifdef OVERDRAW_INSPECTOR 920glFragColor=vec4(1.0); 921#endif 922HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 923#include "_prelude_terrain.vertex.glsl" 924#include "_prelude_shadow.vertex.glsl" 925#include "_prelude_lighting.glsl" 926uniform 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; 927#ifdef RENDER_WALL_MODE 928in vec3 a_join_normal_inside; 929#endif 930#ifdef PROJECTION_GLOBE_VIEW 931in 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; 932#endif 933#ifdef TERRAIN 934uniform int u_height_type;uniform int u_base_type; 935#endif 936uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat; 937#ifdef RENDER_SHADOWS 938uniform 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; 939#endif 940#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 941out vec4 v_roof_color; 942#endif 943#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 944out highp vec3 v_normal; 945#endif 946#ifdef FAUX_AO 947uniform lowp vec2 u_ao;out vec2 v_ao; 948#endif 949#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
950out float v_flood_radius;out float v_has_floodlight; 951#endif 952out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} 953#pragma mapbox: define highp float base 954#pragma mapbox: define highp float height 955#pragma mapbox: define highp vec4 color 956#pragma mapbox: define highp float flood_light_wall_radius 957#pragma mapbox: define highp float line_width 958#pragma mapbox: define highp float emissive_strength 959void main() { 960#pragma mapbox: initialize highp float base 961#pragma mapbox: initialize highp float height 962#pragma mapbox: initialize highp vec4 color 963#pragma mapbox: initialize highp float flood_light_wall_radius 964#pragma mapbox: initialize highp float line_width 965#pragma mapbox: initialize highp float emissive_strength 966base*=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)); 967#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 968v_normal=normal; 969#endif 970base=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); 971#if defined(HAS_CENTROID) || defined(TERRAIN) 972centroid_pos=a_centroid_pos; 973#endif 974float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos; 975#ifdef TERRAIN 976bool 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); 977#else 978h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h); 979#endif 980#ifdef PROJECTION_GLOBE_VIEW 981float 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); 982#endif 983float cutoff=1.0;vec3 scaled_pos=pos; 984#ifdef RENDER_CUTOFF 985vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale); 986#endif 987float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0)); 988#ifdef RENDER_WALL_MODE 989vec2 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; 990#endif 991gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h; 992#ifdef RENDER_SHADOWS 993vec3 shd_pos0=pos;vec3 shd_pos1=pos; 994#ifdef NORMAL_OFFSET 995vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 996#endif 997v_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); 998#endif 999float NdotL=0.0;float colorvalue=0.0; 1000#ifndef LIGHTING_3D_MODE 1001colorvalue=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*=( 1002(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 1003#endif 1004#ifdef FAUX_AO
1005float 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; 1006#ifdef TERRAIN 1007top_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); 1008#endif 1009v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); 1010#ifdef PROJECTION_GLOBE_VIEW 1011top_height+=u_height_lift; 1012#endif 1013gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 1014#endif 1015#ifdef LIGHTING_3D_MODE 1016#ifdef FLOOD_LIGHT 1017float 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; 1018#endif 1019v_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); 1020#else 1021v_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; 1022#endif 1023#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 1024float 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; 1025#endif 1026#ifdef FOG 1027v_fog_pos=fog_position(pos); 1028#endif 1029}`),fillExtrusionDepth:Jt(`in highp float v_depth;void main() { 1030#ifndef DEPTH_TEXTURE 1031glFragColor=pack_depth(v_depth); 1032#endif 1033}`,`#include "_prelude_terrain.vertex.glsl" 1034uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale; 1035#ifdef TERRAIN 1036uniform int u_height_type;uniform int u_base_type; 1037#endif 1038in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; 1039#ifdef RENDER_WALL_MODE 1040in vec3 a_join_normal_inside; 1041#endif 1042#pragma mapbox: define highp float base 1043#pragma mapbox: define highp float height 1044#pragma mapbox: define highp float line_width 1045#pragma mapbox: define highp vec4 color 1046out highp float v_depth;void main() { 1047#pragma mapbox: initialize highp float base 1048#pragma mapbox: initialize highp float height 1049#pragma mapbox: initialize highp float line_width 1050#pragma mapbox: initialize highp vec4 color 1051base*=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); 1052#if defined(HAS_CENTROID) || defined(TERRAIN) 1053centroid_pos=a_centroid_pos; 1054#endif 1055vec3 pos; 1056#ifdef TERRAIN 1057bool 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); 1058#else 1059pos=vec3(pos_nx.xy,t > 0.0 ? height : base); 1060#endif 1061#ifdef RENDER_WALL_MODE 1062vec2 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; 1063#endif 1064float 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" 1065#include "_prelude_lighting.glsl" 1066uniform vec2 u_texsize;uniform sampler2D u_image; 1067#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1068uniform float u_pattern_transition; 1069#endif 1070#ifdef FAUX_AO 1071uniform lowp vec2 u_ao;in vec3 v_ao; 1072#endif 1073#ifdef LIGHTING_3D_MODE 1074in vec3 v_normal; 1075#endif 1076in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity; 1077#pragma mapbox: define highp float base 1078#pragma mapbox: define highp float height 1079#pragma mapbox: define mediump vec4 pattern 1080#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1081#pragma mapbox: define mediump vec4 pattern_b 1082#endif 1083#pragma mapbox: define highp float pixel_ratio 1084void main() { 1085#pragma mapbox: initialize highp float base 1086#pragma mapbox: initialize highp float height 1087#pragma mapbox: initialize mediump vec4 pattern 1088#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1089#pragma mapbox: initialize mediump vec4 pattern_b 1090#endif 1091#pragma mapbox: initialize highp float pixel_ratio 1092vec2 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); 1093#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1094vec2 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; 1095#endif 1096#ifdef LIGHTING_3D_MODE 1097out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity; 1098#else 1099out_color=out_color*v_lighting; 1100#endif 1101#ifdef FAUX_AO 1102float 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
1102),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; 1103#endif 1104#ifdef FOG 1105out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1106#endif 1107#ifdef INDICATOR_CUTOUT 1108out_color=applyCutout(out_color,height); 1109#endif 1110glFragColor=out_color; 1111#ifdef OVERDRAW_INSPECTOR 1112glFragColor=vec4(1.0); 1113#endif 1114HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1115#include "_prelude_terrain.vertex.glsl" 1116#include "_prelude_lighting.glsl" 1117uniform 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; 1118#ifdef RENDER_WALL_MODE 1119in vec3 a_join_normal_inside; 1120#endif 1121#ifdef PROJECTION_GLOBE_VIEW 1122in 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; 1123#endif 1124#ifdef TERRAIN 1125uniform int u_height_type;uniform int u_base_type; 1126#endif 1127out highp vec2 v_pos;out vec4 v_lighting; 1128#ifdef FAUX_AO 1129uniform lowp vec2 u_ao;out vec3 v_ao; 1130#endif 1131#ifdef LIGHTING_3D_MODE 1132out vec3 v_normal; 1133#endif 1134#pragma mapbox: define highp float base 1135#pragma mapbox: define highp float height 1136#pragma mapbox: define highp vec4 color 1137#pragma mapbox: define mediump vec4 pattern 1138#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1139#pragma mapbox: define mediump vec4 pattern_b 1140#endif 1141#pragma mapbox: define highp float pixel_ratio 1142#pragma mapbox: define highp float line_width 1143void main() { 1144#pragma mapbox: initialize highp float base 1145#pragma mapbox: initialize highp float height 1146#pragma mapbox: initialize highp vec4 color 1147#pragma mapbox: initialize mediump vec4 pattern 1148#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1149#pragma mapbox: initialize mediump vec4 pattern_b 1150#endif 1151#pragma mapbox: initialize highp float pixel_ratio 1152#pragma mapbox: initialize highp float line_width 1153vec2 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); 1154#if defined(HAS_CENTROID) || defined(TERRAIN) 1155centroid_pos=a_centroid_pos; 1156#endif 1157float ele=0.0;float h=z;vec3 p;float c_ele; 1158#ifdef TERRAIN 1159bool 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); 1160#else 1161p=vec3(pos_nx.xy,z); 1162#endif 1163#ifdef PROJECTION_GLOBE_VIEW 1164float 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); 1165#endif 1166#ifdef RENDER_WALL_MODE 1167vec2 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; 1168#endif 1169float 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 1170? pos_nx.xy 1171: 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; 1172#ifdef LIGHTING_3D_MODE 1173NdotL=calculate_NdotL(normal); 1174#else 1175NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); 1176#endif 1177if (normal.y !=0.0) {float r=0.84; 1178#ifndef LIGHTING_3D_MODE 1179r=mix(0.7,0.98,1.0-u_lightintensity); 1180#endif 1181NdotL*=( 1182(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 1183#ifdef FAUX_AO
1184float 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; 1185#ifdef TERRAIN 1186top_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); 1187#endif 1188v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); 1189#ifdef PROJECTION_GLOBE_VIEW 1190top_height+=u_height_lift; 1191#endif 1192gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 1193#endif 1194#ifdef LIGHTING_3D_MODE 1195v_normal=normal; 1196#else 1197v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; 1198#endif 1199#ifdef FOG 1200v_fog_pos=fog_position(p); 1201#endif 1202}`),groundShadow:Jt(`#include "_prelude_shadow.fragment.glsl" 1203precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 1204#ifdef FOG 1205in float v_fog_opacity; 1206#endif 1207void 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); 1208#ifdef RENDER_CUTOFF 1209shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w)); 1210#endif 1211#ifdef FOG 1212shadow=mix(shadow,vec3(1.0),v_fog_opacity); 1213#endif 1214#ifdef INDICATOR_CUTOUT 1215shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r); 1216#endif 1217glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl" 1218uniform 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; 1219#ifdef FOG 1220out float v_fog_opacity; 1221#endif 1222void 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); 1223#ifdef FOG 1224v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos); 1225#endif 1226}`),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; 1227#ifdef SDF_SUBPASS 1228in 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);} 1229#ifdef FOG 1230in highp float v_fog; 1231#endif 1232#endif 1233void main() { 1234#ifdef CLEAR_SUBPASS 1235vec4 color=vec4(1.0); 1236#ifdef CLEAR_FROM_TEXTURE 1237color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)); 1238#endif 1239glFragColor=color; 1240#else 1241#ifdef SDF_SUBPASS 1242highp 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; 1243#ifdef FOG 1244fog=v_fog; 1245#endif 1246#ifdef RENDER_CUTOFF 1247fog*=v_cutoff_opacity; 1248#endif 1249glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog)); 1250#else 1251vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass); 1252#ifdef OVERDRAW_INSPECTOR 1253color=vec4(1.0); 1254#endif 1255glFragColor=color; 1256#endif 1257HANDLE_WIREFRAME_DEBUG; 1258#endif 1259}`,`#include "_prelude_fog.vertex.glsl" 1260in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark; 1261#ifdef SDF_SUBPASS 1262out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao; 1263#ifdef FOG 1264out highp float v_fog; 1265#endif 1266#endif 1267uniform 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; 1268#pragma mapbox: define highp float flood_light_ground_radius 1269const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
1270#pragma mapbox: initialize highp float flood_light_ground_radius 1271vec2 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; 1272#ifdef SDF_SUBPASS 1273v_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); 1274#ifdef FOG 1275v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos); 1276#endif 1277#endif 1278float hidden_by_landmark=0.0; 1279#ifdef HAS_CENTROID 1280hidden_by_landmark=a_hidden_by_landmark; 1281#endif 1282float 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)); 1283#ifdef RENDER_CUTOFF 1284v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 1285#endif 1286}`),hillshadePrepare:Jt(`precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2( 1287(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c) 1288)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4( 1289deriv.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" 1290#include "_prelude_lighting.glsl" 1291uniform 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; 1292#ifdef LIGHTING_3D_MODE 1293glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength); 1294#endif 1295#ifdef FOG 1296glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos)); 1297#endif 1298#ifdef OVERDRAW_INSPECTOR 1299glFragColor=vec4(1.0); 1300#endif 1301HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1302uniform 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; 1303#ifdef FOG 1304v_fog_pos=fog_position(a_pos); 1305#endif 1306}`),line:Jt(`#include "_prelude_fog.fragment.glsl" 1307#include "_prelude_lighting.glsl" 1308#include "_prelude_shadow.fragment.glsl" 1309uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;
1309uniform 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; 1310#ifdef ELEVATED_ROADS 1311in highp float v_road_z_offset; 1312#endif 1313#ifdef RENDER_LINE_DASH 1314uniform sampler2D u_dash_image;in vec2 v_tex; 1315#endif 1316#ifdef RENDER_LINE_GRADIENT 1317uniform sampler2D u_gradient_image; 1318#endif 1319#ifdef INDICATOR_CUTOUT 1320in highp float v_z_offset; 1321#endif 1322#ifdef RENDER_SHADOWS 1323uniform 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; 1324#endif 1325float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength; 1326#pragma mapbox: define highp vec4 color 1327#pragma mapbox: define lowp float floorwidth 1328#pragma mapbox: define lowp vec4 dash 1329#pragma mapbox: define lowp float blur 1330#pragma mapbox: define lowp float opacity 1331#pragma mapbox: define lowp float border_width 1332#pragma mapbox: define lowp vec4 border_color 1333float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { 1334#pragma mapbox: initialize highp vec4 color 1335#pragma mapbox: initialize lowp float floorwidth 1336#pragma mapbox: initialize lowp vec4 dash 1337#pragma mapbox: initialize lowp float blur 1338#pragma mapbox: initialize lowp float opacity 1339#pragma mapbox: initialize lowp float border_width 1340#pragma mapbox: initialize lowp vec4 border_color 1341float 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); 1342#ifdef RENDER_LINE_DASH 1343float sdfdist=texture(u_dash_image,v_tex).r;
1343float 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); 1344#endif 1345highp vec4 out_color; 1346#ifdef RENDER_LINE_GRADIENT 1347out_color=texture(u_gradient_image,v_uv.xy); 1348#else 1349out_color=color; 1350#endif 1351float trim_alpha=1.0; 1352#ifdef RENDER_LINE_TRIM_OFFSET 1353highp 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;} 1354#endif 1355if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}} 1356#ifdef RENDER_LINE_BORDER 1357float 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);}} 1358#endif 1359#ifdef LIGHTING_3D_MODE 1360out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 1361#ifdef RENDER_SHADOWS 1362float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 1363#ifdef ELEVATED_ROADS 1364out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1365#else 1366out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1367#endif 1368#endif 1369#endif 1370#ifdef FOG 1371out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1372#endif 1373out_color*=(alpha*opacity); 1374#ifdef INDICATOR_CUTOUT 1375out_color=applyCutout(out_color,v_z_offset); 1376#endif 1377glFragColor=out_color; 1378#ifdef OVERDRAW_INSPECTOR 1379glFragColor=vec4(1.0); 1380#endif 1381HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1382#include "_prelude_shadow.vertex.glsl" 1383#include "_prelude_terrain.vertex.glsl" 1384#define EXTRUDE_SCALE 0.015873016 1385in vec2 a_pos_normal;in vec4 a_data; 1386#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) 1387in vec3 a_z_offset_width; 1388#endif 1389#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1390in highp vec3 a_packed; 1391#endif 1392#ifdef RENDER_LINE_DASH 1393in float a_linesofar; 1394#endif 1395uniform 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; 1396#ifdef ELEVATED 1397uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 1398#ifdef ELEVATION_REFERENCE_SEA 1399return 0.0; 1400#else 1401return elevation(apos); 1402#endif 1403} 1404#endif 1405out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv; 1406#ifdef ELEVATED_ROADS 1407out highp float v_road_z_offset; 1408#endif 1409#ifdef RENDER_LINE_DASH 1410uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex; 1411#endif 1412#ifdef RENDER_LINE_GRADIENT 1413uniform float u_image_height; 1414#endif 1415#ifdef INDICATOR_CUTOUT 1416out highp float v_z_offset; 1417#endif 1418#ifdef RENDER_SHADOWS 1419uniform 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; 1420#endif 1421#pragma mapbox: define highp vec4 color 1422#pragma mapbox: define lowp float floorwidth 1423#pragma mapbox: define lowp vec4 dash 1424#pragma mapbox: define lowp float blur 1425#pragma mapbox: define lowp float opacity 1426#pragma mapbox: define mediump float gapwidth 1427#pragma mapbox: define lowp float offset 1428#pragma mapbox: define mediump float width 1429#pragma mapbox: define lowp float border_width 1430#pragma mapbox: define lowp vec4 border_color 1431void main() { 1432#pragma mapbox: initialize highp vec4 color 1433#pragma mapbox: initialize lowp float floorwidth 1434#pragma mapbox: initialize lowp vec4 dash 1435#pragma mapbox: initialize lowp float blur 1436#pragma mapbox: initialize lowp float opacity 1437#pragma mapbox: initialize mediump float gapwidth 1438#pragma mapbox: initialize lowp float offset 1439#pragma mapbox: initialize mediump float width 1440#pragma mapbox: initialize lowp float border_width 1441#pragma mapbox: initialize lowp vec4 border_color 1442float a_z_offset; 1443#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1444a_z_offset=a_z_offset_width.x; 1445#endif 1446float 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; 1447#ifdef VARIABLE_LINE_WIDTH 1448float left=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);halfwidth=(u_width_scale*(left==1.0 ? a_z_offset_width.y : a_z_offset_width.z))/2.0; 1449#else 1450halfwidth=(u_width_scale*width)/2.0; 1451#endif 1452offset=-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;
1452vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 1453#ifdef ELEVATED_ROADS 1454v_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; 1455#else 1456#ifdef ELEVATED 1457vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; 1458#ifdef CROSS_SLOPE_VERTICAL 1459float 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); 1460#else 1461#ifdef CROSS_SLOPE_HORIZONTAL 1462float 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; 1463#else 1464float 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; 1465#endif 1466#endif 1467gl_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); 1468#else 1469gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); 1470#endif 1471#endif 1472#ifdef ELEVATED_ROADS 1473#ifdef RENDER_SHADOWS 1474vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 1475#ifdef NORMAL_OFFSET 1476vec3 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(); 1477#endif 1478v_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; 1479#endif 1480#endif 1481#ifndef RENDER_TO_TEXTURE 1482float 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)); 1483#else 1484v_gamma_scale=1.0; 1485#endif 1486#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1487highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2]; 1488#ifdef RENDER_LINE_GRADIENT 1489highp 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); 1490#else 1491v_uv=vec3(a_uv_x,0.0,line_progress); 1492#endif 1493#endif 1494#ifdef RENDER_LINE_DASH 1495float 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); 1496#endif 1497v_width2=vec2(outset,inset); 1498#ifdef FOG 1499v_fog_pos=fog_position(pos); 1500#endif 1501#ifdef INDICATOR_CUTOUT 1502v_z_offset=a_z_offset; 1503#endif 1504}`),linePattern:Jt(`#include "_prelude_fog.fragment.glsl" 1505#include "_prelude_lighting.glsl" 1506#include "_prelude_shadow.fragment.glsl" 1507uniform 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; 1508#ifdef LINE_PATTERN_TRANSITION 1509uniform float u_pattern_transition; 1510#endif 1511in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width; 1512#ifdef RENDER_LINE_TRIM_OFFSET 1513in highp vec3 v_uv; 1514#endif 1515#ifdef ELEVATED_ROADS 1516in highp float v_road_z_offset; 1517#endif 1518#ifdef LINE_JOIN_NONE 1519in vec2 v_pattern_data; 1520#endif 1521#ifdef INDICATOR_CUTOUT 1522in highp float v_z_offset; 1523#endif 1524#ifdef RENDER_SHADOWS 1525uniform 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; 1526#endif 1527uniform float u_emissive_strength; 1528#pragma mapbox: define mediump vec4 pattern 1529#ifdef LINE_PATTERN_TRANSITION 1530#pragma mapbox: define mediump vec4 pattern_b 1531#endif 1532#pragma mapbox: define mediump float pixel_ratio 1533#pragma mapbox: define mediump float blur 1534#pragma mapbox: define mediump float opacity 1535void main() { 1536#pragma mapbox: initialize mediump vec4 pattern 1537#ifdef LINE_PATTERN_TRANSITION 1538#pragma mapbox: initialize mediump vec4 pattern_b 1539#endif 1540#pragma mapbox: initialize mediump float pixel_ratio 1541#pragma mapbox: initialize mediump float blur 1542#pragma mapbox: initialize mediump float opacity 1543vec2 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); 1544#ifdef LINE_PATTERN_TRANSITION 1545vec2 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; 1546#endif 1547#ifdef RENDER_LINE_TRIM_OFFSET 1548highp 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);} 1549#endif 1550#ifdef LINE_JOIN_NONE 1551highp 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);} 1552#endif 1553#ifdef LIGHTING_3D_MODE 1554color=apply_lighting_with_emission_ground(color,u_emissive_strength); 1555#ifdef RENDER_SHADOWS 1556float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 1557#ifdef ELEVATED_ROADS 1558color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1559#else 1560color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1561#endif 1562#endif 1563#endif 1564#ifdef FOG 1565color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 1566#endif 1567color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}} 1568#ifdef INDICATOR_CUTOUT 1569color=applyCutout(color,v_z_offset); 1570#endif 1571glFragColor=color; 1572#ifdef OVERDRAW_INSPECTOR 1573glFragColor=vec4(1.0); 1574#endif 1575HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1576#include "_prelude_shadow.vertex.glsl" 1577#include "_prelude_terrain.vertex.glsl" 1578#define scale 0.015873016 1579in vec2 a_pos_normal;in vec4 a_data; 1580#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1581in vec3 a_z_offset_width; 1582#endif 1583#ifdef RENDER_LINE_TRIM_OFFSET 1584in highp vec3 a_packed; 1585#endif 1586in highp float a_linesofar; 1587#ifdef LINE_JOIN_NONE 1588in highp vec3 a_pattern_data;out vec2 v_pattern_data; 1589#endif 1590#ifdef INDICATOR_CUTOUT 1591out highp float v_z_offset; 1592#endif 1593uniform 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; 1594#ifdef ELEVATED 1595uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 1596#ifdef ELEVATION_REFERENCE_SEA 1597return 0.0; 1598#else 1599return elevation(apos); 1600#endif 1601} 1602#endif 1603out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width; 1604#ifdef RENDER_LINE_TRIM_OFFSET 1605out highp vec3 v_uv; 1606#endif 1607#ifdef ELEVATED_ROADS 1608out highp float v_road_z_offset; 1609#endif 1610#ifdef RENDER_SHADOWS 1611uniform 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; 1612#endif 1613#pragma mapbox: define mediump float blur 1614#pragma mapbox: define mediump float opacity 1615#pragma mapbox: define mediump float offset 1616#pragma mapbox: define mediump float gapwidth 1617#pragma mapbox: define mediump float width 1618#pragma mapbox: define mediump float floorwidth 1619#pragma mapbox: define mediump vec4 pattern 1620#ifdef LINE_PATTERN_TRANSITION 1621#pragma mapbox: define mediump vec4 pattern_b 1622#endif 1623#pragma mapbox: define mediump float pixel_ratio 1624void main() { 1625#pragma mapbox: initialize mediump float blur 1626#pragma mapbox: initialize mediump float opacity 1627#pragma mapbox: initialize mediump float offset 1628#pragma mapbox: initialize mediump float gapwidth 1629#pragma mapbox: initialize mediump float width 1630#pragma mapbox: initialize mediump float floorwidth 1631#pragma mapbox: initialize mediump vec4 pattern 1632#ifdef LINE_PATTERN_TRANSITION 1633#pragma mapbox: initialize mediump vec4 pattern_b 1634#endif 1635#pragma mapbox: initialize mediump float pixel_ratio 1636float a_z_offset; 1637#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1638a_z_offset=a_z_offset_width.x; 1639#endif 1640float 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;
1640vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 1641#ifdef ELEVATED_ROADS 1642v_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; 1643#else 1644#ifdef ELEVATED 1645vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; 1646#ifdef CROSS_SLOPE_VERTICAL 1647float 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); 1648#else 1649#ifdef CROSS_SLOPE_HORIZONTAL 1650float 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; 1651#else 1652float 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; 1653#endif 1654#endif 1655gl_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); 1656#else 1657gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); 1658#endif 1659#endif 1660#ifdef ELEVATED_ROADS 1661#ifdef RENDER_SHADOWS 1662vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 1663#ifdef NORMAL_OFFSET 1664vec3 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(); 1665#endif 1666v_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; 1667#endif 1668#endif 1669#ifndef RENDER_TO_TEXTURE 1670float 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)); 1671#else 1672v_gamma_scale=1.0; 1673#endif 1674#ifdef RENDER_LINE_TRIM_OFFSET 1675highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress); 1676#endif 1677v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale); 1678#ifdef LINE_JOIN_NONE 1679v_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); 1680#endif 1681#ifdef FOG 1682v_fog_pos=fog_position(pos); 1683#endif 1684#ifdef INDICATOR_CUTOUT 1685v_z_offset=a_z_offset; 1686#endif 1687}`),raster:Jt(`#include "_prelude_fog.fragment.glsl" 1688#include "_prelude_lighting.glsl" 1689#include "_prelude_raster_array.glsl" 1690uniform 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; 1691#ifdef PROJECTION_GLOBE_VIEW 1692in float v_split_fade; 1693#endif 1694uniform 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; 1695#ifndef RASTER_ARRAY 1696uniform highp sampler2D u_image0;uniform sampler2D u_image1; 1697#endif 1698#ifdef RASTER_COLOR 1699uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res; 1700#endif 1701void main() {vec4 color0,color1,color;vec2 value; 1702#ifdef RASTER_COLOR 1703#ifdef RASTER_ARRAY 1704#ifdef RASTER_ARRAY_LINEAR 1705value=mix( 1706raTexture2D_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 1707); 1708#else 1709value=mix( 1710raTexture2D_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 1711); 1712#endif 1713if (value.y > 0.0) value.x/=value.y; 1714#else 1715color=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); 1716#endif 1717color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y; 1718#else 1719color0=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); 1720#endif 1721color.a*=u_opacity; 1722#ifdef GLOBE_POLES 1723color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition); 1724#endif 1725vec3 rgb=color.rgb;rgb=vec3( 1726dot(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); 1727#ifdef LIGHTING_3D_MODE 1728out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb; 1729#endif 1730#ifdef FOG 1731highp 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)); 1732#endif 1733glFragColor=vec4(out_color*color.a,color.a); 1734#ifdef PROJECTION_GLOBE_VIEW 1735glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade)); 1736#endif 1737#ifdef RENDER_CUTOFF 1738glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth); 1739#endif 1740#ifdef OVERDRAW_INSPECTOR 1741glFragColor=vec4(1.0); 1742#endif 1743HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1744uniform 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; 1745#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 1746#ifdef GLOBE_POLES 1747in vec3 a_globe_pos;in vec2 a_uv; 1748#else 1749in vec2 a_pos;in vec2 a_texture_pos; 1750#endif 1751out vec2 v_pos0;out vec2 v_pos1;out float v_depth; 1752#ifdef PROJECTION_GLOBE_VIEW 1753out float v_split_fade; 1754#endif 1755void main() {vec2 uv; 1756#ifdef GLOBE_POLES 1757vec3 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; 1758#ifdef FOG 1759v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz); 1760#endif 1761#else 1762float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0; 1763#ifdef PROJECTION_GLOBE_VIEW 1764vec3 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]); 1765v_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];
1765if (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; 1766#ifdef FOG 1767v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 1768#endif 1769#else 1770gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); 1771#ifdef FOG 1772v_fog_pos=fog_position(a_pos); 1773#endif 1774#endif 1775#endif 1776v_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; 1777#ifdef RENDER_CUTOFF 1778v_depth=gl_Position.z; 1779#endif 1780}`),rasterParticle:Jt(`#include "_prelude_fog.fragment.glsl" 1781#include "_prelude_lighting.glsl" 1782uniform 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; 1783#ifdef LIGHTING_3D_MODE 1784out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb; 1785#endif 1786#ifdef FOG 1787highp 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)); 1788#endif 1789glFragColor=vec4(out_color*color.a,color.a); 1790#ifdef OVERDRAW_INSPECTOR 1791glFragColor=vec4(1.0); 1792#endif 1793HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1794uniform 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; 1795#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 1796in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv; 1797#ifdef PROJECTION_GLOBE_VIEW 1798vec3 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; 1799#ifdef FOG 1800v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 1801#endif 1802#else 1803uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); 1804#ifdef FOG 1805v_fog_pos=fog_position(a_pos); 1806#endif 1807#endif 1808v_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" 1809in 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( 1810mod(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" 1811uniform 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;
1811vec2 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( 1812linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4) 1813);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" 1814#include "_prelude_shadow.fragment.glsl" 1815#define SDF_PX 8.0 1816#define SDF 1.0 1817#define ICON 0.0 1818uniform 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; 1819#ifdef ICON_TRANSITION 1820uniform float u_icon_transition; 1821#endif 1822#ifdef COLOR_ADJUSTMENT 1823uniform mat4 u_color_adj_mat; 1824#endif 1825#ifdef INDICATOR_CUTOUT 1826in highp float v_z_offset; 1827#else 1828#ifdef Z_OFFSET 1829#ifdef RENDER_SHADOWS 1830in highp float v_z_offset; 1831#endif 1832#endif 1833#endif 1834in vec2 v_tex_a; 1835#ifdef ICON_TRANSITION 1836in vec2 v_tex_b; 1837#endif 1838in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity; 1839#ifdef RENDER_TEXT_AND_SYMBOL 1840in float is_sdf;in vec2 v_tex_a_icon; 1841#endif 1842#ifdef Z_OFFSET 1843#ifdef RENDER_SHADOWS 1844uniform 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; 1845#endif 1846#endif 1847#pragma mapbox: define highp vec4 fill_color 1848#pragma mapbox: define highp vec4 halo_color 1849#pragma mapbox: define lowp float opacity 1850#pragma mapbox: define lowp float halo_width 1851#pragma mapbox: define lowp float halo_blur 1852#pragma mapbox: define lowp float emissive_strength 1853void main() { 1854#pragma mapbox: initialize highp vec4 fill_color 1855#pragma mapbox: initialize highp vec4 halo_color 1856#pragma mapbox: initialize lowp float opacity 1857#pragma mapbox: initialize lowp float halo_width 1858#pragma mapbox: initialize lowp float halo_blur 1859#pragma mapbox: initialize lowp float emissive_strength 1860vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2]; 1861#ifdef RENDER_TEXT_AND_SYMBOL 1862if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha; 1863#ifdef OVERDRAW_INSPECTOR 1864glFragColor=vec4(1.0); 1865#endif 1866return;} 1867#endif 1868#ifdef RENDER_SDF 1869float 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; 1870#else 1871#ifdef ICON_TRANSITION 1872vec4 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); 1873#else 1874out_color=texture(u_texture,v_tex_a); 1875#endif 1876#ifdef COLOR_ADJUSTMENT 1877out_color=u_color_adj_mat*out_color; 1878#endif 1879#endif 1880out_color*=opacity*fade_opacity; 1881#ifdef LIGHTING_3D_MODE 1882out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); 1883#ifdef Z_OFFSET 1884#ifdef RENDER_SHADOWS 1885float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1886#endif 1887#endif 1888#endif 1889#ifdef INDICATOR_CUTOUT 1890out_color=applyCutout(out_color,v_z_offset); 1891#endif 1892glFragColor=out_color; 1893#ifdef OVERDRAW_INSPECTOR 1894glFragColor=vec4(1.0); 1895#endif 1896HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 1897#include "_prelude_shadow.vertex.glsl" 1898in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; 1899#ifdef Z_OFFSET 1900in float a_auto_z_offset; 1901#endif 1902#ifdef PROJECTION_GLOBE_VIEW 1903in vec3 a_globe_anchor;in vec3 a_globe_normal; 1904#endif 1905#ifdef ICON_TRANSITION 1906in vec2 a_texb; 1907#endif 1908#ifdef OCCLUSION_QUERIES 1909in float a_occlusion_query_opacity; 1910#endif 1911#ifdef ELEVATED_ROADS 1912in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale; 1913#endif 1914#ifdef INDICATOR_CUTOUT 1915out highp float v_z_offset; 1916#else 1917#ifdef Z_OFFSET 1918#ifdef RENDER_SHADOWS 1919out highp float v_z_offset; 1920#endif 1921#endif 1922#endif 1923uniform 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; 1924#ifdef PROJECTION_GLOBE_VIEW 1925uniform 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; 1926#endif 1927out vec2 v_tex_a; 1928#ifdef ICON_TRANSITION 1929out vec2 v_tex_b; 1930#endif 1931out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity; 1932#ifdef RENDER_TEXT_AND_SYMBOL 1933out float is_sdf;out vec2 v_tex_a_icon; 1934#endif 1935#ifdef Z_OFFSET 1936#ifdef RENDER_SHADOWS 1937uniform 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; 1938#endif 1939#endif 1940#pragma mapbox: define highp vec4 fill_color 1941#pragma mapbox: define highp vec4 halo_color 1942#pragma mapbox: define lowp float opacity 1943#pragma mapbox: define lowp float halo_width 1944#pragma mapbox: define lowp float halo_blur 1945#pragma mapbox: define lowp float emissive_strength 1946#pragma mapbox: define lowp float occlusion_opacity 1947#pragma mapbox: define lowp float z_offset 1948void main() { 1949#pragma mapbox: initialize highp vec4 fill_color 1950#pragma mapbox: initialize highp vec4 halo_color 1951#pragma mapbox: initialize lowp float opacity 1952#pragma mapbox: initialize lowp float halo_width 1953#pragma mapbox: initialize lowp float halo_blur 1954#pragma mapbox: initialize lowp float emissive_strength 1955#pragma mapbox: initialize lowp float occlusion_opacity 1956#pragma mapbox: initialize lowp float z_offset 1957vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor); 1958#ifdef Z_OFFSET 1959e+=a_auto_z_offset; 1960#endif 1961vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; 1962#ifdef PROJECTION_GLOBE_VIEW 1963mercator_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; 1964#else 1965world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; 1966#endif 1967vec4 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 ? 1968camera_to_anchor_distance/u_camera_to_center_distance : 1969u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 19700.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; 1971#ifdef PROJECTION_GLOBE_VIEW 1972vec3 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; 1973#else 1974offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; 1975#endif 1976vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; 1977#ifdef PROJECTION_GLOBE_VIEW 1978#ifdef PROJECTED_POS_ON_VIEWPORT 1979projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0); 1980#else 1981vec3 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); 1982#endif 1983#else 1984projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); 1985#endif 1986highp 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); 1987#ifdef TERRAIN 1988#ifdef PITCH_WITH_MAP_TERRAIN 1989vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); 1990#endif 1991#endif 1992#ifdef Z_OFFSET 1993z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0; 1994#else 1995z+=u_pitch_with_map ? z_offset : 0.0; 1996#endif 1997float 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)); 1998#ifdef DEPTH_OCCLUSION 1999float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier; 2000#endif 2001#ifdef OCCLUSION_QUERIES 2002float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; 2003#endif 2004float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos; 2005#ifdef PROJECTION_GLOBE_VIEW 2006vec3 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; 2007#else 2008#ifdef ELEVATED_ROADS 2009vec3 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; 2010#else 2011pos=vec3(projected_pos.xy/projected_pos.w+offset,z); 2012#endif 2013#endif 2014gl_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; 2015#ifdef RENDER_TEXT_AND_SYMBOL 2016is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon; 2017#endif 2018#ifdef ICON_TRANSITION 2019v_tex_b=a_texb/u_texsize; 2020#endif 2021#ifdef Z_OFFSET 2022#ifdef RENDER_SHADOWS 2023vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz; 2024#ifdef NORMAL_OFFSET 2025vec3 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(); 2026#endif 2027v_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; 2028#endif 2029#endif 2030#ifdef INDICATOR_CUTOUT 2031v_z_offset=e; 2032#else 2033#ifdef Z_OFFSET 2034#ifdef RENDER_SHADOWS 2035v_z_offset=e; 2036#endif 2037#endif 2038#endif 2039}`),terrainRaster:Jt(`#include "_prelude_fog.fragment.glsl" 2040#include "_prelude_shadow.fragment.glsl" 2041#include "_prelude_lighting.glsl" 2042uniform sampler2D u_image0;in vec2 v_pos0; 2043#ifdef FOG 2044in float v_fog_opacity; 2045#endif 2046#ifdef RENDER_SHADOWS 2047in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 2048#endif 2049uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color; 2050#ifdef LIGHTING_3D_MODE 2051const vec3 normal=vec3(0.0,0.0,1.0); 2052#ifdef RENDER_SHADOWS 2053float cutoffOpacity=1.0; 2054#ifdef RENDER_CUTOFF 2055cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w); 2056#endif 2057#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2058vec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0; 2059#else 2060float 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)); 2061#endif 2062#else 2063float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor); 2064#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2065color.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0; 2066#endif 2067#endif 2068#else 2069color=image_color; 2070#endif 2071#ifdef FOG 2072#ifdef ZERO_EXAGGERATION 2073color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 2074#else 2075color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); 2076#endif 2077#endif 2078glFragColor=color; 2079#ifdef OVERDRAW_INSPECTOR 2080glFragColor=vec4(1.0); 2081#endif 2082HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2083#include "_prelude_terrain.vertex.glsl" 2084uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0; 2085#ifdef FOG 2086out float v_fog_opacity; 2087#endif 2088#ifdef RENDER_SHADOWS 2089uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth; 2090#endif 2091void 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); 2092#ifdef FOG 2093#ifdef ZERO_EXAGGERATION 2094v_fog_pos=fog_position(decodedPos); 2095#else 2096v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); 2097#endif 2098#endif 2099#ifdef RENDER_SHADOWS 2100vec3 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.); 2101#endif 2102}`),terrainDepth:Jt("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl" 2103uniform 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" 2104in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3
2104 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( 2105cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb; 2106#ifdef FOG 2107sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); 2108#endif 2109sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity); 2110#ifdef OVERDRAW_INSPECTOR 2111glFragColor=vec4(1.0); 2112#endif 2113}`,ma),skyboxGradient:Jt(`#include "_prelude_fog.fragment.glsl" 2114in 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)); 2115#ifdef FOG 2116color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; 2117#endif 2118color*=u_opacity;glFragColor=color; 2119#ifdef OVERDRAW_INSPECTOR 2120glFragColor=vec4(1.0); 2121#endif 2122}`,ma),skyboxCapture:Jt
vendor: 3,792 bytes, lines 2122-2133
2122(` 2123in 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; 2124#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) 2125#define BETA_M vec3(21e-6,21e-6,21e-6) 2126#define MIE_G 0.76 2127#define DENSITY_HEIGHT_SCALE_R 8000.0 2128#define DENSITY_HEIGHT_SCALE_M 1200.0 2129#define PLANET_RADIUS 6360e3 2130#define ATMOSPHERE_RADIUS 6420e3 2131#define SAMPLE_STEPS 10 2132#define DENSITY_STEPS 4 2133float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globe
2133Raster:Jt(`#include "_prelude_fog.fragment.glsl" 2134#include "_prelude_lighting.glsl" 2135uniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0; 2136#ifndef FOG 2137uniform 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; 2138#endif 2139void main() {vec4 color; 2140#ifdef CUSTOM_ANTIALIASING 2141highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( 2142mix(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); 2143#ifdef LIGHTING_3D_MODE 2144#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2145raster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias); 2146#else 2147raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias); 2148#endif 2149#else 2150color=vec4(raster.rgb*antialias,raster.a*antialias); 2151#endif 2152#else 2153color=texture(u_image0,v_pos0); 2154#ifdef LIGHTING_3D_MODE 2155#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2156color=apply_lighting_with_emission_ground(color,color.a);color.a=1.0; 2157#else 2158color=apply_lighting_ground(color); 2159#endif 2160#endif 2161#endif 2162#ifdef FOG 2163color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 2164#endif 2165color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color; 2166#ifdef OVERDRAW_INSPECTOR 2167glFragColor=vec4(1.0); 2168#endif 2169HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2170#include "_prelude_terrain.vertex.glsl" 2171uniform 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; 2172#ifdef GLOBE_POLES 2173in vec3 a_globe_pos;in vec2 a_uv; 2174#else 2175in vec2 a_pos; 2176#endif 2177out vec2 v_pos0;void main() { 2178#ifdef GLOBE_POLES 2179vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; 2180#else 2181float 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); 2182#endif 2183v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; 2184#ifdef GLOBE_POLES 2185vec3 up_vector=globe_derived_up_vector; 2186#else 2187vec3 up_vector=elevationVector(tile_pos); 2188#endif 2189float height=elevation(tile_pos);globe_pos+=up_vector*height; 2190#ifndef GLOBE_POLES 2191globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; 2192#endif 2193#ifdef GLOBE_POLES 2194vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); 2195#else 2196vec4 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); 2197#endif 2198gl_Position=u_proj_matrix*interpolated_pos; 2199#ifdef FOG 2200v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 2201#endif 2202}`),globeAtmosphere:Jt(`#include "_prelude_fog.fragment.glsl" 2203uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir; 2204#ifdef PROJECTION_GLOBE_VIEW 2205globe_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) { 2206#ifdef ALPHA_PASS 2207glFragColor=vec4(0,0,0,0);return; 2208#else 2209#ifdef NATIVE 2210glFragColor=vec4(1,1,1,1); 2211#else 2212glFragColor=vec4(0,0,0,1); 2213#endif 2214return; 2215#endif 2216} 2217#endif 2218highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? 22190.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle; 2220#ifdef PROJECTION_GLOBE_VIEW 2221highp 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 ? 2222PI-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); 2223#else 2224horizon_angle=horizon_angle_mercator; 2225#endif 2226horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;
2226vec3 color_stop_2=u_space_color.rgb; 2227#ifdef ALPHA_PASS 2228float 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); 2229#else 2230vec3 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); 2231#endif 2232}`,`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( 2233mix(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( 2234mix(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" 2235#include "_prelude_shadow.fragment.glsl" 2236#include "_prelude_lighting.glsl" 2237uniform 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; 2238#ifdef RENDER_SHADOWS 2239in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; 2240#endif 2241#ifdef OCCLUSION_TEXTURE_TRANSFORM 2242uniform vec4 u_occlusionTextureTransform; 2243#endif 2244#pragma mapbox: define-attribute highp vec3 normal_3f 2245#pragma mapbox: define-attribute highp vec3 color_3f 2246#pragma mapbox: define-attribute highp vec4 color_4f 2247#pragma mapbox: define-attribute highp vec2 uv_2f 2248#pragma mapbox: initialize-attribute highp vec3 normal_3f 2249#pragma mapbox: initialize-attribute highp vec3 color_3f 2250#pragma mapbox: initialize-attribute highp vec4 color_4f 2251#pragma mapbox: initialize-attribute highp vec2 uv_2f 2252#ifdef HAS_ATTRIBUTE_a_pbr 2253in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params; 2254#endif 2255#ifdef HAS_TEXTURE_u_baseColorTexture 2256uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff; 2257#endif 2258#ifdef HAS_TEXTURE_u_metallicRoughnessTexture 2259uniform sampler2D u_metallicRoughnessTexture; 2260#endif 2261#ifdef HAS_TEXTURE_u_occlusionTexture 2262uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity; 2263#endif 2264#ifdef HAS_TEXTURE_u_normalTexture 2265uniform sampler2D u_normalTexture; 2266#endif 2267#ifdef HAS_TEXTURE_u_emissionTexture 2268uniform sampler2D u_emissionTexture; 2269#endif 2270#ifdef APPLY_LUT_ON_GPU 2271uniform highp sampler3D u_lutTexture; 2272#endif 2273#ifdef TERRAIN_FRAGMENT_OCCLUSION 2274in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack; 2275#ifdef DEPTH_D24 2276highp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;} 2277#else 2278highp float unpack_depth_rgba(highp vec4 rgba_depth) 2279{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;} 2280#endif 2281bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size; 2282#ifdef DEPTH_D24 2283highp float depth=unpack_depth(texture(u_depthTexture,coord).r); 2284#else 2285highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord)); 2286#endif 2287return v_depth > depth+0.0005;} 2288#endif 2289#define saturate(_x) clamp(_x,0.,1.) 2290vec3 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) 2291{ 2292#ifdef LIGHTING_3D_MODE 2293vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor; 2294#ifdef RENDER_SHADOWS 2295lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 2296#else 2297lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir)); 2298#endif 2299return apply_lighting(albedo,transformed_normal,lighting_factor); 2300#else 2301vec3 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
2301Color),vec3(1.0));return c3; 2302#endif 2303}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor; 2304#ifdef HAS_ATTRIBUTE_a_color_3f 2305albedo*=vec4(color_3f,1.0); 2306#endif 2307#ifdef HAS_ATTRIBUTE_a_pbr 2308#else 2309#ifdef HAS_ATTRIBUTE_a_color_4f 2310albedo*=color_4f; 2311#endif 2312#endif 2313#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f) 2314vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}} 2315#ifdef UNPREMULT_TEXTURE_IN_SHADER 2316if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0; 2317#endif 2318if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;} 2319#endif 2320vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a); 2321#ifdef APPLY_LUT_ON_GPU 2322color=applyLUT(u_lutTexture,color); 2323#endif 2324return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) { 2325#ifdef HAS_TEXTURE_u_normalTexture 2326highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res; 2327#else 2328return mat3(1.0); 2329#endif 2330}highp vec3 getNormal(){highp vec3 n; 2331#ifdef HAS_ATTRIBUTE_a_normal_3f 2332n=normalize(normal_3f); 2333#else 2334highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0; 2335#endif 2336#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2337vec3 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); 2338#endif 2339return 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; 2340#ifdef HAS_ATTRIBUTE_a_pbr 2341mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w; 2342#endif 2343#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2344vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b; 2345#endif 2346const 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) 2347{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) 2348{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH) 2349{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) 2350{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) 2351{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) 2352{ 2353#ifdef LIGHTING_3D_MODE 2354return mat.diffuseColor; 2355#else 2356return mat.diffuseColor/PI; 2357#endif 2358}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV) 2359{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) 2360{vec3 env_light=vec3(0.65,0.65,0.65); 2361#ifdef LIGHTING_3D_MODE 2362float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor; 2363#endif 2364vec3 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) 2365{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; 2366#ifdef RENDER_SHADOWS 2367lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 2368#else 2369lighting_factor=NdotL; 2370#endif 2371vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2371Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0; 2372#if !defined(LIGHTING_3D_MODE) 2373const 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); 2374#endif 2375color*=intensityFactor;return color;}void main() { 2376#ifdef TERRAIN_FRAGMENT_OCCLUSION 2377if (isOccluded()) {discard;} 2378#endif 2379vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor; 2380#ifdef LIGHTING_3D_MODE 2381lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color; 2382#endif 2383vec4 finalColor; 2384#ifdef DIFFUSE_SHADED 2385vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor); 2386#ifdef HAS_TEXTURE_u_occlusionTexture 2387float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao; 2388#endif 2389finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity; 2390#else 2391Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0; 2392#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2393#ifdef OCCLUSION_TEXTURE_TRANSFORM 2394vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy; 2395#else 2396vec2 uv=uv_2f; 2397#endif 2398ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao; 2399#endif 2400vec4 emissive=u_emissiveFactor; 2401#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2402emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb); 2403#endif 2404#ifdef APPLY_LUT_ON_GPU 2405float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength; 2406#endif 2407color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity; 2408#ifdef HAS_ATTRIBUTE_a_pbr 2409float 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; 2410#ifdef APPLY_LUT_ON_GPU 2411color_mix=applyLUT(u_lutTexture,color_mix); 2412#endif 2413color=mix(color,color_mix,min(1.0,resEmission)); 2414#ifdef HAS_ATTRIBUTE_a_color_4f 2415float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2415y));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); 2416#endif 2417#endif 2418vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity); 2419#endif 2420#ifdef FOG 2421finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w)); 2422#endif 2423#ifdef RENDER_CUTOFF 2424finalColor*=v_cutoff_opacity; 2425#endif 2426#ifdef INDICATOR_CUTOUT 2427finalColor=applyCutout(finalColor,v_position_height.w); 2428#endif 2429glFragColor=finalColor; 2430#ifdef OVERDRAW_INSPECTOR 2431glFragColor=vec4(1.0); 2432#endif 2433HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2434#include "_prelude_shadow.vertex.glsl" 2435in vec3 a_pos_3f; 2436#pragma mapbox: define-attribute highp vec3 normal_3f 2437#pragma mapbox: define-attribute highp vec2 uv_2f 2438#pragma mapbox: define-attribute highp vec3 color_3f 2439#pragma mapbox: define-attribute highp vec4 color_4f 2440#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr 2441#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength 2442uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix; 2443#ifdef INSTANCED_ARRAYS 2444in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 2445#else 2446uniform highp mat4 u_normal_matrix; 2447#endif 2448#ifdef RENDER_SHADOWS 2449uniform 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; 2450#endif 2451out vec4 v_position_height;out lowp vec4 v_color_mix; 2452#ifdef TERRAIN_FRAGMENT_OCCLUSION 2453out highp float v_depth; 2454#endif 2455#ifdef HAS_ATTRIBUTE_a_pbr 2456out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params; 2457#endif 2458vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { 2459#pragma mapbox: initialize-attribute highp vec3 normal_3f 2460#pragma mapbox: initialize-attribute highp vec2 uv_2f 2461#pragma mapbox: initialize-attribute highp vec3 color_3f 2462#pragma mapbox: initialize-attribute highp vec4 color_4f 2463#pragma mapbox: initialize-attribute-custom highp vec4 pbr 2464#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength 2465highp mat4 normal_matrix; 2466#ifdef INSTANCED_ARRAYS 2467normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2468#else 2469normal_matrix=u_normal_matrix; 2470#endif 2471vec3 local_pos;mat3 rs; 2472#ifdef MODEL_POSITION_ON_GPU 2473vec3 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; 2474#else 2475local_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); 2476#endif 2477v_position_height.w=a_pos_3f.z; 2478#ifdef HAS_ATTRIBUTE_a_pbr 2479vec4 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; 2480#endif 2481#ifdef FOG 2482v_fog_pos=fog_position(local_pos); 2483#endif 2484#ifdef RENDER_CUTOFF 2485v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 2486#endif 2487#ifdef TERRAIN_FRAGMENT_OCCLUSION 2488v_depth=gl_Position.z/gl_Position.w; 2489#endif 2490#ifdef HAS_ATTRIBUTE_a_normal_3f 2491#ifdef MODEL_POSITION_ON_GPU 2492float 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); 2493#else
2494normal_3f=vec3(normal_matrix*vec4(normal_3f,0)); 2495#endif 2496#endif 2497#ifdef HAS_ATTRIBUTE_a_pbr 2498#ifdef HAS_ATTRIBUTE_a_color_4f 2499v_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); 2500#endif 2501#endif 2502#ifdef RENDER_SHADOWS 2503vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0); 2504#ifdef NORMAL_OFFSET 2505#ifdef HAS_ATTRIBUTE_a_normal_3f 2506#ifdef MODEL_POSITION_ON_GPU 2507vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 2508#else 2509vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 2510#endif 2511#endif 2512#endif 2513v_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; 2514#endif 2515}`),modelDepth:Jt(`in highp float v_depth;void main() { 2516#ifndef DEPTH_TEXTURE 2517glFragColor=pack_depth(v_depth); 2518#endif 2519}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth; 2520#ifdef MODEL_POSITION_ON_GPU 2521#ifdef INSTANCED_ARRAYS 2522in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 2523#else 2524uniform highp mat4 u_instance; 2525#endif 2526uniform highp mat4 u_node_matrix; 2527#endif 2528void main() { 2529#ifdef MODEL_POSITION_ON_GPU 2530highp mat4 instance; 2531#ifdef INSTANCED_ARRAYS 2532instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2533#else 2534instance=u_instance; 2535#endif 2536vec3 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;
2536rs[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); 2537#else 2538gl_Position=u_matrix*vec4(a_pos_3f,1); 2539#endif 2540v_depth=gl_Position.z/gl_Position.w;}`),stars:Jt(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv) 2541{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;}`,` 2542in 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;}",` 2543in 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; 2544uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 2545uniform float u_horizontalOscillationRate; 2546uniform 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+ 2547localY*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;}",` 2548in 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; 2549uniform float u_velocity; 2550uniform 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;
2550pos*=halfBoxSize; 2551pos+=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+ 2552localY*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" 2553in 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; 2554#ifdef TERRAIN 2555float e=elevation(world_pos.xy);world_pos.z+=e; 2556#endif 2557vec4 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 Nn(l,t){const n=l.replace(/\s*\/\/[^\n]*\n/g,` 2558`).split(` 2559`);for(let c of n)if(c=c.trim(),c[0]==="#"&&c.includes("if")&&!c.includes("endif")){c=c.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const d=c.split(" ");for(const p of d)t.includes(p)||t.push(p)}}function Jt(l,t){const n=/#include\s+"([^"]+)"/g,c=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let d=t.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);d&&(d=d.map(T=>{const S=T.split(" ");return S[S.length-1]}),d=[...new Set(d)]);const p={},m=[],y=[];if(l=l.replace(n,(T,S)=>(y.push(S),"")),(t=t.replace(n,(T,S)=>(m.push(S),""))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let x=[...ga];Nn(l,x),Nn(t,x);for(const T of[...m,...y])ya[T]||console.error(`Undefined include: ${T}`),xl[T]||(xl[T]=[],Nn(ya[T],xl[T])),x=[...x,...xl[T]];return{fragmentSource:l=l.replace(c,(T,S,M,I,C)=>(p[C]=!0,S==="define"?` 2560#ifndef HAS_UNIFORM_u_${C} 2561in ${M} ${I} ${C}; 2562#else 2563uniform ${M} ${I} u_${C}; 2564#endif 2565`:S==="initialize"?` 2566#ifdef HAS_UNIFORM_u_${C} 2567 ${M} ${I} ${C} = u_${C}; 2568#endif 2569`:S==="define-attribute"?` 2570#ifdef HAS_ATTRIBUTE_a_${C} 2571 in ${M} ${I} ${C}; 2572#endif 2573`:S==="initialize-attribute"?"":void 0)),vertexSource:t=t.replace(c,(T,S,M,I,C)=>{const L=I==="float"?"vec2":I,R=C.match(/color/)?"color":L;return S==="define-attribute-vertex-shader-only"?` 2574#ifdef HAS_ATTRIBUTE_a_${C} 2575in ${M} ${I} a_${C}; 2576#endif 2577`:p[C]?S==="define"?` 2578#ifndef HAS_UNIFORM_u_${C} 2579uniform lowp float u_${C}_t; 2580in ${M} ${L} a_${C}; 2581out ${M} ${I} ${C}; 2582#else 2583uniform ${M} ${I} u_${C}; 2584#endif 2585`:S==="initialize"?R==="vec4"?` 2586#ifndef HAS_UNIFORM_u_${C} 2587 ${C} = a_${C}; 2588#else 2589 ${M} ${I} ${C} = u_${C}; 2590#endif 2591`:` 2592#ifndef HAS_UNIFORM_u_${C} 2593 ${C} = unpack_mix_${R}(a_${C}, u_${C}_t); 2594#else 2595 ${M} ${I} ${C} = u_${C}; 2596#endif 2597`:S==="define-attribute"?` 2598#ifdef HAS_ATTRIBUTE_a_${C} 2599 in ${M} ${I} a_${C}; 2600 out ${M} ${I} ${C}; 2601#endif 2602`:S==="initialize-attribute"?` 2603#ifdef HAS_ATTRIBUTE_a_${C} 2604 ${C} = a_${C}; 2605#endif 2606`:void 0:S==="define"?` 2607#ifndef HAS_UNIFORM_u_${C} 2608uniform lowp float u_${C}_t; 2609in ${M} ${L} a_${C}; 2610#else 2611uniform ${M} ${I} u_${C}; 2612#endif 2613`:S==="define-instanced"?R==="mat4"?` 2614#ifdef INSTANCED_ARRAYS 2615in vec4 a_${C}0; 2616in vec4 a_${C}1; 2617in vec4 a_${C}2; 2618in vec4 a_${C}3; 2619#else 2620uniform ${M} ${I} u_${C}; 2621#endif 2622`:` 2623#ifdef INSTANCED_ARRAYS 2624in ${M} ${L} a_${C}; 2625#else 2626uniform ${M} ${I} u_${C}; 2627#endif 2628`:S==="initialize-attribute-custom"?` 2629#ifdef HAS_ATTRIBUTE_a_${C} 2630 ${M} ${I} ${C} = a_${C}; 2631#endif 2632`:R==="vec4"?` 2633#ifndef HAS_UNIFORM_u_${C} 2634 ${M} ${I} ${C} = a_${C}; 2635#else 2636 ${M} ${I} ${C} = u_${C}; 2637#endif 2638`:` 2639#ifndef HAS_UNIFORM_u_${C} 2640 ${M} ${I} ${C} = unpack_mix_${R}(a_${C}, u_${C}_t); 2641#else 2642 ${M} ${I} ${C} = u_${C}; 2643#endif 2644`}),staticAttributes:d,usedDefines:x,vertexIncludes:m,fragmentIncludes:y}}class xa{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,y,x){this.context=t;let T=this.boundPaintVertexBuffers.length!==d.length;for(let M=0;!T&&M<d.length;M++)this.boundPaintVertexBuffers[M]!==d[M]&&(T=!0);let S=this.boundDynamicVertexBuffers.length!==y.length;for(let M=0;!S&&M<y.length;M++)this.boundDynamicVertexBuffers[M]!==y[M]&&(S=!0);if(!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==c||T||S||this.boundIndexBuffer!==p||this.boundVertexOffset!==m)this.freshBind(n,c,d,p,m,y,x);else{t.bindVertexArrayOES.set(this.vao);for(const M of y)M&&(M.bind(),x&&M.instanceCount&&M.setVertexAttribDivisor(t.gl,n,x));p&&p.dynamicDraw&&p.bind()}}
vendor: 11,724 bytes, line 2644
2644freshBind(t,n,c,d,p,m,y){const x=t.numAttributes,T=this.context,S=T.gl;this.vao&&this.destroy(),this.vao=T.gl.createVertexArray(),T.bindVertexArrayOES.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=c,this.boundIndexBuffer=d,this.boundVertexOffset=p,this.boundDynamicVertexBuffers=m,n.enableAttributes(S,t),n.bind(),n.setVertexAttribPointers(S,t,p);for(const M of c)M.enableAttributes(S,t),M.bind(),M.setVertexAttribPointers(S,t,p);for(const M of m)M&&(M.enableAttributes(S,t),M.bind(),M.setVertexAttribPointers(S,t,p),y&&M.instanceCount&&M.setVertexAttribDivisor(S,t,y));d&&d.bind(),T.currentNumAttributes=x}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function Ef(l,t){const n=Math.pow(2,t.canonical.z),c=t.canonical.y;return[new o.ac(0,c/n).toLngLat().lat,new o.ac(0,(c+1)/n).toLngLat().lat]}function If(l,t,n,c,d,p,m){const y=l.context,x=y.gl,T=n.hillshadeFBO;if(!T)return;l.prepareDrawTile();const S=l.isTileAffectedByFog(t),M=l.getOrCreateProgram("hillshade",{overrideFog:S});y.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,T.colorAttachment.get());const I=((F,B,V,Z)=>{const Y=V.paint.get("hillshade-shadow-color"),te=V.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",ee=V.paint.get("hillshade-highlight-color"),J=V.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",K=V.paint.get("hillshade-accent-color"),ie=V.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",ne=V.paint.get("hillshade-emissive-strength");let fe=o.al(V.paint.get("hillshade-illumination-direction"));if(V.paint.get("hillshade-illumination-anchor")==="viewport")fe-=F.transform.angle;else if(F.style&&F.style.enable3dLights()&&F.style.directionalLight){const Ae=F.style.directionalLight.properties.get("direction"),Me=o.cR(Ae.x,Ae.y,Ae.z);fe=o.al(Me[1])}const me=!F.options.moving;return{u_matrix:Z||F.transform.calculateProjMatrix(B.tileID.toUnwrapped(),me),u_image:0,u_latrange:Ef(0,B.tileID),u_light:[V.paint.get("hillshade-exaggeration"),fe],u_shadow:Y.toPremultipliedRenderColor(te?null:V.lut),u_highlight:ee.toPremultipliedRenderColor(J?null:V.lut),u_emissive_strength:ne,u_accent:K.toPremultipliedRenderColor(ie?null:V.lut)}})(l,n,c,l.terrain?t.projMatrix:null);l.uploadCommonUniforms(y,M,t.toUnwrapped());const{tileBoundsBuffer:C,tileBoundsIndexBuffer:L,tileBoundsSegments:R}=l.getTileBoundsBuffers(n);M.draw(l,x.TRIANGLES,d,p,m,bt.disabled,I,c.id,C,L,R)}function Ec(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 o.T(c,p,d.R32F,{premultiply:!1}),t.needsDEMTextureUpload=!1}function Af(l,t,n){const c=l.context,d=c.gl;if(!t.dem)return;const p=t.dem;if(c.activeTexture.set(d.TEXTURE1),Ec(l,t,p),!t.demTexture)return;t.demTexture.bind(d.NEAREST,d.CLAMP_TO_EDGE);const m=p.dim;c.activeTexture.set(d.TEXTURE0);let y=t.hillshadeFBO;if(!y){const I=new o.T(c,{width:m,height:m,data:null},d.RGBA8);I.bind(d.LINEAR,d.CLAMP_TO_EDGE),y=t.hillshadeFBO=c.createFramebuffer(m,m,!0,"renderbuffer"),y.colorAttachment.set(I.texture)}c.bindFramebuffer.set(y.framebuffer),c.viewport.set([0,0,m,m]);const{tileBoundsBuffer:x,tileBoundsIndexBuffer:T,tileBoundsSegments:S}=l.getMercatorTileBoundsBuffers(),M=[];l.linearFloatFilteringSupported()&&M.push("TERRAIN_DEM_FLOAT_FORMAT"),l.getOrCreateProgram("hillshadePrepare",{defines:M}).draw(l,d.TRIANGLES,et.disabled,Mt.disabled,qt.unblended,bt.disabled,((I,C)=>{const L=C.stride,R=o.bz();return o.c5(R,0,o.aj,-8192,0,0,1),o.bo(R,R,[0,-8192,0]),{u_matrix:R,u_image:1,u_dimension:[L,L],u_zoom:I.overscaledZ}})(t.tileID,p),n.id,x,T,S),t.needsHillshadePrepare=!1}class Ji{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Ed extends Ji{getDefault(){return o.am.transparent.toNonPremultipliedRenderColor(null)}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class qu extends Ji{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Mf extends Ji{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Cf extends Ji{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 Pf extends Ji{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class zf extends Ji{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Id extends Ji{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 Rf extends Ji{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 Ic extends Ji{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 Df extends Ji{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 Ad extends Ji{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 $u extends Ji{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Ac extends Ji{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 Zu extends Ji{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 Ro extends Ji{getDefault(){return o.am.transparent.toNonPremultipliedRenderColor(null)}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class va extends Ji{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(t,t),this.current=t,this.dirty=!1)}}class Mc extends Ji{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 Cc extends Ji{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class ba extends Ji{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}let Md=class extends Ji{getDefault(){return null}set(l){(l!==this.current||this.dirty)&&(this.gl.useProgram(l),this.current=l,this.dirty=!1)}};class Hu extends Ji{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Cd extends Ji{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 wa extends Ji{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 Pc extends Ji{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 zc extends Ji{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 Wu extends Ji{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 Rc extends Ji{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class bl extends Ji{getDefault(){return null}set(t){this.gl&&(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}}class Pd extends Ji{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 zd extends Ji{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 Rd extends Ji{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 Xs extends Ji{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Dd extends Xs{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Ld extends Xs{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 Lf extends Xs{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 Ff extends Ld{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Xu=(l,t,n)=>({u_matrix:l,u_image0:0,u_skirt_height:t,u_ground_shadow_factor:n}),Dc=(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,R)=>({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_frustum_tl:m,u_frustum_tr:y,u_frustum_br:x,u_frustum_bl:T,u_globe_pos:S,u_globe_radius:M,u_viewport:I,u_grid_matrix:R?Float32Array.from(R):new Float32Array(9),u_skirt_height:C,u_far_z_cutoff:L});function Lc(l,t){return l!=null&&t!=null&&!(!l.hasData()||!t.hasData())&&l.demTexture!=null&&t.demTexture!=null&&l.tileID.key!==t.tileID.key}const Ys=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>
2644=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()}},Yu={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Ku(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 kf(l,t){const n=1<<l.z;return!t&&(l.x===0||l.x===n-1)||l.y===0||l.y===n-1}const Do=l=>({u_matrix:l});function Lo(l,t,n,c,d){if(d>0){const p=o.q.now(),m=(p-l.timeAdded)/d,y=t?(p-t.timeAdded)/d:-1,x=n.getSource(),T=c.coveringZoomLevel({tileSize:x.tileSize,roundZoom:x.roundZoom}),S=!t||Math.abs(t.tileID.overscaledZ-T)>Math.abs(l.tileID.overscaledZ-T),M=S&&l.refreshedUponExpiration?1:o.ay(S?m:1-y,0,1);return l.refreshedUponExpiration&&m>=1&&(l.refreshedUponExpiration=!1),t?{opacity:1,mix:1-M}:{opacity:M,mix:0}}return{opacity:1,mix:0}}class Fd extends hn{constructor(t){const n={type:"raster-dem",maxzoom:t.transform.maxZoom},c=new o.D(o.c$(),null),d=el("mock-dem",n,c,t.style);super("mock-dem",d,!1),d.setEventedParent(this),this._sourceLoaded=!0}_loadTile(t,n){t.state="loaded",n(null)}}class Pn extends hn{constructor(t){const n=el("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},new o.D(o.c$(),null),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 y=new bo(m,this._source.tileSize*m.overscaleFactor(),t.tileZoom,void 0,void 0,this._source.worldview);y.state="loaded",this._tiles[m.key]=y}return p},{});for(const p in this._tiles)p in d||(this.freeFBO(p),this._tiles[p].unloadVectorData(),delete this._tiles[p])}freeFBO(t){const 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 Fc extends o.aM{constructor(t,n,c){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=n,this.projMatrix=c}}class wl extends o.dt{constructor(t,n){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},t.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),t.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),t.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[c,d,p]=function(x){const T=new o.ba,S=new o.a_,M=131;T.reserve(17161),S.reserve(33800);const I=o.aj/128,C=o.aj+I/2,L=C+I;for(let F=-64;F<L;F+=I)for(let B=-64;B<L;B+=I){const V=B<0||B>C||F<0||F>C?24575:0,Z=o.ay(Math.round(B),0,o.aj),Y=o.ay(Math.round(F),0,o.aj);T.emplaceBack(Z+V,Y)}const R=(F,B)=>{const V=B*M+F;S.emplaceBack(V+1,V,V+M),S.emplaceBack(V+M,V+M+1,V+1)};for(let F=1;F<129;F++)for(let B=1;B<129;B++)R(B,F);return[0,129].forEach(F=>{for(let B=0;B<130;B++)R(B,F),R(F,B)}),[T,S,32768]}(),m=t.context;this.gridBuffer=m.createVertexBuffer(c,o.bc.members),this.gridIndexBuffer=m.createIndexBuffer(d),this.gridSegments=o.bd.simpleSegment(0,0,c.length,d.length),this.gridNoSkirtSegments=o.bd.simpleSegment(0,0,c.length,p),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Pn(n.map),this.orthoMatrix=o.bz(),o.c5(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,o.aj,0,o.aj,0,1);const y=m.gl;this._overlapStencilMode=new Mt({func:y.GEQUAL,mask:255},0,255,y.KEEP,y.KEEP,y.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=n,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Fd(n.map),this._pendingGroundEffectLayers=[]}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),this._style=t,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(t,n,c){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const d=t.terrain.properties,p=t.terrain.drapeRenderMode===0,m=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=o.q.now();const y=t.terrain&&t.terrain.scope,x=d.get("source"),T=p?this._mockSourceCache:t.getSourceCache(x,y);if(!T)return void o.w(`Couldn't find terrain source "${x}".`);if(this.sourceCache=T,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=m?this.calculateExaggeration(n):d.get("exaggeration"),!n.projection.requiresDraping&&m&&this._exaggeration===0)return void this._disable();this.enabled=!0;const S=()=>{this.sourceCache.used&&o.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 2645This 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 y=p-this._previousZoom;const x=this._previousUpdateTimestamp;let T=p;this._evaluationZoom!=null&&(T=this._evaluationZoom,Math.abs(p-T)>.5&&(y=.5*(p-T+y)),y*d<0&&(T+=y)),this._evaluationZoom=T;const S=m.getExaggeration(T),M=S===m.getExaggeration(Math.max(0,T-.1));if(M&&Math.abs(S-this._exaggeration)<.01)return S;let I=Math.min(.1,.00375*(this._updateTimestamp-x));return(M||S<.1||Math.abs(y)<1e-4)&&(I=Math.min(.2,4*I)),o.ai(this._exaggeration,S,I)}resetTileLookupCache(t){this._findCoveringTileCache[t]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(t){t.coord&&t.dataType==="source"?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):t.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const t in this._style._mergedSourceCaches)this._style._mergedSourceCaches[t].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(t=>t.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const t=2*this.proxySourceCache.getSource().tileSize;return[t,t]}set useVertexMorphing(t){this._useVertexMorphing=t}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const n=this.proxySourceCache,c=this.painter.transform;this._initializing&&(this._initializing=c._centerAltitude===0&&this.getAtPointOrZero(o.ac.fromLngLat(c.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const d=this.proxyCoords=n.getIds().map(x=>{const T=n.getTileByID(x).tileID;return T.projMatrix=c.calculateProjMatrix(T.toUnwrapped()),T});(function(x,T){const S=T.transform.pointCoordinate(T.transform.getCameraPoint()),M=new o.P(S.x,S.y);x.sort((I,C)=>
vendor: 4,676 bytes, line 2645
2645{if(C.overscaledZ-I.overscaledZ)return C.overscaledZ-I.overscaledZ;const L=new o.P(I.canonical.x+(1<<I.canonical.z)*I.wrap,I.canonical.y),R=new o.P(C.canonical.x+(1<<C.canonical.z)*C.wrap,C.canonical.y),F=M.mult(1<<I.canonical.z);return F.x-=.5,F.y-=.5,F.distSqr(L)-F.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 T=m[x];if(!T.used||(T!==this.sourceCache&&this.resetTileLookupCache(T.id),this._setupProxiedCoordsForOrtho(T,t[x],p),T.usedForTerrain))continue;const S=t[x];T.getSource().reparseOverscaled&&this._assignTerrainTiles(S)}this.proxiedCoords[n.id]=d.map(x=>new Fc(x,x.key,this.orthoMatrix)),this._assignTerrainTiles(d),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(p),this.renderingToTexture=!1;const y={};this._visibleDemTiles=[];for(const x of this.proxyCoords){const T=this.terrainTileForTile[x.key];if(!T)continue;const S=T.tileID.key;S in y||(this._visibleDemTiles.push(T),y[S]=S)}}_assignTerrainTiles(t){this._initializing||t.forEach(n=>{if(this.terrainTileForTile[n.key])return;const c=this._findTileCoveringTileID(n,this.sourceCache);c&&(this.terrainTileForTile[n.key]=c)})}_prepareDEMTextures(){const t=this.painter.context,n=t.gl;for(const c in this.terrainTileForTile){const d=this.terrainTileForTile[c],p=d.dem;!p||d.demTexture&&!d.needsDEMTextureUpload||(t.activeTexture.set(n.TEXTURE1),Ec(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),y=d||"";return c[`u_dem_tl${y}`]=[p.x*m%1,p.y*m%1],c[`u_dem_scale${y}`]=m,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let t=0;const 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 o.du({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 o.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 y=null,x=null,T=1;if(c&&c.morphing&&this._useVertexMorphing){const C=c.morphing.srcDemTile,L=c.morphing.dstDemTile;T=c.morphing.phase,C&&L&&(this._prepareDemTileUniforms(t,C,m,"_prev")&&(x=C),this._prepareDemTileUniforms(t,L,m)&&(y=L))}const S=C=>C&&C.demTexture&&this.painter.linearFloatFilteringSupported()?p.LINEAR:p.NEAREST;let M=null;var I;if(this.enabled?x&&y?(M=y.demTexture,d.activeTexture.set(p.TEXTURE4),x.demTexture.bind(S(x),p.CLAMP_TO_EDGE),m.u_dem_lerp=T):(y=this.terrainTileForTile[t.tileID.key],M=this._prepareDemTileUniforms(t,y,m)?y.demTexture:this.emptyDEMTexture):M=this.emptyDEMTexture,d.activeTexture.set(p.TEXTURE2),M&&(m.u_dem_size=(I=M).size[0]===1?1:I.size[0]-2,M.bind(S(y),p.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(c&&c.useDepthForOcclusion,n,m),c&&c.useMeterToDem&&y){const C=(1<<y.tileID.canonical.z)*o.c6(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;m.u_meter_to_dem=C}if(c&&c.labelPlaneMatrixInv&&(m.u_label_plane_matrix_inv=c.labelPlaneMatrixInv),n.setTerrainUniformValues(d,m),this.painter.transform.projection.name==="globe"){const C=this.globeUniformValues(this.painter.transform,t.tileID.canonical,c&&c.useDenormalizedUpVectorScale);n.setGlobeUniformValues(d,C)}}globeUniformValues(t,n,c){const d=t.projection;return{u_tile_tl_up:d.upVector(n,0,0),u_tile_tr_up:d.upVector(n,o.aj,0),u_tile_br_up:d.upVector(n,o.aj,o.aj),u_tile_bl_up:d.upVector(n,0,o.aj),u_tile_up_scale:c?o.dv(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,y,x){if(d.transform.projection.name==="globe")(function(T,S,M,I,C){const L=T.context,R=L.gl;let F,B;const V=T.transform,Z=o.dl(T,L,V),Y=(Ae,Me)=>
2645{if(B===Me)return;const Fe=[Yu[Me],"PROJECTION_GLOBE_VIEW"];Z&&Fe.push("CUSTOM_ANTIALIASING");const de=T.isTileAffectedByFog(Ae);F=T.getOrCreateProgram("globeRaster",{defines:Fe,overrideFog:de}),B=Me},te=T.colorModeForRenderPass(),ee=new et(R.LEQUAL,et.ReadWrite,T.depthRangeFor3D);Ys.update(C);const J=o.dm(V),K=[o.aD(V.center.lng),o.aH(V.center.lat)],ie=T.globeSharedBuffers,ne=[V.width*o.q.devicePixelRatio,V.height*o.q.devicePixelRatio],fe=Float32Array.from(V.globeMatrix),me={useDenormalizedUpVectorScale:!0};{const Ae=T.transform,Me=Ku(Ae.zoom,S.exaggeration(),S.sourceCache._source.tileSize);B=-1;const Fe=R.TRIANGLES;for(const de of I){const we=M.getTile(de),le=Mt.disabled,Pe=S.prevTerrainTileForTile[de.key],ye=S.terrainTileForTile[de.key];Lc(Pe,ye)&&Ys.newMorphing(de.key,Pe,ye,C,250),L.activeTexture.set(R.TEXTURE0),we.texture&&we.texture.bind(R.LINEAR,R.CLAMP_TO_EDGE);const De=Ys.getMorphValuesForProxy(de.key),qe=De?1:0;De&&o.L(me,{morphing:{srcDemTile:De.from,dstDemTile:De.to,phase:o.dk(De.phase)}});const Ce=o.dn(de.canonical),je=o.dp(Ce.getCenter().lat),it=o.dq(de.canonical,Ce,je,Ae.worldSize/Ae._pixelsPerMercatorPixel),rt=o.bh(o.dr(de.canonical)),Qe=Dc(Ae.expandedFarZProjMatrix,fe,J,rt,o.ah(Ae.zoom),K,Ae.frustumCorners.TL,Ae.frustumCorners.TR,Ae.frustumCorners.BR,Ae.frustumCorners.BL,Ae.globeCenterInViewSpace,Ae.globeRadius,ne,Me,Ae._farZ,it);if(Y(de,qe),F&&(S.setupElevationDraw(we,F,me),T.uploadCommonUniforms(L,F,de.toUnwrapped()),ie)){const[ut,pt,yt]=ie.getGridBuffers(je,Me!==0);F.draw(T,Fe,ee,le,te,bt.backCCW,Qe,"globe_raster",ut,pt,yt)}}}if(ie&&(T.renderDefaultNorthPole||T.renderDefaultSouthPole)){const Ae=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];Z&&Ae.push("CUSTOM_ANTIALIASING"),F=T.getOrCreateProgram("globeRaster",{defines:Ae});for(const Me of I){const{x:Fe,y:de,z:we}=Me.canonical,le=de===0,Pe=de===(1<<we)-1,[ye,De,qe,Ce]=ie.getPoleBuffers(we,!1);if(Ce&&(le||Pe)){const je=M.getTile(Me);L.activeTexture.set(R.TEXTURE0),je.texture&&je.texture.bind(R.LINEAR,R.CLAMP_TO_EDGE);let it=o.ds(we,Fe,V);const rt=o.bh(o.dr(Me.canonical)),Qe=(ut,pt)=>ut.draw(T,R.TRIANGLES,ee,Mt.disabled,te,bt.disabled,Dc(V.expandedFarZProjMatrix,it,it,rt,0,K,V.frustumCorners.TL,V.frustumCorners.TR,V.frustumCorners.BR,V.frustumCorners.BL,V.globeCenterInViewSpace,V.globeRadius,ne,0,V._farZ),"globe_pole_raster",pt,qe,Ce);S.setupElevationDraw(je,F,me),T.uploadCommonUniforms(L,F,Me.toUnwrapped()),le&&T.renderDefaultNorthPole&&Qe(F,ye),Pe&&T.renderDefaultSouthPole&&(it=o.cE(o.bz(),it,[1,-1,1]),Qe(F,De))}}}})(d,p,m,y,x);else{const T=d.context,S=T.gl;let M,I;const C=d.shadowRenderer,L=os(d,d.longestCutoffRange),R=te=>{if(I===te)return;const ee=[];ee.push(Yu[te]),L.shouldRenderCutoff&&ee.push("RENDER_CUTOFF"),C&&(ee.push("RENDER_SHADOWS","DEPTH_TEXTURE"),C.useNormalOffset&&ee.push("NORMAL_OFFSET")),M=d.getOrCreateProgram("terrainRaster",{defines:ee}),I=te},F=d.colorModeForRenderPass(),B=new et(S.LEQUAL,et.ReadWrite,d.depthRangeFor3D);Ys.update(x);const V=d.transform,Z=Ku(V.zoom,p.exaggeration(),p.sourceCache._source.tileSize);let Y=[0,0,0];if(C){const te=d.style.directionalLight,ee=d.style.ambientLight;te&&ee&&(Y=Po(d.style,te,ee))}{I=-1;const te=S.TRIANGLES,[ee,J]=[p.gridIndexBuffer,p.gridSegments];for(const K of y){const ie=m.getTile(K),ne=Mt.disabled,fe=p.prevTerrainTileForTile[K.key],me=p.terrainTileForTile[K.key];Lc(fe,me)&&Ys.newMorphing(K.key,fe,me,x,250),T.activeTexture.set(S.TEXTURE0),ie.texture&&ie.texture.bind(S.LINEAR,S.CLAMP_TO_EDGE);const Ae=Ys.getMorphValuesForProxy(K.key),Me=Ae?1:0;let Fe;Ae&&(Fe={morphing:{srcDemTile:Ae.from,dstDemTile:Ae.to,phase:o.dk(Ae.phase)}});const de=Xu(K.projMatrix,kf(K.canonical,V.renderWorldCopies)?Z/10:Z,Y);if(R(Me),!M)continue;p.setupElevationDraw(ie,M,Fe);const we=K.toUnwrapped();C&&C.setupShadows(we,M),d.uploadCommonUniforms(T,M,we,null,L),M.draw(d,te,B,ne,F,bt.backCCW,de,"terrain_raster",p.gridBuffer,ee,J)}}}}(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(),y=n.style.order,x=[];let T=0;for(const S of p){const M=d.getTileByID(S.proxyTileKey),I=d.proxyCachedFBO[S.key]?d.proxyCachedFBO[S.key][t]:void 0,C=I!==void 0?d.renderCache[I]:this.pool[T++],L=I!==void 0;if(M.texture=C.tex,L&&!C.dirty){x.push(M.tileID);continue}let R;c.bindFramebuffer.set(C.fb.framebuffer),this.renderedToTile=!1,C.dirty&&(c.clear({color:o.am.transparent,stencil:0}),C.dirty=!1);for(let F=m.start;F<=m.end;++F){const B=n.style._mergedLayers[y[F]];if(B.isHidden(n.transform.zoom))continue;const V=n.style.getLayerSourceCache(B),Z=V?this.proxyToSource[S.key][V.id]:[S];if(!Z)continue;const Y=Z;
vendor: 11,041 bytes, line 2645
2645c.viewport.set([0,0,C.fb.width,C.fb.height]),R!==(V?V.id:null)&&(this._setupStencil(C,Z,B,V),R=V?V.id:null),n.renderLayer(n,V,B,Y)}if(this._drapedRenderBatches.length===0)for(const F of this._pendingGroundEffectLayers){const B=n.style._mergedLayers[y[F]];if(B.isHidden(n.transform.zoom))continue;const V=n.style.getLayerSourceCache(B),Z=V?this.proxyToSource[S.key][V.id]:[S];if(!Z)continue;const Y=Z;c.viewport.set([0,0,C.fb.width,C.fb.height]),R!==(V?V.id:null)&&(this._setupStencil(C,Z,B,V),R=V?V.id:null),n.renderLayer(n,V,B,Y)}this.renderedToTile?(C.dirty=!0,x.push(M.tileID)):L||--T,T===5&&(T=0,this.renderToBackBuffer(x))}return this.renderToBackBuffer(x),this.renderingToTexture=!1,c.bindFramebuffer.set(null),c.viewport.set([0,0,n.width,n.height]),m.end+1}postRender(){}isLayerOrderingCorrect(t){const n=t.order.length;let c=-1,d=n;for(let 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,y=1<<m.overscaledZ,{x,y:T}=m.canonical,S=x/y,M=(x+1)/y,I=T/y,C=(T+1)/y;return{minx:S,miny:I,maxx:M,maxy:C,t:p.dem.tree.raycastRoot(S,I,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 o.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],!0,null);return p.colorAttachment.set(d.texture),p.depthAttachment=new Ff(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,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(const t in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[t].hasTransition())return!0;return this._style.order.some(t=>{const n=this._style._mergedLayers[t],c=n.isHidden(this.painter.transform.zoom);return n.type==="hillshade"||n.type==="custom"?!c&&n.shouldRedrape():!c&&n.hasTransition()})}_clearLineLayersFromRenderCache(){let t=!1;for(const c of this._style.getSources())if(c instanceof Qa){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"&&d.widthExpression()instanceof o.ab){n[p.id]=!0;for(const m of this.proxyCoords){const y=this.proxyToSource[m.key][p.id];if(y)for(const x of y)this._clearRenderCacheForTile(p.id,x)}}}}_clearRasterLayersFromRenderCache(){let t=!1;for(const c in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[c]._source instanceof kr){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 y of this.proxyCoords){const x=this.proxyToSource[y.key][p.id];if(x)for(const T of x){const S=Lo(p.getTile(T),p.findLoadedParent(T,0),p,this.painter.transform,m);(S.opacity!==1||S.mix!==0)&&this._clearRenderCacheForTile(p.id,T)}}}}_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 y=this._style._mergedLayers[t[p]];y.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(y)?d===void 0&&(d=p):(y.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(p),d!==void 0&&(c.push({start:d,end:p-1}),d=void 0)))}if(d!==void 0&&c.push({start:d,end:p-1}),c.length!==0){const y=c[c.length-1];this._pendingGroundEffectLayers.every(x=>x>y.end)||o.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=c}_setupRenderCache(t){const n=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,n.renderCache.length>n.renderCachePool.length){const m=Object.values(n.proxyCachedFBO);n.proxyCachedFBO={};for(let y=0;y<m.length;++y){const x=Object.values(m[y]);n.renderCachePool.push(...x)}}return}this._clearRasterLayersFromRenderCache();const c=this.proxyCoords,d=this._tilesDirty;for(let m=c.length-1;m>=0;m--){const y=c[m];if(n.getTileByID(y.key),n.proxyCachedFBO[y.key]!==void 0){const x=t[y.key],T=this.proxyToSource[y.key];let S=0;for(const M in T){const I=T[M],C=x[M];if(!C||C.length!==I.length||I.some((L,R)=>L!==C[R]||d[M]&&d[M].hasOwnProperty(L.key))){S=-1;break}++S}for(const M in n.proxyCachedFBO[y.key])n.renderCache[n.proxyCachedFBO[y.key][M]].dirty=S<0||S!==Object.values(x).length}}const p=[...this._drapedRenderBatches];p.sort((m,y)=>y.end-y.start-(m.end-m.start));for(const m of p)for(const y of c){if(n.proxyCachedFBO[y.key])continue;let x=n.renderCachePool.pop();x===void 0&&n.renderCache.length<50&&(x=n.renderCache.length,n.renderCache.push(this._createFBO())),x!==void 0&&(n.proxyCachedFBO[y.key]={},n.proxyCachedFBO[y.key][m.start]=x,n.renderCache[x].dirty=!0)}this._tilesDirty={}}_setupStencil(t,n,c,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const p=this.painter.context,m=p.gl;if(n.length<=1)return void(this._overlapStencilType=!1);let y;if(c.isTileClipped())y=n.length,this._overlapStencilMode.test={func:m.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(n[0].overscaledZ>n[n.length-1].overscaledZ))return void(this._overlapStencilType=!1);y=1,this._overlapStencilMode.test={func:m.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+y>255&&(p.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=y,this._overlapStencilMode.ref=this._stencilRef,c.isTileClipped()&&this._renderTileClippingMasks(n,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(t){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):Mt.disabled}_renderTileClippingMasks(t,n){const c=this.painter,d=this.painter.context,p=d.gl;c._tileClippingMaskIDs={},d.setColorMode(qt.disabled),d.setDepthMode(et.disabled);const m=c.getOrCreateProgram("clippingMask");for(const y of t){const x=c._tileClippingMaskIDs[y.key]=--n;m.draw(c,p.TRIANGLES,et.disabled,new Mt({func:p.ALWAYS,mask:0},x,255,p.KEEP,p.KEEP,p.REPLACE),qt.disabled,bt.disabled,Do(y.projMatrix),"$clipping",c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}}pointCoordinate(t){const n=this.painter.transform;if(t.x<0||t.x>n.width||t.y<0||t.y>n.height)return null;const c=[t.x,t.y,1,1];o.aA(c,c,n.pixelMatrixInverse),o.cw(c,c,1/c[3]),c[0]/=n.worldSize,c[1]/=n.worldSize;const d=n._camera.position,p=o.c6(1,n.center.lat),m=[d[0],d[1],d[2]/p,0],y=o.cX([],c.slice(0,3),m);o.au(y,y);const x=this.raycast(m,y,this._exaggeration);return x!==null&&x?(o.bE(m,m,y,x),m[3]=m[2],m[2]*=p,m):null}_setupProxiedCoordsForOrtho(t,n,c){if(t.getSource()instanceof o.aP)return this._setupProxiedCoordsForImageSource(t,n,c);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const d=this.proxiedCoords[t.id]=[],p=this.proxyCoords;for(let x=0;x<p.length;x++){const T=p[x],S=this._findTileCoveringTileID(T,t);if(S){const M=this._createProxiedId(T,S,c[T.key]&&c[T.key][t.id]);d.push(M),this.proxyToSource[T.key][t.id]=[M]}}let m=!1;const y=new Set;for(let x=0;x<n.length;x++){const T=t.getTile(n[x]);if(!T||!T.hasData())continue;const S=this._findTileCoveringTileID(T.tileID,this.proxySourceCache);if(S&&S.tileID.canonical.z!==T.tileID.canonical.z){const M=this.proxyToSource[S.tileID.key][t.id],I=this._createProxiedId(S.tileID,T,c[S.tileID.key]&&c[S.tileID.key][t.id]);M?M.splice(M.length-1,0,I):this.proxyToSource[S.tileID.key][t.id]=[I];const C=this.proxyToSource[S.tileID.key][t.id];y.has(C)||y.add(C),d.push(I),m=!0}}if(this._sourceTilesOverlap[t.id]=m,m&&this._debugParams.sortTilesHiZFirst)for(const x of y)x.sort((T,S)=>S.overscaledZ-T.overscaledZ)}_setupProxiedCoordsForImageSource(t,n,c){if(!t.getSource().loaded())return;const d=this.proxiedCoords[t.id]=[],p=this.proxyCoords,m=t.getSource(),y=m.tileID;if(!y)return;const x=new o.P(y.x,y.y)._div(1<<y.z),T=m.coordinates.map(o.ac.fromLngLat).reduce((M,I)=>(M.min.x=Math.min(M.min.x,I.x-x.x),M.min.y=Math.min(M.min.y,I.y-x.y),M.max.x=Math.max(M.max.x,I.x-x.x),M.max.y=Math.max(M.max.y,I.y-x.y),M),{min:new o.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new o.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),S=(M,I)=>{const C=M.wrap+M.canonical.x/(1<<M.canonical.z),L=M.canonical.y/(1<<M.canonical.z),R=o.aj/(1<<M.canonical.z),F=I.wrap+I.canonical.x/(1<<I.canonical.z),B=I.canonical.y/(1<<I.canonical.z);return C+R<F+T.min.x||C>F+T.max.x||L+R<B+T.min.y||L>B+T.max.y};for(let M=0;M<p.length;M++){const I=p[M];for(let C=0;C<n.length;C++){const L=t.getTile(n[C]);if(!L||!L.hasData()||S(I,L.tileID))continue;const R=this._createProxiedId(I,L,c[I.key]&&c[I.key][t.id]),F=this.proxyToSource[I.key][t.id];F?F.push(R):this.proxyToSource[I.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,y,x;d=o.bz();const T=n.tileID.wrap-t.wrap<<t.overscaledZ;p>0?(m=o.aj>>p,y=m*((n.tileID.canonical.x<<p)-t.canonical.x+T),x=m*((n.tileID.canonical.y<<p)-t.canonical.y)):(m=o.aj<<-p,y=o.aj*(n.tileID.canonical.x-(t.canonical.x+T<<-p)),x=o.aj*(n.tileID.canonical.y-(t.canonical.y<<-p))),o.c5(d,0,m,0,m,0,1),o.bo(d,d,[y,x,0])}return new Fc(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];
2645if(c=p?n.getTileByID(p):null,c&&c.hasData()||p===null)return c;let m=c?c.tileID:t,y=m.overscaledZ;const x=n.getSource().minzoom,T=[];if(!p){const M=n.getSource().maxzoom;if(t.canonical.z>=M){const I=t.canonical.z-M;n.getSource().reparseOverscaled?(y=Math.max(t.canonical.z+2,n.transform.tileZoom),m=new o.aM(y,t.wrap,M,t.canonical.x>>I,t.canonical.y>>I)):I!==0&&(y=M,m=new o.aM(y,t.wrap,M,t.canonical.x>>I,t.canonical.y>>I))}m.key!==t.key&&(T.push(m.key),c=n.getTile(m))}const S=M=>{T.forEach(I=>{d[I]=M}),T.length=0};for(y-=1;y>=x&&(!c||!c.hasData());y--){c&&S(c.tileID.key);const M=m.calculateScaledKey(y);if(c=n.getTileByID(M),c&&c.hasData())break;const I=d[M];if(I===null)break;I===void 0?T.push(M):c=n.getTileByID(I)}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 kc(l,t,n){const c=function(y,x,T){const S=o.bG(x,y),M=o.bG(T,[.2126,.7152,.0722]),I=(L,R,F)=>(1-F)*L+F*R,C=I(1-.3*Math.min(M,1),1,Math.min(S+1,1));return I(.92,1,Math.asin(o.ay(x[2],-1,1))/Math.PI+.5)*C}(l,[0,0,1],t),d=[0,0,0];o.bY(d,n.slice(0,3),c);const p=[0,0,0];o.bY(p,t.slice(0,3),l[2]);const m=[0,0,0];return o.cV(m,d,p),o.cY(m)}const Ju=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],Qu=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","elevatedStructures","model","symbol"];class Oc{static cacheKey(t,n,c,d){let p=`${n}${d?d.cacheKey:""}`;for(const m of c)t.usedDefines.includes(m)&&(p+=`/${m}`);return p}constructor(t,n,c,d,p,m){const y=t.gl;this.program=y.createProgram(),this.configuration=d,this.name=n,this.fixedDefines=[...m];const x=d?d.getBinderAttributes():[],T=(c.staticAttributes||[]).concat(x);let S=d?d.defines():[];S=S.concat(m.map(F=>`#define ${F}`));const M=`#version 300 es 2646`;let I=M+S.concat("precision mediump float;",as,vl.fragmentSource).join(` 2647`);for(const F of c.fragmentIncludes)I+=` 2648${ya[F]}`;I+=` 2649${c.fragmentSource}`;let C=M+S.concat("precision highp float;",as,vl.vertexSource).join(` 2650`);for(const F of c.vertexIncludes)C+=` 2651${ya[F]}`;this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&c.vertexSource.indexOf("gl_InstanceID")!==-1,this.forceManualRenderingForInstanceIDShaders&&(C+=` 2652uniform int u_instanceID; 2653`),C+=` 2654${c.vertexSource}`,this.forceManualRenderingForInstanceIDShaders&&(C=C.replaceAll("gl_InstanceID","u_instanceID"));const L=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(L,I),y.compileShader(L),y.attachShader(this.program,L);const R=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())this.failedToCreate=!0;else{y.shaderSource(R,C),y.compileShader(R),y.attachShader(this.program,R),this.attributes={},this.numAttributes=T.length;for(let F=0;F<this.numAttributes;F++)if(T[F]){const B=T[F].startsWith("a_")?T[F]:`a_${T[F]}`;y.bindAttribLocation(this.program,F,B),this.attributes[B]=F}y.linkProgram(this.program),y.deleteShader(R),y.deleteShader(L),this.fixedUniforms=p(t),this.binderUniforms=d?d.getUniforms(t):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(F=>({u_instanceID:new o.c8(F)}))(t)),(m.includes("TERRAIN")||n.indexOf("symbol")!==-1||n.indexOf("circle")!==-1)&&(this.terrainUniforms=(F=>({u_dem:new o.c8(F),u_dem_prev:new o.c8(F),u_dem_tl:new o.cb(F),u_dem_scale:new o.ca(F),u_dem_tl_prev:new o.cb(F),u_dem_scale_prev:new o.ca(F),u_dem_size:new o.ca(F),u_dem_lerp:new o.ca(F),u_exaggeration:new o.ca(F),u_depth:new o.c8(F),u_depth_size_inv:new o.cb(F),u_depth_range_unpack:new o.cb(F),u_occluder_half_size:new o.ca(F),u_occlusion_depth_offset:new o.ca(F),u_meter_to_dem:new o.ca(F),u_label_plane_matrix_inv:new o.cc(F)}))(t)),m.includes("GLOBE")&&(this.globeUniforms=(F=>({u_tile_tl_up:new o.c9(F),u_tile_tr_up:new o.c9(F),u_tile_br_up:new o.c9(F),u_tile_bl_up:new o.c9(F),u_tile_up_scale:new o.ca(F)}))(t)),m.includes("FOG")&&(this.fogUniforms=(F=>({u_fog_matrix:new o.cc(F),u_fog_range:new o.cb(F),u_fog_color:new o.cQ(F),u_fog_horizon_blend:new o.ca(F),u_fog_vertical_limit:new o.cb(F),u_fog_temporal_offset:new o.ca(F),u_frustum_tl:new o.c9(F),u_frustum_tr:new o.c9(F),u_frustum_br:new o.c9(F),u_frustum_bl:new o.c9(F),u_globe_pos:new o.c9(F),u_globe_radius:new o.ca(F),u_globe_transition:new o.ca(F),u_is_globe:new o.c8(F),u_viewport:new o.cb(F)}))(t)),m.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(F=>({u_cutoff_params:new o.cQ(F)}))(t)),m.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(F=>({u_lighting_ambient_color:new o.c9(F),u_lighting_directional_dir:new o.c9(F),u_lighting_directional_color:new o.c9(F),u_ground_radiance:new o.c9(F)}))(t)),m.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(F=>({u_light_matrix_0:new o.cc(F),u_light_matrix_1:new o.cc(F),u_fade_range:new o.cb(F),u_shadow_normal_offset:new o.c9(F),u_shadow_intensity:new o.ca(F),u_shadow_texel_size:new o.ca(F),u_shadow_map_resolution:new o.ca(F),u_shadow_direction:new o.c9(F),u_shadow_bias:new o.c9(F),u_shadowmap_0:new o.c8(F),u_shadowmap_1:new o.c8(F)}))(t))}}setTerrainUniformValues(t,n){if(!this.terrainUniforms)return;const c=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d]&&c[d].set(this.program,d,n[d])}}setGlobeUniformValues(t,n){if(!this.globeUniforms)return;const c=this.globeUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d]&&c[d].set(this.program,d,n[d])}}setFogUniformValues(t,n){if(!this.fogUniforms)return;const c=this.fogUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}}setCutoffUniformValues(t,n){if(!this.cutoffUniforms)return;const c=this.cutoffUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}}setLightsUniformValues(t,n){if(!this.lightsUniforms)return;const c=this.lightsUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}}setShadowUniformValues(t,n){if(this.failedToCreate||!this.shadowUniforms)return;const c=this.shadowUniforms;t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}_drawDebugWireframe(t,n,c,d,p,m,y,x,T,S){const M=t.options.wireframe;if(M.terrain===!1&&M.layers2D===!1&&M.layers3D===!1)return;const I=t.context;if(!(!(!M.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!M.layers2D||t._terrain&&t._terrain.renderingToTexture||!Ju.includes(this.name))||!(!M.layers3D||!Qu.includes(this.name))))return;const C=I.gl,L=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,p,I);if(!L)return;const R=[...this.fixedDefines];
2654R.push("DEBUG_WIREFRAME");const F=t.getOrCreateProgram(this.name,{config:this.configuration,defines:R});I.program.set(F.program);const B=(Y,te,ee)=>{if(te[Y]&&ee[Y])for(const J in te[Y])ee[Y][J]&&ee[Y][J].set(ee.program,J,te[Y][J].current)};T&&T.setUniforms(F.program,I,F.binderUniforms,y,{zoom:x}),B("fixedUniforms",this,F),B("terrainUniforms",this,F),B("globeUniforms",this,F),B("fogUniforms",this,F),B("lightsUniforms",this,F),B("shadowUniforms",this,F),L.bind(),I.setColorMode(new qt([C.ONE,C.ONE_MINUS_SRC_ALPHA,C.ZERO,C.ONE],o.am.transparent,[!0,!0,!0,!1])),I.setDepthMode(new et(n.func===C.LESS?C.LEQUAL:n.func,et.ReadOnly,n.range)),I.setStencilMode(Mt.disabled);const V=3*m.primitiveLength*2,Z=3*m.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const Y=S||1;for(let te=0;te<Y;++te)F.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",te),C.drawElements(C.LINES,V,C.UNSIGNED_SHORT,Z)}else S&&S>1?C.drawElementsInstanced(C.LINES,V,C.UNSIGNED_SHORT,Z,S):C.drawElements(C.LINES,V,C.UNSIGNED_SHORT,Z);p.bind(),I.program.set(this.program),I.setDepthMode(n),I.setStencilMode(c),I.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,y,x,T,S,M,I,C,L,R,F){const B=t.context,V=B.gl;if(this.failedToCreate)return;B.program.set(this.program),B.setDepthMode(c),B.setStencilMode(d),B.setColorMode(p),B.setCullFace(m);for(const te of Object.keys(this.fixedUniforms))this.fixedUniforms[te].set(this.program,te,y[te]);L&&L.setUniforms(this.program,B,this.binderUniforms,I,{zoom:C});const Z={[V.POINTS]:1,[V.LINES]:2,[V.TRIANGLES]:3,[V.LINE_STRIP]:1}[n];this.checkUniforms(x,"RENDER_SHADOWS",this.shadowUniforms);const Y=F&&F>0?1:void 0;for(const te of M.get()){const ee=te.vaos||(te.vaos={});if((ee[x]||(ee[x]=new xa)).bind(B,this,T,L?L.getPaintVertexBuffers():[],S,te.vertexOffset,R||[],Y),this.forceManualRenderingForInstanceIDShaders){const J=F||1;for(let K=0;K<J;++K)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",K),S?V.drawElements(n,te.primitiveLength*Z,V.UNSIGNED_SHORT,te.primitiveOffset*Z*2):V.drawArrays(n,te.vertexOffset,te.vertexLength)}else F&&F>1?V.drawElementsInstanced(n,te.primitiveLength*Z,V.UNSIGNED_SHORT,te.primitiveOffset*Z*2,F):S?V.drawElements(n,te.primitiveLength*Z,V.UNSIGNED_SHORT,te.primitiveOffset*Z*2):V.drawArrays(n,te.vertexOffset,te.vertexLength);n===V.TRIANGLES&&S&&this._drawDebugWireframe(t,c,d,p,S,te,I,C,L,F)}}}function Tl(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/o.aw(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 Ta={terrain:0,flat:1},eh=o.bz(),Sl=(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,R,F,B)=>{const V=t.style.light,Z=V.properties.get("position"),Y=[Z.x,Z.y,Z.z],te=o.dx();V.properties.get("anchor")==="viewport"&&(o.dy(te,-t.transform.angle),o.dz(Y,Y,te));const ee=V.properties.get("color").toPremultipliedRenderColor(null),J=t.transform,K={u_matrix:l,u_lightpos:Y,u_lightintensity:V.properties.get("intensity"),u_lightcolor:[ee.r,ee.g,ee.b],u_vertical_gradient:+n,u_opacity:c,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:eh,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Ta[T],u_base_type:Ta[S],u_ao:d,u_edge_radius:p,u_width_scale:m,u_flood_light_color:L,u_vertical_scale:R,u_flood_light_intensity:F,u_ground_shadow_factor:B};return J.projection.name==="globe"&&(K.u_tile_id=[y.canonical.x,y.canonical.y,1<<y.canonical.z],K.u_zoom_transition=M,K.u_inv_rot_matrix=C,K.u_merc_center=I,K.u_up_dir=J.projection.upVector(new o.cp(0,0,0),I[0]*o.aj,I[1]*o.aj),K.u_height_lift=x),K},kd=(l,t,n,c,d,p)=>({u_matrix:l,u_edge_radius:t,u_width_scale:n,u_vertical_scale:c,u_height_type:Ta[d],u_base_type:Ta[p]}),Od=(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,R,F,B)=>{const V=Sl(l,t,n,c,d,p,m,y,T,S,M,I,C,L,R,F,1,[0,0,0]),Z={u_height_factor:-Math.pow(2,y.overscaledZ
2654)/x.tileSize/8};return o.h(V,Tl(t,x,B),Z)},Fo=(l,t,n)=>({u_matrix:l,u_emissive_strength:t,u_ground_shadow_factor:n}),Bd=(l,t,n,c,d,p=0)=>o.h(Fo(l,t,d),Tl(n,c,p)),Of=(l,t,n,c)=>({u_matrix:l,u_world:n,u_emissive_strength:t,u_ground_shadow_factor:c}),Bf=(l,t,n,c,d,p,m=0)=>o.h(Bd(l,t,n,c,p,m),{u_world:d}),Nf=(l,t)=>({u_matrix:l,u_ground_shadow_factor:t}),Bc=(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}),Vf=(l,t,n,c)=>{const d=o.aj/n.tileSize;return{u_matrix:l,u_camera_to_center_distance:t.getCameraToCenterDistance(c),u_extrude_scale:[t.pixelsToGLUnits[0]/d,t.pixelsToGLUnits[1]/d]}},Nc=(l,t,n=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:n}),th=o.bz(),Nd=(l,t,n,c,d,p,m)=>{const y=l.transform,x=y.projection.name==="globe",T=x?o.dA(y.zoom,t.canonical)*y._pixelsPerMercatorPixel:o.aw(n,1,p),S={u_matrix:t.projMatrix,u_extrude_scale:T,u_intensity:m,u_inv_rot_matrix:th,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(x){S.u_inv_rot_matrix=c,S.u_merc_center=d,S.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],S.u_zoom_transition=o.ah(y.zoom);const M=d[0]*o.aj,I=d[1]*o.aj;S.u_up_dir=y.projection.upVector(new o.cp(0,0,0),M,I)}return S};function ko(l,[t,n,c,d],[p,m]){if(p===m)return[0,0,0,0];const y=255*(l-1)/(l*(m-p));return[t*y,n*y,c*y,d*y]}function ih(l,t,[n,c]){return n===c?0:.5/l+(t-n)*(l-1)/(l*(c-n))}const rh=(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,R,F,B,V,Z,Y)=>({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:T,u_fade_t:S.mix,u_opacity:S.opacity*M.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:M.paint.get("raster-brightness-min"),u_brightness_high:M.paint.get("raster-brightness-max"),u_saturation_factor:o.dC(M.paint.get("raster-saturation")),u_contrast_factor:o.dB(M.paint.get("raster-contrast")),u_spin_weights:Vd(M.paint.get("raster-hue-rotate")),u_perspective_transform:I,u_raster_elevation:C,u_zoom_transition:m,u_merc_center:y,u_cutoff_params:x,u_colorization_mix:ko(o.dD,R,B),u_colorization_offset:ih(o.dD,F,B),u_color_ramp:L,u_texture_offset:[Z/(V+2*Z),V/(V+2*Z)],u_texture_res:[V+2*Z,V+2*Z],u_emissive_strength:Y});function Vd(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 Ks=.05,Oo=(l,t,n,c,d,p,m,y,x,T,S,M)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:n,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:p,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity,u_image0:0,u_image1:1,u_raster_elevation:M,u_zoom_transition:m,u_merc_center:y,u_cutoff_params:x}),Ud=(l,t,n,c,d,p,m,y,x,T)=>({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:y,u_data_scale:[255*x[0],255*x[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[Ks,Ks]}),Js=(l,t,n,c,d,p,m,y,x,T)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_velocity:n,u_velocity_res:c,u_max_speed:d,u_speed_factor:p,u_reset_rate:m,u_rand_seed:Math.random(),u_uv_offset:y,u_data_scale:[255*x[0],255*x[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[Ks,Ks]}),Vc=o.bz(),El=(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,R,F,B,V,Z,Y,te,ee,J)=>{const K=d.transform,ie={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:K.getCameraToCenterDistance(V),u_rotate_symbol:+n,u_aspect_ratio:K.width/K.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:m,u_coord_matrix:y,u_is_text:+T,u_elevation_from_sea:x?1:0,u_pitch_with_map:+c,u_texsize: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:Vc,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Vc,u_up_vector:[0,-1,0],u_color_adj_mat:te,u_icon_transition:ee||0,u_gamma_scale:c?d.transform.getCameraToCenterDistance(V)*Math.cos(d.terrain?0:d.transform._pitch):1,u_device_pixel_ratio:o.q.devicePixelRatio,u_is_halo:1,u_scale_factor:J||1,u_ground_shadow_factor:Z,u_inv_matrix:o.bi(o.bz(),m),u_normal_scale:Y};
2654return V.name==="globe"&&(ie.u_tile_id=[C.canonical.x,C.canonical.y,1<<C.canonical.z],ie.u_zoom_transition=L,ie.u_inv_rot_matrix=F,ie.u_merc_center=R,ie.u_camera_forward=K._camera.forward(),ie.u_ecef_origin=o.dE(K.globeMatrix,C.toUnwrapped()),ie.u_tile_matrix=Float32Array.from(K.globeMatrix),ie.u_up_vector=B),ie},nh=(l,t,n,c)=>({u_matrix:l,u_emissive_strength:t,u_opacity:n,u_color:c}),sh=(l,t,n,c,d,p,m,y,x)=>o.h(function(T,S,M,I,C,L){const{width:R,height:F}=I.imageManager.getPixelSize(S),B=Math.pow(2,L.tileID.overscaledZ),V=L.tileSize*Math.pow(2,I.transform.tileZoom)/B,Z=V*(L.tileID.canonical.x+L.tileID.wrap*B),Y=V*L.tileID.canonical.y;return{u_image:0,u_pattern_tl:M.tl,u_pattern_br:M.br,u_texsize:[R,F],u_pattern_size:M.displaySize,u_pattern_units_to_pixels:C?[I.transform.width,-1*I.transform.height]:[1/o.aw(L,1,I.transform.tileZoom),1/o.aw(L,1,I.transform.tileZoom)],u_pixel_coord_upper:[Z>>16,Y>>16],u_pixel_coord_lower:[65535&Z,65535&Y]}}(0,p,m,c,y,x),{u_matrix:l,u_emissive_strength:t,u_opacity:n}),Il=new Float32Array(o.bx([])),Al=(l,t,n,c,d,p,m,y,x,T,S,M,I,C=[0,0,0],L)=>{const R=d.style.light,F=R.properties.get("position"),B=[-F.x,-F.y,F.z],V=o.dx();R.properties.get("anchor")==="viewport"&&(o.dy(V,-d.transform.angle),o.dz(B,B,V));const Z=S.alphaMode==="MASK",Y=R.properties.get("color").toNonPremultipliedRenderColor(null),te=I.paint.get("model-ambient-occlusion-intensity"),ee=I.paint.get("model-color").constantOr(o.am.white).toNonPremultipliedRenderColor(null);return ee.a=I.paint.get("model-color-mix-intensity").constantOr(0),{u_matrix:l,u_lighting_matrix:t,u_normal_matrix:n,u_node_matrix:c||Il,u_lightpos:B,u_lightintensity:R.properties.get("intensity"),u_lightcolor:[Y.r,Y.g,Y.b],u_camera_pos:C,u_opacity:p,u_baseTextureIsAlpha:0,u_alphaMask:+Z,u_alphaCutoff:S.alphaCutoff,u_baseColorFactor:m.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:y.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:x,u_roughnessFactor:T,u_baseColorTexture:sn.BaseColor,u_metallicRoughnessTexture:sn.MetallicRoughness,u_normalTexture:sn.Normal,u_occlusionTexture:sn.Occlusion,u_emissionTexture:sn.Emission,u_lutTexture:sn.LUT,u_color_mix:ee.toArray01(),u_aoIntensity:te,u_emissive_strength:M,u_occlusionTextureTransform:L||[0,0,0,0]}},jd=(l,t=Il,n=Il)=>({u_matrix:l,u_instance:t,u_node_matrix:n}),Gd={fillExtrusion:l=>({u_matrix:new o.cc(l),u_lightpos:new o.c9(l),u_lightintensity:new o.ca(l),u_lightcolor:new o.c9(l),u_vertical_gradient:new o.ca(l),u_opacity:new o.ca(l),u_edge_radius:new o.ca(l),u_width_scale:new o.ca(l),u_ao:new o.cb(l),u_height_type:new o.c8(l),u_base_type:new o.c8(l),u_tile_id:new o.c9(l),u_zoom_transition:new o.ca(l),u_inv_rot_matrix:new o.cc(l),u_merc_center:new o.cb(l),u_up_dir:new o.c9(l),u_height_lift:new o.ca(l),u_flood_light_color:new o.c9(l),u_vertical_scale:new o.ca(l),u_flood_light_intensity:new o.ca(l),u_ground_shadow_factor:new o.c9(l)}),fillExtrusionDepth:l=>({u_matrix:new o.cc(l),u_edge_radius:new o.ca(l),u_width_scale:new o.ca(l),u_vertical_scale:new o.ca(l),u_height_type:new o.c8(l),u_base_type:new o.c8(l)}),fillExtrusionPattern:l=>({u_matrix:new o.cc(l),u_lightpos:new o.c9(l),u_lightintensity:new o.ca(l),u_lightcolor:new o.c9(l),u_vertical_gradient:new o.ca(l),u_height_factor:new o.ca(l),u_edge_radius:new o.ca(l),u_width_scale:new o.ca(l),u_ao:new o.cb(l),u_height_type:new o.c8(l),u_base_type:new o.c8(l),u_tile_id:new o.c9(l),u_zoom_transition:new o.ca(l),u_inv_rot_matrix:new o.cc(l),u_merc_center:new o.cb(l),u_up_dir:new o.c9(l),u_height_lift:new o.ca(l),u_image:new o.c8(l),u_texsize:new o.cb(l),u_pixel_coord_upper:new o.cb(l),u_pixel_coord_lower:new o.cb(l),u_tile_units_to_pixels:new o.ca(l),u_opacity:new o.ca(l),u_pattern_transition:new o.ca(l)}),fillExtrusionGroundEffect:l=>({u_matrix:new o.cc(l),u_opacity:new o.ca(l),u_ao_pass:new o.ca(l),u_meter_to_tile:new o.ca(l),u_ao:new o.cb(l),u_flood_light_intensity:new o.ca(l),u_flood_light_color:new o.c9(l),u_attenuation:new o.ca(l),u_edge_radius:new o.ca(l),u_fb:new o.c8(l),u_fb_size:new o.ca(l),u_dynamic_offset:new o.ca(l)}),fill:l=>({u_matrix:new o.cc(l),u_emissive_strength:new o.ca(l),u_ground_shadow_factor:new o.c9(l)}),fillPattern:l=>({u_matrix:new o.cc(l),u_emissive_strength:new o.ca(l),u_image:new o.c8(l),u_texsize:new o.cb(l),u_pixel_coord_upper:new o.cb(l),u_pixel_coord_lower:new o.cb(l),u_tile_units_to_pixels:new o.ca(l),u_ground_shadow_factor:new o.c9(l),u_pattern_transition:new o.ca(l)}),fillOutline:l=>({u_matrix:new o.cc(l),u_emissive_strength:new o.ca(l),u_world:new o.cb(l),u_ground_shadow_factor:new o.c9(l)}),fillOutlinePattern:l=>({u_matrix:new o.cc(l),u_emissive_strength:new o.ca(l),u_world:new o.cb(l),u_image:new o.c8(l),u_texsize:new o.cb(l),u_pixel_coord_upper:new o.cb(l),u_pixel_coord_lower:new o.cb(l),u_tile_units_to_pixels:new o.ca(l),u_ground_shadow_factor:new o.c9(l),u_pattern_transition:new o.ca(l)}),building:l=>({u_matrix:new o.cc(l),u_normal_matrix:new o.cc(l),u_opacity:new o.ca(l)}),buildingDepth:l=>({u_matrix:new o.cc(l)}),elevatedStructuresDepth:l=>({u_matrix:new o.cc(l),u_depth_bias:new o.ca(l)}),elevatedStructures:l=>({u_matrix:new o.cc(l),u_ground_shadow_factor:new o.c9(l)}),elevatedStructuresDepthReconstruct:l=>({u_matrix:new o.cc(l),u_camera_pos:new o.c9(l),u_depth_bias:new o.ca(l),u_height_scale:new o.ca(l),u_reset_depth:new o.ca(l)}),circle:o.dH,collisionBox:l=>({u_matrix:new o.cc(l),u_camera_to_center_distance:new o.ca(l),u_extrude_scale:new o.cb(l)}),collisionCircle:l=>({u_matrix:new o.cc(l),u_inv_matrix:new o.cc(l),u_camera_to_center_distance:new o.ca(l),u_viewport_size:new o.cb(l)}),debug:l=>({u_color:new o.di(l),u_matrix:new o.cc(l),u_overlay:new o.c8(l),u_overlay_scale:new o.ca(l)}),clippingMask:l=>({u_matrix:new o.cc(l)}),heatmap:l=>({u_extrude_scale:new o.ca(l),u_intensity:new o.ca(l),u_matrix:new o.cc(l),u_inv_rot_matrix:new o.cc(l),u_merc_center:new o.cb(l),u_tile_id:new o.c9(l),u_zoom_transition:new o.ca(l),u_up_dir:new o.c9(l)}),heatmapTexture:l=>({u_image:new o.c8(l),u_color_ramp:new o.c8(l),u_opacity:new o.ca(l)}),hillshade:l=>({u_matrix:new o.cc(l),u_image:new o.c8(l),u_latrange:new o.cb(l),u_light:new o.cb(l),u_shadow:new o.di(l),u_highlight:new o.di(l),u_emissive_strength:new o.ca(l),u_accent:new o.di(l)}),hillshadePrepare:l=>({u_matrix:new o.cc(l),u_image:new o.c8(l),u_dimension:new o.cb(l),u_zoom:new o.ca(l)}),line:o.dG,linePattern:o.dF,raster:l=>({u_matrix:new o.cc(l),u_normalize_matrix:new o.cc(l),u_globe_matrix:new o.cc(l),u_merc_matrix:new o.cc(l),u_grid_matrix:new o.dj(l),u_tl_parent:new o.cb(l),u_scale_parent:new o.ca(l),u_fade_t:new o.ca(l),u_opacity:new o.ca(l),u_image0:new o.c8(l),u_image1:new o.c8(l),u_brightness_low:new o.ca(l),u_brightness_high:new o.ca(l),u_saturation_factor:new o.ca(l),u_contrast_factor:new o.ca(l),u_spin_weights:new o.c9(l),u_perspective_transform:new o.cb(l),u_raster_elevation:new o.ca(l),u_zoom_transition:new o.ca(l),u_merc_center:new o.cb(l),u_cutoff_params:new o.cQ(l),u_colorization_mix:new o.cQ(l),u_colorization_offset:new o.ca(l),u_color_ramp:new o.c8(l),u_texture_offset:new o.cb(l),u_texture_res:new o.cb(l),u_emissive_strength:new o.ca(l)}),rasterParticle:l=>({u_matrix:new o.cc(l),u_normalize_matrix:new o.cc(l),u_globe_matrix:new o.cc(l),u_merc_matrix:new o.cc(l),u_grid_matrix:new o.dj(l),u_tl_parent:new o.cb(l),u_scale_parent:new o.ca(l),u_fade_t:new o.ca(l),u_opacity:new o.ca(l),u_image0:new o.c8(l),u_image1:new o.c8(l),u_raster_elevation:new o.ca(l),u_zoom_transition:new o.ca(l),u_merc_center:new o.cb(l),u_cutoff_params:new o.cQ(l)}),rasterParticleTexture:l=>({u_texture:new o.c8(l),u_opacity:new o.ca(l)}),rasterParticleDraw:l=>({u_particle_texture:new o.c8(l),u_particle_texture_side_len:new o.ca(l),u_tile_offset:new o.cb(l),u_velocity:new o.c8(l),u_color_ramp:new o.c8(l),u_velocity_res:new o.cb(l),u_max_speed:new o.ca(l),u_uv_offset:new o.cb(l),u_data_scale:new o.cb(l),u_data_offset:new o.ca(l),u_particle_pos_scale:new o.ca(l),u_particle_pos_offset:new o.cb(l)}),rasterParticleUpdate:l=>({u_particle_texture:new o.c8(l),u_particle_texture_side_len:new o.ca(l),u_velocity:new o.c8(l),u_velocity_res:new o.cb(l),u_max_speed:new o.ca(l),u_speed_factor:new o.ca(l),u_reset_rate:new o.ca(l),u_rand_seed:new o.ca(l),u_uv_offset:new o.cb(l),u_data_scale:new o.cb(l),u_data_offset:new o.ca(l),u_particle_pos_scale:new o.ca(l),u_particle_pos_offset:new o.cb(l)}),symbol:l=>({u_is_size_zoom_constant:new o.c8(l),u_is_size_feature_constant:new o.c8(l),u_size_t:new o.ca(l),u_size:new o.ca(l),u_camera_to_center_distance:new o.ca(l),u_rotate_symbol:new o.c8(l),u_aspect_ratio:new o.ca(l),u_fade_change:new o.ca(l),u_matrix:new o.cc(l),u_label_plane_matrix:new o.cc(l),u_coord_matrix:new o.cc(l),u_is_text:new o.c8(l),u_elevation_from_sea:new o.c8(l),u_pitch_with_map:new o.c8(l),u_texsize:new o.cb(l),u_texsize_icon:new o.cb(l),u_texture:new o.c8(l),u_texture_icon:new o.c8(l),u_gamma_scale:new o.ca(l),u_device_pixel_ratio:new o.ca(l),u_tile_id:new o.c9(l),u_zoom_transition:new o.ca(l),u_inv_rot_matrix:new o.cc(l),u_merc_center:new o.cb(l),u_camera_forward:new o.c9(l),u_tile_matrix:new o.cc(l),u_up_vector:new o.c9(l),u_ecef_origin:new o.c9(l),u_is_halo:new o.c8(l),u_icon_transition:new o.ca(l),u_color_adj_mat:new o.cc(l),u_scale_factor:new o.ca(l),u_ground_shadow_factor:new o.c9(l),u_inv_matrix:new o.cc(l),u_normal_scale:new o.ca(l)}),background:l=>({u_matrix:new o.cc(l),u_emissive_strength:new o.ca(l),u_opacity:new o.ca(l),u_color:new o.di(l)}),backgroundPattern:l=>({u_matrix:new o.cc(l),u_emissive_strength:new o.ca(l),u_opacity:new o.ca(l),u_image:new o.c8(l),u_pattern_tl:new o.cb(l),u_pattern_br:new o.cb(l),u_texsize:new o.cb(l),u_pattern_size:new o.cb(l),u_pixel_coord_upper:new o.cb(l),u_pixel_coord_lower:new o.cb(l),u_pattern_units_to_pixels:new o.cb(l)}),terrainRaster:l=>({u_matrix:new o.cc(l),u_image0:new o.c8(l),u_skirt_height:new o.ca(l),u_ground_shadow_factor:new o.c9(l)}),skybox:l=>({u_matrix:new o.cc(l),u_sun_direction:new o.c9(l),u_cubemap:new o.c8(l),u_opacity:new o.ca(l),u_temporal_offset:new o.ca(l)}),skyboxGradient:l=>({u_matrix:new o.cc(l),u_color_ramp:new o.c8(l),u_center_direction:new o.c9(l),u_radius:new o.ca(l),u_opacity:new o.ca(l),u_temporal_offset:new o.ca(l)}),skyboxCapture:l=>({u_matrix_3f:new o.dj(l),u_sun_direction:new o.c9(l),u_sun_intensity:new o.ca(l),u_color_tint_r:new o.cQ(l),u_color_tint_m:new o.cQ(l),u_luminance:new o.ca(l)}),globeRaster:l=>({u_proj_matrix:new o.cc(l),u_globe_matrix:new o.cc(l),u_normalize_matrix:new o.cc(l),u_merc_matrix:new o.cc(l),u_zoom_transition:new o.ca(l),u_merc_center:new o.cb(l),u_image0:new o.c8(l),u_grid_matrix:new o.dj(l),u_skirt_height:new o.ca(l),u_far_z_cutoff:new o.ca(l),u_frustum_tl:new o.c9(l),u_frustum_tr:new o.c9(l),u_frustum_br:new o.c9(l),u_frustum_bl:new o.c9(l),u_globe_pos:new o.c9(l),u_globe_radius:new o.ca(l),u_viewport:new o.cb(l)}),globeAtmosphere:l=>({u_frustum_tl:new o.c9(l),u_frustum_tr:new o.c9(l),u_frustum_br:new o.c9(l),u_frustum_bl:new o.c9(l),u_horizon:new o.ca(l),u_transition:new o.ca(l),u_fadeout_range:new o.ca(l),u_color:new o.cQ(l),u_high_color:new o.cQ(l),u_space_color:new o.cQ(l),u_temporal_offset:new o.ca(l),u_horizon_angle:new o.ca(l)}),model:l=>({u_matrix:new o.cc(l),u_lighting_matrix:new o.cc(l),u_normal_matrix:new o.cc(l),u_node_matrix:new o.cc(l),u_lightpos:new o.c9(l),u_lightintensity:new o.ca(l),u_lightcolor:new o.c9(l),u_camera_pos:new o.c9(l),u_opacity:new o.ca(l),u_baseColorFactor:new o.cQ(l),u_emissiveFactor:new o.cQ(l),u_metallicFactor:new o.ca(l),u_roughnessFactor:new o.ca(l),u_baseTextureIsAlpha:new o.c8(l),u_alphaMask:new o.c8(l),u_alphaCutoff:new o.ca(l),u_baseColorTexture:new o.c8(l),u_metallicRoughnessTexture:new o.c8(l),u_normalTexture:new o.c8(l),u_occlusionTexture:new o.c8(l),u_emissionTexture:new o.c8(l),u_lutTexture:new o.c8(l),u_color_mix:new o.cQ(l),u_aoIntensity:new o.ca(l),u_emissive_strength:new o.ca(l),u_occlusionTextureTransform:new o.cQ(l)}),modelDepth:l=>({u_matrix:new o.cc(l),u_instance:new o.cc(l),u_node_matrix:new o.cc(l)}),groundShadow:l=>({u_matrix:new o.cc(l),u_ground_shadow_factor:new o.c9(l)}),stars:l=>({u_matrix:new o.cc(l),u_up:new o.c9(l),u_right:new o.c9(l),u_intensity_multiplier:new o.ca(l)}),snowParticle:l=>({u_modelview:new o.cc(l),u_projection:new o.cc(l),u_time:new o.ca(l),u_cam_pos:new o.c9(l),u_velocityConeAperture:new o.ca(l),u_velocity:new o.ca(l),u_horizontalOscillationRadius:new o.ca(l),u_horizontalOscillationRate:new o.ca(l),u_boxSize:new o.ca(l),u_billboardSize:new o.ca(l),u_simpleShapeParameters:new o.cb(l),u_screenSize:new o.cb(l),u_thinningCenterPos:new o.cb(l),u_thinningShape:new o.c9(l),u_thinningAffectedRatio:new o.ca(l),u_thinningParticleOffset:new o.ca(l),u_particleColor:new o.cQ(l),u_direction:new o.c9(l)}),rainParticle:l=>({u_modelview:new o.cc(l),u_projection:new o.cc(l),u_time:new o.ca(l),u_cam_pos:new o.c9(l),u_texScreen:new o.c8(l),u_velocityConeAperture:new o.ca(l),u_velocity:new o.ca(l),u_boxSize:new o.ca(l),u_rainDropletSize:new o.cb(l),u_distortionStrength:new o.ca(l),u_rainDirection:new o.c9(l),u_color:new o.cQ(l),u_screenSize:new o.cb(l),u_thinningCenterPos:new o.cb(l),u_thinningShape:new o.c9(l),u_thinningAffectedRatio:new o.ca(l),u_thinningParticleOffset:new o.ca(l),u_shapeDirectionalPower:new o.ca(l),u_shapeNormalPower:new o.ca(l),u_mode:new o.ca(l)}),vignette:l=>({u_vignetteShape:new o.c9(l),u_vignetteColor:new o.cQ(l)}),occlusion:l=>({u_matrix:new o.cc(l),u_anchorPos:new o.c9(l),u_screenSizePx:new o.cb(l),u_occluderSizePx:new o.cb(l),u_color:new o.cQ(l)})};class Vn{constructor(t,n,c,d){this.id=Vn.uniqueIdxCounter,Vn.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=Vn.uniqueIdxCounter,Vn.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)}}Vn.uniqueIdxCounter=0;const Uf={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class jf{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 y=t.gl;this.buffer=y.createBuffer(),t.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||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)}
2654enableAttributes(t,n){for(let c=0;c<this.attributes.length;c++){const d=n.attributes[this.attributes[c].name];d!==void 0&&t.enableVertexAttribArray(d)}}setVertexAttribPointers(t,n,c){for(let d=0;d<this.attributes.length;d++){const p=this.attributes[d],m=n.attributes[p.name];m!==void 0&&t.vertexAttribPointer(m,p.components,t[Uf[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.attributes[this.attributes[d].name];p!==void 0&&this.instanceCount&&this.instanceCount>0&&t.vertexAttribDivisor(p,c)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class oh{constructor(t,n,c,d,p){this.context=t,this.width=n,this.height=c;const m=this.framebuffer=t.gl.createFramebuffer();d&&(this.colorAttachment=new Dd(t,m)),p&&(this.depthAttachmentType=p,this.depthAttachment=p==="renderbuffer"?new Ld(t,m):new Lf(t,m))}destroy(){const t=this.context.gl;if(this.colorAttachment){const n=this.colorAttachment.get();n&&t.deleteTexture(n)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const n=this.depthAttachment.get();n&&t.deleteRenderbuffer(n)}else{const n=this.depthAttachment.get();n&&t.deleteTexture(n)}t.deleteFramebuffer(this.framebuffer)}}class Gf{constructor(t,n){this.gl=t,this.clearColor=new Ed(this),this.clearDepth=new qu(this),this.clearStencil=new Mf(this),this.colorMask=new Cf(this),this.depthMask=new Pf(this),this.stencilMask=new zf(this),this.stencilFunc=new Id(this),this.stencilOp=new Rf(this),this.stencilTest=new Ic(this),this.depthRange=new Df(this),this.depthTest=new Ad(this),this.depthFunc=new $u(this),this.blend=new Ac(this),this.blendFunc=new Zu(this),this.blendColor=new Ro(this),this.blendEquation=new va(this),this.cullFace=new Mc(this),this.cullFaceSide=new Cc(this),this.frontFace=new ba(this),this.program=new Md(this),this.activeTexture=new Hu(this),this.viewport=new Cd(this),this.bindFramebuffer=new wa(this),this.bindRenderbuffer=new Pc(this),this.bindTexture=new zc(this),this.bindVertexBuffer=new Wu(this),this.bindElementBuffer=new Rc(this),this.bindVertexArrayOES=new bl(this),this.pixelStoreUnpack=new Pd(this),this.pixelStoreUnpackPremultiplyAlpha=new zd(this),this.pixelStoreUnpackFlipY=new Rd(this),this.options=n?Object.assign({},n):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=t.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=t.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=t.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=n&&!!n.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=t.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.maxPointSize=t.getParameter(t.ALIASED_POINT_SIZE_RANGE)[1]}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n,c){return new Vn(this,t,n,c)}createVertexBuffer(t,n,c,d,p){return new jf(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 oh(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){o.bv(t.blendFunction,qt.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 Sa;function Uc(l,t,n,c,d,p,m){const y=l.context,x=y.gl,T=l.transform,S=l.getOrCreateProgram("collisionBox"),M=[];let I=0,C=0;for(let Y=0;Y<c.length;Y++){const te=c[Y],ee=t.getTile(te),J=ee.getBucket(n);if(!J)continue;const K=Tt(te,J,T);let ie=K;d[0]===0&&d[1]===0||(ie=l.translatePosMatrix(K,ee,d,p));const ne=m?J.textCollisionBox:J.iconCollisionBox,fe=J.collisionCircleArray;
2654if(fe.length>0){const me=o.bz(),Ae=ie;o.cB(me,J.placementInvProjMatrix,T.glCoordMatrix),o.cB(me,me,J.placementViewportMatrix),M.push({circleArray:fe,circleOffset:C,transform:Ae,invTransform:me,projection:J.getProjection()}),I+=fe.length/4,C=I}ne&&(l.terrain&&l.terrain.setupElevationDraw(ee,S),S.draw(l,x.LINES,et.disabled,Mt.disabled,l.colorModeForRenderPass(),bt.disabled,Vf(ie,T,ee,J.getProjection()),n.id,ne.layoutVertexBuffer,ne.indexBuffer,ne.segments,null,T.zoom,null,[ne.collisionVertexBuffer,ne.collisionVertexBufferExt]))}if(!m||!M.length)return;const L=l.getOrCreateProgram("collisionCircle"),R=new o.dI;R.resize(4*I),R._trim();let F=0;for(const Y of M)for(let te=0;te<Y.circleArray.length/4;te++){const ee=4*te,J=Y.circleArray[ee+0],K=Y.circleArray[ee+1],ie=Y.circleArray[ee+2],ne=Y.circleArray[ee+3];R.emplace(F++,J,K,ie,ne,0),R.emplace(F++,J,K,ie,ne,1),R.emplace(F++,J,K,ie,ne,2),R.emplace(F++,J,K,ie,ne,3)}(!Sa||Sa.length<2*I)&&(Sa=function(Y){const te=2*Y,ee=new o.a_;ee.resize(te),ee._trim();for(let J=0;J<te;J++){const K=6*J;ee.uint16[K+0]=4*J+0,ee.uint16[K+1]=4*J+1,ee.uint16[K+2]=4*J+2,ee.uint16[K+3]=4*J+2,ee.uint16[K+4]=4*J+3,ee.uint16[K+5]=4*J+0}return ee}(I));const B=y.createIndexBuffer(Sa,!0),V=y.createVertexBuffer(R,o.dJ.members,!0);for(const Y of M){const te={u_matrix:Y.transform,u_inv_matrix:Y.invTransform,u_camera_to_center_distance:(Z=T).getCameraToCenterDistance(Y.projection),u_viewport_size:[Z.width,Z.height]};L.draw(l,x.TRIANGLES,et.disabled,Mt.disabled,l.colorModeForRenderPass(),bt.disabled,te,n.id,V,B,o.bd.simpleSegment(0,2*Y.circleOffset,Y.circleArray.length,Y.circleArray.length/2),null,T.zoom)}var Z;V.destroy(),B.destroy()}const Ss=o.bz();function Ml(l){const t=l._camera.getWorldToCamera(l.worldSize,1),n=o.az([],t,l.globeMatrix);o.bi(n,n);const c=[0,0,0],d=[0,1,0,0];return o.aA(d,d,n),c[0]=d[0],c[1]=d[1],c[2]=d[2],o.au(c,c),c}function Cl({width:l,height:t,anchor:n,textOffset:c,textScale:d},p){const{horizontalAlign:m,verticalAlign:y}=o.bT(n),x=-(m-.5)*l,T=-(y-.5)*t,S=o.bU(n,c);return new o.P((x/d+S[0])*p,(T/d+S[1])*p)}function qd(l,t,n,c,d,p,m,y,x,T){const S=l.text.placedSymbolArray,M=l.text.dynamicLayoutVertexArray,I=l.icon.dynamicLayoutVertexArray,C={},L=l.getProjection(),R=_c(m,L,d),F=d.elevation,B=L.upVectorScale(m.canonical,d.center.lat,d.worldSize).metersToTile;M.clear();for(let V=0;V<S.length;V++){const Z=S.get(V),{tileAnchorX:Y,tileAnchorY:te,numGlyphs:ee}=Z,J=Z.hidden||!Z.crossTileID||l.allowVerticalPlacement&&!Z.placedOrientation?null:c[Z.crossTileID];if(J){let K=0,ie=0,ne=0;if(F){const Pe=F?F.getAtTileOffset(m,Y,te):0,[ye,De,qe]=L.upVector(m.canonical,Y,te);K=Pe*ye*B,ie=Pe*De*B,ne=Pe*qe*B}let[fe,me,Ae,Me]=Xn(Z.projectedAnchorX+K,Z.projectedAnchorY+ie,Z.projectedAnchorZ+ne,n?R:p);const Fe=cl(d.getCameraToCenterDistance(L),Me);let de=o.bJ(l.textSizeData,x,Z)*Fe/o.bO;n&&(de*=l.tilePixelRatio/y);const we=Cl(J,de);n?({x:fe,y:me,z:Ae}=L.projectTilePoint(Y+we.x,te+we.y,m.canonical),[fe,me,Ae]=Xn(fe+K,me+ie,Ae+ne,p)):(t&&we._rotate(-d.angle),fe+=we.x,me+=we.y,Ae=0);const le=l.allowVerticalPlacement&&Z.placedOrientation===o.bI.vertical?Math.PI/2:0;for(let Pe=0;Pe<ee;Pe++)o.bL(M,fe,me,Ae,le);T&&Z.associatedIconIndex>=0&&(C[Z.associatedIconIndex]={x:fe,y:me,z:Ae,angle:le})}else Ao(ee,M)}if(T){I.clear();const V=l.icon.placedSymbolArray;for(let Z=0;Z<V.length;Z++){const Y=V.get(Z),{numGlyphs:te}=Y,ee=C[Z];if(Y.hidden||!ee)Ao(te,I);else{const{x:J,y:K,z:ie,angle:ne}=ee;for(let fe=0;fe<te;fe++)o.bL(I,J,K,ie,ne)}}l.icon.dynamicLayoutVertexBuffer.updateData(I)}l.text.dynamicLayoutVertexBuffer.updateData(M)}function Ea(l,t,n,c,d,p,m={}){const y=n.paint.get("icon-translate"),x=n.paint.get("text-translate"),T=n.paint.get("icon-translate-anchor"),S=n.paint.get("text-translate-anchor"),M=n.layout.get("icon-rotation-alignment"),I=n.layout.get("text-rotation-alignment"),C=n.layout.get("icon-pitch-alignment"),L=n.layout.get("text-pitch-alignment"),R=n.layout.get("icon-keep-upright"),F=n.layout.get("text-keep-upright"),B=n.paint.get("icon-color-saturation"),V=n.paint.get("icon-color-contrast"),Z=n.paint.get("icon-color-brightness-min"),Y=n.paint.get("icon-color-brightness-max"),te=n.layout.get("symbol-elevation-reference")==="sea",ee=l.context,J=ee.gl,K=l.transform,ie=M==="map",ne=I==="map",fe=C==="map",me=L==="map",Ae=n.layout.get("symbol-sort-key").constantOr(1)!==void 0;let Me=!1;const Fe=l.depthModeForSublayer(0,et.ReadOnly),de=new et(l.context.gl.LEQUAL,et.ReadOnly,l.depthRangeFor3D),we=[o.aD(K.
2654center.lng),o.aH(K.center.lat)],le=n.layout.get("text-variable-anchor"),Pe=K.projection.name==="globe",ye=[],De=[0,-1,0];for(const qe of c){const Ce=t.getTile(qe),je=Ce.getBucket(n);if(!je||je.projection.name==="mercator"&&Pe||je.fullyClipped)continue;const it=je.projection.name==="globe",rt=it?o.ah(K.zoom):0,Qe=_c(qe,je.getProjection(),K),ut=K.calculatePixelsToTileUnitsMatrix(Ce),pt=le&&je.hasTextData(),yt=je.hasIconTextFit()&&pt&&je.hasIconData(),It=je.getProjection().createInversionMatrix(K,qe.canonical),Ot=(1<<Ce.tileID.canonical.z)*o.aj/l.transform.worldSize,pi=Di=>{let li=[0,0,0];if(Di){const nr=l.style.directionalLight,Qt=l.style.ambientLight;nr&&Qt&&(li=Po(l.style,nr,Qt))}return li},Ri=Di=>{K.depthOcclusionForSymbolsAndCircles&&(n.hasInitialOcclusionOpacityProperties||l.terrain)&&(Di.push("DEPTH_D24"),Di.push("DEPTH_OCCLUSION"))},gi=()=>{const Di=ie&&n.layout.get("symbol-placement")!=="point",li=[];Ri(li);const nr=Di||yt,Qt=je.elevationType==="road"&&fe,mr=l.shadowRenderer,Bi=Qt&&!!mr&&mr.enabled,Mi=pi(Bi),Ni=Qt?de:Fe,ui=n.paint.get("icon-image-cross-fade");l.terrainRenderModeElevated()&&fe&&li.push("PITCH_WITH_MAP_TERRAIN"),it&&(li.push("PROJECTION_GLOBE_VIEW"),nr&&li.push("PROJECTED_POS_ON_VIEWPORT")),ui>0&&li.push("ICON_TRANSITION"),je.icon.zOffsetVertexBuffer&&li.push("Z_OFFSET"),B===0&&V===0&&Z===0&&Y===1||li.push("COLOR_ADJUSTMENT"),je.sdfIcons&&li.push("RENDER_SDF"),Bi&&li.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Qt&&je.icon.orientationVertexBuffer&&li.push("ELEVATED_ROADS");const ar=je.icon.programConfigurations.get(n.id),Nr=l.getOrCreateProgram("symbol",{config:ar,defines:li}),Hi=Ce.imageAtlasTexture?Ce.imageAtlasTexture.size:[0,0],si=je.iconSizeData,wn=o.bH(si,K.zoom),pn=fe||!K.isOrthographic,zn=vs(Qe,Ce.tileID.canonical,fe,ie,K,je.getProjection(),ut),Qn=pc(Qe,Ce.tileID.canonical,fe,ie,K,je.getProjection(),ut),jn=l.translatePosMatrix(Qn,Ce,y,T,!0),fn=l.translatePosMatrix(Qe,Ce,y,T),ao=nr?Ss:zn,es=ie&&!fe&&!Di;let lo=De;!Pe&&!K.mercatorFromTransition||ie||(lo=Ml(K));const Zl=it?lo:De,Ph=n.getColorAdjustmentMatrix(B,V,Z,Y),Na=El(si.kind,wn,es,fe,l,fn,ao,jn,te,!1,Hi,[0,0],0,qe,rt,we,It,Zl,je.getProjection(),Mi,Ot,Ph,ui,null),zh=Ce.imageAtlasTexture?Ce.imageAtlasTexture:null,Hl=n.layout.get("icon-size").constantOr(0)!==1||je.iconsNeedLinear,ou=je.sdfIcons||l.options.rotating||l.options.zooming||Hl||pn?J.LINEAR:J.NEAREST,au=je.sdfIcons&&n.paint.get("icon-halo-width").constantOr(1)!==0,hs=l.terrain&&fe&&Di?o.bi(o.bz(),zn):Ss;if(Di&&je.icon){const Va=K.elevation,Go=Va?Va.getAtTileOffsetFunc(qe,K.center.lat,K.worldSize,je.getProjection()):null,co=dc(Qe,Ce.tileID.canonical,fe,ie,K,je.getProjection(),ut);fc(je,Qe,l,!1,co,Qn,fe,R,Go,qe)}return{program:Nr,buffers:je.icon,uniformValues:Na,atlasTexture:zh,atlasTextureIcon:null,atlasInterpolation:ou,atlasInterpolationIcon:null,isSDF:je.sdfIcons,hasHalo:au,depthMode:Ni,tile:Ce,renderWithShadows:Bi,labelPlaneMatrixInv:hs}},bi=()=>{const Di=ne&&n.layout.get("symbol-placement")!=="point",li=[],nr=Di||le||yt,Qt=je.elevationType==="road"&&me,mr=l.shadowRenderer,Bi=Qt&&!!mr&&mr.enabled,Mi=pi(Bi),Ni=Qt?de:Fe;l.terrainRenderModeElevated()&&me&&li.push("PITCH_WITH_MAP_TERRAIN"),it&&(li.push("PROJECTION_GLOBE_VIEW"),nr&&li.push("PROJECTED_POS_ON_VIEWPORT")),je.text.zOffsetVertexBuffer&&li.push("Z_OFFSET"),je.iconsInText&&li.push("RENDER_TEXT_AND_SYMBOL"),li.push("RENDER_SDF"),Bi&&li.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Qt&&je.text.orientationVertexBuffer&&li.push("ELEVATED_ROADS"),Ri(li);const ui=je.text.programConfigurations.get(n.id),ar=l.getOrCreateProgram("symbol",{config:ui,defines:li});let Nr,Hi=[0,0],si=null;const wn=je.textSizeData;je.iconsInText&&(Hi=Ce.imageAtlasTexture?Ce.imageAtlasTexture.size:[0,0],si=Ce.imageAtlasTexture?Ce.imageAtlasTexture:null,Nr=me||!K.isOrthographic||l.options.rotating||l.options.zooming||wn.kind==="composite"||wn.kind==="camera"?J.LINEAR:J.NEAREST);const pn=Ce.glyphAtlasTexture?Ce.glyphAtlasTexture.size:[0,0],zn=n.layout.get("text-size-scale-range"),Qn=o.ay(l.scaleFactor,zn[0],zn[1]),jn=o.bH(wn,K.zoom,Qn),fn=vs(Qe,Ce.tileID.canonical,me,ne,K,je.getProjection(),ut),ao=pc(Qe,Ce.tileID.canonical,me,ne,K,je.getProjection(),ut),es=l.translatePosMatrix(ao,Ce,x,S,!0),lo=l.translatePosMatrix(Qe,Ce,x,S),Zl=nr?Ss:fn,Ph=ne&&!me&&!Di;let Na=De;!Pe&&!K.mercatorFromTransition||ne||(Na=Ml(K));const zh=El(wn.kind,jn,Ph,me,l,lo,Zl,es,te,!0,pn,Hi,0,qe,rt,we,It,it?Na:De,je.getProjection(),Mi,Ot,null,null,Qn),Hl=Ce.glyphAtlasTexture?Ce.glyphAtlasTexture:null,ou=J.LINEAR,au=n.paint.get("text-halo-width").constantOr(1)!==0,hs=l.terrain&&me&&Di?o.bi(o.bz(),fn):Ss;if(Di&&je.text){const Va=K.elevation,Go=Va?Va.getAtTileOffsetFunc(qe,K.center.lat,K.worldSize,je.getProjection()):null,co=dc(Qe,Ce.tileID.canonical,me,ne,K,je.getProjection(),ut);fc(je,Qe,l,!0,co,ao,me,F,Go,qe)}return{program:ar,buffers:je.text,uniformValues:zh,atlasTexture:Hl,atlasTextureIcon:si,atlasInterpolation:ou,atlasInterpolationIcon:Nr,isSDF:!0,hasHalo:au,depthMode:Ni,tile:Ce,renderWithShadows:Bi,labelPlaneMatr
2654ixInv:hs}},ur=je.icon.segments.get().length,Rt=je.text.segments.get().length,Vt=ur&&!m.onlyText?gi():null,Wt=Rt&&!m.onlyIcons?bi():null,Oi=n.paint.get("icon-opacity").constantOr(1),br=n.paint.get("text-opacity").constantOr(1);if(Ae&&je.canOverlap){Me=!0;const Di=Oi&&!m.onlyText?je.icon.segments.get():[],li=br&&!m.onlyIcons?je.text.segments.get():[];for(const nr of Di)ye.push({segments:new o.bd([nr]),sortKey:nr.sortKey,state:Vt});for(const nr of li)ye.push({segments:new o.bd([nr]),sortKey:nr.sortKey,state:Wt})}else m.onlyText||ye.push({segments:Oi?je.icon.segments:new o.bd([]),sortKey:0,state:Vt}),m.onlyIcons||ye.push({segments:br?je.text.segments:new o.bd([]),sortKey:0,state:Wt})}Me&&ye.sort((qe,Ce)=>qe.sortKey-Ce.sortKey);for(const qe of ye){const Ce=qe.state;if(Ce)if(l.terrain?l.terrain.setupElevationDraw(Ce.tile,Ce.program,{useDepthForOcclusion:K.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Ce.labelPlaneMatrixInv}):l.setupDepthForOcclusion(K.depthOcclusionForSymbolsAndCircles,Ce.program),ee.activeTexture.set(J.TEXTURE0),Ce.atlasTexture&&Ce.atlasTexture.bind(Ce.atlasInterpolation,J.CLAMP_TO_EDGE,!0),Ce.atlasTextureIcon&&(ee.activeTexture.set(J.TEXTURE1),Ce.atlasTextureIcon&&Ce.atlasTextureIcon.bind(Ce.atlasInterpolationIcon,J.CLAMP_TO_EDGE,!0)),Ce.renderWithShadows&&l.shadowRenderer.setupShadows(Ce.tile.tileID.toUnwrapped(),Ce.program,"vector-tile",Ce.tile.tileID.overscaledZ),l.uploadCommonLightUniforms(l.context,Ce.program),Ce.hasHalo){const je=Ce.uniformValues;je.u_is_halo=1,Ia(Ce.buffers,qe.segments,n,l,Ce.program,Ce.depthMode,d,p,je,2),je.u_is_halo=0}else{if(Ce.isSDF){const je=Ce.uniformValues;Ce.hasHalo&&(je.u_is_halo=1,Ia(Ce.buffers,qe.segments,n,l,Ce.program,Ce.depthMode,d,p,je,1)),je.u_is_halo=0}Ia(Ce.buffers,qe.segments,n,l,Ce.program,Ce.depthMode,d,p,Ce.uniformValues,1)}}}function Ia(l,t,n,c,d,p,m,y,x,T){const S=[l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer,l.iconTransitioningVertexBuffer,l.globeExtVertexBuffer,l.zOffsetVertexBuffer,l.orientationVertexBuffer];d.draw(c,c.context.gl.TRIANGLES,p,m,y,bt.disabled,x,n.id,l.layoutVertexBuffer,l.indexBuffer,t,n.paint,c.transform.zoom,l.programConfigurations.get(n.id),S,T)}function jc(l,t){const n=1<<l.canonical.z,c=(t.x*n-l.canonical.x-l.wrap*n)*o.aj,d=(t.y*n-l.canonical.y)*o.aj,p=o.dS(t.z,t.y);return o.cS(c,d,p)}function ah(l,t,n,c,d){if(!n.layout||n.layout.get("fill-elevation-reference")==="none")return;const p=l.context.gl,m=new et(l.context.gl.LEQUAL,et.ReadWrite,l.depthRangeFor3D),y=new et(l.context.gl.GREATER,et.ReadWrite,l.depthRangeFor3D),x=function(C){const L=o.cJ(C.pitch);let R=.01;return C.isOrthographic&&(R=o.ai(1e-4,R,o.cN(L>=Dr?1:L/Dr))),2*R}(l.transform),T=l.transform.getFreeCameraOptions().position,S="elevatedStructuresDepthReconstruct",M=l.getOrCreateProgram(S,{defines:["DEPTH_RECONSTRUCTION"]}),I=l.getOrCreateProgram(S);for(const C of c){const L=t.getTile(C),R=L.getBucket(n);if(!R)continue;const F=R.elevatedStructures;if(!F)continue;const B=R.elevationBufferData.heightRange,V=jc(C.toUnwrapped(),T),Z=l.translatePosMatrix(C.projMatrix,L,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));let Y,te,ee,J;if(d==="initialize"){if(!B||B.min>=1||F.depthSegments.segments[0].primitiveLength===0)continue;Y=Bc(Z,V,x,1,0),te=m,ee=F.depthSegments,J=M}else if(d==="reset"){if(!B||B.min>=0||F.maskSegments.segments[0].primitiveLength===0)continue;Y=Bc(Z,V,0,0,1),te=y,ee=F.maskSegments,J=M}else if(d==="geometry"){if(F.depthSegments.segments[0].primitiveLength===0)continue;Y=Bc(Z,V,x,1,0),te=m,ee=F.depthSegments,J=I}J.draw(l,p.TRIANGLES,te,Mt.disabled,qt.disabled,bt.disabled,Y,n.id,F.vertexBuffer,F.indexBuffer,ee,n.paint,l.transform.zoom)}}function lh(l,t,n){const{painter:c,sourceCache:d,layer:p,coords:m,colorMode:y,elevationType:x,terrainEnabled:T,pass:S}=l,M=c.context.gl,I=p.paint.get("fill-pattern"),C=p.paint.get("fill-pattern-cross-fade"),L=I.constantOr(null);let R=x;x!=="road"||t&&!T||(R="none");const F=R==="road",B=l.painter.shadowRenderer,V=F&&!!B&&B.enabled,Z=new et(c.context.gl.LEQUAL,et.ReadOnly,c.depthRangeFor3D);let Y=[0,0,0];if(V){const J=c.style.directionalLight,K=c.style.ambientLight;J&&K&&(Y=Po(c.style,J,K))}const te=I&&I.constantOr(1),ee=(J,K)=>{let ie,ne,fe,me,Ae;K?(ie=te&&!p.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",fe=M.LINES):(ie=te?"fillPattern":"fill",fe=M.TRIANGLES);for(const Me of m){const Fe=d.getTile(Me);if(te&&!Fe.patternsLoaded())continue;const de=Fe.getBucket(p);if(!de)continue;const we=t?de.elevationBufferData:de.bufferData;if(we.isEmpty())continue;c.prepareDrawTile();const le=we.programConfigurations.get(p.id),Pe=c.isTileAffectedByFog(Me),ye=[],De=[];F&&(ye.push("ELEVATED_ROADS"),De.push(we.elevatedLayoutVertexBuffer)),V&&ye.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),te&&(c.context.activeTexture.set(M.TEXTURE0),Fe.imageAtlasTexture&&Fe.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),le.updatePaintBuffers());let qe=!1;if(L&&Fe.imageAtlas){const Qe=Fe.imageAtlas,ut=o.dN.from(L),pt=ut.getPrimary().scaleSelf(o.q.devicePixelRatio).toString(),yt=ut.getSecondary(),It=Qe.patternPositions.get(pt),Ot=yt?Qe.patternPositions.get(yt.scaleSelf(o.q.devicePixelRatio).toString()):null;qe=!!It&&!!Ot,It&&le.setConstantPatternPositions(It,Ot)}C>0&&(qe||le.getPatternTransitionVertexBuffer("fill-pattern"))&&ye.push("FILL_PATTERN_TRANSITION");const Ce=c.getOrCreateProgram(ie,{config:le,overrideFog:Pe,defines:ye}),je=c.translatePosMatrix(Me.projMatrix,Fe,p.paint.get("fill-translate"),p.paint.get("fill-translate-anchor"));V&&B.setupShadows(Fe.tileID.toUnwrapped(),Ce,"vector-tile",Fe.tileID.overscaledZ
2654);const it=p.paint.get("fill-emissive-strength");if(K){me=we.lineIndexBuffer,Ae=we.lineSegments;const Qe=c.terrain&&c.terrain.renderingToTexture?c.terrain.drapeBufferSize:[M.drawingBufferWidth,M.drawingBufferHeight];ne=ie==="fillOutlinePattern"&&te?Bf(je,it,c,Fe,Qe,Y,C):Of(je,it,Qe,Y)}else me=we.indexBuffer,Ae=we.triangleSegments,ne=te?Bd(je,it,c,Fe,Y,C):Fo(je,it,Y);c.uploadCommonUniforms(c.context,Ce,Me.toUnwrapped());let rt=J;(x==="road"&&!T||x==="offset")&&(rt=Z),Ce.draw(c,fe,rt,n||c.stencilModeForClipping(Me),y,bt.disabled,ne,p.id,we.layoutVertexBuffer,me,Ae,p.paint,c.transform.zoom,le,De)}};c.renderPass===S&&ee(c.depthModeForSublayer(1,c.renderPass==="opaque"?et.ReadWrite:et.ReadOnly),!1),R==="none"&&c.renderPass==="translucent"&&p.paint.get("fill-antialias")&&ee(c.depthModeForSublayer(p.getPaintProperty("fill-outline-color")?2:0,et.ReadOnly),!0)}function Es(l,t,n,c,d,p,m,y){n.resetLayerRenderingStats(l);const x=l.context,T=x.gl,S=l.transform,M=n.paint.get("fill-extrusion-pattern"),I=n.paint.get("fill-extrusion-pattern-cross-fade"),C=M.constantOr(null),L=M.constantOr(1),R=n.paint.get("fill-extrusion-opacity"),F=l.style.enable3dLights(),B=n.paint.get(F&&!L?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),V=[n.paint.get("fill-extrusion-ambient-occlusion-intensity"),B],Z=n.layout.get("fill-extrusion-edge-radius"),Y=Z>0&&!n.paint.get("fill-extrusion-rounded-roof"),te=Y?0:Z,ee=S.projection.name==="globe"?o.dV():0,J=S.projection.name==="globe",K=J?o.ah(S.zoom):0,ie=[o.aD(S.center.lng),o.aH(S.center.lat)],ne=n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",fe=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(ne?null:n.lut).toArray01().slice(0,3),me=n.paint.get("fill-extrusion-flood-light-intensity"),Ae=n.paint.get("fill-extrusion-vertical-scale"),Me=n.paint.get("fill-extrusion-line-width").constantOr(1)!==0,Fe=n.paint.get("fill-extrusion-height-alignment"),de=n.paint.get("fill-extrusion-base-alignment"),we=os(l,n.paint.get("fill-extrusion-cutoff-fade-range")),le=[];let Pe;J&&le.push("PROJECTION_GLOBE_VIEW"),V[0]>0&&le.push("FAUX_AO"),Y&&le.push("ZERO_ROOF_RADIUS"),y&&le.push("HAS_CENTROID"),me>0&&le.push("FLOOD_LIGHT"),we.shouldRenderCutoff&&le.push("RENDER_CUTOFF"),Me&&le.push("RENDER_WALL_MODE");const ye=l.renderPass==="shadow",De=l.shadowRenderer,qe=ye&&!!De,Ce=ye?bt.disabled:bt.backCCW;l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0);let je=[0,0,0];if(De){const Qe=l.style.directionalLight,ut=l.style.ambientLight;Qe&&ut&&(je=Po(l.style,Qe,ut)),ye||(le.push("RENDER_SHADOWS","DEPTH_TEXTURE"),De.useNormalOffset&&le.push("NORMAL_OFFSET")),Pe=le.concat(["SHADOWS_SINGLE_CASCADE"])}const it=qe?"fillExtrusionDepth":L?"fillExtrusionPattern":"fillExtrusion",rt=n.getLayerRenderingStats();for(const Qe of c){const ut=t.getTile(Qe),pt=ut.getBucket(n);if(!pt||pt.projection.name!==S.projection.name)continue;let yt=!1;De&&(yt=De.getMaxCascadeForTile(Qe.toUnwrapped())===0);const It=l.isTileAffectedByFog(Qe),Ot=pt.programConfigurations.get(n.id);let pi=!1;if(C&&ut.imageAtlas){const Wt=ut.imageAtlas,Oi=o.dN.from(C),br=Oi.getPrimary().scaleSelf(o.q.devicePixelRatio).toString(),Di=Oi.getSecondary(),li=Wt.patternPositions.get(br),nr=Di?Wt.patternPositions.get(Di.scaleSelf(o.q.devicePixelRatio).toString()):null;pi=!!li&&!!nr,li&&Ot.setConstantPatternPositions(li,nr)}I>0&&(pi||Ot.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&le.push("FILL_EXTRUSION_PATTERN_TRANSITION");const Ri=l.getOrCreateProgram(it,{config:Ot,defines:yt?Pe:le,overrideFog:It});if(l.terrain&&l.terrain.setupElevationDraw(ut,Ri,{useMeterToDem:!0}),!pt.centroidVertexBuffer){const Wt=Ri.attributes.a_centroid_pos;Wt!==void 0&&T.vertexAttrib2f(Wt,0,0)}!ye&&De&&De.setupShadows(ut.tileID.toUnwrapped(),Ri,"vector-tile",ut.tileID.overscaledZ),L&&(l.context.activeTexture.set(T.TEXTURE0),ut.imageAtlasTexture&&ut.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),Ot.updatePaintBuffers());const gi=n.paint.get("fill-extrusion-vertical-gradient"),bi=1/pt.tileToMeter;let ur;if(ye&&De){if(eo(ut.tileID,pt,l))continue;const Wt=De.calculateShadowPassMatrixFromTile(ut.tileID.toUnwrapped());ur=kd(Wt,te,bi,Ae,Fe,de)}else{const Wt=l.translatePosMatrix(Qe.expandedProjMatrix,ut,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),Oi=S.projection.createInversionMatrix(S,Qe.canonical);ur=L?Od(Wt,l,gi,R,V,te,bi,Qe,ut,ee,Fe,de,K,ie,Oi,fe,Ae,I):Sl(Wt,l,gi,R,V,te,bi,Qe,ee,Fe,de,K,ie,Oi,fe,Ae,me,
2654je)}l.uploadCommonUniforms(x,Ri,Qe.toUnwrapped(),null,we);let Rt=pt.segments;if(S.projection.name==="mercator"&&!ye&&(Rt=pt.getVisibleSegments(ut.tileID,l.terrain,l.transform.getFrustum(0)),!Rt.get().length))continue;if(rt)if(ye)for(const Wt of Rt.get())rt.numRenderedVerticesInShadowPass+=Wt.primitiveLength;else for(const Wt of Rt.get())rt.numRenderedVerticesInTransparentPass+=Wt.primitiveLength;const Vt=[];(l.terrain||y)&&Vt.push(pt.centroidVertexBuffer),J&&Vt.push(pt.layoutVertexExtBuffer),Me&&Vt.push(pt.wallVertexBuffer),Ri.draw(l,x.gl.TRIANGLES,d,p,m,Ce,ur,n.id,pt.layoutVertexBuffer,pt.indexBuffer,Rt,n.paint,l.transform.zoom,Ot,Vt)}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1)}function Is(l,t,n,c,d,p,m,y,x,T,S,M,I,C,L,R,F,B,V){const Z=l.context,Y=Z.gl,te=l.transform,ee=l.transform.zoom,J=[],K=os(l,n.paint.get("fill-extrusion-cutoff-fade-range"));T==="clear"?(J.push("CLEAR_SUBPASS"),V&&(J.push("CLEAR_FROM_TEXTURE"),Z.activeTexture.set(Y.TEXTURE0),V.bind(Y.LINEAR,Y.CLAMP_TO_EDGE))):T==="sdf"&&J.push("SDF_SUBPASS"),F&&J.push("HAS_CENTROID"),K.shouldRenderCutoff&&J.push("RENDER_CUTOFF");const ie=n.layout.get("fill-extrusion-edge-radius"),ne=(fe,me,Ae,Me,Fe)=>{const de=me.programConfigurations.get(n.id),we=l.isTileAffectedByFog(fe),le=l.getOrCreateProgram("fillExtrusionGroundEffect",{config:de,defines:J,overrideFog:we}),Pe=((De,qe,Ce,je,it,rt,Qe,ut,pt,yt,It)=>({u_matrix:qe,u_opacity:Ce,u_ao_pass:je?1:0,u_meter_to_tile:it,u_ao:rt,u_flood_light_intensity:Qe,u_flood_light_color:ut,u_attenuation:pt,u_edge_radius:yt,u_fb:0,u_fb_size:It,u_dynamic_offset:1}))(0,Me,S,x,Fe,[M,I*Fe],C,L,R,ee>=17?0:ie*Fe,V?V.size[0]:0),ye=[];F&&ye.push(me.hiddenByLandmarkVertexBuffer),l.uploadCommonUniforms(Z,le,fe.toUnwrapped(),null,K),le.draw(l,Z.gl.TRIANGLES,d,p,m,y,Pe,n.id,me.vertexBuffer,me.indexBuffer,Ae,n.paint,ee,de,ye)};for(const fe of c){const me=t.getTile(fe),Ae=me.getBucket(n);if(!Ae||Ae.projection.name!==te.projection.name||!Ae.groundEffect||Ae.groundEffect&&!Ae.groundEffect.hasData())continue;const Me=Ae.groundEffect,Fe=1/Ae.tileToMeter;{const de=l.translatePosMatrix(fe.projMatrix,me,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),we=Me.getDefaultSegment();ne(fe,Me,we,de,Fe)}if(B)for(let de=0;de<4;de++){const we=o.dT[de](fe),le=t.getTile(we);if(!le)continue;const Pe=le.getBucket(n);if(!Pe||Pe.projection.name!==te.projection.name||!Pe.groundEffect||Pe.groundEffect&&!Pe.groundEffect.hasData())continue;const ye=Pe.groundEffect;let De,qe;de===0?(De=[-8192,0,0],qe=1):de===1?(De=[o.aj,0,0],qe=0):de===2?(De=[0,-8192,0],qe=3):(De=[0,o.aj,0],qe=2);const Ce=ye.regionSegments[qe];if(!Ce)continue;const je=new Float32Array(16);o.bo(je,fe.projMatrix,De),ne(fe,ye,Ce,l.translatePosMatrix(je,me,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),Fe)}}}function tt(l,t,n,c,d,p,m){c.centroidVertexArray.length===0&&c.createCentroidsBuffer();const y=p?p.findDEMTileFor(n):null;if(!(y&&y.dem||m))return;p&&y&&y.dem&&c.selfDEMTileTimestamp!==y.dem._timestamp&&(c.borderDoneWithNeighborZ=[-1,-1,-1,-1],c.selfDEMTileTimestamp=y.dem._timestamp);const x=B=>new o.P(Math.ceil((B+o.dX)*o.dY),0),T=B=>{const V=t.getSource().minzoom,Z=te=>{const ee=t.getTileByID(te);if(ee&&ee.hasData())return ee.getBucket(d)},Y=[0,-1,1];for(const te of Y){if(B.overscaledZ+te<V)continue;const ee=Z(B.calculateScaledKey(B.overscaledZ+te));if(ee)return ee}},S=[0,0,0],M=(B,V)=>(S[0]=Math.min(B.min.y,V.min.y),S[1]=Math.max(B.max.y,V.max.y),S[2]=o.aj-V.min.x>B.max.x?V.min.x-o.aj:B.max.x,S),I=(B,V)=>(S[0]=Math.min(B.min.x,V.min.x),S[1]=Math.max(B.max.x,V.max.x),S[2]=o.aj-V.min.y>B.max.y?V.min.y-o.aj:B.max.y,S),C=[(B,V)=>M(B,V),(B,V)=>M(V,B),(B,V)=>I(B,V),(B,V)=>I(V,B)],L=(B,V,Z,Y,te,ee,J)=>{if(!p)return 0;const K=[[ee?Z:B,ee?B:Z,0],[ee?Z:V,ee?V:Z,0]],ie=J<0?o.aj+J:J,ne=[ee?ie:(B+V)/2,ee?(B+V)/2:ie,0];return Z===0&&J<0||Z!==0&&J>0?p.getForTilePoints(te,[ne],!0,Y):K.push(ne),p.getForTilePoints(n,K,!0,y),Math.max(K[0][2],K[1][2],ne[2])/p.exaggeration()};for(let B=0;B<4;B++){const V=c.borderFeatureIndices[B];if(V.length===0)continue;const Z=o.dT[B](n),Y=T(Z);if(!(Y&&Y instanceof o.dU))continue;const te=p?p.findDEMTileFor(Z):null;if(!(te&&te.dem||m)||(p&&te&&te.dem&&c.borderDEMTileTimestamp[B]!==te.dem._timestamp&&(c.borderDoneWithNeighborZ[B]=-1,c.borderDEMTileTimestamp[B]=te.dem._timestamp),c.borderDoneWithNeighborZ[B]===Y.canonical.z))continue;Y.centroidVertexArray.length===0&&Y.createCentroidsBuffer();const ee=(B<2?1:5)-B,J=Y.borderDoneWithNeighborZ[ee]!==c.canonical.z,K=Y.borderFeatureIndices[ee];let ie=0;if(c.canonical.z!==Y.canonical.z){for(const ne of V)c.showCentroid(c.featuresOnBorder[ne]);if(J)for(const ne of K)Y.showCentroid(Y.featuresOnBorder[ne]);c.borderDoneWithNeighborZ[B]=Y.canonical.z,Y.borderDoneWithNeighborZ[ee]=c.canonical.z}for(const ne of V){const fe=c.featuresOnBorder[ne],me=c.centroidData[fe.centroidDataIndex],Ae=fe.borders[B];let Me;for(;ie<K.length;){Me=Y.featuresOnBorder[K[ie]];const Fe=Me.borders[ee];if(Fe[1]>Ae[0]+3||Fe[0]>Ae[0]-3)break;Y.showCentroid(Me),ie++}if(Me&&ie<K.length){const Fe=ie;let de=0;for(;!(Me.borders[ee][0]>Ae[1]-3)&&(de++,++ie!==K.length);)Me=Y.featuresOnBorder[K[ie]];Me=Y.featuresOnBorder[K[Fe]];let we=!1;if(de>=1){const ye=Me.borders[ee];Math.abs(Ae[0]-ye[0])<3&&Math.abs(Ae[1]-ye[1])<3&&(de=1,we=!0,ie=Fe+1)}else if(de===0){c.showCentroid(fe);continue}const le=Y.centroidData[Me.centroidDataIndex];m&&we&&(((R=me).flags|(F=le).flags)&o.dW?(R.flags|=o.dW,F.flags|=o.dW):(R.flags&=2147483647,F.flags&=2147483647));const Pe=fe.intersectsCount()>1||Me.intersectsCount()>1;
vendor: 16,384 bytes, line 2654
2654if(de>1)ie=Fe,me.centroidXY=le.centroidXY=new o.P(0,0);else if(te&&te.dem&&!Pe){const ye=C[B](me,le),De=B%2?o.aj-1:0,qe=L(ye[0],Math.min(o.aj-1,ye[1]),De,te,Z,B<2,ye[2]);me.centroidXY=le.centroidXY=x(qe)}else Pe?me.centroidXY=le.centroidXY=new o.P(0,0):(me.centroidXY=c.encodeBorderCentroid(fe),le.centroidXY=Y.encodeBorderCentroid(Me));c.writeCentroidToBuffer(me),Y.writeCentroidToBuffer(le)}else c.showCentroid(fe)}c.borderDoneWithNeighborZ[B]=Y.canonical.z,Y.borderDoneWithNeighborZ[ee]=c.canonical.z}var R,F;(c.needsCentroidUpdate||!c.centroidVertexBuffer&&c.centroidVertexArray.length!==0)&&c.uploadCentroid(l)}const $d=[1,0,0],Zd=[0,1,0],Qs=[0,0,1];function eo(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 y=t.maxHeight;if(c.elevation){const R=c.elevation.getMinMaxForTile(l);R&&(y+=R.max)}const x=[...d.shadowDirection];x[2]=-x[2];const T=d.computeSimplifiedTileShadowVolume(p,y,m,x);if(!T)return!1;const S=[$d,Zd,Qs,x,[x[0],0,x[2]],[0,x[1],x[2]]],M=c.projection.name==="globe",I=c.scaleZoom(m),C=o.cn.fromInvProjectionMatrix(c.invProjMatrix,c.worldSize,I,!M),L=d.getCurrentCascadeFrustum();return C.intersectsPrecise(T.vertices,T.planes,S)===0||L.intersectsPrecise(T.vertices,T.planes,S)===0}function xt(l){return[l[0]*o.dZ,l[1]*o.dZ,l[2]*o.dZ,0]}function Pl(l,t,n,c,d,p,m,y,x){const T=c.getSource(),S=n.globeSharedBuffers;if(!S)return;let M,I,C;if(t&&(M=c.getTile(t)),T instanceof o.aP?(I=T.texture,C=o.ds(0,0,n.transform)):M&&t&&(I=M.texture,C=o.ds(t.canonical.z,t.canonical.x,n.transform)),!I||!C)return;l||(C=o.cE(o.bz(),C,[1,-1,1]));const L=n.context,R=L.gl,F=d.paint.get("raster-resampling")==="nearest"?R.NEAREST:R.LINEAR,B=n.colorModeForDrapableLayerRenderPass(p),V=m.defines;V.push("GLOBE_POLES");const Z=new et(R.LEQUAL,et.ReadWrite,n.depthRangeFor3D),Y=Float32Array.from(n.transform.expandedFarZProjMatrix),te=Float32Array.from(o.bh(o.dr(new o.cp(0,0,0))));n.terrain&&n.terrain.prepareDrawTile(),L.activeTexture.set(R.TEXTURE0),I.bind(F,R.CLAMP_TO_EDGE),L.activeTexture.set(R.TEXTURE1),I.bind(F,R.CLAMP_TO_EDGE),"useMipmap"in I&&L.extTextureFilterAnisotropic&&n.transform.pitch>20&&R.texParameterf(R.TEXTURE_2D,L.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,L.extTextureFilterAnisotropicMax);const[ee,J,K,ie]=t?S.getPoleBuffers(t.canonical.z,!1):S.getPoleBuffers(0,!0),ne=d.paint.get("raster-elevation");let fe;l?(fe=ee,n.renderDefaultNorthPole=ne!==0):(fe=J,n.renderDefaultSouthPole=ne!==0);const me=xt(m.mix),Ae=((Fe,de,we,le,Pe,ye,De,qe,Ce,je,it,rt,Qe)=>rh(Fe,de,we,new Float32Array(16),new Float32Array(9),[0,0],le,[0,0],[0,0,0,0],1,{opacity:1,mix:0},ye,[0,0],qe,2,je,it,rt,1,0,Qe))(Y,te,C,o.ah(n.transform.zoom),0,d,0,ne,0,me,m.offset,m.range,p),Me=n.getOrCreateProgram("raster",{defines:V});n.uploadCommonUniforms(L,Me,null),Me.draw(n,R.TRIANGLES,Z,x,B,y,Ae,d.id,fe,K,ie)}function qf(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 $f(l,t,n,c){if(l)return t instanceof qs&&l instanceof sa?t.getTextureDescriptor(l,n,!0):{texture:l.texture,mix:xt(c.mix),offset:c.offset,buffer:0,tileSize:1}}var ch=o.d_([{name:"a_index",type:"Int16",components:1}]);class Hd{constructor(t,n,c,d){const p={width:c[0],height:c[1],data:null},m=t.gl;this.targetColorTexture=new o.T(t,p,m.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new o.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 o.T(this.context,n,c.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new o.T(this.context,n,c.RGBA8,{premultiply:!1,useMipmap:!1});const p=new o.d$;p.reserve(d);for(let m=0;m<d;m++)p.emplaceBack(m);this.particleIndexBuffer=this.context.createVertexBuffer(p,ch.members,!0),this.particleSegment=o.bd.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=n.width}update(t){return!(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=o.q.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function Zf(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:y,buffer:x,format:T}=c;if(!d||!T)return null;let S=!1;return T==="uint32"&&(S=!0,p[3]=0,p=ko(o.e0,p,[0,n.paint.get("raster-particle-max-speed")]),m=ih(o.e0,m,[0,n.paint.get("raster-particle-max-speed")])),{texture:d,textureOffset:[x/(y+2*x),y/(y+2*x)],tileSize:y,scalarData:S,scale:p,offset:m,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[T]]}}function Wd(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]}const Hf=new o.am(1,0,0,1),Wf=new o.am(0,1,0,1),bn=new o.am(0,0,1,1),uh=new o.am(1,0,1,1),on=new o.am(0,1,1,1);function As(l,t,n,c,d,p){for(let m=0;m<n.length;m++)if(d){const T=new o.am(c.r*.8,c.g*.8,c.b*.8,1);Bo(l,t,n[m],c,-1,-1,p),Bo(l,t,n[m],c,-1,1,p),Bo(l,t,n[m],c,1,1,p),Bo(l,t,n[m],c,1,-1,p),Bo(l,t,n[m],T,0,0,p)}else Bo(l,t,n[m],c,0,0,p)}function Bo(l,t,n,c,d,p,m){const y=l.context,x=l.transform,T=y.gl,S=x.projection.name==="globe",M=S?["PROJECTION_GLOBE_VIEW"]:[];let I=o.bw(n.projMatrix);if(S&&o.ah(x.zoom)>0){const me=o.bg(n.canonical,x),Ae=o.e1(me);I=o.az(new Float32Array(16),x.globeMatrix,Ae),o.az(I,x.projMatrix,I)}const C=o.bz();C[12]+=2*d/(o.q.devicePixelRatio*x.width),C[13]+=2*p/(o.q.devicePixelRatio*x.height),o.az(I,C,I);const L=l.getOrCreateProgram("debug",{defines:M}),R=t.getTileByID(n.key);l.terrain&&l.terrain.setupElevationDraw(R,L);const F=et.disabled,B=Mt.disabled,V=l.colorModeForRenderPass(),Z="$debug";y.activeTexture.set(T.TEXTURE0),l.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),S?R._makeGlobeTileDebugBuffers(l.context,x):R._makeDebugTileBoundsBuffers(l.context,x.projection);const Y=R._tileDebugBuffer||l.debugBuffer,te=R._tileDebugIndexBuffer||l.debugIndexBuffer,ee=R._tileDebugSegments||l.debugSegments;if(L.draw(l,T.LINE_STRIP,F,B,V,bt.disabled,Nc(I,c.toPremultipliedRenderColor(null)),Z,Y,te,ee,null,null,null,[R._globeTileDebugBorderBuffer]),m){const me=R.latestRawTileData,Ae=Math.floor((me&&me.byteLength||0)/1024);let Me=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(Me+=` => ${n.overscaledZ}`),Me+=` ${R.state}`,Me+=` ${Ae}kb`,function(Fe,de){Fe.initDebugOverlayCanvas();const we=Fe.debugOverlayCanvas,le=Fe.context.gl,Pe=Fe.debugOverlayCanvas.getContext("2d");Pe.clearRect(0,0,we.width,we.height),Pe.shadowColor="white",Pe.shadowBlur=2,Pe.lineWidth=1.5,Pe.strokeStyle="white",Pe.textBaseline="top",Pe.font="bold 36px Open Sans, sans-serif",Pe.fillText(de,5,5),Pe.strokeText(de,5,5),Fe.debugOverlayTexture.update(we),Fe.debugOverlayTexture.bind(le.LINEAR,le.CLAMP_TO_EDGE)}(l,Me)}const J=t.getTile(n).tileSize,K=512/Math.min(J,512)*(n.overscaledZ/x.zoom)*.5,ie=R._tileDebugTextBuffer||l.debugBuffer,ne=R._tileDebugTextIndexBuffer||l.quadTriangleIndexBuffer,fe=R._tileDebugTextSegments||l.debugSegments;L.draw(l,T.TRIANGLES,F,B,qt.alphaBlended,bt.disabled,Nc(I,o.am.transparent.toPremultipliedRenderColor(null),K),Z,ie,ne,fe,null,null,null,[R._globeTileDebugTextBuffer])}function Gc(l,t,n,c){Aa(l,0,t+n/2,l.transform.width,n,c)}function qc(l,t,n,c){Aa(l,t-n/2,0,n,l.transform.height,c)}function Aa(l,t,n,c,d,p){const m=l.context,y=m.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*o.q.devicePixelRatio,n*o.q.devicePixelRatio,c*o.q.devicePixelRatio,d*o.q.devicePixelRatio),m.clear({color:p}),y.disable(y.SCISSOR_TEST)}const Xd=o.d_([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Ms}=Xd;function Ti(l,t,n,c){l.emplaceBack(t,n,c)}class zl{constructor(t){this.vertexArray=new o.e2,this.indices=new o.a_,Ti(this.vertexArray,-1,-1,1),Ti(this.vertexArray,1,-1,1),Ti(this.vertexArray,-1,1,1),Ti(this.vertexArray,1,1,1),Ti(this.vertexArray,-1,-1,-1),Ti(this.vertexArray,1,-1,-1),Ti(this.vertexArray,-1,1,-1),Ti(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,Ms),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=o.bd.simpleSegment(0,0,36,12)}}function to(l,t,n,c,d,p){const m=l.context.gl,y=t.paint.get("sky-atmosphere-color"),x=t.paint.get("sky-atmosphere-halo-color"),T=t.paint.get("sky-atmosphere-sun-intensity"),S=((M,I,C,L,R)=>({u_matrix_3f:M,u_sun_direction:I,u_sun_intensity:C,u_color_tint_r:[L.r,L.g,L.b,L.a],u_color_tint_m:[R.r,R.g,R.b,R.a],u_luminance:5e-5}))(o.e4(o.dx(),c),d,T,y.toPremultipliedRenderColor(null),x.toPremultipliedRenderColor(null));m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_CUBE_MAP_POSITIVE_X+p,t.skyboxTexture,0),n.draw(l,m.TRIANGLES,et.disabled,Mt.disabled,qt.unblended,bt.frontCW,S,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}const Yd=o.d_([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Kd{constructor(t){const n=new o.e5;n.emplaceBack(-1,1,1,0,0),n.emplaceBack(1,1,1,1,0),n.emplaceBack(1,-1,1,1,1),n.emplaceBack(-1,-1,1,0,1);const c=new o.a_;c.emplaceBack(0,1,2),c.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(n,Yd.members),this.indexBuffer=t.createIndexBuffer(c),this.segments=o.bd.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Jd=o.d_([{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 Xf{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class Ma{constructor(t){this.colorModeAlphaBlendedWriteRGB=new qt([1,Co,1,Co],o.am.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new qt([1,0,1,0],o.am.transparent,[!1,!1,!1,!0]),this.params=new Xf,this.updateNeeded=!0,t.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),t.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),t.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),t.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(t){const n=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Kd(n);const c=this.params.sizeRange,d=this.params.intensityRange,p=function(S){const M=o.e7(30),I=[];for(let C=0;C<S;++C){const L=2*Math.PI*M(),R=Math.acos(1-2*M())-.5*Math.PI;I.push(o.cS(Math.cos(R)*Math.cos(L),Math.cos(R)*Math.sin(L),Math.sin(R)))}return I}(this.params.starsCount),m=o.e7(300),y=new o.e6,x=new o.a_;let T=0;for(let S=0;S<p.length;++S){const M=o.bY([],p[S],200),I=Math.max(0,1+.01*c*(1*m()-.5)),C=Math.max(0,1+.01*d*(1*m()-.5));y.emplaceBack(M[0],M[1],M[2],-1,-1,I,C),y.emplaceBack(M[0],M[1],M[2],1,-1,I,C),y.emplaceBack(M[0],M[1],M[2],1,1,I,C),y.emplaceBack(M[0],M[1],M[2],-1,1,I,C),x.emplaceBack(T+0,T+1,T+2),x.emplaceBack(T+0,T+2,T+3),T+=4}this.starsVx=n.createVertexBuffer(y,Jd.members),this.starsIdx=n.createIndexBuffer(x),this.starsSegments=o.bd.simpleSegment(0,0,y.length,x.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(t,n){const c=t.context,d=c.gl,p=t.transform,m=new et(d.LEQUAL,et.ReadOnly,[0,1]),y=o.ah(p.zoom),x=t.style.getLut(n.scope),T=n.properties.get("color-use-theme")==="none",S=n.properties.get("color").toNonPremultipliedRenderColor(T?null:x).toArray01(),M=n.properties.get("high-color-use-theme")==="none",I=n.properties.get("high-color").toNonPremultipliedRenderColor(M?null:x).toArray01(),C=n.properties.get("space-color-use-theme")==="none",L=n.properties.get("space-color").toNonPremultipliedRenderColor(C?null:x).toArray01(),R=5e-4,F=o.e8(n.properties.get("horizon-blend"),0,1,R,.25),B=o.dl(t,c,p)&&F===R?p.worldSize/(2*Math.PI*1.025)-1:p.globeRadius,V=t.frameCounter/1e3%1,Z=o.ae(p.globeCenterInViewSpace),Y=Math.sqrt(Math.pow(Z,2)-Math.pow(B,2)),te=Math.acos(Y/Z),ee=J=>{const K=p.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];J&&K.push("ALPHA_PASS");const ie=t.getOrCreateProgram("globeAtmosphere",{defines:K}),ne=((me,Ae,Me,Fe,de,we,le,Pe,ye,De,qe,Ce)=>({u_frustum_tl:me,u_frustum_tr:Ae,u_frustum_br:Me,u_frustum_bl:Fe,u_horizon:de,u_transition:we,u_fadeout_range:le,u_color:Pe,u_high_color:ye,u_space_color:De,u_temporal_offset:qe,u_horizon_angle:Ce}))(p.frustumCorners.TL,p.frustumCorners.TR,p.frustumCorners.BR,p.frustumCorners.BL,p.frustumCorners.horizon,y,F,S,I,L,V,te);t.uploadCommonUniforms(c,ie);const fe=this.atmosphereBuffer;fe&&ie.draw(t,d.TRIANGLES,m,Mt.disabled,J?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,bt.backCW,ne,J?"atmosphere_glow_alpha":"atmosphere_glow",fe.vertexBuffer,fe.indexBuffer,fe.segments)};ee(!1),ee(!0)}drawStars(t,n){const c=o.ay(n.properties.get("star-intensity"),0,1);if(c===0)return;const d=t.context,p=d.gl,m=t.transform,y=t.getOrCreateProgram("stars"),x=o.b_([]);o.c0(x,x,-m._pitch),o.b$(x,x,-m.angle),o.c0(x,x,o.al(m._center.lat)),o.e9(x,x,-o.al(m._center.lng));const T=o.c3(new Float32Array(16),x),S=o.az([],m.starsProjMatrix,T),M=o.e4([],T),I=o.ea([],M),C=[0,1,0];o.dz(C,C,I),o.bY(C,C,this.params.sizeMultiplier);const L=[1,0,0];o.dz(L,L,I),o.bY(L,L,this.params.sizeMultiplier);const R=(F=C,B=L,V=c,{u_matrix:Float32Array.from(S),u_up:F,u_right:B,u_intensity_multiplier:V});var F,B,V;t.uploadCommonUniforms(d,y),this.starsVx&&this.starsIdx&&y.draw(t,p.TRIANGLES,et.disabled,Mt.disabled,this.colorModeAlphaBlendedWriteRGB,bt.disabled,R,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function No(l,t){const n=[...l],c=t.cameraWorldSizeForFog/t.worldSize,d=o.bx([]);return o.cE(d,d,[c,c,1]),o.az(n,d,n),o.az(n,t.worldToFogMatrix,n),n}function Ne(l,t,n,c,d){const p=n.material,m=c.context,{baseColorTexture:y,metallicRoughnessTexture:x}=p.pbrMetallicRoughness,{normalTexture:T,occlusionTexture:S,emissionTexture:M}=p;function I(L,R,F){if(L&&(l.push(R),m.activeTexture.set(m.gl.TEXTURE0+F),L.gfxTexture)){const{minFilter:B,magFilter:V,wrapS:Z,wrapT:Y}=L.sampler;L.gfxTexture.bindExtraParam(B,V,Z,Y)}}I(y,"HAS_TEXTURE_u_baseColorTexture",sn.BaseColor),I(x,"HAS_TEXTURE_u_metallicRoughnessTexture",sn.MetallicRoughness),I(T,"HAS_TEXTURE_u_normalTexture",sn.Normal),I(S,"HAS_TEXTURE_u_occlusionTexture",sn.Occlusion),I(M,"HAS_TEXTURE_u_emissionTexture",sn.Emission),d&&(d.texture||(d.texture=new o.eh(c.context,d.image,[d.image.height,d.image.height,d.image.height],m.gl.RGBA8)),m.activeTexture.set(m.gl.TEXTURE0+sn.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 Je(l,t,n,c,d,p){const m=n.paint.get("model-opacity").constantOr(
26541),y=t.context,x=new et(t.context.gl.LEQUAL,et.ReadWrite,t.depthRangeFor3D),T=t.transform,S=l.mesh,M=S.material,I=M.pbrMetallicRoughness,C=t.style.fog;let L;L=t.transform.projection.zAxisUnit==="pixels"?[...l.nodeModelMatrix]:o.az([],c.zScaleMatrix,l.nodeModelMatrix),o.az(L,c.negCameraPosMatrix,L);const R=o.bi([],L);o.ee(R,R);const F=n.paint.get("model-color-use-theme").constantOr("default")==="none",B=n.paint.get("model-emissive-strength").constantOr(0),V=Al(new Float32Array(l.worldViewProjection),new Float32Array(L),new Float32Array(R),null,t,m,I.baseColorFactor,M.emissiveFactor,I.metallicFactor,I.roughnessFactor,M,B,n),Z={defines:[]},Y=[],te=t.shadowRenderer;te&&(te.useNormalOffset=!1),Ne(Z.defines,Y,S,t,F?null:n.lut);let ee=null;if(C){const ie=No(l.nodeModelMatrix,t.transform);if(ee=new Float32Array(ie),T.projection.name!=="globe"){const ne=S.aabb.min,fe=S.aabb.max,[me,Ae]=C.getOpacityForBounds(ie,ne[0],ne[1],fe[0],fe[1]);Z.overrideFog=me>=ve||Ae>=ve}}const J=os(t,n.paint.get("model-cutoff-fade-range"));J.shouldRenderCutoff&&Z.defines.push("RENDER_CUTOFF");const K=t.getOrCreateProgram("model",Z);t.uploadCommonUniforms(y,K,null,ee,J),t.renderPass!=="shadow"&&te&&te.setupShadowsFromMatrix(l.nodeModelMatrix,K),K.draw(t,y.gl.TRIANGLES,x,d,p,S.material.doubleSided?bt.disabled:bt.backCCW,V,n.id,S.vertexBuffer,S.indexBuffer,S.segments,n.paint,t.transform.zoom,void 0,Y)}function Vo(l,t,n,c,d,p,m){let y;y=l.projection.name==="globe"?o.ed(n,l):[...n],o.az(y,y,t.matrix);const x=o.az([],c,y);if(t.meshes)for(const T of t.meshes){if(T.material.alphaMode!=="BLEND"){m.push({mesh:T,depth:0,modelIndex:d,worldViewProjection:x,nodeModelMatrix:y});continue}const S=o.ad([],T.centroid,x);!l.isOrthographic&&S[2]<=0||p.push({mesh:T,depth:S[2],modelIndex:d,worldViewProjection:x,nodeModelMatrix:y})}if(t.children)for(const T of t.children)Vo(l,T,n,c,d,p,m)}function rr(l,t,n,c){const d=n.shadowRenderer;if(!d)return;const p=d.getShadowPassDepthMode(),m=d.getShadowPassColorMode(),y=d.calculateShadowPassMatrixFromMatrix(t),x=jd(y);n.getOrCreateProgram("modelDepth",{defines:n._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(n,n.context.gl.TRIANGLES,p,Mt.disabled,m,bt.backCCW,x,c.id,l.vertexBuffer,l.indexBuffer,l.segments,c.paint,n.transform.zoom,void 0,void 0)}function pe(l,t,n){const c=t.updateZoomBasedPaintProperties(),d=function(p,m,y){let x,T,S,M=p.terrain?p.terrain.exaggeration():0;if(p.terrain&&M>0){const I=p.terrain,C=I.findDEMTileFor(y);C&&C.dem?x=o.ei.create(I,y,C):M=0}if(M===0&&(m.terrainElevationMin=0,m.terrainElevationMax=0),M===m.validForExaggeration&&(M===0||x&&x._demTile&&x._demTile.tileID===m.validForDEMTile.id&&x._dem._timestamp===m.validForDEMTile.timestamp))return!1;for(const I in m.instancesPerModel){const C=m.instancesPerModel[I];for(let L=0;L<C.instancedDataArray.length;++L){const R=(x?M*x.getElevationAt(0|C.instancedDataArray.float32[16*L],0|C.instancedDataArray.float32[16*L+1],!0,!0):0)+C.instancesEvaluatedElevation[L];C.instancedDataArray.float32[16*L+6]=R,T=T?Math.min(m.terrainElevationMin,R):R,S=S?Math.max(m.terrainElevationMax,R):R}}return m.terrainElevationMin=T||0,m.terrainElevationMax=S||0,m.validForExaggeration=M,m.validForDEMTile=x&&x._demTile?{id:x._demTile.tileID,timestamp:x._dem._timestamp}:{id:void 0,timestamp:0},!0}(l,t,n);(c||d)&&(t.uploaded=!1,t.upload(l.context))}const Kn={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new o.cW([0,0,0],[o.aj,o.aj,0])};function $c(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,y=l.canonical.y/n,x=(l.canonical.y+1)/n;let T=t._centerAltitude;if(d){const C=d.getMinMaxForTile(l);C&&C.max>T&&(T=C.max)}const S=o.ay(c.x,p,m)-c.x,M=o.ay(c.y,y,x)-c.y,I=o.c6(T,t.center.lat)-c.z;return t._zoomFromMercatorZ(Math.sqrt(S*S+M*M+I*I))}function Zc(l,t,n,c,d,p,m){const y=l.context,x=l.renderPass==="shadow",T=l.shadowRenderer,S=x&&T?T.getShadowPassDepthMode():new et(y.gl.LEQUAL,et.ReadWrite,l.depthRangeFor3D),M=l.isTileAffectedByFog(p);if(n.meshes)for(const I of n.meshes){const C=["MODEL_POSITION_ON_GPU"],L=[];let R,F,B;c.instancedDataArray.length>20&&C.push("INSTANCED_ARRAYS");const V=os(l,t.paint.get("model-cutoff-fade-range"));if(V.shouldRenderCutoff&&C.push("RENDER_CUTOFF"),x&&T)R=l.getOrCreateProgram("modelDepth",{defines:C}),F=jd(m.shadowTileMatrix,m.shadowTileMatrix,Float32Array.from(n.matrix
2654)),B=T.getShadowPassColorMode();else{Ne(C,L,I,l,t.paint.get("model-color-use-theme").constantOr("default")==="none"?null:t.lut),R=l.getOrCreateProgram("model",{defines:C,overrideFog:M});const Y=I.material,te=Y.pbrMetallicRoughness,ee=t.paint.get("model-opacity").constantOr(1),J=t.paint.get("model-emissive-strength").constantOr(0);F=Al(p.expandedProjMatrix,Float32Array.from(n.matrix),new Float32Array(16),null,l,ee,te.baseColorFactor,Y.emissiveFactor,te.metallicFactor,te.roughnessFactor,Y,J,t,d),T&&(m.shadowUniformsInitialized?R.setShadowUniformValues(y,T.getShadowUniformValues()):(T.setupShadows(p.toUnwrapped(),R,"model-tile",p.overscaledZ),m.shadowUniformsInitialized=!0)),B=V.shouldRenderCutoff||ee<1||Y.alphaMode!=="OPAQUE"?qt.alphaBlended:qt.unblended}l.uploadCommonUniforms(y,R,p.toUnwrapped(),null,V);const Z=I.material.doubleSided?bt.disabled:bt.backCCW;if(c.instancedDataArray.length>20)L.push(c.instancedDataBuffer),R.draw(l,y.gl.TRIANGLES,S,Mt.disabled,B,Z,F,t.id,I.vertexBuffer,I.indexBuffer,I.segments,t.paint,l.transform.zoom,void 0,L,c.instancedDataArray.length);else{const Y=x?"u_instance":"u_normal_matrix";for(let te=0;te<c.instancedDataArray.length;++te)F[Y]=new Float32Array(c.instancedDataArray.arrayBuffer,64*te,16),R.draw(l,y.gl.TRIANGLES,S,Mt.disabled,B,Z,F,t.id,I.vertexBuffer,I.indexBuffer,I.segments,t.paint,l.transform.zoom,void 0,L)}}if(n.children)for(const I of n.children)Zc(l,t,I,c,d,p,m)}const hh=[1,-1,1];function Qd(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 y=!0,x=l.maxHeight;if(x===0){let S=0;for(const M in l.instancesPerModel){const I=d.getModel(M,c);I?S=Math.max(S,Math.max(Math.max(I.aabb.max[0],I.aabb.max[1]),I.aabb.max[2])):y=!1}x=l.maxScale*S*1.41+l.maxVerticalOffset,y&&(l.maxHeight=x)}m.max[2]=x,m.min[2]+=l.terrainElevationMin,m.max[2]+=l.terrainElevationMax,o.ad(m.min,m.min,t.tileMatrix),o.ad(m.max,m.max,t.tileMatrix);const T=m.intersects(p.getCurrentCascadeFrustum());return n.currentShadowCascade===0&&(l.isInsideFirstShadowMapFrustum=T===2),T===0}function ep(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:o.ay(((t-n)/(c-n)-d)/(p-d),0,1)}function Ca(l,t,n,c){if(t.pitch<20)return 1;const d=t.getWorldToCameraMatrix();o.az(d,d,l);const p=o.ej(n.min[0],n.min[1],n.min[2],1);let m=o.aA(o.ek(),p,d),y=m,x=m;p[1]=n.max[1],m=o.aA(o.ek(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x,p[0]=n.max[0],m=o.aA(o.ek(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x,p[1]=n.min[1],m=o.aA(o.ek(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x;const T=o.ay(c[0],0,1),S=100*t.pixelsPerMeter*o.ay(c[1],0,1),M=o.ay(c[2],0,1),I=o.el(o.ek(),y,x,T),C=Math.tan(.5*t.fovX),L=-I[2]*C;if(S===0)return I[1]<-Math.abs(L)?M:1;const R=(-Math.abs(L)-I[1])/S,F=(V,Z,Y)=>(1-Y)*V+Y*Z,B=o.ay(F(1,M,R),M,1);return F(1,B,o.ay((t.pitch-20)/20,0,1))}class Yf{}class Kf{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),y=new Int16Array(m);d.getBufferSubData(d.ELEMENT_ARRAY_BUFFER,0,new Int16Array(m));const x=new o.en;for(let M=0;M<p/2;M+=3){const I=y[M],C=y[M+1],L=y[M+2];x.emplaceBack(I,C),x.emplaceBack(C,L),x.emplaceBack(L,I)}const T=c.bindVertexArrayOES.current,S=new Yf;return S.buf=new Vn(c,x),S.lastUsedFrameIdx=t,this._storage.set(n.id,S),c.bindVertexArrayOES.set(T),S.buf}update(t){for(const[n,c]of this._storage)t-c.lastUsedFrameIdx>30&&(c.buf.destroy(),this._storage.delete(n))}destroy(){for(const[t,n]of this._storage)n.buf.destroy(),this._storage.delete(t)}}class tp{constructor(t){this.occluderSize=30,this.depthOffset=-1e-4,t.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),t.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}const Hc=o.d_([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class dh{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}class ph{constructor(t,n){this.revealStart=11,this.revealRange=2,t.registerParameter(this,[...n,"Reveal"],"revealStart",{min:0,max:17,step:.05}
2654),t.registerParameter(this,[...n,"Reveal"],"revealRange",{min:.1,max:5.1,step:.05})}}const ip=o.d_([{type:"Float32",name:"a_pos_2f",components:2}]);class Wc{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,n){const c=t.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const m=new o.eo,y=new o.a_;m.emplaceBack(-1,-1),m.emplaceBack(1,-1),m.emplaceBack(1,1),m.emplaceBack(-1,1),y.emplaceBack(0,1,2),y.emplaceBack(0,2,3),this.vignetteVx=t.context.createVertexBuffer(m,ip.members),this.vignetteIdx=t.context.createIndexBuffer(y)}const d=o.bd.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,c);const m={u_vignetteShape:(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,et.disabled,Mt.disabled,qt.alphaBlended,bt.disabled,m,"vignette",this.vignetteVx,this.vignetteIdx,d)}var p}}class Rl{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=o.al(p.lng),y=o.al(p.lat),x=t.pixelsPerMeter/n,T=m*o.eq,S=o.eq*Math.log(Math.tan(Math.PI/4+y/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const M=-this._offsetYPrev+S,I=-this._elevationPrev+d;this._accumulatedOffsetX+=(-this._offsetXPrev+T)*x,this._accumulatedOffsetY+=M*x,this._accumulatedElevation+=I*x,this._offsetXPrev=T,this._offsetYPrev=S,this._elevationPrev=d}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function Uo(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 fh(l){const t=o.e7(1323123451230),n=[];for(let c=0;c<l;++c){const d=2*t()-1,p=2*t()-1,m=2*t()-1;n.push(o.cS(d,p,m))}return n}function io(l,t,n,c,d){const p=o.ay((d-n)/(c-n),0,1);return(1-p)*l+p*t}class Xr{constructor(t){this._movement=new Rl,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new Wc,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=o.b_([]);o.c0(p,p,o.al(90)-c._pitch),o.b$(p,p,-c.angle);const m=o.c3(new Float32Array(16),p),y=o.ep(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),x=o.ee([],y),T=o.az([],x,m),S=Date.now()/1e3;return this._accumulatedTimeFromStart+=(S-this._prevTime)*n,this._prevTime=S,{projectionMatrix:d,modelviewMatrix:T}}}class Jf extends Xr{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 ph(t.tp,["Precipitation","Rain"]),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(t){const n=t.context;if(!this.particlesVx){const c=fh(this.particlesCount),d=new o.er,p=new o.a_;let m=0;const y=o.e7(1323123451230);for(let x=0;x<c.length;++x){const T=c[x],S=[2*y()-1,y(),y(),y()];d.emplaceBack(T[0],T[1],T[2],-1,-1,...S),d.emplaceBack(T[0],T[1],T[2],1,-1,...S),d.emplaceBack(T[0],T[1],T[2],1,1,...S),d.emplaceBack(T[0],T[1],T[2],-1,1,...S),p.emplaceBack(m+0,m+1,m+2),p.emplaceBack(m+0,m+2,m+3),m+=4}this.particlesVx=n.createVertexBuffer(d,Hc.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=io(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];o.au(m,m);
2654const y=structuredClone(this._vignetteParams);y.strength*=d,p.overrideStyleParameters||(p.intensity=t.style.rain.state.density,p.timeFactor=t.style.rain.state.intensity,p.color=structuredClone(t.style.rain.state.color),m=structuredClone(t.style.rain.state.direction),p.screenThinning.intensity=t.style.rain.state.centerThinning,p.dropletSizeX=t.style.rain.state.dropletSize[0],p.dropletSizeYScale=t.style.rain.state.dropletSize[1]/t.style.rain.state.dropletSize[0],p.distortionStrength=100*t.style.rain.state.distortionStrength,y.strength=1,y.color=structuredClone(t.style.rain.state.vignetteColor));const x=this.updateOnRender(t,p.timeFactor),T=t.context,S=T.gl,M=t.transform;this.screenTexture&&this.screenTexture.size[0]===t.width&&this.screenTexture.size[1]===t.height||(this.screenTexture=new o.T(T,{width:t.width,height:t.height,data:null},S.RGBA8)),p.distortionStrength>0&&(T.activeTexture.set(S.TEXTURE0),this.screenTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),S.copyTexSubImage2D(S.TEXTURE_2D,0,0,0,0,0,t.width,t.height));const I=t.getOrCreateProgram("rainParticle");t.uploadCommonUniforms(T,I),T.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],L=(R,F)=>{const B=Uo(this._movement.getPosition(),R),V=p.dropletSizeX,Z=p.dropletSizeX*p.dropletSizeYScale,Y=t.width/2,te=t.height/2,ee=io(0,p.screenThinning.start,0,1,p.screenThinning.intensity),J=io(.001,p.screenThinning.range,0,1,p.screenThinning.intensity),K=io(0,p.screenThinning.particleOffset,0,1,p.screenThinning.intensity),ie=(ne={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:B,velocityConeAperture:p.velocityConeAperture,velocity:p.velocity,boxSize:R,rainDropletSize:[V,Z],distortionStrength:p.distortionStrength,rainDirection:m,color:C,screenSize:[M.width,M.height],thinningCenterPos:[Y,te],thinningShape:[ee,J,Math.pow(10,p.screenThinning.fadePower)],thinningAffectedRatio:p.screenThinning.affectedRatio,thinningParticleOffset:K,shapeDirectionalPower:p.shapeDirPower,shapeNormalPower:p.shapeNormalPower,mode:F?0:1},{u_modelview:Float32Array.from(ne.modelview),u_projection:Float32Array.from(ne.projection),u_time:ne.time,u_cam_pos:ne.camPos,u_texScreen:0,u_velocityConeAperture:ne.velocityConeAperture,u_velocity:ne.velocity,u_boxSize:ne.boxSize,u_rainDropletSize:ne.rainDropletSize,u_distortionStrength:ne.distortionStrength,u_rainDirection:ne.rainDirection,u_color:ne.color,u_screenSize:ne.screenSize,u_thinningCenterPos:ne.thinningCenterPos,u_thinningShape:ne.thinningShape,u_thinningAffectedRatio:ne.thinningAffectedRatio,u_thinningParticleOffset:ne.thinningParticleOffset,u_shapeDirectionalPower:ne.shapeDirectionalPower,u_shapeNormalPower:ne.shapeNormalPower,u_mode:ne.mode});var ne;const fe=Math.round(p.intensity*this.particlesCount),me=o.bd.simpleSegment(0,0,4*fe,2*fe);I.draw(t,S.TRIANGLES,et.disabled,Mt.disabled,qt.alphaBlended,bt.disabled,ie,"rain_particles",this.particlesVx,this.particlesIdx,me)};p.distortionStrength>0&&L(p.boxSize,!0),L(p.boxSize,!1),this._vignette.draw(t,y)}}const Dl=o.d_([{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 Zi extends Xr{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 ph(t.tp,["Precipitation","Snow"]),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(t){const n=t.context;if(!this.particlesVx){const c=fh(this.particlesCount),d=new o.es,p=new o.a_;let m=0;const y=o.e7(1323123451230);for(let x=0;x<c.length;++x){const T=c[x],S=y(),M=y(),I=y(),C=[x/c.length,S,M,I],L=[y(),y()];d.emplaceBack(T[0],T[1],T[2],-1,-1,...C,...L),d.emplaceBack(T[0],T[1],T[2],1,-1,...C,...L),d.emplaceBack(T[0],T[1],T[2],1,1,...C,...L),d.emplaceBack(T[0],T[1],T[2],-1,1,...C,...L),p.emplaceBack(m+0,m+1,m+2),p.emplaceBack(m+0,m+2,m+3),m
2654+=4}this.particlesVx=n.createVertexBuffer(d,Dl.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];o.au(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 y=io(0,1,p.revealStart,p.revealStart+p.revealRange,m);d.strength*=y,n.overrideStyleParameters||(n.intensity=t.style.snow.state.density,n.timeFactor=t.style.snow.state.intensity,n.color=structuredClone(t.style.snow.state.color),c=structuredClone(t.style.snow.state.direction),n.screenThinning.intensity=t.style.snow.state.centerThinning,n.billboardSize=2.79*t.style.snow.state.flakeSize,d.strength=1,d.color=structuredClone(t.style.snow.state.vignetteColor));const x=this.updateOnRender(t,n.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const T=t.context,S=T.gl,M=t.transform,I=t.getOrCreateProgram("snowParticle");t.uploadCommonUniforms(T,I),((C,L,R)=>{const F=Uo(this._movement.getPosition(),C),B=M.width/2,V=M.height/2,Z=io(0,R.screenThinning.start,0,1,R.screenThinning.intensity),Y=io(.001,R.screenThinning.range,0,1,R.screenThinning.intensity),te=io(0,R.screenThinning.particleOffset,0,1,R.screenThinning.intensity),ee=(J={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:F,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:[B,V],thinningShape:[Z,Y,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(J.modelview),u_projection:Float32Array.from(J.projection),u_time:J.time,u_cam_pos:J.camPos,u_velocityConeAperture:J.velocityConeAperture,u_velocity:J.velocity,u_horizontalOscillationRadius:J.horizontalOscillationRadius,u_horizontalOscillationRate:J.horizontalOscillationRate,u_boxSize:J.boxSize,u_billboardSize:J.billboardSize,u_simpleShapeParameters:J.simpleShapeParameters,u_screenSize:J.screenSize,u_thinningCenterPos:J.thinningCenterPos,u_thinningShape:J.thinningShape,u_thinningAffectedRatio:J.thinningAffectedRatio,u_thinningParticleOffset:J.thinningParticleOffset,u_particleColor:J.color,u_direction:J.direction});var J;const K=Math.round(R.intensity*this.particlesCount),ie=o.bd.simpleSegment(0,0,4*K,2*K);this.particlesVx&&this.particlesIdx&&I.draw(t,S.TRIANGLES,et.disabled,Mt.disabled,qt.alphaBlended,bt.disabled,ee,"snow_particles",this.particlesVx,this.particlesIdx,ie)})(n.boxSize,0,n),this._vignette.draw(t,d)}}const ii={symbol:function(l,t,n,c,d){if(l.renderPass!=="translucent")return;const p=Mt.disabled,m=l.colorModeForRenderPass(),y=n.layout.get("text-variable-anchor"),x=n.layout.get("text-size-scale-range"),T=o.ay(l.scaleFactor,x[0],x[1]);y&&function(I,C,L,R,F,B,V,Z){const Y=C.transform,te=F==="map",ee=B==="map";for(const J of I){const K=R.getTile(J),ie=K.getBucket(L);if(!ie||!ie.text||!ie.text.segments.get().length)continue;const ne=o.bH(ie.textSizeData,Y.zoom,Z),fe=_c(J,ie.getProjection(),Y),me=Y.calculatePixelsToTileUnitsMatrix(K),Ae=vs(fe,K.tileID.canonical,ee,te,Y,ie.getProjection(),me),Me=ie.hasIconTextFit()&&ie.hasIconData();ne&&qd(ie,te,ee,V,Y,Ae,J,Math.pow(2,Y.zoom-K.tileID.overscaledZ),ne,Me)}}(c,l,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),d,T);const S=n.paint.get("icon-opacity").constantOr(1)!==0,M=n.paint.get("text-opacity").constantOr(1)!==0;n.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(S||M)?Ea(l,t,n,c,p,m):(S&&Ea(l,t,n,c,p,m,{onlyIcons:!0}),M&&Ea(l,t,n,c,p,m,{onlyText:!0})),t.map.showCollisionBoxes&&(Uc(l,t,n,c,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Uc(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"),y=n.layout.get("
vendor: 6,093 bytes, line 2654
2654circle-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 T=l.context,S=T.gl,M=l.transform,I=!(!l.terrain||!l.terrain.enabled),C=n.layout.get("circle-elevation-reference"),L=l.depthModeForSublayer(0,et.ReadOnly),R=new et(l.context.gl.LEQUAL,et.ReadOnly,l.depthRangeFor3D),F=C==="none"||I?L:R,B=Mt.disabled,V=l.colorModeForDrapableLayerRenderPass(x),Z=M.projection.name==="globe",Y=[o.aD(M.center.lng),o.aH(M.center.lat)],te=[];for(let J=0;J<c.length;J++){const K=c[J],ie=t.getTile(K),ne=ie.getBucket(n);if(!ne||ne.projection.name!==M.projection.name)continue;const fe=ne.programConfigurations.get(n.id),me=ne.layoutVertexBuffer,Ae=ne.globeExtVertexBuffer,Me=ne.indexBuffer,Fe=o.dK(n),de=[Ae],we=l.isTileAffectedByFog(K);Z&&Fe.push("PROJECTION_GLOBE_VIEW"),Fe.push("DEPTH_D24"),l.terrain&&M.depthOcclusionForSymbolsAndCircles&&Fe.push("DEPTH_OCCLUSION"),ne.hasElevation&&(Fe.push("ELEVATED_ROADS"),de.push(ne.elevatedLayoutVertexBuffer));const le=l.getOrCreateProgram("circle",{config:fe,defines:Fe,overrideFog:we}),Pe=M.projection.createInversionMatrix(M,K.canonical),ye={programConfiguration:fe,program:le,layoutVertexBuffer:me,dynamicBuffers:de,indexBuffer:Me,uniformValues:o.dL(l,K,ie,Pe,Y,n),tile:ie};if(y){const De=ne.segments.get();for(const qe of De)te.push({segments:new o.bd([qe]),sortKey:qe.sortKey,state:ye})}else te.push({segments:ne.segments,sortKey:0,state:ye})}y&&te.sort((J,K)=>J.sortKey-K.sortKey);const ee={useDepthForOcclusion:M.depthOcclusionForSymbolsAndCircles};for(const J of te){const{programConfiguration:K,program:ie,layoutVertexBuffer:ne,dynamicBuffers:fe,indexBuffer:me,uniformValues:Ae,tile:Me}=J.state,Fe=J.segments;l.terrain&&l.terrain.setupElevationDraw(Me,ie,ee),l.uploadCommonUniforms(T,ie,Me.tileID.toUnwrapped()),ie.draw(l,S.TRIANGLES,F,B,V,bt.disabled,Ae,n.id,ne,me,Fe,n.paint,M.zoom,K,fe)}},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=Mt.disabled,y=new qt([p.ONE,p.ONE,p.ONE,p.ONE],o.am.transparent,[!0,!0,!0,!0]);(function(C,L,R,F){const B=C.gl,V=L.width*F,Z=L.height*F;C.activeTexture.set(B.TEXTURE1),C.viewport.set([0,0,V,Z]);let Y=R.heatmapFbo;if(!Y||Y&&(Y.width!==V||Y.height!==Z)){Y&&Y.destroy();const te=B.createTexture();B.bindTexture(B.TEXTURE_2D,te),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_WRAP_S,B.CLAMP_TO_EDGE),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_WRAP_T,B.CLAMP_TO_EDGE),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MIN_FILTER,B.LINEAR),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MAG_FILTER,B.LINEAR),Y=R.heatmapFbo=C.createFramebuffer(V,Z,!0,null),function(ee,J,K,ie,ne,fe){const me=ee.gl;me.texImage2D(me.TEXTURE_2D,0,ee.extRenderToTextureHalfFloat?me.RGBA16F:me.RGBA,ne,fe,0,me.RGBA,ee.extRenderToTextureHalfFloat?me.HALF_FLOAT:me.UNSIGNED_BYTE,null),ie.colorAttachment.set(K)}(C,0,te,Y,V,Z)}else B.bindTexture(B.TEXTURE_2D,Y.colorAttachment.get()),C.bindFramebuffer.set(Y.framebuffer)})(d,l,n,l.transform.projection.name==="globe"?.5:.25),d.clear({color:o.am.transparent});const x=l.transform,T=x.projection.name==="globe",S=T?["PROJECTION_GLOBE_VIEW"]:[],M=T?bt.frontCCW:bt.disabled,I=[o.aD(x.center.lng),o.aH(x.center.lat)];for(let C=0;C<c.length;C++){const L=c[C];if(t.hasRenderableParent(L))continue;const R=t.getTile(L),F=R.getBucket(n);if(!F||F.projection.name!==x.projection.name)continue;const B=l.isTileAffectedByFog(L),V=F.programConfigurations.get(n.id),Z=l.getOrCreateProgram("heatmap",{config:V,defines:S,overrideFog:B}),{zoom:Y}=l.transform;l.terrain&&l.terrain.setupElevationDraw(R,Z),l.uploadCommonUniforms(d,Z,L.toUnwrapped());const te=x.projection.createInversionMatrix(x,L.canonical);Z.draw(l,p.TRIANGLES,et.disabled,m,y,M,Nd(l,L,R,te,I,Y,n.paint.get("heatmap-intensity")),n.id,F.layoutVertexBuffer,F.indexBuffer,F.segments,n.paint,l.transform.zoom,V,T?[F.globeExtVertexBuffer]:null)}d.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),function(d,p){const m=d.context,y=m.gl,x=p.heatmapFbo;if(!x)return;m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,x.colorAttachment.get()),m.activeTexture.set(y.TEXTURE1);let T=p.colorRampTexture;T||(T=p.colorRampTexture=new o.T(m,p.colorRamp,y.RGBA8)),T.bind(y.LINEAR,y.CLAMP_TO_EDGE),d.getOrCreateProgram("heatmapTexture").draw(d,y.TRIANGLES,et.disabled,Mt.disabled,d.colorModeForRenderPass(),bt.disabled,((S,M,I,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"),y=n.paint.get("line-occlusion-opacity"),x=n.layout.get("line-elevation-reference"),T=n.layout.get("line-width-unit")==="meters",S=x==="sea",M=!(!l.terrain||!l.terrain.enabled),I=l.context,C=I.gl;if(n.hasElevatedBuckets&&l.transform.projection.name==="globe")return;const L=n.layout.get("line-cross-slope"),R=L!==void 0,F=L<1,B=l.colorModeForDrapableLayerRenderPass(m),V=l.terrain&&l.terrain.renderingToTexture,Z=V?1:o.q.devicePixelRatio,Y=n.paint.get("line-dasharray"),te=Y.constantOr(1),ee=n.layout.get("line-cap"),J=Y.constantOr(null),K=ee.constantOr(null),ie=n.paint.get("line-pattern"),ne=ie.constantOr(1),fe=n.paint.get("line-pattern-cross-fade"),me=ie.constantOr(null),Ae=n.paint.get("line-opacity").constantOr(1);let Me=!ne&&Ae!==1||l.depthOcclusion&&y>0&&y<1;const Fe=n.paint.get("line-gradient"),de=ne?"linePattern":"line",we=o.dM(n);let le;if(V&&l.terrain&&l.terrain.clipOrMaskOverlapStencilType()&&(Me=!1),y!==0&&l.depthOcclusion){const qe=n.paint._values["line-opacity"];qe&&qe.value&&qe.value.kind==="constant"?le=qe.value:o.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&&we.pu
2654sh("VARIABLE_LINE_WIDTH");const Pe=(qe,Ce,je,it,rt,Qe)=>{for(const ut of qe){const pt=t.getTile(ut);if(ne&&!pt.patternsLoaded())continue;const yt=pt.getBucket(n);if(!yt||yt.elevationType!=="none"&&!rt||yt.elevationType==="none"&&rt)continue;l.prepareDrawTile();const It=[...Ce],Ot=l.shadowRenderer,pi=yt.elevationType==="road"&&!!Ot&&Ot.enabled;let Ri=[0,0,0];if(pi){const Qt=l.style.directionalLight,mr=l.style.ambientLight;Qt&&mr&&(Ri=Po(l.style,Qt,mr)),It.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const gi=yt.programConfigurations.get(n.id);let bi=!1;if(me&&pt.imageAtlas){const Qt=o.dN.from(me),mr=Qt.getPrimary().scaleSelf(Z).toString(),Bi=pt.imageAtlas.patternPositions.get(mr),Mi=Qt.getSecondary(),Ni=Mi?pt.imageAtlas.patternPositions.get(Mi.scaleSelf(Z).toString()):null;bi=!!Bi&&!!Ni,Bi&&gi.setConstantPatternPositions(Bi,Ni)}fe>0&&(bi||gi.getPatternTransitionVertexBuffer("line-pattern"))&&It.push("LINE_PATTERN_TRANSITION");const ur=l.isTileAffectedByFog(ut),Rt=l.getOrCreateProgram(de,{config:gi,defines:It,overrideFog:ur,overrideRtt:!rt&&void 0});if(!ne&&J&&K&&pt.lineAtlas){const Qt=pt.lineAtlas.getDash(J,K);Qt&&gi.setConstantPatternPositions(Qt)}pi&&Ot.setupShadows(pt.tileID.toUnwrapped(),Rt,"vector-tile",pt.tileID.overscaledZ);let[Vt,Wt]=n.paint.get("line-trim-offset");(K==="round"||K==="square")&&Vt!==Wt&&(Vt===0&&(Vt-=1),Wt===1&&(Wt+=1));const Oi=V?ut.projMatrix:null,br=T?1/yt.tileToMeter/o.aw(pt,1,l.transform.zoom):1,Di=T?1/yt.tileToMeter/o.aw(pt,1,Math.floor(l.transform.zoom)):1,li=ne?o.dO(l,pt,n,Oi,Z,br,Di,[Vt,Wt],Ri,fe):o.dP(l,pt,n,Oi,yt.lineClipsArray.length,Z,br,Di,[Vt,Wt],Ri);if(Fe){const Qt=yt.gradients[n.id];let mr=Qt.texture;if(n.gradientVersion!==Qt.version){let Bi=256;if(n.stepInterpolant){const Mi=t.getSource().maxzoom,Ni=ut.canonical.z===Mi?Math.ceil(1<<l.transform.maxZoom-ut.canonical.z):1;Bi=o.ay(o.dQ(yt.maxLineLength/o.aj*1024*Ni),256,I.maxTextureSize)}Qt.gradient=o.dR({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:Bi,image:Qt.gradient||void 0,clips:yt.lineClipsArray}),Qt.texture?Qt.texture.update(Qt.gradient):Qt.texture=new o.T(I,Qt.gradient,C.RGBA8),Qt.version=n.gradientVersion,mr=Qt.texture}I.activeTexture.set(C.TEXTURE1),mr.bind(n.stepInterpolant?C.NEAREST:C.LINEAR,C.CLAMP_TO_EDGE)}te&&(I.activeTexture.set(C.TEXTURE0),pt.lineAtlasTexture&&pt.lineAtlasTexture.bind(C.LINEAR,C.REPEAT),gi.updatePaintBuffers()),ne&&(I.activeTexture.set(C.TEXTURE0),pt.imageAtlasTexture&&pt.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),gi.updatePaintBuffers()),rt&&!S&&l.terrain.setupElevationDraw(pt,Rt),l.uploadCommonUniforms(I,Rt,ut.toUnwrapped());const nr=Qt=>{le!=null&&(le.value=Ae*y),Rt.draw(l,C.TRIANGLES,je,Qt,B,bt.disabled,li,n.id,yt.layoutVertexBuffer,yt.indexBuffer,yt.segments,n.paint,l.transform.zoom,gi,[yt.layoutVertexBuffer2,yt.patternVertexBuffer,yt.zOffsetVertexBuffer]),le!=null&&(le.value=Ae)};if(Me&&!rt){const Qt=l.stencilModeForClipping(ut).ref;Qt===0&&V&&I.clear({stencil:0});const mr={func:C.EQUAL,mask:255};li.u_alpha_discard_threshold=.8,nr(new Mt(mr,Qt,255,C.KEEP,C.KEEP,C.INVERT)),li.u_alpha_discard_threshold=0,nr(new Mt(mr,Qt,255,C.KEEP,C.KEEP,C.KEEP))}else li.u_alpha_discard_threshold=Me&&rt&&Qe?.8:0,nr(rt?it:l.stencilModeForClipping(ut))}};let ye=l.depthModeForSublayer(0,et.ReadOnly);const De=new et(l.depthOcclusion?C.GREATER:C.LEQUAL,et.ReadOnly,l.depthRangeFor3D);if(n.hasNonElevatedBuckets){const qe=!V&&l.terrain;y!==0&&qe?o.w(`Occlusion opacity for layer ${n.id} is supported on terrain only if the layer has line-z-offset enabled.`):qe?o.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${n.id}.`):Pe(c,we,ye,Mt.disabled,!1,!0)}if(n.hasElevatedBuckets){x==="hd-road-markup"?M||(ye=De,we.push("ELEVATED_ROADS")):(we.push("ELEVATED"),ye=De,R&&we.push(F?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),S&&we.push("ELEVATION_REFERENCE_SEA"));const qe=Me?l.stencilModeFor3D():Mt.disabled;l.forceTerrainMode=!0,Pe(c,we,ye,qe,!0,!0),Me&&Pe(c,we,ye,qe,!0,!1),l.forceTerrainMode=!1}Me&&(l.resetStencilClippingMasks(),V&&I.clear({stencil:0})),y===0||l.depthOcclusion||V||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"),y=l.colorModeForDrapableLayerRenderPass(m),x=n.paint.get("fill-pattern"),T=l.opaquePassEnabledForLayer()&&!x.constantOr(1)&&d.constantOr(o.am.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),I={painter:l,sourceCache:t,layer:n,coords:c,colorMode:y,elevationType:S,terrainEnabled:M,pass:T};
2654if(l.renderPass!=="shadow")if(S!=="offset"){if(lh(I,!1),S==="road"){const C=!M&&l.renderPass==="translucent";C&&ah(l,t,n,c,"geometry"),lh(I,!0,Mt.disabled),C&&function(L){const{painter:R,sourceCache:F,layer:B,coords:V,colorMode:Z}=L,Y=R.context.gl,te=L.painter.shadowRenderer,ee=!!te&&te.enabled,J=new et(R.context.gl.LEQUAL,et.ReadOnly,R.depthRangeFor3D);let K=[0,0,0];if(ee){const ne=R.style.directionalLight,fe=R.style.ambientLight;ne&&fe&&(K=Po(R.style,ne,fe))}const ie=ne=>{for(const fe of V){const me=F.getTile(fe),Ae=me.getBucket(B);if(!Ae)continue;const Me=Ae.elevatedStructures;if(!Me)continue;let Fe,de;if(ne?(Fe=Me.renderableBridgeSegments,de=Me.bridgeProgramConfigurations.get(B.id)):(Fe=Me.renderableTunnelSegments,de=Me.tunnelProgramConfigurations.get(B.id)),!Fe||Fe.segments[0].primitiveLength===0)continue;de.updatePaintBuffers(),R.prepareDrawTile();const we=R.isTileAffectedByFog(fe),le=[];ee&&le.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const Pe=R.getOrCreateProgram("elevatedStructures",{config:de,overrideFog:we,defines:le}),ye=R.translatePosMatrix(fe.projMatrix,me,B.paint.get("fill-translate"),B.paint.get("fill-translate-anchor"));ee&&te.setupShadows(me.tileID.toUnwrapped(),Pe,"vector-tile",me.tileID.overscaledZ);const De=Nf(ye,K);R.uploadCommonUniforms(R.context,Pe,fe.toUnwrapped()),Pe.draw(R,Y.TRIANGLES,J,Mt.disabled,Z,bt.backCCW,De,B.id,Me.vertexBuffer,Me.indexBuffer,Fe,B.paint,R.transform.zoom,de,[Me.vertexBufferNormal])}};ie(!0),ie(!1)}(I)}}else lh(I,!1,l.stencilModeFor3D());else l.shadowRenderer&&S==="road"&&!M&&function(C){const{painter:L,sourceCache:R,layer:F,coords:B}=C,V=L.context.gl,Z=C.painter.shadowRenderer;for(const Y of B){const te=R.getTile(Y),ee=te.getBucket(F);if(!ee)continue;const J=ee.elevatedStructures;if(!J||!J.shadowCasterSegments||J.shadowCasterSegments.segments[0].primitiveLength===0)continue;L.prepareDrawTile();const K=ee.bufferData.programConfigurations.get(F.id),ie=L.isTileAffectedByFog(Y),ne=L.getOrCreateProgram("elevatedStructuresDepth",{config:K,overrideFog:ie}),fe=Z.calculateShadowPassMatrixFromTile(te.tileID.toUnwrapped());L.uploadCommonUniforms(L.context,ne,Y.toUnwrapped());const me={u_matrix:fe,u_depth_bias:.001};ne.draw(L,V.TRIANGLES,Z.getShadowPassDepthMode(),Mt.disabled,Z.getShadowPassColorMode(),bt.disabled,me,F.id,J.vertexBuffer,J.indexBuffer,J.shadowCasterSegments,F.paint,L.transform.zoom,K)}}(I)},"fill-extrusion":function(l,t,n,c){const d=n.paint.get("fill-extrusion-opacity"),p=l.context,m=p.gl,y=l.terrain,x=y&&y.renderingToTexture;if(d===0)return;const T=l.conflationActive&&l.style.isLayerClipped(n,t.getSource()),S=l.style.order.indexOf(n.fqid);if(T&&function(M,I,C,L,R){for(const F of L){const B=I.getTile(F).getBucket(C);B&&(B.updateReplacement(F,M.replacementSource,R),B.uploadCentroid(M.context))}}(l,t,n,c,S),y||T)for(const M of c){const I=t.getTile(M).getBucket(n);I&&tt(l.context,t,M,I,n,y,T)}if(l.renderPass==="shadow"&&l.shadowRenderer){const M=l.shadowRenderer;if(y&&d<.65&&n._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof o.ab)return;const I=M.getShadowPassDepthMode(),C=M.getShadowPassColorMode();Es(l,t,n,c,I,Mt.disabled,C,T)}else if(l.renderPass==="translucent"){const M=!n.paint.get("fill-extrusion-pattern").constantOr(1),I=n.paint.get("fill-extrusion-color").constantOr(o.am.white);if(!x&&I.a!==0){const C=new et(l.context.gl.LEQUAL,et.ReadWrite,l.depthRangeFor3D);d===1&&M?Es(l,t,n,c,C,Mt.disabled,qt.unblended,T):(Es(l,t,n,c,C,Mt.disabled,qt.disabled,T),Es(l,t,n,c,C,l.stencilModeFor3D(),l.colorModeForRenderPass(),T),l.resetStencilClippingMasks())}if(l.style.enable3dLights()&&M&&(!y&&l.transform.projection.name!=="globe"||x)){const C=n.paint.get("fill-extrusion-opacity"),L=n.paint.get("fill-extrusion-ambient-occlusion-intensity"),R=n.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),F=n.paint.get("fill-extrusion-flood-light-intensity"),B=n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",V=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(B?null:n.lut).toArray01().slice(0,3),Z=L>0&&R>0,Y=F>0,te=(J,K,ie)=>(1-ie)*J+ie*K,ee=J=>{const K=l.depthModeForSublayer(1,et.ReadOnly,m.LEQUAL,!0),ie=n.paint.get(J?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),ne=te(.1,3,ie),fe=l._showOverdrawInspector;if(!fe){const me=new Mt({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),Ae=new qt([m.ONE,m.ONE,m.ONE,m.ONE],o.am.transparent,[!1,!1,!1,!0],m.MIN);Is(l,t,n,c,K,me,Ae,bt.disabled,J,"sdf",C,L,R,F,V,ne,T,!1)}{const me=fe?Mt.disabled:new Mt({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),Ae=fe?l.colorModeForRenderPass():new qt([m.ONE_MINUS_DST_ALPHA,m.DST_ALPHA,m.ONE,m.ONE],o.am.transparent,[!0,!0,!0,!0]);Is(l,t,n,c,K,me,Ae,bt.disabled,J,"color",C,L,R,F,V,ne,T,!1)}};if(x){const J=(K,ie,ne)=>{const fe=l.depthModeForSublayer(1,et.ReadOnly,m.LEQUAL,!1),me=n.paint.get(K?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Ae=te(.1,3,me);{const Me=new qt([m.ONE,m.ONE,m.ONE,m.ONE],o.am.transparent,[!1,!1,!1,!0]);Is(l,t,n,c,fe,Mt.disabled,Me,bt.disabled,K,"clear",C,L,R,F,V,Ae,T,ie)}{const Me=new Mt({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),Fe=new qt([m.ONE,m.ONE,m.ONE,m.ONE],o.am.transparent,[!1,!1,!1,!0],m.MIN);Is(l,t,n,c,fe,Me,Fe,bt.disabled,K,"sdf",C,L,R,F,V,Ae,T,ie)}{const Me=K?m.ZERO:m.ONE_MINUS_DST_ALPHA,Fe=new Mt({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),de=new qt([Me,m.DST_ALPHA,m.ONE_MINUS_DST_ALPHA,m.ZERO],o.am.transparent,[!0,!0,!0,!0]);Is(l,t,n,c,fe,Fe,de,bt.disabled,K,"color",C,L,R,F,V,Ae,T,ie)}{const Me=new qt([m.ONE,m.ONE,m.ONE,K?m.ZERO:m.ONE],o.am.transparent,[!1,!1,!1,!0],K?m.FUNC_ADD:m.MAX);Is(l,t,n,c,fe,Mt.disabled,Me,bt.disabled,K,"clear",C,L,R,F,V,Ae,T,ie,ne)}};if(Z||Y){let K;if(l.prepareDrawTile(),y){const ie=y.drapeBufferSize[0],ne=y.drapeBufferSize[1];K=y.framebufferCopyTexture,K&&(!K||K.size[0]===ie&&K.size[1]===ne)||(K&&K.destroy(),K=y.framebufferCopyTexture=new o.T(p,new o.r({width:ie,height:ne}),m.RGBA8)),K.bind(m.LINEAR,m.CLAMP_TO_EDGE),m.copyTexSubImage2D(m.TEXTURE_2D,0,0,0,0,0,ie,ne)}Z&&J(!0,!1,K),Y&&J(!1,!0,K)}}else Z&&ee(!0),Y&&ee(!1),(Z||Y)&&l.resetStencilClippingMasks()}}},building:function(l,t,n,c){},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,y]=l.renderPass!=="translucent"||p?[{},c]:l.stencilConfigForOverlap(c);for(const x of y){const T=t.getTile(x);
2654if(T.needsHillshadePrepare&&l.renderPass==="offscreen")Af(l,T,n);else if(l.renderPass==="translucent"){const S=l.depthModeForSublayer(0,et.ReadOnly),M=n.paint.get("hillshade-emissive-strength"),I=l.colorModeForDrapableLayerRenderPass(M),C=p&&l.terrain?l.terrain.stencilModeForRTTOverlap(x):m[x.overscaledZ];If(l,x,T,n,S,C,I)}}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",y=n.paint.get("raster-elevation")!==0,x=y&&m;if(l.renderElevatedRasterBackface&&!x)return;const T=l.context,S=T.gl,M=t.getSource(),I=function(ee,J,K,ie){const ne=J.paint.get("raster-color"),fe=ee.type==="raster-array",me=[],Ae=J.paint.get("raster-resampling"),Me=J.paint.get("raster-color-mix");let Fe=J.paint.get("raster-color-range");const de=[Me[0],Me[1],Me[2],0],we=Me[3];let le=Ae==="nearest"?ie.NEAREST:ie.LINEAR;if(fe&&(me.push("RASTER_ARRAY"),ne||me.push("RASTER_COLOR"),Ae==="linear"&&me.push("RASTER_ARRAY_LINEAR"),le=ie.NEAREST,!Fe&&ee.rasterLayers)){const Pe=ee.rasterLayers.find(({id:ye})=>ye===J.sourceLayer);Pe&&Pe.fields&&Pe.fields.range&&(Fe=Pe.fields.range)}if(Fe=Fe||[0,1],ne){me.push("RASTER_COLOR"),K.activeTexture.set(ie.TEXTURE2),J.updateColorRamp(Fe);let Pe=J.colorRampTexture;Pe||(Pe=J.colorRampTexture=new o.T(K,J.colorRamp,ie.RGBA8)),Pe.bind(ie.LINEAR,ie.CLAMP_TO_EDGE)}return{mix:de,range:Fe,offset:we,defines:me,resampling:le}}(M,n,T,S);if(M instanceof o.aP&&!c.length&&!m)return;const C=n.paint.get("raster-emissive-strength"),L=l.colorModeForDrapableLayerRenderPass(C),R=l.terrain&&l.terrain.renderingToTexture,F=!l.options.moving,B=n.paint.get("raster-resampling")==="nearest"?S.NEAREST:S.LINEAR;if(M instanceof o.aP&&!c.length&&(M.onNorthPole||M.onSouthPole)){const ee=y?l.stencilModeFor3D():Mt.disabled;return void Pl(!!M.onNorthPole,null,l,t,n,C,I,bt.disabled,ee)}if(!c.length)return;const[V,Z]=M instanceof o.aP||R?[{},c]:l.stencilConfigForOverlap(c),Y=Z[Z.length-1].overscaledZ;x&&I.defines.push("PROJECTION_GLOBE_VIEW"),y&&I.defines.push("RENDER_CUTOFF");const te=(ee,J,K)=>{for(const ie of ee){const ne=ie.toUnwrapped(),fe=t.getTile(ie);if(R&&(!fe||!fe.hasData()))continue;T.activeTexture.set(S.TEXTURE0);const me=$f(fe,M,n,I);if(!me||!me.texture)continue;const{texture:Ae,mix:Me,offset:Fe,tileSize:de,buffer:we}=me;let le,Pe;R?(le=et.disabled,Pe=ie.projMatrix):y?(le=new et(S.LEQUAL,et.ReadWrite,l.depthRangeFor3D),Pe=m?Float32Array.from(l.transform.expandedFarZProjMatrix):l.transform.calculateProjMatrix(ne,F)):(le=l.depthModeForSublayer(ie.overscaledZ-Y,n.paint.get("raster-opacity")===1?et.ReadWrite:et.ReadOnly,S.LESS),Pe=l.transform.calculateProjMatrix(ne,F));const ye=l.terrain&&R?l.terrain.stencilModeForRTTOverlap(ie):V[ie.overscaledZ],De=p?0:n.paint.get("raster-fade-duration");fe.registerFadeDuration(De);const qe=t.findLoadedParent(ie,0),Ce=Lo(fe,qe,t,l.transform,De);let je,it;l.terrain&&l.terrain.prepareDrawTile(),T.activeTexture.set(S.TEXTURE0),Ae.bind(B,S.CLAMP_TO_EDGE),T.activeTexture.set(S.TEXTURE1),qe?(qe.texture&&qe.texture.bind(B,S.CLAMP_TO_EDGE),je=Math.pow(2,qe.tileID.overscaledZ-fe.tileID.overscaledZ),it=[fe.tileID.canonical.x*je%1,fe.tileID.canonical.y*je%1]):Ae.bind(B,S.CLAMP_TO_EDGE),"useMipmap"in Ae&&T.extTextureFilterAnisotropic&&l.transform.pitch>20&&S.texParameterf(S.TEXTURE_2D,T.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,T.extTextureFilterAnisotropicMax);const rt=l.transform;let Qe;const ut=y?qf(rt):[0,0,0,0];let pt,yt,It,Ot,pi,Ri=0;if(x&&M instanceof o.aP&&M.coordinates.length>3)pt=Float32Array.from(o.bh(o.dr(new o.cp(0,0,0)))),yt=Float32Array.from(rt.globeMatrix),It=Float32Array.from(o.dm(rt)),Ot=[o.aD(rt.center.lng),o.aH(rt.center.lat)],Qe=M.elevatedGlobePerspectiveTransform,pi=M.elevatedGlobeGridMatrix||new Float32Array(9);else if(x){const Rt=o.dn(ie.canonical);Ri=o.dp(Rt.getCenter().lat),pt=Float32Array.from(o.bh(o.dr(ie.canonical))),yt=Float32Array.from(rt.globeMatrix),It=Float32Array.from(o.dm(rt)),Ot=[o.aD(rt.center.lng),o.aH(rt.center.lat)],Qe=[0,0],pi=Float32Array.from(o.dq(ie.canonical,Rt,Ri,rt.worldSize/rt._pixelsPerMercatorPixel))}else Qe=M instanceof o.aP?M.perspectiveTransform:[0,0],pt=new Float32Array(16),yt=new Float32Array(9),It=new Float32Array(16),Ot=[0,0],pi=new Float32Array(9);const gi=rh(Pe,pt,yt,It,pi,it||[0,0],o.ah(l.transform.zoom),Ot,ut,je||1,Ce,n,Qe,y?n.paint.get("raster-elevation"):0,2,Me,Fe,I.range,de,we,C),bi=l.isTileAffectedByFog(ie),ur=l.getOrCreateProgram("raster",{defines:I.defines,overrideFog:bi});if(l.uploadCommonUniforms(T,ur,ne),M instanceof o.aP){const Rt=M.elevatedGlobeVertexBuffer,Vt=M.elevatedGlobeIndexBuffer;if(R||!m)M.boundsBuffer&&M.boundsSegments&&ur.draw(l,S.TRIANGLES,le,Mt.disabled,L,bt.disabled,gi,n.id,M.boundsBuffer,l.quadTriangleIndexBuffer,M.boundsSegments);else if(Rt&&Vt){const Wt=rt.zoom<=o.cL?M.elevatedGlobeSegments:M.getSegmentsForLongitude(rt.center.lng);Wt&&ur.draw(l,S.TRIANGLES,le,Mt.disabled,L,J,gi,n.id,Rt,Vt,Wt)}}else if(x){le=new et(S.LEQUAL,et.ReadOnly,l.depthRangeFor3D);const Rt=l.globeSharedBuffers;if(Rt){const[Vt,Wt,Oi]=Rt.getGridBuffers(Ri,!1);ur.draw(l,S.TRIANGLES,le,K||ye,l.colorModeForRenderPass(),J,gi,n.id,Vt,Wt,Oi)}}else{const{tileBoundsBuffer:Rt,tileBoundsIndexBuffer:Vt,tileBoundsSegments:Wt}=l.getTileBoundsBuffers(fe);ur.draw(l,S.TRIANGLES,le,ye,L,bt.disabled,gi,n.id,Rt,Vt,Wt)}}if(!(M instanceof o.aP)&&x)for(const ie of ee){const ne=ie.canonical.y===(1<<ie.canonical.z)-1;ie.canonical.y===0&&Pl(!0,ie,l,t,n,C,I,J,K||Mt.disabled),ne&&Pl(!1,ie,l,t,n,C,I,J===bt.frontCW?bt.backCW:bt.frontCW,K||Mt.disabled)}};x?te(Z,l.renderElevatedRasterBackface?bt.backCW:bt.frontCW,l.stencilModeFor3D()):te(Z,bt.disabled,void 0),l.resetStencilClippingMasks()},"raster-particle":function(l,t,n,c,d,p){l.renderPass==="offscreen"&&function(m,y,x,T){if(!T.length)return;const S=m.context,M=S.gl,I=y.getSource();if(!(I instanceof qs))return;const C=Math.ceil(Math.sqrt(x.paint.get("raster-particle-count")));let L=x.particlePositionRGBAImage;if(!L||L.width!==C){const Z=function(Y){const te=Y*Y,ee=new Uint8Array(4*te),J=function(ie){return ie|=0,ie=Math.imul(2747636419^ie,2654435769),ie=Math.imul(ie^ie>>>16,2654435769),((ie=Math.imul(ie^ie>>>16,2654435769))>>>0)/4294967296},K=1/1.1;for(let ie=0;ie<te;ie++){const ne=K*(J(2*ie+0)+Ks),fe=K*(J(2*ie+1)+Ks),me=255*ne%1,Ae=255*fe%1,Me=me,Fe=fe-Ae/255,de=Ae;ee[4*ie+0]=255*(ne-me/255),ee[4*ie+1]=255*Me,ee[4*ie+2]=255*Fe,ee[4*ie+3]=255*de}return ee}(C);L=x.particlePositionRGBAImage=new o.r({width:C,height:C},Z)}let R=x.particleFramebuffer;R?R.width!==C&&(R.destroy(),R=x.particleFramebuffer=S.createFramebuffer(C,C,!0,null)):R=x.particleFramebuffer=S.createFramebuffer(C,C,!0,null);const F=[];for(const Z of T){const Y=y.getTile(Z);if(!(Y instanceof sa))continue;const te=Zf(Y,I,x);if(!te)continue;const ee=[Y.tileSize,Y.tileSize];let J=x.tileFramebuffer;J||(J=x.tileFramebuffer=S.createFramebuffer(ee[0],ee[1],!0,null));let K=Y.rasterParticleState;K||(K=Y.rasterParticleState=new Hd(S,Z,ee,L));const ie=K.update(x.lastInvalidatedAt);K.particleTextureDimension!==C&&K.updateParticleTexture(Z,L);const ne=K.targetColorTexture;K.targetColorTexture=K.backgroundColorTexture,K.backgroundColorTexture=ne;const fe=K.particleTexture0;K.particleTexture0=K.particleTexture1,K.particleTexture1=fe,F.push([Z,te,K,ie])}if(F.length===0)return;const B=o.q.now(),V=x.previousDrawTimestamp?.001*(B-x.previousDrawTimestamp):.0167;if(x.previousDrawTimestamp=B,x.hasColorMap()){S.activeTexture.set(M.TEXTURE0+2);let Z=x.colorRampTexture;Z||(Z=x.colorRampTexture=new o.T(S,x.colorRamp,M.RGBA8)),Z.bind(M.LINEAR,M.CLAMP_TO_EDGE)}S.bindFramebuffer.set(x.tileFramebuffer.framebuffer),function(Z,Y,te){const ee=Z.context,J=ee.gl,K=Y.tileFramebuffer;ee.activeTexture.set(J.TEXTURE0);const ie={u_texture:0,u_opacity:1.05*(fe=Y.paint.get("raster-particle-fade-opacity-factor"))/(fe+.05)},ne=Z.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var fe;for(const me of te){const[,,Ae,Me]=me;K.colorAttachment.set(Ae.targetColorTexture.texture),ee.viewport.set([0,0,K.width,K.height]),ee.clear({color:o.am.transparent}),Me&&(Ae.backgroundColorTexture.bind(J.NEAREST,J.CLAMP_TO_EDGE),ne.draw(Z,J.TRIANGLES,et.disabled,Mt.disabled,qt.alphaBlended,bt.disabled,ie,Y.id,Z.viewportBuffer,Z.quadTriangleIndexBuffer,Z.viewportSegments))}}(m,x,F),function(Z,Y,te,ee){const J=Z.context,K=J.gl,ie=te.tileFramebuffer,ne=Z.transform.projection.name==="globe",fe=te.paint.get("raster-particle-max-speed");for(const me of ee){const[Ae,Me,Fe]=me;J.activeTexture.set(K.TEXTURE0+0),Me.texture.bind(K.LINEAR,K.CLAMP_TO_EDGE),ie.colorAttachment.set(Fe.targetColorTexture.texture);const de=Z.getOrCreateProgram("rasterParticleDraw",{defines:Me.defines,overrideFog:!1});J.activeTexture.set(K.TEXTURE0+1);const we=Me.scalarData?[]:[0,1,2,3].map(ye=>o.dT[ye](Ae));we.push(Ae);const le=Ae.canonical.x,Pe=Ae.canonical.y;for(const ye of we){const De=Y.getTile(ne?ye.wrapped():ye);if(!De)continue;const qe=De.rasterParticleState;if(!qe)continue;const Ce=ye.canonical.x+(1<<ye.canonical.z)*(ye.wrap-Ae.wrap),je=ye.canonical.y;qe.particleTexture0.bind(K.NEAREST,K.CLAMP_TO_EDGE);const it=Ud(1,qe.particleTexture0.size[0],[Ce-le,je-Pe],0,Me.texture.size,2,fe,Me.textureOffset,Me.scale,Me.offset);de.draw(Z,K.POINTS,et.disabled,Mt.disabled,qt.alphaBlended,bt.disabled,it,te.id,qe.particleIndexBuffer,void 0,qe.particleSegment)}}}(m,y,x,F),S.bindFramebuffer.set(x.particleFramebuffer.framebuffer),function(Z,Y,te,ee){const J=Z.context,K=J.gl,ie=Y.paint.get("raster-particle-max-speed"),ne=ee*Y.paint.get("raster-particle-speed-factor")*.15,fe=function(Ae){return Math.pow(Ae,6)}(.01+1*Y.paint.get("raster-particle-reset-rate-factor")),me=Y.particleFramebuffer;J.viewport.set([0,0,me.width,me.height]);for(const Ae of te){const[,Me,Fe]=Ae;J.activeTexture.set(K.TEXTURE0+0),Me.texture.bind(K.LINEAR,K.CLAMP_TO_EDGE),J.activeTexture.set(K.TEXTURE0+1);const de=Fe.particleTexture0;de.bind(K.NEAREST,K.CLAMP_TO_EDGE);const we=Js(1,de.size[0],0,Me.texture.size,ie,ne,fe,Me.textureOffset,Me.scale,Me.offset);me.colorAttachment.set(Fe.particleTexture1.texture),J.clear({color:o.am.transparent}),Z.getOrCreateProgram("rasterParticleUpdate",{defines:Me.defines}).draw(Z,K.TRIANGLES,et.disabled,Mt.disabled,qt.unblended,bt.disabled,we,Y.id,Z.viewportBuffer,Z.quadTriangleIndexBuffer,Z.viewportSegments)}}(m,x,F,V)}(l,t,n,c),l.renderPass==="translucent"&&(function(m,y,x,T,S){const M=m.context,I=M.gl,C=y.getSource().tileSize,L=5*(1-o.af(o.cx,o.cx+1,m.transform.zoom))*C+x.paint.get("raster-particle-elevation"),R=!m.options.moving,F=m.transform.projection.name==="globe";if(!T.length)return;const[B,V]=m.stencilConfigForOverlap(T),Z=[];F&&Z.push("PROJECTION_GLOBE_VIEW");const Y=m.stencilModeFor3D();for(const te of V){const ee=te.toUnwrapped(),J=y.getTile(te);if(!J.rasterParticleState)continue;const K=J.rasterParticleState,ie=100;J.registerFadeDuration(ie);const ne=y.findLoadedParent(te,0),fe=Lo(J,ne,y,m.transform,ie);let me,Ae;m.terrain&&m.terrain.prepareDrawTile(),M.activeTexture.set(I.TEXTURE0),K.targetColorTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),M.activeTexture.set(I.TEXTURE1),ne&&ne.rasterParticleState?(ne.rasterParticleState.targetColorTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),me=Math.pow(2,ne.tileID.overscaledZ-J.tileID.overscaledZ
2654),Ae=[J.tileID.canonical.x*me%1,J.tileID.canonical.y*me%1]):K.targetColorTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE);const Me=F?Float32Array.from(m.transform.expandedFarZProjMatrix):m.transform.calculateProjMatrix(ee,R),Fe=m.transform,de=Wd(Fe),we=o.dn(te.canonical),le=o.dp(we.getCenter().lat);let Pe,ye,De,qe,Ce;F?(Pe=Float32Array.from(o.bh(o.dr(te.canonical))),ye=Float32Array.from(Fe.globeMatrix),De=Float32Array.from(o.dm(Fe)),qe=[o.aD(Fe.center.lng),o.aH(Fe.center.lat)],Ce=Float32Array.from(o.dq(te.canonical,we,le,Fe.worldSize/Fe._pixelsPerMercatorPixel))):(Pe=new Float32Array(16),ye=new Float32Array(9),De=new Float32Array(16),qe=[0,0],Ce=new Float32Array(9));const je=Oo(Me,Pe,ye,De,Ce,Ae||[0,0],o.ah(m.transform.zoom),qe,de,me||1,fe,L),it=m.isTileAffectedByFog(te),rt=m.getOrCreateProgram("rasterParticle",{defines:Z,overrideFog:it});if(m.uploadCommonUniforms(M,rt,ee),F){const Qe=new et(I.LEQUAL,et.ReadOnly,m.depthRangeFor3D),ut=0,pt=m.globeSharedBuffers;if(pt){const[yt,It,Ot]=pt.getGridBuffers(le,ut!==0);rt.draw(m,I.TRIANGLES,Qe,Y,qt.alphaBlended,m.renderElevatedRasterBackface?bt.frontCCW:bt.backCCW,je,x.id,yt,It,Ot)}}else{const Qe=m.depthModeForSublayer(0,et.ReadOnly),ut=B[te.overscaledZ],{tileBoundsBuffer:pt,tileBoundsIndexBuffer:yt,tileBoundsSegments:It}=m.getTileBoundsBuffers(J);rt.draw(m,I.TRIANGLES,Qe,ut,qt.alphaBlended,bt.disabled,je,x.id,pt,yt,It)}}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"),y=n.paint.get("background-emissive-strength"),x=n.paint.get("background-pitch-alignment")==="viewport";if(m===0)return;const T=l.context,S=T.gl,M=l.transform,I=M.tileSize,C=n.paint.get("background-pattern");let L;if(C!==void 0&&(C===null||(L=l.imageManager.getPattern(o.I.from(C.toString()),n.scope,l.style.getLut(n.scope)),!L)))return;const R=!C&&d.a===1&&m===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==R)return;const F=Mt.disabled,B=l.depthModeForSublayer(0,R==="opaque"?et.ReadWrite:et.ReadOnly),V=l.colorModeForDrapableLayerRenderPass(y),Z=C?"backgroundPattern":"background";let Y,te=c;if(te||(Y=l.getBackgroundTiles(),te=Object.values(Y).map(ee=>ee.tileID)),C&&(T.activeTexture.set(S.TEXTURE0),l.imageManager.bind(l.context,n.scope)),x){const ee=l.getOrCreateProgram(Z,{overrideFog:!1,overrideRtt:!0}),J=new Float32Array(o.bx([])),K=new o.aM(0,0,0,0,0),ie=C?sh(J,y,m,l,0,n.scope,L,x,{tileID:K,tileSize:I}):nh(J,y,m,d.toPremultipliedRenderColor(p?null:n.lut));ee.draw(l,S.TRIANGLES,B,F,V,bt.disabled,ie,n.id,l.viewportBuffer,l.quadTriangleIndexBuffer,l.viewportSegments)}else for(const ee of te){const J=l.isTileAffectedByFog(ee),K=l.getOrCreateProgram(Z,{overrideFog:J}),ie=ee.toUnwrapped(),ne=c?ee.projMatrix:l.transform.calculateProjMatrix(ie);l.prepareDrawTile();const fe=t?t.getTile(ee):Y?Y[ee.key]:new bo(ee,I,M.zoom,l),me=C?sh(ne,y,m,l,0,n.scope,L,x,{tileID:ee,tileSize:I}):nh(ne,y,m,d.toPremultipliedRenderColor(p?null:n.lut));l.uploadCommonUniforms(T,K,ie);const{tileBoundsBuffer:Ae,tileBoundsIndexBuffer:Me,tileBoundsSegments:Fe}=l.getTileBoundsBuffers(fe);K.draw(l,S.TRIANGLES,B,F,V,bt.disabled,me,n.id,Ae,Me,Fe)}},sky:function(l,t,n){const c=l._atmosphere?o.ah(l.transform.zoom):1,d=n.paint.get("sky-opacity")*c;if(d===0)return;const p=l.context,m=n.paint.get("sky-type"),y=new et(p.gl.LEQUAL,et.ReadOnly,[0,1]),x=l.frameCounter/1e3%1;m==="atmosphere"?l.renderPass==="offscreen"?n.needsSkyboxCapture(l)&&(function(T,S,M,I){const C=T.context,L=C.gl;let R=S.skyboxFbo;if(!R){R=S.skyboxFbo=C.createFramebuffer(32,32,!0,null),S.skyboxGeometry=new zl(C),S.skyboxTexture=C.gl.createTexture(),L.bindTexture(L.TEXTURE_CUBE_MAP,S.skyboxTexture),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_MIN_FILTER,L.LINEAR),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_MAG_FILTER,L.LINEAR);for(let Z=0;Z<6;++Z)L.texImage2D(L.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,L.RGBA,32,32,0,L.RGBA,L.UNSIGNED_BYTE,null)}C.bindFramebuffer.set(R.framebuffer),C.viewport.set([0,0,32,32]);const F=S.getCenter(T,!0),B=T.getOrCreateProgram("skyboxCapture"),V=new Float64Array(16);o.bx(V),o.e3(V,V,.5*-Math.PI),to(T,S,B,V,F,0),o.bx(V),o.e3(V,V,.5*Math.PI),to(T,S,B,V,F,1),o.bx(V),o.cG(V,V,.5*-Math.PI),to(T,S,B,V,F,2),o.bx(V),o.cG(V,V,.5*Math.PI),to(T,S,B,V,F,3),o.bx(V),to(T,S,B,V,F,4),o.bx(V),o.e3(V,V,Math.PI),to(T,S,B,V,F,5),C.viewport.set([0,0,T.width,T.height])}(l,n),n.markSkyboxValid(l)):l.renderPass==="sky"&&function(T,S,M,I,C){const L=T.context,R=L.gl,F=T.transform,B=T.getOrCreateProgram("skybox");L.activeTexture.set(R.TEXTURE0),R.bindTexture(R.TEXTURE_CUBE_MAP,S.skyboxTexture);const V=((Z,Y,te,ee,J)=>({u_matrix:Z,u_sun_direction:Y,u_cubemap:0,u_opacity:ee,u_temporal_offset:J}))(F.skyboxMatrix,S.getCenter(T,!1),0,I,C);T.uploadCommonUniforms(L,B),B.draw(T,R.TRIANGLES,M,Mt.disabled,T.colorModeForRenderPass(),bt.backCW,V,"skybox",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)}(l,n,y,d,x):m==="gradient"&&l.renderPass==="sky"&&function(T,S,M,I,C){const L=T.context,R=L.gl,F=T.transform,B=T.getOrCreateProgram("skyboxGradient");S.skyboxGeometry||(S.skyboxGeometry=new zl(L)),L.activeTexture.set(R.TEXTURE0);let V=S.colorRampTexture;V||(V=S.colorRampTexture=new o.T(L,S.colorRamp,R.RGBA8)),V.bind(R.LINEAR,R.CLAMP_TO_EDGE);const Z=((Y,te,ee,J,K)=>({u_matrix:Y,u_color_ramp:0,u_center_direction:te,u_radius:o.al(ee),u_opacity:J,u_temporal_offset:K}))(F.skyboxMatrix,S.getCenter(T,!1),S.paint.get("sky-gradient-radius"),I,C);T.uploadCommonUniforms(L,B),B.draw(T,R.TRIANGLES,M,Mt.disabled,T.colorModeForRenderPass(),bt.backCW,Z,"skyboxGradient",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)}(l,n,y,d,x)},custom:function(l,t,n,c){const d=l.context,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 y=l.transform.pointMerc;m.call(p,d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),o.ah(l.transform.zoom),[y.x,y.y],l.transform.pixelsPerMeterRatio)}else m.call(p,d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState()}}else if(l.renderPass==="translucent"){if(l.terrain&&l.terrain.renderingToTexture){const y=p.renderToTile;if(y){const x=c[0].canonical,T={x:x.x+c[0].wrap*(p.wrapTileId?0:1<<x.z),y:x.y,z:x.z};d.setDepthMode(et.disabled),d.setStencilMode(Mt.disabled),d.setColorMode(l.colorModeForRenderPass()),l.setCustomLayerDefaults(),y.call(p,d.gl,T),d.setDirty(),l.setBaseState()}return}l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),d.setStencilMode(Mt.disabled);const m=p.renderingMode==="3d"?new et(l.context.gl.LEQUAL,et.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,et.ReadOnly);if(d.setDepthMode(m),l.transform.projection.name==="globe"){const y=l.transform.pointMerc;p.render(d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),o.ah(l.transform.zoom),[y.x,y.y],l.transform.pixelsPerMeterRatio)}else p.render(d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState(),d.bindFramebuffer.set(null)}}else o.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(l,t,n,c){if(l.renderPass==="opaque")return;const d=n.paint.get("model-opacity").constantOr(1);if(d===0)return;const p=n.paint.get("model-cast-shadows");
2654if(l.renderPass==="shadow"&&(!p||l.terrain&&d<.65&&n._transitionablePaint._values["model-opacity"].value.expression instanceof o.ab))return;const m=l.shadowRenderer,y=n.paint.get("model-receive-shadows");m&&(m.useNormalOffset=!0,y||(m.enabled=!1));const x=()=>{m&&(m.useNormalOffset=!0,y||(m.enabled=!0))},T=t.getSource();if(l.renderPass==="light-beam"&&T.type!=="batched-model")return;if(T.type==="vector"||T.type==="geojson")return function(B,V,Z,Y,te){const ee=B.transform;if(ee.projection.name!=="mercator")return void o.w(`Drawing 3D models for ${ee.projection.name} projection is not yet implemented`);const J=ee.getFreeCameraOptions().position;if(!B.modelManager)return;const K=B.modelManager;Z.modelManager=K;const ie=B.shadowRenderer;if(!Z._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const ne=Z._unevaluatedLayout._values["model-id"],fe=Object.assign({},Z.layout.get("model-id").parameters),me=B.style.order.indexOf(Z.fqid);for(const Ae of Y){const Me=V.getTile(Ae).getBucket(Z);if(!Me||Me.projection.name!==ee.projection.name)continue;const Fe=Me.getModelUris();Fe&&!Me.modelsRequested&&(K.addModelsFromBucket(Fe,te),Me.modelsRequested=!0);const de=$c(Ae,ee);fe.zoom=de;const we=ne.possiblyEvaluate(fe);if(pe(B,Me,Ae),Kn.shadowUniformsInitialized=!1,Kn.useSingleShadowCascade=!!ie&&ie.getMaxCascadeForTile(Ae.toUnwrapped())===0,B.renderPass==="shadow"&&ie){if(B.currentShadowCascade===1&&Me.isInsideFirstShadowMapFrustum)continue;const ye=ee.calculatePosMatrix(Ae.toUnwrapped(),ee.worldSize);if(Kn.tileMatrix.set(ye),Kn.shadowTileMatrix=Float32Array.from(ie.calculateShadowPassMatrixFromMatrix(ye)),Kn.aabb.min.fill(0),Kn.aabb.max[0]=Kn.aabb.max[1]=o.aj,Kn.aabb.max[2]=0,Qd(Me,Kn,B,Z.scope))continue}const le=1<<Ae.canonical.z,Pe=[((J.x-Ae.wrap)*le-Ae.canonical.x)*o.aj,(J.y*le-Ae.canonical.y)*o.aj,J.z*le*o.aj];B.conflationActive&&Object.keys(Me.instancesPerModel).length>0&&B.style.isLayerClipped(Z,V.getSource())&&Me.updateReplacement(Ae,B.replacementSource,me,te)&&(Me.uploaded=!1,Me.upload(B.context));for(let ye in Me.instancesPerModel){const De=Me.instancesPerModel[ye];De.features.length>0&&(ye=we.evaluate(De.features[0].feature,{}));const qe=K.getModel(ye,te);if(qe||K.hasURLBeenRequested(ye)||Me.modelUris.includes(ye)||(Me.modelUris.push(ye),Me.modelsRequested=!1),qe&&qe.uploaded)for(const Ce of qe.nodes)Zc(B,Z,Ce,De,Pe,Ae,Kn)}}}(l,t,n,c,T.type==="vector"?n.scope:""),void x();if(!T.loaded())return;if(T.type==="batched-model")return function(B,V,Z,Y){Z.resetLayerRenderingStats(B);const te=B.context,ee=B.transform,J=B.style.fog,K=B.shadowRenderer;if(ee.projection.name!=="mercator")return void o.w(`Drawing 3D landmark models for ${ee.projection.name} projection is not yet implemented`);const ie=B.transform.getFreeCameraOptions().position,ne=o.bY([],[ie.x,ie.y,ie.z],B.transform.worldSize),fe=o.eb([],ne),me=o.bx([]),Ae=o.ec(ee.center.lat,ee.zoom),Me=o.bn([],[1,1,1/Ae]);o.bo(me,me,fe);const Fe=Z.paint.get("model-opacity").constantOr(1),de=new et(te.gl.LEQUAL,et.ReadWrite,B.depthRangeFor3D),we=new et(te.gl.LEQUAL,et.ReadOnly,B.depthRangeFor3D),le=new o.cW([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),Pe=B.renderPass==="shadow",ye=Pe&&K?K.getCurrentCascadeFrustum():ee.getFrustum(ee.scaleZoom(ee.worldSize)),De=Z.paint.get("model-front-cutoff"),qe=De[2]<1,Ce=os(B,Z.paint.get("model-cutoff-fade-range")),je=Z.getLayerRenderingStats();(function(it,rt,Qe,ut){const pt=it.terrain?it.terrain.exaggeration():0,yt=it.transform.zoom;for(const It of ut){const Ot=rt.getTile(It).getBucket(Qe);Ot&&(Ot.setFilter(Qe.filter),it.conflationActive&&Ot.updateReplacement(It,it.replacementSource),Ot.evaluateTransform(it,Qe),it.terrain&&pt>0&&Ot.elevationUpdate(it.terrain,pt,It,Qe.source),Ot.needsReEvaluation(it,yt,Qe)&&Ot.evaluate(Qe))}})(B,V,Z,Y),function(){let it,rt,Qe;qe?(it=Y.length-1,rt=-1,Qe=-1):(it=0,rt=Y.length,Qe=1);const ut=new Float64Array(16),pt=o.ef(),yt=new o.P(0,0);for(let It=it;It!==rt;It+=Qe){const Ot=Y[It],pi=V.getTile(Ot).getBucket(Z);if(!pi||!pi.uploaded)continue;let Ri=!1;K&&(Ri=K.getMaxCascadeForTile(Ot.toUnwrapped())===0);const gi=ee.calculatePosMatrix(Ot.toUnwrapped(),ee.worldSize),bi=pi.modelTraits;!Pe&&qe&&(o.bi(ut,gi),o.ad(pt,ne,ut),yt.x=pt[0],yt.y=pt[1]);const ur=[];pi.setFilter(Z.filter);
2654for(const Rt of pi.getNodesInfo()){if(Rt.hiddenByReplacement||!Rt.node.meshes)continue;const Vt=Rt.node;let Wt=0;B.terrain&&Vt.elevation&&(Wt=Vt.elevation*B.terrain.exaggeration());const Oi=(()=>{const ar=Rt.aabb;return le.min=[...ar.min],le.max=[...ar.max],le.min[2]+=Wt,le.max[2]+=Wt,o.ad(le.min,le.min,gi),o.ad(le.max,le.max,gi),le})(),br=Rt.evaluatedScale;if(br[0]<=1&&br[1]<=1&&br[2]<=1&&Oi.intersects(ye)===0)continue;if(!Pe&&qe){const ar=.16666666666666666;Rt.cameraCollisionOpacity=ne[0]>Oi.min[0]&&ne[0]<Oi.max[0]&&ne[1]>Oi.min[1]&&ne[1]<Oi.max[1]&&ne[2]*Ae<Oi.max[2]&&Vt.footprint&&o.bS(yt,Vt.footprint)?Math.max(Rt.cameraCollisionOpacity-ar,0):Math.min(1,Rt.cameraCollisionOpacity+ar)}const Di=[...gi],li=1/o.cU(Ot.canonical),nr=Vt.anchor?Vt.anchor[0]:0,Qt=Vt.anchor?Vt.anchor[1]:0;o.bo(Di,Di,[nr*(br[0]-1)+Rt.evaluatedTranslation[0]*li,Qt*(br[1]-1)+Rt.evaluatedTranslation[1]*li,Wt+Rt.evaluatedTranslation[2]]),o.ci(br,o.eg)||o.cE(Di,Di,br);const mr=o.az([],Di,Vt.matrix),Bi=o.az([],ee.expandedFarZProjMatrix,mr),Mi=o.az([],ee.expandedFarZProjMatrix,Di),Ni=o.aA([],[nr,Qt,Wt,1],Bi)[2];Vt.hidden=!1;let ui=Fe;Pe||(qe&&(ui*=Rt.cameraCollisionOpacity,ui*=Ca(Di,ee,Rt.aabb,De)),ui*=ep(Ce,Ni)),ui!==0?ur.push({nodeInfo:Rt,depth:Ni,opacity:ui,wvpForNode:Bi,wvpForTile:Mi,nodeModelMatrix:mr,tileModelMatrix:Di}):Vt.hidden=!0}Pe||ur.sort((Rt,Vt)=>!qe||Rt.opacity===1&&Vt.opacity===1?Rt.depth<Vt.depth?-1:1:Rt.opacity===1?-1:Vt.opacity===1?1:Rt.depth>Vt.depth?-1:1);for(const Rt of ur){const Vt=Rt.nodeInfo,Wt=Vt.node;let Oi=o.az([],Me,Rt.tileModelMatrix);o.az(Oi,me,Oi);const br=o.bi([],Oi);o.ee(br,br),o.cE(br,br,hh),Oi=o.az(Oi,Oi,Wt.matrix);const Di=B.renderPass==="light-beam",li=Z.paint.get("model-color-use-theme").constantOr("default")==="none",nr=bi&o.em.HasMapboxMeshFeatures,Qt=nr?0:Vt.evaluatedRMEA[0][2];for(let mr=0;mr<Wt.meshes.length;++mr){const Bi=Wt.meshes[mr],Mi=mr===Wt.lightMeshIndex;let Ni=Rt.wvpForNode;if(Mi){if(!Di&&!B.terrain&&B.shadowRenderer){B.currentLayer<B.firstLightBeamLayer&&(B.firstLightBeamLayer=B.currentLayer);continue}Ni=Rt.wvpForTile}else if(Di)continue;const ui={defines:[]},ar=[];if(!Pe&&K&&(K.useNormalOffset=!!Bi.normalBuffer),Ne(ui.defines,ar,Bi,B,li?null:Z.lut),nr||ui.defines.push("DIFFUSE_SHADED"),Ri&&ui.defines.push("SHADOWS_SINGLE_CASCADE"),je&&(Pe?je.numRenderedVerticesInShadowPass+=Bi.vertexArray.length:je.numRenderedVerticesInTransparentPass+=Bi.vertexArray.length),Pe){rr(Bi,Rt.nodeModelMatrix,B,Z);continue}let Nr=null;if(J){const Qn=No(Rt.nodeModelMatrix,B.transform);if(Nr=new Float32Array(Qn),ee.projection.name!=="globe"){const jn=Bi.aabb.min,fn=Bi.aabb.max,[ao,es]=J.getOpacityForBounds(Qn,jn[0],jn[1],fn[0],fn[1]);ui.overrideFog=ao>=ve||es>=ve}}const Hi=Bi.material;let si;Hi.occlusionTexture&&Hi.occlusionTexture.offsetScale&&(si=Hi.occlusionTexture.offsetScale,ui.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const wn=B.getOrCreateProgram("model",ui);!Pe&&K&&K.setupShadowsFromMatrix(Rt.tileModelMatrix,wn,K.useNormalOffset),B.uploadCommonUniforms(te,wn,null,Nr);const pn=Hi.pbrMetallicRoughness;pn.metallicFactor=.9,pn.roughnessFactor=.5;const zn=Al(new Float32Array(Ni),new Float32Array(Oi),new Float32Array(br),new Float32Array(Wt.matrix),B,Rt.opacity,pn.baseColorFactor,Hi.emissiveFactor,pn.metallicFactor,pn.roughnessFactor,Hi,Qt,Z,[0,0,0],si);!Mi&&(Vt.hasTranslucentParts||Rt.opacity<1)&&wn.draw(B,te.gl.TRIANGLES,de,Mt.disabled,qt.disabled,bt.backCCW,zn,Z.id,Bi.vertexBuffer,Bi.indexBuffer,Bi.segments,Z.paint,B.transform.zoom,void 0,ar),wn.draw(B,te.gl.TRIANGLES,Mi?we:de,Mt.disabled,Mi||Rt.opacity<1||Vt.hasTranslucentParts?qt.alphaBlended:qt.unblended,bt.backCCW,zn,Z.id,Bi.vertexBuffer,Bi.indexBuffer,Bi.segments,Z.paint,B.transform.zoom,void 0,ar)}}}}()}(l,t,n,c),void x();if(T.type!=="model")return;const S=T.getModels(),M=[],I=l.transform.getFreeCameraOptions().position,C=o.bY([],[I.x,I.y,I.z],l.transform.worldSize);o.eb(C,C);const L=[],R=[];let F=0;for(const B of S){const V=n.paint.get("model-rotation").constantOr(null),Z=n.paint.get("model-scale").constantOr(null),Y=n.paint.get("model-translation").constantOr(null);B.computeModelMatrix(l,V,Z,Y,!0,!0,!1);const te=o.bx([]),ee=o.ec(B.position.lat,l.transform.zoom),J=o.bn([],[1,1,1/ee]);o.bo(te,te,C),M.push({zScaleMatrix:J,negCameraPosMatrix:te});for(const K of B.nodes)Vo(l.transform,K,B.matrix,l.transform.expandedFarZProjMatrix,F,L,R);F++}if(L.sort((B,V)=>V.depth-B.depth),l.renderPass!=="shadow"){if(d===1)for(const B of R)Je(B,l,n,M[B.modelIndex],Mt.disabled,l.colorModeForRenderPass());else{for(const B of R)Je(B,l,n,M[B.modelIndex],Mt.disabled,qt.disabled);for(const B of R)Je(B,l,n,M[B.modelIndex],l.stencilModeFor3D(),l.colorModeForRenderPass());l.resetStencilClippingMasks()}for(const B of L)Je(B,l,n,M[B.modelIndex],Mt.disabled,l.colorModeForRenderPass());x()}else{for(const B of R)rr(B.mesh,B.nodeModelMatrix,l,n);for(const B of L)rr(B.mesh,B.nodeModelMatrix,l,n);x()}}},mh={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,c.type==="vector"?l.scope:""));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 qs&&c.loaded()))return;const d=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const p=l.paint.get("raster-array-band")||c.getInitialBand(d);if(p==null)return;const m=t.getIds().map(y=>t.getTileByID(y));for(const y of m)y.updateNeeded(d,p)&&c.prepareTile(y,d,p)},"raster-particle":function(l,t,n){const c=t.getSource();if(!(c instanceof qs&&c.loaded()))return;const d=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const p=l.paint.get("raster-particle-array-band")||c.getInitialBand(d);if(p==null)return;const m=t.getIds().map(y=>t.getTileByID(y));for(const y of m)y.updateNeeded(d,p)&&c.prepareTile(y,d,p)}}
2654,Cs={fill:ah},Ll={fill:function(l,t,n,c){if(!n.layout||n.layout.get("fill-elevation-reference")==="none")return;const d=l.context.gl,p=new et(d.LEQUAL,et.ReadOnly,l.depthRangeFor3D),m=new Mt({func:d.ALWAYS,mask:255},255,255,d.KEEP,d.KEEP,d.REPLACE),y=l.transform.getFreeCameraOptions().position,x=l.getOrCreateProgram("elevatedStructuresDepthReconstruct",{defines:["DEPTH_RECONSTRUCTION"]});for(const T of c){const S=t.getTile(T),M=S.getBucket(n);if(!M)continue;const I=M.elevatedStructures;if(!I||I.maskSegments.segments[0].primitiveLength===0)continue;const C=jc(T.toUnwrapped(),y),L=l.translatePosMatrix(T.projMatrix,S,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor")),R=Bc(L,C,0,0,0);x.draw(l,d.TRIANGLES,p,m,qt.disabled,bt.disabled,R,n.id,I.vertexBuffer,I.indexBuffer,I.maskSegments,n.paint,l.transform.zoom)}}};class Pa{constructor(t,n,c,d,p,m){this.context=new Gf(t,n),this.transform=c,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=p,this._timeStamp=o.q.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const y=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const T of y)this._debugParams.enabledLayers[T]=!0;p.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),p.registerParameter(this._debugParams,["Precipitation"],"forceEnablePrecipitation"),p.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),p.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),p.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),p.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const T of y)p.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],T);this.occlusionParams=new tp(p),this.setup(),this.numSublayers=hn.maxUnderzooming+hn.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new o.et,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new wf(this),this._wireframeDebugCache=new Kf,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const x=new o.r({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new o.T(this.context,x,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=d,this.worldview=m}updateTerrain(t,n){const c=!!t&&!!t.terrain&&this.transform.projection.supportsTerrain;if(!(c||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new wl(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 wl(this,this.style)),this._forceTerrainMode=t}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,n){if(this.width=t*o.q.devicePixelRatio,this.height=n*o.q.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style.order)this.style._mergedLayers[c].resize()}setup(){const t=this.context,n=new o.ba;n.emplaceBack(0,0),n.emplaceBack(o.aj,0),n.emplaceBack(0,o.aj),n.emplaceBack(o.aj,o.aj),this.tileExtentBuffer=t.createVertexBuffer(n,o.bc.members),this.tileExtentSegments=o.bd.simpleSegment(0,0,4,2);const c=new o.ba;c.emplaceBack(0,0),c.emplaceBack(o.aj,0),c.emplaceBack(0,o.aj),c.emplaceBack(o.aj,o.aj),this.debugBuffer=t.createVertexBuffer(c,o.bc.members),this.debugSegments=o.bd.simpleSegment(0,0,4,5);const d=new o.ba;d.emplaceBack(-1,-1),d.emplaceBack(1,-1),d.emplaceBack(-1,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,o.bc.members),this.viewportSegments=o.bd.simpleSegment(0,0,4,2);const p=new o.aZ;p.emplaceBack(0,0,0,0),p.emplaceBack(o.aj,0,o.aj,0),p.emplaceBack(0,o.aj,0,o.aj),p.emplaceBack(o.aj,o.aj,o.aj,o.aj),this.mercatorBoundsBuffer=t.createVertexBuffer(p,o.bf.members),this.mercatorBoundsSegments=o.bd.simpleSegment(0,0,4,2);const m=new o.a_;m.emplaceBack(0,1,2),m.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(m);const y=new o.bb;for(const T of[0,1,3,2,0])y.emplaceBack(T);this.debugIndexBuffer=t.createIndexBuffer(y),this.emptyTexture=new o.T(t,new o.r({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=o.bz();const x=this.context.gl;this.stencilClearMode=new Mt({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,et.disabled,this.stencilClearMode,qt.disabled,bt.disabled,Do(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,n,c){if(!n||this.currentStencilSource===n.id||!t.isTileClipped()||!c||c.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let y=!1;for(const x of c)if(this._tileClippingMaskIDs[x.key]===void 0){y=!0;break}if(!y)return}this.currentStencilSource=n.id;const d=this.context,p=d.gl;this.nextStencilID+c.length>256&&this.clearStencil(),d.setColorMode(qt.disabled),d.setDepthMode(et.disabled);const m=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const y of c){const x=n.getTile(y),T=this._tileClippingMaskIDs[y.key]=this.nextStencilID++,{tileBoundsBuffer:S,tileBoundsIndexBuffer:M,tileBoundsSegments:I}=this.getTileBoundsBuffers(x);m.draw(this,p.TRIANGLES,et.disabled,new Mt({func:p.ALWAYS,mask:0},T,255,p.KEEP,p.KEEP,p.REPLACE),qt.disabled,bt.disabled,Do(y.projMatrix),"$clipping",S,M,I)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Mt({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 Mt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,c=t.sort((m,y)=>
2654y.overscaledZ-m.overscaledZ),d=c[c.length-1].overscaledZ,p=c[0].overscaledZ-d+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let y=0;y<p;y++)m[y+d]=new Mt({func:n.GEQUAL,mask:255},y+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[m,c]}return[{[d]:Mt.disabled},c]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new qt([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new o.am(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?qt.unblended:qt.alphaBlended}colorModeForDrapableLayerRenderPass(t){const n=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?new qt([n.ONE,n.ONE_MINUS_SRC_ALPHA,n.CONSTANT_ALPHA,n.ONE_MINUS_SRC_ALPHA],new o.am(0,0,0,t===void 0?0:t),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(t,n,c,d=!1){if(this.depthOcclusion)return new et(this.context.gl.GREATER,et.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!d)return et.disabled;const p=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new et(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 oh(this.context,n,c,!1,"texture"),this.depthTexture=new o.T(this.context,{width:n,height:c,data:null},t.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(d),t.bindTexture(t.TEXTURE_2D,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=o.q.now();this._dt=c-this._timeStamp,this._timeStamp=c,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=n;const d=this.style._mergedLayers,p=!(!this.terrain||!this.terrain.enabled),m=()=>this.style._getOrder(p).filter(de=>{const we=d[de];return!(we.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[we.type]});let y=m(),x=!1,T=!1;for(const de of y){const we=d[de];we.type==="circle"&&(x=!0),we.type==="symbol"&&(we.hasInitialOcclusionOpacityProperties?T=!0:x=!0)}let S=y.map(de=>d[de]);const M=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(o.q.now()),this.imageManager.beginFrame();let I=0,C=!1;for(const de in M){const we=M[de];we.used&&(we.prepare(this.context),we.getSource().usedInConflation&&++I)}let L=!1;for(const de of S)de.isHidden(this.transform.zoom)||(de.type==="clip"&&(L=!0),this.prepareLayer(de));const R={},F={},B={},V={},Z={};for(const de in M){const we=M[de];R[de]=we.getVisibleCoordinates(),F[de]=R[de].slice().reverse(),B[de]=we.getVisibleCoordinates(!0).reverse(),V[de]=we.getShadowCasterCoordinates(),Z[de]=we.sortCoordinatesByDistance(R[de])}const Y=de=>{const we=this.style.getLayerSourceCache(de);return we&&we.used?we.getSource():null};if(I||L||this._clippingActiveLastFrame){const de=[],we=[];let le=0;for(const Pe of S)this.isSourceForClippingOrConflation(Pe,Y(Pe))&&(de.push(Pe),we.push(le)),le++;if(de&&(L||de.length>1)||this._clippingActiveLastFrame){L=!1;const Pe=[];for(let ye=0;ye<de.length;ye++){const De=de[ye],qe=we[ye],Ce=this.style.getLayerSourceCache(De);
2654if(!Ce||!Ce.used||!Ce.getSource().usedInConflation&&De.type!=="clip")continue;let je=o.eu,it=o.bQ.None;const rt=[];let Qe=!0;if(De.type==="clip"){je=qe;for(const ut of De.layout.get("clip-layer-types"))it|=ut==="model"?o.bQ.Model:ut==="symbol"?o.bQ.Symbol:o.bQ.FillExtrusion;for(const ut of De.layout.get("clip-layer-scope"))rt.push(ut);De.isHidden(this.transform.zoom)?Qe=!1:L=!0}Qe&&Pe.push({layer:De.fqid,cache:Ce,order:je,clipMask:it,clipScope:rt})}this.replacementSource.setSources(Pe),C=!0}}this._clippingActiveLastFrame=L,C||this.replacementSource.clear(),this.conflationActive=C,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let de=0;de<S.length;de++){const we=S[de],le=we.cutoffRange();if(this.longestCutoffRange=Math.max(le,this.longestCutoffRange),le>0){const Pe=Y(we);Pe&&(this.minCutoffZoom=Math.max(Pe.minzoom,this.minCutoffZoom)),we.minzoom&&(this.minCutoffZoom=Math.max(we.minzoom,this.minCutoffZoom))}we.is3D(p)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=de),this._lastOcclusionLayer=de)}const te=this.style&&this.style.fog;te?(this._fogVisible=te.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=te.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(B),this.opaquePassCutoff=0,y=m(),S=y.map(de=>d[de]));const ee=this._shadowRenderer;if(ee){ee.updateShadowParameters(this.transform,this.style.directionalLight);for(const de in M)for(const we of R[de]){let le={min:0,max:0};this.terrain&&(le=this.terrain.getMinMaxForTile(we)||le),ee.addShadowReceiver(we.toUnwrapped(),le.min,le.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new o.ev(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Ma(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const J=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),K=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(J&&!this._snow&&(this._snow=new Zi(this)),!J&&this._snow&&(this._snow.destroy(),delete this._snow),K&&!this._rain&&(this._rain=new Jf(this)),!K&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),!ms.has(this.context.gl))return;this.renderPass="offscreen";for(const de of S){const we=t.getLayerSourceCache(de);if(!de.hasOffscreenPass()||de.isHidden(this.transform.zoom))continue;const le=we?F[we.id]:void 0;(de.type==="custom"||de.type==="raster"||de.type==="raster-particle"||de.isSky()||le&&le.length)&&this.renderLayer(this,we,de,le)}this.depthRangeFor3D=[0,1-(S.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,V)),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(),ne=(()=>{if(n.showOverdrawInspector)return o.am.black;const de=this.style.fog;if(de&&this.transform.projection.supportsFog){const we=this.style.getLut(de.scope);if(!ie){const le=de.properties.get("color-use-theme")==="none",Pe=de.properties.get("color").toNonPremultipliedRenderColor(le?null:we).toArray01();return new o.am(...Pe)}if(ie){const le=de.properties.get("space-color-use-theme")==="none",Pe=de.properties.get("space-color").toNonPremultipliedRenderColor(le?null:we).toArray01();return new o.am(...Pe)}}return o.am.transparent})();if(this.context.clear({color:ne,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=y.length-1;this.currentLayer>=0;this.currentLayer--){const de=S[this.currentLayer],we=t.getLayerSourceCache(de);if(de.isSky())continue;const le=we?(de.is3D(p)?Z:F)[we.id]:void 0;this._renderTileClippingMasks(de,we,le),this.renderLayer(this,we,de,le)}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||o.ah(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isH
2654orizonVisible()))for(this.currentLayer=0;this.currentLayer<y.length;this.currentLayer++){const de=S[this.currentLayer],we=t.getLayerSourceCache(de);de.isSky()&&this.renderLayer(this,we,de,we?F[we.id]:void 0)}function fe(de,we){let le;return we&&(le=(de.type==="symbol"?B:de.is3D(p)?Z:F)[we.id]),le}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<y.length;){const de=S[this.currentLayer];if(de.type==="raster"||de.type==="raster-particle"){const we=t.getLayerSourceCache(de);this.renderLayer(this,we,de,fe(de,we))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let me=0;ee&&(me=ee.getShadowCastingLayerCount());let Ae=!1,Me=-1;for(let de=0;de<y.length;++de){const we=S[de];we.isHidden(this.transform.zoom)||we.is3D(p)&&(Me=de)}T&&Me===-1&&(x=!0);let Fe=!1;for(;this.currentLayer<y.length;){const de=S[this.currentLayer],we=t.getLayerSourceCache(de);if(de.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(de)){if(de.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!Fe&&de.is3D(p)&&!p){const le=this.currentLayer,Pe=ye=>{for(this.currentLayer=0;this.currentLayer<S.length;this.currentLayer++){const De=S[this.currentLayer];if(Cs[De.type]){const qe=this.style.getLayerSourceCache(De);Cs[De.type](this,qe,De,fe(De,qe),ye)}}};Pe("initialize"),Pe("reset"),this.currentLayer=le,Fe=!0}if(x&&!Ae&&this.terrain&&!this.transform.isOrthographic&&(Ae=!0,this.blitDepth()),T&&Me!==-1&&this.currentLayer===Me+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(de,we,we?R[we.id]:void 0),this.renderLayer(this,we,de,fe(de,we)),!this.terrain&&ee&&me>0&&de.hasShadowPass()&&--me==0){{this.clearStencil();const le=this.currentLayer;for(this.currentLayer=0;this.currentLayer<S.length;this.currentLayer++){const Pe=S[this.currentLayer];if(Ll[Pe.type]){const ye=this.style.getLayerSourceCache(Pe);Ll[Pe.type](this,ye,Pe,fe(Pe,ye))}}this.currentLayer=le}if(ee.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const le=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=le;this.currentLayer++){const Pe=S[this.currentLayer];if(!Pe.hasLightBeamPass())continue;const ye=t.getLayerSourceCache(Pe);this.renderLayer(this,ye,Pe,ye?F[ye.id]:void 0)}this.currentLayer=le,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const le=this.currentLayer;this.depthOcclusion=!0;for(const Pe of this.layersWithOcclusionOpacity){this.currentLayer=Pe;const ye=S[this.currentLayer],De=t.getLayerSourceCache(ye),qe=De?F[De.id]:void 0;this.terrain||this._renderTileClippingMasks(ye,De,De?R[De.id]:void 0),this.renderLayer(this,De,ye,qe)}this.depthOcclusion=!1,this.currentLayer=le,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 de=null;S.forEach(we=>{const le=t.getLayerSourceCache(we);le&&!we.isHidden(this.transform.zoom)&&le.getVisibleCoordinates().length&&(!de||de.getSource().maxzoom<le.getSource().maxzoom)&&(de=le)}),de&&this.options.showTileBoundaries&&As(this,de,de.getVisibleCoordinates(),o.am.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&As(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new o.am(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(de){const we=de.transform.padding;Gc(de,de.transform.height-(we.top||0),3,Hf),Gc(de,we.bottom||0,3,Wf),qc(de,we.left||0,3,bn),qc(de,de.transform.width-(we.right||0),3,uh);const le=de.transform.centerPoint;(function(Pe,ye,De,qe){Aa(Pe,ye-1,De-10,2,20,qe),Aa(Pe,ye-10,De-1,20,2,qe)})(de,le.x,de.transform.height-le.y,on)}(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
2654anvasCopy()),C||(this.conflationActive=!1)}prepareLayer(t){this.gpuTimingStart(t);const{unsupportedLayers:n}=this.transform.projection,c=!n||!n.includes(t.type);if(mh[t.type]&&(c||this.terrain&&t.type==="custom")){const d=this.style.getLayerSourceCache(t);mh[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"||ii[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;
2654p.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 T=Math.sin(m),S=Math.cos(m);c=[c[0]*S-c[1]*T,c[0]*T+c[1]*S]}const y=[p?c[0]:o.aw(n,c[0],this.transform.zoom),p?c[1]:o.aw(n,c[1],this.transform.zoom),0],x=new Float32Array(16);return o.bo(x,t,y),x}saveTileTexture(t){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=Oc.cacheKey(Sc[t],t,p,d);return this.cache[m]||(this.cache[m]=new Oc(this.context,t,Sc[t],d,Gd[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 o.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,n){if(this.style.enable3dLights()){const c=this.style.directionalLight,d=this.style.ambientLight;if(c&&d){const p=((m,y,x)=>{const T=m.properties.get("direction"),S=m.properties.get("color-use-theme")==="none",M=m.properties.get("color").toNonPremultipliedRenderColor(S?null:x.getLut(m.scope)).toArray01(),I=m.properties.get("intensity"),C=y.properties.get("color-use-theme")==="none",L=y.properties.get("color").toNonPremultipliedRenderColor(C?null:x.getLut(y.scope)).toArray01(),R=y.properties.get("intensity"),F=[T.x,T.y,T.z],B=o.dw(L,R),V=o.dw(M,I);return{u_lighting_ambient_color:B,u_lighting_directional_dir:F,u_lighting_directional_color:V,u_ground_radiance:kc(F,V,B)}})(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 y=m.getOpacity(this.transform.pitch),x=((T,S,M,I,C,L,R,F,B,V,Z,Y)=>{const te=T.transform,ee=S.properties.get("color-use-theme")==="none",J=S.properties.get("color").toNonPremultipliedRenderColor(ee?null:T.style.getLut(S.scope)).toArray01();J[3]=I;const K=T.frameCounter/1e3%1,[ie,ne]=S.properties.get("vertical-range");return{u_fog_matrix:M?te.calculateFogTileMatrix(M):Y||T.identityMat,u_fog_range:S.getFovAdjustedRange(te._fov),u_fog_color:J,u_fog_horizon_blend:S.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(ie,ne),ne],u_fog_temporal_offset:K,u_frustum_tl:C,u_frustum_tr:L,u_frustum_br:R,u_frustum_bl:F,u_globe_pos:B,u_globe_radius:V,u_viewport:Z,u_globe_transition:o.ah(te.zoom),u_is_globe:+(te.projection.name==="globe")}})(this,m,c,y,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*o.q.devicePixelRatio,this.transform.height*o.q.devicePixelRatio],d);n.setFogUniformValues(t,x)}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}
vendor: 37,246 bytes, line 2654
2654getBackgroundTiles(){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 bo(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.minzoom&&t.minzoom>this.transform.zoom||(this.style._clipLayerPresent||t.sourceLayer!=="building")&&(!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]>=ve||n[1]>=ve}setupDepthForOcclusion(t,n,c){const d=this.context,p=d.gl,m=!!c;var y;c||(c={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),d.activeTexture.set(p.TEXTURE3),t&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),c.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],c.u_depth_range_unpack=[2/((y=this.depthRangeFor3D)[1]-y[0]),-1-2*y[0]/(y[1]-y[0])],c.u_occluder_half_size=.5*this.occlusionParams.occluderSize,c.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),d.activeTexture.set(p.TEXTURE0),m||n.setTerrainUniformValues(d,c)}}function ro(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 _h{constructor(t){this._hashName=t&&encodeURIComponent(t),o.aV(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=ro(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=Xc(t);if(this._hashName){const c=this._hashName;let d=!1;const p=location.hash.slice(1).split("&").map(m=>{const y=m.split("=")[0];return y===c?(d=!0,`${y}=${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 Xc(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,y=Math.round(n.lat*p)/p,x=l.getBearing(),T=l.getPitch();let S=t?`/${m}/${y}/${c}`:`${c}/${y}/${m}`;return(x||T)&&(S+="/"+Math.round(10*x)/10),T&&(S+=`/${Math.round(T)}`),S}const za={linearity:.3,easing:o.ew(0,0,.3,1)},gh=o.h({deceleration:2500,maxSpeed:1400},za),ls=o.h({deceleration:20,maxSpeed:1400},za),no=o.h({deceleration:1e3,maxSpeed:360},za),Fl=o.h({deceleration:1e3,maxSpeed:90},za);class Yc{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:o.q.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=o.q.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const n={zoom:0,bearing:0,pitch:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings: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=Da(n.pan.mag(),c,o.h({},gh,t||{}));d.offset=n.pan.mult(p.amount/n.pan.mag()),d.center=this._map.transform.center,Ra(d,p)}if(n.zoom){const p=Da(n.zoom,c,ls);d.zoom=this._map.transform.zoom+p.amount,Ra(d,p)}if(n.bearing){const p=Da(n.bearing,c,no);d.bearing=this._map.transform.bearing+o.ay(p.amount,-179,179),Ra(d,p)}if(n.pitch){const p=Da(n.pitch,c,Fl);d.pitch=this._map.transform.pitch+p.amount,Ra(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 Ra(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function Da(l,t,n){const{maxSpeed:c,linearity:d,deceleration:p}=n,m=o.ay(l*d/(t/1e3),-c,c),y=Math.abs(m)/(p*d);return{easing:n.easing,duration:1e3*y,amount:m*(y/2)}}class Or extends o.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,c,d={}){const p=ks(n.getCanvasContainer(),c),m=n.unproject(p);super(t,o.h({point:p,lngLat:m,originalEvent:c},d)),this._defaultPrevented=!1,this.target=n}}class La extends o.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,c){const d=t==="touchend"?c.changedTouches:c.touches,p=ns(n.getCanvasContainer(),d),m=p.map(x=>n.unproject(x)),y=p.reduce((x,T,S,M)=>x.add(T.div(M.length)),new o.P(0,0));super(t,{points:p,point:y,lngLats:m,lngLat:n.unproject(y),originalEvent:c}),this._defaultPrevented=!1}}class so extends o.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n){super("wheel",{originalEvent:n}),this._defaultPrevented=!1}}class yh{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){this._mousedownPos=void 0}wheel(t){return this._firePreventable(new so(this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Or(t.type,this._map,t))}mouseup(t){this._map.fire(new Or(t.type,this._map,t))}preclick(t){const n=o.h({},t);n.type="preclick",this._map.fire(new Or(n.type,this._map,n))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||(this.preclick(t),this._map.fire(new Or(t.type,this._map,t)))}dblclick(t){return this._firePreventable(new Or(t.type,this._map,t))}mouseover(t){this._map.fire(new Or(t.type,this._map,t))}mouseout(t){this._map.fire(new Or(t.type,this._map,t))}touchstart(t){return this._firePreventable(new La(t.type,this._map,t))}touchmove(t){this._map.fire(new La(t.type,this._map,t))}touchend(t){this._map.fire(new La(t.type,this._map,t))}touchcancel(t){this._map.fire(new La(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Kc{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(t){this._map.fire(new Or(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Or("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Or(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class xh{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&&(Dn(),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=Dt("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const m=Math.min(d.x,c.x),y=Math.max(d.x,c.x),x=Math.min(d.y,c.y),T=Math.max(d.y,c.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${m}px,${x}px)`,this._box.style.width=y-m+"px",this._box.style.height=T-x+"px")})}mouseupWindow(t,n){if(!this._active)return;const c=this._startPos,d=n;if(c&&t.button===0){if(this.reset(),Xo(),c.x!==d.x||c.y!==d.y)return this._map.fire(new o.A("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),cn(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new o.A(t,{originalEvent:n}))}}function kl(l,t){const n={};for(let c=0;c<l.length;c++)n[l[c].identifier]=t[c];return n}class Br{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 o.P(0,0);for(const m of d)p._add(m);return p.div(d.length)}(n),this.touches=kl(c,n)))}touchmove(t,n,c){if(this.aborted||!this.centroid)return;const d=kl(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 Ol{constructor(t){this.singleTap=new Br(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 vh{constructor(){this._zoomIn=new Ol({numTouches:1,numTaps:2}),this._zoomOut=new Ol({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 bh={0:1,2:2},oo={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class Bl{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=sc(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=bh[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&&sc(t)===this._eventButton&&(this._moved&&Xo(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class wh extends Bl{mousedown(t,n){super.mousedown(t,n),this._lastPoint&&(this._active=!0)}_correctButton(t,n){return n===0&&!t.ctrlKey}_move(t,n){return{around:n,panDelta:n.sub(t)}}}class Jc extends Bl{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?oo[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 jo extends Bl{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?oo[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 Th{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=n.clickTolerance||1,this.reset(),o.aV(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}touchstart(t,n,c){return this._calculateTransform(t,n,c)}touchmove(t,n,c){if(this._active&&!(c.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(c.length===1&&!o.ex())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=kl(c,n),p=new o.P(0,0),m=new o.P(0,0);let y=0;for(const T in d){const S=d[T],M=this._touches[T];M&&(p._add(S),m._add(S.sub(M)),y++,d[T]=S)}if(this._touches=d,y<this._minTouches||!m.mag())return;const x=m.div(y);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(y),panDelta:x}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Dt("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 Nl{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,y=Fa(c,n,p),x=Fa(c,n,m);if(!y||!x)return;const T=this._aroundCenter?null:y.add(x).div(2);return this._move([y,x],T,t)}touchend(t,n,c){if(!this._firstTwoTouches)return;const[d,p]=this._firstTwoTouches,m=Fa(c,n,d),y=Fa(c,n,p);m&&y||(this._active&&Xo(),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 Fa(l,t,n){for(let c=0;c<l.length;c++)if(l[c].identifier===n)return t[c]}function Vl(l,t){return Math.log(l/t)/Math.LN2}class Sh extends Nl{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const c=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Vl(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Vl(this._distance,c),pinchAround:n}}}function Qc(l,t){return 180*l.angleWith(t)/Math.PI}class rp extends Nl{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:Qc(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=Qc(t,c);return Math.abs(d)<n}}function eu(l){return Math.abs(l.y)>Math.abs(l.x)}class np extends Nl{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,eu(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&&!o.ex()&&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 eu(t)&&eu(n)&&m}}const sp={panStep:100,bearingStep:15,pitchStep:10};class op{constructor(){const t=sp;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:y=>{const x=y.getZoom();y.easeTo({duration:300,easeId:"keyboardHandler",easing:ap,zoom:n?Math.round(x)+n*(t.shiftKey?2:1):x,bearing:y.getBearing()+c*this._bearingStep,pitch:y.getPitch()+d*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:y.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function ap(l){return l*(2-l)}const Eh=4.000244140625,lp=1/450;class cp{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=lp,o.aV(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||o.ex()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const c=o.q.now(),d=c-(this._lastWheelEventTime||0);this._lastWheelEventTime=c,n!==0&&n%Eh==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=ks(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:n,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;this._type==="wheel"&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const n=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>Eh?this._wheelZoomRate:this._defaultZoomRate;let S=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&S!==0&&(S=1/S);const M=n(),I=Math.pow(2,M),C=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):I;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,y=!1;if(this._type==="wheel"&&d&&p){const T=Math.min((o.q.now()-this._lastWheelEventTime)/200,1),S=p(T);m=o.ai(d,c,S),T<1?this._frameId||(this._frameId=!0):y=!0}else m=c,y=!0;this._active=!0,y&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let x=m-n();return x*this._lastDelta<0&&(x=0),{noInertia:!0,needsRenderFrame:!y,zoomDelta:x,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=o.ey;if(this._prevEase){const c=this._prevEase,d=(o.q.now()-c.start)/c.duration,p=c.easing(d+.01)-c.easing(d),m=.27/Math.sqrt(p*p+1e-4)*.01,y=Math.sqrt(.0729-m*m);n=o.ew(m,y,.25,1)}return this._prevEase={start:o.q.now(),duration:t,easing:n},n}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Dt("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 up{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 hp{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 dp{constructor(){this._tap=new Ol({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 pp{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 Qf{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 em{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 tu=l=>l.zoom||l.drag||l.pitch||l.rotate;class or extends o.A{}class fp{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,n){const c=o.at([],n,t);this.radius=o.ae(c[2]<0?o.eA([],c,this.constants):[c[0],c[1],0])}projectRay(t){o.eA(t,t,this.constants),o.au(t,t),o.eB(t,t,this.constants);const n=o.bY([],t,this.radius);if(n[2]>0){const c=o.bY([],[0,0,1],o.bG(n,[0,0,1])),d=o.bY([],o.au([],[n[0],n[1],0]),this.radius),p=o.cV([],n,o.bY([],o.at([],o.cV([],d,c),n),2));n[0]=p[0],n[1]=p[1]}return n}}function iu(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class Ih{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Yc(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new fp,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(n),o.aV(["handleEvent","handleWindowEvent"],this);const c=this._el;this._listeners=[[c,"touchstart",{passive:!0}],[c,"touchmove",{passive:!1}],[c,"touchend",void 0],[c,"touchcancel",void 0],[c,"mousedown",void 0],[c,"mousemove",void 0],[c,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[c,"mouseover",void 0],[c,"mouseout",void 0],[c,"dblclick",void 0],[c,"click",void 0],[c,"keydown",{capture:!1}],[c,"keyup",void 0],[c,"wheel",{passive:!1}],[c,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,p,m]of this._listeners){const y=d===document?this.handleWindowEvent:this.handleEvent;d.addEventListener(p,y,m)}}destroy(){for(const[t,n,c]of this._listeners){const d=t===document?this.handleWindowEvent:this.handleEvent;t.removeEventListener(n,d,c)}}_addDefaultHandlers(t){const n=this._map,c=n.getCanvasContainer();this._add("mapEvent",new yh(n,t));const d=n.boxZoom=new xh(n,t);this._add("boxZoom",d);const p=new vh,m=new hp;n.doubleClickZoom=new up(m,p),this._add("tapZoom",p),this._add("clickZoom",m);const y=new dp;this._add("tapDragZoom",y);const x=n.touchPitch=new np(n);this._add("touchPitch",x);const T=new Jc(t),S=new jo(t);n.dragRotate=new Qf(t,T,S),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const M=new wh(t),I=new Th(n,t);n.dragPan=new pp(c,M,I),this._add("mousePan",M),this._add("touchPan",I,["touchZoom","touchRotate"]);const C=new rp,L=new Sh;n.touchZoomRotate=new em(c,L,C,y),this._add("touchRotate",C,["touchPan","touchZoom"]),this._add("touchZoom",L,["touchPan","touchRotate"]),this._add("blockableMapEvent",new Kc(n));const R=n.scrollZoom=new cp(n,this);this._add("scrollZoom",R,["mousePan"]);const F=n.keyboard=new op;this._add("keyboard",F);for(const B of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[B]&&n[B].enable(t[B])}_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!!tu(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={},y={},x=t.touches?this._getMapTouches(t.touches):void 0,T=x?ns(this._el,x):c?void 0:ks(this._el,t);for(const{handlerName:I,handler:C,allowed:L}of this._handlers){if(!C.isEnabled())continue;let R;this._blockedByActive(y,L,I)?C.reset():C[n||t.type]&&(R=C[n||t.type](t,T,x),this.mergeHandlerResult(p,m,R,I,d),R&&R.needsRenderFrame&&this._triggerRenderFrame()),(R||C.isActive())&&(y[I]=C)}const S={};for(const I in this._previousActiveHandlers)y[I]||(S[I]=d);this._previousActiveHandlers=y,(Object.keys(S).length||iu(p))&&(this._changes.push([p,m,S]),this._triggerRenderFrame()),(Object.keys(y).length||iu(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;o.h(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 o.P(0,0))._add(d.panDelta)),d.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(t.around=d.around),d.aroundCoord!==void 0&&(t.aroundCoord=d.aroundCoord),d.pinchAround!==void 0&&(t.pinchAround=d.pinchAround),d.noInertia&&(t.noInertia=d.noInertia),o.h(n,p),o.h(c,m);this._updateMapTransform(t,n,c),this._changes=[]}_updateMapTransform(t,n,c){const d=this._map,p=d.transform,m=V=>[V.x,V.y,V.z];if((V=>{const Z=this._eventsInProgress.drag;return Z&&!this._handlersById[Z.handlerName].isActive()})()&&!iu(t)){const V=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"),V!==p.zoom&&this._map._update(!0)}if(p._isCameraConstrained&&d._stop(!0),!iu(t))return void this._fireEvents(n,c,!0);let{panDelta:y,zoomDelta:x,bearingDelta:T,pitchDelta:S,around:M,aroundCoord:I,pinchAround:C}=t;p._isCameraConstrained&&(x>0&&(x=0),p._isCameraConstrained=!1),C!==void 0&&(M=C),(x||(V=>n[V]&&!this._eventsInProgress[V])("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,T&&(p.bearing+=T),S&&(p.pitch+=S),p._updateCameraState();const L=[0,0,0];if(y)if(p.projection.name==="mercator"){const V=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(M).dir),Z=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(M.sub(y)).dir);L[0]=Z[0]-V[0],L[1]=Z[1]-V[1]}else{const V=p.pointCoordinate(M);if(p.projection.name==="globe"){y=y.rotate(-p.angle);const Z=p._pixelsPerMercatorPixel/p.worldSize;L[0]=-y.x*o.ez(o.aY(V.y))*Z,L[1]=-y.y*o.ez(p.center.lat)*Z}else{const Z=p.pointCoordinate(M.sub(y));V&&Z&&(L[0]=Z.x-V.x,L[1]=Z.y-V.y)}}const R=p.zoom,F=[0,0,0];if(x){const V=m(I||p.pointCoordinate3D(M)),Z={dir:o.au([],o.at([],V,p._camera.position))};if(Z.dir[2]<0){const Y=p.zoomDeltaToMovement(V,x);o.bY(F,Z.dir,Y)}}const B=o.cV(L,L,F);p._translateCameraConstrained(B),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=tu(this._eventsInProgress),p=tu(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 y={};let x;for(const S in this._eventsInProgress){const{handlerName:M,originalEvent:I}=this._eventsInProgress[S];this._handlersById[M].isActive()||(delete this._eventsInProgress[S],x=n[M]||I,y[`${S}end`]=x)}for(const S in y)this._fireEvent(S,y[S]);const T=tu(this._eventsInProgress);if(c&&(d||p)&&!T){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),M=I=>I!==0&&-this._bearingSnap<I&&I<this._bearingSnap;S?(M(S.bearing||this._map.getBearing())&&(S.bearing=0),this._map.easeTo(S,{originalEvent:x})):(this._map.fire(new o.A("moveend",{originalEvent:x})),M(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new o.A(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{this._frameId=void 0,this.handleEvent(new or("renderFrame",{timeStamp:t})),this._applyChanges()})}
2654_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const mp="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Ul extends o.E{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this._respectPrefersReducedMotion=n.respectPrefersReducedMotion!==!1,o.aV(["_renderFrameCallback"],this)}getCenter(){return new o.cd(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,c){return t=o.P.convert(t).mult(-1),this.panTo(this.transform.center,o.h({offset:t},n),c)}panTo(t,n,c){return this.easeTo(o.h({center:t},n),c)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,c){return this.easeTo(o.h({zoom:t},n),c)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,c){return this.easeTo(o.h({bearing:t},n),c)}resetNorth(t,n){return this.rotateTo(0,o.h({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(o.h({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=o.aG.convert(t);const c=n&&n.bearing||0,d=n&&n.pitch||0,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?o.h({},n,this.transform.padding):typeof t=="number"?{top:t,bottom:t,right:t,left:t}:o.h({},n,t)}_extendCameraOptions(t){return(t=o.h({offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding=this._extendPadding(t.padding),t}_minimumAABBFrustumDistance(t,n){const c=n.max[0]-n.min[0],d=n.max[1]-n.min[1];return c/d>t.aspect?c/(2*Math.tan(.5*t.fovX)*t.aspect):d/(2*Math.tan(.5*t.fovY)*t.aspect)}_cameraForBoundsOnGlobe(t,n,c,d,p,m){const y=t.clone(),x=this._extendCameraOptions(m);y.bearing=d,y.pitch=p;const T=o.cd.convert(n),S=o.cd.convert(c),M=.5*(T.lat+S.lat),I=.5*(T.lng+S.lng),C=o.eC(M,I),L=o.au([],C),R=o.au([],o.bF([],L,[0,1,0])),F=o.bF([],R,L),B=[R[0],R[1],R[2],0,F[0],F[1],F[2],0,L[0],L[1],L[2],0,0,0,0,1],V=[C,o.eC(T.lat,T.lng),o.eC(S.lat,T.lng),o.eC(S.lat,S.lng),o.eC(T.lat,S.lng),o.eC(M,T.lng),o.eC(M,S.lng),o.eC(T.lat,I),o.eC(S.lat,I)];let Z=o.cW.fromPoints(V.map(ye=>[o.bG(R,ye),o.bG(F,ye),o.bG(L,ye)]));const Y=o.ad([],Z.center,B);o.eD(Y)===0&&o.eE(Y,0,0,1),o.au(Y,Y),o.bY(Y,Y,o.aB),y.center=o.eF(Y);const te=y.getWorldToCameraMatrix(),ee=o.bi(new Float64Array(16),te);Z=o.cW.applyTransform(Z,o.az([],te,B));const J=this._extendAABB(Z,y,x,d);if(!J)return void o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Z=J,o.ad(Y,Y,te);const K=.5*(Z.max[2]-Z.min[2]),ie=this._minimumAABBFrustumDistance(y,Z),ne=o.bY([],[0,0,1],K),fe=o.cV(ne,Y,ne),me=ie+(y.pitch===0?0:o.bD(Y,fe)),Ae=y.globeCenterInViewSpace,Me=o.at([],Y,[Ae[0],Ae[1],Ae[2]]);o.au(Me,Me),o.bY(Me,Me,me);const Fe=o.cV([],Y,Me);o.ad(Fe,Fe,ee);const de=o.eq/o.aB,we=o.ae(Fe),le=o.c6(Math.max(we*de-o.eq,Number.EPSILON),0),Pe=Math.min(y.zoomFromMercatorZAdjusted(le),x.maxZoom);return Pe>.5*(o.cL+o.cx)?(y.setProjection({name:"mercator"}),y.zoom=Pe,this._cameraForBounds(y,n,c,d,p,m)):{center:y.center,zoom:Pe,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)),y=m,x=p,T=p,S=m,M=n.width-(x+T),I=n.height-(y+S),C=o.at([],t.max,t.min),L=Math.min(M/C[0],I/C[1]),R=Math.min(n.scaleZoom(n.scale*L),c.maxZoom);if(isNaN(R))return null;const F=n.scale/n.zoomScale(R),B=new o.cW([t.min[0]-x*F,t.min[1]-S*F,t.min[2]],[t.max[0]+T*F,t.max[1]+y*F,t.max[2]]),V=(typeof c.offset.x=="number"&&typeof c.offset.y=="number"?new o.P(c.offset.x,c.offset.y):o.P.convert(c.offset)).rotate(-o.al(d));return B.center[0]-=V.x*F,B.center[1]+=V.y*F,B}queryTerrainElevation(t,n){const c=this.transform.elevation;return c?(n=o.h({},{exaggerated:!0}
vendor: 12,347 bytes, line 2654
2654,n),c.getAtPoint(o.ac.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 y=t.clone(),x=this._extendCameraOptions(m);y.bearing=d,y.pitch=p;const T=o.cd.convert(n),S=o.cd.convert(c),M=new o.cd(T.lng,S.lat),I=new o.cd(S.lng,T.lat),C=y.project(T),L=y.project(S),R=this.queryTerrainElevation(T),F=this.queryTerrainElevation(S),B=this.queryTerrainElevation(M),V=this.queryTerrainElevation(I),Z=[[C.x,C.y,Math.min(R||0,F||0,B||0,V||0)],[L.x,L.y,Math.max(R||0,F||0,B||0,V||0)]];let Y=o.cW.fromPoints(Z);const te=y.getWorldToCameraMatrix(),ee=o.bi(new Float64Array(16),te);Y=o.cW.applyTransform(Y,te);const J=this._extendAABB(Y,y,x,d);if(!J)return void o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Y=J;const K=.5*o.at([],Y.max,Y.min)[2],ie=this._minimumAABBFrustumDistance(y,Y),ne=[0,0,1,0];o.aA(ne,ne,te),o.eG(ne,ne);const fe=o.bY([],ne,ie+K),me=o.cV([],Y.center,fe);o.ad(Y.center,Y.center,ee),o.ad(me,me,ee);const Ae=y.unproject(new o.P(Y.center[0],Y.center[1])),Me=o.eH(y.projection,Ae),Fe=Math.pow(2,Me),de=Math.min(y._zoomFromMercatorZ(me[2]*y.pixelsPerMeter*Fe/y.worldSize),x.maxZoom);return y.mercatorFromTransition&&de<.5*(o.cL+o.cx)?(y.setProjection({name:"globe"}),y.zoom=de,this._cameraForBounds(y,n,c,d,p,m)):{center:Ae,zoom:de,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=o.P.convert(t),y=o.P.convert(n),x=new o.P(Math.min(m.x,y.x),Math.min(m.y,y.y)),T=new o.P(Math.max(m.x,y.x),Math.max(m.y,y.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(m,y))return this;const S=this.transform.pointLocation3D(x),M=this.transform.pointLocation3D(T),I=this.transform.pointLocation3D(new o.P(x.x,T.y)),C=this.transform.pointLocation3D(new o.P(T.x,x.y)),L=[Math.min(S.lng,M.lng,I.lng,C.lng),Math.min(S.lat,M.lat,I.lat,C.lat)],R=[Math.max(S.lng,M.lng,I.lng,C.lng),Math.max(S.lat,M.lat,I.lat,C.lat)],F=d&&d.pitch?d.pitch:this.getPitch(),B=this._cameraForBounds(this.transform,L,R,c,F,d);return this._fitInternal(B,d,p)}_fitInternal(t,n,c){return t?(n=o.h(t,n)).linear?this.easeTo(n,c):this.flyTo(n,c):this}jumpTo(t,n){this.stop();const c=t.preloadOnly?this.transform.clone():this.transform;let d=!1,p=!1,m=!1;"zoom"in t&&c.zoom!==+t.zoom&&(d=!0,c.zoom=+t.zoom),t.center!==void 0&&(c.center=o.cd.convert(t.center)),"bearing"in t&&c.bearing!==+t.bearing&&(p=!0,c.bearing=+t.bearing),"pitch"in t&&c.pitch!==+t.pitch&&(m=!0,c.pitch=+t.pitch);const y=typeof t.padding=="number"?this._extendPadding(t.padding):t.padding;if(t.padding!=null&&!c.isPaddingEqual(y))if(t.retainPadding===!1){const x=c.clone();x.padding=y,c.setLocationAtPoint(c.center,x.centerPoint)}else c.padding=y;return t.preloadOnly?(this._preloadTiles(c),this):(this.fire(new o.A("movestart",n)).fire(new o.A("move",n)),d&&this.fire(new o.A("zoomstart",n)).fire(new o.A("zoom",n)).fire(new o.A("zoomend",n)),p&&this.fire(new o.A("rotatestart",n)).fire(new o.A("rotate",n)).fire(new o.A("rotateend",n)),m&&this.fire(new o.A("pitchstart",n)).fire(new o.A("pitch",n)).fire(new o.A("pitchend",n)),this.fire(new o.A("moveend",n)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||o.w(mp),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,n){const c=this.transform;if(!c.projection.supportsFreeCamera)return o.w(mp),this;this.stop();const d=c.zoom,p=c.pitch,m=c.bearing;c.setFreeCameraOptions(t);const y=d!==c.zoom,x=p!==c.pitch,T=m!==c.bearing;return this.fire(new o.A("movestart",n)).fire(new o.A("move",n)),y&&this.fire(new o.A("zoomstart",n)).fire(new o.A("zoom",n)).fire(new o.A("zoomend",n)),T&&this.fire(new o.A("rotatestart",n)).fire(new o.A("rotate",n)).fire(new o.A("rotateend",n)),x&&this.fire(new o.A("pitchstart",n)).fire(new o.A("pitch",n)).fire(new o.A("pitchend",n)),this.fire(new o.A("moveend",n)),this}easeTo(t,n){this._stop(!1,t.easeId),((t=o.h({offset:[0,0],duration:500,easing:o.ey},t)).animate===!1||this._prefersReducedMotion(t))&&(t.duration=0);const c=this.transform,d=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),x="zoom"in t?+t.zoom:d,T="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,M=this._extendPadding(t.padding),I=o.P.convert(t.offset);let C,L,R;if(c.projection.name==="globe"){const ne=o.ac.fromLngLat(c.center),fe=I.rotate(-c.angle);ne.x+=fe.x/c.worldSize,ne.y+=fe.y/c.worldSize;const me=ne.toLngLat(),Ae=o.cd.convert(t.center||me);this._normalizeCenter(Ae),C=c.centerPoint.add(fe),L=new o.P(ne.x,ne.y).mult(c.worldSize),R=new o.P(o.aD(Ae.lng),o.aH(Ae.lat)).mult(c.worldSize).sub(L)}else{C=c.centerPoint.add(I);const ne=c.pointLocation(C),fe=o.cd.convert(t.center||ne);this._normalizeCenter(fe),L=c.project(ne),R=c.project(fe).sub(L)}const F=c.zoomScale(x-d);let B,V;t.around&&(B=o.cd.convert(t.around),V=c.locationPoint(B));const Z=this._zooming||x!==d,Y=this._rotating||p!==T,te=this._pitching||S!==m,ee=!c.isPaddingEqual(M),J=t.retainPadding===!1?c.clone():c,K=ne=>fe=>{if(Z&&(ne.zoom=o.ai(d,x,fe)),Y&&(ne.bearing=o.ai(p,T,fe)),te&&(ne.pitch=o.ai(m,S,fe)),ee&&(J.interpolatePadding(y,M,fe),C=J.centerPoint.add(I)),B)ne.setLocationAtPoint(B,V);else{const me=ne.zoomScale(ne.zoom-d),Ae=x>d?Math.min(2,F):Math.max(.5,F),Me=Math.pow(Ae,1-fe),Fe=ne.unproject(L.add(R.mult(fe*Me)).mult(me));ne.setLocationAtPoint(ne.renderWorldCopies?Fe.wrap():Fe,C)}return t.preloadOnly||this._fireMoveEvents(n),ne};if(t.preloadOnly){const ne=this._emulate(K,t.duration,c);return this._preloadTiles(ne),this}const ie={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=Z,this._rotating=Y,this._pitching=te,this._padding=ee,this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ie),this._ease(K(c),ne=>{c.cameraElevationReference==="sea"&&c.recenterOnTerrain(),this._afterEase(n,ne)},t),this}_prepareEase(t,n,c={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),n||c.moving||this.fire(new o.A("movestart",t)),this._zooming&&!c.zooming&&this.fire(new o.A("zoomstart",t)),this._rotating&&!c.rotating&&this.fire(new o.A("rotatestart",t)),this._pitching&&!c.pitching&&this.fire(new o.A("pitchstart",t))}_fireMoveEvents(t){this.fire(new o.A("move",t)),this._zooming&&this.fire(new o.A("zoom",t)),this._rotating&&this.fire(new o.A("rotate",t)),this._pitching&&this.fire(new o.A("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const c=this._zooming,d=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,c&&this.fire(new o.A("zoomend",t)),d&&this.fire(new o.A("rotateend",t)),p&&this.fire(new o.A("pitchend",t)),this.fire(new o.A("moveend",t))}flyTo(t,n){if(this._prefersReducedMotion(t)){const ye=o.aF(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(ye,n)}this.stop(),t=o.h({offset:[0,0],speed:1.2,curve:1.42,easing:o.ey},t);const c=this.transform,d=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),x="zoom"in t?o.ay(+t.zoom,c.minZoom,c.maxZoom):d,T="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,M=this._extendPadding(t.padding),I=c.zoomScale(x-d),C=o.P.convert(t.offset);let L=c.centerPoint.add(C);const R=c.pointLocation(L),F=o.cd.convert(t.center||R);this._normalizeCenter(F);const B=c.project(R),V=c.project(F).sub(B);let Z=t.curve;const Y=Math.max(c.width,c.height),te=Y/I,ee=V.mag();if("minZoom"in t){const ye=o.ay(Math.min(t.minZoom,d,x),c.minZoom,c.maxZoom),De=Y/c.zoomScale(ye-d);Z=Math.sqrt(De/ee*2)}const J=Z*Z;function K(ye){const De=(te*te-Y*Y+(ye?-1:1)*J*J*ee*ee)/(2*(ye?te:Y)*J*ee);return Math.log(Math.sqrt(De*De+1)-De)}function ie(ye){return(Math.exp(ye)-Math.exp(-ye))/2}function ne(ye){return(Math.exp(ye)+Math.exp(-ye))/2}const fe=K(0);let me=function(ye){return ne(fe)/ne(fe+Z*ye)},Ae=function(ye){return Y*((ne(fe)*(ie(De=fe+Z*ye)/ne(De))-ie(fe))/J)/ee;var De},Me=(K(1)-fe)/Z;if(Math.abs(ee)<1e-6||!isFinite(Me)){if(Math.abs(Y-te)<1e-6)return this.easeTo(t,n);const ye=te<Y?-1:1;Me=Math.abs(Math.log(te/Y))/Z,Ae=function(){return 0},me=function(De){return Math.exp(ye*Z*De)}}t.duration="duration"in t?+t.duration:1e3*Me/("screenSpeed"in t?+t.screenSpeed/Z:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const Fe=p!==T,de=S!==m,we=!c.isPaddingEqual(M),le=t.retainPadding===!1?c.clone():c,Pe=ye=>De=>{const qe=De*Me,Ce=1/me(qe);ye.zoom=De===1?x:d+ye.scaleZoom(Ce),Fe&&(ye.bearing=o.ai(p,T,De)),de&&(ye.pitch=o.ai(m,S,De)),we&&(le.interpolatePadding(y,M,De),L=le.centerPoint.add(C));const je=De===1?F:ye.unproject(B.add(V.mult(Ae(qe))).mult(Ce));return ye.setLocationAtPoint(ye.renderWorldCopies?je.wrap():je,L),ye._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(n),ye};if(t.preloadOnly){const ye=this._emulate(Pe,t.duration,c);return this._preloadTiles(ye),this}return this._zooming=!0,this._rotating=Fe,this._pitching=de,this._padding=we,this._prepareEase(n,!1),this._ease(Pe(c),()=>this._afterEase(n),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(t){}_cancelRenderFrame(t){}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const c=this._onEaseEnd;this._onEaseEnd=void 0,c.call(this,n)}if(!t){const c=this.handlers;c&&c.stop(!1)}return this}_ease(t,n,c){c.animate===!1||c.duration===0?(t(1),n()):(this._easeStart=o.q.now(),this._easeOptions=c,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((o.q.now()-this._easeStart)/this._easeOptions.duration,1),n=this._onEaseFrame;n&&n(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=o.bX(t,-180,180);const c=Math.abs(t-n);return Math.abs(t-360-n)<c&&(t-=360),Math.abs(t+360-n)<c&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(n.maxBounds||n.projection.name!=="globe"&&!n.renderWorldCopies)return;const c=t.lng-n.center.lng;t.lng+=c>180?-360:c<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&o.q.prefersReducedMotion&&!(t&&t.essential)}_emulate(t,n,c){const d=Math.ceil(15*n/1e3),p=[],m=t(c.clone());for(let y=0;y<=d;y++){const x=m(y/d);p.push(x.clone())}return p}_preloadTiles(t,n){}}class Ah{constructor(t={}){this.options=t,o.aV(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const n=this.options&&this.options.compact,c=t._getUIString("AttributionControl.ToggleAttribution");this._map=t,this._container=Dt("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=Dt("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=Dt("span","mapboxgl-ctrl-icon",this._compactButton);return d.setAttribute("aria-hidden","true"),d.setAttribute("title",c),this._innerContainer=Dt("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
2654se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||o.e.ACCESS_TOKEN}];if(t){const c=n.reduce((d,p,m)=>(p.value&&(d+=`${p.key}=${p.value}${m<n.length-1?"&":""}`),d),"?");t.href=`${o.e.FEEDBACK_URL}/${c}#${Xc(this._map,!0)}`,t.rel="noopener nofollow"}}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let t=[];if(this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const n=this._map.style._mergedSourceCaches;for(const d in n){const 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.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 ru{constructor(){o.aV(["_updateLogo","_updateCompact"],this)}onAdd(t){this._map=t,this._container=Dt("div","mapboxgl-ctrl");const n=Dt("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 jl{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 Ps{constructor(t){this.jumpTo(t)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const n=o.dk((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 nu={"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 fr extends o.A{constructor(t,n,c,d){const{point:p,lngLat:m,originalEvent:y,target:x}=t;super(t.type,{point:p,lngLat:m,originalEvent:y,target:x}),this.preventDefault=()=>{t.preventDefault()},this.id=n,this.interaction=c,this.feature=d}}class cs{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}
vendor: 6,584 bytes, line 2654
2654add(t,n){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const c=n.filter;let d=n.type;c&&this.filters.set(t,o.b3(c)),d==="mouseover"&&(d="mouseenter"),d==="mouseout"&&(d="mouseleave");const 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())))}handleOut(t){const n=Array.from(this.hoveredFeatures.values()).map(({feature:c})=>c);n.length&&(t.type="mouseleave",this.handleType(t,n)),this.hoveredFeatures.clear()}handleType(t,n){const c=t.type==="mouseenter";if(c&&!this.interactionsByType.has(t.type))return void o.w("mouseenter interaction required for mouseleave to work.");const d=Array.from(this.interactionsByType.get(t.type)).reverse(),p=!!n;n=n||this.queryTargets(t.point,d);let m=!1;const y=new Set;for(const x of n){for(const[T,S]of d){if(!S.target)continue;const M=x.variants?x.variants[T]:null;if(M){for(const I of M){if(lc(I,x,y,T))continue;const C=new o.de(x,I),L=tl(I,x,T);p&&(C.state=this.map.getFeatureState(C));const R=c?this.prevHoveredFeatures.get(L):null,F=new fr(t,T,S,C),B=R?R.stop:S.handler(F);if(c&&this.hoveredFeatures.set(L,{feature:x,stop:B}),B!==!1){m=!0;break}}if(m)break}}if(m)break}if(!m)for(const[x,T]of d){const{handler:S,target:M}=T;if(!M&&S(new fr(t,x,T,null))!==!1)break}}}function Gl(l,t){if(Array.isArray(l)&&Array.isArray(t)){const n=new Set(l),c=new Set(t);return n.size===c.size&&l.every(d=>c.has(d))}return o.bv(l,t)}const su={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"},_p={showCompass:!0,showZoom:!0,visualizePitch:!1};class tm{constructor(t,n,c=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new Jc({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,c&&(this.mousePitch=new jo({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),o.aV(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchmove",this.touchmove),n.addEventListener("touchend",this.touchend),n.addEventListener("touchcancel",this.reset)}down(t,n){this.mouseRotate.mousedown(t,n),this.mousePitch&&this.mousePitch.mousedown(t,n),Dn()}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),y=m&&m.pitchDelta;y&&c.setPitch(c.getPitch()+y)}}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),t.removeEventListener("touchmove",this.touchmove),t.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){cn(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(o.h({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),ks(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(t){this.move(t,ks(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=ns(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=ns(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 ka(l,t,n){if(l=new o.cd(l.lng,l.lat),t){const c=new o.cd(l.lng-360,l.lat),d=new o.cd(l.lng+360,l.lat),p=360*Math.ceil(Math.abs(l.lng-n.center.lng)/360),m=n.locationPoint3D(l).distSqr(t),y=t.x<0||t.y<0||t.x>n.width||t.y>n.height;n.locationPoint3D(c).distSqr(t)<m&&(y||Math.abs(c.lng-n.center.lng)<p)?l=c:n.locationPoint3D(d).distSqr(t)<m&&(y||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}
2654const Mh={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%)"},us={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class ql extends o.E{constructor(t,n){super(),(t instanceof HTMLElement||n)&&(t=o.h({element:t},n)),o.aV(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:c="center",color:d="#3FB1CE",scale:p=1,draggable:m=!1,clickTolerance:y=0,rotation:x=us.rotation,rotationAlignment:T=us.rotationAlignment,pitchAlignment:S=us.pitchAlignment,occludedOpacity:M=us.occludedOpacity,altitude:I=us.altitude}=t||{};this._anchor=c,this._color=d,this._scale=p,this._draggable=m,this._clickTolerance=y,this._rotation=x,this._rotationAlignment=T,this._pitchAlignment=S,this._occludedOpacity=M,this._altitude=I,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=o.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=o.P.convert(t&&t.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",R=>{R.preventDefault()}),this._element.addEventListener("mousedown",R=>{R.preventDefault()});const C=this._element.classList;for(const R in Mh)C.remove(`mapboxgl-marker-anchor-${R}`);C.add(`mapboxgl-marker-anchor-${this._anchor}`);const L=t&&t.className?t.className.trim().split(/\s+/):[];C.add(...L),this._popup=null}_createDefaultMarker(){const t=Dt("div"),n=Tr("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=Tr("radialGradient",{id:"shadowGradient"},Tr("defs",{},n));Tr("stop",{offset:"10%","stop-opacity":.4},c),Tr("stop",{offset:"100%","stop-opacity":.05},c),Tr("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},n)}return Tr("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),Tr("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),Tr("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},n),t}addTo(t){return t===this._map||(this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._updateMoving),t.on("moveend",this._update),t.on("remove",this._clearFadeTimer),t._addMarker(this),this.setDraggable(this._draggable),this._update(),t.on("click",this._onMapClick)),this}remove(){const t=this._map;return t&&(t.off("click",this._onMapClick),t.off("move",this._updateMoving),t.off("moveend",this._update),t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler),t.off("mouseup",this._onUp),t.off("touchend",this._onUp),t.off("mousemove",this._onMove),t.off("touchmove",this._onMove),t.off("remove",this._clearFadeTimer),t._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=o.cd.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||us.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const d=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
vendor: 7,438 bytes, lines 2654-2659
26540,-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()&&o.eK(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=` 2655 translate(${t.x}px,${t.y}px) 2656 ${Mh[this._anchor]} 2657 ${this._calculateXYTransform()} ${this._calculateZTransform()} 2658 translate(${n.x}px,${n.y}px) 2659 `}_calculateXYTransform(){const t=this._pos,n=this._map,c=this.getPitchAlignment();if(!n||!t||c!=="map")return"";if(!n._showingGlobe()){const x=n.getPitch();return x?`rotateX(${x}deg)`:""}const d=o.cJ(o.eL(n.transform,this._lngLat)),p=t.sub(o.eM(n.transform)),m=Math.abs(p.x)+Math.abs(p.y);if(m===0)return"";const y=d/m;return`rotateX(${-p.y*y}deg) rotateY(${p.x*y}deg)`}_calculateZTransform(){const t=this._pos,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 o.cd(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),m=n.project(new o.cd(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(p);c=o.cJ(Math.atan2(m.y,m.x))-90}else c=-n.getBearing();else if(d==="horizon"){const p=o.af(4,6,n.getZoom()),m=o.eM(n.transform);m.y+=p*n.transform.height;const y=t.sub(m),x=o.cJ(Math.atan2(y.y,y.x));c=(x>90?x-270:x+90)*(1-p)}return c+=this._rotation,c?`rotateZ(${c}deg)`:""}_update(t){cancelAnimationFrame(this._updateFrameId);const n=this._map;n&&(n.transform.renderWorldCopies&&(this._lngLat=ka(this._lngLat,this._pos,n.transform)),this._pos=n.project(this._lngLat,this._altitude),t===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),n._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(n._showingGlobe()||n.getTerrain()||n.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(t){return this._offset=o.P.convert(t),this._update(),this}addClassName(t){return this._element.classList.add(t),this}removeClassName(t){return this._element.classList.remove(t),this}toggleClassName(t){return this._element.classList.toggle(t)}_onMove(t){const n=this._map;if(!n)return;const c=this._pointerdownPos,d=this._positionDelta;if(c&&d){if(!this._isDragging){const 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 o.A("dragstart"))),this.fire(new o.A("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new o.A("dragend")),this._state="inactive"}_addDragHandler(t){const n=this._map,c=this._pos;n&&c&&this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(c),this._pointerdownPos=t.point,this._state="pending",n.on("mousemove",this._onMove),n.on("touchmove",this._onMove),n.once("mouseup",this._onUp),n.once("touchend",this._onUp))}setDraggable(t){this._draggable=!!t;const n=this._map;return n&&(t?(n.on("mousedown",this._addDragHandler),n.on("touchstart",this._addDragHandler)):(n.off("mousedown",this._addDragHandler),n.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||us.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||us.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||us.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(t){return this._occludedOpacity=t||us.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Ch={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},$l={maxWidth:100,unit:"metric"},Oa={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},zs={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},Jn=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Un(l=new o.P(0,0),t="bottom"){if(typeof l=="number"){const n=Math.round(Math.sqrt(.5*Math.pow(l,2)));switch(t){case"top":return new o.P(0,l);case"top-left":return new o.P(n,n);case"top-right":return new o.P(-n,n);case"bottom":return new o.P(0,-l);case"bottom-left":return new o.P(n,-n);case"bottom-right":return new o.P(-n,-n);case"left":return new o.P(l,0);case"right":return new o.P(-l,0)}return new o.P(0,0)}return l instanceof o.P||Array.isArray(l)?o.P.convert(l):o.P.convert(l[t]||[0,0])}return{version:Gt,supported:Kr.supported,setRTLTextPlugin:o.eQ,getRTLTextPluginStatus:o.eP,Map:class extends Ul{constructor(l){ri.mark(ft.create);const t=l;if((l=o.h({}
2659,su,l)).minZoom!=null&&l.maxZoom!=null&&l.minZoom>l.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(l.minPitch!=null&&l.maxPitch!=null&&l.minPitch>l.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(l.minPitch!=null&&l.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(l.maxPitch!=null&&l.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(l.antialias&&o.eI(window)&&(l.antialias=!1,o.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Fu(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 jl,this._domRenderTaskQueue=new jl,this._controls=[],this._markers=[],this._popups=[],this._mapId=o.a$(),this._locale=o.h({},nu,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 Ps(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=l.scaleFactor,this._requestManager=new Ai(l.transformRequest,l.accessToken,l.testMode),this._silenceAuthErrors=!!l.testMode,this._contextCreateOptions=l.contextCreateOptions?Object.assign({},l.contextCreateOptions):{},typeof l.container=="string"){const n=document.getElementById(l.container);if(!n)throw new Error(`Container '${l.container.toString()}' not found.`);this._container=n}else{if(!(l.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=l.container}if(this._container.childNodes.length>0&&o.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),l.maxBounds&&this.setMaxBounds(l.maxBounds),this._spriteFormat=l.spriteFormat,o.aV(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new dh),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},()=>{this._update()}),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._tp.registerParameter(this,["Scaling"],"_scaleFactor",{min:.1,max:10,step:.1},()=>{this.setScaleFactor(this._scaleFactor)}),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new Ih(this,l),this._localFontFamily=l.localFontFamily,this._localIdeographFontFamily=l.localIdeographFontFamily,(l.style||!l.testMode)&&this.setStyle(l.style||o.e.DEFAULT_STYLE,{config:l.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),l.projection&&this.setProjection(l.projection),this.indoor=new Tf(this),l.hash&&(this._hash=new _h(typeof l.hash=="string"&&l.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){t.center==null&&t.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch});const n=l.bounds;n&&(this.resize(),this.fitBounds(n,o.h({},l.fitBoundsOptions,{duration:0})))}this.resize(),l.attributionControl&&this.addControl(new Ah({customAttribution:l.customAttribution}
vendor: 27,467 bytes, lines 2659-2661
2659)),this._logoControl=new ru,this.addControl(this._logoControl,l.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new o.A(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new o.A(`${n.dataType}dataloading`,n))}),this._interactions=new cs(this)}_getMapId(){return this._mapId}addControl(l,t){if(t===void 0&&(t=l.getDefaultPosition?l.getDefaultPosition():"top-right"),!l||!l.onAdd)return this.fire(new o.z(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=l.onAdd(this);this._controls.push(l);const c=this._controlPositions[t];return t.indexOf("bottom")!==-1?c.insertBefore(n,c.firstChild):c.appendChild(n),this}removeControl(l){if(!l||!l.onRemove)return this.fire(new o.z(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(l);return t>-1&&this._controls.splice(t,1),l.onRemove(this),this}hasControl(l){return this._controls.indexOf(l)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(l){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const t=!this._moving;return t&&this.fire(new o.A("movestart",l)).fire(new o.A("move",l)),this.fire(new o.A("resize",l)),t&&this.fire(new o.A("moveend",l)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(l){return this.transform.setMaxBounds(o.aG.convert(l)),this._update()}setMinZoom(l){if((l=l??-2)>=-2&&l<=this.transform.maxZoom)return this.transform.minZoom=l,this._update(),this.getZoom()<l?this.setZoom(l):this.fire(new o.A("zoomstart")).fire(new o.A("zoom")).fire(new o.A("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(l){if((l=l??22)>=this.transform.minZoom)return this.transform.maxZoom=l,this._update(),this.getZoom()>l?this.setZoom(l):this.fire(new o.A("zoomstart")).fire(new o.A("zoom")).fire(new o.A("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(l){if((l=l??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(l>=0&&l<=this.transform.maxPitch)return this.transform.minPitch=l,this._update(),this.getPitch()<l?this.setPitch(l):this.fire(new o.A("pitchstart")).fire(new o.A("pitch")).fire(new o.A("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(l){if((l=l??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(l>=this.transform.minPitch)return this.transform.maxPitch=l,this._update(),this.getPitch()>l?this.setPitch(l):this.fire(new o.A("pitchstart")).fire(new o.A("pitch")).fire(new o.A("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(l){return this._scaleFactor=l,this.painter.scaleFactor=l,this._tp.refreshUI(),this._scaleFactorChanged=!0,this.style._updateFilteredLayers(t=>t.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(l){return this.transform.renderWorldCopies=l,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(l){return l==="auto"?navigator.language:Array.isArray(l)?l.length===0?void 0:l.map(t=>t==="auto"?navigator.language:t):l}setLanguage(l){const t=this._parseLanguage(l);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const n of this._controls)n._setLanguage&&n._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(l){return this.style&&l!==this._worldview?(this._worldview=l,this._styleDirty=!0,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(l){return this._lazyInitEmptyStyle(),l?typeof l=="string"&&(l={name:l}):l=null,this._useExplicitProjection=!!l,this._prioritizeAndUpdateProjection(l,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const l=this.transform,t=l.projection.name;let n;t==="globe"&&l.zoom>=o.cx?(l.setMercatorFromTransition(),n=!0):t==="mercator"&&l.zoom<o.cx&&(l.setProjection({name:"globe"}),n=!0),n&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(l,t){return this._updateProjection(l||t||{name:"mercator"})}_updateProjection(l){let t;return t=l.name==="globe"&&this.transform.zoom>=o.cx?this.transform.setMercatorFromTransition():this.transform.setProjection(l),this.style.applyProjectionUpdate(),t&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(l,t){return this.transform.locationPoint3D(o.cd.convert(l),t)}unproject(l,t){return this.transform.pointLocation3D(o.P.convert(l),t)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(l,t,n){const c=d=>{let p=[];if(Array.isArray(t)){const m=t.filter(y=>this.getLayer(y));p=m.length?this.queryRenderedFeatures(d,{layers:m}):[]}else p=this.queryRenderedFeatures(d,{target:t});return p};if(l==="mouseenter"||l==="mouseover"){let d=!1;return{listener:n,targets:t,delegates:{mousemove:m=>{const y=c(m.point);y.length?d||(d=!0,n.call(this,new Or(l,this,m.originalEvent,{features:y}))):d=!1},mouseout:()=>{d=!1}}}}if(l==="mouseleave"||l==="mouseout"){let d=!1;return{listener:n,targets:t,delegates:{mousemove:y=>{c(y.point).length?d=!0:d&&(d=!1,n.call(this,new Or(l,this,y.originalEvent)))},mouseout:y=>{d&&(d=!1,n.call(this,new Or(l,this,y.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&&Gl(m.targets,t)){for(const y in m.delegates)this.off(y,m.delegates[y]);return d.splice(p,1),this}}})(c),this}queryRenderedFeatures(l,t){if(!this.style)return[];if(l===void 0||l instanceof o.P||Array.isArray(l)||t!==void 0||(t=l,l=void 0),l=l||[[0,0],[this.transform.width,this.transform.height]],!t){const 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)}isPointOnSurface(l){const{name:t}=this.transform.projection;return t!=="globe"&&t!=="mercator"&&o.w(`${t} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(o.P.convert(l))}addInteraction(l,t){return this._interactions.add(l,t),this}removeInteraction(l){return this._interactions.remove(l),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(l){return this._cooperativeGestures=l,this}setStyle(l,t){return t=o.h({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},t),this.style&&l&&t.diff!==!1&&t.localFontFamily===this._localFontFamily&&t.localIdeographFontFamily===this._localIdeographFontFamily&&!t.config?(this.style._diffStyle(l,(n,c)=>{if(n){const d=typeof n=="string"?n:n instanceof Error?n.message:n.error;o.w(`Unable to perform style diff: ${d}. Rebuilding the style from scratch.`),this._updateStyle(l,t)}else c&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._localFontFamily=t.localFontFamily,this._updateStyle(l,t))}_getUIString(l){const t=this._locale[l];if(t==null)throw new Error(`Missing UI string '${l}'`);return t}_updateStyle(l,t){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),l){const n=o.h({},t);t&&t.config&&(n.initialConfig=t.config,delete n.config),this.style=new Wr(this,n).load(l),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Wr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(o.w("There is no style added to the map."),!1)}_isValidId(l){return l==null?(this.fire(new o.z(new Error("IDs can't be empty."))),!1):!o.d8(l)||(this.fire(new o.z(new Error(`IDs can't contain special symbols: "${l}".`))),!1)}_isTargetValid(l){return"featuresetId"in l?this._isValidId("importId"in l?l.importId:l.featuresetId):"layerId"in l&&this._isValidId(l.layerId)}_areTargetsValid(l){if(Array.isArray(l)){for(const t of l)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(l)}addSource(l,t){return this._isValidId(l)?(this._lazyInitEmptyStyle(),this.style.addSource(l,t),this._update(!0)):this}isSourceLoaded(l){return!!this._isValidId(l)&&!!this.style&&this.style._isSourceCacheLoaded(l)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(l,t,n){this._lazyInitEmptyStyle(),this.style.addSourceType(l,t,n)}removeSource(l){return this._isValidId(l)?(this.style.removeSource(l),this._updateTerrain(),this._update(!0)):this}getSource(l){return this._isValidId(l)?this.style.getOwnSource(l):null}addImage(l,t,{pixelRatio:n=1,sdf:c=!1,stretchX:d,stretchY:p,content:m}={}){this._lazyInitEmptyStyle();const y=o.I.from(l);if(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap){const{width:x,height:T,data:S}=o.q.getImageData(t);this.style.addImage(y,{data:new o.r({width:x,height:T},S),pixelRatio:n,stretchX:d,stretchY:p,content:m,sdf:c,version:0,usvg:!1})}else if(t.width===void 0||t.height===void 0)this.fire(new o.z(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:x,height:T}=t,S=t;this.style.addImage(y,{data:new o.r({width:x,height:T},new Uint8Array(S.data)),pixelRatio:n,stretchX:d,stretchY:p,content:m,sdf:c,usvg:!1,version:0,userImage:S}),S.onAdd&&S.onAdd(this,l)}}updateImage(l,t){this._lazyInitEmptyStyle();const n=o.I.from(l),c=this.style.getImage(n);if(!c)return void this.fire(new o.z(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap?o.q.getImageData(t):t,{width:p,height:m,data:y}=d;if(p===void 0||m===void 0)return void this.fire(new o.z(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(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 o.z(new Error(`The width and height of the updated image (${p}, ${m}) 2660 must be that same as the previous version of the image 2661 (${c.data.width}, ${c.data.height})`)));const x=!(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap);let T=!1;c.usvg?(c.data=new o.r({width:p,height:m},new Uint8Array(y)),c.usvg=!1,c.icon=void 0,T=!0):c.data.replace(y,x),this.style.updateImage(n,c,T)}hasImage(l){return l?!!this.style&&!!this.style.getImage(o.I.from(l)):(this.fire(new o.z(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(o.I.from(l))}loadImage(l,t){o.o(this._requestManager.transformRequest(l,o.R.Image),(n,c)=>{t(n,c instanceof HTMLImageElement?o.q.getImageData(c):c)})}listImages(){return this.style.listImages().map(l=>l.name)}addModel(l,t){this._lazyInitEmptyStyle(),this.style.addModel(l,t)}hasModel(l){return l?this.style.hasModel(l):(this.fire(new o.z(new Error("Missing required model id"))),!1)}removeModel(l){this.style.removeModel(l)}listModels(){return this.style.listModels()}addLayer(l,t){return this._isValidId(l.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(l,t),this._update(!0)):this}getSlot(l){const t=this.getLayer(l);return t&&t.slot||null}setSlot(l,t){return this.style.setSlot(l,t),this.style.mergeLayers(),this._update(!0)}addImport(l,t){return this.style.addImport(l,t).catch(n=>this.fire(new o.z(new Error("Failed to add import",n)))),this}updateImport(l,t){return typeof t!="string"&&t.id!==l?(this.removeImport(l),this.addImport(t)):(this.style.updateImport(l,t),this._update(!0))}removeImport(l){return this.style.removeImport(l),this}moveImport(l,t){return this.style.moveImport(l,t),this._update(!0)}moveLayer(l,t){return this._isValidId(l)?(this.style.moveLayer(l,t),this._update(!0)):this}removeLayer(l){return this._isValidId(l)?(this.style.removeLayer(l),this._update(!0)):this}getLayer(l){if(!this._isValidId(l))return null;const t=this.style.getOwnLayer(l);return t?t.type==="custom"?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(l,t,n){return this._isValidId(l)?(this.style.setLayerZoomRange(l,t,n),this._update(!0)):this}setFilter(l,t,n={}){return this._isValidId(l)?(this.style.setFilter(l,t,n),this._update(!0)):this}getFilter(l){return this._isValidId(l)?this.style.getFilter(l):null}setPaintProperty(l,t,n,c={}){return this._isValidId(l)?(this.style.setPaintProperty(l,t,n,c),this._update(!0)):this}getPaintProperty(l,t){return this._isValidId(l)?this.style.getPaintProperty(l,t):null}setLayoutProperty(l,t,n,c={}){return this._isValidId(l)?(this.style.setLayoutProperty(l,t,n,c),this._update(!0)):this}getLayoutProperty(l,t){return this._isValidId(l)?this.style.getLayoutProperty(l,t):null}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(l){return this.style.setGlyphsUrl(l),this._update(!0)}getSchema(l){return this.style.getSchema(l)}setSchema(l,t){return this.style.setSchema(l,t),this._update(!0)}getConfig(l){return this.style.getConfig(l)}setConfig(l,t){return this.style.setConfig(l,t),this._update(!0)}getConfigProperty(l,t){return this.style.getConfigProperty(l,t)}setConfigProperty(l,t,n){return this.style.setConfigProperty(l,t,n),this._update(!0)}getFeaturesetDescriptors(l){return this.style.getFeaturesetDescriptors(l)}setLights(l){if(this._lazyInitEmptyStyle(),l&&l.length===1&&l[0].type==="flat"){const t=l[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(l),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const l=this.style.getLights()||[];return l.length===0&&l.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),l}setLight(l,t={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:l}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(l){return this._lazyInitEmptyStyle(),!l&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(l),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(l){return this._lazyInitEmptyStyle(),this.style.setFog(l),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(l){return this._lazyInitEmptyStyle(),this.style.setSnow(l),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(l){return this._lazyInitEmptyStyle(),this.style.setRain(l),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(l){return this._lazyInitEmptyStyle(),this.style.setColorTheme(l),this._update(!0)}setImportColorTheme(l,t){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(l,t),this._update(!0)}setCamera(l){return this.style.setCamera(l),this._triggerCameraUpdate(l)}_triggerCameraUpdate(l){return this._update(this.transform.setOrthographicProjectionAtLowPitch(l["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(l){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(o.cd.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)}_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)"&&o.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const l=this._container;l.classList.add("mapboxgl-map"),(this._missingCSSCanary=Dt("div","mapboxgl-canary",l)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=Dt("div","mapboxgl-canvas-container",l);this._canvas=Dt("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=Dt("div","mapboxgl-control-container",l),c=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(d=>{c[d]=Dt("div",`mapboxgl-ctrl-${d}`,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(l,t){const n=o.q.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=o.h({},Kr.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl2",l);t?(Zn(t,!0),this.painter=new Pa(t,this._contextCreateOptions,this.transform,this._scaleFactor,this._tp,this._worldview),this.on("data",n=>{n.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),o.l.testSupport(t)):this.fire(new o.z(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new o.A("webglcontextlost",{originalEvent:l}))}_contextRestored(l){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new o.A("webglcontextrestored",{originalEvent:l}))}_onMapScroll(l){if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(l){return this.style?(this._styleDirty=this._styleDirty||l,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(l){return this._update(),this._renderTaskQueue.add(l)}_cancelRenderFrame(l){this._renderTaskQueue.remove(l)}_requestDomTask(l){!this.loaded()||this.loaded()&&!this.isMoving()?l():this._domRenderTaskQueue.add(l)}_render(l){let t;this.fire(new o.A("renderstart")),++this._frameId;const n=this.painter.context.extTimerQuery,c=o.q.now(),d=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(t=d.createQuery(),d.beginQuery(n.TIME_ELAPSED_EXT,t)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(l),this._domRenderTaskQueue.run(l),this._removed)return;this._updateProjectionTransition();const p=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const T=this.transform.zoom,S=this.transform.pitch,M=o.q.now(),I=new o.aa(T,{now:M,fadeDuration:p,pitch:S,transition:this.style.transition,worldview:this._worldview});this.style.update(I)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let m=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),m=this._updateAverageElevation(c),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):m=this._updateAverageElevation(c);const y=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,p,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),y&&(this._placementDirty=y.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration: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 o.A("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,ri.mark(ft.load),this.fire(new o.A("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),t){const T=o.q.now()-c;d.endQuery(n.TIME_ELAPSED_EXT),setTimeout(()=>{const S=d.getQueryParameter(t,d.QUERY_RESULT)/1e6;d.deleteQuery(t),this.fire(new o.A("gpu-timing-frame",{cpuTime:T,gpuTime:S}))},50)}if(this.listens("gpu-timing-layer")){const T=this.painter.collectGpuTimers();setTimeout(()=>{const S=this.painter.queryGpuTimers(T);this.fire(new o.A("gpu-timing-layer",{layerTimes:S}))},50)}if(this.listens("gpu-timing-deferred-render")){const T=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const S=this.painter.queryGpuTimeDeferredRender(T);this.fire(new o.A("gpu-timing-deferred-render",{gpuTime:S}))},50)}const x=this._sourcesDirty||this._styleDirty||this._placementDirty||m;if(x||this._repaint)this.triggerRepaint();else{const T=this.idle();if(T&&(m=this._updateAverageElevation(c,!0)),m)this.triggerRepaint();else if(this._triggerFrame(!1),T&&(this.fire(new o.A("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const S=this._calculateSpeedIndex();this.fire(new o.A("speedindexcompleted",{speedIndex:S})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||x||(this._fullyLoaded=!0,ri.mark(ft.fullLoad),this._performanceMetricsCollection&&Ln(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())}
2661_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(){Jo(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,l=>{if(l&&(l.message===Jr||l.status===401)){const t=this.painter.context.gl;Zn(t,!1),this._logoControl instanceof ru&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new o.z(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),Ko(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&_r(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){const l=this._isDragging();this.painter.updateTerrain(this.style,l)}_calculateSpeedIndex(){const l=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const n=this.painter.context.gl,c=n.createFramebuffer();function d(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 y=0;for(let x=0;x<m.length;x+=4)m[x]===l[x]&&m[x+1]===l[x+1]&&m[x+2]===l[x+2]&&m[x+3]===l[x+3]&&(y+=1);c+=(n[p+2]-n[p+1])*(1-y/d)}return c}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.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),ms.delete(this.painter.context.gl),Gi.remove(),Yo.remove(),this._removed=!0,this.fire(new o.A("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(l){this._renderNextFrame=this._renderNextFrame||l,this.style&&!this._frame&&(this._frame=o.q.frame(t=>{const n=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,n&&this._render(t)}))}_preloadTiles(l){const t=this.style?this.style.getSourceCaches():[];return o.bt(t,(n,c)=>n._preloadTiles(l,c),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(l){this._trackResize&&this.resize({originalEvent:l})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(l){this._showTileBoundaries!==l&&(this._showTileBoundaries=l,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(l){this._showParseStatus!==l&&(this._showParseStatus=l,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(l){this._showTerrainWireframe!==l&&(this._showTerrainWireframe=l,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(l){this._showLayers2DWireframe!==l&&(this._showLayers2DWireframe=l,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(l){this._showLayers3DWireframe!==l&&(this._showLayers3DWireframe=l,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(l){this._speedIndexTiming!==l&&(this._speedIndexTiming=l,this._update())}get showPadding(){return!!this._showPadding}set showPadding(l){this._showPadding!==l&&(this._showPadding=l,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(l){this._showCollisionBoxes!==l&&(this._showCollisionBoxes=l,this._tp.refreshUI(),l?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(l){this._showOverdrawInspector!==l&&(this._showOverdrawInspector=l,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(l){this._repaint!==l&&(this._repaint=l,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(l){this._vertices=l,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(l){this._showTileAABBs!==l&&(this._showTileAABBs=l,this._tp.refreshUI(),l&&this._update())}_setCacheLimits(l,t){o.eJ(l,t)}get version(){return Gt}},NavigationControl:class{constructor(l={}){this.options=o.h({},_p,l),this._container=Dt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(o.aV(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",t=>{this._map&&this._map.zoomIn({},{originalEvent:t})}),Dt("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})}),Dt("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(o.aV(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",t=>{const n=this._map;n&&(this.options.visualizePitch?n.resetNorthPitch({},{originalEvent:t}):n.resetNorth({},{originalEvent:t}))}),this._compassIcon=Dt("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map;if(!l)return;
vendor: 4,341 bytes, line 2661
2661const 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 tm(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=Dt("button",l,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(l,t){if(!this._map)return;const n=this._map._getUIString(`NavigationControl.${t}`);l.setAttribute("aria-label",n),l.firstElementChild&&l.firstElementChild.setAttribute("title",n)}},GeolocateControl:class extends o.E{constructor(l={}){super();const t=navigator.geolocation;this.options=o.h({geolocation:t},Ch,l),o.aV(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=ro(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(l){return this._map=l,this._container=Dt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(l){const t=(n=!!this.options.geolocation)=>{this._supportsGeolocation=n,l(n)};this._supportsGeolocation!==void 0?l(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(n=>t(n.state!=="denied")).catch(()=>t()):t()}_isOutOfMapMaxBounds(l){const t=this._map.getMaxBounds(),n=l.coords;return!!t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(l){if(this._map){if(this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new o.A("outofmaxbounds",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
2661RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(l),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(l),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new o.A("geolocate",l)),this._finish()}}_updateCamera(l){const t=new o.cd(l.coords.longitude,l.coords.latitude),n=l.coords.accuracy,c=this._map.getBearing(),d=o.h({bearing:c},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),d,{geolocateSource:!0})}_updateMarker(l){if(l){const t=new o.cd(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const l=this._map.transform,t=o.c6(1,l._center.lat)*l.worldSize,n=Math.ceil(2*this._accuracy*t);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(l){if(this._map){if(this.options.trackUserLocation)if(l.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new o.A("error",l)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(l){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=Dt("button","mapboxgl-ctrl-geolocate",this._container),Dt("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
2661se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Dt("div","mapboxgl-user-location"),this._dotElement.appendChild(Dt("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(Dt("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new ql({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=Dt("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ql({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new o.A("trackuserlocationend")))})}}_onDeviceOrientation(l){this._userLocationDotMarker&&(l.webkitCompassHeading?this._heading=l.webkitCompassHeading:l.absolute===!0&&(this._heading=-1*l.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return o.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new o.A("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new o.A("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new o.A("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let l;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(l={maximumAge:6e5,timeout:0},this._noTimeout=!0):(l=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,l),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const l=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(t=>{t==="granted"&&l()}).catch(console.error):l()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
2661se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Ah,ScaleControl:class{constructor(l={}){this.options=o.h({},$l,l),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch{return!1}}(),o.aV(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const l=this.options.maxWidth||100,t=this._map,n=t._containerHeight/2,c=t._containerWidth/2-l/2,d=t.unproject([c,n]),p=t.unproject([c+l,n]),m=d.distanceTo(p);if(this.options.unit==="imperial"){const y=3.2808*m;y>5280?this._setScale(l,y/5280,"mile"):this._setScale(l,y,"foot")}else this.options.unit==="nautical"?this._setScale(l,m/1852,"nautical-mile"):m>=1e3?this._setScale(l,m/1e3,"kilometer"):this._setScale(l,m,"meter")}_setScale(l,t,n){this._map._requestDomTask(()=>{const c=function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let y=p/m;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T}(y),m*y}(t),d=c/t;this._container.innerHTML=this._isNumberFormatSupported&&n!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:n}).format(c):`${c} ${Oa[n]}`,this._container.style.width=l*d+"px"})}onAdd(l){return this._map=l,this._language=l.getLanguage(),this._container=Dt("div","mapboxgl-ctrl mapboxgl-ctrl-scale",l.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(l){this._language=l,this._update()}setUnit(l){this.options.unit=l,this._update()}},FullscreenControl:class{constructor(l={}){this._fullscreen=!1,l&&l.container&&(l.container instanceof HTMLElement?this._container=l.container:o.w("Full screen control 'container' must be a DOM element.")),o.aV(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=Dt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",o.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const l=this._fullscreenButton=Dt("button","mapboxgl-ctrl-fullscreen",this._controlContainer);Dt("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()}},Popup:class extends o.E{constructor(l){super(),this.options=o.h(Object.create(zs),l),this._altitude=this.options.altitude,o.aV(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(l&&l.className?l.className.trim().split(/\s+/):[])}addTo(l){return this._map&&this.remove(),this._map=l,this.options.closeOnClick&&l.on("preclick",this._onClose),this.options.closeOnMove&&l.on("move",this._onClose),l.on("remove",this.remove),this._update(),l._addPopup(this),this._focusFirstElement(),this._trackPointer?(l.on("mousemove",this._onMouseEvent),l.on("mouseup",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")):l.on("move",this._update),this.fire(new o.A("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const l=this._map;return l&&(l.off("move",this._update),l.off("move",this._onClose),l.off("preclick",this._onClose),l.off("click",this._onClose),l.off("remove",this.remove),l.off("mousemove",this._onMouseEvent),l.off("mouseup",this._onMouseEvent),l.off("drag",this._onMouseEvent),l._canvasContainer&&l._canvasContainer.classList.remove("mapboxgl-track-pointer"),l._removePopup(this),this._map=void 0),this.fire(new o.A("close")),this}getLngLat(){return this._lngLat}setLngLat(l){this._lngLat=o.cd.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;
2661)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=Dt("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(l),this.options.closeButton){const n=this._closeButton=Dt("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,y=c.x>t.transform.width-d/2;if(c.y+l<p)return m?"top-left":y?"top-right":"top";if(c.y>t.transform.height-p){if(m)return"bottom-left";if(y)return"bottom-right"}return m?"left":y?"right":"bottom"}_updateClassList(){const l=this._container;if(!l)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),l.className=t.join(" ")}_update(l){const t=this._map,n=this._content;if(!t||!this._lngLat&&!this._trackPointer||!n)return;let c=this._container;if(c||(c=this._container=Dt("div","mapboxgl-popup",t.getContainer()),this._tip=Dt("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=ka(this._lngLat,this._pos,t.transform)),!this._trackPointer||l){const d=this._pos=this._trackPointer&&l instanceof o.P?l:t.project(this._lngLat,this._altitude),p=Un(this.options.offset),m=this._anchor=this._getAnchor(p.y),y=Un(this.options.offset,m),x=d.add(y).round();t._requestDomTask(()=>{this._container&&m&&(this._container.style.transform=`${Mh[m]} translate(${x.x}px,${x.y}px)`)})}if(!this._marker&&t._showingGlobe()){const d=o.eK(t.transform,this._lngLat)?0:1;this._setOpacity(d)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(Jn);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:ql,Style:Wr,LngLat:o.cd,LngLatBounds:o.aG,Point:o.P,MercatorCoordinate:o.ac,FreeCameraOptions:vd,Evented:o.E,config:o.e,prewarm:o.eO,clearPrewarmedResources:o.eN,get accessToken(){return o.e.ACCESS_TOKEN},set accessToken(l){o.e.ACCESS_TOKEN=l},get baseApiUrl(){return o.e.API_URL},set baseApiUrl(l){o.e.API_URL=l},get workerCount(){return o.eX.workerCount},set workerCount(l){o.eX.workerCount=l},get maxParallelImageRequests(){return o.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){o.e.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){o.eW(l)},get workerUrl(){return o.eV.workerUrl},set workerUrl(l){o.eV.workerUrl=l},get workerClass(){return o.eV.workerClass},set workerClass(l){o.eV.workerClass=l},get workerParams(){return o.eV.workerParams},set workerParams(l){o.eV.workerParams=l},get dracoUrl(){return o.eU()},set dracoUrl(l){o.eT(l)},get meshoptUrl(){return o.eS()},set meshoptUrl(l){o.eR(l)},setNow:o.q.setNow,restoreNow:o.q.restoreNow}});var jt=ji;return jt})}(mf)),mf.exports}var Pw=Cw();const Wo=ow(Pw),zw=I_({});function gf(){return zw}function _f(ht){var xi;const Et=gf();if(!Et)return Xa();const mt=I_((xi=Et.value[ht])==null?void 0:xi.map);return rs(Et,()=>{var ji;mt.value=(ji=Et.value[ht])==null?void 0:ji.map,Zo(mt)}),mt}function E_(ht){return _f(ht)}function Rw(ht){return _d(()=>{var mt;return(mt=gf())==null?void 0:mt.value[ht]})}function Dw(ht){var Et;(Et=gf())==null||delete Et.value[ht]}function Sv(ht,Et){function mt(gt){var jt;return(jt=gt==null?void 0:gt.value)!=null&&jt.map?(gt.value.map&>.value.loaded?Et(gt.value.map):S_(()=>{var o;return(o=gt.value)==null?void 0:o.loaded},()=>{var o;(o=gt.value)!=null&&o.loaded&&Et(gt.value.map)}),!0):!1}const xi=Rw(ht);mt(xi)||S_(xi,()=>{var gt;(gt=xi.value)!=null&>.map&&mt(xi)})}function pd(ht){return _d(()=>md("mapbox_marker_instances",()=>({})).value[ht])}function Lw(ht,Et){const mt=pd(ht);mt.value?Et(mt.value):rs(()=>mt.value,()=>
2661{mt.value&&Et(mt.value)})}function Ev(ht,Et,mt,xi,ji=""){if(pd(ht).value)return console.warn(`Mapbox marker with ID '${ht}' was initialized multiple times. This can cause unexpected behaviour.`),pd(ht);const gt=Xa(),jt=Jb("MapID");function o(){const Gt=bv(Et)?Et.value:Et;if(mt)return bw(mt,()=>{if(mt.value){mt.value.hidden=!1;const ft=md("mapbox_marker_instances",()=>({}));ft.value[ht]=new Wo.Marker({element:mt.value,...Gt}),gt.value=ft.value[ht],Sv(jt||ji,ri=>{var oi;gt.value&&((oi=gt==null?void 0:gt.value)==null||oi.setLngLat(Gt.lnglat).addTo(ri))})}},{immediate:!0}),gt;{const ft=md("mapbox_marker_instances",()=>({}));ft.value[ht]=new Wo.Marker(Gt);const ri=ft.value[ht];return Sv(jt||ji,oi=>{ri.setLngLat(Gt.lnglat).addTo(oi)}),ri}}return bv(Et)&&(rs(Et,(Gt,ft)=>{var oi,sr,pr,Kr,Dt,Tr,zi;const ri=pd(ht);Gt.draggable!==(ft==null?void 0:ft.draggable)&&Gt.draggable!==void 0&&((oi=ri.value)==null||oi.setDraggable(Gt.draggable)),Gt.offset!==(ft==null?void 0:ft.offset)&&Gt.offset!==void 0&&((sr=ri.value)==null||sr.setOffset(Gt.offset)),Gt.pitchAlignment!==(ft==null?void 0:ft.pitchAlignment)&&Gt.pitchAlignment!==void 0&&((
2661pr=ri.value)==null||pr.setPitchAlignment(Gt.pitchAlignment)),Gt.rotationAlignment!==(ft==null?void 0:ft.rotationAlignment)&&Gt.rotationAlignment!==void 0&&((Kr=ri.value)==null||Kr.setRotationAlignment(Gt.rotationAlignment)),Gt.rotation!==(ft==null?void 0:ft.rotation)&&Gt.rotation!==void 0&&((Dt=ri.value)==null||Dt.setRotation(Gt.rotation)),((Tr=ri.value)==null?void 0:Tr.getLngLat())!==Et.value.lnglat&&((zi=ri.value)==null||zi.setLngLat(Et.value.lnglat))},{deep:!0}),Lw(ht,Gt=>{Gt.on("drag",()=>{const ft=Gt.getLngLat();Array.isArray(Et.value.lnglat)?Et.value.lnglat=ft.toArray():Et.value.lnglat=ft})})),Cv(()=>{const Gt=pd(ht);if(Gt.value){Gt.value.remove();const ft=md("mapbox_marker_instances",()=>({}));delete ft.value[ht]}}),o()}const Fw=Pv({__name:"DefaultMarker",props:{markerId:{},options:{default:()=>({})},lnglat:{}},emits:["dragstart","drag","dragend","update:lnglat"],setup(ht,{emit:Et}){const mt=ht,xi=Et,ji=Aw(mt,"lnglat",xi),gt=Xa();zv("MarkerRef",gt);const jt=Xa({...mt.options,lnglat:ji.value});rs(()=>jt.value.lnglat,()=>{ji.value=jt.value.lnglat}),rs(mt,()=>{jt.value={...mt.options,lnglat:ji.value}});const o=Xa(null),Gt=Qb();return A_(()=>{Gt.marker?vw(Ev(mt.markerId,jt,o),gt):gt.value=Ev(mt.markerId,jt);const ft=gt.value;ji&&(ft==null||ft.setLngLat(ji.value)),ft==null||ft.on("dragstart",()=>{xi("dragstart",ft)}),ft==null||ft.on("drag",()=>{xi("drag",ft)}),ft==null||ft.on("dragend",()=>{xi("dragend",ft)})}),(ft,ri)=>(En(),is(fd,null,[ri[0]||(ri[0]=Ur("div",null,null,-1)),Ur("div",{ref_key:"customHTMLRef",ref:o,hidden:""},[w_(ft.$slots,"marker")],512),w_(ft.$slots,"default")],64))}});function kw(){const ht=md("mapbox_init",()=>!1);if(ht.value)return;ht.value=!0;const Et=aw();if(Wo.accessToken=Et.public.mapbox.accessToken,Et.public.mapbox.baseApiUrl&&(Wo.baseApiUrl=Et.public.mapbox.baseApiUrl),Et.public.mapbox.workerUrl&&(Wo.workerUrl=Et.public.mapbox.workerUrl),Et.public.mapbox.workerCount&&(Wo.workerCount=Et.public.mapbox.workerCount),Et.public.mapbox.prewarm&&Wo.prewarm(),Et.public.mapbox.RTLTextPlugin){const mt="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js";typeof Et.public.mapbox.RTLTextPlugin=="boolean"&&(Et.public.mapbox.RTLTextPlugin={pluginURL:mt,lazy:!1}),Wo.setRTLTextPlugin(Et.public.mapbox.RTLTextPlugin.pluginURL||mt,()=>{},Et.public.mapbox.RTLTextPlugin.lazy||!1)}}function Ow(ht,Et={container:ht}){kw();const mt=gf();return mt?mt.value[ht]?(console.warn(`Mapbox instance with key '${ht}' was initialized multiple times. This can cause unexpected behaviour.`),E_(ht)):(mt.value[ht]=ew({map:new Wo.Map(Et),loaded:!1}),mt.value[ht].map.on("load",()=>{mt.value[ht].loaded=!0,Zo(mt),mt.value[ht]&&Zo(ff(mt.value[ht]))}),mt.value[ht].map.on("style.load",()=>{mt.value[ht].loaded=!0,Zo(mt),mt.value[ht]&&Zo(ff(mt.value[ht]))}),mt.value[ht].map.on("idle",()=>{Zo(mt),mt.value[ht]&&Zo(ff(mt.value[ht]))}),mt.value[ht].map.on("data",()=>{Zo(mt),mt.value[ht]&&Zo(ff(mt.value[ht]))}),E_(ht)):Xa()}function Bw(ht,Et){const mt=E_(ht);if(mt.value)return Et(mt.value);S_(mt,()=>{mt.value&&Et(mt.value)})}const Nw=["id"],Vw=Pv({__name:"Map",props:{mapId:{},options:{},onError:{type:Function},onLoad:{type:Function},onIdle:{type:Function},onRemove:{type:Function},onRender:{type:Function},onResize:{type:Function},onWebglcontextlost:{type:Function},onWebglcontextrestored:{type:Function},onDataloading:{type:Function},onData:{type:Function},onTiledataloading:{type:Function},onSourcedataloading:{type:Function},onStyledataloading:{type:Function},onStyleImageMissing:{type:Function},onStyleload:{type:Function},onStyleimportload:{type:Function},onSourcedata:{type:Function},onStyledata:{type:Function},onBoxzoomcancel:{type:Function},onBoxzoomstart:{type:Function},onBoxzoomend:{type:Function},onTouchcancel:{type:Function},onTouchmove:{type:Function},onTouchend:{type:Function},onTouchstart:{type:Function},onClick:{type:Function},onContextmenu:{type:Function},onDblclick:{type:Function},onMousemove:{type:Function},onMouseup:{type:Function},onMousedown:{type:Function},onMouseout:{type:Function},onMouseover:{type:Function},onMovestart:{type:Function},onMove:{type:Function},onMoveend:{type:Function},onZoomstart:{type:Function},onZoom:{type:Function},onZoomend:{type:Function},onRotatestart:{type:Function},onRotate:{type:Function},onRotateend:{type:Function},onDragstart:{type:Function},onDrag:{type:Function},onDragend:{type:Function},onPitchstart:{type:Function},onPitch:{type:Function},onPitchend:{type:Function},onWheel:{type:Function}},emits:["resize","remove","load","render","idle","error","webglcontextlost","webglcontextrestored","data","styledata","sourcedata","dataloading","styledataloading","sourcedataloading","styleimagemissing","styleload","styleimportload","movestart","move","moveend","drag","dragend","zoomstart","zoom","zoomend","rotatestart","rotate","rotateend","pitchstart","pitch","pitchend","boxzoomstart","boxzoomend","boxzoomcancel","mousedown","mouseup","mouseover","mousemove","preclick","click","dblclick","mouseout","contextmenu","wheel","touchstart","touchend","touchmove","touchcancel"],setup(ht,{emit:Et}){const mt=ht,xi=Et;zv("MapID",mt.mapId),rs(()=>Object.entries(mt).filter(gt=>gt[0].toString().startsWith("on")),gt=>{for(const[jt,o]of gt)if(o){const Gt=["resize","remove","load","render","idle","error","webglcontextlost","webglcontextrestored"],ft=jt.toString().replace("on","").toLowerCase();let ri=ft;ft==="styleload"&&(ri="style.load"),ft==="styleimportload"&&(ri="style.import.load"),Bw(mt.mapId,oi=>{oi.on(ri,sr=>{xi(ft,Gt.includes(ft)?oi:sr)})})}},{immediate:!0}),rs(()=>
2661mt.options,(gt,jt)=>{var Gt,ft,ri,oi,sr,pr,Kr,Dt,Tr;const o=_f(mt.mapId);gt&&(gt.style&&(jt==null?void 0:jt.style)!==gt.style&&((Gt=o.value)==null||Gt.setStyle(gt.style)),gt.center&&(jt==null?void 0:jt.center)!==gt.center&&((ft=o.value)==null||ft.setCenter(gt.center)),gt.zoom&&(jt==null?void 0:jt.zoom)!==gt.zoom&&((ri=o.value)==null||ri.setZoom(gt.zoom)),gt.projection&&(jt==null?void 0:jt.projection)!==gt.projection&&((oi=o.value)==null||oi.setProjection(gt.projection)),gt.bearing&&(jt==null?void 0:jt.bearing)!==gt.bearing&&((sr=o.value)==null||sr.setBearing(gt.bearing)),gt.pitch&&(jt==null?void 0:jt.pitch)!==gt.pitch&&((pr=o.value)==null||pr.setPitch(gt.pitch)),gt.minZoom&&(jt==null?void 0:jt.minZoom)!==gt.minZoom&&((Kr=o.value)==null||Kr.setMinZoom(gt.minZoom)),gt.maxZoom&&(jt==null?void 0:jt.maxZoom)!==gt.maxZoom&&((Dt=o.value)==null||Dt.setMaxZoom(gt.maxZoom)),gt.bounds&&(jt==null?void 0:jt.bounds)!==gt.bounds&&((Tr=o.value)==null||Tr.fitBounds(gt.bounds)))});const ji=Xa();return A_(()=>{let gt=_f(mt.mapId);gt.value||(gt=Ow(mt.mapId,{...mt.options,container:ji.value||mt.mapId})),Iw(ji,()=>{setTimeout(()=>{var jt;return(jt=gt.value)==null?void 0:jt.resize()},0)})}),Cv(()=>{Dw(mt.mapId)}),(gt,jt)=>(En(),is(fd,null,[Ur("div",{id:gt.mapId,ref_key:"mapContainerRef",ref:ji,class:Rv(["mapboxgl-default-map-size",gt.$attrs.class]),style:tw(gt.$attrs.style)},null,14,Nw),w_(gt.$slots,"default")],64))}}),Uw=["innerHTML"],jw={class:"leading-relaxed"},Gw={key:0},qw={key:1,class:"mt-1"},$w=["href"],Zw={key:2,class:"mt-1"},Hw=["href"],Ww={__name:"Store",props:{store:{type:Object,required:!0}},setup(ht){const{t:Et}=M_();return(mt,xi)=>{var ji,gt,jt,o;return En(),is("div",{"card-store":"",class:Rv(["bg-green-100 p-6 rounded-4xl text-gray-800",{"bg-green-500 text-white font-[600]":(ji=ht.store.locationsFields)==null?void 0:ji.mainLocations}])},[Ur("h2",{class:"mb-3.5 text-xs-mob md:text-xs",innerHTML:ht.store.title},null,8,Uw),Ur("div",jw,[(gt=ht.store.locationsFields)!=null&>.address?(En(),is("span",Gw,Ho(nc(Et)("contacts.address"))+": "+Ho(ht.store.locationsFields.address),1)):y_("",!0),xi[0]||(xi[0]=Ur("br",null,null,-1)),(jt=ht.store.locationsFields)!=null&&jt.phone?(En(),is("div",qw,[Ur("a",{href:`tel:${ht.store.locationsFields.phone}`,class:"relative inline-block min-h-[24px]"},Ho(nc(Et)("contacts.phone"))+": "+Ho(ht.store.locationsFields.phone),9,$w)])):y_("",!0),(o=ht.store.locationsFields)!=null&&o.phone2?(En(),is("div",Zw,[Ur("a",{href:`tel:${ht.store.locationsFields.phone2}`,class:"relative inline-block min-h-[24px]"},Ho(nc(Et)("contacts.phone"))+": "+Ho(ht.store.locationsFields.phone2),9,Hw)])):y_("",!0)])],2)}}},Xw={class:"container store-locator-container relative flex gap-x-8 max-h-[550px] md:h-[550px]"},Yw={map:"",class:"w-full"},Kw={width:"27",height:"34",viewBox:"0 0 27 34",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Jw=["fill","stroke"],Qw={class:"list-store overflow-y-auto pr-4"},eT={__name:"StoreLocator",props:{stores:{type:Array,default:()=>[]}},setup(ht){const{t:Et}=M_(),mt=_f("storeLocator"),xi=(gt,jt)=>{var o;(o=mt.value)==null||o.flyTo({center:[gt,jt],zoom:12,speed:1})},ji=gt=>{xi(gt.locationsFields.lng,gt.locationsFields.lat)};return(gt,jt)=>{const o=Fw,Gt=Vw,ft=dw,ri=Ww;return En(),is("div",Xw,[T_(ft,null,{default:x_(()=>[Ur("div",Yw,[T_(Gt,{"map-id":"storeLocator",class:"w-full h-full rounded-xl hidden md:block !overflow-hidden !relative",options:{style:"mapbox://styles/mapbox/light-v11",center:[12.14,45.51],zoom:4}},{default:x_(()=>[(En(!0),is(fd,null,v_(ht.stores,(oi,sr)=>(En(),b_(o,{key:oi.title+oi.databaseId+"-"+sr,"marker-id":oi.title+oi.databaseId,options:{},lnglat:[oi.locationsFields.lng,oi.locationsFields.lat]},{marker:x_(()=>[(En(),is("svg",Kw,[Ur("path",{d:"M3.78373 22.4068L3.78384 22.4067L3.77625 22.3978C2.03688 20.3607 0.932687 17.8486 0.603462 15.1777C0.274292 12.5073 0.734656 9.79837 1.92622 7.3922C2.87085 5.51229 4.26763 3.90284 5.98783 2.71129C7.70833 1.51953 9.69731 0.783937 11.772 0.571667C12.715 0.476111 13.665 0.476111 14.608 0.571667C16.6827 0.783791 18.6717 1.5194 20.3922 2.7113C22.1123 3.90299 23.5089 5.51269 24.4531 7.39285C25.6447 9.79891 26.105 12.5077 25.7758 15.178C25.4466 17.8488 24.3424 20.3608 22.6031 22.3978L22.603 22.3977L22.5956 22.4068L13.802 33.207L13.8019 33.2071C13.727 33.2992 13.6331 33.3729 13.5273 33.4234C13.4215 33.4739 13.3062 33.5 13.1897 33.5C13.0731 33.5 12.9578 33.4739 12.852 33.4234C12.7462 33.3729 12.6524 33.2992 12.5775 33.2071L12.5774 33.207L3.78373 22.4068ZM13.1897 18.807H13.1903C14.6971 18.8052 16.1408 18.1997 17.2047 17.1249C18.2685 16.0502 18.866 14.5943 18.8678 13.0767V13.0761C18.8678 11.9438 18.5354 10.8365 17.9122 9.89416C17.2888 8.9518 16.4024 8.21655 15.3643 7.78217C14.3261 7.34776 13.1834 7.23402 12.081 7.45555C10.9785 7.67706 9.9666 8.22372 9.17283 9.02557C8.37912 9.82737 7.83916 10.8483 7.62045 11.959C7.40175 13.0697 7.51395 14.221 7.94308 15.2676C8.37222 16.3142 9.09929 17.2095 10.0331 17.8399C10.967 18.4702 12.0655 18.807 13.1897 18.807Z",fill:oi.locationsFields.mainLocations?"#1D9947":"#D3EFD3",stroke:oi.locationsFields.mainLocations?"#214725":"#D3EFD3"},null,8,Jw)]))]),_:2},1032,["marker-id","lnglat"]))),128))]),_:1})])]),_:1}
2661),Ur("div",Qw,[(En(!0),is(fd,null,v_(ht.stores.filter(oi=>oi.locationsFields.mainLocations),(oi,sr)=>(En(),b_(ri,{key:sr,store:oi,class:"cursor-pointer mb-3",onClick:pr=>ji(oi)},null,8,["store","onClick"]))),128)),(En(!0),is(fd,null,v_(ht.stores.filter(oi=>!oi.locationsFields.mainLocations),(oi,sr)=>(En(),b_(ri,{key:sr,store:oi,class:"cursor-pointer mb-3",onClick:pr=>ji(oi)},null,8,["store","onClick"]))),128))])])}}},tT=lw("/images/3ds/contacts-3d.png"),iT={class:"pt-28 md:pt-56 container relative overflow-x-hidden"},rT={class:"text-xxl-mob md:text-xxl text-green-400 font-bold"},nT={class:"cards mt-10 md:my-16 grid md:grid-cols-3 gap-3.5 md:gap-12"},sT={class:"card-contact relative bg-gray-100 rounded-4xl px-8 py-6 md:py-10 overflow-hidden",role:"none"},oT={class:"content",role:"none"},aT={class:"mb-3"},lT={class:"card-contact relative bg-gray-100 rounded-4xl px-8 py-6 md:py-10 overflow-hidden",role:"none"},cT={class:"content",role:"none"},uT={class:"mb-3"},hT={__name:"contacts",async setup(ht){let Et,mt;const{t:xi,locale:ji}=M_(),gt=cw({}),{data:jt}=([Et,mt]=iw(()=>pw("getLocations",{language:ji.value.toUpperCase()})),Et=await Et,mt(),Et),o=jt.value.locations.nodes;uw({title:xi("contacts.seo.title"),ogTitle:xi("contacts.seo.title"),description:xi("contacts.seo.description"),ogDescription:xi("contacts.seo.description"),ogImage:"og-image.jpg",ogType:"website",twitterCard:"summary_large_image"});let Gt=gt.value.link;return Gt=Gt.map(ft=>(ft.rel==="alternate"&&ft.hreflang==="x-default"&&(ft.href="https://www.pometon.com/"+fw.contacts.en),ft)),hw({link:Gt}),(ft,ri)=>{const oi=eT,sr=rw("title-reveal");return En(),is("section",iT,[nw((En(),is("h1",rT,[sw(Ho(nc(xi)("contacts.title")),1)])),[[sr]]),Ur("section",nT,[Ur("div",sT,[Ur("div",oT,[Ur("p",aT,Ho(nc(xi)("contacts.address")),1),ri[0]||(ri[0]=Ur("p",{class:"text-xs-mob md:text-xs"}," Via Circonvallazione, 62 I-30030 Maerne, Italy ",-1))])]),Ur("div",lT,[Ur("div",cT,[Ur("p",uT,Ho(nc(xi)("contacts.phone")),1),ri[1]||(ri[1]=Ur("a",{href:"tel:+390412903611",class:"text-xs-mob md:text-xs"},"+39 041 290 3611",-1))])])]),ri[2]||(ri[2]=Ur("img",{src:tT,alt:"Contacts Icon 3d",class:"relative md:absolute ml-auto md:ml-0 -mt-[25%] md:mt-0 -right-20 md:-right-16 md:top-[10%] max-w-56 md:max-w-[350px] w-full object-cover"},null,-1)),T_(oi,{class:"mb-10 md:mb-36",stores:nc(o)},null,8,["stores"])])}}},yT=mw(hT,[["__scopeId","data-v-5f4a2ff1"]]);export{yT 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.