@arenarium/maps 1.0.71 → 1.0.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,8 +2,8 @@
2
2
  \r\f \v\uFEFF`];function V_(v,g,b){var I=v==null?"":""+v;if(b){for(var z in b)if(b[z])I=I?I+" "+z:z;else if(I.length)for(var B=z.length,S=0;(S=I.indexOf(z,S))>=0;){var o=S+B;(S===0||Mf.includes(I[S-1]))&&(o===I.length||Mf.includes(I[o]))?I=(S===0?"":I.substring(0,S))+I.substring(o+1):S=o}}return I===""?null:I}function Sf(v,g=!1){var b=g?" !important;":";",I="";for(var z in v){var B=v[z];B!=null&&B!==""&&(I+=" "+z+": "+B+b)}return I}function hd(v){return v[0]!=="-"||v[1]!=="-"?v.toLowerCase():v}function U_(v,g){if(g){var b="",I,z;if(Array.isArray(g)?(I=g[0],z=g[1]):I=g,v){v=String(v).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var B=!1,S=0,o=!1,he=[];I&&he.push(...Object.keys(I).map(hd)),z&&he.push(...Object.keys(z).map(hd));var me=0,Pe=-1;const Bt=v.length;for(var Be=0;Be<Bt;Be++){var Ee=v[Be];if(o?Ee==="/"&&v[Be-1]==="*"&&(o=!1):B?B===Ee&&(B=!1):Ee==="/"&&v[Be+1]==="*"?o=!0:Ee==='"'||Ee==="'"?B=Ee:Ee==="("?S++:Ee===")"&&S--,!o&&B===!1&&S===0){if(Ee===":"&&Pe===-1)Pe=Be;else if(Ee===";"||Be===Bt-1){if(Pe!==-1){var le=hd(v.substring(me,Pe).trim());if(!he.includes(le)){Ee!==";"&&Be++;var Fe=v.substring(me,Be).trim();b+=" "+Fe+";"}}me=Be+1,Pe=-1}}}}return I&&(b+=Sf(I)),z&&(b+=Sf(z,!0)),b=b.trim(),b===""?null:b}return v==null?null:String(v)}function Pf(v,g,b,I,z,B){var S=v.__className;if(S!==b||S===void 0){var o=V_(b,I,B);o==null?v.removeAttribute("class"):v.className=o,v.__className=b}else if(B&&z!==B)for(var he in B){var me=!!B[he];(z==null||me!==!!z[he])&&v.classList.toggle(he,me)}return B}function dd(v,g={},b,I){for(var z in b){var B=b[z];g[z]!==B&&(b[z]==null?v.style.removeProperty(z):v.style.setProperty(z,B,I))}}function Pu(v,g,b,I){var z=v.__style;if(z!==g){var B=U_(g,I);B==null?v.removeAttribute("style"):v.style.cssText=B,v.__style=g}else I&&(Array.isArray(I)?(dd(v,b==null?void 0:b[0],I[0]),dd(v,b==null?void 0:b[1],I[1],"important")):dd(v,b,I));return I}const $_=()=>performance.now(),Vn={tick:v=>requestAnimationFrame(v),now:()=>$_(),tasks:new Set};function Cf(){const v=Vn.now();Vn.tasks.forEach(g=>{g.c(v)||(Vn.tasks.delete(g),g.f())}),Vn.tasks.size!==0&&Vn.tick(Cf)}function G_(v){let g;return Vn.tasks.size===0&&Vn.tick(Cf),{promise:new Promise(b=>{Vn.tasks.add(g={c:v,f:b})}),abort(){Vn.tasks.delete(g)}}}const ju=class ju{constructor(g){Ea(this,Ou);Ea(this,Oa,new WeakMap);Ea(this,So);Ea(this,ql);nu(this,ql,g)}observe(g,b){var I=Ci(this,Oa).get(g)||new Set;return I.add(b),Ci(this,Oa).set(g,I),Vg(this,Ou,Ug).call(this).observe(g,Ci(this,ql)),()=>{var z=Ci(this,Oa).get(g);z.delete(b),z.size===0&&(Ci(this,Oa).delete(g),Ci(this,So).unobserve(g))}}};Oa=new WeakMap,So=new WeakMap,ql=new WeakMap,Ou=new WeakSet,Ug=function(){return Ci(this,So)??nu(this,So,new ResizeObserver(g=>{for(var b of g){ju.entries.set(b.target,b);for(var I of Ci(this,Oa).get(b.target)||[])I(b)}}))},qt(ju,"entries",new WeakMap);let pd=ju;var q_=new pd({box:"border-box"});function Cu(v,g,b){var I=q_.observe(v,()=>b(v[g]));_u(()=>(sd(()=>b(v[g])),I))}function If(v,g){return v===g||(v==null?void 0:v[hu])===g}function yo(v={},g,b,I){return _u(()=>{var z,B;return uf(()=>{z=B,B=[],sd(()=>{v!==b(...B)&&(g(v,...B),z&&If(b(...z),v)&&g(null,...z))})}),()=>{mf(()=>{B&&If(b(...B),v)&&g(null,...B)})}}),v}function Ef(v){Zr===null&&l_(),go(()=>{const g=sd(v);if(typeof g=="function")return g})}const H_="5";typeof window<"u"&&((em=window.__svelte??(window.__svelte={})).v??(em.v=new Set)).add(H_);function Af(v){return Object.prototype.toString.call(v)==="[object Date]"}function W_(v){return v}function X_(v){return-.5*(Math.cos(Math.PI*v)-1)}function fd(v,g){if(v===g||v!==v)return()=>v;const b=typeof v;if(b!==typeof g||Array.isArray(v)!==Array.isArray(g))throw new Error("Cannot interpolate values of different type");if(Array.isArray(v)){const I=g.map((z,B)=>fd(v[B],z));return z=>I.map(B=>B(z))}if(b==="object"){if(!v||!g)throw new Error("Object cannot be null");if(Af(v)&&Af(g)){const B=v.getTime(),o=g.getTime()-B;return he=>new Date(B+he*o)}const I=Object.keys(g),z={};return I.forEach(B=>{z[B]=fd(v[B],g[B])}),B=>{const S={};return I.forEach(o=>{S[o]=z[o](B)}),S}}if(b==="number"){const I=g-v;return z=>v+z*I}return()=>g}const Md=class Md{constructor(g,b={}){Ea(this,oa,ed(void 0));Ea(this,Po,ed(void 0));Ea(this,Hl);Ea(this,Ts,null);Ci(this,oa).v=Ci(this,Po).v=g,nu(this,Hl,b)}static of(g,b){const I=new Md(g(),b);return uf(()=>{I.set(g())}),I}set(g,b){var Be;di(Ci(this,Po),g);let{delay:I=0,duration:z=400,easing:B=W_,interpolate:S=fd}={...Ci(this,Hl),...b};if(z===0)return(Be=Ci(this,Ts))==null||Be.abort(),di(Ci(this,oa),g),Promise.resolve();const o=Vn.now()+I;let he,me=!1,Pe=Ci(this,Ts);return nu(this,Ts,G_(Ee=>{if(Ee<o)return!0;if(!me){me=!0;const Fe=Ci(this,oa).v;he=S(Fe,g),typeof z=="function"&&(z=z(Fe,g)),Pe==null||Pe.abort()}const le=Ee-o;return le>z?(di(Ci(this,oa),g),!1):(di(Ci(this,oa),he(B(le/z))),!0)})),Ci(this,Ts).promise}get current(){return ct(Ci(this,oa))}get target(){return ct(Ci(this,Po))}set target(g){this.set(g)}};oa=new WeakMap,Po=new WeakMap,Hl=new WeakMap,Ts=new WeakMap;let md=Md;function kf(v,g,b){const I=b*(Math.PI/180),z=v/2,B=g/2,S=Math.sqrt(z*z+B*B),o=Math.atan(B/z)*(180/Math.PI),he=o,me=180-o,Pe=180+o,Be=360-o;switch(!0){case(he<=b&&b<=me):return{offsetX:S*Math.cos(I)-z,offsetY:0};case(me<=b&&b<=Pe):return{offsetX:-v,offsetY:S*Math.sin(I)-B};case(Pe<=b&&b<=Be):return{offsetX:S*Math.cos(I)-z,offsetY:-g};default:return{offsetX:0,offsetY:S*Math.sin(I)-B}}}function K_(v,g,b){const I=kf(v,g,b),z=I.offsetX,B=I.offsetY,S=g,o=v,he=kf(S,o,b),me=S/2+he.offsetX,Pe=o/2+he.offsetY,Ee=Math.atan2(Pe,me)/Math.PI*180-45,le=0,Fe=30,Bt=z+v/2,fi=B+g/2,ti=Math.sqrt(Bt*Bt+fi*fi),yi=Math.min(v,g)/2,Ki=Math.sqrt(v*v+g*g)/2,Ft=(ti-yi)/(Ki-yi),It=le+Ft*(Fe-le);return{markerOffsetX:z,markerOffsetY:B,pinAngleDeg:Ee,pinSkewDeg:It}}const zf=512,gd=0,El=18,Rf=10,Df=3,Y_=.5,Lf=270,J_=8;var Q_=od('<div><div class="pin svelte-oqgycc"></div> <div class="marker svelte-oqgycc"><div class="body svelte-oqgycc"></div></div></div>');function ey(v,g){pu(g,!0);let b,I,z,B;const S=()=>B;let o=Zi(!0);function he(ot){di(o,ot,!0)}function me(){return ct(o)}let Pe=Zi(!0);function Be(ot){di(Pe,ot,!0)}function Ee(){return I?I.clientWidth==0&&I.clientHeight==0:!1}function le(){return I?I.clientWidth>0&&I.clientHeight>0:!1}let Fe=Lf,Bt=!1,fi=new md(Lf,{easing:X_,interpolate:ti});go(()=>{yi(fi.current)}),go(()=>{ct(o)==!1&&fi.set(Fe,{duration:0})});function ti(ot,Vi){if(Math.abs(Vi-ot)<180)return xi=>ot+xi*(Vi-ot);{const xi=360-Math.abs(Vi-ot),yr=ot<Vi?-1:1;return Et=>(360+ot+Et*xi*yr)%360}}function yi(ot){if(!b||!I||!z)return;const Vi=K_(ct(Ft),ct(It),ot),xi=Math.round(Vi.markerOffsetX),yr=Math.round(Vi.markerOffsetY);I.style.transform=`translate(${xi}px, ${yr}px)`;const Et=Vi.pinAngleDeg,Ar=Vi.pinSkewDeg;z.style.transform=`rotate(${Et}deg) skew(${Ar}deg, ${Ar}deg)`;const sr=-1-2*(xi/ct(Ft)),cn=-1-2*(yr/ct(It));b.style.filter=`drop-shadow(0px 0px 4px rgba(0,0,0,0.5)) drop-shadow(${sr}px ${cn}px 2px rgba(0,0,0,0.5))`}function Ki(ot){ot!=Fe&&(Fe=ot,fi.set(ot,{duration:Bt?400:0})),Bt=!0}let Ft=Zi(0),It=Zi(0);go(()=>{ct(Ft)&&ct(It)&&(z.style.width=`${Math.min(ct(Ft),ct(It))/4}px`,z.style.height=`${Math.min(ct(Ft),ct(It))/4}px`)}),go(()=>{ct(Ft)&&ct(It)&&yi(Fe)});const $t=()=>ct(Ft),_r=()=>ct(It);var jt=Q_();let Tn;var Mn=gu(jt);yo(Mn,ot=>z=ot,()=>z);var Yi=p_(Mn,2);Pu(Yi,"",{},{padding:J_+"px"});var ar=gu(Yi);let Ji;return yo(ar,ot=>B=ot,()=>B),yo(Yi,ot=>I=ot,()=>I),yo(jt,ot=>b=ot,()=>b),id(ot=>{Tn=Pf(jt,1,"anchor svelte-oqgycc",null,Tn,ot),Ji=Pu(ar,"",Ji,{width:`${g.width}px`,height:`${g.height}px`})},[()=>({collapsed:ct(Pe),hidden:!ct(o)})]),Cu(Yi,"clientWidth",ot=>di(Ft,ot)),Cu(Yi,"clientHeight",ot=>di(It,ot)),ld(v,jt),fu({getBody:S,setDisplayed:he,getDisplayed:me,setCollapsed:Be,getCollapsed:Ee,getExpanded:le,setAngle:Ki,getWidth:$t,getHeight:_r})}var ty=od('<div><div class="pin svelte-r58uhe"></div></div>');function iy(v,g){pu(g,!0);let b,I=Zi(!0),z=Zi(0),B=mu(()=>`translate(-50%, -50%) scale(${ct(z)})`),S=mu(()=>`brightness(${.4+.6*ct(z)})`);function o(Fe){di(I,Fe,!0)}function he(Fe){di(z,Fe,!0)}function me(){return b}var Pe=ty();let Be,Ee;var le=gu(Pe);return yo(le,Fe=>b=Fe,()=>b),id(Fe=>{Be=Pf(Pe,1,"circle svelte-r58uhe",null,Be,Fe),Ee=Pu(Pe,"",Ee,{transform:ct(B),filter:ct(S)})},[()=>({collapsed:ct(I)})]),ld(v,Pe),fu({setCollapsed:o,setScale:he,getPin:me})}function ry(v){return v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v.default:v}var Iu={exports:{}};/**
3
3
  * MapLibre GL JS
4
4
  * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.5.0/LICENSE.txt
5
- */var ny=Iu.exports,Bf;function ay(){return Bf||(Bf=1,function(v,g){(function(b,I){v.exports=I()})(ny,function(){var b={},I={};function z(S,o,he){if(I[S]=he,S==="index"){var me="var sharedModule = {}; ("+I.shared+")(sharedModule); ("+I.worker+")(sharedModule);",Pe={};return I.shared(Pe),I.index(b,Pe),typeof window<"u"&&b.setWorkerUrl(window.URL.createObjectURL(new Blob([me],{type:"text/javascript"}))),b}}z("shared",["exports"],function(S){function o(n,t,r,a){return new(r||(r=Promise))(function(c,d){function p(w){try{y(a.next(w))}catch(M){d(M)}}function m(w){try{y(a.throw(w))}catch(M){d(M)}}function y(w){var M;w.done?c(w.value):(M=w.value,M instanceof r?M:new r(function(C){C(M)})).then(p,m)}y((a=a.apply(n,t||[])).next())})}function he(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var me,Pe;function Be(){if(Pe)return me;function n(t,r){this.x=t,this.y=r}return Pe=1,me=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,r){return this.clone()._rotateAround(t,r)},matMult:function(t){return this.clone()._matMult(t)},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(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var r=t.x-this.x,a=t.y-this.y;return r*r+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,r){return Math.atan2(this.x*r-this.y*t,this.x*t+this.y*r)},_matMult:function(t){var r=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var r=Math.cos(t),a=Math.sin(t),c=a*this.x+r*this.y;return this.x=r*this.x-a*this.y,this.y=c,this},_rotateAround:function(t,r){var a=Math.cos(t),c=Math.sin(t),d=r.y+c*(this.x-r.x)+a*(this.y-r.y);return this.x=r.x+a*(this.x-r.x)-c*(this.y-r.y),this.y=d,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t},me}typeof SuppressedError=="function"&&SuppressedError;var Ee,le,Fe=he(Be()),Bt=function(){if(le)return Ee;function n(t,r,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(c-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=a,this.p2y=c}return le=1,Ee=n,n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var a=t,c=0;c<8;c++){var d=this.sampleCurveX(a)-t;if(Math.abs(d)<r)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var m=0,y=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<r));c++)t>d?m=a:y=a,a=.5*(y-m)+m;return a},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},Ee}(),fi=he(Bt);let ti,yi;function Ki(){return ti==null&&(ti=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ti}function Ft(){if(yi==null&&(yi=!1,Ki())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let a=0;a<5*5;a++){const c=4*a;t.fillStyle=`rgb(${c},${c+1},${c+2})`,t.fillRect(a%5,Math.floor(a/5),1,1)}const r=t.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&r[a]!==a){yi=!0;break}}}return yi||!1}var It=1e-6,$t=typeof Float32Array<"u"?Float32Array:Array;function _r(){var n=new $t(9);return $t!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[5]=0,n[6]=0,n[7]=0),n[0]=1,n[4]=1,n[8]=1,n}function jt(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function Tn(){var n=new $t(3);return $t!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function Mn(n){return Math.hypot(n[0],n[1],n[2])}function Yi(n,t,r){var a=new $t(3);return a[0]=n,a[1]=t,a[2]=r,a}Math.hypot||(Math.hypot=function(){for(var n=0,t=arguments.length;t--;)n+=arguments[t]*arguments[t];return Math.sqrt(n)});var ar,Ji=Mn;function ot(n,t,r){var a=t[0],c=t[1],d=t[2],p=t[3];return n[0]=r[0]*a+r[4]*c+r[8]*d+r[12]*p,n[1]=r[1]*a+r[5]*c+r[9]*d+r[13]*p,n[2]=r[2]*a+r[6]*c+r[10]*d+r[14]*p,n[3]=r[3]*a+r[7]*c+r[11]*d+r[15]*p,n}function Vi(){var n=new $t(4);return $t!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n[3]=1,n}function xi(){var n=new $t(2);return $t!=Float32Array&&(n[0]=0,n[1]=0),n}function yr(n,t){var r=new $t(2);return r[0]=n,r[1]=t,r}Tn(),ar=new $t(4),$t!=Float32Array&&(ar[0]=0,ar[1]=0,ar[2]=0,ar[3]=0),Tn(),Yi(1,0,0),Yi(0,1,0),Vi(),Vi(),_r(),xi();const Et=8192;function Ar(n,t,r){return t*(Et/(n.tileSize*Math.pow(2,r-n.tileID.overscaledZ)))}function sr(n,t){return(n%t+t)%t}function cn(n,t,r){return n*(1-r)+t*r}function kr(n){if(n<=0)return 0;if(n>=1)return 1;const t=n*n,r=t*n;return 4*(n<.5?r:3*(n-t)+r-.75)}function la(n,t,r,a){const c=new fi(n,t,r,a);return d=>c.solve(d)}const xr=la(.25,.1,.25,1);function Ht(n,t,r){return Math.min(r,Math.max(t,n))}function vr(n,t,r){const a=r-t,c=((n-t)%a+a)%a+t;return c===t?r:c}function Qi(n,...t){for(const r of t)for(const a in r)n[a]=r[a];return n}let Sn=1;function un(n,t,r){const a={};for(const c in n)a[c]=t.call(this,n[c],c,n);return a}function ca(n,t,r){const a={};for(const c in n)t.call(this,n[c],c,n)&&(a[c]=n[c]);return a}function or(n){return Array.isArray(n)?n.map(or):typeof n=="object"&&n?un(n,or):n}const lr={};function Ui(n){lr[n]||(typeof console<"u"&&console.warn(n),lr[n]=!0)}function Zt(n,t,r){return(r.y-n.y)*(t.x-n.x)>(t.y-n.y)*(r.x-n.x)}function Vr(n){return typeof WorkerGlobalScope<"u"&&n!==void 0&&n instanceof WorkerGlobalScope}let hn=null;function br(n){return typeof ImageBitmap<"u"&&n instanceof ImageBitmap}const Pn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Cn(n,t,r,a,c){return o(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(n,{timestamp:0});try{const p=d==null?void 0:d.format;if(!p||!p.startsWith("BGR")&&!p.startsWith("RGB"))throw new Error(`Unrecognized format ${p}`);const m=p.startsWith("BGR"),y=new Uint8ClampedArray(a*c*4);if(yield d.copyTo(y,function(w,M,C,k,D){const L=4*Math.max(1,0),j=(Math.max(0,C)-C)*k*4+L,U=4*k,X=Math.max(0,M),ne=Math.max(0,C);return{rect:{x:X,y:ne,width:Math.min(w.width,M+k)-X,height:Math.min(w.height,C+D)-ne},layout:[{offset:j,stride:U}]}}(n,t,r,a,c)),m)for(let w=0;w<y.length;w+=4){const M=y[w];y[w]=y[w+2],y[w+2]=M}return y}finally{d.close()}})}let Ce,Ye;function Ue(n,t,r,a){return n.addEventListener(t,r,a),{unsubscribe:()=>{n.removeEventListener(t,r,a)}}}function _t(n){return n*Math.PI/180}function Nt(n){return n/Math.PI*180}const cr={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},mi={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},zr="AbortError";function Rr(){return new Error(zr)}const In={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function qn(n){return In.REGISTERED_PROTOCOLS[n.substring(0,n.indexOf("://"))]}const ja="global-dispatcher";class Ur extends Error{constructor(t,r,a,c){super(`AJAXError: ${r} (${t}): ${a}`),this.status=t,this.statusText=r,this.url=a,this.body=c}}const wr=()=>Vr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,dn=function(n,t){if(/:\/\//.test(n.url)&&!/^https?:|^file:/.test(n.url)){const a=qn(n.url);if(a)return a(n,t);if(Vr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,targetMapId:ja},t)}if(!(/^file:/.test(r=n.url)||/^file:/.test(wr())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(a,c){return o(this,void 0,void 0,function*(){const d=new Request(a.url,{method:a.method||"GET",body:a.body,credentials:a.credentials,headers:a.headers,cache:a.cache,referrer:wr(),signal:c.signal});let p,m;a.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");try{p=yield fetch(d)}catch(w){throw new Ur(0,w.message,a.url,new Blob)}if(!p.ok){const w=yield p.blob();throw new Ur(p.status,p.statusText,a.url,w)}m=a.type==="arrayBuffer"||a.type==="image"?p.arrayBuffer():a.type==="json"?p.json():p.text();const y=yield m;if(c.signal.aborted)throw Rr();return{data:y,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(n,t);if(Vr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,mustQueue:!0,targetMapId:ja},t)}var r;return function(a,c){return new Promise((d,p)=>{var m;const y=new XMLHttpRequest;y.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(y.responseType="arraybuffer");for(const w in a.headers)y.setRequestHeader(w,a.headers[w]);a.type==="json"&&(y.responseType="text",!((m=a.headers)===null||m===void 0)&&m.Accept||y.setRequestHeader("Accept","application/json")),y.withCredentials=a.credentials==="include",y.onerror=()=>{p(new Error(y.statusText))},y.onload=()=>{if(!c.signal.aborted)if((y.status>=200&&y.status<300||y.status===0)&&y.response!==null){let w=y.response;if(a.type==="json")try{w=JSON.parse(y.response)}catch(M){return void p(M)}d({data:w,cacheControl:y.getResponseHeader("Cache-Control"),expires:y.getResponseHeader("Expires")})}else{const w=new Blob([y.response],{type:y.getResponseHeader("Content-Type")});p(new Ur(y.status,y.statusText,a.url,w))}},c.signal.addEventListener("abort",()=>{y.abort(),p(Rr())}),y.send(a.body)})}(n,t)};function ce(n){if(!n||n.indexOf("://")<=0||n.indexOf("data:image/")===0||n.indexOf("blob:")===0)return!0;const t=new URL(n),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function N(n,t,r){r[n]&&r[n].indexOf(t)!==-1||(r[n]=r[n]||[],r[n].push(t))}function Z(n,t,r){if(r&&r[n]){const a=r[n].indexOf(t);a!==-1&&r[n].splice(a,1)}}class G{constructor(t,r={}){Qi(this,r),this.type=t}}class J extends G{constructor(t,r={}){super("error",Qi({error:t},r))}}class ae{on(t,r){return this._listeners=this._listeners||{},N(t,r,this._listeners),{unsubscribe:()=>{this.off(t,r)}}}off(t,r){return Z(t,r,this._listeners),Z(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},N(t,r,this._oneTimeListeners),this):new Promise(a=>this.once(t,a))}fire(t,r){typeof t=="string"&&(t=new G(t,r||{}));const a=t.type;if(this.listens(a)){t.target=this;const c=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const m of c)m.call(this,t);const d=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const m of d)Z(a,m,this._oneTimeListeners),m.call(this,t);const p=this._eventedParent;p&&(Qi(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(t))}else t instanceof J&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var $={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{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_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},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:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const ge=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function oe(n,t){const r={};for(const a in n)a!=="ref"&&(r[a]=n[a]);return ge.forEach(a=>{a in t&&(r[a]=t[a])}),r}function de(n,t){if(Array.isArray(n)){if(!Array.isArray(t)||n.length!==t.length)return!1;for(let r=0;r<n.length;r++)if(!de(n[r],t[r]))return!1;return!0}if(typeof n=="object"&&n!==null&&t!==null){if(typeof t!="object"||Object.keys(n).length!==Object.keys(t).length)return!1;for(const r in n)if(!de(n[r],t[r]))return!1;return!0}return n===t}function _e(n,t){n.push(t)}function ue(n,t,r){_e(r,{command:"addSource",args:[n,t[n]]})}function Ae(n,t,r){_e(t,{command:"removeSource",args:[n]}),r[n]=!0}function Ze(n,t,r,a){Ae(n,r,a),ue(n,t,r)}function Ve(n,t,r){let a;for(a in n[r])if(Object.prototype.hasOwnProperty.call(n[r],a)&&a!=="data"&&!de(n[r][a],t[r][a]))return!1;for(a in t[r])if(Object.prototype.hasOwnProperty.call(t[r],a)&&a!=="data"&&!de(n[r][a],t[r][a]))return!1;return!0}function Qe(n,t,r,a,c,d){n=n||{},t=t||{};for(const p in n)Object.prototype.hasOwnProperty.call(n,p)&&(de(n[p],t[p])||r.push({command:d,args:[a,p,t[p],c]}));for(const p in t)Object.prototype.hasOwnProperty.call(t,p)&&!Object.prototype.hasOwnProperty.call(n,p)&&(de(n[p],t[p])||r.push({command:d,args:[a,p,t[p],c]}))}function dt(n){return n.id}function st(n,t){return n[t.id]=t,n}class we{constructor(t,r,a,c){this.message=(t?`${t}: `:"")+a,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Lt(n,...t){for(const r of t)for(const a in r)n[a]=r[a];return n}class Tt extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class kt{constructor(t,r=[]){this.parent=t,this.bindings={};for(const[a,c]of r)this.bindings[a]=c}concat(t){return new kt(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const at={kind:"null"},Ie={kind:"number"},it={kind:"string"},pt={kind:"boolean"},oi={kind:"color"},li={kind:"projectionDefinition"},Tr={kind:"object"},ft={kind:"value"},Na={kind:"collator"},Ms={kind:"formatted"},ua={kind:"padding"},Ss={kind:"colorArray"},En={kind:"numberArray"},ha={kind:"resolvedImage"},vi={kind:"variableAnchorOffsetCollection"};function Dr(n,t){return{kind:"array",itemType:n,N:t}}function ei(n){if(n.kind==="array"){const t=ei(n.itemType);return typeof n.N=="number"?`array<${t}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${t}>`}return n.kind}const Ps=[at,Ie,it,pt,oi,li,Ms,Tr,Dr(ft),ua,En,Ss,ha,vi];function Za(n,t){if(t.kind==="error")return null;if(n.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Za(n.itemType,t.itemType))&&(typeof n.N!="number"||n.N===t.N))return null}else{if(n.kind===t.kind)return null;if(n.kind==="value"){for(const r of Ps)if(!Za(r,t))return null}}return`Expected ${ei(n)} but found ${ei(t)} instead.`}function Wl(n,t){return t.some(r=>r.kind===n.kind)}function da(n,t){return t.some(r=>r==="null"?n===null:r==="array"?Array.isArray(n):r==="object"?n&&!Array.isArray(n)&&typeof n=="object":r===typeof n)}function An(n,t){return n.kind==="array"&&t.kind==="array"?n.itemType.kind===t.itemType.kind&&typeof n.N=="number":n.kind===t.kind}const Nu=.96422,Xl=.82521,Zu=4/29,Va=6/29,Vu=3*Va*Va,Sd=Va*Va*Va,Pd=Math.PI/180,Cd=180/Math.PI;function Uu(n){return(n%=360)<0&&(n+=360),n}function Kl([n,t,r,a]){let c,d;const p=Yl((.2225045*(n=pa(n))+.7168786*(t=pa(t))+.0606169*(r=pa(r)))/1);n===t&&t===r?c=d=p:(c=Yl((.4360747*n+.3850649*t+.1430804*r)/Nu),d=Yl((.0139322*n+.0971045*t+.7141733*r)/Xl));const m=116*p-16;return[m<0?0:m,500*(c-p),200*(p-d),a]}function pa(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Yl(n){return n>Sd?Math.pow(n,1/3):n/Vu+Zu}function $u([n,t,r,a]){let c=(n+16)/116,d=isNaN(t)?c:c+t/500,p=isNaN(r)?c:c-r/200;return c=1*Jl(c),d=Nu*Jl(d),p=Xl*Jl(p),[fa(3.1338561*d-1.6168667*c-.4906146*p),fa(-.9787684*d+1.9161415*c+.033454*p),fa(.0719453*d-.2289914*c+1.4052427*p),a]}function fa(n){return(n=n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055)<0?0:n>1?1:n}function Jl(n){return n>Va?n*n*n:Vu*(n-Zu)}const Id=Object.hasOwn||function(n,t){return Object.prototype.hasOwnProperty.call(n,t)};function Cs(n,t){return Id(n,t)?n[t]:void 0}function Is(n){return parseInt(n.padEnd(2,n),16)/255}function Ql(n,t){return ur(t?n/100:n,0,1)}function ur(n,t,r){return Math.min(Math.max(t,n),r)}function Ct(n){return!n.some(Number.isNaN)}const Ua={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function hr(n,t,r){return n+r*(t-n)}function ma(n,t,r){return n.map((a,c)=>hr(a,t[c],r))}class Mt{constructor(t,r,a,c=1,d=!0){this.r=t,this.g=r,this.b=a,this.a=c,d||(this.r*=c,this.g*=c,this.b*=c,c||this.overwriteGetter("rgb",[t,r,a,c]))}static parse(t){if(t instanceof Mt)return t;if(typeof t!="string")return;const r=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const c=Cs(Ua,a);if(c){const[p,m,y]=c;return[p/255,m/255,y/255,1]}if(a.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(a)){const p=a.length<6?1:2;let m=1;return[Is(a.slice(m,m+=p)),Is(a.slice(m,m+=p)),Is(a.slice(m,m+=p)),Is(a.slice(m,m+p)||"ff")]}if(a.startsWith("rgb")){const p=a.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[m,y,w,M,C,k,D,L,j,U,X,ne]=p,Y=[M||" ",D||" ",U].join("");if(Y===" "||Y===" /"||Y===",,"||Y===",,,"){const R=[w,k,j].join(""),V=R==="%%%"?100:R===""?255:0;if(V){const Q=[ur(+y/V,0,1),ur(+C/V,0,1),ur(+L/V,0,1),X?Ql(+X,ne):1];if(Ct(Q))return Q}}return}}const d=a.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[p,m,y,w,M,C,k,D,L]=d,j=[y||" ",M||" ",k].join("");if(j===" "||j===" /"||j===",,"||j===",,,"){const U=[+m,ur(+w,0,100),ur(+C,0,100),D?Ql(+D,L):1];if(Ct(U))return function([X,ne,Y,R]){function V(Q){const fe=(Q+X/30)%12,ke=ne*Math.min(Y,1-Y);return Y-ke*Math.max(-1,Math.min(fe-3,9-fe,1))}return X=Uu(X),ne/=100,Y/=100,[V(0),V(8),V(4),R]}(U)}}}(t);return r?new Mt(...r,!1):void 0}get rgb(){const{r:t,g:r,b:a,a:c}=this,d=c||1/0;return this.overwriteGetter("rgb",[t/d,r/d,a/d,c])}get hcl(){return this.overwriteGetter("hcl",function(t){const[r,a,c,d]=Kl(t),p=Math.sqrt(a*a+c*c);return[Math.round(1e4*p)?Uu(Math.atan2(c,a)*Cd):NaN,p,r,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Kl(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){const[t,r,a,c]=this.rgb;return`rgba(${[t,r,a].map(d=>Math.round(255*d)).join(",")},${c})`}static interpolate(t,r,a,c="rgb"){switch(c){case"rgb":{const[d,p,m,y]=ma(t.rgb,r.rgb,a);return new Mt(d,p,m,y,!1)}case"hcl":{const[d,p,m,y]=t.hcl,[w,M,C,k]=r.hcl;let D,L;if(isNaN(d)||isNaN(w))isNaN(d)?isNaN(w)?D=NaN:(D=w,m!==1&&m!==0||(L=M)):(D=d,C!==1&&C!==0||(L=p));else{let Y=w-d;w>d&&Y>180?Y-=360:w<d&&d-w>180&&(Y+=360),D=d+a*Y}const[j,U,X,ne]=function([Y,R,V,Q]){return Y=isNaN(Y)?0:Y*Pd,$u([V,Math.cos(Y)*R,Math.sin(Y)*R,Q])}([D,L??hr(p,M,a),hr(m,C,a),hr(y,k,a)]);return new Mt(j,U,X,ne,!1)}case"lab":{const[d,p,m,y]=$u(ma(t.lab,r.lab,a));return new Mt(d,p,m,y,!1)}}}}Mt.black=new Mt(0,0,0,1),Mt.white=new Mt(1,1,1,1),Mt.transparent=new Mt(0,0,0,0),Mt.red=new Mt(1,0,0,1);class Es{constructor(t,r,a){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const As=["bottom","center","top"];class $a{constructor(t,r,a,c,d,p){this.text=t,this.image=r,this.scale=a,this.fontStack=c,this.textColor=d,this.verticalAlign=p}}class Mr{constructor(t){this.sections=t}static fromString(t){return new Mr([new $a(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof Mr?t:Mr.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class $i{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof $i)return t;if(typeof t=="number")return new $i([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new $i(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a){return new $i(ma(t.values,r.values,a))}}class bi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof bi)return t;if(typeof t=="number")return new bi([t]);if(Array.isArray(t)){for(const r of t)if(typeof r!="number")return;return new bi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a){return new bi(ma(t.values,r.values,a))}}class Gi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Gi)return t;if(typeof t=="string"){const a=Mt.parse(t);return a?new Gi([a]):void 0}if(!Array.isArray(t))return;const r=[];for(const a of t){if(typeof a!="string")return;const c=Mt.parse(a);if(!c)return;r.push(c)}return new Gi(r)}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a,c="rgb"){const d=[];if(t.values.length!=r.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let p=0;p<t.values.length;p++)d.push(Mt.interpolate(t.values[p],r.values[p],a,c));return new Gi(d)}}class Wt extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const Ga=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class dr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof dr)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r<t.length;r+=2){const a=t[r],c=t[r+1];if(typeof a!="string"||!Ga.has(a)||!Array.isArray(c)||c.length!==2||typeof c[0]!="number"||typeof c[1]!="number")return}return new dr(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a){const c=t.values,d=r.values;if(c.length!==d.length)throw new Wt(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${r.toString()}`);const p=[];for(let m=0;m<c.length;m+=2){if(c[m]!==d[m])throw new Wt(`Cannot interpolate values containing mismatched anchors. from[${m}]: ${c[m]}, to[${m}]: ${d[m]}`);p.push(c[m]);const[y,w]=c[m+1],[M,C]=d[m+1];p.push([hr(y,M,a),hr(w,C,a)])}return new dr(p)}}class Lr{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Lr({name:t,available:!1}):null}}class Sr{constructor(t,r,a){this.from=t,this.to=r,this.transition=a}static interpolate(t,r,a){return new Sr(t,r,a)}static parse(t){return t instanceof Sr?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new Sr(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new Sr(t.from,t.to,t.transition):typeof t=="string"?new Sr(t,t,1):void 0}}function ks(n,t,r,a){return typeof n=="number"&&n>=0&&n<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[n,t,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[n,t,r,a]:[n,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Vt(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof Sr||n instanceof Mt||n instanceof Es||n instanceof Mr||n instanceof $i||n instanceof bi||n instanceof Gi||n instanceof dr||n instanceof Lr)return!0;if(Array.isArray(n)){for(const t of n)if(!Vt(t))return!1;return!0}if(typeof n=="object"){for(const t in n)if(!Vt(n[t]))return!1;return!0}return!1}function ci(n){if(n===null)return at;if(typeof n=="string")return it;if(typeof n=="boolean")return pt;if(typeof n=="number")return Ie;if(n instanceof Mt)return oi;if(n instanceof Sr)return li;if(n instanceof Es)return Na;if(n instanceof Mr)return Ms;if(n instanceof $i)return ua;if(n instanceof bi)return En;if(n instanceof Gi)return Ss;if(n instanceof dr)return vi;if(n instanceof Lr)return ha;if(Array.isArray(n)){const t=n.length;let r;for(const a of n){const c=ci(a);if(r){if(r===c)continue;r=ft;break}r=c}return Dr(r||ft,t)}return Tr}function St(n){const t=typeof n;return n===null?"":t==="string"||t==="number"||t==="boolean"?String(n):n instanceof Mt||n instanceof Sr||n instanceof Mr||n instanceof $i||n instanceof bi||n instanceof Gi||n instanceof dr||n instanceof Lr?n.toString():JSON.stringify(n)}class lt{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Vt(t[1]))return r.error("invalid value");const a=t[1];let c=ci(a);const d=r.expectedType;return c.kind!=="array"||c.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(c=d),new lt(c,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const qa={string:it,number:Ie,boolean:pt,object:Tr};class mt{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a,c=1;const d=t[0];if(d==="array"){let m,y;if(t.length>2){const w=t[1];if(typeof w!="string"||!(w in qa)||w==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=qa[w],c++}else m=ft;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);y=t[2],c++}a=Dr(m,y)}else{if(!qa[d])throw new Error(`Types doesn't contain name = ${d}`);a=qa[d]}const p=[];for(;c<t.length;c++){const m=r.parse(t[c],c,ft);if(!m)return null;p.push(m)}return new mt(a,p)}evaluate(t){for(let r=0;r<this.args.length;r++){const a=this.args[r].evaluate(t);if(!Za(this.type,ci(a)))return a;if(r===this.args.length-1)throw new Wt(`Expected value to be of type ${ei(this.type)}, but found ${ei(ci(a))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Co={"to-boolean":pt,"to-color":oi,"to-number":Ie,"to-string":it};class er{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const a=t[0];if(!Co[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&t.length!==2)return r.error("Expected one argument.");const c=Co[a],d=[];for(let p=1;p<t.length;p++){const m=r.parse(t[p],p,ft);if(!m)return null;d.push(m)}return new er(c,d)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,a;for(const c of this.args){if(r=c.evaluate(t),a=null,r instanceof Mt)return r;if(typeof r=="string"){const d=t.parseColor(r);if(d)return d}else if(Array.isArray(r)&&(a=r.length<3||r.length>4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:ks(r[0],r[1],r[2],r[3]),!a))return new Mt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Wt(a||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const a of this.args){r=a.evaluate(t);const c=$i.parse(r);if(c)return c}throw new Wt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"numberArray":{let r;for(const a of this.args){r=a.evaluate(t);const c=bi.parse(r);if(c)return c}throw new Wt(`Could not parse numberArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"colorArray":{let r;for(const a of this.args){r=a.evaluate(t);const c=Gi.parse(r);if(c)return c}throw new Wt(`Could not parse colorArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const a of this.args){r=a.evaluate(t);const c=dr.parse(r);if(c)return c}throw new Wt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const a of this.args){if(r=a.evaluate(t),r===null)return 0;const c=Number(r);if(!isNaN(c))return c}throw new Wt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Mr.fromString(St(this.args[0].evaluate(t)));case"resolvedImage":return Lr.fromString(St(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return St(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const ec=["Unknown","Point","LineString","Polygon"];class tc{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?ec[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||{}}parseColor(t){let r=this._parseColorCache.get(t);return r||(r=Mt.parse(t),this._parseColorCache.set(t,r)),r}}class zs{constructor(t,r,a=[],c,d=new kt,p=[]){this.registry=t,this.path=a,this.key=a.map(m=>`[${m}]`).join(""),this.scope=d,this.errors=p,this.expectedType=c,this._isConstant=r}parse(t,r,a,c,d={}){return r?this.concat(r,a,c)._parse(t,d):this._parse(t,d)}_parse(t,r){function a(c,d,p){return p==="assert"?new mt(d,[c]):p==="coerce"?new er(d,[c]):c}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const c=t[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const d=this.registry[c];if(d){let p=d.parse(t,this);if(!p)return null;if(this.expectedType){const m=this.expectedType,y=p.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||y.kind!=="value"){if(m.kind==="projectionDefinition"&&["string","array"].includes(y.kind)||["color","formatted","resolvedImage"].includes(m.kind)&&["value","string"].includes(y.kind)||["padding","numberArray"].includes(m.kind)&&["value","number","array"].includes(y.kind)||m.kind==="colorArray"&&["value","string","array"].includes(y.kind)||m.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(y.kind))p=a(p,m,r.typeAnnotation||"coerce");else if(this.checkSubtype(m,y))return null}else p=a(p,m,r.typeAnnotation||"assert")}if(!(p instanceof lt)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const m=new tc;try{p=new lt(p.type,p.evaluate(m))}catch(y){return this.error(y.message),null}}return p}return this.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,a){const c=typeof t=="number"?this.path.concat(t):this.path,d=a?this.scope.concat(a):this.scope;return new zs(this.registry,this._isConstant,c,r||null,d,this.errors)}error(t,...r){const a=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new Tt(a,t))}checkSubtype(t,r){const a=Za(t,r);return a&&this.error(a),a}}class Ha{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const a=[];for(let d=1;d<t.length-1;d+=2){const p=t[d];if(typeof p!="string")return r.error(`Expected string, but found ${typeof p} instead.`,d);if(/[^a-zA-Z0-9_]/.test(p))return r.error("Variable names must contain only alphanumeric characters or '_'.",d);const m=r.parse(t[d+1],d+1);if(!m)return null;a.push([p,m])}const c=r.parse(t[t.length-1],t.length-1,r.expectedType,a);return c?new Ha(a,c):null}outputDefined(){return this.result.outputDefined()}}class Rs{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const a=t[1];return r.scope.has(a)?new Rs(a,r.scope.get(a)):r.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class ic{constructor(t,r,a){this.type=t,this.index=r,this.input=a}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,Ie),c=r.parse(t[2],2,Dr(r.expectedType||ft));return a&&c?new ic(c.type.itemType,a,c):null}evaluate(t){const r=this.index.evaluate(t),a=this.input.evaluate(t);if(r<0)throw new Wt(`Array index out of bounds: ${r} < 0.`);if(r>=a.length)throw new Wt(`Array index out of bounds: ${r} > ${a.length-1}.`);if(r!==Math.floor(r))throw new Wt(`Array index must be an integer, but found ${r} instead.`);return a[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Io{constructor(t,r){this.type=pt,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,ft),c=r.parse(t[2],2,ft);return a&&c?Wl(a.type,[pt,it,Ie,at,ft])?new Io(a,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ei(a.type)} instead`):null}evaluate(t){const r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!a)return!1;if(!da(r,["boolean","string","number","null"]))throw new Wt(`Expected first argument to be of type boolean, string, number or null, but found ${ei(ci(r))} instead.`);if(!da(a,["string","array"]))throw new Wt(`Expected second argument to be of type array or string, but found ${ei(ci(a))} instead.`);return a.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Ds{constructor(t,r,a){this.type=Ie,this.needle=t,this.haystack=r,this.fromIndex=a}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,ft),c=r.parse(t[2],2,ft);if(!a||!c)return null;if(!Wl(a.type,[pt,it,Ie,at,ft]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ei(a.type)} instead`);if(t.length===4){const d=r.parse(t[3],3,Ie);return d?new Ds(a,c,d):null}return new Ds(a,c)}evaluate(t){const r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!da(r,["boolean","string","number","null"]))throw new Wt(`Expected first argument to be of type boolean, string, number or null, but found ${ei(ci(r))} instead.`);let c;if(this.fromIndex&&(c=this.fromIndex.evaluate(t)),da(a,["string"])){const d=a.indexOf(r,c);return d===-1?-1:[...a.slice(0,d)].length}if(da(a,["array"]))return a.indexOf(r,c);throw new Wt(`Expected second argument to be of type array or string, but found ${ei(ci(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class ga{constructor(t,r,a,c,d,p){this.inputType=t,this.type=r,this.input=a,this.cases=c,this.outputs=d,this.otherwise=p}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let a,c;r.expectedType&&r.expectedType.kind!=="value"&&(c=r.expectedType);const d={},p=[];for(let w=2;w<t.length-1;w+=2){let M=t[w];const C=t[w+1];Array.isArray(M)||(M=[M]);const k=r.concat(w);if(M.length===0)return k.error("Expected at least one branch label.");for(const L of M){if(typeof L!="number"&&typeof L!="string")return k.error("Branch labels must be numbers or strings.");if(typeof L=="number"&&Math.abs(L)>Number.MAX_SAFE_INTEGER)return k.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof L=="number"&&Math.floor(L)!==L)return k.error("Numeric branch labels must be integer values.");if(a){if(k.checkSubtype(a,ci(L)))return null}else a=ci(L);if(d[String(L)]!==void 0)return k.error("Branch labels must be unique.");d[String(L)]=p.length}const D=r.parse(C,w,c);if(!D)return null;c=c||D.type,p.push(D)}const m=r.parse(t[1],1,ft);if(!m)return null;const y=r.parse(t[t.length-1],t.length-1,c);return y?m.type.kind!=="value"&&r.concat(1).checkSubtype(a,m.type)?null:new ga(a,c,m,d,p,y):null}evaluate(t){const r=this.input.evaluate(t);return(ci(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class Di{constructor(t,r,a){this.type=t,this.branches=r,this.otherwise=a}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let a;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);const c=[];for(let p=1;p<t.length-1;p+=2){const m=r.parse(t[p],p,pt);if(!m)return null;const y=r.parse(t[p+1],p+1,a);if(!y)return null;c.push([m,y]),a=a||y.type}const d=r.parse(t[t.length-1],t.length-1,a);if(!d)return null;if(!a)throw new Error("Can't infer output type");return new Di(a,c,d)}evaluate(t){for(const[r,a]of this.branches)if(r.evaluate(t))return a.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[r,a]of this.branches)t(r),t(a);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class _a{constructor(t,r,a,c){this.type=t,this.input=r,this.beginIndex=a,this.endIndex=c}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,ft),c=r.parse(t[2],2,Ie);if(!a||!c)return null;if(!Wl(a.type,[Dr(ft),it,ft]))return r.error(`Expected first argument to be of type array or string, but found ${ei(a.type)} instead`);if(t.length===4){const d=r.parse(t[3],3,Ie);return d?new _a(a.type,a,c,d):null}return new _a(a.type,a,c)}evaluate(t){const r=this.input.evaluate(t),a=this.beginIndex.evaluate(t);let c;if(this.endIndex&&(c=this.endIndex.evaluate(t)),da(r,["string"]))return[...r].slice(a,c).join("");if(da(r,["array"]))return r.slice(a,c);throw new Wt(`Expected first argument to be of type array or string, but found ${ei(ci(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Ls(n,t){const r=n.length-1;let a,c,d=0,p=r,m=0;for(;d<=p;)if(m=Math.floor((d+p)/2),a=n[m],c=n[m+1],a<=t){if(m===r||t<c)return m;d=m+1}else{if(!(a>t))throw new Wt("Input is not a number.");p=m-1}return 0}class Hn{constructor(t,r,a){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(const[c,d]of a)this.labels.push(c),this.outputs.push(d)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");const a=r.parse(t[1],1,Ie);if(!a)return null;const c=[];let d=null;r.expectedType&&r.expectedType.kind!=="value"&&(d=r.expectedType);for(let p=1;p<t.length;p+=2){const m=p===1?-1/0:t[p],y=t[p+1],w=p,M=p+1;if(typeof m!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',w);if(c.length&&c[c.length-1][0]>=m)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',w);const C=r.parse(y,M,d);if(!C)return null;d=d||C.type,c.push([m,C])}return new Hn(d,a,c)}evaluate(t){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=r[0])return a[0].evaluate(t);const d=r.length;return c>=r[d-1]?a[d-1].evaluate(t):a[Ls(r,c)].evaluate(t)}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Li(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Eo,Ao,Gu=function(){if(Ao)return Eo;function n(t,r,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(c-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=a,this.p2y=c}return Ao=1,Eo=n,n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var a=t,c=0;c<8;c++){var d=this.sampleCurveX(a)-t;if(Math.abs(d)<r)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var m=0,y=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<r));c++)t>d?m=a:y=a,a=.5*(y-m)+m;return a},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},Eo}(),Ed=Li(Gu);class tr{constructor(t,r,a,c,d){this.type=t,this.operator=r,this.interpolation=a,this.input=c,this.labels=[],this.outputs=[];for(const[p,m]of d)this.labels.push(p),this.outputs.push(m)}static interpolationFactor(t,r,a,c){let d=0;if(t.name==="exponential")d=Bs(r,t.base,a,c);else if(t.name==="linear")d=Bs(r,1,a,c);else if(t.name==="cubic-bezier"){const p=t.controlPoints;d=new Ed(p[0],p[1],p[2],p[3]).solve(Bs(r,1,a,c))}return d}static parse(t,r){let[a,c,d,...p]=t;if(!Array.isArray(c)||c.length===0)return r.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const w=c[1];if(typeof w!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:w}}else{if(c[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const w=c.slice(1);if(w.length!==4||w.some(M=>typeof M!="number"||M<0||M>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:w}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(d=r.parse(d,2,Ie),!d)return null;const m=[];let y=null;a!=="interpolate-hcl"&&a!=="interpolate-lab"||r.expectedType==Ss?r.expectedType&&r.expectedType.kind!=="value"&&(y=r.expectedType):y=oi;for(let w=0;w<p.length;w+=2){const M=p[w],C=p[w+1],k=w+3,D=w+4;if(typeof M!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',k);if(m.length&&m[m.length-1][0]>=M)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',k);const L=r.parse(C,D,y);if(!L)return null;y=y||L.type,m.push([M,L])}return An(y,Ie)||An(y,li)||An(y,oi)||An(y,ua)||An(y,En)||An(y,Ss)||An(y,vi)||An(y,Dr(Ie))?new tr(y,a,c,d,m):r.error(`Type ${ei(y)} is not interpolatable.`)}evaluate(t){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=r[0])return a[0].evaluate(t);const d=r.length;if(c>=r[d-1])return a[d-1].evaluate(t);const p=Ls(r,c),m=tr.interpolationFactor(this.interpolation,c,r[p],r[p+1]),y=a[p].evaluate(t),w=a[p+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return hr(y,w,m);case"color":return Mt.interpolate(y,w,m);case"padding":return $i.interpolate(y,w,m);case"colorArray":return Gi.interpolate(y,w,m);case"numberArray":return bi.interpolate(y,w,m);case"variableAnchorOffsetCollection":return dr.interpolate(y,w,m);case"array":return ma(y,w,m);case"projectionDefinition":return Sr.interpolate(y,w,m)}case"interpolate-hcl":switch(this.type.kind){case"color":return Mt.interpolate(y,w,m,"hcl");case"colorArray":return Gi.interpolate(y,w,m,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Mt.interpolate(y,w,m,"lab");case"colorArray":return Gi.interpolate(y,w,m,"lab")}}}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Bs(n,t,r,a){const c=a-r,d=n-r;return c===0?0:t===1?d/c:(Math.pow(t,d)-1)/(Math.pow(t,c)-1)}const pn={color:Mt.interpolate,number:hr,padding:$i.interpolate,numberArray:bi.interpolate,colorArray:Gi.interpolate,variableAnchorOffsetCollection:dr.interpolate,array:ma};class ya{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a=null;const c=r.expectedType;c&&c.kind!=="value"&&(a=c);const d=[];for(const m of t.slice(1)){const y=r.parse(m,1+d.length,a,void 0,{typeAnnotation:"omit"});if(!y)return null;a=a||y.type,d.push(y)}if(!a)throw new Error("No output type");const p=c&&d.some(m=>Za(c,m.type));return new ya(p?ft:a,d)}evaluate(t){let r,a=null,c=0;for(const d of this.args)if(c++,a=d.evaluate(t),a&&a instanceof Lr&&!a.available&&(r||(r=a.name),a=null,c===this.args.length&&(a=r)),a!==null)break;return a}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function Fs(n,t){return n==="=="||n==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function $r(n,t,r,a){return a.compare(t,r)===0}function xa(n,t,r){const a=n!=="=="&&n!=="!=";return class $g{constructor(d,p,m){this.type=pt,this.lhs=d,this.rhs=p,this.collator=m,this.hasUntypedArgument=d.type.kind==="value"||p.type.kind==="value"}static parse(d,p){if(d.length!==3&&d.length!==4)return p.error("Expected two or three arguments.");const m=d[0];let y=p.parse(d[1],1,ft);if(!y)return null;if(!Fs(m,y.type))return p.concat(1).error(`"${m}" comparisons are not supported for type '${ei(y.type)}'.`);let w=p.parse(d[2],2,ft);if(!w)return null;if(!Fs(m,w.type))return p.concat(2).error(`"${m}" comparisons are not supported for type '${ei(w.type)}'.`);if(y.type.kind!==w.type.kind&&y.type.kind!=="value"&&w.type.kind!=="value")return p.error(`Cannot compare types '${ei(y.type)}' and '${ei(w.type)}'.`);a&&(y.type.kind==="value"&&w.type.kind!=="value"?y=new mt(w.type,[y]):y.type.kind!=="value"&&w.type.kind==="value"&&(w=new mt(y.type,[w])));let M=null;if(d.length===4){if(y.type.kind!=="string"&&w.type.kind!=="string"&&y.type.kind!=="value"&&w.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(M=p.parse(d[3],3,Na),!M)return null}return new $g(y,w,M)}evaluate(d){const p=this.lhs.evaluate(d),m=this.rhs.evaluate(d);if(a&&this.hasUntypedArgument){const y=ci(p),w=ci(m);if(y.kind!==w.kind||y.kind!=="string"&&y.kind!=="number")throw new Wt(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${y.kind}, ${w.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const y=ci(p),w=ci(m);if(y.kind!=="string"||w.kind!=="string")return t(d,p,m)}return this.collator?r(d,p,m,this.collator.evaluate(d)):t(d,p,m)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}const ko=xa("==",function(n,t,r){return t===r},$r),Ad=xa("!=",function(n,t,r){return t!==r},function(n,t,r,a){return!$r(0,t,r,a)}),rc=xa("<",function(n,t,r){return t<r},function(n,t,r,a){return a.compare(t,r)<0}),kd=xa(">",function(n,t,r){return t>r},function(n,t,r,a){return a.compare(t,r)>0}),zd=xa("<=",function(n,t,r){return t<=r},function(n,t,r,a){return a.compare(t,r)<=0}),Rd=xa(">=",function(n,t,r){return t>=r},function(n,t,r,a){return a.compare(t,r)>=0});class zo{constructor(t,r,a){this.type=Na,this.locale=a,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");const a=t[1];if(typeof a!="object"||Array.isArray(a))return r.error("Collator options argument must be an object.");const c=r.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,pt);if(!c)return null;const d=r.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,pt);if(!d)return null;let p=null;return a.locale&&(p=r.parse(a.locale,1,it),!p)?null:new zo(c,d,p)}evaluate(t){return new Es(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class Wa{constructor(t,r,a,c,d){this.type=it,this.number=t,this.locale=r,this.currency=a,this.minFractionDigits=c,this.maxFractionDigits=d}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");const a=r.parse(t[1],1,Ie);if(!a)return null;const c=t[2];if(typeof c!="object"||Array.isArray(c))return r.error("NumberFormat options argument must be an object.");let d=null;if(c.locale&&(d=r.parse(c.locale,1,it),!d))return null;let p=null;if(c.currency&&(p=r.parse(c.currency,1,it),!p))return null;let m=null;if(c["min-fraction-digits"]&&(m=r.parse(c["min-fraction-digits"],1,Ie),!m))return null;let y=null;return c["max-fraction-digits"]&&(y=r.parse(c["max-fraction-digits"],1,Ie),!y)?null:new Wa(a,d,p,m,y)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Ro{constructor(t){this.type=Ms,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const a=t[1];if(!Array.isArray(a)&&typeof a=="object")return r.error("First argument must be an image or text section.");const c=[];let d=!1;for(let p=1;p<=t.length-1;++p){const m=t[p];if(d&&typeof m=="object"&&!Array.isArray(m)){d=!1;let y=null;if(m["font-scale"]&&(y=r.parse(m["font-scale"],1,Ie),!y))return null;let w=null;if(m["text-font"]&&(w=r.parse(m["text-font"],1,Dr(it)),!w))return null;let M=null;if(m["text-color"]&&(M=r.parse(m["text-color"],1,oi),!M))return null;let C=null;if(m["vertical-align"]){if(typeof m["vertical-align"]=="string"&&!As.includes(m["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${m["vertical-align"]}' instead.`);if(C=r.parse(m["vertical-align"],1,it),!C)return null}const k=c[c.length-1];k.scale=y,k.font=w,k.textColor=M,k.verticalAlign=C}else{const y=r.parse(t[p],1,ft);if(!y)return null;const w=y.type.kind;if(w!=="string"&&w!=="value"&&w!=="null"&&w!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,c.push({content:y,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Ro(c)}evaluate(t){return new Mr(this.sections.map(r=>{const a=r.content.evaluate(t);return ci(a)===ha?new $a("",a,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new $a(St(a),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null,r.verticalAlign?r.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor),r.verticalAlign&&t(r.verticalAlign)}outputDefined(){return!1}}class Do{constructor(t){this.type=ha,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");const a=r.parse(t[1],1,it);return a?new Do(a):r.error("No image name provided.")}evaluate(t){const r=this.input.evaluate(t),a=Lr.fromString(r);return a&&t.availableImages&&(a.available=t.availableImages.indexOf(r)>-1),a}eachChild(t){t(this.input)}outputDefined(){return!1}}class Lo{constructor(t){this.type=Ie,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const a=r.parse(t[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${ei(a.type)} instead.`):new Lo(a):null}evaluate(t){const r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new Wt(`Expected value to be of type string or array, but found ${ei(ci(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const fn=8192;function qu(n,t){const r=(180+n[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n[1]*Math.PI/360)))/360,c=Math.pow(2,t.z);return[Math.round(r*c*fn),Math.round(a*c*fn)]}function nc(n,t){const r=Math.pow(2,t.z);return[(c=(n[0]/fn+t.x)/r,360*c-180),(a=(n[1]/fn+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,c}function Os(n,t){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function js(n,t){return!(n[0]<=t[0]||n[2]>=t[2]||n[1]<=t[1]||n[3]>=t[3])}function Dd(n,t,r){const a=n[0]-t[0],c=n[1]-t[1],d=n[0]-r[0],p=n[1]-r[1];return a*p-d*c==0&&a*d<=0&&c*p<=0}function Bo(n,t,r,a){return(c=[a[0]-r[0],a[1]-r[1]])[0]*(d=[t[0]-n[0],t[1]-n[1]])[1]-c[1]*d[0]!=0&&!(!Ku(n,t,r,a)||!Ku(r,a,n,t));var c,d}function Hu(n,t,r){for(const a of r)for(let c=0;c<a.length-1;++c)if(Bo(n,t,a[c],a[c+1]))return!0;return!1}function va(n,t,r=!1){let a=!1;for(const m of t)for(let y=0;y<m.length-1;y++){if(Dd(n,m[y],m[y+1]))return r;(d=m[y])[1]>(c=n)[1]!=(p=m[y+1])[1]>c[1]&&c[0]<(p[0]-d[0])*(c[1]-d[1])/(p[1]-d[1])+d[0]&&(a=!a)}var c,d,p;return a}function Wu(n,t){for(const r of t)if(va(n,r))return!0;return!1}function Xu(n,t){for(const r of n)if(!va(r,t))return!1;for(let r=0;r<n.length-1;++r)if(Hu(n[r],n[r+1],t))return!1;return!0}function Ld(n,t){for(const r of t)if(Xu(n,r))return!0;return!1}function Ku(n,t,r,a){const c=a[0]-r[0],d=a[1]-r[1],p=(n[0]-r[0])*d-c*(n[1]-r[1]),m=(t[0]-r[0])*d-c*(t[1]-r[1]);return p>0&&m<0||p<0&&m>0}function Ns(n,t,r){const a=[];for(let c=0;c<n.length;c++){const d=[];for(let p=0;p<n[c].length;p++){const m=qu(n[c][p],r);Os(t,m),d.push(m)}a.push(d)}return a}function Yu(n,t,r){const a=[];for(let c=0;c<n.length;c++){const d=Ns(n[c],t,r);a.push(d)}return a}function Ju(n,t,r,a){if(n[0]<r[0]||n[0]>r[2]){const c=.5*a;let d=n[0]-r[0]>c?-a:r[0]-n[0]>c?a:0;d===0&&(d=n[0]-r[2]>c?-a:r[2]-n[0]>c?a:0),n[0]+=d}Os(t,n)}function Qu(n,t,r,a){const c=Math.pow(2,a.z)*fn,d=[a.x*fn,a.y*fn],p=[];for(const m of n)for(const y of m){const w=[y.x+d[0],y.y+d[1]];Ju(w,t,r,c),p.push(w)}return p}function ac(n,t,r,a){const c=Math.pow(2,a.z)*fn,d=[a.x*fn,a.y*fn],p=[];for(const y of n){const w=[];for(const M of y){const C=[M.x+d[0],M.y+d[1]];Os(t,C),w.push(C)}p.push(w)}if(t[2]-t[0]<=c/2){(m=t)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const y of p)for(const w of y)Ju(w,t,r,c)}var m;return p}class Wn{constructor(t,r){this.type=pt,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Vt(t[1])){const a=t[1];if(a.type==="FeatureCollection"){const c=[];for(const d of a.features){const{type:p,coordinates:m}=d.geometry;p==="Polygon"&&c.push(m),p==="MultiPolygon"&&c.push(...m)}if(c.length)return new Wn(a,{type:"MultiPolygon",coordinates:c})}else if(a.type==="Feature"){const c=a.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new Wn(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new Wn(a,a)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(a.type==="Polygon"){const m=Ns(a.coordinates,d,p),y=Qu(r.geometry(),c,d,p);if(!js(c,d))return!1;for(const w of y)if(!va(w,m))return!1}if(a.type==="MultiPolygon"){const m=Yu(a.coordinates,d,p),y=Qu(r.geometry(),c,d,p);if(!js(c,d))return!1;for(const w of y)if(!Wu(w,m))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(a.type==="Polygon"){const m=Ns(a.coordinates,d,p),y=ac(r.geometry(),c,d,p);if(!js(c,d))return!1;for(const w of y)if(!Xu(w,m))return!1}if(a.type==="MultiPolygon"){const m=Yu(a.coordinates,d,p),y=ac(r.geometry(),c,d,p);if(!js(c,d))return!1;for(const w of y)if(!Ld(w,m))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let eh=class{constructor(n=[],t=(r,a)=>r<a?-1:r>a?1:0){if(this.data=n,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(n){this.data.push(n),this._up(this.length++)}pop(){if(this.length===0)return;const n=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:t,compare:r}=this,a=t[n];for(;n>0;){const c=n-1>>1,d=t[c];if(r(a,d)>=0)break;t[n]=d,n=c}t[n]=a}_down(n){const{data:t,compare:r}=this,a=this.length>>1,c=t[n];for(;n<a;){let d=1+(n<<1);const p=d+1;if(p<this.length&&r(t[p],t[d])<0&&(d=p),r(t[d],c)>=0)break;t[n]=t[d],n=d}t[n]=c}};function th(n,t,r=0,a=n.length-1,c=ih){for(;a>r;){if(a-r>600){const y=a-r+1,w=t-r+1,M=Math.log(y),C=.5*Math.exp(2*M/3),k=.5*Math.sqrt(M*C*(y-C)/y)*(w-y/2<0?-1:1);th(n,t,Math.max(r,Math.floor(t-w*C/y+k)),Math.min(a,Math.floor(t+(y-w)*C/y+k)),c)}const d=n[t];let p=r,m=a;for(Xa(n,r,t),c(n[a],d)>0&&Xa(n,r,a);p<m;){for(Xa(n,p,m),p++,m--;c(n[p],d)<0;)p++;for(;c(n[m],d)>0;)m--}c(n[r],d)===0?Xa(n,r,m):(m++,Xa(n,m,a)),m<=t&&(r=m+1),t<=m&&(a=m-1)}}function Xa(n,t,r){const a=n[t];n[t]=n[r],n[r]=a}function ih(n,t){return n<t?-1:n>t?1:0}function Fo(n,t){if(n.length<=1)return[n];const r=[];let a,c;for(const d of n){const p=Fd(d);p!==0&&(d.area=Math.abs(p),c===void 0&&(c=p<0),c===p<0?(a&&r.push(a),a=[d]):a.push(d))}if(a&&r.push(a),t>1)for(let d=0;d<r.length;d++)r[d].length<=t||(th(r[d],t,1,r[d].length-1,Bd),r[d]=r[d].slice(0,t));return r}function Bd(n,t){return t.area-n.area}function Fd(n){let t=0;for(let r,a,c=0,d=n.length,p=d-1;c<d;p=c++)r=n[c],a=n[p],t+=(a.x-r.x)*(r.y+a.y);return t}const sc=1/298.257223563,rh=sc*(2-sc),nh=Math.PI/180;class oc{constructor(t){const r=6378.137*nh*1e3,a=Math.cos(t*nh),c=1/(1-rh*(1-a*a)),d=Math.sqrt(c);this.kx=r*d*a,this.ky=r*d*c*(1-rh)}distance(t,r){const a=this.wrap(t[0]-r[0])*this.kx,c=(t[1]-r[1])*this.ky;return Math.sqrt(a*a+c*c)}pointOnLine(t,r){let a,c,d,p,m=1/0;for(let y=0;y<t.length-1;y++){let w=t[y][0],M=t[y][1],C=this.wrap(t[y+1][0]-w)*this.kx,k=(t[y+1][1]-M)*this.ky,D=0;C===0&&k===0||(D=(this.wrap(r[0]-w)*this.kx*C+(r[1]-M)*this.ky*k)/(C*C+k*k),D>1?(w=t[y+1][0],M=t[y+1][1]):D>0&&(w+=C/this.kx*D,M+=k/this.ky*D)),C=this.wrap(r[0]-w)*this.kx,k=(r[1]-M)*this.ky;const L=C*C+k*k;L<m&&(m=L,a=w,c=M,d=y,p=D)}return{point:[a,c],index:d,t:Math.max(0,Math.min(1,p))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function ah(n,t){return t[0]-n[0]}function At(n){return n[1]-n[0]+1}function kn(n,t){return n[1]>=n[0]&&n[1]<t}function lc(n,t){if(n[0]>n[1])return[null,null];const r=At(n);if(t){if(r===2)return[n,null];const c=Math.floor(r/2);return[[n[0],n[0]+c],[n[0]+c,n[1]]]}if(r===1)return[n,null];const a=Math.floor(r/2)-1;return[[n[0],n[0]+a],[n[0]+a+1,n[1]]]}function cc(n,t){if(!kn(t,n.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let a=t[0];a<=t[1];++a)Os(r,n[a]);return r}function uc(n){const t=[1/0,1/0,-1/0,-1/0];for(const r of n)for(const a of r)Os(t,a);return t}function sh(n){return n[0]!==-1/0&&n[1]!==-1/0&&n[2]!==1/0&&n[3]!==1/0}function hc(n,t,r){if(!sh(n)||!sh(t))return NaN;let a=0,c=0;return n[2]<t[0]&&(a=t[0]-n[2]),n[0]>t[2]&&(a=n[0]-t[2]),n[1]>t[3]&&(c=n[1]-t[3]),n[3]<t[1]&&(c=t[1]-n[3]),r.distance([0,0],[a,c])}function ba(n,t,r){const a=r.pointOnLine(t,n);return r.distance(n,a.point)}function dc(n,t,r,a,c){const d=Math.min(ba(n,[r,a],c),ba(t,[r,a],c)),p=Math.min(ba(r,[n,t],c),ba(a,[n,t],c));return Math.min(d,p)}function Od(n,t,r,a,c){if(!kn(t,n.length)||!kn(a,r.length))return 1/0;let d=1/0;for(let p=t[0];p<t[1];++p){const m=n[p],y=n[p+1];for(let w=a[0];w<a[1];++w){const M=r[w],C=r[w+1];if(Bo(m,y,M,C))return 0;d=Math.min(d,dc(m,y,M,C,c))}}return d}function jd(n,t,r,a,c){if(!kn(t,n.length)||!kn(a,r.length))return NaN;let d=1/0;for(let p=t[0];p<=t[1];++p)for(let m=a[0];m<=a[1];++m)if(d=Math.min(d,c.distance(n[p],r[m])),d===0)return d;return d}function Nd(n,t,r){if(va(n,t,!0))return 0;let a=1/0;for(const c of t){const d=c[0],p=c[c.length-1];if(d!==p&&(a=Math.min(a,ba(n,[p,d],r)),a===0))return a;const m=r.pointOnLine(c,n);if(a=Math.min(a,r.distance(n,m.point)),a===0)return a}return a}function Zd(n,t,r,a){if(!kn(t,n.length))return NaN;for(let d=t[0];d<=t[1];++d)if(va(n[d],r,!0))return 0;let c=1/0;for(let d=t[0];d<t[1];++d){const p=n[d],m=n[d+1];for(const y of r)for(let w=0,M=y.length,C=M-1;w<M;C=w++){const k=y[C],D=y[w];if(Bo(p,m,k,D))return 0;c=Math.min(c,dc(p,m,k,D,a))}}return c}function oh(n,t){for(const r of n)for(const a of r)if(va(a,t,!0))return!0;return!1}function Vd(n,t,r,a=1/0){const c=uc(n),d=uc(t);if(a!==1/0&&hc(c,d,r)>=a)return a;if(js(c,d)){if(oh(n,t))return 0}else if(oh(t,n))return 0;let p=1/0;for(const m of n)for(let y=0,w=m.length,M=w-1;y<w;M=y++){const C=m[M],k=m[y];for(const D of t)for(let L=0,j=D.length,U=j-1;L<j;U=L++){const X=D[U],ne=D[L];if(Bo(C,k,X,ne))return 0;p=Math.min(p,dc(C,k,X,ne,r))}}return p}function lh(n,t,r,a,c,d){if(!d)return;const p=hc(cc(a,d),c,r);p<t&&n.push([p,d,[0,0]])}function Oo(n,t,r,a,c,d,p){if(!d||!p)return;const m=hc(cc(a,d),cc(c,p),r);m<t&&n.push([m,d,p])}function jo(n,t,r,a,c=1/0){let d=Math.min(a.distance(n[0],r[0][0]),c);if(d===0)return d;const p=new eh([[0,[0,n.length-1],[0,0]]],ah),m=uc(r);for(;p.length>0;){const y=p.pop();if(y[0]>=d)continue;const w=y[1],M=t?50:100;if(At(w)<=M){if(!kn(w,n.length))return NaN;if(t){const C=Zd(n,w,r,a);if(isNaN(C)||C===0)return C;d=Math.min(d,C)}else for(let C=w[0];C<=w[1];++C){const k=Nd(n[C],r,a);if(d=Math.min(d,k),d===0)return 0}}else{const C=lc(w,t);lh(p,d,a,n,m,C[0]),lh(p,d,a,n,m,C[1])}}return d}function No(n,t,r,a,c,d=1/0){let p=Math.min(d,c.distance(n[0],r[0]));if(p===0)return p;const m=new eh([[0,[0,n.length-1],[0,r.length-1]]],ah);for(;m.length>0;){const y=m.pop();if(y[0]>=p)continue;const w=y[1],M=y[2],C=t?50:100,k=a?50:100;if(At(w)<=C&&At(M)<=k){if(!kn(w,n.length)&&kn(M,r.length))return NaN;let D;if(t&&a)D=Od(n,w,r,M,c),p=Math.min(p,D);else if(t&&!a){const L=n.slice(w[0],w[1]+1);for(let j=M[0];j<=M[1];++j)if(D=ba(r[j],L,c),p=Math.min(p,D),p===0)return p}else if(!t&&a){const L=r.slice(M[0],M[1]+1);for(let j=w[0];j<=w[1];++j)if(D=ba(n[j],L,c),p=Math.min(p,D),p===0)return p}else D=jd(n,w,r,M,c),p=Math.min(p,D)}else{const D=lc(w,t),L=lc(M,a);Oo(m,p,c,n,r,D[0],L[0]),Oo(m,p,c,n,r,D[0],L[1]),Oo(m,p,c,n,r,D[1],L[0]),Oo(m,p,c,n,r,D[1],L[1])}}return p}function pc(n){return n.type==="MultiPolygon"?n.coordinates.map(t=>({type:"Polygon",coordinates:t})):n.type==="MultiLineString"?n.coordinates.map(t=>({type:"LineString",coordinates:t})):n.type==="MultiPoint"?n.coordinates.map(t=>({type:"Point",coordinates:t})):[n]}class wa{constructor(t,r){this.type=Ie,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Vt(t[1])){const a=t[1];if(a.type==="FeatureCollection")return new wa(a,a.features.map(c=>pc(c.geometry)).flat());if(a.type==="Feature")return new wa(a,pc(a.geometry));if("type"in a&&"coordinates"in a)return new wa(a,pc(a))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,a){const c=r.geometry(),d=c.flat().map(y=>nc([y.x,y.y],r.canonical));if(c.length===0)return NaN;const p=new oc(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,No(d,!1,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,No(d,!1,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,jo(d,!1,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,a){const c=r.geometry(),d=c.flat().map(y=>nc([y.x,y.y],r.canonical));if(c.length===0)return NaN;const p=new oc(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,No(d,!0,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,No(d,!0,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,jo(d,!0,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries);if(t.geometryType()==="Polygon")return function(r,a){const c=r.geometry();if(c.length===0||c[0].length===0)return NaN;const d=Fo(c,0).map(y=>y.map(w=>w.map(M=>nc([M.x,M.y],r.canonical)))),p=new oc(d[0][0][0][1]);let m=1/0;for(const y of a)for(const w of d){switch(y.type){case"Point":m=Math.min(m,jo([y.coordinates],!1,w,p,m));break;case"LineString":m=Math.min(m,jo(y.coordinates,!0,w,p,m));break;case"Polygon":m=Math.min(m,Vd(w,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Zo{constructor(t){this.type=ft,this.key=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const a=t[1];return a==null?r.error("Global state property must be defined."):typeof a!="string"?r.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Zo(a)}evaluate(t){var r;const a=(r=t.globals)===null||r===void 0?void 0:r.globalState;return a&&Object.keys(a).length!==0?Cs(a,this.key):null}eachChild(){}outputDefined(){return!1}}const Ka={"==":ko,"!=":Ad,">":kd,"<":rc,">=":Rd,"<=":zd,array:mt,at:ic,boolean:mt,case:Di,coalesce:ya,collator:zo,format:Ro,image:Do,in:Io,"index-of":Ds,interpolate:tr,"interpolate-hcl":tr,"interpolate-lab":tr,length:Lo,let:Ha,literal:lt,match:ga,number:mt,"number-format":Wa,object:mt,slice:_a,step:Hn,string:mt,"to-boolean":er,"to-color":er,"to-number":er,"to-string":er,var:Rs,within:Wn,distance:wa,"global-state":Zo};class Gr{constructor(t,r,a,c){this.name=t,this.type=r,this._evaluate=a,this.args=c}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){const a=t[0],c=Gr.definitions[a];if(!c)return r.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);const d=Array.isArray(c)?c[0]:c.type,p=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,m=p.filter(([w])=>!Array.isArray(w)||w.length===t.length-1);let y=null;for(const[w,M]of m){y=new zs(r.registry,Vo,r.path,null,r.scope);const C=[];let k=!1;for(let D=1;D<t.length;D++){const L=t[D],j=Array.isArray(w)?w[D-1]:w.type,U=y.parse(L,1+C.length,j);if(!U){k=!0;break}C.push(U)}if(!k)if(Array.isArray(w)&&w.length!==C.length)y.error(`Expected ${w.length} arguments, but found ${C.length} instead.`);else{for(let D=0;D<C.length;D++){const L=Array.isArray(w)?w[D]:w.type,j=C[D];y.concat(D+1).checkSubtype(L,j.type)}if(y.errors.length===0)return new Gr(a,d,M,C)}}if(m.length===1)r.errors.push(...y.errors);else{const w=(m.length?m:p).map(([C])=>{return k=C,Array.isArray(k)?`(${k.map(ei).join(", ")})`:`(${ei(k.type)}...)`;var k}).join(" | "),M=[];for(let C=1;C<t.length;C++){const k=r.parse(t[C],1+M.length);if(!k)return null;M.push(ei(k.type))}r.error(`Expected arguments of type ${w}, but found (${M.join(", ")}) instead.`)}return null}static register(t,r){Gr.definitions=r;for(const a in r)t[a]=Gr}}function ch(n,[t,r,a,c]){t=t.evaluate(n),r=r.evaluate(n),a=a.evaluate(n);const d=c?c.evaluate(n):1,p=ks(t,r,a,d);if(p)throw new Wt(p);return new Mt(t/255,r/255,a/255,d,!1)}function uh(n,t){return n in t}function fc(n,t){const r=t[n];return r===void 0?null:r}function Ta(n){return{type:n}}function Vo(n){if(n instanceof Rs)return Vo(n.boundExpression);if(n instanceof Gr&&n.name==="error"||n instanceof zo||n instanceof Wn||n instanceof wa||n instanceof Zo)return!1;const t=n instanceof er||n instanceof mt;let r=!0;return n.eachChild(a=>{r=t?r&&Vo(a):r&&a instanceof lt}),!!r&&Uo(n)&&$o(n,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Uo(n){if(n instanceof Gr&&(n.name==="get"&&n.args.length===1||n.name==="feature-state"||n.name==="has"&&n.args.length===1||n.name==="properties"||n.name==="geometry-type"||n.name==="id"||/^filter-/.test(n.name))||n instanceof Wn||n instanceof wa)return!1;let t=!0;return n.eachChild(r=>{t&&!Uo(r)&&(t=!1)}),t}function Zs(n){if(n instanceof Gr&&n.name==="feature-state")return!1;let t=!0;return n.eachChild(r=>{t&&!Zs(r)&&(t=!1)}),t}function $o(n,t){if(n instanceof Gr&&t.indexOf(n.name)>=0)return!1;let r=!0;return n.eachChild(a=>{r&&!$o(a,t)&&(r=!1)}),r}function Go(n){return{result:"success",value:n}}function Ya(n){return{result:"error",value:n}}function Ja(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function hh(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function qo(n){return!!n.expression&&n.expression.interpolated}function xt(n){return n instanceof Number?"number":n instanceof String?"string":n instanceof Boolean?"boolean":Array.isArray(n)?"array":n===null?"null":typeof n}function Ho(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&ci(n)===Tr}function Wo(n){return n}function mc(n,t){const r=n.stops&&typeof n.stops[0][0]=="object",a=r||!(r||n.property!==void 0),c=n.type||(qo(t)?"exponential":"interval"),d=function(M){switch(M.type){case"color":return Mt.parse;case"padding":return $i.parse;case"numberArray":return bi.parse;case"colorArray":return Gi.parse;default:return null}}(t);if(d&&((n=Lt({},n)).stops&&(n.stops=n.stops.map(M=>[M[0],d(M[1])])),n.default=d(n.default?n.default:t.default)),n.colorSpace&&(p=n.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${n.colorSpace}"`);var p;const m=function(M){switch(M){case"exponential":return dh;case"interval":return $d;case"categorical":return Ud;case"identity":return Gd;default:throw new Error(`Unknown function type "${M}"`)}}(c);let y,w;if(c==="categorical"){y=Object.create(null);for(const M of n.stops)y[M[0]]=M[1];w=typeof n.stops[0][0]}if(r){const M={},C=[];for(let L=0;L<n.stops.length;L++){const j=n.stops[L],U=j[0].zoom;M[U]===void 0&&(M[U]={zoom:U,type:n.type,property:n.property,default:n.default,stops:[]},C.push(U)),M[U].stops.push([j[0].value,j[1]])}const k=[];for(const L of C)k.push([M[L].zoom,mc(M[L],t)]);const D={name:"linear"};return{kind:"composite",interpolationType:D,interpolationFactor:tr.interpolationFactor.bind(void 0,D),zoomStops:k.map(L=>L[0]),evaluate:({zoom:L},j)=>dh({stops:k,base:n.base},t,L).evaluate(L,j)}}if(a){const M=c==="exponential"?{name:"exponential",base:n.base!==void 0?n.base:1}:null;return{kind:"camera",interpolationType:M,interpolationFactor:tr.interpolationFactor.bind(void 0,M),zoomStops:n.stops.map(C=>C[0]),evaluate:({zoom:C})=>m(n,t,C,y,w)}}return{kind:"source",evaluate(M,C){const k=C&&C.properties?C.properties[n.property]:void 0;return k===void 0?Vs(n.default,t.default):m(n,t,k,y,w)}}}function Vs(n,t,r){return n!==void 0?n:t!==void 0?t:r!==void 0?r:void 0}function Ud(n,t,r,a,c){return Vs(typeof r===c?a[r]:void 0,n.default,t.default)}function $d(n,t,r){if(xt(r)!=="number")return Vs(n.default,t.default);const a=n.stops.length;if(a===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[a-1][0])return n.stops[a-1][1];const c=Ls(n.stops.map(d=>d[0]),r);return n.stops[c][1]}function dh(n,t,r){const a=n.base!==void 0?n.base:1;if(xt(r)!=="number")return Vs(n.default,t.default);const c=n.stops.length;if(c===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[c-1][0])return n.stops[c-1][1];const d=Ls(n.stops.map(M=>M[0]),r),p=function(M,C,k,D){const L=D-k,j=M-k;return L===0?0:C===1?j/L:(Math.pow(C,j)-1)/(Math.pow(C,L)-1)}(r,a,n.stops[d][0],n.stops[d+1][0]),m=n.stops[d][1],y=n.stops[d+1][1],w=pn[t.type]||Wo;return typeof m.evaluate=="function"?{evaluate(...M){const C=m.evaluate.apply(void 0,M),k=y.evaluate.apply(void 0,M);if(C!==void 0&&k!==void 0)return w(C,k,p,n.colorSpace)}}:w(m,y,p,n.colorSpace)}function Gd(n,t,r){switch(t.type){case"color":r=Mt.parse(r);break;case"formatted":r=Mr.fromString(r.toString());break;case"resolvedImage":r=Lr.fromString(r.toString());break;case"padding":r=$i.parse(r);break;case"colorArray":r=Gi.parse(r);break;case"numberArray":r=bi.parse(r);break;default:xt(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return Vs(r,n.default,t.default)}Gr.register(Ka,{error:[{kind:"error"},[it],(n,[t])=>{throw new Wt(t.evaluate(n))}],typeof:[it,[ft],(n,[t])=>ei(ci(t.evaluate(n)))],"to-rgba":[Dr(Ie,4),[oi],(n,[t])=>{const[r,a,c,d]=t.evaluate(n).rgb;return[255*r,255*a,255*c,d]}],rgb:[oi,[Ie,Ie,Ie],ch],rgba:[oi,[Ie,Ie,Ie,Ie],ch],has:{type:pt,overloads:[[[it],(n,[t])=>uh(t.evaluate(n),n.properties())],[[it,Tr],(n,[t,r])=>uh(t.evaluate(n),r.evaluate(n))]]},get:{type:ft,overloads:[[[it],(n,[t])=>fc(t.evaluate(n),n.properties())],[[it,Tr],(n,[t,r])=>fc(t.evaluate(n),r.evaluate(n))]]},"feature-state":[ft,[it],(n,[t])=>fc(t.evaluate(n),n.featureState||{})],properties:[Tr,[],n=>n.properties()],"geometry-type":[it,[],n=>n.geometryType()],id:[ft,[],n=>n.id()],zoom:[Ie,[],n=>n.globals.zoom],"heatmap-density":[Ie,[],n=>n.globals.heatmapDensity||0],"line-progress":[Ie,[],n=>n.globals.lineProgress||0],accumulated:[ft,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[Ie,Ta(Ie),(n,t)=>{let r=0;for(const a of t)r+=a.evaluate(n);return r}],"*":[Ie,Ta(Ie),(n,t)=>{let r=1;for(const a of t)r*=a.evaluate(n);return r}],"-":{type:Ie,overloads:[[[Ie,Ie],(n,[t,r])=>t.evaluate(n)-r.evaluate(n)],[[Ie],(n,[t])=>-t.evaluate(n)]]},"/":[Ie,[Ie,Ie],(n,[t,r])=>t.evaluate(n)/r.evaluate(n)],"%":[Ie,[Ie,Ie],(n,[t,r])=>t.evaluate(n)%r.evaluate(n)],ln2:[Ie,[],()=>Math.LN2],pi:[Ie,[],()=>Math.PI],e:[Ie,[],()=>Math.E],"^":[Ie,[Ie,Ie],(n,[t,r])=>Math.pow(t.evaluate(n),r.evaluate(n))],sqrt:[Ie,[Ie],(n,[t])=>Math.sqrt(t.evaluate(n))],log10:[Ie,[Ie],(n,[t])=>Math.log(t.evaluate(n))/Math.LN10],ln:[Ie,[Ie],(n,[t])=>Math.log(t.evaluate(n))],log2:[Ie,[Ie],(n,[t])=>Math.log(t.evaluate(n))/Math.LN2],sin:[Ie,[Ie],(n,[t])=>Math.sin(t.evaluate(n))],cos:[Ie,[Ie],(n,[t])=>Math.cos(t.evaluate(n))],tan:[Ie,[Ie],(n,[t])=>Math.tan(t.evaluate(n))],asin:[Ie,[Ie],(n,[t])=>Math.asin(t.evaluate(n))],acos:[Ie,[Ie],(n,[t])=>Math.acos(t.evaluate(n))],atan:[Ie,[Ie],(n,[t])=>Math.atan(t.evaluate(n))],min:[Ie,Ta(Ie),(n,t)=>Math.min(...t.map(r=>r.evaluate(n)))],max:[Ie,Ta(Ie),(n,t)=>Math.max(...t.map(r=>r.evaluate(n)))],abs:[Ie,[Ie],(n,[t])=>Math.abs(t.evaluate(n))],round:[Ie,[Ie],(n,[t])=>{const r=t.evaluate(n);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ie,[Ie],(n,[t])=>Math.floor(t.evaluate(n))],ceil:[Ie,[Ie],(n,[t])=>Math.ceil(t.evaluate(n))],"filter-==":[pt,[it,ft],(n,[t,r])=>n.properties()[t.value]===r.value],"filter-id-==":[pt,[ft],(n,[t])=>n.id()===t.value],"filter-type-==":[pt,[it],(n,[t])=>n.geometryType()===t.value],"filter-<":[pt,[it,ft],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a<c}],"filter-id-<":[pt,[ft],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r<a}],"filter->":[pt,[it,ft],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a>c}],"filter-id->":[pt,[ft],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r>a}],"filter-<=":[pt,[it,ft],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a<=c}],"filter-id-<=":[pt,[ft],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r<=a}],"filter->=":[pt,[it,ft],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a>=c}],"filter-id->=":[pt,[ft],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r>=a}],"filter-has":[pt,[ft],(n,[t])=>t.value in n.properties()],"filter-has-id":[pt,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[pt,[Dr(it)],(n,[t])=>t.value.indexOf(n.geometryType())>=0],"filter-id-in":[pt,[Dr(ft)],(n,[t])=>t.value.indexOf(n.id())>=0],"filter-in-small":[pt,[it,Dr(ft)],(n,[t,r])=>r.value.indexOf(n.properties()[t.value])>=0],"filter-in-large":[pt,[it,Dr(ft)],(n,[t,r])=>function(a,c,d,p){for(;d<=p;){const m=d+p>>1;if(c[m]===a)return!0;c[m]>a?p=m-1:d=m+1}return!1}(n.properties()[t.value],r.value,0,r.value.length-1)],all:{type:pt,overloads:[[[pt,pt],(n,[t,r])=>t.evaluate(n)&&r.evaluate(n)],[Ta(pt),(n,t)=>{for(const r of t)if(!r.evaluate(n))return!1;return!0}]]},any:{type:pt,overloads:[[[pt,pt],(n,[t,r])=>t.evaluate(n)||r.evaluate(n)],[Ta(pt),(n,t)=>{for(const r of t)if(r.evaluate(n))return!0;return!1}]]},"!":[pt,[pt],(n,[t])=>!t.evaluate(n)],"is-supported-script":[pt,[it],(n,[t])=>{const r=n.globals&&n.globals.isSupportedScript;return!r||r(t.evaluate(n))}],upcase:[it,[it],(n,[t])=>t.evaluate(n).toUpperCase()],downcase:[it,[it],(n,[t])=>t.evaluate(n).toLowerCase()],concat:[it,Ta(ft),(n,t)=>t.map(r=>St(r.evaluate(n))).join("")],"resolved-locale":[it,[Na],(n,[t])=>t.evaluate(n).resolvedLocale()]});class Xo{constructor(t,r){this.expression=t,this._warningHistory={},this._evaluator=new tc,this._defaultValue=r?function(a){if(a.type==="color"&&Ho(a.default))return new Mt(0,0,0,0);switch(a.type){case"color":return Mt.parse(a.default)||null;case"padding":return $i.parse(a.default)||null;case"numberArray":return bi.parse(a.default)||null;case"colorArray":return Gi.parse(a.default)||null;case"variableAnchorOffsetCollection":return dr.parse(a.default)||null;case"projectionDefinition":return Sr.parse(a.default)||null;default:return a.default===void 0?null:a.default}}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,a,c,d,p){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=a,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(t,r,a,c,d,p){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=a||null,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p||null;try{const m=this.expression.evaluate(this._evaluator);if(m==null||typeof m=="number"&&m!=m)return this._defaultValue;if(this._enumValues&&!(m in this._enumValues))throw new Wt(`Expected value to be one of ${Object.keys(this._enumValues).map(y=>JSON.stringify(y)).join(", ")}, but found ${JSON.stringify(m)} instead.`);return m}catch(m){return this._warningHistory[m.message]||(this._warningHistory[m.message]=!0,typeof console<"u"&&console.warn(m.message)),this._defaultValue}}}function Us(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in Ka}function Ko(n,t){const r=new zs(Ka,Vo,[],t?function(c){const d={color:oi,string:it,number:Ie,enum:it,boolean:pt,formatted:Ms,padding:ua,numberArray:En,colorArray:Ss,projectionDefinition:li,resolvedImage:ha,variableAnchorOffsetCollection:vi};return c.type==="array"?Dr(d[c.value]||ft,c.length):d[c.type]}(t):void 0),a=r.parse(n,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?Go(new Xo(a,t)):Ya(r.errors)}class gc{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!Zs(r.expression)}evaluateWithoutErrorHandling(t,r,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,r,a,c,d,p)}evaluate(t,r,a,c,d,p){return this._styleExpression.evaluate(t,r,a,c,d,p)}}class Yo{constructor(t,r,a,c){this.kind=t,this.zoomStops=a,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!Zs(r.expression),this.interpolationType=c}evaluateWithoutErrorHandling(t,r,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,r,a,c,d,p)}evaluate(t,r,a,c,d,p){return this._styleExpression.evaluate(t,r,a,c,d,p)}interpolationFactor(t,r,a){return this.interpolationType?tr.interpolationFactor(this.interpolationType,t,r,a):0}}function _c(n,t){const r=Ko(n,t);if(r.result==="error")return r;const a=r.value.expression,c=Uo(a);if(!c&&!Ja(t))return Ya([new Tt("","data expressions not supported")]);const d=$o(a,["zoom"]);if(!d&&!hh(t))return Ya([new Tt("","zoom expressions not supported")]);const p=Gs(a);return p||d?p instanceof Tt?Ya([p]):p instanceof tr&&!qo(t)?Ya([new Tt("",'"interpolate" expressions cannot be used with this property')]):Go(p?new Yo(c?"camera":"composite",r.value,p.labels,p instanceof tr?p.interpolation:void 0):new gc(c?"constant":"source",r.value)):Ya([new Tt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class $s{constructor(t,r){this._parameters=t,this._specification=r,Lt(this,mc(this._parameters,this._specification))}static deserialize(t){return new $s(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Gs(n){let t=null;if(n instanceof Ha)t=Gs(n.result);else if(n instanceof ya){for(const r of n.args)if(t=Gs(r),t)break}else(n instanceof Hn||n instanceof tr)&&n.input instanceof Gr&&n.input.name==="zoom"&&(t=n);return t instanceof Tt||n.eachChild(r=>{const a=Gs(r);a instanceof Tt?t=a:!t&&a?t=new Tt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&a&&t!==a&&(t=new Tt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function qs(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const t of n.slice(1))if(!qs(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const yc={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Hs(n){if(n==null)return{filter:()=>!0,needGeometry:!1};qs(n)||(n=Qo(n));const t=Ko(n,yc);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,a,c)=>t.value.evaluate(r,a,{},c),needGeometry:ph(n)}}function Jo(n,t){return n<t?-1:n>t?1:0}function ph(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let t=1;t<n.length;t++)if(ph(n[t]))return!0;return!1}function Qo(n){if(!n)return!0;const t=n[0];return n.length<=1?t!=="any":t==="=="?xc(n[1],n[2],"=="):t==="!="?el(xc(n[1],n[2],"==")):t==="<"||t===">"||t==="<="||t===">="?xc(n[1],n[2],t):t==="any"?(r=n.slice(1),["any"].concat(r.map(Qo))):t==="all"?["all"].concat(n.slice(1).map(Qo)):t==="none"?["all"].concat(n.slice(1).map(Qo).map(el)):t==="in"?fh(n[1],n.slice(2)):t==="!in"?el(fh(n[1],n.slice(2))):t==="has"?mh(n[1]):t!=="!has"||el(mh(n[1]));var r}function xc(n,t,r){switch(n){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,n,t]}}function fh(n,t){if(t.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",n,["literal",t.sort(Jo)]]:["filter-in-small",n,["literal",t]]}}function mh(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function el(n){return["!",n]}function tl(n){const t=typeof n;if(t==="number"||t==="boolean"||t==="string"||n==null)return JSON.stringify(n);if(Array.isArray(n)){let c="[";for(const d of n)c+=`${tl(d)},`;return`${c}]`}const r=Object.keys(n).sort();let a="{";for(let c=0;c<r.length;c++)a+=`${JSON.stringify(r[c])}:${tl(n[r[c]])},`;return`${a}}`}function gh(n){let t="";for(const r of ge)t+=`/${tl(n[r])}`;return t}function Ws(n){const t=n.value;return t?[new we(n.key,t,"constants have been deprecated as of v8")]:[]}function gi(n){return n instanceof Number||n instanceof String||n instanceof Boolean?n.valueOf():n}function Xn(n){if(Array.isArray(n))return n.map(Xn);if(n instanceof Object&&!(n instanceof Number||n instanceof String||n instanceof Boolean)){const t={};for(const r in n)t[r]=Xn(n[r]);return t}return gi(n)}function Br(n){const t=n.key,r=n.value,a=n.valueSpec||{},c=n.objectElementValidators||{},d=n.style,p=n.styleSpec,m=n.validateSpec;let y=[];const w=xt(r);if(w!=="object")return[new we(t,r,`object expected, ${w} found`)];for(const M in r){const C=M.split(".")[0],k=Cs(a,C)||a["*"];let D;if(Cs(c,C))D=c[C];else if(Cs(a,C))D=m;else if(c["*"])D=c["*"];else{if(!a["*"]){y.push(new we(t,r[M],`unknown property "${M}"`));continue}D=m}y=y.concat(D({key:(t&&`${t}.`)+M,value:r[M],valueSpec:k,style:d,styleSpec:p,object:r,objectKey:M,validateSpec:m},r))}for(const M in a)c[M]||a[M].required&&a[M].default===void 0&&r[M]===void 0&&y.push(new we(t,r,`missing required property "${M}"`));return y}function vc(n){const t=n.value,r=n.valueSpec,a=n.style,c=n.styleSpec,d=n.key,p=n.arrayElementValidator||n.validateSpec;if(xt(t)!=="array")return[new we(d,t,`array expected, ${xt(t)} found`)];if(r.length&&t.length!==r.length)return[new we(d,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new we(d,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let m={type:r.value,values:r.values};c.$version<7&&(m.function=r.function),xt(r.value)==="object"&&(m=r.value);let y=[];for(let w=0;w<t.length;w++)y=y.concat(p({array:t,arrayIndex:w,value:t[w],valueSpec:m,validateSpec:n.validateSpec,style:a,styleSpec:c,key:`${d}[${w}]`}));return y}function Xs(n){const t=n.key,r=n.value,a=n.valueSpec;let c=xt(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new we(t,r,`number expected, ${c} found`)]:"minimum"in a&&r<a.minimum?[new we(t,r,`${r} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&r>a.maximum?[new we(t,r,`${r} is greater than the maximum value ${a.maximum}`)]:[]}function bc(n){const t=n.valueSpec,r=gi(n.value.type);let a,c,d,p={};const m=r!=="categorical"&&n.value.property===void 0,y=!m,w=xt(n.value.stops)==="array"&&xt(n.value.stops[0])==="array"&&xt(n.value.stops[0][0])==="object",M=Br({key:n.key,value:n.value,valueSpec:n.styleSpec.function,validateSpec:n.validateSpec,style:n.style,styleSpec:n.styleSpec,objectElementValidators:{stops:function(D){if(r==="identity")return[new we(D.key,D.value,'identity function may not have a "stops" property')];let L=[];const j=D.value;return L=L.concat(vc({key:D.key,value:j,valueSpec:D.valueSpec,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,arrayElementValidator:C})),xt(j)==="array"&&j.length===0&&L.push(new we(D.key,j,"array must have at least one stop")),L},default:function(D){return D.validateSpec({key:D.key,value:D.value,valueSpec:t,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec})}}});return r==="identity"&&m&&M.push(new we(n.key,n.value,'missing required property "property"')),r==="identity"||n.value.stops||M.push(new we(n.key,n.value,'missing required property "stops"')),r==="exponential"&&n.valueSpec.expression&&!qo(n.valueSpec)&&M.push(new we(n.key,n.value,"exponential functions not supported")),n.styleSpec.$version>=8&&(y&&!Ja(n.valueSpec)?M.push(new we(n.key,n.value,"property functions not supported")):m&&!hh(n.valueSpec)&&M.push(new we(n.key,n.value,"zoom functions not supported"))),r!=="categorical"&&!w||n.value.property!==void 0||M.push(new we(n.key,n.value,'"property" property is required')),M;function C(D){let L=[];const j=D.value,U=D.key;if(xt(j)!=="array")return[new we(U,j,`array expected, ${xt(j)} found`)];if(j.length!==2)return[new we(U,j,`array length 2 expected, length ${j.length} found`)];if(w){if(xt(j[0])!=="object")return[new we(U,j,`object expected, ${xt(j[0])} found`)];if(j[0].zoom===void 0)return[new we(U,j,"object stop key must have zoom")];if(j[0].value===void 0)return[new we(U,j,"object stop key must have value")];if(d&&d>gi(j[0].zoom))return[new we(U,j[0].zoom,"stop zoom values must appear in ascending order")];gi(j[0].zoom)!==d&&(d=gi(j[0].zoom),c=void 0,p={}),L=L.concat(Br({key:`${U}[0]`,value:j[0],valueSpec:{zoom:{}},validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,objectElementValidators:{zoom:Xs,value:k}}))}else L=L.concat(k({key:`${U}[0]`,value:j[0],validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec},j));return Us(Xn(j[1]))?L.concat([new we(`${U}[1]`,j[1],"expressions are not allowed in function stops.")]):L.concat(D.validateSpec({key:`${U}[1]`,value:j[1],valueSpec:t,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec}))}function k(D,L){const j=xt(D.value),U=gi(D.value),X=D.value!==null?D.value:L;if(a){if(j!==a)return[new we(D.key,X,`${j} stop domain type must match previous stop domain type ${a}`)]}else a=j;if(j!=="number"&&j!=="string"&&j!=="boolean")return[new we(D.key,X,"stop domain value must be a number, string, or boolean")];if(j!=="number"&&r!=="categorical"){let ne=`number expected, ${j} found`;return Ja(t)&&r===void 0&&(ne+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new we(D.key,X,ne)]}return r!=="categorical"||j!=="number"||isFinite(U)&&Math.floor(U)===U?r!=="categorical"&&j==="number"&&c!==void 0&&U<c?[new we(D.key,X,"stop domain values must appear in ascending order")]:(c=U,r==="categorical"&&U in p?[new we(D.key,X,"stop domain values must be unique")]:(p[U]=!0,[])):[new we(D.key,X,`integer expected, found ${U}`)]}}function mn(n){const t=(n.expressionContext==="property"?_c:Ko)(Xn(n.value),n.valueSpec);if(t.result==="error")return t.value.map(a=>new we(`${n.key}${a.key}`,n.value,a.message));const r=t.value.expression||t.value._styleExpression.expression;if(n.expressionContext==="property"&&n.propertyKey==="text-font"&&!r.outputDefined())return[new we(n.key,n.value,`Invalid data expression for "${n.propertyKey}". Output values must be contained as literals within the expression.`)];if(n.expressionContext==="property"&&n.propertyType==="layout"&&!Zs(r))return[new we(n.key,n.value,'"feature-state" data expressions are not supported with layout properties.')];if(n.expressionContext==="filter"&&!Zs(r))return[new we(n.key,n.value,'"feature-state" data expressions are not supported with filters.')];if(n.expressionContext&&n.expressionContext.indexOf("cluster")===0){if(!$o(r,["zoom","feature-state"]))return[new we(n.key,n.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(n.expressionContext==="cluster-initial"&&!Uo(r))return[new we(n.key,n.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function wc(n){const t=n.key,r=n.value,a=xt(r);return a!=="string"?[new we(t,r,`color expected, ${a} found`)]:Mt.parse(String(r))?[]:[new we(t,r,`color expected, "${r}" found`)]}function Ks(n){const t=n.key,r=n.value,a=n.valueSpec,c=[];return Array.isArray(a.values)?a.values.indexOf(gi(r))===-1&&c.push(new we(t,r,`expected one of [${a.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(a.values).indexOf(gi(r))===-1&&c.push(new we(t,r,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function Tc(n){return qs(Xn(n.value))?mn(Lt({},n,{expressionContext:"filter",valueSpec:{value:"boolean"}})):_h(n)}function _h(n){const t=n.value,r=n.key;if(xt(t)!=="array")return[new we(r,t,`array expected, ${xt(t)} found`)];const a=n.styleSpec;let c,d=[];if(t.length<1)return[new we(r,t,"filter array must have at least 1 element")];switch(d=d.concat(Ks({key:`${r}[0]`,value:t[0],valueSpec:a.filter_operator,style:n.style,styleSpec:n.styleSpec})),gi(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&gi(t[1])==="$type"&&d.push(new we(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&d.push(new we(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(c=xt(t[1]),c!=="string"&&d.push(new we(`${r}[1]`,t[1],`string expected, ${c} found`)));for(let p=2;p<t.length;p++)c=xt(t[p]),gi(t[1])==="$type"?d=d.concat(Ks({key:`${r}[${p}]`,value:t[p],valueSpec:a.geometry_type,style:n.style,styleSpec:n.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&d.push(new we(`${r}[${p}]`,t[p],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let p=1;p<t.length;p++)d=d.concat(_h({key:`${r}[${p}]`,value:t[p],style:n.style,styleSpec:n.styleSpec}));break;case"has":case"!has":c=xt(t[1]),t.length!==2?d.push(new we(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):c!=="string"&&d.push(new we(`${r}[1]`,t[1],`string expected, ${c} found`))}return d}function yh(n,t){const r=n.key,a=n.validateSpec,c=n.style,d=n.styleSpec,p=n.value,m=n.objectKey,y=d[`${t}_${n.layerType}`];if(!y)return[];const w=m.match(/^(.*)-transition$/);if(t==="paint"&&w&&y[w[1]]&&y[w[1]].transition)return a({key:r,value:p,valueSpec:d.transition,style:c,styleSpec:d});const M=n.valueSpec||y[m];if(!M)return[new we(r,p,`unknown property "${m}"`)];let C;if(xt(p)==="string"&&Ja(M)&&!M.tokens&&(C=/^{([^}]+)}$/.exec(p)))return[new we(r,p,`"${m}" does not support interpolation syntax
6
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(C[1])} }\`.`)];const k=[];return n.layerType==="symbol"&&(m==="text-field"&&c&&!c.glyphs&&k.push(new we(r,p,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&Ho(Xn(p))&&gi(p.type)==="identity"&&k.push(new we(r,p,'"text-font" does not support identity functions'))),k.concat(a({key:n.key,value:p,valueSpec:M,style:c,styleSpec:d,expressionContext:"property",propertyType:t,propertyKey:m}))}function xh(n){return yh(n,"paint")}function Qa(n){return yh(n,"layout")}function es(n){let t=[];const r=n.value,a=n.key,c=n.style,d=n.styleSpec;if(xt(r)!=="object")return[new we(a,r,`object expected, ${xt(r)} found`)];r.type||r.ref||t.push(new we(a,r,'either "type" or "ref" is required'));let p=gi(r.type);const m=gi(r.ref);if(r.id){const y=gi(r.id);for(let w=0;w<n.arrayIndex;w++){const M=c.layers[w];gi(M.id)===y&&t.push(new we(a,r.id,`duplicate layer id "${r.id}", previously used at line ${M.id.__line__}`))}}if("ref"in r){let y;["type","source","source-layer","filter","layout"].forEach(w=>{w in r&&t.push(new we(a,r[w],`"${w}" is prohibited for ref layers`))}),c.layers.forEach(w=>{gi(w.id)===m&&(y=w)}),y?y.ref?t.push(new we(a,r.ref,"ref cannot reference another ref layer")):p=gi(y.type):t.push(new we(a,r.ref,`ref layer "${m}" not found`))}else if(p!=="background")if(r.source){const y=c.sources&&c.sources[r.source],w=y&&gi(y.type);y?w==="vector"&&p==="raster"?t.push(new we(a,r.source,`layer "${r.id}" requires a raster source`)):w!=="raster-dem"&&p==="hillshade"?t.push(new we(a,r.source,`layer "${r.id}" requires a raster-dem source`)):w==="raster"&&p!=="raster"?t.push(new we(a,r.source,`layer "${r.id}" requires a vector source`)):w!=="vector"||r["source-layer"]?w==="raster-dem"&&p!=="hillshade"?t.push(new we(a,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||w==="geojson"&&y.lineMetrics||t.push(new we(a,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new we(a,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new we(a,r.source,`source "${r.source}" not found`))}else t.push(new we(a,r,'missing required property "source"'));return t=t.concat(Br({key:a,value:r,valueSpec:d.layer,style:n.style,styleSpec:n.styleSpec,validateSpec:n.validateSpec,objectElementValidators:{"*":()=>[],type:()=>n.validateSpec({key:`${a}.type`,value:r.type,valueSpec:d.layer.type,style:n.style,styleSpec:n.styleSpec,validateSpec:n.validateSpec,object:r,objectKey:"type"}),filter:Tc,layout:y=>Br({layer:r,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":w=>Qa(Lt({layerType:p},w))}}),paint:y=>Br({layer:r,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":w=>xh(Lt({layerType:p},w))}})}})),t}function Ei(n){const t=n.value,r=n.key,a=xt(t);return a!=="string"?[new we(r,t,`string expected, ${a} found`)]:[]}const ts={promoteId:function({key:n,value:t}){if(xt(t)==="string")return Ei({key:n,value:t});{const r=[];for(const a in t)r.push(...Ei({key:`${n}.${a}`,value:t[a]}));return r}}};function Mc(n){const t=n.value,r=n.key,a=n.styleSpec,c=n.style,d=n.validateSpec;if(!t.type)return[new we(r,t,'"type" is required')];const p=gi(t.type);let m;switch(p){case"vector":case"raster":return m=Br({key:r,value:t,valueSpec:a[`source_${p.replace("-","_")}`],style:n.style,styleSpec:a,objectElementValidators:ts,validateSpec:d}),m;case"raster-dem":return m=function(y){var w;const M=(w=y.sourceName)!==null&&w!==void 0?w:"",C=y.value,k=y.styleSpec,D=k.source_raster_dem,L=y.style;let j=[];const U=xt(C);if(C===void 0)return j;if(U!=="object")return j.push(new we("source_raster_dem",C,`object expected, ${U} found`)),j;const X=gi(C.encoding)==="custom",ne=["redFactor","greenFactor","blueFactor","baseShift"],Y=y.value.encoding?`"${y.value.encoding}"`:"Default";for(const R in C)!X&&ne.includes(R)?j.push(new we(R,C[R],`In "${M}": "${R}" is only valid when "encoding" is set to "custom". ${Y} encoding found`)):D[R]?j=j.concat(y.validateSpec({key:R,value:C[R],valueSpec:D[R],validateSpec:y.validateSpec,style:L,styleSpec:k})):j.push(new we(R,C[R],`unknown property "${R}"`));return j}({sourceName:r,value:t,style:n.style,styleSpec:a,validateSpec:d}),m;case"geojson":if(m=Br({key:r,value:t,valueSpec:a.source_geojson,style:c,styleSpec:a,validateSpec:d,objectElementValidators:ts}),t.cluster)for(const y in t.clusterProperties){const[w,M]=t.clusterProperties[y],C=typeof w=="string"?[w,["accumulated"],["get",y]]:w;m.push(...mn({key:`${r}.${y}.map`,value:M,expressionContext:"cluster-map"})),m.push(...mn({key:`${r}.${y}.reduce`,value:C,expressionContext:"cluster-reduce"}))}return m;case"video":return Br({key:r,value:t,valueSpec:a.source_video,style:c,validateSpec:d,styleSpec:a});case"image":return Br({key:r,value:t,valueSpec:a.source_image,style:c,validateSpec:d,styleSpec:a});case"canvas":return[new we(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ks({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function vh(n){const t=n.value,r=n.styleSpec,a=r.light,c=n.style;let d=[];const p=xt(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new we("light",t,`object expected, ${p} found`)]),d;for(const m in t){const y=m.match(/^(.*)-transition$/);d=d.concat(y&&a[y[1]]&&a[y[1]].transition?n.validateSpec({key:m,value:t[m],valueSpec:r.transition,validateSpec:n.validateSpec,style:c,styleSpec:r}):a[m]?n.validateSpec({key:m,value:t[m],valueSpec:a[m],validateSpec:n.validateSpec,style:c,styleSpec:r}):[new we(m,t[m],`unknown property "${m}"`)])}return d}function bh(n){const t=n.value,r=n.styleSpec,a=r.sky,c=n.style,d=xt(t);if(t===void 0)return[];if(d!=="object")return[new we("sky",t,`object expected, ${d} found`)];let p=[];for(const m in t)p=p.concat(a[m]?n.validateSpec({key:m,value:t[m],valueSpec:a[m],style:c,styleSpec:r}):[new we(m,t[m],`unknown property "${m}"`)]);return p}function is(n){const t=n.value,r=n.styleSpec,a=r.terrain,c=n.style;let d=[];const p=xt(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new we("terrain",t,`object expected, ${p} found`)]),d;for(const m in t)d=d.concat(a[m]?n.validateSpec({key:m,value:t[m],valueSpec:a[m],validateSpec:n.validateSpec,style:c,styleSpec:r}):[new we(m,t[m],`unknown property "${m}"`)]);return d}function Sc(n){let t=[];const r=n.value,a=n.key;if(Array.isArray(r)){const c=[],d=[];for(const p in r)r[p].id&&c.includes(r[p].id)&&t.push(new we(a,r,`all the sprites' ids must be unique, but ${r[p].id} is duplicated`)),c.push(r[p].id),r[p].url&&d.includes(r[p].url)&&t.push(new we(a,r,`all the sprites' URLs must be unique, but ${r[p].url} is duplicated`)),d.push(r[p].url),t=t.concat(Br({key:`${a}[${p}]`,value:r[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:n.validateSpec}));return t}return Ei({key:a,value:r})}function il(n){return t=n.value,t&&t.constructor===Object?[]:[new we(n.key,n.value,`object expected, ${xt(n.value)} found`)];var t}const wh={"*":()=>[],array:vc,boolean:function(n){const t=n.value,r=n.key,a=xt(t);return a!=="boolean"?[new we(r,t,`boolean expected, ${a} found`)]:[]},number:Xs,color:wc,constants:Ws,enum:Ks,filter:Tc,function:bc,layer:es,object:Br,source:Mc,light:vh,sky:bh,terrain:is,projection:function(n){const t=n.value,r=n.styleSpec,a=r.projection,c=n.style,d=xt(t);if(t===void 0)return[];if(d!=="object")return[new we("projection",t,`object expected, ${d} found`)];let p=[];for(const m in t)p=p.concat(a[m]?n.validateSpec({key:m,value:t[m],valueSpec:a[m],style:c,styleSpec:r}):[new we(m,t[m],`unknown property "${m}"`)]);return p},projectionDefinition:function(n){const t=n.key;let r=n.value;r=r instanceof String?r.valueOf():r;const a=xt(r);return a!=="array"||function(c){return Array.isArray(c)&&c.length===3&&typeof c[0]=="string"&&typeof c[1]=="string"&&typeof c[2]=="number"}(r)||function(c){return!!["interpolate","step","literal"].includes(c[0])}(r)?["array","string"].includes(a)?[]:[new we(t,r,`projection expected, invalid type "${a}" found`)]:[new we(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:Ei,formatted:function(n){return Ei(n).length===0?[]:mn(n)},resolvedImage:function(n){return Ei(n).length===0?[]:mn(n)},padding:function(n){const t=n.key,r=n.value;if(xt(r)==="array"){if(r.length<1||r.length>4)return[new we(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];const a={type:"number"};let c=[];for(let d=0;d<r.length;d++)c=c.concat(n.validateSpec({key:`${t}[${d}]`,value:r[d],validateSpec:n.validateSpec,valueSpec:a}));return c}return Xs({key:t,value:r,valueSpec:{}})},numberArray:function(n){const t=n.key,r=n.value;if(xt(r)==="array"){const a={type:"number"};if(r.length<1)return[new we(t,r,"array length at least 1 expected, length 0 found")];let c=[];for(let d=0;d<r.length;d++)c=c.concat(n.validateSpec({key:`${t}[${d}]`,value:r[d],validateSpec:n.validateSpec,valueSpec:a}));return c}return Xs({key:t,value:r,valueSpec:{}})},colorArray:function(n){const t=n.key,r=n.value;if(xt(r)==="array"){if(r.length<1)return[new we(t,r,"array length at least 1 expected, length 0 found")];let a=[];for(let c=0;c<r.length;c++)a=a.concat(wc({key:`${t}[${c}]`,value:r[c]}));return a}return wc({key:t,value:r})},variableAnchorOffsetCollection:function(n){const t=n.key,r=n.value,a=xt(r),c=n.styleSpec;if(a!=="array"||r.length<1||r.length%2!=0)return[new we(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let p=0;p<r.length;p+=2)d=d.concat(Ks({key:`${t}[${p}]`,value:r[p],valueSpec:c.layout_symbol["text-anchor"]})),d=d.concat(vc({key:`${t}[${p+1}]`,value:r[p+1],valueSpec:{length:2,value:"number"},validateSpec:n.validateSpec,style:n.style,styleSpec:c}));return d},sprite:Sc,state:il};function rs(n){const t=n.value,r=n.valueSpec,a=n.styleSpec;return n.validateSpec=rs,r.expression&&Ho(gi(t))?bc(n):r.expression&&Us(Xn(t))?mn(n):r.type&&wh[r.type]?wh[r.type](n):Br(Lt({},n,{valueSpec:r.type?a[r.type]:r}))}function Th(n){const t=n.value,r=n.key,a=Ei(n);return a.length||(t.indexOf("{fontstack}")===-1&&a.push(new we(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&a.push(new we(r,t,'"glyphs" url must include a "{range}" token'))),a}function ir(n,t=$){let r=[];return r=r.concat(rs({key:"",value:n,valueSpec:t.$root,styleSpec:t,style:n,validateSpec:rs,objectElementValidators:{glyphs:Th,"*":()=>[]}})),n.constants&&(r=r.concat(Ws({key:"constants",value:n.constants}))),ns(r)}function Qr(n){return function(t){return n({...t,validateSpec:rs})}}function ns(n){return[].concat(n).sort((t,r)=>t.line-r.line)}function en(n){return function(...t){return ns(n.apply(this,t))}}ir.source=en(Qr(Mc)),ir.sprite=en(Qr(Sc)),ir.glyphs=en(Qr(Th)),ir.light=en(Qr(vh)),ir.sky=en(Qr(bh)),ir.terrain=en(Qr(is)),ir.state=en(Qr(il)),ir.layer=en(Qr(es)),ir.filter=en(Qr(Tc)),ir.paintProperty=en(Qr(xh)),ir.layoutProperty=en(Qr(Qa));const as=ir,rl=as.light,qd=as.sky,Pc=as.paintProperty,nl=as.layoutProperty;function Cc(n,t){let r=!1;if(t&&t.length)for(const a of t)n.fire(new J(new Error(a.message))),r=!0;return r}class ss{constructor(t,r,a){const c=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const p=new Int32Array(this.arrayBuffer);t=p[0],this.d=(r=p[1])+2*(a=p[2]);for(let y=0;y<this.d*this.d;y++){const w=p[3+y],M=p[3+y+1];c.push(w===M?null:p.subarray(w,M))}const m=p[3+c.length+1];this.keys=p.subarray(p[3+c.length],m),this.bboxes=p.subarray(m),this.insert=this._insertReadonly}else{this.d=r+2*a;for(let p=0;p<this.d*this.d;p++)c.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=a,this.scale=r/t,this.uid=0;const d=a/r*t;this.min=-d,this.max=t+d}insert(t,r,a,c,d){this._forEachCell(r,a,c,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(c),this.bboxes.push(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,a,c,d,p){this.cells[d].push(p)}query(t,r,a,c,d){const p=this.min,m=this.max;if(t<=p&&r<=p&&m<=a&&m<=c&&!d)return Array.prototype.slice.call(this.keys);{const y=[];return this._forEachCell(t,r,a,c,this._queryCell,y,{},d),y}}_queryCell(t,r,a,c,d,p,m,y){const w=this.cells[d];if(w!==null){const M=this.keys,C=this.bboxes;for(let k=0;k<w.length;k++){const D=w[k];if(m[D]===void 0){const L=4*D;(y?y(C[L+0],C[L+1],C[L+2],C[L+3]):t<=C[L+2]&&r<=C[L+3]&&a>=C[L+0]&&c>=C[L+1])?(m[D]=!0,p.push(M[D])):m[D]=!1}}}}_forEachCell(t,r,a,c,d,p,m,y){const w=this._convertToCellCoord(t),M=this._convertToCellCoord(r),C=this._convertToCellCoord(a),k=this._convertToCellCoord(c);for(let D=w;D<=C;D++)for(let L=M;L<=k;L++){const j=this.d*L+D;if((!y||y(this._convertFromCellCoord(D),this._convertFromCellCoord(L),this._convertFromCellCoord(D+1),this._convertFromCellCoord(L+1)))&&d.call(this,t,r,a,c,j,p,m,y))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,r=3+this.cells.length+1+1;let a=0;for(let p=0;p<this.cells.length;p++)a+=this.cells[p].length;const c=new Int32Array(r+a+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let d=r;for(let p=0;p<t.length;p++){const m=t[p];c[3+p]=d,c.set(m,d),d+=m.length}return c[3+t.length]=d,c.set(this.keys,d),d+=this.keys.length,c[3+t.length+1]=d,c.set(this.bboxes,d),d+=this.bboxes.length,c.buffer}static serialize(t,r){const a=t.toArrayBuffer();return r&&r.push(a),{buffer:a}}static deserialize(t){return new ss(t.buffer)}}const gn={};function $e(n,t,r={}){if(gn[n])throw new Error(`${n} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:n,writeable:!1}),gn[n]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}$e("Object",Object),$e("TransferableGridIndex",ss),$e("Color",Mt),$e("Error",Error),$e("AJAXError",Ur),$e("ResolvedImage",Lr),$e("StylePropertyFunction",$s),$e("StyleExpression",Xo,{omit:["_evaluator"]}),$e("ZoomDependentExpression",Yo),$e("ZoomConstantExpression",gc),$e("CompoundExpression",Gr,{omit:["_evaluate"]});for(const n in Ka)Ka[n]._classRegistryKey||$e(`Expression_${n}`,Ka[n]);function al(n){return n&&typeof ArrayBuffer<"u"&&(n instanceof ArrayBuffer||n.constructor&&n.constructor.name==="ArrayBuffer")}function sl(n){return n.$name||n.constructor._classRegistryKey}function Mh(n){return!function(t){if(t===null||typeof t!="object")return!1;const r=sl(t);return!(!r||r==="Object")}(n)&&(n==null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"||n instanceof Boolean||n instanceof Number||n instanceof String||n instanceof Date||n instanceof RegExp||n instanceof Blob||n instanceof Error||al(n)||br(n)||ArrayBuffer.isView(n)||n instanceof ImageData)}function os(n,t){if(Mh(n))return(al(n)||br(n))&&t&&t.push(n),ArrayBuffer.isView(n)&&t&&t.push(n.buffer),n instanceof ImageData&&t&&t.push(n.data.buffer),n;if(Array.isArray(n)){const d=[];for(const p of n)d.push(os(p,t));return d}if(typeof n!="object")throw new Error("can't serialize object of type "+typeof n);const r=sl(n);if(!r)throw new Error(`can't serialize object of unregistered class ${n.constructor.name}`);if(!gn[r])throw new Error(`${r} is not registered.`);const{klass:a}=gn[r],c=a.serialize?a.serialize(n,t):{};if(a.serialize){if(t&&c===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const d in n){if(!n.hasOwnProperty(d)||gn[r].omit.indexOf(d)>=0)continue;const p=n[d];c[d]=gn[r].shallow.indexOf(d)>=0?p:os(p,t)}n instanceof Error&&(c.message=n.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(c.$name=r),c}function Ys(n){if(Mh(n))return n;if(Array.isArray(n))return n.map(Ys);if(typeof n!="object")throw new Error("can't deserialize object of type "+typeof n);const t=sl(n)||"Object";if(!gn[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:r}=gn[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(n);const a=Object.create(r.prototype);for(const c of Object.keys(n)){if(c==="$name")continue;const d=n[c];a[c]=gn[t].shallow.indexOf(c)>=0?d:Ys(d)}return a}class Ic{constructor(){this.first=!0}update(t,r){const a=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<a&&(this.lastIntegerZoom=a,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=a,!0))}}const vt={"Latin-1 Supplement":n=>n>=128&&n<=255,"Hangul Jamo":n=>n>=4352&&n<=4607,Khmer:n=>n>=6016&&n<=6143,"General Punctuation":n=>n>=8192&&n<=8303,"Letterlike Symbols":n=>n>=8448&&n<=8527,"Number Forms":n=>n>=8528&&n<=8591,"Miscellaneous Technical":n=>n>=8960&&n<=9215,"Control Pictures":n=>n>=9216&&n<=9279,"Optical Character Recognition":n=>n>=9280&&n<=9311,"Enclosed Alphanumerics":n=>n>=9312&&n<=9471,"Geometric Shapes":n=>n>=9632&&n<=9727,"Miscellaneous Symbols":n=>n>=9728&&n<=9983,"Miscellaneous Symbols and Arrows":n=>n>=11008&&n<=11263,"Ideographic Description Characters":n=>n>=12272&&n<=12287,"CJK Symbols and Punctuation":n=>n>=12288&&n<=12351,Hiragana:n=>n>=12352&&n<=12447,Katakana:n=>n>=12448&&n<=12543,Kanbun:n=>n>=12688&&n<=12703,"CJK Strokes":n=>n>=12736&&n<=12783,"Enclosed CJK Letters and Months":n=>n>=12800&&n<=13055,"CJK Compatibility":n=>n>=13056&&n<=13311,"Yijing Hexagram Symbols":n=>n>=19904&&n<=19967,"CJK Unified Ideographs":n=>n>=19968&&n<=40959,"Hangul Syllables":n=>n>=44032&&n<=55215,"Private Use Area":n=>n>=57344&&n<=63743,"Vertical Forms":n=>n>=65040&&n<=65055,"CJK Compatibility Forms":n=>n>=65072&&n<=65103,"Small Form Variants":n=>n>=65104&&n<=65135,"Halfwidth and Fullwidth Forms":n=>n>=65280&&n<=65519};function ol(n){for(const t of n)if(ll(t.charCodeAt(0)))return!0;return!1}function Hd(n){for(const t of n)if(!Ph(t.charCodeAt(0)))return!1;return!0}function Ec(n){const t=n.map(r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(t.join("|"),"u")}const Sh=Ec(["Arab","Dupl","Mong","Ougr","Syrc"]);function Ph(n){return!Sh.test(String.fromCodePoint(n))}const Ac=Ec(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function ll(n){return!(n!==746&&n!==747&&(n<4352||!(vt["CJK Compatibility Forms"](n)&&!(n>=65097&&n<=65103)||vt["CJK Compatibility"](n)||vt["CJK Strokes"](n)||!(!vt["CJK Symbols and Punctuation"](n)||n>=12296&&n<=12305||n>=12308&&n<=12319||n===12336)||vt["Enclosed CJK Letters and Months"](n)||vt["Ideographic Description Characters"](n)||vt.Kanbun(n)||vt.Katakana(n)&&n!==12540||!(!vt["Halfwidth and Fullwidth Forms"](n)||n===65288||n===65289||n===65293||n>=65306&&n<=65310||n===65339||n===65341||n===65343||n>=65371&&n<=65503||n===65507||n>=65512&&n<=65519)||!(!vt["Small Form Variants"](n)||n>=65112&&n<=65118||n>=65123&&n<=65126)||vt["Vertical Forms"](n)||vt["Yijing Hexagram Symbols"](n)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(n))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(n))||Ac.test(String.fromCodePoint(n)))))}function Js(n){return!(ll(n)||function(t){return!!(vt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||vt["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||vt["Letterlike Symbols"](t)||vt["Number Forms"](t)||vt["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||vt["Control Pictures"](t)&&t!==9251||vt["Optical Character Recognition"](t)||vt["Enclosed Alphanumerics"](t)||vt["Geometric Shapes"](t)||vt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||vt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||vt["CJK Symbols and Punctuation"](t)||vt.Katakana(t)||vt["Private Use Area"](t)||vt["CJK Compatibility Forms"](t)||vt["Small Form Variants"](t)||vt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(n))}const Wd=Ec(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function cl(n){return Wd.test(String.fromCodePoint(n))}function Xd(n,t){return!(!t&&cl(n)||n>=2304&&n<=3583||n>=3840&&n<=4255||vt.Khmer(n))}function Kd(n){for(const t of n)if(cl(t.charCodeAt(0)))return!0;return!1}const zn=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(n){this.pluginStatus=n.pluginStatus,this.pluginURL=n.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(n){if(zn.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=n.applyArabicShaping,this.processBidirectionalText=n.processBidirectionalText,this.processStyledBidirectionalText=n.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(n,t){return o(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(n.pluginStatus!=="loading")return this.setState(n),n;const r=n.pluginURL,a=new Promise(d=>{this.loadScriptResolve=d});t(r);const c=new Promise(d=>setTimeout(()=>d(),this.TIMEOUT));if(yield Promise.race([a,c]),this.isParsed()){const d={pluginStatus:"loaded",pluginURL:r};return this.setState(d),d}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${r}`)})}};class Xt{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ic,this.transition={})}isSupportedScript(t){return function(r,a){for(const c of r)if(!Xd(c.charCodeAt(0),a))return!1;return!0}(t,zn.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,r=t-Math.floor(t),a=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*r}}}class Qs{constructor(t,r){this.property=t,this.value=r,this.expression=function(a,c){if(Ho(a))return new $s(a,c);if(Us(a)){const d=_c(a,c);if(d.result==="error")throw new Error(d.value.map(p=>`${p.key}: ${p.message}`).join(", "));return d.value}{let d=a;return c.type==="color"&&typeof a=="string"?d=Mt.parse(a):c.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?c.type!=="numberArray"||typeof a!="number"&&!Array.isArray(a)?c.type!=="colorArray"||typeof a!="string"&&!Array.isArray(a)?c.type==="variableAnchorOffsetCollection"&&Array.isArray(a)?d=dr.parse(a):c.type==="projectionDefinition"&&typeof a=="string"&&(d=Sr.parse(a)):d=Gi.parse(a):d=bi.parse(a):d=$i.parse(a),{kind:"constant",evaluate:()=>d}}}(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,a){return this.property.possiblyEvaluate(this,t,r,a)}}class kc{constructor(t){this.property=t,this.value=new Qs(t,void 0)}transitioned(t,r){return new Ih(this.property,this.value,r,Qi({},t.transition,this.transition),t.now)}untransitioned(){return new Ih(this.property,this.value,null,{},0)}}class Ch{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return or(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new kc(this._values[t].property)),this._values[t].value=new Qs(this._values[t].property,r===null?void 0:or(r))}getTransition(t){return or(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new kc(this._values[t].property)),this._values[t].transition=or(r)||void 0}serialize(){const t={};for(const r of Object.keys(this._values)){const a=this.getValue(r);a!==void 0&&(t[r]=a);const c=this.getTransition(r);c!==void 0&&(t[`${r}-transition`]=c)}return t}transitioned(t,r){const a=new Eh(this._properties);for(const c of Object.keys(this._values))a._values[c]=this._values[c].transitioned(t,r._values[c]);return a}untransitioned(){const t=new Eh(this._properties);for(const r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class Ih{constructor(t,r,a,c,d){this.property=t,this.value=r,this.begin=d+c.delay||0,this.end=this.begin+c.duration||0,t.specification.transition&&(c.delay||c.duration)&&(this.prior=a)}possiblyEvaluate(t,r,a){const c=t.now||0,d=this.value.possiblyEvaluate(t,r,a),p=this.prior;if(p){if(c>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(c<this.begin)return p.possiblyEvaluate(t,r,a);{const m=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(t,r,a),d,kr(m))}}return d}}class Eh{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,a){const c=new ul(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,r,a);return c}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Yd{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return or(this._values[t].value)}setValue(t,r){this._values[t]=new Qs(this._values[t].property,r===null?void 0:or(r))}serialize(){const t={};for(const r of Object.keys(this._values)){const a=this.getValue(r);a!==void 0&&(t[r]=a)}return t}possiblyEvaluate(t,r,a){const c=new ul(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,r,a);return c}}class pr{constructor(t,r,a){this.property=t,this.value=r,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,a,c){return this.property.evaluate(this.value,this.parameters,t,r,a,c)}}class ul{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Ke{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,a){const c=pn[this.specification.type];return c?c(t,r,a):t}}class rt{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,a,c){return new pr(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},a,c)}:t.expression,r)}interpolate(t,r,a){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new pr(this,{kind:"constant",value:void 0},t.parameters);const c=pn[this.specification.type];if(c){const d=c(t.value.value,r.value.value,a);return new pr(this,{kind:"constant",value:d},t.parameters)}return t}evaluate(t,r,a,c,d,p){return t.kind==="constant"?t.value:t.evaluate(r,a,c,d,p)}}class eo extends rt{possiblyEvaluate(t,r,a,c){if(t.value===void 0)return new pr(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){const d=t.expression.evaluate(r,null,{},a,c),p=t.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,m=this._calculate(p,p,p,r);return new pr(this,{kind:"constant",value:m},r)}if(t.expression.kind==="camera"){const d=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new pr(this,{kind:"constant",value:d},r)}return new pr(this,t.expression,r)}evaluate(t,r,a,c,d,p){if(t.kind==="source"){const m=t.evaluate(r,a,c,d,p);return this._calculate(m,m,m,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},a,c),t.evaluate({zoom:Math.floor(r.zoom)},a,c),t.evaluate({zoom:Math.floor(r.zoom)+1},a,c),r):t.value}_calculate(t,r,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:a,to:r}}interpolate(t){return t}}class zc{constructor(t){this.specification=t}possiblyEvaluate(t,r,a,c){if(t.value!==void 0){if(t.expression.kind==="constant"){const d=t.expression.evaluate(r,null,{},a,c);return this._calculate(d,d,d,r)}return this._calculate(t.expression.evaluate(new Xt(Math.floor(r.zoom-1),r)),t.expression.evaluate(new Xt(Math.floor(r.zoom),r)),t.expression.evaluate(new Xt(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:a,to:r}}interpolate(t){return t}}class Rc{constructor(t){this.specification=t}possiblyEvaluate(t,r,a,c){return!!t.expression.evaluate(r,null,{},a,c)}interpolate(){return!1}}class Ti{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in t){const a=t[r];a.specification.overridable&&this.overridableProperties.push(r);const c=this.defaultPropertyValues[r]=new Qs(a,void 0),d=this.defaultTransitionablePropertyValues[r]=new kc(a);this.defaultTransitioningPropertyValues[r]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}$e("DataDrivenProperty",rt),$e("DataConstantProperty",Ke),$e("CrossFadedDataDrivenProperty",eo),$e("CrossFadedProperty",zc),$e("ColorRampProperty",Rc);const Dc="-transition";class qr extends ae{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),r.layout&&(this._unevaluatedLayout=new Yd(r.layout)),r.paint)){this._transitionablePaint=new Ch(r.paint);for(const a in t.paint)this.setPaintProperty(a,t.paint[a],{validate:!1});for(const a in t.layout)this.setLayoutProperty(a,t.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ul(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,r,a={}){r!=null&&this._validate(nl,`layers.${this.id}.layout.${t}`,t,r,a)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(Dc)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,a={}){if(r!=null&&this._validate(Pc,`layers.${this.id}.paint.${t}`,t,r,a))return!1;if(t.endsWith(Dc))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{const c=this._transitionablePaint._values[t],d=c.property.specification["property-type"]==="cross-faded-data-driven",p=c.value.isDataDriven(),m=c.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);const y=this._transitionablePaint._values[t].value;return y.isDataDriven()||p||d||this._handleOverridablePaintPropertyUpdate(t,m,y)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,a){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),ca(t,(r,a)=>!(r===void 0||a==="layout"&&!Object.keys(r).length||a==="paint"&&!Object.keys(r).length))}_validate(t,r,a,c,d={}){return(!d||d.validate!==!1)&&Cc(this,t.call(as,{key:r,layerType:this.type,objectKey:a,value:c,styleSpec:$,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const r=this.paint.get(t);if(r instanceof pr&&Ja(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Ah={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ma{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ui{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ii(n,t=1){let r=0,a=0;return{members:n.map(c=>{const d=Ah[c.type].BYTES_PER_ELEMENT,p=r=ls(r,Math.max(t,d)),m=c.components||1;return a=Math.max(a,d),r+=d*m,{name:c.name,type:c.type,components:m,offset:p}}),size:ls(r,Math.max(a,t)),alignment:t}}function ls(n,t){return Math.ceil(n/t)*t}class to extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){const a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){const c=2*t;return this.int16[c+0]=r,this.int16[c+1]=a,t}}to.prototype.bytesPerElement=4,$e("StructArrayLayout2i4",to);class io extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=3*t;return this.int16[d+0]=r,this.int16[d+1]=a,this.int16[d+2]=c,t}}io.prototype.bytesPerElement=6,$e("StructArrayLayout3i6",io);class Sa extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,r,a,c)}emplace(t,r,a,c,d){const p=4*t;return this.int16[p+0]=r,this.int16[p+1]=a,this.int16[p+2]=c,this.int16[p+3]=d,t}}Sa.prototype.bytesPerElement=8,$e("StructArrayLayout4i8",Sa);class Lc extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,a,c,d,p)}emplace(t,r,a,c,d,p,m){const y=6*t;return this.int16[y+0]=r,this.int16[y+1]=a,this.int16[y+2]=c,this.int16[y+3]=d,this.int16[y+4]=p,this.int16[y+5]=m,t}}Lc.prototype.bytesPerElement=12,$e("StructArrayLayout2i4i12",Lc);class Bc extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,a,c,d,p)}emplace(t,r,a,c,d,p,m){const y=4*t,w=8*t;return this.int16[y+0]=r,this.int16[y+1]=a,this.uint8[w+4]=c,this.uint8[w+5]=d,this.uint8[w+6]=p,this.uint8[w+7]=m,t}}Bc.prototype.bytesPerElement=8,$e("StructArrayLayout2i4ub8",Bc);class cs extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){const a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){const c=2*t;return this.float32[c+0]=r,this.float32[c+1]=a,t}}cs.prototype.bytesPerElement=8,$e("StructArrayLayout2f8",cs);class Fc extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,w,M){const C=this.length;return this.resize(C+1),this.emplace(C,t,r,a,c,d,p,m,y,w,M)}emplace(t,r,a,c,d,p,m,y,w,M,C){const k=10*t;return this.uint16[k+0]=r,this.uint16[k+1]=a,this.uint16[k+2]=c,this.uint16[k+3]=d,this.uint16[k+4]=p,this.uint16[k+5]=m,this.uint16[k+6]=y,this.uint16[k+7]=w,this.uint16[k+8]=M,this.uint16[k+9]=C,t}}Fc.prototype.bytesPerElement=20,$e("StructArrayLayout10ui20",Fc);class u extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,w,M,C,k){const D=this.length;return this.resize(D+1),this.emplace(D,t,r,a,c,d,p,m,y,w,M,C,k)}emplace(t,r,a,c,d,p,m,y,w,M,C,k,D){const L=12*t;return this.int16[L+0]=r,this.int16[L+1]=a,this.int16[L+2]=c,this.int16[L+3]=d,this.uint16[L+4]=p,this.uint16[L+5]=m,this.uint16[L+6]=y,this.uint16[L+7]=w,this.int16[L+8]=M,this.int16[L+9]=C,this.int16[L+10]=k,this.int16[L+11]=D,t}}u.prototype.bytesPerElement=24,$e("StructArrayLayout4i4ui4i24",u);class e extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=3*t;return this.float32[d+0]=r,this.float32[d+1]=a,this.float32[d+2]=c,t}}e.prototype.bytesPerElement=12,$e("StructArrayLayout3f12",e);class i extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}i.prototype.bytesPerElement=4,$e("StructArrayLayout1ul4",i);class s extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,w){const M=this.length;return this.resize(M+1),this.emplace(M,t,r,a,c,d,p,m,y,w)}emplace(t,r,a,c,d,p,m,y,w,M){const C=10*t,k=5*t;return this.int16[C+0]=r,this.int16[C+1]=a,this.int16[C+2]=c,this.int16[C+3]=d,this.int16[C+4]=p,this.int16[C+5]=m,this.uint32[k+3]=y,this.uint16[C+8]=w,this.uint16[C+9]=M,t}}s.prototype.bytesPerElement=20,$e("StructArrayLayout6i1ul2ui20",s);class l extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,a,c,d,p)}emplace(t,r,a,c,d,p,m){const y=6*t;return this.int16[y+0]=r,this.int16[y+1]=a,this.int16[y+2]=c,this.int16[y+3]=d,this.int16[y+4]=p,this.int16[y+5]=m,t}}l.prototype.bytesPerElement=12,$e("StructArrayLayout2i2i2i12",l);class h extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d){const p=this.length;return this.resize(p+1),this.emplace(p,t,r,a,c,d)}emplace(t,r,a,c,d,p){const m=4*t,y=8*t;return this.float32[m+0]=r,this.float32[m+1]=a,this.float32[m+2]=c,this.int16[y+6]=d,this.int16[y+7]=p,t}}h.prototype.bytesPerElement=16,$e("StructArrayLayout2f1f2i16",h);class f extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,a,c,d,p)}emplace(t,r,a,c,d,p,m){const y=16*t,w=4*t,M=8*t;return this.uint8[y+0]=r,this.uint8[y+1]=a,this.float32[w+1]=c,this.float32[w+2]=d,this.int16[M+6]=p,this.int16[M+7]=m,t}}f.prototype.bytesPerElement=16,$e("StructArrayLayout2ub2f2i16",f);class _ extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=3*t;return this.uint16[d+0]=r,this.uint16[d+1]=a,this.uint16[d+2]=c,t}}_.prototype.bytesPerElement=6,$e("StructArrayLayout3ui6",_);class x extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,w,M,C,k,D,L,j,U,X){const ne=this.length;return this.resize(ne+1),this.emplace(ne,t,r,a,c,d,p,m,y,w,M,C,k,D,L,j,U,X)}emplace(t,r,a,c,d,p,m,y,w,M,C,k,D,L,j,U,X,ne){const Y=24*t,R=12*t,V=48*t;return this.int16[Y+0]=r,this.int16[Y+1]=a,this.uint16[Y+2]=c,this.uint16[Y+3]=d,this.uint32[R+2]=p,this.uint32[R+3]=m,this.uint32[R+4]=y,this.uint16[Y+10]=w,this.uint16[Y+11]=M,this.uint16[Y+12]=C,this.float32[R+7]=k,this.float32[R+8]=D,this.uint8[V+36]=L,this.uint8[V+37]=j,this.uint8[V+38]=U,this.uint32[R+10]=X,this.int16[Y+22]=ne,t}}x.prototype.bytesPerElement=48,$e("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",x);class T extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,w,M,C,k,D,L,j,U,X,ne,Y,R,V,Q,fe,ke,ye,Te,De,ze){const Le=this.length;return this.resize(Le+1),this.emplace(Le,t,r,a,c,d,p,m,y,w,M,C,k,D,L,j,U,X,ne,Y,R,V,Q,fe,ke,ye,Te,De,ze)}emplace(t,r,a,c,d,p,m,y,w,M,C,k,D,L,j,U,X,ne,Y,R,V,Q,fe,ke,ye,Te,De,ze,Le){const Se=32*t,Ge=16*t;return this.int16[Se+0]=r,this.int16[Se+1]=a,this.int16[Se+2]=c,this.int16[Se+3]=d,this.int16[Se+4]=p,this.int16[Se+5]=m,this.int16[Se+6]=y,this.int16[Se+7]=w,this.uint16[Se+8]=M,this.uint16[Se+9]=C,this.uint16[Se+10]=k,this.uint16[Se+11]=D,this.uint16[Se+12]=L,this.uint16[Se+13]=j,this.uint16[Se+14]=U,this.uint16[Se+15]=X,this.uint16[Se+16]=ne,this.uint16[Se+17]=Y,this.uint16[Se+18]=R,this.uint16[Se+19]=V,this.uint16[Se+20]=Q,this.uint16[Se+21]=fe,this.uint16[Se+22]=ke,this.uint32[Ge+12]=ye,this.float32[Ge+13]=Te,this.float32[Ge+14]=De,this.uint16[Se+30]=ze,this.uint16[Se+31]=Le,t}}T.prototype.bytesPerElement=64,$e("StructArrayLayout8i15ui1ul2f2ui64",T);class P extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}P.prototype.bytesPerElement=4,$e("StructArrayLayout1f4",P);class A extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=3*t;return this.uint16[6*t+0]=r,this.float32[d+1]=a,this.float32[d+2]=c,t}}A.prototype.bytesPerElement=12,$e("StructArrayLayout1ui2f12",A);class E extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=4*t;return this.uint32[2*t+0]=r,this.uint16[d+2]=a,this.uint16[d+3]=c,t}}E.prototype.bytesPerElement=8,$e("StructArrayLayout1ul2ui8",E);class F extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){const a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){const c=2*t;return this.uint16[c+0]=r,this.uint16[c+1]=a,t}}F.prototype.bytesPerElement=4,$e("StructArrayLayout2ui4",F);class O extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}O.prototype.bytesPerElement=2,$e("StructArrayLayout1ui2",O);class H extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,r,a,c)}emplace(t,r,a,c,d){const p=4*t;return this.float32[p+0]=r,this.float32[p+1]=a,this.float32[p+2]=c,this.float32[p+3]=d,t}}H.prototype.bytesPerElement=16,$e("StructArrayLayout4f16",H);class q extends Ma{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new Fe(this.anchorPointX,this.anchorPointY)}}q.prototype.size=20;class W extends s{get(t){return new q(this,t)}}$e("CollisionBoxArray",W);class K extends Ma{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}K.prototype.size=48;class te extends x{get(t){return new K(this,t)}}$e("PlacedSymbolArray",te);class ee extends Ma{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}ee.prototype.size=64;class ie extends T{get(t){return new ee(this,t)}}$e("SymbolInstanceArray",ie);class se extends P{getoffsetX(t){return this.float32[1*t+0]}}$e("GlyphOffsetArray",se);class re extends io{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}$e("SymbolLineVertexArray",re);class pe extends Ma{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}pe.prototype.size=12;class Me extends A{get(t){return new pe(this,t)}}$e("TextAnchorOffsetArray",Me);class xe extends Ma{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]}}xe.prototype.size=8;class ve extends E{get(t){return new xe(this,t)}}$e("FeatureIndexArray",ve);class be extends to{}class Ne extends to{}class Oe extends to{}class Re extends Lc{}class He extends Bc{}class gt extends cs{}class Pt extends Fc{}class ri extends u{}class Ut extends e{}class ni extends i{}class ai extends l{}class Gt extends f{}class zt extends _{}class Ai extends F{}const Bi=ii([{name:"a_pos",components:2,type:"Int16"}],4),{members:qi}=Bi;class Rt{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,r,a,c){const d=this.segments[this.segments.length-1];return t>Rt.MAX_VERTEX_ARRAY_LENGTH&&Ui(`Max vertices per segment is ${Rt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Rt.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!d||d.vertexLength+t>Rt.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==c?this.createNewSegment(r,a,c):d}createNewSegment(t,r,a){const c={vertexOffset:t.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return a!==void 0&&(c.sortKey=a),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(c),c}getOrCreateLatestSegment(t,r,a){return this.prepareSegment(0,t,r,a)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,a,c){return new Rt([{vertexOffset:t,primitiveOffset:r,vertexLength:a,primitiveLength:c,vaos:{},sortKey:0}])}}function Kn(n,t){return 256*(n=Ht(Math.floor(n),0,255))+Ht(Math.floor(t),0,255)}Rt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,$e("SegmentVector",Rt);const _n=ii([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Yn,Pa,ro,Jn={exports:{}},Ca={exports:{}},Fr={exports:{}},Qn=function(){if(ro)return Jn.exports;ro=1;var n=(Yn||(Yn=1,Ca.exports=function(r,a){var c,d,p,m,y,w,M,C;for(d=r.length-(c=3&r.length),p=a,y=3432918353,w=461845907,C=0;C<d;)M=255&r.charCodeAt(C)|(255&r.charCodeAt(++C))<<8|(255&r.charCodeAt(++C))<<16|(255&r.charCodeAt(++C))<<24,++C,p=27492+(65535&(m=5*(65535&(p=(p^=M=(65535&(M=(M=(65535&M)*y+(((M>>>16)*y&65535)<<16)&4294967295)<<15|M>>>17))*w+(((M>>>16)*w&65535)<<16)&4294967295)<<13|p>>>19))+((5*(p>>>16)&65535)<<16)&4294967295))+((58964+(m>>>16)&65535)<<16);switch(M=0,c){case 3:M^=(255&r.charCodeAt(C+2))<<16;case 2:M^=(255&r.charCodeAt(C+1))<<8;case 1:p^=M=(65535&(M=(M=(65535&(M^=255&r.charCodeAt(C)))*y+(((M>>>16)*y&65535)<<16)&4294967295)<<15|M>>>17))*w+(((M>>>16)*w&65535)<<16)&4294967295}return p^=r.length,p=2246822507*(65535&(p^=p>>>16))+((2246822507*(p>>>16)&65535)<<16)&4294967295,p=3266489909*(65535&(p^=p>>>13))+((3266489909*(p>>>16)&65535)<<16)&4294967295,(p^=p>>>16)>>>0}),Ca.exports),t=(Pa||(Pa=1,Fr.exports=function(r,a){for(var c,d=r.length,p=a^d,m=0;d>=4;)c=1540483477*(65535&(c=255&r.charCodeAt(m)|(255&r.charCodeAt(++m))<<8|(255&r.charCodeAt(++m))<<16|(255&r.charCodeAt(++m))<<24))+((1540483477*(c>>>16)&65535)<<16),p=1540483477*(65535&p)+((1540483477*(p>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),d-=4,++m;switch(d){case 3:p^=(255&r.charCodeAt(m+2))<<16;case 2:p^=(255&r.charCodeAt(m+1))<<8;case 1:p=1540483477*(65535&(p^=255&r.charCodeAt(m)))+((1540483477*(p>>>16)&65535)<<16)}return p=1540483477*(65535&(p^=p>>>13))+((1540483477*(p>>>16)&65535)<<16),(p^=p>>>15)>>>0}),Fr.exports);return Jn.exports=n,Jn.exports.murmur3=n,Jn.exports.murmur2=t,Jn.exports}(),Rn=he(Qn);class ea{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,a,c){this.ids.push(Mi(t)),this.positions.push(r,a,c)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Mi(t);let a=0,c=this.ids.length-1;for(;a<c;){const p=a+c>>1;this.ids[p]>=r?c=p:a=p+1}const d=[];for(;this.ids[a]===r;)d.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return d}static serialize(t,r){const a=new Float64Array(t.ids),c=new Uint32Array(t.positions);return Si(a,c,0,a.length-1),r&&r.push(a.buffer,c.buffer),{ids:a,positions:c}}static deserialize(t){const r=new ea;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function Mi(n){const t=+n;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:Rn(String(n))}function Si(n,t,r,a){for(;r<a;){const c=n[r+a>>1];let d=r-1,p=a+1;for(;;){do d++;while(n[d]<c);do p--;while(n[p]>c);if(d>=p)break;fr(n,d,p),fr(t,3*d,3*p),fr(t,3*d+1,3*p+1),fr(t,3*d+2,3*p+2)}p-r<a-p?(Si(n,t,r,p),r=p+1):(Si(n,t,p+1,a),a=p)}}function fr(n,t,r){const a=n[t];n[t]=n[r],n[r]=a}$e("FeaturePositionMap",ea);class Kt{constructor(t,r){this.gl=t.gl,this.location=r}}class hl extends Kt{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class kh extends Kt{constructor(t,r){super(t,r),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class zh extends Kt{constructor(t,r){super(t,r),this.current=Mt.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const Jd=new Float32Array(16);function Oc(n){return[Kn(255*n.r,255*n.g),Kn(255*n.b,255*n.a)]}class no{constructor(t,r,a){this.value=t,this.uniformNames=r.map(c=>`u_${c}`),this.type=a}setUniform(t,r,a){t.set(a.constantOr(this.value))}getBinding(t,r,a){return this.type==="color"?new zh(t,r):new hl(t,r)}}class Hr{constructor(t,r){this.uniformNames=r.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,a,c){const d=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;d&&t.set(d)}getBinding(t,r,a){return a.substr(0,9)==="u_pattern"?new kh(t,r):new hl(t,r)}}class yn{constructor(t,r,a,c){this.expression=t,this.type=a,this.maxValue=0,this.paintVertexAttributes=r.map(d=>({name:`a_${d}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(t,r,a,c,d){const p=this.paintVertexArray.length,m=this.expression.evaluate(new Xt(0),r,{},c,[],d);this.paintVertexArray.resize(t),this._setPaintValue(p,t,m)}updatePaintArray(t,r,a,c){const d=this.expression.evaluate({zoom:0},a,c);this._setPaintValue(t,r,d)}_setPaintValue(t,r,a){if(this.type==="color"){const c=Oc(a);for(let d=t;d<r;d++)this.paintVertexArray.emplace(d,c[0],c[1])}else{for(let c=t;c<r;c++)this.paintVertexArray.emplace(c,a);this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Wr{constructor(t,r,a,c,d,p){this.expression=t,this.uniformNames=r.map(m=>`u_${m}_t`),this.type=a,this.useIntegerZoom=c,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:a==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(t,r,a,c,d){const p=this.expression.evaluate(new Xt(this.zoom),r,{},c,[],d),m=this.expression.evaluate(new Xt(this.zoom+1),r,{},c,[],d),y=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(y,t,p,m)}updatePaintArray(t,r,a,c){const d=this.expression.evaluate({zoom:this.zoom},a,c),p=this.expression.evaluate({zoom:this.zoom+1},a,c);this._setPaintValue(t,r,d,p)}_setPaintValue(t,r,a,c){if(this.type==="color"){const d=Oc(a),p=Oc(c);for(let m=t;m<r;m++)this.paintVertexArray.emplace(m,d[0],d[1],p[0],p[1])}else{for(let d=t;d<r;d++)this.paintVertexArray.emplace(d,a,c);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(c))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,r){const a=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,c=Ht(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);t.set(c)}getBinding(t,r,a){return new hl(t,r)}}class Dn{constructor(t,r,a,c,d,p){this.expression=t,this.type=r,this.useIntegerZoom=a,this.zoom=c,this.layerId=p,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(t,r,a){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(c,t,r.patterns&&r.patterns[this.layerId],a)}updatePaintArray(t,r,a,c,d){this._setPaintValues(t,r,a.patterns&&a.patterns[this.layerId],d)}_setPaintValues(t,r,a,c){if(!c||!a)return;const{min:d,mid:p,max:m}=a,y=c[d],w=c[p],M=c[m];if(y&&w&&M)for(let C=t;C<r;C++)this.zoomInPaintVertexArray.emplace(C,w.tl[0],w.tl[1],w.br[0],w.br[1],y.tl[0],y.tl[1],y.br[0],y.br[1],w.pixelRatio,y.pixelRatio),this.zoomOutPaintVertexArray.emplace(C,w.tl[0],w.tl[1],w.br[0],w.br[1],M.tl[0],M.tl[1],M.br[0],M.br[1],w.pixelRatio,M.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,_n.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,_n.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class dl{constructor(t,r,a){this.binders={},this._buffers=[];const c=[];for(const d in t.paint._values){if(!a(d))continue;const p=t.paint.get(d);if(!(p instanceof pr&&Ja(p.property.specification)))continue;const m=jc(d,t.type),y=p.value,w=p.property.specification.type,M=p.property.useIntegerZoom,C=p.property.specification["property-type"],k=C==="cross-faded"||C==="cross-faded-data-driven";if(y.kind==="constant")this.binders[d]=k?new Hr(y.value,m):new no(y.value,m,w),c.push(`/u_${d}`);else if(y.kind==="source"||k){const D=tm(d,w,"source");this.binders[d]=k?new Dn(y,w,M,r,D,t.id):new yn(y,m,w,D),c.push(`/a_${d}`)}else{const D=tm(d,w,"composite");this.binders[d]=new Wr(y,m,w,M,r,D),c.push(`/z_${d}`)}}this.cacheKey=c.sort().join("")}getMaxValue(t){const r=this.binders[t];return r instanceof yn||r instanceof Wr?r.maxValue:0}populatePaintArrays(t,r,a,c,d){for(const p in this.binders){const m=this.binders[p];(m instanceof yn||m instanceof Wr||m instanceof Dn)&&m.populatePaintArray(t,r,a,c,d)}}setConstantPatternPositions(t,r){for(const a in this.binders){const c=this.binders[a];c instanceof Hr&&c.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,a,c,d){let p=!1;for(const m in t){const y=r.getPositions(m);for(const w of y){const M=a.feature(w.index);for(const C in this.binders){const k=this.binders[C];if((k instanceof yn||k instanceof Wr||k instanceof Dn)&&k.expression.isStateDependent===!0){const D=c.paint.get(C);k.expression=D.value,k.updatePaintArray(w.start,w.end,M,t[m],d),p=!0}}}}return p}defines(){const t=[];for(const r in this.binders){const a=this.binders[r];(a instanceof no||a instanceof Hr)&&t.push(...a.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return t}getBinderAttributes(){const t=[];for(const r in this.binders){const a=this.binders[r];if(a instanceof yn||a instanceof Wr)for(let c=0;c<a.paintVertexAttributes.length;c++)t.push(a.paintVertexAttributes[c].name);else if(a instanceof Dn)for(let c=0;c<_n.members.length;c++)t.push(_n.members[c].name)}return t}getBinderUniforms(){const t=[];for(const r in this.binders){const a=this.binders[r];if(a instanceof no||a instanceof Hr||a instanceof Wr)for(const c of a.uniformNames)t.push(c)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){const a=[];for(const c in this.binders){const d=this.binders[c];if(d instanceof no||d instanceof Hr||d instanceof Wr){for(const p of d.uniformNames)if(r[p]){const m=d.getBinding(t,r[p],p);a.push({name:p,property:c,binding:m})}}}return a}setUniforms(t,r,a,c){for(const{name:d,property:p,binding:m}of r)this.binders[p].setUniform(m,c,a.get(p),d)}updatePaintBuffers(t){this._buffers=[];for(const r in this.binders){const a=this.binders[r];if(t&&a instanceof Dn){const c=t.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(a instanceof yn||a instanceof Wr)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(t){for(const r in this.binders){const a=this.binders[r];(a instanceof yn||a instanceof Wr||a instanceof Dn)&&a.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const r=this.binders[t];(r instanceof yn||r instanceof Wr||r instanceof Dn)&&r.destroy()}}}class ta{constructor(t,r,a=()=>!0){this.programConfigurations={};for(const c of t)this.programConfigurations[c.id]=new dl(c,r,a);this.needsUpload=!1,this._featureMap=new ea,this._bufferOffset=0}populatePaintArrays(t,r,a,c,d,p){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(t,r,c,d,p);r.id!==void 0&&this._featureMap.add(r.id,a,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,a,c){for(const d of a)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(t,this._featureMap,r,d,c)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function jc(n,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"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"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[n]||[n.replace(`${t}-`,"").replace(/-/g,"_")]}function tm(n,t,r){const a={color:{source:cs,composite:H},number:{source:P,composite:cs}},c=function(d){return{"line-pattern":{source:Pt,composite:Pt},"fill-pattern":{source:Pt,composite:Pt},"fill-extrusion-pattern":{source:Pt,composite:Pt}}[d]}(n);return c&&c[r]||a[t][r]}$e("ConstantBinder",no),$e("CrossFadedConstantBinder",Hr),$e("SourceExpressionBinder",yn),$e("CrossFadedCompositeBinder",Dn),$e("CompositeExpressionBinder",Wr),$e("ProgramConfiguration",dl,{omit:["_buffers"]}),$e("ProgramConfigurationSet",ta);const Qd=Math.pow(2,14)-1,im=-Qd-1;function ao(n){const t=Et/n.extent,r=n.loadGeometry();for(let a=0;a<r.length;a++){const c=r[a];for(let d=0;d<c.length;d++){const p=c[d],m=Math.round(p.x*t),y=Math.round(p.y*t);p.x=Ht(m,im,Qd),p.y=Ht(y,im,Qd),(m<p.x||m>p.x+1||y<p.y||y>p.y+1)&&Ui("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function so(n,t){return{type:n.type,id:n.id,properties:n.properties,geometry:t?ao(n):[]}}const rm=-32768;function Px(n,t,r,a,c){n.emplaceBack(rm+8*t+a,rm+8*r+c)}class ep{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ne,this.indexArray=new zt,this.segments=new Rt,this.programConfigurations=new ta(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){const c=this.layers[0],d=[];let p=null,m=!1,y=c.type==="heatmap";if(c.type==="circle"){const M=c;p=M.layout.get("circle-sort-key"),m=!p.isConstant(),y=y||M.paint.get("circle-pitch-alignment")==="map"}const w=y?r.subdivisionGranularity.circle:1;for(const{feature:M,id:C,index:k,sourceLayerIndex:D}of t){const L=this.layers[0]._featureFilter.needGeometry,j=so(M,L);if(!this.layers[0]._featureFilter.filter(new Xt(this.zoom),j,a))continue;const U=m?p.evaluate(j,{},a):void 0,X={id:C,properties:M.properties,type:M.type,sourceLayerIndex:D,index:k,geometry:L?j.geometry:ao(M),patterns:{},sortKey:U};d.push(X)}m&&d.sort((M,C)=>M.sortKey-C.sortKey);for(const M of d){const{geometry:C,index:k,sourceLayerIndex:D}=M,L=t[k].feature;this.addFeature(M,C,k,a,w),r.featureIndex.insert(L,C,k,D,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,qi),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,a,c,d=1){let p;switch(d){case 1:p=[0,7];break;case 3:p=[0,2,5,7];break;case 5:p=[0,1,3,4,6,7];break;case 7:p=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${d}; valid values are 1, 3, 5, 7.`)}const m=p.length;for(const y of r)for(const w of y){const M=w.x,C=w.y;if(M<0||M>=Et||C<0||C>=Et)continue;const k=this.segments.prepareSegment(m*m,this.layoutVertexArray,this.indexArray,t.sortKey),D=k.vertexLength;for(let L=0;L<m;L++)for(let j=0;j<m;j++)Px(this.layoutVertexArray,M,C,p[j],p[L]);for(let L=0;L<m-1;L++)for(let j=0;j<m-1;j++){const U=D+L*m+j,X=D+(L+1)*m+j;this.indexArray.emplaceBack(U,X+1,U+1),this.indexArray.emplaceBack(U,X,X+1)}k.vertexLength+=m*m,k.primitiveLength+=(m-1)*(m-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,{},c)}}function nm(n,t){for(let r=0;r<n.length;r++)if(oo(t,n[r]))return!0;for(let r=0;r<t.length;r++)if(oo(n,t[r]))return!0;return!!tp(n,t)}function Cx(n,t,r){return!!oo(n,t)||!!ip(t,n,r)}function am(n,t){if(n.length===1)return om(t,n[0]);for(let r=0;r<t.length;r++){const a=t[r];for(let c=0;c<a.length;c++)if(oo(n,a[c]))return!0}for(let r=0;r<n.length;r++)if(om(t,n[r]))return!0;for(let r=0;r<t.length;r++)if(tp(n,t[r]))return!0;return!1}function Ix(n,t,r){if(n.length>1){if(tp(n,t))return!0;for(let a=0;a<t.length;a++)if(ip(t[a],n,r))return!0}for(let a=0;a<n.length;a++)if(ip(n[a],t,r))return!0;return!1}function tp(n,t){if(n.length===0||t.length===0)return!1;for(let r=0;r<n.length-1;r++){const a=n[r],c=n[r+1];for(let d=0;d<t.length-1;d++)if(Ex(a,c,t[d],t[d+1]))return!0}return!1}function Ex(n,t,r,a){return Zt(n,r,a)!==Zt(t,r,a)&&Zt(n,t,r)!==Zt(n,t,a)}function ip(n,t,r){const a=r*r;if(t.length===1)return n.distSqr(t[0])<a;for(let c=1;c<t.length;c++)if(sm(n,t[c-1],t[c])<a)return!0;return!1}function sm(n,t,r){const a=t.distSqr(r);if(a===0)return n.distSqr(t);const c=((n.x-t.x)*(r.x-t.x)+(n.y-t.y)*(r.y-t.y))/a;return n.distSqr(c<0?t:c>1?r:r.sub(t)._mult(c)._add(t))}function om(n,t){for(let r=0;r<n.length;r++)if(oo(n[r],t))return!0;return!1}function oo(n,t){let r=!1;for(let a=0,c=n.length-1;a<n.length;c=a++){const d=n[a],p=n[c];d.y>t.y!=p.y>t.y&&t.x<(p.x-d.x)*(t.y-d.y)/(p.y-d.y)+d.x&&(r=!r)}return r}function Ax(n,t,r){const a=r[0],c=r[2];if(n.x<a.x&&t.x<a.x||n.x>c.x&&t.x>c.x||n.y<a.y&&t.y<a.y||n.y>c.y&&t.y>c.y)return!1;const d=Zt(n,t,r[0]);return d!==Zt(n,t,r[1])||d!==Zt(n,t,r[2])||d!==Zt(n,t,r[3])}function Nc(n,t,r){const a=t.paint.get(n).value;return a.kind==="constant"?a.value:r.programConfigurations.get(t.id).getMaxValue(n)}function Rh(n){return Math.sqrt(n[0]*n[0]+n[1]*n[1])}function Dh(n,t,r,a,c){if(!t[0]&&!t[1])return n;const d=Fe.convert(t)._mult(c);r==="viewport"&&d._rotate(-a);const p=[];for(let m=0;m<n.length;m++)p.push(n[m].sub(d));return p}let lm,cm;$e("CircleBucket",ep,{omit:["layers"]});var kx={get paint(){return cm=cm||new Ti({"circle-radius":new rt($.paint_circle["circle-radius"]),"circle-color":new rt($.paint_circle["circle-color"]),"circle-blur":new rt($.paint_circle["circle-blur"]),"circle-opacity":new rt($.paint_circle["circle-opacity"]),"circle-translate":new Ke($.paint_circle["circle-translate"]),"circle-translate-anchor":new Ke($.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ke($.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ke($.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new rt($.paint_circle["circle-stroke-width"]),"circle-stroke-color":new rt($.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new rt($.paint_circle["circle-stroke-opacity"])})},get layout(){return lm=lm||new Ti({"circle-sort-key":new rt($.layout_circle["circle-sort-key"])})}};class zx extends qr{constructor(t){super(t,kx)}createBucket(t){return new ep(t)}queryRadius(t){const r=t;return Nc("circle-radius",this,r)+Nc("circle-stroke-width",this,r)+Rh(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,unwrappedTileID:m,getElevation:y}){const w=Dh(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-d.bearingInRadians,p),M=this.paint.get("circle-radius").evaluate(r,a)+this.paint.get("circle-stroke-width").evaluate(r,a),C=this.paint.get("circle-pitch-alignment")==="map",k=C?w:function(L,j,U,X){return L.map(ne=>um(ne,j,U,X))}(w,d,m,y),D=C?M*p:M;for(const L of c)for(const j of L){const U=C?j:um(j,d,m,y);let X=D;const ne=d.projectTileCoordinates(j.x,j.y,m,y).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?X*=ne/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(X*=d.cameraToCenterDistance/ne),Cx(k,U,X))return!0}return!1}}function um(n,t,r,a){const c=t.projectTileCoordinates(n.x,n.y,r,a).point;return new Fe((.5*c.x+.5)*t.width,(.5*-c.y+.5)*t.height)}class hm extends ep{}let dm;$e("HeatmapBucket",hm,{omit:["layers"]});var Rx={get paint(){return dm=dm||new Ti({"heatmap-radius":new rt($.paint_heatmap["heatmap-radius"]),"heatmap-weight":new rt($.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ke($.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Rc($.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ke($.paint_heatmap["heatmap-opacity"])})}};function rp(n,{width:t,height:r},a,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==t*r*a)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${t*r*a}`)}else c=new Uint8Array(t*r*a);return n.width=t,n.height=r,n.data=c,n}function pm(n,{width:t,height:r},a){if(t===n.width&&r===n.height)return;const c=rp({},{width:t,height:r},a);np(n,c,{x:0,y:0},{x:0,y:0},{width:Math.min(n.width,t),height:Math.min(n.height,r)},a),n.width=t,n.height=r,n.data=c.data}function np(n,t,r,a,c,d){if(c.width===0||c.height===0)return t;if(c.width>n.width||c.height>n.height||r.x>n.width-c.width||r.y>n.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>t.width||c.height>t.height||a.x>t.width-c.width||a.y>t.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const p=n.data,m=t.data;if(p===m)throw new Error("srcData equals dstData, so image is already copied");for(let y=0;y<c.height;y++){const w=((r.y+y)*n.width+r.x)*d,M=((a.y+y)*t.width+a.x)*d;for(let C=0;C<c.width*d;C++)m[M+C]=p[w+C]}return t}class Zc{constructor(t,r){rp(this,t,1,r)}resize(t){pm(this,t,1)}clone(){return new Zc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,a,c,d){np(t,r,a,c,d,1)}}class tn{constructor(t,r){rp(this,t,4,r)}resize(t){pm(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new tn({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,a,c,d){np(t,r,a,c,d,4)}}function fm(n){const t={},r=n.resolution||256,a=n.clips?n.clips.length:1,c=n.image||new tn({width:r,height:a});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const d=(p,m,y)=>{t[n.evaluationKey]=y;const w=n.expression.evaluate(t);c.data[p+m+0]=Math.floor(255*w.r/w.a),c.data[p+m+1]=Math.floor(255*w.g/w.a),c.data[p+m+2]=Math.floor(255*w.b/w.a),c.data[p+m+3]=Math.floor(255*w.a)};if(n.clips)for(let p=0,m=0;p<a;++p,m+=4*r)for(let y=0,w=0;y<r;y++,w+=4){const M=y/(r-1),{start:C,end:k}=n.clips[p];d(m,w,C*(1-M)+k*M)}else for(let p=0,m=0;p<r;p++,m+=4)d(0,m,p/(r-1));return c}$e("AlphaImage",Zc),$e("RGBAImage",tn);const ap="big-fb";class Dx extends qr{createBucket(t){return new hm(t)}constructor(t){super(t,Rx),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=fm({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(ap)&&this.heatmapFbos.delete(ap)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let mm;var Lx={get paint(){return mm=mm||new Ti({"hillshade-illumination-direction":new Ke($.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Ke($.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Ke($.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ke($.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ke($.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ke($.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ke($.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Ke($.paint_hillshade["hillshade-method"])})}};class Bx extends qr{constructor(t){super(t,Lx),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,r=this.paint.get("hillshade-illumination-altitude").values,a=this.paint.get("hillshade-highlight-color").values,c=this.paint.get("hillshade-shadow-color").values;const d=Math.max(t.length,r.length,a.length,c.length);t=t.concat(Array(d-t.length).fill(t.at(-1))),r=r.concat(Array(d-r.length).fill(r.at(-1))),a=a.concat(Array(d-a.length).fill(a.at(-1))),c=c.concat(Array(d-c.length).fill(c.at(-1)));const p=r.map(_t);return{directionRadians:t.map(_t),altitudeRadians:p,shadowColor:c,highlightColor:a}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const Fx=ii([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ox}=Fx;function sp(n,t,r){const a=r.patternDependencies;let c=!1;for(const d of t){const p=d.paint.get(`${n}-pattern`);p.isConstant()||(c=!0);const m=p.constantOr(null);m&&(c=!0,a[m.to]=!0,a[m.from]=!0)}return c}function op(n,t,r,a,c){const d=c.patternDependencies;for(const p of t){const m=p.paint.get(`${n}-pattern`).value;if(m.kind!=="constant"){let y=m.evaluate({zoom:a-1},r,{},c.availableImages),w=m.evaluate({zoom:a},r,{},c.availableImages),M=m.evaluate({zoom:a+1},r,{},c.availableImages);y=y&&y.name?y.name:y,w=w&&w.name?w.name:w,M=M&&M.name?M.name:M,d[y]=!0,d[w]=!0,d[M]=!0,r.patterns[p.id]={min:y,mid:w,max:M}}}return r}function gm(n,t,r,a,c){let d;if(c===function(p,m,y,w){let M=0;for(let C=m,k=y-w;C<y;C+=w)M+=(p[k]-p[C])*(p[C+1]+p[k+1]),k=C;return M}(n,t,r,a)>0)for(let p=t;p<r;p+=a)d=vm(p/a|0,n[p],n[p+1],d);else for(let p=r-a;p>=t;p-=a)d=vm(p/a|0,n[p],n[p+1],d);return d&&pl(d,d.next)&&(Gc(d),d=d.next),d}function lo(n,t){if(!n)return n;t||(t=n);let r,a=n;do if(r=!1,a.steiner||!pl(a,a.next)&&wi(a.prev,a,a.next)!==0)a=a.next;else{if(Gc(a),a=t=a.prev,a===a.next)break;r=!0}while(r||a!==t);return t}function Vc(n,t,r,a,c,d,p){if(!n)return;!p&&d&&function(y,w,M,C){let k=y;do k.z===0&&(k.z=lp(k.x,k.y,w,M,C)),k.prevZ=k.prev,k.nextZ=k.next,k=k.next;while(k!==y);k.prevZ.nextZ=null,k.prevZ=null,function(D){let L,j=1;do{let U,X=D;D=null;let ne=null;for(L=0;X;){L++;let Y=X,R=0;for(let Q=0;Q<j&&(R++,Y=Y.nextZ,Y);Q++);let V=j;for(;R>0||V>0&&Y;)R!==0&&(V===0||!Y||X.z<=Y.z)?(U=X,X=X.nextZ,R--):(U=Y,Y=Y.nextZ,V--),ne?ne.nextZ=U:D=U,U.prevZ=ne,ne=U;X=Y}ne.nextZ=null,j*=2}while(L>1)}(k)}(n,a,c,d);let m=n;for(;n.prev!==n.next;){const y=n.prev,w=n.next;if(d?Nx(n,a,c,d):jx(n))t.push(y.i,n.i,w.i),Gc(n),n=w.next,m=w.next;else if((n=w)===m){p?p===1?Vc(n=Zx(lo(n),t),t,r,a,c,d,2):p===2&&Vx(n,t,r,a,c,d):Vc(lo(n),t,r,a,c,d,1);break}}}function jx(n){const t=n.prev,r=n,a=n.next;if(wi(t,r,a)>=0)return!1;const c=t.x,d=r.x,p=a.x,m=t.y,y=r.y,w=a.y,M=Math.min(c,d,p),C=Math.min(m,y,w),k=Math.max(c,d,p),D=Math.max(m,y,w);let L=a.next;for(;L!==t;){if(L.x>=M&&L.x<=k&&L.y>=C&&L.y<=D&&Uc(c,m,d,y,p,w,L.x,L.y)&&wi(L.prev,L,L.next)>=0)return!1;L=L.next}return!0}function Nx(n,t,r,a){const c=n.prev,d=n,p=n.next;if(wi(c,d,p)>=0)return!1;const m=c.x,y=d.x,w=p.x,M=c.y,C=d.y,k=p.y,D=Math.min(m,y,w),L=Math.min(M,C,k),j=Math.max(m,y,w),U=Math.max(M,C,k),X=lp(D,L,t,r,a),ne=lp(j,U,t,r,a);let Y=n.prevZ,R=n.nextZ;for(;Y&&Y.z>=X&&R&&R.z<=ne;){if(Y.x>=D&&Y.x<=j&&Y.y>=L&&Y.y<=U&&Y!==c&&Y!==p&&Uc(m,M,y,C,w,k,Y.x,Y.y)&&wi(Y.prev,Y,Y.next)>=0||(Y=Y.prevZ,R.x>=D&&R.x<=j&&R.y>=L&&R.y<=U&&R!==c&&R!==p&&Uc(m,M,y,C,w,k,R.x,R.y)&&wi(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;Y&&Y.z>=X;){if(Y.x>=D&&Y.x<=j&&Y.y>=L&&Y.y<=U&&Y!==c&&Y!==p&&Uc(m,M,y,C,w,k,Y.x,Y.y)&&wi(Y.prev,Y,Y.next)>=0)return!1;Y=Y.prevZ}for(;R&&R.z<=ne;){if(R.x>=D&&R.x<=j&&R.y>=L&&R.y<=U&&R!==c&&R!==p&&Uc(m,M,y,C,w,k,R.x,R.y)&&wi(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function Zx(n,t){let r=n;do{const a=r.prev,c=r.next.next;!pl(a,c)&&ym(a,r,r.next,c)&&$c(a,c)&&$c(c,a)&&(t.push(a.i,r.i,c.i),Gc(r),Gc(r.next),r=n=c),r=r.next}while(r!==n);return lo(r)}function Vx(n,t,r,a,c,d){let p=n;do{let m=p.next.next;for(;m!==p.prev;){if(p.i!==m.i&&Hx(p,m)){let y=xm(p,m);return p=lo(p,p.next),y=lo(y,y.next),Vc(p,t,r,a,c,d,0),void Vc(y,t,r,a,c,d,0)}m=m.next}p=p.next}while(p!==n)}function Ux(n,t){let r=n.x-t.x;return r===0&&(r=n.y-t.y,r===0)&&(r=(n.next.y-n.y)/(n.next.x-n.x)-(t.next.y-t.y)/(t.next.x-t.x)),r}function $x(n,t){const r=function(c,d){let p=d;const m=c.x,y=c.y;let w,M=-1/0;if(pl(c,p))return p;do{if(pl(c,p.next))return p.next;if(y<=p.y&&y>=p.next.y&&p.next.y!==p.y){const j=p.x+(y-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(j<=m&&j>M&&(M=j,w=p.x<p.next.x?p:p.next,j===m))return w}p=p.next}while(p!==d);if(!w)return null;const C=w,k=w.x,D=w.y;let L=1/0;p=w;do{if(m>=p.x&&p.x>=k&&m!==p.x&&_m(y<D?m:M,y,k,D,y<D?M:m,y,p.x,p.y)){const j=Math.abs(y-p.y)/(m-p.x);$c(p,c)&&(j<L||j===L&&(p.x>w.x||p.x===w.x&&Gx(w,p)))&&(w=p,L=j)}p=p.next}while(p!==C);return w}(n,t);if(!r)return t;const a=xm(r,n);return lo(a,a.next),lo(r,r.next)}function Gx(n,t){return wi(n.prev,n,t.prev)<0&&wi(t.next,n,n.next)<0}function lp(n,t,r,a,c){return(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-r)*c|0)|n<<8))|n<<4))|n<<2))|n<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-a)*c|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function qx(n){let t=n,r=n;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==n);return r}function _m(n,t,r,a,c,d,p,m){return(c-p)*(t-m)>=(n-p)*(d-m)&&(n-p)*(a-m)>=(r-p)*(t-m)&&(r-p)*(d-m)>=(c-p)*(a-m)}function Uc(n,t,r,a,c,d,p,m){return!(n===p&&t===m)&&_m(n,t,r,a,c,d,p,m)}function Hx(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!function(r,a){let c=r;do{if(c.i!==r.i&&c.next.i!==r.i&&c.i!==a.i&&c.next.i!==a.i&&ym(c,c.next,r,a))return!0;c=c.next}while(c!==r);return!1}(n,t)&&($c(n,t)&&$c(t,n)&&function(r,a){let c=r,d=!1;const p=(r.x+a.x)/2,m=(r.y+a.y)/2;do c.y>m!=c.next.y>m&&c.next.y!==c.y&&p<(c.next.x-c.x)*(m-c.y)/(c.next.y-c.y)+c.x&&(d=!d),c=c.next;while(c!==r);return d}(n,t)&&(wi(n.prev,n,t.prev)||wi(n,t.prev,t))||pl(n,t)&&wi(n.prev,n,n.next)>0&&wi(t.prev,t,t.next)>0)}function wi(n,t,r){return(t.y-n.y)*(r.x-t.x)-(t.x-n.x)*(r.y-t.y)}function pl(n,t){return n.x===t.x&&n.y===t.y}function ym(n,t,r,a){const c=Bh(wi(n,t,r)),d=Bh(wi(n,t,a)),p=Bh(wi(r,a,n)),m=Bh(wi(r,a,t));return c!==d&&p!==m||!(c!==0||!Lh(n,r,t))||!(d!==0||!Lh(n,a,t))||!(p!==0||!Lh(r,n,a))||!(m!==0||!Lh(r,t,a))}function Lh(n,t,r){return t.x<=Math.max(n.x,r.x)&&t.x>=Math.min(n.x,r.x)&&t.y<=Math.max(n.y,r.y)&&t.y>=Math.min(n.y,r.y)}function Bh(n){return n>0?1:n<0?-1:0}function $c(n,t){return wi(n.prev,n,n.next)<0?wi(n,t,n.next)>=0&&wi(n,n.prev,t)>=0:wi(n,t,n.prev)<0||wi(n,n.next,t)<0}function xm(n,t){const r=cp(n.i,n.x,n.y),a=cp(t.i,t.x,t.y),c=n.next,d=t.prev;return n.next=t,t.prev=n,r.next=c,c.prev=r,a.next=r,r.prev=a,d.next=a,a.prev=d,a}function vm(n,t,r,a){const c=cp(n,t,r);return a?(c.next=a.next,c.prev=a,a.next.prev=c,a.next=c):(c.prev=c,c.next=c),c}function Gc(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function cp(n,t,r){return{i:n,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class fl{constructor(t,r){if(r>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=r}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class Fh{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}Fh.noSubdivision=new Fh({fill:new fl(0,0),line:new fl(0,0),tile:new fl(0,0),stencil:new fl(0,0),circle:1}),$e("SubdivisionGranularityExpression",fl),$e("SubdivisionGranularitySetting",Fh);const ml=-32768,qc=32767;class Wx{constructor(t,r){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=Et/t,this._canonical=r}_getKey(t,r){return(t+=32768)<<16|(r+=32768)<<0}_vertexToIndex(t,r){if(t<-32768||r<-32768||t>32767||r>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const a=0|Math.round(t),c=0|Math.round(r),d=this._getKey(a,c);if(this._vertexDictionary.has(d))return this._vertexDictionary.get(d);const p=this._vertexBuffer.length/2;return this._vertexDictionary.set(d,p),this._vertexBuffer.push(a,c),p}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(c,d){const p=[];for(let m=0;m<d.length;m+=3){const y=d[m],w=d[m+1],M=d[m+2],C=c[2*y],k=c[2*y+1];(c[2*w]-C)*(c[2*M+1]-k)-(c[2*w+1]-k)*(c[2*M]-C)>0?(p.push(y),p.push(M),p.push(w)):(p.push(y),p.push(w),p.push(M))}return p}(this._vertexBuffer,t);const r=[],a=t.length;for(let c=0;c<a;c+=3){const d=[t[c+0],t[c+1],t[c+2]],p=[this._vertexBuffer[2*t[c+0]+0],this._vertexBuffer[2*t[c+0]+1],this._vertexBuffer[2*t[c+1]+0],this._vertexBuffer[2*t[c+1]+1],this._vertexBuffer[2*t[c+2]+0],this._vertexBuffer[2*t[c+2]+1]];let m=1/0,y=1/0,w=-1/0,M=-1/0;for(let j=0;j<3;j++){const U=p[2*j],X=p[2*j+1];m=Math.min(m,U),w=Math.max(w,U),y=Math.min(y,X),M=Math.max(M,X)}if(m===w||y===M)continue;const C=Math.floor(m/this._granularityCellSize),k=Math.ceil(w/this._granularityCellSize),D=Math.floor(y/this._granularityCellSize),L=Math.ceil(M/this._granularityCellSize);if(C!==k||D!==L)for(let j=D;j<L;j++){const U=this._scanlineGenerateVertexRingForCellRow(j,p,d);Xx(this._vertexBuffer,U,r)}else r.push(...d)}return r}_scanlineGenerateVertexRingForCellRow(t,r,a){const c=t*this._granularityCellSize,d=c+this._granularityCellSize,p=[];for(let m=0;m<3;m++){const y=r[2*m],w=r[2*m+1],M=r[2*(m+1)%6],C=r[(2*(m+1)+1)%6],k=r[2*(m+2)%6],D=r[(2*(m+2)+1)%6],L=M-y,j=C-w,U=L===0,X=j===0,ne=(c-w)/j,Y=(d-w)/j,R=Math.min(ne,Y),V=Math.max(ne,Y);if(!X&&(R>=1||V<=0)||X&&(w<c||w>d)){C>=c&&C<=d&&p.push(a[(m+1)%3]);continue}!X&&R>0&&p.push(this._vertexToIndex(y+L*R,w+j*R));const Q=y+L*Math.max(R,0),fe=y+L*Math.min(V,1);U||this._generateIntraEdgeVertices(p,y,w,M,C,Q,fe),!X&&V<1&&p.push(this._vertexToIndex(y+L*V,w+j*V)),(X||C>=c&&C<=d)&&p.push(a[(m+1)%3]),!X&&(C<=c||C>=d)&&this._generateInterEdgeVertices(p,y,w,M,C,k,D,fe,c,d)}return p}_generateIntraEdgeVertices(t,r,a,c,d,p,m){const y=c-r,w=d-a,M=w===0,C=M?Math.min(r,c):Math.min(p,m),k=M?Math.max(r,c):Math.max(p,m),D=Math.floor(C/this._granularityCellSize)+1,L=Math.ceil(k/this._granularityCellSize)-1;if(M?r<c:p<m)for(let j=D;j<=L;j++){const U=j*this._granularityCellSize;t.push(this._vertexToIndex(U,a+w*(U-r)/y))}else for(let j=L;j>=D;j--){const U=j*this._granularityCellSize;t.push(this._vertexToIndex(U,a+w*(U-r)/y))}}_generateInterEdgeVertices(t,r,a,c,d,p,m,y,w,M){const C=d-a,k=p-c,D=m-d,L=(w-d)/D,j=(M-d)/D,U=Math.min(L,j),X=Math.max(L,j),ne=c+k*U;let Y=Math.floor(Math.min(ne,y)/this._granularityCellSize)+1,R=Math.ceil(Math.max(ne,y)/this._granularityCellSize)-1,V=y<ne;const Q=D===0;if(Q&&(m===w||m===M))return;if(Q||U>=1||X<=0){const ke=a-m,ye=p+(r-p)*Math.min((w-m)/ke,(M-m)/ke);Y=Math.floor(Math.min(ye,y)/this._granularityCellSize)+1,R=Math.ceil(Math.max(ye,y)/this._granularityCellSize)-1,V=y<ye}const fe=C>0?M:w;if(V)for(let ke=Y;ke<=R;ke++)t.push(this._vertexToIndex(ke*this._granularityCellSize,fe));else for(let ke=R;ke>=Y;ke--)t.push(this._vertexToIndex(ke*this._granularityCellSize,fe))}_generateOutline(t){const r=[];for(const a of t){const c=co(a,this._granularity,!0),d=this._pointArrayToIndices(c),p=[];for(let m=1;m<d.length;m++)p.push(d[m-1]),p.push(d[m]);r.push(p)}return r}_handlePoles(t){let r=!1,a=!1;this._canonical&&(this._canonical.y===0&&(r=!0),this._canonical.y===(1<<this._canonical.z)-1&&(a=!0)),(r||a)&&this._fillPoles(t,r,a)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let r=0;r<t.length;r+=2){const a=t[r+1];a===ml&&(t[r+1]=-32767),a===qc&&(t[r+1]=32766)}}_generatePoleQuad(t,r,a,c,d,p){c>d!=(p===ml)?(t.push(r),t.push(a),t.push(this._vertexToIndex(c,p)),t.push(a),t.push(this._vertexToIndex(d,p)),t.push(this._vertexToIndex(c,p))):(t.push(a),t.push(r),t.push(this._vertexToIndex(c,p)),t.push(this._vertexToIndex(d,p)),t.push(a),t.push(this._vertexToIndex(c,p)))}_fillPoles(t,r,a){const c=this._vertexBuffer,d=Et,p=t.length;for(let m=2;m<p;m+=3){const y=t[m-2],w=t[m-1],M=t[m],C=c[2*y],k=c[2*y+1],D=c[2*w],L=c[2*w+1],j=c[2*M],U=c[2*M+1];r&&(k===0&&L===0&&this._generatePoleQuad(t,y,w,C,D,ml),L===0&&U===0&&this._generatePoleQuad(t,w,M,D,j,ml),U===0&&k===0&&this._generatePoleQuad(t,M,y,j,C,ml)),a&&(k===d&&L===d&&this._generatePoleQuad(t,y,w,C,D,qc),L===d&&U===d&&this._generatePoleQuad(t,w,M,D,j,qc),U===d&&k===d&&this._generatePoleQuad(t,M,y,j,C,qc))}}_initializeVertices(t){for(let r=0;r<t.length;r+=2)this._vertexToIndex(t[r],t[r+1])}subdividePolygonInternal(t,r){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:a,holeIndices:c}=function(m){const y=[],w=[];for(const M of m)if(M.length!==0){M!==m[0]&&y.push(w.length/2);for(let C=0;C<M.length;C++)w.push(M[C].x),w.push(M[C].y)}return{flattened:w,holeIndices:y}}(t);let d;this._initializeVertices(a);try{const m=function(w,M,C=2){const k=M&&M.length,D=k?M[0]*C:w.length;let L=gm(w,0,D,C,!0);const j=[];if(!L||L.next===L.prev)return j;let U,X,ne;if(k&&(L=function(Y,R,V,Q){const fe=[];for(let ke=0,ye=R.length;ke<ye;ke++){const Te=gm(Y,R[ke]*Q,ke<ye-1?R[ke+1]*Q:Y.length,Q,!1);Te===Te.next&&(Te.steiner=!0),fe.push(qx(Te))}fe.sort(Ux);for(let ke=0;ke<fe.length;ke++)V=$x(fe[ke],V);return V}(w,M,L,C)),w.length>80*C){U=1/0,X=1/0;let Y=-1/0,R=-1/0;for(let V=C;V<D;V+=C){const Q=w[V],fe=w[V+1];Q<U&&(U=Q),fe<X&&(X=fe),Q>Y&&(Y=Q),fe>R&&(R=fe)}ne=Math.max(Y-U,R-X),ne=ne!==0?32767/ne:0}return Vc(L,j,C,U,X,ne,0),j}(a,c),y=this._convertIndices(a,m);d=this._subdivideTrianglesScanline(y)}catch(m){console.error(m)}let p=[];return r&&(p=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(d),{verticesFlattened:this._vertexBuffer,indicesTriangles:d,indicesLineList:p}}_convertIndices(t,r){const a=[];for(let c=0;c<r.length;c++)a.push(this._vertexToIndex(t[2*r[c]],t[2*r[c]+1]));return a}_pointArrayToIndices(t){const r=[];for(let a=0;a<t.length;a++){const c=t[a];r.push(this._vertexToIndex(c.x,c.y))}return r}}function bm(n,t,r,a=!0){return new Wx(r,t).subdividePolygonInternal(n,a)}function co(n,t,r=!1){if(!n||n.length<1)return[];if(n.length<2)return[];const a=n[0],c=n[n.length-1],d=r&&(a.x!==c.x||a.y!==c.y);if(t<2)return d?[...n,n[0]]:[...n];const p=Math.floor(Et/t),m=[];m.push(new Fe(n[0].x,n[0].y));const y=n.length,w=d?y:y-1;for(let M=0;M<w;M++){const C=n[M],k=M<y-1?n[M+1]:n[0],D=C.x,L=C.y,j=k.x,U=k.y,X=D!==j,ne=L!==U;if(!X&&!ne)continue;const Y=j-D,R=U-L,V=Math.abs(Y),Q=Math.abs(R);let fe=D,ke=L;for(;;){const Te=Y>0?(Math.floor(fe/p)+1)*p:(Math.ceil(fe/p)-1)*p,De=R>0?(Math.floor(ke/p)+1)*p:(Math.ceil(ke/p)-1)*p,ze=Math.abs(fe-Te),Le=Math.abs(ke-De),Se=Math.abs(fe-j),Ge=Math.abs(ke-U),et=X?ze/V:Number.POSITIVE_INFINITY,Je=ne?Le/Q:Number.POSITIVE_INFINITY;if((Se<=ze||!X)&&(Ge<=Le||!ne))break;if(et<Je&&X||!ne){fe=Te,ke+=R*et;const We=new Fe(fe,Math.round(ke));m[m.length-1].x===We.x&&m[m.length-1].y===We.y||m.push(We)}else{fe+=Y*Je,ke=De;const We=new Fe(Math.round(fe),ke);m[m.length-1].x===We.x&&m[m.length-1].y===We.y||m.push(We)}}const ye=new Fe(j,U);m[m.length-1].x===ye.x&&m[m.length-1].y===ye.y||m.push(ye)}return m}function Xx(n,t,r){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let a=0,c=n[2*t[0]];for(let y=1;y<t.length;y++){const w=n[2*t[y]];w<c&&(c=w,a=y)}const d=t.length;let p=a,m=(p+1)%d;for(;;){const y=p-1>=0?p-1:d-1,w=(m+1)%d,M=n[2*t[y]],C=n[2*t[w]],k=n[2*t[p]],D=n[2*t[p]+1],L=n[2*t[m]+1];let j=!1;if(M<C)j=!0;else if(M>C)j=!1;else{const U=L-D,X=-(n[2*t[m]]-k),ne=D<L?1:-1;((M-k)*U+(n[2*t[y]+1]-D)*X)*ne>((C-k)*U+(n[2*t[w]+1]-D)*X)*ne&&(j=!0)}if(j){const U=t[y],X=t[p],ne=t[m];U!==X&&U!==ne&&X!==ne&&r.push(ne,X,U),p--,p<0&&(p=d-1)}else{const U=t[w],X=t[p],ne=t[m];U!==X&&U!==ne&&X!==ne&&r.push(ne,X,U),m++,m>=d&&(m=0)}if(y===w)break}}function wm(n,t,r,a,c,d,p,m,y){const w=c.length/2,M=p&&m&&y;if(w<Rt.MAX_VERTEX_ARRAY_LENGTH){const C=t.prepareSegment(w,r,a),k=C.vertexLength;for(let j=0;j<d.length;j+=3)a.emplaceBack(k+d[j],k+d[j+1],k+d[j+2]);let D,L;C.vertexLength+=w,C.primitiveLength+=d.length/3,M&&(L=p.prepareSegment(w,r,m),D=L.vertexLength,L.vertexLength+=w);for(let j=0;j<c.length;j+=2)n(c[j],c[j+1]);if(M)for(let j=0;j<y.length;j++){const U=y[j];for(let X=1;X<U.length;X+=2)m.emplaceBack(D+U[X-1],D+U[X]);L.primitiveLength+=U.length/2}}else(function(C,k,D,L,j,U){const X=[];for(let Q=0;Q<L.length/2;Q++)X.push(-1);const ne={count:0};let Y=0,R=C.getOrCreateLatestSegment(k,D),V=R.vertexLength;for(let Q=2;Q<j.length;Q+=3){const fe=j[Q-2],ke=j[Q-1],ye=j[Q];let Te=X[fe]<Y,De=X[ke]<Y,ze=X[ye]<Y;R.vertexLength+((Te?1:0)+(De?1:0)+(ze?1:0))>Rt.MAX_VERTEX_ARRAY_LENGTH&&(R=C.createNewSegment(k,D),Y=ne.count,Te=!0,De=!0,ze=!0,V=0);const Le=Hc(X,L,U,ne,fe,Te,R),Se=Hc(X,L,U,ne,ke,De,R),Ge=Hc(X,L,U,ne,ye,ze,R);D.emplaceBack(V+Le-Y,V+Se-Y,V+Ge-Y),R.primitiveLength++}})(t,r,a,c,d,n),M&&function(C,k,D,L,j,U){const X=[];for(let Q=0;Q<L.length/2;Q++)X.push(-1);const ne={count:0};let Y=0,R=C.getOrCreateLatestSegment(k,D),V=R.vertexLength;for(let Q=0;Q<j.length;Q++){const fe=j[Q];for(let ke=1;ke<j[Q].length;ke+=2){const ye=fe[ke-1],Te=fe[ke];let De=X[ye]<Y,ze=X[Te]<Y;R.vertexLength+((De?1:0)+(ze?1:0))>Rt.MAX_VERTEX_ARRAY_LENGTH&&(R=C.createNewSegment(k,D),Y=ne.count,De=!0,ze=!0,V=0);const Le=Hc(X,L,U,ne,ye,De,R),Se=Hc(X,L,U,ne,Te,ze,R);D.emplaceBack(V+Le-Y,V+Se-Y),R.primitiveLength++}}}(p,r,m,c,y,n),t.forceNewSegmentOnNextPrepare(),p==null||p.forceNewSegmentOnNextPrepare()}function Hc(n,t,r,a,c,d,p){if(d){const m=a.count;return r(t[2*c],t[2*c+1]),n[c]=a.count,a.count++,p.vertexLength++,m}return n[c]}class up{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Oe,this.indexArray=new zt,this.indexArray2=new Ai,this.programConfigurations=new ta(t.layers,t.zoom),this.segments=new Rt,this.segments2=new Rt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.hasPattern=sp("fill",this.layers,r);const c=this.layers[0].layout.get("fill-sort-key"),d=!c.isConstant(),p=[];for(const{feature:m,id:y,index:w,sourceLayerIndex:M}of t){const C=this.layers[0]._featureFilter.needGeometry,k=so(m,C);if(!this.layers[0]._featureFilter.filter(new Xt(this.zoom),k,a))continue;const D=d?c.evaluate(k,{},a,r.availableImages):void 0,L={id:y,properties:m.properties,type:m.type,sourceLayerIndex:M,index:w,geometry:C?k.geometry:ao(m),patterns:{},sortKey:D};p.push(L)}d&&p.sort((m,y)=>m.sortKey-y.sortKey);for(const m of p){const{geometry:y,index:w,sourceLayerIndex:M}=m;if(this.hasPattern){const C=op("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(C)}else this.addFeature(m,y,w,a,{},r.subdivisionGranularity);r.featureIndex.insert(t[w].feature,y,w,M,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}addFeatures(t,r,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ox),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,r,a,c,d,p){for(const m of Fo(r,500)){const y=bm(m,c,p.fill.getGranularityForZoomLevel(c.z)),w=this.layoutVertexArray;wm((M,C)=>{w.emplaceBack(M,C)},this.segments,this.layoutVertexArray,this.indexArray,y.verticesFlattened,y.indicesTriangles,this.segments2,this.indexArray2,y.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}}let Tm,Mm;$e("FillBucket",up,{omit:["layers","patternFeatures"]});var Kx={get paint(){return Mm=Mm||new Ti({"fill-antialias":new Ke($.paint_fill["fill-antialias"]),"fill-opacity":new rt($.paint_fill["fill-opacity"]),"fill-color":new rt($.paint_fill["fill-color"]),"fill-outline-color":new rt($.paint_fill["fill-outline-color"]),"fill-translate":new Ke($.paint_fill["fill-translate"]),"fill-translate-anchor":new Ke($.paint_fill["fill-translate-anchor"]),"fill-pattern":new eo($.paint_fill["fill-pattern"])})},get layout(){return Tm=Tm||new Ti({"fill-sort-key":new rt($.layout_fill["fill-sort-key"])})}};class Yx extends qr{constructor(t){super(t,Kx)}recalculate(t,r){super.recalculate(t,r);const a=this.paint._values["fill-outline-color"];a.value.kind==="constant"&&a.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new up(t)}queryRadius(){return Rh(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:r,transform:a,pixelsToTileUnits:c}){return am(Dh(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-a.bearingInRadians,c),r)}isTileClipped(){return!0}}const Jx=ii([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Qx=ii([{name:"a_centroid",components:2,type:"Int16"}],4),{members:ev}=Jx;var hp,Sm,dp,Pm,pp,Cm,Im,Oh={};function Em(){if(Sm)return hp;Sm=1;var n=Be();function t(c,d,p,m,y){this.properties={},this.extent=p,this.type=0,this._pbf=c,this._geometry=-1,this._keys=m,this._values=y,c.readFields(r,this,d)}function r(c,d,p){c==1?d.id=p.readVarint():c==2?function(m,y){for(var w=m.readVarint()+m.pos;m.pos<w;){var M=y._keys[m.readVarint()],C=y._values[m.readVarint()];y.properties[M]=C}}(p,d):c==3?d.type=p.readVarint():c==4&&(d._geometry=p.pos)}function a(c){for(var d,p,m=0,y=0,w=c.length,M=w-1;y<w;M=y++)m+=((p=c[M]).x-(d=c[y]).x)*(d.y+p.y);return m}return hp=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var c=this._pbf;c.pos=this._geometry;for(var d,p=c.readVarint()+c.pos,m=1,y=0,w=0,M=0,C=[];c.pos<p;){if(y<=0){var k=c.readVarint();m=7&k,y=k>>3}if(y--,m===1||m===2)w+=c.readSVarint(),M+=c.readSVarint(),m===1&&(d&&C.push(d),d=[]),d.push(new n(w,M));else{if(m!==7)throw new Error("unknown command "+m);d&&d.push(d[0].clone())}}return d&&C.push(d),C},t.prototype.bbox=function(){var c=this._pbf;c.pos=this._geometry;for(var d=c.readVarint()+c.pos,p=1,m=0,y=0,w=0,M=1/0,C=-1/0,k=1/0,D=-1/0;c.pos<d;){if(m<=0){var L=c.readVarint();p=7&L,m=L>>3}if(m--,p===1||p===2)(y+=c.readSVarint())<M&&(M=y),y>C&&(C=y),(w+=c.readSVarint())<k&&(k=w),w>D&&(D=w);else if(p!==7)throw new Error("unknown command "+p)}return[M,k,C,D]},t.prototype.toGeoJSON=function(c,d,p){var m,y,w=this.extent*Math.pow(2,p),M=this.extent*c,C=this.extent*d,k=this.loadGeometry(),D=t.types[this.type];function L(X){for(var ne=0;ne<X.length;ne++){var Y=X[ne];X[ne]=[360*(Y.x+M)/w-180,360/Math.PI*Math.atan(Math.exp((180-360*(Y.y+C)/w)*Math.PI/180))-90]}}switch(this.type){case 1:var j=[];for(m=0;m<k.length;m++)j[m]=k[m][0];L(k=j);break;case 2:for(m=0;m<k.length;m++)L(k[m]);break;case 3:for(k=function(X){var ne=X.length;if(ne<=1)return[X];for(var Y,R,V=[],Q=0;Q<ne;Q++){var fe=a(X[Q]);fe!==0&&(R===void 0&&(R=fe<0),R===fe<0?(Y&&V.push(Y),Y=[X[Q]]):Y.push(X[Q]))}return Y&&V.push(Y),V}(k),m=0;m<k.length;m++)for(y=0;y<k[m].length;y++)L(k[m][y])}k.length===1?k=k[0]:D="Multi"+D;var U={type:"Feature",geometry:{type:D,coordinates:k},properties:this.properties};return"id"in this&&(U.id=this.id),U},hp}function Am(){if(Pm)return dp;Pm=1;var n=Em();function t(a,c){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=a,this._keys=[],this._values=[],this._features=[],a.readFields(r,this,c),this.length=this._features.length}function r(a,c,d){a===15?c.version=d.readVarint():a===1?c.name=d.readString():a===5?c.extent=d.readVarint():a===2?c._features.push(d.pos):a===3?c._keys.push(d.readString()):a===4&&c._values.push(function(p){for(var m=null,y=p.readVarint()+p.pos;p.pos<y;){var w=p.readVarint()>>3;m=w===1?p.readString():w===2?p.readFloat():w===3?p.readDouble():w===4?p.readVarint64():w===5?p.readVarint():w===6?p.readSVarint():w===7?p.readBoolean():null}return m}(d))}return dp=t,t.prototype.feature=function(a){if(a<0||a>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[a];var c=this._pbf.readVarint()+this._pbf.pos;return new n(this._pbf,c,this.extent,this._keys,this._values)},dp}function km(){return Im||(Im=1,Oh.VectorTile=function(){if(Cm)return pp;Cm=1;var n=Am();function t(r,a,c){if(r===3){var d=new n(c,c.readVarint()+c.pos);d.length&&(a[d.name]=d)}}return pp=function(r,a){this.layers=r.readFields(t,{},a)},pp}(),Oh.VectorTileFeature=Em(),Oh.VectorTileLayer=Am()),Oh}var Wc=he(km());const tv=Wc.VectorTileFeature.types,fp=Math.pow(2,13);function Xc(n,t,r,a,c,d,p,m){n.emplaceBack(t,r,2*Math.floor(a*fp)+p,c*fp*2,d*fp*2,Math.round(m))}class mp{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Re,this.centroidVertexArray=new be,this.indexArray=new zt,this.programConfigurations=new ta(t.layers,t.zoom),this.segments=new Rt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.features=[],this.hasPattern=sp("fill-extrusion",this.layers,r);for(const{feature:c,id:d,index:p,sourceLayerIndex:m}of t){const y=this.layers[0]._featureFilter.needGeometry,w=so(c,y);if(!this.layers[0]._featureFilter.filter(new Xt(this.zoom),w,a))continue;const M={id:d,sourceLayerIndex:m,index:p,geometry:y?w.geometry:ao(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(op("fill-extrusion",this.layers,M,this.zoom,r)):this.addFeature(M,M.geometry,p,a,{},r.subdivisionGranularity),r.featureIndex.insert(c,M.geometry,p,m,this.index,!0)}}addFeatures(t,r,a){for(const c of this.features){const{geometry:d}=c;this.addFeature(c,d,c.index,r,a,t.subdivisionGranularity)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ev),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Qx.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,a,c,d,p){for(const m of Fo(r,500)){const y={x:0,y:0,sampleCount:0},w=this.layoutVertexArray.length;this.processPolygon(y,c,t,m,p);const M=this.layoutVertexArray.length-w,C=Math.floor(y.x/y.sampleCount),k=Math.floor(y.y/y.sampleCount);for(let D=0;D<M;D++)this.centroidVertexArray.emplaceBack(C,k)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}processPolygon(t,r,a,c,d){if(c.length<1||zm(c[0]))return;for(const C of c)C.length!==0&&iv(t,C);const p={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},m=d.fill.getGranularityForZoomLevel(r.z),y=tv[a.type]==="Polygon";for(const C of c){if(C.length===0||zm(C))continue;const k=co(C,m,y);this._generateSideFaces(k,p)}if(!y)return;const w=bm(c,r,m,!1),M=this.layoutVertexArray;wm((C,k)=>{Xc(M,C,k,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,w.verticesFlattened,w.indicesTriangles)}_generateSideFaces(t,r){let a=0;for(let c=1;c<t.length;c++){const d=t[c],p=t[c-1];if(rv(d,p))continue;r.segment.vertexLength+4>Rt.MAX_VERTEX_ARRAY_LENGTH&&(r.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const m=d.sub(p)._perp()._unit(),y=p.dist(d);a+y>32768&&(a=0),Xc(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,0,a),Xc(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,1,a),a+=y,Xc(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,0,a),Xc(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,1,a);const w=r.segment.vertexLength;this.indexArray.emplaceBack(w,w+2,w+1),this.indexArray.emplaceBack(w+1,w+2,w+3),r.segment.vertexLength+=4,r.segment.primitiveLength+=2}}}function iv(n,t){for(let r=0;r<t.length;r++){const a=t[r];r===t.length-1&&t[0].x===a.x&&t[0].y===a.y||(n.x+=a.x,n.y+=a.y,n.sampleCount++)}}function rv(n,t){return n.x===t.x&&(n.x<0||n.x>Et)||n.y===t.y&&(n.y<0||n.y>Et)}function zm(n){return n.every(t=>t.x<0)||n.every(t=>t.x>Et)||n.every(t=>t.y<0)||n.every(t=>t.y>Et)}let Rm;$e("FillExtrusionBucket",mp,{omit:["layers","features"]});var nv={get paint(){return Rm=Rm||new Ti({"fill-extrusion-opacity":new Ke($["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new rt($["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ke($["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ke($["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new eo($["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new rt($["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new rt($["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ke($["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class av extends qr{constructor(t){super(t,nv)}createBucket(t){return new mp(t)}queryRadius(){return Rh(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,pixelPosMatrix:m}){const y=Dh(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-d.bearingInRadians,p),w=this.paint.get("fill-extrusion-height").evaluate(r,a),M=this.paint.get("fill-extrusion-base").evaluate(r,a),C=function(D,L,j){const U=[];for(const X of D){const ne=[X.x,X.y,0,1];ot(ne,ne,L),U.push(new Fe(ne[0]/ne[3],ne[1]/ne[3]))}return U}(y,m),k=function(D,L,j,U){const X=[],ne=[],Y=U[8]*L,R=U[9]*L,V=U[10]*L,Q=U[11]*L,fe=U[8]*j,ke=U[9]*j,ye=U[10]*j,Te=U[11]*j;for(const De of D){const ze=[],Le=[];for(const Se of De){const Ge=Se.x,et=Se.y,Je=U[0]*Ge+U[4]*et+U[12],We=U[1]*Ge+U[5]*et+U[13],bt=U[2]*Ge+U[6]*et+U[14],hi=U[3]*Ge+U[7]*et+U[15],zi=bt+V,nr=hi+Q,nn=Je+fe,jr=We+ke,Hi=bt+ye,si=hi+Te,Fi=new Fe((Je+Y)/nr,(We+R)/nr);Fi.z=zi/nr,ze.push(Fi);const Wi=new Fe(nn/si,jr/si);Wi.z=Hi/si,Le.push(Wi)}X.push(ze),ne.push(Le)}return[X,ne]}(c,M,w,m);return function(D,L,j){let U=1/0;am(j,L)&&(U=Dm(j,L[0]));for(let X=0;X<L.length;X++){const ne=L[X],Y=D[X];for(let R=0;R<ne.length-1;R++){const V=ne[R],Q=[V,ne[R+1],Y[R+1],Y[R],V];nm(j,Q)&&(U=Math.min(U,Dm(j,Q)))}}return U!==1/0&&U}(k[0],k[1],C)}}function Kc(n,t){return n.x*t.x+n.y*t.y}function Dm(n,t){if(n.length===1){let r=0;const a=t[r++];let c;for(;!c||a.equals(c);)if(c=t[r++],!c)return 1/0;for(;r<t.length;r++){const d=t[r],p=n[0],m=c.sub(a),y=d.sub(a),w=p.sub(a),M=Kc(m,m),C=Kc(m,y),k=Kc(y,y),D=Kc(w,m),L=Kc(w,y),j=M*k-C*C,U=(k*D-C*L)/j,X=(M*L-C*D)/j,ne=a.z*(1-U-X)+c.z*U+d.z*X;if(isFinite(ne))return ne}return 1/0}{let r=1/0;for(const a of t)r=Math.min(r,a.z);return r}}const sv=ii([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ov}=sv,lv=ii([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:cv}=lv,uv=Wc.VectorTileFeature.types,hv=Math.cos(Math.PI/180*37.5),Lm=Math.pow(2,14)/.5;class gp{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new He,this.layoutVertexArray2=new gt,this.indexArray=new zt,this.programConfigurations=new ta(t.layers,t.zoom),this.segments=new Rt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.hasPattern=sp("line",this.layers,r);const c=this.layers[0].layout.get("line-sort-key"),d=!c.isConstant(),p=[];for(const{feature:m,id:y,index:w,sourceLayerIndex:M}of t){const C=this.layers[0]._featureFilter.needGeometry,k=so(m,C);if(!this.layers[0]._featureFilter.filter(new Xt(this.zoom),k,a))continue;const D=d?c.evaluate(k,{},a):void 0,L={id:y,properties:m.properties,type:m.type,sourceLayerIndex:M,index:w,geometry:C?k.geometry:ao(m),patterns:{},sortKey:D};p.push(L)}d&&p.sort((m,y)=>m.sortKey-y.sortKey);for(const m of p){const{geometry:y,index:w,sourceLayerIndex:M}=m;if(this.hasPattern){const C=op("line",this.layers,m,this.zoom,r);this.patternFeatures.push(C)}else this.addFeature(m,y,w,a,{},r.subdivisionGranularity);r.featureIndex.insert(t[w].feature,y,w,M,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}addFeatures(t,r,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,cv)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ov),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,a,c,d,p){const m=this.layers[0].layout,y=m.get("line-join").evaluate(t,{}),w=m.get("line-cap"),M=m.get("line-miter-limit"),C=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const k of r)this.addLine(k,t,y,w,M,C,c,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}addLine(t,r,a,c,d,p,m,y){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=co(t,m?y.line.getGranularityForZoomLevel(m.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Y=0;Y<t.length-1;Y++)this.totalDistance+=t[Y].dist(t[Y+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const w=uv[r.type]==="Polygon";let M=t.length;for(;M>=2&&t[M-1].equals(t[M-2]);)M--;let C=0;for(;C<M-1&&t[C].equals(t[C+1]);)C++;if(M<(w?3:2))return;a==="bevel"&&(d=1.05);const k=this.overscaling<=16?15*Et/(512*this.overscaling):0,D=this.segments.prepareSegment(10*M,this.layoutVertexArray,this.indexArray);let L,j,U,X,ne;this.e1=this.e2=-1,w&&(L=t[M-2],ne=t[C].sub(L)._unit()._perp());for(let Y=C;Y<M;Y++){if(U=Y===M-1?w?t[C+1]:void 0:t[Y+1],U&&t[Y].equals(U))continue;ne&&(X=ne),L&&(j=L),L=t[Y],ne=U?U.sub(L)._unit()._perp():X,X=X||ne;let R=X.add(ne);R.x===0&&R.y===0||R._unit();const V=X.x*ne.x+X.y*ne.y,Q=R.x*ne.x+R.y*ne.y,fe=Q!==0?1/Q:1/0,ke=2*Math.sqrt(2-2*Q),ye=Q<hv&&j&&U,Te=X.x*ne.y-X.y*ne.x>0;if(ye&&Y>C){const Le=L.dist(j);if(Le>2*k){const Se=L.sub(L.sub(j)._mult(k/Le)._round());this.updateDistance(j,Se),this.addCurrentVertex(Se,X,0,0,D),j=Se}}const De=j&&U;let ze=De?a:w?"butt":c;if(De&&ze==="round"&&(fe<p?ze="miter":fe<=2&&(ze="fakeround")),ze==="miter"&&fe>d&&(ze="bevel"),ze==="bevel"&&(fe>2&&(ze="flipbevel"),fe<d&&(ze="miter")),j&&this.updateDistance(j,L),ze==="miter")R._mult(fe),this.addCurrentVertex(L,R,0,0,D);else if(ze==="flipbevel"){if(fe>100)R=ne.mult(-1);else{const Le=fe*X.add(ne).mag()/X.sub(ne).mag();R._perp()._mult(Le*(Te?-1:1))}this.addCurrentVertex(L,R,0,0,D),this.addCurrentVertex(L,R.mult(-1),0,0,D)}else if(ze==="bevel"||ze==="fakeround"){const Le=-Math.sqrt(fe*fe-1),Se=Te?Le:0,Ge=Te?0:Le;if(j&&this.addCurrentVertex(L,X,Se,Ge,D),ze==="fakeround"){const et=Math.round(180*ke/Math.PI/20);for(let Je=1;Je<et;Je++){let We=Je/et;if(We!==.5){const hi=We-.5;We+=We*hi*(We-1)*((1.0904+V*(V*(3.55645-1.43519*V)-3.2452))*hi*hi+(.848013+V*(.215638*V-1.06021)))}const bt=ne.sub(X)._mult(We)._add(X)._unit()._mult(Te?-1:1);this.addHalfVertex(L,bt.x,bt.y,!1,Te,0,D)}}U&&this.addCurrentVertex(L,ne,-Se,-Ge,D)}else if(ze==="butt")this.addCurrentVertex(L,R,0,0,D);else if(ze==="square"){const Le=j?1:-1;this.addCurrentVertex(L,R,Le,Le,D)}else ze==="round"&&(j&&(this.addCurrentVertex(L,X,0,0,D),this.addCurrentVertex(L,X,1,1,D,!0)),U&&(this.addCurrentVertex(L,ne,-1,-1,D,!0),this.addCurrentVertex(L,ne,0,0,D)));if(ye&&Y<M-1){const Le=L.dist(U);if(Le>2*k){const Se=L.add(U.sub(L)._mult(k/Le)._round());this.updateDistance(L,Se),this.addCurrentVertex(Se,ne,0,0,D),L=Se}}}}addCurrentVertex(t,r,a,c,d,p=!1){const m=r.y*c-r.x,y=-r.y-r.x*c;this.addHalfVertex(t,r.x+r.y*a,r.y-r.x*a,p,!1,a,d),this.addHalfVertex(t,m,y,p,!0,-c,d),this.distance>Lm/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,a,c,d,p))}addHalfVertex({x:t,y:r},a,c,d,p,m,y){const w=.5*(this.lineClips?this.scaledDistance*(Lm-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(d?1:0),(r<<1)+(p?1:0),Math.round(63*a)+128,Math.round(63*c)+128,1+(m===0?0:m<0?-1:1)|(63&w)<<2,w>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const M=y.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,M,this.e2),y.primitiveLength++),p?this.e2=M:this.e1=M}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}let Bm,Fm;$e("LineBucket",gp,{omit:["layers","patternFeatures"]});var Om={get paint(){return Fm=Fm||new Ti({"line-opacity":new rt($.paint_line["line-opacity"]),"line-color":new rt($.paint_line["line-color"]),"line-translate":new Ke($.paint_line["line-translate"]),"line-translate-anchor":new Ke($.paint_line["line-translate-anchor"]),"line-width":new rt($.paint_line["line-width"]),"line-gap-width":new rt($.paint_line["line-gap-width"]),"line-offset":new rt($.paint_line["line-offset"]),"line-blur":new rt($.paint_line["line-blur"]),"line-dasharray":new zc($.paint_line["line-dasharray"]),"line-pattern":new eo($.paint_line["line-pattern"]),"line-gradient":new Rc($.paint_line["line-gradient"])})},get layout(){return Bm=Bm||new Ti({"line-cap":new Ke($.layout_line["line-cap"]),"line-join":new rt($.layout_line["line-join"]),"line-miter-limit":new Ke($.layout_line["line-miter-limit"]),"line-round-limit":new Ke($.layout_line["line-round-limit"]),"line-sort-key":new rt($.layout_line["line-sort-key"])})}};class dv extends rt{possiblyEvaluate(t,r){return r=new Xt(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,a,c){return r=Qi({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,a,c)}}let jh;class pv extends qr{constructor(t){super(t,Om),this.gradientVersion=0,jh||(jh=new dv(Om.paint.properties["line-width"].specification),jh.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(a){return a._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof Hn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=jh.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new gp(t)}queryRadius(t){const r=t,a=jm(Nc("line-width",this,r),Nc("line-gap-width",this,r)),c=Nc("line-offset",this,r);return a/2+Math.abs(c)+Rh(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p}){const m=Dh(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,p),y=p/2*jm(this.paint.get("line-width").evaluate(r,a),this.paint.get("line-gap-width").evaluate(r,a)),w=this.paint.get("line-offset").evaluate(r,a);return w&&(c=function(M,C){const k=[];for(let D=0;D<M.length;D++){const L=M[D],j=[];for(let U=0;U<L.length;U++){const X=L[U-1],ne=L[U],Y=L[U+1],R=U===0?new Fe(0,0):ne.sub(X)._unit()._perp(),V=U===L.length-1?new Fe(0,0):Y.sub(ne)._unit()._perp(),Q=R._add(V)._unit(),fe=Q.x*V.x+Q.y*V.y;fe!==0&&Q._mult(1/fe),j.push(Q._mult(C)._add(ne))}k.push(j)}return k}(c,w*p)),function(M,C,k){for(let D=0;D<C.length;D++){const L=C[D];if(M.length>=3){for(let j=0;j<L.length;j++)if(oo(M,L[j]))return!0}if(Ix(M,L,k))return!0}return!1}(m,c,y)}isTileClipped(){return!0}}function jm(n,t){return t>0?t+2*n:n}const fv=ii([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),mv=ii([{name:"a_projected_pos",components:3,type:"Float32"}],4);ii([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const gv=ii([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ii([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Nm=ii([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),_v=ii([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function yv(n,t,r){return n.sections.forEach(a=>{a.text=function(c,d,p){const m=d.layout.get("text-transform").evaluate(p,{});return m==="uppercase"?c=c.toLocaleUpperCase():m==="lowercase"&&(c=c.toLocaleLowerCase()),zn.applyArabicShaping&&(c=zn.applyArabicShaping(c)),c}(a.text,t,r)}),n}ii([{name:"triangle",components:3,type:"Uint16"}]),ii([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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"}]),ii([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),ii([{type:"Float32",name:"offsetX"}]),ii([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ii([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Yc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Zm,_p,Vm,ki=24,yp={};function xv(){return Zm||(Zm=1,yp.read=function(n,t,r,a,c){var d,p,m=8*c-a-1,y=(1<<m)-1,w=y>>1,M=-7,C=r?c-1:0,k=r?-1:1,D=n[t+C];for(C+=k,d=D&(1<<-M)-1,D>>=-M,M+=m;M>0;d=256*d+n[t+C],C+=k,M-=8);for(p=d&(1<<-M)-1,d>>=-M,M+=a;M>0;p=256*p+n[t+C],C+=k,M-=8);if(d===0)d=1-w;else{if(d===y)return p?NaN:1/0*(D?-1:1);p+=Math.pow(2,a),d-=w}return(D?-1:1)*p*Math.pow(2,d-a)},yp.write=function(n,t,r,a,c,d){var p,m,y,w=8*d-c-1,M=(1<<w)-1,C=M>>1,k=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,D=a?0:d-1,L=a?1:-1,j=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(m=isNaN(t)?1:0,p=M):(p=Math.floor(Math.log(t)/Math.LN2),t*(y=Math.pow(2,-p))<1&&(p--,y*=2),(t+=p+C>=1?k/y:k*Math.pow(2,1-C))*y>=2&&(p++,y/=2),p+C>=M?(m=0,p=M):p+C>=1?(m=(t*y-1)*Math.pow(2,c),p+=C):(m=t*Math.pow(2,C-1)*Math.pow(2,c),p=0));c>=8;n[r+D]=255&m,D+=L,m/=256,c-=8);for(p=p<<c|m,w+=c;w>0;n[r+D]=255&p,D+=L,p/=256,w-=8);n[r+D-L]|=128*j}),yp}function Um(){if(Vm)return _p;Vm=1,_p=t;var n=xv();function t(R){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(R)?R:new Uint8Array(R||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var r=4294967296,a=1/r,c=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function d(R){return R.type===t.Bytes?R.readVarint()+R.pos:R.pos+1}function p(R,V,Q){return Q?4294967296*V+(R>>>0):4294967296*(V>>>0)+(R>>>0)}function m(R,V,Q){var fe=V<=16383?1:V<=2097151?2:V<=268435455?3:Math.floor(Math.log(V)/(7*Math.LN2));Q.realloc(fe);for(var ke=Q.pos-1;ke>=R;ke--)Q.buf[ke+fe]=Q.buf[ke]}function y(R,V){for(var Q=0;Q<R.length;Q++)V.writeVarint(R[Q])}function w(R,V){for(var Q=0;Q<R.length;Q++)V.writeSVarint(R[Q])}function M(R,V){for(var Q=0;Q<R.length;Q++)V.writeFloat(R[Q])}function C(R,V){for(var Q=0;Q<R.length;Q++)V.writeDouble(R[Q])}function k(R,V){for(var Q=0;Q<R.length;Q++)V.writeBoolean(R[Q])}function D(R,V){for(var Q=0;Q<R.length;Q++)V.writeFixed32(R[Q])}function L(R,V){for(var Q=0;Q<R.length;Q++)V.writeSFixed32(R[Q])}function j(R,V){for(var Q=0;Q<R.length;Q++)V.writeFixed64(R[Q])}function U(R,V){for(var Q=0;Q<R.length;Q++)V.writeSFixed64(R[Q])}function X(R,V){return(R[V]|R[V+1]<<8|R[V+2]<<16)+16777216*R[V+3]}function ne(R,V,Q){R[Q]=V,R[Q+1]=V>>>8,R[Q+2]=V>>>16,R[Q+3]=V>>>24}function Y(R,V){return(R[V]|R[V+1]<<8|R[V+2]<<16)+(R[V+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(R,V,Q){for(Q=Q||this.length;this.pos<Q;){var fe=this.readVarint(),ke=fe>>3,ye=this.pos;this.type=7&fe,R(ke,V,this),this.pos===ye&&this.skip(fe)}return V},readMessage:function(R,V){return this.readFields(R,V,this.readVarint()+this.pos)},readFixed32:function(){var R=X(this.buf,this.pos);return this.pos+=4,R},readSFixed32:function(){var R=Y(this.buf,this.pos);return this.pos+=4,R},readFixed64:function(){var R=X(this.buf,this.pos)+X(this.buf,this.pos+4)*r;return this.pos+=8,R},readSFixed64:function(){var R=X(this.buf,this.pos)+Y(this.buf,this.pos+4)*r;return this.pos+=8,R},readFloat:function(){var R=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,R},readDouble:function(){var R=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,R},readVarint:function(R){var V,Q,fe=this.buf;return V=127&(Q=fe[this.pos++]),Q<128?V:(V|=(127&(Q=fe[this.pos++]))<<7,Q<128?V:(V|=(127&(Q=fe[this.pos++]))<<14,Q<128?V:(V|=(127&(Q=fe[this.pos++]))<<21,Q<128?V:function(ke,ye,Te){var De,ze,Le=Te.buf;if(De=(112&(ze=Le[Te.pos++]))>>4,ze<128||(De|=(127&(ze=Le[Te.pos++]))<<3,ze<128)||(De|=(127&(ze=Le[Te.pos++]))<<10,ze<128)||(De|=(127&(ze=Le[Te.pos++]))<<17,ze<128)||(De|=(127&(ze=Le[Te.pos++]))<<24,ze<128)||(De|=(1&(ze=Le[Te.pos++]))<<31,ze<128))return p(ke,De,ye);throw new Error("Expected varint not more than 10 bytes")}(V|=(15&(Q=fe[this.pos]))<<28,R,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var R=this.readVarint();return R%2==1?(R+1)/-2:R/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var R=this.readVarint()+this.pos,V=this.pos;return this.pos=R,R-V>=12&&c?function(Q,fe,ke){return c.decode(Q.subarray(fe,ke))}(this.buf,V,R):function(Q,fe,ke){for(var ye="",Te=fe;Te<ke;){var De,ze,Le,Se=Q[Te],Ge=null,et=Se>239?4:Se>223?3:Se>191?2:1;if(Te+et>ke)break;et===1?Se<128&&(Ge=Se):et===2?(192&(De=Q[Te+1]))==128&&(Ge=(31&Se)<<6|63&De)<=127&&(Ge=null):et===3?(ze=Q[Te+2],(192&(De=Q[Te+1]))==128&&(192&ze)==128&&((Ge=(15&Se)<<12|(63&De)<<6|63&ze)<=2047||Ge>=55296&&Ge<=57343)&&(Ge=null)):et===4&&(ze=Q[Te+2],Le=Q[Te+3],(192&(De=Q[Te+1]))==128&&(192&ze)==128&&(192&Le)==128&&((Ge=(15&Se)<<18|(63&De)<<12|(63&ze)<<6|63&Le)<=65535||Ge>=1114112)&&(Ge=null)),Ge===null?(Ge=65533,et=1):Ge>65535&&(Ge-=65536,ye+=String.fromCharCode(Ge>>>10&1023|55296),Ge=56320|1023&Ge),ye+=String.fromCharCode(Ge),Te+=et}return ye}(this.buf,V,R)},readBytes:function(){var R=this.readVarint()+this.pos,V=this.buf.subarray(this.pos,R);return this.pos=R,V},readPackedVarint:function(R,V){if(this.type!==t.Bytes)return R.push(this.readVarint(V));var Q=d(this);for(R=R||[];this.pos<Q;)R.push(this.readVarint(V));return R},readPackedSVarint:function(R){if(this.type!==t.Bytes)return R.push(this.readSVarint());var V=d(this);for(R=R||[];this.pos<V;)R.push(this.readSVarint());return R},readPackedBoolean:function(R){if(this.type!==t.Bytes)return R.push(this.readBoolean());var V=d(this);for(R=R||[];this.pos<V;)R.push(this.readBoolean());return R},readPackedFloat:function(R){if(this.type!==t.Bytes)return R.push(this.readFloat());var V=d(this);for(R=R||[];this.pos<V;)R.push(this.readFloat());return R},readPackedDouble:function(R){if(this.type!==t.Bytes)return R.push(this.readDouble());var V=d(this);for(R=R||[];this.pos<V;)R.push(this.readDouble());return R},readPackedFixed32:function(R){if(this.type!==t.Bytes)return R.push(this.readFixed32());var V=d(this);for(R=R||[];this.pos<V;)R.push(this.readFixed32());return R},readPackedSFixed32:function(R){if(this.type!==t.Bytes)return R.push(this.readSFixed32());var V=d(this);for(R=R||[];this.pos<V;)R.push(this.readSFixed32());return R},readPackedFixed64:function(R){if(this.type!==t.Bytes)return R.push(this.readFixed64());var V=d(this);for(R=R||[];this.pos<V;)R.push(this.readFixed64());return R},readPackedSFixed64:function(R){if(this.type!==t.Bytes)return R.push(this.readSFixed64());var V=d(this);for(R=R||[];this.pos<V;)R.push(this.readSFixed64());return R},skip:function(R){var V=7&R;if(V===t.Varint)for(;this.buf[this.pos++]>127;);else if(V===t.Bytes)this.pos=this.readVarint()+this.pos;else if(V===t.Fixed32)this.pos+=4;else{if(V!==t.Fixed64)throw new Error("Unimplemented type: "+V);this.pos+=8}},writeTag:function(R,V){this.writeVarint(R<<3|V)},realloc:function(R){for(var V=this.length||16;V<this.pos+R;)V*=2;if(V!==this.length){var Q=new Uint8Array(V);Q.set(this.buf),this.buf=Q,this.length=V}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(R){this.realloc(4),ne(this.buf,R,this.pos),this.pos+=4},writeSFixed32:function(R){this.realloc(4),ne(this.buf,R,this.pos),this.pos+=4},writeFixed64:function(R){this.realloc(8),ne(this.buf,-1&R,this.pos),ne(this.buf,Math.floor(R*a),this.pos+4),this.pos+=8},writeSFixed64:function(R){this.realloc(8),ne(this.buf,-1&R,this.pos),ne(this.buf,Math.floor(R*a),this.pos+4),this.pos+=8},writeVarint:function(R){(R=+R||0)>268435455||R<0?function(V,Q){var fe,ke;if(V>=0?(fe=V%4294967296|0,ke=V/4294967296|0):(ke=~(-V/4294967296),4294967295^(fe=~(-V%4294967296))?fe=fe+1|0:(fe=0,ke=ke+1|0)),V>=18446744073709552e3||V<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");Q.realloc(10),function(ye,Te,De){De.buf[De.pos++]=127&ye|128,ye>>>=7,De.buf[De.pos++]=127&ye|128,ye>>>=7,De.buf[De.pos++]=127&ye|128,ye>>>=7,De.buf[De.pos++]=127&ye|128,De.buf[De.pos]=127&(ye>>>=7)}(fe,0,Q),function(ye,Te){var De=(7&ye)<<4;Te.buf[Te.pos++]|=De|((ye>>>=3)?128:0),ye&&(Te.buf[Te.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(Te.buf[Te.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(Te.buf[Te.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(Te.buf[Te.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(Te.buf[Te.pos++]=127&ye)))))}(ke,Q)}(R,this):(this.realloc(4),this.buf[this.pos++]=127&R|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=R>>>7&127))))},writeSVarint:function(R){this.writeVarint(R<0?2*-R-1:2*R)},writeBoolean:function(R){this.writeVarint(!!R)},writeString:function(R){R=String(R),this.realloc(4*R.length),this.pos++;var V=this.pos;this.pos=function(fe,ke,ye){for(var Te,De,ze=0;ze<ke.length;ze++){if((Te=ke.charCodeAt(ze))>55295&&Te<57344){if(!De){Te>56319||ze+1===ke.length?(fe[ye++]=239,fe[ye++]=191,fe[ye++]=189):De=Te;continue}if(Te<56320){fe[ye++]=239,fe[ye++]=191,fe[ye++]=189,De=Te;continue}Te=De-55296<<10|Te-56320|65536,De=null}else De&&(fe[ye++]=239,fe[ye++]=191,fe[ye++]=189,De=null);Te<128?fe[ye++]=Te:(Te<2048?fe[ye++]=Te>>6|192:(Te<65536?fe[ye++]=Te>>12|224:(fe[ye++]=Te>>18|240,fe[ye++]=Te>>12&63|128),fe[ye++]=Te>>6&63|128),fe[ye++]=63&Te|128)}return ye}(this.buf,R,this.pos);var Q=this.pos-V;Q>=128&&m(V,Q,this),this.pos=V-1,this.writeVarint(Q),this.pos+=Q},writeFloat:function(R){this.realloc(4),n.write(this.buf,R,this.pos,!0,23,4),this.pos+=4},writeDouble:function(R){this.realloc(8),n.write(this.buf,R,this.pos,!0,52,8),this.pos+=8},writeBytes:function(R){var V=R.length;this.writeVarint(V),this.realloc(V);for(var Q=0;Q<V;Q++)this.buf[this.pos++]=R[Q]},writeRawMessage:function(R,V){this.pos++;var Q=this.pos;R(V,this);var fe=this.pos-Q;fe>=128&&m(Q,fe,this),this.pos=Q-1,this.writeVarint(fe),this.pos+=fe},writeMessage:function(R,V,Q){this.writeTag(R,t.Bytes),this.writeRawMessage(V,Q)},writePackedVarint:function(R,V){V.length&&this.writeMessage(R,y,V)},writePackedSVarint:function(R,V){V.length&&this.writeMessage(R,w,V)},writePackedBoolean:function(R,V){V.length&&this.writeMessage(R,k,V)},writePackedFloat:function(R,V){V.length&&this.writeMessage(R,M,V)},writePackedDouble:function(R,V){V.length&&this.writeMessage(R,C,V)},writePackedFixed32:function(R,V){V.length&&this.writeMessage(R,D,V)},writePackedSFixed32:function(R,V){V.length&&this.writeMessage(R,L,V)},writePackedFixed64:function(R,V){V.length&&this.writeMessage(R,j,V)},writePackedSFixed64:function(R,V){V.length&&this.writeMessage(R,U,V)},writeBytesField:function(R,V){this.writeTag(R,t.Bytes),this.writeBytes(V)},writeFixed32Field:function(R,V){this.writeTag(R,t.Fixed32),this.writeFixed32(V)},writeSFixed32Field:function(R,V){this.writeTag(R,t.Fixed32),this.writeSFixed32(V)},writeFixed64Field:function(R,V){this.writeTag(R,t.Fixed64),this.writeFixed64(V)},writeSFixed64Field:function(R,V){this.writeTag(R,t.Fixed64),this.writeSFixed64(V)},writeVarintField:function(R,V){this.writeTag(R,t.Varint),this.writeVarint(V)},writeSVarintField:function(R,V){this.writeTag(R,t.Varint),this.writeSVarint(V)},writeStringField:function(R,V){this.writeTag(R,t.Bytes),this.writeString(V)},writeFloatField:function(R,V){this.writeTag(R,t.Fixed32),this.writeFloat(V)},writeDoubleField:function(R,V){this.writeTag(R,t.Fixed64),this.writeDouble(V)},writeBooleanField:function(R,V){this.writeVarintField(R,!!V)}},_p}var xp=he(Um());const vp=3;function vv(n,t,r){n===1&&r.readMessage(bv,t)}function bv(n,t,r){if(n===3){const{id:a,bitmap:c,width:d,height:p,left:m,top:y,advance:w}=r.readMessage(wv,{});t.push({id:a,bitmap:new Zc({width:d+2*vp,height:p+2*vp},c),metrics:{width:d,height:p,left:m,top:y,advance:w}})}}function wv(n,t,r){n===1?t.id=r.readVarint():n===2?t.bitmap=r.readBytes():n===3?t.width=r.readVarint():n===4?t.height=r.readVarint():n===5?t.left=r.readSVarint():n===6?t.top=r.readSVarint():n===7&&(t.advance=r.readVarint())}const Tv=vp;function $m(n){let t=0,r=0;for(const p of n)t+=p.w*p.h,r=Math.max(r,p.w);n.sort((p,m)=>m.h-p.h);const a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let c=0,d=0;for(const p of n)for(let m=a.length-1;m>=0;m--){const y=a[m];if(!(p.w>y.w||p.h>y.h)){if(p.x=y.x,p.y=y.y,d=Math.max(d,p.y+p.h),c=Math.max(c,p.x+p.w),p.w===y.w&&p.h===y.h){const w=a.pop();m<a.length&&(a[m]=w)}else p.h===y.h?(y.x+=p.w,y.w-=p.w):p.w===y.w?(y.y+=p.h,y.h-=p.h):(a.push({x:y.x+p.w,y:y.y,w:y.w-p.w,h:p.h}),y.y+=p.h,y.h-=p.h);break}}return{w:c,h:d,fill:t/(c*d)||0}}const Or=1;class bp{constructor(t,{pixelRatio:r,version:a,stretchX:c,stretchY:d,content:p,textFitWidth:m,textFitHeight:y}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=c,this.stretchY=d,this.content=p,this.version=a,this.textFitWidth=m,this.textFitHeight=y}get tl(){return[this.paddedRect.x+Or,this.paddedRect.y+Or]}get br(){return[this.paddedRect.x+this.paddedRect.w-Or,this.paddedRect.y+this.paddedRect.h-Or]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Or)/this.pixelRatio,(this.paddedRect.h-2*Or)/this.pixelRatio]}}class Gm{constructor(t,r){const a={},c={};this.haveRenderCallbacks=[];const d=[];this.addImages(t,a,d),this.addImages(r,c,d);const{w:p,h:m}=$m(d),y=new tn({width:p||1,height:m||1});for(const w in t){const M=t[w],C=a[w].paddedRect;tn.copy(M.data,y,{x:0,y:0},{x:C.x+Or,y:C.y+Or},M.data)}for(const w in r){const M=r[w],C=c[w].paddedRect,k=C.x+Or,D=C.y+Or,L=M.data.width,j=M.data.height;tn.copy(M.data,y,{x:0,y:0},{x:k,y:D},M.data),tn.copy(M.data,y,{x:0,y:j-1},{x:k,y:D-1},{width:L,height:1}),tn.copy(M.data,y,{x:0,y:0},{x:k,y:D+j},{width:L,height:1}),tn.copy(M.data,y,{x:L-1,y:0},{x:k-1,y:D},{width:1,height:j}),tn.copy(M.data,y,{x:0,y:0},{x:k+L,y:D},{width:1,height:j})}this.image=y,this.iconPositions=a,this.patternPositions=c}addImages(t,r,a){for(const c in t){const d=t[c],p={x:0,y:0,w:d.data.width+2*Or,h:d.data.height+2*Or};a.push(p),r[c]=new bp(p,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const a in t.updatedImages)this.patchUpdatedImage(this.iconPositions[a],t.getImage(a),r),this.patchUpdatedImage(this.patternPositions[a],t.getImage(a),r)}patchUpdatedImage(t,r,a){if(!t||!r||t.version===r.version)return;t.version=r.version;const[c,d]=t.tl;a.update(r.data,void 0,{x:c,y:d})}}var us;$e("ImagePosition",bp),$e("ImageAtlas",Gm),S.al=void 0,(us=S.al||(S.al={}))[us.none=0]="none",us[us.horizontal=1]="horizontal",us[us.vertical=2]="vertical",us[us.horizontalOnly=3]="horizontalOnly";const Nh=-17;class Jc{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,r,a){const c=new Jc;return c.scale=t||1,c.fontStack=r,c.verticalAlign=a||"bottom",c}static forImage(t,r){const a=new Jc;return a.imageName=t,a.verticalAlign=r||"bottom",a}}class gl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){const a=new gl;for(let c=0;c<t.sections.length;c++){const d=t.sections[c];d.image?a.addImageSection(d):a.addTextSection(d,r)}return a}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let r="";for(let a=0;a<t.length;a++){const c=t.charCodeAt(a+1)||null,d=t.charCodeAt(a-1)||null;r+=c&&Js(c)&&!Yc[t[a+1]]||d&&Js(d)&&!Yc[t[a-1]]||!Yc[t[a]]?t[a]:Yc[t[a]]}return r}(this.text)}trim(){let t=0;for(let a=0;a<this.text.length&&Vh[this.text.charCodeAt(a)];a++)t++;let r=this.text.length;for(let a=this.text.length-1;a>=0&&a>=t&&Vh[this.text.charCodeAt(a)];a--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){const a=new gl;return a.text=this.text.substring(t,r),a.sectionIndex=this.sectionIndex.slice(t,r),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}getMaxImageSize(t){let r=0,a=0;for(let c=0;c<this.length();c++){const d=this.getSection(c);if(d.imageName){const p=t[d.imageName];if(!p)continue;const m=p.displaySize;r=Math.max(r,m[0]),a=Math.max(a,m[1])}}return{maxImageWidth:r,maxImageHeight:a}}addTextSection(t,r){this.text+=t.text,this.sections.push(Jc.forText(t.scale,t.fontStack||r,t.verticalAlign));const a=this.sections.length-1;for(let c=0;c<t.text.length;++c)this.sectionIndex.push(a)}addImageSection(t){const r=t.image?t.image.name:"";if(r.length===0)return void Ui("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push(Jc.forImage(r,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):Ui("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Zh(n,t,r,a,c,d,p,m,y,w,M,C,k,D,L){const j=gl.fromFeature(n,c);let U;C===S.al.vertical&&j.verticalizePunctuation();const{processBidirectionalText:X,processStyledBidirectionalText:ne}=zn;if(X&&j.sections.length===1){U=[];const V=X(j.toString(),wp(j,w,d,t,a,D));for(const Q of V){const fe=new gl;fe.text=Q,fe.sections=j.sections;for(let ke=0;ke<Q.length;ke++)fe.sectionIndex.push(0);U.push(fe)}}else if(ne){U=[];const V=ne(j.text,j.sectionIndex,wp(j,w,d,t,a,D));for(const Q of V){const fe=new gl;fe.text=Q[0],fe.sectionIndex=Q[1],fe.sections=j.sections,U.push(fe)}}else U=function(V,Q){const fe=[],ke=V.text;let ye=0;for(const Te of Q)fe.push(V.substring(ye,Te)),ye=Te;return ye<ke.length&&fe.push(V.substring(ye,ke.length)),fe}(j,wp(j,w,d,t,a,D));const Y=[],R={positionedLines:Y,text:j.toString(),top:M[1],bottom:M[1],left:M[0],right:M[0],writingMode:C,iconsInText:!1,verticalizable:!1};return function(V,Q,fe,ke,ye,Te,De,ze,Le,Se,Ge,et){let Je=0,We=0,bt=0,hi=0;const zi=ze==="right"?1:ze==="left"?0:.5,nr=ki/et;let nn=0;for(const si of ye){si.trim();const Fi=si.getMaxScale(),Wi={positionedGlyphs:[],lineOffset:0};V.positionedLines[nn]=Wi;const Xi=Wi.positionedGlyphs;let Pr=0;if(!si.length()){We+=Te,++nn;continue}const an=Cv(ke,si,nr);for(let Nr=0;Nr<si.length();Nr++){const Ri=si.getSection(Nr),ji=si.getSectionIndex(Nr),Ni=si.getCharCode(Nr),Pi=Iv(Le,Ge,Ni);let Yt;if(Ri.imageName){if(V.iconsInText=!0,Ri.scale=Ri.scale*nr,Yt=Av(Ri,Pi,Fi,an,ke),!Yt)continue;Pr=Math.max(Pr,Yt.imageOffset)}else if(Yt=Ev(Ri,Ni,Pi,an,Q,fe),!Yt)continue;const{rect:Ln,metrics:vl,baselineOffset:Bn}=Yt;Xi.push({glyph:Ni,imageName:Ri.imageName,x:Je,y:We+Bn+Nh,vertical:Pi,scale:Ri.scale,fontStack:Ri.fontStack,sectionIndex:ji,metrics:vl,rect:Ln}),Pi?(V.verticalizable=!0,Je+=(Ri.imageName?vl.advance:ki)*Ri.scale+Se):Je+=vl.advance*Ri.scale+Se}Xi.length!==0&&(bt=Math.max(Je-Se,bt),kv(Xi,0,Xi.length-1,zi)),Je=0,Wi.lineOffset=Math.max(Pr,(Fi-1)*ki);const Oi=Te*Fi+Pr;We+=Oi,hi=Math.max(Oi,hi),++nn}const{horizontalAlign:jr,verticalAlign:Hi}=Tp(De);(function(si,Fi,Wi,Xi,Pr,an,Oi,Nr,Ri){const ji=(Fi-Wi)*Pr;let Ni=0;Ni=an!==Oi?-Nr*Xi-Nh:-Xi*Ri*Oi+.5*Oi;for(const Pi of si)for(const Yt of Pi.positionedGlyphs)Yt.x+=ji,Yt.y+=Ni})(V.positionedLines,zi,jr,Hi,bt,hi,Te,We,ye.length),V.top+=-Hi*We,V.bottom=V.top+We,V.left+=-jr*bt,V.right=V.left+bt}(R,t,r,a,U,p,m,y,C,w,k,L),!function(V){for(const Q of V)if(Q.positionedGlyphs.length!==0)return!1;return!0}(Y)&&R}const Vh={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Mv={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Sv={40:!0};function qm(n,t,r,a,c,d){if(t.imageName){const p=a[t.imageName];return p?p.displaySize[0]*t.scale*ki/d+c:0}{const p=r[t.fontStack],m=p&&p[n];return m?m.metrics.advance*t.scale+c:0}}function Hm(n,t,r,a){const c=Math.pow(n-t,2);return a?n<t?c/2:2*c:c+Math.abs(r)*r}function Pv(n,t,r){let a=0;return n===10&&(a-=1e4),r&&(a+=150),n!==40&&n!==65288||(a+=50),t!==41&&t!==65289||(a+=50),a}function Wm(n,t,r,a,c,d){let p=null,m=Hm(t,r,c,d);for(const y of a){const w=Hm(t-y.x,r,c,d)+y.badness;w<=m&&(p=y,m=w)}return{index:n,x:t,priorBreak:p,badness:m}}function Xm(n){return n?Xm(n.priorBreak).concat(n.index):[]}function wp(n,t,r,a,c,d){if(!n)return[];const p=[],m=function(C,k,D,L,j,U){let X=0;for(let ne=0;ne<C.length();ne++){const Y=C.getSection(ne);X+=qm(C.getCharCode(ne),Y,L,j,k,U)}return X/Math.max(1,Math.ceil(X/D))}(n,t,r,a,c,d),y=n.text.indexOf("​")>=0;let w=0;for(let C=0;C<n.length();C++){const k=n.getSection(C),D=n.getCharCode(C);if(Vh[D]||(w+=qm(D,k,a,c,t,d)),C<n.length()-1){const L=!((M=D)<11904)&&(!!vt["CJK Compatibility Forms"](M)||!!vt["CJK Compatibility"](M)||!!vt["CJK Strokes"](M)||!!vt["CJK Symbols and Punctuation"](M)||!!vt["Enclosed CJK Letters and Months"](M)||!!vt["Halfwidth and Fullwidth Forms"](M)||!!vt["Ideographic Description Characters"](M)||!!vt["Vertical Forms"](M)||Ac.test(String.fromCodePoint(M)));(Mv[D]||L||k.imageName||C!==n.length()-2&&Sv[n.getCharCode(C+1)])&&p.push(Wm(C+1,w,m,p,Pv(D,n.getCharCode(C+1),L&&y),!1))}}var M;return Xm(Wm(n.length(),w,m,p,0,!0))}function Tp(n){let t=.5,r=.5;switch(n){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(n){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function Cv(n,t,r){const a=t.getMaxScale()*ki,{maxImageWidth:c,maxImageHeight:d}=t.getMaxImageSize(n),p=Math.max(a,d*r);return{verticalLineContentWidth:Math.max(a,c*r),horizontalLineContentHeight:p}}function Km(n){switch(n){case"top":return 0;case"center":return .5;default:return 1}}function Iv(n,t,r){return!(n===S.al.horizontal||!t&&!ll(r)||t&&(Vh[r]||(a=r,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(a)))));var a}function Ev(n,t,r,a,c,d){const p=d[n.fontStack],m=function(w,M,C,k){if(w&&w.rect)return w;const D=M[C.fontStack],L=D&&D[k];return L?{rect:null,metrics:L.metrics}:null}(p&&p[t],c,n,t);if(m===null)return null;let y;if(r)y=a.verticalLineContentWidth-n.scale*ki;else{const w=Km(n.verticalAlign);y=(a.horizontalLineContentHeight-n.scale*ki)*w}return{rect:m.rect,metrics:m.metrics,baselineOffset:y}}function Av(n,t,r,a,c){const d=c[n.imageName];if(!d)return null;const p=d.paddedRect,m=d.displaySize,y={width:m[0],height:m[1],left:Or,top:-3,advance:t?m[1]:m[0]};let w;if(t)w=a.verticalLineContentWidth-m[1]*n.scale;else{const M=Km(n.verticalAlign);w=(a.horizontalLineContentHeight-m[1]*n.scale)*M}return{rect:p,metrics:y,baselineOffset:w,imageOffset:(t?m[0]:m[1])*n.scale-ki*r}}function kv(n,t,r,a){if(a===0)return;const c=n[r],d=(n[r].x+c.metrics.advance*c.scale)*a;for(let p=t;p<=r;p++)n[p].x-=d}function zv(n,t,r){const{horizontalAlign:a,verticalAlign:c}=Tp(r),d=t[0]-n.displaySize[0]*a,p=t[1]-n.displaySize[1]*c;return{image:n,top:p,bottom:p+n.displaySize[1],left:d,right:d+n.displaySize[0]}}function Ym(n){var t,r;let a=n.left,c=n.top,d=n.right-a,p=n.bottom-c;const m=(t=n.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",y=(r=n.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",w=(n.image.content[2]-n.image.content[0])/(n.image.content[3]-n.image.content[1]);if(y==="proportional"){if(m==="stretchOnly"&&d/p<w||m==="proportional"){const M=Math.ceil(p*w);a*=M/d,d=M}}else if(m==="proportional"&&y==="stretchOnly"&&w!==0&&d/p>w){const M=Math.ceil(d/w);c*=M/p,p=M}return{x1:a,y1:c,x2:a+d,y2:c+p}}function Jm(n,t,r,a,c,d){const p=n.image;let m;if(p.content){const U=p.content,X=p.pixelRatio||1;m=[U[0]/X,U[1]/X,p.displaySize[0]-U[2]/X,p.displaySize[1]-U[3]/X]}const y=t.left*d,w=t.right*d;let M,C,k,D;r==="width"||r==="both"?(D=c[0]+y-a[3],C=c[0]+w+a[1]):(D=c[0]+(y+w-p.displaySize[0])/2,C=D+p.displaySize[0]);const L=t.top*d,j=t.bottom*d;return r==="height"||r==="both"?(M=c[1]+L-a[0],k=c[1]+j+a[2]):(M=c[1]+(L+j-p.displaySize[1])/2,k=M+p.displaySize[1]),{image:p,top:M,right:C,bottom:k,left:D,collisionPadding:m}}const Qc=255,ia=128,hs=Qc*ia;function Qm(n,t){const{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Xt(n+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:c}=r;let d=0;for(;d<a.length&&a[d]<=n;)d++;d=Math.max(0,d-1);let p=d;for(;p<a.length&&a[p]<n+1;)p++;p=Math.min(a.length-1,p);const m=a[d],y=a[p];return r.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:y,interpolationType:c}:{kind:"camera",minZoom:m,maxZoom:y,minSize:r.evaluate(new Xt(m)),maxSize:r.evaluate(new Xt(y)),interpolationType:c}}}function Mp(n,t,r){let a="never";const c=n.get(t);return c?a=c:n.get(r)&&(a="always"),a}const Rv=Wc.VectorTileFeature.types,Dv=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Uh(n,t,r,a,c,d,p,m,y,w,M,C,k){const D=m?Math.min(hs,Math.round(m[0])):0,L=m?Math.min(hs,Math.round(m[1])):0;n.emplaceBack(t,r,Math.round(32*a),Math.round(32*c),d,p,(D<<1)+(y?1:0),L,16*w,16*M,256*C,256*k)}function Sp(n,t,r){n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r)}function Lv(n){for(const t of n.sections)if(Kd(t.text))return!0;return!1}class Pp{constructor(t){this.layoutVertexArray=new ri,this.indexArray=new zt,this.programConfigurations=t,this.segments=new Rt,this.dynamicLayoutVertexArray=new Ut,this.opacityVertexArray=new ni,this.hasVisibleVertices=!1,this.placedSymbolArray=new te}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,a,c){this.isEmpty()||(a&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,fv.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,mv.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Dv,!0),this.opacityVertexBuffer.itemSize=1),(a||c)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}$e("SymbolBuffers",Pp);class Cp{constructor(t,r,a){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new a,this.segments=new Rt,this.collisionVertexArray=new Gt}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,gv.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}$e("CollisionBuffers",Cp);class _l{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(p=>p.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Qm(this.zoom,r["text-size"]),this.iconSizeData=Qm(this.zoom,r["icon-size"]);const a=this.layers[0].layout,c=a.get("symbol-sort-key"),d=a.get("symbol-z-order");this.canOverlap=Mp(a,"text-overlap","text-allow-overlap")!=="never"||Mp(a,"icon-overlap","icon-allow-overlap")!=="never"||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,a.get("symbol-placement")==="point"&&(this.writingModes=a.get("text-writing-mode").map(p=>S.al[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=t.sourceID}createArrays(){this.text=new Pp(new ta(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Pp(new ta(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new se,this.lineVertexArray=new re,this.symbolInstances=new ie,this.textAnchorOffsets=new Me}calculateGlyphDependencies(t,r,a,c,d){for(let p=0;p<t.length;p++)if(r[t.charCodeAt(p)]=!0,(a||c)&&d){const m=Yc[t.charAt(p)];m&&(r[m.charCodeAt(0)]=!0)}}populate(t,r,a){const c=this.layers[0],d=c.layout,p=d.get("text-font"),m=d.get("text-field"),y=d.get("icon-image"),w=(m.value.kind!=="constant"||m.value.value instanceof Mr&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),M=y.value.kind!=="constant"||!!y.value.value||Object.keys(y.parameters).length>0,C=d.get("symbol-sort-key");if(this.features=[],!w&&!M)return;const k=r.iconDependencies,D=r.glyphDependencies,L=r.availableImages,j=new Xt(this.zoom);for(const{feature:U,id:X,index:ne,sourceLayerIndex:Y}of t){const R=c._featureFilter.needGeometry,V=so(U,R);if(!c._featureFilter.filter(j,V,a))continue;let Q,fe;if(R||(V.geometry=ao(U)),w){const ye=c.getValueAndResolveTokens("text-field",V,a,L),Te=Mr.factory(ye),De=this.hasRTLText=this.hasRTLText||Lv(Te);(!De||zn.getRTLTextPluginStatus()==="unavailable"||De&&zn.isParsed())&&(Q=yv(Te,c,V))}if(M){const ye=c.getValueAndResolveTokens("icon-image",V,a,L);fe=ye instanceof Lr?ye:Lr.fromString(ye)}if(!Q&&!fe)continue;const ke=this.sortFeaturesByKey?C.evaluate(V,{},a):void 0;if(this.features.push({id:X,text:Q,icon:fe,index:ne,sourceLayerIndex:Y,geometry:V.geometry,properties:U.properties,type:Rv[U.type],sortKey:ke}),fe&&(k[fe.name]=!0),Q){const ye=p.evaluate(V,{},a).join(","),Te=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(S.al.vertical)>=0;for(const De of Q.sections)if(De.image)k[De.image.name]=!0;else{const ze=ol(Q.toString()),Le=De.fontStack||ye,Se=D[Le]=D[Le]||{};this.calculateGlyphDependencies(De.text,Se,Te,this.allowVerticalPlacement,ze)}}}d.get("symbol-placement")==="line"&&(this.features=function(U){const X={},ne={},Y=[];let R=0;function V(ye){Y.push(U[ye]),R++}function Q(ye,Te,De){const ze=ne[ye];return delete ne[ye],ne[Te]=ze,Y[ze].geometry[0].pop(),Y[ze].geometry[0]=Y[ze].geometry[0].concat(De[0]),ze}function fe(ye,Te,De){const ze=X[Te];return delete X[Te],X[ye]=ze,Y[ze].geometry[0].shift(),Y[ze].geometry[0]=De[0].concat(Y[ze].geometry[0]),ze}function ke(ye,Te,De){const ze=De?Te[0][Te[0].length-1]:Te[0][0];return`${ye}:${ze.x}:${ze.y}`}for(let ye=0;ye<U.length;ye++){const Te=U[ye],De=Te.geometry,ze=Te.text?Te.text.toString():null;if(!ze){V(ye);continue}const Le=ke(ze,De),Se=ke(ze,De,!0);if(Le in ne&&Se in X&&ne[Le]!==X[Se]){const Ge=fe(Le,Se,De),et=Q(Le,Se,Y[Ge].geometry);delete X[Le],delete ne[Se],ne[ke(ze,Y[et].geometry,!0)]=et,Y[Ge].geometry=null}else Le in ne?Q(Le,Se,De):Se in X?fe(Le,Se,De):(V(ye),X[Le]=R-1,ne[Se]=R-1)}return Y.filter(ye=>ye.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((U,X)=>U.sortKey-X.sortKey)}update(t,r,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,a),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,a))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,r){const a=this.lineVertexArray.length;if(t.segment!==void 0){let c=t.dist(r[t.segment+1]),d=t.dist(r[t.segment]);const p={};for(let m=t.segment+1;m<r.length;m++)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:c},m<r.length-1&&(c+=r[m+1].dist(r[m]));for(let m=t.segment||0;m>=0;m--)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:d},m>0&&(d+=r[m-1].dist(r[m]));for(let m=0;m<r.length;m++){const y=p[m];this.lineVertexArray.emplaceBack(y.x,y.y,y.tileUnitDistanceFromAnchor)}}return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(t,r,a,c,d,p,m,y,w,M,C,k){const D=t.indexArray,L=t.layoutVertexArray,j=t.segments.prepareSegment(4*r.length,L,D,this.canOverlap?p.sortKey:void 0),U=this.glyphOffsetArray.length,X=j.vertexLength,ne=this.allowVerticalPlacement&&m===S.al.vertical?Math.PI/2:0,Y=p.text&&p.text.sections;for(let R=0;R<r.length;R++){const{tl:V,tr:Q,bl:fe,br:ke,tex:ye,pixelOffsetTL:Te,pixelOffsetBR:De,minFontScaleX:ze,minFontScaleY:Le,glyphOffset:Se,isSDF:Ge,sectionIndex:et}=r[R],Je=j.vertexLength,We=Se[1];Uh(L,y.x,y.y,V.x,We+V.y,ye.x,ye.y,a,Ge,Te.x,Te.y,ze,Le),Uh(L,y.x,y.y,Q.x,We+Q.y,ye.x+ye.w,ye.y,a,Ge,De.x,Te.y,ze,Le),Uh(L,y.x,y.y,fe.x,We+fe.y,ye.x,ye.y+ye.h,a,Ge,Te.x,De.y,ze,Le),Uh(L,y.x,y.y,ke.x,We+ke.y,ye.x+ye.w,ye.y+ye.h,a,Ge,De.x,De.y,ze,Le),Sp(t.dynamicLayoutVertexArray,y,ne),D.emplaceBack(Je,Je+2,Je+1),D.emplaceBack(Je+1,Je+2,Je+3),j.vertexLength+=4,j.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Se[0]),R!==r.length-1&&et===r[R+1].sectionIndex||t.programConfigurations.populatePaintArrays(L.length,p,p.index,{},k,Y&&Y[et])}t.placedSymbolArray.emplaceBack(y.x,y.y,U,this.glyphOffsetArray.length-U,X,w,M,y.segment,a?a[0]:0,a?a[1]:0,c[0],c[1],m,0,!1,0,C)}_addCollisionDebugVertex(t,r,a,c,d,p){return r.emplaceBack(0,0),t.emplaceBack(a.x,a.y,c,d,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(t,r,a,c,d,p,m){const y=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),w=y.vertexLength,M=d.layoutVertexArray,C=d.collisionVertexArray,k=m.anchorX,D=m.anchorY;this._addCollisionDebugVertex(M,C,p,k,D,new Fe(t,r)),this._addCollisionDebugVertex(M,C,p,k,D,new Fe(a,r)),this._addCollisionDebugVertex(M,C,p,k,D,new Fe(a,c)),this._addCollisionDebugVertex(M,C,p,k,D,new Fe(t,c)),y.vertexLength+=4;const L=d.indexArray;L.emplaceBack(w,w+1),L.emplaceBack(w+1,w+2),L.emplaceBack(w+2,w+3),L.emplaceBack(w+3,w),y.primitiveLength+=4}addDebugCollisionBoxes(t,r,a,c){for(let d=t;d<r;d++){const p=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,c?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,a)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Cp(ai,Nm.members,Ai),this.iconCollisionBox=new Cp(ai,Nm.members,Ai);for(let t=0;t<this.symbolInstances.length;t++){const r=this.symbolInstances.get(t);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(t,r,a,c,d,p,m,y,w){const M={};for(let C=r;C<a;C++){const k=t.get(C);M.textBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},M.textFeatureIndex=k.featureIndex;break}for(let C=c;C<d;C++){const k=t.get(C);M.verticalTextBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},M.verticalTextFeatureIndex=k.featureIndex;break}for(let C=p;C<m;C++){const k=t.get(C);M.iconBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},M.iconFeatureIndex=k.featureIndex;break}for(let C=y;C<w;C++){const k=t.get(C);M.verticalIconBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},M.verticalIconFeatureIndex=k.featureIndex;break}return M}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const a=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.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}addIndicesForPlacedSymbol(t,r){const a=t.placedSymbolArray.get(r),c=a.vertexStartIndex+4*a.numGlyphs;for(let d=a.vertexStartIndex;d<c;d+=4)t.indexArray.emplaceBack(d,d+2,d+1),t.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(t),a=Math.cos(t),c=[],d=[],p=[];for(let m=0;m<this.symbolInstances.length;++m){p.push(m);const y=this.symbolInstances.get(m);c.push(0|Math.round(r*y.anchorX+a*y.anchorY)),d.push(y.featureIndex)}return p.sort((m,y)=>c[m]-c[y]||d[y]-d[m]),p}addToSortKeyRanges(t,r){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===r?a.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const a=this.symbolInstances.get(r);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((c,d,p)=>{c>=0&&p.indexOf(c)===d&&this.addIndicesForPlacedSymbol(this.text,c)}),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let eg,tg;$e("SymbolBucket",_l,{omit:["layers","collisionBoxArray","features","compareText"]}),_l.MAX_GLYPHS=65535,_l.addDynamicAttributes=Sp;var Ip={get paint(){return tg=tg||new Ti({"icon-opacity":new rt($.paint_symbol["icon-opacity"]),"icon-color":new rt($.paint_symbol["icon-color"]),"icon-halo-color":new rt($.paint_symbol["icon-halo-color"]),"icon-halo-width":new rt($.paint_symbol["icon-halo-width"]),"icon-halo-blur":new rt($.paint_symbol["icon-halo-blur"]),"icon-translate":new Ke($.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ke($.paint_symbol["icon-translate-anchor"]),"text-opacity":new rt($.paint_symbol["text-opacity"]),"text-color":new rt($.paint_symbol["text-color"],{runtimeType:oi,getOverride:n=>n.textColor,hasOverride:n=>!!n.textColor}),"text-halo-color":new rt($.paint_symbol["text-halo-color"]),"text-halo-width":new rt($.paint_symbol["text-halo-width"]),"text-halo-blur":new rt($.paint_symbol["text-halo-blur"]),"text-translate":new Ke($.paint_symbol["text-translate"]),"text-translate-anchor":new Ke($.paint_symbol["text-translate-anchor"])})},get layout(){return eg=eg||new Ti({"symbol-placement":new Ke($.layout_symbol["symbol-placement"]),"symbol-spacing":new Ke($.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ke($.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new rt($.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ke($.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ke($.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ke($.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ke($.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ke($.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ke($.layout_symbol["icon-rotation-alignment"]),"icon-size":new rt($.layout_symbol["icon-size"]),"icon-text-fit":new Ke($.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ke($.layout_symbol["icon-text-fit-padding"]),"icon-image":new rt($.layout_symbol["icon-image"]),"icon-rotate":new rt($.layout_symbol["icon-rotate"]),"icon-padding":new rt($.layout_symbol["icon-padding"]),"icon-keep-upright":new Ke($.layout_symbol["icon-keep-upright"]),"icon-offset":new rt($.layout_symbol["icon-offset"]),"icon-anchor":new rt($.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ke($.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ke($.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ke($.layout_symbol["text-rotation-alignment"]),"text-field":new rt($.layout_symbol["text-field"]),"text-font":new rt($.layout_symbol["text-font"]),"text-size":new rt($.layout_symbol["text-size"]),"text-max-width":new rt($.layout_symbol["text-max-width"]),"text-line-height":new Ke($.layout_symbol["text-line-height"]),"text-letter-spacing":new rt($.layout_symbol["text-letter-spacing"]),"text-justify":new rt($.layout_symbol["text-justify"]),"text-radial-offset":new rt($.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ke($.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new rt($.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new rt($.layout_symbol["text-anchor"]),"text-max-angle":new Ke($.layout_symbol["text-max-angle"]),"text-writing-mode":new Ke($.layout_symbol["text-writing-mode"]),"text-rotate":new rt($.layout_symbol["text-rotate"]),"text-padding":new Ke($.layout_symbol["text-padding"]),"text-keep-upright":new Ke($.layout_symbol["text-keep-upright"]),"text-transform":new rt($.layout_symbol["text-transform"]),"text-offset":new rt($.layout_symbol["text-offset"]),"text-allow-overlap":new Ke($.layout_symbol["text-allow-overlap"]),"text-overlap":new Ke($.layout_symbol["text-overlap"]),"text-ignore-placement":new Ke($.layout_symbol["text-ignore-placement"]),"text-optional":new Ke($.layout_symbol["text-optional"])})}};class ig{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:at,this.defaultValue=t}evaluate(t){if(t.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}$e("FormatSectionOverride",ig,{omit:["defaultValue"]});class $h extends qr{constructor(t){super(t,Ip)}recalculate(t,r){if(super.recalculate(t,r),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")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const a=this.layout.get("text-writing-mode");if(a){const c=[];for(const d of a)c.indexOf(d)<0&&c.push(d);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,a,c){const d=this.layout.get(t).evaluate(r,{},a,c),p=this._unevaluatedLayout._values[t];return p.isDataDriven()||Us(p.value)||!d?d:function(m,y){return y.replace(/{([^{}]+)}/g,(w,M)=>m&&M in m?String(m[M]):"")}(r.properties,d)}createBucket(t){return new _l(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Ip.paint.overridableProperties){if(!$h.hasPaintOverride(this.layout,t))continue;const r=this.paint.get(t),a=new ig(r),c=new Xo(a,r.property.specification);let d=null;d=r.value.kind==="constant"||r.value.kind==="source"?new gc("source",c):new Yo("composite",c,r.value.zoomStops),this.paint._values[t]=new pr(r.property,d,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven())&&$h.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){const a=t.get("text-field"),c=Ip.paint.properties[r];let d=!1;const p=m=>{for(const y of m)if(c.overrides&&c.overrides.hasOverride(y))return void(d=!0)};if(a.value.kind==="constant"&&a.value.value instanceof Mr)p(a.value.value.sections);else if(a.value.kind==="source"){const m=w=>{d||(w instanceof lt&&ci(w.value)===Ms?p(w.value.sections):w instanceof Ro?p(w.sections):w.eachChild(m))},y=a.value;y._styleExpression&&m(y._styleExpression.expression)}return d}}let rg;var Bv={get paint(){return rg=rg||new Ti({"background-color":new Ke($.paint_background["background-color"]),"background-pattern":new zc($.paint_background["background-pattern"]),"background-opacity":new Ke($.paint_background["background-opacity"])})}};class Fv extends qr{constructor(t){super(t,Bv)}}let ng;var Ov={get paint(){return ng=ng||new Ti({"raster-opacity":new Ke($.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ke($.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ke($.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ke($.paint_raster["raster-brightness-max"]),"raster-saturation":new Ke($.paint_raster["raster-saturation"]),"raster-contrast":new Ke($.paint_raster["raster-contrast"]),"raster-resampling":new Ke($.paint_raster["raster-resampling"]),"raster-fade-duration":new Ke($.paint_raster["raster-fade-duration"])})}};class jv extends qr{constructor(t){super(t,Ov)}}class Nv extends qr{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Zv{constructor(t){this._methodToThrottle=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Vv={once:!0},Ep=63710088e-1;class ds{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new ds(vr(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const r=Math.PI/180,a=this.lat*r,c=t.lat*r,d=Math.sin(a)*Math.sin(c)+Math.cos(a)*Math.cos(c)*Math.cos((t.lng-this.lng)*r);return Ep*Math.acos(Math.min(d,1))}static convert(t){if(t instanceof ds)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new ds(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new ds(Number("lng"in t?t.lng:t.lon),Number(t.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>]")}}const ag=2*Math.PI*Ep;function sg(n){return ag*Math.cos(n*Math.PI/180)}function og(n){return(180+n)/360}function lg(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function cg(n,t){return n/sg(t)}function Ap(n){return 360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90}function ug(n,t){return n*sg(Ap(t))}class eu{constructor(t,r,a=0){this.x=+t,this.y=+r,this.z=+a}static fromLngLat(t,r=0){const a=ds.convert(t);return new eu(og(a.lng),lg(a.lat),cg(r,a.lat))}toLngLat(){return new ds(360*this.x-180,Ap(this.y))}toAltitude(){return ug(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/ag*(t=Ap(this.y),1/Math.cos(t*Math.PI/180));var t}}function hg(n,t,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[n*a-2*Math.PI*6378137/2,t*a-2*Math.PI*6378137/2]}class kp{constructor(t,r,a){if(!function(c,d,p){return!(c<0||c>25||p<0||p>=Math.pow(2,c)||d<0||d>=Math.pow(2,c))}(t,r,a))throw new Error(`x=${r}, y=${a}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=r,this.y=a,this.key=yl(0,t,t,r,a)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,a){const c=(p=this.y,m=this.z,y=hg(256*(d=this.x),256*(p=Math.pow(2,m)-p-1),m),w=hg(256*(d+1),256*(p+1),m),y[0]+","+y[1]+","+w[0]+","+w[1]);var d,p,m,y,w;const M=function(C,k,D){let L,j="";for(let U=C;U>0;U--)L=1<<U-1,j+=(k&L?1:0)+(D&L?2:0);return j}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(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(a==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,M).replace(/{bbox-epsg-3857}/g,c)}isChildOf(t){const r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){const r=Math.pow(2,this.z);return new Fe((t.x*r-this.x)*Et,(t.y*r-this.y)*Et)}toString(){return`${this.z}/${this.x}/${this.y}`}}class dg{constructor(t,r){this.wrap=t,this.canonical=r,this.key=yl(t,r.z,r.z,r.x,r.y)}}class rn{constructor(t,r,a,c,d){if(this.terrainRttPosMatrix32f=null,t<a)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${a}`);this.overscaledZ=t,this.wrap=r,this.canonical=new kp(a,+c,+d),this.key=yl(r,t,a,c,d)}clone(){return new rn(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?new rn(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new rn(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-t;return t>this.canonical.z?yl(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):yl(this.wrap*+r,t,t,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new rn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,a=2*this.canonical.x,c=2*this.canonical.y;return[new rn(r,this.wrap,r,a,c),new rn(r,this.wrap,r,a+1,c),new rn(r,this.wrap,r,a,c+1),new rn(r,this.wrap,r,a+1,c+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new rn(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new rn(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new dg(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new eu(t.x-this.wrap,t.y))}}function yl(n,t,r,a,c){(n*=2)<0&&(n=-1*n-1);const d=1<<r;return(d*d*n+d*c+a).toString(36)+r.toString(36)+t.toString(36)}$e("CanonicalTileID",kp),$e("OverscaledTileID",rn,{omit:["terrainRttPosMatrix32f"]});class pg{constructor(t,r,a,c=1,d=1,p=1,m=0){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(a&&!["mapbox","terrarium","custom"].includes(a))return void Ui(`"${a}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const y=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),a){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=c,this.greenFactor=d,this.blueFactor=p,this.baseShift=m;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let w=0;w<y;w++)this.data[this._idx(-1,w)]=this.data[this._idx(0,w)],this.data[this._idx(y,w)]=this.data[this._idx(y-1,w)],this.data[this._idx(w,-1)]=this.data[this._idx(w,0)],this.data[this._idx(w,y)]=this.data[this._idx(w,y-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(y,-1)]=this.data[this._idx(y-1,0)],this.data[this._idx(-1,y)]=this.data[this._idx(0,y-1)],this.data[this._idx(y,y)]=this.data[this._idx(y-1,y-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let w=0;w<y;w++)for(let M=0;M<y;M++){const C=this.get(w,M);C>this.max&&(this.max=C),C<this.min&&(this.min=C)}}get(t,r){const a=new Uint8Array(this.data.buffer),c=4*this._idx(t,r);return this.unpack(a[c],a[c+1],a[c+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,a){return t*this.redFactor+r*this.greenFactor+a*this.blueFactor-this.baseShift}getPixels(){return new tn({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,a){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let c=r*this.dim,d=r*this.dim+this.dim,p=a*this.dim,m=a*this.dim+this.dim;switch(r){case-1:c=d-1;break;case 1:d=c+1}switch(a){case-1:p=m-1;break;case 1:m=p+1}const y=-r*this.dim,w=-a*this.dim;for(let M=p;M<m;M++)for(let C=c;C<d;C++)this.data[this._idx(C,M)]=t.data[this._idx(C+y,M+w)]}}$e("DEMData",pg);class fg{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){const a=t[r];this._stringToNumber[a]=r,this._numberToString[r]=a}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class mg{constructor(t,r,a,c,d){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=a,t._y=c,this.properties=t.properties,this.id=d}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class gg{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new ss(Et,16,0),this.grid3D=new ss(Et,16,0),this.featureIndexArray=new ve,this.promoteId=r}insert(t,r,a,c,d,p){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,c,d);const y=p?this.grid3D:this.grid;for(let w=0;w<r.length;w++){const M=r[w],C=[1/0,1/0,-1/0,-1/0];for(let k=0;k<M.length;k++){const D=M[k];C[0]=Math.min(C[0],D.x),C[1]=Math.min(C[1],D.y),C[2]=Math.max(C[2],D.x),C[3]=Math.max(C[3],D.y)}C[0]<Et&&C[1]<Et&&C[2]>=0&&C[3]>=0&&y.insert(m,C[0],C[1],C[2],C[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Wc.VectorTile(new xp(this.rawTileData)).layers,this.sourceLayerCoder=new fg(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,a,c){this.loadVTLayers();const d=t.params,p=Et/t.tileSize/t.scale,m=Hs(d.filter),y=t.queryGeometry,w=t.queryPadding*p,M=yg(y),C=this.grid.query(M.minX-w,M.minY-w,M.maxX+w,M.maxY+w),k=yg(t.cameraQueryGeometry),D=this.grid3D.query(k.minX-w,k.minY-w,k.maxX+w,k.maxY+w,(U,X,ne,Y)=>function(R,V,Q,fe,ke){for(const Te of R)if(V<=Te.x&&Q<=Te.y&&fe>=Te.x&&ke>=Te.y)return!0;const ye=[new Fe(V,Q),new Fe(V,ke),new Fe(fe,ke),new Fe(fe,Q)];if(R.length>2){for(const Te of ye)if(oo(R,Te))return!0}for(let Te=0;Te<R.length-1;Te++)if(Ax(R[Te],R[Te+1],ye))return!0;return!1}(t.cameraQueryGeometry,U-w,X-w,ne+w,Y+w));for(const U of D)C.push(U);C.sort(Uv);const L={};let j;for(let U=0;U<C.length;U++){const X=C[U];if(X===j)continue;j=X;const ne=this.featureIndexArray.get(X);let Y=null;this.loadMatchingFeature(L,ne.bucketIndex,ne.sourceLayerIndex,ne.featureIndex,m,d.layers,d.availableImages,r,a,c,(R,V,Q)=>(Y||(Y=ao(R)),V.queryIntersectsFeature({queryGeometry:y,feature:R,featureState:Q,geometry:Y,zoom:this.z,transform:t.transform,pixelsToTileUnits:p,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return L}loadMatchingFeature(t,r,a,c,d,p,m,y,w,M,C){const k=this.bucketLayerIDs[r];if(p&&!k.some(U=>p.has(U)))return;const D=this.sourceLayerCoder.decode(a),L=this.vtLayers[D].feature(c);if(d.needGeometry){const U=so(L,!0);if(!d.filter(new Xt(this.tileID.overscaledZ),U,this.tileID.canonical))return}else if(!d.filter(new Xt(this.tileID.overscaledZ),L))return;const j=this.getId(L,D);for(let U=0;U<k.length;U++){const X=k[U];if(p&&!p.has(X))continue;const ne=y[X];if(!ne)continue;let Y={};j&&M&&(Y=M.getState(ne.sourceLayer||"_geojsonTileLayer",j));const R=Qi({},w[X]);R.paint=_g(R.paint,ne.paint,L,Y,m),R.layout=_g(R.layout,ne.layout,L,Y,m);const V=!C||C(L,ne,Y);if(!V)continue;const Q=new mg(L,this.z,this.x,this.y,j);Q.layer=R;let fe=t[X];fe===void 0&&(fe=t[X]=[]),fe.push({featureIndex:c,feature:Q,intersectionZ:V})}}lookupSymbolFeatures(t,r,a,c,d,p,m,y){const w={};this.loadVTLayers();const M=Hs(d);for(const C of t)this.loadMatchingFeature(w,a,c,C,M,p,m,y,r);return w}hasLayer(t){for(const r of this.bucketLayerIDs)for(const a of r)if(t===a)return!0;return!1}getId(t,r){var a;let c=t.id;return this.promoteId&&(c=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof c=="boolean"&&(c=Number(c)),c===void 0&&(!((a=t.properties)===null||a===void 0)&&a.cluster)&&this.promoteId&&(c=Number(t.properties.cluster_id))),c}}function _g(n,t,r,a,c){return un(n,(d,p)=>{const m=t instanceof ul?t.get(p):null;return m&&m.evaluate?m.evaluate(r,a,c):m})}function yg(n){let t=1/0,r=1/0,a=-1/0,c=-1/0;for(const d of n)t=Math.min(t,d.x),r=Math.min(r,d.y),a=Math.max(a,d.x),c=Math.max(c,d.y);return{minX:t,minY:r,maxX:a,maxY:c}}function Uv(n,t){return t-n}function xg(n,t,r,a,c){const d=[];for(let p=0;p<n.length;p++){const m=n[p];let y;for(let w=0;w<m.length-1;w++){let M=m[w],C=m[w+1];M.x<t&&C.x<t||(M.x<t?M=new Fe(t,M.y+(t-M.x)/(C.x-M.x)*(C.y-M.y))._round():C.x<t&&(C=new Fe(t,M.y+(t-M.x)/(C.x-M.x)*(C.y-M.y))._round()),M.y<r&&C.y<r||(M.y<r?M=new Fe(M.x+(r-M.y)/(C.y-M.y)*(C.x-M.x),r)._round():C.y<r&&(C=new Fe(M.x+(r-M.y)/(C.y-M.y)*(C.x-M.x),r)._round()),M.x>=a&&C.x>=a||(M.x>=a?M=new Fe(a,M.y+(a-M.x)/(C.x-M.x)*(C.y-M.y))._round():C.x>=a&&(C=new Fe(a,M.y+(a-M.x)/(C.x-M.x)*(C.y-M.y))._round()),M.y>=c&&C.y>=c||(M.y>=c?M=new Fe(M.x+(c-M.y)/(C.y-M.y)*(C.x-M.x),c)._round():C.y>=c&&(C=new Fe(M.x+(c-M.y)/(C.y-M.y)*(C.x-M.x),c)._round()),y&&M.equals(y[y.length-1])||(y=[M],d.push(y)),y.push(C)))))}}return d}$e("FeatureIndex",gg,{omit:["rawTileData","sourceLayerCoder"]});class ps extends Fe{constructor(t,r,a,c){super(t,r),this.angle=a,c!==void 0&&(this.segment=c)}clone(){return new ps(this.x,this.y,this.angle,this.segment)}}function vg(n,t,r,a,c){if(t.segment===void 0||r===0)return!0;let d=t,p=t.segment+1,m=0;for(;m>-r/2;){if(p--,p<0)return!1;m-=n[p].dist(d),d=n[p]}m+=n[p].dist(n[p+1]),p++;const y=[];let w=0;for(;m<r/2;){const M=n[p],C=n[p+1];if(!C)return!1;let k=n[p-1].angleTo(M)-M.angleTo(C);for(k=Math.abs((k+3*Math.PI)%(2*Math.PI)-Math.PI),y.push({distance:m,angleDelta:k}),w+=k;m-y[0].distance>a;)w-=y.shift().angleDelta;if(w>c)return!1;p++,m+=M.dist(C)}return!0}function bg(n){let t=0;for(let r=0;r<n.length-1;r++)t+=n[r].dist(n[r+1]);return t}function wg(n,t,r){return n?.6*t*r:0}function Tg(n,t){return Math.max(n?n.right-n.left:0,t?t.right-t.left:0)}function $v(n,t,r,a,c,d){const p=wg(r,c,d),m=Tg(r,a)*d;let y=0;const w=bg(n)/2;for(let M=0;M<n.length-1;M++){const C=n[M],k=n[M+1],D=C.dist(k);if(y+D>w){const L=(w-y)/D,j=pn.number(C.x,k.x,L),U=pn.number(C.y,k.y,L),X=new ps(j,U,k.angleTo(C),M);return X._round(),!p||vg(n,X,m,p,t)?X:void 0}y+=D}}function Gv(n,t,r,a,c,d,p,m,y){const w=wg(a,d,p),M=Tg(a,c),C=M*p,k=n[0].x===0||n[0].x===y||n[0].y===0||n[0].y===y;return t-C<t/4&&(t=C+t/4),Mg(n,k?t/2*m%t:(M/2+2*d)*p*m%t,t,w,r,C,k,!1,y)}function Mg(n,t,r,a,c,d,p,m,y){const w=d/2,M=bg(n);let C=0,k=t-r,D=[];for(let L=0;L<n.length-1;L++){const j=n[L],U=n[L+1],X=j.dist(U),ne=U.angleTo(j);for(;k+r<C+X;){k+=r;const Y=(k-C)/X,R=pn.number(j.x,U.x,Y),V=pn.number(j.y,U.y,Y);if(R>=0&&R<y&&V>=0&&V<y&&k-w>=0&&k+w<=M){const Q=new ps(R,V,ne,L);Q._round(),a&&!vg(n,Q,d,a,c)||D.push(Q)}}C+=X}return m||D.length||p||(D=Mg(n,C/2,r,a,c,d,p,!0,y)),D}$e("Anchor",ps);const tu=Or;function Sg(n,t,r,a){const c=[],d=n.image,p=d.pixelRatio,m=d.paddedRect.w-2*tu,y=d.paddedRect.h-2*tu;let w={x1:n.left,y1:n.top,x2:n.right,y2:n.bottom};const M=d.stretchX||[[0,m]],C=d.stretchY||[[0,y]],k=(Se,Ge)=>Se+Ge[1]-Ge[0],D=M.reduce(k,0),L=C.reduce(k,0),j=m-D,U=y-L;let X=0,ne=D,Y=0,R=L,V=0,Q=j,fe=0,ke=U;if(d.content&&a){const Se=d.content,Ge=Se[2]-Se[0],et=Se[3]-Se[1];(d.textFitWidth||d.textFitHeight)&&(w=Ym(n)),X=Gh(M,0,Se[0]),Y=Gh(C,0,Se[1]),ne=Gh(M,Se[0],Se[2]),R=Gh(C,Se[1],Se[3]),V=Se[0]-X,fe=Se[1]-Y,Q=Ge-ne,ke=et-R}const ye=w.x1,Te=w.y1,De=w.x2-ye,ze=w.y2-Te,Le=(Se,Ge,et,Je)=>{const We=qh(Se.stretch-X,ne,De,ye),bt=Hh(Se.fixed-V,Q,Se.stretch,D),hi=qh(Ge.stretch-Y,R,ze,Te),zi=Hh(Ge.fixed-fe,ke,Ge.stretch,L),nr=qh(et.stretch-X,ne,De,ye),nn=Hh(et.fixed-V,Q,et.stretch,D),jr=qh(Je.stretch-Y,R,ze,Te),Hi=Hh(Je.fixed-fe,ke,Je.stretch,L),si=new Fe(We,hi),Fi=new Fe(nr,hi),Wi=new Fe(nr,jr),Xi=new Fe(We,jr),Pr=new Fe(bt/p,zi/p),an=new Fe(nn/p,Hi/p),Oi=t*Math.PI/180;if(Oi){const ji=Math.sin(Oi),Ni=Math.cos(Oi),Pi=[Ni,-ji,ji,Ni];si._matMult(Pi),Fi._matMult(Pi),Xi._matMult(Pi),Wi._matMult(Pi)}const Nr=Se.stretch+Se.fixed,Ri=Ge.stretch+Ge.fixed;return{tl:si,tr:Fi,bl:Xi,br:Wi,tex:{x:d.paddedRect.x+tu+Nr,y:d.paddedRect.y+tu+Ri,w:et.stretch+et.fixed-Nr,h:Je.stretch+Je.fixed-Ri},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Pr,pixelOffsetBR:an,minFontScaleX:Q/p/De,minFontScaleY:ke/p/ze,isSDF:r}};if(a&&(d.stretchX||d.stretchY)){const Se=Pg(M,j,D),Ge=Pg(C,U,L);for(let et=0;et<Se.length-1;et++){const Je=Se[et],We=Se[et+1];for(let bt=0;bt<Ge.length-1;bt++)c.push(Le(Je,Ge[bt],We,Ge[bt+1]))}}else c.push(Le({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:y+1}));return c}function Gh(n,t,r){let a=0;for(const c of n)a+=Math.max(t,Math.min(r,c[1]))-Math.max(t,Math.min(r,c[0]));return a}function Pg(n,t,r){const a=[{fixed:-1,stretch:0}];for(const[c,d]of n){const p=a[a.length-1];a.push({fixed:c-p.stretch,stretch:p.stretch}),a.push({fixed:c-p.stretch,stretch:p.stretch+(d-c)})}return a.push({fixed:t+tu,stretch:r}),a}function qh(n,t,r,a){return n/t*r+a}function Hh(n,t,r,a){return n-t*r/a}class Wh{constructor(t,r,a,c,d,p,m,y,w,M){var C;if(this.boxStartIndex=t.length,w){let k=p.top,D=p.bottom;const L=p.collisionPadding;L&&(k-=L[1],D+=L[3]);let j=D-k;j>0&&(j=Math.max(10,j),this.circleDiameter=j)}else{const k=!((C=p.image)===null||C===void 0)&&C.content&&(p.image.textFitWidth||p.image.textFitHeight)?Ym(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};k.y1=k.y1*m-y[0],k.y2=k.y2*m+y[2],k.x1=k.x1*m-y[3],k.x2=k.x2*m+y[1];const D=p.collisionPadding;if(D&&(k.x1-=D[0]*m,k.y1-=D[1]*m,k.x2+=D[2]*m,k.y2+=D[3]*m),M){const L=new Fe(k.x1,k.y1),j=new Fe(k.x2,k.y1),U=new Fe(k.x1,k.y2),X=new Fe(k.x2,k.y2),ne=M*Math.PI/180;L._rotate(ne),j._rotate(ne),U._rotate(ne),X._rotate(ne),k.x1=Math.min(L.x,j.x,U.x,X.x),k.x2=Math.max(L.x,j.x,U.x,X.x),k.y1=Math.min(L.y,j.y,U.y,X.y),k.y2=Math.max(L.y,j.y,U.y,X.y)}t.emplaceBack(r.x,r.y,k.x1,k.y1,k.x2,k.y2,a,c,d)}this.boxEndIndex=t.length}}class qv{constructor(t=[],r=(a,c)=>a<c?-1:a>c?1:0){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:r,compare:a}=this,c=r[t];for(;t>0;){const d=t-1>>1,p=r[d];if(a(c,p)>=0)break;r[t]=p,t=d}r[t]=c}_down(t){const{data:r,compare:a}=this,c=this.length>>1,d=r[t];for(;t<c;){let p=1+(t<<1);const m=p+1;if(m<this.length&&a(r[m],r[p])<0&&(p=m),a(r[p],d)>=0)break;r[t]=r[p],t=p}r[t]=d}}function Hv(n,t=1,r=!1){let a=1/0,c=1/0,d=-1/0,p=-1/0;const m=n[0];for(let D=0;D<m.length;D++){const L=m[D];(!D||L.x<a)&&(a=L.x),(!D||L.y<c)&&(c=L.y),(!D||L.x>d)&&(d=L.x),(!D||L.y>p)&&(p=L.y)}const y=Math.min(d-a,p-c);let w=y/2;const M=new qv([],Wv);if(y===0)return new Fe(a,c);for(let D=a;D<d;D+=y)for(let L=c;L<p;L+=y)M.push(new xl(D+w,L+w,w,n));let C=function(D){let L=0,j=0,U=0;const X=D[0];for(let ne=0,Y=X.length,R=Y-1;ne<Y;R=ne++){const V=X[ne],Q=X[R],fe=V.x*Q.y-Q.x*V.y;j+=(V.x+Q.x)*fe,U+=(V.y+Q.y)*fe,L+=3*fe}return new xl(j/L,U/L,0,D)}(n),k=M.length;for(;M.length;){const D=M.pop();(D.d>C.d||!C.d)&&(C=D,r&&console.log("found best %d after %d probes",Math.round(1e4*D.d)/1e4,k)),D.max-C.d<=t||(w=D.h/2,M.push(new xl(D.p.x-w,D.p.y-w,w,n)),M.push(new xl(D.p.x+w,D.p.y-w,w,n)),M.push(new xl(D.p.x-w,D.p.y+w,w,n)),M.push(new xl(D.p.x+w,D.p.y+w,w,n)),k+=4)}return r&&(console.log(`num probes: ${k}`),console.log(`best distance: ${C.d}`)),C.p}function Wv(n,t){return t.max-n.max}function xl(n,t,r,a){this.p=new Fe(n,t),this.h=r,this.d=function(c,d){let p=!1,m=1/0;for(let y=0;y<d.length;y++){const w=d[y];for(let M=0,C=w.length,k=C-1;M<C;k=M++){const D=w[M],L=w[k];D.y>c.y!=L.y>c.y&&c.x<(L.x-D.x)*(c.y-D.y)/(L.y-D.y)+D.x&&(p=!p),m=Math.min(m,sm(c,D,L))}}return(p?1:-1)*Math.sqrt(m)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var rr;S.aB=void 0,(rr=S.aB||(S.aB={}))[rr.center=1]="center",rr[rr.left=2]="left",rr[rr.right=3]="right",rr[rr.top=4]="top",rr[rr.bottom=5]="bottom",rr[rr["top-left"]=6]="top-left",rr[rr["top-right"]=7]="top-right",rr[rr["bottom-left"]=8]="bottom-left",rr[rr["bottom-right"]=9]="bottom-right";const fs=7,zp=Number.POSITIVE_INFINITY;function Cg(n,t){return t[1]!==zp?function(r,a,c){let d=0,p=0;switch(a=Math.abs(a),c=Math.abs(c),r){case"top-right":case"top-left":case"top":p=c-fs;break;case"bottom-right":case"bottom-left":case"bottom":p=-c+fs}switch(r){case"top-right":case"bottom-right":case"right":d=-a;break;case"top-left":case"bottom-left":case"left":d=a}return[d,p]}(n,t[0],t[1]):function(r,a){let c=0,d=0;a<0&&(a=0);const p=a/Math.SQRT2;switch(r){case"top-right":case"top-left":d=p-fs;break;case"bottom-right":case"bottom-left":d=-p+fs;break;case"bottom":d=-a+fs;break;case"top":d=a-fs}switch(r){case"top-right":case"bottom-right":c=-p;break;case"top-left":case"bottom-left":c=p;break;case"left":c=a;break;case"right":c=-a}return[c,d]}(n,t[0])}function Ig(n,t,r){var a;const c=n.layout,d=(a=c.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(t,{},r);if(d){const m=d.values,y=[];for(let w=0;w<m.length;w+=2){const M=y[w]=m[w],C=m[w+1].map(k=>k*ki);M.startsWith("top")?C[1]-=fs:M.startsWith("bottom")&&(C[1]+=fs),y[w+1]=C}return new dr(y)}const p=c.get("text-variable-anchor");if(p){let m;m=n._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[c.get("text-radial-offset").evaluate(t,{},r)*ki,zp]:c.get("text-offset").evaluate(t,{},r).map(w=>w*ki);const y=[];for(const w of p)y.push(w,Cg(w,m));return new dr(y)}return null}function Rp(n){switch(n){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Xv(n,t,r,a,c,d,p,m,y,w,M,C){let k=d.textMaxSize.evaluate(t,{});k===void 0&&(k=p);const D=n.layers[0].layout,L=D.get("icon-offset").evaluate(t,{},M),j=Ag(r.horizontal),U=p/24,X=n.tilePixelRatio*U,ne=n.tilePixelRatio*k/24,Y=n.tilePixelRatio*m,R=n.tilePixelRatio*D.get("symbol-spacing"),V=D.get("text-padding")*n.tilePixelRatio,Q=function(et,Je,We,bt=1){const hi=et.get("icon-padding").evaluate(Je,{},We),zi=hi&&hi.values;return[zi[0]*bt,zi[1]*bt,zi[2]*bt,zi[3]*bt]}(D,t,M,n.tilePixelRatio),fe=D.get("text-max-angle")/180*Math.PI,ke=D.get("text-rotation-alignment")!=="viewport"&&D.get("symbol-placement")!=="point",ye=D.get("icon-rotation-alignment")==="map"&&D.get("symbol-placement")!=="point",Te=D.get("symbol-placement"),De=R/2,ze=D.get("icon-text-fit");let Le;a&&ze!=="none"&&(n.allowVerticalPlacement&&r.vertical&&(Le=Jm(a,r.vertical,ze,D.get("icon-text-fit-padding"),L,U)),j&&(a=Jm(a,j,ze,D.get("icon-text-fit-padding"),L,U)));const Se=M?C.line.getGranularityForZoomLevel(M.z):1,Ge=(et,Je)=>{Je.x<0||Je.x>=Et||Je.y<0||Je.y>=Et||function(We,bt,hi,zi,nr,nn,jr,Hi,si,Fi,Wi,Xi,Pr,an,Oi,Nr,Ri,ji,Ni,Pi,Yt,Ln,vl,Bn,Jv){const bl=We.addToLineVertexArray(bt,hi);let uo,wl,Tl,Ml,Dg=0,Lg=0,Bg=0,Fg=0,Zp=-1,Vp=-1;const Ia={};let Og=Rn("");if(We.allowVerticalPlacement&&zi.vertical){const mr=Hi.layout.get("text-rotate").evaluate(Yt,{},Bn)+90;Tl=new Wh(si,bt,Fi,Wi,Xi,zi.vertical,Pr,an,Oi,mr),jr&&(Ml=new Wh(si,bt,Fi,Wi,Xi,jr,Ri,ji,Oi,mr))}if(nr){const mr=Hi.layout.get("icon-rotate").evaluate(Yt,{}),sn=Hi.layout.get("icon-text-fit")!=="none",ho=Sg(nr,mr,vl,sn),On=jr?Sg(jr,mr,vl,sn):void 0;wl=new Wh(si,bt,Fi,Wi,Xi,nr,Ri,ji,!1,mr),Dg=4*ho.length;const po=We.iconSizeData;let ra=null;po.kind==="source"?(ra=[ia*Hi.layout.get("icon-size").evaluate(Yt,{})],ra[0]>hs&&Ui(`${We.layerIds[0]}: Value for "icon-size" is >= ${Qc}. Reduce your "icon-size".`)):po.kind==="composite"&&(ra=[ia*Ln.compositeIconSizes[0].evaluate(Yt,{},Bn),ia*Ln.compositeIconSizes[1].evaluate(Yt,{},Bn)],(ra[0]>hs||ra[1]>hs)&&Ui(`${We.layerIds[0]}: Value for "icon-size" is >= ${Qc}. Reduce your "icon-size".`)),We.addSymbols(We.icon,ho,ra,Pi,Ni,Yt,S.al.none,bt,bl.lineStartIndex,bl.lineLength,-1,Bn),Zp=We.icon.placedSymbolArray.length-1,On&&(Lg=4*On.length,We.addSymbols(We.icon,On,ra,Pi,Ni,Yt,S.al.vertical,bt,bl.lineStartIndex,bl.lineLength,-1,Bn),Vp=We.icon.placedSymbolArray.length-1)}const jg=Object.keys(zi.horizontal);for(const mr of jg){const sn=zi.horizontal[mr];if(!uo){Og=Rn(sn.text);const On=Hi.layout.get("text-rotate").evaluate(Yt,{},Bn);uo=new Wh(si,bt,Fi,Wi,Xi,sn,Pr,an,Oi,On)}const ho=sn.positionedLines.length===1;if(Bg+=Eg(We,bt,sn,nn,Hi,Oi,Yt,Nr,bl,zi.vertical?S.al.horizontal:S.al.horizontalOnly,ho?jg:[mr],Ia,Zp,Ln,Bn),ho)break}zi.vertical&&(Fg+=Eg(We,bt,zi.vertical,nn,Hi,Oi,Yt,Nr,bl,S.al.vertical,["vertical"],Ia,Vp,Ln,Bn));const Qv=uo?uo.boxStartIndex:We.collisionBoxArray.length,e0=uo?uo.boxEndIndex:We.collisionBoxArray.length,t0=Tl?Tl.boxStartIndex:We.collisionBoxArray.length,i0=Tl?Tl.boxEndIndex:We.collisionBoxArray.length,r0=wl?wl.boxStartIndex:We.collisionBoxArray.length,n0=wl?wl.boxEndIndex:We.collisionBoxArray.length,a0=Ml?Ml.boxStartIndex:We.collisionBoxArray.length,s0=Ml?Ml.boxEndIndex:We.collisionBoxArray.length;let Fn=-1;const Kh=(mr,sn)=>mr&&mr.circleDiameter?Math.max(mr.circleDiameter,sn):sn;Fn=Kh(uo,Fn),Fn=Kh(Tl,Fn),Fn=Kh(wl,Fn),Fn=Kh(Ml,Fn);const Ng=Fn>-1?1:0;Ng&&(Fn*=Jv/ki),We.glyphOffsetArray.length>=_l.MAX_GLYPHS&&Ui("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Yt.sortKey!==void 0&&We.addToSortKeyRanges(We.symbolInstances.length,Yt.sortKey);const o0=Ig(Hi,Yt,Bn),[l0,c0]=function(mr,sn){const ho=mr.length,On=sn==null?void 0:sn.values;if((On==null?void 0:On.length)>0)for(let po=0;po<On.length;po+=2){const ra=On[po+1];mr.emplaceBack(S.aB[On[po]],ra[0],ra[1])}return[ho,mr.length]}(We.textAnchorOffsets,o0);We.symbolInstances.emplaceBack(bt.x,bt.y,Ia.right>=0?Ia.right:-1,Ia.center>=0?Ia.center:-1,Ia.left>=0?Ia.left:-1,Ia.vertical||-1,Zp,Vp,Og,Qv,e0,t0,i0,r0,n0,a0,s0,Fi,Bg,Fg,Dg,Lg,Ng,0,Pr,Fn,l0,c0)}(n,Je,et,r,a,c,Le,n.layers[0],n.collisionBoxArray,t.index,t.sourceLayerIndex,n.index,X,[V,V,V,V],ke,y,Y,Q,ye,L,t,d,w,M,p)};if(Te==="line")for(const et of xg(t.geometry,0,0,Et,Et)){const Je=co(et,Se),We=Gv(Je,R,fe,r.vertical||j,a,24,ne,n.overscaling,Et);for(const bt of We)j&&Kv(n,j.text,De,bt)||Ge(Je,bt)}else if(Te==="line-center"){for(const et of t.geometry)if(et.length>1){const Je=co(et,Se),We=$v(Je,fe,r.vertical||j,a,24,ne);We&&Ge(Je,We)}}else if(t.type==="Polygon")for(const et of Fo(t.geometry,0)){const Je=Hv(et,16);Ge(co(et[0],Se,!0),new ps(Je.x,Je.y,0))}else if(t.type==="LineString")for(const et of t.geometry){const Je=co(et,Se);Ge(Je,new ps(Je[0].x,Je[0].y,0))}else if(t.type==="Point")for(const et of t.geometry)for(const Je of et)Ge([Je],new ps(Je.x,Je.y,0))}function Eg(n,t,r,a,c,d,p,m,y,w,M,C,k,D,L){const j=function(ne,Y,R,V,Q,fe,ke,ye){const Te=V.layout.get("text-rotate").evaluate(fe,{})*Math.PI/180,De=[];for(const ze of Y.positionedLines)for(const Le of ze.positionedGlyphs){if(!Le.rect)continue;const Se=Le.rect||{};let Ge=Tv+1,et=!0,Je=1,We=0;const bt=(Q||ye)&&Le.vertical,hi=Le.metrics.advance*Le.scale/2;if(ye&&Y.verticalizable&&(We=ze.lineOffset/2-(Le.imageName?-(ki-Le.metrics.width*Le.scale)/2:(Le.scale-1)*ki)),Le.imageName){const ji=ke[Le.imageName];et=ji.sdf,Je=ji.pixelRatio,Ge=Or/Je}const zi=Q?[Le.x+hi,Le.y]:[0,0];let nr=Q?[0,0]:[Le.x+hi+R[0],Le.y+R[1]-We],nn=[0,0];bt&&(nn=nr,nr=[0,0]);const jr=Le.metrics.isDoubleResolution?2:1,Hi=(Le.metrics.left-Ge)*Le.scale-hi+nr[0],si=(-Le.metrics.top-Ge)*Le.scale+nr[1],Fi=Hi+Se.w/jr*Le.scale/Je,Wi=si+Se.h/jr*Le.scale/Je,Xi=new Fe(Hi,si),Pr=new Fe(Fi,si),an=new Fe(Hi,Wi),Oi=new Fe(Fi,Wi);if(bt){const ji=new Fe(-hi,hi-Nh),Ni=-Math.PI/2,Pi=ki/2-hi,Yt=new Fe(5-Nh-Pi,-(Le.imageName?Pi:0)),Ln=new Fe(...nn);Xi._rotateAround(Ni,ji)._add(Yt)._add(Ln),Pr._rotateAround(Ni,ji)._add(Yt)._add(Ln),an._rotateAround(Ni,ji)._add(Yt)._add(Ln),Oi._rotateAround(Ni,ji)._add(Yt)._add(Ln)}if(Te){const ji=Math.sin(Te),Ni=Math.cos(Te),Pi=[Ni,-ji,ji,Ni];Xi._matMult(Pi),Pr._matMult(Pi),an._matMult(Pi),Oi._matMult(Pi)}const Nr=new Fe(0,0),Ri=new Fe(0,0);De.push({tl:Xi,tr:Pr,bl:an,br:Oi,tex:Se,writingMode:Y.writingMode,glyphOffset:zi,sectionIndex:Le.sectionIndex,isSDF:et,pixelOffsetTL:Nr,pixelOffsetBR:Ri,minFontScaleX:0,minFontScaleY:0})}return De}(0,r,m,c,d,p,a,n.allowVerticalPlacement),U=n.textSizeData;let X=null;U.kind==="source"?(X=[ia*c.layout.get("text-size").evaluate(p,{})],X[0]>hs&&Ui(`${n.layerIds[0]}: Value for "text-size" is >= ${Qc}. Reduce your "text-size".`)):U.kind==="composite"&&(X=[ia*D.compositeTextSizes[0].evaluate(p,{},L),ia*D.compositeTextSizes[1].evaluate(p,{},L)],(X[0]>hs||X[1]>hs)&&Ui(`${n.layerIds[0]}: Value for "text-size" is >= ${Qc}. Reduce your "text-size".`)),n.addSymbols(n.text,j,X,m,d,p,w,t,y.lineStartIndex,y.lineLength,k,L);for(const ne of M)C[ne]=n.text.placedSymbolArray.length-1;return 4*j.length}function Ag(n){for(const t in n)return n[t];return null}function Kv(n,t,r,a){const c=n.compareText;if(t in c){const d=c[t];for(let p=d.length-1;p>=0;p--)if(a.dist(d[p])<r)return!0}else c[t]=[];return c[t].push(a),!1}const kg=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Dp{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,a]=new Uint8Array(t,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const c=a>>4;if(c!==1)throw new Error(`Got v${c} data when expected v1.`);const d=kg[15&a];if(!d)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(t,2,1),[m]=new Uint32Array(t,4,1);return new Dp(m,p,d,t)}constructor(t,r=64,a=Float64Array,c){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=a,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const d=kg.indexOf(this.ArrayType),p=2*t*this.ArrayType.BYTES_PER_ELEMENT,m=t*this.IndexArrayType.BYTES_PER_ELEMENT,y=(8-m%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${a}.`);c&&c instanceof ArrayBuffer?(this.data=c,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+m+y,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+p+m+y),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+m+y,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){const a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=t,this.coords[this._pos++]=r,a}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Lp(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,a,c){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:p,nodeSize:m}=this,y=[0,d.length-1,0],w=[];for(;y.length;){const M=y.pop()||0,C=y.pop()||0,k=y.pop()||0;if(C-k<=m){for(let U=k;U<=C;U++){const X=p[2*U],ne=p[2*U+1];X>=t&&X<=a&&ne>=r&&ne<=c&&w.push(d[U])}continue}const D=k+C>>1,L=p[2*D],j=p[2*D+1];L>=t&&L<=a&&j>=r&&j<=c&&w.push(d[D]),(M===0?t<=L:r<=j)&&(y.push(k),y.push(D-1),y.push(1-M)),(M===0?a>=L:c>=j)&&(y.push(D+1),y.push(C),y.push(1-M))}return w}within(t,r,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:c,coords:d,nodeSize:p}=this,m=[0,c.length-1,0],y=[],w=a*a;for(;m.length;){const M=m.pop()||0,C=m.pop()||0,k=m.pop()||0;if(C-k<=p){for(let U=k;U<=C;U++)Rg(d[2*U],d[2*U+1],t,r)<=w&&y.push(c[U]);continue}const D=k+C>>1,L=d[2*D],j=d[2*D+1];Rg(L,j,t,r)<=w&&y.push(c[D]),(M===0?t-a<=L:r-a<=j)&&(m.push(k),m.push(D-1),m.push(1-M)),(M===0?t+a>=L:r+a>=j)&&(m.push(D+1),m.push(C),m.push(1-M))}return y}}function Lp(n,t,r,a,c,d){if(c-a<=r)return;const p=a+c>>1;zg(n,t,p,a,c,d),Lp(n,t,r,a,p-1,1-d),Lp(n,t,r,p+1,c,1-d)}function zg(n,t,r,a,c,d){for(;c>a;){if(c-a>600){const w=c-a+1,M=r-a+1,C=Math.log(w),k=.5*Math.exp(2*C/3),D=.5*Math.sqrt(C*k*(w-k)/w)*(M-w/2<0?-1:1);zg(n,t,r,Math.max(a,Math.floor(r-M*k/w+D)),Math.min(c,Math.floor(r+(w-M)*k/w+D)),d)}const p=t[2*r+d];let m=a,y=c;for(iu(n,t,a,r),t[2*c+d]>p&&iu(n,t,a,c);m<y;){for(iu(n,t,m,y),m++,y--;t[2*m+d]<p;)m++;for(;t[2*y+d]>p;)y--}t[2*a+d]===p?iu(n,t,a,y):(y++,iu(n,t,y,c)),y<=r&&(a=y+1),r<=y&&(c=y-1)}}function iu(n,t,r,a){Bp(n,r,a),Bp(t,2*r,2*a),Bp(t,2*r+1,2*a+1)}function Bp(n,t,r){const a=n[t];n[t]=n[r],n[r]=a}function Rg(n,t,r,a){const c=n-r,d=t-a;return c*c+d*d}var Fp;S.co=void 0,(Fp=S.co||(S.co={})).create="create",Fp.load="load",Fp.fullLoad="fullLoad";let Xh=null,ru=[];const Op=1e3/60,jp="loadTime",Np="fullLoadTime",Yv={mark(n){performance.mark(n)},frame(n){const t=n;Xh!=null&&ru.push(t-Xh),Xh=t},clearMetrics(){Xh=null,ru=[],performance.clearMeasures(jp),performance.clearMeasures(Np);for(const n in S.co)performance.clearMarks(S.co[n])},getPerformanceMetrics(){performance.measure(jp,S.co.create,S.co.load),performance.measure(Np,S.co.create,S.co.fullLoad);const n=performance.getEntriesByName(jp)[0].duration,t=performance.getEntriesByName(Np)[0].duration,r=ru.length,a=1/(ru.reduce((d,p)=>d+p,0)/r/1e3),c=ru.filter(d=>d>Op).reduce((d,p)=>d+(p-Op)/Op,0);return{loadTime:n,fullLoadTime:t,fps:a,percentDroppedFrames:c/(r+c)*100,totalFrames:r}}};S.$=eu,S.A=$t,S.B=pn,S.C=Xt,S.D=Ke,S.E=ae,S.F=qd,S.G=function(n){if(hn==null){const t=n.navigator?n.navigator.userAgent:null;hn=!!n.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return hn},S.H=class{constructor(n,t){this.target=n,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Zv(()=>this.process()),this.subscription=Ue(this.target,"message",r=>this.receive(r),!1),this.globalScope=Vr(self)?n:window}registerMessageHandler(n,t){this.messageHandlers[n]=t}sendAsync(n,t){return new Promise((r,a)=>{const c=Math.round(1e18*Math.random()).toString(36).substring(0,10),d=t?Ue(t.signal,"abort",()=>{d==null||d.unsubscribe(),delete this.resolveRejects[c];const y={id:c,type:"<cancel>",origin:location.origin,targetMapId:n.targetMapId,sourceMapId:this.mapId};this.target.postMessage(y)},Vv):null;this.resolveRejects[c]={resolve:y=>{d==null||d.unsubscribe(),r(y)},reject:y=>{d==null||d.unsubscribe(),a(y)}};const p=[],m=Object.assign(Object.assign({},n),{id:c,sourceMapId:this.mapId,origin:location.origin,data:os(n.data,p)});this.target.postMessage(m,{transfer:p})})}receive(n){const t=n.data,r=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[r];const a=this.abortControllers[r];return delete this.abortControllers[r],void(a&&a.abort())}if(Vr(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;const n=this.taskQueue.shift(),t=this.tasks[n];delete this.tasks[n],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(n,t)}processTask(n,t){return o(this,void 0,void 0,function*(){if(t.type==="<response>"){const c=this.resolveRejects[n];return delete this.resolveRejects[n],c?void(t.error?c.reject(Ys(t.error)):c.resolve(Ys(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(n,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=Ys(t.data),a=new AbortController;this.abortControllers[n]=a;try{const c=yield this.messageHandlers[t.type](t.sourceMapId,r,a);this.completeTask(n,null,c)}catch(c){this.completeTask(n,c)}})}completeTask(n,t,r){const a=[];delete this.abortControllers[n];const c={id:n,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?os(t):null,data:os(r,a)};this.target.postMessage(c,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},S.I=bp,S.J=ja,S.K=function(){var n=new $t(16);return $t!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0),n[0]=1,n[5]=1,n[10]=1,n[15]=1,n},S.L=function(n,t,r){var a,c,d,p,m,y,w,M,C,k,D,L,j=r[0],U=r[1],X=r[2];return t===n?(n[12]=t[0]*j+t[4]*U+t[8]*X+t[12],n[13]=t[1]*j+t[5]*U+t[9]*X+t[13],n[14]=t[2]*j+t[6]*U+t[10]*X+t[14],n[15]=t[3]*j+t[7]*U+t[11]*X+t[15]):(c=t[1],d=t[2],p=t[3],m=t[4],y=t[5],w=t[6],M=t[7],C=t[8],k=t[9],D=t[10],L=t[11],n[0]=a=t[0],n[1]=c,n[2]=d,n[3]=p,n[4]=m,n[5]=y,n[6]=w,n[7]=M,n[8]=C,n[9]=k,n[10]=D,n[11]=L,n[12]=a*j+m*U+C*X+t[12],n[13]=c*j+y*U+k*X+t[13],n[14]=d*j+w*U+D*X+t[14],n[15]=p*j+M*U+L*X+t[15]),n},S.M=function(n,t,r){var a=r[0],c=r[1],d=r[2];return n[0]=t[0]*a,n[1]=t[1]*a,n[2]=t[2]*a,n[3]=t[3]*a,n[4]=t[4]*c,n[5]=t[5]*c,n[6]=t[6]*c,n[7]=t[7]*c,n[8]=t[8]*d,n[9]=t[9]*d,n[10]=t[10]*d,n[11]=t[11]*d,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},S.N=function(n,t,r){var a=t[0],c=t[1],d=t[2],p=t[3],m=t[4],y=t[5],w=t[6],M=t[7],C=t[8],k=t[9],D=t[10],L=t[11],j=t[12],U=t[13],X=t[14],ne=t[15],Y=r[0],R=r[1],V=r[2],Q=r[3];return n[0]=Y*a+R*m+V*C+Q*j,n[1]=Y*c+R*y+V*k+Q*U,n[2]=Y*d+R*w+V*D+Q*X,n[3]=Y*p+R*M+V*L+Q*ne,n[4]=(Y=r[4])*a+(R=r[5])*m+(V=r[6])*C+(Q=r[7])*j,n[5]=Y*c+R*y+V*k+Q*U,n[6]=Y*d+R*w+V*D+Q*X,n[7]=Y*p+R*M+V*L+Q*ne,n[8]=(Y=r[8])*a+(R=r[9])*m+(V=r[10])*C+(Q=r[11])*j,n[9]=Y*c+R*y+V*k+Q*U,n[10]=Y*d+R*w+V*D+Q*X,n[11]=Y*p+R*M+V*L+Q*ne,n[12]=(Y=r[12])*a+(R=r[13])*m+(V=r[14])*C+(Q=r[15])*j,n[13]=Y*c+R*y+V*k+Q*U,n[14]=Y*d+R*w+V*D+Q*X,n[15]=Y*p+R*M+V*L+Q*ne,n},S.O=function(n,t){const r={};for(let a=0;a<t.length;a++){const c=t[a];c in n&&(r[c]=n[c])}return r},S.P=Fe,S.Q=ds,S.R=tn,S.S=lg,S.T=Ch,S.U=og,S.V=Ki,S.W=Ft,S.X=Cn,S.Y=rn,S.Z=Et,S._=o,S.a=In,S.a$=function(n,t,r){var a=Math.sin(r),c=Math.cos(r),d=t[4],p=t[5],m=t[6],y=t[7],w=t[8],M=t[9],C=t[10],k=t[11];return t!==n&&(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[4]=d*c+w*a,n[5]=p*c+M*a,n[6]=m*c+C*a,n[7]=y*c+k*a,n[8]=w*c-d*a,n[9]=M*c-p*a,n[10]=C*c-m*a,n[11]=k*c-y*a,n},S.a0=25,S.a1=kp,S.a2=n=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(const a of n){const c=window.document.createElement("source");ce(a)||(t.crossOrigin="Anonymous"),c.src=a,t.appendChild(c)}})},S.a3=we,S.a4=function(){return Sn++},S.a5=W,S.a6=_l,S.a7=Hs,S.a8=so,S.a9=mg,S.aA=function(n,t,r,a,c=!1){if(!r[0]&&!r[1])return[0,0];const d=c?a==="map"?-n.bearingInRadians:0:a==="viewport"?n.bearingInRadians:0;if(d){const p=Math.sin(d),m=Math.cos(d);r=[r[0]*m-r[1]*p,r[0]*p+r[1]*m]}return[c?r[0]:Ar(t,r[0],n.zoom),c?r[1]:Ar(t,r[1],n.zoom)]},S.aC=Mp,S.aD=Rp,S.aE=Tp,S.aF=Dp,S.aG=ii,S.aH=Fh,S.aI=be,S.aJ=Rt,S.aK=zt,S.aL=vr,S.aM=Nt,S.aN=ug,S.aO=function(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n[2]=t[2]*r,n},S.aP=function(n,t,r){return n[0]=t[0]+r[0],n[1]=t[1]+r[1],n[2]=t[2]+r[2],n},S.aQ=function(n){var t=new $t(3);return t[0]=n[0],t[1]=n[1],t[2]=n[2],t},S.aR=function(n,t,r){return n[0]=t[0]*r[0],n[1]=t[1]*r[1],n[2]=t[2]*r[2],n[3]=t[3]*r[3],n},S.aS=function(n,t,r){return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],n},S.aT=function(n,t){var r=t[0],a=t[1],c=t[2],d=r*r+a*a+c*c;return d>0&&(d=1/Math.sqrt(d)),n[0]=t[0]*d,n[1]=t[1]*d,n[2]=t[2]*d,n},S.aU=function(n,t,r){var a=t[0],c=t[1],d=t[2],p=r[0],m=r[1],y=r[2];return n[0]=c*y-d*m,n[1]=d*p-a*y,n[2]=a*m-c*p,n},S.aV=function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]},S.aW=dg,S.aX=yl,S.aY=function(n,t,r,a,c){var d,p=1/Math.tan(t/2);return n[0]=p/r,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=p,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,c!=null&&c!==1/0?(n[10]=(c+a)*(d=1/(a-c)),n[14]=2*c*a*d):(n[10]=-1,n[14]=-2*a),n},S.aZ=function(n){var t=new $t(16);return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},S.a_=function(n,t,r){var a=Math.sin(r),c=Math.cos(r),d=t[0],p=t[1],m=t[2],y=t[3],w=t[4],M=t[5],C=t[6],k=t[7];return t!==n&&(n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=d*c+w*a,n[1]=p*c+M*a,n[2]=m*c+C*a,n[3]=y*c+k*a,n[4]=w*c-d*a,n[5]=M*c-p*a,n[6]=C*c-m*a,n[7]=k*c-y*a,n},S.aa=function(n){const t={};if(n.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,a,c,d)=>{const p=c||d;return t[a]=!p||p.toLowerCase(),""}),t["max-age"]){const r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},S.ab=_t,S.ac=function(n){return Math.pow(2,n)},S.ad=jt,S.ae=Ht,S.af=85.051129,S.ag=cg,S.ah=function(n){return Math.log(n)/Math.LN2},S.ai=function(n){var t=n[0],r=n[1];return t*t+r*r},S.aj=function(n,t){const r=[];for(const a in n)a in t||r.push(a);return r},S.ak=function(n,t){let r=0,a=0;if(n.kind==="constant")a=n.layoutSize;else if(n.kind!=="source"){const{interpolationType:c,minZoom:d,maxZoom:p}=n,m=c?Ht(tr.interpolationFactor(c,t,d,p),0,1):0;n.kind==="camera"?a=pn.number(n.minSize,n.maxSize,m):r=m}return{uSizeT:r,uSize:a}},S.am=function(n,{uSize:t,uSizeT:r},{lowerSize:a,upperSize:c}){return n.kind==="source"?a/ia:n.kind==="composite"?pn.number(a/ia,c/ia,r):t},S.an=function(n,t){var r=t[0],a=t[1],c=t[2],d=t[3],p=t[4],m=t[5],y=t[6],w=t[7],M=t[8],C=t[9],k=t[10],D=t[11],L=t[12],j=t[13],U=t[14],X=t[15],ne=r*m-a*p,Y=r*y-c*p,R=r*w-d*p,V=a*y-c*m,Q=a*w-d*m,fe=c*w-d*y,ke=M*j-C*L,ye=M*U-k*L,Te=M*X-D*L,De=C*U-k*j,ze=C*X-D*j,Le=k*X-D*U,Se=ne*Le-Y*ze+R*De+V*Te-Q*ye+fe*ke;return Se?(n[0]=(m*Le-y*ze+w*De)*(Se=1/Se),n[1]=(c*ze-a*Le-d*De)*Se,n[2]=(j*fe-U*Q+X*V)*Se,n[3]=(k*Q-C*fe-D*V)*Se,n[4]=(y*Te-p*Le-w*ye)*Se,n[5]=(r*Le-c*Te+d*ye)*Se,n[6]=(U*R-L*fe-X*Y)*Se,n[7]=(M*fe-k*R+D*Y)*Se,n[8]=(p*ze-m*Te+w*ke)*Se,n[9]=(a*Te-r*ze-d*ke)*Se,n[10]=(L*Q-j*R+X*ne)*Se,n[11]=(C*R-M*Q-D*ne)*Se,n[12]=(m*ye-p*De-y*ke)*Se,n[13]=(r*De-a*ye+c*ke)*Se,n[14]=(j*Y-L*V-U*ne)*Se,n[15]=(M*V-C*Y+k*ne)*Se,n):null},S.ao=xi,S.ap=function(n){return Math.hypot(n[0],n[1])},S.aq=function(n){return n[0]=0,n[1]=0,n},S.ar=function(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n},S.as=Sp,S.at=ot,S.au=function(n,t,r,a){const c=t.y-n.y,d=t.x-n.x,p=a.y-r.y,m=a.x-r.x,y=p*d-m*c;if(y===0)return null;const w=(m*(n.y-r.y)-p*(n.x-r.x))/y;return new Fe(n.x+w*d,n.y+w*c)},S.av=xg,S.aw=nm,S.ax=function(n){let t=1/0,r=1/0,a=-1/0,c=-1/0;for(const d of n)t=Math.min(t,d.x),r=Math.min(r,d.y),a=Math.max(a,d.x),c=Math.max(c,d.y);return[t,r,a,c]},S.ay=ki,S.az=Ar,S.b=br,S.b$=class extends O{},S.b0=function(){const n=new Float32Array(16);return jt(n),n},S.b1=function(){const n=new Float64Array(16);return jt(n),n},S.b2=function(){return new Float64Array(16)},S.b3=function(n,t,r){const a=new Float64Array(4);return function(c,d,p,m){var y=.5*Math.PI/180;d*=y,p*=y,m*=y;var w=Math.sin(d),M=Math.cos(d),C=Math.sin(p),k=Math.cos(p),D=Math.sin(m),L=Math.cos(m);c[0]=w*k*L-M*C*D,c[1]=M*C*L+w*k*D,c[2]=M*k*D-w*C*L,c[3]=M*k*L+w*C*D}(a,n,t-90,r),a},S.b4=function(n,t,r,a){var c,d,p,m,y,w=t[0],M=t[1],C=t[2],k=t[3],D=r[0],L=r[1],j=r[2],U=r[3];return(d=w*D+M*L+C*j+k*U)<0&&(d=-d,D=-D,L=-L,j=-j,U=-U),1-d>It?(c=Math.acos(d),p=Math.sin(c),m=Math.sin((1-a)*c)/p,y=Math.sin(a*c)/p):(m=1-a,y=a),n[0]=m*w+y*D,n[1]=m*M+y*L,n[2]=m*C+y*j,n[3]=m*k+y*U,n},S.b5=function(n){const t=new Float64Array(9);var r,a,c,d,p,m,y,w,M,C,k,D,L,j,U,X,ne,Y;C=(c=(a=n)[0])*(y=c+c),k=(d=a[1])*y,L=(p=a[2])*y,j=p*(w=d+d),X=(m=a[3])*y,ne=m*w,Y=m*(M=p+p),(r=t)[0]=1-(D=d*w)-(U=p*M),r[3]=k-Y,r[6]=L+ne,r[1]=k+Y,r[4]=1-C-U,r[7]=j-X,r[2]=L-ne,r[5]=j+X,r[8]=1-C-D;const R=Nt(-Math.asin(Ht(t[2],-1,1)));let V,Q;return Math.hypot(t[5],t[8])<.001?(V=0,Q=-Nt(Math.atan2(t[3],t[4]))):(V=Nt(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),Q=Nt(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:V,pitch:R+90,bearing:Q}},S.b6=function(n,t){return n.roll==t.roll&&n.pitch==t.pitch&&n.bearing==t.bearing},S.b7=Mt,S.b8=hl,S.b9=ml,S.bA=function(n){if(n.type==="custom")return new Nv(n);switch(n.type){case"background":return new Fv(n);case"circle":return new zx(n);case"fill":return new Yx(n);case"fill-extrusion":return new av(n);case"heatmap":return new Dx(n);case"hillshade":return new Bx(n);case"line":return new pv(n);case"raster":return new jv(n);case"symbol":return new $h(n)}},S.bB=or,S.bC=function(n,t){if(!n)return[{command:"setStyle",args:[t]}];let r=[];try{if(!de(n.version,t.version))return[{command:"setStyle",args:[t]}];de(n.center,t.center)||r.push({command:"setCenter",args:[t.center]}),de(n.state,t.state)||r.push({command:"setGlobalState",args:[t.state]}),de(n.centerAltitude,t.centerAltitude)||r.push({command:"setCenterAltitude",args:[t.centerAltitude]}),de(n.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),de(n.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),de(n.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),de(n.roll,t.roll)||r.push({command:"setRoll",args:[t.roll]}),de(n.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),de(n.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),de(n.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),de(n.light,t.light)||r.push({command:"setLight",args:[t.light]}),de(n.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),de(n.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),de(n.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});const a={},c=[];(function(p,m,y,w){let M;for(M in m=m||{},p=p||{})Object.prototype.hasOwnProperty.call(p,M)&&(Object.prototype.hasOwnProperty.call(m,M)||Ae(M,y,w));for(M in m)Object.prototype.hasOwnProperty.call(m,M)&&(Object.prototype.hasOwnProperty.call(p,M)?de(p[M],m[M])||(p[M].type==="geojson"&&m[M].type==="geojson"&&Ve(p,m,M)?_e(y,{command:"setGeoJSONSourceData",args:[M,m[M].data]}):Ze(M,m,y,w)):ue(M,m,y))})(n.sources,t.sources,c,a);const d=[];n.layers&&n.layers.forEach(p=>{"source"in p&&a[p.source]?r.push({command:"removeLayer",args:[p.id]}):d.push(p)}),r=r.concat(c),function(p,m,y){m=m||[];const w=(p=p||[]).map(dt),M=m.map(dt),C=p.reduce(st,{}),k=m.reduce(st,{}),D=w.slice(),L=Object.create(null);let j,U,X,ne,Y;for(let R=0,V=0;R<w.length;R++)j=w[R],Object.prototype.hasOwnProperty.call(k,j)?V++:(_e(y,{command:"removeLayer",args:[j]}),D.splice(D.indexOf(j,V),1));for(let R=0,V=0;R<M.length;R++)j=M[M.length-1-R],D[D.length-1-R]!==j&&(Object.prototype.hasOwnProperty.call(C,j)?(_e(y,{command:"removeLayer",args:[j]}),D.splice(D.lastIndexOf(j,D.length-V),1)):V++,ne=D[D.length-R],_e(y,{command:"addLayer",args:[k[j],ne]}),D.splice(D.length-R,0,j),L[j]=!0);for(let R=0;R<M.length;R++)if(j=M[R],U=C[j],X=k[j],!L[j]&&!de(U,X))if(de(U.source,X.source)&&de(U["source-layer"],X["source-layer"])&&de(U.type,X.type)){for(Y in Qe(U.layout,X.layout,y,j,null,"setLayoutProperty"),Qe(U.paint,X.paint,y,j,null,"setPaintProperty"),de(U.filter,X.filter)||_e(y,{command:"setFilter",args:[j,X.filter]}),de(U.minzoom,X.minzoom)&&de(U.maxzoom,X.maxzoom)||_e(y,{command:"setLayerZoomRange",args:[j,X.minzoom,X.maxzoom]}),U)Object.prototype.hasOwnProperty.call(U,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Qe(U[Y],X[Y],y,j,Y.slice(6),"setPaintProperty"):de(U[Y],X[Y])||_e(y,{command:"setLayerProperty",args:[j,Y,X[Y]]}));for(Y in X)Object.prototype.hasOwnProperty.call(X,Y)&&!Object.prototype.hasOwnProperty.call(U,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Qe(U[Y],X[Y],y,j,Y.slice(6),"setPaintProperty"):de(U[Y],X[Y])||_e(y,{command:"setLayerProperty",args:[j,Y,X[Y]]}))}else _e(y,{command:"removeLayer",args:[j]}),ne=D[D.lastIndexOf(j)+1],_e(y,{command:"addLayer",args:[X,ne]})}(d,t.layers,r)}catch(a){console.warn("Unable to compute style diff:",a),r=[{command:"setStyle",args:[t]}]}return r},S.bD=function(n){const t=[],r=n.id;return r===void 0&&t.push({message:`layers.${r}: missing required property "id"`}),n.render===void 0&&t.push({message:`layers.${r}: missing required method "render"`}),n.renderingMode&&n.renderingMode!=="2d"&&n.renderingMode!=="3d"&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},S.bE=function n(t,r){if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let a=0;a<t.length;a++)if(!n(t[a],r[a]))return!1;return!0}if(typeof t=="object"&&t!==null&&r!==null){if(typeof r!="object"||Object.keys(t).length!==Object.keys(r).length)return!1;for(const a in t)if(!n(t[a],r[a]))return!1;return!0}return t===r},S.bF=un,S.bG=ca,S.bH=class extends Kt{constructor(n,t){super(n,t),this.current=0}set(n){this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}},S.bI=zh,S.bJ=class extends Kt{constructor(n,t){super(n,t),this.current=Jd}set(n){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let t=1;t<16;t++)if(n[t]!==this.current[t]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}},S.bK=kh,S.bL=class extends Kt{constructor(n,t){super(n,t),this.current=[0,0,0]}set(n){n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2]))}},S.bM=class extends Kt{constructor(n,t){super(n,t),this.current=[0,0]}set(n){n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1]))}},S.bN=_r,S.bO=function(n,t){var r=Math.sin(t),a=Math.cos(t);return n[0]=a,n[1]=r,n[2]=0,n[3]=-r,n[4]=a,n[5]=0,n[6]=0,n[7]=0,n[8]=1,n},S.bP=function(n,t,r){var a=t[0],c=t[1],d=t[2];return n[0]=a*r[0]+c*r[3]+d*r[6],n[1]=a*r[1]+c*r[4]+d*r[7],n[2]=a*r[2]+c*r[5]+d*r[8],n},S.bQ=function(n,t,r,a,c,d,p){var m=1/(t-r),y=1/(a-c),w=1/(d-p);return n[0]=-2*m,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*y,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*w,n[11]=0,n[12]=(t+r)*m,n[13]=(c+a)*y,n[14]=(p+d)*w,n[15]=1,n},S.bR=class extends Kt{constructor(n,t){super(n,t),this.current=new Array}set(n){if(n!=this.current){this.current=n;const t=new Float32Array(4*n.length);for(let r=0;r<n.length;r++)t[4*r]=n[r].r,t[4*r+1]=n[r].g,t[4*r+2]=n[r].b,t[4*r+3]=n[r].a;this.gl.uniform4fv(this.location,t)}}},S.bS=class extends Kt{constructor(n,t){super(n,t),this.current=new Array}set(n){if(n!=this.current){this.current=n;const t=new Float32Array(n);this.gl.uniform1fv(this.location,t)}}},S.bT=class extends h{},S.bU=_v,S.bV=class extends _{},S.bW=ap,S.bX=function(n){return n<=1?1:Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))},S.bY=fm,S.bZ=function(n,t,r){var a=t[0],c=t[1],d=t[2],p=r[3]*a+r[7]*c+r[11]*d+r[15];return n[0]=(r[0]*a+r[4]*c+r[8]*d+r[12])/(p=p||1),n[1]=(r[1]*a+r[5]*c+r[9]*d+r[13])/p,n[2]=(r[2]*a+r[6]*c+r[10]*d+r[14])/p,n},S.b_=class extends Sa{},S.ba=qc,S.bb=fl,S.bc=cn,S.bd=kr,S.be=Sr,S.bf=function(n,t,r,a,c){return cn(a,c,Ht((n-t)/(r-t),0,1))},S.bg=sr,S.bh=function(){return new Float64Array(3)},S.bi=function(n,t,r,a){return n[0]=t[0]+r[0]*a,n[1]=t[1]+r[1]*a,n[2]=t[2]+r[2]*a,n},S.bj=Ji,S.bk=function(){return new Float64Array(4)},S.bl=function(n,t,r,a){var c=[],d=[];return c[0]=t[0]-r[0],c[1]=t[1]-r[1],c[2]=t[2]-r[2],d[0]=c[0]*Math.cos(a)-c[1]*Math.sin(a),d[1]=c[0]*Math.sin(a)+c[1]*Math.cos(a),d[2]=c[2],n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},S.bm=function(n,t,r,a){var c=[],d=[];return c[0]=t[0]-r[0],c[1]=t[1]-r[1],c[2]=t[2]-r[2],d[0]=c[0],d[1]=c[1]*Math.cos(a)-c[2]*Math.sin(a),d[2]=c[1]*Math.sin(a)+c[2]*Math.cos(a),n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},S.bn=function(n,t,r,a){var c=[],d=[];return c[0]=t[0]-r[0],c[1]=t[1]-r[1],c[2]=t[2]-r[2],d[0]=c[2]*Math.sin(a)+c[0]*Math.cos(a),d[1]=c[1],d[2]=c[2]*Math.cos(a)-c[0]*Math.sin(a),n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},S.bo=Mn,S.bp=function(n,t,r){var a=Math.sin(r),c=Math.cos(r),d=t[0],p=t[1],m=t[2],y=t[3],w=t[8],M=t[9],C=t[10],k=t[11];return t!==n&&(n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=d*c-w*a,n[1]=p*c-M*a,n[2]=m*c-C*a,n[3]=y*c-k*a,n[8]=d*a+w*c,n[9]=p*a+M*c,n[10]=m*a+C*c,n[11]=y*a+k*c,n},S.bq=function(n,t){const r=sr(n,360),a=sr(t,360),c=a-r,d=a>r?c-360:c+360;return Math.abs(c)<Math.abs(d)?c:d},S.br=function(n){return n[0]=0,n[1]=0,n[2]=0,n},S.bs=function(n,t,r,a){const c=Math.sqrt(n*n+t*t),d=Math.sqrt(r*r+a*a);n/=c,t/=c,r/=d,a/=d;const p=Math.acos(n*r+t*a);return-t*r+n*a>0?p:-p},S.bt=function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]},S.bu=Ep,S.bv=function(n,t){const r=sr(n,2*Math.PI),a=sr(t,2*Math.PI);return Math.min(Math.abs(r-a),Math.abs(r-a+2*Math.PI),Math.abs(r-a-2*Math.PI))},S.bw=function(){const n={},t=$.$version;for(const r in $.$root){const a=$.$root[r];if(a.required){let c=null;c=r==="version"?t:a.type==="array"?[]:{},c!=null&&(n[r]=c)}}return n},S.bx=Ic,S.by=wr,S.bz=function(n){n=n.slice();const t=Object.create(null);for(let r=0;r<n.length;r++)t[n[r].id]=n[r];for(let r=0;r<n.length;r++)"ref"in n[r]&&(n[r]=oe(n[r],t[n[r].ref]));return n},S.c=Rr,S.c0=function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]&&n[3]===t[3]&&n[4]===t[4]&&n[5]===t[5]&&n[6]===t[6]&&n[7]===t[7]&&n[8]===t[8]&&n[9]===t[9]&&n[10]===t[10]&&n[11]===t[11]&&n[12]===t[12]&&n[13]===t[13]&&n[14]===t[14]&&n[15]===t[15]},S.c1=function(n,t){var r=n[0],a=n[1],c=n[2],d=n[3],p=n[4],m=n[5],y=n[6],w=n[7],M=n[8],C=n[9],k=n[10],D=n[11],L=n[12],j=n[13],U=n[14],X=n[15],ne=t[0],Y=t[1],R=t[2],V=t[3],Q=t[4],fe=t[5],ke=t[6],ye=t[7],Te=t[8],De=t[9],ze=t[10],Le=t[11],Se=t[12],Ge=t[13],et=t[14],Je=t[15];return Math.abs(r-ne)<=It*Math.max(1,Math.abs(r),Math.abs(ne))&&Math.abs(a-Y)<=It*Math.max(1,Math.abs(a),Math.abs(Y))&&Math.abs(c-R)<=It*Math.max(1,Math.abs(c),Math.abs(R))&&Math.abs(d-V)<=It*Math.max(1,Math.abs(d),Math.abs(V))&&Math.abs(p-Q)<=It*Math.max(1,Math.abs(p),Math.abs(Q))&&Math.abs(m-fe)<=It*Math.max(1,Math.abs(m),Math.abs(fe))&&Math.abs(y-ke)<=It*Math.max(1,Math.abs(y),Math.abs(ke))&&Math.abs(w-ye)<=It*Math.max(1,Math.abs(w),Math.abs(ye))&&Math.abs(M-Te)<=It*Math.max(1,Math.abs(M),Math.abs(Te))&&Math.abs(C-De)<=It*Math.max(1,Math.abs(C),Math.abs(De))&&Math.abs(k-ze)<=It*Math.max(1,Math.abs(k),Math.abs(ze))&&Math.abs(D-Le)<=It*Math.max(1,Math.abs(D),Math.abs(Le))&&Math.abs(L-Se)<=It*Math.max(1,Math.abs(L),Math.abs(Se))&&Math.abs(j-Ge)<=It*Math.max(1,Math.abs(j),Math.abs(Ge))&&Math.abs(U-et)<=It*Math.max(1,Math.abs(U),Math.abs(et))&&Math.abs(X-Je)<=It*Math.max(1,Math.abs(X),Math.abs(Je))},S.c2=function(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},S.c3=n=>n.type==="symbol",S.c4=n=>n.type==="circle",S.c5=n=>n.type==="heatmap",S.c6=n=>n.type==="line",S.c7=n=>n.type==="fill",S.c8=n=>n.type==="fill-extrusion",S.c9=n=>n.type==="hillshade",S.cA=up,S.cB=mp,S.cC=Wc,S.cD=xp,S.cE=class{constructor(n){this._marks={start:[n.url,"start"].join("#"),end:[n.url,"end"].join("#"),measure:n.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let n=performance.getEntriesByName(this._marks.measure);return n.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),n=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),n}},S.cF=function(n,t,r,a,c){return o(this,void 0,void 0,function*(){if(Ft())try{return yield Cn(n,t,r,a,c)}catch{}return function(d,p,m,y,w){const M=d.width,C=d.height;Ce&&Ye||(Ce=new OffscreenCanvas(M,C),Ye=Ce.getContext("2d",{willReadFrequently:!0})),Ce.width=M,Ce.height=C,Ye.drawImage(d,0,0,M,C);const k=Ye.getImageData(p,m,y,w);return Ye.clearRect(0,0,M,C),k.data}(n,t,r,a,c)})},S.cG=pg,S.cH=he,S.cI=Be,S.cJ=km,S.cK=Um,S.cL=Ko,S.cM=zn,S.ca=n=>n.type==="raster",S.cb=n=>n.type==="background",S.cc=n=>n.type==="custom",S.cd=la,S.ce=function(n,t,r){const a=yr(t.x-r.x,t.y-r.y),c=yr(n.x-r.x,n.y-r.y);var d,p;return Nt(Math.atan2(a[0]*c[1]-a[1]*c[0],(d=a)[0]*(p=c)[0]+d[1]*p[1]))},S.cf=xr,S.cg=function(n,t){return mi[t]&&(n instanceof MouseEvent||n instanceof WheelEvent)},S.ch=function(n,t){return cr[t]&&"touches"in n},S.ci=function(n){return cr[n]||mi[n]},S.cj=function(n,t,r){var a=t[0],c=t[1];return n[0]=r[0]*a+r[4]*c+r[12],n[1]=r[1]*a+r[5]*c+r[13],n},S.ck=function(n,t){const{x:r,y:a}=eu.fromLngLat(t);return!(n<0||n>25||a<0||a>=1||r<0||r>=1)},S.cl=function(n,t){return n[0]=t[0],n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=t[1],n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=t[2],n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n},S.cm=class extends io{},S.cn=Yv,S.cp=function(n){return n.message===zr},S.cq=Ur,S.cr=function(n,t){In.REGISTERED_PROTOCOLS[n]=t},S.cs=function(n){delete In.REGISTERED_PROTOCOLS[n]},S.ct=function(n,t){const r={};for(let c=0;c<n.length;c++){const d=t&&t[n[c].id]||gh(n[c]);t&&(t[n[c].id]=d);let p=r[d];p||(p=r[d]=[]),p.push(n[c])}const a=[];for(const c in r)a.push(r[c]);return a},S.cu=$e,S.cv=fg,S.cw=gg,S.cx=Gm,S.cy=function(n){n.bucket.createArrays(),n.bucket.tilePixelRatio=Et/(512*n.bucket.overscaling),n.bucket.compareText={},n.bucket.iconsNeedLinear=!1;const t=n.bucket.layers[0],r=t.layout,a=t._unevaluatedLayout._values,c={layoutIconSize:a["icon-size"].possiblyEvaluate(new Xt(n.bucket.zoom+1),n.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new Xt(n.bucket.zoom+1),n.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new Xt(18))};if(n.bucket.textSizeData.kind==="composite"){const{minZoom:w,maxZoom:M}=n.bucket.textSizeData;c.compositeTextSizes=[a["text-size"].possiblyEvaluate(new Xt(w),n.canonical),a["text-size"].possiblyEvaluate(new Xt(M),n.canonical)]}if(n.bucket.iconSizeData.kind==="composite"){const{minZoom:w,maxZoom:M}=n.bucket.iconSizeData;c.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new Xt(w),n.canonical),a["icon-size"].possiblyEvaluate(new Xt(M),n.canonical)]}const d=r.get("text-line-height")*ki,p=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",m=r.get("text-keep-upright"),y=r.get("text-size");for(const w of n.bucket.features){const M=r.get("text-font").evaluate(w,{},n.canonical).join(","),C=y.evaluate(w,{},n.canonical),k=c.layoutTextSize.evaluate(w,{},n.canonical),D=c.layoutIconSize.evaluate(w,{},n.canonical),L={horizontal:{},vertical:void 0},j=w.text;let U,X=[0,0];if(j){const R=j.toString(),V=r.get("text-letter-spacing").evaluate(w,{},n.canonical)*ki,Q=Hd(R)?V:0,fe=r.get("text-anchor").evaluate(w,{},n.canonical),ke=Ig(t,w,n.canonical);if(!ke){const ze=r.get("text-radial-offset").evaluate(w,{},n.canonical);X=ze?Cg(fe,[ze*ki,zp]):r.get("text-offset").evaluate(w,{},n.canonical).map(Le=>Le*ki)}let ye=p?"center":r.get("text-justify").evaluate(w,{},n.canonical);const Te=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(w,{},n.canonical)*ki:1/0,De=()=>{n.bucket.allowVerticalPlacement&&ol(R)&&(L.vertical=Zh(j,n.glyphMap,n.glyphPositions,n.imagePositions,M,Te,d,fe,"left",Q,X,S.al.vertical,!0,k,C))};if(!p&&ke){const ze=new Set;if(ye==="auto")for(let Se=0;Se<ke.values.length;Se+=2)ze.add(Rp(ke.values[Se]));else ze.add(ye);let Le=!1;for(const Se of ze)if(!L.horizontal[Se])if(Le)L.horizontal[Se]=L.horizontal[0];else{const Ge=Zh(j,n.glyphMap,n.glyphPositions,n.imagePositions,M,Te,d,"center",Se,Q,X,S.al.horizontal,!1,k,C);Ge&&(L.horizontal[Se]=Ge,Le=Ge.positionedLines.length===1)}De()}else{ye==="auto"&&(ye=Rp(fe));const ze=Zh(j,n.glyphMap,n.glyphPositions,n.imagePositions,M,Te,d,fe,ye,Q,X,S.al.horizontal,!1,k,C);ze&&(L.horizontal[ye]=ze),De(),ol(R)&&p&&m&&(L.vertical=Zh(j,n.glyphMap,n.glyphPositions,n.imagePositions,M,Te,d,fe,ye,Q,X,S.al.vertical,!1,k,C))}}let ne=!1;if(w.icon&&w.icon.name){const R=n.imageMap[w.icon.name];R&&(U=zv(n.imagePositions[w.icon.name],r.get("icon-offset").evaluate(w,{},n.canonical),r.get("icon-anchor").evaluate(w,{},n.canonical)),ne=!!R.sdf,n.bucket.sdfIcons===void 0?n.bucket.sdfIcons=ne:n.bucket.sdfIcons!==ne&&Ui("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(R.pixelRatio!==n.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(n.bucket.iconsNeedLinear=!0))}const Y=Ag(L.horizontal)||L.vertical;n.bucket.iconsInText=!!Y&&Y.iconsInText,(Y||U)&&Xv(n.bucket,w,L,U,n.imageMap,c,k,D,X,ne,n.canonical,n.subdivisionGranularity)}n.showCollisionBoxes&&n.bucket.generateCollisionDebugBuffers()},S.cz=gp,S.d=ce,S.e=Qi,S.f=n=>o(void 0,void 0,void 0,function*(){if(n.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(n)],{type:"image/png"});try{return createImageBitmap(t)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),S.g=qn,S.h=n=>new Promise((t,r)=>{const a=new Image;a.onload=()=>{t(a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame(()=>{a.src=Pn})},a.onerror=()=>r(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 c=new Blob([new Uint8Array(n)],{type:"image/png"});a.src=n.byteLength?URL.createObjectURL(c):Pn}),S.i=Vr,S.j=(n,t)=>dn(Qi(n,{type:"json"}),t),S.k=J,S.l=G,S.m=dn,S.n=(n,t)=>dn(Qi(n,{type:"arrayBuffer"}),t),S.o=function(n){return new xp(n).readFields(vv,[])},S.p=$m,S.q=Zc,S.r=Ti,S.s=Ue,S.t=rl,S.u=vt,S.v=$,S.w=Ui,S.x=Cc,S.y=as,S.z=function([n,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:n*Math.cos(t)*Math.sin(r),y:n*Math.sin(t)*Math.sin(r),z:n*Math.cos(r)}}}),z("worker",["./shared"],function(S){class o{constructor(N){this.keyCache={},N&&this.replace(N)}replace(N){this._layerConfigs={},this._layers={},this.update(N,[])}update(N,Z){for(const J of N){this._layerConfigs[J.id]=J;const ae=this._layers[J.id]=S.bA(J);ae._featureFilter=S.a7(ae.filter),this.keyCache[J.id]&&delete this.keyCache[J.id]}for(const J of Z)delete this.keyCache[J],delete this._layerConfigs[J],delete this._layers[J];this.familiesBySource={};const G=S.ct(Object.values(this._layerConfigs),this.keyCache);for(const J of G){const ae=J.map(ue=>this._layers[ue.id]),$=ae[0];if($.visibility==="none")continue;const ge=$.source||"";let oe=this.familiesBySource[ge];oe||(oe=this.familiesBySource[ge]={});const de=$.sourceLayer||"_geojsonTileLayer";let _e=oe[de];_e||(_e=oe[de]=[]),_e.push(ae)}}}class he{constructor(N){const Z={},G=[];for(const ge in N){const oe=N[ge],de=Z[ge]={};for(const _e in oe){const ue=oe[+_e];if(!ue||ue.bitmap.width===0||ue.bitmap.height===0)continue;const Ae={x:0,y:0,w:ue.bitmap.width+2,h:ue.bitmap.height+2};G.push(Ae),de[_e]={rect:Ae,metrics:ue.metrics}}}const{w:J,h:ae}=S.p(G),$=new S.q({width:J||1,height:ae||1});for(const ge in N){const oe=N[ge];for(const de in oe){const _e=oe[+de];if(!_e||_e.bitmap.width===0||_e.bitmap.height===0)continue;const ue=Z[ge][de].rect;S.q.copy(_e.bitmap,$,{x:0,y:0},{x:ue.x+1,y:ue.y+1},_e.bitmap)}}this.image=$,this.positions=Z}}S.cu("GlyphAtlas",he);class me{constructor(N){this.tileID=new S.Y(N.tileID.overscaledZ,N.tileID.wrap,N.tileID.canonical.z,N.tileID.canonical.x,N.tileID.canonical.y),this.uid=N.uid,this.zoom=N.zoom,this.pixelRatio=N.pixelRatio,this.tileSize=N.tileSize,this.source=N.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=N.showCollisionBoxes,this.collectResourceTiming=!!N.collectResourceTiming,this.returnDependencies=!!N.returnDependencies,this.promoteId=N.promoteId,this.inFlightDependencies=[]}parse(N,Z,G,J,ae){return S._(this,void 0,void 0,function*(){this.status="parsing",this.data=N,this.collisionBoxArray=new S.a5;const $=new S.cv(Object.keys(N.layers).sort()),ge=new S.cw(this.tileID,this.promoteId);ge.bucketLayerIDs=[];const oe={},de={featureIndex:ge,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:G,subdivisionGranularity:ae},_e=Z.familiesBySource[this.source];for(const at in _e){const Ie=N.layers[at];if(!Ie)continue;Ie.version===1&&S.w(`Vector tile source "${this.source}" layer "${at}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const it=$.encode(at),pt=[];for(let oi=0;oi<Ie.length;oi++){const li=Ie.feature(oi),Tr=ge.getId(li,at);pt.push({feature:li,id:Tr,index:oi,sourceLayerIndex:it})}for(const oi of _e[at]){const li=oi[0];li.source!==this.source&&S.w(`layer.source = ${li.source} does not equal this.source = ${this.source}`),li.minzoom&&this.zoom<Math.floor(li.minzoom)||li.maxzoom&&this.zoom>=li.maxzoom||li.visibility!=="none"&&(Pe(oi,this.zoom,G),(oe[li.id]=li.createBucket({index:ge.bucketLayerIDs.length,layers:oi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:it,sourceID:this.source})).populate(pt,de,this.tileID.canonical),ge.bucketLayerIDs.push(oi.map(Tr=>Tr.id)))}}const ue=S.bF(de.glyphDependencies,at=>Object.keys(at).map(Number));this.inFlightDependencies.forEach(at=>at==null?void 0:at.abort()),this.inFlightDependencies=[];let Ae=Promise.resolve({});if(Object.keys(ue).length){const at=new AbortController;this.inFlightDependencies.push(at),Ae=J.sendAsync({type:"GG",data:{stacks:ue,source:this.source,tileID:this.tileID,type:"glyphs"}},at)}const Ze=Object.keys(de.iconDependencies);let Ve=Promise.resolve({});if(Ze.length){const at=new AbortController;this.inFlightDependencies.push(at),Ve=J.sendAsync({type:"GI",data:{icons:Ze,source:this.source,tileID:this.tileID,type:"icons"}},at)}const Qe=Object.keys(de.patternDependencies);let dt=Promise.resolve({});if(Qe.length){const at=new AbortController;this.inFlightDependencies.push(at),dt=J.sendAsync({type:"GI",data:{icons:Qe,source:this.source,tileID:this.tileID,type:"patterns"}},at)}const[st,we,Lt]=yield Promise.all([Ae,Ve,dt]),Tt=new he(st),kt=new S.cx(we,Lt);for(const at in oe){const Ie=oe[at];Ie instanceof S.a6?(Pe(Ie.layers,this.zoom,G),S.cy({bucket:Ie,glyphMap:st,glyphPositions:Tt.positions,imageMap:we,imagePositions:kt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:de.subdivisionGranularity})):Ie.hasPattern&&(Ie instanceof S.cz||Ie instanceof S.cA||Ie instanceof S.cB)&&(Pe(Ie.layers,this.zoom,G),Ie.addFeatures(de,this.tileID.canonical,kt.patternPositions))}return this.status="done",{buckets:Object.values(oe).filter(at=>!at.isEmpty()),featureIndex:ge,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Tt.image,imageAtlas:kt,glyphMap:this.returnDependencies?st:null,iconMap:this.returnDependencies?we:null,glyphPositions:this.returnDependencies?Tt.positions:null}})}}function Pe(ce,N,Z){const G=new S.C(N);for(const J of ce)J.recalculate(G,Z)}class Be{constructor(N,Z,G){this.actor=N,this.layerIndex=Z,this.availableImages=G,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(N,Z){return S._(this,void 0,void 0,function*(){const G=yield S.n(N.request,Z);try{return{vectorTile:new S.cC.VectorTile(new S.cD(G.data)),rawData:G.data,cacheControl:G.cacheControl,expires:G.expires}}catch(J){const ae=new Uint8Array(G.data);let $=`Unable to parse the tile at ${N.request.url}, `;throw $+=ae[0]===31&&ae[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${J.message}`,new Error($)}})}loadTile(N){return S._(this,void 0,void 0,function*(){const Z=N.uid,G=!!(N&&N.request&&N.request.collectResourceTiming)&&new S.cE(N.request),J=new me(N);this.loading[Z]=J;const ae=new AbortController;J.abort=ae;try{const $=yield this.loadVectorTile(N,ae);if(delete this.loading[Z],!$)return null;const ge=$.rawData,oe={};$.expires&&(oe.expires=$.expires),$.cacheControl&&(oe.cacheControl=$.cacheControl);const de={};if(G){const ue=G.finish();ue&&(de.resourceTiming=JSON.parse(JSON.stringify(ue)))}J.vectorTile=$.vectorTile;const _e=J.parse($.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);this.loaded[Z]=J,this.fetching[Z]={rawTileData:ge,cacheControl:oe,resourceTiming:de};try{const ue=yield _e;return S.e({rawTileData:ge.slice(0)},ue,oe,de)}finally{delete this.fetching[Z]}}catch($){throw delete this.loading[Z],J.status="done",this.loaded[Z]=J,$}})}reloadTile(N){return S._(this,void 0,void 0,function*(){const Z=N.uid;if(!this.loaded||!this.loaded[Z])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const G=this.loaded[Z];if(G.showCollisionBoxes=N.showCollisionBoxes,G.status==="parsing"){const J=yield G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);let ae;if(this.fetching[Z]){const{rawTileData:$,cacheControl:ge,resourceTiming:oe}=this.fetching[Z];delete this.fetching[Z],ae=S.e({rawTileData:$.slice(0)},J,ge,oe)}else ae=J;return ae}if(G.status==="done"&&G.vectorTile)return G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity)})}abortTile(N){return S._(this,void 0,void 0,function*(){const Z=this.loading,G=N.uid;Z&&Z[G]&&Z[G].abort&&(Z[G].abort.abort(),delete Z[G])})}removeTile(N){return S._(this,void 0,void 0,function*(){this.loaded&&this.loaded[N.uid]&&delete this.loaded[N.uid]})}}class Ee{constructor(){this.loaded={}}loadTile(N){return S._(this,void 0,void 0,function*(){const{uid:Z,encoding:G,rawImageData:J,redFactor:ae,greenFactor:$,blueFactor:ge,baseShift:oe}=N,de=J.width+2,_e=J.height+2,ue=S.b(J)?new S.R({width:de,height:_e},yield S.cF(J,-1,-1,de,_e)):J,Ae=new S.cG(Z,ue,G,ae,$,ge,oe);return this.loaded=this.loaded||{},this.loaded[Z]=Ae,Ae})}removeTile(N){const Z=this.loaded,G=N.uid;Z&&Z[G]&&delete Z[G]}}var le,Fe,Bt=function(){if(Fe)return le;function ce(Z,G){if(Z.length!==0){N(Z[0],G);for(var J=1;J<Z.length;J++)N(Z[J],!G)}}function N(Z,G){for(var J=0,ae=0,$=0,ge=Z.length,oe=ge-1;$<ge;oe=$++){var de=(Z[$][0]-Z[oe][0])*(Z[oe][1]+Z[$][1]),_e=J+de;ae+=Math.abs(J)>=Math.abs(de)?J-_e+de:de-_e+J,J=_e}J+ae>=0!=!!G&&Z.reverse()}return Fe=1,le=function Z(G,J){var ae,$=G&&G.type;if($==="FeatureCollection")for(ae=0;ae<G.features.length;ae++)Z(G.features[ae],J);else if($==="GeometryCollection")for(ae=0;ae<G.geometries.length;ae++)Z(G.geometries[ae],J);else if($==="Feature")Z(G.geometry,J);else if($==="Polygon")ce(G.coordinates,J);else if($==="MultiPolygon")for(ae=0;ae<G.coordinates.length;ae++)ce(G.coordinates[ae],J);return G}}(),fi=S.cH(Bt);const ti=S.cC.VectorTileFeature.prototype.toGeoJSON;class yi{constructor(N){this._feature=N,this.extent=S.Z,this.type=N.type,this.properties=N.tags,"id"in N&&!isNaN(N.id)&&(this.id=parseInt(N.id,10))}loadGeometry(){if(this._feature.type===1){const N=[];for(const Z of this._feature.geometry)N.push([new S.P(Z[0],Z[1])]);return N}{const N=[];for(const Z of this._feature.geometry){const G=[];for(const J of Z)G.push(new S.P(J[0],J[1]));N.push(G)}return N}}toGeoJSON(N,Z,G){return ti.call(this,N,Z,G)}}class Ki{constructor(N){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=S.Z,this.length=N.length,this._features=N}feature(N){return new yi(this._features[N])}}var Ft,It,$t,_r={exports:{}},jt=function(){if($t)return _r.exports;$t=1;var ce=S.cK(),N=function(){if(It)return Ft;It=1;var _e=S.cI(),ue=S.cJ().VectorTileFeature;function Ae(Ve,Qe){this.options=Qe||{},this.features=Ve,this.length=Ve.length}function Ze(Ve,Qe){this.id=typeof Ve.id=="number"?Ve.id:void 0,this.type=Ve.type,this.rawGeometry=Ve.type===1?[Ve.geometry]:Ve.geometry,this.properties=Ve.tags,this.extent=Qe||4096}return Ft=Ae,Ae.prototype.feature=function(Ve){return new Ze(this.features[Ve],this.options.extent)},Ze.prototype.loadGeometry=function(){var Ve=this.rawGeometry;this.geometry=[];for(var Qe=0;Qe<Ve.length;Qe++){for(var dt=Ve[Qe],st=[],we=0;we<dt.length;we++)st.push(new _e(dt[we][0],dt[we][1]));this.geometry.push(st)}return this.geometry},Ze.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Ve=this.geometry,Qe=1/0,dt=-1/0,st=1/0,we=-1/0,Lt=0;Lt<Ve.length;Lt++)for(var Tt=Ve[Lt],kt=0;kt<Tt.length;kt++){var at=Tt[kt];Qe=Math.min(Qe,at.x),dt=Math.max(dt,at.x),st=Math.min(st,at.y),we=Math.max(we,at.y)}return[Qe,st,dt,we]},Ze.prototype.toGeoJSON=ue.prototype.toGeoJSON,Ft}();function Z(_e){var ue=new ce;return function(Ae,Ze){for(var Ve in Ae.layers)Ze.writeMessage(3,G,Ae.layers[Ve])}(_e,ue),ue.finish()}function G(_e,ue){var Ae;ue.writeVarintField(15,_e.version||1),ue.writeStringField(1,_e.name||""),ue.writeVarintField(5,_e.extent||4096);var Ze={keys:[],values:[],keycache:{},valuecache:{}};for(Ae=0;Ae<_e.length;Ae++)Ze.feature=_e.feature(Ae),ue.writeMessage(2,J,Ze);var Ve=Ze.keys;for(Ae=0;Ae<Ve.length;Ae++)ue.writeStringField(3,Ve[Ae]);var Qe=Ze.values;for(Ae=0;Ae<Qe.length;Ae++)ue.writeMessage(4,de,Qe[Ae])}function J(_e,ue){var Ae=_e.feature;Ae.id!==void 0&&ue.writeVarintField(1,Ae.id),ue.writeMessage(2,ae,_e),ue.writeVarintField(3,Ae.type),ue.writeMessage(4,oe,Ae)}function ae(_e,ue){var Ae=_e.feature,Ze=_e.keys,Ve=_e.values,Qe=_e.keycache,dt=_e.valuecache;for(var st in Ae.properties){var we=Ae.properties[st],Lt=Qe[st];if(we!==null){Lt===void 0&&(Ze.push(st),Qe[st]=Lt=Ze.length-1),ue.writeVarint(Lt);var Tt=typeof we;Tt!=="string"&&Tt!=="boolean"&&Tt!=="number"&&(we=JSON.stringify(we));var kt=Tt+":"+we,at=dt[kt];at===void 0&&(Ve.push(we),dt[kt]=at=Ve.length-1),ue.writeVarint(at)}}}function $(_e,ue){return(ue<<3)+(7&_e)}function ge(_e){return _e<<1^_e>>31}function oe(_e,ue){for(var Ae=_e.loadGeometry(),Ze=_e.type,Ve=0,Qe=0,dt=Ae.length,st=0;st<dt;st++){var we=Ae[st],Lt=1;Ze===1&&(Lt=we.length),ue.writeVarint($(1,Lt));for(var Tt=Ze===3?we.length-1:we.length,kt=0;kt<Tt;kt++){kt===1&&Ze!==1&&ue.writeVarint($(2,Tt-1));var at=we[kt].x-Ve,Ie=we[kt].y-Qe;ue.writeVarint(ge(at)),ue.writeVarint(ge(Ie)),Ve+=at,Qe+=Ie}Ze===3&&ue.writeVarint($(7,1))}}function de(_e,ue){var Ae=typeof _e;Ae==="string"?ue.writeStringField(1,_e):Ae==="boolean"?ue.writeBooleanField(7,_e):Ae==="number"&&(_e%1!=0?ue.writeDoubleField(3,_e):_e<0?ue.writeSVarintField(6,_e):ue.writeVarintField(5,_e))}return _r.exports=Z,_r.exports.fromVectorTileJs=Z,_r.exports.fromGeojsonVt=function(_e,ue){ue=ue||{};var Ae={};for(var Ze in _e)Ae[Ze]=new N(_e[Ze].features,ue),Ae[Ze].name=Ze,Ae[Ze].version=ue.version,Ae[Ze].extent=ue.extent;return Z({layers:Ae})},_r.exports.GeoJSONWrapper=N,_r.exports}(),Tn=S.cH(jt);const Mn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ce=>ce},Yi=Math.fround||(ar=new Float32Array(1),ce=>(ar[0]=+ce,ar[0]));var ar;const Ji=3,ot=5,Vi=6;class xi{constructor(N){this.options=Object.assign(Object.create(Mn),N),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(N){const{log:Z,minZoom:G,maxZoom:J}=this.options;Z&&console.time("total time");const ae=`prepare ${N.length} points`;Z&&console.time(ae),this.points=N;const $=[];for(let oe=0;oe<N.length;oe++){const de=N[oe];if(!de.geometry)continue;const[_e,ue]=de.geometry.coordinates,Ae=Yi(Ar(_e)),Ze=Yi(sr(ue));$.push(Ae,Ze,1/0,oe,-1,1),this.options.reduce&&$.push(0)}let ge=this.trees[J+1]=this._createTree($);Z&&console.timeEnd(ae);for(let oe=J;oe>=G;oe--){const de=+Date.now();ge=this.trees[oe]=this._createTree(this._cluster(ge,oe)),Z&&console.log("z%d: %d clusters in %dms",oe,ge.numItems,+Date.now()-de)}return Z&&console.timeEnd("total time"),this}getClusters(N,Z){let G=((N[0]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,N[1]));let ae=N[2]===180?180:((N[2]+180)%360+360)%360-180;const $=Math.max(-90,Math.min(90,N[3]));if(N[2]-N[0]>=360)G=-180,ae=180;else if(G>ae){const ue=this.getClusters([G,J,180,$],Z),Ae=this.getClusters([-180,J,ae,$],Z);return ue.concat(Ae)}const ge=this.trees[this._limitZoom(Z)],oe=ge.range(Ar(G),sr($),Ar(ae),sr(J)),de=ge.data,_e=[];for(const ue of oe){const Ae=this.stride*ue;_e.push(de[Ae+ot]>1?yr(de,Ae,this.clusterProps):this.points[de[Ae+Ji]])}return _e}getChildren(N){const Z=this._getOriginId(N),G=this._getOriginZoom(N),J="No cluster with the specified id.",ae=this.trees[G];if(!ae)throw new Error(J);const $=ae.data;if(Z*this.stride>=$.length)throw new Error(J);const ge=this.options.radius/(this.options.extent*Math.pow(2,G-1)),oe=ae.within($[Z*this.stride],$[Z*this.stride+1],ge),de=[];for(const _e of oe){const ue=_e*this.stride;$[ue+4]===N&&de.push($[ue+ot]>1?yr($,ue,this.clusterProps):this.points[$[ue+Ji]])}if(de.length===0)throw new Error(J);return de}getLeaves(N,Z,G){const J=[];return this._appendLeaves(J,N,Z=Z||10,G=G||0,0),J}getTile(N,Z,G){const J=this.trees[this._limitZoom(N)],ae=Math.pow(2,N),{extent:$,radius:ge}=this.options,oe=ge/$,de=(G-oe)/ae,_e=(G+1+oe)/ae,ue={features:[]};return this._addTileFeatures(J.range((Z-oe)/ae,de,(Z+1+oe)/ae,_e),J.data,Z,G,ae,ue),Z===0&&this._addTileFeatures(J.range(1-oe/ae,de,1,_e),J.data,ae,G,ae,ue),Z===ae-1&&this._addTileFeatures(J.range(0,de,oe/ae,_e),J.data,-1,G,ae,ue),ue.features.length?ue:null}getClusterExpansionZoom(N){let Z=this._getOriginZoom(N)-1;for(;Z<=this.options.maxZoom;){const G=this.getChildren(N);if(Z++,G.length!==1)break;N=G[0].properties.cluster_id}return Z}_appendLeaves(N,Z,G,J,ae){const $=this.getChildren(Z);for(const ge of $){const oe=ge.properties;if(oe&&oe.cluster?ae+oe.point_count<=J?ae+=oe.point_count:ae=this._appendLeaves(N,oe.cluster_id,G,J,ae):ae<J?ae++:N.push(ge),N.length===G)break}return ae}_createTree(N){const Z=new S.aF(N.length/this.stride|0,this.options.nodeSize,Float32Array);for(let G=0;G<N.length;G+=this.stride)Z.add(N[G],N[G+1]);return Z.finish(),Z.data=N,Z}_addTileFeatures(N,Z,G,J,ae,$){for(const ge of N){const oe=ge*this.stride,de=Z[oe+ot]>1;let _e,ue,Ae;if(de)_e=Et(Z,oe,this.clusterProps),ue=Z[oe],Ae=Z[oe+1];else{const Qe=this.points[Z[oe+Ji]];_e=Qe.properties;const[dt,st]=Qe.geometry.coordinates;ue=Ar(dt),Ae=sr(st)}const Ze={type:1,geometry:[[Math.round(this.options.extent*(ue*ae-G)),Math.round(this.options.extent*(Ae*ae-J))]],tags:_e};let Ve;Ve=de||this.options.generateId?Z[oe+Ji]:this.points[Z[oe+Ji]].id,Ve!==void 0&&(Ze.id=Ve),$.features.push(Ze)}}_limitZoom(N){return Math.max(this.options.minZoom,Math.min(Math.floor(+N),this.options.maxZoom+1))}_cluster(N,Z){const{radius:G,extent:J,reduce:ae,minPoints:$}=this.options,ge=G/(J*Math.pow(2,Z)),oe=N.data,de=[],_e=this.stride;for(let ue=0;ue<oe.length;ue+=_e){if(oe[ue+2]<=Z)continue;oe[ue+2]=Z;const Ae=oe[ue],Ze=oe[ue+1],Ve=N.within(oe[ue],oe[ue+1],ge),Qe=oe[ue+ot];let dt=Qe;for(const st of Ve){const we=st*_e;oe[we+2]>Z&&(dt+=oe[we+ot])}if(dt>Qe&&dt>=$){let st,we=Ae*Qe,Lt=Ze*Qe,Tt=-1;const kt=((ue/_e|0)<<5)+(Z+1)+this.points.length;for(const at of Ve){const Ie=at*_e;if(oe[Ie+2]<=Z)continue;oe[Ie+2]=Z;const it=oe[Ie+ot];we+=oe[Ie]*it,Lt+=oe[Ie+1]*it,oe[Ie+4]=kt,ae&&(st||(st=this._map(oe,ue,!0),Tt=this.clusterProps.length,this.clusterProps.push(st)),ae(st,this._map(oe,Ie)))}oe[ue+4]=kt,de.push(we/dt,Lt/dt,1/0,kt,-1,dt),ae&&de.push(Tt)}else{for(let st=0;st<_e;st++)de.push(oe[ue+st]);if(dt>1)for(const st of Ve){const we=st*_e;if(!(oe[we+2]<=Z)){oe[we+2]=Z;for(let Lt=0;Lt<_e;Lt++)de.push(oe[we+Lt])}}}}return de}_getOriginId(N){return N-this.points.length>>5}_getOriginZoom(N){return(N-this.points.length)%32}_map(N,Z,G){if(N[Z+ot]>1){const $=this.clusterProps[N[Z+Vi]];return G?Object.assign({},$):$}const J=this.points[N[Z+Ji]].properties,ae=this.options.map(J);return G&&ae===J?Object.assign({},ae):ae}}function yr(ce,N,Z){return{type:"Feature",id:ce[N+Ji],properties:Et(ce,N,Z),geometry:{type:"Point",coordinates:[(G=ce[N],360*(G-.5)),cn(ce[N+1])]}};var G}function Et(ce,N,Z){const G=ce[N+ot],J=G>=1e4?`${Math.round(G/1e3)}k`:G>=1e3?Math.round(G/100)/10+"k":G,ae=ce[N+Vi],$=ae===-1?{}:Object.assign({},Z[ae]);return Object.assign($,{cluster:!0,cluster_id:ce[N+Ji],point_count:G,point_count_abbreviated:J})}function Ar(ce){return ce/360+.5}function sr(ce){const N=Math.sin(ce*Math.PI/180),Z=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return Z<0?0:Z>1?1:Z}function cn(ce){const N=(180-360*ce)*Math.PI/180;return 360*Math.atan(Math.exp(N))/Math.PI-90}function kr(ce,N,Z,G){let J=G;const ae=N+(Z-N>>1);let $,ge=Z-N;const oe=ce[N],de=ce[N+1],_e=ce[Z],ue=ce[Z+1];for(let Ae=N+3;Ae<Z;Ae+=3){const Ze=la(ce[Ae],ce[Ae+1],oe,de,_e,ue);if(Ze>J)$=Ae,J=Ze;else if(Ze===J){const Ve=Math.abs(Ae-ae);Ve<ge&&($=Ae,ge=Ve)}}J>G&&($-N>3&&kr(ce,N,$,G),ce[$+2]=J,Z-$>3&&kr(ce,$,Z,G))}function la(ce,N,Z,G,J,ae){let $=J-Z,ge=ae-G;if($!==0||ge!==0){const oe=((ce-Z)*$+(N-G)*ge)/($*$+ge*ge);oe>1?(Z=J,G=ae):oe>0&&(Z+=$*oe,G+=ge*oe)}return $=ce-Z,ge=N-G,$*$+ge*ge}function xr(ce,N,Z,G){const J={id:ce??null,type:N,geometry:Z,tags:G,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(N==="Point"||N==="MultiPoint"||N==="LineString")Ht(J,Z);else if(N==="Polygon")Ht(J,Z[0]);else if(N==="MultiLineString")for(const ae of Z)Ht(J,ae);else if(N==="MultiPolygon")for(const ae of Z)Ht(J,ae[0]);return J}function Ht(ce,N){for(let Z=0;Z<N.length;Z+=3)ce.minX=Math.min(ce.minX,N[Z]),ce.minY=Math.min(ce.minY,N[Z+1]),ce.maxX=Math.max(ce.maxX,N[Z]),ce.maxY=Math.max(ce.maxY,N[Z+1])}function vr(ce,N,Z,G){if(!N.geometry)return;const J=N.geometry.coordinates;if(J&&J.length===0)return;const ae=N.geometry.type,$=Math.pow(Z.tolerance/((1<<Z.maxZoom)*Z.extent),2);let ge=[],oe=N.id;if(Z.promoteId?oe=N.properties[Z.promoteId]:Z.generateId&&(oe=G||0),ae==="Point")Qi(J,ge);else if(ae==="MultiPoint")for(const de of J)Qi(de,ge);else if(ae==="LineString")Sn(J,ge,$,!1);else if(ae==="MultiLineString"){if(Z.lineMetrics){for(const de of J)ge=[],Sn(de,ge,$,!1),ce.push(xr(oe,"LineString",ge,N.properties));return}un(J,ge,$,!1)}else if(ae==="Polygon")un(J,ge,$,!0);else{if(ae!=="MultiPolygon"){if(ae==="GeometryCollection"){for(const de of N.geometry.geometries)vr(ce,{id:oe,geometry:de,properties:N.properties},Z,G);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const de of J){const _e=[];un(de,_e,$,!0),ge.push(_e)}}ce.push(xr(oe,ae,ge,N.properties))}function Qi(ce,N){N.push(ca(ce[0]),or(ce[1]),0)}function Sn(ce,N,Z,G){let J,ae,$=0;for(let oe=0;oe<ce.length;oe++){const de=ca(ce[oe][0]),_e=or(ce[oe][1]);N.push(de,_e,0),oe>0&&($+=G?(J*_e-de*ae)/2:Math.sqrt(Math.pow(de-J,2)+Math.pow(_e-ae,2))),J=de,ae=_e}const ge=N.length-3;N[2]=1,kr(N,0,ge,Z),N[ge+2]=1,N.size=Math.abs($),N.start=0,N.end=N.size}function un(ce,N,Z,G){for(let J=0;J<ce.length;J++){const ae=[];Sn(ce[J],ae,Z,G),N.push(ae)}}function ca(ce){return ce/360+.5}function or(ce){const N=Math.sin(ce*Math.PI/180),Z=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return Z<0?0:Z>1?1:Z}function lr(ce,N,Z,G,J,ae,$,ge){if(G/=N,ae>=(Z/=N)&&$<G)return ce;if($<Z||ae>=G)return null;const oe=[];for(const de of ce){const _e=de.geometry;let ue=de.type;const Ae=J===0?de.minX:de.minY,Ze=J===0?de.maxX:de.maxY;if(Ae>=Z&&Ze<G){oe.push(de);continue}if(Ze<Z||Ae>=G)continue;let Ve=[];if(ue==="Point"||ue==="MultiPoint")Ui(_e,Ve,Z,G,J);else if(ue==="LineString")Zt(_e,Ve,Z,G,J,!1,ge.lineMetrics);else if(ue==="MultiLineString")hn(_e,Ve,Z,G,J,!1);else if(ue==="Polygon")hn(_e,Ve,Z,G,J,!0);else if(ue==="MultiPolygon")for(const Qe of _e){const dt=[];hn(Qe,dt,Z,G,J,!0),dt.length&&Ve.push(dt)}if(Ve.length){if(ge.lineMetrics&&ue==="LineString"){for(const Qe of Ve)oe.push(xr(de.id,ue,Qe,de.tags));continue}ue!=="LineString"&&ue!=="MultiLineString"||(Ve.length===1?(ue="LineString",Ve=Ve[0]):ue="MultiLineString"),ue!=="Point"&&ue!=="MultiPoint"||(ue=Ve.length===3?"Point":"MultiPoint"),oe.push(xr(de.id,ue,Ve,de.tags))}}return oe.length?oe:null}function Ui(ce,N,Z,G,J){for(let ae=0;ae<ce.length;ae+=3){const $=ce[ae+J];$>=Z&&$<=G&&br(N,ce[ae],ce[ae+1],ce[ae+2])}}function Zt(ce,N,Z,G,J,ae,$){let ge=Vr(ce);const oe=J===0?Pn:Cn;let de,_e,ue=ce.start;for(let dt=0;dt<ce.length-3;dt+=3){const st=ce[dt],we=ce[dt+1],Lt=ce[dt+2],Tt=ce[dt+3],kt=ce[dt+4],at=J===0?st:we,Ie=J===0?Tt:kt;let it=!1;$&&(de=Math.sqrt(Math.pow(st-Tt,2)+Math.pow(we-kt,2))),at<Z?Ie>Z&&(_e=oe(ge,st,we,Tt,kt,Z),$&&(ge.start=ue+de*_e)):at>G?Ie<G&&(_e=oe(ge,st,we,Tt,kt,G),$&&(ge.start=ue+de*_e)):br(ge,st,we,Lt),Ie<Z&&at>=Z&&(_e=oe(ge,st,we,Tt,kt,Z),it=!0),Ie>G&&at<=G&&(_e=oe(ge,st,we,Tt,kt,G),it=!0),!ae&&it&&($&&(ge.end=ue+de*_e),N.push(ge),ge=Vr(ce)),$&&(ue+=de)}let Ae=ce.length-3;const Ze=ce[Ae],Ve=ce[Ae+1],Qe=J===0?Ze:Ve;Qe>=Z&&Qe<=G&&br(ge,Ze,Ve,ce[Ae+2]),Ae=ge.length-3,ae&&Ae>=3&&(ge[Ae]!==ge[0]||ge[Ae+1]!==ge[1])&&br(ge,ge[0],ge[1],ge[2]),ge.length&&N.push(ge)}function Vr(ce){const N=[];return N.size=ce.size,N.start=ce.start,N.end=ce.end,N}function hn(ce,N,Z,G,J,ae){for(const $ of ce)Zt($,N,Z,G,J,ae,!1)}function br(ce,N,Z,G){ce.push(N,Z,G)}function Pn(ce,N,Z,G,J,ae){const $=(ae-N)/(G-N);return br(ce,ae,Z+(J-Z)*$,1),$}function Cn(ce,N,Z,G,J,ae){const $=(ae-Z)/(J-Z);return br(ce,N+(G-N)*$,ae,1),$}function Ce(ce,N){const Z=[];for(let G=0;G<ce.length;G++){const J=ce[G],ae=J.type;let $;if(ae==="Point"||ae==="MultiPoint"||ae==="LineString")$=Ye(J.geometry,N);else if(ae==="MultiLineString"||ae==="Polygon"){$=[];for(const ge of J.geometry)$.push(Ye(ge,N))}else if(ae==="MultiPolygon"){$=[];for(const ge of J.geometry){const oe=[];for(const de of ge)oe.push(Ye(de,N));$.push(oe)}}Z.push(xr(J.id,ae,$,J.tags))}return Z}function Ye(ce,N){const Z=[];Z.size=ce.size,ce.start!==void 0&&(Z.start=ce.start,Z.end=ce.end);for(let G=0;G<ce.length;G+=3)Z.push(ce[G]+N,ce[G+1],ce[G+2]);return Z}function Ue(ce,N){if(ce.transformed)return ce;const Z=1<<ce.z,G=ce.x,J=ce.y;for(const ae of ce.features){const $=ae.geometry,ge=ae.type;if(ae.geometry=[],ge===1)for(let oe=0;oe<$.length;oe+=2)ae.geometry.push(_t($[oe],$[oe+1],N,Z,G,J));else for(let oe=0;oe<$.length;oe++){const de=[];for(let _e=0;_e<$[oe].length;_e+=2)de.push(_t($[oe][_e],$[oe][_e+1],N,Z,G,J));ae.geometry.push(de)}}return ce.transformed=!0,ce}function _t(ce,N,Z,G,J,ae){return[Math.round(Z*(ce*G-J)),Math.round(Z*(N*G-ae))]}function Nt(ce,N,Z,G,J){const ae=N===J.maxZoom?0:J.tolerance/((1<<N)*J.extent),$={features:[],numPoints:0,numSimplified:0,numFeatures:ce.length,source:null,x:Z,y:G,z:N,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ge of ce)cr($,ge,ae,J);return $}function cr(ce,N,Z,G){const J=N.geometry,ae=N.type,$=[];if(ce.minX=Math.min(ce.minX,N.minX),ce.minY=Math.min(ce.minY,N.minY),ce.maxX=Math.max(ce.maxX,N.maxX),ce.maxY=Math.max(ce.maxY,N.maxY),ae==="Point"||ae==="MultiPoint")for(let ge=0;ge<J.length;ge+=3)$.push(J[ge],J[ge+1]),ce.numPoints++,ce.numSimplified++;else if(ae==="LineString")mi($,J,ce,Z,!1,!1);else if(ae==="MultiLineString"||ae==="Polygon")for(let ge=0;ge<J.length;ge++)mi($,J[ge],ce,Z,ae==="Polygon",ge===0);else if(ae==="MultiPolygon")for(let ge=0;ge<J.length;ge++){const oe=J[ge];for(let de=0;de<oe.length;de++)mi($,oe[de],ce,Z,!0,de===0)}if($.length){let ge=N.tags||null;if(ae==="LineString"&&G.lineMetrics){ge={};for(const de in N.tags)ge[de]=N.tags[de];ge.mapbox_clip_start=J.start/J.size,ge.mapbox_clip_end=J.end/J.size}const oe={geometry:$,type:ae==="Polygon"||ae==="MultiPolygon"?3:ae==="LineString"||ae==="MultiLineString"?2:1,tags:ge};N.id!==null&&(oe.id=N.id),ce.features.push(oe)}}function mi(ce,N,Z,G,J,ae){const $=G*G;if(G>0&&N.size<(J?$:G))return void(Z.numPoints+=N.length/3);const ge=[];for(let oe=0;oe<N.length;oe+=3)(G===0||N[oe+2]>$)&&(Z.numSimplified++,ge.push(N[oe],N[oe+1])),Z.numPoints++;J&&function(oe,de){let _e=0;for(let ue=0,Ae=oe.length,Ze=Ae-2;ue<Ae;Ze=ue,ue+=2)_e+=(oe[ue]-oe[Ze])*(oe[ue+1]+oe[Ze+1]);if(_e>0===de)for(let ue=0,Ae=oe.length;ue<Ae/2;ue+=2){const Ze=oe[ue],Ve=oe[ue+1];oe[ue]=oe[Ae-2-ue],oe[ue+1]=oe[Ae-1-ue],oe[Ae-2-ue]=Ze,oe[Ae-1-ue]=Ve}}(ge,ae),ce.push(ge)}const zr={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Rr{constructor(N,Z){const G=(Z=this.options=function(ae,$){for(const ge in $)ae[ge]=$[ge];return ae}(Object.create(zr),Z)).debug;if(G&&console.time("preprocess data"),Z.maxZoom<0||Z.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(Z.promoteId&&Z.generateId)throw new Error("promoteId and generateId cannot be used together.");let J=function(ae,$){const ge=[];if(ae.type==="FeatureCollection")for(let oe=0;oe<ae.features.length;oe++)vr(ge,ae.features[oe],$,oe);else vr(ge,ae.type==="Feature"?ae:{geometry:ae},$);return ge}(N,Z);this.tiles={},this.tileCoords=[],G&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Z.indexMaxZoom,Z.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),J=function(ae,$){const ge=$.buffer/$.extent;let oe=ae;const de=lr(ae,1,-1-ge,ge,0,-1,2,$),_e=lr(ae,1,1-ge,2+ge,0,-1,2,$);return(de||_e)&&(oe=lr(ae,1,-ge,1+ge,0,-1,2,$)||[],de&&(oe=Ce(de,1).concat(oe)),_e&&(oe=oe.concat(Ce(_e,-1)))),oe}(J,Z),J.length&&this.splitTile(J,0,0,0),G&&(J.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(N,Z,G,J,ae,$,ge){const oe=[N,Z,G,J],de=this.options,_e=de.debug;for(;oe.length;){J=oe.pop(),G=oe.pop(),Z=oe.pop(),N=oe.pop();const ue=1<<Z,Ae=In(Z,G,J);let Ze=this.tiles[Ae];if(!Ze&&(_e>1&&console.time("creation"),Ze=this.tiles[Ae]=Nt(N,Z,G,J,de),this.tileCoords.push({z:Z,x:G,y:J}),_e)){_e>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Z,G,J,Ze.numFeatures,Ze.numPoints,Ze.numSimplified),console.timeEnd("creation"));const it=`z${Z}`;this.stats[it]=(this.stats[it]||0)+1,this.total++}if(Ze.source=N,ae==null){if(Z===de.indexMaxZoom||Ze.numPoints<=de.indexMaxPoints)continue}else{if(Z===de.maxZoom||Z===ae)continue;if(ae!=null){const it=ae-Z;if(G!==$>>it||J!==ge>>it)continue}}if(Ze.source=null,N.length===0)continue;_e>1&&console.time("clipping");const Ve=.5*de.buffer/de.extent,Qe=.5-Ve,dt=.5+Ve,st=1+Ve;let we=null,Lt=null,Tt=null,kt=null,at=lr(N,ue,G-Ve,G+dt,0,Ze.minX,Ze.maxX,de),Ie=lr(N,ue,G+Qe,G+st,0,Ze.minX,Ze.maxX,de);N=null,at&&(we=lr(at,ue,J-Ve,J+dt,1,Ze.minY,Ze.maxY,de),Lt=lr(at,ue,J+Qe,J+st,1,Ze.minY,Ze.maxY,de),at=null),Ie&&(Tt=lr(Ie,ue,J-Ve,J+dt,1,Ze.minY,Ze.maxY,de),kt=lr(Ie,ue,J+Qe,J+st,1,Ze.minY,Ze.maxY,de),Ie=null),_e>1&&console.timeEnd("clipping"),oe.push(we||[],Z+1,2*G,2*J),oe.push(Lt||[],Z+1,2*G,2*J+1),oe.push(Tt||[],Z+1,2*G+1,2*J),oe.push(kt||[],Z+1,2*G+1,2*J+1)}}getTile(N,Z,G){N=+N,Z=+Z,G=+G;const J=this.options,{extent:ae,debug:$}=J;if(N<0||N>24)return null;const ge=1<<N,oe=In(N,Z=Z+ge&ge-1,G);if(this.tiles[oe])return Ue(this.tiles[oe],ae);$>1&&console.log("drilling down to z%d-%d-%d",N,Z,G);let de,_e=N,ue=Z,Ae=G;for(;!de&&_e>0;)_e--,ue>>=1,Ae>>=1,de=this.tiles[In(_e,ue,Ae)];return de&&de.source?($>1&&(console.log("found parent tile z%d-%d-%d",_e,ue,Ae),console.time("drilling down")),this.splitTile(de.source,_e,ue,Ae,N,Z,G),$>1&&console.timeEnd("drilling down"),this.tiles[oe]?Ue(this.tiles[oe],ae):null):null}}function In(ce,N,Z){return 32*((1<<ce)*Z+N)+ce}function qn(ce,N){return N?ce.properties[N]:ce.id}function ja(ce,N){if(ce==null)return!0;if(ce.type==="Feature")return qn(ce,N)!=null;if(ce.type==="FeatureCollection"){const Z=new Set;for(const G of ce.features){const J=qn(G,N);if(J==null||Z.has(J))return!1;Z.add(J)}return!0}return!1}function Ur(ce,N){const Z=new Map;if(ce!=null)if(ce.type==="Feature")Z.set(qn(ce,N),ce);else for(const G of ce.features)Z.set(qn(G,N),G);return Z}class wr extends Be{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(N,Z){return S._(this,void 0,void 0,function*(){const G=N.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const J=this._geoJSONIndex.getTile(G.z,G.x,G.y);if(!J)return null;const ae=new Ki(J.features);let $=Tn(ae);return $.byteOffset===0&&$.byteLength===$.buffer.byteLength||($=new Uint8Array($)),{vectorTile:ae,rawData:$.buffer}})}loadData(N){return S._(this,void 0,void 0,function*(){var Z;(Z=this._pendingRequest)===null||Z===void 0||Z.abort();const G=!!(N&&N.request&&N.request.collectResourceTiming)&&new S.cE(N.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(N,this._pendingRequest),this._geoJSONIndex=N.cluster?new xi(function({superclusterOptions:$,clusterProperties:ge}){if(!ge||!$)return $;const oe={},de={},_e={accumulated:null,zoom:0},ue={properties:null},Ae=Object.keys(ge);for(const Ze of Ae){const[Ve,Qe]=ge[Ze],dt=S.cL(Qe),st=S.cL(typeof Ve=="string"?[Ve,["accumulated"],["get",Ze]]:Ve);oe[Ze]=dt.value,de[Ze]=st.value}return $.map=Ze=>{ue.properties=Ze;const Ve={};for(const Qe of Ae)Ve[Qe]=oe[Qe].evaluate(_e,ue);return Ve},$.reduce=(Ze,Ve)=>{ue.properties=Ve;for(const Qe of Ae)_e.accumulated=Ze[Qe],Ze[Qe]=de[Qe].evaluate(_e,ue)},$}(N)).load((yield this._pendingData).features):(J=yield this._pendingData,new Rr(J,N.geojsonVtOptions)),this.loaded={};const ae={};if(G){const $=G.finish();$&&(ae.resourceTiming={},ae.resourceTiming[N.source]=JSON.parse(JSON.stringify($)))}return ae}catch(ae){if(delete this._pendingRequest,S.cp(ae))return{abandoned:!0};throw ae}var J})}getData(){return S._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(N){const Z=this.loaded;return Z&&Z[N.uid]?super.reloadTile(N):this.loadTile(N)}loadAndProcessGeoJSON(N,Z){return S._(this,void 0,void 0,function*(){let G=yield this.loadGeoJSON(N,Z);if(delete this._pendingRequest,typeof G!="object")throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(fi(G,!0),N.filter){const J=S.cL(N.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(J.result==="error")throw new Error(J.value.map($=>`${$.key}: ${$.message}`).join(", "));G={type:"FeatureCollection",features:G.features.filter($=>J.value.evaluate({zoom:0},$))}}return G})}loadGeoJSON(N,Z){return S._(this,void 0,void 0,function*(){const{promoteId:G}=N;if(N.request){const J=yield S.j(N.request,Z);return this._dataUpdateable=ja(J.data,G)?Ur(J.data,G):void 0,J.data}if(typeof N.data=="string")try{const J=JSON.parse(N.data);return this._dataUpdateable=ja(J,G)?Ur(J,G):void 0,J}catch{throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`)}if(!N.dataDiff)throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${N.source}`);return function(J,ae,$){var ge,oe,de,_e;if(ae.removeAll&&J.clear(),ae.remove)for(const ue of ae.remove)J.delete(ue);if(ae.add)for(const ue of ae.add){const Ae=qn(ue,$);Ae!=null&&J.set(Ae,ue)}if(ae.update)for(const ue of ae.update){let Ae=J.get(ue.id);if(Ae==null)continue;const Ze=!ue.removeAllProperties&&(((ge=ue.removeProperties)===null||ge===void 0?void 0:ge.length)>0||((oe=ue.addOrUpdateProperties)===null||oe===void 0?void 0:oe.length)>0);if((ue.newGeometry||ue.removeAllProperties||Ze)&&(Ae=Object.assign({},Ae),J.set(ue.id,Ae),Ze&&(Ae.properties=Object.assign({},Ae.properties))),ue.newGeometry&&(Ae.geometry=ue.newGeometry),ue.removeAllProperties)Ae.properties={};else if(((de=ue.removeProperties)===null||de===void 0?void 0:de.length)>0)for(const Ve of ue.removeProperties)Object.prototype.hasOwnProperty.call(Ae.properties,Ve)&&delete Ae.properties[Ve];if(((_e=ue.addOrUpdateProperties)===null||_e===void 0?void 0:_e.length)>0)for(const{key:Ve,value:Qe}of ue.addOrUpdateProperties)Ae.properties[Ve]=Qe}}(this._dataUpdateable,N.dataDiff,G),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(N){return S._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(N){return this._geoJSONIndex.getClusterExpansionZoom(N.clusterId)}getClusterChildren(N){return this._geoJSONIndex.getChildren(N.clusterId)}getClusterLeaves(N){return this._geoJSONIndex.getLeaves(N.clusterId,N.limit,N.offset)}}class dn{constructor(N){this.self=N,this.actor=new S.H(N),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(Z,G)=>{if(this.externalWorkerSourceTypes[Z])throw new Error(`Worker source with name "${Z}" already registered.`);this.externalWorkerSourceTypes[Z]=G},this.self.addProtocol=S.cr,this.self.removeProtocol=S.cs,this.self.registerRTLTextPlugin=Z=>{S.cM.setMethods(Z)},this.actor.registerMessageHandler("LDT",(Z,G)=>this._getDEMWorkerSource(Z,G.source).loadTile(G)),this.actor.registerMessageHandler("RDT",(Z,G)=>S._(this,void 0,void 0,function*(){this._getDEMWorkerSource(Z,G.source).removeTile(G)})),this.actor.registerMessageHandler("GCEZ",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterExpansionZoom(G)})),this.actor.registerMessageHandler("GCC",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterChildren(G)})),this.actor.registerMessageHandler("GCL",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterLeaves(G)})),this.actor.registerMessageHandler("LD",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).loadData(G)),this.actor.registerMessageHandler("GD",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).getData()),this.actor.registerMessageHandler("LT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).loadTile(G)),this.actor.registerMessageHandler("RT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).reloadTile(G)),this.actor.registerMessageHandler("AT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).abortTile(G)),this.actor.registerMessageHandler("RMT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).removeTile(G)),this.actor.registerMessageHandler("RS",(Z,G)=>S._(this,void 0,void 0,function*(){if(!this.workerSources[Z]||!this.workerSources[Z][G.type]||!this.workerSources[Z][G.type][G.source])return;const J=this.workerSources[Z][G.type][G.source];delete this.workerSources[Z][G.type][G.source],J.removeSource!==void 0&&J.removeSource(G)})),this.actor.registerMessageHandler("RM",Z=>S._(this,void 0,void 0,function*(){delete this.layerIndexes[Z],delete this.availableImages[Z],delete this.workerSources[Z],delete this.demWorkerSources[Z]})),this.actor.registerMessageHandler("SR",(Z,G)=>S._(this,void 0,void 0,function*(){this.referrer=G})),this.actor.registerMessageHandler("SRPS",(Z,G)=>this._syncRTLPluginState(Z,G)),this.actor.registerMessageHandler("IS",(Z,G)=>S._(this,void 0,void 0,function*(){this.self.importScripts(G)})),this.actor.registerMessageHandler("SI",(Z,G)=>this._setImages(Z,G)),this.actor.registerMessageHandler("UL",(Z,G)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(Z).update(G.layers,G.removedIds)})),this.actor.registerMessageHandler("SL",(Z,G)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(Z).replace(G)}))}_setImages(N,Z){return S._(this,void 0,void 0,function*(){this.availableImages[N]=Z;for(const G in this.workerSources[N]){const J=this.workerSources[N][G];for(const ae in J)J[ae].availableImages=Z}})}_syncRTLPluginState(N,Z){return S._(this,void 0,void 0,function*(){return yield S.cM.syncState(Z,this.self.importScripts)})}_getAvailableImages(N){let Z=this.availableImages[N];return Z||(Z=[]),Z}_getLayerIndex(N){let Z=this.layerIndexes[N];return Z||(Z=this.layerIndexes[N]=new o),Z}_getWorkerSource(N,Z,G){if(this.workerSources[N]||(this.workerSources[N]={}),this.workerSources[N][Z]||(this.workerSources[N][Z]={}),!this.workerSources[N][Z][G]){const J={sendAsync:(ae,$)=>(ae.targetMapId=N,this.actor.sendAsync(ae,$))};switch(Z){case"vector":this.workerSources[N][Z][G]=new Be(J,this._getLayerIndex(N),this._getAvailableImages(N));break;case"geojson":this.workerSources[N][Z][G]=new wr(J,this._getLayerIndex(N),this._getAvailableImages(N));break;default:this.workerSources[N][Z][G]=new this.externalWorkerSourceTypes[Z](J,this._getLayerIndex(N),this._getAvailableImages(N))}}return this.workerSources[N][Z][G]}_getDEMWorkerSource(N,Z){return this.demWorkerSources[N]||(this.demWorkerSources[N]={}),this.demWorkerSources[N][Z]||(this.demWorkerSources[N][Z]=new Ee),this.demWorkerSources[N][Z]}}return S.i(self)&&(self.worker=new dn(self)),dn}),z("index",["exports","./shared"],function(S,o){var he="5.5.0";function me(){var u=new o.A(4);return o.A!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}let Pe,Be;const Ee={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(u,e,i){const s=requestAnimationFrame(h=>{l(),e(h)}),{unsubscribe:l}=o.s(u.signal,"abort",()=>{l(),cancelAnimationFrame(s),i(o.c())},!1)},frameAsync(u){return new Promise((e,i)=>{this.frame(u,e,i)})},getImageData(u,e=0){return this.getImageCanvasContext(u).getImageData(-e,-e,u.width+2*e,u.height+2*e)},getImageCanvasContext(u){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=u.width,e.height=u.height,i.drawImage(u,0,0,u.width,u.height),i},resolveURL:u=>(Pe||(Pe=document.createElement("a")),Pe.href=u,Pe.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Be==null&&(Be=matchMedia("(prefers-reduced-motion: reduce)")),Be.matches)}};class le{static testProp(e){if(!le.docStyle)return e[0];for(let i=0;i<e.length;i++)if(e[i]in le.docStyle)return e[i];return e[0]}static create(e,i,s){const l=window.document.createElement(e);return i!==void 0&&(l.className=i),s&&s.appendChild(l),l}static createNS(e,i){return window.document.createElementNS(e,i)}static disableDrag(){le.docStyle&&le.selectProp&&(le.userSelect=le.docStyle[le.selectProp],le.docStyle[le.selectProp]="none")}static enableDrag(){le.docStyle&&le.selectProp&&(le.docStyle[le.selectProp]=le.userSelect)}static setTransform(e,i){e.style[le.transformProp]=i}static addEventListener(e,i,s,l={}){e.addEventListener(i,s,"passive"in l?l:l.capture)}static removeEventListener(e,i,s,l={}){e.removeEventListener(i,s,"passive"in l?l:l.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",le.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",le.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",le.suppressClickInternal,!0)},0)}static getScale(e){const i=e.getBoundingClientRect();return{x:i.width/e.offsetWidth||1,y:i.height/e.offsetHeight||1,boundingClientRect:i}}static getPoint(e,i,s){const l=i.boundingClientRect;return new o.P((s.clientX-l.left)/i.x-e.clientLeft,(s.clientY-l.top)/i.y-e.clientTop)}static mousePos(e,i){const s=le.getScale(e);return le.getPoint(e,s,i)}static touchPos(e,i){const s=[],l=le.getScale(e);for(let h=0;h<i.length;h++)s.push(le.getPoint(e,l,i[h]));return s}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){const i=new DOMParser().parseFromString(e,"text/html").body||document.createElement("body"),s=i.querySelectorAll("script");for(const l of s)l.remove();return le.clean(i),i.innerHTML}static isPossiblyDangerous(e,i){const s=i.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!s.includes("javascript:")&&!s.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){const i=e.children;for(const s of i)le.removeAttributes(s),le.clean(s)}static removeAttributes(e){for(const{name:i,value:s}of e.attributes)le.isPossiblyDangerous(i,s)&&e.removeAttribute(i)}}le.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,le.selectProp=le.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),le.transformProp=le.testProp(["transform","WebkitTransform"]);const Fe={supported:!1,testSupport:function(u){!ti&&fi&&(yi?Ki(u):Bt=u)}};let Bt,fi,ti=!1,yi=!1;function Ki(u){const e=u.createTexture();u.bindTexture(u.TEXTURE_2D,e);try{if(u.texImage2D(u.TEXTURE_2D,0,u.RGBA,u.RGBA,u.UNSIGNED_BYTE,fi),u.isContextLost())return;Fe.supported=!0}catch{}u.deleteTexture(e),ti=!0}var Ft;typeof document<"u"&&(fi=document.createElement("img"),fi.onload=()=>{Bt&&Ki(Bt),Bt=null,yi=!0},fi.onerror=()=>{ti=!0,Bt=null},fi.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(u){let e,i,s,l;u.resetRequestQueue=()=>{e=[],i=0,s=0,l={}},u.addThrottleControl=x=>{const T=s++;return l[T]=x,T},u.removeThrottleControl=x=>{delete l[x],f()},u.getImage=(x,T,P=!0)=>new Promise((A,E)=>{Fe.supported&&(x.headers||(x.headers={}),x.headers.accept="image/webp,*/*"),o.e(x,{type:"image"}),e.push({abortController:T,requestParameters:x,supportImageRefresh:P,state:"queued",onError:F=>{E(F)},onSuccess:F=>{A(F)}}),f()});const h=x=>o._(this,void 0,void 0,function*(){x.state="running";const{requestParameters:T,supportImageRefresh:P,onError:A,onSuccess:E,abortController:F}=x,O=P===!1&&!o.i(self)&&!o.g(T.url)&&(!T.headers||Object.keys(T.headers).reduce((W,K)=>W&&K==="accept",!0));i++;const H=O?_(T,F):o.m(T,F);try{const W=yield H;delete x.abortController,x.state="completed",W.data instanceof HTMLImageElement||o.b(W.data)?E(W):W.data&&E({data:yield(q=W.data,typeof createImageBitmap=="function"?o.f(q):o.h(q)),cacheControl:W.cacheControl,expires:W.expires})}catch(W){delete x.abortController,A(W)}finally{i--,f()}var q}),f=()=>{const x=(()=>{for(const T of Object.keys(l))if(l[T]())return!0;return!1})()?o.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:o.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let T=i;T<x&&e.length>0;T++){const P=e.shift();P.abortController.signal.aborted?T--:h(P)}},_=(x,T)=>new Promise((P,A)=>{const E=new Image,F=x.url,O=x.credentials;O&&O==="include"?E.crossOrigin="use-credentials":(O&&O==="same-origin"||!o.d(F))&&(E.crossOrigin="anonymous"),T.signal.addEventListener("abort",()=>{E.src="",A(o.c())}),E.fetchPriority="high",E.onload=()=>{E.onerror=E.onload=null,P({data:E})},E.onerror=()=>{E.onerror=E.onload=null,T.signal.aborted||A(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."))},E.src=F})}(Ft||(Ft={})),Ft.resetRequestQueue();class It{constructor(e){this._transformRequestFn=e}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function $t(u){const e=[];if(typeof u=="string")e.push({id:"default",url:u});else if(u&&u.length>0){const i=[];for(const{id:s,url:l}of u){const h=`${s}${l}`;i.indexOf(h)===-1&&(i.push(h),e.push({id:s,url:l}))}}return e}function _r(u,e,i){try{const s=new URL(u);return s.pathname+=`${e}${i}`,s.toString()}catch{throw new Error(`Invalid sprite URL "${u}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}class jt{constructor(e,i,s,l){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this.update(i,l)}update(e,i,s){const{width:l,height:h}=e,f=!(this.size&&this.size[0]===l&&this.size[1]===h||s),{context:_}=this,{gl:x}=_;if(this.useMipmap=!!(i&&i.useMipmap),x.bindTexture(x.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===x.RGBA&&(!i||i.premultiply!==!1)),f)this.size=[l,h],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||o.b(e)?x.texImage2D(x.TEXTURE_2D,0,this.format,this.format,x.UNSIGNED_BYTE,e):x.texImage2D(x.TEXTURE_2D,0,this.format,l,h,0,this.format,x.UNSIGNED_BYTE,e.data);else{const{x:T,y:P}=s||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||o.b(e)?x.texSubImage2D(x.TEXTURE_2D,0,T,P,x.RGBA,x.UNSIGNED_BYTE,e):x.texSubImage2D(x.TEXTURE_2D,0,T,P,l,h,x.RGBA,x.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&x.generateMipmap(x.TEXTURE_2D),_.pixelStoreUnpackFlipY.setDefault(),_.pixelStoreUnpack.setDefault(),_.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,i,s){const{context:l}=this,{gl:h}=l;h.bindTexture(h.TEXTURE_2D,this.texture),s!==h.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=h.LINEAR),e!==this.filter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,e),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,s||e),this.filter=e),i!==this.wrap&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,i),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function Tn(u){const{userImage:e}=u;return!!(e&&e.render&&e.render())&&(u.data.replace(new Uint8Array(e.data.buffer)),!0)}class Mn extends o.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new o.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:i,promiseResolve:s}of this.requestors)s(this._getImagesForIds(i));this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const s=i.spriteData;i.data=new o.R({width:s.width,height:s.height},s.context.getImageData(s.x,s.y,s.width,s.height).data),i.spriteData=null}return i}addImage(e,i){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,i)&&(this.images[e]=i)}_validate(e,i){let s=!0;const l=i.data||i.spriteData;return this._validateStretch(i.stretchX,l&&l.width)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "stretchX" value`))),s=!1),this._validateStretch(i.stretchY,l&&l.height)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "stretchY" value`))),s=!1),this._validateContent(i.content,i)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "content" value`))),s=!1),s}_validateStretch(e,i){if(!e)return!0;let s=0;for(const l of e){if(l[0]<s||l[1]<l[0]||i<l[1])return!1;s=l[1]}return!0}_validateContent(e,i){if(!e)return!0;if(e.length!==4)return!1;const s=i.spriteData,l=s&&s.width||i.data.width,h=s&&s.height||i.data.height;return!(e[0]<0||l<e[0]||e[1]<0||h<e[1]||e[2]<0||l<e[2]||e[3]<0||h<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,i,s=!0){const l=this.getImage(e);if(s&&(l.data.width!==i.data.width||l.data.height!==i.data.height))throw new Error(`size mismatch between old image (${l.data.width}x${l.data.height}) and new image (${i.data.width}x${i.data.height}).`);i.version=l.version+1,this.images[e]=i,this.updatedImages[e]=!0}removeImage(e){const i=this.images[e];delete this.images[e],delete this.patterns[e],i.userImage&&i.userImage.onRemove&&i.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((i,s)=>{let l=!0;if(!this.isLoaded())for(const h of e)this.images[h]||(l=!1);this.isLoaded()||l?i(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:i})})}_getImagesForIds(e){const i={};for(const s of e){let l=this.getImage(s);l||(this.fire(new o.l("styleimagemissing",{id:s})),l=this.getImage(s)),l?i[s]={data:l.data.clone(),pixelRatio:l.pixelRatio,sdf:l.sdf,version:l.version,stretchX:l.stretchX,stretchY:l.stretchY,content:l.content,textFitWidth:l.textFitWidth,textFitHeight:l.textFitHeight,hasRenderCallback:!!(l.userImage&&l.userImage.render)}:o.w(`Image "${s}" 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.`)}return i}getPixelSize(){const{width:e,height:i}=this.atlasImage;return{width:e,height:i}}getPattern(e){const i=this.patterns[e],s=this.getImage(e);if(!s)return null;if(i&&i.position.version===s.version)return i.position;if(i)i.position.version=s.version;else{const l={w:s.data.width+2,h:s.data.height+2,x:0,y:0},h=new o.I(l,s);this.patterns[e]={bin:l,position:h}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const i=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new jt(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const h in this.patterns)e.push(this.patterns[h].bin);const{w:i,h:s}=o.p(e),l=this.atlasImage;l.resize({width:i||1,height:s||1});for(const h in this.patterns){const{bin:f}=this.patterns[h],_=f.x+1,x=f.y+1,T=this.getImage(h).data,P=T.width,A=T.height;o.R.copy(T,l,{x:0,y:0},{x:_,y:x},{width:P,height:A}),o.R.copy(T,l,{x:0,y:A-1},{x:_,y:x-1},{width:P,height:1}),o.R.copy(T,l,{x:0,y:0},{x:_,y:x+A},{width:P,height:1}),o.R.copy(T,l,{x:P-1,y:0},{x:_-1,y:x},{width:1,height:A}),o.R.copy(T,l,{x:0,y:0},{x:_+P,y:x},{width:1,height:A})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const s=this.getImage(i);s||o.w(`Image with ID: "${i}" was not found`),Tn(s)&&this.updateImage(i,s)}}}const Yi=1e20;function ar(u,e,i,s,l,h,f,_,x){for(let T=e;T<e+s;T++)Ji(u,i*h+T,h,l,f,_,x);for(let T=i;T<i+l;T++)Ji(u,T*h+e,1,s,f,_,x)}function Ji(u,e,i,s,l,h,f){h[0]=0,f[0]=-1e20,f[1]=Yi,l[0]=u[e];for(let _=1,x=0,T=0;_<s;_++){l[_]=u[e+_*i];const P=_*_;do{const A=h[x];T=(l[_]-l[A]+P-A*A)/(_-A)/2}while(T<=f[x]&&--x>-1);x++,h[x]=_,f[x]=T,f[x+1]=Yi}for(let _=0,x=0;_<s;_++){for(;f[x+1]<_;)x++;const T=h[x],P=_-T;u[e+_*i]=l[T]+P*P}}class ot{constructor(e,i){this.requestManager=e,this.localIdeographFontFamily=i,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return o._(this,void 0,void 0,function*(){const i=[];for(const h in e)for(const f of e[h])i.push(this._getAndCacheGlyphsPromise(h,f));const s=yield Promise.all(i),l={};for(const{stack:h,id:f,glyph:_}of s)l[h]||(l[h]={}),l[h][f]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return l})}_getAndCacheGlyphsPromise(e,i){return o._(this,void 0,void 0,function*(){let s=this.entries[e];s||(s=this.entries[e]={glyphs:{},requests:{},ranges:{}});let l=s.glyphs[i];if(l!==void 0)return{stack:e,id:i,glyph:l};if(l=this._tinySDF(s,e,i),l)return s.glyphs[i]=l,{stack:e,id:i,glyph:l};const h=Math.floor(i/256);if(256*h>65535)throw new Error("glyphs > 65535 not supported");if(s.ranges[h])return{stack:e,id:i,glyph:l};if(!this.url)throw new Error("glyphsUrl is not set");if(!s.requests[h]){const _=ot.loadGlyphRange(e,h,this.url,this.requestManager);s.requests[h]=_}const f=yield s.requests[h];for(const _ in f)this._doesCharSupportLocalGlyph(+_)||(s.glyphs[+_]=f[+_]);return s.ranges[h]=!0,{stack:e,id:i,glyph:f[i]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))||o.u["CJK Unified Ideographs"](e)||o.u["Hangul Syllables"](e)||o.u.Hiragana(e)||o.u.Katakana(e)||o.u["CJK Symbols and Punctuation"](e)||o.u["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,i,s){const l=this.localIdeographFontFamily;if(!l||!this._doesCharSupportLocalGlyph(s))return;let h=e.tinySDF;if(!h){let _="400";/bold/i.test(i)?_="900":/medium/i.test(i)?_="500":/light/i.test(i)&&(_="200"),h=e.tinySDF=new ot.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:l,fontWeight:_})}const f=h.draw(String.fromCharCode(s));return{id:s,bitmap:new o.q({width:f.width||60,height:f.height||60},f.data),metrics:{width:f.glyphWidth/2||24,height:f.glyphHeight/2||24,left:f.glyphLeft/2+.5||0,top:f.glyphTop/2-27.5||-8,advance:f.glyphAdvance/2||24,isDoubleResolution:!0}}}}ot.loadGlyphRange=function(u,e,i,s){return o._(this,void 0,void 0,function*(){const l=256*e,h=l+255,f=s.transformRequest(i.replace("{fontstack}",u).replace("{range}",`${l}-${h}`),"Glyphs"),_=yield o.n(f,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${l}-${h}`);const x={};for(const T of o.o(_.data))x[T.id]=T;return x})},ot.TinySDF=class{constructor({fontSize:u=24,buffer:e=3,radius:i=8,cutoff:s=.25,fontFamily:l="sans-serif",fontWeight:h="normal",fontStyle:f="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=i;const _=this.size=u+4*e,x=this._createCanvas(_),T=this.ctx=x.getContext("2d",{willReadFrequently:!0});T.font=`${f} ${h} ${u}px ${l}`,T.textBaseline="alphabetic",T.textAlign="left",T.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(u){const e=document.createElement("canvas");return e.width=e.height=u,e}draw(u){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:l,actualBoundingBoxRight:h}=this.ctx.measureText(u),f=Math.ceil(i),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-l))),x=Math.min(this.size-this.buffer,f+Math.ceil(s)),T=_+2*this.buffer,P=x+2*this.buffer,A=Math.max(T*P,0),E=new Uint8ClampedArray(A),F={data:E,width:T,height:P,glyphWidth:_,glyphHeight:x,glyphTop:f,glyphLeft:0,glyphAdvance:e};if(_===0||x===0)return F;const{ctx:O,buffer:H,gridInner:q,gridOuter:W}=this;O.clearRect(H,H,_,x),O.fillText(u,H,H+f);const K=O.getImageData(H,H,_,x);W.fill(Yi,0,A),q.fill(0,0,A);for(let te=0;te<x;te++)for(let ee=0;ee<_;ee++){const ie=K.data[4*(te*_+ee)+3]/255;if(ie===0)continue;const se=(te+H)*T+ee+H;if(ie===1)W[se]=0,q[se]=Yi;else{const re=.5-ie;W[se]=re>0?re*re:0,q[se]=re<0?re*re:0}}ar(W,0,0,T,P,T,this.f,this.v,this.z),ar(q,H,H,_,x,T,this.f,this.v,this.z);for(let te=0;te<A;te++){const ee=Math.sqrt(W[te])-Math.sqrt(q[te]);E[te]=Math.round(255-255*(ee/this.radius+this.cutoff))}return F}};class Vi{constructor(){this.specification=o.v.light.position}possiblyEvaluate(e,i){return o.z(e.expression.evaluate(i))}interpolate(e,i,s){return{x:o.B.number(e.x,i.x,s),y:o.B.number(e.y,i.y,s),z:o.B.number(e.z,i.z,s)}}}let xi;class yr extends o.E{constructor(e){super(),xi=xi||new o.r({anchor:new o.D(o.v.light.anchor),position:new Vi,color:new o.D(o.v.light.color),intensity:new o.D(o.v.light.intensity)}),this._transitionable=new o.T(xi),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(o.t,e,i))for(const s in e){const l=e[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),l):this._transitionable.setValue(s,l)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,s){return(!s||s.validate!==!1)&&o.x(this,e.call(o.y,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:o.v}))}}const Et=new o.r({"sky-color":new o.D(o.v.sky["sky-color"]),"horizon-color":new o.D(o.v.sky["horizon-color"]),"fog-color":new o.D(o.v.sky["fog-color"]),"fog-ground-blend":new o.D(o.v.sky["fog-ground-blend"]),"horizon-fog-blend":new o.D(o.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new o.D(o.v.sky["sky-horizon-blend"]),"atmosphere-blend":new o.D(o.v.sky["atmosphere-blend"])});class Ar extends o.E{constructor(e){super(),this._transitionable=new o.T(Et),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new o.C(0))}setSky(e,i={}){if(!this._validate(o.F,e,i)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const s in e){const l=e[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),l):this._transitionable.setValue(s,l)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,s={}){return(s==null?void 0:s.validate)!==!1&&o.x(this,e.call(o.y,o.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:o.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class sr{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,i){const s=e.join(",")+String(i);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(e,i)),this.dashEntry[s]}getDashRanges(e,i,s){const l=[];let h=e.length%2==1?-e[e.length-1]*s:0,f=e[0]*s,_=!0;l.push({left:h,right:f,isDash:_,zeroLength:e[0]===0});let x=e[0];for(let T=1;T<e.length;T++){_=!_;const P=e[T];h=x*s,x+=P,f=x*s,l.push({left:h,right:f,isDash:_,zeroLength:P===0})}return l}addRoundDash(e,i,s){const l=i/2;for(let h=-s;h<=s;h++){const f=this.width*(this.nextRow+s+h);let _=0,x=e[_];for(let T=0;T<this.width;T++){T/x.right>1&&(x=e[++_]);const P=Math.abs(T-x.left),A=Math.abs(T-x.right),E=Math.min(P,A);let F;const O=h/s*(l+1);if(x.isDash){const H=l-Math.abs(O);F=Math.sqrt(E*E+H*H)}else F=l-Math.sqrt(E*E+O*O);this.data[f+T]=Math.max(0,Math.min(255,F+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){const x=e[_],T=e[_+1];x.zeroLength?e.splice(_,1):T&&T.isDash===x.isDash&&(T.left=x.left,e.splice(_,1))}const i=e[0],s=e[e.length-1];i.isDash===s.isDash&&(i.left=s.left-this.width,s.right=i.right+this.width);const l=this.width*this.nextRow;let h=0,f=e[h];for(let _=0;_<this.width;_++){_/f.right>1&&(f=e[++h]);const x=Math.abs(_-f.left),T=Math.abs(_-f.right),P=Math.min(x,T);this.data[l+_]=Math.max(0,Math.min(255,(f.isDash?P:-P)+128))}}addDash(e,i){const s=i?7:0,l=2*s+1;if(this.nextRow+l>this.height)return o.w("LineAtlas out of space"),null;let h=0;for(let _=0;_<e.length;_++)h+=e[_];if(h!==0){const _=this.width/h,x=this.getDashRanges(e,this.width,_);i?this.addRoundDash(x,_,s):this.addRegularDash(x)}const f={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:h};return this.nextRow+=l,this.dirty=!0,f}bind(e){const i=e.gl;this.texture?(i.bindTexture(i.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,i.texSubImage2D(i.TEXTURE_2D,0,0,0,this.width,this.height,i.ALPHA,i.UNSIGNED_BYTE,this.data))):(this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texImage2D(i.TEXTURE_2D,0,i.ALPHA,this.width,this.height,0,i.ALPHA,i.UNSIGNED_BYTE,this.data))}}const cn="maplibre_preloaded_worker_pool";class kr{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<kr.workerCount;)this.workers.push(new Worker(o.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[cn]}numActive(){return Object.keys(this.active).length}}const la=Math.floor(Ee.hardwareConcurrency/2);let xr,Ht;function vr(){return xr||(xr=new kr),xr}kr.workerCount=o.G(globalThis)?Math.max(Math.min(la,3),1):1;class Qi{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;const s=this.workerPool.acquire(i);for(let l=0;l<s.length;l++){const h=new o.H(s[l],i);h.name=`Worker ${l}`,this.actors.push(h)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,i){const s=[];for(const l of this.actors)s.push(l.sendAsync({type:e,data:i}));return Promise.all(s)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(i=>{i.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,i){for(const s of this.actors)s.registerMessageHandler(e,i)}}function Sn(){return Ht||(Ht=new Qi(vr(),o.J),Ht.registerMessageHandler("GR",(u,e,i)=>o.m(e,i))),Ht}function un(u,e){const i=o.K();return o.L(i,i,[1,1,0]),o.M(i,i,[.5*u.width,.5*u.height,1]),u.calculatePosMatrix?o.N(i,i,u.calculatePosMatrix(e.toUnwrapped())):i}function ca(u,e,i,s,l,h,f){var _;const x=function(E,F,O){if(E)for(const H of E){const q=F[H];if(q&&q.source===O&&q.type==="fill-extrusion")return!0}else for(const H in F){const q=F[H];if(q.source===O&&q.type==="fill-extrusion")return!0}return!1}((_=l==null?void 0:l.layers)!==null&&_!==void 0?_:null,e,u.id),T=h.maxPitchScaleFactor(),P=u.tilesIn(s,T,x);P.sort(or);const A=[];for(const E of P)A.push({wrappedTileID:E.tileID.wrapped().key,queryResults:E.tile.queryRenderedFeatures(e,i,u._state,E.queryGeometry,E.cameraQueryGeometry,E.scale,l,h,T,un(u.transform,E.tileID),f?(F,O)=>f(E.tileID,F,O):void 0)});return function(E,F){for(const O in E)for(const H of E[O])lr(H,F);return E}(function(E){const F={},O={};for(const H of E){const q=H.queryResults,W=H.wrappedTileID,K=O[W]=O[W]||{};for(const te in q){const ee=q[te],ie=K[te]=K[te]||{},se=F[te]=F[te]||[];for(const re of ee)ie[re.featureIndex]||(ie[re.featureIndex]=!0,se.push(re))}}return F}(A),u)}function or(u,e){const i=u.tileID,s=e.tileID;return i.overscaledZ-s.overscaledZ||i.canonical.y-s.canonical.y||i.wrap-s.wrap||i.canonical.x-s.canonical.x}function lr(u,e){const i=u.feature,s=e.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=s}function Ui(u,e,i){return o._(this,void 0,void 0,function*(){let s=u;if(u.url?s=(yield o.j(e.transformRequest(u.url,"Source"),i)).data:yield Ee.frameAsync(i),!s)return null;const l=o.O(o.e(s,u),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in s&&s.vector_layers&&(l.vectorLayerIds=s.vector_layers.map(h=>h.id)),l})}class Zt{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof o.Q?new o.Q(e.lng,e.lat):o.Q.convert(e),this}setSouthWest(e){return this._sw=e instanceof o.Q?new o.Q(e.lng,e.lat):o.Q.convert(e),this}extend(e){const i=this._sw,s=this._ne;let l,h;if(e instanceof o.Q)l=e,h=e;else{if(!(e instanceof Zt))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Zt.convert(e)):this.extend(o.Q.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(o.Q.convert(e)):this;if(l=e._sw,h=e._ne,!l||!h)return this}return i||s?(i.lng=Math.min(l.lng,i.lng),i.lat=Math.min(l.lat,i.lat),s.lng=Math.max(h.lng,s.lng),s.lat=Math.max(h.lat,s.lat)):(this._sw=new o.Q(l.lng,l.lat),this._ne=new o.Q(h.lng,h.lat)),this}getCenter(){return new o.Q((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 o.Q(this.getWest(),this.getNorth())}getSouthEast(){return new o.Q(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}=o.Q.convert(e);let l=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(l=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&l}static convert(e){return e instanceof Zt?e:e&&new Zt(e)}static fromLngLat(e,i=0){const s=360*i/40075017,l=s/Math.cos(Math.PI/180*e.lat);return new Zt(new o.Q(e.lng-l,e.lat-s),new o.Q(e.lng+l,e.lat+s))}adjustAntiMeridian(){const e=new o.Q(this._sw.lng,this._sw.lat),i=new o.Q(this._ne.lng,this._ne.lat);return new Zt(e,e.lng>i.lng?new o.Q(i.lng+360,i.lat):i)}}class Vr{constructor(e,i,s){this.bounds=Zt.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=s||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),s=Math.floor(o.U(this.bounds.getWest())*i),l=Math.floor(o.S(this.bounds.getNorth())*i),h=Math.ceil(o.U(this.bounds.getEast())*i),f=Math.ceil(o.S(this.bounds.getSouth())*i);return e.x>=s&&e.x<h&&e.y>=l&&e.y<f}}class hn extends o.E{constructor(e,i,s,l){if(super(),this.id=e,this.dispatcher=s,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.e(this,o.O(i,["url","scheme","tileSize","promoteId"])),this._options=o.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(l)}load(){return o._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield Ui(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(o.e(this,e),e.bounds&&(this.tileBounds=new Vr(e.bounds,this.minzoom,this.maxzoom)),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.l("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new o.k(e))}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return o.e({},this._options)}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s={request:this.map._requestManager.transformRequest(i,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};s.request.collectResourceTiming=this._collectResourceTiming;let l="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((h,f)=>{e.reloadPromise={resolve:h,reject:f}})}else e.actor=this.dispatcher.getActor(),l="LT";e.abortController=new AbortController;try{const h=yield e.actor.sendAsync({type:l,data:s},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,h)}catch(h){if(delete e.abortController,e.aborted)return;if(h&&h.status!==404)throw h;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,i){if(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),i&&this.map._refreshExpiredTiles&&e.setExpiryData(i),e.loadVectorData(i,this.map.painter),e.reloadPromise){const s=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(s.resolve).catch(s.reject)}}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class br extends o.E{constructor(e,i,s,l){super(),this.id=e,this.dispatcher=s,this.setEventedParent(l),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=o.e({type:"raster"},i),o.e(this,o.O(i,["url","scheme","tileSize"]))}load(){return o._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield Ui(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(o.e(this,i),i.bounds&&(this.tileBounds=new Vr(i.bounds,this.minzoom,this.maxzoom)),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(i){this._tileJSONRequest=null,this.fire(new o.k(i))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return o.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const s=yield Ft.getImage(this.map._requestManager.transformRequest(i,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(s&&s.data){this.map._refreshExpiredTiles&&(s.cacheControl||s.expires)&&e.setExpiryData({cacheControl:s.cacheControl,expires:s.expires});const l=this.map.painter.context,h=l.gl,f=s.data;e.texture=this.map.painter.getTileTexture(f.width),e.texture?e.texture.update(f,{useMipmap:!0}):(e.texture=new jt(l,f,h.RGBA,{useMipmap:!0}),e.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(s){if(delete e.abortController,e.aborted)e.state="unloaded";else if(s)throw e.state="errored",s}})}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class Pn extends br{constructor(e,i,s,l){super(e,i,s,l),this.type="raster-dem",this.maxzoom=22,this._options=o.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s=this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const l=yield Ft.getImage(s,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(l&&l.data){const h=l.data;this.map._refreshExpiredTiles&&(l.cacheControl||l.expires)&&e.setExpiryData({cacheControl:l.cacheControl,expires:l.expires});const f=o.b(h)&&o.V()?h:yield this.readImageNow(h),_={type:this.type,uid:e.uid,source:this.id,rawImageData:f,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const x=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=x,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(l){if(delete e.abortController,e.aborted)e.state="unloaded";else if(l)throw e.state="errored",l}})}readImageNow(e){return o._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&o.W()){const i=e.width+2,s=e.height+2;try{return new o.R({width:i,height:s},yield o.X(e,-1,-1,i,s))}catch{}}return Ee.getImageData(e,1)})}_getNeighboringTiles(e){const i=e.canonical,s=Math.pow(2,i.z),l=(i.x-1+s)%s,h=i.x===0?e.wrap-1:e.wrap,f=(i.x+1+s)%s,_=i.x+1===s?e.wrap+1:e.wrap,x={};return x[new o.Y(e.overscaledZ,h,i.z,l,i.y).key]={backfilled:!1},x[new o.Y(e.overscaledZ,_,i.z,f,i.y).key]={backfilled:!1},i.y>0&&(x[new o.Y(e.overscaledZ,h,i.z,l,i.y-1).key]={backfilled:!1},x[new o.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},x[new o.Y(e.overscaledZ,_,i.z,f,i.y-1).key]={backfilled:!1}),i.y+1<s&&(x[new o.Y(e.overscaledZ,h,i.z,l,i.y+1).key]={backfilled:!1},x[new o.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},x[new o.Y(e.overscaledZ,_,i.z,f,i.y+1).key]={backfilled:!1}),x}unloadTile(e){return o._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}class Cn extends o.E{constructor(e,i,s,l){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(l),this._data=i.data,this._options=o.e({},i),this._collectResourceTiming=i.collectResourceTiming,i.maxzoom!==void 0&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,i.clusterMaxZoom!==void 0&&this.maxzoom<=i.clusterMaxZoom&&o.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=o.e({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(i.buffer!==void 0?i.buffer:128),tolerance:this._pixelsToTileUnits(i.tolerance!==void 0?i.tolerance:.375),extent:o.Z,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:i.clusterMaxZoom!==void 0?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:o.Z,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(o.Z/this.tileSize)}load(){return o._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return o._(this,void 0,void 0,function*(){const e=o.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}getCoordinatesFromGeometry(e){return e.type==="GeometryCollection"?e.geometries.map(i=>i.coordinates).flat(1/0):e.coordinates.flat(1/0)}getBounds(){return o._(this,void 0,void 0,function*(){const e=new Zt,i=yield this.getData();let s;switch(i.type){case"FeatureCollection":s=i.features.map(l=>this.getCoordinatesFromGeometry(l.geometry)).flat(1/0);break;case"Feature":s=this.getCoordinatesFromGeometry(i.geometry);break;default:s=this.getCoordinatesFromGeometry(i)}if(s.length==0)return e;for(let l=0;l<s.length-1;l+=2)e.extend([s[l],s[l+1]]);return e})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,i,s){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:i,offset:s}})}_updateWorkerData(e){return o._(this,void 0,void 0,function*(){const i=o.e({type:this.type},this.workerOptions);e?i.dataDiff=e:typeof this._data=="string"?(i.request=this.map._requestManager.transformRequest(Ee.resolveURL(this._data),"Source"),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new o.l("dataloading",{dataType:"source"}));try{const s=yield this.actor.sendAsync({type:"LD",data:i});if(this._pendingLoads--,this._removed||s.abandoned)return void this.fire(new o.l("dataabort",{dataType:"source"}));let l=null;s.resourceTiming&&s.resourceTiming[this.id]&&(l=s.resourceTiming[this.id].slice(0));const h={dataType:"source"};this._collectResourceTiming&&l&&l.length>0&&o.e(h,{resourceTiming:l}),this.fire(new o.l("data",Object.assign(Object.assign({},h),{sourceDataType:"metadata"}))),this.fire(new o.l("data",Object.assign(Object.assign({},h),{sourceDataType:"content"})))}catch(s){if(this._pendingLoads--,this._removed)return void this.fire(new o.l("dataabort",{dataType:"source"}));this.fire(new o.k(s))}})}loaded(){return this._pendingLoads===0}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.actor?"RT":"LT";e.actor=this.actor;const s={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;const l=yield this.actor.sendAsync({type:i,data:s},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(l,this.map.painter,i==="RT")})}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return o.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class Ce extends o.E{constructor(e,i,s,l){super(),this.flippedWindingOrder=!1,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.setEventedParent(l),this.options=i}load(e){return o._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const i=yield Ft.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,i&&i.data&&(this.image=i.data,e&&(this.coordinates=e),this._finishLoading())}catch(i){this._request=null,this._loaded=!0,this.fire(new o.k(i))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(o.$.fromLngLat);var s;return this.tileID=function(l){let h=1/0,f=1/0,_=-1/0,x=-1/0;for(const E of l)h=Math.min(h,E.x),f=Math.min(f,E.y),_=Math.max(_,E.x),x=Math.max(x,E.y);const T=Math.max(_-h,x-f),P=Math.max(0,Math.floor(-Math.log(T)/Math.LN2)),A=Math.pow(2,P);return new o.a1(P,Math.floor((h+_)/2*A),Math.floor((f+x)/2*A))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map(l=>this.tileID.getTilePoint(l)._round()),this.flippedWindingOrder=((s=this.tileCoords)[1].x-s[0].x)*(s[2].y-s[0].y)-(s[1].y-s[0].y)*(s[2].x-s[0].x)<0,this.fire(new o.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,i=e.gl;this.texture||(this.texture=new jt(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const l in this.tiles){const h=this.tiles[l];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,s=!0)}s&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return o._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let i=1/0,s=1/0,l=-1/0,h=-1/0;for(const _ of e)i=Math.min(i,_.x),s=Math.min(s,_.y),l=Math.max(l,_.x),h=Math.max(h,_.y);const f={};for(let _=0;_<=o.a0;_++){const x=Math.pow(2,_),T=Math.floor(i*x),P=Math.floor(s*x),A=Math.floor(l*x),E=Math.floor(h*x);f[_]={minTileX:T,minTileY:P,maxTileX:A,maxTileY:E}}return f}}class Ye extends Ce{constructor(e,i,s,l){super(e,i,s,l),this.roundZoom=!0,this.type="video",this.options=i}load(){return o._(this,void 0,void 0,function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const i of e.urls)this.urls.push(this.map._requestManager.transformRequest(i,"Source").url);try{const i=yield o.a2(this.urls);if(this._loaded=!0,!i)return;this.video=i,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(i){this.fire(new o.k(i))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new o.k(new o.a3(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,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 e=this.map.painter.context,i=e.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new jt(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const l in this.tiles){const h=this.tiles[l];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,s=!0)}s&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Ue extends Ce{constructor(e,i,s,l){super(e,i,s,l),i.coordinates?Array.isArray(i.coordinates)&&i.coordinates.length===4&&!i.coordinates.some(h=>!Array.isArray(h)||h.length!==2||h.some(f=>typeof f!="number"))||this.fire(new o.k(new o.a3(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.k(new o.a3(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&typeof i.animate!="boolean"&&this.fire(new o.k(new o.a3(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?typeof i.canvas=="string"||i.canvas instanceof HTMLCanvasElement||this.fire(new o.k(new o.a3(`sources.${e}`,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.k(new o.a3(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=i.animate===void 0||i.animate}load(){return o._(this,void 0,void 0,function*(){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.k(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(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const i=this.map.painter.context,s=i.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new jt(i,this.canvas,s.RGBA,{premultiply:!0});let l=!1;for(const h in this.tiles){const f=this.tiles[h];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,l=!0)}l&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const _t={},Nt=u=>{switch(u){case"geojson":return Cn;case"image":return Ce;case"raster":return br;case"raster-dem":return Pn;case"vector":return hn;case"video":return Ye;case"canvas":return Ue}return _t[u]},cr="RTLPluginLoaded";class mi extends o.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Sn()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(i=>{throw this.status="error",i})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return o._(this,arguments,void 0,function*(i,s=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Ee.resolveURL(i),!this.url)throw new Error(`requested url ${i} is invalid`);if(this.status==="unavailable"){if(!s)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return o._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new o.l(cr))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let zr=null;function Rr(){return zr||(zr=new mi),zr}class In{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=o.a4(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const i=e+this.timeAdded;i<this.fadeEndTime||(this.fadeEndTime=i)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(l,h){const f={};if(!h)return f;for(const _ of l){const x=_.layerIds.map(T=>h.getLayer(T)).filter(Boolean);if(x.length!==0){_.layers=x,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(T=>x.filter(P=>P.id===T)[0]));for(const T of x)f[T.id]=_}}return f}(e.buckets,i==null?void 0:i.style),this.hasSymbolBuckets=!1;for(const l in this.buckets){const h=this.buckets[l];if(h instanceof o.a6){if(this.hasSymbolBuckets=!0,!s)break;h.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const l in this.buckets){const h=this.buckets[l];if(h instanceof o.a6&&h.hasRTLText){this.hasRTLText=!0,Rr().lazyLoad();break}}this.queryPadding=0;for(const l in this.buckets){const h=this.buckets[l];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(l).queryRadius(h))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new o.a5}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const s in this.buckets){const l=this.buckets[s];l.uploadPending()&&l.upload(e)}const i=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new jt(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new jt(e,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,i,s,l,h,f,_,x,T,P,A){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:l,cameraQueryGeometry:h,scale:f,tileSize:this.tileSize,pixelPosMatrix:P,transform:x,params:_,queryPadding:this.queryPadding*T,getElevation:A},e,i,s):{}}querySourceFeatures(e,i){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const l=s.loadVTLayers(),h=i&&i.sourceLayer?i.sourceLayer:"",f=l._geojsonTileLayer||l[h];if(!f)return;const _=o.a7(i&&i.filter),{z:x,x:T,y:P}=this.tileID.canonical,A={z:x,x:T,y:P};for(let E=0;E<f.length;E++){const F=f.feature(E);if(_.needGeometry){const q=o.a8(F,!0);if(!_.filter(new o.C(this.tileID.overscaledZ),q,this.tileID.canonical))continue}else if(!_.filter(new o.C(this.tileID.overscaledZ),F))continue;const O=s.getId(F,h),H=new o.a9(F,x,T,P,O);H.tile=A,e.push(H)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const s=o.aa(e.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const s=Date.now();let l=!1;if(this.expirationTime>s)l=!1;else if(i)if(this.expirationTime<i)l=!0;else{const h=this.expirationTime-i;h?this.expirationTime=s+Math.max(h,3e4):l=!0}else l=!0;l?(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)}setFeatureState(e,i){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const l in this.buckets){if(!i.style.hasLayer(l))continue;const h=this.buckets[l],f=h.layers[0].sourceLayer||"_geojsonTileLayer",_=s[f],x=e[f];if(!_||!x||Object.keys(x).length===0)continue;h.update(x,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const T=i&&i.style&&i.style.getLayer(l);T&&(this.queryPadding=Math.max(this.queryPadding,T.queryRadius(h)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Ee.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=Ee.now()+e}setDependencies(e,i){const s={};for(const l of i)s[l]=!0;this.dependencies[e]=s}hasDependency(e,i){for(const s of e){const l=this.dependencies[s];if(l){for(const h of i)if(l[h])return!0}}return!1}}class qn{constructor(e,i){this.max=e,this.onRemove=i,this.reset()}reset(){for(const e in this.data)for(const i of this.data[e])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(e,i,s){const l=e.wrapped().key;this.data[l]===void 0&&(this.data[l]=[]);const h={value:i,timeout:void 0};if(s!==void 0&&(h.timeout=setTimeout(()=>{this.remove(e,h)},s)),this.data[l].push(h),this.order.push(l),this.order.length>this.max){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const i=this.data[e].shift();return i.timeout&&clearTimeout(i.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),i.value}getByKey(e){const i=this.data[e];return i?i[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,i){if(!this.has(e))return this;const s=e.wrapped().key,l=i===void 0?0:this.data[s].indexOf(i),h=this.data[s][l];return this.data[s].splice(l,1),h.timeout&&clearTimeout(h.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(h.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(e){const i=[];for(const s in this.data)for(const l of this.data[s])e(l.value)||i.push(l);for(const s of i)this.remove(s.value.tileID,s)}}class ja{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,s){const l=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][l]=this.stateChanges[e][l]||{},o.e(this.stateChanges[e][l],s),this.deletedStates[e]===null){this.deletedStates[e]={};for(const h in this.state[e])h!==l&&(this.deletedStates[e][h]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][l]===null){this.deletedStates[e][l]={};for(const h in this.state[e][l])s[h]||(this.deletedStates[e][l][h]=null)}else for(const h in s)this.deletedStates[e]&&this.deletedStates[e][l]&&this.deletedStates[e][l][h]===null&&delete this.deletedStates[e][l][h]}removeFeatureState(e,i,s){if(this.deletedStates[e]===null)return;const l=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},s&&i!==void 0)this.deletedStates[e][l]!==null&&(this.deletedStates[e][l]=this.deletedStates[e][l]||{},this.deletedStates[e][l][s]=null);else if(i!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][l])for(s in this.deletedStates[e][l]={},this.stateChanges[e][l])this.deletedStates[e][l][s]=null;else this.deletedStates[e][l]=null;else this.deletedStates[e]=null}getState(e,i){const s=String(i),l=o.e({},(this.state[e]||{})[s],(this.stateChanges[e]||{})[s]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const h=this.deletedStates[e][i];if(h===null)return{};for(const f in h)delete l[f]}return l}initializeTileState(e,i){e.setFeatureState(this.state,i)}coalesceChanges(e,i){const s={};for(const l in this.stateChanges){this.state[l]=this.state[l]||{};const h={};for(const f in this.stateChanges[l])this.state[l][f]||(this.state[l][f]={}),o.e(this.state[l][f],this.stateChanges[l][f]),h[f]=this.state[l][f];s[l]=h}for(const l in this.deletedStates){this.state[l]=this.state[l]||{};const h={};if(this.deletedStates[l]===null)for(const f in this.state[l])h[f]={},this.state[l][f]={};else for(const f in this.deletedStates[l]){if(this.deletedStates[l][f]===null)this.state[l][f]={};else for(const _ of Object.keys(this.deletedStates[l][f]))delete this.state[l][f][_];h[f]=this.state[l][f]}s[l]=s[l]||{},o.e(s[l],h)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const l in e)e[l].setFeatureState(s,i)}}const Ur=89.25;function wr(u,e){const i=o.ae(e.lat,-85.051129,o.af);return new o.P(o.U(e.lng)*u,o.S(i)*u)}function dn(u,e){return new o.$(e.x/u,e.y/u).toLngLat()}function ce(u){return u.cameraToCenterDistance*Math.min(.85*Math.tan(o.ab(90-u.pitch)),Math.tan(o.ab(Ur-u.pitch)))}function N(u,e){const i=u.canonical,s=e/o.ac(i.z),l=i.x+Math.pow(2,i.z)*u.wrap,h=o.ad(new Float64Array(16));return o.L(h,h,[l*s,i.y*s,0]),o.M(h,h,[s/o.Z,s/o.Z,1]),h}function Z(u,e,i,s,l){const h=o.$.fromLngLat(u,e),f=l*o.ag(1,u.lat),_=f*Math.cos(o.ab(i)),x=Math.sqrt(f*f-_*_),T=x*Math.sin(o.ab(-s)),P=x*Math.cos(o.ab(-s));return new o.$(h.x+T,h.y+P,h.z+_)}function G(u,e,i){const s=e.intersectsFrustum(u);if(!i)return s;const l=e.intersectsPlane(i);return s===0||l===0?0:s===2&&l===2?2:1}function J(u,e,i){let s=0;const l=(i-e)/10;for(let h=0;h<10;h++)s+=l*Math.pow(Math.cos(e+(h+.5)/10*(i-e)),u);return s}function ae(u,e){return function(i,s,l,h,f){const _=2*((u-1)/o.ah(Math.cos(o.ab(Ur-f))/Math.cos(o.ab(Ur)))-1),x=Math.acos(l/h),T=2*J(_-1,0,o.ab(f/2)),P=Math.min(o.ab(Ur),x+o.ab(f/2)),A=J(_-1,Math.min(P,x-o.ab(f/2)),P),E=Math.atan(s/l),F=Math.hypot(s,l);let O=i;return O+=o.ah(h/F/Math.max(.5,Math.cos(o.ab(f/2)))),O+=_*o.ah(Math.cos(E))/2,O-=o.ah(Math.max(1,A/T/e))/2,O}}const $=ae(9.314,3);function ge(u,e){const i=(e.roundZoom?Math.round:Math.floor)(u.zoom+o.ah(u.tileSize/e.tileSize));return Math.max(0,i)}function oe(u,e){const i=u.getCameraFrustum(),s=u.getClippingPlane(),l=u.screenPointToMercatorCoordinate(u.getCameraPoint()),h=o.$.fromLngLat(u.center,u.elevation);l.z=h.z+Math.cos(u.pitchInRadians)*u.cameraToCenterDistance/u.worldSize;const f=u.getCoveringTilesDetailsProvider(),_=f.allowVariableZoom(u,e),x=ge(u,e),T=e.minzoom||0,P=e.maxzoom!==void 0?e.maxzoom:u.maxZoom,A=Math.min(Math.max(0,x),P),E=Math.pow(2,A),F=[E*l.x,E*l.y,0],O=[E*h.x,E*h.y,0],H=Math.hypot(h.x-l.x,h.y-l.y),q=Math.abs(h.z-l.z),W=Math.hypot(H,q),K=ie=>({zoom:0,x:0,y:0,wrap:ie,fullyVisible:!1}),te=[],ee=[];if(u.renderWorldCopies&&f.allowWorldCopies())for(let ie=1;ie<=3;ie++)te.push(K(-ie)),te.push(K(ie));for(te.push(K(0));te.length>0;){const ie=te.pop(),se=ie.x,re=ie.y;let pe=ie.fullyVisible;const Me={x:se,y:re,z:ie.zoom},xe=f.getTileAABB(Me,ie.wrap,u.elevation,e);if(!pe){const Oe=G(i,xe,s);if(Oe===0)continue;pe=Oe===2}const ve=f.distanceToTile2d(l.x,l.y,Me,xe);let be=x;_&&(be=(e.calculateTileZoom||$)(u.zoom+o.ah(u.tileSize/e.tileSize),ve,q,W,u.fov)),be=(e.roundZoom?Math.round:Math.floor)(be),be=Math.max(0,be);const Ne=Math.min(be,P);if(ie.wrap=f.getWrap(h,Me,ie.wrap),ie.zoom>=Ne){if(ie.zoom<T)continue;const Oe=A-ie.zoom,Re=F[0]-.5-(se<<Oe),He=F[1]-.5-(re<<Oe),gt=e.reparseOverscaled?Math.max(ie.zoom,be):ie.zoom;ee.push({tileID:new o.Y(ie.zoom===P?gt:ie.zoom,ie.wrap,ie.zoom,se,re),distanceSq:o.ai([O[0]-.5-se,O[1]-.5-re]),tileDistanceToCamera:Math.sqrt(Re*Re+He*He)})}else for(let Oe=0;Oe<4;Oe++)te.push({zoom:ie.zoom+1,x:(se<<1)+Oe%2,y:(re<<1)+(Oe>>1),wrap:ie.wrap,fullyVisible:pe})}return ee.sort((ie,se)=>ie.distanceSq-se.distanceSq).map(ie=>ie.tileID)}class de extends o.E{constructor(e,i,s){super(),this.id=e,this.dispatcher=s,this.on("data",l=>this._dataHandler(l)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((l,h,f,_)=>{const x=new(Nt(h.type))(l,h,f,_);if(x.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${x.id}`);return x})(e,i,s,this),this._tiles={},this._cache=new qn(0,l=>this._unloadTile(l)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ja,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const e in this._tiles){const i=this._tiles[e];if(i.state!=="loaded"&&i.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,i,s){return o._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,i,s)}catch(l){e.state="errored",l.status!==404?this._source.fire(new o.k(l,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new o.l("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const i in this._tiles){const s=this._tiles[i];s.upload(e),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(_e).map(e=>e.key)}getRenderableIds(e){const i=[];for(const s in this._tiles)this._isIdRenderable(s,e)&&i.push(this._tiles[s]);return e?i.sort((s,l)=>{const h=s.tileID,f=l.tileID,_=new o.P(h.canonical.x,h.canonical.y)._rotate(-this.transform.bearingInRadians),x=new o.P(f.canonical.x,f.canonical.y)._rotate(-this.transform.bearingInRadians);return h.overscaledZ-f.overscaledZ||x.y-_.y||x.x-_.x}).map(s=>s.tileID.key):i.map(s=>s.tileID).sort(_e).map(s=>s.key)}hasRenderableParent(e){const i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())}reload(e){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const i in this._tiles)(e||this._tiles[i].state!=="errored")&&this._reloadTile(i,"reloading")}}_reloadTile(e,i){return o._(this,void 0,void 0,function*(){const s=this._tiles[e];s&&(s.state!=="loading"&&(s.state=i),yield this._loadTile(s,e,i))})}_tileLoaded(e,i,s){e.timeAdded=Ee.now(),s==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new o.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const i=this.getRenderableIds();for(let l=0;l<i.length;l++){const h=i[l];if(e.neighboringTiles&&e.neighboringTiles[h]){const f=this.getTileByID(h);s(e,f),s(f,e)}}function s(l,h){l.needsHillshadePrepare=!0,l.needsTerrainPrepare=!0;let f=h.tileID.canonical.x-l.tileID.canonical.x;const _=h.tileID.canonical.y-l.tileID.canonical.y,x=Math.pow(2,l.tileID.canonical.z),T=h.tileID.key;f===0&&_===0||Math.abs(_)>1||(Math.abs(f)>1&&(Math.abs(f+x)===1?f+=x:Math.abs(f-x)===1&&(f-=x)),h.dem&&l.dem&&(l.dem.backfillBorder(h.dem,f,_),l.neighboringTiles&&l.neighboringTiles[T]&&(l.neighboringTiles[T].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,s,l){for(const h in this._tiles){let f=this._tiles[h];if(l[h]||!f.hasData()||f.tileID.overscaledZ<=i||f.tileID.overscaledZ>s)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>i+1;){const T=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[T.key],f&&f.hasData()&&(_=T)}let x=_;for(;x.overscaledZ>i;)if(x=x.scaledTo(x.overscaledZ-1),e[x.key]||e[x.canonical.key]){l[_.key]=_;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){const s=this._loadedParentTiles[e.key];return s&&s.tileID.overscaledZ>=i?s:null}for(let s=e.overscaledZ-1;s>=i;s--){const l=e.scaledTo(s),h=this._getLoadedTile(l);if(h)return h}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,s=Math.ceil(e.height/this._source.tileSize)+1,l=Math.floor(i*s*(this._maxTileCacheZoomLevels===null?o.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),h=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,l):l;this._cache.setMaxSize(h)}handleWrapJump(e){const i=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,i){const s={};for(const l in this._tiles){const h=this._tiles[l];h.tileID=h.tileID.unwrapTo(h.tileID.wrap+i),s[h.tileID.key]=h}this._tiles=s;for(const l in this._timers)clearTimeout(this._timers[l]),delete this._timers[l];for(const l in this._tiles)this._setTileReloadTimer(l,this._tiles[l])}}_updateCoveredAndRetainedTiles(e,i,s,l,h,f){const _={},x={},T=Object.keys(e),P=Ee.now();for(const A of T){const E=e[A],F=this._tiles[A];if(!F||F.fadeEndTime!==0&&F.fadeEndTime<=P)continue;const O=this.findLoadedParent(E,i),H=this.findLoadedSibling(E),q=O||H||null;q&&(this._addTile(q.tileID),_[q.tileID.key]=q.tileID),x[A]=E}this._retainLoadedChildren(x,l,s,e);for(const A in _)e[A]||(this._coveredTiles[A]=!0,e[A]=_[A]);if(f){const A={},E={};for(const F of h)this._tiles[F.key].hasData()?A[F.key]=F:E[F.key]=F;for(const F in E){const O=E[F].children(this._source.maxzoom);this._tiles[O[0].key]&&this._tiles[O[1].key]&&this._tiles[O[2].key]&&this._tiles[O[3].key]&&(A[O[0].key]=e[O[0].key]=O[0],A[O[1].key]=e[O[1].key]=O[1],A[O[2].key]=e[O[2].key]=O[2],A[O[3].key]=e[O[3].key]=O[3],delete E[F])}for(const F in E){const O=E[F],H=this.findLoadedParent(O,this._source.minzoom),q=this.findLoadedSibling(O),W=H||q||null;if(W){A[W.tileID.key]=e[W.tileID.key]=W.tileID;for(const K in A)A[K].isChildOf(W.tileID)&&delete A[K]}}for(const F in this._tiles)A[F]||(this._coveredTiles[F]=!0)}}update(e,i){if(!this._sourceLoaded||this._paused)return;let s;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(P=>new o.Y(P.canonical.z,P.wrap,P.canonical.z,P.canonical.x,P.canonical.y)):(s=oe(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(s=s.filter(P=>this._source.hasTile(P)))):s=[];const l=ge(e,this._source),h=Math.max(l-de.maxOverzooming,this._source.minzoom),f=Math.max(l+de.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const P={};for(const A of s)if(A.canonical.z>this._source.minzoom){const E=A.scaledTo(A.canonical.z-1);P[E.key]=E;const F=A.scaledTo(Math.max(this._source.minzoom,Math.min(A.canonical.z,5)));P[F.key]=F}s=s.concat(Object.values(P))}const _=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new o.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const x=this._updateRetainedTiles(s,l);ue(this._source.type)&&this._updateCoveredAndRetainedTiles(x,h,f,l,s,i);for(const P in x)this._tiles[P].clearFadeHold();const T=o.aj(this._tiles,x);for(const P of T){const A=this._tiles[P];A.hasSymbolBuckets&&!A.holdingForFade()?A.setHoldDuration(this.map._fadeDuration):A.hasSymbolBuckets&&!A.symbolFadeFinished()||this._removeTile(P)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,i){var s;const l={},h={},f=Math.max(i-de.maxOverzooming,this._source.minzoom),_=Math.max(i+de.maxUnderzooming,this._source.minzoom),x={};for(const T of e){const P=this._addTile(T);l[T.key]=T,P.hasData()||i<this._source.maxzoom&&(x[T.key]=T)}this._retainLoadedChildren(x,i,_,l);for(const T of e){let P=this._tiles[T.key];if(P.hasData())continue;if(i+1>this._source.maxzoom){const E=T.children(this._source.maxzoom)[0],F=this.getTile(E);if(F&&F.hasData()){l[E.key]=E;continue}}else{const E=T.children(this._source.maxzoom);if(l[E[0].key]&&l[E[1].key]&&l[E[2].key]&&l[E[3].key])continue}let A=P.wasRequested();for(let E=T.overscaledZ-1;E>=f;--E){const F=T.scaledTo(E);if(h[F.key])break;if(h[F.key]=!0,P=this.getTile(F),!P&&A&&(P=this._addTile(F)),P){const O=P.hasData();if((O||!(!((s=this.map)===null||s===void 0)&&s.cancelPendingTileRequestsWhileZooming)||A)&&(l[F.key]=F),A=P.wasRequested(),O)break}}}return l}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const i=[];let s,l=this._tiles[e].tileID;for(;l.overscaledZ>0;){if(l.key in this._loadedParentTiles){s=this._loadedParentTiles[l.key];break}i.push(l.key);const h=l.scaledTo(l.overscaledZ-1);if(s=this._getLoadedTile(h),s)break;l=h}for(const h of i)this._loadedParentTiles[h]=s}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const i=this._tiles[e].tileID,s=this._getLoadedTile(i);this._loadedSiblingTiles[i.key]=s}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const s=i;return i||(i=new In(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._tiles[e.key]=i,s||this._source.fire(new o.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const s=i.getExpiryTimeout();s&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},s))}refreshTiles(e){for(const i in this._tiles)this._isIdRenderable(i)&&e.some(s=>s.equals(this._tiles[i].tileID.canonical))&&this._reloadTile(i,"expired")}_removeTile(e){const i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&i.state!=="reloading"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(e){const i=e.sourceDataType;e.dataType==="source"&&i==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&i==="content"&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,i,s){const l=[],h=this.transform;if(!h)return l;const f=s?h.getCameraQueryGeometry(e):e,_=e.map(O=>h.screenPointToMercatorCoordinate(O,this.terrain)),x=f.map(O=>h.screenPointToMercatorCoordinate(O,this.terrain)),T=this.getIds();let P=1/0,A=1/0,E=-1/0,F=-1/0;for(const O of x)P=Math.min(P,O.x),A=Math.min(A,O.y),E=Math.max(E,O.x),F=Math.max(F,O.y);for(let O=0;O<T.length;O++){const H=this._tiles[T[O]];if(H.holdingForFade())continue;const q=h.getCoveringTilesDetailsProvider().allowWorldCopies()?H.tileID:H.tileID.unwrapTo(0),W=Math.pow(2,h.zoom-H.tileID.overscaledZ),K=i*H.queryPadding*o.Z/H.tileSize/W,te=[q.getTilePoint(new o.$(P,A)),q.getTilePoint(new o.$(E,F))];if(te[0].x-K<o.Z&&te[0].y-K<o.Z&&te[1].x+K>=0&&te[1].y+K>=0){const ee=_.map(se=>q.getTilePoint(se)),ie=x.map(se=>q.getTilePoint(se));l.push({tile:H,tileID:q,queryGeometry:ee,cameraQueryGeometry:ie,scale:W})}}return l}getVisibleCoordinates(e){const i=this.getRenderableIds(e).map(s=>this._tiles[s].tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){if(this._source.hasTransition())return!0;if(ue(this._source.type)){const e=Ee.now();for(const i in this._tiles)if(this._tiles[i].fadeEndTime>=e)return!0}return!1}setFeatureState(e,i,s){this._state.updateState(e=e||"_geojsonTileLayer",i,s)}removeFeatureState(e,i,s){this._state.removeFeatureState(e=e||"_geojsonTileLayer",i,s)}getFeatureState(e,i){return this._state.getState(e=e||"_geojsonTileLayer",i)}setDependencies(e,i,s){const l=this._tiles[e];l&&l.setDependencies(i,s)}reloadTilesForDependencies(e,i){for(const s in this._tiles)this._tiles[s].hasDependency(e,i)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(e,i))}}function _e(u,e){const i=Math.abs(2*u.wrap)-+(u.wrap<0),s=Math.abs(2*e.wrap)-+(e.wrap<0);return u.overscaledZ-e.overscaledZ||s-i||e.canonical.y-u.canonical.y||e.canonical.x-u.canonical.x}function ue(u){return u==="raster"||u==="image"||u==="video"}de.maxOverzooming=10,de.maxUnderzooming=3;class Ae{constructor(e,i){this.reset(e,i)}reset(e,i){this.points=e||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=o.ae(e,0,1);let i=1,s=this._distances[i];const l=e*this.paddedLength+this.padding;for(;s<l&&i<this._distances.length;)s=this._distances[++i];const h=i-1,f=this._distances[h],_=s-f,x=_>0?(l-f)/_:0;return this.points[h].mult(1-x).add(this.points[i].mult(x))}}function Ze(u,e){let i=!0;return u==="always"||u!=="never"&&e!=="never"||(i=!1),i}class Ve{constructor(e,i,s){const l=this.boxCells=[],h=this.circleCells=[];this.xCellCount=Math.ceil(e/s),this.yCellCount=Math.ceil(i/s);for(let f=0;f<this.xCellCount*this.yCellCount;f++)l.push([]),h.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=i,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,i,s,l,h){this._forEachCell(i,s,l,h,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(h)}insertCircle(e,i,s,l){this._forEachCell(i-l,s-l,i+l,s+l,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(i),this.circles.push(s),this.circles.push(l)}_insertBoxCell(e,i,s,l,h,f){this.boxCells[h].push(f)}_insertCircleCell(e,i,s,l,h,f){this.circleCells[h].push(f)}_query(e,i,s,l,h,f,_){if(s<0||e>this.width||l<0||i>this.height)return[];const x=[];if(e<=0&&i<=0&&this.width<=s&&this.height<=l){if(h)return[{key:null,x1:e,y1:i,x2:s,y2:l}];for(let T=0;T<this.boxKeys.length;T++)x.push({key:this.boxKeys[T],x1:this.bboxes[4*T],y1:this.bboxes[4*T+1],x2:this.bboxes[4*T+2],y2:this.bboxes[4*T+3]});for(let T=0;T<this.circleKeys.length;T++){const P=this.circles[3*T],A=this.circles[3*T+1],E=this.circles[3*T+2];x.push({key:this.circleKeys[T],x1:P-E,y1:A-E,x2:P+E,y2:A+E})}}else this._forEachCell(e,i,s,l,this._queryCell,x,{hitTest:h,overlapMode:f,seenUids:{box:{},circle:{}}},_);return x}query(e,i,s,l){return this._query(e,i,s,l,!1,null)}hitTest(e,i,s,l,h,f){return this._query(e,i,s,l,!0,h,f).length>0}hitTestCircle(e,i,s,l,h){const f=e-s,_=e+s,x=i-s,T=i+s;if(_<0||f>this.width||T<0||x>this.height)return!1;const P=[];return this._forEachCell(f,x,_,T,this._queryCellCircle,P,{hitTest:!0,overlapMode:l,circle:{x:e,y:i,radius:s},seenUids:{box:{},circle:{}}},h),P.length>0}_queryCell(e,i,s,l,h,f,_,x){const{seenUids:T,hitTest:P,overlapMode:A}=_,E=this.boxCells[h];if(E!==null){const O=this.bboxes;for(const H of E)if(!T.box[H]){T.box[H]=!0;const q=4*H,W=this.boxKeys[H];if(e<=O[q+2]&&i<=O[q+3]&&s>=O[q+0]&&l>=O[q+1]&&(!x||x(W))&&(!P||!Ze(A,W.overlapMode))&&(f.push({key:W,x1:O[q],y1:O[q+1],x2:O[q+2],y2:O[q+3]}),P))return!0}}const F=this.circleCells[h];if(F!==null){const O=this.circles;for(const H of F)if(!T.circle[H]){T.circle[H]=!0;const q=3*H,W=this.circleKeys[H];if(this._circleAndRectCollide(O[q],O[q+1],O[q+2],e,i,s,l)&&(!x||x(W))&&(!P||!Ze(A,W.overlapMode))){const K=O[q],te=O[q+1],ee=O[q+2];if(f.push({key:W,x1:K-ee,y1:te-ee,x2:K+ee,y2:te+ee}),P)return!0}}}return!1}_queryCellCircle(e,i,s,l,h,f,_,x){const{circle:T,seenUids:P,overlapMode:A}=_,E=this.boxCells[h];if(E!==null){const O=this.bboxes;for(const H of E)if(!P.box[H]){P.box[H]=!0;const q=4*H,W=this.boxKeys[H];if(this._circleAndRectCollide(T.x,T.y,T.radius,O[q+0],O[q+1],O[q+2],O[q+3])&&(!x||x(W))&&!Ze(A,W.overlapMode))return f.push(!0),!0}}const F=this.circleCells[h];if(F!==null){const O=this.circles;for(const H of F)if(!P.circle[H]){P.circle[H]=!0;const q=3*H,W=this.circleKeys[H];if(this._circlesCollide(O[q],O[q+1],O[q+2],T.x,T.y,T.radius)&&(!x||x(W))&&!Ze(A,W.overlapMode))return f.push(!0),!0}}}_forEachCell(e,i,s,l,h,f,_,x){const T=this._convertToXCellCoord(e),P=this._convertToYCellCoord(i),A=this._convertToXCellCoord(s),E=this._convertToYCellCoord(l);for(let F=T;F<=A;F++)for(let O=P;O<=E;O++)if(h.call(this,e,i,s,l,this.xCellCount*O+F,f,_,x))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,i,s,l,h,f){const _=l-e,x=h-i,T=s+f;return T*T>_*_+x*x}_circleAndRectCollide(e,i,s,l,h,f,_){const x=(f-l)/2,T=Math.abs(e-(l+x));if(T>x+s)return!1;const P=(_-h)/2,A=Math.abs(i-(h+P));if(A>P+s)return!1;if(T<=x||A<=P)return!0;const E=T-x,F=A-P;return E*E+F*F<=s*s}}function Qe(u,e,i){const s=o.K();if(!u){const{vecSouth:A,vecEast:E}=st(e),F=me();F[0]=E[0],F[1]=E[1],F[2]=A[0],F[3]=A[1],l=F,(P=(f=(h=F)[0])*(T=h[3])-(x=h[2])*(_=h[1]))&&(l[0]=T*(P=1/P),l[1]=-_*P,l[2]=-x*P,l[3]=f*P),s[0]=F[0],s[1]=F[1],s[4]=F[2],s[5]=F[3]}var l,h,f,_,x,T,P;return o.M(s,s,[1/i,1/i,1]),s}function dt(u,e,i,s){if(u){const l=o.K();if(!e){const{vecSouth:h,vecEast:f}=st(i);l[0]=f[0],l[1]=f[1],l[4]=h[0],l[5]=h[1]}return o.M(l,l,[s,s,1]),l}return i.pixelsToClipSpaceMatrix}function st(u){const e=Math.cos(u.rollInRadians),i=Math.sin(u.rollInRadians),s=Math.cos(u.pitchInRadians),l=Math.cos(u.bearingInRadians),h=Math.sin(u.bearingInRadians),f=o.ao();f[0]=-l*s*i-h*e,f[1]=-h*s*i+l*e;const _=o.ap(f);_<1e-9?o.aq(f):o.ar(f,f,1/_);const x=o.ao();x[0]=l*s*e-h*i,x[1]=h*s*e+l*i;const T=o.ap(x);return T<1e-9?o.aq(x):o.ar(x,x,1/T),{vecEast:x,vecSouth:f}}function we(u,e,i,s){let l;s?(l=[u,e,s(u,e),1],o.at(l,l,i)):(l=[u,e,0,1],ha(l,l,i));const h=l[3];return{point:new o.P(l[0]/h,l[1]/h),signedDistanceFromCamera:h,isOccluded:!1}}function Lt(u,e){return .5+u/e*.5}function Tt(u,e){return u.x>=-e[0]&&u.x<=e[0]&&u.y>=-e[1]&&u.y<=e[1]}function kt(u,e,i,s,l,h,f,_,x,T,P,A,E){const F=i?u.textSizeData:u.iconSizeData,O=o.ak(F,e.transform.zoom),H=[256/e.width*2+1,256/e.height*2+1],q=i?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;q.clear();const W=u.lineVertexArray,K=i?u.text.placedSymbolArray:u.icon.placedSymbolArray,te=e.transform.width/e.transform.height;let ee=!1;for(let ie=0;ie<K.length;ie++){const se=K.get(ie);if(se.hidden||se.writingMode===o.al.vertical&&!ee){En(se.numGlyphs,q);continue}ee=!1;const re=new o.P(se.anchorX,se.anchorY),pe={getElevation:E,pitchedLabelPlaneMatrix:s,lineVertexArray:W,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:re,unwrappedTileID:x,width:T,height:P,translation:A},Me=ft(se.anchorX,se.anchorY,pe);if(!Tt(Me.point,H)){En(se.numGlyphs,q);continue}const xe=Lt(e.transform.cameraToCenterDistance,Me.signedDistanceFromCamera),ve=o.am(F,O,se),be=h?ve*e.transform.getPitchedTextCorrection(se.anchorX,se.anchorY,x)/xe:ve*xe,Ne=it({projectionContext:pe,pitchedLabelPlaneMatrixInverse:l,symbol:se,fontSize:be,flip:!1,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:te,rotateToLine:_});ee=Ne.useVertical,(Ne.notEnoughRoom||ee||Ne.needsFlipping&&it({projectionContext:pe,pitchedLabelPlaneMatrixInverse:l,symbol:se,fontSize:be,flip:!0,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:te,rotateToLine:_}).notEnoughRoom)&&En(se.numGlyphs,q)}i?u.text.dynamicLayoutVertexBuffer.updateData(q):u.icon.dynamicLayoutVertexBuffer.updateData(q)}function at(u,e,i,s,l,h,f,_){const x=h.glyphStartIndex+h.numGlyphs,T=h.lineStartIndex,P=h.lineStartIndex+h.lineLength,A=e.getoffsetX(h.glyphStartIndex),E=e.getoffsetX(x-1),F=ua(u*A,i,s,l,h.segment,T,P,_,f);if(!F)return null;const O=ua(u*E,i,s,l,h.segment,T,P,_,f);return O?_.projectionCache.anyProjectionOccluded?null:{first:F,last:O}:null}function Ie(u,e,i,s){return u===o.al.horizontal&&Math.abs(i.y-e.y)>Math.abs(i.x-e.x)*s?{useVertical:!0}:(u===o.al.vertical?e.y<i.y:e.x>i.x)?{needsFlipping:!0}:null}function it(u){const{projectionContext:e,pitchedLabelPlaneMatrixInverse:i,symbol:s,fontSize:l,flip:h,keepUpright:f,glyphOffsetArray:_,dynamicLayoutVertexArray:x,aspectRatio:T,rotateToLine:P}=u,A=l/24,E=s.lineOffsetX*A,F=s.lineOffsetY*A;let O;if(s.numGlyphs>1){const H=s.glyphStartIndex+s.numGlyphs,q=s.lineStartIndex,W=s.lineStartIndex+s.lineLength,K=at(A,_,E,F,h,s,P,e);if(!K)return{notEnoughRoom:!0};const te=Tr(K.first.point.x,K.first.point.y,e,i),ee=Tr(K.last.point.x,K.last.point.y,e,i);if(f&&!h){const ie=Ie(s.writingMode,te,ee,T);if(ie)return ie}O=[K.first];for(let ie=s.glyphStartIndex+1;ie<H-1;ie++)O.push(ua(A*_.getoffsetX(ie),E,F,h,s.segment,q,W,e,P));O.push(K.last)}else{if(f&&!h){const q=li(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,W=s.lineStartIndex+s.segment+1,K=new o.P(e.lineVertexArray.getx(W),e.lineVertexArray.gety(W)),te=li(K.x,K.y,e),ee=te.signedDistanceFromCamera>0?te.point:pt(e.tileAnchorPoint,K,q,1,e),ie=Tr(q.x,q.y,e,i),se=Tr(ee.x,ee.y,e,i),re=Ie(s.writingMode,ie,se,T);if(re)return re}const H=ua(A*_.getoffsetX(s.glyphStartIndex),E,F,h,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,e,P);if(!H||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};O=[H]}for(const H of O)o.as(x,H.point,H.angle);return{}}function pt(u,e,i,s,l){const h=u.add(u.sub(e)._unit()),f=li(h.x,h.y,l).point,_=i.sub(f);return i.add(_._mult(s/_.mag()))}function oi(u,e,i){const s=e.projectionCache;if(s.projections[u])return s.projections[u];const l=new o.P(e.lineVertexArray.getx(u),e.lineVertexArray.gety(u)),h=li(l.x,l.y,e);if(h.signedDistanceFromCamera>0)return s.projections[u]=h.point,s.anyProjectionOccluded=s.anyProjectionOccluded||h.isOccluded,h.point;const f=u-i.direction;return pt(i.distanceFromAnchor===0?e.tileAnchorPoint:new o.P(e.lineVertexArray.getx(f),e.lineVertexArray.gety(f)),l,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,e)}function li(u,e,i){const s=u+i.translation[0],l=e+i.translation[1];let h;return i.pitchWithMap?(h=we(s,l,i.pitchedLabelPlaneMatrix,i.getElevation),h.isOccluded=!1):(h=i.transform.projectTileCoordinates(s,l,i.unwrappedTileID,i.getElevation),h.point.x=(.5*h.point.x+.5)*i.width,h.point.y=(.5*-h.point.y+.5)*i.height),h}function Tr(u,e,i,s){if(i.pitchWithMap){const l=[u,e,0,1];return o.at(l,l,s),i.transform.projectTileCoordinates(l[0]/l[3],l[1]/l[3],i.unwrappedTileID,i.getElevation).point}return{x:u/i.width*2-1,y:e/i.height*2-1}}function ft(u,e,i){return i.transform.projectTileCoordinates(u,e,i.unwrappedTileID,i.getElevation)}function Na(u,e,i){return u._unit()._perp()._mult(e*i)}function Ms(u,e,i,s,l,h,f,_,x){if(_.projectionCache.offsets[u])return _.projectionCache.offsets[u];const T=i.add(e);if(u+x.direction<s||u+x.direction>=l)return _.projectionCache.offsets[u]=T,T;const P=oi(u+x.direction,_,x),A=Na(P.sub(i),f,x.direction),E=i.add(A),F=P.add(A);return _.projectionCache.offsets[u]=o.au(h,T,E,F)||T,_.projectionCache.offsets[u]}function ua(u,e,i,s,l,h,f,_,x){const T=s?u-e:u+e;let P=T>0?1:-1,A=0;s&&(P*=-1,A=Math.PI),P<0&&(A+=Math.PI);let E,F=P>0?h+l:h+l+1;_.projectionCache.cachedAnchorPoint?E=_.projectionCache.cachedAnchorPoint:(E=li(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=E);let O,H,q=E,W=E,K=0,te=0;const ee=Math.abs(T),ie=[];let se;for(;K+te<=ee;){if(F+=P,F<h||F>=f)return null;K+=te,W=q,H=O;const Me={absOffsetX:ee,direction:P,distanceFromAnchor:K,previousVertex:W};if(q=oi(F,_,Me),i===0)ie.push(W),se=q.sub(W);else{let xe;const ve=q.sub(W);xe=ve.mag()===0?Na(oi(F+P,_,Me).sub(q),i,P):Na(ve,i,P),H||(H=W.add(xe)),O=Ms(F,xe,q,h,f,H,i,_,Me),ie.push(H),se=O.sub(H)}te=se.mag()}const re=se._mult((ee-K)/te)._add(H||W),pe=A+Math.atan2(q.y-W.y,q.x-W.x);return ie.push(re),{point:re,angle:x?pe:0,path:ie}}const Ss=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function En(u,e){for(let i=0;i<u;i++){const s=e.length;e.resize(s+4),e.float32.set(Ss,3*s)}}function ha(u,e,i){const s=e[0],l=e[1];return u[0]=i[0]*s+i[4]*l+i[12],u[1]=i[1]*s+i[5]*l+i[13],u[3]=i[3]*s+i[7]*l+i[15],u}const vi=100;class Dr{constructor(e,i=new Ve(e.width+200,e.height+200,25),s=new Ve(e.width+200,e.height+200,25)){this.transform=e,this.grid=i,this.ignoredGrid=s,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+vi,this.screenBottomBoundary=e.height+vi,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,i,s,l,h,f,_,x,T,P,A,E){const F=this.projectAndGetPerspectiveRatio(e.anchorPointX+x[0],e.anchorPointY+x[1],h,P,E),O=s*F.perspectiveRatio;let H;if(f||_)H=this._projectCollisionBox(e,O,l,h,f,_,x,F,P,A,E);else{const se=F.x+(A?A.x*O:0),re=F.y+(A?A.y*O:0);H={allPointsOccluded:!1,box:[se+e.x1*O,re+e.y1*O,se+e.x2*O,re+e.y2*O]}}const[q,W,K,te]=H.box,ee=f?H.allPointsOccluded:F.isOccluded;let ie=ee;return ie||(ie=F.perspectiveRatio<this.perspectiveRatioCutoff),ie||(ie=!this.isInsideGrid(q,W,K,te)),ie||i!=="always"&&this.grid.hitTest(q,W,K,te,i,T)?{box:[q,W,K,te],placeable:!1,offscreen:!1,occluded:ee}:{box:[q,W,K,te],placeable:!0,offscreen:this.isOffscreen(q,W,K,te),occluded:ee}}placeCollisionCircles(e,i,s,l,h,f,_,x,T,P,A,E,F,O){const H=[],q=new o.P(i.anchorX,i.anchorY),W=this.getPerspectiveRatio(q.x,q.y,f,O),K=(T?h*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,f)/W:h*W)/o.ay,te={getElevation:O,pitchedLabelPlaneMatrix:_,lineVertexArray:s,pitchWithMap:T,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:q,unwrappedTileID:f,width:this.transform.width,height:this.transform.height,translation:F},ee=at(K,l,i.lineOffsetX*K,i.lineOffsetY*K,!1,i,!1,te);let ie=!1,se=!1,re=!0;if(ee){const pe=.5*A*W+E,Me=new o.P(-100,-100),xe=new o.P(this.screenRightBoundary,this.screenBottomBoundary),ve=new Ae,be=ee.first,Ne=ee.last;let Oe=[];for(let gt=be.path.length-1;gt>=1;gt--)Oe.push(be.path[gt]);for(let gt=1;gt<Ne.path.length;gt++)Oe.push(Ne.path[gt]);const Re=2.5*pe;if(T){const gt=this.projectPathToScreenSpace(Oe,te);Oe=gt.some(Pt=>Pt.signedDistanceFromCamera<=0)?[]:gt.map(Pt=>Pt.point)}let He=[];if(Oe.length>0){const gt=Oe[0].clone(),Pt=Oe[0].clone();for(let ri=1;ri<Oe.length;ri++)gt.x=Math.min(gt.x,Oe[ri].x),gt.y=Math.min(gt.y,Oe[ri].y),Pt.x=Math.max(Pt.x,Oe[ri].x),Pt.y=Math.max(Pt.y,Oe[ri].y);He=gt.x>=Me.x&&Pt.x<=xe.x&&gt.y>=Me.y&&Pt.y<=xe.y?[Oe]:Pt.x<Me.x||gt.x>xe.x||Pt.y<Me.y||gt.y>xe.y?[]:o.av([Oe],Me.x,Me.y,xe.x,xe.y)}for(const gt of He){ve.reset(gt,.25*pe);let Pt=0;Pt=ve.length<=.5*pe?1:Math.ceil(ve.paddedLength/Re)+1;for(let ri=0;ri<Pt;ri++){const Ut=ri/Math.max(Pt-1,1),ni=ve.lerp(Ut),ai=ni.x+vi,Gt=ni.y+vi;H.push(ai,Gt,pe,0);const zt=ai-pe,Ai=Gt-pe,Bi=ai+pe,qi=Gt+pe;if(re=re&&this.isOffscreen(zt,Ai,Bi,qi),se=se||this.isInsideGrid(zt,Ai,Bi,qi),e!=="always"&&this.grid.hitTestCircle(ai,Gt,pe,e,P)&&(ie=!0,!x))return{circles:[],offscreen:!1,collisionDetected:ie}}}}return{circles:!x&&ie||!se||W<this.perspectiveRatioCutoff?[]:H,offscreen:re,collisionDetected:ie}}projectPathToScreenSpace(e,i){const s=function(l,h){const f=o.K();return o.an(f,h.pitchedLabelPlaneMatrix),l.map(_=>{const x=we(_.x,_.y,f,h.getElevation),T=h.transform.projectTileCoordinates(x.point.x,x.point.y,h.unwrappedTileID,h.getElevation);return T.point.x=(.5*T.point.x+.5)*h.width,T.point.y=(.5*-T.point.y+.5)*h.height,T})}(e,i);return function(l){let h=0,f=0,_=0,x=0;for(let T=0;T<l.length;T++)l[T].isOccluded?(_=T+1,x=0):(x++,x>f&&(f=x,h=_));return l.slice(h,h+f)}(s)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const i=[];let s=1/0,l=1/0,h=-1/0,f=-1/0;for(const P of e){const A=new o.P(P.x+vi,P.y+vi);s=Math.min(s,A.x),l=Math.min(l,A.y),h=Math.max(h,A.x),f=Math.max(f,A.y),i.push(A)}const _=this.grid.query(s,l,h,f).concat(this.ignoredGrid.query(s,l,h,f)),x={},T={};for(const P of _){const A=P.key;if(x[A.bucketInstanceId]===void 0&&(x[A.bucketInstanceId]={}),x[A.bucketInstanceId][A.featureIndex])continue;const E=[new o.P(P.x1,P.y1),new o.P(P.x2,P.y1),new o.P(P.x2,P.y2),new o.P(P.x1,P.y2)];o.aw(i,E)&&(x[A.bucketInstanceId][A.featureIndex]=!0,T[A.bucketInstanceId]===void 0&&(T[A.bucketInstanceId]=[]),T[A.bucketInstanceId].push(A.featureIndex))}return T}insertCollisionBox(e,i,s,l,h,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:l,featureIndex:h,collisionGroupID:f,overlapMode:i},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,i,s,l,h,f){const _=s?this.ignoredGrid:this.grid,x={bucketInstanceId:l,featureIndex:h,collisionGroupID:f,overlapMode:i};for(let T=0;T<e.length;T+=4)_.insertCircle(x,e[T],e[T+1],e[T+2])}projectAndGetPerspectiveRatio(e,i,s,l,h){if(h){let f;l?(f=[e,i,l(e,i),1],o.at(f,f,h)):(f=[e,i,0,1],ha(f,f,h));const _=f[3];return{x:(f[0]/_+1)/2*this.transform.width+vi,y:(-f[1]/_+1)/2*this.transform.height+vi,perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}{const f=this.transform.projectTileCoordinates(e,i,s,l);return{x:(f.point.x+1)/2*this.transform.width+vi,y:(1-f.point.y)/2*this.transform.height+vi,perspectiveRatio:.5+this.transform.cameraToCenterDistance/f.signedDistanceFromCamera*.5,isOccluded:f.isOccluded,signedDistanceFromCamera:f.signedDistanceFromCamera}}}getPerspectiveRatio(e,i,s,l){const h=this.transform.projectTileCoordinates(e,i,s,l);return .5+this.transform.cameraToCenterDistance/h.signedDistanceFromCamera*.5}isOffscreen(e,i,s,l){return s<vi||e>=this.screenRightBoundary||l<vi||i>this.screenBottomBoundary}isInsideGrid(e,i,s,l){return s>=0&&e<this.gridRightBoundary&&l>=0&&i<this.gridBottomBoundary}getViewportMatrix(){const e=o.ad([]);return o.L(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,s,l,h,f,_,x,T,P,A){let E=1,F=0,O=0,H=1;const q=e.anchorPointX+_[0],W=e.anchorPointY+_[1];if(f&&!h){const Oe=this.projectAndGetPerspectiveRatio(q+1,W,l,T,A),Re=Oe.x-x.x,He=Math.atan((Oe.y-x.y)/Re)+(Re<0?Math.PI:0),gt=Math.sin(He),Pt=Math.cos(He);E=Pt,F=gt,O=-gt,H=Pt}else if(!f&&h){const Oe=st(this.transform);E=Oe.vecEast[0],F=Oe.vecEast[1],O=Oe.vecSouth[0],H=Oe.vecSouth[1]}let K=x.x,te=x.y,ee=i;h&&(K=q,te=W,ee=Math.pow(2,-(this.transform.zoom-s.overscaledZ)),ee*=this.transform.getPitchedTextCorrection(q,W,l),P||(ee*=o.ae(.5+x.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),P&&(K+=E*P.x*ee+O*P.y*ee,te+=F*P.x*ee+H*P.y*ee);const ie=e.x1*ee,se=e.x2*ee,re=(ie+se)/2,pe=e.y1*ee,Me=e.y2*ee,xe=(pe+Me)/2,ve=[{offsetX:ie,offsetY:pe},{offsetX:re,offsetY:pe},{offsetX:se,offsetY:pe},{offsetX:se,offsetY:xe},{offsetX:se,offsetY:Me},{offsetX:re,offsetY:Me},{offsetX:ie,offsetY:Me},{offsetX:ie,offsetY:xe}];let be=[];for(const{offsetX:Oe,offsetY:Re}of ve)be.push(new o.P(K+E*Oe+O*Re,te+F*Oe+H*Re));let Ne=!1;if(h){const Oe=be.map(Re=>this.projectAndGetPerspectiveRatio(Re.x,Re.y,l,T,A));Ne=Oe.some(Re=>!Re.isOccluded),be=Oe.map(Re=>new o.P(Re.x,Re.y))}else Ne=!0;return{box:o.ax(be),allPointsOccluded:!Ne}}}class ei{constructor(e,i,s,l){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?i:-i))):l&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class Ps{constructor(e,i,s,l,h){this.text=new ei(e?e.text:null,i,s,h),this.icon=new ei(e?e.icon:null,i,l,h)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Za{constructor(e,i,s){this.text=e,this.icon=i,this.skipFade=s}}class Wl{constructor(e,i,s,l,h){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=s,this.bucketIndex=l,this.tileID=h}}class da{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const i=++this.maxGroupID;this.collisionGroups[e]={ID:i,predicate:s=>s.collisionGroupID===i}}return this.collisionGroups[e]}}function An(u,e,i,s,l){const{horizontalAlign:h,verticalAlign:f}=o.aE(u);return new o.P(-(h-.5)*e+s[0]*l,-(f-.5)*i+s[1]*l)}class Nu{constructor(e,i,s,l,h){this.transform=e.clone(),this.terrain=i,this.collisionIndex=new Dr(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new da(l),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=h,h&&(h.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const i=this.terrain;return i?(s,l)=>i.getElevation(e,s,l):null}getBucketParts(e,i,s,l){const h=s.getBucket(i),f=s.latestFeatureIndex;if(!h||!f||i.id!==h.layerIds[0])return;const _=s.collisionBoxArray,x=h.layers[0].layout,T=h.layers[0].paint,P=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),A=s.tileSize/o.Z,E=s.tileID.toUnwrapped(),F=x.get("text-rotation-alignment")==="map",O=o.az(s,1,this.transform.zoom),H=o.aA(this.collisionIndex.transform,s,T.get("text-translate"),T.get("text-translate-anchor")),q=o.aA(this.collisionIndex.transform,s,T.get("icon-translate"),T.get("icon-translate-anchor")),W=Qe(F,this.transform,O);this.retainedQueryData[h.bucketInstanceId]=new Wl(h.bucketInstanceId,f,h.sourceLayerIndex,h.index,s.tileID);const K={bucket:h,layout:x,translationText:H,translationIcon:q,unwrappedTileID:E,pitchedLabelPlaneMatrix:W,scale:P,textPixelRatio:A,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:o.ak(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(l)for(const te of h.sortKeyRanges){const{sortKey:ee,symbolInstanceStart:ie,symbolInstanceEnd:se}=te;e.push({sortKey:ee,symbolInstanceStart:ie,symbolInstanceEnd:se,parameters:K})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:K})}attemptAnchorPlacement(e,i,s,l,h,f,_,x,T,P,A,E,F,O,H,q,W,K,te,ee){const ie=o.aB[e.textAnchor],se=[e.textOffset0,e.textOffset1],re=An(ie,s,l,se,h),pe=this.collisionIndex.placeCollisionBox(i,E,x,T,P,_,f,q,A.predicate,te,re,ee);if((!K||this.collisionIndex.placeCollisionBox(K,E,x,T,P,_,f,W,A.predicate,te,re,ee).placeable)&&pe.placeable){let Me;if(this.prevPlacement&&this.prevPlacement.variableOffsets[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID].text&&(Me=this.prevPlacement.variableOffsets[F.crossTileID].anchor),F.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[F.crossTileID]={textOffset:se,width:s,height:l,anchor:ie,textBoxScale:h,prevAnchor:Me},this.markUsedJustification(O,ie,F,H),O.allowVerticalPlacement&&(this.markUsedOrientation(O,H,F),this.placedOrientations[F.crossTileID]=H),{shift:re,placedGlyphBoxes:pe}}}placeLayerBucketPart(e,i,s){const{bucket:l,layout:h,translationText:f,translationIcon:_,unwrappedTileID:x,pitchedLabelPlaneMatrix:T,textPixelRatio:P,holdingForFade:A,collisionBoxArray:E,partiallyEvaluatedTextSize:F,collisionGroup:O}=e.parameters,H=h.get("text-optional"),q=h.get("icon-optional"),W=o.aC(h,"text-overlap","text-allow-overlap"),K=W==="always",te=o.aC(h,"icon-overlap","icon-allow-overlap"),ee=te==="always",ie=h.get("text-rotation-alignment")==="map",se=h.get("text-pitch-alignment")==="map",re=h.get("icon-text-fit")!=="none",pe=h.get("symbol-z-order")==="viewport-y",Me=K&&(ee||!l.hasIconData()||q),xe=ee&&(K||!l.hasTextData()||H);!l.collisionArrays&&E&&l.deserializeCollisionBoxes(E);const ve=this.retainedQueryData[l.bucketInstanceId].tileID,be=this._getTerrainElevationFunc(ve),Ne=this.transform.getFastPathSimpleProjectionMatrix(ve),Oe=(Re,He,gt)=>{var Pt,ri;if(i[Re.crossTileID])return;if(A)return void(this.placements[Re.crossTileID]=new Za(!1,!1,!1));let Ut=!1,ni=!1,ai=!0,Gt=null,zt={box:null,placeable:!1,offscreen:null,occluded:!1},Ai={placeable:!1},Bi=null,qi=null,Rt=null,Kn=0,_n=0,Yn=0;He.textFeatureIndex?Kn=He.textFeatureIndex:Re.useRuntimeCollisionCircles&&(Kn=Re.featureIndex),He.verticalTextFeatureIndex&&(_n=He.verticalTextFeatureIndex);const Pa=He.textBox;if(Pa){const Fr=Mi=>{let Si=o.al.horizontal;if(l.allowVerticalPlacement&&!Mi&&this.prevPlacement){const fr=this.prevPlacement.placedOrientations[Re.crossTileID];fr&&(this.placedOrientations[Re.crossTileID]=fr,Si=fr,this.markUsedOrientation(l,Si,Re))}return Si},Qn=(Mi,Si)=>{if(l.allowVerticalPlacement&&Re.numVerticalGlyphVertices>0&&He.verticalTextBox){for(const fr of l.writingModes)if(fr===o.al.vertical?(zt=Si(),Ai=zt):zt=Mi(),zt&&zt.placeable)break}else zt=Mi()},Rn=Re.textAnchorOffsetStartIndex,ea=Re.textAnchorOffsetEndIndex;if(ea===Rn){const Mi=(Si,fr)=>{const Kt=this.collisionIndex.placeCollisionBox(Si,W,P,ve,x,se,ie,f,O.predicate,be,void 0,Ne);return Kt&&Kt.placeable&&(this.markUsedOrientation(l,fr,Re),this.placedOrientations[Re.crossTileID]=fr),Kt};Qn(()=>Mi(Pa,o.al.horizontal),()=>{const Si=He.verticalTextBox;return l.allowVerticalPlacement&&Re.numVerticalGlyphVertices>0&&Si?Mi(Si,o.al.vertical):{box:null,offscreen:null}}),Fr(zt&&zt.placeable)}else{let Mi=o.aB[(ri=(Pt=this.prevPlacement)===null||Pt===void 0?void 0:Pt.variableOffsets[Re.crossTileID])===null||ri===void 0?void 0:ri.anchor];const Si=(Kt,hl,kh)=>{const zh=Kt.x2-Kt.x1,Jd=Kt.y2-Kt.y1,Oc=Re.textBoxScale,no=re&&te==="never"?hl:null;let Hr=null,yn=W==="never"?1:2,Wr="never";Mi&&yn++;for(let Dn=0;Dn<yn;Dn++){for(let dl=Rn;dl<ea;dl++){const ta=l.textAnchorOffsets.get(dl);if(Mi&&ta.textAnchor!==Mi)continue;const jc=this.attemptAnchorPlacement(ta,Kt,zh,Jd,Oc,ie,se,P,ve,x,O,Wr,Re,l,kh,f,_,no,be);if(jc&&(Hr=jc.placedGlyphBoxes,Hr&&Hr.placeable))return Ut=!0,Gt=jc.shift,Hr}Mi?Mi=null:Wr=W}return s&&!Hr&&(Hr={box:this.collisionIndex.placeCollisionBox(Pa,"always",P,ve,x,se,ie,f,O.predicate,be,void 0,Ne).box,offscreen:!1,placeable:!1,occluded:!1}),Hr};Qn(()=>Si(Pa,He.iconBox,o.al.horizontal),()=>{const Kt=He.verticalTextBox;return l.allowVerticalPlacement&&(!zt||!zt.placeable)&&Re.numVerticalGlyphVertices>0&&Kt?Si(Kt,He.verticalIconBox,o.al.vertical):{box:null,occluded:!0,offscreen:null}}),zt&&(Ut=zt.placeable,ai=zt.offscreen);const fr=Fr(zt&&zt.placeable);if(!Ut&&this.prevPlacement){const Kt=this.prevPlacement.variableOffsets[Re.crossTileID];Kt&&(this.variableOffsets[Re.crossTileID]=Kt,this.markUsedJustification(l,Kt.anchor,Re,fr))}}}if(Bi=zt,Ut=Bi&&Bi.placeable,ai=Bi&&Bi.offscreen,Re.useRuntimeCollisionCircles){const Fr=l.text.placedSymbolArray.get(Re.centerJustifiedTextSymbolIndex),Qn=o.am(l.textSizeData,F,Fr),Rn=h.get("text-padding");qi=this.collisionIndex.placeCollisionCircles(W,Fr,l.lineVertexArray,l.glyphOffsetArray,Qn,x,T,s,se,O.predicate,Re.collisionCircleDiameter,Rn,f,be),qi.circles.length&&qi.collisionDetected&&!s&&o.w("Collisions detected, but collision boxes are not shown"),Ut=K||qi.circles.length>0&&!qi.collisionDetected,ai=ai&&qi.offscreen}if(He.iconFeatureIndex&&(Yn=He.iconFeatureIndex),He.iconBox){const Fr=Qn=>this.collisionIndex.placeCollisionBox(Qn,te,P,ve,x,se,ie,_,O.predicate,be,re&&Gt?Gt:void 0,Ne);Ai&&Ai.placeable&&He.verticalIconBox?(Rt=Fr(He.verticalIconBox),ni=Rt.placeable):(Rt=Fr(He.iconBox),ni=Rt.placeable),ai=ai&&Rt.offscreen}const ro=H||Re.numHorizontalGlyphVertices===0&&Re.numVerticalGlyphVertices===0,Jn=q||Re.numIconVertices===0;ro||Jn?Jn?ro||(ni=ni&&Ut):Ut=ni&&Ut:ni=Ut=ni&&Ut;const Ca=ni&&Rt.placeable;if(Ut&&Bi.placeable&&this.collisionIndex.insertCollisionBox(Bi.box,W,h.get("text-ignore-placement"),l.bucketInstanceId,Ai&&Ai.placeable&&_n?_n:Kn,O.ID),Ca&&this.collisionIndex.insertCollisionBox(Rt.box,te,h.get("icon-ignore-placement"),l.bucketInstanceId,Yn,O.ID),qi&&Ut&&this.collisionIndex.insertCollisionCircles(qi.circles,W,h.get("text-ignore-placement"),l.bucketInstanceId,Kn,O.ID),s&&this.storeCollisionData(l.bucketInstanceId,gt,He,Bi,Rt,qi),Re.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(l.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Re.crossTileID]=new Za((Ut||Me)&&!(Bi!=null&&Bi.occluded),(ni||xe)&&!(Rt!=null&&Rt.occluded),ai||l.justReloaded),i[Re.crossTileID]=!0};if(pe){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Re=l.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let He=Re.length-1;He>=0;--He){const gt=Re[He];Oe(l.symbolInstances.get(gt),l.collisionArrays[gt],gt)}}else for(let Re=e.symbolInstanceStart;Re<e.symbolInstanceEnd;Re++)Oe(l.symbolInstances.get(Re),l.collisionArrays[Re],Re);l.justReloaded=!1}storeCollisionData(e,i,s,l,h,f){if(s.textBox||s.iconBox){let _,x;this.collisionBoxArrays.has(e)?_=this.collisionBoxArrays.get(e):(_=new Map,this.collisionBoxArrays.set(e,_)),_.has(i)?x=_.get(i):(x={text:null,icon:null},_.set(i,x)),s.textBox&&(x.text=l.box),s.iconBox&&(x.icon=h.box)}if(f){let _=this.collisionCircleArrays[e];_===void 0&&(_=this.collisionCircleArrays[e]=[]);for(let x=0;x<f.circles.length;x+=4)_.push(f.circles[x+0]-vi),_.push(f.circles[x+1]-vi),_.push(f.circles[x+2]),_.push(f.collisionDetected?1:0)}}markUsedJustification(e,i,s,l){let h;h=l===o.al.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[o.aD(i)];const f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const _ of f)_>=0&&(e.text.placedSymbolArray.get(_).crossTileID=h>=0&&_!==h?0:s.crossTileID)}markUsedOrientation(e,i,s){const l=i===o.al.horizontal||i===o.al.horizontalOnly?i:0,h=i===o.al.vertical?i:0,f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of f)e.text.placedSymbolArray.get(_).placedOrientation=l;s.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=h)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const i=this.prevPlacement;let s=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;const l=i?i.symbolFadeChange(e):1,h=i?i.opacities:{},f=i?i.variableOffsets:{},_=i?i.placedOrientations:{};for(const x in this.placements){const T=this.placements[x],P=h[x];P?(this.opacities[x]=new Ps(P,l,T.text,T.icon),s=s||T.text!==P.text.placed||T.icon!==P.icon.placed):(this.opacities[x]=new Ps(null,l,T.text,T.icon,T.skipFade),s=s||T.text||T.icon)}for(const x in h){const T=h[x];if(!this.opacities[x]){const P=new Ps(T,l,!1,!1);P.isHidden()||(this.opacities[x]=P,s=s||T.text.placed||T.icon.placed)}}for(const x in f)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=f[x]);for(const x in _)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=_[x]);if(i&&i.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:e)}updateLayerOpacities(e,i){const s={};for(const l of i){const h=l.getBucket(e);h&&l.latestFeatureIndex&&e.id===h.layerIds[0]&&this.updateBucketOpacities(h,l.tileID,s,l.collisionBoxArray)}}updateBucketOpacities(e,i,s,l){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const h=e.layers[0],f=h.layout,_=new Ps(null,0,!1,!1,!0),x=f.get("text-allow-overlap"),T=f.get("icon-allow-overlap"),P=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),A=f.get("text-rotation-alignment")==="map",E=f.get("text-pitch-alignment")==="map",F=f.get("icon-text-fit")!=="none",O=new Ps(null,0,x&&(T||!e.hasIconData()||f.get("icon-optional")),T&&(x||!e.hasTextData()||f.get("text-optional")),!0);!e.collisionArrays&&l&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(l);const H=(W,K,te)=>{for(let ee=0;ee<K/4;ee++)W.opacityVertexArray.emplaceBack(te);W.hasVisibleVertices=W.hasVisibleVertices||te!==pa},q=this.collisionBoxArrays.get(e.bucketInstanceId);for(let W=0;W<e.symbolInstances.length;W++){const K=e.symbolInstances.get(W),{numHorizontalGlyphVertices:te,numVerticalGlyphVertices:ee,crossTileID:ie}=K;let se=this.opacities[ie];s[ie]?se=_:se||(se=O,this.opacities[ie]=se),s[ie]=!0;const re=K.numIconVertices>0,pe=this.placedOrientations[K.crossTileID],Me=pe===o.al.vertical,xe=pe===o.al.horizontal||pe===o.al.horizontalOnly;if(te>0||ee>0){const be=Kl(se.text);H(e.text,te,Me?pa:be),H(e.text,ee,xe?pa:be);const Ne=se.text.isHidden();[K.rightJustifiedTextSymbolIndex,K.centerJustifiedTextSymbolIndex,K.leftJustifiedTextSymbolIndex].forEach(He=>{He>=0&&(e.text.placedSymbolArray.get(He).hidden=Ne||Me?1:0)}),K.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(K.verticalPlacedTextSymbolIndex).hidden=Ne||xe?1:0);const Oe=this.variableOffsets[K.crossTileID];Oe&&this.markUsedJustification(e,Oe.anchor,K,pe);const Re=this.placedOrientations[K.crossTileID];Re&&(this.markUsedJustification(e,"left",K,Re),this.markUsedOrientation(e,Re,K))}if(re){const be=Kl(se.icon),Ne=!(F&&K.verticalPlacedIconSymbolIndex&&Me);K.placedIconSymbolIndex>=0&&(H(e.icon,K.numIconVertices,Ne?be:pa),e.icon.placedSymbolArray.get(K.placedIconSymbolIndex).hidden=se.icon.isHidden()),K.verticalPlacedIconSymbolIndex>=0&&(H(e.icon,K.numVerticalIconVertices,Ne?pa:be),e.icon.placedSymbolArray.get(K.verticalPlacedIconSymbolIndex).hidden=se.icon.isHidden())}const ve=q&&q.has(W)?q.get(W):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const be=e.collisionArrays[W];if(be){let Ne=new o.P(0,0);if(be.textBox||be.verticalTextBox){let Oe=!0;if(P){const Re=this.variableOffsets[ie];Re?(Ne=An(Re.anchor,Re.width,Re.height,Re.textOffset,Re.textBoxScale),A&&Ne._rotate(E?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Oe=!1}if(be.textBox||be.verticalTextBox){let Re;be.textBox&&(Re=Me),be.verticalTextBox&&(Re=xe),Xl(e.textCollisionBox.collisionVertexArray,se.text.placed,!Oe||Re,ve.text,Ne.x,Ne.y)}}if(be.iconBox||be.verticalIconBox){const Oe=!!(!xe&&be.verticalIconBox);let Re;be.iconBox&&(Re=Oe),be.verticalIconBox&&(Re=!Oe),Xl(e.iconCollisionBox.collisionVertexArray,se.icon.placed,Re,ve.icon,F?Ne.x:0,F?Ne.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,i){const s=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*s>e}setStale(){this.stale=!0}}function Xl(u,e,i,s,l,h){s&&s.length!==0||(s=[0,0,0,0]);const f=s[0]-vi,_=s[1]-vi,x=s[2]-vi,T=s[3]-vi;u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,x,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,x,T),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,T)}const Zu=Math.pow(2,25),Va=Math.pow(2,24),Vu=Math.pow(2,17),Sd=Math.pow(2,16),Pd=Math.pow(2,9),Cd=Math.pow(2,8),Uu=Math.pow(2,1);function Kl(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const e=u.placed?1:0,i=Math.floor(127*u.opacity);return i*Zu+e*Va+i*Vu+e*Sd+i*Pd+e*Cd+i*Uu+e}const pa=0;class Yl{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,i,s,l,h){const f=this._bucketParts;for(;this._currentTileIndex<e.length;)if(i.getBucketParts(f,l,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,h())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,f.sort((_,x)=>_.sortKey-x.sortKey));this._currentPartIndex<f.length;)if(i.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,h())return!0;return!1}}class $u{constructor(e,i,s,l,h,f,_,x){this.placement=new Nu(e,i,f,_,x),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=l,this._showCollisionBoxes=h,this._done=!1}isDone(){return this._done}continuePlacement(e,i,s){const l=Ee.now(),h=()=>!this._forceFullPlacement&&Ee.now()-l>2;for(;this._currentPlacementIndex>=0;){const f=i[e[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=_)&&(!f.maxzoom||f.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new Yl(f)),this._inProgressLayer.continuePlacement(s[f.source],this.placement,this._showCollisionBoxes,f,h))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const fa=512/o.Z/2;class Jl{constructor(e,i,s){this.tileID=e,this.bucketInstanceId=s,this._symbolsByKey={};const l=new Map;for(let h=0;h<i.length;h++){const f=i.get(h),_=f.key,x=l.get(_);x?x.push(f):l.set(_,[f])}for(const[h,f]of l){const _={positions:f.map(x=>({x:Math.floor(x.anchorX*fa),y:Math.floor(x.anchorY*fa)})),crossTileIDs:f.map(x=>x.crossTileID)};if(_.positions.length>128){const x=new o.aF(_.positions.length,16,Uint16Array);for(const{x:T,y:P}of _.positions)x.add(T,P);x.finish(),delete _.positions,_.index=x}this._symbolsByKey[h]=_}}getScaledCoordinates(e,i){const{x:s,y:l,z:h}=this.tileID.canonical,{x:f,y:_,z:x}=i.canonical,T=fa/Math.pow(2,x-h),P=(_*o.Z+e.anchorY)*T,A=l*o.Z*fa;return{x:Math.floor((f*o.Z+e.anchorX)*T-s*o.Z*fa),y:Math.floor(P-A)}}findMatches(e,i,s){const l=this.tileID.canonical.z<i.canonical.z?1:Math.pow(2,this.tileID.canonical.z-i.canonical.z);for(let h=0;h<e.length;h++){const f=e.get(h);if(f.crossTileID)continue;const _=this._symbolsByKey[f.key];if(!_)continue;const x=this.getScaledCoordinates(f,i);if(_.index){const T=_.index.range(x.x-l,x.y-l,x.x+l,x.y+l).sort();for(const P of T){const A=_.crossTileIDs[P];if(!s[A]){s[A]=!0,f.crossTileID=A;break}}}else if(_.positions)for(let T=0;T<_.positions.length;T++){const P=_.positions[T],A=_.crossTileIDs[T];if(Math.abs(P.x-x.x)<=l&&Math.abs(P.y-x.y)<=l&&!s[A]){s[A]=!0,f.crossTileID=A;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class Id{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Cs{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const i=Math.round((e-this.lng)/360);if(i!==0)for(const s in this.indexes){const l=this.indexes[s],h={};for(const f in l){const _=l[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+i),h[_.tileID.key]=_}this.indexes[s]=h}this.lng=e}addBucket(e,i,s){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let h=0;h<i.symbolInstances.length;h++)i.symbolInstances.get(h).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const l=this.usedCrossTileIDs[e.overscaledZ];for(const h in this.indexes){const f=this.indexes[h];if(Number(h)>e.overscaledZ)for(const _ in f){const x=f[_];x.tileID.isChildOf(e)&&x.findMatches(i.symbolInstances,e,l)}else{const _=f[e.scaledTo(Number(h)).key];_&&_.findMatches(i.symbolInstances,e,l)}}for(let h=0;h<i.symbolInstances.length;h++){const f=i.symbolInstances.get(h);f.crossTileID||(f.crossTileID=s.generate(),l[f.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Jl(e,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(e,i){for(const s of i.getCrossTileIDsLists())for(const l of s)delete this.usedCrossTileIDs[e][l]}removeStaleBuckets(e){let i=!1;for(const s in this.indexes){const l=this.indexes[s];for(const h in l)e[l[h].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,l[h]),delete l[h],i=!0)}return i}}class Is{constructor(){this.layerIndexes={},this.crossTileIDs=new Id,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,s){let l=this.layerIndexes[e.id];l===void 0&&(l=this.layerIndexes[e.id]=new Cs);let h=!1;const f={};l.handleWrapJump(s);for(const _ of i){const x=_.getBucket(e);x&&e.id===x.layerIds[0]&&(x.bucketInstanceId||(x.bucketInstanceId=++this.maxBucketInstanceId),l.addBucket(_.tileID,x,this.crossTileIDs)&&(h=!0),f[x.bucketInstanceId]=!0)}return l.removeStaleBuckets(f)&&(h=!0),h}pruneUnusedLayers(e){const i={};e.forEach(s=>{i[s]=!0});for(const s in this.layerIndexes)i[s]||delete this.layerIndexes[s]}}var Ql="void main() {fragColor=vec4(1.0);}";const ur={prelude:Ct(`#ifdef GL_ES
5
+ */var ny=Iu.exports,Bf;function ay(){return Bf||(Bf=1,function(v,g){(function(b,I){v.exports=I()})(ny,function(){var b={},I={};function z(S,o,he){if(I[S]=he,S==="index"){var me="var sharedModule = {}; ("+I.shared+")(sharedModule); ("+I.worker+")(sharedModule);",Pe={};return I.shared(Pe),I.index(b,Pe),typeof window<"u"&&b.setWorkerUrl(window.URL.createObjectURL(new Blob([me],{type:"text/javascript"}))),b}}z("shared",["exports"],function(S){function o(n,t,r,a){return new(r||(r=Promise))(function(c,d){function p(w){try{y(a.next(w))}catch(M){d(M)}}function m(w){try{y(a.throw(w))}catch(M){d(M)}}function y(w){var M;w.done?c(w.value):(M=w.value,M instanceof r?M:new r(function(C){C(M)})).then(p,m)}y((a=a.apply(n,t||[])).next())})}function he(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var me,Pe;function Be(){if(Pe)return me;function n(t,r){this.x=t,this.y=r}return Pe=1,me=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,r){return this.clone()._rotateAround(t,r)},matMult:function(t){return this.clone()._matMult(t)},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(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var r=t.x-this.x,a=t.y-this.y;return r*r+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,r){return Math.atan2(this.x*r-this.y*t,this.x*t+this.y*r)},_matMult:function(t){var r=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var r=Math.cos(t),a=Math.sin(t),c=a*this.x+r*this.y;return this.x=r*this.x-a*this.y,this.y=c,this},_rotateAround:function(t,r){var a=Math.cos(t),c=Math.sin(t),d=r.y+c*(this.x-r.x)+a*(this.y-r.y);return this.x=r.x+a*(this.x-r.x)-c*(this.y-r.y),this.y=d,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t},me}typeof SuppressedError=="function"&&SuppressedError;var Ee,le,Fe=he(Be()),Bt=function(){if(le)return Ee;function n(t,r,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(c-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=a,this.p2y=c}return le=1,Ee=n,n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var a=t,c=0;c<8;c++){var d=this.sampleCurveX(a)-t;if(Math.abs(d)<r)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var m=0,y=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<r));c++)t>d?m=a:y=a,a=.5*(y-m)+m;return a},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},Ee}(),fi=he(Bt);let ti,yi;function Ki(){return ti==null&&(ti=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ti}function Ft(){if(yi==null&&(yi=!1,Ki())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let a=0;a<5*5;a++){const c=4*a;t.fillStyle=`rgb(${c},${c+1},${c+2})`,t.fillRect(a%5,Math.floor(a/5),1,1)}const r=t.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&r[a]!==a){yi=!0;break}}}return yi||!1}var It=1e-6,$t=typeof Float32Array<"u"?Float32Array:Array;function _r(){var n=new $t(9);return $t!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[5]=0,n[6]=0,n[7]=0),n[0]=1,n[4]=1,n[8]=1,n}function jt(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function Tn(){var n=new $t(3);return $t!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function Mn(n){return Math.hypot(n[0],n[1],n[2])}function Yi(n,t,r){var a=new $t(3);return a[0]=n,a[1]=t,a[2]=r,a}Math.hypot||(Math.hypot=function(){for(var n=0,t=arguments.length;t--;)n+=arguments[t]*arguments[t];return Math.sqrt(n)});var ar,Ji=Mn;function ot(n,t,r){var a=t[0],c=t[1],d=t[2],p=t[3];return n[0]=r[0]*a+r[4]*c+r[8]*d+r[12]*p,n[1]=r[1]*a+r[5]*c+r[9]*d+r[13]*p,n[2]=r[2]*a+r[6]*c+r[10]*d+r[14]*p,n[3]=r[3]*a+r[7]*c+r[11]*d+r[15]*p,n}function Vi(){var n=new $t(4);return $t!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n[3]=1,n}function xi(){var n=new $t(2);return $t!=Float32Array&&(n[0]=0,n[1]=0),n}function yr(n,t){var r=new $t(2);return r[0]=n,r[1]=t,r}Tn(),ar=new $t(4),$t!=Float32Array&&(ar[0]=0,ar[1]=0,ar[2]=0,ar[3]=0),Tn(),Yi(1,0,0),Yi(0,1,0),Vi(),Vi(),_r(),xi();const Et=8192;function Ar(n,t,r){return t*(Et/(n.tileSize*Math.pow(2,r-n.tileID.overscaledZ)))}function sr(n,t){return(n%t+t)%t}function cn(n,t,r){return n*(1-r)+t*r}function kr(n){if(n<=0)return 0;if(n>=1)return 1;const t=n*n,r=t*n;return 4*(n<.5?r:3*(n-t)+r-.75)}function la(n,t,r,a){const c=new fi(n,t,r,a);return d=>c.solve(d)}const xr=la(.25,.1,.25,1);function Ht(n,t,r){return Math.min(r,Math.max(t,n))}function vr(n,t,r){const a=r-t,c=((n-t)%a+a)%a+t;return c===t?r:c}function Qi(n,...t){for(const r of t)for(const a in r)n[a]=r[a];return n}let Sn=1;function un(n,t,r){const a={};for(const c in n)a[c]=t.call(this,n[c],c,n);return a}function ca(n,t,r){const a={};for(const c in n)t.call(this,n[c],c,n)&&(a[c]=n[c]);return a}function or(n){return Array.isArray(n)?n.map(or):typeof n=="object"&&n?un(n,or):n}const lr={};function Ui(n){lr[n]||(typeof console<"u"&&console.warn(n),lr[n]=!0)}function Zt(n,t,r){return(r.y-n.y)*(t.x-n.x)>(t.y-n.y)*(r.x-n.x)}function Vr(n){return typeof WorkerGlobalScope<"u"&&n!==void 0&&n instanceof WorkerGlobalScope}let hn=null;function br(n){return typeof ImageBitmap<"u"&&n instanceof ImageBitmap}const Pn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Cn(n,t,r,a,c){return o(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(n,{timestamp:0});try{const p=d==null?void 0:d.format;if(!p||!p.startsWith("BGR")&&!p.startsWith("RGB"))throw new Error(`Unrecognized format ${p}`);const m=p.startsWith("BGR"),y=new Uint8ClampedArray(a*c*4);if(yield d.copyTo(y,function(w,M,C,k,D){const L=4*Math.max(1,0),j=(Math.max(0,C)-C)*k*4+L,U=4*k,X=Math.max(0,M),ne=Math.max(0,C);return{rect:{x:X,y:ne,width:Math.min(w.width,M+k)-X,height:Math.min(w.height,C+D)-ne},layout:[{offset:j,stride:U}]}}(n,t,r,a,c)),m)for(let w=0;w<y.length;w+=4){const M=y[w];y[w]=y[w+2],y[w+2]=M}return y}finally{d.close()}})}let Ce,Ye;function Ue(n,t,r,a){return n.addEventListener(t,r,a),{unsubscribe:()=>{n.removeEventListener(t,r,a)}}}function _t(n){return n*Math.PI/180}function Nt(n){return n/Math.PI*180}const cr={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},mi={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},zr="AbortError";function Rr(){return new Error(zr)}const In={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function qn(n){return In.REGISTERED_PROTOCOLS[n.substring(0,n.indexOf("://"))]}const ja="global-dispatcher";class Ur extends Error{constructor(t,r,a,c){super(`AJAXError: ${r} (${t}): ${a}`),this.status=t,this.statusText=r,this.url=a,this.body=c}}const wr=()=>Vr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,dn=function(n,t){if(/:\/\//.test(n.url)&&!/^https?:|^file:/.test(n.url)){const a=qn(n.url);if(a)return a(n,t);if(Vr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,targetMapId:ja},t)}if(!(/^file:/.test(r=n.url)||/^file:/.test(wr())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(a,c){return o(this,void 0,void 0,function*(){const d=new Request(a.url,{method:a.method||"GET",body:a.body,credentials:a.credentials,headers:a.headers,cache:a.cache,referrer:wr(),signal:c.signal});let p,m;a.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");try{p=yield fetch(d)}catch(w){throw new Ur(0,w.message,a.url,new Blob)}if(!p.ok){const w=yield p.blob();throw new Ur(p.status,p.statusText,a.url,w)}m=a.type==="arrayBuffer"||a.type==="image"?p.arrayBuffer():a.type==="json"?p.json():p.text();const y=yield m;if(c.signal.aborted)throw Rr();return{data:y,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(n,t);if(Vr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,mustQueue:!0,targetMapId:ja},t)}var r;return function(a,c){return new Promise((d,p)=>{var m;const y=new XMLHttpRequest;y.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(y.responseType="arraybuffer");for(const w in a.headers)y.setRequestHeader(w,a.headers[w]);a.type==="json"&&(y.responseType="text",!((m=a.headers)===null||m===void 0)&&m.Accept||y.setRequestHeader("Accept","application/json")),y.withCredentials=a.credentials==="include",y.onerror=()=>{p(new Error(y.statusText))},y.onload=()=>{if(!c.signal.aborted)if((y.status>=200&&y.status<300||y.status===0)&&y.response!==null){let w=y.response;if(a.type==="json")try{w=JSON.parse(y.response)}catch(M){return void p(M)}d({data:w,cacheControl:y.getResponseHeader("Cache-Control"),expires:y.getResponseHeader("Expires")})}else{const w=new Blob([y.response],{type:y.getResponseHeader("Content-Type")});p(new Ur(y.status,y.statusText,a.url,w))}},c.signal.addEventListener("abort",()=>{y.abort(),p(Rr())}),y.send(a.body)})}(n,t)};function ce(n){if(!n||n.indexOf("://")<=0||n.indexOf("data:image/")===0||n.indexOf("blob:")===0)return!0;const t=new URL(n),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function N(n,t,r){r[n]&&r[n].indexOf(t)!==-1||(r[n]=r[n]||[],r[n].push(t))}function Z(n,t,r){if(r&&r[n]){const a=r[n].indexOf(t);a!==-1&&r[n].splice(a,1)}}class G{constructor(t,r={}){Qi(this,r),this.type=t}}class J extends G{constructor(t,r={}){super("error",Qi({error:t},r))}}class ae{on(t,r){return this._listeners=this._listeners||{},N(t,r,this._listeners),{unsubscribe:()=>{this.off(t,r)}}}off(t,r){return Z(t,r,this._listeners),Z(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},N(t,r,this._oneTimeListeners),this):new Promise(a=>this.once(t,a))}fire(t,r){typeof t=="string"&&(t=new G(t,r||{}));const a=t.type;if(this.listens(a)){t.target=this;const c=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const m of c)m.call(this,t);const d=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const m of d)Z(a,m,this._oneTimeListeners),m.call(this,t);const p=this._eventedParent;p&&(Qi(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(t))}else t instanceof J&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var $={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{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_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},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:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const ge=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function oe(n,t){const r={};for(const a in n)a!=="ref"&&(r[a]=n[a]);return ge.forEach(a=>{a in t&&(r[a]=t[a])}),r}function de(n,t){if(Array.isArray(n)){if(!Array.isArray(t)||n.length!==t.length)return!1;for(let r=0;r<n.length;r++)if(!de(n[r],t[r]))return!1;return!0}if(typeof n=="object"&&n!==null&&t!==null){if(typeof t!="object"||Object.keys(n).length!==Object.keys(t).length)return!1;for(const r in n)if(!de(n[r],t[r]))return!1;return!0}return n===t}function _e(n,t){n.push(t)}function ue(n,t,r){_e(r,{command:"addSource",args:[n,t[n]]})}function Ae(n,t,r){_e(t,{command:"removeSource",args:[n]}),r[n]=!0}function Ze(n,t,r,a){Ae(n,r,a),ue(n,t,r)}function Ve(n,t,r){let a;for(a in n[r])if(Object.prototype.hasOwnProperty.call(n[r],a)&&a!=="data"&&!de(n[r][a],t[r][a]))return!1;for(a in t[r])if(Object.prototype.hasOwnProperty.call(t[r],a)&&a!=="data"&&!de(n[r][a],t[r][a]))return!1;return!0}function Qe(n,t,r,a,c,d){n=n||{},t=t||{};for(const p in n)Object.prototype.hasOwnProperty.call(n,p)&&(de(n[p],t[p])||r.push({command:d,args:[a,p,t[p],c]}));for(const p in t)Object.prototype.hasOwnProperty.call(t,p)&&!Object.prototype.hasOwnProperty.call(n,p)&&(de(n[p],t[p])||r.push({command:d,args:[a,p,t[p],c]}))}function dt(n){return n.id}function at(n,t){return n[t.id]=t,n}class we{constructor(t,r,a,c){this.message=(t?`${t}: `:"")+a,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Lt(n,...t){for(const r of t)for(const a in r)n[a]=r[a];return n}class Tt extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class kt{constructor(t,r=[]){this.parent=t,this.bindings={};for(const[a,c]of r)this.bindings[a]=c}concat(t){return new kt(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const nt={kind:"null"},Ie={kind:"number"},it={kind:"string"},pt={kind:"boolean"},oi={kind:"color"},li={kind:"projectionDefinition"},Tr={kind:"object"},ft={kind:"value"},Na={kind:"collator"},Ms={kind:"formatted"},ua={kind:"padding"},Ss={kind:"colorArray"},En={kind:"numberArray"},ha={kind:"resolvedImage"},vi={kind:"variableAnchorOffsetCollection"};function Dr(n,t){return{kind:"array",itemType:n,N:t}}function ei(n){if(n.kind==="array"){const t=ei(n.itemType);return typeof n.N=="number"?`array<${t}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${t}>`}return n.kind}const Ps=[nt,Ie,it,pt,oi,li,Ms,Tr,Dr(ft),ua,En,Ss,ha,vi];function Za(n,t){if(t.kind==="error")return null;if(n.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Za(n.itemType,t.itemType))&&(typeof n.N!="number"||n.N===t.N))return null}else{if(n.kind===t.kind)return null;if(n.kind==="value"){for(const r of Ps)if(!Za(r,t))return null}}return`Expected ${ei(n)} but found ${ei(t)} instead.`}function Wl(n,t){return t.some(r=>r.kind===n.kind)}function da(n,t){return t.some(r=>r==="null"?n===null:r==="array"?Array.isArray(n):r==="object"?n&&!Array.isArray(n)&&typeof n=="object":r===typeof n)}function An(n,t){return n.kind==="array"&&t.kind==="array"?n.itemType.kind===t.itemType.kind&&typeof n.N=="number":n.kind===t.kind}const Nu=.96422,Xl=.82521,Zu=4/29,Va=6/29,Vu=3*Va*Va,Sd=Va*Va*Va,Pd=Math.PI/180,Cd=180/Math.PI;function Uu(n){return(n%=360)<0&&(n+=360),n}function Kl([n,t,r,a]){let c,d;const p=Yl((.2225045*(n=pa(n))+.7168786*(t=pa(t))+.0606169*(r=pa(r)))/1);n===t&&t===r?c=d=p:(c=Yl((.4360747*n+.3850649*t+.1430804*r)/Nu),d=Yl((.0139322*n+.0971045*t+.7141733*r)/Xl));const m=116*p-16;return[m<0?0:m,500*(c-p),200*(p-d),a]}function pa(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Yl(n){return n>Sd?Math.pow(n,1/3):n/Vu+Zu}function $u([n,t,r,a]){let c=(n+16)/116,d=isNaN(t)?c:c+t/500,p=isNaN(r)?c:c-r/200;return c=1*Jl(c),d=Nu*Jl(d),p=Xl*Jl(p),[fa(3.1338561*d-1.6168667*c-.4906146*p),fa(-.9787684*d+1.9161415*c+.033454*p),fa(.0719453*d-.2289914*c+1.4052427*p),a]}function fa(n){return(n=n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055)<0?0:n>1?1:n}function Jl(n){return n>Va?n*n*n:Vu*(n-Zu)}const Id=Object.hasOwn||function(n,t){return Object.prototype.hasOwnProperty.call(n,t)};function Cs(n,t){return Id(n,t)?n[t]:void 0}function Is(n){return parseInt(n.padEnd(2,n),16)/255}function Ql(n,t){return ur(t?n/100:n,0,1)}function ur(n,t,r){return Math.min(Math.max(t,n),r)}function Ct(n){return!n.some(Number.isNaN)}const Ua={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function hr(n,t,r){return n+r*(t-n)}function ma(n,t,r){return n.map((a,c)=>hr(a,t[c],r))}class Mt{constructor(t,r,a,c=1,d=!0){this.r=t,this.g=r,this.b=a,this.a=c,d||(this.r*=c,this.g*=c,this.b*=c,c||this.overwriteGetter("rgb",[t,r,a,c]))}static parse(t){if(t instanceof Mt)return t;if(typeof t!="string")return;const r=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const c=Cs(Ua,a);if(c){const[p,m,y]=c;return[p/255,m/255,y/255,1]}if(a.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(a)){const p=a.length<6?1:2;let m=1;return[Is(a.slice(m,m+=p)),Is(a.slice(m,m+=p)),Is(a.slice(m,m+=p)),Is(a.slice(m,m+p)||"ff")]}if(a.startsWith("rgb")){const p=a.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[m,y,w,M,C,k,D,L,j,U,X,ne]=p,Y=[M||" ",D||" ",U].join("");if(Y===" "||Y===" /"||Y===",,"||Y===",,,"){const R=[w,k,j].join(""),V=R==="%%%"?100:R===""?255:0;if(V){const Q=[ur(+y/V,0,1),ur(+C/V,0,1),ur(+L/V,0,1),X?Ql(+X,ne):1];if(Ct(Q))return Q}}return}}const d=a.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[p,m,y,w,M,C,k,D,L]=d,j=[y||" ",M||" ",k].join("");if(j===" "||j===" /"||j===",,"||j===",,,"){const U=[+m,ur(+w,0,100),ur(+C,0,100),D?Ql(+D,L):1];if(Ct(U))return function([X,ne,Y,R]){function V(Q){const fe=(Q+X/30)%12,ke=ne*Math.min(Y,1-Y);return Y-ke*Math.max(-1,Math.min(fe-3,9-fe,1))}return X=Uu(X),ne/=100,Y/=100,[V(0),V(8),V(4),R]}(U)}}}(t);return r?new Mt(...r,!1):void 0}get rgb(){const{r:t,g:r,b:a,a:c}=this,d=c||1/0;return this.overwriteGetter("rgb",[t/d,r/d,a/d,c])}get hcl(){return this.overwriteGetter("hcl",function(t){const[r,a,c,d]=Kl(t),p=Math.sqrt(a*a+c*c);return[Math.round(1e4*p)?Uu(Math.atan2(c,a)*Cd):NaN,p,r,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Kl(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){const[t,r,a,c]=this.rgb;return`rgba(${[t,r,a].map(d=>Math.round(255*d)).join(",")},${c})`}static interpolate(t,r,a,c="rgb"){switch(c){case"rgb":{const[d,p,m,y]=ma(t.rgb,r.rgb,a);return new Mt(d,p,m,y,!1)}case"hcl":{const[d,p,m,y]=t.hcl,[w,M,C,k]=r.hcl;let D,L;if(isNaN(d)||isNaN(w))isNaN(d)?isNaN(w)?D=NaN:(D=w,m!==1&&m!==0||(L=M)):(D=d,C!==1&&C!==0||(L=p));else{let Y=w-d;w>d&&Y>180?Y-=360:w<d&&d-w>180&&(Y+=360),D=d+a*Y}const[j,U,X,ne]=function([Y,R,V,Q]){return Y=isNaN(Y)?0:Y*Pd,$u([V,Math.cos(Y)*R,Math.sin(Y)*R,Q])}([D,L??hr(p,M,a),hr(m,C,a),hr(y,k,a)]);return new Mt(j,U,X,ne,!1)}case"lab":{const[d,p,m,y]=$u(ma(t.lab,r.lab,a));return new Mt(d,p,m,y,!1)}}}}Mt.black=new Mt(0,0,0,1),Mt.white=new Mt(1,1,1,1),Mt.transparent=new Mt(0,0,0,0),Mt.red=new Mt(1,0,0,1);class Es{constructor(t,r,a){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const As=["bottom","center","top"];class $a{constructor(t,r,a,c,d,p){this.text=t,this.image=r,this.scale=a,this.fontStack=c,this.textColor=d,this.verticalAlign=p}}class Mr{constructor(t){this.sections=t}static fromString(t){return new Mr([new $a(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof Mr?t:Mr.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class $i{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof $i)return t;if(typeof t=="number")return new $i([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new $i(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a){return new $i(ma(t.values,r.values,a))}}class bi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof bi)return t;if(typeof t=="number")return new bi([t]);if(Array.isArray(t)){for(const r of t)if(typeof r!="number")return;return new bi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a){return new bi(ma(t.values,r.values,a))}}class Gi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Gi)return t;if(typeof t=="string"){const a=Mt.parse(t);return a?new Gi([a]):void 0}if(!Array.isArray(t))return;const r=[];for(const a of t){if(typeof a!="string")return;const c=Mt.parse(a);if(!c)return;r.push(c)}return new Gi(r)}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a,c="rgb"){const d=[];if(t.values.length!=r.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let p=0;p<t.values.length;p++)d.push(Mt.interpolate(t.values[p],r.values[p],a,c));return new Gi(d)}}class Wt extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const Ga=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class dr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof dr)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r<t.length;r+=2){const a=t[r],c=t[r+1];if(typeof a!="string"||!Ga.has(a)||!Array.isArray(c)||c.length!==2||typeof c[0]!="number"||typeof c[1]!="number")return}return new dr(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a){const c=t.values,d=r.values;if(c.length!==d.length)throw new Wt(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${r.toString()}`);const p=[];for(let m=0;m<c.length;m+=2){if(c[m]!==d[m])throw new Wt(`Cannot interpolate values containing mismatched anchors. from[${m}]: ${c[m]}, to[${m}]: ${d[m]}`);p.push(c[m]);const[y,w]=c[m+1],[M,C]=d[m+1];p.push([hr(y,M,a),hr(w,C,a)])}return new dr(p)}}class Lr{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Lr({name:t,available:!1}):null}}class Sr{constructor(t,r,a){this.from=t,this.to=r,this.transition=a}static interpolate(t,r,a){return new Sr(t,r,a)}static parse(t){return t instanceof Sr?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new Sr(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new Sr(t.from,t.to,t.transition):typeof t=="string"?new Sr(t,t,1):void 0}}function ks(n,t,r,a){return typeof n=="number"&&n>=0&&n<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[n,t,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[n,t,r,a]:[n,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Vt(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof Sr||n instanceof Mt||n instanceof Es||n instanceof Mr||n instanceof $i||n instanceof bi||n instanceof Gi||n instanceof dr||n instanceof Lr)return!0;if(Array.isArray(n)){for(const t of n)if(!Vt(t))return!1;return!0}if(typeof n=="object"){for(const t in n)if(!Vt(n[t]))return!1;return!0}return!1}function ci(n){if(n===null)return nt;if(typeof n=="string")return it;if(typeof n=="boolean")return pt;if(typeof n=="number")return Ie;if(n instanceof Mt)return oi;if(n instanceof Sr)return li;if(n instanceof Es)return Na;if(n instanceof Mr)return Ms;if(n instanceof $i)return ua;if(n instanceof bi)return En;if(n instanceof Gi)return Ss;if(n instanceof dr)return vi;if(n instanceof Lr)return ha;if(Array.isArray(n)){const t=n.length;let r;for(const a of n){const c=ci(a);if(r){if(r===c)continue;r=ft;break}r=c}return Dr(r||ft,t)}return Tr}function St(n){const t=typeof n;return n===null?"":t==="string"||t==="number"||t==="boolean"?String(n):n instanceof Mt||n instanceof Sr||n instanceof Mr||n instanceof $i||n instanceof bi||n instanceof Gi||n instanceof dr||n instanceof Lr?n.toString():JSON.stringify(n)}class lt{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Vt(t[1]))return r.error("invalid value");const a=t[1];let c=ci(a);const d=r.expectedType;return c.kind!=="array"||c.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(c=d),new lt(c,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const qa={string:it,number:Ie,boolean:pt,object:Tr};class mt{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a,c=1;const d=t[0];if(d==="array"){let m,y;if(t.length>2){const w=t[1];if(typeof w!="string"||!(w in qa)||w==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=qa[w],c++}else m=ft;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);y=t[2],c++}a=Dr(m,y)}else{if(!qa[d])throw new Error(`Types doesn't contain name = ${d}`);a=qa[d]}const p=[];for(;c<t.length;c++){const m=r.parse(t[c],c,ft);if(!m)return null;p.push(m)}return new mt(a,p)}evaluate(t){for(let r=0;r<this.args.length;r++){const a=this.args[r].evaluate(t);if(!Za(this.type,ci(a)))return a;if(r===this.args.length-1)throw new Wt(`Expected value to be of type ${ei(this.type)}, but found ${ei(ci(a))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Co={"to-boolean":pt,"to-color":oi,"to-number":Ie,"to-string":it};class er{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const a=t[0];if(!Co[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&t.length!==2)return r.error("Expected one argument.");const c=Co[a],d=[];for(let p=1;p<t.length;p++){const m=r.parse(t[p],p,ft);if(!m)return null;d.push(m)}return new er(c,d)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,a;for(const c of this.args){if(r=c.evaluate(t),a=null,r instanceof Mt)return r;if(typeof r=="string"){const d=t.parseColor(r);if(d)return d}else if(Array.isArray(r)&&(a=r.length<3||r.length>4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:ks(r[0],r[1],r[2],r[3]),!a))return new Mt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Wt(a||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const a of this.args){r=a.evaluate(t);const c=$i.parse(r);if(c)return c}throw new Wt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"numberArray":{let r;for(const a of this.args){r=a.evaluate(t);const c=bi.parse(r);if(c)return c}throw new Wt(`Could not parse numberArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"colorArray":{let r;for(const a of this.args){r=a.evaluate(t);const c=Gi.parse(r);if(c)return c}throw new Wt(`Could not parse colorArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const a of this.args){r=a.evaluate(t);const c=dr.parse(r);if(c)return c}throw new Wt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const a of this.args){if(r=a.evaluate(t),r===null)return 0;const c=Number(r);if(!isNaN(c))return c}throw new Wt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Mr.fromString(St(this.args[0].evaluate(t)));case"resolvedImage":return Lr.fromString(St(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return St(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const ec=["Unknown","Point","LineString","Polygon"];class tc{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?ec[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||{}}parseColor(t){let r=this._parseColorCache.get(t);return r||(r=Mt.parse(t),this._parseColorCache.set(t,r)),r}}class zs{constructor(t,r,a=[],c,d=new kt,p=[]){this.registry=t,this.path=a,this.key=a.map(m=>`[${m}]`).join(""),this.scope=d,this.errors=p,this.expectedType=c,this._isConstant=r}parse(t,r,a,c,d={}){return r?this.concat(r,a,c)._parse(t,d):this._parse(t,d)}_parse(t,r){function a(c,d,p){return p==="assert"?new mt(d,[c]):p==="coerce"?new er(d,[c]):c}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const c=t[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const d=this.registry[c];if(d){let p=d.parse(t,this);if(!p)return null;if(this.expectedType){const m=this.expectedType,y=p.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||y.kind!=="value"){if(m.kind==="projectionDefinition"&&["string","array"].includes(y.kind)||["color","formatted","resolvedImage"].includes(m.kind)&&["value","string"].includes(y.kind)||["padding","numberArray"].includes(m.kind)&&["value","number","array"].includes(y.kind)||m.kind==="colorArray"&&["value","string","array"].includes(y.kind)||m.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(y.kind))p=a(p,m,r.typeAnnotation||"coerce");else if(this.checkSubtype(m,y))return null}else p=a(p,m,r.typeAnnotation||"assert")}if(!(p instanceof lt)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const m=new tc;try{p=new lt(p.type,p.evaluate(m))}catch(y){return this.error(y.message),null}}return p}return this.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,a){const c=typeof t=="number"?this.path.concat(t):this.path,d=a?this.scope.concat(a):this.scope;return new zs(this.registry,this._isConstant,c,r||null,d,this.errors)}error(t,...r){const a=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new Tt(a,t))}checkSubtype(t,r){const a=Za(t,r);return a&&this.error(a),a}}class Ha{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const a=[];for(let d=1;d<t.length-1;d+=2){const p=t[d];if(typeof p!="string")return r.error(`Expected string, but found ${typeof p} instead.`,d);if(/[^a-zA-Z0-9_]/.test(p))return r.error("Variable names must contain only alphanumeric characters or '_'.",d);const m=r.parse(t[d+1],d+1);if(!m)return null;a.push([p,m])}const c=r.parse(t[t.length-1],t.length-1,r.expectedType,a);return c?new Ha(a,c):null}outputDefined(){return this.result.outputDefined()}}class Rs{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const a=t[1];return r.scope.has(a)?new Rs(a,r.scope.get(a)):r.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class ic{constructor(t,r,a){this.type=t,this.index=r,this.input=a}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,Ie),c=r.parse(t[2],2,Dr(r.expectedType||ft));return a&&c?new ic(c.type.itemType,a,c):null}evaluate(t){const r=this.index.evaluate(t),a=this.input.evaluate(t);if(r<0)throw new Wt(`Array index out of bounds: ${r} < 0.`);if(r>=a.length)throw new Wt(`Array index out of bounds: ${r} > ${a.length-1}.`);if(r!==Math.floor(r))throw new Wt(`Array index must be an integer, but found ${r} instead.`);return a[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Io{constructor(t,r){this.type=pt,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,ft),c=r.parse(t[2],2,ft);return a&&c?Wl(a.type,[pt,it,Ie,nt,ft])?new Io(a,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ei(a.type)} instead`):null}evaluate(t){const r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!a)return!1;if(!da(r,["boolean","string","number","null"]))throw new Wt(`Expected first argument to be of type boolean, string, number or null, but found ${ei(ci(r))} instead.`);if(!da(a,["string","array"]))throw new Wt(`Expected second argument to be of type array or string, but found ${ei(ci(a))} instead.`);return a.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Ds{constructor(t,r,a){this.type=Ie,this.needle=t,this.haystack=r,this.fromIndex=a}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,ft),c=r.parse(t[2],2,ft);if(!a||!c)return null;if(!Wl(a.type,[pt,it,Ie,nt,ft]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ei(a.type)} instead`);if(t.length===4){const d=r.parse(t[3],3,Ie);return d?new Ds(a,c,d):null}return new Ds(a,c)}evaluate(t){const r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!da(r,["boolean","string","number","null"]))throw new Wt(`Expected first argument to be of type boolean, string, number or null, but found ${ei(ci(r))} instead.`);let c;if(this.fromIndex&&(c=this.fromIndex.evaluate(t)),da(a,["string"])){const d=a.indexOf(r,c);return d===-1?-1:[...a.slice(0,d)].length}if(da(a,["array"]))return a.indexOf(r,c);throw new Wt(`Expected second argument to be of type array or string, but found ${ei(ci(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class ga{constructor(t,r,a,c,d,p){this.inputType=t,this.type=r,this.input=a,this.cases=c,this.outputs=d,this.otherwise=p}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let a,c;r.expectedType&&r.expectedType.kind!=="value"&&(c=r.expectedType);const d={},p=[];for(let w=2;w<t.length-1;w+=2){let M=t[w];const C=t[w+1];Array.isArray(M)||(M=[M]);const k=r.concat(w);if(M.length===0)return k.error("Expected at least one branch label.");for(const L of M){if(typeof L!="number"&&typeof L!="string")return k.error("Branch labels must be numbers or strings.");if(typeof L=="number"&&Math.abs(L)>Number.MAX_SAFE_INTEGER)return k.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof L=="number"&&Math.floor(L)!==L)return k.error("Numeric branch labels must be integer values.");if(a){if(k.checkSubtype(a,ci(L)))return null}else a=ci(L);if(d[String(L)]!==void 0)return k.error("Branch labels must be unique.");d[String(L)]=p.length}const D=r.parse(C,w,c);if(!D)return null;c=c||D.type,p.push(D)}const m=r.parse(t[1],1,ft);if(!m)return null;const y=r.parse(t[t.length-1],t.length-1,c);return y?m.type.kind!=="value"&&r.concat(1).checkSubtype(a,m.type)?null:new ga(a,c,m,d,p,y):null}evaluate(t){const r=this.input.evaluate(t);return(ci(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class Di{constructor(t,r,a){this.type=t,this.branches=r,this.otherwise=a}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let a;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);const c=[];for(let p=1;p<t.length-1;p+=2){const m=r.parse(t[p],p,pt);if(!m)return null;const y=r.parse(t[p+1],p+1,a);if(!y)return null;c.push([m,y]),a=a||y.type}const d=r.parse(t[t.length-1],t.length-1,a);if(!d)return null;if(!a)throw new Error("Can't infer output type");return new Di(a,c,d)}evaluate(t){for(const[r,a]of this.branches)if(r.evaluate(t))return a.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[r,a]of this.branches)t(r),t(a);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class _a{constructor(t,r,a,c){this.type=t,this.input=r,this.beginIndex=a,this.endIndex=c}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,ft),c=r.parse(t[2],2,Ie);if(!a||!c)return null;if(!Wl(a.type,[Dr(ft),it,ft]))return r.error(`Expected first argument to be of type array or string, but found ${ei(a.type)} instead`);if(t.length===4){const d=r.parse(t[3],3,Ie);return d?new _a(a.type,a,c,d):null}return new _a(a.type,a,c)}evaluate(t){const r=this.input.evaluate(t),a=this.beginIndex.evaluate(t);let c;if(this.endIndex&&(c=this.endIndex.evaluate(t)),da(r,["string"]))return[...r].slice(a,c).join("");if(da(r,["array"]))return r.slice(a,c);throw new Wt(`Expected first argument to be of type array or string, but found ${ei(ci(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Ls(n,t){const r=n.length-1;let a,c,d=0,p=r,m=0;for(;d<=p;)if(m=Math.floor((d+p)/2),a=n[m],c=n[m+1],a<=t){if(m===r||t<c)return m;d=m+1}else{if(!(a>t))throw new Wt("Input is not a number.");p=m-1}return 0}class Hn{constructor(t,r,a){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(const[c,d]of a)this.labels.push(c),this.outputs.push(d)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");const a=r.parse(t[1],1,Ie);if(!a)return null;const c=[];let d=null;r.expectedType&&r.expectedType.kind!=="value"&&(d=r.expectedType);for(let p=1;p<t.length;p+=2){const m=p===1?-1/0:t[p],y=t[p+1],w=p,M=p+1;if(typeof m!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',w);if(c.length&&c[c.length-1][0]>=m)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',w);const C=r.parse(y,M,d);if(!C)return null;d=d||C.type,c.push([m,C])}return new Hn(d,a,c)}evaluate(t){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=r[0])return a[0].evaluate(t);const d=r.length;return c>=r[d-1]?a[d-1].evaluate(t):a[Ls(r,c)].evaluate(t)}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Li(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Eo,Ao,Gu=function(){if(Ao)return Eo;function n(t,r,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(c-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=a,this.p2y=c}return Ao=1,Eo=n,n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var a=t,c=0;c<8;c++){var d=this.sampleCurveX(a)-t;if(Math.abs(d)<r)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var m=0,y=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<r));c++)t>d?m=a:y=a,a=.5*(y-m)+m;return a},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},Eo}(),Ed=Li(Gu);class tr{constructor(t,r,a,c,d){this.type=t,this.operator=r,this.interpolation=a,this.input=c,this.labels=[],this.outputs=[];for(const[p,m]of d)this.labels.push(p),this.outputs.push(m)}static interpolationFactor(t,r,a,c){let d=0;if(t.name==="exponential")d=Bs(r,t.base,a,c);else if(t.name==="linear")d=Bs(r,1,a,c);else if(t.name==="cubic-bezier"){const p=t.controlPoints;d=new Ed(p[0],p[1],p[2],p[3]).solve(Bs(r,1,a,c))}return d}static parse(t,r){let[a,c,d,...p]=t;if(!Array.isArray(c)||c.length===0)return r.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const w=c[1];if(typeof w!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:w}}else{if(c[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const w=c.slice(1);if(w.length!==4||w.some(M=>typeof M!="number"||M<0||M>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:w}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(d=r.parse(d,2,Ie),!d)return null;const m=[];let y=null;a!=="interpolate-hcl"&&a!=="interpolate-lab"||r.expectedType==Ss?r.expectedType&&r.expectedType.kind!=="value"&&(y=r.expectedType):y=oi;for(let w=0;w<p.length;w+=2){const M=p[w],C=p[w+1],k=w+3,D=w+4;if(typeof M!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',k);if(m.length&&m[m.length-1][0]>=M)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',k);const L=r.parse(C,D,y);if(!L)return null;y=y||L.type,m.push([M,L])}return An(y,Ie)||An(y,li)||An(y,oi)||An(y,ua)||An(y,En)||An(y,Ss)||An(y,vi)||An(y,Dr(Ie))?new tr(y,a,c,d,m):r.error(`Type ${ei(y)} is not interpolatable.`)}evaluate(t){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=r[0])return a[0].evaluate(t);const d=r.length;if(c>=r[d-1])return a[d-1].evaluate(t);const p=Ls(r,c),m=tr.interpolationFactor(this.interpolation,c,r[p],r[p+1]),y=a[p].evaluate(t),w=a[p+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return hr(y,w,m);case"color":return Mt.interpolate(y,w,m);case"padding":return $i.interpolate(y,w,m);case"colorArray":return Gi.interpolate(y,w,m);case"numberArray":return bi.interpolate(y,w,m);case"variableAnchorOffsetCollection":return dr.interpolate(y,w,m);case"array":return ma(y,w,m);case"projectionDefinition":return Sr.interpolate(y,w,m)}case"interpolate-hcl":switch(this.type.kind){case"color":return Mt.interpolate(y,w,m,"hcl");case"colorArray":return Gi.interpolate(y,w,m,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Mt.interpolate(y,w,m,"lab");case"colorArray":return Gi.interpolate(y,w,m,"lab")}}}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Bs(n,t,r,a){const c=a-r,d=n-r;return c===0?0:t===1?d/c:(Math.pow(t,d)-1)/(Math.pow(t,c)-1)}const pn={color:Mt.interpolate,number:hr,padding:$i.interpolate,numberArray:bi.interpolate,colorArray:Gi.interpolate,variableAnchorOffsetCollection:dr.interpolate,array:ma};class ya{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a=null;const c=r.expectedType;c&&c.kind!=="value"&&(a=c);const d=[];for(const m of t.slice(1)){const y=r.parse(m,1+d.length,a,void 0,{typeAnnotation:"omit"});if(!y)return null;a=a||y.type,d.push(y)}if(!a)throw new Error("No output type");const p=c&&d.some(m=>Za(c,m.type));return new ya(p?ft:a,d)}evaluate(t){let r,a=null,c=0;for(const d of this.args)if(c++,a=d.evaluate(t),a&&a instanceof Lr&&!a.available&&(r||(r=a.name),a=null,c===this.args.length&&(a=r)),a!==null)break;return a}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function Fs(n,t){return n==="=="||n==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function $r(n,t,r,a){return a.compare(t,r)===0}function xa(n,t,r){const a=n!=="=="&&n!=="!=";return class $g{constructor(d,p,m){this.type=pt,this.lhs=d,this.rhs=p,this.collator=m,this.hasUntypedArgument=d.type.kind==="value"||p.type.kind==="value"}static parse(d,p){if(d.length!==3&&d.length!==4)return p.error("Expected two or three arguments.");const m=d[0];let y=p.parse(d[1],1,ft);if(!y)return null;if(!Fs(m,y.type))return p.concat(1).error(`"${m}" comparisons are not supported for type '${ei(y.type)}'.`);let w=p.parse(d[2],2,ft);if(!w)return null;if(!Fs(m,w.type))return p.concat(2).error(`"${m}" comparisons are not supported for type '${ei(w.type)}'.`);if(y.type.kind!==w.type.kind&&y.type.kind!=="value"&&w.type.kind!=="value")return p.error(`Cannot compare types '${ei(y.type)}' and '${ei(w.type)}'.`);a&&(y.type.kind==="value"&&w.type.kind!=="value"?y=new mt(w.type,[y]):y.type.kind!=="value"&&w.type.kind==="value"&&(w=new mt(y.type,[w])));let M=null;if(d.length===4){if(y.type.kind!=="string"&&w.type.kind!=="string"&&y.type.kind!=="value"&&w.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(M=p.parse(d[3],3,Na),!M)return null}return new $g(y,w,M)}evaluate(d){const p=this.lhs.evaluate(d),m=this.rhs.evaluate(d);if(a&&this.hasUntypedArgument){const y=ci(p),w=ci(m);if(y.kind!==w.kind||y.kind!=="string"&&y.kind!=="number")throw new Wt(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${y.kind}, ${w.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const y=ci(p),w=ci(m);if(y.kind!=="string"||w.kind!=="string")return t(d,p,m)}return this.collator?r(d,p,m,this.collator.evaluate(d)):t(d,p,m)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}const ko=xa("==",function(n,t,r){return t===r},$r),Ad=xa("!=",function(n,t,r){return t!==r},function(n,t,r,a){return!$r(0,t,r,a)}),rc=xa("<",function(n,t,r){return t<r},function(n,t,r,a){return a.compare(t,r)<0}),kd=xa(">",function(n,t,r){return t>r},function(n,t,r,a){return a.compare(t,r)>0}),zd=xa("<=",function(n,t,r){return t<=r},function(n,t,r,a){return a.compare(t,r)<=0}),Rd=xa(">=",function(n,t,r){return t>=r},function(n,t,r,a){return a.compare(t,r)>=0});class zo{constructor(t,r,a){this.type=Na,this.locale=a,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");const a=t[1];if(typeof a!="object"||Array.isArray(a))return r.error("Collator options argument must be an object.");const c=r.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,pt);if(!c)return null;const d=r.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,pt);if(!d)return null;let p=null;return a.locale&&(p=r.parse(a.locale,1,it),!p)?null:new zo(c,d,p)}evaluate(t){return new Es(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class Wa{constructor(t,r,a,c,d){this.type=it,this.number=t,this.locale=r,this.currency=a,this.minFractionDigits=c,this.maxFractionDigits=d}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");const a=r.parse(t[1],1,Ie);if(!a)return null;const c=t[2];if(typeof c!="object"||Array.isArray(c))return r.error("NumberFormat options argument must be an object.");let d=null;if(c.locale&&(d=r.parse(c.locale,1,it),!d))return null;let p=null;if(c.currency&&(p=r.parse(c.currency,1,it),!p))return null;let m=null;if(c["min-fraction-digits"]&&(m=r.parse(c["min-fraction-digits"],1,Ie),!m))return null;let y=null;return c["max-fraction-digits"]&&(y=r.parse(c["max-fraction-digits"],1,Ie),!y)?null:new Wa(a,d,p,m,y)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Ro{constructor(t){this.type=Ms,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const a=t[1];if(!Array.isArray(a)&&typeof a=="object")return r.error("First argument must be an image or text section.");const c=[];let d=!1;for(let p=1;p<=t.length-1;++p){const m=t[p];if(d&&typeof m=="object"&&!Array.isArray(m)){d=!1;let y=null;if(m["font-scale"]&&(y=r.parse(m["font-scale"],1,Ie),!y))return null;let w=null;if(m["text-font"]&&(w=r.parse(m["text-font"],1,Dr(it)),!w))return null;let M=null;if(m["text-color"]&&(M=r.parse(m["text-color"],1,oi),!M))return null;let C=null;if(m["vertical-align"]){if(typeof m["vertical-align"]=="string"&&!As.includes(m["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${m["vertical-align"]}' instead.`);if(C=r.parse(m["vertical-align"],1,it),!C)return null}const k=c[c.length-1];k.scale=y,k.font=w,k.textColor=M,k.verticalAlign=C}else{const y=r.parse(t[p],1,ft);if(!y)return null;const w=y.type.kind;if(w!=="string"&&w!=="value"&&w!=="null"&&w!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,c.push({content:y,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Ro(c)}evaluate(t){return new Mr(this.sections.map(r=>{const a=r.content.evaluate(t);return ci(a)===ha?new $a("",a,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new $a(St(a),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null,r.verticalAlign?r.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor),r.verticalAlign&&t(r.verticalAlign)}outputDefined(){return!1}}class Do{constructor(t){this.type=ha,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");const a=r.parse(t[1],1,it);return a?new Do(a):r.error("No image name provided.")}evaluate(t){const r=this.input.evaluate(t),a=Lr.fromString(r);return a&&t.availableImages&&(a.available=t.availableImages.indexOf(r)>-1),a}eachChild(t){t(this.input)}outputDefined(){return!1}}class Lo{constructor(t){this.type=Ie,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const a=r.parse(t[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${ei(a.type)} instead.`):new Lo(a):null}evaluate(t){const r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new Wt(`Expected value to be of type string or array, but found ${ei(ci(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const fn=8192;function qu(n,t){const r=(180+n[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n[1]*Math.PI/360)))/360,c=Math.pow(2,t.z);return[Math.round(r*c*fn),Math.round(a*c*fn)]}function nc(n,t){const r=Math.pow(2,t.z);return[(c=(n[0]/fn+t.x)/r,360*c-180),(a=(n[1]/fn+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,c}function Os(n,t){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function js(n,t){return!(n[0]<=t[0]||n[2]>=t[2]||n[1]<=t[1]||n[3]>=t[3])}function Dd(n,t,r){const a=n[0]-t[0],c=n[1]-t[1],d=n[0]-r[0],p=n[1]-r[1];return a*p-d*c==0&&a*d<=0&&c*p<=0}function Bo(n,t,r,a){return(c=[a[0]-r[0],a[1]-r[1]])[0]*(d=[t[0]-n[0],t[1]-n[1]])[1]-c[1]*d[0]!=0&&!(!Ku(n,t,r,a)||!Ku(r,a,n,t));var c,d}function Hu(n,t,r){for(const a of r)for(let c=0;c<a.length-1;++c)if(Bo(n,t,a[c],a[c+1]))return!0;return!1}function va(n,t,r=!1){let a=!1;for(const m of t)for(let y=0;y<m.length-1;y++){if(Dd(n,m[y],m[y+1]))return r;(d=m[y])[1]>(c=n)[1]!=(p=m[y+1])[1]>c[1]&&c[0]<(p[0]-d[0])*(c[1]-d[1])/(p[1]-d[1])+d[0]&&(a=!a)}var c,d,p;return a}function Wu(n,t){for(const r of t)if(va(n,r))return!0;return!1}function Xu(n,t){for(const r of n)if(!va(r,t))return!1;for(let r=0;r<n.length-1;++r)if(Hu(n[r],n[r+1],t))return!1;return!0}function Ld(n,t){for(const r of t)if(Xu(n,r))return!0;return!1}function Ku(n,t,r,a){const c=a[0]-r[0],d=a[1]-r[1],p=(n[0]-r[0])*d-c*(n[1]-r[1]),m=(t[0]-r[0])*d-c*(t[1]-r[1]);return p>0&&m<0||p<0&&m>0}function Ns(n,t,r){const a=[];for(let c=0;c<n.length;c++){const d=[];for(let p=0;p<n[c].length;p++){const m=qu(n[c][p],r);Os(t,m),d.push(m)}a.push(d)}return a}function Yu(n,t,r){const a=[];for(let c=0;c<n.length;c++){const d=Ns(n[c],t,r);a.push(d)}return a}function Ju(n,t,r,a){if(n[0]<r[0]||n[0]>r[2]){const c=.5*a;let d=n[0]-r[0]>c?-a:r[0]-n[0]>c?a:0;d===0&&(d=n[0]-r[2]>c?-a:r[2]-n[0]>c?a:0),n[0]+=d}Os(t,n)}function Qu(n,t,r,a){const c=Math.pow(2,a.z)*fn,d=[a.x*fn,a.y*fn],p=[];for(const m of n)for(const y of m){const w=[y.x+d[0],y.y+d[1]];Ju(w,t,r,c),p.push(w)}return p}function ac(n,t,r,a){const c=Math.pow(2,a.z)*fn,d=[a.x*fn,a.y*fn],p=[];for(const y of n){const w=[];for(const M of y){const C=[M.x+d[0],M.y+d[1]];Os(t,C),w.push(C)}p.push(w)}if(t[2]-t[0]<=c/2){(m=t)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const y of p)for(const w of y)Ju(w,t,r,c)}var m;return p}class Wn{constructor(t,r){this.type=pt,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Vt(t[1])){const a=t[1];if(a.type==="FeatureCollection"){const c=[];for(const d of a.features){const{type:p,coordinates:m}=d.geometry;p==="Polygon"&&c.push(m),p==="MultiPolygon"&&c.push(...m)}if(c.length)return new Wn(a,{type:"MultiPolygon",coordinates:c})}else if(a.type==="Feature"){const c=a.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new Wn(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new Wn(a,a)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(a.type==="Polygon"){const m=Ns(a.coordinates,d,p),y=Qu(r.geometry(),c,d,p);if(!js(c,d))return!1;for(const w of y)if(!va(w,m))return!1}if(a.type==="MultiPolygon"){const m=Yu(a.coordinates,d,p),y=Qu(r.geometry(),c,d,p);if(!js(c,d))return!1;for(const w of y)if(!Wu(w,m))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(a.type==="Polygon"){const m=Ns(a.coordinates,d,p),y=ac(r.geometry(),c,d,p);if(!js(c,d))return!1;for(const w of y)if(!Xu(w,m))return!1}if(a.type==="MultiPolygon"){const m=Yu(a.coordinates,d,p),y=ac(r.geometry(),c,d,p);if(!js(c,d))return!1;for(const w of y)if(!Ld(w,m))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let eh=class{constructor(n=[],t=(r,a)=>r<a?-1:r>a?1:0){if(this.data=n,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(n){this.data.push(n),this._up(this.length++)}pop(){if(this.length===0)return;const n=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:t,compare:r}=this,a=t[n];for(;n>0;){const c=n-1>>1,d=t[c];if(r(a,d)>=0)break;t[n]=d,n=c}t[n]=a}_down(n){const{data:t,compare:r}=this,a=this.length>>1,c=t[n];for(;n<a;){let d=1+(n<<1);const p=d+1;if(p<this.length&&r(t[p],t[d])<0&&(d=p),r(t[d],c)>=0)break;t[n]=t[d],n=d}t[n]=c}};function th(n,t,r=0,a=n.length-1,c=ih){for(;a>r;){if(a-r>600){const y=a-r+1,w=t-r+1,M=Math.log(y),C=.5*Math.exp(2*M/3),k=.5*Math.sqrt(M*C*(y-C)/y)*(w-y/2<0?-1:1);th(n,t,Math.max(r,Math.floor(t-w*C/y+k)),Math.min(a,Math.floor(t+(y-w)*C/y+k)),c)}const d=n[t];let p=r,m=a;for(Xa(n,r,t),c(n[a],d)>0&&Xa(n,r,a);p<m;){for(Xa(n,p,m),p++,m--;c(n[p],d)<0;)p++;for(;c(n[m],d)>0;)m--}c(n[r],d)===0?Xa(n,r,m):(m++,Xa(n,m,a)),m<=t&&(r=m+1),t<=m&&(a=m-1)}}function Xa(n,t,r){const a=n[t];n[t]=n[r],n[r]=a}function ih(n,t){return n<t?-1:n>t?1:0}function Fo(n,t){if(n.length<=1)return[n];const r=[];let a,c;for(const d of n){const p=Fd(d);p!==0&&(d.area=Math.abs(p),c===void 0&&(c=p<0),c===p<0?(a&&r.push(a),a=[d]):a.push(d))}if(a&&r.push(a),t>1)for(let d=0;d<r.length;d++)r[d].length<=t||(th(r[d],t,1,r[d].length-1,Bd),r[d]=r[d].slice(0,t));return r}function Bd(n,t){return t.area-n.area}function Fd(n){let t=0;for(let r,a,c=0,d=n.length,p=d-1;c<d;p=c++)r=n[c],a=n[p],t+=(a.x-r.x)*(r.y+a.y);return t}const sc=1/298.257223563,rh=sc*(2-sc),nh=Math.PI/180;class oc{constructor(t){const r=6378.137*nh*1e3,a=Math.cos(t*nh),c=1/(1-rh*(1-a*a)),d=Math.sqrt(c);this.kx=r*d*a,this.ky=r*d*c*(1-rh)}distance(t,r){const a=this.wrap(t[0]-r[0])*this.kx,c=(t[1]-r[1])*this.ky;return Math.sqrt(a*a+c*c)}pointOnLine(t,r){let a,c,d,p,m=1/0;for(let y=0;y<t.length-1;y++){let w=t[y][0],M=t[y][1],C=this.wrap(t[y+1][0]-w)*this.kx,k=(t[y+1][1]-M)*this.ky,D=0;C===0&&k===0||(D=(this.wrap(r[0]-w)*this.kx*C+(r[1]-M)*this.ky*k)/(C*C+k*k),D>1?(w=t[y+1][0],M=t[y+1][1]):D>0&&(w+=C/this.kx*D,M+=k/this.ky*D)),C=this.wrap(r[0]-w)*this.kx,k=(r[1]-M)*this.ky;const L=C*C+k*k;L<m&&(m=L,a=w,c=M,d=y,p=D)}return{point:[a,c],index:d,t:Math.max(0,Math.min(1,p))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function ah(n,t){return t[0]-n[0]}function At(n){return n[1]-n[0]+1}function kn(n,t){return n[1]>=n[0]&&n[1]<t}function lc(n,t){if(n[0]>n[1])return[null,null];const r=At(n);if(t){if(r===2)return[n,null];const c=Math.floor(r/2);return[[n[0],n[0]+c],[n[0]+c,n[1]]]}if(r===1)return[n,null];const a=Math.floor(r/2)-1;return[[n[0],n[0]+a],[n[0]+a+1,n[1]]]}function cc(n,t){if(!kn(t,n.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let a=t[0];a<=t[1];++a)Os(r,n[a]);return r}function uc(n){const t=[1/0,1/0,-1/0,-1/0];for(const r of n)for(const a of r)Os(t,a);return t}function sh(n){return n[0]!==-1/0&&n[1]!==-1/0&&n[2]!==1/0&&n[3]!==1/0}function hc(n,t,r){if(!sh(n)||!sh(t))return NaN;let a=0,c=0;return n[2]<t[0]&&(a=t[0]-n[2]),n[0]>t[2]&&(a=n[0]-t[2]),n[1]>t[3]&&(c=n[1]-t[3]),n[3]<t[1]&&(c=t[1]-n[3]),r.distance([0,0],[a,c])}function ba(n,t,r){const a=r.pointOnLine(t,n);return r.distance(n,a.point)}function dc(n,t,r,a,c){const d=Math.min(ba(n,[r,a],c),ba(t,[r,a],c)),p=Math.min(ba(r,[n,t],c),ba(a,[n,t],c));return Math.min(d,p)}function Od(n,t,r,a,c){if(!kn(t,n.length)||!kn(a,r.length))return 1/0;let d=1/0;for(let p=t[0];p<t[1];++p){const m=n[p],y=n[p+1];for(let w=a[0];w<a[1];++w){const M=r[w],C=r[w+1];if(Bo(m,y,M,C))return 0;d=Math.min(d,dc(m,y,M,C,c))}}return d}function jd(n,t,r,a,c){if(!kn(t,n.length)||!kn(a,r.length))return NaN;let d=1/0;for(let p=t[0];p<=t[1];++p)for(let m=a[0];m<=a[1];++m)if(d=Math.min(d,c.distance(n[p],r[m])),d===0)return d;return d}function Nd(n,t,r){if(va(n,t,!0))return 0;let a=1/0;for(const c of t){const d=c[0],p=c[c.length-1];if(d!==p&&(a=Math.min(a,ba(n,[p,d],r)),a===0))return a;const m=r.pointOnLine(c,n);if(a=Math.min(a,r.distance(n,m.point)),a===0)return a}return a}function Zd(n,t,r,a){if(!kn(t,n.length))return NaN;for(let d=t[0];d<=t[1];++d)if(va(n[d],r,!0))return 0;let c=1/0;for(let d=t[0];d<t[1];++d){const p=n[d],m=n[d+1];for(const y of r)for(let w=0,M=y.length,C=M-1;w<M;C=w++){const k=y[C],D=y[w];if(Bo(p,m,k,D))return 0;c=Math.min(c,dc(p,m,k,D,a))}}return c}function oh(n,t){for(const r of n)for(const a of r)if(va(a,t,!0))return!0;return!1}function Vd(n,t,r,a=1/0){const c=uc(n),d=uc(t);if(a!==1/0&&hc(c,d,r)>=a)return a;if(js(c,d)){if(oh(n,t))return 0}else if(oh(t,n))return 0;let p=1/0;for(const m of n)for(let y=0,w=m.length,M=w-1;y<w;M=y++){const C=m[M],k=m[y];for(const D of t)for(let L=0,j=D.length,U=j-1;L<j;U=L++){const X=D[U],ne=D[L];if(Bo(C,k,X,ne))return 0;p=Math.min(p,dc(C,k,X,ne,r))}}return p}function lh(n,t,r,a,c,d){if(!d)return;const p=hc(cc(a,d),c,r);p<t&&n.push([p,d,[0,0]])}function Oo(n,t,r,a,c,d,p){if(!d||!p)return;const m=hc(cc(a,d),cc(c,p),r);m<t&&n.push([m,d,p])}function jo(n,t,r,a,c=1/0){let d=Math.min(a.distance(n[0],r[0][0]),c);if(d===0)return d;const p=new eh([[0,[0,n.length-1],[0,0]]],ah),m=uc(r);for(;p.length>0;){const y=p.pop();if(y[0]>=d)continue;const w=y[1],M=t?50:100;if(At(w)<=M){if(!kn(w,n.length))return NaN;if(t){const C=Zd(n,w,r,a);if(isNaN(C)||C===0)return C;d=Math.min(d,C)}else for(let C=w[0];C<=w[1];++C){const k=Nd(n[C],r,a);if(d=Math.min(d,k),d===0)return 0}}else{const C=lc(w,t);lh(p,d,a,n,m,C[0]),lh(p,d,a,n,m,C[1])}}return d}function No(n,t,r,a,c,d=1/0){let p=Math.min(d,c.distance(n[0],r[0]));if(p===0)return p;const m=new eh([[0,[0,n.length-1],[0,r.length-1]]],ah);for(;m.length>0;){const y=m.pop();if(y[0]>=p)continue;const w=y[1],M=y[2],C=t?50:100,k=a?50:100;if(At(w)<=C&&At(M)<=k){if(!kn(w,n.length)&&kn(M,r.length))return NaN;let D;if(t&&a)D=Od(n,w,r,M,c),p=Math.min(p,D);else if(t&&!a){const L=n.slice(w[0],w[1]+1);for(let j=M[0];j<=M[1];++j)if(D=ba(r[j],L,c),p=Math.min(p,D),p===0)return p}else if(!t&&a){const L=r.slice(M[0],M[1]+1);for(let j=w[0];j<=w[1];++j)if(D=ba(n[j],L,c),p=Math.min(p,D),p===0)return p}else D=jd(n,w,r,M,c),p=Math.min(p,D)}else{const D=lc(w,t),L=lc(M,a);Oo(m,p,c,n,r,D[0],L[0]),Oo(m,p,c,n,r,D[0],L[1]),Oo(m,p,c,n,r,D[1],L[0]),Oo(m,p,c,n,r,D[1],L[1])}}return p}function pc(n){return n.type==="MultiPolygon"?n.coordinates.map(t=>({type:"Polygon",coordinates:t})):n.type==="MultiLineString"?n.coordinates.map(t=>({type:"LineString",coordinates:t})):n.type==="MultiPoint"?n.coordinates.map(t=>({type:"Point",coordinates:t})):[n]}class wa{constructor(t,r){this.type=Ie,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Vt(t[1])){const a=t[1];if(a.type==="FeatureCollection")return new wa(a,a.features.map(c=>pc(c.geometry)).flat());if(a.type==="Feature")return new wa(a,pc(a.geometry));if("type"in a&&"coordinates"in a)return new wa(a,pc(a))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,a){const c=r.geometry(),d=c.flat().map(y=>nc([y.x,y.y],r.canonical));if(c.length===0)return NaN;const p=new oc(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,No(d,!1,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,No(d,!1,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,jo(d,!1,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,a){const c=r.geometry(),d=c.flat().map(y=>nc([y.x,y.y],r.canonical));if(c.length===0)return NaN;const p=new oc(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,No(d,!0,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,No(d,!0,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,jo(d,!0,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries);if(t.geometryType()==="Polygon")return function(r,a){const c=r.geometry();if(c.length===0||c[0].length===0)return NaN;const d=Fo(c,0).map(y=>y.map(w=>w.map(M=>nc([M.x,M.y],r.canonical)))),p=new oc(d[0][0][0][1]);let m=1/0;for(const y of a)for(const w of d){switch(y.type){case"Point":m=Math.min(m,jo([y.coordinates],!1,w,p,m));break;case"LineString":m=Math.min(m,jo(y.coordinates,!0,w,p,m));break;case"Polygon":m=Math.min(m,Vd(w,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Zo{constructor(t){this.type=ft,this.key=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const a=t[1];return a==null?r.error("Global state property must be defined."):typeof a!="string"?r.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Zo(a)}evaluate(t){var r;const a=(r=t.globals)===null||r===void 0?void 0:r.globalState;return a&&Object.keys(a).length!==0?Cs(a,this.key):null}eachChild(){}outputDefined(){return!1}}const Ka={"==":ko,"!=":Ad,">":kd,"<":rc,">=":Rd,"<=":zd,array:mt,at:ic,boolean:mt,case:Di,coalesce:ya,collator:zo,format:Ro,image:Do,in:Io,"index-of":Ds,interpolate:tr,"interpolate-hcl":tr,"interpolate-lab":tr,length:Lo,let:Ha,literal:lt,match:ga,number:mt,"number-format":Wa,object:mt,slice:_a,step:Hn,string:mt,"to-boolean":er,"to-color":er,"to-number":er,"to-string":er,var:Rs,within:Wn,distance:wa,"global-state":Zo};class Gr{constructor(t,r,a,c){this.name=t,this.type=r,this._evaluate=a,this.args=c}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){const a=t[0],c=Gr.definitions[a];if(!c)return r.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);const d=Array.isArray(c)?c[0]:c.type,p=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,m=p.filter(([w])=>!Array.isArray(w)||w.length===t.length-1);let y=null;for(const[w,M]of m){y=new zs(r.registry,Vo,r.path,null,r.scope);const C=[];let k=!1;for(let D=1;D<t.length;D++){const L=t[D],j=Array.isArray(w)?w[D-1]:w.type,U=y.parse(L,1+C.length,j);if(!U){k=!0;break}C.push(U)}if(!k)if(Array.isArray(w)&&w.length!==C.length)y.error(`Expected ${w.length} arguments, but found ${C.length} instead.`);else{for(let D=0;D<C.length;D++){const L=Array.isArray(w)?w[D]:w.type,j=C[D];y.concat(D+1).checkSubtype(L,j.type)}if(y.errors.length===0)return new Gr(a,d,M,C)}}if(m.length===1)r.errors.push(...y.errors);else{const w=(m.length?m:p).map(([C])=>{return k=C,Array.isArray(k)?`(${k.map(ei).join(", ")})`:`(${ei(k.type)}...)`;var k}).join(" | "),M=[];for(let C=1;C<t.length;C++){const k=r.parse(t[C],1+M.length);if(!k)return null;M.push(ei(k.type))}r.error(`Expected arguments of type ${w}, but found (${M.join(", ")}) instead.`)}return null}static register(t,r){Gr.definitions=r;for(const a in r)t[a]=Gr}}function ch(n,[t,r,a,c]){t=t.evaluate(n),r=r.evaluate(n),a=a.evaluate(n);const d=c?c.evaluate(n):1,p=ks(t,r,a,d);if(p)throw new Wt(p);return new Mt(t/255,r/255,a/255,d,!1)}function uh(n,t){return n in t}function fc(n,t){const r=t[n];return r===void 0?null:r}function Ta(n){return{type:n}}function Vo(n){if(n instanceof Rs)return Vo(n.boundExpression);if(n instanceof Gr&&n.name==="error"||n instanceof zo||n instanceof Wn||n instanceof wa||n instanceof Zo)return!1;const t=n instanceof er||n instanceof mt;let r=!0;return n.eachChild(a=>{r=t?r&&Vo(a):r&&a instanceof lt}),!!r&&Uo(n)&&$o(n,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Uo(n){if(n instanceof Gr&&(n.name==="get"&&n.args.length===1||n.name==="feature-state"||n.name==="has"&&n.args.length===1||n.name==="properties"||n.name==="geometry-type"||n.name==="id"||/^filter-/.test(n.name))||n instanceof Wn||n instanceof wa)return!1;let t=!0;return n.eachChild(r=>{t&&!Uo(r)&&(t=!1)}),t}function Zs(n){if(n instanceof Gr&&n.name==="feature-state")return!1;let t=!0;return n.eachChild(r=>{t&&!Zs(r)&&(t=!1)}),t}function $o(n,t){if(n instanceof Gr&&t.indexOf(n.name)>=0)return!1;let r=!0;return n.eachChild(a=>{r&&!$o(a,t)&&(r=!1)}),r}function Go(n){return{result:"success",value:n}}function Ya(n){return{result:"error",value:n}}function Ja(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function hh(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function qo(n){return!!n.expression&&n.expression.interpolated}function xt(n){return n instanceof Number?"number":n instanceof String?"string":n instanceof Boolean?"boolean":Array.isArray(n)?"array":n===null?"null":typeof n}function Ho(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&ci(n)===Tr}function Wo(n){return n}function mc(n,t){const r=n.stops&&typeof n.stops[0][0]=="object",a=r||!(r||n.property!==void 0),c=n.type||(qo(t)?"exponential":"interval"),d=function(M){switch(M.type){case"color":return Mt.parse;case"padding":return $i.parse;case"numberArray":return bi.parse;case"colorArray":return Gi.parse;default:return null}}(t);if(d&&((n=Lt({},n)).stops&&(n.stops=n.stops.map(M=>[M[0],d(M[1])])),n.default=d(n.default?n.default:t.default)),n.colorSpace&&(p=n.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${n.colorSpace}"`);var p;const m=function(M){switch(M){case"exponential":return dh;case"interval":return $d;case"categorical":return Ud;case"identity":return Gd;default:throw new Error(`Unknown function type "${M}"`)}}(c);let y,w;if(c==="categorical"){y=Object.create(null);for(const M of n.stops)y[M[0]]=M[1];w=typeof n.stops[0][0]}if(r){const M={},C=[];for(let L=0;L<n.stops.length;L++){const j=n.stops[L],U=j[0].zoom;M[U]===void 0&&(M[U]={zoom:U,type:n.type,property:n.property,default:n.default,stops:[]},C.push(U)),M[U].stops.push([j[0].value,j[1]])}const k=[];for(const L of C)k.push([M[L].zoom,mc(M[L],t)]);const D={name:"linear"};return{kind:"composite",interpolationType:D,interpolationFactor:tr.interpolationFactor.bind(void 0,D),zoomStops:k.map(L=>L[0]),evaluate:({zoom:L},j)=>dh({stops:k,base:n.base},t,L).evaluate(L,j)}}if(a){const M=c==="exponential"?{name:"exponential",base:n.base!==void 0?n.base:1}:null;return{kind:"camera",interpolationType:M,interpolationFactor:tr.interpolationFactor.bind(void 0,M),zoomStops:n.stops.map(C=>C[0]),evaluate:({zoom:C})=>m(n,t,C,y,w)}}return{kind:"source",evaluate(M,C){const k=C&&C.properties?C.properties[n.property]:void 0;return k===void 0?Vs(n.default,t.default):m(n,t,k,y,w)}}}function Vs(n,t,r){return n!==void 0?n:t!==void 0?t:r!==void 0?r:void 0}function Ud(n,t,r,a,c){return Vs(typeof r===c?a[r]:void 0,n.default,t.default)}function $d(n,t,r){if(xt(r)!=="number")return Vs(n.default,t.default);const a=n.stops.length;if(a===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[a-1][0])return n.stops[a-1][1];const c=Ls(n.stops.map(d=>d[0]),r);return n.stops[c][1]}function dh(n,t,r){const a=n.base!==void 0?n.base:1;if(xt(r)!=="number")return Vs(n.default,t.default);const c=n.stops.length;if(c===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[c-1][0])return n.stops[c-1][1];const d=Ls(n.stops.map(M=>M[0]),r),p=function(M,C,k,D){const L=D-k,j=M-k;return L===0?0:C===1?j/L:(Math.pow(C,j)-1)/(Math.pow(C,L)-1)}(r,a,n.stops[d][0],n.stops[d+1][0]),m=n.stops[d][1],y=n.stops[d+1][1],w=pn[t.type]||Wo;return typeof m.evaluate=="function"?{evaluate(...M){const C=m.evaluate.apply(void 0,M),k=y.evaluate.apply(void 0,M);if(C!==void 0&&k!==void 0)return w(C,k,p,n.colorSpace)}}:w(m,y,p,n.colorSpace)}function Gd(n,t,r){switch(t.type){case"color":r=Mt.parse(r);break;case"formatted":r=Mr.fromString(r.toString());break;case"resolvedImage":r=Lr.fromString(r.toString());break;case"padding":r=$i.parse(r);break;case"colorArray":r=Gi.parse(r);break;case"numberArray":r=bi.parse(r);break;default:xt(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return Vs(r,n.default,t.default)}Gr.register(Ka,{error:[{kind:"error"},[it],(n,[t])=>{throw new Wt(t.evaluate(n))}],typeof:[it,[ft],(n,[t])=>ei(ci(t.evaluate(n)))],"to-rgba":[Dr(Ie,4),[oi],(n,[t])=>{const[r,a,c,d]=t.evaluate(n).rgb;return[255*r,255*a,255*c,d]}],rgb:[oi,[Ie,Ie,Ie],ch],rgba:[oi,[Ie,Ie,Ie,Ie],ch],has:{type:pt,overloads:[[[it],(n,[t])=>uh(t.evaluate(n),n.properties())],[[it,Tr],(n,[t,r])=>uh(t.evaluate(n),r.evaluate(n))]]},get:{type:ft,overloads:[[[it],(n,[t])=>fc(t.evaluate(n),n.properties())],[[it,Tr],(n,[t,r])=>fc(t.evaluate(n),r.evaluate(n))]]},"feature-state":[ft,[it],(n,[t])=>fc(t.evaluate(n),n.featureState||{})],properties:[Tr,[],n=>n.properties()],"geometry-type":[it,[],n=>n.geometryType()],id:[ft,[],n=>n.id()],zoom:[Ie,[],n=>n.globals.zoom],"heatmap-density":[Ie,[],n=>n.globals.heatmapDensity||0],"line-progress":[Ie,[],n=>n.globals.lineProgress||0],accumulated:[ft,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[Ie,Ta(Ie),(n,t)=>{let r=0;for(const a of t)r+=a.evaluate(n);return r}],"*":[Ie,Ta(Ie),(n,t)=>{let r=1;for(const a of t)r*=a.evaluate(n);return r}],"-":{type:Ie,overloads:[[[Ie,Ie],(n,[t,r])=>t.evaluate(n)-r.evaluate(n)],[[Ie],(n,[t])=>-t.evaluate(n)]]},"/":[Ie,[Ie,Ie],(n,[t,r])=>t.evaluate(n)/r.evaluate(n)],"%":[Ie,[Ie,Ie],(n,[t,r])=>t.evaluate(n)%r.evaluate(n)],ln2:[Ie,[],()=>Math.LN2],pi:[Ie,[],()=>Math.PI],e:[Ie,[],()=>Math.E],"^":[Ie,[Ie,Ie],(n,[t,r])=>Math.pow(t.evaluate(n),r.evaluate(n))],sqrt:[Ie,[Ie],(n,[t])=>Math.sqrt(t.evaluate(n))],log10:[Ie,[Ie],(n,[t])=>Math.log(t.evaluate(n))/Math.LN10],ln:[Ie,[Ie],(n,[t])=>Math.log(t.evaluate(n))],log2:[Ie,[Ie],(n,[t])=>Math.log(t.evaluate(n))/Math.LN2],sin:[Ie,[Ie],(n,[t])=>Math.sin(t.evaluate(n))],cos:[Ie,[Ie],(n,[t])=>Math.cos(t.evaluate(n))],tan:[Ie,[Ie],(n,[t])=>Math.tan(t.evaluate(n))],asin:[Ie,[Ie],(n,[t])=>Math.asin(t.evaluate(n))],acos:[Ie,[Ie],(n,[t])=>Math.acos(t.evaluate(n))],atan:[Ie,[Ie],(n,[t])=>Math.atan(t.evaluate(n))],min:[Ie,Ta(Ie),(n,t)=>Math.min(...t.map(r=>r.evaluate(n)))],max:[Ie,Ta(Ie),(n,t)=>Math.max(...t.map(r=>r.evaluate(n)))],abs:[Ie,[Ie],(n,[t])=>Math.abs(t.evaluate(n))],round:[Ie,[Ie],(n,[t])=>{const r=t.evaluate(n);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ie,[Ie],(n,[t])=>Math.floor(t.evaluate(n))],ceil:[Ie,[Ie],(n,[t])=>Math.ceil(t.evaluate(n))],"filter-==":[pt,[it,ft],(n,[t,r])=>n.properties()[t.value]===r.value],"filter-id-==":[pt,[ft],(n,[t])=>n.id()===t.value],"filter-type-==":[pt,[it],(n,[t])=>n.geometryType()===t.value],"filter-<":[pt,[it,ft],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a<c}],"filter-id-<":[pt,[ft],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r<a}],"filter->":[pt,[it,ft],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a>c}],"filter-id->":[pt,[ft],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r>a}],"filter-<=":[pt,[it,ft],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a<=c}],"filter-id-<=":[pt,[ft],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r<=a}],"filter->=":[pt,[it,ft],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a>=c}],"filter-id->=":[pt,[ft],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r>=a}],"filter-has":[pt,[ft],(n,[t])=>t.value in n.properties()],"filter-has-id":[pt,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[pt,[Dr(it)],(n,[t])=>t.value.indexOf(n.geometryType())>=0],"filter-id-in":[pt,[Dr(ft)],(n,[t])=>t.value.indexOf(n.id())>=0],"filter-in-small":[pt,[it,Dr(ft)],(n,[t,r])=>r.value.indexOf(n.properties()[t.value])>=0],"filter-in-large":[pt,[it,Dr(ft)],(n,[t,r])=>function(a,c,d,p){for(;d<=p;){const m=d+p>>1;if(c[m]===a)return!0;c[m]>a?p=m-1:d=m+1}return!1}(n.properties()[t.value],r.value,0,r.value.length-1)],all:{type:pt,overloads:[[[pt,pt],(n,[t,r])=>t.evaluate(n)&&r.evaluate(n)],[Ta(pt),(n,t)=>{for(const r of t)if(!r.evaluate(n))return!1;return!0}]]},any:{type:pt,overloads:[[[pt,pt],(n,[t,r])=>t.evaluate(n)||r.evaluate(n)],[Ta(pt),(n,t)=>{for(const r of t)if(r.evaluate(n))return!0;return!1}]]},"!":[pt,[pt],(n,[t])=>!t.evaluate(n)],"is-supported-script":[pt,[it],(n,[t])=>{const r=n.globals&&n.globals.isSupportedScript;return!r||r(t.evaluate(n))}],upcase:[it,[it],(n,[t])=>t.evaluate(n).toUpperCase()],downcase:[it,[it],(n,[t])=>t.evaluate(n).toLowerCase()],concat:[it,Ta(ft),(n,t)=>t.map(r=>St(r.evaluate(n))).join("")],"resolved-locale":[it,[Na],(n,[t])=>t.evaluate(n).resolvedLocale()]});class Xo{constructor(t,r){this.expression=t,this._warningHistory={},this._evaluator=new tc,this._defaultValue=r?function(a){if(a.type==="color"&&Ho(a.default))return new Mt(0,0,0,0);switch(a.type){case"color":return Mt.parse(a.default)||null;case"padding":return $i.parse(a.default)||null;case"numberArray":return bi.parse(a.default)||null;case"colorArray":return Gi.parse(a.default)||null;case"variableAnchorOffsetCollection":return dr.parse(a.default)||null;case"projectionDefinition":return Sr.parse(a.default)||null;default:return a.default===void 0?null:a.default}}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,a,c,d,p){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=a,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(t,r,a,c,d,p){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=a||null,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p||null;try{const m=this.expression.evaluate(this._evaluator);if(m==null||typeof m=="number"&&m!=m)return this._defaultValue;if(this._enumValues&&!(m in this._enumValues))throw new Wt(`Expected value to be one of ${Object.keys(this._enumValues).map(y=>JSON.stringify(y)).join(", ")}, but found ${JSON.stringify(m)} instead.`);return m}catch(m){return this._warningHistory[m.message]||(this._warningHistory[m.message]=!0,typeof console<"u"&&console.warn(m.message)),this._defaultValue}}}function Us(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in Ka}function Ko(n,t){const r=new zs(Ka,Vo,[],t?function(c){const d={color:oi,string:it,number:Ie,enum:it,boolean:pt,formatted:Ms,padding:ua,numberArray:En,colorArray:Ss,projectionDefinition:li,resolvedImage:ha,variableAnchorOffsetCollection:vi};return c.type==="array"?Dr(d[c.value]||ft,c.length):d[c.type]}(t):void 0),a=r.parse(n,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?Go(new Xo(a,t)):Ya(r.errors)}class gc{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!Zs(r.expression)}evaluateWithoutErrorHandling(t,r,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,r,a,c,d,p)}evaluate(t,r,a,c,d,p){return this._styleExpression.evaluate(t,r,a,c,d,p)}}class Yo{constructor(t,r,a,c){this.kind=t,this.zoomStops=a,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!Zs(r.expression),this.interpolationType=c}evaluateWithoutErrorHandling(t,r,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,r,a,c,d,p)}evaluate(t,r,a,c,d,p){return this._styleExpression.evaluate(t,r,a,c,d,p)}interpolationFactor(t,r,a){return this.interpolationType?tr.interpolationFactor(this.interpolationType,t,r,a):0}}function _c(n,t){const r=Ko(n,t);if(r.result==="error")return r;const a=r.value.expression,c=Uo(a);if(!c&&!Ja(t))return Ya([new Tt("","data expressions not supported")]);const d=$o(a,["zoom"]);if(!d&&!hh(t))return Ya([new Tt("","zoom expressions not supported")]);const p=Gs(a);return p||d?p instanceof Tt?Ya([p]):p instanceof tr&&!qo(t)?Ya([new Tt("",'"interpolate" expressions cannot be used with this property')]):Go(p?new Yo(c?"camera":"composite",r.value,p.labels,p instanceof tr?p.interpolation:void 0):new gc(c?"constant":"source",r.value)):Ya([new Tt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class $s{constructor(t,r){this._parameters=t,this._specification=r,Lt(this,mc(this._parameters,this._specification))}static deserialize(t){return new $s(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Gs(n){let t=null;if(n instanceof Ha)t=Gs(n.result);else if(n instanceof ya){for(const r of n.args)if(t=Gs(r),t)break}else(n instanceof Hn||n instanceof tr)&&n.input instanceof Gr&&n.input.name==="zoom"&&(t=n);return t instanceof Tt||n.eachChild(r=>{const a=Gs(r);a instanceof Tt?t=a:!t&&a?t=new Tt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&a&&t!==a&&(t=new Tt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function qs(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const t of n.slice(1))if(!qs(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const yc={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Hs(n){if(n==null)return{filter:()=>!0,needGeometry:!1};qs(n)||(n=Qo(n));const t=Ko(n,yc);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,a,c)=>t.value.evaluate(r,a,{},c),needGeometry:ph(n)}}function Jo(n,t){return n<t?-1:n>t?1:0}function ph(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let t=1;t<n.length;t++)if(ph(n[t]))return!0;return!1}function Qo(n){if(!n)return!0;const t=n[0];return n.length<=1?t!=="any":t==="=="?xc(n[1],n[2],"=="):t==="!="?el(xc(n[1],n[2],"==")):t==="<"||t===">"||t==="<="||t===">="?xc(n[1],n[2],t):t==="any"?(r=n.slice(1),["any"].concat(r.map(Qo))):t==="all"?["all"].concat(n.slice(1).map(Qo)):t==="none"?["all"].concat(n.slice(1).map(Qo).map(el)):t==="in"?fh(n[1],n.slice(2)):t==="!in"?el(fh(n[1],n.slice(2))):t==="has"?mh(n[1]):t!=="!has"||el(mh(n[1]));var r}function xc(n,t,r){switch(n){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,n,t]}}function fh(n,t){if(t.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",n,["literal",t.sort(Jo)]]:["filter-in-small",n,["literal",t]]}}function mh(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function el(n){return["!",n]}function tl(n){const t=typeof n;if(t==="number"||t==="boolean"||t==="string"||n==null)return JSON.stringify(n);if(Array.isArray(n)){let c="[";for(const d of n)c+=`${tl(d)},`;return`${c}]`}const r=Object.keys(n).sort();let a="{";for(let c=0;c<r.length;c++)a+=`${JSON.stringify(r[c])}:${tl(n[r[c]])},`;return`${a}}`}function gh(n){let t="";for(const r of ge)t+=`/${tl(n[r])}`;return t}function Ws(n){const t=n.value;return t?[new we(n.key,t,"constants have been deprecated as of v8")]:[]}function gi(n){return n instanceof Number||n instanceof String||n instanceof Boolean?n.valueOf():n}function Xn(n){if(Array.isArray(n))return n.map(Xn);if(n instanceof Object&&!(n instanceof Number||n instanceof String||n instanceof Boolean)){const t={};for(const r in n)t[r]=Xn(n[r]);return t}return gi(n)}function Br(n){const t=n.key,r=n.value,a=n.valueSpec||{},c=n.objectElementValidators||{},d=n.style,p=n.styleSpec,m=n.validateSpec;let y=[];const w=xt(r);if(w!=="object")return[new we(t,r,`object expected, ${w} found`)];for(const M in r){const C=M.split(".")[0],k=Cs(a,C)||a["*"];let D;if(Cs(c,C))D=c[C];else if(Cs(a,C))D=m;else if(c["*"])D=c["*"];else{if(!a["*"]){y.push(new we(t,r[M],`unknown property "${M}"`));continue}D=m}y=y.concat(D({key:(t&&`${t}.`)+M,value:r[M],valueSpec:k,style:d,styleSpec:p,object:r,objectKey:M,validateSpec:m},r))}for(const M in a)c[M]||a[M].required&&a[M].default===void 0&&r[M]===void 0&&y.push(new we(t,r,`missing required property "${M}"`));return y}function vc(n){const t=n.value,r=n.valueSpec,a=n.style,c=n.styleSpec,d=n.key,p=n.arrayElementValidator||n.validateSpec;if(xt(t)!=="array")return[new we(d,t,`array expected, ${xt(t)} found`)];if(r.length&&t.length!==r.length)return[new we(d,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new we(d,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let m={type:r.value,values:r.values};c.$version<7&&(m.function=r.function),xt(r.value)==="object"&&(m=r.value);let y=[];for(let w=0;w<t.length;w++)y=y.concat(p({array:t,arrayIndex:w,value:t[w],valueSpec:m,validateSpec:n.validateSpec,style:a,styleSpec:c,key:`${d}[${w}]`}));return y}function Xs(n){const t=n.key,r=n.value,a=n.valueSpec;let c=xt(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new we(t,r,`number expected, ${c} found`)]:"minimum"in a&&r<a.minimum?[new we(t,r,`${r} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&r>a.maximum?[new we(t,r,`${r} is greater than the maximum value ${a.maximum}`)]:[]}function bc(n){const t=n.valueSpec,r=gi(n.value.type);let a,c,d,p={};const m=r!=="categorical"&&n.value.property===void 0,y=!m,w=xt(n.value.stops)==="array"&&xt(n.value.stops[0])==="array"&&xt(n.value.stops[0][0])==="object",M=Br({key:n.key,value:n.value,valueSpec:n.styleSpec.function,validateSpec:n.validateSpec,style:n.style,styleSpec:n.styleSpec,objectElementValidators:{stops:function(D){if(r==="identity")return[new we(D.key,D.value,'identity function may not have a "stops" property')];let L=[];const j=D.value;return L=L.concat(vc({key:D.key,value:j,valueSpec:D.valueSpec,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,arrayElementValidator:C})),xt(j)==="array"&&j.length===0&&L.push(new we(D.key,j,"array must have at least one stop")),L},default:function(D){return D.validateSpec({key:D.key,value:D.value,valueSpec:t,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec})}}});return r==="identity"&&m&&M.push(new we(n.key,n.value,'missing required property "property"')),r==="identity"||n.value.stops||M.push(new we(n.key,n.value,'missing required property "stops"')),r==="exponential"&&n.valueSpec.expression&&!qo(n.valueSpec)&&M.push(new we(n.key,n.value,"exponential functions not supported")),n.styleSpec.$version>=8&&(y&&!Ja(n.valueSpec)?M.push(new we(n.key,n.value,"property functions not supported")):m&&!hh(n.valueSpec)&&M.push(new we(n.key,n.value,"zoom functions not supported"))),r!=="categorical"&&!w||n.value.property!==void 0||M.push(new we(n.key,n.value,'"property" property is required')),M;function C(D){let L=[];const j=D.value,U=D.key;if(xt(j)!=="array")return[new we(U,j,`array expected, ${xt(j)} found`)];if(j.length!==2)return[new we(U,j,`array length 2 expected, length ${j.length} found`)];if(w){if(xt(j[0])!=="object")return[new we(U,j,`object expected, ${xt(j[0])} found`)];if(j[0].zoom===void 0)return[new we(U,j,"object stop key must have zoom")];if(j[0].value===void 0)return[new we(U,j,"object stop key must have value")];if(d&&d>gi(j[0].zoom))return[new we(U,j[0].zoom,"stop zoom values must appear in ascending order")];gi(j[0].zoom)!==d&&(d=gi(j[0].zoom),c=void 0,p={}),L=L.concat(Br({key:`${U}[0]`,value:j[0],valueSpec:{zoom:{}},validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,objectElementValidators:{zoom:Xs,value:k}}))}else L=L.concat(k({key:`${U}[0]`,value:j[0],validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec},j));return Us(Xn(j[1]))?L.concat([new we(`${U}[1]`,j[1],"expressions are not allowed in function stops.")]):L.concat(D.validateSpec({key:`${U}[1]`,value:j[1],valueSpec:t,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec}))}function k(D,L){const j=xt(D.value),U=gi(D.value),X=D.value!==null?D.value:L;if(a){if(j!==a)return[new we(D.key,X,`${j} stop domain type must match previous stop domain type ${a}`)]}else a=j;if(j!=="number"&&j!=="string"&&j!=="boolean")return[new we(D.key,X,"stop domain value must be a number, string, or boolean")];if(j!=="number"&&r!=="categorical"){let ne=`number expected, ${j} found`;return Ja(t)&&r===void 0&&(ne+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new we(D.key,X,ne)]}return r!=="categorical"||j!=="number"||isFinite(U)&&Math.floor(U)===U?r!=="categorical"&&j==="number"&&c!==void 0&&U<c?[new we(D.key,X,"stop domain values must appear in ascending order")]:(c=U,r==="categorical"&&U in p?[new we(D.key,X,"stop domain values must be unique")]:(p[U]=!0,[])):[new we(D.key,X,`integer expected, found ${U}`)]}}function mn(n){const t=(n.expressionContext==="property"?_c:Ko)(Xn(n.value),n.valueSpec);if(t.result==="error")return t.value.map(a=>new we(`${n.key}${a.key}`,n.value,a.message));const r=t.value.expression||t.value._styleExpression.expression;if(n.expressionContext==="property"&&n.propertyKey==="text-font"&&!r.outputDefined())return[new we(n.key,n.value,`Invalid data expression for "${n.propertyKey}". Output values must be contained as literals within the expression.`)];if(n.expressionContext==="property"&&n.propertyType==="layout"&&!Zs(r))return[new we(n.key,n.value,'"feature-state" data expressions are not supported with layout properties.')];if(n.expressionContext==="filter"&&!Zs(r))return[new we(n.key,n.value,'"feature-state" data expressions are not supported with filters.')];if(n.expressionContext&&n.expressionContext.indexOf("cluster")===0){if(!$o(r,["zoom","feature-state"]))return[new we(n.key,n.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(n.expressionContext==="cluster-initial"&&!Uo(r))return[new we(n.key,n.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function wc(n){const t=n.key,r=n.value,a=xt(r);return a!=="string"?[new we(t,r,`color expected, ${a} found`)]:Mt.parse(String(r))?[]:[new we(t,r,`color expected, "${r}" found`)]}function Ks(n){const t=n.key,r=n.value,a=n.valueSpec,c=[];return Array.isArray(a.values)?a.values.indexOf(gi(r))===-1&&c.push(new we(t,r,`expected one of [${a.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(a.values).indexOf(gi(r))===-1&&c.push(new we(t,r,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function Tc(n){return qs(Xn(n.value))?mn(Lt({},n,{expressionContext:"filter",valueSpec:{value:"boolean"}})):_h(n)}function _h(n){const t=n.value,r=n.key;if(xt(t)!=="array")return[new we(r,t,`array expected, ${xt(t)} found`)];const a=n.styleSpec;let c,d=[];if(t.length<1)return[new we(r,t,"filter array must have at least 1 element")];switch(d=d.concat(Ks({key:`${r}[0]`,value:t[0],valueSpec:a.filter_operator,style:n.style,styleSpec:n.styleSpec})),gi(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&gi(t[1])==="$type"&&d.push(new we(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&d.push(new we(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(c=xt(t[1]),c!=="string"&&d.push(new we(`${r}[1]`,t[1],`string expected, ${c} found`)));for(let p=2;p<t.length;p++)c=xt(t[p]),gi(t[1])==="$type"?d=d.concat(Ks({key:`${r}[${p}]`,value:t[p],valueSpec:a.geometry_type,style:n.style,styleSpec:n.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&d.push(new we(`${r}[${p}]`,t[p],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let p=1;p<t.length;p++)d=d.concat(_h({key:`${r}[${p}]`,value:t[p],style:n.style,styleSpec:n.styleSpec}));break;case"has":case"!has":c=xt(t[1]),t.length!==2?d.push(new we(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):c!=="string"&&d.push(new we(`${r}[1]`,t[1],`string expected, ${c} found`))}return d}function yh(n,t){const r=n.key,a=n.validateSpec,c=n.style,d=n.styleSpec,p=n.value,m=n.objectKey,y=d[`${t}_${n.layerType}`];if(!y)return[];const w=m.match(/^(.*)-transition$/);if(t==="paint"&&w&&y[w[1]]&&y[w[1]].transition)return a({key:r,value:p,valueSpec:d.transition,style:c,styleSpec:d});const M=n.valueSpec||y[m];if(!M)return[new we(r,p,`unknown property "${m}"`)];let C;if(xt(p)==="string"&&Ja(M)&&!M.tokens&&(C=/^{([^}]+)}$/.exec(p)))return[new we(r,p,`"${m}" does not support interpolation syntax
6
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(C[1])} }\`.`)];const k=[];return n.layerType==="symbol"&&(m==="text-field"&&c&&!c.glyphs&&k.push(new we(r,p,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&Ho(Xn(p))&&gi(p.type)==="identity"&&k.push(new we(r,p,'"text-font" does not support identity functions'))),k.concat(a({key:n.key,value:p,valueSpec:M,style:c,styleSpec:d,expressionContext:"property",propertyType:t,propertyKey:m}))}function xh(n){return yh(n,"paint")}function Qa(n){return yh(n,"layout")}function es(n){let t=[];const r=n.value,a=n.key,c=n.style,d=n.styleSpec;if(xt(r)!=="object")return[new we(a,r,`object expected, ${xt(r)} found`)];r.type||r.ref||t.push(new we(a,r,'either "type" or "ref" is required'));let p=gi(r.type);const m=gi(r.ref);if(r.id){const y=gi(r.id);for(let w=0;w<n.arrayIndex;w++){const M=c.layers[w];gi(M.id)===y&&t.push(new we(a,r.id,`duplicate layer id "${r.id}", previously used at line ${M.id.__line__}`))}}if("ref"in r){let y;["type","source","source-layer","filter","layout"].forEach(w=>{w in r&&t.push(new we(a,r[w],`"${w}" is prohibited for ref layers`))}),c.layers.forEach(w=>{gi(w.id)===m&&(y=w)}),y?y.ref?t.push(new we(a,r.ref,"ref cannot reference another ref layer")):p=gi(y.type):t.push(new we(a,r.ref,`ref layer "${m}" not found`))}else if(p!=="background")if(r.source){const y=c.sources&&c.sources[r.source],w=y&&gi(y.type);y?w==="vector"&&p==="raster"?t.push(new we(a,r.source,`layer "${r.id}" requires a raster source`)):w!=="raster-dem"&&p==="hillshade"?t.push(new we(a,r.source,`layer "${r.id}" requires a raster-dem source`)):w==="raster"&&p!=="raster"?t.push(new we(a,r.source,`layer "${r.id}" requires a vector source`)):w!=="vector"||r["source-layer"]?w==="raster-dem"&&p!=="hillshade"?t.push(new we(a,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||w==="geojson"&&y.lineMetrics||t.push(new we(a,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new we(a,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new we(a,r.source,`source "${r.source}" not found`))}else t.push(new we(a,r,'missing required property "source"'));return t=t.concat(Br({key:a,value:r,valueSpec:d.layer,style:n.style,styleSpec:n.styleSpec,validateSpec:n.validateSpec,objectElementValidators:{"*":()=>[],type:()=>n.validateSpec({key:`${a}.type`,value:r.type,valueSpec:d.layer.type,style:n.style,styleSpec:n.styleSpec,validateSpec:n.validateSpec,object:r,objectKey:"type"}),filter:Tc,layout:y=>Br({layer:r,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":w=>Qa(Lt({layerType:p},w))}}),paint:y=>Br({layer:r,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":w=>xh(Lt({layerType:p},w))}})}})),t}function Ei(n){const t=n.value,r=n.key,a=xt(t);return a!=="string"?[new we(r,t,`string expected, ${a} found`)]:[]}const ts={promoteId:function({key:n,value:t}){if(xt(t)==="string")return Ei({key:n,value:t});{const r=[];for(const a in t)r.push(...Ei({key:`${n}.${a}`,value:t[a]}));return r}}};function Mc(n){const t=n.value,r=n.key,a=n.styleSpec,c=n.style,d=n.validateSpec;if(!t.type)return[new we(r,t,'"type" is required')];const p=gi(t.type);let m;switch(p){case"vector":case"raster":return m=Br({key:r,value:t,valueSpec:a[`source_${p.replace("-","_")}`],style:n.style,styleSpec:a,objectElementValidators:ts,validateSpec:d}),m;case"raster-dem":return m=function(y){var w;const M=(w=y.sourceName)!==null&&w!==void 0?w:"",C=y.value,k=y.styleSpec,D=k.source_raster_dem,L=y.style;let j=[];const U=xt(C);if(C===void 0)return j;if(U!=="object")return j.push(new we("source_raster_dem",C,`object expected, ${U} found`)),j;const X=gi(C.encoding)==="custom",ne=["redFactor","greenFactor","blueFactor","baseShift"],Y=y.value.encoding?`"${y.value.encoding}"`:"Default";for(const R in C)!X&&ne.includes(R)?j.push(new we(R,C[R],`In "${M}": "${R}" is only valid when "encoding" is set to "custom". ${Y} encoding found`)):D[R]?j=j.concat(y.validateSpec({key:R,value:C[R],valueSpec:D[R],validateSpec:y.validateSpec,style:L,styleSpec:k})):j.push(new we(R,C[R],`unknown property "${R}"`));return j}({sourceName:r,value:t,style:n.style,styleSpec:a,validateSpec:d}),m;case"geojson":if(m=Br({key:r,value:t,valueSpec:a.source_geojson,style:c,styleSpec:a,validateSpec:d,objectElementValidators:ts}),t.cluster)for(const y in t.clusterProperties){const[w,M]=t.clusterProperties[y],C=typeof w=="string"?[w,["accumulated"],["get",y]]:w;m.push(...mn({key:`${r}.${y}.map`,value:M,expressionContext:"cluster-map"})),m.push(...mn({key:`${r}.${y}.reduce`,value:C,expressionContext:"cluster-reduce"}))}return m;case"video":return Br({key:r,value:t,valueSpec:a.source_video,style:c,validateSpec:d,styleSpec:a});case"image":return Br({key:r,value:t,valueSpec:a.source_image,style:c,validateSpec:d,styleSpec:a});case"canvas":return[new we(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ks({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function vh(n){const t=n.value,r=n.styleSpec,a=r.light,c=n.style;let d=[];const p=xt(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new we("light",t,`object expected, ${p} found`)]),d;for(const m in t){const y=m.match(/^(.*)-transition$/);d=d.concat(y&&a[y[1]]&&a[y[1]].transition?n.validateSpec({key:m,value:t[m],valueSpec:r.transition,validateSpec:n.validateSpec,style:c,styleSpec:r}):a[m]?n.validateSpec({key:m,value:t[m],valueSpec:a[m],validateSpec:n.validateSpec,style:c,styleSpec:r}):[new we(m,t[m],`unknown property "${m}"`)])}return d}function bh(n){const t=n.value,r=n.styleSpec,a=r.sky,c=n.style,d=xt(t);if(t===void 0)return[];if(d!=="object")return[new we("sky",t,`object expected, ${d} found`)];let p=[];for(const m in t)p=p.concat(a[m]?n.validateSpec({key:m,value:t[m],valueSpec:a[m],style:c,styleSpec:r}):[new we(m,t[m],`unknown property "${m}"`)]);return p}function is(n){const t=n.value,r=n.styleSpec,a=r.terrain,c=n.style;let d=[];const p=xt(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new we("terrain",t,`object expected, ${p} found`)]),d;for(const m in t)d=d.concat(a[m]?n.validateSpec({key:m,value:t[m],valueSpec:a[m],validateSpec:n.validateSpec,style:c,styleSpec:r}):[new we(m,t[m],`unknown property "${m}"`)]);return d}function Sc(n){let t=[];const r=n.value,a=n.key;if(Array.isArray(r)){const c=[],d=[];for(const p in r)r[p].id&&c.includes(r[p].id)&&t.push(new we(a,r,`all the sprites' ids must be unique, but ${r[p].id} is duplicated`)),c.push(r[p].id),r[p].url&&d.includes(r[p].url)&&t.push(new we(a,r,`all the sprites' URLs must be unique, but ${r[p].url} is duplicated`)),d.push(r[p].url),t=t.concat(Br({key:`${a}[${p}]`,value:r[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:n.validateSpec}));return t}return Ei({key:a,value:r})}function il(n){return t=n.value,t&&t.constructor===Object?[]:[new we(n.key,n.value,`object expected, ${xt(n.value)} found`)];var t}const wh={"*":()=>[],array:vc,boolean:function(n){const t=n.value,r=n.key,a=xt(t);return a!=="boolean"?[new we(r,t,`boolean expected, ${a} found`)]:[]},number:Xs,color:wc,constants:Ws,enum:Ks,filter:Tc,function:bc,layer:es,object:Br,source:Mc,light:vh,sky:bh,terrain:is,projection:function(n){const t=n.value,r=n.styleSpec,a=r.projection,c=n.style,d=xt(t);if(t===void 0)return[];if(d!=="object")return[new we("projection",t,`object expected, ${d} found`)];let p=[];for(const m in t)p=p.concat(a[m]?n.validateSpec({key:m,value:t[m],valueSpec:a[m],style:c,styleSpec:r}):[new we(m,t[m],`unknown property "${m}"`)]);return p},projectionDefinition:function(n){const t=n.key;let r=n.value;r=r instanceof String?r.valueOf():r;const a=xt(r);return a!=="array"||function(c){return Array.isArray(c)&&c.length===3&&typeof c[0]=="string"&&typeof c[1]=="string"&&typeof c[2]=="number"}(r)||function(c){return!!["interpolate","step","literal"].includes(c[0])}(r)?["array","string"].includes(a)?[]:[new we(t,r,`projection expected, invalid type "${a}" found`)]:[new we(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:Ei,formatted:function(n){return Ei(n).length===0?[]:mn(n)},resolvedImage:function(n){return Ei(n).length===0?[]:mn(n)},padding:function(n){const t=n.key,r=n.value;if(xt(r)==="array"){if(r.length<1||r.length>4)return[new we(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];const a={type:"number"};let c=[];for(let d=0;d<r.length;d++)c=c.concat(n.validateSpec({key:`${t}[${d}]`,value:r[d],validateSpec:n.validateSpec,valueSpec:a}));return c}return Xs({key:t,value:r,valueSpec:{}})},numberArray:function(n){const t=n.key,r=n.value;if(xt(r)==="array"){const a={type:"number"};if(r.length<1)return[new we(t,r,"array length at least 1 expected, length 0 found")];let c=[];for(let d=0;d<r.length;d++)c=c.concat(n.validateSpec({key:`${t}[${d}]`,value:r[d],validateSpec:n.validateSpec,valueSpec:a}));return c}return Xs({key:t,value:r,valueSpec:{}})},colorArray:function(n){const t=n.key,r=n.value;if(xt(r)==="array"){if(r.length<1)return[new we(t,r,"array length at least 1 expected, length 0 found")];let a=[];for(let c=0;c<r.length;c++)a=a.concat(wc({key:`${t}[${c}]`,value:r[c]}));return a}return wc({key:t,value:r})},variableAnchorOffsetCollection:function(n){const t=n.key,r=n.value,a=xt(r),c=n.styleSpec;if(a!=="array"||r.length<1||r.length%2!=0)return[new we(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let p=0;p<r.length;p+=2)d=d.concat(Ks({key:`${t}[${p}]`,value:r[p],valueSpec:c.layout_symbol["text-anchor"]})),d=d.concat(vc({key:`${t}[${p+1}]`,value:r[p+1],valueSpec:{length:2,value:"number"},validateSpec:n.validateSpec,style:n.style,styleSpec:c}));return d},sprite:Sc,state:il};function rs(n){const t=n.value,r=n.valueSpec,a=n.styleSpec;return n.validateSpec=rs,r.expression&&Ho(gi(t))?bc(n):r.expression&&Us(Xn(t))?mn(n):r.type&&wh[r.type]?wh[r.type](n):Br(Lt({},n,{valueSpec:r.type?a[r.type]:r}))}function Th(n){const t=n.value,r=n.key,a=Ei(n);return a.length||(t.indexOf("{fontstack}")===-1&&a.push(new we(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&a.push(new we(r,t,'"glyphs" url must include a "{range}" token'))),a}function ir(n,t=$){let r=[];return r=r.concat(rs({key:"",value:n,valueSpec:t.$root,styleSpec:t,style:n,validateSpec:rs,objectElementValidators:{glyphs:Th,"*":()=>[]}})),n.constants&&(r=r.concat(Ws({key:"constants",value:n.constants}))),ns(r)}function Qr(n){return function(t){return n({...t,validateSpec:rs})}}function ns(n){return[].concat(n).sort((t,r)=>t.line-r.line)}function en(n){return function(...t){return ns(n.apply(this,t))}}ir.source=en(Qr(Mc)),ir.sprite=en(Qr(Sc)),ir.glyphs=en(Qr(Th)),ir.light=en(Qr(vh)),ir.sky=en(Qr(bh)),ir.terrain=en(Qr(is)),ir.state=en(Qr(il)),ir.layer=en(Qr(es)),ir.filter=en(Qr(Tc)),ir.paintProperty=en(Qr(xh)),ir.layoutProperty=en(Qr(Qa));const as=ir,rl=as.light,qd=as.sky,Pc=as.paintProperty,nl=as.layoutProperty;function Cc(n,t){let r=!1;if(t&&t.length)for(const a of t)n.fire(new J(new Error(a.message))),r=!0;return r}class ss{constructor(t,r,a){const c=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const p=new Int32Array(this.arrayBuffer);t=p[0],this.d=(r=p[1])+2*(a=p[2]);for(let y=0;y<this.d*this.d;y++){const w=p[3+y],M=p[3+y+1];c.push(w===M?null:p.subarray(w,M))}const m=p[3+c.length+1];this.keys=p.subarray(p[3+c.length],m),this.bboxes=p.subarray(m),this.insert=this._insertReadonly}else{this.d=r+2*a;for(let p=0;p<this.d*this.d;p++)c.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=a,this.scale=r/t,this.uid=0;const d=a/r*t;this.min=-d,this.max=t+d}insert(t,r,a,c,d){this._forEachCell(r,a,c,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(c),this.bboxes.push(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,a,c,d,p){this.cells[d].push(p)}query(t,r,a,c,d){const p=this.min,m=this.max;if(t<=p&&r<=p&&m<=a&&m<=c&&!d)return Array.prototype.slice.call(this.keys);{const y=[];return this._forEachCell(t,r,a,c,this._queryCell,y,{},d),y}}_queryCell(t,r,a,c,d,p,m,y){const w=this.cells[d];if(w!==null){const M=this.keys,C=this.bboxes;for(let k=0;k<w.length;k++){const D=w[k];if(m[D]===void 0){const L=4*D;(y?y(C[L+0],C[L+1],C[L+2],C[L+3]):t<=C[L+2]&&r<=C[L+3]&&a>=C[L+0]&&c>=C[L+1])?(m[D]=!0,p.push(M[D])):m[D]=!1}}}}_forEachCell(t,r,a,c,d,p,m,y){const w=this._convertToCellCoord(t),M=this._convertToCellCoord(r),C=this._convertToCellCoord(a),k=this._convertToCellCoord(c);for(let D=w;D<=C;D++)for(let L=M;L<=k;L++){const j=this.d*L+D;if((!y||y(this._convertFromCellCoord(D),this._convertFromCellCoord(L),this._convertFromCellCoord(D+1),this._convertFromCellCoord(L+1)))&&d.call(this,t,r,a,c,j,p,m,y))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,r=3+this.cells.length+1+1;let a=0;for(let p=0;p<this.cells.length;p++)a+=this.cells[p].length;const c=new Int32Array(r+a+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let d=r;for(let p=0;p<t.length;p++){const m=t[p];c[3+p]=d,c.set(m,d),d+=m.length}return c[3+t.length]=d,c.set(this.keys,d),d+=this.keys.length,c[3+t.length+1]=d,c.set(this.bboxes,d),d+=this.bboxes.length,c.buffer}static serialize(t,r){const a=t.toArrayBuffer();return r&&r.push(a),{buffer:a}}static deserialize(t){return new ss(t.buffer)}}const gn={};function $e(n,t,r={}){if(gn[n])throw new Error(`${n} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:n,writeable:!1}),gn[n]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}$e("Object",Object),$e("TransferableGridIndex",ss),$e("Color",Mt),$e("Error",Error),$e("AJAXError",Ur),$e("ResolvedImage",Lr),$e("StylePropertyFunction",$s),$e("StyleExpression",Xo,{omit:["_evaluator"]}),$e("ZoomDependentExpression",Yo),$e("ZoomConstantExpression",gc),$e("CompoundExpression",Gr,{omit:["_evaluate"]});for(const n in Ka)Ka[n]._classRegistryKey||$e(`Expression_${n}`,Ka[n]);function al(n){return n&&typeof ArrayBuffer<"u"&&(n instanceof ArrayBuffer||n.constructor&&n.constructor.name==="ArrayBuffer")}function sl(n){return n.$name||n.constructor._classRegistryKey}function Mh(n){return!function(t){if(t===null||typeof t!="object")return!1;const r=sl(t);return!(!r||r==="Object")}(n)&&(n==null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"||n instanceof Boolean||n instanceof Number||n instanceof String||n instanceof Date||n instanceof RegExp||n instanceof Blob||n instanceof Error||al(n)||br(n)||ArrayBuffer.isView(n)||n instanceof ImageData)}function os(n,t){if(Mh(n))return(al(n)||br(n))&&t&&t.push(n),ArrayBuffer.isView(n)&&t&&t.push(n.buffer),n instanceof ImageData&&t&&t.push(n.data.buffer),n;if(Array.isArray(n)){const d=[];for(const p of n)d.push(os(p,t));return d}if(typeof n!="object")throw new Error("can't serialize object of type "+typeof n);const r=sl(n);if(!r)throw new Error(`can't serialize object of unregistered class ${n.constructor.name}`);if(!gn[r])throw new Error(`${r} is not registered.`);const{klass:a}=gn[r],c=a.serialize?a.serialize(n,t):{};if(a.serialize){if(t&&c===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const d in n){if(!n.hasOwnProperty(d)||gn[r].omit.indexOf(d)>=0)continue;const p=n[d];c[d]=gn[r].shallow.indexOf(d)>=0?p:os(p,t)}n instanceof Error&&(c.message=n.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(c.$name=r),c}function Ys(n){if(Mh(n))return n;if(Array.isArray(n))return n.map(Ys);if(typeof n!="object")throw new Error("can't deserialize object of type "+typeof n);const t=sl(n)||"Object";if(!gn[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:r}=gn[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(n);const a=Object.create(r.prototype);for(const c of Object.keys(n)){if(c==="$name")continue;const d=n[c];a[c]=gn[t].shallow.indexOf(c)>=0?d:Ys(d)}return a}class Ic{constructor(){this.first=!0}update(t,r){const a=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<a&&(this.lastIntegerZoom=a,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=a,!0))}}const vt={"Latin-1 Supplement":n=>n>=128&&n<=255,"Hangul Jamo":n=>n>=4352&&n<=4607,Khmer:n=>n>=6016&&n<=6143,"General Punctuation":n=>n>=8192&&n<=8303,"Letterlike Symbols":n=>n>=8448&&n<=8527,"Number Forms":n=>n>=8528&&n<=8591,"Miscellaneous Technical":n=>n>=8960&&n<=9215,"Control Pictures":n=>n>=9216&&n<=9279,"Optical Character Recognition":n=>n>=9280&&n<=9311,"Enclosed Alphanumerics":n=>n>=9312&&n<=9471,"Geometric Shapes":n=>n>=9632&&n<=9727,"Miscellaneous Symbols":n=>n>=9728&&n<=9983,"Miscellaneous Symbols and Arrows":n=>n>=11008&&n<=11263,"Ideographic Description Characters":n=>n>=12272&&n<=12287,"CJK Symbols and Punctuation":n=>n>=12288&&n<=12351,Hiragana:n=>n>=12352&&n<=12447,Katakana:n=>n>=12448&&n<=12543,Kanbun:n=>n>=12688&&n<=12703,"CJK Strokes":n=>n>=12736&&n<=12783,"Enclosed CJK Letters and Months":n=>n>=12800&&n<=13055,"CJK Compatibility":n=>n>=13056&&n<=13311,"Yijing Hexagram Symbols":n=>n>=19904&&n<=19967,"CJK Unified Ideographs":n=>n>=19968&&n<=40959,"Hangul Syllables":n=>n>=44032&&n<=55215,"Private Use Area":n=>n>=57344&&n<=63743,"Vertical Forms":n=>n>=65040&&n<=65055,"CJK Compatibility Forms":n=>n>=65072&&n<=65103,"Small Form Variants":n=>n>=65104&&n<=65135,"Halfwidth and Fullwidth Forms":n=>n>=65280&&n<=65519};function ol(n){for(const t of n)if(ll(t.charCodeAt(0)))return!0;return!1}function Hd(n){for(const t of n)if(!Ph(t.charCodeAt(0)))return!1;return!0}function Ec(n){const t=n.map(r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(t.join("|"),"u")}const Sh=Ec(["Arab","Dupl","Mong","Ougr","Syrc"]);function Ph(n){return!Sh.test(String.fromCodePoint(n))}const Ac=Ec(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function ll(n){return!(n!==746&&n!==747&&(n<4352||!(vt["CJK Compatibility Forms"](n)&&!(n>=65097&&n<=65103)||vt["CJK Compatibility"](n)||vt["CJK Strokes"](n)||!(!vt["CJK Symbols and Punctuation"](n)||n>=12296&&n<=12305||n>=12308&&n<=12319||n===12336)||vt["Enclosed CJK Letters and Months"](n)||vt["Ideographic Description Characters"](n)||vt.Kanbun(n)||vt.Katakana(n)&&n!==12540||!(!vt["Halfwidth and Fullwidth Forms"](n)||n===65288||n===65289||n===65293||n>=65306&&n<=65310||n===65339||n===65341||n===65343||n>=65371&&n<=65503||n===65507||n>=65512&&n<=65519)||!(!vt["Small Form Variants"](n)||n>=65112&&n<=65118||n>=65123&&n<=65126)||vt["Vertical Forms"](n)||vt["Yijing Hexagram Symbols"](n)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(n))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(n))||Ac.test(String.fromCodePoint(n)))))}function Js(n){return!(ll(n)||function(t){return!!(vt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||vt["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||vt["Letterlike Symbols"](t)||vt["Number Forms"](t)||vt["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||vt["Control Pictures"](t)&&t!==9251||vt["Optical Character Recognition"](t)||vt["Enclosed Alphanumerics"](t)||vt["Geometric Shapes"](t)||vt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||vt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||vt["CJK Symbols and Punctuation"](t)||vt.Katakana(t)||vt["Private Use Area"](t)||vt["CJK Compatibility Forms"](t)||vt["Small Form Variants"](t)||vt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(n))}const Wd=Ec(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function cl(n){return Wd.test(String.fromCodePoint(n))}function Xd(n,t){return!(!t&&cl(n)||n>=2304&&n<=3583||n>=3840&&n<=4255||vt.Khmer(n))}function Kd(n){for(const t of n)if(cl(t.charCodeAt(0)))return!0;return!1}const zn=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(n){this.pluginStatus=n.pluginStatus,this.pluginURL=n.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(n){if(zn.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=n.applyArabicShaping,this.processBidirectionalText=n.processBidirectionalText,this.processStyledBidirectionalText=n.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(n,t){return o(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(n.pluginStatus!=="loading")return this.setState(n),n;const r=n.pluginURL,a=new Promise(d=>{this.loadScriptResolve=d});t(r);const c=new Promise(d=>setTimeout(()=>d(),this.TIMEOUT));if(yield Promise.race([a,c]),this.isParsed()){const d={pluginStatus:"loaded",pluginURL:r};return this.setState(d),d}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${r}`)})}};class Xt{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ic,this.transition={})}isSupportedScript(t){return function(r,a){for(const c of r)if(!Xd(c.charCodeAt(0),a))return!1;return!0}(t,zn.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,r=t-Math.floor(t),a=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*r}}}class Qs{constructor(t,r){this.property=t,this.value=r,this.expression=function(a,c){if(Ho(a))return new $s(a,c);if(Us(a)){const d=_c(a,c);if(d.result==="error")throw new Error(d.value.map(p=>`${p.key}: ${p.message}`).join(", "));return d.value}{let d=a;return c.type==="color"&&typeof a=="string"?d=Mt.parse(a):c.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?c.type!=="numberArray"||typeof a!="number"&&!Array.isArray(a)?c.type!=="colorArray"||typeof a!="string"&&!Array.isArray(a)?c.type==="variableAnchorOffsetCollection"&&Array.isArray(a)?d=dr.parse(a):c.type==="projectionDefinition"&&typeof a=="string"&&(d=Sr.parse(a)):d=Gi.parse(a):d=bi.parse(a):d=$i.parse(a),{kind:"constant",evaluate:()=>d}}}(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,a){return this.property.possiblyEvaluate(this,t,r,a)}}class kc{constructor(t){this.property=t,this.value=new Qs(t,void 0)}transitioned(t,r){return new Ih(this.property,this.value,r,Qi({},t.transition,this.transition),t.now)}untransitioned(){return new Ih(this.property,this.value,null,{},0)}}class Ch{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return or(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new kc(this._values[t].property)),this._values[t].value=new Qs(this._values[t].property,r===null?void 0:or(r))}getTransition(t){return or(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new kc(this._values[t].property)),this._values[t].transition=or(r)||void 0}serialize(){const t={};for(const r of Object.keys(this._values)){const a=this.getValue(r);a!==void 0&&(t[r]=a);const c=this.getTransition(r);c!==void 0&&(t[`${r}-transition`]=c)}return t}transitioned(t,r){const a=new Eh(this._properties);for(const c of Object.keys(this._values))a._values[c]=this._values[c].transitioned(t,r._values[c]);return a}untransitioned(){const t=new Eh(this._properties);for(const r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class Ih{constructor(t,r,a,c,d){this.property=t,this.value=r,this.begin=d+c.delay||0,this.end=this.begin+c.duration||0,t.specification.transition&&(c.delay||c.duration)&&(this.prior=a)}possiblyEvaluate(t,r,a){const c=t.now||0,d=this.value.possiblyEvaluate(t,r,a),p=this.prior;if(p){if(c>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(c<this.begin)return p.possiblyEvaluate(t,r,a);{const m=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(t,r,a),d,kr(m))}}return d}}class Eh{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,a){const c=new ul(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,r,a);return c}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Yd{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return or(this._values[t].value)}setValue(t,r){this._values[t]=new Qs(this._values[t].property,r===null?void 0:or(r))}serialize(){const t={};for(const r of Object.keys(this._values)){const a=this.getValue(r);a!==void 0&&(t[r]=a)}return t}possiblyEvaluate(t,r,a){const c=new ul(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,r,a);return c}}class pr{constructor(t,r,a){this.property=t,this.value=r,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,a,c){return this.property.evaluate(this.value,this.parameters,t,r,a,c)}}class ul{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Ke{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,a){const c=pn[this.specification.type];return c?c(t,r,a):t}}class rt{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,a,c){return new pr(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},a,c)}:t.expression,r)}interpolate(t,r,a){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new pr(this,{kind:"constant",value:void 0},t.parameters);const c=pn[this.specification.type];if(c){const d=c(t.value.value,r.value.value,a);return new pr(this,{kind:"constant",value:d},t.parameters)}return t}evaluate(t,r,a,c,d,p){return t.kind==="constant"?t.value:t.evaluate(r,a,c,d,p)}}class eo extends rt{possiblyEvaluate(t,r,a,c){if(t.value===void 0)return new pr(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){const d=t.expression.evaluate(r,null,{},a,c),p=t.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,m=this._calculate(p,p,p,r);return new pr(this,{kind:"constant",value:m},r)}if(t.expression.kind==="camera"){const d=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new pr(this,{kind:"constant",value:d},r)}return new pr(this,t.expression,r)}evaluate(t,r,a,c,d,p){if(t.kind==="source"){const m=t.evaluate(r,a,c,d,p);return this._calculate(m,m,m,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},a,c),t.evaluate({zoom:Math.floor(r.zoom)},a,c),t.evaluate({zoom:Math.floor(r.zoom)+1},a,c),r):t.value}_calculate(t,r,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:a,to:r}}interpolate(t){return t}}class zc{constructor(t){this.specification=t}possiblyEvaluate(t,r,a,c){if(t.value!==void 0){if(t.expression.kind==="constant"){const d=t.expression.evaluate(r,null,{},a,c);return this._calculate(d,d,d,r)}return this._calculate(t.expression.evaluate(new Xt(Math.floor(r.zoom-1),r)),t.expression.evaluate(new Xt(Math.floor(r.zoom),r)),t.expression.evaluate(new Xt(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:a,to:r}}interpolate(t){return t}}class Rc{constructor(t){this.specification=t}possiblyEvaluate(t,r,a,c){return!!t.expression.evaluate(r,null,{},a,c)}interpolate(){return!1}}class Ti{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in t){const a=t[r];a.specification.overridable&&this.overridableProperties.push(r);const c=this.defaultPropertyValues[r]=new Qs(a,void 0),d=this.defaultTransitionablePropertyValues[r]=new kc(a);this.defaultTransitioningPropertyValues[r]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}$e("DataDrivenProperty",rt),$e("DataConstantProperty",Ke),$e("CrossFadedDataDrivenProperty",eo),$e("CrossFadedProperty",zc),$e("ColorRampProperty",Rc);const Dc="-transition";class qr extends ae{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),r.layout&&(this._unevaluatedLayout=new Yd(r.layout)),r.paint)){this._transitionablePaint=new Ch(r.paint);for(const a in t.paint)this.setPaintProperty(a,t.paint[a],{validate:!1});for(const a in t.layout)this.setLayoutProperty(a,t.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ul(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,r,a={}){r!=null&&this._validate(nl,`layers.${this.id}.layout.${t}`,t,r,a)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(Dc)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,a={}){if(r!=null&&this._validate(Pc,`layers.${this.id}.paint.${t}`,t,r,a))return!1;if(t.endsWith(Dc))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{const c=this._transitionablePaint._values[t],d=c.property.specification["property-type"]==="cross-faded-data-driven",p=c.value.isDataDriven(),m=c.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);const y=this._transitionablePaint._values[t].value;return y.isDataDriven()||p||d||this._handleOverridablePaintPropertyUpdate(t,m,y)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,a){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),ca(t,(r,a)=>!(r===void 0||a==="layout"&&!Object.keys(r).length||a==="paint"&&!Object.keys(r).length))}_validate(t,r,a,c,d={}){return(!d||d.validate!==!1)&&Cc(this,t.call(as,{key:r,layerType:this.type,objectKey:a,value:c,styleSpec:$,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const r=this.paint.get(t);if(r instanceof pr&&Ja(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Ah={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ma{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ui{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ii(n,t=1){let r=0,a=0;return{members:n.map(c=>{const d=Ah[c.type].BYTES_PER_ELEMENT,p=r=ls(r,Math.max(t,d)),m=c.components||1;return a=Math.max(a,d),r+=d*m,{name:c.name,type:c.type,components:m,offset:p}}),size:ls(r,Math.max(a,t)),alignment:t}}function ls(n,t){return Math.ceil(n/t)*t}class to extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){const a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){const c=2*t;return this.int16[c+0]=r,this.int16[c+1]=a,t}}to.prototype.bytesPerElement=4,$e("StructArrayLayout2i4",to);class io extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=3*t;return this.int16[d+0]=r,this.int16[d+1]=a,this.int16[d+2]=c,t}}io.prototype.bytesPerElement=6,$e("StructArrayLayout3i6",io);class Sa extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,r,a,c)}emplace(t,r,a,c,d){const p=4*t;return this.int16[p+0]=r,this.int16[p+1]=a,this.int16[p+2]=c,this.int16[p+3]=d,t}}Sa.prototype.bytesPerElement=8,$e("StructArrayLayout4i8",Sa);class Lc extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,a,c,d,p)}emplace(t,r,a,c,d,p,m){const y=6*t;return this.int16[y+0]=r,this.int16[y+1]=a,this.int16[y+2]=c,this.int16[y+3]=d,this.int16[y+4]=p,this.int16[y+5]=m,t}}Lc.prototype.bytesPerElement=12,$e("StructArrayLayout2i4i12",Lc);class Bc extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,a,c,d,p)}emplace(t,r,a,c,d,p,m){const y=4*t,w=8*t;return this.int16[y+0]=r,this.int16[y+1]=a,this.uint8[w+4]=c,this.uint8[w+5]=d,this.uint8[w+6]=p,this.uint8[w+7]=m,t}}Bc.prototype.bytesPerElement=8,$e("StructArrayLayout2i4ub8",Bc);class cs extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){const a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){const c=2*t;return this.float32[c+0]=r,this.float32[c+1]=a,t}}cs.prototype.bytesPerElement=8,$e("StructArrayLayout2f8",cs);class Fc extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,w,M){const C=this.length;return this.resize(C+1),this.emplace(C,t,r,a,c,d,p,m,y,w,M)}emplace(t,r,a,c,d,p,m,y,w,M,C){const k=10*t;return this.uint16[k+0]=r,this.uint16[k+1]=a,this.uint16[k+2]=c,this.uint16[k+3]=d,this.uint16[k+4]=p,this.uint16[k+5]=m,this.uint16[k+6]=y,this.uint16[k+7]=w,this.uint16[k+8]=M,this.uint16[k+9]=C,t}}Fc.prototype.bytesPerElement=20,$e("StructArrayLayout10ui20",Fc);class u extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,w,M,C,k){const D=this.length;return this.resize(D+1),this.emplace(D,t,r,a,c,d,p,m,y,w,M,C,k)}emplace(t,r,a,c,d,p,m,y,w,M,C,k,D){const L=12*t;return this.int16[L+0]=r,this.int16[L+1]=a,this.int16[L+2]=c,this.int16[L+3]=d,this.uint16[L+4]=p,this.uint16[L+5]=m,this.uint16[L+6]=y,this.uint16[L+7]=w,this.int16[L+8]=M,this.int16[L+9]=C,this.int16[L+10]=k,this.int16[L+11]=D,t}}u.prototype.bytesPerElement=24,$e("StructArrayLayout4i4ui4i24",u);class e extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=3*t;return this.float32[d+0]=r,this.float32[d+1]=a,this.float32[d+2]=c,t}}e.prototype.bytesPerElement=12,$e("StructArrayLayout3f12",e);class i extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}i.prototype.bytesPerElement=4,$e("StructArrayLayout1ul4",i);class s extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,w){const M=this.length;return this.resize(M+1),this.emplace(M,t,r,a,c,d,p,m,y,w)}emplace(t,r,a,c,d,p,m,y,w,M){const C=10*t,k=5*t;return this.int16[C+0]=r,this.int16[C+1]=a,this.int16[C+2]=c,this.int16[C+3]=d,this.int16[C+4]=p,this.int16[C+5]=m,this.uint32[k+3]=y,this.uint16[C+8]=w,this.uint16[C+9]=M,t}}s.prototype.bytesPerElement=20,$e("StructArrayLayout6i1ul2ui20",s);class l extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,a,c,d,p)}emplace(t,r,a,c,d,p,m){const y=6*t;return this.int16[y+0]=r,this.int16[y+1]=a,this.int16[y+2]=c,this.int16[y+3]=d,this.int16[y+4]=p,this.int16[y+5]=m,t}}l.prototype.bytesPerElement=12,$e("StructArrayLayout2i2i2i12",l);class h extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d){const p=this.length;return this.resize(p+1),this.emplace(p,t,r,a,c,d)}emplace(t,r,a,c,d,p){const m=4*t,y=8*t;return this.float32[m+0]=r,this.float32[m+1]=a,this.float32[m+2]=c,this.int16[y+6]=d,this.int16[y+7]=p,t}}h.prototype.bytesPerElement=16,$e("StructArrayLayout2f1f2i16",h);class f extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,a,c,d,p)}emplace(t,r,a,c,d,p,m){const y=16*t,w=4*t,M=8*t;return this.uint8[y+0]=r,this.uint8[y+1]=a,this.float32[w+1]=c,this.float32[w+2]=d,this.int16[M+6]=p,this.int16[M+7]=m,t}}f.prototype.bytesPerElement=16,$e("StructArrayLayout2ub2f2i16",f);class _ extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=3*t;return this.uint16[d+0]=r,this.uint16[d+1]=a,this.uint16[d+2]=c,t}}_.prototype.bytesPerElement=6,$e("StructArrayLayout3ui6",_);class x extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,w,M,C,k,D,L,j,U,X){const ne=this.length;return this.resize(ne+1),this.emplace(ne,t,r,a,c,d,p,m,y,w,M,C,k,D,L,j,U,X)}emplace(t,r,a,c,d,p,m,y,w,M,C,k,D,L,j,U,X,ne){const Y=24*t,R=12*t,V=48*t;return this.int16[Y+0]=r,this.int16[Y+1]=a,this.uint16[Y+2]=c,this.uint16[Y+3]=d,this.uint32[R+2]=p,this.uint32[R+3]=m,this.uint32[R+4]=y,this.uint16[Y+10]=w,this.uint16[Y+11]=M,this.uint16[Y+12]=C,this.float32[R+7]=k,this.float32[R+8]=D,this.uint8[V+36]=L,this.uint8[V+37]=j,this.uint8[V+38]=U,this.uint32[R+10]=X,this.int16[Y+22]=ne,t}}x.prototype.bytesPerElement=48,$e("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",x);class T extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,w,M,C,k,D,L,j,U,X,ne,Y,R,V,Q,fe,ke,ye,Te,De,ze){const Le=this.length;return this.resize(Le+1),this.emplace(Le,t,r,a,c,d,p,m,y,w,M,C,k,D,L,j,U,X,ne,Y,R,V,Q,fe,ke,ye,Te,De,ze)}emplace(t,r,a,c,d,p,m,y,w,M,C,k,D,L,j,U,X,ne,Y,R,V,Q,fe,ke,ye,Te,De,ze,Le){const Se=32*t,Ge=16*t;return this.int16[Se+0]=r,this.int16[Se+1]=a,this.int16[Se+2]=c,this.int16[Se+3]=d,this.int16[Se+4]=p,this.int16[Se+5]=m,this.int16[Se+6]=y,this.int16[Se+7]=w,this.uint16[Se+8]=M,this.uint16[Se+9]=C,this.uint16[Se+10]=k,this.uint16[Se+11]=D,this.uint16[Se+12]=L,this.uint16[Se+13]=j,this.uint16[Se+14]=U,this.uint16[Se+15]=X,this.uint16[Se+16]=ne,this.uint16[Se+17]=Y,this.uint16[Se+18]=R,this.uint16[Se+19]=V,this.uint16[Se+20]=Q,this.uint16[Se+21]=fe,this.uint16[Se+22]=ke,this.uint32[Ge+12]=ye,this.float32[Ge+13]=Te,this.float32[Ge+14]=De,this.uint16[Se+30]=ze,this.uint16[Se+31]=Le,t}}T.prototype.bytesPerElement=64,$e("StructArrayLayout8i15ui1ul2f2ui64",T);class P extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}P.prototype.bytesPerElement=4,$e("StructArrayLayout1f4",P);class A extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=3*t;return this.uint16[6*t+0]=r,this.float32[d+1]=a,this.float32[d+2]=c,t}}A.prototype.bytesPerElement=12,$e("StructArrayLayout1ui2f12",A);class E extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=4*t;return this.uint32[2*t+0]=r,this.uint16[d+2]=a,this.uint16[d+3]=c,t}}E.prototype.bytesPerElement=8,$e("StructArrayLayout1ul2ui8",E);class F extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){const a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){const c=2*t;return this.uint16[c+0]=r,this.uint16[c+1]=a,t}}F.prototype.bytesPerElement=4,$e("StructArrayLayout2ui4",F);class O extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}O.prototype.bytesPerElement=2,$e("StructArrayLayout1ui2",O);class H extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,r,a,c)}emplace(t,r,a,c,d){const p=4*t;return this.float32[p+0]=r,this.float32[p+1]=a,this.float32[p+2]=c,this.float32[p+3]=d,t}}H.prototype.bytesPerElement=16,$e("StructArrayLayout4f16",H);class q extends Ma{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new Fe(this.anchorPointX,this.anchorPointY)}}q.prototype.size=20;class W extends s{get(t){return new q(this,t)}}$e("CollisionBoxArray",W);class K extends Ma{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}K.prototype.size=48;class te extends x{get(t){return new K(this,t)}}$e("PlacedSymbolArray",te);class ee extends Ma{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}ee.prototype.size=64;class ie extends T{get(t){return new ee(this,t)}}$e("SymbolInstanceArray",ie);class se extends P{getoffsetX(t){return this.float32[1*t+0]}}$e("GlyphOffsetArray",se);class re extends io{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}$e("SymbolLineVertexArray",re);class pe extends Ma{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}pe.prototype.size=12;class Me extends A{get(t){return new pe(this,t)}}$e("TextAnchorOffsetArray",Me);class xe extends Ma{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]}}xe.prototype.size=8;class ve extends E{get(t){return new xe(this,t)}}$e("FeatureIndexArray",ve);class be extends to{}class Ne extends to{}class Oe extends to{}class Re extends Lc{}class He extends Bc{}class gt extends cs{}class Pt extends Fc{}class ri extends u{}class Ut extends e{}class ni extends i{}class ai extends l{}class Gt extends f{}class zt extends _{}class Ai extends F{}const Bi=ii([{name:"a_pos",components:2,type:"Int16"}],4),{members:qi}=Bi;class Rt{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,r,a,c){const d=this.segments[this.segments.length-1];return t>Rt.MAX_VERTEX_ARRAY_LENGTH&&Ui(`Max vertices per segment is ${Rt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Rt.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!d||d.vertexLength+t>Rt.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==c?this.createNewSegment(r,a,c):d}createNewSegment(t,r,a){const c={vertexOffset:t.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return a!==void 0&&(c.sortKey=a),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(c),c}getOrCreateLatestSegment(t,r,a){return this.prepareSegment(0,t,r,a)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,a,c){return new Rt([{vertexOffset:t,primitiveOffset:r,vertexLength:a,primitiveLength:c,vaos:{},sortKey:0}])}}function Kn(n,t){return 256*(n=Ht(Math.floor(n),0,255))+Ht(Math.floor(t),0,255)}Rt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,$e("SegmentVector",Rt);const _n=ii([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Yn,Pa,ro,Jn={exports:{}},Ca={exports:{}},Fr={exports:{}},Qn=function(){if(ro)return Jn.exports;ro=1;var n=(Yn||(Yn=1,Ca.exports=function(r,a){var c,d,p,m,y,w,M,C;for(d=r.length-(c=3&r.length),p=a,y=3432918353,w=461845907,C=0;C<d;)M=255&r.charCodeAt(C)|(255&r.charCodeAt(++C))<<8|(255&r.charCodeAt(++C))<<16|(255&r.charCodeAt(++C))<<24,++C,p=27492+(65535&(m=5*(65535&(p=(p^=M=(65535&(M=(M=(65535&M)*y+(((M>>>16)*y&65535)<<16)&4294967295)<<15|M>>>17))*w+(((M>>>16)*w&65535)<<16)&4294967295)<<13|p>>>19))+((5*(p>>>16)&65535)<<16)&4294967295))+((58964+(m>>>16)&65535)<<16);switch(M=0,c){case 3:M^=(255&r.charCodeAt(C+2))<<16;case 2:M^=(255&r.charCodeAt(C+1))<<8;case 1:p^=M=(65535&(M=(M=(65535&(M^=255&r.charCodeAt(C)))*y+(((M>>>16)*y&65535)<<16)&4294967295)<<15|M>>>17))*w+(((M>>>16)*w&65535)<<16)&4294967295}return p^=r.length,p=2246822507*(65535&(p^=p>>>16))+((2246822507*(p>>>16)&65535)<<16)&4294967295,p=3266489909*(65535&(p^=p>>>13))+((3266489909*(p>>>16)&65535)<<16)&4294967295,(p^=p>>>16)>>>0}),Ca.exports),t=(Pa||(Pa=1,Fr.exports=function(r,a){for(var c,d=r.length,p=a^d,m=0;d>=4;)c=1540483477*(65535&(c=255&r.charCodeAt(m)|(255&r.charCodeAt(++m))<<8|(255&r.charCodeAt(++m))<<16|(255&r.charCodeAt(++m))<<24))+((1540483477*(c>>>16)&65535)<<16),p=1540483477*(65535&p)+((1540483477*(p>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),d-=4,++m;switch(d){case 3:p^=(255&r.charCodeAt(m+2))<<16;case 2:p^=(255&r.charCodeAt(m+1))<<8;case 1:p=1540483477*(65535&(p^=255&r.charCodeAt(m)))+((1540483477*(p>>>16)&65535)<<16)}return p=1540483477*(65535&(p^=p>>>13))+((1540483477*(p>>>16)&65535)<<16),(p^=p>>>15)>>>0}),Fr.exports);return Jn.exports=n,Jn.exports.murmur3=n,Jn.exports.murmur2=t,Jn.exports}(),Rn=he(Qn);class ea{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,a,c){this.ids.push(Mi(t)),this.positions.push(r,a,c)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Mi(t);let a=0,c=this.ids.length-1;for(;a<c;){const p=a+c>>1;this.ids[p]>=r?c=p:a=p+1}const d=[];for(;this.ids[a]===r;)d.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return d}static serialize(t,r){const a=new Float64Array(t.ids),c=new Uint32Array(t.positions);return Si(a,c,0,a.length-1),r&&r.push(a.buffer,c.buffer),{ids:a,positions:c}}static deserialize(t){const r=new ea;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function Mi(n){const t=+n;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:Rn(String(n))}function Si(n,t,r,a){for(;r<a;){const c=n[r+a>>1];let d=r-1,p=a+1;for(;;){do d++;while(n[d]<c);do p--;while(n[p]>c);if(d>=p)break;fr(n,d,p),fr(t,3*d,3*p),fr(t,3*d+1,3*p+1),fr(t,3*d+2,3*p+2)}p-r<a-p?(Si(n,t,r,p),r=p+1):(Si(n,t,p+1,a),a=p)}}function fr(n,t,r){const a=n[t];n[t]=n[r],n[r]=a}$e("FeaturePositionMap",ea);class Kt{constructor(t,r){this.gl=t.gl,this.location=r}}class hl extends Kt{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class kh extends Kt{constructor(t,r){super(t,r),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class zh extends Kt{constructor(t,r){super(t,r),this.current=Mt.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const Jd=new Float32Array(16);function Oc(n){return[Kn(255*n.r,255*n.g),Kn(255*n.b,255*n.a)]}class no{constructor(t,r,a){this.value=t,this.uniformNames=r.map(c=>`u_${c}`),this.type=a}setUniform(t,r,a){t.set(a.constantOr(this.value))}getBinding(t,r,a){return this.type==="color"?new zh(t,r):new hl(t,r)}}class Hr{constructor(t,r){this.uniformNames=r.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,a,c){const d=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;d&&t.set(d)}getBinding(t,r,a){return a.substr(0,9)==="u_pattern"?new kh(t,r):new hl(t,r)}}class yn{constructor(t,r,a,c){this.expression=t,this.type=a,this.maxValue=0,this.paintVertexAttributes=r.map(d=>({name:`a_${d}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(t,r,a,c,d){const p=this.paintVertexArray.length,m=this.expression.evaluate(new Xt(0),r,{},c,[],d);this.paintVertexArray.resize(t),this._setPaintValue(p,t,m)}updatePaintArray(t,r,a,c){const d=this.expression.evaluate({zoom:0},a,c);this._setPaintValue(t,r,d)}_setPaintValue(t,r,a){if(this.type==="color"){const c=Oc(a);for(let d=t;d<r;d++)this.paintVertexArray.emplace(d,c[0],c[1])}else{for(let c=t;c<r;c++)this.paintVertexArray.emplace(c,a);this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Wr{constructor(t,r,a,c,d,p){this.expression=t,this.uniformNames=r.map(m=>`u_${m}_t`),this.type=a,this.useIntegerZoom=c,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:a==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(t,r,a,c,d){const p=this.expression.evaluate(new Xt(this.zoom),r,{},c,[],d),m=this.expression.evaluate(new Xt(this.zoom+1),r,{},c,[],d),y=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(y,t,p,m)}updatePaintArray(t,r,a,c){const d=this.expression.evaluate({zoom:this.zoom},a,c),p=this.expression.evaluate({zoom:this.zoom+1},a,c);this._setPaintValue(t,r,d,p)}_setPaintValue(t,r,a,c){if(this.type==="color"){const d=Oc(a),p=Oc(c);for(let m=t;m<r;m++)this.paintVertexArray.emplace(m,d[0],d[1],p[0],p[1])}else{for(let d=t;d<r;d++)this.paintVertexArray.emplace(d,a,c);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(c))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,r){const a=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,c=Ht(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);t.set(c)}getBinding(t,r,a){return new hl(t,r)}}class Dn{constructor(t,r,a,c,d,p){this.expression=t,this.type=r,this.useIntegerZoom=a,this.zoom=c,this.layerId=p,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(t,r,a){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(c,t,r.patterns&&r.patterns[this.layerId],a)}updatePaintArray(t,r,a,c,d){this._setPaintValues(t,r,a.patterns&&a.patterns[this.layerId],d)}_setPaintValues(t,r,a,c){if(!c||!a)return;const{min:d,mid:p,max:m}=a,y=c[d],w=c[p],M=c[m];if(y&&w&&M)for(let C=t;C<r;C++)this.zoomInPaintVertexArray.emplace(C,w.tl[0],w.tl[1],w.br[0],w.br[1],y.tl[0],y.tl[1],y.br[0],y.br[1],w.pixelRatio,y.pixelRatio),this.zoomOutPaintVertexArray.emplace(C,w.tl[0],w.tl[1],w.br[0],w.br[1],M.tl[0],M.tl[1],M.br[0],M.br[1],w.pixelRatio,M.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,_n.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,_n.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class dl{constructor(t,r,a){this.binders={},this._buffers=[];const c=[];for(const d in t.paint._values){if(!a(d))continue;const p=t.paint.get(d);if(!(p instanceof pr&&Ja(p.property.specification)))continue;const m=jc(d,t.type),y=p.value,w=p.property.specification.type,M=p.property.useIntegerZoom,C=p.property.specification["property-type"],k=C==="cross-faded"||C==="cross-faded-data-driven";if(y.kind==="constant")this.binders[d]=k?new Hr(y.value,m):new no(y.value,m,w),c.push(`/u_${d}`);else if(y.kind==="source"||k){const D=tm(d,w,"source");this.binders[d]=k?new Dn(y,w,M,r,D,t.id):new yn(y,m,w,D),c.push(`/a_${d}`)}else{const D=tm(d,w,"composite");this.binders[d]=new Wr(y,m,w,M,r,D),c.push(`/z_${d}`)}}this.cacheKey=c.sort().join("")}getMaxValue(t){const r=this.binders[t];return r instanceof yn||r instanceof Wr?r.maxValue:0}populatePaintArrays(t,r,a,c,d){for(const p in this.binders){const m=this.binders[p];(m instanceof yn||m instanceof Wr||m instanceof Dn)&&m.populatePaintArray(t,r,a,c,d)}}setConstantPatternPositions(t,r){for(const a in this.binders){const c=this.binders[a];c instanceof Hr&&c.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,a,c,d){let p=!1;for(const m in t){const y=r.getPositions(m);for(const w of y){const M=a.feature(w.index);for(const C in this.binders){const k=this.binders[C];if((k instanceof yn||k instanceof Wr||k instanceof Dn)&&k.expression.isStateDependent===!0){const D=c.paint.get(C);k.expression=D.value,k.updatePaintArray(w.start,w.end,M,t[m],d),p=!0}}}}return p}defines(){const t=[];for(const r in this.binders){const a=this.binders[r];(a instanceof no||a instanceof Hr)&&t.push(...a.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return t}getBinderAttributes(){const t=[];for(const r in this.binders){const a=this.binders[r];if(a instanceof yn||a instanceof Wr)for(let c=0;c<a.paintVertexAttributes.length;c++)t.push(a.paintVertexAttributes[c].name);else if(a instanceof Dn)for(let c=0;c<_n.members.length;c++)t.push(_n.members[c].name)}return t}getBinderUniforms(){const t=[];for(const r in this.binders){const a=this.binders[r];if(a instanceof no||a instanceof Hr||a instanceof Wr)for(const c of a.uniformNames)t.push(c)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){const a=[];for(const c in this.binders){const d=this.binders[c];if(d instanceof no||d instanceof Hr||d instanceof Wr){for(const p of d.uniformNames)if(r[p]){const m=d.getBinding(t,r[p],p);a.push({name:p,property:c,binding:m})}}}return a}setUniforms(t,r,a,c){for(const{name:d,property:p,binding:m}of r)this.binders[p].setUniform(m,c,a.get(p),d)}updatePaintBuffers(t){this._buffers=[];for(const r in this.binders){const a=this.binders[r];if(t&&a instanceof Dn){const c=t.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(a instanceof yn||a instanceof Wr)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(t){for(const r in this.binders){const a=this.binders[r];(a instanceof yn||a instanceof Wr||a instanceof Dn)&&a.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const r=this.binders[t];(r instanceof yn||r instanceof Wr||r instanceof Dn)&&r.destroy()}}}class ta{constructor(t,r,a=()=>!0){this.programConfigurations={};for(const c of t)this.programConfigurations[c.id]=new dl(c,r,a);this.needsUpload=!1,this._featureMap=new ea,this._bufferOffset=0}populatePaintArrays(t,r,a,c,d,p){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(t,r,c,d,p);r.id!==void 0&&this._featureMap.add(r.id,a,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,a,c){for(const d of a)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(t,this._featureMap,r,d,c)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function jc(n,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"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"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[n]||[n.replace(`${t}-`,"").replace(/-/g,"_")]}function tm(n,t,r){const a={color:{source:cs,composite:H},number:{source:P,composite:cs}},c=function(d){return{"line-pattern":{source:Pt,composite:Pt},"fill-pattern":{source:Pt,composite:Pt},"fill-extrusion-pattern":{source:Pt,composite:Pt}}[d]}(n);return c&&c[r]||a[t][r]}$e("ConstantBinder",no),$e("CrossFadedConstantBinder",Hr),$e("SourceExpressionBinder",yn),$e("CrossFadedCompositeBinder",Dn),$e("CompositeExpressionBinder",Wr),$e("ProgramConfiguration",dl,{omit:["_buffers"]}),$e("ProgramConfigurationSet",ta);const Qd=Math.pow(2,14)-1,im=-Qd-1;function ao(n){const t=Et/n.extent,r=n.loadGeometry();for(let a=0;a<r.length;a++){const c=r[a];for(let d=0;d<c.length;d++){const p=c[d],m=Math.round(p.x*t),y=Math.round(p.y*t);p.x=Ht(m,im,Qd),p.y=Ht(y,im,Qd),(m<p.x||m>p.x+1||y<p.y||y>p.y+1)&&Ui("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function so(n,t){return{type:n.type,id:n.id,properties:n.properties,geometry:t?ao(n):[]}}const rm=-32768;function Px(n,t,r,a,c){n.emplaceBack(rm+8*t+a,rm+8*r+c)}class ep{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ne,this.indexArray=new zt,this.segments=new Rt,this.programConfigurations=new ta(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){const c=this.layers[0],d=[];let p=null,m=!1,y=c.type==="heatmap";if(c.type==="circle"){const M=c;p=M.layout.get("circle-sort-key"),m=!p.isConstant(),y=y||M.paint.get("circle-pitch-alignment")==="map"}const w=y?r.subdivisionGranularity.circle:1;for(const{feature:M,id:C,index:k,sourceLayerIndex:D}of t){const L=this.layers[0]._featureFilter.needGeometry,j=so(M,L);if(!this.layers[0]._featureFilter.filter(new Xt(this.zoom),j,a))continue;const U=m?p.evaluate(j,{},a):void 0,X={id:C,properties:M.properties,type:M.type,sourceLayerIndex:D,index:k,geometry:L?j.geometry:ao(M),patterns:{},sortKey:U};d.push(X)}m&&d.sort((M,C)=>M.sortKey-C.sortKey);for(const M of d){const{geometry:C,index:k,sourceLayerIndex:D}=M,L=t[k].feature;this.addFeature(M,C,k,a,w),r.featureIndex.insert(L,C,k,D,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,qi),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,a,c,d=1){let p;switch(d){case 1:p=[0,7];break;case 3:p=[0,2,5,7];break;case 5:p=[0,1,3,4,6,7];break;case 7:p=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${d}; valid values are 1, 3, 5, 7.`)}const m=p.length;for(const y of r)for(const w of y){const M=w.x,C=w.y;if(M<0||M>=Et||C<0||C>=Et)continue;const k=this.segments.prepareSegment(m*m,this.layoutVertexArray,this.indexArray,t.sortKey),D=k.vertexLength;for(let L=0;L<m;L++)for(let j=0;j<m;j++)Px(this.layoutVertexArray,M,C,p[j],p[L]);for(let L=0;L<m-1;L++)for(let j=0;j<m-1;j++){const U=D+L*m+j,X=D+(L+1)*m+j;this.indexArray.emplaceBack(U,X+1,U+1),this.indexArray.emplaceBack(U,X,X+1)}k.vertexLength+=m*m,k.primitiveLength+=(m-1)*(m-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,{},c)}}function nm(n,t){for(let r=0;r<n.length;r++)if(oo(t,n[r]))return!0;for(let r=0;r<t.length;r++)if(oo(n,t[r]))return!0;return!!tp(n,t)}function Cx(n,t,r){return!!oo(n,t)||!!ip(t,n,r)}function am(n,t){if(n.length===1)return om(t,n[0]);for(let r=0;r<t.length;r++){const a=t[r];for(let c=0;c<a.length;c++)if(oo(n,a[c]))return!0}for(let r=0;r<n.length;r++)if(om(t,n[r]))return!0;for(let r=0;r<t.length;r++)if(tp(n,t[r]))return!0;return!1}function Ix(n,t,r){if(n.length>1){if(tp(n,t))return!0;for(let a=0;a<t.length;a++)if(ip(t[a],n,r))return!0}for(let a=0;a<n.length;a++)if(ip(n[a],t,r))return!0;return!1}function tp(n,t){if(n.length===0||t.length===0)return!1;for(let r=0;r<n.length-1;r++){const a=n[r],c=n[r+1];for(let d=0;d<t.length-1;d++)if(Ex(a,c,t[d],t[d+1]))return!0}return!1}function Ex(n,t,r,a){return Zt(n,r,a)!==Zt(t,r,a)&&Zt(n,t,r)!==Zt(n,t,a)}function ip(n,t,r){const a=r*r;if(t.length===1)return n.distSqr(t[0])<a;for(let c=1;c<t.length;c++)if(sm(n,t[c-1],t[c])<a)return!0;return!1}function sm(n,t,r){const a=t.distSqr(r);if(a===0)return n.distSqr(t);const c=((n.x-t.x)*(r.x-t.x)+(n.y-t.y)*(r.y-t.y))/a;return n.distSqr(c<0?t:c>1?r:r.sub(t)._mult(c)._add(t))}function om(n,t){for(let r=0;r<n.length;r++)if(oo(n[r],t))return!0;return!1}function oo(n,t){let r=!1;for(let a=0,c=n.length-1;a<n.length;c=a++){const d=n[a],p=n[c];d.y>t.y!=p.y>t.y&&t.x<(p.x-d.x)*(t.y-d.y)/(p.y-d.y)+d.x&&(r=!r)}return r}function Ax(n,t,r){const a=r[0],c=r[2];if(n.x<a.x&&t.x<a.x||n.x>c.x&&t.x>c.x||n.y<a.y&&t.y<a.y||n.y>c.y&&t.y>c.y)return!1;const d=Zt(n,t,r[0]);return d!==Zt(n,t,r[1])||d!==Zt(n,t,r[2])||d!==Zt(n,t,r[3])}function Nc(n,t,r){const a=t.paint.get(n).value;return a.kind==="constant"?a.value:r.programConfigurations.get(t.id).getMaxValue(n)}function Rh(n){return Math.sqrt(n[0]*n[0]+n[1]*n[1])}function Dh(n,t,r,a,c){if(!t[0]&&!t[1])return n;const d=Fe.convert(t)._mult(c);r==="viewport"&&d._rotate(-a);const p=[];for(let m=0;m<n.length;m++)p.push(n[m].sub(d));return p}let lm,cm;$e("CircleBucket",ep,{omit:["layers"]});var kx={get paint(){return cm=cm||new Ti({"circle-radius":new rt($.paint_circle["circle-radius"]),"circle-color":new rt($.paint_circle["circle-color"]),"circle-blur":new rt($.paint_circle["circle-blur"]),"circle-opacity":new rt($.paint_circle["circle-opacity"]),"circle-translate":new Ke($.paint_circle["circle-translate"]),"circle-translate-anchor":new Ke($.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ke($.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ke($.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new rt($.paint_circle["circle-stroke-width"]),"circle-stroke-color":new rt($.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new rt($.paint_circle["circle-stroke-opacity"])})},get layout(){return lm=lm||new Ti({"circle-sort-key":new rt($.layout_circle["circle-sort-key"])})}};class zx extends qr{constructor(t){super(t,kx)}createBucket(t){return new ep(t)}queryRadius(t){const r=t;return Nc("circle-radius",this,r)+Nc("circle-stroke-width",this,r)+Rh(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,unwrappedTileID:m,getElevation:y}){const w=Dh(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-d.bearingInRadians,p),M=this.paint.get("circle-radius").evaluate(r,a)+this.paint.get("circle-stroke-width").evaluate(r,a),C=this.paint.get("circle-pitch-alignment")==="map",k=C?w:function(L,j,U,X){return L.map(ne=>um(ne,j,U,X))}(w,d,m,y),D=C?M*p:M;for(const L of c)for(const j of L){const U=C?j:um(j,d,m,y);let X=D;const ne=d.projectTileCoordinates(j.x,j.y,m,y).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?X*=ne/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(X*=d.cameraToCenterDistance/ne),Cx(k,U,X))return!0}return!1}}function um(n,t,r,a){const c=t.projectTileCoordinates(n.x,n.y,r,a).point;return new Fe((.5*c.x+.5)*t.width,(.5*-c.y+.5)*t.height)}class hm extends ep{}let dm;$e("HeatmapBucket",hm,{omit:["layers"]});var Rx={get paint(){return dm=dm||new Ti({"heatmap-radius":new rt($.paint_heatmap["heatmap-radius"]),"heatmap-weight":new rt($.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ke($.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Rc($.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ke($.paint_heatmap["heatmap-opacity"])})}};function rp(n,{width:t,height:r},a,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==t*r*a)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${t*r*a}`)}else c=new Uint8Array(t*r*a);return n.width=t,n.height=r,n.data=c,n}function pm(n,{width:t,height:r},a){if(t===n.width&&r===n.height)return;const c=rp({},{width:t,height:r},a);np(n,c,{x:0,y:0},{x:0,y:0},{width:Math.min(n.width,t),height:Math.min(n.height,r)},a),n.width=t,n.height=r,n.data=c.data}function np(n,t,r,a,c,d){if(c.width===0||c.height===0)return t;if(c.width>n.width||c.height>n.height||r.x>n.width-c.width||r.y>n.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>t.width||c.height>t.height||a.x>t.width-c.width||a.y>t.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const p=n.data,m=t.data;if(p===m)throw new Error("srcData equals dstData, so image is already copied");for(let y=0;y<c.height;y++){const w=((r.y+y)*n.width+r.x)*d,M=((a.y+y)*t.width+a.x)*d;for(let C=0;C<c.width*d;C++)m[M+C]=p[w+C]}return t}class Zc{constructor(t,r){rp(this,t,1,r)}resize(t){pm(this,t,1)}clone(){return new Zc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,a,c,d){np(t,r,a,c,d,1)}}class tn{constructor(t,r){rp(this,t,4,r)}resize(t){pm(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new tn({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,a,c,d){np(t,r,a,c,d,4)}}function fm(n){const t={},r=n.resolution||256,a=n.clips?n.clips.length:1,c=n.image||new tn({width:r,height:a});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const d=(p,m,y)=>{t[n.evaluationKey]=y;const w=n.expression.evaluate(t);c.data[p+m+0]=Math.floor(255*w.r/w.a),c.data[p+m+1]=Math.floor(255*w.g/w.a),c.data[p+m+2]=Math.floor(255*w.b/w.a),c.data[p+m+3]=Math.floor(255*w.a)};if(n.clips)for(let p=0,m=0;p<a;++p,m+=4*r)for(let y=0,w=0;y<r;y++,w+=4){const M=y/(r-1),{start:C,end:k}=n.clips[p];d(m,w,C*(1-M)+k*M)}else for(let p=0,m=0;p<r;p++,m+=4)d(0,m,p/(r-1));return c}$e("AlphaImage",Zc),$e("RGBAImage",tn);const ap="big-fb";class Dx extends qr{createBucket(t){return new hm(t)}constructor(t){super(t,Rx),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=fm({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(ap)&&this.heatmapFbos.delete(ap)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let mm;var Lx={get paint(){return mm=mm||new Ti({"hillshade-illumination-direction":new Ke($.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Ke($.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Ke($.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ke($.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ke($.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ke($.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ke($.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Ke($.paint_hillshade["hillshade-method"])})}};class Bx extends qr{constructor(t){super(t,Lx),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,r=this.paint.get("hillshade-illumination-altitude").values,a=this.paint.get("hillshade-highlight-color").values,c=this.paint.get("hillshade-shadow-color").values;const d=Math.max(t.length,r.length,a.length,c.length);t=t.concat(Array(d-t.length).fill(t.at(-1))),r=r.concat(Array(d-r.length).fill(r.at(-1))),a=a.concat(Array(d-a.length).fill(a.at(-1))),c=c.concat(Array(d-c.length).fill(c.at(-1)));const p=r.map(_t);return{directionRadians:t.map(_t),altitudeRadians:p,shadowColor:c,highlightColor:a}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const Fx=ii([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ox}=Fx;function sp(n,t,r){const a=r.patternDependencies;let c=!1;for(const d of t){const p=d.paint.get(`${n}-pattern`);p.isConstant()||(c=!0);const m=p.constantOr(null);m&&(c=!0,a[m.to]=!0,a[m.from]=!0)}return c}function op(n,t,r,a,c){const d=c.patternDependencies;for(const p of t){const m=p.paint.get(`${n}-pattern`).value;if(m.kind!=="constant"){let y=m.evaluate({zoom:a-1},r,{},c.availableImages),w=m.evaluate({zoom:a},r,{},c.availableImages),M=m.evaluate({zoom:a+1},r,{},c.availableImages);y=y&&y.name?y.name:y,w=w&&w.name?w.name:w,M=M&&M.name?M.name:M,d[y]=!0,d[w]=!0,d[M]=!0,r.patterns[p.id]={min:y,mid:w,max:M}}}return r}function gm(n,t,r,a,c){let d;if(c===function(p,m,y,w){let M=0;for(let C=m,k=y-w;C<y;C+=w)M+=(p[k]-p[C])*(p[C+1]+p[k+1]),k=C;return M}(n,t,r,a)>0)for(let p=t;p<r;p+=a)d=vm(p/a|0,n[p],n[p+1],d);else for(let p=r-a;p>=t;p-=a)d=vm(p/a|0,n[p],n[p+1],d);return d&&pl(d,d.next)&&(Gc(d),d=d.next),d}function lo(n,t){if(!n)return n;t||(t=n);let r,a=n;do if(r=!1,a.steiner||!pl(a,a.next)&&wi(a.prev,a,a.next)!==0)a=a.next;else{if(Gc(a),a=t=a.prev,a===a.next)break;r=!0}while(r||a!==t);return t}function Vc(n,t,r,a,c,d,p){if(!n)return;!p&&d&&function(y,w,M,C){let k=y;do k.z===0&&(k.z=lp(k.x,k.y,w,M,C)),k.prevZ=k.prev,k.nextZ=k.next,k=k.next;while(k!==y);k.prevZ.nextZ=null,k.prevZ=null,function(D){let L,j=1;do{let U,X=D;D=null;let ne=null;for(L=0;X;){L++;let Y=X,R=0;for(let Q=0;Q<j&&(R++,Y=Y.nextZ,Y);Q++);let V=j;for(;R>0||V>0&&Y;)R!==0&&(V===0||!Y||X.z<=Y.z)?(U=X,X=X.nextZ,R--):(U=Y,Y=Y.nextZ,V--),ne?ne.nextZ=U:D=U,U.prevZ=ne,ne=U;X=Y}ne.nextZ=null,j*=2}while(L>1)}(k)}(n,a,c,d);let m=n;for(;n.prev!==n.next;){const y=n.prev,w=n.next;if(d?Nx(n,a,c,d):jx(n))t.push(y.i,n.i,w.i),Gc(n),n=w.next,m=w.next;else if((n=w)===m){p?p===1?Vc(n=Zx(lo(n),t),t,r,a,c,d,2):p===2&&Vx(n,t,r,a,c,d):Vc(lo(n),t,r,a,c,d,1);break}}}function jx(n){const t=n.prev,r=n,a=n.next;if(wi(t,r,a)>=0)return!1;const c=t.x,d=r.x,p=a.x,m=t.y,y=r.y,w=a.y,M=Math.min(c,d,p),C=Math.min(m,y,w),k=Math.max(c,d,p),D=Math.max(m,y,w);let L=a.next;for(;L!==t;){if(L.x>=M&&L.x<=k&&L.y>=C&&L.y<=D&&Uc(c,m,d,y,p,w,L.x,L.y)&&wi(L.prev,L,L.next)>=0)return!1;L=L.next}return!0}function Nx(n,t,r,a){const c=n.prev,d=n,p=n.next;if(wi(c,d,p)>=0)return!1;const m=c.x,y=d.x,w=p.x,M=c.y,C=d.y,k=p.y,D=Math.min(m,y,w),L=Math.min(M,C,k),j=Math.max(m,y,w),U=Math.max(M,C,k),X=lp(D,L,t,r,a),ne=lp(j,U,t,r,a);let Y=n.prevZ,R=n.nextZ;for(;Y&&Y.z>=X&&R&&R.z<=ne;){if(Y.x>=D&&Y.x<=j&&Y.y>=L&&Y.y<=U&&Y!==c&&Y!==p&&Uc(m,M,y,C,w,k,Y.x,Y.y)&&wi(Y.prev,Y,Y.next)>=0||(Y=Y.prevZ,R.x>=D&&R.x<=j&&R.y>=L&&R.y<=U&&R!==c&&R!==p&&Uc(m,M,y,C,w,k,R.x,R.y)&&wi(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;Y&&Y.z>=X;){if(Y.x>=D&&Y.x<=j&&Y.y>=L&&Y.y<=U&&Y!==c&&Y!==p&&Uc(m,M,y,C,w,k,Y.x,Y.y)&&wi(Y.prev,Y,Y.next)>=0)return!1;Y=Y.prevZ}for(;R&&R.z<=ne;){if(R.x>=D&&R.x<=j&&R.y>=L&&R.y<=U&&R!==c&&R!==p&&Uc(m,M,y,C,w,k,R.x,R.y)&&wi(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function Zx(n,t){let r=n;do{const a=r.prev,c=r.next.next;!pl(a,c)&&ym(a,r,r.next,c)&&$c(a,c)&&$c(c,a)&&(t.push(a.i,r.i,c.i),Gc(r),Gc(r.next),r=n=c),r=r.next}while(r!==n);return lo(r)}function Vx(n,t,r,a,c,d){let p=n;do{let m=p.next.next;for(;m!==p.prev;){if(p.i!==m.i&&Hx(p,m)){let y=xm(p,m);return p=lo(p,p.next),y=lo(y,y.next),Vc(p,t,r,a,c,d,0),void Vc(y,t,r,a,c,d,0)}m=m.next}p=p.next}while(p!==n)}function Ux(n,t){let r=n.x-t.x;return r===0&&(r=n.y-t.y,r===0)&&(r=(n.next.y-n.y)/(n.next.x-n.x)-(t.next.y-t.y)/(t.next.x-t.x)),r}function $x(n,t){const r=function(c,d){let p=d;const m=c.x,y=c.y;let w,M=-1/0;if(pl(c,p))return p;do{if(pl(c,p.next))return p.next;if(y<=p.y&&y>=p.next.y&&p.next.y!==p.y){const j=p.x+(y-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(j<=m&&j>M&&(M=j,w=p.x<p.next.x?p:p.next,j===m))return w}p=p.next}while(p!==d);if(!w)return null;const C=w,k=w.x,D=w.y;let L=1/0;p=w;do{if(m>=p.x&&p.x>=k&&m!==p.x&&_m(y<D?m:M,y,k,D,y<D?M:m,y,p.x,p.y)){const j=Math.abs(y-p.y)/(m-p.x);$c(p,c)&&(j<L||j===L&&(p.x>w.x||p.x===w.x&&Gx(w,p)))&&(w=p,L=j)}p=p.next}while(p!==C);return w}(n,t);if(!r)return t;const a=xm(r,n);return lo(a,a.next),lo(r,r.next)}function Gx(n,t){return wi(n.prev,n,t.prev)<0&&wi(t.next,n,n.next)<0}function lp(n,t,r,a,c){return(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-r)*c|0)|n<<8))|n<<4))|n<<2))|n<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-a)*c|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function qx(n){let t=n,r=n;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==n);return r}function _m(n,t,r,a,c,d,p,m){return(c-p)*(t-m)>=(n-p)*(d-m)&&(n-p)*(a-m)>=(r-p)*(t-m)&&(r-p)*(d-m)>=(c-p)*(a-m)}function Uc(n,t,r,a,c,d,p,m){return!(n===p&&t===m)&&_m(n,t,r,a,c,d,p,m)}function Hx(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!function(r,a){let c=r;do{if(c.i!==r.i&&c.next.i!==r.i&&c.i!==a.i&&c.next.i!==a.i&&ym(c,c.next,r,a))return!0;c=c.next}while(c!==r);return!1}(n,t)&&($c(n,t)&&$c(t,n)&&function(r,a){let c=r,d=!1;const p=(r.x+a.x)/2,m=(r.y+a.y)/2;do c.y>m!=c.next.y>m&&c.next.y!==c.y&&p<(c.next.x-c.x)*(m-c.y)/(c.next.y-c.y)+c.x&&(d=!d),c=c.next;while(c!==r);return d}(n,t)&&(wi(n.prev,n,t.prev)||wi(n,t.prev,t))||pl(n,t)&&wi(n.prev,n,n.next)>0&&wi(t.prev,t,t.next)>0)}function wi(n,t,r){return(t.y-n.y)*(r.x-t.x)-(t.x-n.x)*(r.y-t.y)}function pl(n,t){return n.x===t.x&&n.y===t.y}function ym(n,t,r,a){const c=Bh(wi(n,t,r)),d=Bh(wi(n,t,a)),p=Bh(wi(r,a,n)),m=Bh(wi(r,a,t));return c!==d&&p!==m||!(c!==0||!Lh(n,r,t))||!(d!==0||!Lh(n,a,t))||!(p!==0||!Lh(r,n,a))||!(m!==0||!Lh(r,t,a))}function Lh(n,t,r){return t.x<=Math.max(n.x,r.x)&&t.x>=Math.min(n.x,r.x)&&t.y<=Math.max(n.y,r.y)&&t.y>=Math.min(n.y,r.y)}function Bh(n){return n>0?1:n<0?-1:0}function $c(n,t){return wi(n.prev,n,n.next)<0?wi(n,t,n.next)>=0&&wi(n,n.prev,t)>=0:wi(n,t,n.prev)<0||wi(n,n.next,t)<0}function xm(n,t){const r=cp(n.i,n.x,n.y),a=cp(t.i,t.x,t.y),c=n.next,d=t.prev;return n.next=t,t.prev=n,r.next=c,c.prev=r,a.next=r,r.prev=a,d.next=a,a.prev=d,a}function vm(n,t,r,a){const c=cp(n,t,r);return a?(c.next=a.next,c.prev=a,a.next.prev=c,a.next=c):(c.prev=c,c.next=c),c}function Gc(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function cp(n,t,r){return{i:n,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class fl{constructor(t,r){if(r>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=r}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class Fh{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}Fh.noSubdivision=new Fh({fill:new fl(0,0),line:new fl(0,0),tile:new fl(0,0),stencil:new fl(0,0),circle:1}),$e("SubdivisionGranularityExpression",fl),$e("SubdivisionGranularitySetting",Fh);const ml=-32768,qc=32767;class Wx{constructor(t,r){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=Et/t,this._canonical=r}_getKey(t,r){return(t+=32768)<<16|(r+=32768)<<0}_vertexToIndex(t,r){if(t<-32768||r<-32768||t>32767||r>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const a=0|Math.round(t),c=0|Math.round(r),d=this._getKey(a,c);if(this._vertexDictionary.has(d))return this._vertexDictionary.get(d);const p=this._vertexBuffer.length/2;return this._vertexDictionary.set(d,p),this._vertexBuffer.push(a,c),p}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(c,d){const p=[];for(let m=0;m<d.length;m+=3){const y=d[m],w=d[m+1],M=d[m+2],C=c[2*y],k=c[2*y+1];(c[2*w]-C)*(c[2*M+1]-k)-(c[2*w+1]-k)*(c[2*M]-C)>0?(p.push(y),p.push(M),p.push(w)):(p.push(y),p.push(w),p.push(M))}return p}(this._vertexBuffer,t);const r=[],a=t.length;for(let c=0;c<a;c+=3){const d=[t[c+0],t[c+1],t[c+2]],p=[this._vertexBuffer[2*t[c+0]+0],this._vertexBuffer[2*t[c+0]+1],this._vertexBuffer[2*t[c+1]+0],this._vertexBuffer[2*t[c+1]+1],this._vertexBuffer[2*t[c+2]+0],this._vertexBuffer[2*t[c+2]+1]];let m=1/0,y=1/0,w=-1/0,M=-1/0;for(let j=0;j<3;j++){const U=p[2*j],X=p[2*j+1];m=Math.min(m,U),w=Math.max(w,U),y=Math.min(y,X),M=Math.max(M,X)}if(m===w||y===M)continue;const C=Math.floor(m/this._granularityCellSize),k=Math.ceil(w/this._granularityCellSize),D=Math.floor(y/this._granularityCellSize),L=Math.ceil(M/this._granularityCellSize);if(C!==k||D!==L)for(let j=D;j<L;j++){const U=this._scanlineGenerateVertexRingForCellRow(j,p,d);Xx(this._vertexBuffer,U,r)}else r.push(...d)}return r}_scanlineGenerateVertexRingForCellRow(t,r,a){const c=t*this._granularityCellSize,d=c+this._granularityCellSize,p=[];for(let m=0;m<3;m++){const y=r[2*m],w=r[2*m+1],M=r[2*(m+1)%6],C=r[(2*(m+1)+1)%6],k=r[2*(m+2)%6],D=r[(2*(m+2)+1)%6],L=M-y,j=C-w,U=L===0,X=j===0,ne=(c-w)/j,Y=(d-w)/j,R=Math.min(ne,Y),V=Math.max(ne,Y);if(!X&&(R>=1||V<=0)||X&&(w<c||w>d)){C>=c&&C<=d&&p.push(a[(m+1)%3]);continue}!X&&R>0&&p.push(this._vertexToIndex(y+L*R,w+j*R));const Q=y+L*Math.max(R,0),fe=y+L*Math.min(V,1);U||this._generateIntraEdgeVertices(p,y,w,M,C,Q,fe),!X&&V<1&&p.push(this._vertexToIndex(y+L*V,w+j*V)),(X||C>=c&&C<=d)&&p.push(a[(m+1)%3]),!X&&(C<=c||C>=d)&&this._generateInterEdgeVertices(p,y,w,M,C,k,D,fe,c,d)}return p}_generateIntraEdgeVertices(t,r,a,c,d,p,m){const y=c-r,w=d-a,M=w===0,C=M?Math.min(r,c):Math.min(p,m),k=M?Math.max(r,c):Math.max(p,m),D=Math.floor(C/this._granularityCellSize)+1,L=Math.ceil(k/this._granularityCellSize)-1;if(M?r<c:p<m)for(let j=D;j<=L;j++){const U=j*this._granularityCellSize;t.push(this._vertexToIndex(U,a+w*(U-r)/y))}else for(let j=L;j>=D;j--){const U=j*this._granularityCellSize;t.push(this._vertexToIndex(U,a+w*(U-r)/y))}}_generateInterEdgeVertices(t,r,a,c,d,p,m,y,w,M){const C=d-a,k=p-c,D=m-d,L=(w-d)/D,j=(M-d)/D,U=Math.min(L,j),X=Math.max(L,j),ne=c+k*U;let Y=Math.floor(Math.min(ne,y)/this._granularityCellSize)+1,R=Math.ceil(Math.max(ne,y)/this._granularityCellSize)-1,V=y<ne;const Q=D===0;if(Q&&(m===w||m===M))return;if(Q||U>=1||X<=0){const ke=a-m,ye=p+(r-p)*Math.min((w-m)/ke,(M-m)/ke);Y=Math.floor(Math.min(ye,y)/this._granularityCellSize)+1,R=Math.ceil(Math.max(ye,y)/this._granularityCellSize)-1,V=y<ye}const fe=C>0?M:w;if(V)for(let ke=Y;ke<=R;ke++)t.push(this._vertexToIndex(ke*this._granularityCellSize,fe));else for(let ke=R;ke>=Y;ke--)t.push(this._vertexToIndex(ke*this._granularityCellSize,fe))}_generateOutline(t){const r=[];for(const a of t){const c=co(a,this._granularity,!0),d=this._pointArrayToIndices(c),p=[];for(let m=1;m<d.length;m++)p.push(d[m-1]),p.push(d[m]);r.push(p)}return r}_handlePoles(t){let r=!1,a=!1;this._canonical&&(this._canonical.y===0&&(r=!0),this._canonical.y===(1<<this._canonical.z)-1&&(a=!0)),(r||a)&&this._fillPoles(t,r,a)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let r=0;r<t.length;r+=2){const a=t[r+1];a===ml&&(t[r+1]=-32767),a===qc&&(t[r+1]=32766)}}_generatePoleQuad(t,r,a,c,d,p){c>d!=(p===ml)?(t.push(r),t.push(a),t.push(this._vertexToIndex(c,p)),t.push(a),t.push(this._vertexToIndex(d,p)),t.push(this._vertexToIndex(c,p))):(t.push(a),t.push(r),t.push(this._vertexToIndex(c,p)),t.push(this._vertexToIndex(d,p)),t.push(a),t.push(this._vertexToIndex(c,p)))}_fillPoles(t,r,a){const c=this._vertexBuffer,d=Et,p=t.length;for(let m=2;m<p;m+=3){const y=t[m-2],w=t[m-1],M=t[m],C=c[2*y],k=c[2*y+1],D=c[2*w],L=c[2*w+1],j=c[2*M],U=c[2*M+1];r&&(k===0&&L===0&&this._generatePoleQuad(t,y,w,C,D,ml),L===0&&U===0&&this._generatePoleQuad(t,w,M,D,j,ml),U===0&&k===0&&this._generatePoleQuad(t,M,y,j,C,ml)),a&&(k===d&&L===d&&this._generatePoleQuad(t,y,w,C,D,qc),L===d&&U===d&&this._generatePoleQuad(t,w,M,D,j,qc),U===d&&k===d&&this._generatePoleQuad(t,M,y,j,C,qc))}}_initializeVertices(t){for(let r=0;r<t.length;r+=2)this._vertexToIndex(t[r],t[r+1])}subdividePolygonInternal(t,r){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:a,holeIndices:c}=function(m){const y=[],w=[];for(const M of m)if(M.length!==0){M!==m[0]&&y.push(w.length/2);for(let C=0;C<M.length;C++)w.push(M[C].x),w.push(M[C].y)}return{flattened:w,holeIndices:y}}(t);let d;this._initializeVertices(a);try{const m=function(w,M,C=2){const k=M&&M.length,D=k?M[0]*C:w.length;let L=gm(w,0,D,C,!0);const j=[];if(!L||L.next===L.prev)return j;let U,X,ne;if(k&&(L=function(Y,R,V,Q){const fe=[];for(let ke=0,ye=R.length;ke<ye;ke++){const Te=gm(Y,R[ke]*Q,ke<ye-1?R[ke+1]*Q:Y.length,Q,!1);Te===Te.next&&(Te.steiner=!0),fe.push(qx(Te))}fe.sort(Ux);for(let ke=0;ke<fe.length;ke++)V=$x(fe[ke],V);return V}(w,M,L,C)),w.length>80*C){U=1/0,X=1/0;let Y=-1/0,R=-1/0;for(let V=C;V<D;V+=C){const Q=w[V],fe=w[V+1];Q<U&&(U=Q),fe<X&&(X=fe),Q>Y&&(Y=Q),fe>R&&(R=fe)}ne=Math.max(Y-U,R-X),ne=ne!==0?32767/ne:0}return Vc(L,j,C,U,X,ne,0),j}(a,c),y=this._convertIndices(a,m);d=this._subdivideTrianglesScanline(y)}catch(m){console.error(m)}let p=[];return r&&(p=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(d),{verticesFlattened:this._vertexBuffer,indicesTriangles:d,indicesLineList:p}}_convertIndices(t,r){const a=[];for(let c=0;c<r.length;c++)a.push(this._vertexToIndex(t[2*r[c]],t[2*r[c]+1]));return a}_pointArrayToIndices(t){const r=[];for(let a=0;a<t.length;a++){const c=t[a];r.push(this._vertexToIndex(c.x,c.y))}return r}}function bm(n,t,r,a=!0){return new Wx(r,t).subdividePolygonInternal(n,a)}function co(n,t,r=!1){if(!n||n.length<1)return[];if(n.length<2)return[];const a=n[0],c=n[n.length-1],d=r&&(a.x!==c.x||a.y!==c.y);if(t<2)return d?[...n,n[0]]:[...n];const p=Math.floor(Et/t),m=[];m.push(new Fe(n[0].x,n[0].y));const y=n.length,w=d?y:y-1;for(let M=0;M<w;M++){const C=n[M],k=M<y-1?n[M+1]:n[0],D=C.x,L=C.y,j=k.x,U=k.y,X=D!==j,ne=L!==U;if(!X&&!ne)continue;const Y=j-D,R=U-L,V=Math.abs(Y),Q=Math.abs(R);let fe=D,ke=L;for(;;){const Te=Y>0?(Math.floor(fe/p)+1)*p:(Math.ceil(fe/p)-1)*p,De=R>0?(Math.floor(ke/p)+1)*p:(Math.ceil(ke/p)-1)*p,ze=Math.abs(fe-Te),Le=Math.abs(ke-De),Se=Math.abs(fe-j),Ge=Math.abs(ke-U),et=X?ze/V:Number.POSITIVE_INFINITY,Je=ne?Le/Q:Number.POSITIVE_INFINITY;if((Se<=ze||!X)&&(Ge<=Le||!ne))break;if(et<Je&&X||!ne){fe=Te,ke+=R*et;const We=new Fe(fe,Math.round(ke));m[m.length-1].x===We.x&&m[m.length-1].y===We.y||m.push(We)}else{fe+=Y*Je,ke=De;const We=new Fe(Math.round(fe),ke);m[m.length-1].x===We.x&&m[m.length-1].y===We.y||m.push(We)}}const ye=new Fe(j,U);m[m.length-1].x===ye.x&&m[m.length-1].y===ye.y||m.push(ye)}return m}function Xx(n,t,r){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let a=0,c=n[2*t[0]];for(let y=1;y<t.length;y++){const w=n[2*t[y]];w<c&&(c=w,a=y)}const d=t.length;let p=a,m=(p+1)%d;for(;;){const y=p-1>=0?p-1:d-1,w=(m+1)%d,M=n[2*t[y]],C=n[2*t[w]],k=n[2*t[p]],D=n[2*t[p]+1],L=n[2*t[m]+1];let j=!1;if(M<C)j=!0;else if(M>C)j=!1;else{const U=L-D,X=-(n[2*t[m]]-k),ne=D<L?1:-1;((M-k)*U+(n[2*t[y]+1]-D)*X)*ne>((C-k)*U+(n[2*t[w]+1]-D)*X)*ne&&(j=!0)}if(j){const U=t[y],X=t[p],ne=t[m];U!==X&&U!==ne&&X!==ne&&r.push(ne,X,U),p--,p<0&&(p=d-1)}else{const U=t[w],X=t[p],ne=t[m];U!==X&&U!==ne&&X!==ne&&r.push(ne,X,U),m++,m>=d&&(m=0)}if(y===w)break}}function wm(n,t,r,a,c,d,p,m,y){const w=c.length/2,M=p&&m&&y;if(w<Rt.MAX_VERTEX_ARRAY_LENGTH){const C=t.prepareSegment(w,r,a),k=C.vertexLength;for(let j=0;j<d.length;j+=3)a.emplaceBack(k+d[j],k+d[j+1],k+d[j+2]);let D,L;C.vertexLength+=w,C.primitiveLength+=d.length/3,M&&(L=p.prepareSegment(w,r,m),D=L.vertexLength,L.vertexLength+=w);for(let j=0;j<c.length;j+=2)n(c[j],c[j+1]);if(M)for(let j=0;j<y.length;j++){const U=y[j];for(let X=1;X<U.length;X+=2)m.emplaceBack(D+U[X-1],D+U[X]);L.primitiveLength+=U.length/2}}else(function(C,k,D,L,j,U){const X=[];for(let Q=0;Q<L.length/2;Q++)X.push(-1);const ne={count:0};let Y=0,R=C.getOrCreateLatestSegment(k,D),V=R.vertexLength;for(let Q=2;Q<j.length;Q+=3){const fe=j[Q-2],ke=j[Q-1],ye=j[Q];let Te=X[fe]<Y,De=X[ke]<Y,ze=X[ye]<Y;R.vertexLength+((Te?1:0)+(De?1:0)+(ze?1:0))>Rt.MAX_VERTEX_ARRAY_LENGTH&&(R=C.createNewSegment(k,D),Y=ne.count,Te=!0,De=!0,ze=!0,V=0);const Le=Hc(X,L,U,ne,fe,Te,R),Se=Hc(X,L,U,ne,ke,De,R),Ge=Hc(X,L,U,ne,ye,ze,R);D.emplaceBack(V+Le-Y,V+Se-Y,V+Ge-Y),R.primitiveLength++}})(t,r,a,c,d,n),M&&function(C,k,D,L,j,U){const X=[];for(let Q=0;Q<L.length/2;Q++)X.push(-1);const ne={count:0};let Y=0,R=C.getOrCreateLatestSegment(k,D),V=R.vertexLength;for(let Q=0;Q<j.length;Q++){const fe=j[Q];for(let ke=1;ke<j[Q].length;ke+=2){const ye=fe[ke-1],Te=fe[ke];let De=X[ye]<Y,ze=X[Te]<Y;R.vertexLength+((De?1:0)+(ze?1:0))>Rt.MAX_VERTEX_ARRAY_LENGTH&&(R=C.createNewSegment(k,D),Y=ne.count,De=!0,ze=!0,V=0);const Le=Hc(X,L,U,ne,ye,De,R),Se=Hc(X,L,U,ne,Te,ze,R);D.emplaceBack(V+Le-Y,V+Se-Y),R.primitiveLength++}}}(p,r,m,c,y,n),t.forceNewSegmentOnNextPrepare(),p==null||p.forceNewSegmentOnNextPrepare()}function Hc(n,t,r,a,c,d,p){if(d){const m=a.count;return r(t[2*c],t[2*c+1]),n[c]=a.count,a.count++,p.vertexLength++,m}return n[c]}class up{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Oe,this.indexArray=new zt,this.indexArray2=new Ai,this.programConfigurations=new ta(t.layers,t.zoom),this.segments=new Rt,this.segments2=new Rt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.hasPattern=sp("fill",this.layers,r);const c=this.layers[0].layout.get("fill-sort-key"),d=!c.isConstant(),p=[];for(const{feature:m,id:y,index:w,sourceLayerIndex:M}of t){const C=this.layers[0]._featureFilter.needGeometry,k=so(m,C);if(!this.layers[0]._featureFilter.filter(new Xt(this.zoom),k,a))continue;const D=d?c.evaluate(k,{},a,r.availableImages):void 0,L={id:y,properties:m.properties,type:m.type,sourceLayerIndex:M,index:w,geometry:C?k.geometry:ao(m),patterns:{},sortKey:D};p.push(L)}d&&p.sort((m,y)=>m.sortKey-y.sortKey);for(const m of p){const{geometry:y,index:w,sourceLayerIndex:M}=m;if(this.hasPattern){const C=op("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(C)}else this.addFeature(m,y,w,a,{},r.subdivisionGranularity);r.featureIndex.insert(t[w].feature,y,w,M,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}addFeatures(t,r,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ox),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,r,a,c,d,p){for(const m of Fo(r,500)){const y=bm(m,c,p.fill.getGranularityForZoomLevel(c.z)),w=this.layoutVertexArray;wm((M,C)=>{w.emplaceBack(M,C)},this.segments,this.layoutVertexArray,this.indexArray,y.verticesFlattened,y.indicesTriangles,this.segments2,this.indexArray2,y.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}}let Tm,Mm;$e("FillBucket",up,{omit:["layers","patternFeatures"]});var Kx={get paint(){return Mm=Mm||new Ti({"fill-antialias":new Ke($.paint_fill["fill-antialias"]),"fill-opacity":new rt($.paint_fill["fill-opacity"]),"fill-color":new rt($.paint_fill["fill-color"]),"fill-outline-color":new rt($.paint_fill["fill-outline-color"]),"fill-translate":new Ke($.paint_fill["fill-translate"]),"fill-translate-anchor":new Ke($.paint_fill["fill-translate-anchor"]),"fill-pattern":new eo($.paint_fill["fill-pattern"])})},get layout(){return Tm=Tm||new Ti({"fill-sort-key":new rt($.layout_fill["fill-sort-key"])})}};class Yx extends qr{constructor(t){super(t,Kx)}recalculate(t,r){super.recalculate(t,r);const a=this.paint._values["fill-outline-color"];a.value.kind==="constant"&&a.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new up(t)}queryRadius(){return Rh(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:r,transform:a,pixelsToTileUnits:c}){return am(Dh(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-a.bearingInRadians,c),r)}isTileClipped(){return!0}}const Jx=ii([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Qx=ii([{name:"a_centroid",components:2,type:"Int16"}],4),{members:ev}=Jx;var hp,Sm,dp,Pm,pp,Cm,Im,Oh={};function Em(){if(Sm)return hp;Sm=1;var n=Be();function t(c,d,p,m,y){this.properties={},this.extent=p,this.type=0,this._pbf=c,this._geometry=-1,this._keys=m,this._values=y,c.readFields(r,this,d)}function r(c,d,p){c==1?d.id=p.readVarint():c==2?function(m,y){for(var w=m.readVarint()+m.pos;m.pos<w;){var M=y._keys[m.readVarint()],C=y._values[m.readVarint()];y.properties[M]=C}}(p,d):c==3?d.type=p.readVarint():c==4&&(d._geometry=p.pos)}function a(c){for(var d,p,m=0,y=0,w=c.length,M=w-1;y<w;M=y++)m+=((p=c[M]).x-(d=c[y]).x)*(d.y+p.y);return m}return hp=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var c=this._pbf;c.pos=this._geometry;for(var d,p=c.readVarint()+c.pos,m=1,y=0,w=0,M=0,C=[];c.pos<p;){if(y<=0){var k=c.readVarint();m=7&k,y=k>>3}if(y--,m===1||m===2)w+=c.readSVarint(),M+=c.readSVarint(),m===1&&(d&&C.push(d),d=[]),d.push(new n(w,M));else{if(m!==7)throw new Error("unknown command "+m);d&&d.push(d[0].clone())}}return d&&C.push(d),C},t.prototype.bbox=function(){var c=this._pbf;c.pos=this._geometry;for(var d=c.readVarint()+c.pos,p=1,m=0,y=0,w=0,M=1/0,C=-1/0,k=1/0,D=-1/0;c.pos<d;){if(m<=0){var L=c.readVarint();p=7&L,m=L>>3}if(m--,p===1||p===2)(y+=c.readSVarint())<M&&(M=y),y>C&&(C=y),(w+=c.readSVarint())<k&&(k=w),w>D&&(D=w);else if(p!==7)throw new Error("unknown command "+p)}return[M,k,C,D]},t.prototype.toGeoJSON=function(c,d,p){var m,y,w=this.extent*Math.pow(2,p),M=this.extent*c,C=this.extent*d,k=this.loadGeometry(),D=t.types[this.type];function L(X){for(var ne=0;ne<X.length;ne++){var Y=X[ne];X[ne]=[360*(Y.x+M)/w-180,360/Math.PI*Math.atan(Math.exp((180-360*(Y.y+C)/w)*Math.PI/180))-90]}}switch(this.type){case 1:var j=[];for(m=0;m<k.length;m++)j[m]=k[m][0];L(k=j);break;case 2:for(m=0;m<k.length;m++)L(k[m]);break;case 3:for(k=function(X){var ne=X.length;if(ne<=1)return[X];for(var Y,R,V=[],Q=0;Q<ne;Q++){var fe=a(X[Q]);fe!==0&&(R===void 0&&(R=fe<0),R===fe<0?(Y&&V.push(Y),Y=[X[Q]]):Y.push(X[Q]))}return Y&&V.push(Y),V}(k),m=0;m<k.length;m++)for(y=0;y<k[m].length;y++)L(k[m][y])}k.length===1?k=k[0]:D="Multi"+D;var U={type:"Feature",geometry:{type:D,coordinates:k},properties:this.properties};return"id"in this&&(U.id=this.id),U},hp}function Am(){if(Pm)return dp;Pm=1;var n=Em();function t(a,c){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=a,this._keys=[],this._values=[],this._features=[],a.readFields(r,this,c),this.length=this._features.length}function r(a,c,d){a===15?c.version=d.readVarint():a===1?c.name=d.readString():a===5?c.extent=d.readVarint():a===2?c._features.push(d.pos):a===3?c._keys.push(d.readString()):a===4&&c._values.push(function(p){for(var m=null,y=p.readVarint()+p.pos;p.pos<y;){var w=p.readVarint()>>3;m=w===1?p.readString():w===2?p.readFloat():w===3?p.readDouble():w===4?p.readVarint64():w===5?p.readVarint():w===6?p.readSVarint():w===7?p.readBoolean():null}return m}(d))}return dp=t,t.prototype.feature=function(a){if(a<0||a>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[a];var c=this._pbf.readVarint()+this._pbf.pos;return new n(this._pbf,c,this.extent,this._keys,this._values)},dp}function km(){return Im||(Im=1,Oh.VectorTile=function(){if(Cm)return pp;Cm=1;var n=Am();function t(r,a,c){if(r===3){var d=new n(c,c.readVarint()+c.pos);d.length&&(a[d.name]=d)}}return pp=function(r,a){this.layers=r.readFields(t,{},a)},pp}(),Oh.VectorTileFeature=Em(),Oh.VectorTileLayer=Am()),Oh}var Wc=he(km());const tv=Wc.VectorTileFeature.types,fp=Math.pow(2,13);function Xc(n,t,r,a,c,d,p,m){n.emplaceBack(t,r,2*Math.floor(a*fp)+p,c*fp*2,d*fp*2,Math.round(m))}class mp{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Re,this.centroidVertexArray=new be,this.indexArray=new zt,this.programConfigurations=new ta(t.layers,t.zoom),this.segments=new Rt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.features=[],this.hasPattern=sp("fill-extrusion",this.layers,r);for(const{feature:c,id:d,index:p,sourceLayerIndex:m}of t){const y=this.layers[0]._featureFilter.needGeometry,w=so(c,y);if(!this.layers[0]._featureFilter.filter(new Xt(this.zoom),w,a))continue;const M={id:d,sourceLayerIndex:m,index:p,geometry:y?w.geometry:ao(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(op("fill-extrusion",this.layers,M,this.zoom,r)):this.addFeature(M,M.geometry,p,a,{},r.subdivisionGranularity),r.featureIndex.insert(c,M.geometry,p,m,this.index,!0)}}addFeatures(t,r,a){for(const c of this.features){const{geometry:d}=c;this.addFeature(c,d,c.index,r,a,t.subdivisionGranularity)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ev),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Qx.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,a,c,d,p){for(const m of Fo(r,500)){const y={x:0,y:0,sampleCount:0},w=this.layoutVertexArray.length;this.processPolygon(y,c,t,m,p);const M=this.layoutVertexArray.length-w,C=Math.floor(y.x/y.sampleCount),k=Math.floor(y.y/y.sampleCount);for(let D=0;D<M;D++)this.centroidVertexArray.emplaceBack(C,k)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}processPolygon(t,r,a,c,d){if(c.length<1||zm(c[0]))return;for(const C of c)C.length!==0&&iv(t,C);const p={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},m=d.fill.getGranularityForZoomLevel(r.z),y=tv[a.type]==="Polygon";for(const C of c){if(C.length===0||zm(C))continue;const k=co(C,m,y);this._generateSideFaces(k,p)}if(!y)return;const w=bm(c,r,m,!1),M=this.layoutVertexArray;wm((C,k)=>{Xc(M,C,k,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,w.verticesFlattened,w.indicesTriangles)}_generateSideFaces(t,r){let a=0;for(let c=1;c<t.length;c++){const d=t[c],p=t[c-1];if(rv(d,p))continue;r.segment.vertexLength+4>Rt.MAX_VERTEX_ARRAY_LENGTH&&(r.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const m=d.sub(p)._perp()._unit(),y=p.dist(d);a+y>32768&&(a=0),Xc(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,0,a),Xc(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,1,a),a+=y,Xc(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,0,a),Xc(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,1,a);const w=r.segment.vertexLength;this.indexArray.emplaceBack(w,w+2,w+1),this.indexArray.emplaceBack(w+1,w+2,w+3),r.segment.vertexLength+=4,r.segment.primitiveLength+=2}}}function iv(n,t){for(let r=0;r<t.length;r++){const a=t[r];r===t.length-1&&t[0].x===a.x&&t[0].y===a.y||(n.x+=a.x,n.y+=a.y,n.sampleCount++)}}function rv(n,t){return n.x===t.x&&(n.x<0||n.x>Et)||n.y===t.y&&(n.y<0||n.y>Et)}function zm(n){return n.every(t=>t.x<0)||n.every(t=>t.x>Et)||n.every(t=>t.y<0)||n.every(t=>t.y>Et)}let Rm;$e("FillExtrusionBucket",mp,{omit:["layers","features"]});var nv={get paint(){return Rm=Rm||new Ti({"fill-extrusion-opacity":new Ke($["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new rt($["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ke($["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ke($["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new eo($["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new rt($["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new rt($["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ke($["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class av extends qr{constructor(t){super(t,nv)}createBucket(t){return new mp(t)}queryRadius(){return Rh(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,pixelPosMatrix:m}){const y=Dh(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-d.bearingInRadians,p),w=this.paint.get("fill-extrusion-height").evaluate(r,a),M=this.paint.get("fill-extrusion-base").evaluate(r,a),C=function(D,L,j){const U=[];for(const X of D){const ne=[X.x,X.y,0,1];ot(ne,ne,L),U.push(new Fe(ne[0]/ne[3],ne[1]/ne[3]))}return U}(y,m),k=function(D,L,j,U){const X=[],ne=[],Y=U[8]*L,R=U[9]*L,V=U[10]*L,Q=U[11]*L,fe=U[8]*j,ke=U[9]*j,ye=U[10]*j,Te=U[11]*j;for(const De of D){const ze=[],Le=[];for(const Se of De){const Ge=Se.x,et=Se.y,Je=U[0]*Ge+U[4]*et+U[12],We=U[1]*Ge+U[5]*et+U[13],bt=U[2]*Ge+U[6]*et+U[14],hi=U[3]*Ge+U[7]*et+U[15],zi=bt+V,nr=hi+Q,nn=Je+fe,jr=We+ke,Hi=bt+ye,si=hi+Te,Fi=new Fe((Je+Y)/nr,(We+R)/nr);Fi.z=zi/nr,ze.push(Fi);const Wi=new Fe(nn/si,jr/si);Wi.z=Hi/si,Le.push(Wi)}X.push(ze),ne.push(Le)}return[X,ne]}(c,M,w,m);return function(D,L,j){let U=1/0;am(j,L)&&(U=Dm(j,L[0]));for(let X=0;X<L.length;X++){const ne=L[X],Y=D[X];for(let R=0;R<ne.length-1;R++){const V=ne[R],Q=[V,ne[R+1],Y[R+1],Y[R],V];nm(j,Q)&&(U=Math.min(U,Dm(j,Q)))}}return U!==1/0&&U}(k[0],k[1],C)}}function Kc(n,t){return n.x*t.x+n.y*t.y}function Dm(n,t){if(n.length===1){let r=0;const a=t[r++];let c;for(;!c||a.equals(c);)if(c=t[r++],!c)return 1/0;for(;r<t.length;r++){const d=t[r],p=n[0],m=c.sub(a),y=d.sub(a),w=p.sub(a),M=Kc(m,m),C=Kc(m,y),k=Kc(y,y),D=Kc(w,m),L=Kc(w,y),j=M*k-C*C,U=(k*D-C*L)/j,X=(M*L-C*D)/j,ne=a.z*(1-U-X)+c.z*U+d.z*X;if(isFinite(ne))return ne}return 1/0}{let r=1/0;for(const a of t)r=Math.min(r,a.z);return r}}const sv=ii([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ov}=sv,lv=ii([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:cv}=lv,uv=Wc.VectorTileFeature.types,hv=Math.cos(Math.PI/180*37.5),Lm=Math.pow(2,14)/.5;class gp{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new He,this.layoutVertexArray2=new gt,this.indexArray=new zt,this.programConfigurations=new ta(t.layers,t.zoom),this.segments=new Rt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.hasPattern=sp("line",this.layers,r);const c=this.layers[0].layout.get("line-sort-key"),d=!c.isConstant(),p=[];for(const{feature:m,id:y,index:w,sourceLayerIndex:M}of t){const C=this.layers[0]._featureFilter.needGeometry,k=so(m,C);if(!this.layers[0]._featureFilter.filter(new Xt(this.zoom),k,a))continue;const D=d?c.evaluate(k,{},a):void 0,L={id:y,properties:m.properties,type:m.type,sourceLayerIndex:M,index:w,geometry:C?k.geometry:ao(m),patterns:{},sortKey:D};p.push(L)}d&&p.sort((m,y)=>m.sortKey-y.sortKey);for(const m of p){const{geometry:y,index:w,sourceLayerIndex:M}=m;if(this.hasPattern){const C=op("line",this.layers,m,this.zoom,r);this.patternFeatures.push(C)}else this.addFeature(m,y,w,a,{},r.subdivisionGranularity);r.featureIndex.insert(t[w].feature,y,w,M,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}addFeatures(t,r,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,cv)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ov),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,a,c,d,p){const m=this.layers[0].layout,y=m.get("line-join").evaluate(t,{}),w=m.get("line-cap"),M=m.get("line-miter-limit"),C=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const k of r)this.addLine(k,t,y,w,M,C,c,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}addLine(t,r,a,c,d,p,m,y){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=co(t,m?y.line.getGranularityForZoomLevel(m.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Y=0;Y<t.length-1;Y++)this.totalDistance+=t[Y].dist(t[Y+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const w=uv[r.type]==="Polygon";let M=t.length;for(;M>=2&&t[M-1].equals(t[M-2]);)M--;let C=0;for(;C<M-1&&t[C].equals(t[C+1]);)C++;if(M<(w?3:2))return;a==="bevel"&&(d=1.05);const k=this.overscaling<=16?15*Et/(512*this.overscaling):0,D=this.segments.prepareSegment(10*M,this.layoutVertexArray,this.indexArray);let L,j,U,X,ne;this.e1=this.e2=-1,w&&(L=t[M-2],ne=t[C].sub(L)._unit()._perp());for(let Y=C;Y<M;Y++){if(U=Y===M-1?w?t[C+1]:void 0:t[Y+1],U&&t[Y].equals(U))continue;ne&&(X=ne),L&&(j=L),L=t[Y],ne=U?U.sub(L)._unit()._perp():X,X=X||ne;let R=X.add(ne);R.x===0&&R.y===0||R._unit();const V=X.x*ne.x+X.y*ne.y,Q=R.x*ne.x+R.y*ne.y,fe=Q!==0?1/Q:1/0,ke=2*Math.sqrt(2-2*Q),ye=Q<hv&&j&&U,Te=X.x*ne.y-X.y*ne.x>0;if(ye&&Y>C){const Le=L.dist(j);if(Le>2*k){const Se=L.sub(L.sub(j)._mult(k/Le)._round());this.updateDistance(j,Se),this.addCurrentVertex(Se,X,0,0,D),j=Se}}const De=j&&U;let ze=De?a:w?"butt":c;if(De&&ze==="round"&&(fe<p?ze="miter":fe<=2&&(ze="fakeround")),ze==="miter"&&fe>d&&(ze="bevel"),ze==="bevel"&&(fe>2&&(ze="flipbevel"),fe<d&&(ze="miter")),j&&this.updateDistance(j,L),ze==="miter")R._mult(fe),this.addCurrentVertex(L,R,0,0,D);else if(ze==="flipbevel"){if(fe>100)R=ne.mult(-1);else{const Le=fe*X.add(ne).mag()/X.sub(ne).mag();R._perp()._mult(Le*(Te?-1:1))}this.addCurrentVertex(L,R,0,0,D),this.addCurrentVertex(L,R.mult(-1),0,0,D)}else if(ze==="bevel"||ze==="fakeround"){const Le=-Math.sqrt(fe*fe-1),Se=Te?Le:0,Ge=Te?0:Le;if(j&&this.addCurrentVertex(L,X,Se,Ge,D),ze==="fakeround"){const et=Math.round(180*ke/Math.PI/20);for(let Je=1;Je<et;Je++){let We=Je/et;if(We!==.5){const hi=We-.5;We+=We*hi*(We-1)*((1.0904+V*(V*(3.55645-1.43519*V)-3.2452))*hi*hi+(.848013+V*(.215638*V-1.06021)))}const bt=ne.sub(X)._mult(We)._add(X)._unit()._mult(Te?-1:1);this.addHalfVertex(L,bt.x,bt.y,!1,Te,0,D)}}U&&this.addCurrentVertex(L,ne,-Se,-Ge,D)}else if(ze==="butt")this.addCurrentVertex(L,R,0,0,D);else if(ze==="square"){const Le=j?1:-1;this.addCurrentVertex(L,R,Le,Le,D)}else ze==="round"&&(j&&(this.addCurrentVertex(L,X,0,0,D),this.addCurrentVertex(L,X,1,1,D,!0)),U&&(this.addCurrentVertex(L,ne,-1,-1,D,!0),this.addCurrentVertex(L,ne,0,0,D)));if(ye&&Y<M-1){const Le=L.dist(U);if(Le>2*k){const Se=L.add(U.sub(L)._mult(k/Le)._round());this.updateDistance(L,Se),this.addCurrentVertex(Se,ne,0,0,D),L=Se}}}}addCurrentVertex(t,r,a,c,d,p=!1){const m=r.y*c-r.x,y=-r.y-r.x*c;this.addHalfVertex(t,r.x+r.y*a,r.y-r.x*a,p,!1,a,d),this.addHalfVertex(t,m,y,p,!0,-c,d),this.distance>Lm/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,a,c,d,p))}addHalfVertex({x:t,y:r},a,c,d,p,m,y){const w=.5*(this.lineClips?this.scaledDistance*(Lm-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(d?1:0),(r<<1)+(p?1:0),Math.round(63*a)+128,Math.round(63*c)+128,1+(m===0?0:m<0?-1:1)|(63&w)<<2,w>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const M=y.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,M,this.e2),y.primitiveLength++),p?this.e2=M:this.e1=M}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}let Bm,Fm;$e("LineBucket",gp,{omit:["layers","patternFeatures"]});var Om={get paint(){return Fm=Fm||new Ti({"line-opacity":new rt($.paint_line["line-opacity"]),"line-color":new rt($.paint_line["line-color"]),"line-translate":new Ke($.paint_line["line-translate"]),"line-translate-anchor":new Ke($.paint_line["line-translate-anchor"]),"line-width":new rt($.paint_line["line-width"]),"line-gap-width":new rt($.paint_line["line-gap-width"]),"line-offset":new rt($.paint_line["line-offset"]),"line-blur":new rt($.paint_line["line-blur"]),"line-dasharray":new zc($.paint_line["line-dasharray"]),"line-pattern":new eo($.paint_line["line-pattern"]),"line-gradient":new Rc($.paint_line["line-gradient"])})},get layout(){return Bm=Bm||new Ti({"line-cap":new Ke($.layout_line["line-cap"]),"line-join":new rt($.layout_line["line-join"]),"line-miter-limit":new Ke($.layout_line["line-miter-limit"]),"line-round-limit":new Ke($.layout_line["line-round-limit"]),"line-sort-key":new rt($.layout_line["line-sort-key"])})}};class dv extends rt{possiblyEvaluate(t,r){return r=new Xt(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,a,c){return r=Qi({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,a,c)}}let jh;class pv extends qr{constructor(t){super(t,Om),this.gradientVersion=0,jh||(jh=new dv(Om.paint.properties["line-width"].specification),jh.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(a){return a._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof Hn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=jh.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new gp(t)}queryRadius(t){const r=t,a=jm(Nc("line-width",this,r),Nc("line-gap-width",this,r)),c=Nc("line-offset",this,r);return a/2+Math.abs(c)+Rh(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p}){const m=Dh(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,p),y=p/2*jm(this.paint.get("line-width").evaluate(r,a),this.paint.get("line-gap-width").evaluate(r,a)),w=this.paint.get("line-offset").evaluate(r,a);return w&&(c=function(M,C){const k=[];for(let D=0;D<M.length;D++){const L=M[D],j=[];for(let U=0;U<L.length;U++){const X=L[U-1],ne=L[U],Y=L[U+1],R=U===0?new Fe(0,0):ne.sub(X)._unit()._perp(),V=U===L.length-1?new Fe(0,0):Y.sub(ne)._unit()._perp(),Q=R._add(V)._unit(),fe=Q.x*V.x+Q.y*V.y;fe!==0&&Q._mult(1/fe),j.push(Q._mult(C)._add(ne))}k.push(j)}return k}(c,w*p)),function(M,C,k){for(let D=0;D<C.length;D++){const L=C[D];if(M.length>=3){for(let j=0;j<L.length;j++)if(oo(M,L[j]))return!0}if(Ix(M,L,k))return!0}return!1}(m,c,y)}isTileClipped(){return!0}}function jm(n,t){return t>0?t+2*n:n}const fv=ii([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),mv=ii([{name:"a_projected_pos",components:3,type:"Float32"}],4);ii([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const gv=ii([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ii([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Nm=ii([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),_v=ii([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function yv(n,t,r){return n.sections.forEach(a=>{a.text=function(c,d,p){const m=d.layout.get("text-transform").evaluate(p,{});return m==="uppercase"?c=c.toLocaleUpperCase():m==="lowercase"&&(c=c.toLocaleLowerCase()),zn.applyArabicShaping&&(c=zn.applyArabicShaping(c)),c}(a.text,t,r)}),n}ii([{name:"triangle",components:3,type:"Uint16"}]),ii([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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"}]),ii([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),ii([{type:"Float32",name:"offsetX"}]),ii([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ii([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Yc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Zm,_p,Vm,ki=24,yp={};function xv(){return Zm||(Zm=1,yp.read=function(n,t,r,a,c){var d,p,m=8*c-a-1,y=(1<<m)-1,w=y>>1,M=-7,C=r?c-1:0,k=r?-1:1,D=n[t+C];for(C+=k,d=D&(1<<-M)-1,D>>=-M,M+=m;M>0;d=256*d+n[t+C],C+=k,M-=8);for(p=d&(1<<-M)-1,d>>=-M,M+=a;M>0;p=256*p+n[t+C],C+=k,M-=8);if(d===0)d=1-w;else{if(d===y)return p?NaN:1/0*(D?-1:1);p+=Math.pow(2,a),d-=w}return(D?-1:1)*p*Math.pow(2,d-a)},yp.write=function(n,t,r,a,c,d){var p,m,y,w=8*d-c-1,M=(1<<w)-1,C=M>>1,k=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,D=a?0:d-1,L=a?1:-1,j=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(m=isNaN(t)?1:0,p=M):(p=Math.floor(Math.log(t)/Math.LN2),t*(y=Math.pow(2,-p))<1&&(p--,y*=2),(t+=p+C>=1?k/y:k*Math.pow(2,1-C))*y>=2&&(p++,y/=2),p+C>=M?(m=0,p=M):p+C>=1?(m=(t*y-1)*Math.pow(2,c),p+=C):(m=t*Math.pow(2,C-1)*Math.pow(2,c),p=0));c>=8;n[r+D]=255&m,D+=L,m/=256,c-=8);for(p=p<<c|m,w+=c;w>0;n[r+D]=255&p,D+=L,p/=256,w-=8);n[r+D-L]|=128*j}),yp}function Um(){if(Vm)return _p;Vm=1,_p=t;var n=xv();function t(R){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(R)?R:new Uint8Array(R||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var r=4294967296,a=1/r,c=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function d(R){return R.type===t.Bytes?R.readVarint()+R.pos:R.pos+1}function p(R,V,Q){return Q?4294967296*V+(R>>>0):4294967296*(V>>>0)+(R>>>0)}function m(R,V,Q){var fe=V<=16383?1:V<=2097151?2:V<=268435455?3:Math.floor(Math.log(V)/(7*Math.LN2));Q.realloc(fe);for(var ke=Q.pos-1;ke>=R;ke--)Q.buf[ke+fe]=Q.buf[ke]}function y(R,V){for(var Q=0;Q<R.length;Q++)V.writeVarint(R[Q])}function w(R,V){for(var Q=0;Q<R.length;Q++)V.writeSVarint(R[Q])}function M(R,V){for(var Q=0;Q<R.length;Q++)V.writeFloat(R[Q])}function C(R,V){for(var Q=0;Q<R.length;Q++)V.writeDouble(R[Q])}function k(R,V){for(var Q=0;Q<R.length;Q++)V.writeBoolean(R[Q])}function D(R,V){for(var Q=0;Q<R.length;Q++)V.writeFixed32(R[Q])}function L(R,V){for(var Q=0;Q<R.length;Q++)V.writeSFixed32(R[Q])}function j(R,V){for(var Q=0;Q<R.length;Q++)V.writeFixed64(R[Q])}function U(R,V){for(var Q=0;Q<R.length;Q++)V.writeSFixed64(R[Q])}function X(R,V){return(R[V]|R[V+1]<<8|R[V+2]<<16)+16777216*R[V+3]}function ne(R,V,Q){R[Q]=V,R[Q+1]=V>>>8,R[Q+2]=V>>>16,R[Q+3]=V>>>24}function Y(R,V){return(R[V]|R[V+1]<<8|R[V+2]<<16)+(R[V+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(R,V,Q){for(Q=Q||this.length;this.pos<Q;){var fe=this.readVarint(),ke=fe>>3,ye=this.pos;this.type=7&fe,R(ke,V,this),this.pos===ye&&this.skip(fe)}return V},readMessage:function(R,V){return this.readFields(R,V,this.readVarint()+this.pos)},readFixed32:function(){var R=X(this.buf,this.pos);return this.pos+=4,R},readSFixed32:function(){var R=Y(this.buf,this.pos);return this.pos+=4,R},readFixed64:function(){var R=X(this.buf,this.pos)+X(this.buf,this.pos+4)*r;return this.pos+=8,R},readSFixed64:function(){var R=X(this.buf,this.pos)+Y(this.buf,this.pos+4)*r;return this.pos+=8,R},readFloat:function(){var R=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,R},readDouble:function(){var R=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,R},readVarint:function(R){var V,Q,fe=this.buf;return V=127&(Q=fe[this.pos++]),Q<128?V:(V|=(127&(Q=fe[this.pos++]))<<7,Q<128?V:(V|=(127&(Q=fe[this.pos++]))<<14,Q<128?V:(V|=(127&(Q=fe[this.pos++]))<<21,Q<128?V:function(ke,ye,Te){var De,ze,Le=Te.buf;if(De=(112&(ze=Le[Te.pos++]))>>4,ze<128||(De|=(127&(ze=Le[Te.pos++]))<<3,ze<128)||(De|=(127&(ze=Le[Te.pos++]))<<10,ze<128)||(De|=(127&(ze=Le[Te.pos++]))<<17,ze<128)||(De|=(127&(ze=Le[Te.pos++]))<<24,ze<128)||(De|=(1&(ze=Le[Te.pos++]))<<31,ze<128))return p(ke,De,ye);throw new Error("Expected varint not more than 10 bytes")}(V|=(15&(Q=fe[this.pos]))<<28,R,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var R=this.readVarint();return R%2==1?(R+1)/-2:R/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var R=this.readVarint()+this.pos,V=this.pos;return this.pos=R,R-V>=12&&c?function(Q,fe,ke){return c.decode(Q.subarray(fe,ke))}(this.buf,V,R):function(Q,fe,ke){for(var ye="",Te=fe;Te<ke;){var De,ze,Le,Se=Q[Te],Ge=null,et=Se>239?4:Se>223?3:Se>191?2:1;if(Te+et>ke)break;et===1?Se<128&&(Ge=Se):et===2?(192&(De=Q[Te+1]))==128&&(Ge=(31&Se)<<6|63&De)<=127&&(Ge=null):et===3?(ze=Q[Te+2],(192&(De=Q[Te+1]))==128&&(192&ze)==128&&((Ge=(15&Se)<<12|(63&De)<<6|63&ze)<=2047||Ge>=55296&&Ge<=57343)&&(Ge=null)):et===4&&(ze=Q[Te+2],Le=Q[Te+3],(192&(De=Q[Te+1]))==128&&(192&ze)==128&&(192&Le)==128&&((Ge=(15&Se)<<18|(63&De)<<12|(63&ze)<<6|63&Le)<=65535||Ge>=1114112)&&(Ge=null)),Ge===null?(Ge=65533,et=1):Ge>65535&&(Ge-=65536,ye+=String.fromCharCode(Ge>>>10&1023|55296),Ge=56320|1023&Ge),ye+=String.fromCharCode(Ge),Te+=et}return ye}(this.buf,V,R)},readBytes:function(){var R=this.readVarint()+this.pos,V=this.buf.subarray(this.pos,R);return this.pos=R,V},readPackedVarint:function(R,V){if(this.type!==t.Bytes)return R.push(this.readVarint(V));var Q=d(this);for(R=R||[];this.pos<Q;)R.push(this.readVarint(V));return R},readPackedSVarint:function(R){if(this.type!==t.Bytes)return R.push(this.readSVarint());var V=d(this);for(R=R||[];this.pos<V;)R.push(this.readSVarint());return R},readPackedBoolean:function(R){if(this.type!==t.Bytes)return R.push(this.readBoolean());var V=d(this);for(R=R||[];this.pos<V;)R.push(this.readBoolean());return R},readPackedFloat:function(R){if(this.type!==t.Bytes)return R.push(this.readFloat());var V=d(this);for(R=R||[];this.pos<V;)R.push(this.readFloat());return R},readPackedDouble:function(R){if(this.type!==t.Bytes)return R.push(this.readDouble());var V=d(this);for(R=R||[];this.pos<V;)R.push(this.readDouble());return R},readPackedFixed32:function(R){if(this.type!==t.Bytes)return R.push(this.readFixed32());var V=d(this);for(R=R||[];this.pos<V;)R.push(this.readFixed32());return R},readPackedSFixed32:function(R){if(this.type!==t.Bytes)return R.push(this.readSFixed32());var V=d(this);for(R=R||[];this.pos<V;)R.push(this.readSFixed32());return R},readPackedFixed64:function(R){if(this.type!==t.Bytes)return R.push(this.readFixed64());var V=d(this);for(R=R||[];this.pos<V;)R.push(this.readFixed64());return R},readPackedSFixed64:function(R){if(this.type!==t.Bytes)return R.push(this.readSFixed64());var V=d(this);for(R=R||[];this.pos<V;)R.push(this.readSFixed64());return R},skip:function(R){var V=7&R;if(V===t.Varint)for(;this.buf[this.pos++]>127;);else if(V===t.Bytes)this.pos=this.readVarint()+this.pos;else if(V===t.Fixed32)this.pos+=4;else{if(V!==t.Fixed64)throw new Error("Unimplemented type: "+V);this.pos+=8}},writeTag:function(R,V){this.writeVarint(R<<3|V)},realloc:function(R){for(var V=this.length||16;V<this.pos+R;)V*=2;if(V!==this.length){var Q=new Uint8Array(V);Q.set(this.buf),this.buf=Q,this.length=V}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(R){this.realloc(4),ne(this.buf,R,this.pos),this.pos+=4},writeSFixed32:function(R){this.realloc(4),ne(this.buf,R,this.pos),this.pos+=4},writeFixed64:function(R){this.realloc(8),ne(this.buf,-1&R,this.pos),ne(this.buf,Math.floor(R*a),this.pos+4),this.pos+=8},writeSFixed64:function(R){this.realloc(8),ne(this.buf,-1&R,this.pos),ne(this.buf,Math.floor(R*a),this.pos+4),this.pos+=8},writeVarint:function(R){(R=+R||0)>268435455||R<0?function(V,Q){var fe,ke;if(V>=0?(fe=V%4294967296|0,ke=V/4294967296|0):(ke=~(-V/4294967296),4294967295^(fe=~(-V%4294967296))?fe=fe+1|0:(fe=0,ke=ke+1|0)),V>=18446744073709552e3||V<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");Q.realloc(10),function(ye,Te,De){De.buf[De.pos++]=127&ye|128,ye>>>=7,De.buf[De.pos++]=127&ye|128,ye>>>=7,De.buf[De.pos++]=127&ye|128,ye>>>=7,De.buf[De.pos++]=127&ye|128,De.buf[De.pos]=127&(ye>>>=7)}(fe,0,Q),function(ye,Te){var De=(7&ye)<<4;Te.buf[Te.pos++]|=De|((ye>>>=3)?128:0),ye&&(Te.buf[Te.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(Te.buf[Te.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(Te.buf[Te.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(Te.buf[Te.pos++]=127&ye|((ye>>>=7)?128:0),ye&&(Te.buf[Te.pos++]=127&ye)))))}(ke,Q)}(R,this):(this.realloc(4),this.buf[this.pos++]=127&R|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=R>>>7&127))))},writeSVarint:function(R){this.writeVarint(R<0?2*-R-1:2*R)},writeBoolean:function(R){this.writeVarint(!!R)},writeString:function(R){R=String(R),this.realloc(4*R.length),this.pos++;var V=this.pos;this.pos=function(fe,ke,ye){for(var Te,De,ze=0;ze<ke.length;ze++){if((Te=ke.charCodeAt(ze))>55295&&Te<57344){if(!De){Te>56319||ze+1===ke.length?(fe[ye++]=239,fe[ye++]=191,fe[ye++]=189):De=Te;continue}if(Te<56320){fe[ye++]=239,fe[ye++]=191,fe[ye++]=189,De=Te;continue}Te=De-55296<<10|Te-56320|65536,De=null}else De&&(fe[ye++]=239,fe[ye++]=191,fe[ye++]=189,De=null);Te<128?fe[ye++]=Te:(Te<2048?fe[ye++]=Te>>6|192:(Te<65536?fe[ye++]=Te>>12|224:(fe[ye++]=Te>>18|240,fe[ye++]=Te>>12&63|128),fe[ye++]=Te>>6&63|128),fe[ye++]=63&Te|128)}return ye}(this.buf,R,this.pos);var Q=this.pos-V;Q>=128&&m(V,Q,this),this.pos=V-1,this.writeVarint(Q),this.pos+=Q},writeFloat:function(R){this.realloc(4),n.write(this.buf,R,this.pos,!0,23,4),this.pos+=4},writeDouble:function(R){this.realloc(8),n.write(this.buf,R,this.pos,!0,52,8),this.pos+=8},writeBytes:function(R){var V=R.length;this.writeVarint(V),this.realloc(V);for(var Q=0;Q<V;Q++)this.buf[this.pos++]=R[Q]},writeRawMessage:function(R,V){this.pos++;var Q=this.pos;R(V,this);var fe=this.pos-Q;fe>=128&&m(Q,fe,this),this.pos=Q-1,this.writeVarint(fe),this.pos+=fe},writeMessage:function(R,V,Q){this.writeTag(R,t.Bytes),this.writeRawMessage(V,Q)},writePackedVarint:function(R,V){V.length&&this.writeMessage(R,y,V)},writePackedSVarint:function(R,V){V.length&&this.writeMessage(R,w,V)},writePackedBoolean:function(R,V){V.length&&this.writeMessage(R,k,V)},writePackedFloat:function(R,V){V.length&&this.writeMessage(R,M,V)},writePackedDouble:function(R,V){V.length&&this.writeMessage(R,C,V)},writePackedFixed32:function(R,V){V.length&&this.writeMessage(R,D,V)},writePackedSFixed32:function(R,V){V.length&&this.writeMessage(R,L,V)},writePackedFixed64:function(R,V){V.length&&this.writeMessage(R,j,V)},writePackedSFixed64:function(R,V){V.length&&this.writeMessage(R,U,V)},writeBytesField:function(R,V){this.writeTag(R,t.Bytes),this.writeBytes(V)},writeFixed32Field:function(R,V){this.writeTag(R,t.Fixed32),this.writeFixed32(V)},writeSFixed32Field:function(R,V){this.writeTag(R,t.Fixed32),this.writeSFixed32(V)},writeFixed64Field:function(R,V){this.writeTag(R,t.Fixed64),this.writeFixed64(V)},writeSFixed64Field:function(R,V){this.writeTag(R,t.Fixed64),this.writeSFixed64(V)},writeVarintField:function(R,V){this.writeTag(R,t.Varint),this.writeVarint(V)},writeSVarintField:function(R,V){this.writeTag(R,t.Varint),this.writeSVarint(V)},writeStringField:function(R,V){this.writeTag(R,t.Bytes),this.writeString(V)},writeFloatField:function(R,V){this.writeTag(R,t.Fixed32),this.writeFloat(V)},writeDoubleField:function(R,V){this.writeTag(R,t.Fixed64),this.writeDouble(V)},writeBooleanField:function(R,V){this.writeVarintField(R,!!V)}},_p}var xp=he(Um());const vp=3;function vv(n,t,r){n===1&&r.readMessage(bv,t)}function bv(n,t,r){if(n===3){const{id:a,bitmap:c,width:d,height:p,left:m,top:y,advance:w}=r.readMessage(wv,{});t.push({id:a,bitmap:new Zc({width:d+2*vp,height:p+2*vp},c),metrics:{width:d,height:p,left:m,top:y,advance:w}})}}function wv(n,t,r){n===1?t.id=r.readVarint():n===2?t.bitmap=r.readBytes():n===3?t.width=r.readVarint():n===4?t.height=r.readVarint():n===5?t.left=r.readSVarint():n===6?t.top=r.readSVarint():n===7&&(t.advance=r.readVarint())}const Tv=vp;function $m(n){let t=0,r=0;for(const p of n)t+=p.w*p.h,r=Math.max(r,p.w);n.sort((p,m)=>m.h-p.h);const a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let c=0,d=0;for(const p of n)for(let m=a.length-1;m>=0;m--){const y=a[m];if(!(p.w>y.w||p.h>y.h)){if(p.x=y.x,p.y=y.y,d=Math.max(d,p.y+p.h),c=Math.max(c,p.x+p.w),p.w===y.w&&p.h===y.h){const w=a.pop();m<a.length&&(a[m]=w)}else p.h===y.h?(y.x+=p.w,y.w-=p.w):p.w===y.w?(y.y+=p.h,y.h-=p.h):(a.push({x:y.x+p.w,y:y.y,w:y.w-p.w,h:p.h}),y.y+=p.h,y.h-=p.h);break}}return{w:c,h:d,fill:t/(c*d)||0}}const Or=1;class bp{constructor(t,{pixelRatio:r,version:a,stretchX:c,stretchY:d,content:p,textFitWidth:m,textFitHeight:y}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=c,this.stretchY=d,this.content=p,this.version=a,this.textFitWidth=m,this.textFitHeight=y}get tl(){return[this.paddedRect.x+Or,this.paddedRect.y+Or]}get br(){return[this.paddedRect.x+this.paddedRect.w-Or,this.paddedRect.y+this.paddedRect.h-Or]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Or)/this.pixelRatio,(this.paddedRect.h-2*Or)/this.pixelRatio]}}class Gm{constructor(t,r){const a={},c={};this.haveRenderCallbacks=[];const d=[];this.addImages(t,a,d),this.addImages(r,c,d);const{w:p,h:m}=$m(d),y=new tn({width:p||1,height:m||1});for(const w in t){const M=t[w],C=a[w].paddedRect;tn.copy(M.data,y,{x:0,y:0},{x:C.x+Or,y:C.y+Or},M.data)}for(const w in r){const M=r[w],C=c[w].paddedRect,k=C.x+Or,D=C.y+Or,L=M.data.width,j=M.data.height;tn.copy(M.data,y,{x:0,y:0},{x:k,y:D},M.data),tn.copy(M.data,y,{x:0,y:j-1},{x:k,y:D-1},{width:L,height:1}),tn.copy(M.data,y,{x:0,y:0},{x:k,y:D+j},{width:L,height:1}),tn.copy(M.data,y,{x:L-1,y:0},{x:k-1,y:D},{width:1,height:j}),tn.copy(M.data,y,{x:0,y:0},{x:k+L,y:D},{width:1,height:j})}this.image=y,this.iconPositions=a,this.patternPositions=c}addImages(t,r,a){for(const c in t){const d=t[c],p={x:0,y:0,w:d.data.width+2*Or,h:d.data.height+2*Or};a.push(p),r[c]=new bp(p,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const a in t.updatedImages)this.patchUpdatedImage(this.iconPositions[a],t.getImage(a),r),this.patchUpdatedImage(this.patternPositions[a],t.getImage(a),r)}patchUpdatedImage(t,r,a){if(!t||!r||t.version===r.version)return;t.version=r.version;const[c,d]=t.tl;a.update(r.data,void 0,{x:c,y:d})}}var us;$e("ImagePosition",bp),$e("ImageAtlas",Gm),S.al=void 0,(us=S.al||(S.al={}))[us.none=0]="none",us[us.horizontal=1]="horizontal",us[us.vertical=2]="vertical",us[us.horizontalOnly=3]="horizontalOnly";const Nh=-17;class Jc{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,r,a){const c=new Jc;return c.scale=t||1,c.fontStack=r,c.verticalAlign=a||"bottom",c}static forImage(t,r){const a=new Jc;return a.imageName=t,a.verticalAlign=r||"bottom",a}}class gl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){const a=new gl;for(let c=0;c<t.sections.length;c++){const d=t.sections[c];d.image?a.addImageSection(d):a.addTextSection(d,r)}return a}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let r="";for(let a=0;a<t.length;a++){const c=t.charCodeAt(a+1)||null,d=t.charCodeAt(a-1)||null;r+=c&&Js(c)&&!Yc[t[a+1]]||d&&Js(d)&&!Yc[t[a-1]]||!Yc[t[a]]?t[a]:Yc[t[a]]}return r}(this.text)}trim(){let t=0;for(let a=0;a<this.text.length&&Vh[this.text.charCodeAt(a)];a++)t++;let r=this.text.length;for(let a=this.text.length-1;a>=0&&a>=t&&Vh[this.text.charCodeAt(a)];a--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){const a=new gl;return a.text=this.text.substring(t,r),a.sectionIndex=this.sectionIndex.slice(t,r),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}getMaxImageSize(t){let r=0,a=0;for(let c=0;c<this.length();c++){const d=this.getSection(c);if(d.imageName){const p=t[d.imageName];if(!p)continue;const m=p.displaySize;r=Math.max(r,m[0]),a=Math.max(a,m[1])}}return{maxImageWidth:r,maxImageHeight:a}}addTextSection(t,r){this.text+=t.text,this.sections.push(Jc.forText(t.scale,t.fontStack||r,t.verticalAlign));const a=this.sections.length-1;for(let c=0;c<t.text.length;++c)this.sectionIndex.push(a)}addImageSection(t){const r=t.image?t.image.name:"";if(r.length===0)return void Ui("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push(Jc.forImage(r,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):Ui("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Zh(n,t,r,a,c,d,p,m,y,w,M,C,k,D,L){const j=gl.fromFeature(n,c);let U;C===S.al.vertical&&j.verticalizePunctuation();const{processBidirectionalText:X,processStyledBidirectionalText:ne}=zn;if(X&&j.sections.length===1){U=[];const V=X(j.toString(),wp(j,w,d,t,a,D));for(const Q of V){const fe=new gl;fe.text=Q,fe.sections=j.sections;for(let ke=0;ke<Q.length;ke++)fe.sectionIndex.push(0);U.push(fe)}}else if(ne){U=[];const V=ne(j.text,j.sectionIndex,wp(j,w,d,t,a,D));for(const Q of V){const fe=new gl;fe.text=Q[0],fe.sectionIndex=Q[1],fe.sections=j.sections,U.push(fe)}}else U=function(V,Q){const fe=[],ke=V.text;let ye=0;for(const Te of Q)fe.push(V.substring(ye,Te)),ye=Te;return ye<ke.length&&fe.push(V.substring(ye,ke.length)),fe}(j,wp(j,w,d,t,a,D));const Y=[],R={positionedLines:Y,text:j.toString(),top:M[1],bottom:M[1],left:M[0],right:M[0],writingMode:C,iconsInText:!1,verticalizable:!1};return function(V,Q,fe,ke,ye,Te,De,ze,Le,Se,Ge,et){let Je=0,We=0,bt=0,hi=0;const zi=ze==="right"?1:ze==="left"?0:.5,nr=ki/et;let nn=0;for(const si of ye){si.trim();const Fi=si.getMaxScale(),Wi={positionedGlyphs:[],lineOffset:0};V.positionedLines[nn]=Wi;const Xi=Wi.positionedGlyphs;let Pr=0;if(!si.length()){We+=Te,++nn;continue}const an=Cv(ke,si,nr);for(let Nr=0;Nr<si.length();Nr++){const Ri=si.getSection(Nr),ji=si.getSectionIndex(Nr),Ni=si.getCharCode(Nr),Pi=Iv(Le,Ge,Ni);let Yt;if(Ri.imageName){if(V.iconsInText=!0,Ri.scale=Ri.scale*nr,Yt=Av(Ri,Pi,Fi,an,ke),!Yt)continue;Pr=Math.max(Pr,Yt.imageOffset)}else if(Yt=Ev(Ri,Ni,Pi,an,Q,fe),!Yt)continue;const{rect:Ln,metrics:vl,baselineOffset:Bn}=Yt;Xi.push({glyph:Ni,imageName:Ri.imageName,x:Je,y:We+Bn+Nh,vertical:Pi,scale:Ri.scale,fontStack:Ri.fontStack,sectionIndex:ji,metrics:vl,rect:Ln}),Pi?(V.verticalizable=!0,Je+=(Ri.imageName?vl.advance:ki)*Ri.scale+Se):Je+=vl.advance*Ri.scale+Se}Xi.length!==0&&(bt=Math.max(Je-Se,bt),kv(Xi,0,Xi.length-1,zi)),Je=0,Wi.lineOffset=Math.max(Pr,(Fi-1)*ki);const Oi=Te*Fi+Pr;We+=Oi,hi=Math.max(Oi,hi),++nn}const{horizontalAlign:jr,verticalAlign:Hi}=Tp(De);(function(si,Fi,Wi,Xi,Pr,an,Oi,Nr,Ri){const ji=(Fi-Wi)*Pr;let Ni=0;Ni=an!==Oi?-Nr*Xi-Nh:-Xi*Ri*Oi+.5*Oi;for(const Pi of si)for(const Yt of Pi.positionedGlyphs)Yt.x+=ji,Yt.y+=Ni})(V.positionedLines,zi,jr,Hi,bt,hi,Te,We,ye.length),V.top+=-Hi*We,V.bottom=V.top+We,V.left+=-jr*bt,V.right=V.left+bt}(R,t,r,a,U,p,m,y,C,w,k,L),!function(V){for(const Q of V)if(Q.positionedGlyphs.length!==0)return!1;return!0}(Y)&&R}const Vh={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Mv={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Sv={40:!0};function qm(n,t,r,a,c,d){if(t.imageName){const p=a[t.imageName];return p?p.displaySize[0]*t.scale*ki/d+c:0}{const p=r[t.fontStack],m=p&&p[n];return m?m.metrics.advance*t.scale+c:0}}function Hm(n,t,r,a){const c=Math.pow(n-t,2);return a?n<t?c/2:2*c:c+Math.abs(r)*r}function Pv(n,t,r){let a=0;return n===10&&(a-=1e4),r&&(a+=150),n!==40&&n!==65288||(a+=50),t!==41&&t!==65289||(a+=50),a}function Wm(n,t,r,a,c,d){let p=null,m=Hm(t,r,c,d);for(const y of a){const w=Hm(t-y.x,r,c,d)+y.badness;w<=m&&(p=y,m=w)}return{index:n,x:t,priorBreak:p,badness:m}}function Xm(n){return n?Xm(n.priorBreak).concat(n.index):[]}function wp(n,t,r,a,c,d){if(!n)return[];const p=[],m=function(C,k,D,L,j,U){let X=0;for(let ne=0;ne<C.length();ne++){const Y=C.getSection(ne);X+=qm(C.getCharCode(ne),Y,L,j,k,U)}return X/Math.max(1,Math.ceil(X/D))}(n,t,r,a,c,d),y=n.text.indexOf("​")>=0;let w=0;for(let C=0;C<n.length();C++){const k=n.getSection(C),D=n.getCharCode(C);if(Vh[D]||(w+=qm(D,k,a,c,t,d)),C<n.length()-1){const L=!((M=D)<11904)&&(!!vt["CJK Compatibility Forms"](M)||!!vt["CJK Compatibility"](M)||!!vt["CJK Strokes"](M)||!!vt["CJK Symbols and Punctuation"](M)||!!vt["Enclosed CJK Letters and Months"](M)||!!vt["Halfwidth and Fullwidth Forms"](M)||!!vt["Ideographic Description Characters"](M)||!!vt["Vertical Forms"](M)||Ac.test(String.fromCodePoint(M)));(Mv[D]||L||k.imageName||C!==n.length()-2&&Sv[n.getCharCode(C+1)])&&p.push(Wm(C+1,w,m,p,Pv(D,n.getCharCode(C+1),L&&y),!1))}}var M;return Xm(Wm(n.length(),w,m,p,0,!0))}function Tp(n){let t=.5,r=.5;switch(n){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(n){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function Cv(n,t,r){const a=t.getMaxScale()*ki,{maxImageWidth:c,maxImageHeight:d}=t.getMaxImageSize(n),p=Math.max(a,d*r);return{verticalLineContentWidth:Math.max(a,c*r),horizontalLineContentHeight:p}}function Km(n){switch(n){case"top":return 0;case"center":return .5;default:return 1}}function Iv(n,t,r){return!(n===S.al.horizontal||!t&&!ll(r)||t&&(Vh[r]||(a=r,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(a)))));var a}function Ev(n,t,r,a,c,d){const p=d[n.fontStack],m=function(w,M,C,k){if(w&&w.rect)return w;const D=M[C.fontStack],L=D&&D[k];return L?{rect:null,metrics:L.metrics}:null}(p&&p[t],c,n,t);if(m===null)return null;let y;if(r)y=a.verticalLineContentWidth-n.scale*ki;else{const w=Km(n.verticalAlign);y=(a.horizontalLineContentHeight-n.scale*ki)*w}return{rect:m.rect,metrics:m.metrics,baselineOffset:y}}function Av(n,t,r,a,c){const d=c[n.imageName];if(!d)return null;const p=d.paddedRect,m=d.displaySize,y={width:m[0],height:m[1],left:Or,top:-3,advance:t?m[1]:m[0]};let w;if(t)w=a.verticalLineContentWidth-m[1]*n.scale;else{const M=Km(n.verticalAlign);w=(a.horizontalLineContentHeight-m[1]*n.scale)*M}return{rect:p,metrics:y,baselineOffset:w,imageOffset:(t?m[0]:m[1])*n.scale-ki*r}}function kv(n,t,r,a){if(a===0)return;const c=n[r],d=(n[r].x+c.metrics.advance*c.scale)*a;for(let p=t;p<=r;p++)n[p].x-=d}function zv(n,t,r){const{horizontalAlign:a,verticalAlign:c}=Tp(r),d=t[0]-n.displaySize[0]*a,p=t[1]-n.displaySize[1]*c;return{image:n,top:p,bottom:p+n.displaySize[1],left:d,right:d+n.displaySize[0]}}function Ym(n){var t,r;let a=n.left,c=n.top,d=n.right-a,p=n.bottom-c;const m=(t=n.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",y=(r=n.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",w=(n.image.content[2]-n.image.content[0])/(n.image.content[3]-n.image.content[1]);if(y==="proportional"){if(m==="stretchOnly"&&d/p<w||m==="proportional"){const M=Math.ceil(p*w);a*=M/d,d=M}}else if(m==="proportional"&&y==="stretchOnly"&&w!==0&&d/p>w){const M=Math.ceil(d/w);c*=M/p,p=M}return{x1:a,y1:c,x2:a+d,y2:c+p}}function Jm(n,t,r,a,c,d){const p=n.image;let m;if(p.content){const U=p.content,X=p.pixelRatio||1;m=[U[0]/X,U[1]/X,p.displaySize[0]-U[2]/X,p.displaySize[1]-U[3]/X]}const y=t.left*d,w=t.right*d;let M,C,k,D;r==="width"||r==="both"?(D=c[0]+y-a[3],C=c[0]+w+a[1]):(D=c[0]+(y+w-p.displaySize[0])/2,C=D+p.displaySize[0]);const L=t.top*d,j=t.bottom*d;return r==="height"||r==="both"?(M=c[1]+L-a[0],k=c[1]+j+a[2]):(M=c[1]+(L+j-p.displaySize[1])/2,k=M+p.displaySize[1]),{image:p,top:M,right:C,bottom:k,left:D,collisionPadding:m}}const Qc=255,ia=128,hs=Qc*ia;function Qm(n,t){const{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Xt(n+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:c}=r;let d=0;for(;d<a.length&&a[d]<=n;)d++;d=Math.max(0,d-1);let p=d;for(;p<a.length&&a[p]<n+1;)p++;p=Math.min(a.length-1,p);const m=a[d],y=a[p];return r.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:y,interpolationType:c}:{kind:"camera",minZoom:m,maxZoom:y,minSize:r.evaluate(new Xt(m)),maxSize:r.evaluate(new Xt(y)),interpolationType:c}}}function Mp(n,t,r){let a="never";const c=n.get(t);return c?a=c:n.get(r)&&(a="always"),a}const Rv=Wc.VectorTileFeature.types,Dv=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Uh(n,t,r,a,c,d,p,m,y,w,M,C,k){const D=m?Math.min(hs,Math.round(m[0])):0,L=m?Math.min(hs,Math.round(m[1])):0;n.emplaceBack(t,r,Math.round(32*a),Math.round(32*c),d,p,(D<<1)+(y?1:0),L,16*w,16*M,256*C,256*k)}function Sp(n,t,r){n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r)}function Lv(n){for(const t of n.sections)if(Kd(t.text))return!0;return!1}class Pp{constructor(t){this.layoutVertexArray=new ri,this.indexArray=new zt,this.programConfigurations=t,this.segments=new Rt,this.dynamicLayoutVertexArray=new Ut,this.opacityVertexArray=new ni,this.hasVisibleVertices=!1,this.placedSymbolArray=new te}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,a,c){this.isEmpty()||(a&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,fv.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,mv.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Dv,!0),this.opacityVertexBuffer.itemSize=1),(a||c)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}$e("SymbolBuffers",Pp);class Cp{constructor(t,r,a){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new a,this.segments=new Rt,this.collisionVertexArray=new Gt}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,gv.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}$e("CollisionBuffers",Cp);class _l{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(p=>p.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Qm(this.zoom,r["text-size"]),this.iconSizeData=Qm(this.zoom,r["icon-size"]);const a=this.layers[0].layout,c=a.get("symbol-sort-key"),d=a.get("symbol-z-order");this.canOverlap=Mp(a,"text-overlap","text-allow-overlap")!=="never"||Mp(a,"icon-overlap","icon-allow-overlap")!=="never"||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,a.get("symbol-placement")==="point"&&(this.writingModes=a.get("text-writing-mode").map(p=>S.al[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=t.sourceID}createArrays(){this.text=new Pp(new ta(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Pp(new ta(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new se,this.lineVertexArray=new re,this.symbolInstances=new ie,this.textAnchorOffsets=new Me}calculateGlyphDependencies(t,r,a,c,d){for(let p=0;p<t.length;p++)if(r[t.charCodeAt(p)]=!0,(a||c)&&d){const m=Yc[t.charAt(p)];m&&(r[m.charCodeAt(0)]=!0)}}populate(t,r,a){const c=this.layers[0],d=c.layout,p=d.get("text-font"),m=d.get("text-field"),y=d.get("icon-image"),w=(m.value.kind!=="constant"||m.value.value instanceof Mr&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),M=y.value.kind!=="constant"||!!y.value.value||Object.keys(y.parameters).length>0,C=d.get("symbol-sort-key");if(this.features=[],!w&&!M)return;const k=r.iconDependencies,D=r.glyphDependencies,L=r.availableImages,j=new Xt(this.zoom);for(const{feature:U,id:X,index:ne,sourceLayerIndex:Y}of t){const R=c._featureFilter.needGeometry,V=so(U,R);if(!c._featureFilter.filter(j,V,a))continue;let Q,fe;if(R||(V.geometry=ao(U)),w){const ye=c.getValueAndResolveTokens("text-field",V,a,L),Te=Mr.factory(ye),De=this.hasRTLText=this.hasRTLText||Lv(Te);(!De||zn.getRTLTextPluginStatus()==="unavailable"||De&&zn.isParsed())&&(Q=yv(Te,c,V))}if(M){const ye=c.getValueAndResolveTokens("icon-image",V,a,L);fe=ye instanceof Lr?ye:Lr.fromString(ye)}if(!Q&&!fe)continue;const ke=this.sortFeaturesByKey?C.evaluate(V,{},a):void 0;if(this.features.push({id:X,text:Q,icon:fe,index:ne,sourceLayerIndex:Y,geometry:V.geometry,properties:U.properties,type:Rv[U.type],sortKey:ke}),fe&&(k[fe.name]=!0),Q){const ye=p.evaluate(V,{},a).join(","),Te=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(S.al.vertical)>=0;for(const De of Q.sections)if(De.image)k[De.image.name]=!0;else{const ze=ol(Q.toString()),Le=De.fontStack||ye,Se=D[Le]=D[Le]||{};this.calculateGlyphDependencies(De.text,Se,Te,this.allowVerticalPlacement,ze)}}}d.get("symbol-placement")==="line"&&(this.features=function(U){const X={},ne={},Y=[];let R=0;function V(ye){Y.push(U[ye]),R++}function Q(ye,Te,De){const ze=ne[ye];return delete ne[ye],ne[Te]=ze,Y[ze].geometry[0].pop(),Y[ze].geometry[0]=Y[ze].geometry[0].concat(De[0]),ze}function fe(ye,Te,De){const ze=X[Te];return delete X[Te],X[ye]=ze,Y[ze].geometry[0].shift(),Y[ze].geometry[0]=De[0].concat(Y[ze].geometry[0]),ze}function ke(ye,Te,De){const ze=De?Te[0][Te[0].length-1]:Te[0][0];return`${ye}:${ze.x}:${ze.y}`}for(let ye=0;ye<U.length;ye++){const Te=U[ye],De=Te.geometry,ze=Te.text?Te.text.toString():null;if(!ze){V(ye);continue}const Le=ke(ze,De),Se=ke(ze,De,!0);if(Le in ne&&Se in X&&ne[Le]!==X[Se]){const Ge=fe(Le,Se,De),et=Q(Le,Se,Y[Ge].geometry);delete X[Le],delete ne[Se],ne[ke(ze,Y[et].geometry,!0)]=et,Y[Ge].geometry=null}else Le in ne?Q(Le,Se,De):Se in X?fe(Le,Se,De):(V(ye),X[Le]=R-1,ne[Se]=R-1)}return Y.filter(ye=>ye.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((U,X)=>U.sortKey-X.sortKey)}update(t,r,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,a),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,a))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,r){const a=this.lineVertexArray.length;if(t.segment!==void 0){let c=t.dist(r[t.segment+1]),d=t.dist(r[t.segment]);const p={};for(let m=t.segment+1;m<r.length;m++)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:c},m<r.length-1&&(c+=r[m+1].dist(r[m]));for(let m=t.segment||0;m>=0;m--)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:d},m>0&&(d+=r[m-1].dist(r[m]));for(let m=0;m<r.length;m++){const y=p[m];this.lineVertexArray.emplaceBack(y.x,y.y,y.tileUnitDistanceFromAnchor)}}return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(t,r,a,c,d,p,m,y,w,M,C,k){const D=t.indexArray,L=t.layoutVertexArray,j=t.segments.prepareSegment(4*r.length,L,D,this.canOverlap?p.sortKey:void 0),U=this.glyphOffsetArray.length,X=j.vertexLength,ne=this.allowVerticalPlacement&&m===S.al.vertical?Math.PI/2:0,Y=p.text&&p.text.sections;for(let R=0;R<r.length;R++){const{tl:V,tr:Q,bl:fe,br:ke,tex:ye,pixelOffsetTL:Te,pixelOffsetBR:De,minFontScaleX:ze,minFontScaleY:Le,glyphOffset:Se,isSDF:Ge,sectionIndex:et}=r[R],Je=j.vertexLength,We=Se[1];Uh(L,y.x,y.y,V.x,We+V.y,ye.x,ye.y,a,Ge,Te.x,Te.y,ze,Le),Uh(L,y.x,y.y,Q.x,We+Q.y,ye.x+ye.w,ye.y,a,Ge,De.x,Te.y,ze,Le),Uh(L,y.x,y.y,fe.x,We+fe.y,ye.x,ye.y+ye.h,a,Ge,Te.x,De.y,ze,Le),Uh(L,y.x,y.y,ke.x,We+ke.y,ye.x+ye.w,ye.y+ye.h,a,Ge,De.x,De.y,ze,Le),Sp(t.dynamicLayoutVertexArray,y,ne),D.emplaceBack(Je,Je+2,Je+1),D.emplaceBack(Je+1,Je+2,Je+3),j.vertexLength+=4,j.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Se[0]),R!==r.length-1&&et===r[R+1].sectionIndex||t.programConfigurations.populatePaintArrays(L.length,p,p.index,{},k,Y&&Y[et])}t.placedSymbolArray.emplaceBack(y.x,y.y,U,this.glyphOffsetArray.length-U,X,w,M,y.segment,a?a[0]:0,a?a[1]:0,c[0],c[1],m,0,!1,0,C)}_addCollisionDebugVertex(t,r,a,c,d,p){return r.emplaceBack(0,0),t.emplaceBack(a.x,a.y,c,d,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(t,r,a,c,d,p,m){const y=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),w=y.vertexLength,M=d.layoutVertexArray,C=d.collisionVertexArray,k=m.anchorX,D=m.anchorY;this._addCollisionDebugVertex(M,C,p,k,D,new Fe(t,r)),this._addCollisionDebugVertex(M,C,p,k,D,new Fe(a,r)),this._addCollisionDebugVertex(M,C,p,k,D,new Fe(a,c)),this._addCollisionDebugVertex(M,C,p,k,D,new Fe(t,c)),y.vertexLength+=4;const L=d.indexArray;L.emplaceBack(w,w+1),L.emplaceBack(w+1,w+2),L.emplaceBack(w+2,w+3),L.emplaceBack(w+3,w),y.primitiveLength+=4}addDebugCollisionBoxes(t,r,a,c){for(let d=t;d<r;d++){const p=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,c?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,a)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Cp(ai,Nm.members,Ai),this.iconCollisionBox=new Cp(ai,Nm.members,Ai);for(let t=0;t<this.symbolInstances.length;t++){const r=this.symbolInstances.get(t);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(t,r,a,c,d,p,m,y,w){const M={};for(let C=r;C<a;C++){const k=t.get(C);M.textBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},M.textFeatureIndex=k.featureIndex;break}for(let C=c;C<d;C++){const k=t.get(C);M.verticalTextBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},M.verticalTextFeatureIndex=k.featureIndex;break}for(let C=p;C<m;C++){const k=t.get(C);M.iconBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},M.iconFeatureIndex=k.featureIndex;break}for(let C=y;C<w;C++){const k=t.get(C);M.verticalIconBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},M.verticalIconFeatureIndex=k.featureIndex;break}return M}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const a=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.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}addIndicesForPlacedSymbol(t,r){const a=t.placedSymbolArray.get(r),c=a.vertexStartIndex+4*a.numGlyphs;for(let d=a.vertexStartIndex;d<c;d+=4)t.indexArray.emplaceBack(d,d+2,d+1),t.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(t),a=Math.cos(t),c=[],d=[],p=[];for(let m=0;m<this.symbolInstances.length;++m){p.push(m);const y=this.symbolInstances.get(m);c.push(0|Math.round(r*y.anchorX+a*y.anchorY)),d.push(y.featureIndex)}return p.sort((m,y)=>c[m]-c[y]||d[y]-d[m]),p}addToSortKeyRanges(t,r){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===r?a.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const a=this.symbolInstances.get(r);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((c,d,p)=>{c>=0&&p.indexOf(c)===d&&this.addIndicesForPlacedSymbol(this.text,c)}),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let eg,tg;$e("SymbolBucket",_l,{omit:["layers","collisionBoxArray","features","compareText"]}),_l.MAX_GLYPHS=65535,_l.addDynamicAttributes=Sp;var Ip={get paint(){return tg=tg||new Ti({"icon-opacity":new rt($.paint_symbol["icon-opacity"]),"icon-color":new rt($.paint_symbol["icon-color"]),"icon-halo-color":new rt($.paint_symbol["icon-halo-color"]),"icon-halo-width":new rt($.paint_symbol["icon-halo-width"]),"icon-halo-blur":new rt($.paint_symbol["icon-halo-blur"]),"icon-translate":new Ke($.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ke($.paint_symbol["icon-translate-anchor"]),"text-opacity":new rt($.paint_symbol["text-opacity"]),"text-color":new rt($.paint_symbol["text-color"],{runtimeType:oi,getOverride:n=>n.textColor,hasOverride:n=>!!n.textColor}),"text-halo-color":new rt($.paint_symbol["text-halo-color"]),"text-halo-width":new rt($.paint_symbol["text-halo-width"]),"text-halo-blur":new rt($.paint_symbol["text-halo-blur"]),"text-translate":new Ke($.paint_symbol["text-translate"]),"text-translate-anchor":new Ke($.paint_symbol["text-translate-anchor"])})},get layout(){return eg=eg||new Ti({"symbol-placement":new Ke($.layout_symbol["symbol-placement"]),"symbol-spacing":new Ke($.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ke($.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new rt($.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ke($.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ke($.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ke($.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ke($.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ke($.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ke($.layout_symbol["icon-rotation-alignment"]),"icon-size":new rt($.layout_symbol["icon-size"]),"icon-text-fit":new Ke($.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ke($.layout_symbol["icon-text-fit-padding"]),"icon-image":new rt($.layout_symbol["icon-image"]),"icon-rotate":new rt($.layout_symbol["icon-rotate"]),"icon-padding":new rt($.layout_symbol["icon-padding"]),"icon-keep-upright":new Ke($.layout_symbol["icon-keep-upright"]),"icon-offset":new rt($.layout_symbol["icon-offset"]),"icon-anchor":new rt($.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ke($.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ke($.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ke($.layout_symbol["text-rotation-alignment"]),"text-field":new rt($.layout_symbol["text-field"]),"text-font":new rt($.layout_symbol["text-font"]),"text-size":new rt($.layout_symbol["text-size"]),"text-max-width":new rt($.layout_symbol["text-max-width"]),"text-line-height":new Ke($.layout_symbol["text-line-height"]),"text-letter-spacing":new rt($.layout_symbol["text-letter-spacing"]),"text-justify":new rt($.layout_symbol["text-justify"]),"text-radial-offset":new rt($.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ke($.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new rt($.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new rt($.layout_symbol["text-anchor"]),"text-max-angle":new Ke($.layout_symbol["text-max-angle"]),"text-writing-mode":new Ke($.layout_symbol["text-writing-mode"]),"text-rotate":new rt($.layout_symbol["text-rotate"]),"text-padding":new Ke($.layout_symbol["text-padding"]),"text-keep-upright":new Ke($.layout_symbol["text-keep-upright"]),"text-transform":new rt($.layout_symbol["text-transform"]),"text-offset":new rt($.layout_symbol["text-offset"]),"text-allow-overlap":new Ke($.layout_symbol["text-allow-overlap"]),"text-overlap":new Ke($.layout_symbol["text-overlap"]),"text-ignore-placement":new Ke($.layout_symbol["text-ignore-placement"]),"text-optional":new Ke($.layout_symbol["text-optional"])})}};class ig{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:nt,this.defaultValue=t}evaluate(t){if(t.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}$e("FormatSectionOverride",ig,{omit:["defaultValue"]});class $h extends qr{constructor(t){super(t,Ip)}recalculate(t,r){if(super.recalculate(t,r),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")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const a=this.layout.get("text-writing-mode");if(a){const c=[];for(const d of a)c.indexOf(d)<0&&c.push(d);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,a,c){const d=this.layout.get(t).evaluate(r,{},a,c),p=this._unevaluatedLayout._values[t];return p.isDataDriven()||Us(p.value)||!d?d:function(m,y){return y.replace(/{([^{}]+)}/g,(w,M)=>m&&M in m?String(m[M]):"")}(r.properties,d)}createBucket(t){return new _l(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Ip.paint.overridableProperties){if(!$h.hasPaintOverride(this.layout,t))continue;const r=this.paint.get(t),a=new ig(r),c=new Xo(a,r.property.specification);let d=null;d=r.value.kind==="constant"||r.value.kind==="source"?new gc("source",c):new Yo("composite",c,r.value.zoomStops),this.paint._values[t]=new pr(r.property,d,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven())&&$h.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){const a=t.get("text-field"),c=Ip.paint.properties[r];let d=!1;const p=m=>{for(const y of m)if(c.overrides&&c.overrides.hasOverride(y))return void(d=!0)};if(a.value.kind==="constant"&&a.value.value instanceof Mr)p(a.value.value.sections);else if(a.value.kind==="source"){const m=w=>{d||(w instanceof lt&&ci(w.value)===Ms?p(w.value.sections):w instanceof Ro?p(w.sections):w.eachChild(m))},y=a.value;y._styleExpression&&m(y._styleExpression.expression)}return d}}let rg;var Bv={get paint(){return rg=rg||new Ti({"background-color":new Ke($.paint_background["background-color"]),"background-pattern":new zc($.paint_background["background-pattern"]),"background-opacity":new Ke($.paint_background["background-opacity"])})}};class Fv extends qr{constructor(t){super(t,Bv)}}let ng;var Ov={get paint(){return ng=ng||new Ti({"raster-opacity":new Ke($.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ke($.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ke($.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ke($.paint_raster["raster-brightness-max"]),"raster-saturation":new Ke($.paint_raster["raster-saturation"]),"raster-contrast":new Ke($.paint_raster["raster-contrast"]),"raster-resampling":new Ke($.paint_raster["raster-resampling"]),"raster-fade-duration":new Ke($.paint_raster["raster-fade-duration"])})}};class jv extends qr{constructor(t){super(t,Ov)}}class Nv extends qr{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Zv{constructor(t){this._methodToThrottle=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Vv={once:!0},Ep=63710088e-1;class ds{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new ds(vr(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const r=Math.PI/180,a=this.lat*r,c=t.lat*r,d=Math.sin(a)*Math.sin(c)+Math.cos(a)*Math.cos(c)*Math.cos((t.lng-this.lng)*r);return Ep*Math.acos(Math.min(d,1))}static convert(t){if(t instanceof ds)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new ds(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new ds(Number("lng"in t?t.lng:t.lon),Number(t.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>]")}}const ag=2*Math.PI*Ep;function sg(n){return ag*Math.cos(n*Math.PI/180)}function og(n){return(180+n)/360}function lg(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function cg(n,t){return n/sg(t)}function Ap(n){return 360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90}function ug(n,t){return n*sg(Ap(t))}class eu{constructor(t,r,a=0){this.x=+t,this.y=+r,this.z=+a}static fromLngLat(t,r=0){const a=ds.convert(t);return new eu(og(a.lng),lg(a.lat),cg(r,a.lat))}toLngLat(){return new ds(360*this.x-180,Ap(this.y))}toAltitude(){return ug(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/ag*(t=Ap(this.y),1/Math.cos(t*Math.PI/180));var t}}function hg(n,t,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[n*a-2*Math.PI*6378137/2,t*a-2*Math.PI*6378137/2]}class kp{constructor(t,r,a){if(!function(c,d,p){return!(c<0||c>25||p<0||p>=Math.pow(2,c)||d<0||d>=Math.pow(2,c))}(t,r,a))throw new Error(`x=${r}, y=${a}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=r,this.y=a,this.key=yl(0,t,t,r,a)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,a){const c=(p=this.y,m=this.z,y=hg(256*(d=this.x),256*(p=Math.pow(2,m)-p-1),m),w=hg(256*(d+1),256*(p+1),m),y[0]+","+y[1]+","+w[0]+","+w[1]);var d,p,m,y,w;const M=function(C,k,D){let L,j="";for(let U=C;U>0;U--)L=1<<U-1,j+=(k&L?1:0)+(D&L?2:0);return j}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(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(a==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,M).replace(/{bbox-epsg-3857}/g,c)}isChildOf(t){const r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){const r=Math.pow(2,this.z);return new Fe((t.x*r-this.x)*Et,(t.y*r-this.y)*Et)}toString(){return`${this.z}/${this.x}/${this.y}`}}class dg{constructor(t,r){this.wrap=t,this.canonical=r,this.key=yl(t,r.z,r.z,r.x,r.y)}}class rn{constructor(t,r,a,c,d){if(this.terrainRttPosMatrix32f=null,t<a)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${a}`);this.overscaledZ=t,this.wrap=r,this.canonical=new kp(a,+c,+d),this.key=yl(r,t,a,c,d)}clone(){return new rn(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?new rn(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new rn(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-t;return t>this.canonical.z?yl(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):yl(this.wrap*+r,t,t,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new rn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,a=2*this.canonical.x,c=2*this.canonical.y;return[new rn(r,this.wrap,r,a,c),new rn(r,this.wrap,r,a+1,c),new rn(r,this.wrap,r,a,c+1),new rn(r,this.wrap,r,a+1,c+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new rn(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new rn(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new dg(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new eu(t.x-this.wrap,t.y))}}function yl(n,t,r,a,c){(n*=2)<0&&(n=-1*n-1);const d=1<<r;return(d*d*n+d*c+a).toString(36)+r.toString(36)+t.toString(36)}$e("CanonicalTileID",kp),$e("OverscaledTileID",rn,{omit:["terrainRttPosMatrix32f"]});class pg{constructor(t,r,a,c=1,d=1,p=1,m=0){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(a&&!["mapbox","terrarium","custom"].includes(a))return void Ui(`"${a}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const y=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),a){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=c,this.greenFactor=d,this.blueFactor=p,this.baseShift=m;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let w=0;w<y;w++)this.data[this._idx(-1,w)]=this.data[this._idx(0,w)],this.data[this._idx(y,w)]=this.data[this._idx(y-1,w)],this.data[this._idx(w,-1)]=this.data[this._idx(w,0)],this.data[this._idx(w,y)]=this.data[this._idx(w,y-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(y,-1)]=this.data[this._idx(y-1,0)],this.data[this._idx(-1,y)]=this.data[this._idx(0,y-1)],this.data[this._idx(y,y)]=this.data[this._idx(y-1,y-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let w=0;w<y;w++)for(let M=0;M<y;M++){const C=this.get(w,M);C>this.max&&(this.max=C),C<this.min&&(this.min=C)}}get(t,r){const a=new Uint8Array(this.data.buffer),c=4*this._idx(t,r);return this.unpack(a[c],a[c+1],a[c+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,a){return t*this.redFactor+r*this.greenFactor+a*this.blueFactor-this.baseShift}getPixels(){return new tn({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,a){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let c=r*this.dim,d=r*this.dim+this.dim,p=a*this.dim,m=a*this.dim+this.dim;switch(r){case-1:c=d-1;break;case 1:d=c+1}switch(a){case-1:p=m-1;break;case 1:m=p+1}const y=-r*this.dim,w=-a*this.dim;for(let M=p;M<m;M++)for(let C=c;C<d;C++)this.data[this._idx(C,M)]=t.data[this._idx(C+y,M+w)]}}$e("DEMData",pg);class fg{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){const a=t[r];this._stringToNumber[a]=r,this._numberToString[r]=a}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class mg{constructor(t,r,a,c,d){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=a,t._y=c,this.properties=t.properties,this.id=d}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class gg{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new ss(Et,16,0),this.grid3D=new ss(Et,16,0),this.featureIndexArray=new ve,this.promoteId=r}insert(t,r,a,c,d,p){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,c,d);const y=p?this.grid3D:this.grid;for(let w=0;w<r.length;w++){const M=r[w],C=[1/0,1/0,-1/0,-1/0];for(let k=0;k<M.length;k++){const D=M[k];C[0]=Math.min(C[0],D.x),C[1]=Math.min(C[1],D.y),C[2]=Math.max(C[2],D.x),C[3]=Math.max(C[3],D.y)}C[0]<Et&&C[1]<Et&&C[2]>=0&&C[3]>=0&&y.insert(m,C[0],C[1],C[2],C[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Wc.VectorTile(new xp(this.rawTileData)).layers,this.sourceLayerCoder=new fg(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,a,c){this.loadVTLayers();const d=t.params,p=Et/t.tileSize/t.scale,m=Hs(d.filter),y=t.queryGeometry,w=t.queryPadding*p,M=yg(y),C=this.grid.query(M.minX-w,M.minY-w,M.maxX+w,M.maxY+w),k=yg(t.cameraQueryGeometry),D=this.grid3D.query(k.minX-w,k.minY-w,k.maxX+w,k.maxY+w,(U,X,ne,Y)=>function(R,V,Q,fe,ke){for(const Te of R)if(V<=Te.x&&Q<=Te.y&&fe>=Te.x&&ke>=Te.y)return!0;const ye=[new Fe(V,Q),new Fe(V,ke),new Fe(fe,ke),new Fe(fe,Q)];if(R.length>2){for(const Te of ye)if(oo(R,Te))return!0}for(let Te=0;Te<R.length-1;Te++)if(Ax(R[Te],R[Te+1],ye))return!0;return!1}(t.cameraQueryGeometry,U-w,X-w,ne+w,Y+w));for(const U of D)C.push(U);C.sort(Uv);const L={};let j;for(let U=0;U<C.length;U++){const X=C[U];if(X===j)continue;j=X;const ne=this.featureIndexArray.get(X);let Y=null;this.loadMatchingFeature(L,ne.bucketIndex,ne.sourceLayerIndex,ne.featureIndex,m,d.layers,d.availableImages,r,a,c,(R,V,Q)=>(Y||(Y=ao(R)),V.queryIntersectsFeature({queryGeometry:y,feature:R,featureState:Q,geometry:Y,zoom:this.z,transform:t.transform,pixelsToTileUnits:p,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return L}loadMatchingFeature(t,r,a,c,d,p,m,y,w,M,C){const k=this.bucketLayerIDs[r];if(p&&!k.some(U=>p.has(U)))return;const D=this.sourceLayerCoder.decode(a),L=this.vtLayers[D].feature(c);if(d.needGeometry){const U=so(L,!0);if(!d.filter(new Xt(this.tileID.overscaledZ),U,this.tileID.canonical))return}else if(!d.filter(new Xt(this.tileID.overscaledZ),L))return;const j=this.getId(L,D);for(let U=0;U<k.length;U++){const X=k[U];if(p&&!p.has(X))continue;const ne=y[X];if(!ne)continue;let Y={};j&&M&&(Y=M.getState(ne.sourceLayer||"_geojsonTileLayer",j));const R=Qi({},w[X]);R.paint=_g(R.paint,ne.paint,L,Y,m),R.layout=_g(R.layout,ne.layout,L,Y,m);const V=!C||C(L,ne,Y);if(!V)continue;const Q=new mg(L,this.z,this.x,this.y,j);Q.layer=R;let fe=t[X];fe===void 0&&(fe=t[X]=[]),fe.push({featureIndex:c,feature:Q,intersectionZ:V})}}lookupSymbolFeatures(t,r,a,c,d,p,m,y){const w={};this.loadVTLayers();const M=Hs(d);for(const C of t)this.loadMatchingFeature(w,a,c,C,M,p,m,y,r);return w}hasLayer(t){for(const r of this.bucketLayerIDs)for(const a of r)if(t===a)return!0;return!1}getId(t,r){var a;let c=t.id;return this.promoteId&&(c=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof c=="boolean"&&(c=Number(c)),c===void 0&&(!((a=t.properties)===null||a===void 0)&&a.cluster)&&this.promoteId&&(c=Number(t.properties.cluster_id))),c}}function _g(n,t,r,a,c){return un(n,(d,p)=>{const m=t instanceof ul?t.get(p):null;return m&&m.evaluate?m.evaluate(r,a,c):m})}function yg(n){let t=1/0,r=1/0,a=-1/0,c=-1/0;for(const d of n)t=Math.min(t,d.x),r=Math.min(r,d.y),a=Math.max(a,d.x),c=Math.max(c,d.y);return{minX:t,minY:r,maxX:a,maxY:c}}function Uv(n,t){return t-n}function xg(n,t,r,a,c){const d=[];for(let p=0;p<n.length;p++){const m=n[p];let y;for(let w=0;w<m.length-1;w++){let M=m[w],C=m[w+1];M.x<t&&C.x<t||(M.x<t?M=new Fe(t,M.y+(t-M.x)/(C.x-M.x)*(C.y-M.y))._round():C.x<t&&(C=new Fe(t,M.y+(t-M.x)/(C.x-M.x)*(C.y-M.y))._round()),M.y<r&&C.y<r||(M.y<r?M=new Fe(M.x+(r-M.y)/(C.y-M.y)*(C.x-M.x),r)._round():C.y<r&&(C=new Fe(M.x+(r-M.y)/(C.y-M.y)*(C.x-M.x),r)._round()),M.x>=a&&C.x>=a||(M.x>=a?M=new Fe(a,M.y+(a-M.x)/(C.x-M.x)*(C.y-M.y))._round():C.x>=a&&(C=new Fe(a,M.y+(a-M.x)/(C.x-M.x)*(C.y-M.y))._round()),M.y>=c&&C.y>=c||(M.y>=c?M=new Fe(M.x+(c-M.y)/(C.y-M.y)*(C.x-M.x),c)._round():C.y>=c&&(C=new Fe(M.x+(c-M.y)/(C.y-M.y)*(C.x-M.x),c)._round()),y&&M.equals(y[y.length-1])||(y=[M],d.push(y)),y.push(C)))))}}return d}$e("FeatureIndex",gg,{omit:["rawTileData","sourceLayerCoder"]});class ps extends Fe{constructor(t,r,a,c){super(t,r),this.angle=a,c!==void 0&&(this.segment=c)}clone(){return new ps(this.x,this.y,this.angle,this.segment)}}function vg(n,t,r,a,c){if(t.segment===void 0||r===0)return!0;let d=t,p=t.segment+1,m=0;for(;m>-r/2;){if(p--,p<0)return!1;m-=n[p].dist(d),d=n[p]}m+=n[p].dist(n[p+1]),p++;const y=[];let w=0;for(;m<r/2;){const M=n[p],C=n[p+1];if(!C)return!1;let k=n[p-1].angleTo(M)-M.angleTo(C);for(k=Math.abs((k+3*Math.PI)%(2*Math.PI)-Math.PI),y.push({distance:m,angleDelta:k}),w+=k;m-y[0].distance>a;)w-=y.shift().angleDelta;if(w>c)return!1;p++,m+=M.dist(C)}return!0}function bg(n){let t=0;for(let r=0;r<n.length-1;r++)t+=n[r].dist(n[r+1]);return t}function wg(n,t,r){return n?.6*t*r:0}function Tg(n,t){return Math.max(n?n.right-n.left:0,t?t.right-t.left:0)}function $v(n,t,r,a,c,d){const p=wg(r,c,d),m=Tg(r,a)*d;let y=0;const w=bg(n)/2;for(let M=0;M<n.length-1;M++){const C=n[M],k=n[M+1],D=C.dist(k);if(y+D>w){const L=(w-y)/D,j=pn.number(C.x,k.x,L),U=pn.number(C.y,k.y,L),X=new ps(j,U,k.angleTo(C),M);return X._round(),!p||vg(n,X,m,p,t)?X:void 0}y+=D}}function Gv(n,t,r,a,c,d,p,m,y){const w=wg(a,d,p),M=Tg(a,c),C=M*p,k=n[0].x===0||n[0].x===y||n[0].y===0||n[0].y===y;return t-C<t/4&&(t=C+t/4),Mg(n,k?t/2*m%t:(M/2+2*d)*p*m%t,t,w,r,C,k,!1,y)}function Mg(n,t,r,a,c,d,p,m,y){const w=d/2,M=bg(n);let C=0,k=t-r,D=[];for(let L=0;L<n.length-1;L++){const j=n[L],U=n[L+1],X=j.dist(U),ne=U.angleTo(j);for(;k+r<C+X;){k+=r;const Y=(k-C)/X,R=pn.number(j.x,U.x,Y),V=pn.number(j.y,U.y,Y);if(R>=0&&R<y&&V>=0&&V<y&&k-w>=0&&k+w<=M){const Q=new ps(R,V,ne,L);Q._round(),a&&!vg(n,Q,d,a,c)||D.push(Q)}}C+=X}return m||D.length||p||(D=Mg(n,C/2,r,a,c,d,p,!0,y)),D}$e("Anchor",ps);const tu=Or;function Sg(n,t,r,a){const c=[],d=n.image,p=d.pixelRatio,m=d.paddedRect.w-2*tu,y=d.paddedRect.h-2*tu;let w={x1:n.left,y1:n.top,x2:n.right,y2:n.bottom};const M=d.stretchX||[[0,m]],C=d.stretchY||[[0,y]],k=(Se,Ge)=>Se+Ge[1]-Ge[0],D=M.reduce(k,0),L=C.reduce(k,0),j=m-D,U=y-L;let X=0,ne=D,Y=0,R=L,V=0,Q=j,fe=0,ke=U;if(d.content&&a){const Se=d.content,Ge=Se[2]-Se[0],et=Se[3]-Se[1];(d.textFitWidth||d.textFitHeight)&&(w=Ym(n)),X=Gh(M,0,Se[0]),Y=Gh(C,0,Se[1]),ne=Gh(M,Se[0],Se[2]),R=Gh(C,Se[1],Se[3]),V=Se[0]-X,fe=Se[1]-Y,Q=Ge-ne,ke=et-R}const ye=w.x1,Te=w.y1,De=w.x2-ye,ze=w.y2-Te,Le=(Se,Ge,et,Je)=>{const We=qh(Se.stretch-X,ne,De,ye),bt=Hh(Se.fixed-V,Q,Se.stretch,D),hi=qh(Ge.stretch-Y,R,ze,Te),zi=Hh(Ge.fixed-fe,ke,Ge.stretch,L),nr=qh(et.stretch-X,ne,De,ye),nn=Hh(et.fixed-V,Q,et.stretch,D),jr=qh(Je.stretch-Y,R,ze,Te),Hi=Hh(Je.fixed-fe,ke,Je.stretch,L),si=new Fe(We,hi),Fi=new Fe(nr,hi),Wi=new Fe(nr,jr),Xi=new Fe(We,jr),Pr=new Fe(bt/p,zi/p),an=new Fe(nn/p,Hi/p),Oi=t*Math.PI/180;if(Oi){const ji=Math.sin(Oi),Ni=Math.cos(Oi),Pi=[Ni,-ji,ji,Ni];si._matMult(Pi),Fi._matMult(Pi),Xi._matMult(Pi),Wi._matMult(Pi)}const Nr=Se.stretch+Se.fixed,Ri=Ge.stretch+Ge.fixed;return{tl:si,tr:Fi,bl:Xi,br:Wi,tex:{x:d.paddedRect.x+tu+Nr,y:d.paddedRect.y+tu+Ri,w:et.stretch+et.fixed-Nr,h:Je.stretch+Je.fixed-Ri},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Pr,pixelOffsetBR:an,minFontScaleX:Q/p/De,minFontScaleY:ke/p/ze,isSDF:r}};if(a&&(d.stretchX||d.stretchY)){const Se=Pg(M,j,D),Ge=Pg(C,U,L);for(let et=0;et<Se.length-1;et++){const Je=Se[et],We=Se[et+1];for(let bt=0;bt<Ge.length-1;bt++)c.push(Le(Je,Ge[bt],We,Ge[bt+1]))}}else c.push(Le({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:y+1}));return c}function Gh(n,t,r){let a=0;for(const c of n)a+=Math.max(t,Math.min(r,c[1]))-Math.max(t,Math.min(r,c[0]));return a}function Pg(n,t,r){const a=[{fixed:-1,stretch:0}];for(const[c,d]of n){const p=a[a.length-1];a.push({fixed:c-p.stretch,stretch:p.stretch}),a.push({fixed:c-p.stretch,stretch:p.stretch+(d-c)})}return a.push({fixed:t+tu,stretch:r}),a}function qh(n,t,r,a){return n/t*r+a}function Hh(n,t,r,a){return n-t*r/a}class Wh{constructor(t,r,a,c,d,p,m,y,w,M){var C;if(this.boxStartIndex=t.length,w){let k=p.top,D=p.bottom;const L=p.collisionPadding;L&&(k-=L[1],D+=L[3]);let j=D-k;j>0&&(j=Math.max(10,j),this.circleDiameter=j)}else{const k=!((C=p.image)===null||C===void 0)&&C.content&&(p.image.textFitWidth||p.image.textFitHeight)?Ym(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};k.y1=k.y1*m-y[0],k.y2=k.y2*m+y[2],k.x1=k.x1*m-y[3],k.x2=k.x2*m+y[1];const D=p.collisionPadding;if(D&&(k.x1-=D[0]*m,k.y1-=D[1]*m,k.x2+=D[2]*m,k.y2+=D[3]*m),M){const L=new Fe(k.x1,k.y1),j=new Fe(k.x2,k.y1),U=new Fe(k.x1,k.y2),X=new Fe(k.x2,k.y2),ne=M*Math.PI/180;L._rotate(ne),j._rotate(ne),U._rotate(ne),X._rotate(ne),k.x1=Math.min(L.x,j.x,U.x,X.x),k.x2=Math.max(L.x,j.x,U.x,X.x),k.y1=Math.min(L.y,j.y,U.y,X.y),k.y2=Math.max(L.y,j.y,U.y,X.y)}t.emplaceBack(r.x,r.y,k.x1,k.y1,k.x2,k.y2,a,c,d)}this.boxEndIndex=t.length}}class qv{constructor(t=[],r=(a,c)=>a<c?-1:a>c?1:0){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:r,compare:a}=this,c=r[t];for(;t>0;){const d=t-1>>1,p=r[d];if(a(c,p)>=0)break;r[t]=p,t=d}r[t]=c}_down(t){const{data:r,compare:a}=this,c=this.length>>1,d=r[t];for(;t<c;){let p=1+(t<<1);const m=p+1;if(m<this.length&&a(r[m],r[p])<0&&(p=m),a(r[p],d)>=0)break;r[t]=r[p],t=p}r[t]=d}}function Hv(n,t=1,r=!1){let a=1/0,c=1/0,d=-1/0,p=-1/0;const m=n[0];for(let D=0;D<m.length;D++){const L=m[D];(!D||L.x<a)&&(a=L.x),(!D||L.y<c)&&(c=L.y),(!D||L.x>d)&&(d=L.x),(!D||L.y>p)&&(p=L.y)}const y=Math.min(d-a,p-c);let w=y/2;const M=new qv([],Wv);if(y===0)return new Fe(a,c);for(let D=a;D<d;D+=y)for(let L=c;L<p;L+=y)M.push(new xl(D+w,L+w,w,n));let C=function(D){let L=0,j=0,U=0;const X=D[0];for(let ne=0,Y=X.length,R=Y-1;ne<Y;R=ne++){const V=X[ne],Q=X[R],fe=V.x*Q.y-Q.x*V.y;j+=(V.x+Q.x)*fe,U+=(V.y+Q.y)*fe,L+=3*fe}return new xl(j/L,U/L,0,D)}(n),k=M.length;for(;M.length;){const D=M.pop();(D.d>C.d||!C.d)&&(C=D,r&&console.log("found best %d after %d probes",Math.round(1e4*D.d)/1e4,k)),D.max-C.d<=t||(w=D.h/2,M.push(new xl(D.p.x-w,D.p.y-w,w,n)),M.push(new xl(D.p.x+w,D.p.y-w,w,n)),M.push(new xl(D.p.x-w,D.p.y+w,w,n)),M.push(new xl(D.p.x+w,D.p.y+w,w,n)),k+=4)}return r&&(console.log(`num probes: ${k}`),console.log(`best distance: ${C.d}`)),C.p}function Wv(n,t){return t.max-n.max}function xl(n,t,r,a){this.p=new Fe(n,t),this.h=r,this.d=function(c,d){let p=!1,m=1/0;for(let y=0;y<d.length;y++){const w=d[y];for(let M=0,C=w.length,k=C-1;M<C;k=M++){const D=w[M],L=w[k];D.y>c.y!=L.y>c.y&&c.x<(L.x-D.x)*(c.y-D.y)/(L.y-D.y)+D.x&&(p=!p),m=Math.min(m,sm(c,D,L))}}return(p?1:-1)*Math.sqrt(m)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var rr;S.aB=void 0,(rr=S.aB||(S.aB={}))[rr.center=1]="center",rr[rr.left=2]="left",rr[rr.right=3]="right",rr[rr.top=4]="top",rr[rr.bottom=5]="bottom",rr[rr["top-left"]=6]="top-left",rr[rr["top-right"]=7]="top-right",rr[rr["bottom-left"]=8]="bottom-left",rr[rr["bottom-right"]=9]="bottom-right";const fs=7,zp=Number.POSITIVE_INFINITY;function Cg(n,t){return t[1]!==zp?function(r,a,c){let d=0,p=0;switch(a=Math.abs(a),c=Math.abs(c),r){case"top-right":case"top-left":case"top":p=c-fs;break;case"bottom-right":case"bottom-left":case"bottom":p=-c+fs}switch(r){case"top-right":case"bottom-right":case"right":d=-a;break;case"top-left":case"bottom-left":case"left":d=a}return[d,p]}(n,t[0],t[1]):function(r,a){let c=0,d=0;a<0&&(a=0);const p=a/Math.SQRT2;switch(r){case"top-right":case"top-left":d=p-fs;break;case"bottom-right":case"bottom-left":d=-p+fs;break;case"bottom":d=-a+fs;break;case"top":d=a-fs}switch(r){case"top-right":case"bottom-right":c=-p;break;case"top-left":case"bottom-left":c=p;break;case"left":c=a;break;case"right":c=-a}return[c,d]}(n,t[0])}function Ig(n,t,r){var a;const c=n.layout,d=(a=c.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(t,{},r);if(d){const m=d.values,y=[];for(let w=0;w<m.length;w+=2){const M=y[w]=m[w],C=m[w+1].map(k=>k*ki);M.startsWith("top")?C[1]-=fs:M.startsWith("bottom")&&(C[1]+=fs),y[w+1]=C}return new dr(y)}const p=c.get("text-variable-anchor");if(p){let m;m=n._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[c.get("text-radial-offset").evaluate(t,{},r)*ki,zp]:c.get("text-offset").evaluate(t,{},r).map(w=>w*ki);const y=[];for(const w of p)y.push(w,Cg(w,m));return new dr(y)}return null}function Rp(n){switch(n){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Xv(n,t,r,a,c,d,p,m,y,w,M,C){let k=d.textMaxSize.evaluate(t,{});k===void 0&&(k=p);const D=n.layers[0].layout,L=D.get("icon-offset").evaluate(t,{},M),j=Ag(r.horizontal),U=p/24,X=n.tilePixelRatio*U,ne=n.tilePixelRatio*k/24,Y=n.tilePixelRatio*m,R=n.tilePixelRatio*D.get("symbol-spacing"),V=D.get("text-padding")*n.tilePixelRatio,Q=function(et,Je,We,bt=1){const hi=et.get("icon-padding").evaluate(Je,{},We),zi=hi&&hi.values;return[zi[0]*bt,zi[1]*bt,zi[2]*bt,zi[3]*bt]}(D,t,M,n.tilePixelRatio),fe=D.get("text-max-angle")/180*Math.PI,ke=D.get("text-rotation-alignment")!=="viewport"&&D.get("symbol-placement")!=="point",ye=D.get("icon-rotation-alignment")==="map"&&D.get("symbol-placement")!=="point",Te=D.get("symbol-placement"),De=R/2,ze=D.get("icon-text-fit");let Le;a&&ze!=="none"&&(n.allowVerticalPlacement&&r.vertical&&(Le=Jm(a,r.vertical,ze,D.get("icon-text-fit-padding"),L,U)),j&&(a=Jm(a,j,ze,D.get("icon-text-fit-padding"),L,U)));const Se=M?C.line.getGranularityForZoomLevel(M.z):1,Ge=(et,Je)=>{Je.x<0||Je.x>=Et||Je.y<0||Je.y>=Et||function(We,bt,hi,zi,nr,nn,jr,Hi,si,Fi,Wi,Xi,Pr,an,Oi,Nr,Ri,ji,Ni,Pi,Yt,Ln,vl,Bn,Jv){const bl=We.addToLineVertexArray(bt,hi);let uo,wl,Tl,Ml,Dg=0,Lg=0,Bg=0,Fg=0,Zp=-1,Vp=-1;const Ia={};let Og=Rn("");if(We.allowVerticalPlacement&&zi.vertical){const mr=Hi.layout.get("text-rotate").evaluate(Yt,{},Bn)+90;Tl=new Wh(si,bt,Fi,Wi,Xi,zi.vertical,Pr,an,Oi,mr),jr&&(Ml=new Wh(si,bt,Fi,Wi,Xi,jr,Ri,ji,Oi,mr))}if(nr){const mr=Hi.layout.get("icon-rotate").evaluate(Yt,{}),sn=Hi.layout.get("icon-text-fit")!=="none",ho=Sg(nr,mr,vl,sn),On=jr?Sg(jr,mr,vl,sn):void 0;wl=new Wh(si,bt,Fi,Wi,Xi,nr,Ri,ji,!1,mr),Dg=4*ho.length;const po=We.iconSizeData;let ra=null;po.kind==="source"?(ra=[ia*Hi.layout.get("icon-size").evaluate(Yt,{})],ra[0]>hs&&Ui(`${We.layerIds[0]}: Value for "icon-size" is >= ${Qc}. Reduce your "icon-size".`)):po.kind==="composite"&&(ra=[ia*Ln.compositeIconSizes[0].evaluate(Yt,{},Bn),ia*Ln.compositeIconSizes[1].evaluate(Yt,{},Bn)],(ra[0]>hs||ra[1]>hs)&&Ui(`${We.layerIds[0]}: Value for "icon-size" is >= ${Qc}. Reduce your "icon-size".`)),We.addSymbols(We.icon,ho,ra,Pi,Ni,Yt,S.al.none,bt,bl.lineStartIndex,bl.lineLength,-1,Bn),Zp=We.icon.placedSymbolArray.length-1,On&&(Lg=4*On.length,We.addSymbols(We.icon,On,ra,Pi,Ni,Yt,S.al.vertical,bt,bl.lineStartIndex,bl.lineLength,-1,Bn),Vp=We.icon.placedSymbolArray.length-1)}const jg=Object.keys(zi.horizontal);for(const mr of jg){const sn=zi.horizontal[mr];if(!uo){Og=Rn(sn.text);const On=Hi.layout.get("text-rotate").evaluate(Yt,{},Bn);uo=new Wh(si,bt,Fi,Wi,Xi,sn,Pr,an,Oi,On)}const ho=sn.positionedLines.length===1;if(Bg+=Eg(We,bt,sn,nn,Hi,Oi,Yt,Nr,bl,zi.vertical?S.al.horizontal:S.al.horizontalOnly,ho?jg:[mr],Ia,Zp,Ln,Bn),ho)break}zi.vertical&&(Fg+=Eg(We,bt,zi.vertical,nn,Hi,Oi,Yt,Nr,bl,S.al.vertical,["vertical"],Ia,Vp,Ln,Bn));const Qv=uo?uo.boxStartIndex:We.collisionBoxArray.length,e0=uo?uo.boxEndIndex:We.collisionBoxArray.length,t0=Tl?Tl.boxStartIndex:We.collisionBoxArray.length,i0=Tl?Tl.boxEndIndex:We.collisionBoxArray.length,r0=wl?wl.boxStartIndex:We.collisionBoxArray.length,n0=wl?wl.boxEndIndex:We.collisionBoxArray.length,a0=Ml?Ml.boxStartIndex:We.collisionBoxArray.length,s0=Ml?Ml.boxEndIndex:We.collisionBoxArray.length;let Fn=-1;const Kh=(mr,sn)=>mr&&mr.circleDiameter?Math.max(mr.circleDiameter,sn):sn;Fn=Kh(uo,Fn),Fn=Kh(Tl,Fn),Fn=Kh(wl,Fn),Fn=Kh(Ml,Fn);const Ng=Fn>-1?1:0;Ng&&(Fn*=Jv/ki),We.glyphOffsetArray.length>=_l.MAX_GLYPHS&&Ui("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Yt.sortKey!==void 0&&We.addToSortKeyRanges(We.symbolInstances.length,Yt.sortKey);const o0=Ig(Hi,Yt,Bn),[l0,c0]=function(mr,sn){const ho=mr.length,On=sn==null?void 0:sn.values;if((On==null?void 0:On.length)>0)for(let po=0;po<On.length;po+=2){const ra=On[po+1];mr.emplaceBack(S.aB[On[po]],ra[0],ra[1])}return[ho,mr.length]}(We.textAnchorOffsets,o0);We.symbolInstances.emplaceBack(bt.x,bt.y,Ia.right>=0?Ia.right:-1,Ia.center>=0?Ia.center:-1,Ia.left>=0?Ia.left:-1,Ia.vertical||-1,Zp,Vp,Og,Qv,e0,t0,i0,r0,n0,a0,s0,Fi,Bg,Fg,Dg,Lg,Ng,0,Pr,Fn,l0,c0)}(n,Je,et,r,a,c,Le,n.layers[0],n.collisionBoxArray,t.index,t.sourceLayerIndex,n.index,X,[V,V,V,V],ke,y,Y,Q,ye,L,t,d,w,M,p)};if(Te==="line")for(const et of xg(t.geometry,0,0,Et,Et)){const Je=co(et,Se),We=Gv(Je,R,fe,r.vertical||j,a,24,ne,n.overscaling,Et);for(const bt of We)j&&Kv(n,j.text,De,bt)||Ge(Je,bt)}else if(Te==="line-center"){for(const et of t.geometry)if(et.length>1){const Je=co(et,Se),We=$v(Je,fe,r.vertical||j,a,24,ne);We&&Ge(Je,We)}}else if(t.type==="Polygon")for(const et of Fo(t.geometry,0)){const Je=Hv(et,16);Ge(co(et[0],Se,!0),new ps(Je.x,Je.y,0))}else if(t.type==="LineString")for(const et of t.geometry){const Je=co(et,Se);Ge(Je,new ps(Je[0].x,Je[0].y,0))}else if(t.type==="Point")for(const et of t.geometry)for(const Je of et)Ge([Je],new ps(Je.x,Je.y,0))}function Eg(n,t,r,a,c,d,p,m,y,w,M,C,k,D,L){const j=function(ne,Y,R,V,Q,fe,ke,ye){const Te=V.layout.get("text-rotate").evaluate(fe,{})*Math.PI/180,De=[];for(const ze of Y.positionedLines)for(const Le of ze.positionedGlyphs){if(!Le.rect)continue;const Se=Le.rect||{};let Ge=Tv+1,et=!0,Je=1,We=0;const bt=(Q||ye)&&Le.vertical,hi=Le.metrics.advance*Le.scale/2;if(ye&&Y.verticalizable&&(We=ze.lineOffset/2-(Le.imageName?-(ki-Le.metrics.width*Le.scale)/2:(Le.scale-1)*ki)),Le.imageName){const ji=ke[Le.imageName];et=ji.sdf,Je=ji.pixelRatio,Ge=Or/Je}const zi=Q?[Le.x+hi,Le.y]:[0,0];let nr=Q?[0,0]:[Le.x+hi+R[0],Le.y+R[1]-We],nn=[0,0];bt&&(nn=nr,nr=[0,0]);const jr=Le.metrics.isDoubleResolution?2:1,Hi=(Le.metrics.left-Ge)*Le.scale-hi+nr[0],si=(-Le.metrics.top-Ge)*Le.scale+nr[1],Fi=Hi+Se.w/jr*Le.scale/Je,Wi=si+Se.h/jr*Le.scale/Je,Xi=new Fe(Hi,si),Pr=new Fe(Fi,si),an=new Fe(Hi,Wi),Oi=new Fe(Fi,Wi);if(bt){const ji=new Fe(-hi,hi-Nh),Ni=-Math.PI/2,Pi=ki/2-hi,Yt=new Fe(5-Nh-Pi,-(Le.imageName?Pi:0)),Ln=new Fe(...nn);Xi._rotateAround(Ni,ji)._add(Yt)._add(Ln),Pr._rotateAround(Ni,ji)._add(Yt)._add(Ln),an._rotateAround(Ni,ji)._add(Yt)._add(Ln),Oi._rotateAround(Ni,ji)._add(Yt)._add(Ln)}if(Te){const ji=Math.sin(Te),Ni=Math.cos(Te),Pi=[Ni,-ji,ji,Ni];Xi._matMult(Pi),Pr._matMult(Pi),an._matMult(Pi),Oi._matMult(Pi)}const Nr=new Fe(0,0),Ri=new Fe(0,0);De.push({tl:Xi,tr:Pr,bl:an,br:Oi,tex:Se,writingMode:Y.writingMode,glyphOffset:zi,sectionIndex:Le.sectionIndex,isSDF:et,pixelOffsetTL:Nr,pixelOffsetBR:Ri,minFontScaleX:0,minFontScaleY:0})}return De}(0,r,m,c,d,p,a,n.allowVerticalPlacement),U=n.textSizeData;let X=null;U.kind==="source"?(X=[ia*c.layout.get("text-size").evaluate(p,{})],X[0]>hs&&Ui(`${n.layerIds[0]}: Value for "text-size" is >= ${Qc}. Reduce your "text-size".`)):U.kind==="composite"&&(X=[ia*D.compositeTextSizes[0].evaluate(p,{},L),ia*D.compositeTextSizes[1].evaluate(p,{},L)],(X[0]>hs||X[1]>hs)&&Ui(`${n.layerIds[0]}: Value for "text-size" is >= ${Qc}. Reduce your "text-size".`)),n.addSymbols(n.text,j,X,m,d,p,w,t,y.lineStartIndex,y.lineLength,k,L);for(const ne of M)C[ne]=n.text.placedSymbolArray.length-1;return 4*j.length}function Ag(n){for(const t in n)return n[t];return null}function Kv(n,t,r,a){const c=n.compareText;if(t in c){const d=c[t];for(let p=d.length-1;p>=0;p--)if(a.dist(d[p])<r)return!0}else c[t]=[];return c[t].push(a),!1}const kg=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Dp{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,a]=new Uint8Array(t,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const c=a>>4;if(c!==1)throw new Error(`Got v${c} data when expected v1.`);const d=kg[15&a];if(!d)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(t,2,1),[m]=new Uint32Array(t,4,1);return new Dp(m,p,d,t)}constructor(t,r=64,a=Float64Array,c){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=a,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const d=kg.indexOf(this.ArrayType),p=2*t*this.ArrayType.BYTES_PER_ELEMENT,m=t*this.IndexArrayType.BYTES_PER_ELEMENT,y=(8-m%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${a}.`);c&&c instanceof ArrayBuffer?(this.data=c,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+m+y,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+p+m+y),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+m+y,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){const a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=t,this.coords[this._pos++]=r,a}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Lp(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,a,c){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:p,nodeSize:m}=this,y=[0,d.length-1,0],w=[];for(;y.length;){const M=y.pop()||0,C=y.pop()||0,k=y.pop()||0;if(C-k<=m){for(let U=k;U<=C;U++){const X=p[2*U],ne=p[2*U+1];X>=t&&X<=a&&ne>=r&&ne<=c&&w.push(d[U])}continue}const D=k+C>>1,L=p[2*D],j=p[2*D+1];L>=t&&L<=a&&j>=r&&j<=c&&w.push(d[D]),(M===0?t<=L:r<=j)&&(y.push(k),y.push(D-1),y.push(1-M)),(M===0?a>=L:c>=j)&&(y.push(D+1),y.push(C),y.push(1-M))}return w}within(t,r,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:c,coords:d,nodeSize:p}=this,m=[0,c.length-1,0],y=[],w=a*a;for(;m.length;){const M=m.pop()||0,C=m.pop()||0,k=m.pop()||0;if(C-k<=p){for(let U=k;U<=C;U++)Rg(d[2*U],d[2*U+1],t,r)<=w&&y.push(c[U]);continue}const D=k+C>>1,L=d[2*D],j=d[2*D+1];Rg(L,j,t,r)<=w&&y.push(c[D]),(M===0?t-a<=L:r-a<=j)&&(m.push(k),m.push(D-1),m.push(1-M)),(M===0?t+a>=L:r+a>=j)&&(m.push(D+1),m.push(C),m.push(1-M))}return y}}function Lp(n,t,r,a,c,d){if(c-a<=r)return;const p=a+c>>1;zg(n,t,p,a,c,d),Lp(n,t,r,a,p-1,1-d),Lp(n,t,r,p+1,c,1-d)}function zg(n,t,r,a,c,d){for(;c>a;){if(c-a>600){const w=c-a+1,M=r-a+1,C=Math.log(w),k=.5*Math.exp(2*C/3),D=.5*Math.sqrt(C*k*(w-k)/w)*(M-w/2<0?-1:1);zg(n,t,r,Math.max(a,Math.floor(r-M*k/w+D)),Math.min(c,Math.floor(r+(w-M)*k/w+D)),d)}const p=t[2*r+d];let m=a,y=c;for(iu(n,t,a,r),t[2*c+d]>p&&iu(n,t,a,c);m<y;){for(iu(n,t,m,y),m++,y--;t[2*m+d]<p;)m++;for(;t[2*y+d]>p;)y--}t[2*a+d]===p?iu(n,t,a,y):(y++,iu(n,t,y,c)),y<=r&&(a=y+1),r<=y&&(c=y-1)}}function iu(n,t,r,a){Bp(n,r,a),Bp(t,2*r,2*a),Bp(t,2*r+1,2*a+1)}function Bp(n,t,r){const a=n[t];n[t]=n[r],n[r]=a}function Rg(n,t,r,a){const c=n-r,d=t-a;return c*c+d*d}var Fp;S.co=void 0,(Fp=S.co||(S.co={})).create="create",Fp.load="load",Fp.fullLoad="fullLoad";let Xh=null,ru=[];const Op=1e3/60,jp="loadTime",Np="fullLoadTime",Yv={mark(n){performance.mark(n)},frame(n){const t=n;Xh!=null&&ru.push(t-Xh),Xh=t},clearMetrics(){Xh=null,ru=[],performance.clearMeasures(jp),performance.clearMeasures(Np);for(const n in S.co)performance.clearMarks(S.co[n])},getPerformanceMetrics(){performance.measure(jp,S.co.create,S.co.load),performance.measure(Np,S.co.create,S.co.fullLoad);const n=performance.getEntriesByName(jp)[0].duration,t=performance.getEntriesByName(Np)[0].duration,r=ru.length,a=1/(ru.reduce((d,p)=>d+p,0)/r/1e3),c=ru.filter(d=>d>Op).reduce((d,p)=>d+(p-Op)/Op,0);return{loadTime:n,fullLoadTime:t,fps:a,percentDroppedFrames:c/(r+c)*100,totalFrames:r}}};S.$=eu,S.A=$t,S.B=pn,S.C=Xt,S.D=Ke,S.E=ae,S.F=qd,S.G=function(n){if(hn==null){const t=n.navigator?n.navigator.userAgent:null;hn=!!n.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return hn},S.H=class{constructor(n,t){this.target=n,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Zv(()=>this.process()),this.subscription=Ue(this.target,"message",r=>this.receive(r),!1),this.globalScope=Vr(self)?n:window}registerMessageHandler(n,t){this.messageHandlers[n]=t}sendAsync(n,t){return new Promise((r,a)=>{const c=Math.round(1e18*Math.random()).toString(36).substring(0,10),d=t?Ue(t.signal,"abort",()=>{d==null||d.unsubscribe(),delete this.resolveRejects[c];const y={id:c,type:"<cancel>",origin:location.origin,targetMapId:n.targetMapId,sourceMapId:this.mapId};this.target.postMessage(y)},Vv):null;this.resolveRejects[c]={resolve:y=>{d==null||d.unsubscribe(),r(y)},reject:y=>{d==null||d.unsubscribe(),a(y)}};const p=[],m=Object.assign(Object.assign({},n),{id:c,sourceMapId:this.mapId,origin:location.origin,data:os(n.data,p)});this.target.postMessage(m,{transfer:p})})}receive(n){const t=n.data,r=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[r];const a=this.abortControllers[r];return delete this.abortControllers[r],void(a&&a.abort())}if(Vr(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;const n=this.taskQueue.shift(),t=this.tasks[n];delete this.tasks[n],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(n,t)}processTask(n,t){return o(this,void 0,void 0,function*(){if(t.type==="<response>"){const c=this.resolveRejects[n];return delete this.resolveRejects[n],c?void(t.error?c.reject(Ys(t.error)):c.resolve(Ys(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(n,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=Ys(t.data),a=new AbortController;this.abortControllers[n]=a;try{const c=yield this.messageHandlers[t.type](t.sourceMapId,r,a);this.completeTask(n,null,c)}catch(c){this.completeTask(n,c)}})}completeTask(n,t,r){const a=[];delete this.abortControllers[n];const c={id:n,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?os(t):null,data:os(r,a)};this.target.postMessage(c,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},S.I=bp,S.J=ja,S.K=function(){var n=new $t(16);return $t!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0),n[0]=1,n[5]=1,n[10]=1,n[15]=1,n},S.L=function(n,t,r){var a,c,d,p,m,y,w,M,C,k,D,L,j=r[0],U=r[1],X=r[2];return t===n?(n[12]=t[0]*j+t[4]*U+t[8]*X+t[12],n[13]=t[1]*j+t[5]*U+t[9]*X+t[13],n[14]=t[2]*j+t[6]*U+t[10]*X+t[14],n[15]=t[3]*j+t[7]*U+t[11]*X+t[15]):(c=t[1],d=t[2],p=t[3],m=t[4],y=t[5],w=t[6],M=t[7],C=t[8],k=t[9],D=t[10],L=t[11],n[0]=a=t[0],n[1]=c,n[2]=d,n[3]=p,n[4]=m,n[5]=y,n[6]=w,n[7]=M,n[8]=C,n[9]=k,n[10]=D,n[11]=L,n[12]=a*j+m*U+C*X+t[12],n[13]=c*j+y*U+k*X+t[13],n[14]=d*j+w*U+D*X+t[14],n[15]=p*j+M*U+L*X+t[15]),n},S.M=function(n,t,r){var a=r[0],c=r[1],d=r[2];return n[0]=t[0]*a,n[1]=t[1]*a,n[2]=t[2]*a,n[3]=t[3]*a,n[4]=t[4]*c,n[5]=t[5]*c,n[6]=t[6]*c,n[7]=t[7]*c,n[8]=t[8]*d,n[9]=t[9]*d,n[10]=t[10]*d,n[11]=t[11]*d,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},S.N=function(n,t,r){var a=t[0],c=t[1],d=t[2],p=t[3],m=t[4],y=t[5],w=t[6],M=t[7],C=t[8],k=t[9],D=t[10],L=t[11],j=t[12],U=t[13],X=t[14],ne=t[15],Y=r[0],R=r[1],V=r[2],Q=r[3];return n[0]=Y*a+R*m+V*C+Q*j,n[1]=Y*c+R*y+V*k+Q*U,n[2]=Y*d+R*w+V*D+Q*X,n[3]=Y*p+R*M+V*L+Q*ne,n[4]=(Y=r[4])*a+(R=r[5])*m+(V=r[6])*C+(Q=r[7])*j,n[5]=Y*c+R*y+V*k+Q*U,n[6]=Y*d+R*w+V*D+Q*X,n[7]=Y*p+R*M+V*L+Q*ne,n[8]=(Y=r[8])*a+(R=r[9])*m+(V=r[10])*C+(Q=r[11])*j,n[9]=Y*c+R*y+V*k+Q*U,n[10]=Y*d+R*w+V*D+Q*X,n[11]=Y*p+R*M+V*L+Q*ne,n[12]=(Y=r[12])*a+(R=r[13])*m+(V=r[14])*C+(Q=r[15])*j,n[13]=Y*c+R*y+V*k+Q*U,n[14]=Y*d+R*w+V*D+Q*X,n[15]=Y*p+R*M+V*L+Q*ne,n},S.O=function(n,t){const r={};for(let a=0;a<t.length;a++){const c=t[a];c in n&&(r[c]=n[c])}return r},S.P=Fe,S.Q=ds,S.R=tn,S.S=lg,S.T=Ch,S.U=og,S.V=Ki,S.W=Ft,S.X=Cn,S.Y=rn,S.Z=Et,S._=o,S.a=In,S.a$=function(n,t,r){var a=Math.sin(r),c=Math.cos(r),d=t[4],p=t[5],m=t[6],y=t[7],w=t[8],M=t[9],C=t[10],k=t[11];return t!==n&&(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[4]=d*c+w*a,n[5]=p*c+M*a,n[6]=m*c+C*a,n[7]=y*c+k*a,n[8]=w*c-d*a,n[9]=M*c-p*a,n[10]=C*c-m*a,n[11]=k*c-y*a,n},S.a0=25,S.a1=kp,S.a2=n=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(const a of n){const c=window.document.createElement("source");ce(a)||(t.crossOrigin="Anonymous"),c.src=a,t.appendChild(c)}})},S.a3=we,S.a4=function(){return Sn++},S.a5=W,S.a6=_l,S.a7=Hs,S.a8=so,S.a9=mg,S.aA=function(n,t,r,a,c=!1){if(!r[0]&&!r[1])return[0,0];const d=c?a==="map"?-n.bearingInRadians:0:a==="viewport"?n.bearingInRadians:0;if(d){const p=Math.sin(d),m=Math.cos(d);r=[r[0]*m-r[1]*p,r[0]*p+r[1]*m]}return[c?r[0]:Ar(t,r[0],n.zoom),c?r[1]:Ar(t,r[1],n.zoom)]},S.aC=Mp,S.aD=Rp,S.aE=Tp,S.aF=Dp,S.aG=ii,S.aH=Fh,S.aI=be,S.aJ=Rt,S.aK=zt,S.aL=vr,S.aM=Nt,S.aN=ug,S.aO=function(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n[2]=t[2]*r,n},S.aP=function(n,t,r){return n[0]=t[0]+r[0],n[1]=t[1]+r[1],n[2]=t[2]+r[2],n},S.aQ=function(n){var t=new $t(3);return t[0]=n[0],t[1]=n[1],t[2]=n[2],t},S.aR=function(n,t,r){return n[0]=t[0]*r[0],n[1]=t[1]*r[1],n[2]=t[2]*r[2],n[3]=t[3]*r[3],n},S.aS=function(n,t,r){return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],n},S.aT=function(n,t){var r=t[0],a=t[1],c=t[2],d=r*r+a*a+c*c;return d>0&&(d=1/Math.sqrt(d)),n[0]=t[0]*d,n[1]=t[1]*d,n[2]=t[2]*d,n},S.aU=function(n,t,r){var a=t[0],c=t[1],d=t[2],p=r[0],m=r[1],y=r[2];return n[0]=c*y-d*m,n[1]=d*p-a*y,n[2]=a*m-c*p,n},S.aV=function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]},S.aW=dg,S.aX=yl,S.aY=function(n,t,r,a,c){var d,p=1/Math.tan(t/2);return n[0]=p/r,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=p,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,c!=null&&c!==1/0?(n[10]=(c+a)*(d=1/(a-c)),n[14]=2*c*a*d):(n[10]=-1,n[14]=-2*a),n},S.aZ=function(n){var t=new $t(16);return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},S.a_=function(n,t,r){var a=Math.sin(r),c=Math.cos(r),d=t[0],p=t[1],m=t[2],y=t[3],w=t[4],M=t[5],C=t[6],k=t[7];return t!==n&&(n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=d*c+w*a,n[1]=p*c+M*a,n[2]=m*c+C*a,n[3]=y*c+k*a,n[4]=w*c-d*a,n[5]=M*c-p*a,n[6]=C*c-m*a,n[7]=k*c-y*a,n},S.aa=function(n){const t={};if(n.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,a,c,d)=>{const p=c||d;return t[a]=!p||p.toLowerCase(),""}),t["max-age"]){const r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},S.ab=_t,S.ac=function(n){return Math.pow(2,n)},S.ad=jt,S.ae=Ht,S.af=85.051129,S.ag=cg,S.ah=function(n){return Math.log(n)/Math.LN2},S.ai=function(n){var t=n[0],r=n[1];return t*t+r*r},S.aj=function(n,t){const r=[];for(const a in n)a in t||r.push(a);return r},S.ak=function(n,t){let r=0,a=0;if(n.kind==="constant")a=n.layoutSize;else if(n.kind!=="source"){const{interpolationType:c,minZoom:d,maxZoom:p}=n,m=c?Ht(tr.interpolationFactor(c,t,d,p),0,1):0;n.kind==="camera"?a=pn.number(n.minSize,n.maxSize,m):r=m}return{uSizeT:r,uSize:a}},S.am=function(n,{uSize:t,uSizeT:r},{lowerSize:a,upperSize:c}){return n.kind==="source"?a/ia:n.kind==="composite"?pn.number(a/ia,c/ia,r):t},S.an=function(n,t){var r=t[0],a=t[1],c=t[2],d=t[3],p=t[4],m=t[5],y=t[6],w=t[7],M=t[8],C=t[9],k=t[10],D=t[11],L=t[12],j=t[13],U=t[14],X=t[15],ne=r*m-a*p,Y=r*y-c*p,R=r*w-d*p,V=a*y-c*m,Q=a*w-d*m,fe=c*w-d*y,ke=M*j-C*L,ye=M*U-k*L,Te=M*X-D*L,De=C*U-k*j,ze=C*X-D*j,Le=k*X-D*U,Se=ne*Le-Y*ze+R*De+V*Te-Q*ye+fe*ke;return Se?(n[0]=(m*Le-y*ze+w*De)*(Se=1/Se),n[1]=(c*ze-a*Le-d*De)*Se,n[2]=(j*fe-U*Q+X*V)*Se,n[3]=(k*Q-C*fe-D*V)*Se,n[4]=(y*Te-p*Le-w*ye)*Se,n[5]=(r*Le-c*Te+d*ye)*Se,n[6]=(U*R-L*fe-X*Y)*Se,n[7]=(M*fe-k*R+D*Y)*Se,n[8]=(p*ze-m*Te+w*ke)*Se,n[9]=(a*Te-r*ze-d*ke)*Se,n[10]=(L*Q-j*R+X*ne)*Se,n[11]=(C*R-M*Q-D*ne)*Se,n[12]=(m*ye-p*De-y*ke)*Se,n[13]=(r*De-a*ye+c*ke)*Se,n[14]=(j*Y-L*V-U*ne)*Se,n[15]=(M*V-C*Y+k*ne)*Se,n):null},S.ao=xi,S.ap=function(n){return Math.hypot(n[0],n[1])},S.aq=function(n){return n[0]=0,n[1]=0,n},S.ar=function(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n},S.as=Sp,S.at=ot,S.au=function(n,t,r,a){const c=t.y-n.y,d=t.x-n.x,p=a.y-r.y,m=a.x-r.x,y=p*d-m*c;if(y===0)return null;const w=(m*(n.y-r.y)-p*(n.x-r.x))/y;return new Fe(n.x+w*d,n.y+w*c)},S.av=xg,S.aw=nm,S.ax=function(n){let t=1/0,r=1/0,a=-1/0,c=-1/0;for(const d of n)t=Math.min(t,d.x),r=Math.min(r,d.y),a=Math.max(a,d.x),c=Math.max(c,d.y);return[t,r,a,c]},S.ay=ki,S.az=Ar,S.b=br,S.b$=class extends O{},S.b0=function(){const n=new Float32Array(16);return jt(n),n},S.b1=function(){const n=new Float64Array(16);return jt(n),n},S.b2=function(){return new Float64Array(16)},S.b3=function(n,t,r){const a=new Float64Array(4);return function(c,d,p,m){var y=.5*Math.PI/180;d*=y,p*=y,m*=y;var w=Math.sin(d),M=Math.cos(d),C=Math.sin(p),k=Math.cos(p),D=Math.sin(m),L=Math.cos(m);c[0]=w*k*L-M*C*D,c[1]=M*C*L+w*k*D,c[2]=M*k*D-w*C*L,c[3]=M*k*L+w*C*D}(a,n,t-90,r),a},S.b4=function(n,t,r,a){var c,d,p,m,y,w=t[0],M=t[1],C=t[2],k=t[3],D=r[0],L=r[1],j=r[2],U=r[3];return(d=w*D+M*L+C*j+k*U)<0&&(d=-d,D=-D,L=-L,j=-j,U=-U),1-d>It?(c=Math.acos(d),p=Math.sin(c),m=Math.sin((1-a)*c)/p,y=Math.sin(a*c)/p):(m=1-a,y=a),n[0]=m*w+y*D,n[1]=m*M+y*L,n[2]=m*C+y*j,n[3]=m*k+y*U,n},S.b5=function(n){const t=new Float64Array(9);var r,a,c,d,p,m,y,w,M,C,k,D,L,j,U,X,ne,Y;C=(c=(a=n)[0])*(y=c+c),k=(d=a[1])*y,L=(p=a[2])*y,j=p*(w=d+d),X=(m=a[3])*y,ne=m*w,Y=m*(M=p+p),(r=t)[0]=1-(D=d*w)-(U=p*M),r[3]=k-Y,r[6]=L+ne,r[1]=k+Y,r[4]=1-C-U,r[7]=j-X,r[2]=L-ne,r[5]=j+X,r[8]=1-C-D;const R=Nt(-Math.asin(Ht(t[2],-1,1)));let V,Q;return Math.hypot(t[5],t[8])<.001?(V=0,Q=-Nt(Math.atan2(t[3],t[4]))):(V=Nt(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),Q=Nt(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:V,pitch:R+90,bearing:Q}},S.b6=function(n,t){return n.roll==t.roll&&n.pitch==t.pitch&&n.bearing==t.bearing},S.b7=Mt,S.b8=hl,S.b9=ml,S.bA=function(n){if(n.type==="custom")return new Nv(n);switch(n.type){case"background":return new Fv(n);case"circle":return new zx(n);case"fill":return new Yx(n);case"fill-extrusion":return new av(n);case"heatmap":return new Dx(n);case"hillshade":return new Bx(n);case"line":return new pv(n);case"raster":return new jv(n);case"symbol":return new $h(n)}},S.bB=or,S.bC=function(n,t){if(!n)return[{command:"setStyle",args:[t]}];let r=[];try{if(!de(n.version,t.version))return[{command:"setStyle",args:[t]}];de(n.center,t.center)||r.push({command:"setCenter",args:[t.center]}),de(n.state,t.state)||r.push({command:"setGlobalState",args:[t.state]}),de(n.centerAltitude,t.centerAltitude)||r.push({command:"setCenterAltitude",args:[t.centerAltitude]}),de(n.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),de(n.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),de(n.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),de(n.roll,t.roll)||r.push({command:"setRoll",args:[t.roll]}),de(n.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),de(n.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),de(n.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),de(n.light,t.light)||r.push({command:"setLight",args:[t.light]}),de(n.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),de(n.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),de(n.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});const a={},c=[];(function(p,m,y,w){let M;for(M in m=m||{},p=p||{})Object.prototype.hasOwnProperty.call(p,M)&&(Object.prototype.hasOwnProperty.call(m,M)||Ae(M,y,w));for(M in m)Object.prototype.hasOwnProperty.call(m,M)&&(Object.prototype.hasOwnProperty.call(p,M)?de(p[M],m[M])||(p[M].type==="geojson"&&m[M].type==="geojson"&&Ve(p,m,M)?_e(y,{command:"setGeoJSONSourceData",args:[M,m[M].data]}):Ze(M,m,y,w)):ue(M,m,y))})(n.sources,t.sources,c,a);const d=[];n.layers&&n.layers.forEach(p=>{"source"in p&&a[p.source]?r.push({command:"removeLayer",args:[p.id]}):d.push(p)}),r=r.concat(c),function(p,m,y){m=m||[];const w=(p=p||[]).map(dt),M=m.map(dt),C=p.reduce(at,{}),k=m.reduce(at,{}),D=w.slice(),L=Object.create(null);let j,U,X,ne,Y;for(let R=0,V=0;R<w.length;R++)j=w[R],Object.prototype.hasOwnProperty.call(k,j)?V++:(_e(y,{command:"removeLayer",args:[j]}),D.splice(D.indexOf(j,V),1));for(let R=0,V=0;R<M.length;R++)j=M[M.length-1-R],D[D.length-1-R]!==j&&(Object.prototype.hasOwnProperty.call(C,j)?(_e(y,{command:"removeLayer",args:[j]}),D.splice(D.lastIndexOf(j,D.length-V),1)):V++,ne=D[D.length-R],_e(y,{command:"addLayer",args:[k[j],ne]}),D.splice(D.length-R,0,j),L[j]=!0);for(let R=0;R<M.length;R++)if(j=M[R],U=C[j],X=k[j],!L[j]&&!de(U,X))if(de(U.source,X.source)&&de(U["source-layer"],X["source-layer"])&&de(U.type,X.type)){for(Y in Qe(U.layout,X.layout,y,j,null,"setLayoutProperty"),Qe(U.paint,X.paint,y,j,null,"setPaintProperty"),de(U.filter,X.filter)||_e(y,{command:"setFilter",args:[j,X.filter]}),de(U.minzoom,X.minzoom)&&de(U.maxzoom,X.maxzoom)||_e(y,{command:"setLayerZoomRange",args:[j,X.minzoom,X.maxzoom]}),U)Object.prototype.hasOwnProperty.call(U,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Qe(U[Y],X[Y],y,j,Y.slice(6),"setPaintProperty"):de(U[Y],X[Y])||_e(y,{command:"setLayerProperty",args:[j,Y,X[Y]]}));for(Y in X)Object.prototype.hasOwnProperty.call(X,Y)&&!Object.prototype.hasOwnProperty.call(U,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Qe(U[Y],X[Y],y,j,Y.slice(6),"setPaintProperty"):de(U[Y],X[Y])||_e(y,{command:"setLayerProperty",args:[j,Y,X[Y]]}))}else _e(y,{command:"removeLayer",args:[j]}),ne=D[D.lastIndexOf(j)+1],_e(y,{command:"addLayer",args:[X,ne]})}(d,t.layers,r)}catch(a){console.warn("Unable to compute style diff:",a),r=[{command:"setStyle",args:[t]}]}return r},S.bD=function(n){const t=[],r=n.id;return r===void 0&&t.push({message:`layers.${r}: missing required property "id"`}),n.render===void 0&&t.push({message:`layers.${r}: missing required method "render"`}),n.renderingMode&&n.renderingMode!=="2d"&&n.renderingMode!=="3d"&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},S.bE=function n(t,r){if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let a=0;a<t.length;a++)if(!n(t[a],r[a]))return!1;return!0}if(typeof t=="object"&&t!==null&&r!==null){if(typeof r!="object"||Object.keys(t).length!==Object.keys(r).length)return!1;for(const a in t)if(!n(t[a],r[a]))return!1;return!0}return t===r},S.bF=un,S.bG=ca,S.bH=class extends Kt{constructor(n,t){super(n,t),this.current=0}set(n){this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}},S.bI=zh,S.bJ=class extends Kt{constructor(n,t){super(n,t),this.current=Jd}set(n){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let t=1;t<16;t++)if(n[t]!==this.current[t]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}},S.bK=kh,S.bL=class extends Kt{constructor(n,t){super(n,t),this.current=[0,0,0]}set(n){n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2]))}},S.bM=class extends Kt{constructor(n,t){super(n,t),this.current=[0,0]}set(n){n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1]))}},S.bN=_r,S.bO=function(n,t){var r=Math.sin(t),a=Math.cos(t);return n[0]=a,n[1]=r,n[2]=0,n[3]=-r,n[4]=a,n[5]=0,n[6]=0,n[7]=0,n[8]=1,n},S.bP=function(n,t,r){var a=t[0],c=t[1],d=t[2];return n[0]=a*r[0]+c*r[3]+d*r[6],n[1]=a*r[1]+c*r[4]+d*r[7],n[2]=a*r[2]+c*r[5]+d*r[8],n},S.bQ=function(n,t,r,a,c,d,p){var m=1/(t-r),y=1/(a-c),w=1/(d-p);return n[0]=-2*m,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*y,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*w,n[11]=0,n[12]=(t+r)*m,n[13]=(c+a)*y,n[14]=(p+d)*w,n[15]=1,n},S.bR=class extends Kt{constructor(n,t){super(n,t),this.current=new Array}set(n){if(n!=this.current){this.current=n;const t=new Float32Array(4*n.length);for(let r=0;r<n.length;r++)t[4*r]=n[r].r,t[4*r+1]=n[r].g,t[4*r+2]=n[r].b,t[4*r+3]=n[r].a;this.gl.uniform4fv(this.location,t)}}},S.bS=class extends Kt{constructor(n,t){super(n,t),this.current=new Array}set(n){if(n!=this.current){this.current=n;const t=new Float32Array(n);this.gl.uniform1fv(this.location,t)}}},S.bT=class extends h{},S.bU=_v,S.bV=class extends _{},S.bW=ap,S.bX=function(n){return n<=1?1:Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))},S.bY=fm,S.bZ=function(n,t,r){var a=t[0],c=t[1],d=t[2],p=r[3]*a+r[7]*c+r[11]*d+r[15];return n[0]=(r[0]*a+r[4]*c+r[8]*d+r[12])/(p=p||1),n[1]=(r[1]*a+r[5]*c+r[9]*d+r[13])/p,n[2]=(r[2]*a+r[6]*c+r[10]*d+r[14])/p,n},S.b_=class extends Sa{},S.ba=qc,S.bb=fl,S.bc=cn,S.bd=kr,S.be=Sr,S.bf=function(n,t,r,a,c){return cn(a,c,Ht((n-t)/(r-t),0,1))},S.bg=sr,S.bh=function(){return new Float64Array(3)},S.bi=function(n,t,r,a){return n[0]=t[0]+r[0]*a,n[1]=t[1]+r[1]*a,n[2]=t[2]+r[2]*a,n},S.bj=Ji,S.bk=function(){return new Float64Array(4)},S.bl=function(n,t,r,a){var c=[],d=[];return c[0]=t[0]-r[0],c[1]=t[1]-r[1],c[2]=t[2]-r[2],d[0]=c[0]*Math.cos(a)-c[1]*Math.sin(a),d[1]=c[0]*Math.sin(a)+c[1]*Math.cos(a),d[2]=c[2],n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},S.bm=function(n,t,r,a){var c=[],d=[];return c[0]=t[0]-r[0],c[1]=t[1]-r[1],c[2]=t[2]-r[2],d[0]=c[0],d[1]=c[1]*Math.cos(a)-c[2]*Math.sin(a),d[2]=c[1]*Math.sin(a)+c[2]*Math.cos(a),n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},S.bn=function(n,t,r,a){var c=[],d=[];return c[0]=t[0]-r[0],c[1]=t[1]-r[1],c[2]=t[2]-r[2],d[0]=c[2]*Math.sin(a)+c[0]*Math.cos(a),d[1]=c[1],d[2]=c[2]*Math.cos(a)-c[0]*Math.sin(a),n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},S.bo=Mn,S.bp=function(n,t,r){var a=Math.sin(r),c=Math.cos(r),d=t[0],p=t[1],m=t[2],y=t[3],w=t[8],M=t[9],C=t[10],k=t[11];return t!==n&&(n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=d*c-w*a,n[1]=p*c-M*a,n[2]=m*c-C*a,n[3]=y*c-k*a,n[8]=d*a+w*c,n[9]=p*a+M*c,n[10]=m*a+C*c,n[11]=y*a+k*c,n},S.bq=function(n,t){const r=sr(n,360),a=sr(t,360),c=a-r,d=a>r?c-360:c+360;return Math.abs(c)<Math.abs(d)?c:d},S.br=function(n){return n[0]=0,n[1]=0,n[2]=0,n},S.bs=function(n,t,r,a){const c=Math.sqrt(n*n+t*t),d=Math.sqrt(r*r+a*a);n/=c,t/=c,r/=d,a/=d;const p=Math.acos(n*r+t*a);return-t*r+n*a>0?p:-p},S.bt=function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]},S.bu=Ep,S.bv=function(n,t){const r=sr(n,2*Math.PI),a=sr(t,2*Math.PI);return Math.min(Math.abs(r-a),Math.abs(r-a+2*Math.PI),Math.abs(r-a-2*Math.PI))},S.bw=function(){const n={},t=$.$version;for(const r in $.$root){const a=$.$root[r];if(a.required){let c=null;c=r==="version"?t:a.type==="array"?[]:{},c!=null&&(n[r]=c)}}return n},S.bx=Ic,S.by=wr,S.bz=function(n){n=n.slice();const t=Object.create(null);for(let r=0;r<n.length;r++)t[n[r].id]=n[r];for(let r=0;r<n.length;r++)"ref"in n[r]&&(n[r]=oe(n[r],t[n[r].ref]));return n},S.c=Rr,S.c0=function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]&&n[3]===t[3]&&n[4]===t[4]&&n[5]===t[5]&&n[6]===t[6]&&n[7]===t[7]&&n[8]===t[8]&&n[9]===t[9]&&n[10]===t[10]&&n[11]===t[11]&&n[12]===t[12]&&n[13]===t[13]&&n[14]===t[14]&&n[15]===t[15]},S.c1=function(n,t){var r=n[0],a=n[1],c=n[2],d=n[3],p=n[4],m=n[5],y=n[6],w=n[7],M=n[8],C=n[9],k=n[10],D=n[11],L=n[12],j=n[13],U=n[14],X=n[15],ne=t[0],Y=t[1],R=t[2],V=t[3],Q=t[4],fe=t[5],ke=t[6],ye=t[7],Te=t[8],De=t[9],ze=t[10],Le=t[11],Se=t[12],Ge=t[13],et=t[14],Je=t[15];return Math.abs(r-ne)<=It*Math.max(1,Math.abs(r),Math.abs(ne))&&Math.abs(a-Y)<=It*Math.max(1,Math.abs(a),Math.abs(Y))&&Math.abs(c-R)<=It*Math.max(1,Math.abs(c),Math.abs(R))&&Math.abs(d-V)<=It*Math.max(1,Math.abs(d),Math.abs(V))&&Math.abs(p-Q)<=It*Math.max(1,Math.abs(p),Math.abs(Q))&&Math.abs(m-fe)<=It*Math.max(1,Math.abs(m),Math.abs(fe))&&Math.abs(y-ke)<=It*Math.max(1,Math.abs(y),Math.abs(ke))&&Math.abs(w-ye)<=It*Math.max(1,Math.abs(w),Math.abs(ye))&&Math.abs(M-Te)<=It*Math.max(1,Math.abs(M),Math.abs(Te))&&Math.abs(C-De)<=It*Math.max(1,Math.abs(C),Math.abs(De))&&Math.abs(k-ze)<=It*Math.max(1,Math.abs(k),Math.abs(ze))&&Math.abs(D-Le)<=It*Math.max(1,Math.abs(D),Math.abs(Le))&&Math.abs(L-Se)<=It*Math.max(1,Math.abs(L),Math.abs(Se))&&Math.abs(j-Ge)<=It*Math.max(1,Math.abs(j),Math.abs(Ge))&&Math.abs(U-et)<=It*Math.max(1,Math.abs(U),Math.abs(et))&&Math.abs(X-Je)<=It*Math.max(1,Math.abs(X),Math.abs(Je))},S.c2=function(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},S.c3=n=>n.type==="symbol",S.c4=n=>n.type==="circle",S.c5=n=>n.type==="heatmap",S.c6=n=>n.type==="line",S.c7=n=>n.type==="fill",S.c8=n=>n.type==="fill-extrusion",S.c9=n=>n.type==="hillshade",S.cA=up,S.cB=mp,S.cC=Wc,S.cD=xp,S.cE=class{constructor(n){this._marks={start:[n.url,"start"].join("#"),end:[n.url,"end"].join("#"),measure:n.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let n=performance.getEntriesByName(this._marks.measure);return n.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),n=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),n}},S.cF=function(n,t,r,a,c){return o(this,void 0,void 0,function*(){if(Ft())try{return yield Cn(n,t,r,a,c)}catch{}return function(d,p,m,y,w){const M=d.width,C=d.height;Ce&&Ye||(Ce=new OffscreenCanvas(M,C),Ye=Ce.getContext("2d",{willReadFrequently:!0})),Ce.width=M,Ce.height=C,Ye.drawImage(d,0,0,M,C);const k=Ye.getImageData(p,m,y,w);return Ye.clearRect(0,0,M,C),k.data}(n,t,r,a,c)})},S.cG=pg,S.cH=he,S.cI=Be,S.cJ=km,S.cK=Um,S.cL=Ko,S.cM=zn,S.ca=n=>n.type==="raster",S.cb=n=>n.type==="background",S.cc=n=>n.type==="custom",S.cd=la,S.ce=function(n,t,r){const a=yr(t.x-r.x,t.y-r.y),c=yr(n.x-r.x,n.y-r.y);var d,p;return Nt(Math.atan2(a[0]*c[1]-a[1]*c[0],(d=a)[0]*(p=c)[0]+d[1]*p[1]))},S.cf=xr,S.cg=function(n,t){return mi[t]&&(n instanceof MouseEvent||n instanceof WheelEvent)},S.ch=function(n,t){return cr[t]&&"touches"in n},S.ci=function(n){return cr[n]||mi[n]},S.cj=function(n,t,r){var a=t[0],c=t[1];return n[0]=r[0]*a+r[4]*c+r[12],n[1]=r[1]*a+r[5]*c+r[13],n},S.ck=function(n,t){const{x:r,y:a}=eu.fromLngLat(t);return!(n<0||n>25||a<0||a>=1||r<0||r>=1)},S.cl=function(n,t){return n[0]=t[0],n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=t[1],n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=t[2],n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n},S.cm=class extends io{},S.cn=Yv,S.cp=function(n){return n.message===zr},S.cq=Ur,S.cr=function(n,t){In.REGISTERED_PROTOCOLS[n]=t},S.cs=function(n){delete In.REGISTERED_PROTOCOLS[n]},S.ct=function(n,t){const r={};for(let c=0;c<n.length;c++){const d=t&&t[n[c].id]||gh(n[c]);t&&(t[n[c].id]=d);let p=r[d];p||(p=r[d]=[]),p.push(n[c])}const a=[];for(const c in r)a.push(r[c]);return a},S.cu=$e,S.cv=fg,S.cw=gg,S.cx=Gm,S.cy=function(n){n.bucket.createArrays(),n.bucket.tilePixelRatio=Et/(512*n.bucket.overscaling),n.bucket.compareText={},n.bucket.iconsNeedLinear=!1;const t=n.bucket.layers[0],r=t.layout,a=t._unevaluatedLayout._values,c={layoutIconSize:a["icon-size"].possiblyEvaluate(new Xt(n.bucket.zoom+1),n.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new Xt(n.bucket.zoom+1),n.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new Xt(18))};if(n.bucket.textSizeData.kind==="composite"){const{minZoom:w,maxZoom:M}=n.bucket.textSizeData;c.compositeTextSizes=[a["text-size"].possiblyEvaluate(new Xt(w),n.canonical),a["text-size"].possiblyEvaluate(new Xt(M),n.canonical)]}if(n.bucket.iconSizeData.kind==="composite"){const{minZoom:w,maxZoom:M}=n.bucket.iconSizeData;c.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new Xt(w),n.canonical),a["icon-size"].possiblyEvaluate(new Xt(M),n.canonical)]}const d=r.get("text-line-height")*ki,p=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",m=r.get("text-keep-upright"),y=r.get("text-size");for(const w of n.bucket.features){const M=r.get("text-font").evaluate(w,{},n.canonical).join(","),C=y.evaluate(w,{},n.canonical),k=c.layoutTextSize.evaluate(w,{},n.canonical),D=c.layoutIconSize.evaluate(w,{},n.canonical),L={horizontal:{},vertical:void 0},j=w.text;let U,X=[0,0];if(j){const R=j.toString(),V=r.get("text-letter-spacing").evaluate(w,{},n.canonical)*ki,Q=Hd(R)?V:0,fe=r.get("text-anchor").evaluate(w,{},n.canonical),ke=Ig(t,w,n.canonical);if(!ke){const ze=r.get("text-radial-offset").evaluate(w,{},n.canonical);X=ze?Cg(fe,[ze*ki,zp]):r.get("text-offset").evaluate(w,{},n.canonical).map(Le=>Le*ki)}let ye=p?"center":r.get("text-justify").evaluate(w,{},n.canonical);const Te=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(w,{},n.canonical)*ki:1/0,De=()=>{n.bucket.allowVerticalPlacement&&ol(R)&&(L.vertical=Zh(j,n.glyphMap,n.glyphPositions,n.imagePositions,M,Te,d,fe,"left",Q,X,S.al.vertical,!0,k,C))};if(!p&&ke){const ze=new Set;if(ye==="auto")for(let Se=0;Se<ke.values.length;Se+=2)ze.add(Rp(ke.values[Se]));else ze.add(ye);let Le=!1;for(const Se of ze)if(!L.horizontal[Se])if(Le)L.horizontal[Se]=L.horizontal[0];else{const Ge=Zh(j,n.glyphMap,n.glyphPositions,n.imagePositions,M,Te,d,"center",Se,Q,X,S.al.horizontal,!1,k,C);Ge&&(L.horizontal[Se]=Ge,Le=Ge.positionedLines.length===1)}De()}else{ye==="auto"&&(ye=Rp(fe));const ze=Zh(j,n.glyphMap,n.glyphPositions,n.imagePositions,M,Te,d,fe,ye,Q,X,S.al.horizontal,!1,k,C);ze&&(L.horizontal[ye]=ze),De(),ol(R)&&p&&m&&(L.vertical=Zh(j,n.glyphMap,n.glyphPositions,n.imagePositions,M,Te,d,fe,ye,Q,X,S.al.vertical,!1,k,C))}}let ne=!1;if(w.icon&&w.icon.name){const R=n.imageMap[w.icon.name];R&&(U=zv(n.imagePositions[w.icon.name],r.get("icon-offset").evaluate(w,{},n.canonical),r.get("icon-anchor").evaluate(w,{},n.canonical)),ne=!!R.sdf,n.bucket.sdfIcons===void 0?n.bucket.sdfIcons=ne:n.bucket.sdfIcons!==ne&&Ui("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(R.pixelRatio!==n.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(n.bucket.iconsNeedLinear=!0))}const Y=Ag(L.horizontal)||L.vertical;n.bucket.iconsInText=!!Y&&Y.iconsInText,(Y||U)&&Xv(n.bucket,w,L,U,n.imageMap,c,k,D,X,ne,n.canonical,n.subdivisionGranularity)}n.showCollisionBoxes&&n.bucket.generateCollisionDebugBuffers()},S.cz=gp,S.d=ce,S.e=Qi,S.f=n=>o(void 0,void 0,void 0,function*(){if(n.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(n)],{type:"image/png"});try{return createImageBitmap(t)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),S.g=qn,S.h=n=>new Promise((t,r)=>{const a=new Image;a.onload=()=>{t(a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame(()=>{a.src=Pn})},a.onerror=()=>r(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 c=new Blob([new Uint8Array(n)],{type:"image/png"});a.src=n.byteLength?URL.createObjectURL(c):Pn}),S.i=Vr,S.j=(n,t)=>dn(Qi(n,{type:"json"}),t),S.k=J,S.l=G,S.m=dn,S.n=(n,t)=>dn(Qi(n,{type:"arrayBuffer"}),t),S.o=function(n){return new xp(n).readFields(vv,[])},S.p=$m,S.q=Zc,S.r=Ti,S.s=Ue,S.t=rl,S.u=vt,S.v=$,S.w=Ui,S.x=Cc,S.y=as,S.z=function([n,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:n*Math.cos(t)*Math.sin(r),y:n*Math.sin(t)*Math.sin(r),z:n*Math.cos(r)}}}),z("worker",["./shared"],function(S){class o{constructor(N){this.keyCache={},N&&this.replace(N)}replace(N){this._layerConfigs={},this._layers={},this.update(N,[])}update(N,Z){for(const J of N){this._layerConfigs[J.id]=J;const ae=this._layers[J.id]=S.bA(J);ae._featureFilter=S.a7(ae.filter),this.keyCache[J.id]&&delete this.keyCache[J.id]}for(const J of Z)delete this.keyCache[J],delete this._layerConfigs[J],delete this._layers[J];this.familiesBySource={};const G=S.ct(Object.values(this._layerConfigs),this.keyCache);for(const J of G){const ae=J.map(ue=>this._layers[ue.id]),$=ae[0];if($.visibility==="none")continue;const ge=$.source||"";let oe=this.familiesBySource[ge];oe||(oe=this.familiesBySource[ge]={});const de=$.sourceLayer||"_geojsonTileLayer";let _e=oe[de];_e||(_e=oe[de]=[]),_e.push(ae)}}}class he{constructor(N){const Z={},G=[];for(const ge in N){const oe=N[ge],de=Z[ge]={};for(const _e in oe){const ue=oe[+_e];if(!ue||ue.bitmap.width===0||ue.bitmap.height===0)continue;const Ae={x:0,y:0,w:ue.bitmap.width+2,h:ue.bitmap.height+2};G.push(Ae),de[_e]={rect:Ae,metrics:ue.metrics}}}const{w:J,h:ae}=S.p(G),$=new S.q({width:J||1,height:ae||1});for(const ge in N){const oe=N[ge];for(const de in oe){const _e=oe[+de];if(!_e||_e.bitmap.width===0||_e.bitmap.height===0)continue;const ue=Z[ge][de].rect;S.q.copy(_e.bitmap,$,{x:0,y:0},{x:ue.x+1,y:ue.y+1},_e.bitmap)}}this.image=$,this.positions=Z}}S.cu("GlyphAtlas",he);class me{constructor(N){this.tileID=new S.Y(N.tileID.overscaledZ,N.tileID.wrap,N.tileID.canonical.z,N.tileID.canonical.x,N.tileID.canonical.y),this.uid=N.uid,this.zoom=N.zoom,this.pixelRatio=N.pixelRatio,this.tileSize=N.tileSize,this.source=N.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=N.showCollisionBoxes,this.collectResourceTiming=!!N.collectResourceTiming,this.returnDependencies=!!N.returnDependencies,this.promoteId=N.promoteId,this.inFlightDependencies=[]}parse(N,Z,G,J,ae){return S._(this,void 0,void 0,function*(){this.status="parsing",this.data=N,this.collisionBoxArray=new S.a5;const $=new S.cv(Object.keys(N.layers).sort()),ge=new S.cw(this.tileID,this.promoteId);ge.bucketLayerIDs=[];const oe={},de={featureIndex:ge,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:G,subdivisionGranularity:ae},_e=Z.familiesBySource[this.source];for(const nt in _e){const Ie=N.layers[nt];if(!Ie)continue;Ie.version===1&&S.w(`Vector tile source "${this.source}" layer "${nt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const it=$.encode(nt),pt=[];for(let oi=0;oi<Ie.length;oi++){const li=Ie.feature(oi),Tr=ge.getId(li,nt);pt.push({feature:li,id:Tr,index:oi,sourceLayerIndex:it})}for(const oi of _e[nt]){const li=oi[0];li.source!==this.source&&S.w(`layer.source = ${li.source} does not equal this.source = ${this.source}`),li.minzoom&&this.zoom<Math.floor(li.minzoom)||li.maxzoom&&this.zoom>=li.maxzoom||li.visibility!=="none"&&(Pe(oi,this.zoom,G),(oe[li.id]=li.createBucket({index:ge.bucketLayerIDs.length,layers:oi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:it,sourceID:this.source})).populate(pt,de,this.tileID.canonical),ge.bucketLayerIDs.push(oi.map(Tr=>Tr.id)))}}const ue=S.bF(de.glyphDependencies,nt=>Object.keys(nt).map(Number));this.inFlightDependencies.forEach(nt=>nt==null?void 0:nt.abort()),this.inFlightDependencies=[];let Ae=Promise.resolve({});if(Object.keys(ue).length){const nt=new AbortController;this.inFlightDependencies.push(nt),Ae=J.sendAsync({type:"GG",data:{stacks:ue,source:this.source,tileID:this.tileID,type:"glyphs"}},nt)}const Ze=Object.keys(de.iconDependencies);let Ve=Promise.resolve({});if(Ze.length){const nt=new AbortController;this.inFlightDependencies.push(nt),Ve=J.sendAsync({type:"GI",data:{icons:Ze,source:this.source,tileID:this.tileID,type:"icons"}},nt)}const Qe=Object.keys(de.patternDependencies);let dt=Promise.resolve({});if(Qe.length){const nt=new AbortController;this.inFlightDependencies.push(nt),dt=J.sendAsync({type:"GI",data:{icons:Qe,source:this.source,tileID:this.tileID,type:"patterns"}},nt)}const[at,we,Lt]=yield Promise.all([Ae,Ve,dt]),Tt=new he(at),kt=new S.cx(we,Lt);for(const nt in oe){const Ie=oe[nt];Ie instanceof S.a6?(Pe(Ie.layers,this.zoom,G),S.cy({bucket:Ie,glyphMap:at,glyphPositions:Tt.positions,imageMap:we,imagePositions:kt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:de.subdivisionGranularity})):Ie.hasPattern&&(Ie instanceof S.cz||Ie instanceof S.cA||Ie instanceof S.cB)&&(Pe(Ie.layers,this.zoom,G),Ie.addFeatures(de,this.tileID.canonical,kt.patternPositions))}return this.status="done",{buckets:Object.values(oe).filter(nt=>!nt.isEmpty()),featureIndex:ge,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Tt.image,imageAtlas:kt,glyphMap:this.returnDependencies?at:null,iconMap:this.returnDependencies?we:null,glyphPositions:this.returnDependencies?Tt.positions:null}})}}function Pe(ce,N,Z){const G=new S.C(N);for(const J of ce)J.recalculate(G,Z)}class Be{constructor(N,Z,G){this.actor=N,this.layerIndex=Z,this.availableImages=G,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(N,Z){return S._(this,void 0,void 0,function*(){const G=yield S.n(N.request,Z);try{return{vectorTile:new S.cC.VectorTile(new S.cD(G.data)),rawData:G.data,cacheControl:G.cacheControl,expires:G.expires}}catch(J){const ae=new Uint8Array(G.data);let $=`Unable to parse the tile at ${N.request.url}, `;throw $+=ae[0]===31&&ae[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${J.message}`,new Error($)}})}loadTile(N){return S._(this,void 0,void 0,function*(){const Z=N.uid,G=!!(N&&N.request&&N.request.collectResourceTiming)&&new S.cE(N.request),J=new me(N);this.loading[Z]=J;const ae=new AbortController;J.abort=ae;try{const $=yield this.loadVectorTile(N,ae);if(delete this.loading[Z],!$)return null;const ge=$.rawData,oe={};$.expires&&(oe.expires=$.expires),$.cacheControl&&(oe.cacheControl=$.cacheControl);const de={};if(G){const ue=G.finish();ue&&(de.resourceTiming=JSON.parse(JSON.stringify(ue)))}J.vectorTile=$.vectorTile;const _e=J.parse($.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);this.loaded[Z]=J,this.fetching[Z]={rawTileData:ge,cacheControl:oe,resourceTiming:de};try{const ue=yield _e;return S.e({rawTileData:ge.slice(0)},ue,oe,de)}finally{delete this.fetching[Z]}}catch($){throw delete this.loading[Z],J.status="done",this.loaded[Z]=J,$}})}reloadTile(N){return S._(this,void 0,void 0,function*(){const Z=N.uid;if(!this.loaded||!this.loaded[Z])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const G=this.loaded[Z];if(G.showCollisionBoxes=N.showCollisionBoxes,G.status==="parsing"){const J=yield G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);let ae;if(this.fetching[Z]){const{rawTileData:$,cacheControl:ge,resourceTiming:oe}=this.fetching[Z];delete this.fetching[Z],ae=S.e({rawTileData:$.slice(0)},J,ge,oe)}else ae=J;return ae}if(G.status==="done"&&G.vectorTile)return G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity)})}abortTile(N){return S._(this,void 0,void 0,function*(){const Z=this.loading,G=N.uid;Z&&Z[G]&&Z[G].abort&&(Z[G].abort.abort(),delete Z[G])})}removeTile(N){return S._(this,void 0,void 0,function*(){this.loaded&&this.loaded[N.uid]&&delete this.loaded[N.uid]})}}class Ee{constructor(){this.loaded={}}loadTile(N){return S._(this,void 0,void 0,function*(){const{uid:Z,encoding:G,rawImageData:J,redFactor:ae,greenFactor:$,blueFactor:ge,baseShift:oe}=N,de=J.width+2,_e=J.height+2,ue=S.b(J)?new S.R({width:de,height:_e},yield S.cF(J,-1,-1,de,_e)):J,Ae=new S.cG(Z,ue,G,ae,$,ge,oe);return this.loaded=this.loaded||{},this.loaded[Z]=Ae,Ae})}removeTile(N){const Z=this.loaded,G=N.uid;Z&&Z[G]&&delete Z[G]}}var le,Fe,Bt=function(){if(Fe)return le;function ce(Z,G){if(Z.length!==0){N(Z[0],G);for(var J=1;J<Z.length;J++)N(Z[J],!G)}}function N(Z,G){for(var J=0,ae=0,$=0,ge=Z.length,oe=ge-1;$<ge;oe=$++){var de=(Z[$][0]-Z[oe][0])*(Z[oe][1]+Z[$][1]),_e=J+de;ae+=Math.abs(J)>=Math.abs(de)?J-_e+de:de-_e+J,J=_e}J+ae>=0!=!!G&&Z.reverse()}return Fe=1,le=function Z(G,J){var ae,$=G&&G.type;if($==="FeatureCollection")for(ae=0;ae<G.features.length;ae++)Z(G.features[ae],J);else if($==="GeometryCollection")for(ae=0;ae<G.geometries.length;ae++)Z(G.geometries[ae],J);else if($==="Feature")Z(G.geometry,J);else if($==="Polygon")ce(G.coordinates,J);else if($==="MultiPolygon")for(ae=0;ae<G.coordinates.length;ae++)ce(G.coordinates[ae],J);return G}}(),fi=S.cH(Bt);const ti=S.cC.VectorTileFeature.prototype.toGeoJSON;class yi{constructor(N){this._feature=N,this.extent=S.Z,this.type=N.type,this.properties=N.tags,"id"in N&&!isNaN(N.id)&&(this.id=parseInt(N.id,10))}loadGeometry(){if(this._feature.type===1){const N=[];for(const Z of this._feature.geometry)N.push([new S.P(Z[0],Z[1])]);return N}{const N=[];for(const Z of this._feature.geometry){const G=[];for(const J of Z)G.push(new S.P(J[0],J[1]));N.push(G)}return N}}toGeoJSON(N,Z,G){return ti.call(this,N,Z,G)}}class Ki{constructor(N){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=S.Z,this.length=N.length,this._features=N}feature(N){return new yi(this._features[N])}}var Ft,It,$t,_r={exports:{}},jt=function(){if($t)return _r.exports;$t=1;var ce=S.cK(),N=function(){if(It)return Ft;It=1;var _e=S.cI(),ue=S.cJ().VectorTileFeature;function Ae(Ve,Qe){this.options=Qe||{},this.features=Ve,this.length=Ve.length}function Ze(Ve,Qe){this.id=typeof Ve.id=="number"?Ve.id:void 0,this.type=Ve.type,this.rawGeometry=Ve.type===1?[Ve.geometry]:Ve.geometry,this.properties=Ve.tags,this.extent=Qe||4096}return Ft=Ae,Ae.prototype.feature=function(Ve){return new Ze(this.features[Ve],this.options.extent)},Ze.prototype.loadGeometry=function(){var Ve=this.rawGeometry;this.geometry=[];for(var Qe=0;Qe<Ve.length;Qe++){for(var dt=Ve[Qe],at=[],we=0;we<dt.length;we++)at.push(new _e(dt[we][0],dt[we][1]));this.geometry.push(at)}return this.geometry},Ze.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Ve=this.geometry,Qe=1/0,dt=-1/0,at=1/0,we=-1/0,Lt=0;Lt<Ve.length;Lt++)for(var Tt=Ve[Lt],kt=0;kt<Tt.length;kt++){var nt=Tt[kt];Qe=Math.min(Qe,nt.x),dt=Math.max(dt,nt.x),at=Math.min(at,nt.y),we=Math.max(we,nt.y)}return[Qe,at,dt,we]},Ze.prototype.toGeoJSON=ue.prototype.toGeoJSON,Ft}();function Z(_e){var ue=new ce;return function(Ae,Ze){for(var Ve in Ae.layers)Ze.writeMessage(3,G,Ae.layers[Ve])}(_e,ue),ue.finish()}function G(_e,ue){var Ae;ue.writeVarintField(15,_e.version||1),ue.writeStringField(1,_e.name||""),ue.writeVarintField(5,_e.extent||4096);var Ze={keys:[],values:[],keycache:{},valuecache:{}};for(Ae=0;Ae<_e.length;Ae++)Ze.feature=_e.feature(Ae),ue.writeMessage(2,J,Ze);var Ve=Ze.keys;for(Ae=0;Ae<Ve.length;Ae++)ue.writeStringField(3,Ve[Ae]);var Qe=Ze.values;for(Ae=0;Ae<Qe.length;Ae++)ue.writeMessage(4,de,Qe[Ae])}function J(_e,ue){var Ae=_e.feature;Ae.id!==void 0&&ue.writeVarintField(1,Ae.id),ue.writeMessage(2,ae,_e),ue.writeVarintField(3,Ae.type),ue.writeMessage(4,oe,Ae)}function ae(_e,ue){var Ae=_e.feature,Ze=_e.keys,Ve=_e.values,Qe=_e.keycache,dt=_e.valuecache;for(var at in Ae.properties){var we=Ae.properties[at],Lt=Qe[at];if(we!==null){Lt===void 0&&(Ze.push(at),Qe[at]=Lt=Ze.length-1),ue.writeVarint(Lt);var Tt=typeof we;Tt!=="string"&&Tt!=="boolean"&&Tt!=="number"&&(we=JSON.stringify(we));var kt=Tt+":"+we,nt=dt[kt];nt===void 0&&(Ve.push(we),dt[kt]=nt=Ve.length-1),ue.writeVarint(nt)}}}function $(_e,ue){return(ue<<3)+(7&_e)}function ge(_e){return _e<<1^_e>>31}function oe(_e,ue){for(var Ae=_e.loadGeometry(),Ze=_e.type,Ve=0,Qe=0,dt=Ae.length,at=0;at<dt;at++){var we=Ae[at],Lt=1;Ze===1&&(Lt=we.length),ue.writeVarint($(1,Lt));for(var Tt=Ze===3?we.length-1:we.length,kt=0;kt<Tt;kt++){kt===1&&Ze!==1&&ue.writeVarint($(2,Tt-1));var nt=we[kt].x-Ve,Ie=we[kt].y-Qe;ue.writeVarint(ge(nt)),ue.writeVarint(ge(Ie)),Ve+=nt,Qe+=Ie}Ze===3&&ue.writeVarint($(7,1))}}function de(_e,ue){var Ae=typeof _e;Ae==="string"?ue.writeStringField(1,_e):Ae==="boolean"?ue.writeBooleanField(7,_e):Ae==="number"&&(_e%1!=0?ue.writeDoubleField(3,_e):_e<0?ue.writeSVarintField(6,_e):ue.writeVarintField(5,_e))}return _r.exports=Z,_r.exports.fromVectorTileJs=Z,_r.exports.fromGeojsonVt=function(_e,ue){ue=ue||{};var Ae={};for(var Ze in _e)Ae[Ze]=new N(_e[Ze].features,ue),Ae[Ze].name=Ze,Ae[Ze].version=ue.version,Ae[Ze].extent=ue.extent;return Z({layers:Ae})},_r.exports.GeoJSONWrapper=N,_r.exports}(),Tn=S.cH(jt);const Mn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ce=>ce},Yi=Math.fround||(ar=new Float32Array(1),ce=>(ar[0]=+ce,ar[0]));var ar;const Ji=3,ot=5,Vi=6;class xi{constructor(N){this.options=Object.assign(Object.create(Mn),N),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(N){const{log:Z,minZoom:G,maxZoom:J}=this.options;Z&&console.time("total time");const ae=`prepare ${N.length} points`;Z&&console.time(ae),this.points=N;const $=[];for(let oe=0;oe<N.length;oe++){const de=N[oe];if(!de.geometry)continue;const[_e,ue]=de.geometry.coordinates,Ae=Yi(Ar(_e)),Ze=Yi(sr(ue));$.push(Ae,Ze,1/0,oe,-1,1),this.options.reduce&&$.push(0)}let ge=this.trees[J+1]=this._createTree($);Z&&console.timeEnd(ae);for(let oe=J;oe>=G;oe--){const de=+Date.now();ge=this.trees[oe]=this._createTree(this._cluster(ge,oe)),Z&&console.log("z%d: %d clusters in %dms",oe,ge.numItems,+Date.now()-de)}return Z&&console.timeEnd("total time"),this}getClusters(N,Z){let G=((N[0]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,N[1]));let ae=N[2]===180?180:((N[2]+180)%360+360)%360-180;const $=Math.max(-90,Math.min(90,N[3]));if(N[2]-N[0]>=360)G=-180,ae=180;else if(G>ae){const ue=this.getClusters([G,J,180,$],Z),Ae=this.getClusters([-180,J,ae,$],Z);return ue.concat(Ae)}const ge=this.trees[this._limitZoom(Z)],oe=ge.range(Ar(G),sr($),Ar(ae),sr(J)),de=ge.data,_e=[];for(const ue of oe){const Ae=this.stride*ue;_e.push(de[Ae+ot]>1?yr(de,Ae,this.clusterProps):this.points[de[Ae+Ji]])}return _e}getChildren(N){const Z=this._getOriginId(N),G=this._getOriginZoom(N),J="No cluster with the specified id.",ae=this.trees[G];if(!ae)throw new Error(J);const $=ae.data;if(Z*this.stride>=$.length)throw new Error(J);const ge=this.options.radius/(this.options.extent*Math.pow(2,G-1)),oe=ae.within($[Z*this.stride],$[Z*this.stride+1],ge),de=[];for(const _e of oe){const ue=_e*this.stride;$[ue+4]===N&&de.push($[ue+ot]>1?yr($,ue,this.clusterProps):this.points[$[ue+Ji]])}if(de.length===0)throw new Error(J);return de}getLeaves(N,Z,G){const J=[];return this._appendLeaves(J,N,Z=Z||10,G=G||0,0),J}getTile(N,Z,G){const J=this.trees[this._limitZoom(N)],ae=Math.pow(2,N),{extent:$,radius:ge}=this.options,oe=ge/$,de=(G-oe)/ae,_e=(G+1+oe)/ae,ue={features:[]};return this._addTileFeatures(J.range((Z-oe)/ae,de,(Z+1+oe)/ae,_e),J.data,Z,G,ae,ue),Z===0&&this._addTileFeatures(J.range(1-oe/ae,de,1,_e),J.data,ae,G,ae,ue),Z===ae-1&&this._addTileFeatures(J.range(0,de,oe/ae,_e),J.data,-1,G,ae,ue),ue.features.length?ue:null}getClusterExpansionZoom(N){let Z=this._getOriginZoom(N)-1;for(;Z<=this.options.maxZoom;){const G=this.getChildren(N);if(Z++,G.length!==1)break;N=G[0].properties.cluster_id}return Z}_appendLeaves(N,Z,G,J,ae){const $=this.getChildren(Z);for(const ge of $){const oe=ge.properties;if(oe&&oe.cluster?ae+oe.point_count<=J?ae+=oe.point_count:ae=this._appendLeaves(N,oe.cluster_id,G,J,ae):ae<J?ae++:N.push(ge),N.length===G)break}return ae}_createTree(N){const Z=new S.aF(N.length/this.stride|0,this.options.nodeSize,Float32Array);for(let G=0;G<N.length;G+=this.stride)Z.add(N[G],N[G+1]);return Z.finish(),Z.data=N,Z}_addTileFeatures(N,Z,G,J,ae,$){for(const ge of N){const oe=ge*this.stride,de=Z[oe+ot]>1;let _e,ue,Ae;if(de)_e=Et(Z,oe,this.clusterProps),ue=Z[oe],Ae=Z[oe+1];else{const Qe=this.points[Z[oe+Ji]];_e=Qe.properties;const[dt,at]=Qe.geometry.coordinates;ue=Ar(dt),Ae=sr(at)}const Ze={type:1,geometry:[[Math.round(this.options.extent*(ue*ae-G)),Math.round(this.options.extent*(Ae*ae-J))]],tags:_e};let Ve;Ve=de||this.options.generateId?Z[oe+Ji]:this.points[Z[oe+Ji]].id,Ve!==void 0&&(Ze.id=Ve),$.features.push(Ze)}}_limitZoom(N){return Math.max(this.options.minZoom,Math.min(Math.floor(+N),this.options.maxZoom+1))}_cluster(N,Z){const{radius:G,extent:J,reduce:ae,minPoints:$}=this.options,ge=G/(J*Math.pow(2,Z)),oe=N.data,de=[],_e=this.stride;for(let ue=0;ue<oe.length;ue+=_e){if(oe[ue+2]<=Z)continue;oe[ue+2]=Z;const Ae=oe[ue],Ze=oe[ue+1],Ve=N.within(oe[ue],oe[ue+1],ge),Qe=oe[ue+ot];let dt=Qe;for(const at of Ve){const we=at*_e;oe[we+2]>Z&&(dt+=oe[we+ot])}if(dt>Qe&&dt>=$){let at,we=Ae*Qe,Lt=Ze*Qe,Tt=-1;const kt=((ue/_e|0)<<5)+(Z+1)+this.points.length;for(const nt of Ve){const Ie=nt*_e;if(oe[Ie+2]<=Z)continue;oe[Ie+2]=Z;const it=oe[Ie+ot];we+=oe[Ie]*it,Lt+=oe[Ie+1]*it,oe[Ie+4]=kt,ae&&(at||(at=this._map(oe,ue,!0),Tt=this.clusterProps.length,this.clusterProps.push(at)),ae(at,this._map(oe,Ie)))}oe[ue+4]=kt,de.push(we/dt,Lt/dt,1/0,kt,-1,dt),ae&&de.push(Tt)}else{for(let at=0;at<_e;at++)de.push(oe[ue+at]);if(dt>1)for(const at of Ve){const we=at*_e;if(!(oe[we+2]<=Z)){oe[we+2]=Z;for(let Lt=0;Lt<_e;Lt++)de.push(oe[we+Lt])}}}}return de}_getOriginId(N){return N-this.points.length>>5}_getOriginZoom(N){return(N-this.points.length)%32}_map(N,Z,G){if(N[Z+ot]>1){const $=this.clusterProps[N[Z+Vi]];return G?Object.assign({},$):$}const J=this.points[N[Z+Ji]].properties,ae=this.options.map(J);return G&&ae===J?Object.assign({},ae):ae}}function yr(ce,N,Z){return{type:"Feature",id:ce[N+Ji],properties:Et(ce,N,Z),geometry:{type:"Point",coordinates:[(G=ce[N],360*(G-.5)),cn(ce[N+1])]}};var G}function Et(ce,N,Z){const G=ce[N+ot],J=G>=1e4?`${Math.round(G/1e3)}k`:G>=1e3?Math.round(G/100)/10+"k":G,ae=ce[N+Vi],$=ae===-1?{}:Object.assign({},Z[ae]);return Object.assign($,{cluster:!0,cluster_id:ce[N+Ji],point_count:G,point_count_abbreviated:J})}function Ar(ce){return ce/360+.5}function sr(ce){const N=Math.sin(ce*Math.PI/180),Z=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return Z<0?0:Z>1?1:Z}function cn(ce){const N=(180-360*ce)*Math.PI/180;return 360*Math.atan(Math.exp(N))/Math.PI-90}function kr(ce,N,Z,G){let J=G;const ae=N+(Z-N>>1);let $,ge=Z-N;const oe=ce[N],de=ce[N+1],_e=ce[Z],ue=ce[Z+1];for(let Ae=N+3;Ae<Z;Ae+=3){const Ze=la(ce[Ae],ce[Ae+1],oe,de,_e,ue);if(Ze>J)$=Ae,J=Ze;else if(Ze===J){const Ve=Math.abs(Ae-ae);Ve<ge&&($=Ae,ge=Ve)}}J>G&&($-N>3&&kr(ce,N,$,G),ce[$+2]=J,Z-$>3&&kr(ce,$,Z,G))}function la(ce,N,Z,G,J,ae){let $=J-Z,ge=ae-G;if($!==0||ge!==0){const oe=((ce-Z)*$+(N-G)*ge)/($*$+ge*ge);oe>1?(Z=J,G=ae):oe>0&&(Z+=$*oe,G+=ge*oe)}return $=ce-Z,ge=N-G,$*$+ge*ge}function xr(ce,N,Z,G){const J={id:ce??null,type:N,geometry:Z,tags:G,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(N==="Point"||N==="MultiPoint"||N==="LineString")Ht(J,Z);else if(N==="Polygon")Ht(J,Z[0]);else if(N==="MultiLineString")for(const ae of Z)Ht(J,ae);else if(N==="MultiPolygon")for(const ae of Z)Ht(J,ae[0]);return J}function Ht(ce,N){for(let Z=0;Z<N.length;Z+=3)ce.minX=Math.min(ce.minX,N[Z]),ce.minY=Math.min(ce.minY,N[Z+1]),ce.maxX=Math.max(ce.maxX,N[Z]),ce.maxY=Math.max(ce.maxY,N[Z+1])}function vr(ce,N,Z,G){if(!N.geometry)return;const J=N.geometry.coordinates;if(J&&J.length===0)return;const ae=N.geometry.type,$=Math.pow(Z.tolerance/((1<<Z.maxZoom)*Z.extent),2);let ge=[],oe=N.id;if(Z.promoteId?oe=N.properties[Z.promoteId]:Z.generateId&&(oe=G||0),ae==="Point")Qi(J,ge);else if(ae==="MultiPoint")for(const de of J)Qi(de,ge);else if(ae==="LineString")Sn(J,ge,$,!1);else if(ae==="MultiLineString"){if(Z.lineMetrics){for(const de of J)ge=[],Sn(de,ge,$,!1),ce.push(xr(oe,"LineString",ge,N.properties));return}un(J,ge,$,!1)}else if(ae==="Polygon")un(J,ge,$,!0);else{if(ae!=="MultiPolygon"){if(ae==="GeometryCollection"){for(const de of N.geometry.geometries)vr(ce,{id:oe,geometry:de,properties:N.properties},Z,G);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const de of J){const _e=[];un(de,_e,$,!0),ge.push(_e)}}ce.push(xr(oe,ae,ge,N.properties))}function Qi(ce,N){N.push(ca(ce[0]),or(ce[1]),0)}function Sn(ce,N,Z,G){let J,ae,$=0;for(let oe=0;oe<ce.length;oe++){const de=ca(ce[oe][0]),_e=or(ce[oe][1]);N.push(de,_e,0),oe>0&&($+=G?(J*_e-de*ae)/2:Math.sqrt(Math.pow(de-J,2)+Math.pow(_e-ae,2))),J=de,ae=_e}const ge=N.length-3;N[2]=1,kr(N,0,ge,Z),N[ge+2]=1,N.size=Math.abs($),N.start=0,N.end=N.size}function un(ce,N,Z,G){for(let J=0;J<ce.length;J++){const ae=[];Sn(ce[J],ae,Z,G),N.push(ae)}}function ca(ce){return ce/360+.5}function or(ce){const N=Math.sin(ce*Math.PI/180),Z=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return Z<0?0:Z>1?1:Z}function lr(ce,N,Z,G,J,ae,$,ge){if(G/=N,ae>=(Z/=N)&&$<G)return ce;if($<Z||ae>=G)return null;const oe=[];for(const de of ce){const _e=de.geometry;let ue=de.type;const Ae=J===0?de.minX:de.minY,Ze=J===0?de.maxX:de.maxY;if(Ae>=Z&&Ze<G){oe.push(de);continue}if(Ze<Z||Ae>=G)continue;let Ve=[];if(ue==="Point"||ue==="MultiPoint")Ui(_e,Ve,Z,G,J);else if(ue==="LineString")Zt(_e,Ve,Z,G,J,!1,ge.lineMetrics);else if(ue==="MultiLineString")hn(_e,Ve,Z,G,J,!1);else if(ue==="Polygon")hn(_e,Ve,Z,G,J,!0);else if(ue==="MultiPolygon")for(const Qe of _e){const dt=[];hn(Qe,dt,Z,G,J,!0),dt.length&&Ve.push(dt)}if(Ve.length){if(ge.lineMetrics&&ue==="LineString"){for(const Qe of Ve)oe.push(xr(de.id,ue,Qe,de.tags));continue}ue!=="LineString"&&ue!=="MultiLineString"||(Ve.length===1?(ue="LineString",Ve=Ve[0]):ue="MultiLineString"),ue!=="Point"&&ue!=="MultiPoint"||(ue=Ve.length===3?"Point":"MultiPoint"),oe.push(xr(de.id,ue,Ve,de.tags))}}return oe.length?oe:null}function Ui(ce,N,Z,G,J){for(let ae=0;ae<ce.length;ae+=3){const $=ce[ae+J];$>=Z&&$<=G&&br(N,ce[ae],ce[ae+1],ce[ae+2])}}function Zt(ce,N,Z,G,J,ae,$){let ge=Vr(ce);const oe=J===0?Pn:Cn;let de,_e,ue=ce.start;for(let dt=0;dt<ce.length-3;dt+=3){const at=ce[dt],we=ce[dt+1],Lt=ce[dt+2],Tt=ce[dt+3],kt=ce[dt+4],nt=J===0?at:we,Ie=J===0?Tt:kt;let it=!1;$&&(de=Math.sqrt(Math.pow(at-Tt,2)+Math.pow(we-kt,2))),nt<Z?Ie>Z&&(_e=oe(ge,at,we,Tt,kt,Z),$&&(ge.start=ue+de*_e)):nt>G?Ie<G&&(_e=oe(ge,at,we,Tt,kt,G),$&&(ge.start=ue+de*_e)):br(ge,at,we,Lt),Ie<Z&&nt>=Z&&(_e=oe(ge,at,we,Tt,kt,Z),it=!0),Ie>G&&nt<=G&&(_e=oe(ge,at,we,Tt,kt,G),it=!0),!ae&&it&&($&&(ge.end=ue+de*_e),N.push(ge),ge=Vr(ce)),$&&(ue+=de)}let Ae=ce.length-3;const Ze=ce[Ae],Ve=ce[Ae+1],Qe=J===0?Ze:Ve;Qe>=Z&&Qe<=G&&br(ge,Ze,Ve,ce[Ae+2]),Ae=ge.length-3,ae&&Ae>=3&&(ge[Ae]!==ge[0]||ge[Ae+1]!==ge[1])&&br(ge,ge[0],ge[1],ge[2]),ge.length&&N.push(ge)}function Vr(ce){const N=[];return N.size=ce.size,N.start=ce.start,N.end=ce.end,N}function hn(ce,N,Z,G,J,ae){for(const $ of ce)Zt($,N,Z,G,J,ae,!1)}function br(ce,N,Z,G){ce.push(N,Z,G)}function Pn(ce,N,Z,G,J,ae){const $=(ae-N)/(G-N);return br(ce,ae,Z+(J-Z)*$,1),$}function Cn(ce,N,Z,G,J,ae){const $=(ae-Z)/(J-Z);return br(ce,N+(G-N)*$,ae,1),$}function Ce(ce,N){const Z=[];for(let G=0;G<ce.length;G++){const J=ce[G],ae=J.type;let $;if(ae==="Point"||ae==="MultiPoint"||ae==="LineString")$=Ye(J.geometry,N);else if(ae==="MultiLineString"||ae==="Polygon"){$=[];for(const ge of J.geometry)$.push(Ye(ge,N))}else if(ae==="MultiPolygon"){$=[];for(const ge of J.geometry){const oe=[];for(const de of ge)oe.push(Ye(de,N));$.push(oe)}}Z.push(xr(J.id,ae,$,J.tags))}return Z}function Ye(ce,N){const Z=[];Z.size=ce.size,ce.start!==void 0&&(Z.start=ce.start,Z.end=ce.end);for(let G=0;G<ce.length;G+=3)Z.push(ce[G]+N,ce[G+1],ce[G+2]);return Z}function Ue(ce,N){if(ce.transformed)return ce;const Z=1<<ce.z,G=ce.x,J=ce.y;for(const ae of ce.features){const $=ae.geometry,ge=ae.type;if(ae.geometry=[],ge===1)for(let oe=0;oe<$.length;oe+=2)ae.geometry.push(_t($[oe],$[oe+1],N,Z,G,J));else for(let oe=0;oe<$.length;oe++){const de=[];for(let _e=0;_e<$[oe].length;_e+=2)de.push(_t($[oe][_e],$[oe][_e+1],N,Z,G,J));ae.geometry.push(de)}}return ce.transformed=!0,ce}function _t(ce,N,Z,G,J,ae){return[Math.round(Z*(ce*G-J)),Math.round(Z*(N*G-ae))]}function Nt(ce,N,Z,G,J){const ae=N===J.maxZoom?0:J.tolerance/((1<<N)*J.extent),$={features:[],numPoints:0,numSimplified:0,numFeatures:ce.length,source:null,x:Z,y:G,z:N,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ge of ce)cr($,ge,ae,J);return $}function cr(ce,N,Z,G){const J=N.geometry,ae=N.type,$=[];if(ce.minX=Math.min(ce.minX,N.minX),ce.minY=Math.min(ce.minY,N.minY),ce.maxX=Math.max(ce.maxX,N.maxX),ce.maxY=Math.max(ce.maxY,N.maxY),ae==="Point"||ae==="MultiPoint")for(let ge=0;ge<J.length;ge+=3)$.push(J[ge],J[ge+1]),ce.numPoints++,ce.numSimplified++;else if(ae==="LineString")mi($,J,ce,Z,!1,!1);else if(ae==="MultiLineString"||ae==="Polygon")for(let ge=0;ge<J.length;ge++)mi($,J[ge],ce,Z,ae==="Polygon",ge===0);else if(ae==="MultiPolygon")for(let ge=0;ge<J.length;ge++){const oe=J[ge];for(let de=0;de<oe.length;de++)mi($,oe[de],ce,Z,!0,de===0)}if($.length){let ge=N.tags||null;if(ae==="LineString"&&G.lineMetrics){ge={};for(const de in N.tags)ge[de]=N.tags[de];ge.mapbox_clip_start=J.start/J.size,ge.mapbox_clip_end=J.end/J.size}const oe={geometry:$,type:ae==="Polygon"||ae==="MultiPolygon"?3:ae==="LineString"||ae==="MultiLineString"?2:1,tags:ge};N.id!==null&&(oe.id=N.id),ce.features.push(oe)}}function mi(ce,N,Z,G,J,ae){const $=G*G;if(G>0&&N.size<(J?$:G))return void(Z.numPoints+=N.length/3);const ge=[];for(let oe=0;oe<N.length;oe+=3)(G===0||N[oe+2]>$)&&(Z.numSimplified++,ge.push(N[oe],N[oe+1])),Z.numPoints++;J&&function(oe,de){let _e=0;for(let ue=0,Ae=oe.length,Ze=Ae-2;ue<Ae;Ze=ue,ue+=2)_e+=(oe[ue]-oe[Ze])*(oe[ue+1]+oe[Ze+1]);if(_e>0===de)for(let ue=0,Ae=oe.length;ue<Ae/2;ue+=2){const Ze=oe[ue],Ve=oe[ue+1];oe[ue]=oe[Ae-2-ue],oe[ue+1]=oe[Ae-1-ue],oe[Ae-2-ue]=Ze,oe[Ae-1-ue]=Ve}}(ge,ae),ce.push(ge)}const zr={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Rr{constructor(N,Z){const G=(Z=this.options=function(ae,$){for(const ge in $)ae[ge]=$[ge];return ae}(Object.create(zr),Z)).debug;if(G&&console.time("preprocess data"),Z.maxZoom<0||Z.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(Z.promoteId&&Z.generateId)throw new Error("promoteId and generateId cannot be used together.");let J=function(ae,$){const ge=[];if(ae.type==="FeatureCollection")for(let oe=0;oe<ae.features.length;oe++)vr(ge,ae.features[oe],$,oe);else vr(ge,ae.type==="Feature"?ae:{geometry:ae},$);return ge}(N,Z);this.tiles={},this.tileCoords=[],G&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Z.indexMaxZoom,Z.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),J=function(ae,$){const ge=$.buffer/$.extent;let oe=ae;const de=lr(ae,1,-1-ge,ge,0,-1,2,$),_e=lr(ae,1,1-ge,2+ge,0,-1,2,$);return(de||_e)&&(oe=lr(ae,1,-ge,1+ge,0,-1,2,$)||[],de&&(oe=Ce(de,1).concat(oe)),_e&&(oe=oe.concat(Ce(_e,-1)))),oe}(J,Z),J.length&&this.splitTile(J,0,0,0),G&&(J.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(N,Z,G,J,ae,$,ge){const oe=[N,Z,G,J],de=this.options,_e=de.debug;for(;oe.length;){J=oe.pop(),G=oe.pop(),Z=oe.pop(),N=oe.pop();const ue=1<<Z,Ae=In(Z,G,J);let Ze=this.tiles[Ae];if(!Ze&&(_e>1&&console.time("creation"),Ze=this.tiles[Ae]=Nt(N,Z,G,J,de),this.tileCoords.push({z:Z,x:G,y:J}),_e)){_e>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Z,G,J,Ze.numFeatures,Ze.numPoints,Ze.numSimplified),console.timeEnd("creation"));const it=`z${Z}`;this.stats[it]=(this.stats[it]||0)+1,this.total++}if(Ze.source=N,ae==null){if(Z===de.indexMaxZoom||Ze.numPoints<=de.indexMaxPoints)continue}else{if(Z===de.maxZoom||Z===ae)continue;if(ae!=null){const it=ae-Z;if(G!==$>>it||J!==ge>>it)continue}}if(Ze.source=null,N.length===0)continue;_e>1&&console.time("clipping");const Ve=.5*de.buffer/de.extent,Qe=.5-Ve,dt=.5+Ve,at=1+Ve;let we=null,Lt=null,Tt=null,kt=null,nt=lr(N,ue,G-Ve,G+dt,0,Ze.minX,Ze.maxX,de),Ie=lr(N,ue,G+Qe,G+at,0,Ze.minX,Ze.maxX,de);N=null,nt&&(we=lr(nt,ue,J-Ve,J+dt,1,Ze.minY,Ze.maxY,de),Lt=lr(nt,ue,J+Qe,J+at,1,Ze.minY,Ze.maxY,de),nt=null),Ie&&(Tt=lr(Ie,ue,J-Ve,J+dt,1,Ze.minY,Ze.maxY,de),kt=lr(Ie,ue,J+Qe,J+at,1,Ze.minY,Ze.maxY,de),Ie=null),_e>1&&console.timeEnd("clipping"),oe.push(we||[],Z+1,2*G,2*J),oe.push(Lt||[],Z+1,2*G,2*J+1),oe.push(Tt||[],Z+1,2*G+1,2*J),oe.push(kt||[],Z+1,2*G+1,2*J+1)}}getTile(N,Z,G){N=+N,Z=+Z,G=+G;const J=this.options,{extent:ae,debug:$}=J;if(N<0||N>24)return null;const ge=1<<N,oe=In(N,Z=Z+ge&ge-1,G);if(this.tiles[oe])return Ue(this.tiles[oe],ae);$>1&&console.log("drilling down to z%d-%d-%d",N,Z,G);let de,_e=N,ue=Z,Ae=G;for(;!de&&_e>0;)_e--,ue>>=1,Ae>>=1,de=this.tiles[In(_e,ue,Ae)];return de&&de.source?($>1&&(console.log("found parent tile z%d-%d-%d",_e,ue,Ae),console.time("drilling down")),this.splitTile(de.source,_e,ue,Ae,N,Z,G),$>1&&console.timeEnd("drilling down"),this.tiles[oe]?Ue(this.tiles[oe],ae):null):null}}function In(ce,N,Z){return 32*((1<<ce)*Z+N)+ce}function qn(ce,N){return N?ce.properties[N]:ce.id}function ja(ce,N){if(ce==null)return!0;if(ce.type==="Feature")return qn(ce,N)!=null;if(ce.type==="FeatureCollection"){const Z=new Set;for(const G of ce.features){const J=qn(G,N);if(J==null||Z.has(J))return!1;Z.add(J)}return!0}return!1}function Ur(ce,N){const Z=new Map;if(ce!=null)if(ce.type==="Feature")Z.set(qn(ce,N),ce);else for(const G of ce.features)Z.set(qn(G,N),G);return Z}class wr extends Be{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(N,Z){return S._(this,void 0,void 0,function*(){const G=N.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const J=this._geoJSONIndex.getTile(G.z,G.x,G.y);if(!J)return null;const ae=new Ki(J.features);let $=Tn(ae);return $.byteOffset===0&&$.byteLength===$.buffer.byteLength||($=new Uint8Array($)),{vectorTile:ae,rawData:$.buffer}})}loadData(N){return S._(this,void 0,void 0,function*(){var Z;(Z=this._pendingRequest)===null||Z===void 0||Z.abort();const G=!!(N&&N.request&&N.request.collectResourceTiming)&&new S.cE(N.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(N,this._pendingRequest),this._geoJSONIndex=N.cluster?new xi(function({superclusterOptions:$,clusterProperties:ge}){if(!ge||!$)return $;const oe={},de={},_e={accumulated:null,zoom:0},ue={properties:null},Ae=Object.keys(ge);for(const Ze of Ae){const[Ve,Qe]=ge[Ze],dt=S.cL(Qe),at=S.cL(typeof Ve=="string"?[Ve,["accumulated"],["get",Ze]]:Ve);oe[Ze]=dt.value,de[Ze]=at.value}return $.map=Ze=>{ue.properties=Ze;const Ve={};for(const Qe of Ae)Ve[Qe]=oe[Qe].evaluate(_e,ue);return Ve},$.reduce=(Ze,Ve)=>{ue.properties=Ve;for(const Qe of Ae)_e.accumulated=Ze[Qe],Ze[Qe]=de[Qe].evaluate(_e,ue)},$}(N)).load((yield this._pendingData).features):(J=yield this._pendingData,new Rr(J,N.geojsonVtOptions)),this.loaded={};const ae={};if(G){const $=G.finish();$&&(ae.resourceTiming={},ae.resourceTiming[N.source]=JSON.parse(JSON.stringify($)))}return ae}catch(ae){if(delete this._pendingRequest,S.cp(ae))return{abandoned:!0};throw ae}var J})}getData(){return S._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(N){const Z=this.loaded;return Z&&Z[N.uid]?super.reloadTile(N):this.loadTile(N)}loadAndProcessGeoJSON(N,Z){return S._(this,void 0,void 0,function*(){let G=yield this.loadGeoJSON(N,Z);if(delete this._pendingRequest,typeof G!="object")throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(fi(G,!0),N.filter){const J=S.cL(N.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(J.result==="error")throw new Error(J.value.map($=>`${$.key}: ${$.message}`).join(", "));G={type:"FeatureCollection",features:G.features.filter($=>J.value.evaluate({zoom:0},$))}}return G})}loadGeoJSON(N,Z){return S._(this,void 0,void 0,function*(){const{promoteId:G}=N;if(N.request){const J=yield S.j(N.request,Z);return this._dataUpdateable=ja(J.data,G)?Ur(J.data,G):void 0,J.data}if(typeof N.data=="string")try{const J=JSON.parse(N.data);return this._dataUpdateable=ja(J,G)?Ur(J,G):void 0,J}catch{throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`)}if(!N.dataDiff)throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${N.source}`);return function(J,ae,$){var ge,oe,de,_e;if(ae.removeAll&&J.clear(),ae.remove)for(const ue of ae.remove)J.delete(ue);if(ae.add)for(const ue of ae.add){const Ae=qn(ue,$);Ae!=null&&J.set(Ae,ue)}if(ae.update)for(const ue of ae.update){let Ae=J.get(ue.id);if(Ae==null)continue;const Ze=!ue.removeAllProperties&&(((ge=ue.removeProperties)===null||ge===void 0?void 0:ge.length)>0||((oe=ue.addOrUpdateProperties)===null||oe===void 0?void 0:oe.length)>0);if((ue.newGeometry||ue.removeAllProperties||Ze)&&(Ae=Object.assign({},Ae),J.set(ue.id,Ae),Ze&&(Ae.properties=Object.assign({},Ae.properties))),ue.newGeometry&&(Ae.geometry=ue.newGeometry),ue.removeAllProperties)Ae.properties={};else if(((de=ue.removeProperties)===null||de===void 0?void 0:de.length)>0)for(const Ve of ue.removeProperties)Object.prototype.hasOwnProperty.call(Ae.properties,Ve)&&delete Ae.properties[Ve];if(((_e=ue.addOrUpdateProperties)===null||_e===void 0?void 0:_e.length)>0)for(const{key:Ve,value:Qe}of ue.addOrUpdateProperties)Ae.properties[Ve]=Qe}}(this._dataUpdateable,N.dataDiff,G),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(N){return S._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(N){return this._geoJSONIndex.getClusterExpansionZoom(N.clusterId)}getClusterChildren(N){return this._geoJSONIndex.getChildren(N.clusterId)}getClusterLeaves(N){return this._geoJSONIndex.getLeaves(N.clusterId,N.limit,N.offset)}}class dn{constructor(N){this.self=N,this.actor=new S.H(N),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(Z,G)=>{if(this.externalWorkerSourceTypes[Z])throw new Error(`Worker source with name "${Z}" already registered.`);this.externalWorkerSourceTypes[Z]=G},this.self.addProtocol=S.cr,this.self.removeProtocol=S.cs,this.self.registerRTLTextPlugin=Z=>{S.cM.setMethods(Z)},this.actor.registerMessageHandler("LDT",(Z,G)=>this._getDEMWorkerSource(Z,G.source).loadTile(G)),this.actor.registerMessageHandler("RDT",(Z,G)=>S._(this,void 0,void 0,function*(){this._getDEMWorkerSource(Z,G.source).removeTile(G)})),this.actor.registerMessageHandler("GCEZ",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterExpansionZoom(G)})),this.actor.registerMessageHandler("GCC",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterChildren(G)})),this.actor.registerMessageHandler("GCL",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterLeaves(G)})),this.actor.registerMessageHandler("LD",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).loadData(G)),this.actor.registerMessageHandler("GD",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).getData()),this.actor.registerMessageHandler("LT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).loadTile(G)),this.actor.registerMessageHandler("RT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).reloadTile(G)),this.actor.registerMessageHandler("AT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).abortTile(G)),this.actor.registerMessageHandler("RMT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).removeTile(G)),this.actor.registerMessageHandler("RS",(Z,G)=>S._(this,void 0,void 0,function*(){if(!this.workerSources[Z]||!this.workerSources[Z][G.type]||!this.workerSources[Z][G.type][G.source])return;const J=this.workerSources[Z][G.type][G.source];delete this.workerSources[Z][G.type][G.source],J.removeSource!==void 0&&J.removeSource(G)})),this.actor.registerMessageHandler("RM",Z=>S._(this,void 0,void 0,function*(){delete this.layerIndexes[Z],delete this.availableImages[Z],delete this.workerSources[Z],delete this.demWorkerSources[Z]})),this.actor.registerMessageHandler("SR",(Z,G)=>S._(this,void 0,void 0,function*(){this.referrer=G})),this.actor.registerMessageHandler("SRPS",(Z,G)=>this._syncRTLPluginState(Z,G)),this.actor.registerMessageHandler("IS",(Z,G)=>S._(this,void 0,void 0,function*(){this.self.importScripts(G)})),this.actor.registerMessageHandler("SI",(Z,G)=>this._setImages(Z,G)),this.actor.registerMessageHandler("UL",(Z,G)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(Z).update(G.layers,G.removedIds)})),this.actor.registerMessageHandler("SL",(Z,G)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(Z).replace(G)}))}_setImages(N,Z){return S._(this,void 0,void 0,function*(){this.availableImages[N]=Z;for(const G in this.workerSources[N]){const J=this.workerSources[N][G];for(const ae in J)J[ae].availableImages=Z}})}_syncRTLPluginState(N,Z){return S._(this,void 0,void 0,function*(){return yield S.cM.syncState(Z,this.self.importScripts)})}_getAvailableImages(N){let Z=this.availableImages[N];return Z||(Z=[]),Z}_getLayerIndex(N){let Z=this.layerIndexes[N];return Z||(Z=this.layerIndexes[N]=new o),Z}_getWorkerSource(N,Z,G){if(this.workerSources[N]||(this.workerSources[N]={}),this.workerSources[N][Z]||(this.workerSources[N][Z]={}),!this.workerSources[N][Z][G]){const J={sendAsync:(ae,$)=>(ae.targetMapId=N,this.actor.sendAsync(ae,$))};switch(Z){case"vector":this.workerSources[N][Z][G]=new Be(J,this._getLayerIndex(N),this._getAvailableImages(N));break;case"geojson":this.workerSources[N][Z][G]=new wr(J,this._getLayerIndex(N),this._getAvailableImages(N));break;default:this.workerSources[N][Z][G]=new this.externalWorkerSourceTypes[Z](J,this._getLayerIndex(N),this._getAvailableImages(N))}}return this.workerSources[N][Z][G]}_getDEMWorkerSource(N,Z){return this.demWorkerSources[N]||(this.demWorkerSources[N]={}),this.demWorkerSources[N][Z]||(this.demWorkerSources[N][Z]=new Ee),this.demWorkerSources[N][Z]}}return S.i(self)&&(self.worker=new dn(self)),dn}),z("index",["exports","./shared"],function(S,o){var he="5.5.0";function me(){var u=new o.A(4);return o.A!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}let Pe,Be;const Ee={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(u,e,i){const s=requestAnimationFrame(h=>{l(),e(h)}),{unsubscribe:l}=o.s(u.signal,"abort",()=>{l(),cancelAnimationFrame(s),i(o.c())},!1)},frameAsync(u){return new Promise((e,i)=>{this.frame(u,e,i)})},getImageData(u,e=0){return this.getImageCanvasContext(u).getImageData(-e,-e,u.width+2*e,u.height+2*e)},getImageCanvasContext(u){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=u.width,e.height=u.height,i.drawImage(u,0,0,u.width,u.height),i},resolveURL:u=>(Pe||(Pe=document.createElement("a")),Pe.href=u,Pe.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Be==null&&(Be=matchMedia("(prefers-reduced-motion: reduce)")),Be.matches)}};class le{static testProp(e){if(!le.docStyle)return e[0];for(let i=0;i<e.length;i++)if(e[i]in le.docStyle)return e[i];return e[0]}static create(e,i,s){const l=window.document.createElement(e);return i!==void 0&&(l.className=i),s&&s.appendChild(l),l}static createNS(e,i){return window.document.createElementNS(e,i)}static disableDrag(){le.docStyle&&le.selectProp&&(le.userSelect=le.docStyle[le.selectProp],le.docStyle[le.selectProp]="none")}static enableDrag(){le.docStyle&&le.selectProp&&(le.docStyle[le.selectProp]=le.userSelect)}static setTransform(e,i){e.style[le.transformProp]=i}static addEventListener(e,i,s,l={}){e.addEventListener(i,s,"passive"in l?l:l.capture)}static removeEventListener(e,i,s,l={}){e.removeEventListener(i,s,"passive"in l?l:l.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",le.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",le.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",le.suppressClickInternal,!0)},0)}static getScale(e){const i=e.getBoundingClientRect();return{x:i.width/e.offsetWidth||1,y:i.height/e.offsetHeight||1,boundingClientRect:i}}static getPoint(e,i,s){const l=i.boundingClientRect;return new o.P((s.clientX-l.left)/i.x-e.clientLeft,(s.clientY-l.top)/i.y-e.clientTop)}static mousePos(e,i){const s=le.getScale(e);return le.getPoint(e,s,i)}static touchPos(e,i){const s=[],l=le.getScale(e);for(let h=0;h<i.length;h++)s.push(le.getPoint(e,l,i[h]));return s}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){const i=new DOMParser().parseFromString(e,"text/html").body||document.createElement("body"),s=i.querySelectorAll("script");for(const l of s)l.remove();return le.clean(i),i.innerHTML}static isPossiblyDangerous(e,i){const s=i.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!s.includes("javascript:")&&!s.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){const i=e.children;for(const s of i)le.removeAttributes(s),le.clean(s)}static removeAttributes(e){for(const{name:i,value:s}of e.attributes)le.isPossiblyDangerous(i,s)&&e.removeAttribute(i)}}le.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,le.selectProp=le.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),le.transformProp=le.testProp(["transform","WebkitTransform"]);const Fe={supported:!1,testSupport:function(u){!ti&&fi&&(yi?Ki(u):Bt=u)}};let Bt,fi,ti=!1,yi=!1;function Ki(u){const e=u.createTexture();u.bindTexture(u.TEXTURE_2D,e);try{if(u.texImage2D(u.TEXTURE_2D,0,u.RGBA,u.RGBA,u.UNSIGNED_BYTE,fi),u.isContextLost())return;Fe.supported=!0}catch{}u.deleteTexture(e),ti=!0}var Ft;typeof document<"u"&&(fi=document.createElement("img"),fi.onload=()=>{Bt&&Ki(Bt),Bt=null,yi=!0},fi.onerror=()=>{ti=!0,Bt=null},fi.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(u){let e,i,s,l;u.resetRequestQueue=()=>{e=[],i=0,s=0,l={}},u.addThrottleControl=x=>{const T=s++;return l[T]=x,T},u.removeThrottleControl=x=>{delete l[x],f()},u.getImage=(x,T,P=!0)=>new Promise((A,E)=>{Fe.supported&&(x.headers||(x.headers={}),x.headers.accept="image/webp,*/*"),o.e(x,{type:"image"}),e.push({abortController:T,requestParameters:x,supportImageRefresh:P,state:"queued",onError:F=>{E(F)},onSuccess:F=>{A(F)}}),f()});const h=x=>o._(this,void 0,void 0,function*(){x.state="running";const{requestParameters:T,supportImageRefresh:P,onError:A,onSuccess:E,abortController:F}=x,O=P===!1&&!o.i(self)&&!o.g(T.url)&&(!T.headers||Object.keys(T.headers).reduce((W,K)=>W&&K==="accept",!0));i++;const H=O?_(T,F):o.m(T,F);try{const W=yield H;delete x.abortController,x.state="completed",W.data instanceof HTMLImageElement||o.b(W.data)?E(W):W.data&&E({data:yield(q=W.data,typeof createImageBitmap=="function"?o.f(q):o.h(q)),cacheControl:W.cacheControl,expires:W.expires})}catch(W){delete x.abortController,A(W)}finally{i--,f()}var q}),f=()=>{const x=(()=>{for(const T of Object.keys(l))if(l[T]())return!0;return!1})()?o.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:o.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let T=i;T<x&&e.length>0;T++){const P=e.shift();P.abortController.signal.aborted?T--:h(P)}},_=(x,T)=>new Promise((P,A)=>{const E=new Image,F=x.url,O=x.credentials;O&&O==="include"?E.crossOrigin="use-credentials":(O&&O==="same-origin"||!o.d(F))&&(E.crossOrigin="anonymous"),T.signal.addEventListener("abort",()=>{E.src="",A(o.c())}),E.fetchPriority="high",E.onload=()=>{E.onerror=E.onload=null,P({data:E})},E.onerror=()=>{E.onerror=E.onload=null,T.signal.aborted||A(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."))},E.src=F})}(Ft||(Ft={})),Ft.resetRequestQueue();class It{constructor(e){this._transformRequestFn=e}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function $t(u){const e=[];if(typeof u=="string")e.push({id:"default",url:u});else if(u&&u.length>0){const i=[];for(const{id:s,url:l}of u){const h=`${s}${l}`;i.indexOf(h)===-1&&(i.push(h),e.push({id:s,url:l}))}}return e}function _r(u,e,i){try{const s=new URL(u);return s.pathname+=`${e}${i}`,s.toString()}catch{throw new Error(`Invalid sprite URL "${u}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}class jt{constructor(e,i,s,l){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this.update(i,l)}update(e,i,s){const{width:l,height:h}=e,f=!(this.size&&this.size[0]===l&&this.size[1]===h||s),{context:_}=this,{gl:x}=_;if(this.useMipmap=!!(i&&i.useMipmap),x.bindTexture(x.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===x.RGBA&&(!i||i.premultiply!==!1)),f)this.size=[l,h],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||o.b(e)?x.texImage2D(x.TEXTURE_2D,0,this.format,this.format,x.UNSIGNED_BYTE,e):x.texImage2D(x.TEXTURE_2D,0,this.format,l,h,0,this.format,x.UNSIGNED_BYTE,e.data);else{const{x:T,y:P}=s||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||o.b(e)?x.texSubImage2D(x.TEXTURE_2D,0,T,P,x.RGBA,x.UNSIGNED_BYTE,e):x.texSubImage2D(x.TEXTURE_2D,0,T,P,l,h,x.RGBA,x.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&x.generateMipmap(x.TEXTURE_2D),_.pixelStoreUnpackFlipY.setDefault(),_.pixelStoreUnpack.setDefault(),_.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,i,s){const{context:l}=this,{gl:h}=l;h.bindTexture(h.TEXTURE_2D,this.texture),s!==h.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=h.LINEAR),e!==this.filter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,e),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,s||e),this.filter=e),i!==this.wrap&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,i),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function Tn(u){const{userImage:e}=u;return!!(e&&e.render&&e.render())&&(u.data.replace(new Uint8Array(e.data.buffer)),!0)}class Mn extends o.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new o.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:i,promiseResolve:s}of this.requestors)s(this._getImagesForIds(i));this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const s=i.spriteData;i.data=new o.R({width:s.width,height:s.height},s.context.getImageData(s.x,s.y,s.width,s.height).data),i.spriteData=null}return i}addImage(e,i){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,i)&&(this.images[e]=i)}_validate(e,i){let s=!0;const l=i.data||i.spriteData;return this._validateStretch(i.stretchX,l&&l.width)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "stretchX" value`))),s=!1),this._validateStretch(i.stretchY,l&&l.height)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "stretchY" value`))),s=!1),this._validateContent(i.content,i)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "content" value`))),s=!1),s}_validateStretch(e,i){if(!e)return!0;let s=0;for(const l of e){if(l[0]<s||l[1]<l[0]||i<l[1])return!1;s=l[1]}return!0}_validateContent(e,i){if(!e)return!0;if(e.length!==4)return!1;const s=i.spriteData,l=s&&s.width||i.data.width,h=s&&s.height||i.data.height;return!(e[0]<0||l<e[0]||e[1]<0||h<e[1]||e[2]<0||l<e[2]||e[3]<0||h<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,i,s=!0){const l=this.getImage(e);if(s&&(l.data.width!==i.data.width||l.data.height!==i.data.height))throw new Error(`size mismatch between old image (${l.data.width}x${l.data.height}) and new image (${i.data.width}x${i.data.height}).`);i.version=l.version+1,this.images[e]=i,this.updatedImages[e]=!0}removeImage(e){const i=this.images[e];delete this.images[e],delete this.patterns[e],i.userImage&&i.userImage.onRemove&&i.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((i,s)=>{let l=!0;if(!this.isLoaded())for(const h of e)this.images[h]||(l=!1);this.isLoaded()||l?i(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:i})})}_getImagesForIds(e){const i={};for(const s of e){let l=this.getImage(s);l||(this.fire(new o.l("styleimagemissing",{id:s})),l=this.getImage(s)),l?i[s]={data:l.data.clone(),pixelRatio:l.pixelRatio,sdf:l.sdf,version:l.version,stretchX:l.stretchX,stretchY:l.stretchY,content:l.content,textFitWidth:l.textFitWidth,textFitHeight:l.textFitHeight,hasRenderCallback:!!(l.userImage&&l.userImage.render)}:o.w(`Image "${s}" 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.`)}return i}getPixelSize(){const{width:e,height:i}=this.atlasImage;return{width:e,height:i}}getPattern(e){const i=this.patterns[e],s=this.getImage(e);if(!s)return null;if(i&&i.position.version===s.version)return i.position;if(i)i.position.version=s.version;else{const l={w:s.data.width+2,h:s.data.height+2,x:0,y:0},h=new o.I(l,s);this.patterns[e]={bin:l,position:h}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const i=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new jt(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const h in this.patterns)e.push(this.patterns[h].bin);const{w:i,h:s}=o.p(e),l=this.atlasImage;l.resize({width:i||1,height:s||1});for(const h in this.patterns){const{bin:f}=this.patterns[h],_=f.x+1,x=f.y+1,T=this.getImage(h).data,P=T.width,A=T.height;o.R.copy(T,l,{x:0,y:0},{x:_,y:x},{width:P,height:A}),o.R.copy(T,l,{x:0,y:A-1},{x:_,y:x-1},{width:P,height:1}),o.R.copy(T,l,{x:0,y:0},{x:_,y:x+A},{width:P,height:1}),o.R.copy(T,l,{x:P-1,y:0},{x:_-1,y:x},{width:1,height:A}),o.R.copy(T,l,{x:0,y:0},{x:_+P,y:x},{width:1,height:A})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const s=this.getImage(i);s||o.w(`Image with ID: "${i}" was not found`),Tn(s)&&this.updateImage(i,s)}}}const Yi=1e20;function ar(u,e,i,s,l,h,f,_,x){for(let T=e;T<e+s;T++)Ji(u,i*h+T,h,l,f,_,x);for(let T=i;T<i+l;T++)Ji(u,T*h+e,1,s,f,_,x)}function Ji(u,e,i,s,l,h,f){h[0]=0,f[0]=-1e20,f[1]=Yi,l[0]=u[e];for(let _=1,x=0,T=0;_<s;_++){l[_]=u[e+_*i];const P=_*_;do{const A=h[x];T=(l[_]-l[A]+P-A*A)/(_-A)/2}while(T<=f[x]&&--x>-1);x++,h[x]=_,f[x]=T,f[x+1]=Yi}for(let _=0,x=0;_<s;_++){for(;f[x+1]<_;)x++;const T=h[x],P=_-T;u[e+_*i]=l[T]+P*P}}class ot{constructor(e,i){this.requestManager=e,this.localIdeographFontFamily=i,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return o._(this,void 0,void 0,function*(){const i=[];for(const h in e)for(const f of e[h])i.push(this._getAndCacheGlyphsPromise(h,f));const s=yield Promise.all(i),l={};for(const{stack:h,id:f,glyph:_}of s)l[h]||(l[h]={}),l[h][f]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return l})}_getAndCacheGlyphsPromise(e,i){return o._(this,void 0,void 0,function*(){let s=this.entries[e];s||(s=this.entries[e]={glyphs:{},requests:{},ranges:{}});let l=s.glyphs[i];if(l!==void 0)return{stack:e,id:i,glyph:l};if(l=this._tinySDF(s,e,i),l)return s.glyphs[i]=l,{stack:e,id:i,glyph:l};const h=Math.floor(i/256);if(256*h>65535)throw new Error("glyphs > 65535 not supported");if(s.ranges[h])return{stack:e,id:i,glyph:l};if(!this.url)throw new Error("glyphsUrl is not set");if(!s.requests[h]){const _=ot.loadGlyphRange(e,h,this.url,this.requestManager);s.requests[h]=_}const f=yield s.requests[h];for(const _ in f)this._doesCharSupportLocalGlyph(+_)||(s.glyphs[+_]=f[+_]);return s.ranges[h]=!0,{stack:e,id:i,glyph:f[i]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))||o.u["CJK Unified Ideographs"](e)||o.u["Hangul Syllables"](e)||o.u.Hiragana(e)||o.u.Katakana(e)||o.u["CJK Symbols and Punctuation"](e)||o.u["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,i,s){const l=this.localIdeographFontFamily;if(!l||!this._doesCharSupportLocalGlyph(s))return;let h=e.tinySDF;if(!h){let _="400";/bold/i.test(i)?_="900":/medium/i.test(i)?_="500":/light/i.test(i)&&(_="200"),h=e.tinySDF=new ot.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:l,fontWeight:_})}const f=h.draw(String.fromCharCode(s));return{id:s,bitmap:new o.q({width:f.width||60,height:f.height||60},f.data),metrics:{width:f.glyphWidth/2||24,height:f.glyphHeight/2||24,left:f.glyphLeft/2+.5||0,top:f.glyphTop/2-27.5||-8,advance:f.glyphAdvance/2||24,isDoubleResolution:!0}}}}ot.loadGlyphRange=function(u,e,i,s){return o._(this,void 0,void 0,function*(){const l=256*e,h=l+255,f=s.transformRequest(i.replace("{fontstack}",u).replace("{range}",`${l}-${h}`),"Glyphs"),_=yield o.n(f,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${l}-${h}`);const x={};for(const T of o.o(_.data))x[T.id]=T;return x})},ot.TinySDF=class{constructor({fontSize:u=24,buffer:e=3,radius:i=8,cutoff:s=.25,fontFamily:l="sans-serif",fontWeight:h="normal",fontStyle:f="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=i;const _=this.size=u+4*e,x=this._createCanvas(_),T=this.ctx=x.getContext("2d",{willReadFrequently:!0});T.font=`${f} ${h} ${u}px ${l}`,T.textBaseline="alphabetic",T.textAlign="left",T.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(u){const e=document.createElement("canvas");return e.width=e.height=u,e}draw(u){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:l,actualBoundingBoxRight:h}=this.ctx.measureText(u),f=Math.ceil(i),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-l))),x=Math.min(this.size-this.buffer,f+Math.ceil(s)),T=_+2*this.buffer,P=x+2*this.buffer,A=Math.max(T*P,0),E=new Uint8ClampedArray(A),F={data:E,width:T,height:P,glyphWidth:_,glyphHeight:x,glyphTop:f,glyphLeft:0,glyphAdvance:e};if(_===0||x===0)return F;const{ctx:O,buffer:H,gridInner:q,gridOuter:W}=this;O.clearRect(H,H,_,x),O.fillText(u,H,H+f);const K=O.getImageData(H,H,_,x);W.fill(Yi,0,A),q.fill(0,0,A);for(let te=0;te<x;te++)for(let ee=0;ee<_;ee++){const ie=K.data[4*(te*_+ee)+3]/255;if(ie===0)continue;const se=(te+H)*T+ee+H;if(ie===1)W[se]=0,q[se]=Yi;else{const re=.5-ie;W[se]=re>0?re*re:0,q[se]=re<0?re*re:0}}ar(W,0,0,T,P,T,this.f,this.v,this.z),ar(q,H,H,_,x,T,this.f,this.v,this.z);for(let te=0;te<A;te++){const ee=Math.sqrt(W[te])-Math.sqrt(q[te]);E[te]=Math.round(255-255*(ee/this.radius+this.cutoff))}return F}};class Vi{constructor(){this.specification=o.v.light.position}possiblyEvaluate(e,i){return o.z(e.expression.evaluate(i))}interpolate(e,i,s){return{x:o.B.number(e.x,i.x,s),y:o.B.number(e.y,i.y,s),z:o.B.number(e.z,i.z,s)}}}let xi;class yr extends o.E{constructor(e){super(),xi=xi||new o.r({anchor:new o.D(o.v.light.anchor),position:new Vi,color:new o.D(o.v.light.color),intensity:new o.D(o.v.light.intensity)}),this._transitionable=new o.T(xi),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(o.t,e,i))for(const s in e){const l=e[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),l):this._transitionable.setValue(s,l)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,s){return(!s||s.validate!==!1)&&o.x(this,e.call(o.y,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:o.v}))}}const Et=new o.r({"sky-color":new o.D(o.v.sky["sky-color"]),"horizon-color":new o.D(o.v.sky["horizon-color"]),"fog-color":new o.D(o.v.sky["fog-color"]),"fog-ground-blend":new o.D(o.v.sky["fog-ground-blend"]),"horizon-fog-blend":new o.D(o.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new o.D(o.v.sky["sky-horizon-blend"]),"atmosphere-blend":new o.D(o.v.sky["atmosphere-blend"])});class Ar extends o.E{constructor(e){super(),this._transitionable=new o.T(Et),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new o.C(0))}setSky(e,i={}){if(!this._validate(o.F,e,i)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const s in e){const l=e[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),l):this._transitionable.setValue(s,l)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,s={}){return(s==null?void 0:s.validate)!==!1&&o.x(this,e.call(o.y,o.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:o.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class sr{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,i){const s=e.join(",")+String(i);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(e,i)),this.dashEntry[s]}getDashRanges(e,i,s){const l=[];let h=e.length%2==1?-e[e.length-1]*s:0,f=e[0]*s,_=!0;l.push({left:h,right:f,isDash:_,zeroLength:e[0]===0});let x=e[0];for(let T=1;T<e.length;T++){_=!_;const P=e[T];h=x*s,x+=P,f=x*s,l.push({left:h,right:f,isDash:_,zeroLength:P===0})}return l}addRoundDash(e,i,s){const l=i/2;for(let h=-s;h<=s;h++){const f=this.width*(this.nextRow+s+h);let _=0,x=e[_];for(let T=0;T<this.width;T++){T/x.right>1&&(x=e[++_]);const P=Math.abs(T-x.left),A=Math.abs(T-x.right),E=Math.min(P,A);let F;const O=h/s*(l+1);if(x.isDash){const H=l-Math.abs(O);F=Math.sqrt(E*E+H*H)}else F=l-Math.sqrt(E*E+O*O);this.data[f+T]=Math.max(0,Math.min(255,F+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){const x=e[_],T=e[_+1];x.zeroLength?e.splice(_,1):T&&T.isDash===x.isDash&&(T.left=x.left,e.splice(_,1))}const i=e[0],s=e[e.length-1];i.isDash===s.isDash&&(i.left=s.left-this.width,s.right=i.right+this.width);const l=this.width*this.nextRow;let h=0,f=e[h];for(let _=0;_<this.width;_++){_/f.right>1&&(f=e[++h]);const x=Math.abs(_-f.left),T=Math.abs(_-f.right),P=Math.min(x,T);this.data[l+_]=Math.max(0,Math.min(255,(f.isDash?P:-P)+128))}}addDash(e,i){const s=i?7:0,l=2*s+1;if(this.nextRow+l>this.height)return o.w("LineAtlas out of space"),null;let h=0;for(let _=0;_<e.length;_++)h+=e[_];if(h!==0){const _=this.width/h,x=this.getDashRanges(e,this.width,_);i?this.addRoundDash(x,_,s):this.addRegularDash(x)}const f={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:h};return this.nextRow+=l,this.dirty=!0,f}bind(e){const i=e.gl;this.texture?(i.bindTexture(i.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,i.texSubImage2D(i.TEXTURE_2D,0,0,0,this.width,this.height,i.ALPHA,i.UNSIGNED_BYTE,this.data))):(this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texImage2D(i.TEXTURE_2D,0,i.ALPHA,this.width,this.height,0,i.ALPHA,i.UNSIGNED_BYTE,this.data))}}const cn="maplibre_preloaded_worker_pool";class kr{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<kr.workerCount;)this.workers.push(new Worker(o.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[cn]}numActive(){return Object.keys(this.active).length}}const la=Math.floor(Ee.hardwareConcurrency/2);let xr,Ht;function vr(){return xr||(xr=new kr),xr}kr.workerCount=o.G(globalThis)?Math.max(Math.min(la,3),1):1;class Qi{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;const s=this.workerPool.acquire(i);for(let l=0;l<s.length;l++){const h=new o.H(s[l],i);h.name=`Worker ${l}`,this.actors.push(h)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,i){const s=[];for(const l of this.actors)s.push(l.sendAsync({type:e,data:i}));return Promise.all(s)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(i=>{i.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,i){for(const s of this.actors)s.registerMessageHandler(e,i)}}function Sn(){return Ht||(Ht=new Qi(vr(),o.J),Ht.registerMessageHandler("GR",(u,e,i)=>o.m(e,i))),Ht}function un(u,e){const i=o.K();return o.L(i,i,[1,1,0]),o.M(i,i,[.5*u.width,.5*u.height,1]),u.calculatePosMatrix?o.N(i,i,u.calculatePosMatrix(e.toUnwrapped())):i}function ca(u,e,i,s,l,h,f){var _;const x=function(E,F,O){if(E)for(const H of E){const q=F[H];if(q&&q.source===O&&q.type==="fill-extrusion")return!0}else for(const H in F){const q=F[H];if(q.source===O&&q.type==="fill-extrusion")return!0}return!1}((_=l==null?void 0:l.layers)!==null&&_!==void 0?_:null,e,u.id),T=h.maxPitchScaleFactor(),P=u.tilesIn(s,T,x);P.sort(or);const A=[];for(const E of P)A.push({wrappedTileID:E.tileID.wrapped().key,queryResults:E.tile.queryRenderedFeatures(e,i,u._state,E.queryGeometry,E.cameraQueryGeometry,E.scale,l,h,T,un(u.transform,E.tileID),f?(F,O)=>f(E.tileID,F,O):void 0)});return function(E,F){for(const O in E)for(const H of E[O])lr(H,F);return E}(function(E){const F={},O={};for(const H of E){const q=H.queryResults,W=H.wrappedTileID,K=O[W]=O[W]||{};for(const te in q){const ee=q[te],ie=K[te]=K[te]||{},se=F[te]=F[te]||[];for(const re of ee)ie[re.featureIndex]||(ie[re.featureIndex]=!0,se.push(re))}}return F}(A),u)}function or(u,e){const i=u.tileID,s=e.tileID;return i.overscaledZ-s.overscaledZ||i.canonical.y-s.canonical.y||i.wrap-s.wrap||i.canonical.x-s.canonical.x}function lr(u,e){const i=u.feature,s=e.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=s}function Ui(u,e,i){return o._(this,void 0,void 0,function*(){let s=u;if(u.url?s=(yield o.j(e.transformRequest(u.url,"Source"),i)).data:yield Ee.frameAsync(i),!s)return null;const l=o.O(o.e(s,u),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in s&&s.vector_layers&&(l.vectorLayerIds=s.vector_layers.map(h=>h.id)),l})}class Zt{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof o.Q?new o.Q(e.lng,e.lat):o.Q.convert(e),this}setSouthWest(e){return this._sw=e instanceof o.Q?new o.Q(e.lng,e.lat):o.Q.convert(e),this}extend(e){const i=this._sw,s=this._ne;let l,h;if(e instanceof o.Q)l=e,h=e;else{if(!(e instanceof Zt))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Zt.convert(e)):this.extend(o.Q.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(o.Q.convert(e)):this;if(l=e._sw,h=e._ne,!l||!h)return this}return i||s?(i.lng=Math.min(l.lng,i.lng),i.lat=Math.min(l.lat,i.lat),s.lng=Math.max(h.lng,s.lng),s.lat=Math.max(h.lat,s.lat)):(this._sw=new o.Q(l.lng,l.lat),this._ne=new o.Q(h.lng,h.lat)),this}getCenter(){return new o.Q((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 o.Q(this.getWest(),this.getNorth())}getSouthEast(){return new o.Q(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}=o.Q.convert(e);let l=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(l=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&l}static convert(e){return e instanceof Zt?e:e&&new Zt(e)}static fromLngLat(e,i=0){const s=360*i/40075017,l=s/Math.cos(Math.PI/180*e.lat);return new Zt(new o.Q(e.lng-l,e.lat-s),new o.Q(e.lng+l,e.lat+s))}adjustAntiMeridian(){const e=new o.Q(this._sw.lng,this._sw.lat),i=new o.Q(this._ne.lng,this._ne.lat);return new Zt(e,e.lng>i.lng?new o.Q(i.lng+360,i.lat):i)}}class Vr{constructor(e,i,s){this.bounds=Zt.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=s||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),s=Math.floor(o.U(this.bounds.getWest())*i),l=Math.floor(o.S(this.bounds.getNorth())*i),h=Math.ceil(o.U(this.bounds.getEast())*i),f=Math.ceil(o.S(this.bounds.getSouth())*i);return e.x>=s&&e.x<h&&e.y>=l&&e.y<f}}class hn extends o.E{constructor(e,i,s,l){if(super(),this.id=e,this.dispatcher=s,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.e(this,o.O(i,["url","scheme","tileSize","promoteId"])),this._options=o.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(l)}load(){return o._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield Ui(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(o.e(this,e),e.bounds&&(this.tileBounds=new Vr(e.bounds,this.minzoom,this.maxzoom)),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.l("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new o.k(e))}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return o.e({},this._options)}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s={request:this.map._requestManager.transformRequest(i,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};s.request.collectResourceTiming=this._collectResourceTiming;let l="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((h,f)=>{e.reloadPromise={resolve:h,reject:f}})}else e.actor=this.dispatcher.getActor(),l="LT";e.abortController=new AbortController;try{const h=yield e.actor.sendAsync({type:l,data:s},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,h)}catch(h){if(delete e.abortController,e.aborted)return;if(h&&h.status!==404)throw h;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,i){if(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),i&&this.map._refreshExpiredTiles&&e.setExpiryData(i),e.loadVectorData(i,this.map.painter),e.reloadPromise){const s=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(s.resolve).catch(s.reject)}}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class br extends o.E{constructor(e,i,s,l){super(),this.id=e,this.dispatcher=s,this.setEventedParent(l),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=o.e({type:"raster"},i),o.e(this,o.O(i,["url","scheme","tileSize"]))}load(){return o._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield Ui(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(o.e(this,i),i.bounds&&(this.tileBounds=new Vr(i.bounds,this.minzoom,this.maxzoom)),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(i){this._tileJSONRequest=null,this.fire(new o.k(i))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return o.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const s=yield Ft.getImage(this.map._requestManager.transformRequest(i,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(s&&s.data){this.map._refreshExpiredTiles&&(s.cacheControl||s.expires)&&e.setExpiryData({cacheControl:s.cacheControl,expires:s.expires});const l=this.map.painter.context,h=l.gl,f=s.data;e.texture=this.map.painter.getTileTexture(f.width),e.texture?e.texture.update(f,{useMipmap:!0}):(e.texture=new jt(l,f,h.RGBA,{useMipmap:!0}),e.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(s){if(delete e.abortController,e.aborted)e.state="unloaded";else if(s)throw e.state="errored",s}})}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class Pn extends br{constructor(e,i,s,l){super(e,i,s,l),this.type="raster-dem",this.maxzoom=22,this._options=o.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s=this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const l=yield Ft.getImage(s,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(l&&l.data){const h=l.data;this.map._refreshExpiredTiles&&(l.cacheControl||l.expires)&&e.setExpiryData({cacheControl:l.cacheControl,expires:l.expires});const f=o.b(h)&&o.V()?h:yield this.readImageNow(h),_={type:this.type,uid:e.uid,source:this.id,rawImageData:f,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const x=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=x,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(l){if(delete e.abortController,e.aborted)e.state="unloaded";else if(l)throw e.state="errored",l}})}readImageNow(e){return o._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&o.W()){const i=e.width+2,s=e.height+2;try{return new o.R({width:i,height:s},yield o.X(e,-1,-1,i,s))}catch{}}return Ee.getImageData(e,1)})}_getNeighboringTiles(e){const i=e.canonical,s=Math.pow(2,i.z),l=(i.x-1+s)%s,h=i.x===0?e.wrap-1:e.wrap,f=(i.x+1+s)%s,_=i.x+1===s?e.wrap+1:e.wrap,x={};return x[new o.Y(e.overscaledZ,h,i.z,l,i.y).key]={backfilled:!1},x[new o.Y(e.overscaledZ,_,i.z,f,i.y).key]={backfilled:!1},i.y>0&&(x[new o.Y(e.overscaledZ,h,i.z,l,i.y-1).key]={backfilled:!1},x[new o.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},x[new o.Y(e.overscaledZ,_,i.z,f,i.y-1).key]={backfilled:!1}),i.y+1<s&&(x[new o.Y(e.overscaledZ,h,i.z,l,i.y+1).key]={backfilled:!1},x[new o.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},x[new o.Y(e.overscaledZ,_,i.z,f,i.y+1).key]={backfilled:!1}),x}unloadTile(e){return o._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}class Cn extends o.E{constructor(e,i,s,l){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(l),this._data=i.data,this._options=o.e({},i),this._collectResourceTiming=i.collectResourceTiming,i.maxzoom!==void 0&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,i.clusterMaxZoom!==void 0&&this.maxzoom<=i.clusterMaxZoom&&o.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=o.e({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(i.buffer!==void 0?i.buffer:128),tolerance:this._pixelsToTileUnits(i.tolerance!==void 0?i.tolerance:.375),extent:o.Z,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:i.clusterMaxZoom!==void 0?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:o.Z,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(o.Z/this.tileSize)}load(){return o._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return o._(this,void 0,void 0,function*(){const e=o.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}getCoordinatesFromGeometry(e){return e.type==="GeometryCollection"?e.geometries.map(i=>i.coordinates).flat(1/0):e.coordinates.flat(1/0)}getBounds(){return o._(this,void 0,void 0,function*(){const e=new Zt,i=yield this.getData();let s;switch(i.type){case"FeatureCollection":s=i.features.map(l=>this.getCoordinatesFromGeometry(l.geometry)).flat(1/0);break;case"Feature":s=this.getCoordinatesFromGeometry(i.geometry);break;default:s=this.getCoordinatesFromGeometry(i)}if(s.length==0)return e;for(let l=0;l<s.length-1;l+=2)e.extend([s[l],s[l+1]]);return e})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,i,s){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:i,offset:s}})}_updateWorkerData(e){return o._(this,void 0,void 0,function*(){const i=o.e({type:this.type},this.workerOptions);e?i.dataDiff=e:typeof this._data=="string"?(i.request=this.map._requestManager.transformRequest(Ee.resolveURL(this._data),"Source"),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new o.l("dataloading",{dataType:"source"}));try{const s=yield this.actor.sendAsync({type:"LD",data:i});if(this._pendingLoads--,this._removed||s.abandoned)return void this.fire(new o.l("dataabort",{dataType:"source"}));let l=null;s.resourceTiming&&s.resourceTiming[this.id]&&(l=s.resourceTiming[this.id].slice(0));const h={dataType:"source"};this._collectResourceTiming&&l&&l.length>0&&o.e(h,{resourceTiming:l}),this.fire(new o.l("data",Object.assign(Object.assign({},h),{sourceDataType:"metadata"}))),this.fire(new o.l("data",Object.assign(Object.assign({},h),{sourceDataType:"content"})))}catch(s){if(this._pendingLoads--,this._removed)return void this.fire(new o.l("dataabort",{dataType:"source"}));this.fire(new o.k(s))}})}loaded(){return this._pendingLoads===0}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.actor?"RT":"LT";e.actor=this.actor;const s={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;const l=yield this.actor.sendAsync({type:i,data:s},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(l,this.map.painter,i==="RT")})}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return o.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class Ce extends o.E{constructor(e,i,s,l){super(),this.flippedWindingOrder=!1,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.setEventedParent(l),this.options=i}load(e){return o._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const i=yield Ft.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,i&&i.data&&(this.image=i.data,e&&(this.coordinates=e),this._finishLoading())}catch(i){this._request=null,this._loaded=!0,this.fire(new o.k(i))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(o.$.fromLngLat);var s;return this.tileID=function(l){let h=1/0,f=1/0,_=-1/0,x=-1/0;for(const E of l)h=Math.min(h,E.x),f=Math.min(f,E.y),_=Math.max(_,E.x),x=Math.max(x,E.y);const T=Math.max(_-h,x-f),P=Math.max(0,Math.floor(-Math.log(T)/Math.LN2)),A=Math.pow(2,P);return new o.a1(P,Math.floor((h+_)/2*A),Math.floor((f+x)/2*A))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map(l=>this.tileID.getTilePoint(l)._round()),this.flippedWindingOrder=((s=this.tileCoords)[1].x-s[0].x)*(s[2].y-s[0].y)-(s[1].y-s[0].y)*(s[2].x-s[0].x)<0,this.fire(new o.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,i=e.gl;this.texture||(this.texture=new jt(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const l in this.tiles){const h=this.tiles[l];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,s=!0)}s&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return o._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let i=1/0,s=1/0,l=-1/0,h=-1/0;for(const _ of e)i=Math.min(i,_.x),s=Math.min(s,_.y),l=Math.max(l,_.x),h=Math.max(h,_.y);const f={};for(let _=0;_<=o.a0;_++){const x=Math.pow(2,_),T=Math.floor(i*x),P=Math.floor(s*x),A=Math.floor(l*x),E=Math.floor(h*x);f[_]={minTileX:T,minTileY:P,maxTileX:A,maxTileY:E}}return f}}class Ye extends Ce{constructor(e,i,s,l){super(e,i,s,l),this.roundZoom=!0,this.type="video",this.options=i}load(){return o._(this,void 0,void 0,function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const i of e.urls)this.urls.push(this.map._requestManager.transformRequest(i,"Source").url);try{const i=yield o.a2(this.urls);if(this._loaded=!0,!i)return;this.video=i,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(i){this.fire(new o.k(i))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new o.k(new o.a3(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,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 e=this.map.painter.context,i=e.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new jt(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const l in this.tiles){const h=this.tiles[l];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,s=!0)}s&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Ue extends Ce{constructor(e,i,s,l){super(e,i,s,l),i.coordinates?Array.isArray(i.coordinates)&&i.coordinates.length===4&&!i.coordinates.some(h=>!Array.isArray(h)||h.length!==2||h.some(f=>typeof f!="number"))||this.fire(new o.k(new o.a3(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.k(new o.a3(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&typeof i.animate!="boolean"&&this.fire(new o.k(new o.a3(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?typeof i.canvas=="string"||i.canvas instanceof HTMLCanvasElement||this.fire(new o.k(new o.a3(`sources.${e}`,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.k(new o.a3(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=i.animate===void 0||i.animate}load(){return o._(this,void 0,void 0,function*(){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.k(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(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const i=this.map.painter.context,s=i.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new jt(i,this.canvas,s.RGBA,{premultiply:!0});let l=!1;for(const h in this.tiles){const f=this.tiles[h];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,l=!0)}l&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const _t={},Nt=u=>{switch(u){case"geojson":return Cn;case"image":return Ce;case"raster":return br;case"raster-dem":return Pn;case"vector":return hn;case"video":return Ye;case"canvas":return Ue}return _t[u]},cr="RTLPluginLoaded";class mi extends o.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Sn()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(i=>{throw this.status="error",i})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return o._(this,arguments,void 0,function*(i,s=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Ee.resolveURL(i),!this.url)throw new Error(`requested url ${i} is invalid`);if(this.status==="unavailable"){if(!s)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return o._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new o.l(cr))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let zr=null;function Rr(){return zr||(zr=new mi),zr}class In{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=o.a4(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const i=e+this.timeAdded;i<this.fadeEndTime||(this.fadeEndTime=i)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(l,h){const f={};if(!h)return f;for(const _ of l){const x=_.layerIds.map(T=>h.getLayer(T)).filter(Boolean);if(x.length!==0){_.layers=x,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(T=>x.filter(P=>P.id===T)[0]));for(const T of x)f[T.id]=_}}return f}(e.buckets,i==null?void 0:i.style),this.hasSymbolBuckets=!1;for(const l in this.buckets){const h=this.buckets[l];if(h instanceof o.a6){if(this.hasSymbolBuckets=!0,!s)break;h.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const l in this.buckets){const h=this.buckets[l];if(h instanceof o.a6&&h.hasRTLText){this.hasRTLText=!0,Rr().lazyLoad();break}}this.queryPadding=0;for(const l in this.buckets){const h=this.buckets[l];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(l).queryRadius(h))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new o.a5}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const s in this.buckets){const l=this.buckets[s];l.uploadPending()&&l.upload(e)}const i=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new jt(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new jt(e,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,i,s,l,h,f,_,x,T,P,A){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:l,cameraQueryGeometry:h,scale:f,tileSize:this.tileSize,pixelPosMatrix:P,transform:x,params:_,queryPadding:this.queryPadding*T,getElevation:A},e,i,s):{}}querySourceFeatures(e,i){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const l=s.loadVTLayers(),h=i&&i.sourceLayer?i.sourceLayer:"",f=l._geojsonTileLayer||l[h];if(!f)return;const _=o.a7(i&&i.filter),{z:x,x:T,y:P}=this.tileID.canonical,A={z:x,x:T,y:P};for(let E=0;E<f.length;E++){const F=f.feature(E);if(_.needGeometry){const q=o.a8(F,!0);if(!_.filter(new o.C(this.tileID.overscaledZ),q,this.tileID.canonical))continue}else if(!_.filter(new o.C(this.tileID.overscaledZ),F))continue;const O=s.getId(F,h),H=new o.a9(F,x,T,P,O);H.tile=A,e.push(H)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const s=o.aa(e.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const s=Date.now();let l=!1;if(this.expirationTime>s)l=!1;else if(i)if(this.expirationTime<i)l=!0;else{const h=this.expirationTime-i;h?this.expirationTime=s+Math.max(h,3e4):l=!0}else l=!0;l?(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)}setFeatureState(e,i){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const l in this.buckets){if(!i.style.hasLayer(l))continue;const h=this.buckets[l],f=h.layers[0].sourceLayer||"_geojsonTileLayer",_=s[f],x=e[f];if(!_||!x||Object.keys(x).length===0)continue;h.update(x,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const T=i&&i.style&&i.style.getLayer(l);T&&(this.queryPadding=Math.max(this.queryPadding,T.queryRadius(h)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Ee.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=Ee.now()+e}setDependencies(e,i){const s={};for(const l of i)s[l]=!0;this.dependencies[e]=s}hasDependency(e,i){for(const s of e){const l=this.dependencies[s];if(l){for(const h of i)if(l[h])return!0}}return!1}}class qn{constructor(e,i){this.max=e,this.onRemove=i,this.reset()}reset(){for(const e in this.data)for(const i of this.data[e])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(e,i,s){const l=e.wrapped().key;this.data[l]===void 0&&(this.data[l]=[]);const h={value:i,timeout:void 0};if(s!==void 0&&(h.timeout=setTimeout(()=>{this.remove(e,h)},s)),this.data[l].push(h),this.order.push(l),this.order.length>this.max){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const i=this.data[e].shift();return i.timeout&&clearTimeout(i.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),i.value}getByKey(e){const i=this.data[e];return i?i[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,i){if(!this.has(e))return this;const s=e.wrapped().key,l=i===void 0?0:this.data[s].indexOf(i),h=this.data[s][l];return this.data[s].splice(l,1),h.timeout&&clearTimeout(h.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(h.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(e){const i=[];for(const s in this.data)for(const l of this.data[s])e(l.value)||i.push(l);for(const s of i)this.remove(s.value.tileID,s)}}class ja{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,s){const l=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][l]=this.stateChanges[e][l]||{},o.e(this.stateChanges[e][l],s),this.deletedStates[e]===null){this.deletedStates[e]={};for(const h in this.state[e])h!==l&&(this.deletedStates[e][h]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][l]===null){this.deletedStates[e][l]={};for(const h in this.state[e][l])s[h]||(this.deletedStates[e][l][h]=null)}else for(const h in s)this.deletedStates[e]&&this.deletedStates[e][l]&&this.deletedStates[e][l][h]===null&&delete this.deletedStates[e][l][h]}removeFeatureState(e,i,s){if(this.deletedStates[e]===null)return;const l=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},s&&i!==void 0)this.deletedStates[e][l]!==null&&(this.deletedStates[e][l]=this.deletedStates[e][l]||{},this.deletedStates[e][l][s]=null);else if(i!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][l])for(s in this.deletedStates[e][l]={},this.stateChanges[e][l])this.deletedStates[e][l][s]=null;else this.deletedStates[e][l]=null;else this.deletedStates[e]=null}getState(e,i){const s=String(i),l=o.e({},(this.state[e]||{})[s],(this.stateChanges[e]||{})[s]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const h=this.deletedStates[e][i];if(h===null)return{};for(const f in h)delete l[f]}return l}initializeTileState(e,i){e.setFeatureState(this.state,i)}coalesceChanges(e,i){const s={};for(const l in this.stateChanges){this.state[l]=this.state[l]||{};const h={};for(const f in this.stateChanges[l])this.state[l][f]||(this.state[l][f]={}),o.e(this.state[l][f],this.stateChanges[l][f]),h[f]=this.state[l][f];s[l]=h}for(const l in this.deletedStates){this.state[l]=this.state[l]||{};const h={};if(this.deletedStates[l]===null)for(const f in this.state[l])h[f]={},this.state[l][f]={};else for(const f in this.deletedStates[l]){if(this.deletedStates[l][f]===null)this.state[l][f]={};else for(const _ of Object.keys(this.deletedStates[l][f]))delete this.state[l][f][_];h[f]=this.state[l][f]}s[l]=s[l]||{},o.e(s[l],h)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const l in e)e[l].setFeatureState(s,i)}}const Ur=89.25;function wr(u,e){const i=o.ae(e.lat,-85.051129,o.af);return new o.P(o.U(e.lng)*u,o.S(i)*u)}function dn(u,e){return new o.$(e.x/u,e.y/u).toLngLat()}function ce(u){return u.cameraToCenterDistance*Math.min(.85*Math.tan(o.ab(90-u.pitch)),Math.tan(o.ab(Ur-u.pitch)))}function N(u,e){const i=u.canonical,s=e/o.ac(i.z),l=i.x+Math.pow(2,i.z)*u.wrap,h=o.ad(new Float64Array(16));return o.L(h,h,[l*s,i.y*s,0]),o.M(h,h,[s/o.Z,s/o.Z,1]),h}function Z(u,e,i,s,l){const h=o.$.fromLngLat(u,e),f=l*o.ag(1,u.lat),_=f*Math.cos(o.ab(i)),x=Math.sqrt(f*f-_*_),T=x*Math.sin(o.ab(-s)),P=x*Math.cos(o.ab(-s));return new o.$(h.x+T,h.y+P,h.z+_)}function G(u,e,i){const s=e.intersectsFrustum(u);if(!i)return s;const l=e.intersectsPlane(i);return s===0||l===0?0:s===2&&l===2?2:1}function J(u,e,i){let s=0;const l=(i-e)/10;for(let h=0;h<10;h++)s+=l*Math.pow(Math.cos(e+(h+.5)/10*(i-e)),u);return s}function ae(u,e){return function(i,s,l,h,f){const _=2*((u-1)/o.ah(Math.cos(o.ab(Ur-f))/Math.cos(o.ab(Ur)))-1),x=Math.acos(l/h),T=2*J(_-1,0,o.ab(f/2)),P=Math.min(o.ab(Ur),x+o.ab(f/2)),A=J(_-1,Math.min(P,x-o.ab(f/2)),P),E=Math.atan(s/l),F=Math.hypot(s,l);let O=i;return O+=o.ah(h/F/Math.max(.5,Math.cos(o.ab(f/2)))),O+=_*o.ah(Math.cos(E))/2,O-=o.ah(Math.max(1,A/T/e))/2,O}}const $=ae(9.314,3);function ge(u,e){const i=(e.roundZoom?Math.round:Math.floor)(u.zoom+o.ah(u.tileSize/e.tileSize));return Math.max(0,i)}function oe(u,e){const i=u.getCameraFrustum(),s=u.getClippingPlane(),l=u.screenPointToMercatorCoordinate(u.getCameraPoint()),h=o.$.fromLngLat(u.center,u.elevation);l.z=h.z+Math.cos(u.pitchInRadians)*u.cameraToCenterDistance/u.worldSize;const f=u.getCoveringTilesDetailsProvider(),_=f.allowVariableZoom(u,e),x=ge(u,e),T=e.minzoom||0,P=e.maxzoom!==void 0?e.maxzoom:u.maxZoom,A=Math.min(Math.max(0,x),P),E=Math.pow(2,A),F=[E*l.x,E*l.y,0],O=[E*h.x,E*h.y,0],H=Math.hypot(h.x-l.x,h.y-l.y),q=Math.abs(h.z-l.z),W=Math.hypot(H,q),K=ie=>({zoom:0,x:0,y:0,wrap:ie,fullyVisible:!1}),te=[],ee=[];if(u.renderWorldCopies&&f.allowWorldCopies())for(let ie=1;ie<=3;ie++)te.push(K(-ie)),te.push(K(ie));for(te.push(K(0));te.length>0;){const ie=te.pop(),se=ie.x,re=ie.y;let pe=ie.fullyVisible;const Me={x:se,y:re,z:ie.zoom},xe=f.getTileAABB(Me,ie.wrap,u.elevation,e);if(!pe){const Oe=G(i,xe,s);if(Oe===0)continue;pe=Oe===2}const ve=f.distanceToTile2d(l.x,l.y,Me,xe);let be=x;_&&(be=(e.calculateTileZoom||$)(u.zoom+o.ah(u.tileSize/e.tileSize),ve,q,W,u.fov)),be=(e.roundZoom?Math.round:Math.floor)(be),be=Math.max(0,be);const Ne=Math.min(be,P);if(ie.wrap=f.getWrap(h,Me,ie.wrap),ie.zoom>=Ne){if(ie.zoom<T)continue;const Oe=A-ie.zoom,Re=F[0]-.5-(se<<Oe),He=F[1]-.5-(re<<Oe),gt=e.reparseOverscaled?Math.max(ie.zoom,be):ie.zoom;ee.push({tileID:new o.Y(ie.zoom===P?gt:ie.zoom,ie.wrap,ie.zoom,se,re),distanceSq:o.ai([O[0]-.5-se,O[1]-.5-re]),tileDistanceToCamera:Math.sqrt(Re*Re+He*He)})}else for(let Oe=0;Oe<4;Oe++)te.push({zoom:ie.zoom+1,x:(se<<1)+Oe%2,y:(re<<1)+(Oe>>1),wrap:ie.wrap,fullyVisible:pe})}return ee.sort((ie,se)=>ie.distanceSq-se.distanceSq).map(ie=>ie.tileID)}class de extends o.E{constructor(e,i,s){super(),this.id=e,this.dispatcher=s,this.on("data",l=>this._dataHandler(l)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((l,h,f,_)=>{const x=new(Nt(h.type))(l,h,f,_);if(x.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${x.id}`);return x})(e,i,s,this),this._tiles={},this._cache=new qn(0,l=>this._unloadTile(l)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ja,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const e in this._tiles){const i=this._tiles[e];if(i.state!=="loaded"&&i.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,i,s){return o._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,i,s)}catch(l){e.state="errored",l.status!==404?this._source.fire(new o.k(l,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new o.l("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const i in this._tiles){const s=this._tiles[i];s.upload(e),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(_e).map(e=>e.key)}getRenderableIds(e){const i=[];for(const s in this._tiles)this._isIdRenderable(s,e)&&i.push(this._tiles[s]);return e?i.sort((s,l)=>{const h=s.tileID,f=l.tileID,_=new o.P(h.canonical.x,h.canonical.y)._rotate(-this.transform.bearingInRadians),x=new o.P(f.canonical.x,f.canonical.y)._rotate(-this.transform.bearingInRadians);return h.overscaledZ-f.overscaledZ||x.y-_.y||x.x-_.x}).map(s=>s.tileID.key):i.map(s=>s.tileID).sort(_e).map(s=>s.key)}hasRenderableParent(e){const i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())}reload(e){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const i in this._tiles)(e||this._tiles[i].state!=="errored")&&this._reloadTile(i,"reloading")}}_reloadTile(e,i){return o._(this,void 0,void 0,function*(){const s=this._tiles[e];s&&(s.state!=="loading"&&(s.state=i),yield this._loadTile(s,e,i))})}_tileLoaded(e,i,s){e.timeAdded=Ee.now(),s==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new o.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const i=this.getRenderableIds();for(let l=0;l<i.length;l++){const h=i[l];if(e.neighboringTiles&&e.neighboringTiles[h]){const f=this.getTileByID(h);s(e,f),s(f,e)}}function s(l,h){l.needsHillshadePrepare=!0,l.needsTerrainPrepare=!0;let f=h.tileID.canonical.x-l.tileID.canonical.x;const _=h.tileID.canonical.y-l.tileID.canonical.y,x=Math.pow(2,l.tileID.canonical.z),T=h.tileID.key;f===0&&_===0||Math.abs(_)>1||(Math.abs(f)>1&&(Math.abs(f+x)===1?f+=x:Math.abs(f-x)===1&&(f-=x)),h.dem&&l.dem&&(l.dem.backfillBorder(h.dem,f,_),l.neighboringTiles&&l.neighboringTiles[T]&&(l.neighboringTiles[T].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,s,l){for(const h in this._tiles){let f=this._tiles[h];if(l[h]||!f.hasData()||f.tileID.overscaledZ<=i||f.tileID.overscaledZ>s)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>i+1;){const T=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[T.key],f&&f.hasData()&&(_=T)}let x=_;for(;x.overscaledZ>i;)if(x=x.scaledTo(x.overscaledZ-1),e[x.key]||e[x.canonical.key]){l[_.key]=_;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){const s=this._loadedParentTiles[e.key];return s&&s.tileID.overscaledZ>=i?s:null}for(let s=e.overscaledZ-1;s>=i;s--){const l=e.scaledTo(s),h=this._getLoadedTile(l);if(h)return h}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,s=Math.ceil(e.height/this._source.tileSize)+1,l=Math.floor(i*s*(this._maxTileCacheZoomLevels===null?o.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),h=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,l):l;this._cache.setMaxSize(h)}handleWrapJump(e){const i=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,i){const s={};for(const l in this._tiles){const h=this._tiles[l];h.tileID=h.tileID.unwrapTo(h.tileID.wrap+i),s[h.tileID.key]=h}this._tiles=s;for(const l in this._timers)clearTimeout(this._timers[l]),delete this._timers[l];for(const l in this._tiles)this._setTileReloadTimer(l,this._tiles[l])}}_updateCoveredAndRetainedTiles(e,i,s,l,h,f){const _={},x={},T=Object.keys(e),P=Ee.now();for(const A of T){const E=e[A],F=this._tiles[A];if(!F||F.fadeEndTime!==0&&F.fadeEndTime<=P)continue;const O=this.findLoadedParent(E,i),H=this.findLoadedSibling(E),q=O||H||null;q&&(this._addTile(q.tileID),_[q.tileID.key]=q.tileID),x[A]=E}this._retainLoadedChildren(x,l,s,e);for(const A in _)e[A]||(this._coveredTiles[A]=!0,e[A]=_[A]);if(f){const A={},E={};for(const F of h)this._tiles[F.key].hasData()?A[F.key]=F:E[F.key]=F;for(const F in E){const O=E[F].children(this._source.maxzoom);this._tiles[O[0].key]&&this._tiles[O[1].key]&&this._tiles[O[2].key]&&this._tiles[O[3].key]&&(A[O[0].key]=e[O[0].key]=O[0],A[O[1].key]=e[O[1].key]=O[1],A[O[2].key]=e[O[2].key]=O[2],A[O[3].key]=e[O[3].key]=O[3],delete E[F])}for(const F in E){const O=E[F],H=this.findLoadedParent(O,this._source.minzoom),q=this.findLoadedSibling(O),W=H||q||null;if(W){A[W.tileID.key]=e[W.tileID.key]=W.tileID;for(const K in A)A[K].isChildOf(W.tileID)&&delete A[K]}}for(const F in this._tiles)A[F]||(this._coveredTiles[F]=!0)}}update(e,i){if(!this._sourceLoaded||this._paused)return;let s;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(P=>new o.Y(P.canonical.z,P.wrap,P.canonical.z,P.canonical.x,P.canonical.y)):(s=oe(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(s=s.filter(P=>this._source.hasTile(P)))):s=[];const l=ge(e,this._source),h=Math.max(l-de.maxOverzooming,this._source.minzoom),f=Math.max(l+de.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const P={};for(const A of s)if(A.canonical.z>this._source.minzoom){const E=A.scaledTo(A.canonical.z-1);P[E.key]=E;const F=A.scaledTo(Math.max(this._source.minzoom,Math.min(A.canonical.z,5)));P[F.key]=F}s=s.concat(Object.values(P))}const _=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new o.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const x=this._updateRetainedTiles(s,l);ue(this._source.type)&&this._updateCoveredAndRetainedTiles(x,h,f,l,s,i);for(const P in x)this._tiles[P].clearFadeHold();const T=o.aj(this._tiles,x);for(const P of T){const A=this._tiles[P];A.hasSymbolBuckets&&!A.holdingForFade()?A.setHoldDuration(this.map._fadeDuration):A.hasSymbolBuckets&&!A.symbolFadeFinished()||this._removeTile(P)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,i){var s;const l={},h={},f=Math.max(i-de.maxOverzooming,this._source.minzoom),_=Math.max(i+de.maxUnderzooming,this._source.minzoom),x={};for(const T of e){const P=this._addTile(T);l[T.key]=T,P.hasData()||i<this._source.maxzoom&&(x[T.key]=T)}this._retainLoadedChildren(x,i,_,l);for(const T of e){let P=this._tiles[T.key];if(P.hasData())continue;if(i+1>this._source.maxzoom){const E=T.children(this._source.maxzoom)[0],F=this.getTile(E);if(F&&F.hasData()){l[E.key]=E;continue}}else{const E=T.children(this._source.maxzoom);if(l[E[0].key]&&l[E[1].key]&&l[E[2].key]&&l[E[3].key])continue}let A=P.wasRequested();for(let E=T.overscaledZ-1;E>=f;--E){const F=T.scaledTo(E);if(h[F.key])break;if(h[F.key]=!0,P=this.getTile(F),!P&&A&&(P=this._addTile(F)),P){const O=P.hasData();if((O||!(!((s=this.map)===null||s===void 0)&&s.cancelPendingTileRequestsWhileZooming)||A)&&(l[F.key]=F),A=P.wasRequested(),O)break}}}return l}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const i=[];let s,l=this._tiles[e].tileID;for(;l.overscaledZ>0;){if(l.key in this._loadedParentTiles){s=this._loadedParentTiles[l.key];break}i.push(l.key);const h=l.scaledTo(l.overscaledZ-1);if(s=this._getLoadedTile(h),s)break;l=h}for(const h of i)this._loadedParentTiles[h]=s}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const i=this._tiles[e].tileID,s=this._getLoadedTile(i);this._loadedSiblingTiles[i.key]=s}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const s=i;return i||(i=new In(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._tiles[e.key]=i,s||this._source.fire(new o.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const s=i.getExpiryTimeout();s&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},s))}refreshTiles(e){for(const i in this._tiles)this._isIdRenderable(i)&&e.some(s=>s.equals(this._tiles[i].tileID.canonical))&&this._reloadTile(i,"expired")}_removeTile(e){const i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&i.state!=="reloading"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(e){const i=e.sourceDataType;e.dataType==="source"&&i==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&i==="content"&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,i,s){const l=[],h=this.transform;if(!h)return l;const f=s?h.getCameraQueryGeometry(e):e,_=e.map(O=>h.screenPointToMercatorCoordinate(O,this.terrain)),x=f.map(O=>h.screenPointToMercatorCoordinate(O,this.terrain)),T=this.getIds();let P=1/0,A=1/0,E=-1/0,F=-1/0;for(const O of x)P=Math.min(P,O.x),A=Math.min(A,O.y),E=Math.max(E,O.x),F=Math.max(F,O.y);for(let O=0;O<T.length;O++){const H=this._tiles[T[O]];if(H.holdingForFade())continue;const q=h.getCoveringTilesDetailsProvider().allowWorldCopies()?H.tileID:H.tileID.unwrapTo(0),W=Math.pow(2,h.zoom-H.tileID.overscaledZ),K=i*H.queryPadding*o.Z/H.tileSize/W,te=[q.getTilePoint(new o.$(P,A)),q.getTilePoint(new o.$(E,F))];if(te[0].x-K<o.Z&&te[0].y-K<o.Z&&te[1].x+K>=0&&te[1].y+K>=0){const ee=_.map(se=>q.getTilePoint(se)),ie=x.map(se=>q.getTilePoint(se));l.push({tile:H,tileID:q,queryGeometry:ee,cameraQueryGeometry:ie,scale:W})}}return l}getVisibleCoordinates(e){const i=this.getRenderableIds(e).map(s=>this._tiles[s].tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){if(this._source.hasTransition())return!0;if(ue(this._source.type)){const e=Ee.now();for(const i in this._tiles)if(this._tiles[i].fadeEndTime>=e)return!0}return!1}setFeatureState(e,i,s){this._state.updateState(e=e||"_geojsonTileLayer",i,s)}removeFeatureState(e,i,s){this._state.removeFeatureState(e=e||"_geojsonTileLayer",i,s)}getFeatureState(e,i){return this._state.getState(e=e||"_geojsonTileLayer",i)}setDependencies(e,i,s){const l=this._tiles[e];l&&l.setDependencies(i,s)}reloadTilesForDependencies(e,i){for(const s in this._tiles)this._tiles[s].hasDependency(e,i)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(e,i))}}function _e(u,e){const i=Math.abs(2*u.wrap)-+(u.wrap<0),s=Math.abs(2*e.wrap)-+(e.wrap<0);return u.overscaledZ-e.overscaledZ||s-i||e.canonical.y-u.canonical.y||e.canonical.x-u.canonical.x}function ue(u){return u==="raster"||u==="image"||u==="video"}de.maxOverzooming=10,de.maxUnderzooming=3;class Ae{constructor(e,i){this.reset(e,i)}reset(e,i){this.points=e||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=o.ae(e,0,1);let i=1,s=this._distances[i];const l=e*this.paddedLength+this.padding;for(;s<l&&i<this._distances.length;)s=this._distances[++i];const h=i-1,f=this._distances[h],_=s-f,x=_>0?(l-f)/_:0;return this.points[h].mult(1-x).add(this.points[i].mult(x))}}function Ze(u,e){let i=!0;return u==="always"||u!=="never"&&e!=="never"||(i=!1),i}class Ve{constructor(e,i,s){const l=this.boxCells=[],h=this.circleCells=[];this.xCellCount=Math.ceil(e/s),this.yCellCount=Math.ceil(i/s);for(let f=0;f<this.xCellCount*this.yCellCount;f++)l.push([]),h.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=i,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,i,s,l,h){this._forEachCell(i,s,l,h,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(h)}insertCircle(e,i,s,l){this._forEachCell(i-l,s-l,i+l,s+l,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(i),this.circles.push(s),this.circles.push(l)}_insertBoxCell(e,i,s,l,h,f){this.boxCells[h].push(f)}_insertCircleCell(e,i,s,l,h,f){this.circleCells[h].push(f)}_query(e,i,s,l,h,f,_){if(s<0||e>this.width||l<0||i>this.height)return[];const x=[];if(e<=0&&i<=0&&this.width<=s&&this.height<=l){if(h)return[{key:null,x1:e,y1:i,x2:s,y2:l}];for(let T=0;T<this.boxKeys.length;T++)x.push({key:this.boxKeys[T],x1:this.bboxes[4*T],y1:this.bboxes[4*T+1],x2:this.bboxes[4*T+2],y2:this.bboxes[4*T+3]});for(let T=0;T<this.circleKeys.length;T++){const P=this.circles[3*T],A=this.circles[3*T+1],E=this.circles[3*T+2];x.push({key:this.circleKeys[T],x1:P-E,y1:A-E,x2:P+E,y2:A+E})}}else this._forEachCell(e,i,s,l,this._queryCell,x,{hitTest:h,overlapMode:f,seenUids:{box:{},circle:{}}},_);return x}query(e,i,s,l){return this._query(e,i,s,l,!1,null)}hitTest(e,i,s,l,h,f){return this._query(e,i,s,l,!0,h,f).length>0}hitTestCircle(e,i,s,l,h){const f=e-s,_=e+s,x=i-s,T=i+s;if(_<0||f>this.width||T<0||x>this.height)return!1;const P=[];return this._forEachCell(f,x,_,T,this._queryCellCircle,P,{hitTest:!0,overlapMode:l,circle:{x:e,y:i,radius:s},seenUids:{box:{},circle:{}}},h),P.length>0}_queryCell(e,i,s,l,h,f,_,x){const{seenUids:T,hitTest:P,overlapMode:A}=_,E=this.boxCells[h];if(E!==null){const O=this.bboxes;for(const H of E)if(!T.box[H]){T.box[H]=!0;const q=4*H,W=this.boxKeys[H];if(e<=O[q+2]&&i<=O[q+3]&&s>=O[q+0]&&l>=O[q+1]&&(!x||x(W))&&(!P||!Ze(A,W.overlapMode))&&(f.push({key:W,x1:O[q],y1:O[q+1],x2:O[q+2],y2:O[q+3]}),P))return!0}}const F=this.circleCells[h];if(F!==null){const O=this.circles;for(const H of F)if(!T.circle[H]){T.circle[H]=!0;const q=3*H,W=this.circleKeys[H];if(this._circleAndRectCollide(O[q],O[q+1],O[q+2],e,i,s,l)&&(!x||x(W))&&(!P||!Ze(A,W.overlapMode))){const K=O[q],te=O[q+1],ee=O[q+2];if(f.push({key:W,x1:K-ee,y1:te-ee,x2:K+ee,y2:te+ee}),P)return!0}}}return!1}_queryCellCircle(e,i,s,l,h,f,_,x){const{circle:T,seenUids:P,overlapMode:A}=_,E=this.boxCells[h];if(E!==null){const O=this.bboxes;for(const H of E)if(!P.box[H]){P.box[H]=!0;const q=4*H,W=this.boxKeys[H];if(this._circleAndRectCollide(T.x,T.y,T.radius,O[q+0],O[q+1],O[q+2],O[q+3])&&(!x||x(W))&&!Ze(A,W.overlapMode))return f.push(!0),!0}}const F=this.circleCells[h];if(F!==null){const O=this.circles;for(const H of F)if(!P.circle[H]){P.circle[H]=!0;const q=3*H,W=this.circleKeys[H];if(this._circlesCollide(O[q],O[q+1],O[q+2],T.x,T.y,T.radius)&&(!x||x(W))&&!Ze(A,W.overlapMode))return f.push(!0),!0}}}_forEachCell(e,i,s,l,h,f,_,x){const T=this._convertToXCellCoord(e),P=this._convertToYCellCoord(i),A=this._convertToXCellCoord(s),E=this._convertToYCellCoord(l);for(let F=T;F<=A;F++)for(let O=P;O<=E;O++)if(h.call(this,e,i,s,l,this.xCellCount*O+F,f,_,x))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,i,s,l,h,f){const _=l-e,x=h-i,T=s+f;return T*T>_*_+x*x}_circleAndRectCollide(e,i,s,l,h,f,_){const x=(f-l)/2,T=Math.abs(e-(l+x));if(T>x+s)return!1;const P=(_-h)/2,A=Math.abs(i-(h+P));if(A>P+s)return!1;if(T<=x||A<=P)return!0;const E=T-x,F=A-P;return E*E+F*F<=s*s}}function Qe(u,e,i){const s=o.K();if(!u){const{vecSouth:A,vecEast:E}=at(e),F=me();F[0]=E[0],F[1]=E[1],F[2]=A[0],F[3]=A[1],l=F,(P=(f=(h=F)[0])*(T=h[3])-(x=h[2])*(_=h[1]))&&(l[0]=T*(P=1/P),l[1]=-_*P,l[2]=-x*P,l[3]=f*P),s[0]=F[0],s[1]=F[1],s[4]=F[2],s[5]=F[3]}var l,h,f,_,x,T,P;return o.M(s,s,[1/i,1/i,1]),s}function dt(u,e,i,s){if(u){const l=o.K();if(!e){const{vecSouth:h,vecEast:f}=at(i);l[0]=f[0],l[1]=f[1],l[4]=h[0],l[5]=h[1]}return o.M(l,l,[s,s,1]),l}return i.pixelsToClipSpaceMatrix}function at(u){const e=Math.cos(u.rollInRadians),i=Math.sin(u.rollInRadians),s=Math.cos(u.pitchInRadians),l=Math.cos(u.bearingInRadians),h=Math.sin(u.bearingInRadians),f=o.ao();f[0]=-l*s*i-h*e,f[1]=-h*s*i+l*e;const _=o.ap(f);_<1e-9?o.aq(f):o.ar(f,f,1/_);const x=o.ao();x[0]=l*s*e-h*i,x[1]=h*s*e+l*i;const T=o.ap(x);return T<1e-9?o.aq(x):o.ar(x,x,1/T),{vecEast:x,vecSouth:f}}function we(u,e,i,s){let l;s?(l=[u,e,s(u,e),1],o.at(l,l,i)):(l=[u,e,0,1],ha(l,l,i));const h=l[3];return{point:new o.P(l[0]/h,l[1]/h),signedDistanceFromCamera:h,isOccluded:!1}}function Lt(u,e){return .5+u/e*.5}function Tt(u,e){return u.x>=-e[0]&&u.x<=e[0]&&u.y>=-e[1]&&u.y<=e[1]}function kt(u,e,i,s,l,h,f,_,x,T,P,A,E){const F=i?u.textSizeData:u.iconSizeData,O=o.ak(F,e.transform.zoom),H=[256/e.width*2+1,256/e.height*2+1],q=i?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;q.clear();const W=u.lineVertexArray,K=i?u.text.placedSymbolArray:u.icon.placedSymbolArray,te=e.transform.width/e.transform.height;let ee=!1;for(let ie=0;ie<K.length;ie++){const se=K.get(ie);if(se.hidden||se.writingMode===o.al.vertical&&!ee){En(se.numGlyphs,q);continue}ee=!1;const re=new o.P(se.anchorX,se.anchorY),pe={getElevation:E,pitchedLabelPlaneMatrix:s,lineVertexArray:W,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:re,unwrappedTileID:x,width:T,height:P,translation:A},Me=ft(se.anchorX,se.anchorY,pe);if(!Tt(Me.point,H)){En(se.numGlyphs,q);continue}const xe=Lt(e.transform.cameraToCenterDistance,Me.signedDistanceFromCamera),ve=o.am(F,O,se),be=h?ve*e.transform.getPitchedTextCorrection(se.anchorX,se.anchorY,x)/xe:ve*xe,Ne=it({projectionContext:pe,pitchedLabelPlaneMatrixInverse:l,symbol:se,fontSize:be,flip:!1,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:te,rotateToLine:_});ee=Ne.useVertical,(Ne.notEnoughRoom||ee||Ne.needsFlipping&&it({projectionContext:pe,pitchedLabelPlaneMatrixInverse:l,symbol:se,fontSize:be,flip:!0,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:te,rotateToLine:_}).notEnoughRoom)&&En(se.numGlyphs,q)}i?u.text.dynamicLayoutVertexBuffer.updateData(q):u.icon.dynamicLayoutVertexBuffer.updateData(q)}function nt(u,e,i,s,l,h,f,_){const x=h.glyphStartIndex+h.numGlyphs,T=h.lineStartIndex,P=h.lineStartIndex+h.lineLength,A=e.getoffsetX(h.glyphStartIndex),E=e.getoffsetX(x-1),F=ua(u*A,i,s,l,h.segment,T,P,_,f);if(!F)return null;const O=ua(u*E,i,s,l,h.segment,T,P,_,f);return O?_.projectionCache.anyProjectionOccluded?null:{first:F,last:O}:null}function Ie(u,e,i,s){return u===o.al.horizontal&&Math.abs(i.y-e.y)>Math.abs(i.x-e.x)*s?{useVertical:!0}:(u===o.al.vertical?e.y<i.y:e.x>i.x)?{needsFlipping:!0}:null}function it(u){const{projectionContext:e,pitchedLabelPlaneMatrixInverse:i,symbol:s,fontSize:l,flip:h,keepUpright:f,glyphOffsetArray:_,dynamicLayoutVertexArray:x,aspectRatio:T,rotateToLine:P}=u,A=l/24,E=s.lineOffsetX*A,F=s.lineOffsetY*A;let O;if(s.numGlyphs>1){const H=s.glyphStartIndex+s.numGlyphs,q=s.lineStartIndex,W=s.lineStartIndex+s.lineLength,K=nt(A,_,E,F,h,s,P,e);if(!K)return{notEnoughRoom:!0};const te=Tr(K.first.point.x,K.first.point.y,e,i),ee=Tr(K.last.point.x,K.last.point.y,e,i);if(f&&!h){const ie=Ie(s.writingMode,te,ee,T);if(ie)return ie}O=[K.first];for(let ie=s.glyphStartIndex+1;ie<H-1;ie++)O.push(ua(A*_.getoffsetX(ie),E,F,h,s.segment,q,W,e,P));O.push(K.last)}else{if(f&&!h){const q=li(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,W=s.lineStartIndex+s.segment+1,K=new o.P(e.lineVertexArray.getx(W),e.lineVertexArray.gety(W)),te=li(K.x,K.y,e),ee=te.signedDistanceFromCamera>0?te.point:pt(e.tileAnchorPoint,K,q,1,e),ie=Tr(q.x,q.y,e,i),se=Tr(ee.x,ee.y,e,i),re=Ie(s.writingMode,ie,se,T);if(re)return re}const H=ua(A*_.getoffsetX(s.glyphStartIndex),E,F,h,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,e,P);if(!H||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};O=[H]}for(const H of O)o.as(x,H.point,H.angle);return{}}function pt(u,e,i,s,l){const h=u.add(u.sub(e)._unit()),f=li(h.x,h.y,l).point,_=i.sub(f);return i.add(_._mult(s/_.mag()))}function oi(u,e,i){const s=e.projectionCache;if(s.projections[u])return s.projections[u];const l=new o.P(e.lineVertexArray.getx(u),e.lineVertexArray.gety(u)),h=li(l.x,l.y,e);if(h.signedDistanceFromCamera>0)return s.projections[u]=h.point,s.anyProjectionOccluded=s.anyProjectionOccluded||h.isOccluded,h.point;const f=u-i.direction;return pt(i.distanceFromAnchor===0?e.tileAnchorPoint:new o.P(e.lineVertexArray.getx(f),e.lineVertexArray.gety(f)),l,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,e)}function li(u,e,i){const s=u+i.translation[0],l=e+i.translation[1];let h;return i.pitchWithMap?(h=we(s,l,i.pitchedLabelPlaneMatrix,i.getElevation),h.isOccluded=!1):(h=i.transform.projectTileCoordinates(s,l,i.unwrappedTileID,i.getElevation),h.point.x=(.5*h.point.x+.5)*i.width,h.point.y=(.5*-h.point.y+.5)*i.height),h}function Tr(u,e,i,s){if(i.pitchWithMap){const l=[u,e,0,1];return o.at(l,l,s),i.transform.projectTileCoordinates(l[0]/l[3],l[1]/l[3],i.unwrappedTileID,i.getElevation).point}return{x:u/i.width*2-1,y:e/i.height*2-1}}function ft(u,e,i){return i.transform.projectTileCoordinates(u,e,i.unwrappedTileID,i.getElevation)}function Na(u,e,i){return u._unit()._perp()._mult(e*i)}function Ms(u,e,i,s,l,h,f,_,x){if(_.projectionCache.offsets[u])return _.projectionCache.offsets[u];const T=i.add(e);if(u+x.direction<s||u+x.direction>=l)return _.projectionCache.offsets[u]=T,T;const P=oi(u+x.direction,_,x),A=Na(P.sub(i),f,x.direction),E=i.add(A),F=P.add(A);return _.projectionCache.offsets[u]=o.au(h,T,E,F)||T,_.projectionCache.offsets[u]}function ua(u,e,i,s,l,h,f,_,x){const T=s?u-e:u+e;let P=T>0?1:-1,A=0;s&&(P*=-1,A=Math.PI),P<0&&(A+=Math.PI);let E,F=P>0?h+l:h+l+1;_.projectionCache.cachedAnchorPoint?E=_.projectionCache.cachedAnchorPoint:(E=li(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=E);let O,H,q=E,W=E,K=0,te=0;const ee=Math.abs(T),ie=[];let se;for(;K+te<=ee;){if(F+=P,F<h||F>=f)return null;K+=te,W=q,H=O;const Me={absOffsetX:ee,direction:P,distanceFromAnchor:K,previousVertex:W};if(q=oi(F,_,Me),i===0)ie.push(W),se=q.sub(W);else{let xe;const ve=q.sub(W);xe=ve.mag()===0?Na(oi(F+P,_,Me).sub(q),i,P):Na(ve,i,P),H||(H=W.add(xe)),O=Ms(F,xe,q,h,f,H,i,_,Me),ie.push(H),se=O.sub(H)}te=se.mag()}const re=se._mult((ee-K)/te)._add(H||W),pe=A+Math.atan2(q.y-W.y,q.x-W.x);return ie.push(re),{point:re,angle:x?pe:0,path:ie}}const Ss=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function En(u,e){for(let i=0;i<u;i++){const s=e.length;e.resize(s+4),e.float32.set(Ss,3*s)}}function ha(u,e,i){const s=e[0],l=e[1];return u[0]=i[0]*s+i[4]*l+i[12],u[1]=i[1]*s+i[5]*l+i[13],u[3]=i[3]*s+i[7]*l+i[15],u}const vi=100;class Dr{constructor(e,i=new Ve(e.width+200,e.height+200,25),s=new Ve(e.width+200,e.height+200,25)){this.transform=e,this.grid=i,this.ignoredGrid=s,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+vi,this.screenBottomBoundary=e.height+vi,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,i,s,l,h,f,_,x,T,P,A,E){const F=this.projectAndGetPerspectiveRatio(e.anchorPointX+x[0],e.anchorPointY+x[1],h,P,E),O=s*F.perspectiveRatio;let H;if(f||_)H=this._projectCollisionBox(e,O,l,h,f,_,x,F,P,A,E);else{const se=F.x+(A?A.x*O:0),re=F.y+(A?A.y*O:0);H={allPointsOccluded:!1,box:[se+e.x1*O,re+e.y1*O,se+e.x2*O,re+e.y2*O]}}const[q,W,K,te]=H.box,ee=f?H.allPointsOccluded:F.isOccluded;let ie=ee;return ie||(ie=F.perspectiveRatio<this.perspectiveRatioCutoff),ie||(ie=!this.isInsideGrid(q,W,K,te)),ie||i!=="always"&&this.grid.hitTest(q,W,K,te,i,T)?{box:[q,W,K,te],placeable:!1,offscreen:!1,occluded:ee}:{box:[q,W,K,te],placeable:!0,offscreen:this.isOffscreen(q,W,K,te),occluded:ee}}placeCollisionCircles(e,i,s,l,h,f,_,x,T,P,A,E,F,O){const H=[],q=new o.P(i.anchorX,i.anchorY),W=this.getPerspectiveRatio(q.x,q.y,f,O),K=(T?h*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,f)/W:h*W)/o.ay,te={getElevation:O,pitchedLabelPlaneMatrix:_,lineVertexArray:s,pitchWithMap:T,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:q,unwrappedTileID:f,width:this.transform.width,height:this.transform.height,translation:F},ee=nt(K,l,i.lineOffsetX*K,i.lineOffsetY*K,!1,i,!1,te);let ie=!1,se=!1,re=!0;if(ee){const pe=.5*A*W+E,Me=new o.P(-100,-100),xe=new o.P(this.screenRightBoundary,this.screenBottomBoundary),ve=new Ae,be=ee.first,Ne=ee.last;let Oe=[];for(let gt=be.path.length-1;gt>=1;gt--)Oe.push(be.path[gt]);for(let gt=1;gt<Ne.path.length;gt++)Oe.push(Ne.path[gt]);const Re=2.5*pe;if(T){const gt=this.projectPathToScreenSpace(Oe,te);Oe=gt.some(Pt=>Pt.signedDistanceFromCamera<=0)?[]:gt.map(Pt=>Pt.point)}let He=[];if(Oe.length>0){const gt=Oe[0].clone(),Pt=Oe[0].clone();for(let ri=1;ri<Oe.length;ri++)gt.x=Math.min(gt.x,Oe[ri].x),gt.y=Math.min(gt.y,Oe[ri].y),Pt.x=Math.max(Pt.x,Oe[ri].x),Pt.y=Math.max(Pt.y,Oe[ri].y);He=gt.x>=Me.x&&Pt.x<=xe.x&&gt.y>=Me.y&&Pt.y<=xe.y?[Oe]:Pt.x<Me.x||gt.x>xe.x||Pt.y<Me.y||gt.y>xe.y?[]:o.av([Oe],Me.x,Me.y,xe.x,xe.y)}for(const gt of He){ve.reset(gt,.25*pe);let Pt=0;Pt=ve.length<=.5*pe?1:Math.ceil(ve.paddedLength/Re)+1;for(let ri=0;ri<Pt;ri++){const Ut=ri/Math.max(Pt-1,1),ni=ve.lerp(Ut),ai=ni.x+vi,Gt=ni.y+vi;H.push(ai,Gt,pe,0);const zt=ai-pe,Ai=Gt-pe,Bi=ai+pe,qi=Gt+pe;if(re=re&&this.isOffscreen(zt,Ai,Bi,qi),se=se||this.isInsideGrid(zt,Ai,Bi,qi),e!=="always"&&this.grid.hitTestCircle(ai,Gt,pe,e,P)&&(ie=!0,!x))return{circles:[],offscreen:!1,collisionDetected:ie}}}}return{circles:!x&&ie||!se||W<this.perspectiveRatioCutoff?[]:H,offscreen:re,collisionDetected:ie}}projectPathToScreenSpace(e,i){const s=function(l,h){const f=o.K();return o.an(f,h.pitchedLabelPlaneMatrix),l.map(_=>{const x=we(_.x,_.y,f,h.getElevation),T=h.transform.projectTileCoordinates(x.point.x,x.point.y,h.unwrappedTileID,h.getElevation);return T.point.x=(.5*T.point.x+.5)*h.width,T.point.y=(.5*-T.point.y+.5)*h.height,T})}(e,i);return function(l){let h=0,f=0,_=0,x=0;for(let T=0;T<l.length;T++)l[T].isOccluded?(_=T+1,x=0):(x++,x>f&&(f=x,h=_));return l.slice(h,h+f)}(s)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const i=[];let s=1/0,l=1/0,h=-1/0,f=-1/0;for(const P of e){const A=new o.P(P.x+vi,P.y+vi);s=Math.min(s,A.x),l=Math.min(l,A.y),h=Math.max(h,A.x),f=Math.max(f,A.y),i.push(A)}const _=this.grid.query(s,l,h,f).concat(this.ignoredGrid.query(s,l,h,f)),x={},T={};for(const P of _){const A=P.key;if(x[A.bucketInstanceId]===void 0&&(x[A.bucketInstanceId]={}),x[A.bucketInstanceId][A.featureIndex])continue;const E=[new o.P(P.x1,P.y1),new o.P(P.x2,P.y1),new o.P(P.x2,P.y2),new o.P(P.x1,P.y2)];o.aw(i,E)&&(x[A.bucketInstanceId][A.featureIndex]=!0,T[A.bucketInstanceId]===void 0&&(T[A.bucketInstanceId]=[]),T[A.bucketInstanceId].push(A.featureIndex))}return T}insertCollisionBox(e,i,s,l,h,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:l,featureIndex:h,collisionGroupID:f,overlapMode:i},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,i,s,l,h,f){const _=s?this.ignoredGrid:this.grid,x={bucketInstanceId:l,featureIndex:h,collisionGroupID:f,overlapMode:i};for(let T=0;T<e.length;T+=4)_.insertCircle(x,e[T],e[T+1],e[T+2])}projectAndGetPerspectiveRatio(e,i,s,l,h){if(h){let f;l?(f=[e,i,l(e,i),1],o.at(f,f,h)):(f=[e,i,0,1],ha(f,f,h));const _=f[3];return{x:(f[0]/_+1)/2*this.transform.width+vi,y:(-f[1]/_+1)/2*this.transform.height+vi,perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}{const f=this.transform.projectTileCoordinates(e,i,s,l);return{x:(f.point.x+1)/2*this.transform.width+vi,y:(1-f.point.y)/2*this.transform.height+vi,perspectiveRatio:.5+this.transform.cameraToCenterDistance/f.signedDistanceFromCamera*.5,isOccluded:f.isOccluded,signedDistanceFromCamera:f.signedDistanceFromCamera}}}getPerspectiveRatio(e,i,s,l){const h=this.transform.projectTileCoordinates(e,i,s,l);return .5+this.transform.cameraToCenterDistance/h.signedDistanceFromCamera*.5}isOffscreen(e,i,s,l){return s<vi||e>=this.screenRightBoundary||l<vi||i>this.screenBottomBoundary}isInsideGrid(e,i,s,l){return s>=0&&e<this.gridRightBoundary&&l>=0&&i<this.gridBottomBoundary}getViewportMatrix(){const e=o.ad([]);return o.L(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,s,l,h,f,_,x,T,P,A){let E=1,F=0,O=0,H=1;const q=e.anchorPointX+_[0],W=e.anchorPointY+_[1];if(f&&!h){const Oe=this.projectAndGetPerspectiveRatio(q+1,W,l,T,A),Re=Oe.x-x.x,He=Math.atan((Oe.y-x.y)/Re)+(Re<0?Math.PI:0),gt=Math.sin(He),Pt=Math.cos(He);E=Pt,F=gt,O=-gt,H=Pt}else if(!f&&h){const Oe=at(this.transform);E=Oe.vecEast[0],F=Oe.vecEast[1],O=Oe.vecSouth[0],H=Oe.vecSouth[1]}let K=x.x,te=x.y,ee=i;h&&(K=q,te=W,ee=Math.pow(2,-(this.transform.zoom-s.overscaledZ)),ee*=this.transform.getPitchedTextCorrection(q,W,l),P||(ee*=o.ae(.5+x.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),P&&(K+=E*P.x*ee+O*P.y*ee,te+=F*P.x*ee+H*P.y*ee);const ie=e.x1*ee,se=e.x2*ee,re=(ie+se)/2,pe=e.y1*ee,Me=e.y2*ee,xe=(pe+Me)/2,ve=[{offsetX:ie,offsetY:pe},{offsetX:re,offsetY:pe},{offsetX:se,offsetY:pe},{offsetX:se,offsetY:xe},{offsetX:se,offsetY:Me},{offsetX:re,offsetY:Me},{offsetX:ie,offsetY:Me},{offsetX:ie,offsetY:xe}];let be=[];for(const{offsetX:Oe,offsetY:Re}of ve)be.push(new o.P(K+E*Oe+O*Re,te+F*Oe+H*Re));let Ne=!1;if(h){const Oe=be.map(Re=>this.projectAndGetPerspectiveRatio(Re.x,Re.y,l,T,A));Ne=Oe.some(Re=>!Re.isOccluded),be=Oe.map(Re=>new o.P(Re.x,Re.y))}else Ne=!0;return{box:o.ax(be),allPointsOccluded:!Ne}}}class ei{constructor(e,i,s,l){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?i:-i))):l&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class Ps{constructor(e,i,s,l,h){this.text=new ei(e?e.text:null,i,s,h),this.icon=new ei(e?e.icon:null,i,l,h)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Za{constructor(e,i,s){this.text=e,this.icon=i,this.skipFade=s}}class Wl{constructor(e,i,s,l,h){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=s,this.bucketIndex=l,this.tileID=h}}class da{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const i=++this.maxGroupID;this.collisionGroups[e]={ID:i,predicate:s=>s.collisionGroupID===i}}return this.collisionGroups[e]}}function An(u,e,i,s,l){const{horizontalAlign:h,verticalAlign:f}=o.aE(u);return new o.P(-(h-.5)*e+s[0]*l,-(f-.5)*i+s[1]*l)}class Nu{constructor(e,i,s,l,h){this.transform=e.clone(),this.terrain=i,this.collisionIndex=new Dr(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new da(l),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=h,h&&(h.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const i=this.terrain;return i?(s,l)=>i.getElevation(e,s,l):null}getBucketParts(e,i,s,l){const h=s.getBucket(i),f=s.latestFeatureIndex;if(!h||!f||i.id!==h.layerIds[0])return;const _=s.collisionBoxArray,x=h.layers[0].layout,T=h.layers[0].paint,P=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),A=s.tileSize/o.Z,E=s.tileID.toUnwrapped(),F=x.get("text-rotation-alignment")==="map",O=o.az(s,1,this.transform.zoom),H=o.aA(this.collisionIndex.transform,s,T.get("text-translate"),T.get("text-translate-anchor")),q=o.aA(this.collisionIndex.transform,s,T.get("icon-translate"),T.get("icon-translate-anchor")),W=Qe(F,this.transform,O);this.retainedQueryData[h.bucketInstanceId]=new Wl(h.bucketInstanceId,f,h.sourceLayerIndex,h.index,s.tileID);const K={bucket:h,layout:x,translationText:H,translationIcon:q,unwrappedTileID:E,pitchedLabelPlaneMatrix:W,scale:P,textPixelRatio:A,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:o.ak(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(l)for(const te of h.sortKeyRanges){const{sortKey:ee,symbolInstanceStart:ie,symbolInstanceEnd:se}=te;e.push({sortKey:ee,symbolInstanceStart:ie,symbolInstanceEnd:se,parameters:K})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:K})}attemptAnchorPlacement(e,i,s,l,h,f,_,x,T,P,A,E,F,O,H,q,W,K,te,ee){const ie=o.aB[e.textAnchor],se=[e.textOffset0,e.textOffset1],re=An(ie,s,l,se,h),pe=this.collisionIndex.placeCollisionBox(i,E,x,T,P,_,f,q,A.predicate,te,re,ee);if((!K||this.collisionIndex.placeCollisionBox(K,E,x,T,P,_,f,W,A.predicate,te,re,ee).placeable)&&pe.placeable){let Me;if(this.prevPlacement&&this.prevPlacement.variableOffsets[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID].text&&(Me=this.prevPlacement.variableOffsets[F.crossTileID].anchor),F.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[F.crossTileID]={textOffset:se,width:s,height:l,anchor:ie,textBoxScale:h,prevAnchor:Me},this.markUsedJustification(O,ie,F,H),O.allowVerticalPlacement&&(this.markUsedOrientation(O,H,F),this.placedOrientations[F.crossTileID]=H),{shift:re,placedGlyphBoxes:pe}}}placeLayerBucketPart(e,i,s){const{bucket:l,layout:h,translationText:f,translationIcon:_,unwrappedTileID:x,pitchedLabelPlaneMatrix:T,textPixelRatio:P,holdingForFade:A,collisionBoxArray:E,partiallyEvaluatedTextSize:F,collisionGroup:O}=e.parameters,H=h.get("text-optional"),q=h.get("icon-optional"),W=o.aC(h,"text-overlap","text-allow-overlap"),K=W==="always",te=o.aC(h,"icon-overlap","icon-allow-overlap"),ee=te==="always",ie=h.get("text-rotation-alignment")==="map",se=h.get("text-pitch-alignment")==="map",re=h.get("icon-text-fit")!=="none",pe=h.get("symbol-z-order")==="viewport-y",Me=K&&(ee||!l.hasIconData()||q),xe=ee&&(K||!l.hasTextData()||H);!l.collisionArrays&&E&&l.deserializeCollisionBoxes(E);const ve=this.retainedQueryData[l.bucketInstanceId].tileID,be=this._getTerrainElevationFunc(ve),Ne=this.transform.getFastPathSimpleProjectionMatrix(ve),Oe=(Re,He,gt)=>{var Pt,ri;if(i[Re.crossTileID])return;if(A)return void(this.placements[Re.crossTileID]=new Za(!1,!1,!1));let Ut=!1,ni=!1,ai=!0,Gt=null,zt={box:null,placeable:!1,offscreen:null,occluded:!1},Ai={placeable:!1},Bi=null,qi=null,Rt=null,Kn=0,_n=0,Yn=0;He.textFeatureIndex?Kn=He.textFeatureIndex:Re.useRuntimeCollisionCircles&&(Kn=Re.featureIndex),He.verticalTextFeatureIndex&&(_n=He.verticalTextFeatureIndex);const Pa=He.textBox;if(Pa){const Fr=Mi=>{let Si=o.al.horizontal;if(l.allowVerticalPlacement&&!Mi&&this.prevPlacement){const fr=this.prevPlacement.placedOrientations[Re.crossTileID];fr&&(this.placedOrientations[Re.crossTileID]=fr,Si=fr,this.markUsedOrientation(l,Si,Re))}return Si},Qn=(Mi,Si)=>{if(l.allowVerticalPlacement&&Re.numVerticalGlyphVertices>0&&He.verticalTextBox){for(const fr of l.writingModes)if(fr===o.al.vertical?(zt=Si(),Ai=zt):zt=Mi(),zt&&zt.placeable)break}else zt=Mi()},Rn=Re.textAnchorOffsetStartIndex,ea=Re.textAnchorOffsetEndIndex;if(ea===Rn){const Mi=(Si,fr)=>{const Kt=this.collisionIndex.placeCollisionBox(Si,W,P,ve,x,se,ie,f,O.predicate,be,void 0,Ne);return Kt&&Kt.placeable&&(this.markUsedOrientation(l,fr,Re),this.placedOrientations[Re.crossTileID]=fr),Kt};Qn(()=>Mi(Pa,o.al.horizontal),()=>{const Si=He.verticalTextBox;return l.allowVerticalPlacement&&Re.numVerticalGlyphVertices>0&&Si?Mi(Si,o.al.vertical):{box:null,offscreen:null}}),Fr(zt&&zt.placeable)}else{let Mi=o.aB[(ri=(Pt=this.prevPlacement)===null||Pt===void 0?void 0:Pt.variableOffsets[Re.crossTileID])===null||ri===void 0?void 0:ri.anchor];const Si=(Kt,hl,kh)=>{const zh=Kt.x2-Kt.x1,Jd=Kt.y2-Kt.y1,Oc=Re.textBoxScale,no=re&&te==="never"?hl:null;let Hr=null,yn=W==="never"?1:2,Wr="never";Mi&&yn++;for(let Dn=0;Dn<yn;Dn++){for(let dl=Rn;dl<ea;dl++){const ta=l.textAnchorOffsets.get(dl);if(Mi&&ta.textAnchor!==Mi)continue;const jc=this.attemptAnchorPlacement(ta,Kt,zh,Jd,Oc,ie,se,P,ve,x,O,Wr,Re,l,kh,f,_,no,be);if(jc&&(Hr=jc.placedGlyphBoxes,Hr&&Hr.placeable))return Ut=!0,Gt=jc.shift,Hr}Mi?Mi=null:Wr=W}return s&&!Hr&&(Hr={box:this.collisionIndex.placeCollisionBox(Pa,"always",P,ve,x,se,ie,f,O.predicate,be,void 0,Ne).box,offscreen:!1,placeable:!1,occluded:!1}),Hr};Qn(()=>Si(Pa,He.iconBox,o.al.horizontal),()=>{const Kt=He.verticalTextBox;return l.allowVerticalPlacement&&(!zt||!zt.placeable)&&Re.numVerticalGlyphVertices>0&&Kt?Si(Kt,He.verticalIconBox,o.al.vertical):{box:null,occluded:!0,offscreen:null}}),zt&&(Ut=zt.placeable,ai=zt.offscreen);const fr=Fr(zt&&zt.placeable);if(!Ut&&this.prevPlacement){const Kt=this.prevPlacement.variableOffsets[Re.crossTileID];Kt&&(this.variableOffsets[Re.crossTileID]=Kt,this.markUsedJustification(l,Kt.anchor,Re,fr))}}}if(Bi=zt,Ut=Bi&&Bi.placeable,ai=Bi&&Bi.offscreen,Re.useRuntimeCollisionCircles){const Fr=l.text.placedSymbolArray.get(Re.centerJustifiedTextSymbolIndex),Qn=o.am(l.textSizeData,F,Fr),Rn=h.get("text-padding");qi=this.collisionIndex.placeCollisionCircles(W,Fr,l.lineVertexArray,l.glyphOffsetArray,Qn,x,T,s,se,O.predicate,Re.collisionCircleDiameter,Rn,f,be),qi.circles.length&&qi.collisionDetected&&!s&&o.w("Collisions detected, but collision boxes are not shown"),Ut=K||qi.circles.length>0&&!qi.collisionDetected,ai=ai&&qi.offscreen}if(He.iconFeatureIndex&&(Yn=He.iconFeatureIndex),He.iconBox){const Fr=Qn=>this.collisionIndex.placeCollisionBox(Qn,te,P,ve,x,se,ie,_,O.predicate,be,re&&Gt?Gt:void 0,Ne);Ai&&Ai.placeable&&He.verticalIconBox?(Rt=Fr(He.verticalIconBox),ni=Rt.placeable):(Rt=Fr(He.iconBox),ni=Rt.placeable),ai=ai&&Rt.offscreen}const ro=H||Re.numHorizontalGlyphVertices===0&&Re.numVerticalGlyphVertices===0,Jn=q||Re.numIconVertices===0;ro||Jn?Jn?ro||(ni=ni&&Ut):Ut=ni&&Ut:ni=Ut=ni&&Ut;const Ca=ni&&Rt.placeable;if(Ut&&Bi.placeable&&this.collisionIndex.insertCollisionBox(Bi.box,W,h.get("text-ignore-placement"),l.bucketInstanceId,Ai&&Ai.placeable&&_n?_n:Kn,O.ID),Ca&&this.collisionIndex.insertCollisionBox(Rt.box,te,h.get("icon-ignore-placement"),l.bucketInstanceId,Yn,O.ID),qi&&Ut&&this.collisionIndex.insertCollisionCircles(qi.circles,W,h.get("text-ignore-placement"),l.bucketInstanceId,Kn,O.ID),s&&this.storeCollisionData(l.bucketInstanceId,gt,He,Bi,Rt,qi),Re.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(l.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Re.crossTileID]=new Za((Ut||Me)&&!(Bi!=null&&Bi.occluded),(ni||xe)&&!(Rt!=null&&Rt.occluded),ai||l.justReloaded),i[Re.crossTileID]=!0};if(pe){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Re=l.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let He=Re.length-1;He>=0;--He){const gt=Re[He];Oe(l.symbolInstances.get(gt),l.collisionArrays[gt],gt)}}else for(let Re=e.symbolInstanceStart;Re<e.symbolInstanceEnd;Re++)Oe(l.symbolInstances.get(Re),l.collisionArrays[Re],Re);l.justReloaded=!1}storeCollisionData(e,i,s,l,h,f){if(s.textBox||s.iconBox){let _,x;this.collisionBoxArrays.has(e)?_=this.collisionBoxArrays.get(e):(_=new Map,this.collisionBoxArrays.set(e,_)),_.has(i)?x=_.get(i):(x={text:null,icon:null},_.set(i,x)),s.textBox&&(x.text=l.box),s.iconBox&&(x.icon=h.box)}if(f){let _=this.collisionCircleArrays[e];_===void 0&&(_=this.collisionCircleArrays[e]=[]);for(let x=0;x<f.circles.length;x+=4)_.push(f.circles[x+0]-vi),_.push(f.circles[x+1]-vi),_.push(f.circles[x+2]),_.push(f.collisionDetected?1:0)}}markUsedJustification(e,i,s,l){let h;h=l===o.al.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[o.aD(i)];const f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const _ of f)_>=0&&(e.text.placedSymbolArray.get(_).crossTileID=h>=0&&_!==h?0:s.crossTileID)}markUsedOrientation(e,i,s){const l=i===o.al.horizontal||i===o.al.horizontalOnly?i:0,h=i===o.al.vertical?i:0,f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of f)e.text.placedSymbolArray.get(_).placedOrientation=l;s.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=h)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const i=this.prevPlacement;let s=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;const l=i?i.symbolFadeChange(e):1,h=i?i.opacities:{},f=i?i.variableOffsets:{},_=i?i.placedOrientations:{};for(const x in this.placements){const T=this.placements[x],P=h[x];P?(this.opacities[x]=new Ps(P,l,T.text,T.icon),s=s||T.text!==P.text.placed||T.icon!==P.icon.placed):(this.opacities[x]=new Ps(null,l,T.text,T.icon,T.skipFade),s=s||T.text||T.icon)}for(const x in h){const T=h[x];if(!this.opacities[x]){const P=new Ps(T,l,!1,!1);P.isHidden()||(this.opacities[x]=P,s=s||T.text.placed||T.icon.placed)}}for(const x in f)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=f[x]);for(const x in _)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=_[x]);if(i&&i.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:e)}updateLayerOpacities(e,i){const s={};for(const l of i){const h=l.getBucket(e);h&&l.latestFeatureIndex&&e.id===h.layerIds[0]&&this.updateBucketOpacities(h,l.tileID,s,l.collisionBoxArray)}}updateBucketOpacities(e,i,s,l){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const h=e.layers[0],f=h.layout,_=new Ps(null,0,!1,!1,!0),x=f.get("text-allow-overlap"),T=f.get("icon-allow-overlap"),P=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),A=f.get("text-rotation-alignment")==="map",E=f.get("text-pitch-alignment")==="map",F=f.get("icon-text-fit")!=="none",O=new Ps(null,0,x&&(T||!e.hasIconData()||f.get("icon-optional")),T&&(x||!e.hasTextData()||f.get("text-optional")),!0);!e.collisionArrays&&l&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(l);const H=(W,K,te)=>{for(let ee=0;ee<K/4;ee++)W.opacityVertexArray.emplaceBack(te);W.hasVisibleVertices=W.hasVisibleVertices||te!==pa},q=this.collisionBoxArrays.get(e.bucketInstanceId);for(let W=0;W<e.symbolInstances.length;W++){const K=e.symbolInstances.get(W),{numHorizontalGlyphVertices:te,numVerticalGlyphVertices:ee,crossTileID:ie}=K;let se=this.opacities[ie];s[ie]?se=_:se||(se=O,this.opacities[ie]=se),s[ie]=!0;const re=K.numIconVertices>0,pe=this.placedOrientations[K.crossTileID],Me=pe===o.al.vertical,xe=pe===o.al.horizontal||pe===o.al.horizontalOnly;if(te>0||ee>0){const be=Kl(se.text);H(e.text,te,Me?pa:be),H(e.text,ee,xe?pa:be);const Ne=se.text.isHidden();[K.rightJustifiedTextSymbolIndex,K.centerJustifiedTextSymbolIndex,K.leftJustifiedTextSymbolIndex].forEach(He=>{He>=0&&(e.text.placedSymbolArray.get(He).hidden=Ne||Me?1:0)}),K.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(K.verticalPlacedTextSymbolIndex).hidden=Ne||xe?1:0);const Oe=this.variableOffsets[K.crossTileID];Oe&&this.markUsedJustification(e,Oe.anchor,K,pe);const Re=this.placedOrientations[K.crossTileID];Re&&(this.markUsedJustification(e,"left",K,Re),this.markUsedOrientation(e,Re,K))}if(re){const be=Kl(se.icon),Ne=!(F&&K.verticalPlacedIconSymbolIndex&&Me);K.placedIconSymbolIndex>=0&&(H(e.icon,K.numIconVertices,Ne?be:pa),e.icon.placedSymbolArray.get(K.placedIconSymbolIndex).hidden=se.icon.isHidden()),K.verticalPlacedIconSymbolIndex>=0&&(H(e.icon,K.numVerticalIconVertices,Ne?pa:be),e.icon.placedSymbolArray.get(K.verticalPlacedIconSymbolIndex).hidden=se.icon.isHidden())}const ve=q&&q.has(W)?q.get(W):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const be=e.collisionArrays[W];if(be){let Ne=new o.P(0,0);if(be.textBox||be.verticalTextBox){let Oe=!0;if(P){const Re=this.variableOffsets[ie];Re?(Ne=An(Re.anchor,Re.width,Re.height,Re.textOffset,Re.textBoxScale),A&&Ne._rotate(E?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Oe=!1}if(be.textBox||be.verticalTextBox){let Re;be.textBox&&(Re=Me),be.verticalTextBox&&(Re=xe),Xl(e.textCollisionBox.collisionVertexArray,se.text.placed,!Oe||Re,ve.text,Ne.x,Ne.y)}}if(be.iconBox||be.verticalIconBox){const Oe=!!(!xe&&be.verticalIconBox);let Re;be.iconBox&&(Re=Oe),be.verticalIconBox&&(Re=!Oe),Xl(e.iconCollisionBox.collisionVertexArray,se.icon.placed,Re,ve.icon,F?Ne.x:0,F?Ne.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,i){const s=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*s>e}setStale(){this.stale=!0}}function Xl(u,e,i,s,l,h){s&&s.length!==0||(s=[0,0,0,0]);const f=s[0]-vi,_=s[1]-vi,x=s[2]-vi,T=s[3]-vi;u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,x,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,x,T),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,T)}const Zu=Math.pow(2,25),Va=Math.pow(2,24),Vu=Math.pow(2,17),Sd=Math.pow(2,16),Pd=Math.pow(2,9),Cd=Math.pow(2,8),Uu=Math.pow(2,1);function Kl(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const e=u.placed?1:0,i=Math.floor(127*u.opacity);return i*Zu+e*Va+i*Vu+e*Sd+i*Pd+e*Cd+i*Uu+e}const pa=0;class Yl{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,i,s,l,h){const f=this._bucketParts;for(;this._currentTileIndex<e.length;)if(i.getBucketParts(f,l,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,h())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,f.sort((_,x)=>_.sortKey-x.sortKey));this._currentPartIndex<f.length;)if(i.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,h())return!0;return!1}}class $u{constructor(e,i,s,l,h,f,_,x){this.placement=new Nu(e,i,f,_,x),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=l,this._showCollisionBoxes=h,this._done=!1}isDone(){return this._done}continuePlacement(e,i,s){const l=Ee.now(),h=()=>!this._forceFullPlacement&&Ee.now()-l>2;for(;this._currentPlacementIndex>=0;){const f=i[e[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=_)&&(!f.maxzoom||f.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new Yl(f)),this._inProgressLayer.continuePlacement(s[f.source],this.placement,this._showCollisionBoxes,f,h))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const fa=512/o.Z/2;class Jl{constructor(e,i,s){this.tileID=e,this.bucketInstanceId=s,this._symbolsByKey={};const l=new Map;for(let h=0;h<i.length;h++){const f=i.get(h),_=f.key,x=l.get(_);x?x.push(f):l.set(_,[f])}for(const[h,f]of l){const _={positions:f.map(x=>({x:Math.floor(x.anchorX*fa),y:Math.floor(x.anchorY*fa)})),crossTileIDs:f.map(x=>x.crossTileID)};if(_.positions.length>128){const x=new o.aF(_.positions.length,16,Uint16Array);for(const{x:T,y:P}of _.positions)x.add(T,P);x.finish(),delete _.positions,_.index=x}this._symbolsByKey[h]=_}}getScaledCoordinates(e,i){const{x:s,y:l,z:h}=this.tileID.canonical,{x:f,y:_,z:x}=i.canonical,T=fa/Math.pow(2,x-h),P=(_*o.Z+e.anchorY)*T,A=l*o.Z*fa;return{x:Math.floor((f*o.Z+e.anchorX)*T-s*o.Z*fa),y:Math.floor(P-A)}}findMatches(e,i,s){const l=this.tileID.canonical.z<i.canonical.z?1:Math.pow(2,this.tileID.canonical.z-i.canonical.z);for(let h=0;h<e.length;h++){const f=e.get(h);if(f.crossTileID)continue;const _=this._symbolsByKey[f.key];if(!_)continue;const x=this.getScaledCoordinates(f,i);if(_.index){const T=_.index.range(x.x-l,x.y-l,x.x+l,x.y+l).sort();for(const P of T){const A=_.crossTileIDs[P];if(!s[A]){s[A]=!0,f.crossTileID=A;break}}}else if(_.positions)for(let T=0;T<_.positions.length;T++){const P=_.positions[T],A=_.crossTileIDs[T];if(Math.abs(P.x-x.x)<=l&&Math.abs(P.y-x.y)<=l&&!s[A]){s[A]=!0,f.crossTileID=A;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class Id{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Cs{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const i=Math.round((e-this.lng)/360);if(i!==0)for(const s in this.indexes){const l=this.indexes[s],h={};for(const f in l){const _=l[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+i),h[_.tileID.key]=_}this.indexes[s]=h}this.lng=e}addBucket(e,i,s){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let h=0;h<i.symbolInstances.length;h++)i.symbolInstances.get(h).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const l=this.usedCrossTileIDs[e.overscaledZ];for(const h in this.indexes){const f=this.indexes[h];if(Number(h)>e.overscaledZ)for(const _ in f){const x=f[_];x.tileID.isChildOf(e)&&x.findMatches(i.symbolInstances,e,l)}else{const _=f[e.scaledTo(Number(h)).key];_&&_.findMatches(i.symbolInstances,e,l)}}for(let h=0;h<i.symbolInstances.length;h++){const f=i.symbolInstances.get(h);f.crossTileID||(f.crossTileID=s.generate(),l[f.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Jl(e,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(e,i){for(const s of i.getCrossTileIDsLists())for(const l of s)delete this.usedCrossTileIDs[e][l]}removeStaleBuckets(e){let i=!1;for(const s in this.indexes){const l=this.indexes[s];for(const h in l)e[l[h].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,l[h]),delete l[h],i=!0)}return i}}class Is{constructor(){this.layerIndexes={},this.crossTileIDs=new Id,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,s){let l=this.layerIndexes[e.id];l===void 0&&(l=this.layerIndexes[e.id]=new Cs);let h=!1;const f={};l.handleWrapJump(s);for(const _ of i){const x=_.getBucket(e);x&&e.id===x.layerIds[0]&&(x.bucketInstanceId||(x.bucketInstanceId=++this.maxBucketInstanceId),l.addBucket(_.tileID,x,this.crossTileIDs)&&(h=!0),f[x.bucketInstanceId]=!0)}return l.removeStaleBuckets(f)&&(h=!0),h}pruneUnusedLayers(e){const i={};e.forEach(s=>{i[s]=!0});for(const s in this.layerIndexes)i[s]||delete this.layerIndexes[s]}}var Ql="void main() {fragColor=vec4(1.0);}";const ur={prelude:Ct(`#ifdef GL_ES
7
7
  precision mediump float;
8
8
  #else
9
9
  #if !defined(lowp)
@@ -739,4 +739,4 @@ uniform ${P} ${A} u_${E};
739
739
  `),se=ee.concat(ur.prelude.vertexSource,_.vertexSource,i.vertexSource).join(`
740
740
  `);er(P)||(ie=function(xe){return xe.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(ie),se=function(xe){return xe.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(se));const re=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(re,ie),P.compileShader(re),!P.getShaderParameter(re,P.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${P.getShaderInfoLog(re)}`);P.attachShader(this.program,re);const pe=P.createShader(P.VERTEX_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(pe,se),P.compileShader(pe),!P.getShaderParameter(pe,P.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${P.getShaderInfoLog(pe)}`);P.attachShader(this.program,pe),this.attributes={};const Me={};this.numAttributes=F.length;for(let xe=0;xe<this.numAttributes;xe++)F[xe]&&(P.bindAttribLocation(this.program,xe,F[xe]),this.attributes[F[xe]]=xe);if(P.linkProgram(this.program),!P.getProgramParameter(this.program,P.LINK_STATUS))throw new Error(`Program failed to link: ${P.getProgramInfoLog(this.program)}`);P.deleteShader(pe),P.deleteShader(re);for(let xe=0;xe<te.length;xe++){const ve=te[xe];if(ve&&!Me[ve]){const be=P.getUniformLocation(this.program,ve);be&&(Me[ve]=be)}}this.fixedUniforms=l(e,Me),this.terrainUniforms=((xe,ve)=>({u_depth:new o.bH(xe,ve.u_depth),u_terrain:new o.bH(xe,ve.u_terrain),u_terrain_dim:new o.b8(xe,ve.u_terrain_dim),u_terrain_matrix:new o.bJ(xe,ve.u_terrain_matrix),u_terrain_unpack:new o.bK(xe,ve.u_terrain_unpack),u_terrain_exaggeration:new o.b8(xe,ve.u_terrain_exaggeration)}))(e,Me),this.projectionUniforms=((xe,ve)=>({u_projection_matrix:new o.bJ(xe,ve.u_projection_matrix),u_projection_tile_mercator_coords:new o.bK(xe,ve.u_projection_tile_mercator_coords),u_projection_clipping_plane:new o.bK(xe,ve.u_projection_clipping_plane),u_projection_transition:new o.b8(xe,ve.u_projection_transition),u_projection_fallback_matrix:new o.bJ(xe,ve.u_projection_fallback_matrix)}))(e,Me),this.binderUniforms=s?s.getUniforms(e,Me):[]}draw(e,i,s,l,h,f,_,x,T,P,A,E,F,O,H,q,W,K,te){const ee=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(s),e.setStencilMode(l),e.setColorMode(h),e.setCullFace(f),x){e.activeTexture.set(ee.TEXTURE2),ee.bindTexture(ee.TEXTURE_2D,x.depthTexture),e.activeTexture.set(ee.TEXTURE3),ee.bindTexture(ee.TEXTURE_2D,x.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(x[se])}if(T)for(const se in T)this.projectionUniforms[zo[se]].set(T[se]);if(_)for(const se in this.fixedUniforms)this.fixedUniforms[se].set(_[se]);q&&q.setUniforms(e,this.binderUniforms,O,{zoom:H});let ie=0;switch(i){case ee.LINES:ie=2;break;case ee.TRIANGLES:ie=3;break;case ee.LINE_STRIP:ie=1}for(const se of F.get()){const re=se.vaos||(se.vaos={});(re[P]||(re[P]=new zd)).bind(e,this,A,q?q.getPaintVertexBuffers():[],E,se.vertexOffset,W,K,te),ee.drawElements(i,se.primitiveLength*ie,ee.UNSIGNED_SHORT,se.primitiveOffset*ie*2)}}}function Do(u,e,i){const s=1/o.az(i,1,e.transform.tileZoom),l=Math.pow(2,i.tileID.overscaledZ),h=i.tileSize*Math.pow(2,e.transform.tileZoom)/l,f=h*(i.tileID.canonical.x+i.tileID.wrap*l),_=h*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[s,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const Lo=(u,e,i,s)=>{const l=u.style.light,h=l.properties.get("position"),f=[h.x,h.y,h.z],_=o.bN();l.properties.get("anchor")==="viewport"&&o.bO(_,u.transform.bearingInRadians),o.bP(f,f,_);const x=u.transform.transformLightDirection(f),T=l.properties.get("color");return{u_lightpos:f,u_lightpos_globe:x,u_lightintensity:l.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+e,u_opacity:i,u_fill_translate:s}},fn=(u,e,i,s,l,h,f)=>o.e(Lo(u,e,i,s),Do(h,u,f),{u_height_factor:-Math.pow(2,l.overscaledZ)/f.tileSize/8}),qu=(u,e,i,s)=>o.e(Do(e,u,i),{u_fill_translate:s}),nc=(u,e)=>({u_world:u,u_fill_translate:e}),Os=(u,e,i,s,l)=>o.e(qu(u,e,i,l),{u_world:s}),js=(u,e,i,s,l)=>{const h=u.transform;let f,_,x=0;if(i.paint.get("circle-pitch-alignment")==="map"){const T=o.az(e,1,h.zoom);f=!0,_=[T,T],x=T/(o.Z*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*l}else f=!1,_=h.pixelsToGLUnits;return{u_camera_to_center_distance:h.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+f,u_device_pixel_ratio:u.pixelRatio,u_extrude_scale:_,u_globe_extrude_scale:x,u_translate:s}},Dd=u=>({u_pixel_extrude_scale:[1/u.width,1/u.height]}),Bo=u=>({u_viewport_size:[u.width,u.height]}),Hu=(u,e=1)=>({u_color:u,u_overlay:0,u_overlay_scale:e}),va=(u,e,i,s)=>{const l=o.az(u,1,e)/(o.Z*Math.pow(2,u.tileID.overscaledZ))*2*Math.PI*s;return{u_extrude_scale:o.az(u,1,e),u_intensity:i,u_globe_extrude_scale:l}},Wu=(u,e,i,s)=>{const l=o.K();o.bQ(l,0,u.width,u.height,0,0,1);const h=u.context.gl;return{u_matrix:l,u_world:[h.drawingBufferWidth,h.drawingBufferHeight],u_image:i,u_color_ramp:s,u_opacity:e.paint.get("heatmap-opacity")}},Xu=(u,e,i)=>{const s=i.paint.get("hillshade-accent-color");let l;switch(i.paint.get("hillshade-method")){case"basic":l=4;break;case"combined":l=1;break;case"igor":l=2;break;case"multidirectional":l=3;break;default:l=0}const h=i.getIlluminationProperties();for(let f=0;f<h.directionRadians.length;f++)i.paint.get("hillshade-illumination-anchor")==="viewport"&&(h.directionRadians[f]+=u.transform.bearingInRadians);return{u_image:0,u_latrange:Ku(0,e.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:h.altitudeRadians,u_azimuths:h.directionRadians,u_accent:s,u_method:l,u_highlights:h.highlightColor,u_shadows:h.shadowColor}},Ld=(u,e)=>{const i=e.stride,s=o.K();return o.bQ(s,0,o.Z,-8192,0,0,1),o.L(s,s,[0,-8192,0]),{u_matrix:s,u_image:1,u_dimension:[i,i],u_zoom:u.overscaledZ,u_unpack:e.getUnpackVector()}};function Ku(u,e){const i=Math.pow(2,e.canonical.z),s=e.canonical.y;return[new o.$(0,s/i).toLngLat().lat,new o.$(0,(s+1)/i).toLngLat().lat]}const Ns=(u,e,i,s)=>{const l=u.transform;return{u_translation:Wn(u,e,i),u_ratio:s/o.az(e,1,l.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]]}},Yu=(u,e,i,s,l)=>o.e(Ns(u,e,i,s),{u_image:0,u_image_height:l}),Ju=(u,e,i,s,l)=>{const h=u.transform,f=ac(e,h);return{u_translation:Wn(u,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:s/o.az(e,1,h.zoom),u_device_pixel_ratio:u.pixelRatio,u_image:0,u_scale:[f,l.fromScale,l.toScale],u_fade:l.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},Qu=(u,e,i,s,l,h)=>{const f=u.lineAtlas,_=ac(e,u.transform),x=i.layout.get("line-cap")==="round",T=f.getDash(l.from,x),P=f.getDash(l.to,x),A=T.width*h.fromScale,E=P.width*h.toScale;return o.e(Ns(u,e,i,s),{u_patternscale_a:[_/A,-T.height/2],u_patternscale_b:[_/E,-P.height/2],u_sdfgamma:f.width/(256*Math.min(A,E)*u.pixelRatio)/2,u_image:0,u_tex_y_a:T.y,u_tex_y_b:P.y,u_mix:h.t})};function ac(u,e){return 1/o.az(u,1,e.tileZoom)}function Wn(u,e,i){return o.aA(u.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const eh=(u,e,i,s,l)=>{return{u_tl_parent:u,u_scale_parent:e,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*s.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:s.paint.get("raster-brightness-min"),u_brightness_high:s.paint.get("raster-brightness-max"),u_saturation_factor:(f=s.paint.get("raster-saturation"),f>0?1-1/(1.001-f):-f),u_contrast_factor:(h=s.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:th(s.paint.get("raster-hue-rotate")),u_coords_top:[l[0].x,l[0].y,l[1].x,l[1].y],u_coords_bottom:[l[3].x,l[3].y,l[2].x,l[2].y]};var h,f};function th(u){u*=Math.PI/180;const e=Math.sin(u),i=Math.cos(u);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const Xa=(u,e,i,s,l,h,f,_,x,T,P,A,E)=>{const F=f.transform;return{u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:F.cameraToCenterDistance,u_pitch:F.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:F.width/F.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:x,u_is_text:+P,u_pitch_with_map:+s,u_is_along_line:l,u_is_variable_anchor:h,u_texsize:A,u_texture:0,u_translation:T,u_pitched_scale:E}},ih=(u,e,i,s,l,h,f,_,x,T,P,A,E,F)=>{const O=f.transform;return o.e(Xa(u,e,i,s,l,h,f,_,x,T,P,A,F),{u_gamma_scale:s?Math.cos(O.pitch*Math.PI/180)*O.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:1})},Fo=(u,e,i,s,l,h,f,_,x,T,P,A,E)=>o.e(ih(u,e,i,s,l,h,f,_,x,T,!0,P,0,E),{u_texsize_icon:A,u_texture_icon:1}),Bd=(u,e)=>({u_opacity:u,u_color:e}),Fd=(u,e,i,s,l)=>o.e(function(h,f,_,x){const T=_.imageManager.getPattern(h.from.toString()),P=_.imageManager.getPattern(h.to.toString()),{width:A,height:E}=_.imageManager.getPixelSize(),F=Math.pow(2,x.tileID.overscaledZ),O=x.tileSize*Math.pow(2,_.transform.tileZoom)/F,H=O*(x.tileID.canonical.x+x.tileID.wrap*F),q=O*x.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:P.tl,u_pattern_br_b:P.br,u_texsize:[A,E],u_mix:f.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:P.displaySize,u_scale_a:f.fromScale,u_scale_b:f.toScale,u_tile_units_to_pixels:1/o.az(x,1,_.transform.tileZoom),u_pixel_coord_upper:[H>>16,q>>16],u_pixel_coord_lower:[65535&H,65535&q]}}(i,l,e,s),{u_opacity:u}),sc=(u,e)=>{},rh={fillExtrusion:(u,e)=>({u_lightpos:new o.bL(u,e.u_lightpos),u_lightpos_globe:new o.bL(u,e.u_lightpos_globe),u_lightintensity:new o.b8(u,e.u_lightintensity),u_lightcolor:new o.bL(u,e.u_lightcolor),u_vertical_gradient:new o.b8(u,e.u_vertical_gradient),u_opacity:new o.b8(u,e.u_opacity),u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillExtrusionPattern:(u,e)=>({u_lightpos:new o.bL(u,e.u_lightpos),u_lightpos_globe:new o.bL(u,e.u_lightpos_globe),u_lightintensity:new o.b8(u,e.u_lightintensity),u_lightcolor:new o.bL(u,e.u_lightcolor),u_vertical_gradient:new o.b8(u,e.u_vertical_gradient),u_height_factor:new o.b8(u,e.u_height_factor),u_opacity:new o.b8(u,e.u_opacity),u_fill_translate:new o.bM(u,e.u_fill_translate),u_image:new o.bH(u,e.u_image),u_texsize:new o.bM(u,e.u_texsize),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade)}),fill:(u,e)=>({u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillPattern:(u,e)=>({u_image:new o.bH(u,e.u_image),u_texsize:new o.bM(u,e.u_texsize),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade),u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillOutline:(u,e)=>({u_world:new o.bM(u,e.u_world),u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillOutlinePattern:(u,e)=>({u_world:new o.bM(u,e.u_world),u_image:new o.bH(u,e.u_image),u_texsize:new o.bM(u,e.u_texsize),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade),u_fill_translate:new o.bM(u,e.u_fill_translate)}),circle:(u,e)=>({u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_scale_with_map:new o.bH(u,e.u_scale_with_map),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_extrude_scale:new o.bM(u,e.u_extrude_scale),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_globe_extrude_scale:new o.b8(u,e.u_globe_extrude_scale),u_translate:new o.bM(u,e.u_translate)}),collisionBox:(u,e)=>({u_pixel_extrude_scale:new o.bM(u,e.u_pixel_extrude_scale)}),collisionCircle:(u,e)=>({u_viewport_size:new o.bM(u,e.u_viewport_size)}),debug:(u,e)=>({u_color:new o.bI(u,e.u_color),u_overlay:new o.bH(u,e.u_overlay),u_overlay_scale:new o.b8(u,e.u_overlay_scale)}),depth:sc,clippingMask:sc,heatmap:(u,e)=>({u_extrude_scale:new o.b8(u,e.u_extrude_scale),u_intensity:new o.b8(u,e.u_intensity),u_globe_extrude_scale:new o.b8(u,e.u_globe_extrude_scale)}),heatmapTexture:(u,e)=>({u_matrix:new o.bJ(u,e.u_matrix),u_world:new o.bM(u,e.u_world),u_image:new o.bH(u,e.u_image),u_color_ramp:new o.bH(u,e.u_color_ramp),u_opacity:new o.b8(u,e.u_opacity)}),hillshade:(u,e)=>({u_image:new o.bH(u,e.u_image),u_latrange:new o.bM(u,e.u_latrange),u_exaggeration:new o.b8(u,e.u_exaggeration),u_altitudes:new o.bS(u,e.u_altitudes),u_azimuths:new o.bS(u,e.u_azimuths),u_accent:new o.bI(u,e.u_accent),u_method:new o.bH(u,e.u_method),u_shadows:new o.bR(u,e.u_shadows),u_highlights:new o.bR(u,e.u_highlights)}),hillshadePrepare:(u,e)=>({u_matrix:new o.bJ(u,e.u_matrix),u_image:new o.bH(u,e.u_image),u_dimension:new o.bM(u,e.u_dimension),u_zoom:new o.b8(u,e.u_zoom),u_unpack:new o.bK(u,e.u_unpack)}),line:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels)}),lineGradient:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels),u_image:new o.bH(u,e.u_image),u_image_height:new o.b8(u,e.u_image_height)}),linePattern:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_texsize:new o.bM(u,e.u_texsize),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_image:new o.bH(u,e.u_image),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade)}),lineSDF:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels),u_patternscale_a:new o.bM(u,e.u_patternscale_a),u_patternscale_b:new o.bM(u,e.u_patternscale_b),u_sdfgamma:new o.b8(u,e.u_sdfgamma),u_image:new o.bH(u,e.u_image),u_tex_y_a:new o.b8(u,e.u_tex_y_a),u_tex_y_b:new o.b8(u,e.u_tex_y_b),u_mix:new o.b8(u,e.u_mix)}),raster:(u,e)=>({u_tl_parent:new o.bM(u,e.u_tl_parent),u_scale_parent:new o.b8(u,e.u_scale_parent),u_buffer_scale:new o.b8(u,e.u_buffer_scale),u_fade_t:new o.b8(u,e.u_fade_t),u_opacity:new o.b8(u,e.u_opacity),u_image0:new o.bH(u,e.u_image0),u_image1:new o.bH(u,e.u_image1),u_brightness_low:new o.b8(u,e.u_brightness_low),u_brightness_high:new o.b8(u,e.u_brightness_high),u_saturation_factor:new o.b8(u,e.u_saturation_factor),u_contrast_factor:new o.b8(u,e.u_contrast_factor),u_spin_weights:new o.bL(u,e.u_spin_weights),u_coords_top:new o.bK(u,e.u_coords_top),u_coords_bottom:new o.bK(u,e.u_coords_bottom)}),symbolIcon:(u,e)=>({u_is_size_zoom_constant:new o.bH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bH(u,e.u_is_size_feature_constant),u_size_t:new o.b8(u,e.u_size_t),u_size:new o.b8(u,e.u_size),u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_pitch:new o.b8(u,e.u_pitch),u_rotate_symbol:new o.bH(u,e.u_rotate_symbol),u_aspect_ratio:new o.b8(u,e.u_aspect_ratio),u_fade_change:new o.b8(u,e.u_fade_change),u_label_plane_matrix:new o.bJ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bJ(u,e.u_coord_matrix),u_is_text:new o.bH(u,e.u_is_text),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_is_along_line:new o.bH(u,e.u_is_along_line),u_is_variable_anchor:new o.bH(u,e.u_is_variable_anchor),u_texsize:new o.bM(u,e.u_texsize),u_texture:new o.bH(u,e.u_texture),u_translation:new o.bM(u,e.u_translation),u_pitched_scale:new o.b8(u,e.u_pitched_scale)}),symbolSDF:(u,e)=>({u_is_size_zoom_constant:new o.bH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bH(u,e.u_is_size_feature_constant),u_size_t:new o.b8(u,e.u_size_t),u_size:new o.b8(u,e.u_size),u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_pitch:new o.b8(u,e.u_pitch),u_rotate_symbol:new o.bH(u,e.u_rotate_symbol),u_aspect_ratio:new o.b8(u,e.u_aspect_ratio),u_fade_change:new o.b8(u,e.u_fade_change),u_label_plane_matrix:new o.bJ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bJ(u,e.u_coord_matrix),u_is_text:new o.bH(u,e.u_is_text),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_is_along_line:new o.bH(u,e.u_is_along_line),u_is_variable_anchor:new o.bH(u,e.u_is_variable_anchor),u_texsize:new o.bM(u,e.u_texsize),u_texture:new o.bH(u,e.u_texture),u_gamma_scale:new o.b8(u,e.u_gamma_scale),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_is_halo:new o.bH(u,e.u_is_halo),u_translation:new o.bM(u,e.u_translation),u_pitched_scale:new o.b8(u,e.u_pitched_scale)}),symbolTextAndIcon:(u,e)=>({u_is_size_zoom_constant:new o.bH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bH(u,e.u_is_size_feature_constant),u_size_t:new o.b8(u,e.u_size_t),u_size:new o.b8(u,e.u_size),u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_pitch:new o.b8(u,e.u_pitch),u_rotate_symbol:new o.bH(u,e.u_rotate_symbol),u_aspect_ratio:new o.b8(u,e.u_aspect_ratio),u_fade_change:new o.b8(u,e.u_fade_change),u_label_plane_matrix:new o.bJ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bJ(u,e.u_coord_matrix),u_is_text:new o.bH(u,e.u_is_text),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_is_along_line:new o.bH(u,e.u_is_along_line),u_is_variable_anchor:new o.bH(u,e.u_is_variable_anchor),u_texsize:new o.bM(u,e.u_texsize),u_texsize_icon:new o.bM(u,e.u_texsize_icon),u_texture:new o.bH(u,e.u_texture),u_texture_icon:new o.bH(u,e.u_texture_icon),u_gamma_scale:new o.b8(u,e.u_gamma_scale),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_is_halo:new o.bH(u,e.u_is_halo),u_translation:new o.bM(u,e.u_translation),u_pitched_scale:new o.b8(u,e.u_pitched_scale)}),background:(u,e)=>({u_opacity:new o.b8(u,e.u_opacity),u_color:new o.bI(u,e.u_color)}),backgroundPattern:(u,e)=>({u_opacity:new o.b8(u,e.u_opacity),u_image:new o.bH(u,e.u_image),u_pattern_tl_a:new o.bM(u,e.u_pattern_tl_a),u_pattern_br_a:new o.bM(u,e.u_pattern_br_a),u_pattern_tl_b:new o.bM(u,e.u_pattern_tl_b),u_pattern_br_b:new o.bM(u,e.u_pattern_br_b),u_texsize:new o.bM(u,e.u_texsize),u_mix:new o.b8(u,e.u_mix),u_pattern_size_a:new o.bM(u,e.u_pattern_size_a),u_pattern_size_b:new o.bM(u,e.u_pattern_size_b),u_scale_a:new o.b8(u,e.u_scale_a),u_scale_b:new o.b8(u,e.u_scale_b),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_tile_units_to_pixels:new o.b8(u,e.u_tile_units_to_pixels)}),terrain:(u,e)=>({u_texture:new o.bH(u,e.u_texture),u_ele_delta:new o.b8(u,e.u_ele_delta),u_fog_matrix:new o.bJ(u,e.u_fog_matrix),u_fog_color:new o.bI(u,e.u_fog_color),u_fog_ground_blend:new o.b8(u,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new o.b8(u,e.u_fog_ground_blend_opacity),u_horizon_color:new o.bI(u,e.u_horizon_color),u_horizon_fog_blend:new o.b8(u,e.u_horizon_fog_blend),u_is_globe_mode:new o.b8(u,e.u_is_globe_mode)}),terrainDepth:(u,e)=>({u_ele_delta:new o.b8(u,e.u_ele_delta)}),terrainCoords:(u,e)=>({u_texture:new o.bH(u,e.u_texture),u_terrain_coords_id:new o.b8(u,e.u_terrain_coords_id),u_ele_delta:new o.b8(u,e.u_ele_delta)}),projectionErrorMeasurement:(u,e)=>({u_input:new o.b8(u,e.u_input),u_output_expected:new o.b8(u,e.u_output_expected)}),atmosphere:(u,e)=>({u_sun_pos:new o.bL(u,e.u_sun_pos),u_atmosphere_blend:new o.b8(u,e.u_atmosphere_blend),u_globe_position:new o.bL(u,e.u_globe_position),u_globe_radius:new o.b8(u,e.u_globe_radius),u_inv_proj_matrix:new o.bJ(u,e.u_inv_proj_matrix)}),sky:(u,e)=>({u_sky_color:new o.bI(u,e.u_sky_color),u_horizon_color:new o.bI(u,e.u_horizon_color),u_horizon:new o.bM(u,e.u_horizon),u_horizon_normal:new o.bM(u,e.u_horizon_normal),u_sky_horizon_blend:new o.b8(u,e.u_sky_horizon_blend),u_sky_blend:new o.b8(u,e.u_sky_blend)})};class nh{constructor(e,i,s){this.context=e;const l=e.gl;this.buffer=l.createBuffer(),this.dynamicDraw=!!s,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),l.bufferData(l.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const i=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const oc={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ah{constructor(e,i,s,l){this.length=i.length,this.attributes=s,this.itemSize=i.bytesPerElement,this.dynamicDraw=l,this.context=e;const h=e.gl;this.buffer=h.createBuffer(),e.bindVertexBuffer.set(this.buffer),h.bufferData(h.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,i){for(let s=0;s<this.attributes.length;s++){const l=i.attributes[this.attributes[s].name];l!==void 0&&e.enableVertexAttribArray(l)}}setVertexAttribPointers(e,i,s){for(let l=0;l<this.attributes.length;l++){const h=this.attributes[l],f=i.attributes[h.name];f!==void 0&&e.vertexAttribPointer(f,h.components,e[oc[h.type]],!1,this.itemSize,h.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class At{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class kn extends At{getDefault(){return o.b7.transparent}set(e){const i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class lc extends At{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class cc extends At{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class uc extends At{getDefault(){return[!0,!0,!0,!0]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class sh extends At{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class hc extends At{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class ba extends At{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const i=this.current;(e.func!==i.func||e.ref!==i.ref||e.mask!==i.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class dc extends At{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Od extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),this.current=e,this.dirty=!1}}class jd extends At{getDefault(){return[0,1]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Nd extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),this.current=e,this.dirty=!1}}class Zd extends At{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class oh extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.BLEND):i.disable(i.BLEND),this.current=e,this.dirty=!1}}class Vd extends At{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class lh extends At{getDefault(){return o.b7.transparent}set(e){const i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Oo extends At{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class jo extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),this.current=e,this.dirty=!1}}class No extends At{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class pc extends At{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class wa extends At{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Zo extends At{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Ka extends At{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Gr extends At{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindFramebuffer(i.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class ch extends At{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindRenderbuffer(i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class uh extends At{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindTexture(i.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class fc extends At{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindBuffer(i.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Ta extends At{getDefault(){return null}set(e){const i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Vo extends At{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;const s=this.gl;er(s)?s.bindVertexArray(e):(i=s.getExtension("OES_vertex_array_object"))===null||i===void 0||i.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class Uo extends At{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Zs extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class $o extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class Go extends At{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class Ya extends Go{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class Ja extends Go{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class hh extends Go{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}const qo="Framebuffer is not complete";class xt{constructor(e,i,s,l,h){this.context=e,this.width=i,this.height=s;const f=e.gl,_=this.framebuffer=f.createFramebuffer();if(this.colorAttachment=new Ya(e,_),l)this.depthAttachment=h?new hh(e,_):new Ja(e,_);else if(h)throw new Error("Stencil cannot be set without depth");if(f.checkFramebufferStatus(f.FRAMEBUFFER)!==f.FRAMEBUFFER_COMPLETE)throw new Error(qo)}destroy(){const e=this.context.gl,i=this.colorAttachment.get();if(i&&e.deleteTexture(i),this.depthAttachment){const s=this.depthAttachment.get();s&&e.deleteRenderbuffer(s)}e.deleteFramebuffer(this.framebuffer)}}class Ho{constructor(e){var i,s;if(this.gl=e,this.clearColor=new kn(this),this.clearDepth=new lc(this),this.clearStencil=new cc(this),this.colorMask=new uc(this),this.depthMask=new sh(this),this.stencilMask=new hc(this),this.stencilFunc=new ba(this),this.stencilOp=new dc(this),this.stencilTest=new Od(this),this.depthRange=new jd(this),this.depthTest=new Nd(this),this.depthFunc=new Zd(this),this.blend=new oh(this),this.blendFunc=new Vd(this),this.blendColor=new lh(this),this.blendEquation=new Oo(this),this.cullFace=new jo(this),this.cullFaceSide=new No(this),this.frontFace=new pc(this),this.program=new wa(this),this.activeTexture=new Zo(this),this.viewport=new Ka(this),this.bindFramebuffer=new Gr(this),this.bindRenderbuffer=new ch(this),this.bindTexture=new uh(this),this.bindVertexBuffer=new fc(this),this.bindElementBuffer=new Ta(this),this.bindVertexArray=new Vo(this),this.pixelStoreUnpack=new Uo(this),this.pixelStoreUnpackPremultiplyAlpha=new Zs(this),this.pixelStoreUnpackFlipY=new $o(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),er(e)){this.HALF_FLOAT=e.HALF_FLOAT;const l=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(i=e.RGBA16F)!==null&&i!==void 0?i:l==null?void 0:l.RGBA16F_EXT,this.RGB16F=(s=e.RGB16F)!==null&&s!==void 0?s:l==null?void 0:l.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const l=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=l==null?void 0:l.HALF_FLOAT_OES}}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.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,i){return new nh(this,e,i)}createVertexBuffer(e,i,s){return new ah(this,e,i,s)}createRenderbuffer(e,i,s){const l=this.gl,h=l.createRenderbuffer();return this.bindRenderbuffer.set(h),l.renderbufferStorage(l.RENDERBUFFER,e,i,s),this.bindRenderbuffer.set(null),h}createFramebuffer(e,i,s,l){return new xt(this,e,i,s,l)}clear({color:e,depth:i,stencil:s}){const l=this.gl;let h=0;e&&(h|=l.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),i!==void 0&&(h|=l.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),s!==void 0&&(h|=l.STENCIL_BUFFER_BIT,this.clearStencil.set(s),this.stencilMask.set(255)),l.clear(h)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){o.bE(e.blendFunction,Vt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return er(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var i;return er(this.gl)?this.gl.deleteVertexArray(e):(i=this.gl.getExtension("OES_vertex_array_object"))===null||i===void 0?void 0:i.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}let Wo;function mc(u,e,i,s,l){const h=u.context,f=u.transform,_=h.gl,x=u.useProgram("collisionBox"),T=[];let P=0,A=0;for(let W=0;W<s.length;W++){const K=s[W],te=e.getTile(K).getBucket(i);if(!te)continue;const ee=l?te.textCollisionBox:te.iconCollisionBox,ie=te.collisionCircleArray;ie.length>0&&(T.push({circleArray:ie,circleOffset:A,coord:K}),P+=ie.length/4,A=P),ee&&x.draw(h,_.LINES,lt.disabled,mt.disabled,u.colorModeForRenderPass(),St.disabled,Dd(u.transform),u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),f.getProjectionData({overscaledTileID:K,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,null,u.transform.zoom,null,null,ee.collisionVertexBuffer)}if(!l||!T.length)return;const E=u.useProgram("collisionCircle"),F=new o.bT;F.resize(4*P),F._trim();let O=0;for(const W of T)for(let K=0;K<W.circleArray.length/4;K++){const te=4*K,ee=W.circleArray[te+0],ie=W.circleArray[te+1],se=W.circleArray[te+2],re=W.circleArray[te+3];F.emplace(O++,ee,ie,se,re,0),F.emplace(O++,ee,ie,se,re,1),F.emplace(O++,ee,ie,se,re,2),F.emplace(O++,ee,ie,se,re,3)}(!Wo||Wo.length<2*P)&&(Wo=function(W){const K=2*W,te=new o.bV;te.resize(K),te._trim();for(let ee=0;ee<K;ee++){const ie=6*ee;te.uint16[ie+0]=4*ee+0,te.uint16[ie+1]=4*ee+1,te.uint16[ie+2]=4*ee+2,te.uint16[ie+3]=4*ee+2,te.uint16[ie+4]=4*ee+3,te.uint16[ie+5]=4*ee+0}return te}(P));const H=h.createIndexBuffer(Wo,!0),q=h.createVertexBuffer(F,o.bU.members,!0);for(const W of T){const K=Bo(u.transform);E.draw(h,_.TRIANGLES,lt.disabled,mt.disabled,u.colorModeForRenderPass(),St.disabled,K,u.style.map.terrain&&u.style.map.terrain.getTerrainData(W.coord),null,i.id,q,H,o.aJ.simpleSegment(0,2*W.circleOffset,W.circleArray.length,W.circleArray.length/2),null,u.transform.zoom,null,null,null)}q.destroy(),H.destroy()}const Vs=o.ad(new Float32Array(16));function Ud(u,e,i,s,l,h){const{horizontalAlign:f,verticalAlign:_}=o.aE(u);return new o.P((-(f-.5)*e/l+s[0])*h,(-(_-.5)*i/l+s[1])*h)}function $d(u,e,i,s,l,h){const f=e.tileAnchorPoint.add(new o.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let _=s.mult(h);i||(_=_.rotate(-l));const x=f.add(_);return we(x.x,x.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(i){const _=li(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(u),x=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return u.add(s.rotate(x))}return u.add(s)}function dh(u,e,i,s,l,h,f,_,x,T,P,A){const E=u.text.placedSymbolArray,F=u.text.dynamicLayoutVertexArray,O=u.icon.dynamicLayoutVertexArray,H={};F.clear();for(let q=0;q<E.length;q++){const W=E.get(q),K=W.hidden||!W.crossTileID||u.allowVerticalPlacement&&!W.placedOrientation?null:s[W.crossTileID];if(K){const te=new o.P(W.anchorX,W.anchorY),ee={getElevation:A,width:l.width,height:l.height,pitchedLabelPlaneMatrix:h,pitchWithMap:i,transform:l,tileAnchorPoint:te,translation:T,unwrappedTileID:P},ie=i?ft(te.x,te.y,ee):li(te.x,te.y,ee),se=Lt(l.cameraToCenterDistance,ie.signedDistanceFromCamera);let re=o.am(u.textSizeData,_,W)*se/o.ay;i&&(re*=u.tilePixelRatio/f);const{width:pe,height:Me,anchor:xe,textOffset:ve,textBoxScale:be}=K,Ne=Ud(xe,pe,Me,ve,be,re),Oe=l.getPitchedTextCorrection(te.x+T[0],te.y+T[1],P),Re=$d(ie.point,ee,e,Ne,-l.bearingInRadians,Oe),He=u.allowVerticalPlacement&&W.placedOrientation===o.al.vertical?Math.PI/2:0;for(let gt=0;gt<W.numGlyphs;gt++)o.as(F,Re,He);x&&W.associatedIconIndex>=0&&(H[W.associatedIconIndex]={shiftedAnchor:Re,angle:He})}else En(W.numGlyphs,F)}if(x){O.clear();const q=u.icon.placedSymbolArray;for(let W=0;W<q.length;W++){const K=q.get(W);if(K.hidden)En(K.numGlyphs,O);else{const te=H[W];if(te)for(let ee=0;ee<K.numGlyphs;ee++)o.as(O,te.shiftedAnchor,te.angle);else En(K.numGlyphs,O)}}u.icon.dynamicLayoutVertexBuffer.updateData(O)}u.text.dynamicLayoutVertexBuffer.updateData(F)}function Gd(u,e,i){return i.iconsInText&&e?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Xo(u,e,i,s,l,h,f,_,x,T,P,A,E){const F=u.context,O=F.gl,H=u.transform,q=_==="map",W=x==="map",K=_!=="viewport"&&i.layout.get("symbol-placement")!=="point",te=q&&!W&&!K,ee=!i.layout.get("symbol-sort-key").isConstant();let ie=!1;const se=u.getDepthModeForSublayer(0,lt.ReadOnly),re=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),pe=[],Me=H.getCircleRadiusCorrection();for(const xe of s){const ve=e.getTile(xe),be=ve.getBucket(i);if(!be)continue;const Ne=l?be.text:be.icon;if(!Ne||!Ne.segments.get().length||!Ne.hasVisibleVertices)continue;const Oe=Ne.programConfigurations.get(i.id),Re=l||be.sdfIcons,He=l?be.textSizeData:be.iconSizeData,gt=W||H.pitch!==0,Pt=u.useProgram(Gd(Re,l,be),Oe),ri=o.ak(He,H.zoom),Ut=u.style.map.terrain&&u.style.map.terrain.getTerrainData(xe);let ni,ai,Gt,zt,Ai=[0,0],Bi=null;if(l)ai=ve.glyphAtlasTexture,Gt=O.LINEAR,ni=ve.glyphAtlasTexture.size,be.iconsInText&&(Ai=ve.imageAtlasTexture.size,Bi=ve.imageAtlasTexture,zt=gt||u.options.rotating||u.options.zooming||He.kind==="composite"||He.kind==="camera"?O.LINEAR:O.NEAREST);else{const Mi=i.layout.get("icon-size").constantOr(0)!==1||be.iconsNeedLinear;ai=ve.imageAtlasTexture,Gt=Re||u.options.rotating||u.options.zooming||Mi||gt?O.LINEAR:O.NEAREST,ni=ve.imageAtlasTexture.size}const qi=o.az(ve,1,u.transform.zoom),Rt=Qe(q,u.transform,qi),Kn=o.K();o.an(Kn,Rt);const _n=dt(W,q,u.transform,qi),Yn=o.aA(H,ve,h,f),Pa=H.getProjectionData({overscaledTileID:xe,applyGlobeMatrix:!E,applyTerrainMatrix:!0}),ro=re&&be.hasTextData(),Jn=i.layout.get("icon-text-fit")!=="none"&&ro&&be.hasIconData();if(K){const Mi=u.style.map.terrain?(fr,Kt)=>u.style.map.terrain.getElevation(xe,fr,Kt):null,Si=i.layout.get("text-rotation-alignment")==="map";kt(be,u,l,Rt,Kn,W,T,Si,xe.toUnwrapped(),H.width,H.height,Yn,Mi)}const Ca=l&&re||Jn,Fr=K||Ca?Vs:W?Rt:u.transform.clipSpaceToPixelsMatrix,Qn=Re&&i.paint.get(l?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Rn;Rn=Re?be.iconsInText?Fo(He.kind,ri,te,W,K,Ca,u,Fr,_n,Yn,ni,Ai,Me):ih(He.kind,ri,te,W,K,Ca,u,Fr,_n,Yn,l,ni,0,Me):Xa(He.kind,ri,te,W,K,Ca,u,Fr,_n,Yn,l,ni,Me);const ea={program:Pt,buffers:Ne,uniformValues:Rn,projectionData:Pa,atlasTexture:ai,atlasTextureIcon:Bi,atlasInterpolation:Gt,atlasInterpolationIcon:zt,isSDF:Re,hasHalo:Qn};if(ee&&be.canOverlap){ie=!0;const Mi=Ne.segments.get();for(const Si of Mi)pe.push({segments:new o.aJ([Si]),sortKey:Si.sortKey,state:ea,terrainData:Ut})}else pe.push({segments:Ne.segments,sortKey:0,state:ea,terrainData:Ut})}ie&&pe.sort((xe,ve)=>xe.sortKey-ve.sortKey);for(const xe of pe){const ve=xe.state;if(F.activeTexture.set(O.TEXTURE0),ve.atlasTexture.bind(ve.atlasInterpolation,O.CLAMP_TO_EDGE),ve.atlasTextureIcon&&(F.activeTexture.set(O.TEXTURE1),ve.atlasTextureIcon&&ve.atlasTextureIcon.bind(ve.atlasInterpolationIcon,O.CLAMP_TO_EDGE)),ve.isSDF){const be=ve.uniformValues;ve.hasHalo&&(be.u_is_halo=1,Us(ve.buffers,xe.segments,i,u,ve.program,se,P,A,be,ve.projectionData,xe.terrainData)),be.u_is_halo=0}Us(ve.buffers,xe.segments,i,u,ve.program,se,P,A,ve.uniformValues,ve.projectionData,xe.terrainData)}}function Us(u,e,i,s,l,h,f,_,x,T,P){const A=s.context;l.draw(A,A.gl.TRIANGLES,h,f,_,St.backCCW,x,P,T,i.id,u.layoutVertexBuffer,u.indexBuffer,e,i.paint,s.transform.zoom,u.programConfigurations.get(i.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function Ko(u,e,i,s,l){const h=u.context,f=h.gl,_=mt.disabled,x=new Vt([f.ONE,f.ONE],o.b7.transparent,[!0,!0,!0,!0]),T=e.getBucket(i);if(!T)return;const P=s.key;let A=i.heatmapFbos.get(P);A||(A=Yo(h,e.tileSize,e.tileSize),i.heatmapFbos.set(P,A)),h.bindFramebuffer.set(A.framebuffer),h.viewport.set([0,0,e.tileSize,e.tileSize]),h.clear({color:o.b7.transparent});const E=T.programConfigurations.get(i.id),F=u.useProgram("heatmap",E,!l),O=u.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),H=u.style.map.terrain.getTerrainData(s);F.draw(h,f.TRIANGLES,lt.disabled,_,x,St.disabled,va(e,u.transform.zoom,i.paint.get("heatmap-intensity"),1),H,O,i.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,i.paint,u.transform.zoom,E)}function gc(u,e,i,s,l){const h=u.context,f=h.gl,_=u.transform;h.setColorMode(u.colorModeForRenderPass());const x=_c(h,e),T=i.key,P=e.heatmapFbos.get(T);if(!P)return;h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,P.colorAttachment.get()),h.activeTexture.set(f.TEXTURE1),x.bind(f.LINEAR,f.CLAMP_TO_EDGE);const A=_.getProjectionData({overscaledTileID:i,applyTerrainMatrix:l,applyGlobeMatrix:!s});u.useProgram("heatmapTexture").draw(h,f.TRIANGLES,lt.disabled,mt.disabled,u.colorModeForRenderPass(),St.disabled,Wu(u,e,0,1),null,A,e.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments,e.paint,_.zoom),P.destroy(),e.heatmapFbos.delete(T)}function Yo(u,e,i){var s,l;const h=u.gl,f=h.createTexture();h.bindTexture(h.TEXTURE_2D,f),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.LINEAR),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.LINEAR);const _=(s=u.HALF_FLOAT)!==null&&s!==void 0?s:h.UNSIGNED_BYTE,x=(l=u.RGBA16F)!==null&&l!==void 0?l:h.RGBA;h.texImage2D(h.TEXTURE_2D,0,x,e,i,0,h.RGBA,_,null);const T=u.createFramebuffer(e,i,!1,!1);return T.colorAttachment.set(f),T}function _c(u,e){return e.colorRampTexture||(e.colorRampTexture=new jt(u,e.colorRamp,u.gl.RGBA)),e.colorRampTexture}function $s(u,e,i,s,l){if(!i||!s||!s.imageAtlas)return;const h=s.imageAtlas.patternPositions;let f=h[i.to.toString()],_=h[i.from.toString()];if(!f&&_&&(f=_),!_&&f&&(_=f),!f||!_){const x=l.getPaintProperty(e);f=h[x],_=h[x]}f&&_&&u.setConstantPatternPositions(f,_)}function Gs(u,e,i,s,l,h,f,_){const x=u.context.gl,T="fill-pattern",P=i.paint.get(T),A=P&&P.constantOr(1),E=i.getCrossfadeParameters();let F,O,H,q,W;const K=u.transform,te=i.paint.get("fill-translate"),ee=i.paint.get("fill-translate-anchor");f?(O=A&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",F=x.LINES):(O=A?"fillPattern":"fill",F=x.TRIANGLES);const ie=P.constantOr(null);for(const se of s){const re=e.getTile(se);if(A&&!re.patternsLoaded())continue;const pe=re.getBucket(i);if(!pe)continue;const Me=pe.programConfigurations.get(i.id),xe=u.useProgram(O,Me),ve=u.style.map.terrain&&u.style.map.terrain.getTerrainData(se);A&&(u.context.activeTexture.set(x.TEXTURE0),re.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),Me.updatePaintBuffers(E)),$s(Me,T,ie,re,i);const be=K.getProjectionData({overscaledTileID:se,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),Ne=o.aA(K,re,te,ee);if(f){q=pe.indexBuffer2,W=pe.segments2;const Re=[x.drawingBufferWidth,x.drawingBufferHeight];H=O==="fillOutlinePattern"&&A?Os(u,E,re,Re,Ne):nc(Re,Ne)}else q=pe.indexBuffer,W=pe.segments,H=A?qu(u,E,re,Ne):{u_fill_translate:Ne};const Oe=u.stencilModeForClipping(se);xe.draw(u.context,F,l,Oe,h,St.backCCW,H,ve,be,i.id,pe.layoutVertexBuffer,q,W,i.paint,u.transform.zoom,Me)}}function qs(u,e,i,s,l,h,f,_){const x=u.context,T=x.gl,P="fill-extrusion-pattern",A=i.paint.get(P),E=A.constantOr(1),F=i.getCrossfadeParameters(),O=i.paint.get("fill-extrusion-opacity"),H=A.constantOr(null),q=u.transform;for(const W of s){const K=e.getTile(W),te=K.getBucket(i);if(!te)continue;const ee=u.style.map.terrain&&u.style.map.terrain.getTerrainData(W),ie=te.programConfigurations.get(i.id),se=u.useProgram(E?"fillExtrusionPattern":"fillExtrusion",ie);E&&(u.context.activeTexture.set(T.TEXTURE0),K.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),ie.updatePaintBuffers(F));const re=q.getProjectionData({overscaledTileID:W,applyGlobeMatrix:!_,applyTerrainMatrix:!0});$s(ie,P,H,K,i);const pe=o.aA(q,K,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),Me=i.paint.get("fill-extrusion-vertical-gradient"),xe=E?fn(u,Me,O,pe,W,F,K):Lo(u,Me,O,pe);se.draw(x,x.gl.TRIANGLES,l,h,f,St.backCCW,xe,ee,re,i.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,i.paint,u.transform.zoom,ie,u.style.map.terrain&&te.centroidVertexBuffer)}}function yc(u,e,i,s,l,h,f,_,x){var T;const P=u.style.projection,A=u.context,E=u.transform,F=A.gl,O=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],H=u.useProgram("hillshade",null,!1,O),q=!u.options.moving;for(const W of s){const K=e.getTile(W),te=K.fbo;if(!te)continue;const ee=P.getMeshFromTileID(A,W.canonical,_,!0,"raster"),ie=(T=u.style.map.terrain)===null||T===void 0?void 0:T.getTerrainData(W);A.activeTexture.set(F.TEXTURE0),F.bindTexture(F.TEXTURE_2D,te.colorAttachment.get());const se=E.getProjectionData({overscaledTileID:W,aligned:q,applyGlobeMatrix:!x,applyTerrainMatrix:!0});H.draw(A,F.TRIANGLES,h,l[W.overscaledZ],f,St.backCCW,Xu(u,K,i),ie,se,i.id,ee.vertexBuffer,ee.indexBuffer,ee.segments)}}const Hs=[new o.P(0,0),new o.P(o.Z,0),new o.P(o.Z,o.Z),new o.P(0,o.Z)];function Jo(u,e,i,s,l,h,f,_,x=!1,T=!1){const P=s[s.length-1].overscaledZ,A=u.context,E=A.gl,F=u.useProgram("raster"),O=u.transform,H=u.style.projection,q=u.colorModeForRenderPass(),W=!u.options.moving;for(const K of s){const te=u.getDepthModeForSublayer(K.overscaledZ-P,i.paint.get("raster-opacity")===1?lt.ReadWrite:lt.ReadOnly,E.LESS),ee=e.getTile(K);ee.registerFadeDuration(i.paint.get("raster-fade-duration"));const ie=e.findLoadedParent(K,0),se=e.findLoadedSibling(K),re=ph(ee,ie||se||null,e,i,u.transform,u.style.map.terrain);let pe,Me;const xe=i.paint.get("raster-resampling")==="nearest"?E.NEAREST:E.LINEAR;A.activeTexture.set(E.TEXTURE0),ee.texture.bind(xe,E.CLAMP_TO_EDGE,E.LINEAR_MIPMAP_NEAREST),A.activeTexture.set(E.TEXTURE1),ie?(ie.texture.bind(xe,E.CLAMP_TO_EDGE,E.LINEAR_MIPMAP_NEAREST),pe=Math.pow(2,ie.tileID.overscaledZ-ee.tileID.overscaledZ),Me=[ee.tileID.canonical.x*pe%1,ee.tileID.canonical.y*pe%1]):ee.texture.bind(xe,E.CLAMP_TO_EDGE,E.LINEAR_MIPMAP_NEAREST),ee.texture.useMipmap&&A.extTextureFilterAnisotropic&&u.transform.pitch>20&&E.texParameterf(E.TEXTURE_2D,A.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,A.extTextureFilterAnisotropicMax);const ve=u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),be=O.getProjectionData({overscaledTileID:K,aligned:W,applyGlobeMatrix:!T,applyTerrainMatrix:!0}),Ne=eh(Me||[0,0],pe||1,re,i,_),Oe=H.getMeshFromTileID(A,K.canonical,h,f,"raster");F.draw(A,E.TRIANGLES,te,l?l[K.overscaledZ]:mt.disabled,q,x?St.frontCCW:St.backCCW,Ne,ve,be,i.id,Oe.vertexBuffer,Oe.indexBuffer,Oe.segments)}}function ph(u,e,i,s,l,h){const f=s.paint.get("raster-fade-duration");if(!h&&f>0){const _=Ee.now(),x=(_-u.timeAdded)/f,T=e?(_-e.timeAdded)/f:-1,P=i.getSource(),A=ge(l,{tileSize:P.tileSize,roundZoom:P.roundZoom}),E=!e||Math.abs(e.tileID.overscaledZ-A)>Math.abs(u.tileID.overscaledZ-A),F=E&&u.refreshedUponExpiration?1:o.ae(E?x:1-T,0,1);return u.refreshedUponExpiration&&x>=1&&(u.refreshedUponExpiration=!1),e?{opacity:1,mix:1-F}:{opacity:F,mix:0}}return{opacity:1,mix:0}}const Qo=new o.b7(1,0,0,1),xc=new o.b7(0,1,0,1),fh=new o.b7(0,0,1,1),mh=new o.b7(1,0,1,1),el=new o.b7(0,1,1,1);function tl(u,e,i,s){Ws(u,0,e+i/2,u.transform.width,i,s)}function gh(u,e,i,s){Ws(u,e-i/2,0,i,u.transform.height,s)}function Ws(u,e,i,s,l,h){const f=u.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*u.pixelRatio,i*u.pixelRatio,s*u.pixelRatio,l*u.pixelRatio),f.clear({color:h}),_.disable(_.SCISSOR_TEST)}function gi(u,e,i){const s=u.context,l=s.gl,h=u.useProgram("debug"),f=lt.disabled,_=mt.disabled,x=u.colorModeForRenderPass(),T="$debug",P=u.style.map.terrain&&u.style.map.terrain.getTerrainData(i);s.activeTexture.set(l.TEXTURE0);const A=e.getTileByID(i.key).latestRawTileData,E=Math.floor((A&&A.byteLength||0)/1024),F=e.getTile(i).tileSize,O=512/Math.min(F,512)*(i.overscaledZ/u.transform.zoom)*.5;let H=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(H+=` => ${i.overscaledZ}`),function(W,K){W.initDebugOverlayCanvas();const te=W.debugOverlayCanvas,ee=W.context.gl,ie=W.debugOverlayCanvas.getContext("2d");ie.clearRect(0,0,te.width,te.height),ie.shadowColor="white",ie.shadowBlur=2,ie.lineWidth=1.5,ie.strokeStyle="white",ie.textBaseline="top",ie.font="bold 36px Open Sans, sans-serif",ie.fillText(K,5,5),ie.strokeText(K,5,5),W.debugOverlayTexture.update(te),W.debugOverlayTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE)}(u,`${H} ${E}kB`);const q=u.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(s,l.TRIANGLES,f,_,Vt.alphaBlended,St.disabled,Hu(o.b7.transparent,O),null,q,T,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),h.draw(s,l.LINE_STRIP,f,_,x,St.disabled,Hu(o.b7.red),P,q,T,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function Xn(u,e,i,s){const{isRenderingGlobe:l}=s,h=u.context,f=h.gl,_=u.transform,x=u.colorModeForRenderPass(),T=u.getDepthModeFor3D(),P=u.useProgram("terrain");h.bindFramebuffer.set(null),h.viewport.set([0,0,u.width,u.height]);for(const A of i){const E=e.getTerrainMesh(A.tileID),F=u.renderToTexture.getTexture(A),O=e.getTerrainData(A.tileID);h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,F.texture);const H=e.getMeshFrameDelta(_.zoom),q=_.calculateFogMatrix(A.tileID.toUnwrapped()),W=Rd(H,q,u.style.sky,_.pitch,l),K=_.getProjectionData({overscaledTileID:A.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});P.draw(h,f.TRIANGLES,T,mt.disabled,x,St.backCCW,W,O,K,"terrain",E.vertexBuffer,E.indexBuffer,E.segments)}}function Br(u,e){if(!e.mesh){const i=new o.aI;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const s=new o.aK;s.emplaceBack(0,1,2),s.emplaceBack(0,2,3),e.mesh=new Ua(u.createVertexBuffer(i,hr.members),u.createIndexBuffer(s),o.aJ.simpleSegment(0,0,i.length,s.length))}return e.mesh}class vc{constructor(e,i){this.context=new Ho(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:o.ad(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=de.maxUnderzooming+de.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Is}resize(e,i,s){if(this.width=Math.floor(e*s),this.height=Math.floor(i*s),this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const l of this.style._order)this.style._layers[l].resize()}setup(){const e=this.context,i=new o.aI;i.emplaceBack(0,0),i.emplaceBack(o.Z,0),i.emplaceBack(0,o.Z),i.emplaceBack(o.Z,o.Z),this.tileExtentBuffer=e.createVertexBuffer(i,hr.members),this.tileExtentSegments=o.aJ.simpleSegment(0,0,4,2);const s=new o.aI;s.emplaceBack(0,0),s.emplaceBack(o.Z,0),s.emplaceBack(0,o.Z),s.emplaceBack(o.Z,o.Z),this.debugBuffer=e.createVertexBuffer(s,hr.members),this.debugSegments=o.aJ.simpleSegment(0,0,4,5);const l=new o.b_;l.emplaceBack(0,0,0,0),l.emplaceBack(o.Z,0,o.Z,0),l.emplaceBack(0,o.Z,0,o.Z),l.emplaceBack(o.Z,o.Z,o.Z,o.Z),this.rasterBoundsBuffer=e.createVertexBuffer(l,kd.members),this.rasterBoundsSegments=o.aJ.simpleSegment(0,0,4,2);const h=new o.aI;h.emplaceBack(0,0),h.emplaceBack(o.Z,0),h.emplaceBack(0,o.Z),h.emplaceBack(o.Z,o.Z),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(h,hr.members),this.rasterBoundsSegmentsPosOnly=o.aJ.simpleSegment(0,0,4,5);const f=new o.aI;f.emplaceBack(0,0),f.emplaceBack(1,0),f.emplaceBack(0,1),f.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(f,hr.members),this.viewportSegments=o.aJ.simpleSegment(0,0,4,2);const _=new o.b$;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(_);const x=new o.aK;x.emplaceBack(1,0,2),x.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(x);const T=this.context.gl;this.stencilClearMode=new mt({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO),this.tileExtentMesh=new Ua(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=o.K();o.bQ(s,0,this.width,this.height,0,0,1),o.M(s,s,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const l={mainMatrix:s,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s};this.useProgram("clippingMask",null,!0).draw(e,i.TRIANGLES,lt.disabled,this.stencilClearMode,Vt.disabled,St.disabled,null,null,l,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,i,s){if(this.currentStencilSource===e.source||!e.isTileClipped()||!i||!i.length)return;this.currentStencilSource=e.source,this.nextStencilID+i.length>256&&this.clearStencil();const l=this.context;l.setColorMode(Vt.disabled),l.setDepthMode(lt.disabled);const h={};for(const f of i)h[f.key]=this.nextStencilID++;this._renderTileMasks(h,i,s,!0),this._renderTileMasks(h,i,s,!1),this._tileClippingMaskIDs=h}_renderTileMasks(e,i,s,l){const h=this.context,f=h.gl,_=this.style.projection,x=this.transform,T=this.useProgram("clippingMask");for(const P of i){const A=e[P.key],E=this.style.map.terrain&&this.style.map.terrain.getTerrainData(P),F=_.getMeshFromTileID(this.context,P.canonical,l,!0,"stencil"),O=x.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!s,applyTerrainMatrix:!0});T.draw(h,f.TRIANGLES,lt.disabled,new mt({func:f.ALWAYS,mask:0},A,255,f.KEEP,f.KEEP,f.REPLACE),Vt.disabled,s?St.disabled:St.backCCW,null,E,O,"$clipping",F.vertexBuffer,F.indexBuffer,F.segments)}}_renderTilesDepthBuffer(){const e=this.context,i=e.gl,s=this.style.projection,l=this.transform,h=this.useProgram("depth"),f=this.getDepthModeFor3D(),_=oe(l,{tileSize:l.tileSize});for(const x of _){const T=this.style.map.terrain&&this.style.map.terrain.getTerrainData(x),P=s.getMeshFromTileID(this.context,x.canonical,!0,!0,"raster"),A=l.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(e,i.TRIANGLES,f,mt.disabled,Vt.disabled,St.backCCW,null,T,A,"$clipping",P.vertexBuffer,P.indexBuffer,P.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,i=this.context.gl;return new mt({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){const i=this.context.gl;return new mt({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,i.KEEP,i.KEEP,i.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const i=this.context.gl,s=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),l=s[s.length-1].overscaledZ,h=s[0].overscaledZ-l+1;if(h>1){this.currentStencilSource=void 0,this.nextStencilID+h>256&&this.clearStencil();const f={};for(let _=0;_<h;_++)f[_+l]=new mt({func:i.GEQUAL,mask:255},_+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=h,[f,s]}return[{[l]:mt.disabled},s]}stencilConfigForOverlapTwoPass(e){const i=this.context.gl,s=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),l=s[s.length-1].overscaledZ,h=s[0].overscaledZ-l+1;if(this.clearStencil(),h>1){const f={},_={};for(let x=0;x<h;x++)f[x+l]=new mt({func:i.GREATER,mask:255},h+1+x,255,i.KEEP,i.KEEP,i.REPLACE),_[x+l]=new mt({func:i.GREATER,mask:255},1+x,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*h+1,[f,_,s]}return this.nextStencilID=3,[{[l]:new mt({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[l]:new mt({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},s]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new Vt([e.CONSTANT_COLOR,e.ONE],new o.b7(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Vt.unblended:Vt.alphaBlended}getDepthModeForSublayer(e,i,s){if(!this.opaquePassEnabledForLayer())return lt.disabled;const l=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new lt(s||this.context.gl.LEQUAL,i,[l,l])}getDepthModeFor3D(){return new lt(this.context.gl.LEQUAL,lt.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){var s,l;this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(Ee.now()),this.imageManager.beginFrame();const h=this.style._order,f=this.style.sourceCaches,_={},x={},T={},P={isRenderingToTexture:!1,isRenderingGlobe:((s=e.projection)===null||s===void 0?void 0:s.transitionState)>0};for(const E in f){const F=f[E];F.used&&F.prepare(this.context),_[E]=F.getVisibleCoordinates(!1),x[E]=_[E].slice().reverse(),T[E]=F.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let E=0;E<h.length;E++)if(this.style._layers[h[E]].is3D()){this.opaquePassCutoff=E;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const E of h){const F=this.style._layers[E];if(!F.hasOffscreenPass()||F.isHidden(this.transform.zoom))continue;const O=x[F.source];(F.type==="custom"||O.length)&&this.renderLayer(this,f[F.source],F,O,P)}if((l=this.style.projection)===null||l===void 0||l.updateGPUdependent({context:this.context,useProgram:E=>this.useProgram(E)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?o.b7.black:o.b7.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(E,F){const O=E.context,H=O.gl,q=((se,re,pe)=>{const Me=Math.cos(re.rollInRadians),xe=Math.sin(re.rollInRadians),ve=ce(re),be=re.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:se.properties.get("sky-color"),u_horizon_color:se.properties.get("horizon-color"),u_horizon:[(re.width/2-ve*xe)*pe,(re.height/2+ve*Me)*pe],u_horizon_normal:[-xe,Me],u_sky_horizon_blend:se.properties.get("sky-horizon-blend")*re.height/2*pe,u_sky_blend:be}})(F,E.style.map.transform,E.pixelRatio),W=new lt(H.LEQUAL,lt.ReadWrite,[0,1]),K=mt.disabled,te=E.colorModeForRenderPass(),ee=E.useProgram("sky"),ie=Br(O,F);ee.draw(O,H.TRIANGLES,W,K,te,St.disabled,q,null,void 0,"sky",ie.vertexBuffer,ie.indexBuffer,ie.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=h.length-1;this.currentLayer>=0;this.currentLayer--){const E=this.style._layers[h[this.currentLayer]],F=f[E.source],O=_[E.source];this._renderTileClippingMasks(E,O,!1),this.renderLayer(this,F,E,O,P)}this.renderPass="translucent";let A=!1;for(this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const E=this.style._layers[h[this.currentLayer]],F=f[E.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(E,P))continue;this.opaquePassEnabledForLayer()||A||(A=!0,P.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const O=(E.type==="symbol"?T:x)[E.source];this._renderTileClippingMasks(E,_[E.source],!!this.renderToTexture),this.renderLayer(this,F,E,O,P)}if(P.isRenderingGlobe&&function(E,F,O){const H=E.context,q=H.gl,W=E.useProgram("atmosphere"),K=new lt(q.LEQUAL,lt.ReadOnly,[0,1]),te=E.transform,ee=function(be,Ne){const Oe=be.properties.get("position"),Re=[-Oe.x,-Oe.y,-Oe.z],He=o.ad(new Float64Array(16));return be.properties.get("anchor")==="map"&&(o.a_(He,He,Ne.rollInRadians),o.a$(He,He,-Ne.pitchInRadians),o.a_(He,He,Ne.bearingInRadians),o.a$(He,He,Ne.center.lat*Math.PI/180),o.bp(He,He,-Ne.center.lng*Math.PI/180)),o.bZ(Re,Re,He),Re}(O,E.transform),ie=te.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),se=F.properties.get("atmosphere-blend")*ie.projectionTransition;if(se===0)return;const re=_a(te.worldSize,te.center.lat),pe=te.inverseProjectionMatrix,Me=new Float64Array(4);Me[3]=1,o.at(Me,Me,te.modelViewProjectionMatrix),Me[0]/=Me[3],Me[1]/=Me[3],Me[2]/=Me[3],Me[3]=1,o.at(Me,Me,pe),Me[0]/=Me[3],Me[1]/=Me[3],Me[2]/=Me[3],Me[3]=1;const xe=((be,Ne,Oe,Re,He)=>({u_sun_pos:be,u_atmosphere_blend:Ne,u_globe_position:Oe,u_globe_radius:Re,u_inv_proj_matrix:He}))(ee,se,[Me[0],Me[1],Me[2]],re,pe),ve=Br(H,F);W.draw(H,q.TRIANGLES,K,mt.disabled,Vt.alphaBlended,St.disabled,xe,null,null,"atmosphere",ve.vertexBuffer,ve.indexBuffer,ve.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const E=function(F,O){let H=null;const q=Object.values(F._layers).flatMap(ee=>ee.source&&!ee.isHidden(O)?[F.sourceCaches[ee.source]]:[]),W=q.filter(ee=>ee.getSource().type==="vector"),K=q.filter(ee=>ee.getSource().type!=="vector"),te=ee=>{(!H||H.getSource().maxzoom<ee.getSource().maxzoom)&&(H=ee)};return W.forEach(ee=>te(ee)),H||K.forEach(ee=>te(ee)),H}(this.style,this.transform.zoom);E&&function(F,O,H){for(let q=0;q<H.length;q++)gi(F,O,H[q])}(this,E,E.getVisibleCoordinates())}this.options.showPadding&&function(E){const F=E.transform.padding;tl(E,E.transform.height-(F.top||0),3,Qo),tl(E,F.bottom||0,3,xc),gh(E,F.left||0,3,fh),gh(E,E.transform.width-(F.right||0),3,mh);const O=E.transform.centerPoint;(function(H,q,W,K){Ws(H,q-1,W-10,2,20,K),Ws(H,q-10,W-1,20,2,K)})(E,O.x,E.transform.height-O.y,el)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const i=this.terrainFacilitator.matrix,s=this.transform.modelViewProjectionMatrix;let l=this.terrainFacilitator.dirty;l||(l=e?!o.c0(i,s):!o.c1(i,s)),l||(l=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),l&&(o.c2(i,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,f){const _=h.context,x=_.gl,T=h.transform,P=Vt.unblended,A=new lt(x.LEQUAL,lt.ReadWrite,[0,1]),E=f.sourceCache.getRenderableTiles(),F=h.useProgram("terrainDepth");_.bindFramebuffer.set(f.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:o.b7.transparent,depth:1});for(const O of E){const H=f.getTerrainMesh(O.tileID),q=f.getTerrainData(O.tileID),W=T.getProjectionData({overscaledTileID:O.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),K={u_ele_delta:f.getMeshFrameDelta(T.zoom)};F.draw(_,x.TRIANGLES,A,mt.disabled,P,St.backCCW,K,q,W,"terrain",H.vertexBuffer,H.indexBuffer,H.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,f){const _=h.context,x=_.gl,T=h.transform,P=Vt.unblended,A=new lt(x.LEQUAL,lt.ReadWrite,[0,1]),E=f.getCoordsTexture(),F=f.sourceCache.getRenderableTiles(),O=h.useProgram("terrainCoords");_.bindFramebuffer.set(f.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:o.b7.transparent,depth:1}),f.coordsIndex=[];for(const H of F){const q=f.getTerrainMesh(H.tileID),W=f.getTerrainData(H.tileID);_.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,E.texture);const K={u_terrain_coords_id:(255-f.coordsIndex.length)/255,u_texture:0,u_ele_delta:f.getMeshFrameDelta(T.zoom)},te=T.getProjectionData({overscaledTileID:H.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});O.draw(_,x.TRIANGLES,A,mt.disabled,P,St.backCCW,K,W,te,"terrain",q.vertexBuffer,q.indexBuffer,q.segments),f.coordsIndex.push(H.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(e,i,s,l,h){s.isHidden(this.transform.zoom)||(s.type==="background"||s.type==="custom"||(l||[]).length)&&(this.id=s.id,o.c3(s)?function(f,_,x,T,P,A){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=A,F=mt.disabled,O=f.colorModeForRenderPass();(x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(H,q,W,K,te,ee,ie,se,re){const pe=q.transform,Me=q.style.map.terrain,xe=te==="map",ve=ee==="map";for(const be of H){const Ne=K.getTile(be),Oe=Ne.getBucket(W);if(!Oe||!Oe.text||!Oe.text.segments.get().length)continue;const Re=o.ak(Oe.textSizeData,pe.zoom),He=o.az(Ne,1,q.transform.zoom),gt=Qe(xe,q.transform,He),Pt=W.layout.get("icon-text-fit")!=="none"&&Oe.hasIconData();if(Re){const ri=Math.pow(2,pe.zoom-Ne.tileID.overscaledZ),Ut=Me?(ni,ai)=>Me.getElevation(be,ni,ai):null;dh(Oe,xe,ve,re,pe,gt,ri,Re,Pt,o.aA(pe,Ne,ie,se),be.toUnwrapped(),Ut)}}}(T,f,x,_,x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),P),x.paint.get("icon-opacity").constantOr(1)!==0&&Xo(f,_,x,T,!1,x.paint.get("icon-translate"),x.paint.get("icon-translate-anchor"),x.layout.get("icon-rotation-alignment"),x.layout.get("icon-pitch-alignment"),x.layout.get("icon-keep-upright"),F,O,E),x.paint.get("text-opacity").constantOr(1)!==0&&Xo(f,_,x,T,!0,x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.layout.get("text-keep-upright"),F,O,E),_.map.showCollisionBoxes&&(mc(f,_,x,T,!0),mc(f,_,x,T,!1))}(e,i,s,l,this.style.placement.variableOffsets,h):o.c4(s)?function(f,_,x,T,P){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=P,E=x.paint.get("circle-opacity"),F=x.paint.get("circle-stroke-width"),O=x.paint.get("circle-stroke-opacity"),H=!x.layout.get("circle-sort-key").isConstant();if(E.constantOr(1)===0&&(F.constantOr(1)===0||O.constantOr(1)===0))return;const q=f.context,W=q.gl,K=f.transform,te=f.getDepthModeForSublayer(0,lt.ReadOnly),ee=mt.disabled,ie=f.colorModeForRenderPass(),se=[],re=K.getCircleRadiusCorrection();for(let pe=0;pe<T.length;pe++){const Me=T[pe],xe=_.getTile(Me),ve=xe.getBucket(x);if(!ve)continue;const be=x.paint.get("circle-translate"),Ne=x.paint.get("circle-translate-anchor"),Oe=o.aA(K,xe,be,Ne),Re=ve.programConfigurations.get(x.id),He=f.useProgram("circle",Re),gt=ve.layoutVertexBuffer,Pt=ve.indexBuffer,ri=f.style.map.terrain&&f.style.map.terrain.getTerrainData(Me),Ut={programConfiguration:Re,program:He,layoutVertexBuffer:gt,indexBuffer:Pt,uniformValues:js(f,xe,x,Oe,re),terrainData:ri,projectionData:K.getProjectionData({overscaledTileID:Me,applyGlobeMatrix:!A,applyTerrainMatrix:!0})};if(H){const ni=ve.segments.get();for(const ai of ni)se.push({segments:new o.aJ([ai]),sortKey:ai.sortKey,state:Ut})}else se.push({segments:ve.segments,sortKey:0,state:Ut})}H&&se.sort((pe,Me)=>pe.sortKey-Me.sortKey);for(const pe of se){const{programConfiguration:Me,program:xe,layoutVertexBuffer:ve,indexBuffer:be,uniformValues:Ne,terrainData:Oe,projectionData:Re}=pe.state;xe.draw(q,W.TRIANGLES,te,ee,ie,St.backCCW,Ne,Oe,Re,x.id,ve,be,pe.segments,x.paint,f.transform.zoom,Me)}}(e,i,s,l,h):o.c5(s)?function(f,_,x,T,P){if(x.paint.get("heatmap-opacity")===0)return;const A=f.context,{isRenderingToTexture:E,isRenderingGlobe:F}=P;if(f.style.map.terrain){for(const O of T){const H=_.getTile(O);_.hasRenderableParent(O)||(f.renderPass==="offscreen"?Ko(f,H,x,O,F):f.renderPass==="translucent"&&gc(f,x,O,E,F))}A.viewport.set([0,0,f.width,f.height])}else f.renderPass==="offscreen"?function(O,H,q,W){const K=O.context,te=K.gl,ee=O.transform,ie=mt.disabled,se=new Vt([te.ONE,te.ONE],o.b7.transparent,[!0,!0,!0,!0]);(function(re,pe,Me){const xe=re.gl;re.activeTexture.set(xe.TEXTURE1),re.viewport.set([0,0,pe.width/4,pe.height/4]);let ve=Me.heatmapFbos.get(o.bW);ve?(xe.bindTexture(xe.TEXTURE_2D,ve.colorAttachment.get()),re.bindFramebuffer.set(ve.framebuffer)):(ve=Yo(re,pe.width/4,pe.height/4),Me.heatmapFbos.set(o.bW,ve))})(K,O,q),K.clear({color:o.b7.transparent});for(let re=0;re<W.length;re++){const pe=W[re];if(H.hasRenderableParent(pe))continue;const Me=H.getTile(pe),xe=Me.getBucket(q);if(!xe)continue;const ve=xe.programConfigurations.get(q.id),be=O.useProgram("heatmap",ve),Ne=ee.getProjectionData({overscaledTileID:pe,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Oe=ee.getCircleRadiusCorrection();be.draw(K,te.TRIANGLES,lt.disabled,ie,se,St.backCCW,va(Me,ee.zoom,q.paint.get("heatmap-intensity"),Oe),null,Ne,q.id,xe.layoutVertexBuffer,xe.indexBuffer,xe.segments,q.paint,ee.zoom,ve)}K.viewport.set([0,0,O.width,O.height])}(f,_,x,T):f.renderPass==="translucent"&&function(O,H){const q=O.context,W=q.gl;q.setColorMode(O.colorModeForRenderPass());const K=H.heatmapFbos.get(o.bW);K&&(q.activeTexture.set(W.TEXTURE0),W.bindTexture(W.TEXTURE_2D,K.colorAttachment.get()),q.activeTexture.set(W.TEXTURE1),_c(q,H).bind(W.LINEAR,W.CLAMP_TO_EDGE),O.useProgram("heatmapTexture").draw(q,W.TRIANGLES,lt.disabled,mt.disabled,O.colorModeForRenderPass(),St.disabled,Wu(O,H,0,1),null,null,H.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments,H.paint,O.transform.zoom))}(f,x)}(e,i,s,l,h):o.c6(s)?function(f,_,x,T,P){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=P,E=x.paint.get("line-opacity"),F=x.paint.get("line-width");if(E.constantOr(1)===0||F.constantOr(1)===0)return;const O=f.getDepthModeForSublayer(0,lt.ReadOnly),H=f.colorModeForRenderPass(),q=x.paint.get("line-dasharray"),W=x.paint.get("line-pattern"),K=W.constantOr(1),te=x.paint.get("line-gradient"),ee=x.getCrossfadeParameters(),ie=K?"linePattern":q?"lineSDF":te?"lineGradient":"line",se=f.context,re=se.gl,pe=f.transform;let Me=!0;for(const xe of T){const ve=_.getTile(xe);if(K&&!ve.patternsLoaded())continue;const be=ve.getBucket(x);if(!be)continue;const Ne=be.programConfigurations.get(x.id),Oe=f.context.program.get(),Re=f.useProgram(ie,Ne),He=Me||Re.program!==Oe,gt=f.style.map.terrain&&f.style.map.terrain.getTerrainData(xe),Pt=W.constantOr(null);if(Pt&&ve.imageAtlas){const Gt=ve.imageAtlas,zt=Gt.patternPositions[Pt.to.toString()],Ai=Gt.patternPositions[Pt.from.toString()];zt&&Ai&&Ne.setConstantPatternPositions(zt,Ai)}const ri=pe.getProjectionData({overscaledTileID:xe,applyGlobeMatrix:!A,applyTerrainMatrix:!0}),Ut=pe.getPixelScale(),ni=K?Ju(f,ve,x,Ut,ee):q?Qu(f,ve,x,Ut,q,ee):te?Yu(f,ve,x,Ut,be.lineClipsArray.length):Ns(f,ve,x,Ut);if(K)se.activeTexture.set(re.TEXTURE0),ve.imageAtlasTexture.bind(re.LINEAR,re.CLAMP_TO_EDGE),Ne.updatePaintBuffers(ee);else if(q&&(He||f.lineAtlas.dirty))se.activeTexture.set(re.TEXTURE0),f.lineAtlas.bind(se);else if(te){const Gt=be.gradients[x.id];let zt=Gt.texture;if(x.gradientVersion!==Gt.version){let Ai=256;if(x.stepInterpolant){const Bi=_.getSource().maxzoom,qi=xe.canonical.z===Bi?Math.ceil(1<<f.transform.maxZoom-xe.canonical.z):1;Ai=o.ae(o.bX(be.maxLineLength/o.Z*1024*qi),256,se.maxTextureSize)}Gt.gradient=o.bY({expression:x.gradientExpression(),evaluationKey:"lineProgress",resolution:Ai,image:Gt.gradient||void 0,clips:be.lineClipsArray}),Gt.texture?Gt.texture.update(Gt.gradient):Gt.texture=new jt(se,Gt.gradient,re.RGBA),Gt.version=x.gradientVersion,zt=Gt.texture}se.activeTexture.set(re.TEXTURE0),zt.bind(x.stepInterpolant?re.NEAREST:re.LINEAR,re.CLAMP_TO_EDGE)}const ai=f.stencilModeForClipping(xe);Re.draw(se,re.TRIANGLES,O,ai,H,St.disabled,ni,gt,ri,x.id,be.layoutVertexBuffer,be.indexBuffer,be.segments,x.paint,f.transform.zoom,Ne,be.layoutVertexBuffer2),Me=!1}}(e,i,s,l,h):o.c7(s)?function(f,_,x,T,P){const A=x.paint.get("fill-color"),E=x.paint.get("fill-opacity");if(E.constantOr(1)===0)return;const{isRenderingToTexture:F}=P,O=f.colorModeForRenderPass(),H=x.paint.get("fill-pattern"),q=f.opaquePassEnabledForLayer()&&!H.constantOr(1)&&A.constantOr(o.b7.transparent).a===1&&E.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===q){const W=f.getDepthModeForSublayer(1,f.renderPass==="opaque"?lt.ReadWrite:lt.ReadOnly);Gs(f,_,x,T,W,O,!1,F)}if(f.renderPass==="translucent"&&x.paint.get("fill-antialias")){const W=f.getDepthModeForSublayer(x.getPaintProperty("fill-outline-color")?2:0,lt.ReadOnly);Gs(f,_,x,T,W,O,!0,F)}}(e,i,s,l,h):o.c8(s)?function(f,_,x,T,P){const A=x.paint.get("fill-extrusion-opacity");if(A===0)return;const{isRenderingToTexture:E}=P;if(f.renderPass==="translucent"){const F=new lt(f.context.gl.LEQUAL,lt.ReadWrite,f.depthRangeFor3D);if(A!==1||x.paint.get("fill-extrusion-pattern").constantOr(1))qs(f,_,x,T,F,mt.disabled,Vt.disabled,E),qs(f,_,x,T,F,f.stencilModeFor3D(),f.colorModeForRenderPass(),E);else{const O=f.colorModeForRenderPass();qs(f,_,x,T,F,mt.disabled,O,E)}}}(e,i,s,l,h):o.c9(s)?function(f,_,x,T,P){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=P,E=f.context,F=f.style.projection.useSubdivision,O=f.getDepthModeForSublayer(0,lt.ReadOnly),H=f.colorModeForRenderPass();if(f.renderPass==="offscreen")(function(q,W,K,te,ee,ie,se){const re=q.context,pe=re.gl;for(const Me of K){const xe=W.getTile(Me),ve=xe.dem;if(!ve||!ve.data||!xe.needsHillshadePrepare)continue;const be=ve.dim,Ne=ve.stride,Oe=ve.getPixels();if(re.activeTexture.set(pe.TEXTURE1),re.pixelStoreUnpackPremultiplyAlpha.set(!1),xe.demTexture=xe.demTexture||q.getTileTexture(Ne),xe.demTexture){const He=xe.demTexture;He.update(Oe,{premultiply:!1}),He.bind(pe.NEAREST,pe.CLAMP_TO_EDGE)}else xe.demTexture=new jt(re,Oe,pe.RGBA,{premultiply:!1}),xe.demTexture.bind(pe.NEAREST,pe.CLAMP_TO_EDGE);re.activeTexture.set(pe.TEXTURE0);let Re=xe.fbo;if(!Re){const He=new jt(re,{width:be,height:be,data:null},pe.RGBA);He.bind(pe.LINEAR,pe.CLAMP_TO_EDGE),Re=xe.fbo=re.createFramebuffer(be,be,!0,!1),Re.colorAttachment.set(He.texture)}re.bindFramebuffer.set(Re.framebuffer),re.viewport.set([0,0,be,be]),q.useProgram("hillshadePrepare").draw(re,pe.TRIANGLES,ee,ie,se,St.disabled,Ld(xe.tileID,ve),null,null,te.id,q.rasterBoundsBuffer,q.quadTriangleIndexBuffer,q.rasterBoundsSegments),xe.needsHillshadePrepare=!1}})(f,_,T,x,O,mt.disabled,H),E.viewport.set([0,0,f.width,f.height]);else if(f.renderPass==="translucent")if(F){const[q,W,K]=f.stencilConfigForOverlapTwoPass(T);yc(f,_,x,K,q,O,H,!1,A),yc(f,_,x,K,W,O,H,!0,A)}else{const[q,W]=f.getStencilConfigForOverlapAndUpdateStencilID(T);yc(f,_,x,W,q,O,H,!1,A)}}(e,i,s,l,h):o.ca(s)?function(f,_,x,T,P){if(f.renderPass!=="translucent"||x.paint.get("raster-opacity")===0||!T.length)return;const{isRenderingToTexture:A}=P,E=_.getSource(),F=f.style.projection.useSubdivision;if(E instanceof Ce)Jo(f,_,x,T,null,!1,!1,E.tileCoords,E.flippedWindingOrder,A);else if(F){const[O,H,q]=f.stencilConfigForOverlapTwoPass(T);Jo(f,_,x,q,O,!1,!0,Hs,!1,A),Jo(f,_,x,q,H,!0,!0,Hs,!1,A)}else{const[O,H]=f.getStencilConfigForOverlapAndUpdateStencilID(T);Jo(f,_,x,H,O,!1,!0,Hs,!1,A)}}(e,i,s,l,h):o.cb(s)?function(f,_,x,T,P){const A=x.paint.get("background-color"),E=x.paint.get("background-opacity");if(E===0)return;const{isRenderingToTexture:F}=P,O=f.context,H=O.gl,q=f.style.projection,W=f.transform,K=W.tileSize,te=x.paint.get("background-pattern");if(f.isPatternMissing(te))return;const ee=!te&&A.a===1&&E===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==ee)return;const ie=mt.disabled,se=f.getDepthModeForSublayer(0,ee==="opaque"?lt.ReadWrite:lt.ReadOnly),re=f.colorModeForRenderPass(),pe=f.useProgram(te?"backgroundPattern":"background"),Me=T||oe(W,{tileSize:K,terrain:f.style.map.terrain});te&&(O.activeTexture.set(H.TEXTURE0),f.imageManager.bind(f.context));const xe=x.getCrossfadeParameters();for(const ve of Me){const be=W.getProjectionData({overscaledTileID:ve,applyGlobeMatrix:!F,applyTerrainMatrix:!0}),Ne=te?Fd(E,f,te,{tileID:ve,tileSize:K},xe):Bd(E,A),Oe=f.style.map.terrain&&f.style.map.terrain.getTerrainData(ve),Re=q.getMeshFromTileID(O,ve.canonical,!1,!0,"raster");pe.draw(O,H.TRIANGLES,se,ie,re,St.backCCW,Ne,Oe,be,x.id,Re.vertexBuffer,Re.indexBuffer,Re.segments)}}(e,0,s,l,h):o.cc(s)&&function(f,_,x,T){const{isRenderingGlobe:P}=T,A=f.context,E=x.implementation,F=f.style.projection,O=f.transform,H=O.getProjectionDataForCustomLayer(P),q={farZ:O.farZ,nearZ:O.nearZ,fov:O.fov*Math.PI/180,modelViewProjectionMatrix:O.modelViewProjectionMatrix,projectionMatrix:O.projectionMatrix,shaderData:{variantName:F.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
741
741
  uniform mat4 u_projection_matrix;
742
- ${F.shaderPreludeCode.vertexSource}`,define:F.shaderDefine},defaultProjectionData:H},W=E.renderingMode?E.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=E.prerender;K&&(f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),K.call(E,A.gl,q),A.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),A.setStencilMode(mt.disabled);const K=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,lt.ReadOnly);A.setDepthMode(K),E.render(A.gl,q),A.setDirty(),f.setBaseState(),A.bindFramebuffer.set(null)}}(e,0,s,h))}saveTileTexture(e){const i=this._tileTextures[e.size[0]];i?i.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const i=this._tileTextures[e];return i&&i.length>0?i.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const i=this.imageManager.getPattern(e.from.toString()),s=this.imageManager.getPattern(e.to.toString());return!i||!s}useProgram(e,i,s=!1,l=[]){this.cache=this.cache||{};const h=!!this.style.map.terrain,f=this.style.projection,_=s?ur.projectionMercator:f.shaderPreludeCode,x=s?ma:f.shaderDefine,T=e+(i?i.cacheKey:"")+`/${s?Mt:f.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(h?"/terrain":"")+(l?`/${l.join("/")}`:"");return this.cache[T]||(this.cache[T]=new Ro(this.context,ur[e],i,rh[e],this._showOverdrawInspector,h,_,x,l)),this.cache[T]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new jt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:i}=this.context.gl;return this.width!==e||this.height!==i}}function Xs(u,e){let i,s=!1,l=null,h=null;const f=()=>{l=null,s&&(u.apply(h,i),l=setTimeout(f,e),s=!1)};return(..._)=>(s=!0,h=this,i=_,l||f(),l)}class bc{constructor(e){this._getCurrentHash=()=>{const i=window.location.hash.replace("#","");if(this._hashName){let s;return i.split("&").map(l=>l.split("=")).forEach(l=>{l[0]===this._hashName&&(s=l)}),(s&&s[1]||"").split("/")}return i.split("/")},this._onHashChange=()=>{const i=this._getCurrentHash();if(!this._isValidHash(i))return!1;const s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:s,pitch:+(i[4]||0)}),!0},this._updateHashUnthrottled=()=>{const i=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,i)},this._removeHash=()=>{const i=this._getCurrentHash();if(i.length===0)return;const s=i.join("/");let l=s;l.split("&").length>0&&(l=l.split("&")[0]),this._hashName&&(l=`${this._hashName}=${s}`);let h=window.location.hash.replace(l,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let f=window.location.href.replace(/(#.+)?$/,h);f=f.replace("&&","&"),window.history.replaceState(window.history.state,null,f)},this._updateHash=Xs(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const i=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,l=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,l),f=Math.round(i.lng*h)/h,_=Math.round(i.lat*h)/h,x=this._map.getBearing(),T=this._map.getPitch();let P="";if(P+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(x||T)&&(P+="/"+Math.round(10*x)/10),T&&(P+=`/${Math.round(T)}`),this._hashName){const A=this._hashName;let E=!1;const F=window.location.hash.slice(1).split("&").map(O=>{const H=O.split("=")[0];return H===A?(E=!0,`${H}=${P}`):O}).filter(O=>O);return E||F.push(`${A}=${P}`),`#${F.join("&")}`}return`#${P}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new o.Q(+e[2],+e[1])}catch{return!1}const i=+e[0],s=+(e[3]||0),l=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&s>=-180&&s<=180&&l>=this._map.getMinPitch()&&l<=this._map.getMaxPitch()}}const mn={linearity:.3,easing:o.cd(0,0,.3,1)},wc=o.e({deceleration:2500,maxSpeed:1400},mn),Ks=o.e({deceleration:20,maxSpeed:1400},mn),Tc=o.e({deceleration:1e3,maxSpeed:360},mn),_h=o.e({deceleration:1e3,maxSpeed:90},mn),yh=o.e({deceleration:1e3,maxSpeed:360},mn);class xh{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Ee.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=Ee.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)i.zoom+=h.zoomDelta||0,i.bearing+=h.bearingDelta||0,i.pitch+=h.pitchDelta||0,i.roll+=h.rollDelta||0,h.panDelta&&i.pan._add(h.panDelta),h.around&&(i.around=h.around),h.pinchAround&&(i.pinchAround=h.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,l={};if(i.pan.mag()){const h=es(i.pan.mag(),s,o.e({},wc,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,Qa(l,h)}if(i.zoom){const h=es(i.zoom,s,Ks);l.zoom=this._map.transform.zoom+h.amount,Qa(l,h)}if(i.bearing){const h=es(i.bearing,s,Tc);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),Qa(l,h)}if(i.pitch){const h=es(i.pitch,s,_h);l.pitch=this._map.transform.pitch+h.amount,Qa(l,h)}if(i.roll){const h=es(i.roll,s,yh);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),Qa(l,h)}if(l.zoom||l.bearing){const h=i.pinchAround===void 0?i.around:i.pinchAround;l.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),o.e(l,{noMoveStart:!0})}}function Qa(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function es(u,e,i){const{maxSpeed:s,linearity:l,deceleration:h}=i,f=o.ae(u*l/(e/1e3),-s,s),_=Math.abs(f)/(h*l);return{easing:i.easing,duration:1e3*_,amount:f*(_/2)}}class Ei extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s,l={}){s=s instanceof MouseEvent?s:new MouseEvent(e,s);const h=le.mousePos(i.getCanvas(),s),f=i.unproject(h);super(e,o.e({point:h,lngLat:f,originalEvent:s},l)),this._defaultPrevented=!1,this.target=i}}class ts extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){const l=e==="touchend"?s.changedTouches:s.touches,h=le.touchPos(i.getCanvasContainer(),l),f=h.map(x=>i.unproject(x)),_=h.reduce((x,T,P,A)=>x.add(T.div(A.length)),new o.P(0,0));super(e,{points:h,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class Mc extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class vh{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Mc(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new Ei(e.type,this._map,e))}mouseup(e){this._map.fire(new Ei(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new Ei(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Ei(e.type,this._map,e))}mouseover(e){this._map.fire(new Ei(e.type,this._map,e))}mouseout(e){this._map.fire(new Ei(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ts(e.type,this._map,e))}touchmove(e){this._map.fire(new ts(e.type,this._map,e))}touchend(e){this._map.fire(new ts(e.type,this._map,e))}touchcancel(e){this._map.fire(new ts(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class bh{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Ei(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ei("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Ei(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class is{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(o.P.convert(e),this._map.terrain)}}class Sc{constructor(e,i){this._map=e,this._tr=new is(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,i){this.isEnabled()&&e.shiftKey&&e.button===0&&(le.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;const s=i;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const l=this._startPos;this._lastPos=s,this._box||(this._box=le.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const h=Math.min(l.x,s.x),f=Math.max(l.x,s.x),_=Math.min(l.y,s.y),x=Math.max(l.y,s.y);le.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=x-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),le.suppressClick(),s.x!==l.x||s.y!==l.y)return this._map.fire(new o.l("boxzoomend",{originalEvent:e})),{cameraAnimation:h=>h.fitScreenCoordinates(s,l,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(le.remove(this._box),this._box=null),le.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function il(u,e){if(u.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${u.length}, points ${e.length}`);const i={};for(let s=0;s<u.length;s++)i[u[s].identifier]=e[s];return i}class wh{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),s.length===this.numTouches&&(this.centroid=function(l){const h=new o.P(0,0);for(const f of l)h._add(f);return h.div(l.length)}(i),this.touches=il(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=il(s,i);for(const h in this.touches){const f=l[h];(!f||f.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(e,i,s){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const l=!this.aborted&&this.centroid;if(this.reset(),l)return l}}}class rs{constructor(e){this.singleTap=new wh(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,i,s){this.singleTap.touchstart(e,i,s)}touchmove(e,i,s){this.singleTap.touchmove(e,i,s)}touchend(e,i,s){const l=this.singleTap.touchend(e,i,s);if(l){const h=e.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(l)<30;if(h&&f||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=l,this.count===this.numTaps)return this.reset(),l}}}class Th{constructor(e){this._tr=new is(e),this._zoomIn=new rs({numTouches:1,numTaps:2}),this._zoomOut=new rs({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,s){this._zoomIn.touchstart(e,i,s),this._zoomOut.touchstart(e,i,s)}touchmove(e,i,s){this._zoomIn.touchmove(e,i,s),this._zoomOut.touchmove(e,i,s)}touchend(e,i,s){const l=this._zoomIn.touchend(e,i,s),h=this._zoomOut.touchend(e,i,s),f=this._tr;return l?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(l)},{originalEvent:e})}):h?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom-1,around:f.unproject(h)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ir{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const i=this._moveFunction(...e);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(e,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,i){if(!this.isEnabled())return;const s=this._lastPoint;if(!s)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const l=Array.isArray(i)?i[0]:i;return!this._moved&&l.dist(s)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=l,this._move(s,l))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&le.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Qr={0:1,2:2};class ns{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=le.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=Qr[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return le.mouseButton(e)===this._eventButton}}class en{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class as{constructor(e=new ns({checkCorrectEvent:()=>!0}),i=new en){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(e,i,s){return e instanceof MouseEvent?i(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?s(e):void 0}startMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.startMove(i),i=>this.oneFingerTouchMoveStateManager.startMove(i))}endMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.endMove(i),i=>this.oneFingerTouchMoveStateManager.endMove(i))}isValidStartEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidStartEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidStartEvent(i))}isValidMoveEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidMoveEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(i))}isValidEndEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidEndEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidEndEvent(i))}}const rl=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class qd{constructor(e,i){this._clickTolerance=e.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,i,s){return this._calculateTransform(e,i,s)}touchmove(e,i,s){if(this._active){if(!this._shouldBePrevented(s.length))return e.preventDefault(),this._calculateTransform(e,i,s);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,i,s){this._calculateTransform(e,i,s),this._active&&this._shouldBePrevented(s.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,s){s.length>0&&(this._active=!0);const l=il(s,i),h=new o.P(0,0),f=new o.P(0,0);let _=0;for(const T in l){const P=l[T],A=this._touches[T];A&&(h._add(P),f._add(P.sub(A)),_++,l[T]=P)}if(this._touches=l,this._shouldBePrevented(_)||!f.mag())return;const x=f.div(_);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:x}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Pc{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,i,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([i[0],i[1]]))}touchmove(e,i,s){if(!this._firstTwoTouches)return;e.preventDefault();const[l,h]=this._firstTwoTouches,f=nl(s,i,l),_=nl(s,i,h);if(!f||!_)return;const x=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],x,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=nl(s,i,l),_=nl(s,i,h);f&&_||(this._active&&le.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function nl(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function Cc(u,e){return Math.log(u/e)/Math.LN2}class ss extends Pc{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,i){const s=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Cc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Cc(this._distance,s),pinchAround:i}}}function gn(u,e){return 180*u.angleWith(e)/Math.PI}class $e extends Pc{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,i,s){const l=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:gn(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=gn(e,this._startVector);return Math.abs(s)<i}}function al(u){return Math.abs(u.y)>Math.abs(u.x)}class sl extends Pc{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,i,s){super.touchstart(e,i,s),this._currentTouchCount=s.length}_start(e){this._lastPoints=e,al(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,i,s){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const l=e[0].sub(this._lastPoints[0]),h=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(l,h,s.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(l.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(e,i,s){if(this._valid!==void 0)return this._valid;const l=e.mag()>=2,h=i.mag()>=2;if(!l&&!h)return;if(!l||!h)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=e.y>0==i.y>0;return al(e)&&al(i)&&f}}const Mh={panStep:100,bearingStep:15,pitchStep:10};class os{constructor(e){this._tr=new is(e);const i=Mh;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,s=0,l=0,h=0,f=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?s=-1:(e.preventDefault(),h=-1);break;case 39:e.shiftKey?s=1:(e.preventDefault(),h=1);break;case 38:e.shiftKey?l=1:(e.preventDefault(),f=-1);break;case 40:e.shiftKey?l=-1:(e.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,l=0),{cameraAnimation:_=>{const x=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Ys,zoom:i?Math.round(x.zoom)+i*(e.shiftKey?2:1):x.zoom,bearing:x.bearing+s*this._bearingStep,pitch:x.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:x.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Ys(u){return u*(2-u)}const Ic=4.000244140625;class vt{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new is(e),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const s=Ee.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%Ic==0?this._type="wheel":i!==0&&Math.abs(i)<4?this._type="trackpad":l>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(l*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=le.mousePos(this._map.getCanvas(),e),s=this._tr;this._aroundPoint=this._aroundCenter?s.transform.locationToScreenPoint(o.Q.convert(s.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>Ic?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&x!==0&&(x=1/x);const T=typeof this._targetZoom!="number"?e.scale:o.ac(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),o.ah(T*x)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,s=this._startZoom,l=this._easing;let h,f=!1;if(this._type==="wheel"&&s&&l){const _=Ee.now()-this._lastWheelEventTime,x=Math.min((_+5)/200,1),T=l(x);h=o.B.number(s,i,T),x<1?this._frameId||(this._frameId=!0):f=!0}else h=i,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=h,{noInertia:!0,needsRenderFrame:!f,zoomDelta:h-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=o.cf;if(this._prevEase){const s=this._prevEase,l=(Ee.now()-s.start)/s.duration,h=s.easing(l+.01)-s.easing(l),f=.27/Math.sqrt(h*h+1e-4)*.01,_=Math.sqrt(.0729-f*f);i=o.cd(f,_,.25,1)}return this._prevEase={start:Ee.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ol{constructor(e,i){this._clickZoom=e,this._tapZoom=i}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Hd{constructor(e){this._tr=new is(e),this.reset()}reset(){this._active=!1}dblclick(e,i){return e.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ec{constructor(){this._tap=new rs({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,i,s){if(!this._swipePoint)if(this._tapTime){const l=i[0],h=e.timeStamp-this._tapTime<500,f=this._tapPoint.dist(l)<30;h&&f?s.length>0&&(this._swipePoint=l,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(e,i,s)}touchmove(e,i,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const l=i[0],h=l.y-this._swipePoint.y;return this._swipePoint=l,e.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(e,i,s)}touchend(e,i,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{const l=this._tap.touchend(e,i,s);l&&(this._tapTime=e.timeStamp,this._tapPoint=l)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Sh{constructor(e,i,s){this._el=e,this._mousePan=i,this._touchPan=s}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Ph{constructor(e,i,s,l){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=i,this._mousePitch=s,this._mouseRoll=l}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Ac{constructor(e,i,s,l){this._el=e,this._touchZoom=i,this._touchRotate=s,this._tapDragZoom=l,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-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()}}class ll{constructor(e,i){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=le.create("div","maplibregl-cooperative-gesture-screen",e);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const s=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),l=document.createElement("div");l.className="maplibregl-desktop-message",l.textContent=i,this._container.appendChild(l);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=s,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(le.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new o.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Js=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Wd extends o.l{}function cl(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class Xd{constructor(e,i){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,h)=>{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const f=l.type==="renderFrame"?void 0:l,_={needsRenderFrame:!1},x={},T={};for(const{handlerName:E,handler:F,allowed:O}of this._handlers){if(!F.isEnabled())continue;let H;if(this._blockedByActive(T,O,E))F.reset();else if(F[h||l.type]){if(o.cg(l,h||l.type)){const q=le.mousePos(this._map.getCanvas(),l);H=F[h||l.type](l,q)}else if(o.ch(l,h||l.type)){const q=this._getMapTouches(l.touches),W=le.touchPos(this._map.getCanvas(),q);H=F[h||l.type](l,W,q)}else o.ci(h||l.type)||(H=F[h||l.type](l));this.mergeHandlerResult(_,x,H,E,f),H&&H.needsRenderFrame&&this._triggerRenderFrame()}(H||F.isActive())&&(T[E]=F)}const P={};for(const E in this._previousActiveHandlers)T[E]||(P[E]=f);this._previousActiveHandlers=T,(Object.keys(P).length||cl(_))&&(this._changes.push([_,x,P]),this._triggerRenderFrame()),(Object.keys(T).length||cl(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:A}=_;A&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],A(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new xh(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[l,h,f]of this._listeners)le.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)le.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new vh(i,e));const l=i.boxZoom=new Sc(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new ll(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new Th(i),_=new Hd(i);i.doubleClickZoom=new ol(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const x=new Ec;this._add("tapDragZoom",x);const T=i.touchPitch=new sl(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const P=()=>i.project(i.getCenter()),A=function({enable:ee,clickTolerance:ie,aroundCenter:se=!0,minPixelCenterThreshold:re=100,rotateDegreesPerPixelMoved:pe=.8},Me){const xe=new ns({checkCorrectEvent:ve=>le.mouseButton(ve)===0&&ve.ctrlKey||le.mouseButton(ve)===2&&!ve.ctrlKey});return new ir({clickTolerance:ie,move:(ve,be)=>{const Ne=Me();if(se&&Math.abs(Ne.y-ve.y)>re)return{bearingDelta:o.ce(new o.P(ve.x,be.y),be,Ne)};let Oe=(be.x-ve.x)*pe;return se&&be.y<Ne.y&&(Oe=-Oe),{bearingDelta:Oe}},moveStateManager:xe,enable:ee,assignEvents:rl})}(e,P),E=function({enable:ee,clickTolerance:ie,pitchDegreesPerPixelMoved:se=-.5}){const re=new ns({checkCorrectEvent:pe=>le.mouseButton(pe)===0&&pe.ctrlKey||le.mouseButton(pe)===2});return new ir({clickTolerance:ie,move:(pe,Me)=>({pitchDelta:(Me.y-pe.y)*se}),moveStateManager:re,enable:ee,assignEvents:rl})}(e),F=function({enable:ee,clickTolerance:ie,rollDegreesPerPixelMoved:se=.3},re){const pe=new ns({checkCorrectEvent:Me=>le.mouseButton(Me)===2&&Me.ctrlKey});return new ir({clickTolerance:ie,move:(Me,xe)=>{const ve=re();let be=(xe.x-Me.x)*se;return xe.y<ve.y&&(be=-be),{rollDelta:be}},moveStateManager:pe,enable:ee,assignEvents:rl})}(e,P);i.dragRotate=new Ph(e,A,E,F),this._add("mouseRotate",A,["mousePitch"]),this._add("mousePitch",E,["mouseRotate","mouseRoll"]),this._add("mouseRoll",F,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const O=function({enable:ee,clickTolerance:ie}){const se=new ns({checkCorrectEvent:re=>le.mouseButton(re)===0&&!re.ctrlKey});return new ir({clickTolerance:ie,move:(re,pe)=>({around:pe,panDelta:pe.sub(re)}),activateOnStart:!0,moveStateManager:se,enable:ee,assignEvents:rl})}(e),H=new qd(e,i);i.dragPan=new Sh(s,O,H),this._add("mousePan",O),this._add("touchPan",H,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const q=new $e,W=new ss;i.touchZoomRotate=new Ac(s,W,q,x),this._add("touchRotate",q,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const K=i.scrollZoom=new vt(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const te=i.keyboard=new os(i);this._add("keyboard",te),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new bh(i))}_add(e,i,s){this._handlers.push({handlerName:e,handler:i,allowed:s}),this._handlersById[e]=i}stop(e){if(!this._updatingCamera){for(const{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Js(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,i,s){for(const l in e)if(l!==s&&(!i||i.indexOf(l)<0))return!0;return!1}_getMapTouches(e){const i=[];for(const s of e)this._el.contains(s.target)&&i.push(s);return i}mergeHandlerResult(e,i,s,l,h){if(!s)return;o.e(e,s);const f={handlerName:l,originalEvent:s.originalEvent||h};s.zoomDelta!==void 0&&(i.zoom=f),s.panDelta!==void 0&&(i.drag=f),s.rollDelta!==void 0&&(i.roll=f),s.pitchDelta!==void 0&&(i.pitch=f),s.bearingDelta!==void 0&&(i.rotate=f)}_applyChanges(){const e={},i={},s={};for(const[l,h,f]of this._changes)l.panDelta&&(e.panDelta=(e.panDelta||new o.P(0,0))._add(l.panDelta)),l.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+l.zoomDelta),l.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+l.bearingDelta),l.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+l.pitchDelta),l.rollDelta&&(e.rollDelta=(e.rollDelta||0)+l.rollDelta),l.around!==void 0&&(e.around=l.around),l.pinchAround!==void 0&&(e.pinchAround=l.pinchAround),l.noInertia&&(e.noInertia=l.noInertia),o.e(i,h),o.e(s,f);this._updateMapTransform(e,i,s),this._changes=[]}_updateMapTransform(e,i,s){const l=this._map,h=l._getTransformForUpdate(),f=l.terrain;if(!(cl(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:T,pitchDelta:P,rollDelta:A,around:E,pinchAround:F}=e;F!==void 0&&(E=F),E=E||l.transform.centerPoint,f&&!h.isPointOnMapSurface(E)&&(E=h.centerPoint);const O={panDelta:_,zoomDelta:x,rollDelta:A,pitchDelta:P,bearingDelta:T,around:E};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(E)&&(E=h.centerPoint);const H=E.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?E.sub(_):E);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(O,h,H):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(O,h,H))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._map.cameraHelper.handleMapControlsPan(O,h,H)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=Js(this._eventsInProgress),h=Js(e),f={};for(const A in e){const{originalEvent:E}=e[A];this._eventsInProgress[A]||(f[`${A}start`]=E),this._eventsInProgress[A]=e[A]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const A in f)this._fireEvent(A,f[A]);h&&this._fireEvent("move",h.originalEvent);for(const A in e){const{originalEvent:E}=e[A];this._fireEvent(A,E)}const _={};let x;for(const A in this._eventsInProgress){const{handlerName:E,originalEvent:F}=this._eventsInProgress[A];this._handlersById[E].isActive()||(delete this._eventsInProgress[A],x=i[E]||F,_[`${A}end`]=x)}for(const A in _)this._fireEvent(A,_[A]);const T=Js(this._eventsInProgress),P=(l||h)&&!T;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const A=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&A.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(A)}if(s&&P){this._updatingCamera=!0;const A=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),E=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!A||!A.essential&&Ee.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:x})),E(this._map.getBearing())&&this._map.resetNorth()):(E(A.bearing||this._map.getBearing())&&(A.bearing=0),A.freezeElevation=!0,this._map.easeTo(A,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new o.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Wd("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Kd extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((Ee.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(l)),l<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=s.bearingSnap,this.cameraHelper=i,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,i){e.apply(this.transform),this.transform=e,this.cameraHelper=i}getCenter(){return new o.Q(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,i){return this.jumpTo({elevation:e},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,s){return e=o.P.convert(e).mult(-1),this.panTo(this.transform.center,o.e({offset:e},i),s)}panTo(e,i,s){return this.easeTo(o.e({center:e},i),s)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(e,i,s){return this.easeTo(o.e({zoom:e},i),s)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)).fire(new o.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(e,i,s){return this.easeTo(o.e({bearing:e},i),s)}resetNorth(e,i){return this.rotateTo(0,o.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(o.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,i):this}getPitch(){return this.transform.pitch}setPitch(e,i){return this.jumpTo({pitch:e},i),this}getRoll(){return this.transform.roll}setRoll(e,i){return this.jumpTo({roll:e},i),this}cameraForBounds(e,i){e=Zt.convert(e).adjustAntiMeridian();const s=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),s,i)}_cameraForBoxAndBearing(e,i,s,l){const h={top:0,bottom:0,right:0,left:0};if(typeof(l=o.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},l)).padding=="number"){const T=l.padding;l.padding={top:T,bottom:T,right:T,left:T}}const f=o.e(h,l.padding);l.padding=f;const _=this.transform,x=new Zt(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,x,s,_)}fitBounds(e,i,s){return this._fitInternal(this.cameraForBounds(e,i),i,s)}fitScreenCoordinates(e,i,s,l,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(o.P.convert(e)),this.transform.screenPointToLocation(o.P.convert(i)),s,l),l,h)}_fitInternal(e,i,s){return e?(delete(i=o.e(e,i)).padding,i.linear?this.easeTo(i,s):this.flyTo(i,s)):this}jumpTo(e,i){this.stop();const s=this._getTransformForUpdate();let l=!1,h=!1,f=!1;const _=s.zoom;this.cameraHelper.handleJumpToCenterZoom(s,e);const x=s.zoom!==_;return"elevation"in e&&s.elevation!==+e.elevation&&s.setElevation(+e.elevation),"bearing"in e&&s.bearing!==+e.bearing&&(l=!0,s.setBearing(+e.bearing)),"pitch"in e&&s.pitch!==+e.pitch&&(h=!0,s.setPitch(+e.pitch)),"roll"in e&&s.roll!==+e.roll&&(f=!0,s.setRoll(+e.roll)),e.padding==null||s.isPaddingEqual(e.padding)||s.setPadding(e.padding),this._applyUpdatedTransform(s),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)),x&&this.fire(new o.l("zoomstart",i)).fire(new o.l("zoom",i)).fire(new o.l("zoomend",i)),l&&this.fire(new o.l("rotatestart",i)).fire(new o.l("rotate",i)).fire(new o.l("rotateend",i)),h&&this.fire(new o.l("pitchstart",i)).fire(new o.l("pitch",i)).fire(new o.l("pitchend",i)),f&&this.fire(new o.l("rollstart",i)).fire(new o.l("roll",i)).fire(new o.l("rollend",i)),this.fire(new o.l("moveend",i))}calculateCameraOptionsFromTo(e,i,s,l=0){const h=o.$.fromLngLat(e,i),f=o.$.fromLngLat(s,l),_=f.x-h.x,x=f.y-h.y,T=f.z-h.z,P=Math.hypot(_,x,T);if(P===0)throw new Error("Can't calculate camera options with same From and To");const A=Math.hypot(_,x),E=o.ah(this.transform.cameraToCenterDistance/P/this.transform.tileSize),F=180*Math.atan2(_,-x)/Math.PI;let O=180*Math.acos(A/P)/Math.PI;return O=T<0?90-O:90+O,{center:f.toLngLat(),elevation:l,zoom:E,pitch:O,bearing:F}}calculateCameraOptionsFromCameraLngLatAltRotation(e,i,s,l,h){const f=this.transform.calculateCenterFromCameraLngLatAlt(e,i,s,l);return{center:f.center,elevation:f.elevation,zoom:f.zoom,bearing:s,pitch:l,roll:h}}easeTo(e,i){this._stop(!1,e.easeId),((e=o.e({offset:[0,0],duration:500,easing:o.cf},e)).animate===!1||!e.essential&&Ee.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),l=this.getBearing(),h=s.pitch,f=s.roll,_="bearing"in e?this._normalizeBearing(e.bearing,l):l,x="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,P="padding"in e?e.padding:s.padding,A=o.P.convert(e.offset);let E,F;e.around&&(E=o.Q.convert(e.around),F=s.locationToScreenPoint(E));const O={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},H=this.cameraHelper.handleEaseTo(s,{bearing:_,pitch:x,roll:T,padding:P,around:E,aroundPoint:F,offsetAsPoint:A,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||x!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(P),this._zooming=this._zooming||H.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,O),this.terrain&&this._prepareElevation(H.elevationCenter),this._ease(q=>{H.easeFunc(q),this.terrain&&!e.freezeElevation&&this._updateElevation(q),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},q=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,q)},e),this}_prepareEase(e,i,s={}){this._moving=!0,i||s.moving||this.fire(new o.l("movestart",e)),this._zooming&&!s.zooming&&this.fire(new o.l("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new o.l("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new o.l("pitchstart",e)),this._rolling&&!s.rolling&&this.fire(new o.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const s=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(s-(i-(s*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(o.B.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),s=e.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(s<l){const h=this.calculateCameraOptionsFromTo(i,l,e.center,e.elevation);return{pitch:h.pitch,zoom:h.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(l=>this._elevateCameraIfInsideTerrain(l)),this.transformCameraUpdate&&i.push(l=>this.transformCameraUpdate(l)),!i.length)return;const s=e.clone();for(const l of i){const h=s.clone(),{center:f,zoom:_,roll:x,pitch:T,bearing:P,elevation:A}=l(h);f&&h.setCenter(f),A!==void 0&&h.setElevation(A),_!==void 0&&h.setZoom(_),x!==void 0&&h.setRoll(x),T!==void 0&&h.setPitch(T),P!==void 0&&h.setBearing(P),s.apply(h)}this.transform.apply(s)}_fireMoveEvents(e){this.fire(new o.l("move",e)),this._zooming&&this.fire(new o.l("zoom",e)),this._rotating&&this.fire(new o.l("rotate",e)),this._pitching&&this.fire(new o.l("pitch",e)),this._rolling&&this.fire(new o.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const s=this._zooming,l=this._rotating,h=this._pitching,f=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,s&&this.fire(new o.l("zoomend",e)),l&&this.fire(new o.l("rotateend",e)),h&&this.fire(new o.l("pitchend",e)),f&&this.fire(new o.l("rollend",e)),this.fire(new o.l("moveend",e))}flyTo(e,i){if(!e.essential&&Ee.prefersReducedMotion){const be=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(be,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cf},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,_=s.padding,x="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,P="roll"in e?this._normalizeBearing(e.roll,f):f,A="padding"in e?e.padding:s.padding,E=o.P.convert(e.offset);let F=s.centerPoint.add(E);const O=s.screenPointToLocation(F),H=this.cameraHelper.handleFlyTo(s,{bearing:x,pitch:T,roll:P,padding:A,locationAtOffset:O,offsetAsPoint:E,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let q=e.curve;const W=Math.max(s.width,s.height),K=W/H.scaleOfZoom,te=H.pixelPathLength;typeof H.scaleOfMinZoom=="number"&&(q=Math.sqrt(W/H.scaleOfMinZoom/te*2));const ee=q*q;function ie(be){const Ne=(K*K-W*W+(be?-1:1)*ee*ee*te*te)/(2*(be?K:W)*ee*te);return Math.log(Math.sqrt(Ne*Ne+1)-Ne)}function se(be){return(Math.exp(be)-Math.exp(-be))/2}function re(be){return(Math.exp(be)+Math.exp(-be))/2}const pe=ie(!1);let Me=function(be){return re(pe)/re(pe+q*be)},xe=function(be){return W*((re(pe)*(se(Ne=pe+q*be)/re(Ne))-se(pe))/ee)/te;var Ne},ve=(ie(!0)-pe)/q;if(Math.abs(te)<2e-6||!isFinite(ve)){if(Math.abs(W-K)<1e-6)return this.easeTo(e,i);const be=K<W?-1:1;ve=Math.abs(Math.log(K/W))/q,xe=()=>0,Me=Ne=>Math.exp(be*q*Ne)}return e.duration="duration"in e?+e.duration:1e3*ve/("screenSpeed"in e?+e.screenSpeed/q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==x,this._pitching=T!==h,this._rolling=P!==f,this._padding=!s.isPaddingEqual(A),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(H.targetCenter),this._ease(be=>{const Ne=be*ve,Oe=1/Me(Ne),Re=xe(Ne);this._rotating&&s.setBearing(o.B.number(l,x,be)),this._pitching&&s.setPitch(o.B.number(h,T,be)),this._rolling&&s.setRoll(o.B.number(f,P,be)),this._padding&&(s.interpolatePadding(_,A,be),F=s.centerPoint.add(E)),H.easeFunc(be,Oe,Re,F),this.terrain&&!e.freezeElevation&&this._updateElevation(be),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,i){var s;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const l=this._onEaseEnd;delete this._onEaseEnd,l.call(this,i)}return e||(s=this.handlers)===null||s===void 0||s.stop(!1),this}_ease(e,i,s){s.animate===!1||s.duration===0?(e(1),i()):(this._easeStart=Ee.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=o.aL(e,-180,180);const s=Math.abs(e-i);return Math.abs(e-360-i)<s&&(e-=360),Math.abs(e+360-i)<s&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(o.Q.convert(e),this.transform.tileZoom):null}}const zn={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Xt{constructor(e=zn){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=i=>{!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"&&i.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=le.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=le.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=le.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){le.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,i){const s=this._map._getUIString(`AttributionControl.${i}`);e.title=s,e.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(l=>typeof l!="string"?"":l)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const l=this._map.style.stylesheet;this.styleOwner=l.owner,this.styleId=l.id}const i=this._map.style.sourceCaches;for(const l in i){const h=i[l];if(h.used||h.usedForTerrain){const f=h.getSource();f.attribution&&e.indexOf(f.attribution)<0&&e.push(f.attribution)}}e=e.filter(l=>String(l).trim()),e.sort((l,h)=>l.length-h.length),e=e.filter((l,h)=>{for(let f=h+1;f<e.length;f++)if(e[f].indexOf(l)>=0)return!1;return!0});const s=e.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,e.length?(this._innerContainer.innerHTML=le.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Qs{constructor(e={}){this._updateCompact=()=>{const i=this._container.children;if(i.length){const s=i[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=le.create("div","maplibregl-ctrl");const i=le.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){le.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class kc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){const i=this._currentlyRunning,s=i?this._queue.concat(i):this._queue;for(const l of s)if(l.id===e)return void(l.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const i=this._currentlyRunning=this._queue;this._queue=[];for(const s of i)if(!s.cancelled&&(s.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ch=o.aG([{name:"a_pos3d",type:"Int16",components:3}]);class Ih extends o.E{constructor(e){super(),this._lastTilesetChange=Ee.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const s={};for(const l of oe(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))s[l.key]=!0,this._renderableTilesKeys.push(l.key),this._tiles[l.key]||(l.terrainRttPosMatrix32f=new Float64Array(16),o.bQ(l.terrainRttPosMatrix32f,0,o.Z,o.Z,0,0,1),this._tiles[l.key]=new In(l,this.tileSize),this._lastTilesetChange=Ee.now());for(const l in this._tiles)s[l]||delete this._tiles[l]}freeRtt(e){for(const i in this._tiles){const s=this._tiles[i];(!e||s.tileID.equals(e)||s.tileID.isChildOf(e)||e.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,i){return i?this._getTerrainCoordsForTileRanges(e,i):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const s of this._renderableTilesKeys){const l=this._tiles[s].tileID,h=e.clone(),f=o.b2();if(l.canonical.equals(e.canonical))o.bQ(f,0,o.Z,o.Z,0,0,1);else if(l.canonical.isChildOf(e.canonical)){const _=l.canonical.z-e.canonical.z,x=l.canonical.x-(l.canonical.x>>_<<_),T=l.canonical.y-(l.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,P,P,0,0,1),o.L(f,f,[-x*P,-T*P,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const _=e.canonical.z-l.canonical.z,x=e.canonical.x-(e.canonical.x>>_<<_),T=e.canonical.y-(e.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,o.Z,o.Z,0,0,1),o.L(f,f,[x*P,T*P,0]),o.M(f,f,[1/2**_,1/2**_,0])}}h.terrainRttPosMatrix32f=new Float32Array(f),i[s]=h}return i}_getTerrainCoordsForTileRanges(e,i){const s={};for(const l of this._renderableTilesKeys){const h=this._tiles[l].tileID;if(!this._isWithinTileRanges(h,i))continue;const f=e.clone(),_=o.b2();if(h.canonical.z===e.canonical.z){const x=e.canonical.x-h.canonical.x,T=e.canonical.y-h.canonical.y;o.bQ(_,0,o.Z,o.Z,0,0,1),o.L(_,_,[x*o.Z,T*o.Z,0])}else if(h.canonical.z>e.canonical.z){const x=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>x<<x),P=h.canonical.y-(h.canonical.y>>x<<x),A=e.canonical.x-(h.canonical.x>>x),E=e.canonical.y-(h.canonical.y>>x),F=o.Z>>x;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[-T*F+A*o.Z,-P*F+E*o.Z,0])}else{const x=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>x<<x),P=e.canonical.y-(e.canonical.y>>x<<x),A=(e.canonical.x>>x)-h.canonical.x,E=(e.canonical.y>>x)-h.canonical.y,F=o.Z<<x;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[T*o.Z+A*F,P*o.Z+E*F,0])}f.terrainRttPosMatrix32f=new Float32Array(_),s[l]=f}return s}getSourceTile(e,i){const s=this.sourceCache._source;let l=e.overscaledZ-this.deltaZoom;if(l>s.maxzoom&&(l=s.maxzoom),l<s.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(l).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!h||!h.dem)&&i)for(;l>=s.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(e.scaledTo(l--).key);return h}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,i){return i[e.canonical.z]&&e.canonical.x>=i[e.canonical.z].minTileX&&e.canonical.x<=i[e.canonical.z].maxTileX&&e.canonical.y>=i[e.canonical.z].minTileY&&e.canonical.y<=i[e.canonical.z].maxTileY}}class Eh{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new Ih(i),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,s,l=o.Z){var h;if(!(i>=0&&i<l&&s>=0&&s<l))return 0;const f=this.getTerrainData(e),_=(h=f.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const x=o.cj([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[x[0]*_.dim,x[1]*_.dim],P=Math.floor(T[0]),A=Math.floor(T[1]),E=T[0]-P,F=T[1]-A;return _.get(P,A)*(1-E)*(1-F)+_.get(P+1,A)*E*(1-F)+_.get(P,A+1)*(1-E)*F+_.get(P+1,A+1)*E*F}getElevationForLngLatZoom(e,i){if(!o.ck(i,e.wrap()))return 0;const{tileID:s,mercatorX:l,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(s,l%o.Z,h%o.Z,o.Z)}getElevation(e,i,s,l=o.Z){return this.getDEMElevation(e,i,s,l)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const l=this.painter.context,h=new o.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new jt(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new jt(l,new o.R({width:1,height:1}),l.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=o.ad([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const l=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new jt(l,i.dem.getPixels(),l.gl.RGBA,{premultiply:!1}),i.demTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const s=i&&i+i.tileID.key+e.key;if(s&&!this._demMatrixCache[s]){const l=this.sourceCache.sourceCache._source.maxzoom;let h=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=l?h=e.canonical.z-l:o.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=e.canonical.x-(e.canonical.x>>h<<h),_=e.canonical.y-(e.canonical.y>>h<<h),x=o.cl(new Float64Array(16),[1/(o.Z<<h),1/(o.Z<<h),0]);o.L(x,x,[f*o.Z,_*o.Z,0]),this._demMatrixCache[e.key]={matrix:x,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const i=this.painter,s=i.width/devicePixelRatio,l=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===l||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new jt(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new jt(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(s,l,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,s,l))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let h=0,f=0;h<this._coordsTextureSize;h++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)i[f+0]=255&_,i[f+1]=255&h,i[f+2]=_>>8<<4|h>>8,i[f+3]=0;const s=new o.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),l=new jt(e,s,e.gl.RGBA,{premultiply:!1});return l.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),s=this.painter.context,l=s.gl,h=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),f=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(h,_-f-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null);const x=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),P=this.coordsIndex[255-i[3]],A=P&&this.sourceCache.getTileByID(P);if(!A)return null;const E=this._coordsTextureSize,F=(1<<A.tileID.canonical.z)*E;return new o.$((A.tileID.canonical.x*E+x)/F+A.tileID.wrap,(A.tileID.canonical.y*E+T)/F,this.getElevation(A.tileID,x,T,E))}depthAtPoint(e){const i=new Uint8Array(4),s=this.painter.context,l=s.gl;return s.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),l.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null),(i[0]/16777216+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(e){var i;const s=((i=this.painter.style.projection)===null||i===void 0?void 0:i.transitionState)>0,l=s&&e.canonical.y===0,h=s&&e.canonical.y===(1<<e.canonical.z)-1,f=`m_${l?"n":""}_${h?"s":""}`;if(this._meshCache[f])return this._meshCache[f];const _=this.painter.context,x=new o.cm,T=new o.aK,P=this.meshSize,A=o.Z/P,E=P*P;for(let re=0;re<=P;re++)for(let pe=0;pe<=P;pe++)x.emplaceBack(pe*A,re*A,0);for(let re=0;re<E;re+=P+1)for(let pe=0;pe<P;pe++)T.emplaceBack(pe+re,P+pe+re+1,P+pe+re+2),T.emplaceBack(pe+re,P+pe+re+2,pe+re+1);const F=x.length,O=F+(P+1),H=(P+1)*P,q=l?o.b9:0,W=l?0:1,K=h?o.ba:o.Z,te=h?0:1;for(let re=0;re<=P;re++)x.emplaceBack(re*A,q,W);for(let re=0;re<=P;re++)x.emplaceBack(re*A,K,te);for(let re=0;re<P;re++)T.emplaceBack(H+re,O+re,O+re+1),T.emplaceBack(H+re,O+re+1,H+re+1),T.emplaceBack(0+re,F+re+1,F+re),T.emplaceBack(0+re,0+re+1,F+re+1);const ee=x.length,ie=ee+2*(P+1);for(const re of[0,1])for(let pe=0;pe<=P;pe++)for(const Me of[0,1])x.emplaceBack(re*o.Z,pe*A,Me);for(let re=0;re<2*P;re+=2)T.emplaceBack(ee+re,ee+re+1,ee+re+3),T.emplaceBack(ee+re,ee+re+3,ee+re+2),T.emplaceBack(ie+re,ie+re+3,ie+re+1),T.emplaceBack(ie+re,ie+re+2,ie+re+3);const se=new Ua(_.createVertexBuffer(x,Ch.members),_.createIndexBuffer(T),o.aJ.simpleSegment(0,0,x.length,T.length));return this._meshCache[f]=se,se}getMeshFrameDelta(e){return 2*Math.PI*o.bu/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var s;const{tileID:l}=this._getOverscaledTileIDFromLngLatZoom(e,i);return(s=this.getMinMaxElevation(l).minElevation)!==null&&s!==void 0?s:0}getMinMaxElevation(e){const i=this.getTerrainData(e).tile,s={minElevation:null,maxElevation:null};return i&&i.dem&&(s.minElevation=i.dem.min*this.exaggeration,s.maxElevation=i.dem.max*this.exaggeration),s}_getOverscaledTileIDFromLngLatZoom(e,i){const s=o.$.fromLngLat(e.wrap()),l=(1<<i)*o.Z,h=s.x*l,f=s.y*l,_=Math.floor(h/o.Z),x=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,_,x),mercatorX:h,mercatorY:f}}}class Yd{constructor(e,i,s){this._context=e,this._size=i,this._tileSize=s,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const i=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),s=new jt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return s.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),i.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),i.colorAttachment.set(s.texture),{id:e,fbo:i,texture:s,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(i=>e.id!==i),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const i of this._recentlyUsed)if(!this._objects[i].inUse)return this._objects[i];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(e=>!e.inUse)===!1}}const pr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ul{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new Yd(e.context,30,i.sourceCache.tileSize*i.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,i){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(s=>!e._layers[s].isHidden(i)),this._coordsAscending={};for(const s in e.sourceCaches){this._coordsAscending[s]={};const l=e.sourceCaches[s].getVisibleCoordinates(),h=e.sourceCaches[s].getSource(),f=h instanceof Ce?h.terrainTileRanges:null;for(const _ of l){const x=this.terrain.sourceCache.getTerrainCoords(_,f);for(const T in x)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(x[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(pr[l.type]&&!this._coordsAscendingStr[h]){this._coordsAscendingStr[h]={};for(const f in this._coordsAscending[h])this._coordsAscendingStr[h][f]=this._coordsAscending[h][f].map(_=>_.key).sort().join()}}for(const s of this._renderableTiles)for(const l in this._coordsAscendingStr){const h=this._coordsAscendingStr[l][s.tileID.key];h&&h!==s.rttCoords[l]&&(s.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const s=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),l=e.type,h=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(pr[l]&&(this._prevType&&pr[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(pr[this._prevType]||pr[l]&&f){this._prevType=l;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(Xn(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[_]){const A=this.pool.getObjectForId(T.rtt[_].id);if(A.stamp===T.rtt[_].stamp){this.pool.useObject(A);continue}}const P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),T.rtt[_]={id:P.id,stamp:P.stamp},h.context.bindFramebuffer.set(P.fbo.framebuffer),h.context.clear({color:o.b7.transparent,stencil:0}),h.currentStencilSource=void 0;for(let A=0;A<x.length;A++){const E=h.style._layers[x[A]],F=E.source?this._coordsAscending[E.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),h._renderTileClippingMasks(E,F,!0),h.renderLayer(h,h.style.sourceCaches[E.source],E,F,s),E.source&&(T.rttCoords[E.source]=this._coordsAscendingStr[E.source][T.tileID.key])}}return Xn(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),pr[l]}return!1}}const Ke={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},rt=he,eo={hash:!1,interactive:!0,bearingSnap:7,attributionControl:zn,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:o.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},zc={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Rc{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,le.mousePos(this.element,h)),le.addEventListener(window,"mousemove",this.mousemove),le.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,le.mousePos(this.element,h))},this.mouseup=h=>{this._rotatePitchHanlder.dragEnd(h),this.offTemp()},this.touchstart=h=>{h.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=le.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),le.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=le.touchPos(this.element,h.targetTouches)[0],this.move(h,this._lastPos))},this.touchend=h=>{h.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const l=new as;this._rotatePitchHanlder=new ir({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),x=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.ce(new o.P(h.x,f.y),f,x),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,le.addEventListener(i,"mousedown",this.mousedown),le.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),le.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),le.disableDrag()}move(e,i){const s=this.map,{bearingDelta:l,pitchDelta:h}=this._rotatePitchHanlder.dragMove(e,i)||{};l&&s.setBearing(s.getBearing()+l),h&&s.setPitch(s.getPitch()+h)}off(){const e=this.element;le.removeEventListener(e,"mousedown",this.mousedown),le.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),le.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.removeEventListener(window,"touchend",this.touchend),le.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){le.enableDrag(),le.removeEventListener(window,"mousemove",this.mousemove),le.removeEventListener(window,"mouseup",this.mouseup),le.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.removeEventListener(window,"touchend",this.touchend)}}let Ti;function Dc(u,e,i,s=!1){if(s||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return u==null?void 0:u.wrap();const l=new o.Q(u.lng,u.lat);if(u=new o.Q(u.lng,u.lat),e){const h=new o.Q(u.lng-360,u.lat),f=new o.Q(u.lng+360,u.lat),_=i.locationToScreenPoint(u).distSqr(e);i.locationToScreenPoint(h).distSqr(e)<_?u=h:i.locationToScreenPoint(f).distSqr(e)<_&&(u=f)}for(;Math.abs(u.lng-i.center.lng)>180;){const h=i.locationToScreenPoint(u);if(h.x>=0&&h.y>=0&&h.x<=i.width&&h.y<=i.height)break;u.lng>i.center.lng?u.lng-=360:u.lng+=360}return u.lng!==l.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(u))?u:l}const qr={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%)"};function Ah(u,e,i){const s=u.classList;for(const l in qr)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class Ma extends o.E{constructor(e){if(super(),this._onKeyPress=i=>{const s=i.code,l=i.charCode||i.keyCode;s!=="Space"&&s!=="Enter"&&l!==32&&l!==13||this.togglePopup()},this._onMapClick=i=>{const s=i.originalEvent.target,l=this._element;this._popup&&(s===l||l.contains(s))&&this.togglePopup()},this._update=i=>{if(!this._map)return;const s=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!s)&&this._map.once("render",this._update),this._lngLat=Dc(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let l="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?l=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(l=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let h="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?h="rotateX(0deg)":this._pitchAlignment==="map"&&(h=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),le.setTransform(this._element,`${qr[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${l}`),Ee.frameAsync(new AbortController).then(()=>{this._updateOpacity(i&&i.type==="moveend")}).catch(()=>{})},this._onMove=i=>{if(!this._isDragging){const s=this._clickTolerance||this._map._clickTolerance;this._isDragging=i.point.dist(this._pointerdownPos)>=s}this._isDragging&&(this._pos=i.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new o.l("dragstart"))),this.fire(new o.l("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new o.l("dragend")),this._state="inactive"},this._addDragHandler=i=>{this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._offset),this._pointerdownPos=i.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=o.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=le.create("div");const i=le.createNS("http://www.w3.org/2000/svg","svg"),s=41,l=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${s}px`),i.setAttributeNS(null,"width",`${l}px`),i.setAttributeNS(null,"viewBox",`0 0 ${l} ${s}`);const h=le.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"stroke","none"),h.setAttributeNS(null,"stroke-width","1"),h.setAttributeNS(null,"fill","none"),h.setAttributeNS(null,"fill-rule","evenodd");const f=le.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=le.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const x=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const W of x){const K=le.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",W.rx),K.setAttributeNS(null,"ry",W.ry),_.appendChild(K)}const T=le.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const P=le.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),T.appendChild(P);const A=le.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"opacity","0.25"),A.setAttributeNS(null,"fill","#000000");const E=le.createNS("http://www.w3.org/2000/svg","path");E.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),A.appendChild(E);const F=le.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const O=le.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=le.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const q=le.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#FFFFFF"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962"),O.appendChild(H),O.appendChild(q),f.appendChild(_),f.appendChild(T),f.appendChild(A),f.appendChild(F),f.appendChild(O),i.appendChild(f),i.setAttributeNS(null,"height",s*this._scale+"px"),i.setAttributeNS(null,"width",l*this._scale+"px"),this._element.appendChild(i),this._offset=o.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),Ah(this._element,this._anchor,"marker"),e&&e.className)for(const i of e.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),le.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=o.Q.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const l=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[l,-1*(38.1-13.5+l)],"bottom-right":[-l,-1*(38.1-13.5+l)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,s;const l=(i=this._map)===null||i===void 0?void 0:i.terrain,h=this._map.transform.isLocationOccluded(this._lngLat);if(!l||h){const F=h?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==F&&(this._element.style.opacity=F))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const f=this._map,_=f.terrain.depthAtPoint(this._pos),x=f.terrain.getElevationForLngLatZoom(this._lngLat,f.transform.tileZoom);if(f.transform.lngLatToCameraDepth(this._lngLat,x)-_<.006)return void(this._element.style.opacity=this._opacity);const T=-this._offset.y/f.transform.pixelsPerMeter,P=Math.sin(f.getPitch()*Math.PI/180)*T,A=f.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),E=f.transform.lngLatToCameraDepth(this._lngLat,x+P)-A>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&E&&this._popup.remove(),this._element.style.opacity=E?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=o.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,i){return(this._opacity===void 0||e===void 0&&i===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}}const ui={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ii=0,ls=!1;const to={maxWidth:100,unit:"metric"};function io(u,e,i){const s=i&&i.maxWidth||100,l=u._container.clientHeight/2,h=u._container.clientWidth/2,f=u.unproject([h-s/2,l]),_=u.unproject([h+s/2,l]),x=Math.round(u.project(_).x-u.project(f).x),T=Math.min(s,x,u._container.clientWidth),P=f.distanceTo(_);if(i&&i.unit==="imperial"){const A=3.2808*P;A>5280?Sa(e,T,A/5280,u._getUIString("ScaleControl.Miles")):Sa(e,T,A,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?Sa(e,T,P/1852,u._getUIString("ScaleControl.NauticalMiles")):P>=1e3?Sa(e,T,P/1e3,u._getUIString("ScaleControl.Kilometers")):Sa(e,T,P,u._getUIString("ScaleControl.Meters"))}function Sa(u,e,i,s){const l=function(h){const f=Math.pow(10,`${Math.floor(h)}`.length-1);let _=h/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T}(_),f*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l}&nbsp;${s}`}const Lc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Bc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function cs(u){if(u){if(typeof u=="number"){const e=Math.round(Math.abs(u)/Math.SQRT2);return{center:new o.P(0,0),top:new o.P(0,u),"top-left":new o.P(e,e),"top-right":new o.P(-e,e),bottom:new o.P(0,-u),"bottom-left":new o.P(e,-e),"bottom-right":new o.P(-e,-e),left:new o.P(u,0),right:new o.P(-u,0)}}if(u instanceof o.P||Array.isArray(u)){const e=o.P.convert(u);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:o.P.convert(u.center||[0,0]),top:o.P.convert(u.top||[0,0]),"top-left":o.P.convert(u["top-left"]||[0,0]),"top-right":o.P.convert(u["top-right"]||[0,0]),bottom:o.P.convert(u.bottom||[0,0]),"bottom-left":o.P.convert(u["bottom-left"]||[0,0]),"bottom-right":o.P.convert(u["bottom-right"]||[0,0]),left:o.P.convert(u.left||[0,0]),right:o.P.convert(u.right||[0,0])}}return cs(new o.P(0,0))}const Fc=he;S.AJAXError=o.cq,S.Event=o.l,S.Evented=o.E,S.LngLat=o.Q,S.MercatorCoordinate=o.$,S.Point=o.P,S.addProtocol=o.cr,S.config=o.a,S.removeProtocol=o.cs,S.AttributionControl=Xt,S.BoxZoomHandler=Sc,S.CanvasSource=Ue,S.CooperativeGesturesHandler=ll,S.DoubleClickZoomHandler=ol,S.DragPanHandler=Sh,S.DragRotateHandler=Ph,S.EdgeInsets=As,S.FullscreenControl=class extends o.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var e;let i=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=i==null?void 0:i.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:o.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){le.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=le.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);le.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new o.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new o.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},S.GeoJSONSource=Cn,S.GeolocateControl=class extends o.E{constructor(u){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new o.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new o.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new o.Q(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,l=this._map.getBearing(),h=o.e({bearing:l},this.options.fitBoundsOptions),f=Zt.fromLngLat(i,s);this._map.fitBounds(f,h,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new o.Q(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&ls)return;this.options.trackUserLocation&&this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new o.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=le.create("button","maplibregl-ctrl-geolocate",this._container),le.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{const i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=le.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ma({element:this._dotElement}),this._circleElement=le.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ma({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new o.l("trackuserlocationend")),this.fire(new o.l("userlocationlostfocus")))})}},this.options=o.e({},ui,u)}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(Ti!==void 0&&!e)return Ti;if(window.navigator.permissions===void 0)return Ti=!!window.navigator.geolocation,Ti;try{Ti=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Ti=!!window.navigator.geolocation}return Ti})}().then(e=>this._finishSetupUI(e)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),le.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ii=0,ls=!1}_isOutOfMapMaxBounds(u){const e=this._map.getMaxBounds(),i=u.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const u=this._map.getBounds(),e=u.getSouthEast(),i=u.getNorthEast(),s=e.distanceTo(i),l=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}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.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ii--,ls=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new o.l("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new o.l("trackuserlocationstart")),this.fire(new o.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let u;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ii++,ii>1?(u={maximumAge:6e5,timeout:0},ls=!0):(u=this.options.positionOptions,ls=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,u)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},S.GlobeControl=class{constructor(){this._toggleProjection=()=>{var u;const e=(u=this._map.getProjection())===null||u===void 0?void 0:u.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var u;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((u=this._map.getProjection())===null||u===void 0?void 0:u.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=le.create("button","maplibregl-ctrl-globe",this._container),le.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){le.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},S.Hash=bc,S.ImageSource=Ce,S.KeyboardHandler=os,S.LngLatBounds=Zt,S.LogoControl=Qs,S.Map=class extends Kd{constructor(u){var e,i;o.cn.mark(o.co.create);const s=Object.assign(Object.assign(Object.assign({},eo),u),{canvasContextAttributes:Object.assign(Object.assign({},eo.canvasContextAttributes),u.canvasContextAttributes)});if(s.minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const l=new Ga,h=new ks;if(s.minZoom!==void 0&&l.setMinZoom(s.minZoom),s.maxZoom!==void 0&&l.setMaxZoom(s.maxZoom),s.minPitch!==void 0&&l.setMinPitch(s.minPitch),s.maxPitch!==void 0&&l.setMaxPitch(s.maxPitch),s.renderWorldCopies!==void 0&&l.setRenderWorldCopies(s.renderWorldCopies),super(l,h,{bearingSnap:s.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new kc,this._controls=[],this._mapId=o.a4(),this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new o.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.l("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},s.canvasContextAttributes),this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._centerClampedToGround=s.centerClampedToGround,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Ke),s.locale),this._clickTolerance=s.clickTolerance,this._overridePixelRatio=s.pixelRatio,this._maxCanvasSize=s.maxCanvasSize,this.transformCameraUpdate=s.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=s.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Ft.addThrottleControl(()=>this.isMoving()),this._requestManager=new It(s.transformRequest),typeof s.container=="string"){if(this._container=document.getElementById(s.container),!this._container)throw new Error(`Container '${s.container}' not found.`)}else{if(!(s.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=s.container}if(s.maxBounds&&this.setMaxBounds(s.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let _=!1;const x=Xs(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{_?x(T):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Xd(this,s),this._hash=s.hash&&new bc(typeof s.hash=="string"&&s.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,roll:s.roll}),s.bounds&&(this.resize(),this.fitBounds(s.bounds,o.e({},s.fitBoundsOptions,{duration:0}))));const f=typeof s.style=="string"||((i=(e=s.style)===null||e===void 0?void 0:e.projection)===null||i===void 0?void 0:i.type)!=="globe";this.resize(null,f),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new Xt(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new Qs,s.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const _=o.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new o.l(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new o.l(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new o.l("sourcedataabort",_))})}_getMapId(){return this._mapId}addControl(u,e){if(e===void 0&&(e=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new o.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=u.onAdd(this);this._controls.push(u);const s=this._controlPositions[e];return e.indexOf("bottom")!==-1?s.insertBefore(i,s.firstChild):s.appendChild(i),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new o.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(u);return e>-1&&this._controls.splice(e,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,e,i,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,e,i,s)}resize(u,e=!0){const[i,s]=this._containerDimensions(),l=this._getClampedPixelRatio(i,s);if(this._resizeCanvas(i,s,l),this.painter.resize(i,s,l),this.painter.overLimit()){const f=this.painter.context.gl;this._maxCanvasSize=[f.drawingBufferWidth,f.drawingBufferHeight];const _=this._getClampedPixelRatio(i,s);this._resizeCanvas(i,s,_),this.painter.resize(i,s,_)}this._resizeTransform(e);const h=!this._moving;return h&&(this.stop(),this.fire(new o.l("movestart",u)).fire(new o.l("move",u))),this.fire(new o.l("resize",u)),h&&this.fire(new o.l("moveend",u)),this}_resizeTransform(u=!0){var e;const[i,s]=this._containerDimensions();this.transform.resize(i,s,u),(e=this._requestedCameraState)===null||e===void 0||e.resize(i,s,u)}_getClampedPixelRatio(u,e){const{0:i,1:s}=this._maxCanvasSize,l=this.getPixelRatio(),h=u*l,f=e*l;return Math.min(h>i?i/h:1,f>s?s/f:1)*l}getPixelRatio(){var u;return(u=this._overridePixelRatio)!==null&&u!==void 0?u:devicePixelRatio}setPixelRatio(u){this._overridePixelRatio=u,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(u){return this.transform.setMaxBounds(Zt.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.setMinZoom(u),this._update(),this.getZoom()<u&&this.setZoom(u),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(u){if((u=u??22)>=this.transform.minZoom)return this.transform.setMaxZoom(u),this._update(),this.getZoom()>u&&this.setZoom(u),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.setMinPitch(u),this._update(),this.getPitch()<u&&this.setPitch(u),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(u>=this.transform.minPitch)return this.transform.setMaxPitch(u),this._update(),this.getPitch()>u&&this.setPitch(u),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.setRenderWorldCopies(u),this._update()}project(u){return this.transform.locationToScreenPoint(o.Q.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.screenPointToLocation(o.P.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,e,i){if(u==="mouseenter"||u==="mouseover"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:h=>{const f=e.filter(x=>this.getLayer(x)),_=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];_.length?s||(s=!0,i.call(this,new Ei(u,this,h.originalEvent,{features:_}))):s=!1},mouseout:()=>{s=!1}}}}if(u==="mouseleave"||u==="mouseout"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:f=>{const _=e.filter(x=>this.getLayer(x));(_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[]).length?s=!0:s&&(s=!1,i.call(this,new Ei(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new Ei(u,this,f.originalEvent)))}}}}{const s=l=>{const h=e.filter(_=>this.getLayer(_)),f=h.length!==0?this.queryRenderedFeatures(l.point,{layers:h}):[];f.length&&(l.features=f,i.call(this,l),delete l.features)};return{layers:e,listener:i,delegates:{[u]:s}}}}_saveDelegatedListener(u,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(e)}_removeDelegatedListener(u,e,i){if(!this._delegatedListeners||!this._delegatedListeners[u])return;const s=this._delegatedListeners[u];for(let l=0;l<s.length;l++){const h=s[l];if(h.listener===i&&h.layers.length===e.length&&h.layers.every(f=>e.includes(f))){for(const f in h.delegates)this.off(f,h.delegates[f]);return void s.splice(l,1)}}}on(u,e,i){if(i===void 0)return super.on(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);this._saveDelegatedListener(u,l);for(const h in l.delegates)this.on(h,l.delegates[h]);return{unsubscribe:()=>{this._removeDelegatedListener(u,s,i)}}}once(u,e,i){if(i===void 0)return super.once(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);for(const h in l.delegates){const f=l.delegates[h];l.delegates[h]=(..._)=>{this._removeDelegatedListener(u,s,i),f(..._)}}this._saveDelegatedListener(u,l);for(const h in l.delegates)this.once(h,l.delegates[h]);return this}off(u,e,i){return i===void 0?super.off(u,e):(this._removeDelegatedListener(u,typeof e=="string"?[e]:e,i),this)}queryRenderedFeatures(u,e){if(!this.style)return[];let i;const s=u instanceof o.P||Array.isArray(u),l=s?u:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(s?{}:u)||{},l instanceof o.P||typeof l[0]=="number")i=[o.P.convert(l)];else{const h=o.P.convert(l[0]),f=o.P.convert(l[1]);i=[h,new o.P(f.x,h.y),f,new o.P(h.x,f.y),h]}return this.style.queryRenderedFeatures(i,e,this.transform)}querySourceFeatures(u,e){return this.style.querySourceFeatures(u,e)}setStyle(u,e){return(e=o.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(u,e))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const e=this._locale[u];if(e==null)throw new Error(`Missing UI string '${u}'`);return e}_updateStyle(u,e){var i,s;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,e));const l=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new rc(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,e,l):this.style.loadJSON(u,e,l),this):((s=(i=this.style)===null||i===void 0?void 0:i.projection)===null||s===void 0||s.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new rc(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,e){if(typeof u=="string"){const i=this._requestManager.transformRequest(u,"Style");o.j(i,new AbortController).then(s=>{this._updateDiff(s.data,e)}).catch(s=>{s&&this.fire(new o.k(s))})}else typeof u=="object"&&this._updateDiff(u,e)}_updateDiff(u,e){try{this.style.setState(u,e)&&this._update(!0)}catch(i){o.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(u,e)}}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.")}addSource(u,e){return this._lazyInitEmptyStyle(),this.style.addSource(u,e),this._update(!0)}isSourceLoaded(u){const e=this.style&&this.style.sourceCaches[u];if(e!==void 0)return e.loaded();this.fire(new o.k(new Error(`There is no source with ID '${u}'`)))}setTerrain(u){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),u){const e=this.style.sourceCaches[u.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&e.reload();for(const i in this.style._layers){const s=this.style._layers[i];s.type==="hillshade"&&s.source===u.source&&o.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Eh(this.painter,e,u),this.painter.renderToTexture=new ul(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var s;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId!==u.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((s=i.source)===null||s===void 0?void 0:s.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new o.l("terrain",{terrain:u})),this}getTerrain(){var u,e;return(e=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const e in u){const i=u[e]._tiles;for(const s in i){const l=i[s];if(l.state!=="loaded"&&l.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}setSourceTileLodParams(u,e,i){if(i){const s=this.getSource(i);if(!s)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);s.calculateTileZoom=ae(Math.max(1,u),Math.max(1,e))}else for(const s in this.style.sourceCaches)this.style.sourceCaches[s].getSource().calculateTileZoom=ae(Math.max(1,u),Math.max(1,e));return this._update(!0),this}refreshTiles(u,e){const i=this.style.sourceCaches[u];if(!i)throw new Error(`There is no source cache with ID "${u}", cannot refresh tile`);e===void 0?i.reload():i.refreshTiles(e.map(s=>new o.a1(s.z,s.x,s.y)))}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||o.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new o.k(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`")));{const{width:P,height:A,data:E}=e,F=e;return this.style.addImage(u,{data:new o.R({width:P,height:A},new Uint8Array(E)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:P,height:A,data:E}=Ee.getImageData(e);this.style.addImage(u,{data:new o.R({width:P,height:A},E),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0})}}updateImage(u,e){const i=this.style.getImage(u);if(!i)return this.fire(new o.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=e instanceof HTMLImageElement||o.b(e)?Ee.getImageData(e):e,{width:l,height:h,data:f}=s;if(l===void 0||h===void 0)return this.fire(new o.k(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(l!==i.data.width||h!==i.data.height)return this.fire(new o.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||o.b(e));return i.data.replace(f,_),this.style.updateImage(u,i),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new o.k(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return Ft.getImage(this._requestManager.transformRequest(u,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(u,e){return this._lazyInitEmptyStyle(),this.style.addLayer(u,e),this._update(!0)}moveLayer(u,e){return this.style.moveLayer(u,e),this._update(!0)}removeLayer(u){return this.style.removeLayer(u),this._update(!0)}getLayer(u){return this.style.getLayer(u)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(u,e,i){return this.style.setLayerZoomRange(u,e,i),this._update(!0)}setFilter(u,e,i={}){return this.style.setFilter(u,e,i),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,e,i,s={}){return this.style.setPaintProperty(u,e,i,s),this._update(!0)}getPaintProperty(u,e){return this.style.getPaintProperty(u,e)}setLayoutProperty(u,e,i,s={}){return this.style.setLayoutProperty(u,e,i,s),this._update(!0)}getLayoutProperty(u,e){return this.style.getLayoutProperty(u,e)}setGlyphs(u,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,e,i,s=>{s||this._update(!0)}),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,e,i=>{i||this._update(!0)}),this}setLight(u,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(u,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(u,e){return this.style.setFeatureState(u,e),this._update()}removeFeatureState(u,e){return this.style.removeFeatureState(u,e),this._update()}getFeatureState(u){return this.style.getFeatureState(u)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let u=0,e=0;return this._container&&(u=this._container.clientWidth||400,e=this._container.clientHeight||300),[u,e]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const e=this._canvasContainer=le.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=le.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),s=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],s);const l=this._controlContainer=le.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=le.create("div",`maplibregl-ctrl-${f} `,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,e,i){this._canvas.width=Math.floor(i*u),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const u=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",s=>{e={requestedAttributes:u},s&&(e.statusMessage=s.statusMessage,e.type=s.type)},{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,u):this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u),!i){const s="Failed to initialize WebGL";throw e?(e.message=s,new Error(JSON.stringify(e))):new Error(s)}this.painter=new vc(i,this.transform),Fe.testSupport(i)}migrateProjection(u,e){super.migrateProjection(u,e),this.painter.transform=u,this.fire(new o.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){var e,i,s,l,h;const f=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let x=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const A=this.transform.zoom,E=Ee.now();this.style.zoomHistory.update(A,E);const F=new o.C(A,{now:E,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),O=F.crossFadingFactor();O===1&&O===this._crossFadingFactor||(x=!0,this._crossFadingFactor=O),this.style.update(F)}const T=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==_;(s=this.style.projection)===null||s===void 0||s.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((l=this.style.projection)===null||l===void 0?void 0:l.transitionState,(h=this.style.projection)===null||h===void 0?void 0:h.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||T)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,f,this._crossSourceCollisions,T),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,showPadding:this.showPadding}),this.fire(new o.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,o.cn.mark(o.co.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||x)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const P=this._sourcesDirty||this._styleDirty||this._placementDirty;return P||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||P||(this._fullyLoaded=!0,o.cn.mark(o.co.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var u;this._hash&&this._hash.remove();for(const i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Ft.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),le.remove(this._canvasContainer),le.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cn.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ee.frame(this._frameRequest,u=>{o.cn.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cp(e)&&!function(i){return i.message===qo}(e))throw e}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get version(){return rt}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},S.MapMouseEvent=Ei,S.MapTouchEvent=ts,S.MapWheelEvent=Mc,S.Marker=Ma,S.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const e=this._map.getZoom(),i=e===this._map.getMaxZoom(),s=e===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,i)=>{const s=this._map._getUIString(`NavigationControl.${i}`);e.title=s,e.setAttribute("aria-label",s)},this.options=o.e({},zc,u),this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),le.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),le.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=le.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(u){return this._map=u,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Rc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){le.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,e){const i=le.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},S.Popup=class extends o.E{constructor(u){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:void 0)},this.remove=()=>(this._content&&le.remove(this._content),this._container&&(le.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new o.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=le.create("div","maplibregl-popup",this._map.getContainer()),this._tip=le.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const f of this.options.className.split(" "))this._container.classList.add(f);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=Dc(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const i=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let s=this.options.anchor;const l=cs(this.options.offset);if(!s){const f=this._container.offsetWidth,_=this._container.offsetHeight;let x;x=i.y+l.bottom.y<_?["top"]:i.y>this._map.transform.height-_?["bottom"]:[],i.x<f/2?x.push("left"):i.x>this._map.transform.width-f/2&&x.push("right"),s=x.length===0?"bottom":x.join("-")}let h=i.add(l[s]);this.options.subpixelPositioning||(h=h.round()),le.setTransform(this._container,`${qr[s]} translate(${h.x}px,${h.y}px)`),Ah(this._container,s,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(Lc),u)}addTo(u){return this._map&&this.remove(),this._map=u,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new o.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=o.Q.convert(u),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const e=document.createDocumentFragment(),i=document.createElement("body");let s;for(i.innerHTML=u;s=i.firstChild,s;)e.appendChild(s);return this.setDOMContent(e)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=le.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(u),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(u){return this._container&&this._container.classList.add(u),this}removeClassName(u){return this._container&&this._container.classList.remove(u),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){if(this._container)return this._container.classList.toggle(u)}setSubpixelPositioning(u){this.options.subpixelPositioning=u}_createCloseButton(){this.options.closeButton&&(this._closeButton=le.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(Bc);u&&u.focus()}},S.RasterDEMTileSource=Pn,S.RasterTileSource=br,S.ScaleControl=class{constructor(u){this._onMove=()=>{io(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,io(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},to),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){le.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=vt,S.Style=rc,S.TerrainControl=class{constructor(u){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=u}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=le.create("button","maplibregl-ctrl-terrain",this._container),le.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){le.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=sl,S.TwoFingersTouchRotateHandler=$e,S.TwoFingersTouchZoomHandler=ss,S.TwoFingersTouchZoomRotateHandler=Ac,S.VectorTileSource=hn,S.VideoSource=Ye,S.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(Nt(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{_t[i]=s})(u,e)}),S.clearPrewarmedResources=function(){const u=xr;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(cn),xr=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},S.createTileMesh=zs,S.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return Rr().getRTLTextPluginStatus()},S.getVersion=function(){return Fc},S.getWorkerCount=function(){return kr.workerCount},S.getWorkerUrl=function(){return o.a.WORKER_URL},S.importScriptInWorkers=function(u){return Sn().broadcast("IS",u)},S.prewarm=function(){vr().acquire(cn)},S.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,e){return Rr().setRTLTextPlugin(u,e)},S.setWorkerCount=function(u){kr.workerCount=u},S.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var B=b;return B})}(Iu)),Iu.exports}var sy=ay();const _d=ry(sy);class Ff{constructor(g,b,I,z,B){qt(this,"bounds1");qt(this,"bounds2");qt(this,"getBounds",(g,b,I,z)=>new _d.LngLatBounds([g,b],[I,z]));qt(this,"contains",(g,b)=>this.bounds1.contains([b,g])||this.bounds2.contains([b,g]));const S=g.unproject([b,I]),o=g.unproject([z,B]);if(S.lng<-180){this.bounds1=this.getBounds(-180,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(S.wrap().lng,S.lat,180,o.lat);return}if(o.lng>180){this.bounds1=this.getBounds(S.lng,S.lat,180,o.lat),this.bounds2=this.getBounds(-180,S.lat,o.wrap().lng,o.lat);return}this.bounds1=this.getBounds(S.lng,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(0,0,0,0)}}const oy={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(120, 120, 120, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(128, 128, 128, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(56, 56, 56, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(153, 153, 153, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(104, 104, 104, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(56, 56, 56, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(136, 136, 136, 1)","fill-outline-color":"rgba(102, 102, 102, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(50, 50, 50, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(52, 52, 52, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(88, 88, 88, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20],"line-color":"rgba(102, 102, 102, 1)"}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23],"line-color":"rgba(85, 85, 85, 1)"}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":2,"line-color":"rgba(85, 85, 85, 1)"}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(102, 102, 102, 1)",6,"rgba(85, 85, 85, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(102, 102, 102, 1)",6,"rgba(85, 85, 85, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(51, 51, 51, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(51, 51, 51, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(255, 255, 255, 1)","text-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]},ly={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(220, 220, 220, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(228, 228, 228, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(156, 156, 156, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(253, 253, 253, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(204, 204, 204, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(156, 156, 156, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(236, 236, 236, 1)","fill-outline-color":"rgba(202, 202, 202, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(185, 185, 185)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(150, 150, 150, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(152, 152, 152, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(188, 188, 188)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(185, 185, 185)","line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23]}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":2}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(151, 151, 151, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(151, 151, 151, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1.5}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(0, 0, 0, 1)","text-color":"rgba(0, 0, 0, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]};var Dt;(function(v){v.assertEqual=z=>z;function g(z){}v.assertIs=g;function b(z){throw new Error}v.assertNever=b,v.arrayToEnum=z=>{const B={};for(const S of z)B[S]=S;return B},v.getValidEnumValues=z=>{const B=v.objectKeys(z).filter(o=>typeof z[z[o]]!="number"),S={};for(const o of B)S[o]=z[o];return v.objectValues(S)},v.objectValues=z=>v.objectKeys(z).map(function(B){return z[B]}),v.objectKeys=typeof Object.keys=="function"?z=>Object.keys(z):z=>{const B=[];for(const S in z)Object.prototype.hasOwnProperty.call(z,S)&&B.push(S);return B},v.find=(z,B)=>{for(const S of z)if(B(S))return S},v.isInteger=typeof Number.isInteger=="function"?z=>Number.isInteger(z):z=>typeof z=="number"&&isFinite(z)&&Math.floor(z)===z;function I(z,B=" | "){return z.map(S=>typeof S=="string"?`'${S}'`:S).join(B)}v.joinValues=I,v.jsonStringifyReplacer=(z,B)=>typeof B=="bigint"?B.toString():B})(Dt||(Dt={}));var yd;(function(v){v.mergeShapes=(g,b)=>({...g,...b})})(yd||(yd={}));const Xe=Dt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),na=v=>{switch(typeof v){case"undefined":return Xe.undefined;case"string":return Xe.string;case"number":return isNaN(v)?Xe.nan:Xe.number;case"boolean":return Xe.boolean;case"function":return Xe.function;case"bigint":return Xe.bigint;case"symbol":return Xe.symbol;case"object":return Array.isArray(v)?Xe.array:v===null?Xe.null:v.then&&typeof v.then=="function"&&v.catch&&typeof v.catch=="function"?Xe.promise:typeof Map<"u"&&v instanceof Map?Xe.map:typeof Set<"u"&&v instanceof Set?Xe.set:typeof Date<"u"&&v instanceof Date?Xe.date:Xe.object;default:return Xe.unknown}},je=Dt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),cy=v=>JSON.stringify(v,null,2).replace(/"([^"]+)":/g,"$1:");class Jr extends Error{get errors(){return this.issues}constructor(g){super(),this.issues=[],this.addIssue=I=>{this.issues=[...this.issues,I]},this.addIssues=(I=[])=>{this.issues=[...this.issues,...I]};const b=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,b):this.__proto__=b,this.name="ZodError",this.issues=g}format(g){const b=g||function(B){return B.message},I={_errors:[]},z=B=>{for(const S of B.issues)if(S.code==="invalid_union")S.unionErrors.map(z);else if(S.code==="invalid_return_type")z(S.returnTypeError);else if(S.code==="invalid_arguments")z(S.argumentsError);else if(S.path.length===0)I._errors.push(b(S));else{let o=I,he=0;for(;he<S.path.length;){const me=S.path[he];he===S.path.length-1?(o[me]=o[me]||{_errors:[]},o[me]._errors.push(b(S))):o[me]=o[me]||{_errors:[]},o=o[me],he++}}};return z(this),I}static assert(g){if(!(g instanceof Jr))throw new Error(`Not a ZodError: ${g}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Dt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(g=b=>b.message){const b={},I=[];for(const z of this.issues)z.path.length>0?(b[z.path[0]]=b[z.path[0]]||[],b[z.path[0]].push(g(z))):I.push(g(z));return{formErrors:I,fieldErrors:b}}get formErrors(){return this.flatten()}}Jr.create=v=>new Jr(v);const xo=(v,g)=>{let b;switch(v.code){case je.invalid_type:v.received===Xe.undefined?b="Required":b=`Expected ${v.expected}, received ${v.received}`;break;case je.invalid_literal:b=`Invalid literal value, expected ${JSON.stringify(v.expected,Dt.jsonStringifyReplacer)}`;break;case je.unrecognized_keys:b=`Unrecognized key(s) in object: ${Dt.joinValues(v.keys,", ")}`;break;case je.invalid_union:b="Invalid input";break;case je.invalid_union_discriminator:b=`Invalid discriminator value. Expected ${Dt.joinValues(v.options)}`;break;case je.invalid_enum_value:b=`Invalid enum value. Expected ${Dt.joinValues(v.options)}, received '${v.received}'`;break;case je.invalid_arguments:b="Invalid function arguments";break;case je.invalid_return_type:b="Invalid function return type";break;case je.invalid_date:b="Invalid date";break;case je.invalid_string:typeof v.validation=="object"?"includes"in v.validation?(b=`Invalid input: must include "${v.validation.includes}"`,typeof v.validation.position=="number"&&(b=`${b} at one or more positions greater than or equal to ${v.validation.position}`)):"startsWith"in v.validation?b=`Invalid input: must start with "${v.validation.startsWith}"`:"endsWith"in v.validation?b=`Invalid input: must end with "${v.validation.endsWith}"`:Dt.assertNever(v.validation):v.validation!=="regex"?b=`Invalid ${v.validation}`:b="Invalid";break;case je.too_small:v.type==="array"?b=`Array must contain ${v.exact?"exactly":v.inclusive?"at least":"more than"} ${v.minimum} element(s)`:v.type==="string"?b=`String must contain ${v.exact?"exactly":v.inclusive?"at least":"over"} ${v.minimum} character(s)`:v.type==="number"?b=`Number must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${v.minimum}`:v.type==="date"?b=`Date must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(v.minimum))}`:b="Invalid input";break;case je.too_big:v.type==="array"?b=`Array must contain ${v.exact?"exactly":v.inclusive?"at most":"less than"} ${v.maximum} element(s)`:v.type==="string"?b=`String must contain ${v.exact?"exactly":v.inclusive?"at most":"under"} ${v.maximum} character(s)`:v.type==="number"?b=`Number must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="bigint"?b=`BigInt must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="date"?b=`Date must be ${v.exact?"exactly":v.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(v.maximum))}`:b="Invalid input";break;case je.custom:b="Invalid input";break;case je.invalid_intersection_types:b="Intersection results could not be merged";break;case je.not_multiple_of:b=`Number must be a multiple of ${v.multipleOf}`;break;case je.not_finite:b="Number must be finite";break;default:b=g.defaultError,Dt.assertNever(v)}return{message:b}};let Of=xo;function uy(v){Of=v}function Eu(){return Of}const Au=v=>{const{data:g,path:b,errorMaps:I,issueData:z}=v,B=[...b,...z.path||[]],S={...z,path:B};if(z.message!==void 0)return{...z,path:B,message:z.message};let o="";const he=I.filter(me=>!!me).slice().reverse();for(const me of he)o=me(S,{data:g,defaultError:o}).message;return{...z,path:B,message:o}},hy=[];function qe(v,g){const b=Eu(),I=Au({issueData:g,data:v.data,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,b,b===xo?void 0:xo].filter(z=>!!z)});v.common.issues.push(I)}class gr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(g,b){const I=[];for(const z of b){if(z.status==="aborted")return ht;z.status==="dirty"&&g.dirty(),I.push(z.value)}return{status:g.value,value:I}}static async mergeObjectAsync(g,b){const I=[];for(const z of b){const B=await z.key,S=await z.value;I.push({key:B,value:S})}return gr.mergeObjectSync(g,I)}static mergeObjectSync(g,b){const I={};for(const z of b){const{key:B,value:S}=z;if(B.status==="aborted"||S.status==="aborted")return ht;B.status==="dirty"&&g.dirty(),S.status==="dirty"&&g.dirty(),B.value!=="__proto__"&&(typeof S.value<"u"||z.alwaysSet)&&(I[B.value]=S.value)}return{status:g.value,value:I}}}const ht=Object.freeze({status:"aborted"}),vo=v=>({status:"dirty",value:v}),Er=v=>({status:"valid",value:v}),xd=v=>v.status==="aborted",vd=v=>v.status==="dirty",xs=v=>v.status==="valid",Al=v=>typeof Promise<"u"&&v instanceof Promise;function ku(v,g,b,I){if(typeof g=="function"?v!==g||!0:!g.has(v))throw new TypeError("Cannot read private member from an object whose class did not declare it");return g.get(v)}function jf(v,g,b,I,z){if(typeof g=="function"?v!==g||!0:!g.has(v))throw new TypeError("Cannot write private member to an object whose class did not declare it");return g.set(v,b),b}typeof SuppressedError=="function"&&SuppressedError;var tt;(function(v){v.errToObj=g=>typeof g=="string"?{message:g}:g||{},v.toString=g=>typeof g=="string"?g:g==null?void 0:g.message})(tt||(tt={}));var kl,zl;class Un{constructor(g,b,I,z){this._cachedPath=[],this.parent=g,this.data=b,this._path=I,this._key=z}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Nf=(v,g)=>{if(xs(g))return{success:!0,data:g.value};if(!v.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const b=new Jr(v.common.issues);return this._error=b,this._error}}};function yt(v){if(!v)return{};const{errorMap:g,invalid_type_error:b,required_error:I,description:z}=v;if(g&&(b||I))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return g?{errorMap:g,description:z}:{errorMap:(S,o)=>{var he,me;const{message:Pe}=v;return S.code==="invalid_enum_value"?{message:Pe??o.defaultError}:typeof o.data>"u"?{message:(he=Pe??I)!==null&&he!==void 0?he:o.defaultError}:S.code!=="invalid_type"?{message:o.defaultError}:{message:(me=Pe??b)!==null&&me!==void 0?me:o.defaultError}},description:z}}class wt{get description(){return this._def.description}_getType(g){return na(g.data)}_getOrReturnCtx(g,b){return b||{common:g.parent.common,data:g.data,parsedType:na(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}_processInputParams(g){return{status:new gr,ctx:{common:g.parent.common,data:g.data,parsedType:na(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}}_parseSync(g){const b=this._parse(g);if(Al(b))throw new Error("Synchronous parse encountered promise.");return b}_parseAsync(g){const b=this._parse(g);return Promise.resolve(b)}parse(g,b){const I=this.safeParse(g,b);if(I.success)return I.data;throw I.error}safeParse(g,b){var I;const z={common:{issues:[],async:(I=b==null?void 0:b.async)!==null&&I!==void 0?I:!1,contextualErrorMap:b==null?void 0:b.errorMap},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:na(g)},B=this._parseSync({data:g,path:z.path,parent:z});return Nf(z,B)}"~validate"(g){var b,I;const z={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:na(g)};if(!this["~standard"].async)try{const B=this._parseSync({data:g,path:[],parent:z});return xs(B)?{value:B.value}:{issues:z.common.issues}}catch(B){!((I=(b=B==null?void 0:B.message)===null||b===void 0?void 0:b.toLowerCase())===null||I===void 0)&&I.includes("encountered")&&(this["~standard"].async=!0),z.common={issues:[],async:!0}}return this._parseAsync({data:g,path:[],parent:z}).then(B=>xs(B)?{value:B.value}:{issues:z.common.issues})}async parseAsync(g,b){const I=await this.safeParseAsync(g,b);if(I.success)return I.data;throw I.error}async safeParseAsync(g,b){const I={common:{issues:[],contextualErrorMap:b==null?void 0:b.errorMap,async:!0},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:na(g)},z=this._parse({data:g,path:I.path,parent:I}),B=await(Al(z)?z:Promise.resolve(z));return Nf(I,B)}refine(g,b){const I=z=>typeof b=="string"||typeof b>"u"?{message:b}:typeof b=="function"?b(z):b;return this._refinement((z,B)=>{const S=g(z),o=()=>B.addIssue({code:je.custom,...I(z)});return typeof Promise<"u"&&S instanceof Promise?S.then(he=>he?!0:(o(),!1)):S?!0:(o(),!1)})}refinement(g,b){return this._refinement((I,z)=>g(I)?!0:(z.addIssue(typeof b=="function"?b(I,z):b),!1))}_refinement(g){return new wn({schema:this,typeName:ut.ZodEffects,effect:{type:"refinement",refinement:g}})}superRefine(g){return this._refinement(g)}constructor(g){this.spa=this.safeParseAsync,this._def=g,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:b=>this["~validate"](b)}}optional(){return Gn.create(this,this._def)}nullable(){return Fa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return bn.create(this)}promise(){return Mo.create(this,this._def)}or(g){return Bl.create([this,g],this._def)}and(g){return Fl.create(this,g,this._def)}transform(g){return new wn({...yt(this._def),schema:this,typeName:ut.ZodEffects,effect:{type:"transform",transform:g}})}default(g){const b=typeof g=="function"?g:()=>g;return new Vl({...yt(this._def),innerType:this,defaultValue:b,typeName:ut.ZodDefault})}brand(){return new Td({typeName:ut.ZodBranded,type:this,...yt(this._def)})}catch(g){const b=typeof g=="function"?g:()=>g;return new Ul({...yt(this._def),innerType:this,catchValue:b,typeName:ut.ZodCatch})}describe(g){const b=this.constructor;return new b({...this._def,description:g})}pipe(g){return $l.create(this,g)}readonly(){return Gl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const dy=/^c[^\s-]{8,}$/i,py=/^[0-9a-z]+$/,fy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,my=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,gy=/^[a-z0-9_-]{21}$/i,_y=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yy=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,xy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,vy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let bd;const by=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,wy=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ty=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,My=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Py=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zf="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Cy=new RegExp(`^${Zf}$`);function Vf(v){let g="[0-5]\\d";v.precision?g=`${g}\\.\\d{${v.precision}}`:v.precision==null&&(g=`${g}(\\.\\d+)?`);const b=v.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${g})${b}`}function Iy(v){return new RegExp(`^${Vf(v)}$`)}function Uf(v){let g=`${Zf}T${Vf(v)}`;const b=[];return b.push(v.local?"Z?":"Z"),v.offset&&b.push("([+-]\\d{2}:?\\d{2})"),g=`${g}(${b.join("|")})`,new RegExp(`^${g}$`)}function Ey(v,g){return!!((g==="v4"||!g)&&by.test(v)||(g==="v6"||!g)&&Ty.test(v))}function Ay(v,g){if(!_y.test(v))return!1;try{const[b]=v.split("."),I=b.replace(/-/g,"+").replace(/_/g,"/").padEnd(b.length+(4-b.length%4)%4,"="),z=JSON.parse(atob(I));return!(typeof z!="object"||z===null||!z.typ||!z.alg||g&&z.alg!==g)}catch{return!1}}function ky(v,g){return!!((g==="v4"||!g)&&wy.test(v)||(g==="v6"||!g)&&My.test(v))}class vn extends wt{_parse(g){if(this._def.coerce&&(g.data=String(g.data)),this._getType(g)!==Xe.string){const B=this._getOrReturnCtx(g);return qe(B,{code:je.invalid_type,expected:Xe.string,received:B.parsedType}),ht}const I=new gr;let z;for(const B of this._def.checks)if(B.kind==="min")g.data.length<B.value&&(z=this._getOrReturnCtx(g,z),qe(z,{code:je.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),I.dirty());else if(B.kind==="max")g.data.length>B.value&&(z=this._getOrReturnCtx(g,z),qe(z,{code:je.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),I.dirty());else if(B.kind==="length"){const S=g.data.length>B.value,o=g.data.length<B.value;(S||o)&&(z=this._getOrReturnCtx(g,z),S?qe(z,{code:je.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message}):o&&qe(z,{code:je.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message}),I.dirty())}else if(B.kind==="email")xy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"email",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="emoji")bd||(bd=new RegExp(vy,"u")),bd.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"emoji",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="uuid")my.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"uuid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="nanoid")gy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"nanoid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="cuid")dy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"cuid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="cuid2")py.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"cuid2",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="ulid")fy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"ulid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="url")try{new URL(g.data)}catch{z=this._getOrReturnCtx(g,z),qe(z,{validation:"url",code:je.invalid_string,message:B.message}),I.dirty()}else B.kind==="regex"?(B.regex.lastIndex=0,B.regex.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"regex",code:je.invalid_string,message:B.message}),I.dirty())):B.kind==="trim"?g.data=g.data.trim():B.kind==="includes"?g.data.includes(B.value,B.position)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:{includes:B.value,position:B.position},message:B.message}),I.dirty()):B.kind==="toLowerCase"?g.data=g.data.toLowerCase():B.kind==="toUpperCase"?g.data=g.data.toUpperCase():B.kind==="startsWith"?g.data.startsWith(B.value)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:{startsWith:B.value},message:B.message}),I.dirty()):B.kind==="endsWith"?g.data.endsWith(B.value)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:{endsWith:B.value},message:B.message}),I.dirty()):B.kind==="datetime"?Uf(B).test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:"datetime",message:B.message}),I.dirty()):B.kind==="date"?Cy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:"date",message:B.message}),I.dirty()):B.kind==="time"?Iy(B).test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:"time",message:B.message}),I.dirty()):B.kind==="duration"?yy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"duration",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="ip"?Ey(g.data,B.version)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"ip",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="jwt"?Ay(g.data,B.alg)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"jwt",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="cidr"?ky(g.data,B.version)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"cidr",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="base64"?Sy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"base64",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="base64url"?Py.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"base64url",code:je.invalid_string,message:B.message}),I.dirty()):Dt.assertNever(B);return{status:I.value,value:g.data}}_regex(g,b,I){return this.refinement(z=>g.test(z),{validation:b,code:je.invalid_string,...tt.errToObj(I)})}_addCheck(g){return new vn({...this._def,checks:[...this._def.checks,g]})}email(g){return this._addCheck({kind:"email",...tt.errToObj(g)})}url(g){return this._addCheck({kind:"url",...tt.errToObj(g)})}emoji(g){return this._addCheck({kind:"emoji",...tt.errToObj(g)})}uuid(g){return this._addCheck({kind:"uuid",...tt.errToObj(g)})}nanoid(g){return this._addCheck({kind:"nanoid",...tt.errToObj(g)})}cuid(g){return this._addCheck({kind:"cuid",...tt.errToObj(g)})}cuid2(g){return this._addCheck({kind:"cuid2",...tt.errToObj(g)})}ulid(g){return this._addCheck({kind:"ulid",...tt.errToObj(g)})}base64(g){return this._addCheck({kind:"base64",...tt.errToObj(g)})}base64url(g){return this._addCheck({kind:"base64url",...tt.errToObj(g)})}jwt(g){return this._addCheck({kind:"jwt",...tt.errToObj(g)})}ip(g){return this._addCheck({kind:"ip",...tt.errToObj(g)})}cidr(g){return this._addCheck({kind:"cidr",...tt.errToObj(g)})}datetime(g){var b,I;return typeof g=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:g}):this._addCheck({kind:"datetime",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,offset:(b=g==null?void 0:g.offset)!==null&&b!==void 0?b:!1,local:(I=g==null?void 0:g.local)!==null&&I!==void 0?I:!1,...tt.errToObj(g==null?void 0:g.message)})}date(g){return this._addCheck({kind:"date",message:g})}time(g){return typeof g=="string"?this._addCheck({kind:"time",precision:null,message:g}):this._addCheck({kind:"time",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,...tt.errToObj(g==null?void 0:g.message)})}duration(g){return this._addCheck({kind:"duration",...tt.errToObj(g)})}regex(g,b){return this._addCheck({kind:"regex",regex:g,...tt.errToObj(b)})}includes(g,b){return this._addCheck({kind:"includes",value:g,position:b==null?void 0:b.position,...tt.errToObj(b==null?void 0:b.message)})}startsWith(g,b){return this._addCheck({kind:"startsWith",value:g,...tt.errToObj(b)})}endsWith(g,b){return this._addCheck({kind:"endsWith",value:g,...tt.errToObj(b)})}min(g,b){return this._addCheck({kind:"min",value:g,...tt.errToObj(b)})}max(g,b){return this._addCheck({kind:"max",value:g,...tt.errToObj(b)})}length(g,b){return this._addCheck({kind:"length",value:g,...tt.errToObj(b)})}nonempty(g){return this.min(1,tt.errToObj(g))}trim(){return new vn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new vn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new vn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(g=>g.kind==="datetime")}get isDate(){return!!this._def.checks.find(g=>g.kind==="date")}get isTime(){return!!this._def.checks.find(g=>g.kind==="time")}get isDuration(){return!!this._def.checks.find(g=>g.kind==="duration")}get isEmail(){return!!this._def.checks.find(g=>g.kind==="email")}get isURL(){return!!this._def.checks.find(g=>g.kind==="url")}get isEmoji(){return!!this._def.checks.find(g=>g.kind==="emoji")}get isUUID(){return!!this._def.checks.find(g=>g.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(g=>g.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(g=>g.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(g=>g.kind==="cuid2")}get isULID(){return!!this._def.checks.find(g=>g.kind==="ulid")}get isIP(){return!!this._def.checks.find(g=>g.kind==="ip")}get isCIDR(){return!!this._def.checks.find(g=>g.kind==="cidr")}get isBase64(){return!!this._def.checks.find(g=>g.kind==="base64")}get isBase64url(){return!!this._def.checks.find(g=>g.kind==="base64url")}get minLength(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxLength(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}}vn.create=v=>{var g;return new vn({checks:[],typeName:ut.ZodString,coerce:(g=v==null?void 0:v.coerce)!==null&&g!==void 0?g:!1,...yt(v)})};function zy(v,g){const b=(v.toString().split(".")[1]||"").length,I=(g.toString().split(".")[1]||"").length,z=b>I?b:I,B=parseInt(v.toFixed(z).replace(".","")),S=parseInt(g.toFixed(z).replace(".",""));return B%S/Math.pow(10,z)}class Da extends wt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(g){if(this._def.coerce&&(g.data=Number(g.data)),this._getType(g)!==Xe.number){const B=this._getOrReturnCtx(g);return qe(B,{code:je.invalid_type,expected:Xe.number,received:B.parsedType}),ht}let I;const z=new gr;for(const B of this._def.checks)B.kind==="int"?Dt.isInteger(g.data)||(I=this._getOrReturnCtx(g,I),qe(I,{code:je.invalid_type,expected:"integer",received:"float",message:B.message}),z.dirty()):B.kind==="min"?(B.inclusive?g.data<B.value:g.data<=B.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.too_small,minimum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),z.dirty()):B.kind==="max"?(B.inclusive?g.data>B.value:g.data>=B.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.too_big,maximum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),z.dirty()):B.kind==="multipleOf"?zy(g.data,B.value)!==0&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.not_multiple_of,multipleOf:B.value,message:B.message}),z.dirty()):B.kind==="finite"?Number.isFinite(g.data)||(I=this._getOrReturnCtx(g,I),qe(I,{code:je.not_finite,message:B.message}),z.dirty()):Dt.assertNever(B);return{status:z.value,value:g.data}}gte(g,b){return this.setLimit("min",g,!0,tt.toString(b))}gt(g,b){return this.setLimit("min",g,!1,tt.toString(b))}lte(g,b){return this.setLimit("max",g,!0,tt.toString(b))}lt(g,b){return this.setLimit("max",g,!1,tt.toString(b))}setLimit(g,b,I,z){return new Da({...this._def,checks:[...this._def.checks,{kind:g,value:b,inclusive:I,message:tt.toString(z)}]})}_addCheck(g){return new Da({...this._def,checks:[...this._def.checks,g]})}int(g){return this._addCheck({kind:"int",message:tt.toString(g)})}positive(g){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tt.toString(g)})}multipleOf(g,b){return this._addCheck({kind:"multipleOf",value:g,message:tt.toString(b)})}finite(g){return this._addCheck({kind:"finite",message:tt.toString(g)})}safe(g){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tt.toString(g)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tt.toString(g)})}get minValue(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxValue(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}get isInt(){return!!this._def.checks.find(g=>g.kind==="int"||g.kind==="multipleOf"&&Dt.isInteger(g.value))}get isFinite(){let g=null,b=null;for(const I of this._def.checks){if(I.kind==="finite"||I.kind==="int"||I.kind==="multipleOf")return!0;I.kind==="min"?(b===null||I.value>b)&&(b=I.value):I.kind==="max"&&(g===null||I.value<g)&&(g=I.value)}return Number.isFinite(b)&&Number.isFinite(g)}}Da.create=v=>new Da({checks:[],typeName:ut.ZodNumber,coerce:(v==null?void 0:v.coerce)||!1,...yt(v)});class La extends wt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(g){if(this._def.coerce)try{g.data=BigInt(g.data)}catch{return this._getInvalidInput(g)}if(this._getType(g)!==Xe.bigint)return this._getInvalidInput(g);let I;const z=new gr;for(const B of this._def.checks)B.kind==="min"?(B.inclusive?g.data<B.value:g.data<=B.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.too_small,type:"bigint",minimum:B.value,inclusive:B.inclusive,message:B.message}),z.dirty()):B.kind==="max"?(B.inclusive?g.data>B.value:g.data>=B.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.too_big,type:"bigint",maximum:B.value,inclusive:B.inclusive,message:B.message}),z.dirty()):B.kind==="multipleOf"?g.data%B.value!==BigInt(0)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.not_multiple_of,multipleOf:B.value,message:B.message}),z.dirty()):Dt.assertNever(B);return{status:z.value,value:g.data}}_getInvalidInput(g){const b=this._getOrReturnCtx(g);return qe(b,{code:je.invalid_type,expected:Xe.bigint,received:b.parsedType}),ht}gte(g,b){return this.setLimit("min",g,!0,tt.toString(b))}gt(g,b){return this.setLimit("min",g,!1,tt.toString(b))}lte(g,b){return this.setLimit("max",g,!0,tt.toString(b))}lt(g,b){return this.setLimit("max",g,!1,tt.toString(b))}setLimit(g,b,I,z){return new La({...this._def,checks:[...this._def.checks,{kind:g,value:b,inclusive:I,message:tt.toString(z)}]})}_addCheck(g){return new La({...this._def,checks:[...this._def.checks,g]})}positive(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tt.toString(g)})}multipleOf(g,b){return this._addCheck({kind:"multipleOf",value:g,message:tt.toString(b)})}get minValue(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxValue(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}}La.create=v=>{var g;return new La({checks:[],typeName:ut.ZodBigInt,coerce:(g=v==null?void 0:v.coerce)!==null&&g!==void 0?g:!1,...yt(v)})};class Rl extends wt{_parse(g){if(this._def.coerce&&(g.data=!!g.data),this._getType(g)!==Xe.boolean){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.boolean,received:I.parsedType}),ht}return Er(g.data)}}Rl.create=v=>new Rl({typeName:ut.ZodBoolean,coerce:(v==null?void 0:v.coerce)||!1,...yt(v)});class vs extends wt{_parse(g){if(this._def.coerce&&(g.data=new Date(g.data)),this._getType(g)!==Xe.date){const B=this._getOrReturnCtx(g);return qe(B,{code:je.invalid_type,expected:Xe.date,received:B.parsedType}),ht}if(isNaN(g.data.getTime())){const B=this._getOrReturnCtx(g);return qe(B,{code:je.invalid_date}),ht}const I=new gr;let z;for(const B of this._def.checks)B.kind==="min"?g.data.getTime()<B.value&&(z=this._getOrReturnCtx(g,z),qe(z,{code:je.too_small,message:B.message,inclusive:!0,exact:!1,minimum:B.value,type:"date"}),I.dirty()):B.kind==="max"?g.data.getTime()>B.value&&(z=this._getOrReturnCtx(g,z),qe(z,{code:je.too_big,message:B.message,inclusive:!0,exact:!1,maximum:B.value,type:"date"}),I.dirty()):Dt.assertNever(B);return{status:I.value,value:new Date(g.data.getTime())}}_addCheck(g){return new vs({...this._def,checks:[...this._def.checks,g]})}min(g,b){return this._addCheck({kind:"min",value:g.getTime(),message:tt.toString(b)})}max(g,b){return this._addCheck({kind:"max",value:g.getTime(),message:tt.toString(b)})}get minDate(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g!=null?new Date(g):null}get maxDate(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g!=null?new Date(g):null}}vs.create=v=>new vs({checks:[],coerce:(v==null?void 0:v.coerce)||!1,typeName:ut.ZodDate,...yt(v)});class zu extends wt{_parse(g){if(this._getType(g)!==Xe.symbol){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.symbol,received:I.parsedType}),ht}return Er(g.data)}}zu.create=v=>new zu({typeName:ut.ZodSymbol,...yt(v)});class Dl extends wt{_parse(g){if(this._getType(g)!==Xe.undefined){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.undefined,received:I.parsedType}),ht}return Er(g.data)}}Dl.create=v=>new Dl({typeName:ut.ZodUndefined,...yt(v)});class Ll extends wt{_parse(g){if(this._getType(g)!==Xe.null){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.null,received:I.parsedType}),ht}return Er(g.data)}}Ll.create=v=>new Ll({typeName:ut.ZodNull,...yt(v)});class bo extends wt{constructor(){super(...arguments),this._any=!0}_parse(g){return Er(g.data)}}bo.create=v=>new bo({typeName:ut.ZodAny,...yt(v)});class bs extends wt{constructor(){super(...arguments),this._unknown=!0}_parse(g){return Er(g.data)}}bs.create=v=>new bs({typeName:ut.ZodUnknown,...yt(v)});class aa extends wt{_parse(g){const b=this._getOrReturnCtx(g);return qe(b,{code:je.invalid_type,expected:Xe.never,received:b.parsedType}),ht}}aa.create=v=>new aa({typeName:ut.ZodNever,...yt(v)});class Ru extends wt{_parse(g){if(this._getType(g)!==Xe.undefined){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.void,received:I.parsedType}),ht}return Er(g.data)}}Ru.create=v=>new Ru({typeName:ut.ZodVoid,...yt(v)});class bn extends wt{_parse(g){const{ctx:b,status:I}=this._processInputParams(g),z=this._def;if(b.parsedType!==Xe.array)return qe(b,{code:je.invalid_type,expected:Xe.array,received:b.parsedType}),ht;if(z.exactLength!==null){const S=b.data.length>z.exactLength.value,o=b.data.length<z.exactLength.value;(S||o)&&(qe(b,{code:S?je.too_big:je.too_small,minimum:o?z.exactLength.value:void 0,maximum:S?z.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:z.exactLength.message}),I.dirty())}if(z.minLength!==null&&b.data.length<z.minLength.value&&(qe(b,{code:je.too_small,minimum:z.minLength.value,type:"array",inclusive:!0,exact:!1,message:z.minLength.message}),I.dirty()),z.maxLength!==null&&b.data.length>z.maxLength.value&&(qe(b,{code:je.too_big,maximum:z.maxLength.value,type:"array",inclusive:!0,exact:!1,message:z.maxLength.message}),I.dirty()),b.common.async)return Promise.all([...b.data].map((S,o)=>z.type._parseAsync(new Un(b,S,b.path,o)))).then(S=>gr.mergeArray(I,S));const B=[...b.data].map((S,o)=>z.type._parseSync(new Un(b,S,b.path,o)));return gr.mergeArray(I,B)}get element(){return this._def.type}min(g,b){return new bn({...this._def,minLength:{value:g,message:tt.toString(b)}})}max(g,b){return new bn({...this._def,maxLength:{value:g,message:tt.toString(b)}})}length(g,b){return new bn({...this._def,exactLength:{value:g,message:tt.toString(b)}})}nonempty(g){return this.min(1,g)}}bn.create=(v,g)=>new bn({type:v,minLength:null,maxLength:null,exactLength:null,typeName:ut.ZodArray,...yt(g)});function wo(v){if(v instanceof _i){const g={};for(const b in v.shape){const I=v.shape[b];g[b]=Gn.create(wo(I))}return new _i({...v._def,shape:()=>g})}else return v instanceof bn?new bn({...v._def,type:wo(v.element)}):v instanceof Gn?Gn.create(wo(v.unwrap())):v instanceof Fa?Fa.create(wo(v.unwrap())):v instanceof $n?$n.create(v.items.map(g=>wo(g))):v}class _i extends wt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const g=this._def.shape(),b=Dt.objectKeys(g);return this._cached={shape:g,keys:b}}_parse(g){if(this._getType(g)!==Xe.object){const me=this._getOrReturnCtx(g);return qe(me,{code:je.invalid_type,expected:Xe.object,received:me.parsedType}),ht}const{status:I,ctx:z}=this._processInputParams(g),{shape:B,keys:S}=this._getCached(),o=[];if(!(this._def.catchall instanceof aa&&this._def.unknownKeys==="strip"))for(const me in z.data)S.includes(me)||o.push(me);const he=[];for(const me of S){const Pe=B[me],Be=z.data[me];he.push({key:{status:"valid",value:me},value:Pe._parse(new Un(z,Be,z.path,me)),alwaysSet:me in z.data})}if(this._def.catchall instanceof aa){const me=this._def.unknownKeys;if(me==="passthrough")for(const Pe of o)he.push({key:{status:"valid",value:Pe},value:{status:"valid",value:z.data[Pe]}});else if(me==="strict")o.length>0&&(qe(z,{code:je.unrecognized_keys,keys:o}),I.dirty());else if(me!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const me=this._def.catchall;for(const Pe of o){const Be=z.data[Pe];he.push({key:{status:"valid",value:Pe},value:me._parse(new Un(z,Be,z.path,Pe)),alwaysSet:Pe in z.data})}}return z.common.async?Promise.resolve().then(async()=>{const me=[];for(const Pe of he){const Be=await Pe.key,Ee=await Pe.value;me.push({key:Be,value:Ee,alwaysSet:Pe.alwaysSet})}return me}).then(me=>gr.mergeObjectSync(I,me)):gr.mergeObjectSync(I,he)}get shape(){return this._def.shape()}strict(g){return tt.errToObj,new _i({...this._def,unknownKeys:"strict",...g!==void 0?{errorMap:(b,I)=>{var z,B,S,o;const he=(S=(B=(z=this._def).errorMap)===null||B===void 0?void 0:B.call(z,b,I).message)!==null&&S!==void 0?S:I.defaultError;return b.code==="unrecognized_keys"?{message:(o=tt.errToObj(g).message)!==null&&o!==void 0?o:he}:{message:he}}}:{}})}strip(){return new _i({...this._def,unknownKeys:"strip"})}passthrough(){return new _i({...this._def,unknownKeys:"passthrough"})}extend(g){return new _i({...this._def,shape:()=>({...this._def.shape(),...g})})}merge(g){return new _i({unknownKeys:g._def.unknownKeys,catchall:g._def.catchall,shape:()=>({...this._def.shape(),...g._def.shape()}),typeName:ut.ZodObject})}setKey(g,b){return this.augment({[g]:b})}catchall(g){return new _i({...this._def,catchall:g})}pick(g){const b={};return Dt.objectKeys(g).forEach(I=>{g[I]&&this.shape[I]&&(b[I]=this.shape[I])}),new _i({...this._def,shape:()=>b})}omit(g){const b={};return Dt.objectKeys(this.shape).forEach(I=>{g[I]||(b[I]=this.shape[I])}),new _i({...this._def,shape:()=>b})}deepPartial(){return wo(this)}partial(g){const b={};return Dt.objectKeys(this.shape).forEach(I=>{const z=this.shape[I];g&&!g[I]?b[I]=z:b[I]=z.optional()}),new _i({...this._def,shape:()=>b})}required(g){const b={};return Dt.objectKeys(this.shape).forEach(I=>{if(g&&!g[I])b[I]=this.shape[I];else{let B=this.shape[I];for(;B instanceof Gn;)B=B._def.innerType;b[I]=B}}),new _i({...this._def,shape:()=>b})}keyof(){return $f(Dt.objectKeys(this.shape))}}_i.create=(v,g)=>new _i({shape:()=>v,unknownKeys:"strip",catchall:aa.create(),typeName:ut.ZodObject,...yt(g)}),_i.strictCreate=(v,g)=>new _i({shape:()=>v,unknownKeys:"strict",catchall:aa.create(),typeName:ut.ZodObject,...yt(g)}),_i.lazycreate=(v,g)=>new _i({shape:v,unknownKeys:"strip",catchall:aa.create(),typeName:ut.ZodObject,...yt(g)});class Bl extends wt{_parse(g){const{ctx:b}=this._processInputParams(g),I=this._def.options;function z(B){for(const o of B)if(o.result.status==="valid")return o.result;for(const o of B)if(o.result.status==="dirty")return b.common.issues.push(...o.ctx.common.issues),o.result;const S=B.map(o=>new Jr(o.ctx.common.issues));return qe(b,{code:je.invalid_union,unionErrors:S}),ht}if(b.common.async)return Promise.all(I.map(async B=>{const S={...b,common:{...b.common,issues:[]},parent:null};return{result:await B._parseAsync({data:b.data,path:b.path,parent:S}),ctx:S}})).then(z);{let B;const S=[];for(const he of I){const me={...b,common:{...b.common,issues:[]},parent:null},Pe=he._parseSync({data:b.data,path:b.path,parent:me});if(Pe.status==="valid")return Pe;Pe.status==="dirty"&&!B&&(B={result:Pe,ctx:me}),me.common.issues.length&&S.push(me.common.issues)}if(B)return b.common.issues.push(...B.ctx.common.issues),B.result;const o=S.map(he=>new Jr(he));return qe(b,{code:je.invalid_union,unionErrors:o}),ht}}get options(){return this._def.options}}Bl.create=(v,g)=>new Bl({options:v,typeName:ut.ZodUnion,...yt(g)});const sa=v=>v instanceof jl?sa(v.schema):v instanceof wn?sa(v.innerType()):v instanceof Nl?[v.value]:v instanceof Ba?v.options:v instanceof Zl?Dt.objectValues(v.enum):v instanceof Vl?sa(v._def.innerType):v instanceof Dl?[void 0]:v instanceof Ll?[null]:v instanceof Gn?[void 0,...sa(v.unwrap())]:v instanceof Fa?[null,...sa(v.unwrap())]:v instanceof Td||v instanceof Gl?sa(v.unwrap()):v instanceof Ul?sa(v._def.innerType):[];class Du extends wt{_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Xe.object)return qe(b,{code:je.invalid_type,expected:Xe.object,received:b.parsedType}),ht;const I=this.discriminator,z=b.data[I],B=this.optionsMap.get(z);return B?b.common.async?B._parseAsync({data:b.data,path:b.path,parent:b}):B._parseSync({data:b.data,path:b.path,parent:b}):(qe(b,{code:je.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[I]}),ht)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(g,b,I){const z=new Map;for(const B of b){const S=sa(B.shape[g]);if(!S.length)throw new Error(`A discriminator value for key \`${g}\` could not be extracted from all schema options`);for(const o of S){if(z.has(o))throw new Error(`Discriminator property ${String(g)} has duplicate value ${String(o)}`);z.set(o,B)}}return new Du({typeName:ut.ZodDiscriminatedUnion,discriminator:g,options:b,optionsMap:z,...yt(I)})}}function wd(v,g){const b=na(v),I=na(g);if(v===g)return{valid:!0,data:v};if(b===Xe.object&&I===Xe.object){const z=Dt.objectKeys(g),B=Dt.objectKeys(v).filter(o=>z.indexOf(o)!==-1),S={...v,...g};for(const o of B){const he=wd(v[o],g[o]);if(!he.valid)return{valid:!1};S[o]=he.data}return{valid:!0,data:S}}else if(b===Xe.array&&I===Xe.array){if(v.length!==g.length)return{valid:!1};const z=[];for(let B=0;B<v.length;B++){const S=v[B],o=g[B],he=wd(S,o);if(!he.valid)return{valid:!1};z.push(he.data)}return{valid:!0,data:z}}else return b===Xe.date&&I===Xe.date&&+v==+g?{valid:!0,data:v}:{valid:!1}}class Fl extends wt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g),z=(B,S)=>{if(xd(B)||xd(S))return ht;const o=wd(B.value,S.value);return o.valid?((vd(B)||vd(S))&&b.dirty(),{status:b.value,value:o.data}):(qe(I,{code:je.invalid_intersection_types}),ht)};return I.common.async?Promise.all([this._def.left._parseAsync({data:I.data,path:I.path,parent:I}),this._def.right._parseAsync({data:I.data,path:I.path,parent:I})]).then(([B,S])=>z(B,S)):z(this._def.left._parseSync({data:I.data,path:I.path,parent:I}),this._def.right._parseSync({data:I.data,path:I.path,parent:I}))}}Fl.create=(v,g,b)=>new Fl({left:v,right:g,typeName:ut.ZodIntersection,...yt(b)});class $n extends wt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.array)return qe(I,{code:je.invalid_type,expected:Xe.array,received:I.parsedType}),ht;if(I.data.length<this._def.items.length)return qe(I,{code:je.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ht;!this._def.rest&&I.data.length>this._def.items.length&&(qe(I,{code:je.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b.dirty());const B=[...I.data].map((S,o)=>{const he=this._def.items[o]||this._def.rest;return he?he._parse(new Un(I,S,I.path,o)):null}).filter(S=>!!S);return I.common.async?Promise.all(B).then(S=>gr.mergeArray(b,S)):gr.mergeArray(b,B)}get items(){return this._def.items}rest(g){return new $n({...this._def,rest:g})}}$n.create=(v,g)=>{if(!Array.isArray(v))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $n({items:v,typeName:ut.ZodTuple,rest:null,...yt(g)})};class Ol extends wt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.object)return qe(I,{code:je.invalid_type,expected:Xe.object,received:I.parsedType}),ht;const z=[],B=this._def.keyType,S=this._def.valueType;for(const o in I.data)z.push({key:B._parse(new Un(I,o,I.path,o)),value:S._parse(new Un(I,I.data[o],I.path,o)),alwaysSet:o in I.data});return I.common.async?gr.mergeObjectAsync(b,z):gr.mergeObjectSync(b,z)}get element(){return this._def.valueType}static create(g,b,I){return b instanceof wt?new Ol({keyType:g,valueType:b,typeName:ut.ZodRecord,...yt(I)}):new Ol({keyType:vn.create(),valueType:g,typeName:ut.ZodRecord,...yt(b)})}}class Lu extends wt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.map)return qe(I,{code:je.invalid_type,expected:Xe.map,received:I.parsedType}),ht;const z=this._def.keyType,B=this._def.valueType,S=[...I.data.entries()].map(([o,he],me)=>({key:z._parse(new Un(I,o,I.path,[me,"key"])),value:B._parse(new Un(I,he,I.path,[me,"value"]))}));if(I.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const he of S){const me=await he.key,Pe=await he.value;if(me.status==="aborted"||Pe.status==="aborted")return ht;(me.status==="dirty"||Pe.status==="dirty")&&b.dirty(),o.set(me.value,Pe.value)}return{status:b.value,value:o}})}else{const o=new Map;for(const he of S){const me=he.key,Pe=he.value;if(me.status==="aborted"||Pe.status==="aborted")return ht;(me.status==="dirty"||Pe.status==="dirty")&&b.dirty(),o.set(me.value,Pe.value)}return{status:b.value,value:o}}}}Lu.create=(v,g,b)=>new Lu({valueType:g,keyType:v,typeName:ut.ZodMap,...yt(b)});class ws extends wt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.set)return qe(I,{code:je.invalid_type,expected:Xe.set,received:I.parsedType}),ht;const z=this._def;z.minSize!==null&&I.data.size<z.minSize.value&&(qe(I,{code:je.too_small,minimum:z.minSize.value,type:"set",inclusive:!0,exact:!1,message:z.minSize.message}),b.dirty()),z.maxSize!==null&&I.data.size>z.maxSize.value&&(qe(I,{code:je.too_big,maximum:z.maxSize.value,type:"set",inclusive:!0,exact:!1,message:z.maxSize.message}),b.dirty());const B=this._def.valueType;function S(he){const me=new Set;for(const Pe of he){if(Pe.status==="aborted")return ht;Pe.status==="dirty"&&b.dirty(),me.add(Pe.value)}return{status:b.value,value:me}}const o=[...I.data.values()].map((he,me)=>B._parse(new Un(I,he,I.path,me)));return I.common.async?Promise.all(o).then(he=>S(he)):S(o)}min(g,b){return new ws({...this._def,minSize:{value:g,message:tt.toString(b)}})}max(g,b){return new ws({...this._def,maxSize:{value:g,message:tt.toString(b)}})}size(g,b){return this.min(g,b).max(g,b)}nonempty(g){return this.min(1,g)}}ws.create=(v,g)=>new ws({valueType:v,minSize:null,maxSize:null,typeName:ut.ZodSet,...yt(g)});class To extends wt{constructor(){super(...arguments),this.validate=this.implement}_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Xe.function)return qe(b,{code:je.invalid_type,expected:Xe.function,received:b.parsedType}),ht;function I(o,he){return Au({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Eu(),xo].filter(me=>!!me),issueData:{code:je.invalid_arguments,argumentsError:he}})}function z(o,he){return Au({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Eu(),xo].filter(me=>!!me),issueData:{code:je.invalid_return_type,returnTypeError:he}})}const B={errorMap:b.common.contextualErrorMap},S=b.data;if(this._def.returns instanceof Mo){const o=this;return Er(async function(...he){const me=new Jr([]),Pe=await o._def.args.parseAsync(he,B).catch(le=>{throw me.addIssue(I(he,le)),me}),Be=await Reflect.apply(S,this,Pe);return await o._def.returns._def.type.parseAsync(Be,B).catch(le=>{throw me.addIssue(z(Be,le)),me})})}else{const o=this;return Er(function(...he){const me=o._def.args.safeParse(he,B);if(!me.success)throw new Jr([I(he,me.error)]);const Pe=Reflect.apply(S,this,me.data),Be=o._def.returns.safeParse(Pe,B);if(!Be.success)throw new Jr([z(Pe,Be.error)]);return Be.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...g){return new To({...this._def,args:$n.create(g).rest(bs.create())})}returns(g){return new To({...this._def,returns:g})}implement(g){return this.parse(g)}strictImplement(g){return this.parse(g)}static create(g,b,I){return new To({args:g||$n.create([]).rest(bs.create()),returns:b||bs.create(),typeName:ut.ZodFunction,...yt(I)})}}class jl extends wt{get schema(){return this._def.getter()}_parse(g){const{ctx:b}=this._processInputParams(g);return this._def.getter()._parse({data:b.data,path:b.path,parent:b})}}jl.create=(v,g)=>new jl({getter:v,typeName:ut.ZodLazy,...yt(g)});class Nl extends wt{_parse(g){if(g.data!==this._def.value){const b=this._getOrReturnCtx(g);return qe(b,{received:b.data,code:je.invalid_literal,expected:this._def.value}),ht}return{status:"valid",value:g.data}}get value(){return this._def.value}}Nl.create=(v,g)=>new Nl({value:v,typeName:ut.ZodLiteral,...yt(g)});function $f(v,g){return new Ba({values:v,typeName:ut.ZodEnum,...yt(g)})}class Ba extends wt{constructor(){super(...arguments),kl.set(this,void 0)}_parse(g){if(typeof g.data!="string"){const b=this._getOrReturnCtx(g),I=this._def.values;return qe(b,{expected:Dt.joinValues(I),received:b.parsedType,code:je.invalid_type}),ht}if(ku(this,kl)||jf(this,kl,new Set(this._def.values)),!ku(this,kl).has(g.data)){const b=this._getOrReturnCtx(g),I=this._def.values;return qe(b,{received:b.data,code:je.invalid_enum_value,options:I}),ht}return Er(g.data)}get options(){return this._def.values}get enum(){const g={};for(const b of this._def.values)g[b]=b;return g}get Values(){const g={};for(const b of this._def.values)g[b]=b;return g}get Enum(){const g={};for(const b of this._def.values)g[b]=b;return g}extract(g,b=this._def){return Ba.create(g,{...this._def,...b})}exclude(g,b=this._def){return Ba.create(this.options.filter(I=>!g.includes(I)),{...this._def,...b})}}kl=new WeakMap,Ba.create=$f;class Zl extends wt{constructor(){super(...arguments),zl.set(this,void 0)}_parse(g){const b=Dt.getValidEnumValues(this._def.values),I=this._getOrReturnCtx(g);if(I.parsedType!==Xe.string&&I.parsedType!==Xe.number){const z=Dt.objectValues(b);return qe(I,{expected:Dt.joinValues(z),received:I.parsedType,code:je.invalid_type}),ht}if(ku(this,zl)||jf(this,zl,new Set(Dt.getValidEnumValues(this._def.values))),!ku(this,zl).has(g.data)){const z=Dt.objectValues(b);return qe(I,{received:I.data,code:je.invalid_enum_value,options:z}),ht}return Er(g.data)}get enum(){return this._def.values}}zl=new WeakMap,Zl.create=(v,g)=>new Zl({values:v,typeName:ut.ZodNativeEnum,...yt(g)});class Mo extends wt{unwrap(){return this._def.type}_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Xe.promise&&b.common.async===!1)return qe(b,{code:je.invalid_type,expected:Xe.promise,received:b.parsedType}),ht;const I=b.parsedType===Xe.promise?b.data:Promise.resolve(b.data);return Er(I.then(z=>this._def.type.parseAsync(z,{path:b.path,errorMap:b.common.contextualErrorMap})))}}Mo.create=(v,g)=>new Mo({type:v,typeName:ut.ZodPromise,...yt(g)});class wn extends wt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ut.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(g){const{status:b,ctx:I}=this._processInputParams(g),z=this._def.effect||null,B={addIssue:S=>{qe(I,S),S.fatal?b.abort():b.dirty()},get path(){return I.path}};if(B.addIssue=B.addIssue.bind(B),z.type==="preprocess"){const S=z.transform(I.data,B);if(I.common.async)return Promise.resolve(S).then(async o=>{if(b.value==="aborted")return ht;const he=await this._def.schema._parseAsync({data:o,path:I.path,parent:I});return he.status==="aborted"?ht:he.status==="dirty"||b.value==="dirty"?vo(he.value):he});{if(b.value==="aborted")return ht;const o=this._def.schema._parseSync({data:S,path:I.path,parent:I});return o.status==="aborted"?ht:o.status==="dirty"||b.value==="dirty"?vo(o.value):o}}if(z.type==="refinement"){const S=o=>{const he=z.refinement(o,B);if(I.common.async)return Promise.resolve(he);if(he instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(I.common.async===!1){const o=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});return o.status==="aborted"?ht:(o.status==="dirty"&&b.dirty(),S(o.value),{status:b.value,value:o.value})}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(o=>o.status==="aborted"?ht:(o.status==="dirty"&&b.dirty(),S(o.value).then(()=>({status:b.value,value:o.value}))))}if(z.type==="transform")if(I.common.async===!1){const S=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});if(!xs(S))return S;const o=z.transform(S.value,B);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:b.value,value:o}}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(S=>xs(S)?Promise.resolve(z.transform(S.value,B)).then(o=>({status:b.value,value:o})):S);Dt.assertNever(z)}}wn.create=(v,g,b)=>new wn({schema:v,typeName:ut.ZodEffects,effect:g,...yt(b)}),wn.createWithPreprocess=(v,g,b)=>new wn({schema:g,effect:{type:"preprocess",transform:v},typeName:ut.ZodEffects,...yt(b)});class Gn extends wt{_parse(g){return this._getType(g)===Xe.undefined?Er(void 0):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Gn.create=(v,g)=>new Gn({innerType:v,typeName:ut.ZodOptional,...yt(g)});class Fa extends wt{_parse(g){return this._getType(g)===Xe.null?Er(null):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Fa.create=(v,g)=>new Fa({innerType:v,typeName:ut.ZodNullable,...yt(g)});class Vl extends wt{_parse(g){const{ctx:b}=this._processInputParams(g);let I=b.data;return b.parsedType===Xe.undefined&&(I=this._def.defaultValue()),this._def.innerType._parse({data:I,path:b.path,parent:b})}removeDefault(){return this._def.innerType}}Vl.create=(v,g)=>new Vl({innerType:v,typeName:ut.ZodDefault,defaultValue:typeof g.default=="function"?g.default:()=>g.default,...yt(g)});class Ul extends wt{_parse(g){const{ctx:b}=this._processInputParams(g),I={...b,common:{...b.common,issues:[]}},z=this._def.innerType._parse({data:I.data,path:I.path,parent:{...I}});return Al(z)?z.then(B=>({status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new Jr(I.common.issues)},input:I.data})})):{status:"valid",value:z.status==="valid"?z.value:this._def.catchValue({get error(){return new Jr(I.common.issues)},input:I.data})}}removeCatch(){return this._def.innerType}}Ul.create=(v,g)=>new Ul({innerType:v,typeName:ut.ZodCatch,catchValue:typeof g.catch=="function"?g.catch:()=>g.catch,...yt(g)});class Bu extends wt{_parse(g){if(this._getType(g)!==Xe.nan){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.nan,received:I.parsedType}),ht}return{status:"valid",value:g.data}}}Bu.create=v=>new Bu({typeName:ut.ZodNaN,...yt(v)});const Ry=Symbol("zod_brand");class Td extends wt{_parse(g){const{ctx:b}=this._processInputParams(g),I=b.data;return this._def.type._parse({data:I,path:b.path,parent:b})}unwrap(){return this._def.type}}class $l extends wt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.common.async)return(async()=>{const B=await this._def.in._parseAsync({data:I.data,path:I.path,parent:I});return B.status==="aborted"?ht:B.status==="dirty"?(b.dirty(),vo(B.value)):this._def.out._parseAsync({data:B.value,path:I.path,parent:I})})();{const z=this._def.in._parseSync({data:I.data,path:I.path,parent:I});return z.status==="aborted"?ht:z.status==="dirty"?(b.dirty(),{status:"dirty",value:z.value}):this._def.out._parseSync({data:z.value,path:I.path,parent:I})}}static create(g,b){return new $l({in:g,out:b,typeName:ut.ZodPipeline})}}class Gl extends wt{_parse(g){const b=this._def.innerType._parse(g),I=z=>(xs(z)&&(z.value=Object.freeze(z.value)),z);return Al(b)?b.then(z=>I(z)):I(b)}unwrap(){return this._def.innerType}}Gl.create=(v,g)=>new Gl({innerType:v,typeName:ut.ZodReadonly,...yt(g)});function Gf(v,g){const b=typeof v=="function"?v(g):typeof v=="string"?{message:v}:v;return typeof b=="string"?{message:b}:b}function qf(v,g={},b){return v?bo.create().superRefine((I,z)=>{var B,S;const o=v(I);if(o instanceof Promise)return o.then(he=>{var me,Pe;if(!he){const Be=Gf(g,I),Ee=(Pe=(me=Be.fatal)!==null&&me!==void 0?me:b)!==null&&Pe!==void 0?Pe:!0;z.addIssue({code:"custom",...Be,fatal:Ee})}});if(!o){const he=Gf(g,I),me=(S=(B=he.fatal)!==null&&B!==void 0?B:b)!==null&&S!==void 0?S:!0;z.addIssue({code:"custom",...he,fatal:me})}}):bo.create()}const Dy={object:_i.lazycreate};var ut;(function(v){v.ZodString="ZodString",v.ZodNumber="ZodNumber",v.ZodNaN="ZodNaN",v.ZodBigInt="ZodBigInt",v.ZodBoolean="ZodBoolean",v.ZodDate="ZodDate",v.ZodSymbol="ZodSymbol",v.ZodUndefined="ZodUndefined",v.ZodNull="ZodNull",v.ZodAny="ZodAny",v.ZodUnknown="ZodUnknown",v.ZodNever="ZodNever",v.ZodVoid="ZodVoid",v.ZodArray="ZodArray",v.ZodObject="ZodObject",v.ZodUnion="ZodUnion",v.ZodDiscriminatedUnion="ZodDiscriminatedUnion",v.ZodIntersection="ZodIntersection",v.ZodTuple="ZodTuple",v.ZodRecord="ZodRecord",v.ZodMap="ZodMap",v.ZodSet="ZodSet",v.ZodFunction="ZodFunction",v.ZodLazy="ZodLazy",v.ZodLiteral="ZodLiteral",v.ZodEnum="ZodEnum",v.ZodEffects="ZodEffects",v.ZodNativeEnum="ZodNativeEnum",v.ZodOptional="ZodOptional",v.ZodNullable="ZodNullable",v.ZodDefault="ZodDefault",v.ZodCatch="ZodCatch",v.ZodPromise="ZodPromise",v.ZodBranded="ZodBranded",v.ZodPipeline="ZodPipeline",v.ZodReadonly="ZodReadonly"})(ut||(ut={}));const Ly=(v,g={message:`Input not instance of ${v.name}`})=>qf(b=>b instanceof v,g),Hf=vn.create,Wf=Da.create,By=Bu.create,Fy=La.create,Xf=Rl.create,Oy=vs.create,jy=zu.create,Ny=Dl.create,Zy=Ll.create,Vy=bo.create,Uy=bs.create,$y=aa.create,Gy=Ru.create,qy=bn.create,Hy=_i.create,Wy=_i.strictCreate,Xy=Bl.create,Ky=Du.create,Yy=Fl.create,Jy=$n.create,Qy=Ol.create,ex=Lu.create,tx=ws.create,ix=To.create,rx=jl.create,nx=Nl.create,ax=Ba.create,sx=Zl.create,ox=Mo.create,Kf=wn.create,lx=Gn.create,cx=Fa.create,ux=wn.createWithPreprocess,hx=$l.create;var nt=Object.freeze({__proto__:null,defaultErrorMap:xo,setErrorMap:uy,getErrorMap:Eu,makeIssue:Au,EMPTY_PATH:hy,addIssueToContext:qe,ParseStatus:gr,INVALID:ht,DIRTY:vo,OK:Er,isAborted:xd,isDirty:vd,isValid:xs,isAsync:Al,get util(){return Dt},get objectUtil(){return yd},ZodParsedType:Xe,getParsedType:na,ZodType:wt,datetimeRegex:Uf,ZodString:vn,ZodNumber:Da,ZodBigInt:La,ZodBoolean:Rl,ZodDate:vs,ZodSymbol:zu,ZodUndefined:Dl,ZodNull:Ll,ZodAny:bo,ZodUnknown:bs,ZodNever:aa,ZodVoid:Ru,ZodArray:bn,ZodObject:_i,ZodUnion:Bl,ZodDiscriminatedUnion:Du,ZodIntersection:Fl,ZodTuple:$n,ZodRecord:Ol,ZodMap:Lu,ZodSet:ws,ZodFunction:To,ZodLazy:jl,ZodLiteral:Nl,ZodEnum:Ba,ZodNativeEnum:Zl,ZodPromise:Mo,ZodEffects:wn,ZodTransformer:wn,ZodOptional:Gn,ZodNullable:Fa,ZodDefault:Vl,ZodCatch:Ul,ZodNaN:Bu,BRAND:Ry,ZodBranded:Td,ZodPipeline:$l,ZodReadonly:Gl,custom:qf,Schema:wt,ZodSchema:wt,late:Dy,get ZodFirstPartyTypeKind(){return ut},coerce:{string:v=>vn.create({...v,coerce:!0}),number:v=>Da.create({...v,coerce:!0}),boolean:v=>Rl.create({...v,coerce:!0}),bigint:v=>La.create({...v,coerce:!0}),date:v=>vs.create({...v,coerce:!0})},any:Vy,array:qy,bigint:Fy,boolean:Xf,date:Oy,discriminatedUnion:Ky,effect:Kf,enum:ax,function:ix,instanceof:Ly,intersection:Yy,lazy:rx,literal:nx,map:ex,nan:By,nativeEnum:sx,never:$y,null:Zy,nullable:cx,number:Wf,object:Hy,oboolean:()=>Xf().optional(),onumber:()=>Wf().optional(),optional:lx,ostring:()=>Hf().optional(),pipeline:hx,preprocess:ux,promise:ox,record:Qy,set:tx,strictObject:Wy,string:Hf,symbol:jy,transformer:Kf,tuple:Jy,undefined:Ny,union:Xy,unknown:Uy,void:Gy,NEVER:ht,ZodIssueCode:je,quotelessJson:cy,ZodError:Jr});const Fu=nt.object({lat:nt.number(),lng:nt.number()}),dx=nt.object({center:Fu,zoom:nt.number()}),px=nt.object({sw:Fu,ne:Fu}),fx=nt.object({name:nt.literal("dark").or(nt.literal("light")),url:nt.string().optional(),colors:nt.object({primary:nt.string().max(64),background:nt.string().max(64),text:nt.string().max(64)})}),mx=nt.object({container:nt.string(),position:nt.object({center:nt.object({lat:nt.number(),lng:nt.number()}),zoom:nt.number()}),restriction:nt.object({minZoom:nt.number().min(gd).max(El).optional(),maxZoom:nt.number().min(gd).max(El).optional(),maxBounds:px.optional()}).optional(),style:fx});nt.enum(["idle","move","click","popup_click"]);const gx=nt.function().returns(nt.void()),_x=nt.function().args(dx).returns(nt.void()),yx=nt.function().args(Fu).returns(nt.void()),xx={idle:gx,move:_x,click:yx},Yf=nt.object({id:nt.string(),rank:nt.number(),lat:nt.number(),lng:nt.number(),width:nt.number(),height:nt.number()}),vx=nt.tuple([nt.number(),nt.array(nt.tuple([nt.number(),nt.number()]))]),Jf=nt.function().args(nt.string()).returns(nt.promise(nt.any())),bx=nt.object({data:Yf,state:vx,content:nt.object({bodyCallback:Jf,pinCallback:Jf.optional()})}),wx=nt.array(bx);nt.object({apiKey:nt.string(),data:nt.array(Yf),minZoom:nt.number().optional(),maxZoom:nt.number().optional()});var Tx=od('<div class="container svelte-1l30n6h"><div class="map svelte-1l30n6h"></div> <div class="logo svelte-1l30n6h"><a href="https://arenarium.dev" target="_blank" class="svelte-1l30n6h">@arenarium/maps</a></div></div>');function Qf(v,g){pu(g,!0);let b,I,z,B,S,o=Zi(0),he=Zi(0),me=Zi(!1),Pe=Zi(void 0);Ef(()=>{mx.parse(g.options),Be(),Ee()});function Be(){var Ce,Ye,Ue;z=((Ce=g.options.restriction)==null?void 0:Ce.minZoom)??gd,B=((Ye=g.options.restriction)==null?void 0:Ye.maxZoom)??El,S=(Ue=g.options.restriction)==null?void 0:Ue.maxBounds,b=new _d.Map({style:yr(g.options.style),center:{lat:g.options.position.center.lat,lng:g.options.position.center.lng},zoom:g.options.position.zoom,minZoom:It(z),maxZoom:B,maxBounds:S?[S.sw.lng,S.sw.lat,S.ne.lng,S.ne.lat]:void 0,container:I,pitchWithRotate:!1,attributionControl:{compact:!1}})}function Ee(){b.on("load",le),b.on("move",Fe),b.on("idle",Bt),b.on("click",fi),b.dragRotate.disable(),b.keyboard.disable(),b.touchZoomRotate.disableRotation(),b.touchPitch.disable()}function le(){di(me,!0)}function Fe(){const Ce=b.getCenter(),Ye=b.getZoom();Ft("move",{center:Ce,zoom:Ye});const Ue=b.getBounds();di(Pe,{sw:{lat:Ue.getSouthWest().lat,lng:Ue.getSouthWest().lng},ne:{lat:Ue.getNorthEast().lat,lng:Ue.getNorthEast().lng}},!0)}function Bt(){Ft("idle",null);const Ce=b.getBounds();di(Pe,{sw:{lat:Ce.getSouthWest().lat,lng:Ce.getSouthWest().lng},ne:{lat:Ce.getNorthEast().lat,lng:Ce.getNorthEast().lng}},!0)}function fi(Ce){Ft("click",{lat:Ce.lngLat.lat,lng:Ce.lngLat.lng})}const ti=new Map;function yi(Ce,Ye){var Nt;const Ue=xx[Ce];if(!Ue)throw new Error(`No schema defined for event ${Ce}`);if(!Ue.safeParse(Ye).success)throw new Error(`Invalid handler for event ${Ce}`);ti.has(Ce)||ti.set(Ce,new Set),(Nt=ti.get(Ce))==null||Nt.add(Ye)}function Ki(Ce,Ye){const Ue=ti.get(Ce);Ue&&Ue.delete(Ye)&&Ue.size===0&&ti.delete(Ce)}function Ft(Ce,Ye){const Ue=ti.get(Ce);Ue&&Ue.size>0&&[...Ue].forEach(_t=>{try{_t(Ye)}catch(Nt){console.error(Nt)}})}function It(Ce){const Ye=zf,Ue=Math.ceil(Math.log2(ct(o)/Ye));return Math.max(Ce,Ue)}function $t(){const Ce=b.getCenter();return Ce?{lat:Ce.lat,lng:Ce.lng}:{lat:g.options.position.center.lat,lng:g.options.position.center.lng}}function _r(){return b.getZoom()??g.options.position.zoom}function jt(){if(!b)throw new Error("Map not loaded!");const Ce=b.getBounds();return{sw:{lat:Ce.getSouthWest().lat,lng:Ce.getSouthWest().lng},ne:{lat:Ce.getNorthEast().lat,lng:Ce.getNorthEast().lng}}}function Tn(Ce){if(!b)throw new Error("Map not loaded! Consider using the position option");b.setCenter(Ce)}function Mn(Ce){if(!b)throw new Error("Map not loaded! Consider using the position option");b.setZoom(Ce)}function Yi(){if(!b)throw new Error("Map not loaded! Consider using the position option");b.zoomIn()}function ar(){if(!b)throw new Error("Map not loaded! Consider using the position option.");b.zoomOut()}function Ji(Ce){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");z=Ce,b.setMinZoom(It(Ce))}function ot(Ce){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");B=Ce,b.setMaxZoom(Ce)}function Vi(Ce){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");S=Ce,b.setMaxBounds([Ce.sw.lng,Ce.sw.lat,Ce.ne.lng,Ce.ne.lat])}let xi=Zi(gs(g.options.style));go(()=>{ct(me)&&b.setStyle(yr(ct(xi)),{diff:!0})});function yr(Ce){if(Ce.url)return Ce.url;switch(Ce.name){case"light":return ly;case"dark":return oy}}function Et(){return o_(ct(xi))}function Ar(Ce){di(xi,Ce,!0),b.setStyle(yr(ct(xi)),{diff:!0})}class sr{constructor(Ye){qt(this,"id");qt(this,"lat");qt(this,"lng");qt(this,"zoom");qt(this,"element");qt(this,"component");qt(this,"libreMarker");this.id=Ye.data.id,this.lat=Ye.data.lat,this.lng=Ye.data.lng,this.zoom=Ye.state[0],this.element=void 0,this.component=void 0,this.libreMarker=void 0}createLibreMarker(){const Ye=this.element;if(!Ye)throw new Error("Failed to create libre marker");const Ue=new _d.Marker({element:Ye});Ue.setLngLat([this.lng,this.lat]),this.libreMarker=Ue}isCreated(){return this.element!=null}isInBlock(Ye,Ue){return this.zoom<=Ye&&Ue.contains(this.lat,this.lng)}}class cn extends sr{constructor(Ue){super(Ue);qt(this,"pinLoading",!1);qt(this,"pinLoaded",!1);qt(this,"pinContentCallback");this.pinContentCallback=Ue.content.pinCallback}createElement(){this.element=document.createElement("div"),this.element.classList.add("circle"),this.component=cd(iy,{target:this.element}),this.createLibreMarker(),this.updateZIndex()}updateZIndex(){const Ue=this.element;if(!Ue)return;const _t=Math.round((El-this.zoom)*Rf);Ue.style.zIndex=_t.toString()}updateMap(Ue){if(this.libreMarker==null)throw new Error("Failed to update circle map");this.libreMarker._map!=Ue&&(Ue?this.libreMarker.addTo(Ue):this.libreMarker.remove())}updateState(Ue){const _t=this.component;if(!_t)throw new Error("Failed to update circle state");if(this.zoom<=Ue)_t.setCollapsed(!0);else{const cr=1-(this.zoom-Ue)/Df*.5;_t.setScale(cr),_t.setCollapsed(!1)}}updatePin(){var _t;if(this.pinContentCallback==null||this.pinLoaded||this.pinLoading)return;const Ue=(_t=this.component)==null?void 0:_t.getPin();Ue!=null&&(this.pinLoading=!0,this.pinContentCallback(this.id).then(Nt=>{Ue.appendChild(Nt),this.pinLoaded=!0,this.pinLoading=!1}))}isPinLoaded(){return this.pinContentCallback==null||this.pinLoaded}}class kr extends sr{constructor(Ue){super(Ue);qt(this,"width");qt(this,"height");qt(this,"angles");qt(this,"bodyLoading",!1);qt(this,"bodyLoaded",!1);qt(this,"bodyContentCallback");this.id=Ue.data.id,this.angles=Ue.state[1],this.width=Ue.data.width,this.height=Ue.data.height,this.bodyContentCallback=Ue.content.bodyCallback}createElement(){this.element=document.createElement("div"),this.element.classList.add("marker"),this.component=cd(ey,{target:this.element,props:{width:this.width,height:this.height}}),this.createLibreMarker(),this.updateZIndex()}updateZIndex(){const Ue=this.element;if(!Ue)return;const _t=Math.round((El-this.zoom)*Rf)+1e6;Ue.style.zIndex=_t.toString()}updateMap(Ue){const _t=this.libreMarker,Nt=this.component;if(_t==null||Nt==null)throw new Error("Failed to update marker map");_t._map!=Ue&&(Ue?(_t.addTo(Ue),Nt.setDisplayed(!0)):(_t.remove(),Nt.setDisplayed(!1)))}updateState(Ue){const _t=this.component;if(!_t)throw new Error("Failed to update marker state");this.zoom<=Ue?(_t.setCollapsed(!1),_t.setAngle(this.getAngle(Ue))):_t.setCollapsed(!0)}updateBody(){var _t;if(this.bodyLoaded||this.bodyLoading)return;const Ue=(_t=this.component)==null?void 0:_t.getBody();Ue!=null&&(this.bodyLoading=!0,this.bodyContentCallback(this.id).then(Nt=>{Ue.appendChild(Nt),this.bodyLoading=!1,this.bodyLoaded=!0}))}getAngle(Ue){let _t=this.angles,Nt=_t[0],cr=0;for(;Nt[0]<Ue&&(cr++,cr!=_t.length);)Nt=_t[cr];return Nt[1]}getExpanded(){return this.component?this.component.getExpanded():!1}getCollapsed(){return this.component?this.component.getCollapsed():!1}isBodyLoaded(){return this.bodyLoaded}}class la{constructor(Ye){qt(this,"id");qt(this,"rank");qt(this,"lat");qt(this,"lng");qt(this,"zoom");qt(this,"circle");qt(this,"marker");this.id=Ye.data.id,this.rank=Ye.data.rank,this.lat=Ye.data.lat,this.lng=Ye.data.lng,this.zoom=Ye.state[0],this.circle=new cn(Ye),this.marker=new kr(Ye)}}let xr,Ht=new Array,vr=new Map,Qi=zf,Sn=mu(()=>ct(Pe)?new Ff(b,-512,ct(he)+Qi,ct(o)+Qi,-512):void 0),un=mu(()=>ct(Pe)?new Ff(b,0,ct(he),ct(o),0):void 0);Ef(()=>{const Ce=()=>{ca(),xr=window.setTimeout(Ce,25)};return Ce(),()=>clearInterval(xr)});function ca(){if(ct(me)==!1||ct(un)==null||ct(Sn)==null||Ht.length==0)return;const Ce=b.getZoom();if(Ce)for(const Ye of Ht)or(Ye.circle,Ce,ct(un)),lr(Ye.marker,Ce,ct(Sn))}function or(Ce,Ye,Ue){Ce.isInBlock(Ye+Df,Ue)?(Ce.isCreated()==!1&&Ce.createElement(),Ce.updateMap(b),Ce.updateState(Ye),Ce.isPinLoaded()==!1&&Ce.updatePin()):Ce.isCreated()==!0&&Ce.updateMap(null)}function lr(Ce,Ye,Ue){Ce.isInBlock(Ye+Y_,Ue)?(Ce.isCreated()==!1&&Ce.createElement(),Ce.updateMap(b),Ce.updateState(Ye),Ce.getExpanded()&&Ce.isBodyLoaded()==!1&&Ce.updateBody()):Ce.isCreated()==!0&&(Ce.getCollapsed()?Ce.updateMap(null):Ce.updateState(Ye))}async function Ui(Ce){var Nt,cr;const Ye=new Map(Ce.map(mi=>[mi.data.id,new la(mi)])),Ue=new Array,_t=Array.from(Ht);for(const mi of _t)Ye.has(mi.id)==!1&&((Nt=mi.circle.libreMarker)==null||Nt.remove(),(cr=mi.marker.libreMarker)==null||cr.remove(),vr.delete(mi.id),Ht.splice(Ht.indexOf(mi),1));for(const mi of Ce){const zr=vr.get(mi.data.id);if(zr)zr.circle.zoom=mi.state[0],zr.circle.updateZIndex(),zr.marker.zoom=mi.state[0],zr.marker.angles=mi.state[1],zr.marker.updateZIndex();else{const Rr=new la(mi);vr.set(mi.data.id,Rr),Ht.push(Rr),Ue.push(Rr)}}}function Zt(){var Ce,Ye;for(const Ue of Ht)(Ce=Ue.circle.libreMarker)==null||Ce.remove(),(Ye=Ue.marker.libreMarker)==null||Ye.remove();Ht.length=0,vr.clear()}async function Vr(Ce){if(!(await wx.safeParseAsync(Ce)).success)throw new Error("Invalid popups");await Ui(Ce)}function hn(){Zt()}function br(Ce){const Ye=vr.get(Ce);Ye!=null&&b.flyTo({center:{lat:Ye.lat,lng:Ye.lng},zoom:Ye.zoom})}var Pn=Tx();F_("resize",td,()=>b.setMinZoom(It(z)));var Cn=gu(Pn);return yo(Cn,Ce=>I=Ce,()=>I),id(()=>Pu(Pn,`--primary: ${ct(xi).colors.primary??""}; --background: ${ct(xi).colors.background??""}; --text: ${ct(xi).colors.text??""};`)),Cu(Cn,"clientWidth",Ce=>di(o,Ce)),Cu(Cn,"clientHeight",Ce=>di(he,Ce)),ld(v,Pn),fu({on:yi,off:Ki,emit:Ft,getCenter:$t,getZoom:_r,getBounds:jt,setCenter:Tn,setZoom:Mn,zoomIn:Yi,zoomOut:ar,setMinZoom:Ji,setMaxZoom:ot,setMaxBounds:Vi,getStyle:Et,setStyle:Ar,updatePopups:Vr,removePopups:hn,revealPopup:br})}function Mx(v){const g=document.getElementById(v.container);if(!g)throw new Error(`Container not found: ${v.container}`);return cd(Qf,{target:g,props:{options:v}})}function Sx(v){Z_(v)}Ot.Map=Qf,Ot.mountMap=Mx,Ot.unmountMap=Sx,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"})});
742
+ ${F.shaderPreludeCode.vertexSource}`,define:F.shaderDefine},defaultProjectionData:H},W=E.renderingMode?E.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=E.prerender;K&&(f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),K.call(E,A.gl,q),A.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),A.setStencilMode(mt.disabled);const K=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,lt.ReadOnly);A.setDepthMode(K),E.render(A.gl,q),A.setDirty(),f.setBaseState(),A.bindFramebuffer.set(null)}}(e,0,s,h))}saveTileTexture(e){const i=this._tileTextures[e.size[0]];i?i.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const i=this._tileTextures[e];return i&&i.length>0?i.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const i=this.imageManager.getPattern(e.from.toString()),s=this.imageManager.getPattern(e.to.toString());return!i||!s}useProgram(e,i,s=!1,l=[]){this.cache=this.cache||{};const h=!!this.style.map.terrain,f=this.style.projection,_=s?ur.projectionMercator:f.shaderPreludeCode,x=s?ma:f.shaderDefine,T=e+(i?i.cacheKey:"")+`/${s?Mt:f.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(h?"/terrain":"")+(l?`/${l.join("/")}`:"");return this.cache[T]||(this.cache[T]=new Ro(this.context,ur[e],i,rh[e],this._showOverdrawInspector,h,_,x,l)),this.cache[T]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new jt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:i}=this.context.gl;return this.width!==e||this.height!==i}}function Xs(u,e){let i,s=!1,l=null,h=null;const f=()=>{l=null,s&&(u.apply(h,i),l=setTimeout(f,e),s=!1)};return(..._)=>(s=!0,h=this,i=_,l||f(),l)}class bc{constructor(e){this._getCurrentHash=()=>{const i=window.location.hash.replace("#","");if(this._hashName){let s;return i.split("&").map(l=>l.split("=")).forEach(l=>{l[0]===this._hashName&&(s=l)}),(s&&s[1]||"").split("/")}return i.split("/")},this._onHashChange=()=>{const i=this._getCurrentHash();if(!this._isValidHash(i))return!1;const s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:s,pitch:+(i[4]||0)}),!0},this._updateHashUnthrottled=()=>{const i=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,i)},this._removeHash=()=>{const i=this._getCurrentHash();if(i.length===0)return;const s=i.join("/");let l=s;l.split("&").length>0&&(l=l.split("&")[0]),this._hashName&&(l=`${this._hashName}=${s}`);let h=window.location.hash.replace(l,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let f=window.location.href.replace(/(#.+)?$/,h);f=f.replace("&&","&"),window.history.replaceState(window.history.state,null,f)},this._updateHash=Xs(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const i=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,l=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,l),f=Math.round(i.lng*h)/h,_=Math.round(i.lat*h)/h,x=this._map.getBearing(),T=this._map.getPitch();let P="";if(P+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(x||T)&&(P+="/"+Math.round(10*x)/10),T&&(P+=`/${Math.round(T)}`),this._hashName){const A=this._hashName;let E=!1;const F=window.location.hash.slice(1).split("&").map(O=>{const H=O.split("=")[0];return H===A?(E=!0,`${H}=${P}`):O}).filter(O=>O);return E||F.push(`${A}=${P}`),`#${F.join("&")}`}return`#${P}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new o.Q(+e[2],+e[1])}catch{return!1}const i=+e[0],s=+(e[3]||0),l=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&s>=-180&&s<=180&&l>=this._map.getMinPitch()&&l<=this._map.getMaxPitch()}}const mn={linearity:.3,easing:o.cd(0,0,.3,1)},wc=o.e({deceleration:2500,maxSpeed:1400},mn),Ks=o.e({deceleration:20,maxSpeed:1400},mn),Tc=o.e({deceleration:1e3,maxSpeed:360},mn),_h=o.e({deceleration:1e3,maxSpeed:90},mn),yh=o.e({deceleration:1e3,maxSpeed:360},mn);class xh{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Ee.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=Ee.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)i.zoom+=h.zoomDelta||0,i.bearing+=h.bearingDelta||0,i.pitch+=h.pitchDelta||0,i.roll+=h.rollDelta||0,h.panDelta&&i.pan._add(h.panDelta),h.around&&(i.around=h.around),h.pinchAround&&(i.pinchAround=h.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,l={};if(i.pan.mag()){const h=es(i.pan.mag(),s,o.e({},wc,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,Qa(l,h)}if(i.zoom){const h=es(i.zoom,s,Ks);l.zoom=this._map.transform.zoom+h.amount,Qa(l,h)}if(i.bearing){const h=es(i.bearing,s,Tc);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),Qa(l,h)}if(i.pitch){const h=es(i.pitch,s,_h);l.pitch=this._map.transform.pitch+h.amount,Qa(l,h)}if(i.roll){const h=es(i.roll,s,yh);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),Qa(l,h)}if(l.zoom||l.bearing){const h=i.pinchAround===void 0?i.around:i.pinchAround;l.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),o.e(l,{noMoveStart:!0})}}function Qa(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function es(u,e,i){const{maxSpeed:s,linearity:l,deceleration:h}=i,f=o.ae(u*l/(e/1e3),-s,s),_=Math.abs(f)/(h*l);return{easing:i.easing,duration:1e3*_,amount:f*(_/2)}}class Ei extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s,l={}){s=s instanceof MouseEvent?s:new MouseEvent(e,s);const h=le.mousePos(i.getCanvas(),s),f=i.unproject(h);super(e,o.e({point:h,lngLat:f,originalEvent:s},l)),this._defaultPrevented=!1,this.target=i}}class ts extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){const l=e==="touchend"?s.changedTouches:s.touches,h=le.touchPos(i.getCanvasContainer(),l),f=h.map(x=>i.unproject(x)),_=h.reduce((x,T,P,A)=>x.add(T.div(A.length)),new o.P(0,0));super(e,{points:h,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class Mc extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class vh{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Mc(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new Ei(e.type,this._map,e))}mouseup(e){this._map.fire(new Ei(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new Ei(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Ei(e.type,this._map,e))}mouseover(e){this._map.fire(new Ei(e.type,this._map,e))}mouseout(e){this._map.fire(new Ei(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ts(e.type,this._map,e))}touchmove(e){this._map.fire(new ts(e.type,this._map,e))}touchend(e){this._map.fire(new ts(e.type,this._map,e))}touchcancel(e){this._map.fire(new ts(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class bh{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Ei(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ei("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Ei(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class is{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(o.P.convert(e),this._map.terrain)}}class Sc{constructor(e,i){this._map=e,this._tr=new is(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,i){this.isEnabled()&&e.shiftKey&&e.button===0&&(le.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;const s=i;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const l=this._startPos;this._lastPos=s,this._box||(this._box=le.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const h=Math.min(l.x,s.x),f=Math.max(l.x,s.x),_=Math.min(l.y,s.y),x=Math.max(l.y,s.y);le.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=x-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),le.suppressClick(),s.x!==l.x||s.y!==l.y)return this._map.fire(new o.l("boxzoomend",{originalEvent:e})),{cameraAnimation:h=>h.fitScreenCoordinates(s,l,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(le.remove(this._box),this._box=null),le.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function il(u,e){if(u.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${u.length}, points ${e.length}`);const i={};for(let s=0;s<u.length;s++)i[u[s].identifier]=e[s];return i}class wh{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),s.length===this.numTouches&&(this.centroid=function(l){const h=new o.P(0,0);for(const f of l)h._add(f);return h.div(l.length)}(i),this.touches=il(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=il(s,i);for(const h in this.touches){const f=l[h];(!f||f.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(e,i,s){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const l=!this.aborted&&this.centroid;if(this.reset(),l)return l}}}class rs{constructor(e){this.singleTap=new wh(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,i,s){this.singleTap.touchstart(e,i,s)}touchmove(e,i,s){this.singleTap.touchmove(e,i,s)}touchend(e,i,s){const l=this.singleTap.touchend(e,i,s);if(l){const h=e.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(l)<30;if(h&&f||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=l,this.count===this.numTaps)return this.reset(),l}}}class Th{constructor(e){this._tr=new is(e),this._zoomIn=new rs({numTouches:1,numTaps:2}),this._zoomOut=new rs({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,s){this._zoomIn.touchstart(e,i,s),this._zoomOut.touchstart(e,i,s)}touchmove(e,i,s){this._zoomIn.touchmove(e,i,s),this._zoomOut.touchmove(e,i,s)}touchend(e,i,s){const l=this._zoomIn.touchend(e,i,s),h=this._zoomOut.touchend(e,i,s),f=this._tr;return l?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(l)},{originalEvent:e})}):h?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom-1,around:f.unproject(h)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ir{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const i=this._moveFunction(...e);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(e,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,i){if(!this.isEnabled())return;const s=this._lastPoint;if(!s)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const l=Array.isArray(i)?i[0]:i;return!this._moved&&l.dist(s)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=l,this._move(s,l))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&le.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Qr={0:1,2:2};class ns{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=le.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=Qr[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return le.mouseButton(e)===this._eventButton}}class en{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class as{constructor(e=new ns({checkCorrectEvent:()=>!0}),i=new en){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(e,i,s){return e instanceof MouseEvent?i(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?s(e):void 0}startMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.startMove(i),i=>this.oneFingerTouchMoveStateManager.startMove(i))}endMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.endMove(i),i=>this.oneFingerTouchMoveStateManager.endMove(i))}isValidStartEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidStartEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidStartEvent(i))}isValidMoveEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidMoveEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(i))}isValidEndEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidEndEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidEndEvent(i))}}const rl=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class qd{constructor(e,i){this._clickTolerance=e.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,i,s){return this._calculateTransform(e,i,s)}touchmove(e,i,s){if(this._active){if(!this._shouldBePrevented(s.length))return e.preventDefault(),this._calculateTransform(e,i,s);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,i,s){this._calculateTransform(e,i,s),this._active&&this._shouldBePrevented(s.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,s){s.length>0&&(this._active=!0);const l=il(s,i),h=new o.P(0,0),f=new o.P(0,0);let _=0;for(const T in l){const P=l[T],A=this._touches[T];A&&(h._add(P),f._add(P.sub(A)),_++,l[T]=P)}if(this._touches=l,this._shouldBePrevented(_)||!f.mag())return;const x=f.div(_);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:x}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Pc{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,i,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([i[0],i[1]]))}touchmove(e,i,s){if(!this._firstTwoTouches)return;e.preventDefault();const[l,h]=this._firstTwoTouches,f=nl(s,i,l),_=nl(s,i,h);if(!f||!_)return;const x=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],x,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=nl(s,i,l),_=nl(s,i,h);f&&_||(this._active&&le.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function nl(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function Cc(u,e){return Math.log(u/e)/Math.LN2}class ss extends Pc{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,i){const s=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Cc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Cc(this._distance,s),pinchAround:i}}}function gn(u,e){return 180*u.angleWith(e)/Math.PI}class $e extends Pc{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,i,s){const l=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:gn(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=gn(e,this._startVector);return Math.abs(s)<i}}function al(u){return Math.abs(u.y)>Math.abs(u.x)}class sl extends Pc{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,i,s){super.touchstart(e,i,s),this._currentTouchCount=s.length}_start(e){this._lastPoints=e,al(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,i,s){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const l=e[0].sub(this._lastPoints[0]),h=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(l,h,s.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(l.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(e,i,s){if(this._valid!==void 0)return this._valid;const l=e.mag()>=2,h=i.mag()>=2;if(!l&&!h)return;if(!l||!h)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=e.y>0==i.y>0;return al(e)&&al(i)&&f}}const Mh={panStep:100,bearingStep:15,pitchStep:10};class os{constructor(e){this._tr=new is(e);const i=Mh;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,s=0,l=0,h=0,f=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?s=-1:(e.preventDefault(),h=-1);break;case 39:e.shiftKey?s=1:(e.preventDefault(),h=1);break;case 38:e.shiftKey?l=1:(e.preventDefault(),f=-1);break;case 40:e.shiftKey?l=-1:(e.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,l=0),{cameraAnimation:_=>{const x=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Ys,zoom:i?Math.round(x.zoom)+i*(e.shiftKey?2:1):x.zoom,bearing:x.bearing+s*this._bearingStep,pitch:x.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:x.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Ys(u){return u*(2-u)}const Ic=4.000244140625;class vt{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new is(e),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const s=Ee.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%Ic==0?this._type="wheel":i!==0&&Math.abs(i)<4?this._type="trackpad":l>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(l*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=le.mousePos(this._map.getCanvas(),e),s=this._tr;this._aroundPoint=this._aroundCenter?s.transform.locationToScreenPoint(o.Q.convert(s.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>Ic?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&x!==0&&(x=1/x);const T=typeof this._targetZoom!="number"?e.scale:o.ac(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),o.ah(T*x)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,s=this._startZoom,l=this._easing;let h,f=!1;if(this._type==="wheel"&&s&&l){const _=Ee.now()-this._lastWheelEventTime,x=Math.min((_+5)/200,1),T=l(x);h=o.B.number(s,i,T),x<1?this._frameId||(this._frameId=!0):f=!0}else h=i,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=h,{noInertia:!0,needsRenderFrame:!f,zoomDelta:h-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=o.cf;if(this._prevEase){const s=this._prevEase,l=(Ee.now()-s.start)/s.duration,h=s.easing(l+.01)-s.easing(l),f=.27/Math.sqrt(h*h+1e-4)*.01,_=Math.sqrt(.0729-f*f);i=o.cd(f,_,.25,1)}return this._prevEase={start:Ee.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ol{constructor(e,i){this._clickZoom=e,this._tapZoom=i}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Hd{constructor(e){this._tr=new is(e),this.reset()}reset(){this._active=!1}dblclick(e,i){return e.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ec{constructor(){this._tap=new rs({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,i,s){if(!this._swipePoint)if(this._tapTime){const l=i[0],h=e.timeStamp-this._tapTime<500,f=this._tapPoint.dist(l)<30;h&&f?s.length>0&&(this._swipePoint=l,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(e,i,s)}touchmove(e,i,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const l=i[0],h=l.y-this._swipePoint.y;return this._swipePoint=l,e.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(e,i,s)}touchend(e,i,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{const l=this._tap.touchend(e,i,s);l&&(this._tapTime=e.timeStamp,this._tapPoint=l)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Sh{constructor(e,i,s){this._el=e,this._mousePan=i,this._touchPan=s}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Ph{constructor(e,i,s,l){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=i,this._mousePitch=s,this._mouseRoll=l}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Ac{constructor(e,i,s,l){this._el=e,this._touchZoom=i,this._touchRotate=s,this._tapDragZoom=l,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-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()}}class ll{constructor(e,i){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=le.create("div","maplibregl-cooperative-gesture-screen",e);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const s=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),l=document.createElement("div");l.className="maplibregl-desktop-message",l.textContent=i,this._container.appendChild(l);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=s,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(le.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new o.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Js=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Wd extends o.l{}function cl(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class Xd{constructor(e,i){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,h)=>{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const f=l.type==="renderFrame"?void 0:l,_={needsRenderFrame:!1},x={},T={};for(const{handlerName:E,handler:F,allowed:O}of this._handlers){if(!F.isEnabled())continue;let H;if(this._blockedByActive(T,O,E))F.reset();else if(F[h||l.type]){if(o.cg(l,h||l.type)){const q=le.mousePos(this._map.getCanvas(),l);H=F[h||l.type](l,q)}else if(o.ch(l,h||l.type)){const q=this._getMapTouches(l.touches),W=le.touchPos(this._map.getCanvas(),q);H=F[h||l.type](l,W,q)}else o.ci(h||l.type)||(H=F[h||l.type](l));this.mergeHandlerResult(_,x,H,E,f),H&&H.needsRenderFrame&&this._triggerRenderFrame()}(H||F.isActive())&&(T[E]=F)}const P={};for(const E in this._previousActiveHandlers)T[E]||(P[E]=f);this._previousActiveHandlers=T,(Object.keys(P).length||cl(_))&&(this._changes.push([_,x,P]),this._triggerRenderFrame()),(Object.keys(T).length||cl(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:A}=_;A&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],A(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new xh(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[l,h,f]of this._listeners)le.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)le.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new vh(i,e));const l=i.boxZoom=new Sc(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new ll(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new Th(i),_=new Hd(i);i.doubleClickZoom=new ol(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const x=new Ec;this._add("tapDragZoom",x);const T=i.touchPitch=new sl(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const P=()=>i.project(i.getCenter()),A=function({enable:ee,clickTolerance:ie,aroundCenter:se=!0,minPixelCenterThreshold:re=100,rotateDegreesPerPixelMoved:pe=.8},Me){const xe=new ns({checkCorrectEvent:ve=>le.mouseButton(ve)===0&&ve.ctrlKey||le.mouseButton(ve)===2&&!ve.ctrlKey});return new ir({clickTolerance:ie,move:(ve,be)=>{const Ne=Me();if(se&&Math.abs(Ne.y-ve.y)>re)return{bearingDelta:o.ce(new o.P(ve.x,be.y),be,Ne)};let Oe=(be.x-ve.x)*pe;return se&&be.y<Ne.y&&(Oe=-Oe),{bearingDelta:Oe}},moveStateManager:xe,enable:ee,assignEvents:rl})}(e,P),E=function({enable:ee,clickTolerance:ie,pitchDegreesPerPixelMoved:se=-.5}){const re=new ns({checkCorrectEvent:pe=>le.mouseButton(pe)===0&&pe.ctrlKey||le.mouseButton(pe)===2});return new ir({clickTolerance:ie,move:(pe,Me)=>({pitchDelta:(Me.y-pe.y)*se}),moveStateManager:re,enable:ee,assignEvents:rl})}(e),F=function({enable:ee,clickTolerance:ie,rollDegreesPerPixelMoved:se=.3},re){const pe=new ns({checkCorrectEvent:Me=>le.mouseButton(Me)===2&&Me.ctrlKey});return new ir({clickTolerance:ie,move:(Me,xe)=>{const ve=re();let be=(xe.x-Me.x)*se;return xe.y<ve.y&&(be=-be),{rollDelta:be}},moveStateManager:pe,enable:ee,assignEvents:rl})}(e,P);i.dragRotate=new Ph(e,A,E,F),this._add("mouseRotate",A,["mousePitch"]),this._add("mousePitch",E,["mouseRotate","mouseRoll"]),this._add("mouseRoll",F,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const O=function({enable:ee,clickTolerance:ie}){const se=new ns({checkCorrectEvent:re=>le.mouseButton(re)===0&&!re.ctrlKey});return new ir({clickTolerance:ie,move:(re,pe)=>({around:pe,panDelta:pe.sub(re)}),activateOnStart:!0,moveStateManager:se,enable:ee,assignEvents:rl})}(e),H=new qd(e,i);i.dragPan=new Sh(s,O,H),this._add("mousePan",O),this._add("touchPan",H,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const q=new $e,W=new ss;i.touchZoomRotate=new Ac(s,W,q,x),this._add("touchRotate",q,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const K=i.scrollZoom=new vt(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const te=i.keyboard=new os(i);this._add("keyboard",te),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new bh(i))}_add(e,i,s){this._handlers.push({handlerName:e,handler:i,allowed:s}),this._handlersById[e]=i}stop(e){if(!this._updatingCamera){for(const{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Js(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,i,s){for(const l in e)if(l!==s&&(!i||i.indexOf(l)<0))return!0;return!1}_getMapTouches(e){const i=[];for(const s of e)this._el.contains(s.target)&&i.push(s);return i}mergeHandlerResult(e,i,s,l,h){if(!s)return;o.e(e,s);const f={handlerName:l,originalEvent:s.originalEvent||h};s.zoomDelta!==void 0&&(i.zoom=f),s.panDelta!==void 0&&(i.drag=f),s.rollDelta!==void 0&&(i.roll=f),s.pitchDelta!==void 0&&(i.pitch=f),s.bearingDelta!==void 0&&(i.rotate=f)}_applyChanges(){const e={},i={},s={};for(const[l,h,f]of this._changes)l.panDelta&&(e.panDelta=(e.panDelta||new o.P(0,0))._add(l.panDelta)),l.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+l.zoomDelta),l.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+l.bearingDelta),l.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+l.pitchDelta),l.rollDelta&&(e.rollDelta=(e.rollDelta||0)+l.rollDelta),l.around!==void 0&&(e.around=l.around),l.pinchAround!==void 0&&(e.pinchAround=l.pinchAround),l.noInertia&&(e.noInertia=l.noInertia),o.e(i,h),o.e(s,f);this._updateMapTransform(e,i,s),this._changes=[]}_updateMapTransform(e,i,s){const l=this._map,h=l._getTransformForUpdate(),f=l.terrain;if(!(cl(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:T,pitchDelta:P,rollDelta:A,around:E,pinchAround:F}=e;F!==void 0&&(E=F),E=E||l.transform.centerPoint,f&&!h.isPointOnMapSurface(E)&&(E=h.centerPoint);const O={panDelta:_,zoomDelta:x,rollDelta:A,pitchDelta:P,bearingDelta:T,around:E};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(E)&&(E=h.centerPoint);const H=E.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?E.sub(_):E);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(O,h,H):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(O,h,H))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._map.cameraHelper.handleMapControlsPan(O,h,H)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=Js(this._eventsInProgress),h=Js(e),f={};for(const A in e){const{originalEvent:E}=e[A];this._eventsInProgress[A]||(f[`${A}start`]=E),this._eventsInProgress[A]=e[A]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const A in f)this._fireEvent(A,f[A]);h&&this._fireEvent("move",h.originalEvent);for(const A in e){const{originalEvent:E}=e[A];this._fireEvent(A,E)}const _={};let x;for(const A in this._eventsInProgress){const{handlerName:E,originalEvent:F}=this._eventsInProgress[A];this._handlersById[E].isActive()||(delete this._eventsInProgress[A],x=i[E]||F,_[`${A}end`]=x)}for(const A in _)this._fireEvent(A,_[A]);const T=Js(this._eventsInProgress),P=(l||h)&&!T;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const A=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&A.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(A)}if(s&&P){this._updatingCamera=!0;const A=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),E=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!A||!A.essential&&Ee.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:x})),E(this._map.getBearing())&&this._map.resetNorth()):(E(A.bearing||this._map.getBearing())&&(A.bearing=0),A.freezeElevation=!0,this._map.easeTo(A,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new o.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Wd("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Kd extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((Ee.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(l)),l<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=s.bearingSnap,this.cameraHelper=i,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,i){e.apply(this.transform),this.transform=e,this.cameraHelper=i}getCenter(){return new o.Q(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,i){return this.jumpTo({elevation:e},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,s){return e=o.P.convert(e).mult(-1),this.panTo(this.transform.center,o.e({offset:e},i),s)}panTo(e,i,s){return this.easeTo(o.e({center:e},i),s)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(e,i,s){return this.easeTo(o.e({zoom:e},i),s)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)).fire(new o.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(e,i,s){return this.easeTo(o.e({bearing:e},i),s)}resetNorth(e,i){return this.rotateTo(0,o.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(o.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,i):this}getPitch(){return this.transform.pitch}setPitch(e,i){return this.jumpTo({pitch:e},i),this}getRoll(){return this.transform.roll}setRoll(e,i){return this.jumpTo({roll:e},i),this}cameraForBounds(e,i){e=Zt.convert(e).adjustAntiMeridian();const s=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),s,i)}_cameraForBoxAndBearing(e,i,s,l){const h={top:0,bottom:0,right:0,left:0};if(typeof(l=o.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},l)).padding=="number"){const T=l.padding;l.padding={top:T,bottom:T,right:T,left:T}}const f=o.e(h,l.padding);l.padding=f;const _=this.transform,x=new Zt(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,x,s,_)}fitBounds(e,i,s){return this._fitInternal(this.cameraForBounds(e,i),i,s)}fitScreenCoordinates(e,i,s,l,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(o.P.convert(e)),this.transform.screenPointToLocation(o.P.convert(i)),s,l),l,h)}_fitInternal(e,i,s){return e?(delete(i=o.e(e,i)).padding,i.linear?this.easeTo(i,s):this.flyTo(i,s)):this}jumpTo(e,i){this.stop();const s=this._getTransformForUpdate();let l=!1,h=!1,f=!1;const _=s.zoom;this.cameraHelper.handleJumpToCenterZoom(s,e);const x=s.zoom!==_;return"elevation"in e&&s.elevation!==+e.elevation&&s.setElevation(+e.elevation),"bearing"in e&&s.bearing!==+e.bearing&&(l=!0,s.setBearing(+e.bearing)),"pitch"in e&&s.pitch!==+e.pitch&&(h=!0,s.setPitch(+e.pitch)),"roll"in e&&s.roll!==+e.roll&&(f=!0,s.setRoll(+e.roll)),e.padding==null||s.isPaddingEqual(e.padding)||s.setPadding(e.padding),this._applyUpdatedTransform(s),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)),x&&this.fire(new o.l("zoomstart",i)).fire(new o.l("zoom",i)).fire(new o.l("zoomend",i)),l&&this.fire(new o.l("rotatestart",i)).fire(new o.l("rotate",i)).fire(new o.l("rotateend",i)),h&&this.fire(new o.l("pitchstart",i)).fire(new o.l("pitch",i)).fire(new o.l("pitchend",i)),f&&this.fire(new o.l("rollstart",i)).fire(new o.l("roll",i)).fire(new o.l("rollend",i)),this.fire(new o.l("moveend",i))}calculateCameraOptionsFromTo(e,i,s,l=0){const h=o.$.fromLngLat(e,i),f=o.$.fromLngLat(s,l),_=f.x-h.x,x=f.y-h.y,T=f.z-h.z,P=Math.hypot(_,x,T);if(P===0)throw new Error("Can't calculate camera options with same From and To");const A=Math.hypot(_,x),E=o.ah(this.transform.cameraToCenterDistance/P/this.transform.tileSize),F=180*Math.atan2(_,-x)/Math.PI;let O=180*Math.acos(A/P)/Math.PI;return O=T<0?90-O:90+O,{center:f.toLngLat(),elevation:l,zoom:E,pitch:O,bearing:F}}calculateCameraOptionsFromCameraLngLatAltRotation(e,i,s,l,h){const f=this.transform.calculateCenterFromCameraLngLatAlt(e,i,s,l);return{center:f.center,elevation:f.elevation,zoom:f.zoom,bearing:s,pitch:l,roll:h}}easeTo(e,i){this._stop(!1,e.easeId),((e=o.e({offset:[0,0],duration:500,easing:o.cf},e)).animate===!1||!e.essential&&Ee.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),l=this.getBearing(),h=s.pitch,f=s.roll,_="bearing"in e?this._normalizeBearing(e.bearing,l):l,x="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,P="padding"in e?e.padding:s.padding,A=o.P.convert(e.offset);let E,F;e.around&&(E=o.Q.convert(e.around),F=s.locationToScreenPoint(E));const O={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},H=this.cameraHelper.handleEaseTo(s,{bearing:_,pitch:x,roll:T,padding:P,around:E,aroundPoint:F,offsetAsPoint:A,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||x!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(P),this._zooming=this._zooming||H.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,O),this.terrain&&this._prepareElevation(H.elevationCenter),this._ease(q=>{H.easeFunc(q),this.terrain&&!e.freezeElevation&&this._updateElevation(q),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},q=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,q)},e),this}_prepareEase(e,i,s={}){this._moving=!0,i||s.moving||this.fire(new o.l("movestart",e)),this._zooming&&!s.zooming&&this.fire(new o.l("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new o.l("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new o.l("pitchstart",e)),this._rolling&&!s.rolling&&this.fire(new o.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const s=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(s-(i-(s*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(o.B.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),s=e.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(s<l){const h=this.calculateCameraOptionsFromTo(i,l,e.center,e.elevation);return{pitch:h.pitch,zoom:h.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(l=>this._elevateCameraIfInsideTerrain(l)),this.transformCameraUpdate&&i.push(l=>this.transformCameraUpdate(l)),!i.length)return;const s=e.clone();for(const l of i){const h=s.clone(),{center:f,zoom:_,roll:x,pitch:T,bearing:P,elevation:A}=l(h);f&&h.setCenter(f),A!==void 0&&h.setElevation(A),_!==void 0&&h.setZoom(_),x!==void 0&&h.setRoll(x),T!==void 0&&h.setPitch(T),P!==void 0&&h.setBearing(P),s.apply(h)}this.transform.apply(s)}_fireMoveEvents(e){this.fire(new o.l("move",e)),this._zooming&&this.fire(new o.l("zoom",e)),this._rotating&&this.fire(new o.l("rotate",e)),this._pitching&&this.fire(new o.l("pitch",e)),this._rolling&&this.fire(new o.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const s=this._zooming,l=this._rotating,h=this._pitching,f=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,s&&this.fire(new o.l("zoomend",e)),l&&this.fire(new o.l("rotateend",e)),h&&this.fire(new o.l("pitchend",e)),f&&this.fire(new o.l("rollend",e)),this.fire(new o.l("moveend",e))}flyTo(e,i){if(!e.essential&&Ee.prefersReducedMotion){const be=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(be,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cf},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,_=s.padding,x="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,P="roll"in e?this._normalizeBearing(e.roll,f):f,A="padding"in e?e.padding:s.padding,E=o.P.convert(e.offset);let F=s.centerPoint.add(E);const O=s.screenPointToLocation(F),H=this.cameraHelper.handleFlyTo(s,{bearing:x,pitch:T,roll:P,padding:A,locationAtOffset:O,offsetAsPoint:E,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let q=e.curve;const W=Math.max(s.width,s.height),K=W/H.scaleOfZoom,te=H.pixelPathLength;typeof H.scaleOfMinZoom=="number"&&(q=Math.sqrt(W/H.scaleOfMinZoom/te*2));const ee=q*q;function ie(be){const Ne=(K*K-W*W+(be?-1:1)*ee*ee*te*te)/(2*(be?K:W)*ee*te);return Math.log(Math.sqrt(Ne*Ne+1)-Ne)}function se(be){return(Math.exp(be)-Math.exp(-be))/2}function re(be){return(Math.exp(be)+Math.exp(-be))/2}const pe=ie(!1);let Me=function(be){return re(pe)/re(pe+q*be)},xe=function(be){return W*((re(pe)*(se(Ne=pe+q*be)/re(Ne))-se(pe))/ee)/te;var Ne},ve=(ie(!0)-pe)/q;if(Math.abs(te)<2e-6||!isFinite(ve)){if(Math.abs(W-K)<1e-6)return this.easeTo(e,i);const be=K<W?-1:1;ve=Math.abs(Math.log(K/W))/q,xe=()=>0,Me=Ne=>Math.exp(be*q*Ne)}return e.duration="duration"in e?+e.duration:1e3*ve/("screenSpeed"in e?+e.screenSpeed/q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==x,this._pitching=T!==h,this._rolling=P!==f,this._padding=!s.isPaddingEqual(A),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(H.targetCenter),this._ease(be=>{const Ne=be*ve,Oe=1/Me(Ne),Re=xe(Ne);this._rotating&&s.setBearing(o.B.number(l,x,be)),this._pitching&&s.setPitch(o.B.number(h,T,be)),this._rolling&&s.setRoll(o.B.number(f,P,be)),this._padding&&(s.interpolatePadding(_,A,be),F=s.centerPoint.add(E)),H.easeFunc(be,Oe,Re,F),this.terrain&&!e.freezeElevation&&this._updateElevation(be),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,i){var s;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const l=this._onEaseEnd;delete this._onEaseEnd,l.call(this,i)}return e||(s=this.handlers)===null||s===void 0||s.stop(!1),this}_ease(e,i,s){s.animate===!1||s.duration===0?(e(1),i()):(this._easeStart=Ee.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=o.aL(e,-180,180);const s=Math.abs(e-i);return Math.abs(e-360-i)<s&&(e-=360),Math.abs(e+360-i)<s&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(o.Q.convert(e),this.transform.tileZoom):null}}const zn={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Xt{constructor(e=zn){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=i=>{!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"&&i.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=le.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=le.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=le.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){le.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,i){const s=this._map._getUIString(`AttributionControl.${i}`);e.title=s,e.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(l=>typeof l!="string"?"":l)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const l=this._map.style.stylesheet;this.styleOwner=l.owner,this.styleId=l.id}const i=this._map.style.sourceCaches;for(const l in i){const h=i[l];if(h.used||h.usedForTerrain){const f=h.getSource();f.attribution&&e.indexOf(f.attribution)<0&&e.push(f.attribution)}}e=e.filter(l=>String(l).trim()),e.sort((l,h)=>l.length-h.length),e=e.filter((l,h)=>{for(let f=h+1;f<e.length;f++)if(e[f].indexOf(l)>=0)return!1;return!0});const s=e.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,e.length?(this._innerContainer.innerHTML=le.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Qs{constructor(e={}){this._updateCompact=()=>{const i=this._container.children;if(i.length){const s=i[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=le.create("div","maplibregl-ctrl");const i=le.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){le.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class kc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){const i=this._currentlyRunning,s=i?this._queue.concat(i):this._queue;for(const l of s)if(l.id===e)return void(l.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const i=this._currentlyRunning=this._queue;this._queue=[];for(const s of i)if(!s.cancelled&&(s.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ch=o.aG([{name:"a_pos3d",type:"Int16",components:3}]);class Ih extends o.E{constructor(e){super(),this._lastTilesetChange=Ee.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const s={};for(const l of oe(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))s[l.key]=!0,this._renderableTilesKeys.push(l.key),this._tiles[l.key]||(l.terrainRttPosMatrix32f=new Float64Array(16),o.bQ(l.terrainRttPosMatrix32f,0,o.Z,o.Z,0,0,1),this._tiles[l.key]=new In(l,this.tileSize),this._lastTilesetChange=Ee.now());for(const l in this._tiles)s[l]||delete this._tiles[l]}freeRtt(e){for(const i in this._tiles){const s=this._tiles[i];(!e||s.tileID.equals(e)||s.tileID.isChildOf(e)||e.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,i){return i?this._getTerrainCoordsForTileRanges(e,i):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const s of this._renderableTilesKeys){const l=this._tiles[s].tileID,h=e.clone(),f=o.b2();if(l.canonical.equals(e.canonical))o.bQ(f,0,o.Z,o.Z,0,0,1);else if(l.canonical.isChildOf(e.canonical)){const _=l.canonical.z-e.canonical.z,x=l.canonical.x-(l.canonical.x>>_<<_),T=l.canonical.y-(l.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,P,P,0,0,1),o.L(f,f,[-x*P,-T*P,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const _=e.canonical.z-l.canonical.z,x=e.canonical.x-(e.canonical.x>>_<<_),T=e.canonical.y-(e.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,o.Z,o.Z,0,0,1),o.L(f,f,[x*P,T*P,0]),o.M(f,f,[1/2**_,1/2**_,0])}}h.terrainRttPosMatrix32f=new Float32Array(f),i[s]=h}return i}_getTerrainCoordsForTileRanges(e,i){const s={};for(const l of this._renderableTilesKeys){const h=this._tiles[l].tileID;if(!this._isWithinTileRanges(h,i))continue;const f=e.clone(),_=o.b2();if(h.canonical.z===e.canonical.z){const x=e.canonical.x-h.canonical.x,T=e.canonical.y-h.canonical.y;o.bQ(_,0,o.Z,o.Z,0,0,1),o.L(_,_,[x*o.Z,T*o.Z,0])}else if(h.canonical.z>e.canonical.z){const x=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>x<<x),P=h.canonical.y-(h.canonical.y>>x<<x),A=e.canonical.x-(h.canonical.x>>x),E=e.canonical.y-(h.canonical.y>>x),F=o.Z>>x;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[-T*F+A*o.Z,-P*F+E*o.Z,0])}else{const x=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>x<<x),P=e.canonical.y-(e.canonical.y>>x<<x),A=(e.canonical.x>>x)-h.canonical.x,E=(e.canonical.y>>x)-h.canonical.y,F=o.Z<<x;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[T*o.Z+A*F,P*o.Z+E*F,0])}f.terrainRttPosMatrix32f=new Float32Array(_),s[l]=f}return s}getSourceTile(e,i){const s=this.sourceCache._source;let l=e.overscaledZ-this.deltaZoom;if(l>s.maxzoom&&(l=s.maxzoom),l<s.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(l).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!h||!h.dem)&&i)for(;l>=s.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(e.scaledTo(l--).key);return h}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,i){return i[e.canonical.z]&&e.canonical.x>=i[e.canonical.z].minTileX&&e.canonical.x<=i[e.canonical.z].maxTileX&&e.canonical.y>=i[e.canonical.z].minTileY&&e.canonical.y<=i[e.canonical.z].maxTileY}}class Eh{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new Ih(i),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,s,l=o.Z){var h;if(!(i>=0&&i<l&&s>=0&&s<l))return 0;const f=this.getTerrainData(e),_=(h=f.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const x=o.cj([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[x[0]*_.dim,x[1]*_.dim],P=Math.floor(T[0]),A=Math.floor(T[1]),E=T[0]-P,F=T[1]-A;return _.get(P,A)*(1-E)*(1-F)+_.get(P+1,A)*E*(1-F)+_.get(P,A+1)*(1-E)*F+_.get(P+1,A+1)*E*F}getElevationForLngLatZoom(e,i){if(!o.ck(i,e.wrap()))return 0;const{tileID:s,mercatorX:l,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(s,l%o.Z,h%o.Z,o.Z)}getElevation(e,i,s,l=o.Z){return this.getDEMElevation(e,i,s,l)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const l=this.painter.context,h=new o.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new jt(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new jt(l,new o.R({width:1,height:1}),l.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=o.ad([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const l=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new jt(l,i.dem.getPixels(),l.gl.RGBA,{premultiply:!1}),i.demTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const s=i&&i+i.tileID.key+e.key;if(s&&!this._demMatrixCache[s]){const l=this.sourceCache.sourceCache._source.maxzoom;let h=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=l?h=e.canonical.z-l:o.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=e.canonical.x-(e.canonical.x>>h<<h),_=e.canonical.y-(e.canonical.y>>h<<h),x=o.cl(new Float64Array(16),[1/(o.Z<<h),1/(o.Z<<h),0]);o.L(x,x,[f*o.Z,_*o.Z,0]),this._demMatrixCache[e.key]={matrix:x,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const i=this.painter,s=i.width/devicePixelRatio,l=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===l||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new jt(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new jt(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(s,l,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,s,l))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let h=0,f=0;h<this._coordsTextureSize;h++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)i[f+0]=255&_,i[f+1]=255&h,i[f+2]=_>>8<<4|h>>8,i[f+3]=0;const s=new o.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),l=new jt(e,s,e.gl.RGBA,{premultiply:!1});return l.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),s=this.painter.context,l=s.gl,h=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),f=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(h,_-f-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null);const x=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),P=this.coordsIndex[255-i[3]],A=P&&this.sourceCache.getTileByID(P);if(!A)return null;const E=this._coordsTextureSize,F=(1<<A.tileID.canonical.z)*E;return new o.$((A.tileID.canonical.x*E+x)/F+A.tileID.wrap,(A.tileID.canonical.y*E+T)/F,this.getElevation(A.tileID,x,T,E))}depthAtPoint(e){const i=new Uint8Array(4),s=this.painter.context,l=s.gl;return s.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),l.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null),(i[0]/16777216+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(e){var i;const s=((i=this.painter.style.projection)===null||i===void 0?void 0:i.transitionState)>0,l=s&&e.canonical.y===0,h=s&&e.canonical.y===(1<<e.canonical.z)-1,f=`m_${l?"n":""}_${h?"s":""}`;if(this._meshCache[f])return this._meshCache[f];const _=this.painter.context,x=new o.cm,T=new o.aK,P=this.meshSize,A=o.Z/P,E=P*P;for(let re=0;re<=P;re++)for(let pe=0;pe<=P;pe++)x.emplaceBack(pe*A,re*A,0);for(let re=0;re<E;re+=P+1)for(let pe=0;pe<P;pe++)T.emplaceBack(pe+re,P+pe+re+1,P+pe+re+2),T.emplaceBack(pe+re,P+pe+re+2,pe+re+1);const F=x.length,O=F+(P+1),H=(P+1)*P,q=l?o.b9:0,W=l?0:1,K=h?o.ba:o.Z,te=h?0:1;for(let re=0;re<=P;re++)x.emplaceBack(re*A,q,W);for(let re=0;re<=P;re++)x.emplaceBack(re*A,K,te);for(let re=0;re<P;re++)T.emplaceBack(H+re,O+re,O+re+1),T.emplaceBack(H+re,O+re+1,H+re+1),T.emplaceBack(0+re,F+re+1,F+re),T.emplaceBack(0+re,0+re+1,F+re+1);const ee=x.length,ie=ee+2*(P+1);for(const re of[0,1])for(let pe=0;pe<=P;pe++)for(const Me of[0,1])x.emplaceBack(re*o.Z,pe*A,Me);for(let re=0;re<2*P;re+=2)T.emplaceBack(ee+re,ee+re+1,ee+re+3),T.emplaceBack(ee+re,ee+re+3,ee+re+2),T.emplaceBack(ie+re,ie+re+3,ie+re+1),T.emplaceBack(ie+re,ie+re+2,ie+re+3);const se=new Ua(_.createVertexBuffer(x,Ch.members),_.createIndexBuffer(T),o.aJ.simpleSegment(0,0,x.length,T.length));return this._meshCache[f]=se,se}getMeshFrameDelta(e){return 2*Math.PI*o.bu/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var s;const{tileID:l}=this._getOverscaledTileIDFromLngLatZoom(e,i);return(s=this.getMinMaxElevation(l).minElevation)!==null&&s!==void 0?s:0}getMinMaxElevation(e){const i=this.getTerrainData(e).tile,s={minElevation:null,maxElevation:null};return i&&i.dem&&(s.minElevation=i.dem.min*this.exaggeration,s.maxElevation=i.dem.max*this.exaggeration),s}_getOverscaledTileIDFromLngLatZoom(e,i){const s=o.$.fromLngLat(e.wrap()),l=(1<<i)*o.Z,h=s.x*l,f=s.y*l,_=Math.floor(h/o.Z),x=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,_,x),mercatorX:h,mercatorY:f}}}class Yd{constructor(e,i,s){this._context=e,this._size=i,this._tileSize=s,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const i=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),s=new jt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return s.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),i.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),i.colorAttachment.set(s.texture),{id:e,fbo:i,texture:s,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(i=>e.id!==i),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const i of this._recentlyUsed)if(!this._objects[i].inUse)return this._objects[i];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(e=>!e.inUse)===!1}}const pr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ul{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new Yd(e.context,30,i.sourceCache.tileSize*i.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,i){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(s=>!e._layers[s].isHidden(i)),this._coordsAscending={};for(const s in e.sourceCaches){this._coordsAscending[s]={};const l=e.sourceCaches[s].getVisibleCoordinates(),h=e.sourceCaches[s].getSource(),f=h instanceof Ce?h.terrainTileRanges:null;for(const _ of l){const x=this.terrain.sourceCache.getTerrainCoords(_,f);for(const T in x)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(x[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(pr[l.type]&&!this._coordsAscendingStr[h]){this._coordsAscendingStr[h]={};for(const f in this._coordsAscending[h])this._coordsAscendingStr[h][f]=this._coordsAscending[h][f].map(_=>_.key).sort().join()}}for(const s of this._renderableTiles)for(const l in this._coordsAscendingStr){const h=this._coordsAscendingStr[l][s.tileID.key];h&&h!==s.rttCoords[l]&&(s.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const s=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),l=e.type,h=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(pr[l]&&(this._prevType&&pr[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(pr[this._prevType]||pr[l]&&f){this._prevType=l;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(Xn(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[_]){const A=this.pool.getObjectForId(T.rtt[_].id);if(A.stamp===T.rtt[_].stamp){this.pool.useObject(A);continue}}const P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),T.rtt[_]={id:P.id,stamp:P.stamp},h.context.bindFramebuffer.set(P.fbo.framebuffer),h.context.clear({color:o.b7.transparent,stencil:0}),h.currentStencilSource=void 0;for(let A=0;A<x.length;A++){const E=h.style._layers[x[A]],F=E.source?this._coordsAscending[E.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),h._renderTileClippingMasks(E,F,!0),h.renderLayer(h,h.style.sourceCaches[E.source],E,F,s),E.source&&(T.rttCoords[E.source]=this._coordsAscendingStr[E.source][T.tileID.key])}}return Xn(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),pr[l]}return!1}}const Ke={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},rt=he,eo={hash:!1,interactive:!0,bearingSnap:7,attributionControl:zn,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:o.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},zc={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Rc{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,le.mousePos(this.element,h)),le.addEventListener(window,"mousemove",this.mousemove),le.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,le.mousePos(this.element,h))},this.mouseup=h=>{this._rotatePitchHanlder.dragEnd(h),this.offTemp()},this.touchstart=h=>{h.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=le.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),le.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=le.touchPos(this.element,h.targetTouches)[0],this.move(h,this._lastPos))},this.touchend=h=>{h.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const l=new as;this._rotatePitchHanlder=new ir({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),x=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.ce(new o.P(h.x,f.y),f,x),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,le.addEventListener(i,"mousedown",this.mousedown),le.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),le.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),le.disableDrag()}move(e,i){const s=this.map,{bearingDelta:l,pitchDelta:h}=this._rotatePitchHanlder.dragMove(e,i)||{};l&&s.setBearing(s.getBearing()+l),h&&s.setPitch(s.getPitch()+h)}off(){const e=this.element;le.removeEventListener(e,"mousedown",this.mousedown),le.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),le.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.removeEventListener(window,"touchend",this.touchend),le.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){le.enableDrag(),le.removeEventListener(window,"mousemove",this.mousemove),le.removeEventListener(window,"mouseup",this.mouseup),le.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.removeEventListener(window,"touchend",this.touchend)}}let Ti;function Dc(u,e,i,s=!1){if(s||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return u==null?void 0:u.wrap();const l=new o.Q(u.lng,u.lat);if(u=new o.Q(u.lng,u.lat),e){const h=new o.Q(u.lng-360,u.lat),f=new o.Q(u.lng+360,u.lat),_=i.locationToScreenPoint(u).distSqr(e);i.locationToScreenPoint(h).distSqr(e)<_?u=h:i.locationToScreenPoint(f).distSqr(e)<_&&(u=f)}for(;Math.abs(u.lng-i.center.lng)>180;){const h=i.locationToScreenPoint(u);if(h.x>=0&&h.y>=0&&h.x<=i.width&&h.y<=i.height)break;u.lng>i.center.lng?u.lng-=360:u.lng+=360}return u.lng!==l.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(u))?u:l}const qr={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%)"};function Ah(u,e,i){const s=u.classList;for(const l in qr)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class Ma extends o.E{constructor(e){if(super(),this._onKeyPress=i=>{const s=i.code,l=i.charCode||i.keyCode;s!=="Space"&&s!=="Enter"&&l!==32&&l!==13||this.togglePopup()},this._onMapClick=i=>{const s=i.originalEvent.target,l=this._element;this._popup&&(s===l||l.contains(s))&&this.togglePopup()},this._update=i=>{if(!this._map)return;const s=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!s)&&this._map.once("render",this._update),this._lngLat=Dc(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let l="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?l=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(l=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let h="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?h="rotateX(0deg)":this._pitchAlignment==="map"&&(h=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),le.setTransform(this._element,`${qr[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${l}`),Ee.frameAsync(new AbortController).then(()=>{this._updateOpacity(i&&i.type==="moveend")}).catch(()=>{})},this._onMove=i=>{if(!this._isDragging){const s=this._clickTolerance||this._map._clickTolerance;this._isDragging=i.point.dist(this._pointerdownPos)>=s}this._isDragging&&(this._pos=i.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new o.l("dragstart"))),this.fire(new o.l("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new o.l("dragend")),this._state="inactive"},this._addDragHandler=i=>{this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._offset),this._pointerdownPos=i.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=o.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=le.create("div");const i=le.createNS("http://www.w3.org/2000/svg","svg"),s=41,l=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${s}px`),i.setAttributeNS(null,"width",`${l}px`),i.setAttributeNS(null,"viewBox",`0 0 ${l} ${s}`);const h=le.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"stroke","none"),h.setAttributeNS(null,"stroke-width","1"),h.setAttributeNS(null,"fill","none"),h.setAttributeNS(null,"fill-rule","evenodd");const f=le.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=le.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const x=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const W of x){const K=le.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",W.rx),K.setAttributeNS(null,"ry",W.ry),_.appendChild(K)}const T=le.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const P=le.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),T.appendChild(P);const A=le.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"opacity","0.25"),A.setAttributeNS(null,"fill","#000000");const E=le.createNS("http://www.w3.org/2000/svg","path");E.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),A.appendChild(E);const F=le.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const O=le.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=le.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const q=le.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#FFFFFF"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962"),O.appendChild(H),O.appendChild(q),f.appendChild(_),f.appendChild(T),f.appendChild(A),f.appendChild(F),f.appendChild(O),i.appendChild(f),i.setAttributeNS(null,"height",s*this._scale+"px"),i.setAttributeNS(null,"width",l*this._scale+"px"),this._element.appendChild(i),this._offset=o.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),Ah(this._element,this._anchor,"marker"),e&&e.className)for(const i of e.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),le.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=o.Q.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const l=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[l,-1*(38.1-13.5+l)],"bottom-right":[-l,-1*(38.1-13.5+l)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,s;const l=(i=this._map)===null||i===void 0?void 0:i.terrain,h=this._map.transform.isLocationOccluded(this._lngLat);if(!l||h){const F=h?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==F&&(this._element.style.opacity=F))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const f=this._map,_=f.terrain.depthAtPoint(this._pos),x=f.terrain.getElevationForLngLatZoom(this._lngLat,f.transform.tileZoom);if(f.transform.lngLatToCameraDepth(this._lngLat,x)-_<.006)return void(this._element.style.opacity=this._opacity);const T=-this._offset.y/f.transform.pixelsPerMeter,P=Math.sin(f.getPitch()*Math.PI/180)*T,A=f.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),E=f.transform.lngLatToCameraDepth(this._lngLat,x+P)-A>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&E&&this._popup.remove(),this._element.style.opacity=E?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=o.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,i){return(this._opacity===void 0||e===void 0&&i===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}}const ui={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ii=0,ls=!1;const to={maxWidth:100,unit:"metric"};function io(u,e,i){const s=i&&i.maxWidth||100,l=u._container.clientHeight/2,h=u._container.clientWidth/2,f=u.unproject([h-s/2,l]),_=u.unproject([h+s/2,l]),x=Math.round(u.project(_).x-u.project(f).x),T=Math.min(s,x,u._container.clientWidth),P=f.distanceTo(_);if(i&&i.unit==="imperial"){const A=3.2808*P;A>5280?Sa(e,T,A/5280,u._getUIString("ScaleControl.Miles")):Sa(e,T,A,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?Sa(e,T,P/1852,u._getUIString("ScaleControl.NauticalMiles")):P>=1e3?Sa(e,T,P/1e3,u._getUIString("ScaleControl.Kilometers")):Sa(e,T,P,u._getUIString("ScaleControl.Meters"))}function Sa(u,e,i,s){const l=function(h){const f=Math.pow(10,`${Math.floor(h)}`.length-1);let _=h/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T}(_),f*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l}&nbsp;${s}`}const Lc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Bc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function cs(u){if(u){if(typeof u=="number"){const e=Math.round(Math.abs(u)/Math.SQRT2);return{center:new o.P(0,0),top:new o.P(0,u),"top-left":new o.P(e,e),"top-right":new o.P(-e,e),bottom:new o.P(0,-u),"bottom-left":new o.P(e,-e),"bottom-right":new o.P(-e,-e),left:new o.P(u,0),right:new o.P(-u,0)}}if(u instanceof o.P||Array.isArray(u)){const e=o.P.convert(u);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:o.P.convert(u.center||[0,0]),top:o.P.convert(u.top||[0,0]),"top-left":o.P.convert(u["top-left"]||[0,0]),"top-right":o.P.convert(u["top-right"]||[0,0]),bottom:o.P.convert(u.bottom||[0,0]),"bottom-left":o.P.convert(u["bottom-left"]||[0,0]),"bottom-right":o.P.convert(u["bottom-right"]||[0,0]),left:o.P.convert(u.left||[0,0]),right:o.P.convert(u.right||[0,0])}}return cs(new o.P(0,0))}const Fc=he;S.AJAXError=o.cq,S.Event=o.l,S.Evented=o.E,S.LngLat=o.Q,S.MercatorCoordinate=o.$,S.Point=o.P,S.addProtocol=o.cr,S.config=o.a,S.removeProtocol=o.cs,S.AttributionControl=Xt,S.BoxZoomHandler=Sc,S.CanvasSource=Ue,S.CooperativeGesturesHandler=ll,S.DoubleClickZoomHandler=ol,S.DragPanHandler=Sh,S.DragRotateHandler=Ph,S.EdgeInsets=As,S.FullscreenControl=class extends o.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var e;let i=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=i==null?void 0:i.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:o.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){le.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=le.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);le.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new o.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new o.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},S.GeoJSONSource=Cn,S.GeolocateControl=class extends o.E{constructor(u){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new o.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new o.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new o.Q(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,l=this._map.getBearing(),h=o.e({bearing:l},this.options.fitBoundsOptions),f=Zt.fromLngLat(i,s);this._map.fitBounds(f,h,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new o.Q(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&ls)return;this.options.trackUserLocation&&this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new o.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=le.create("button","maplibregl-ctrl-geolocate",this._container),le.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{const i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=le.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ma({element:this._dotElement}),this._circleElement=le.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ma({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new o.l("trackuserlocationend")),this.fire(new o.l("userlocationlostfocus")))})}},this.options=o.e({},ui,u)}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(Ti!==void 0&&!e)return Ti;if(window.navigator.permissions===void 0)return Ti=!!window.navigator.geolocation,Ti;try{Ti=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Ti=!!window.navigator.geolocation}return Ti})}().then(e=>this._finishSetupUI(e)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),le.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ii=0,ls=!1}_isOutOfMapMaxBounds(u){const e=this._map.getMaxBounds(),i=u.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const u=this._map.getBounds(),e=u.getSouthEast(),i=u.getNorthEast(),s=e.distanceTo(i),l=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}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.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ii--,ls=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new o.l("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new o.l("trackuserlocationstart")),this.fire(new o.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let u;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ii++,ii>1?(u={maximumAge:6e5,timeout:0},ls=!0):(u=this.options.positionOptions,ls=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,u)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},S.GlobeControl=class{constructor(){this._toggleProjection=()=>{var u;const e=(u=this._map.getProjection())===null||u===void 0?void 0:u.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var u;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((u=this._map.getProjection())===null||u===void 0?void 0:u.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=le.create("button","maplibregl-ctrl-globe",this._container),le.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){le.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},S.Hash=bc,S.ImageSource=Ce,S.KeyboardHandler=os,S.LngLatBounds=Zt,S.LogoControl=Qs,S.Map=class extends Kd{constructor(u){var e,i;o.cn.mark(o.co.create);const s=Object.assign(Object.assign(Object.assign({},eo),u),{canvasContextAttributes:Object.assign(Object.assign({},eo.canvasContextAttributes),u.canvasContextAttributes)});if(s.minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const l=new Ga,h=new ks;if(s.minZoom!==void 0&&l.setMinZoom(s.minZoom),s.maxZoom!==void 0&&l.setMaxZoom(s.maxZoom),s.minPitch!==void 0&&l.setMinPitch(s.minPitch),s.maxPitch!==void 0&&l.setMaxPitch(s.maxPitch),s.renderWorldCopies!==void 0&&l.setRenderWorldCopies(s.renderWorldCopies),super(l,h,{bearingSnap:s.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new kc,this._controls=[],this._mapId=o.a4(),this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new o.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.l("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},s.canvasContextAttributes),this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._centerClampedToGround=s.centerClampedToGround,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Ke),s.locale),this._clickTolerance=s.clickTolerance,this._overridePixelRatio=s.pixelRatio,this._maxCanvasSize=s.maxCanvasSize,this.transformCameraUpdate=s.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=s.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Ft.addThrottleControl(()=>this.isMoving()),this._requestManager=new It(s.transformRequest),typeof s.container=="string"){if(this._container=document.getElementById(s.container),!this._container)throw new Error(`Container '${s.container}' not found.`)}else{if(!(s.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=s.container}if(s.maxBounds&&this.setMaxBounds(s.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let _=!1;const x=Xs(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{_?x(T):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Xd(this,s),this._hash=s.hash&&new bc(typeof s.hash=="string"&&s.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,roll:s.roll}),s.bounds&&(this.resize(),this.fitBounds(s.bounds,o.e({},s.fitBoundsOptions,{duration:0}))));const f=typeof s.style=="string"||((i=(e=s.style)===null||e===void 0?void 0:e.projection)===null||i===void 0?void 0:i.type)!=="globe";this.resize(null,f),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new Xt(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new Qs,s.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const _=o.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new o.l(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new o.l(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new o.l("sourcedataabort",_))})}_getMapId(){return this._mapId}addControl(u,e){if(e===void 0&&(e=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new o.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=u.onAdd(this);this._controls.push(u);const s=this._controlPositions[e];return e.indexOf("bottom")!==-1?s.insertBefore(i,s.firstChild):s.appendChild(i),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new o.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(u);return e>-1&&this._controls.splice(e,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,e,i,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,e,i,s)}resize(u,e=!0){const[i,s]=this._containerDimensions(),l=this._getClampedPixelRatio(i,s);if(this._resizeCanvas(i,s,l),this.painter.resize(i,s,l),this.painter.overLimit()){const f=this.painter.context.gl;this._maxCanvasSize=[f.drawingBufferWidth,f.drawingBufferHeight];const _=this._getClampedPixelRatio(i,s);this._resizeCanvas(i,s,_),this.painter.resize(i,s,_)}this._resizeTransform(e);const h=!this._moving;return h&&(this.stop(),this.fire(new o.l("movestart",u)).fire(new o.l("move",u))),this.fire(new o.l("resize",u)),h&&this.fire(new o.l("moveend",u)),this}_resizeTransform(u=!0){var e;const[i,s]=this._containerDimensions();this.transform.resize(i,s,u),(e=this._requestedCameraState)===null||e===void 0||e.resize(i,s,u)}_getClampedPixelRatio(u,e){const{0:i,1:s}=this._maxCanvasSize,l=this.getPixelRatio(),h=u*l,f=e*l;return Math.min(h>i?i/h:1,f>s?s/f:1)*l}getPixelRatio(){var u;return(u=this._overridePixelRatio)!==null&&u!==void 0?u:devicePixelRatio}setPixelRatio(u){this._overridePixelRatio=u,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(u){return this.transform.setMaxBounds(Zt.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.setMinZoom(u),this._update(),this.getZoom()<u&&this.setZoom(u),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(u){if((u=u??22)>=this.transform.minZoom)return this.transform.setMaxZoom(u),this._update(),this.getZoom()>u&&this.setZoom(u),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.setMinPitch(u),this._update(),this.getPitch()<u&&this.setPitch(u),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(u>=this.transform.minPitch)return this.transform.setMaxPitch(u),this._update(),this.getPitch()>u&&this.setPitch(u),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.setRenderWorldCopies(u),this._update()}project(u){return this.transform.locationToScreenPoint(o.Q.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.screenPointToLocation(o.P.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,e,i){if(u==="mouseenter"||u==="mouseover"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:h=>{const f=e.filter(x=>this.getLayer(x)),_=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];_.length?s||(s=!0,i.call(this,new Ei(u,this,h.originalEvent,{features:_}))):s=!1},mouseout:()=>{s=!1}}}}if(u==="mouseleave"||u==="mouseout"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:f=>{const _=e.filter(x=>this.getLayer(x));(_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[]).length?s=!0:s&&(s=!1,i.call(this,new Ei(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new Ei(u,this,f.originalEvent)))}}}}{const s=l=>{const h=e.filter(_=>this.getLayer(_)),f=h.length!==0?this.queryRenderedFeatures(l.point,{layers:h}):[];f.length&&(l.features=f,i.call(this,l),delete l.features)};return{layers:e,listener:i,delegates:{[u]:s}}}}_saveDelegatedListener(u,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(e)}_removeDelegatedListener(u,e,i){if(!this._delegatedListeners||!this._delegatedListeners[u])return;const s=this._delegatedListeners[u];for(let l=0;l<s.length;l++){const h=s[l];if(h.listener===i&&h.layers.length===e.length&&h.layers.every(f=>e.includes(f))){for(const f in h.delegates)this.off(f,h.delegates[f]);return void s.splice(l,1)}}}on(u,e,i){if(i===void 0)return super.on(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);this._saveDelegatedListener(u,l);for(const h in l.delegates)this.on(h,l.delegates[h]);return{unsubscribe:()=>{this._removeDelegatedListener(u,s,i)}}}once(u,e,i){if(i===void 0)return super.once(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);for(const h in l.delegates){const f=l.delegates[h];l.delegates[h]=(..._)=>{this._removeDelegatedListener(u,s,i),f(..._)}}this._saveDelegatedListener(u,l);for(const h in l.delegates)this.once(h,l.delegates[h]);return this}off(u,e,i){return i===void 0?super.off(u,e):(this._removeDelegatedListener(u,typeof e=="string"?[e]:e,i),this)}queryRenderedFeatures(u,e){if(!this.style)return[];let i;const s=u instanceof o.P||Array.isArray(u),l=s?u:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(s?{}:u)||{},l instanceof o.P||typeof l[0]=="number")i=[o.P.convert(l)];else{const h=o.P.convert(l[0]),f=o.P.convert(l[1]);i=[h,new o.P(f.x,h.y),f,new o.P(h.x,f.y),h]}return this.style.queryRenderedFeatures(i,e,this.transform)}querySourceFeatures(u,e){return this.style.querySourceFeatures(u,e)}setStyle(u,e){return(e=o.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(u,e))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const e=this._locale[u];if(e==null)throw new Error(`Missing UI string '${u}'`);return e}_updateStyle(u,e){var i,s;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,e));const l=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new rc(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,e,l):this.style.loadJSON(u,e,l),this):((s=(i=this.style)===null||i===void 0?void 0:i.projection)===null||s===void 0||s.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new rc(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,e){if(typeof u=="string"){const i=this._requestManager.transformRequest(u,"Style");o.j(i,new AbortController).then(s=>{this._updateDiff(s.data,e)}).catch(s=>{s&&this.fire(new o.k(s))})}else typeof u=="object"&&this._updateDiff(u,e)}_updateDiff(u,e){try{this.style.setState(u,e)&&this._update(!0)}catch(i){o.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(u,e)}}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.")}addSource(u,e){return this._lazyInitEmptyStyle(),this.style.addSource(u,e),this._update(!0)}isSourceLoaded(u){const e=this.style&&this.style.sourceCaches[u];if(e!==void 0)return e.loaded();this.fire(new o.k(new Error(`There is no source with ID '${u}'`)))}setTerrain(u){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),u){const e=this.style.sourceCaches[u.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&e.reload();for(const i in this.style._layers){const s=this.style._layers[i];s.type==="hillshade"&&s.source===u.source&&o.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Eh(this.painter,e,u),this.painter.renderToTexture=new ul(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var s;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId!==u.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((s=i.source)===null||s===void 0?void 0:s.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new o.l("terrain",{terrain:u})),this}getTerrain(){var u,e;return(e=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const e in u){const i=u[e]._tiles;for(const s in i){const l=i[s];if(l.state!=="loaded"&&l.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}setSourceTileLodParams(u,e,i){if(i){const s=this.getSource(i);if(!s)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);s.calculateTileZoom=ae(Math.max(1,u),Math.max(1,e))}else for(const s in this.style.sourceCaches)this.style.sourceCaches[s].getSource().calculateTileZoom=ae(Math.max(1,u),Math.max(1,e));return this._update(!0),this}refreshTiles(u,e){const i=this.style.sourceCaches[u];if(!i)throw new Error(`There is no source cache with ID "${u}", cannot refresh tile`);e===void 0?i.reload():i.refreshTiles(e.map(s=>new o.a1(s.z,s.x,s.y)))}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||o.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new o.k(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`")));{const{width:P,height:A,data:E}=e,F=e;return this.style.addImage(u,{data:new o.R({width:P,height:A},new Uint8Array(E)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:P,height:A,data:E}=Ee.getImageData(e);this.style.addImage(u,{data:new o.R({width:P,height:A},E),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0})}}updateImage(u,e){const i=this.style.getImage(u);if(!i)return this.fire(new o.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=e instanceof HTMLImageElement||o.b(e)?Ee.getImageData(e):e,{width:l,height:h,data:f}=s;if(l===void 0||h===void 0)return this.fire(new o.k(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(l!==i.data.width||h!==i.data.height)return this.fire(new o.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||o.b(e));return i.data.replace(f,_),this.style.updateImage(u,i),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new o.k(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return Ft.getImage(this._requestManager.transformRequest(u,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(u,e){return this._lazyInitEmptyStyle(),this.style.addLayer(u,e),this._update(!0)}moveLayer(u,e){return this.style.moveLayer(u,e),this._update(!0)}removeLayer(u){return this.style.removeLayer(u),this._update(!0)}getLayer(u){return this.style.getLayer(u)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(u,e,i){return this.style.setLayerZoomRange(u,e,i),this._update(!0)}setFilter(u,e,i={}){return this.style.setFilter(u,e,i),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,e,i,s={}){return this.style.setPaintProperty(u,e,i,s),this._update(!0)}getPaintProperty(u,e){return this.style.getPaintProperty(u,e)}setLayoutProperty(u,e,i,s={}){return this.style.setLayoutProperty(u,e,i,s),this._update(!0)}getLayoutProperty(u,e){return this.style.getLayoutProperty(u,e)}setGlyphs(u,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,e,i,s=>{s||this._update(!0)}),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,e,i=>{i||this._update(!0)}),this}setLight(u,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(u,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(u,e){return this.style.setFeatureState(u,e),this._update()}removeFeatureState(u,e){return this.style.removeFeatureState(u,e),this._update()}getFeatureState(u){return this.style.getFeatureState(u)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let u=0,e=0;return this._container&&(u=this._container.clientWidth||400,e=this._container.clientHeight||300),[u,e]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const e=this._canvasContainer=le.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=le.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),s=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],s);const l=this._controlContainer=le.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=le.create("div",`maplibregl-ctrl-${f} `,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,e,i){this._canvas.width=Math.floor(i*u),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const u=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",s=>{e={requestedAttributes:u},s&&(e.statusMessage=s.statusMessage,e.type=s.type)},{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,u):this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u),!i){const s="Failed to initialize WebGL";throw e?(e.message=s,new Error(JSON.stringify(e))):new Error(s)}this.painter=new vc(i,this.transform),Fe.testSupport(i)}migrateProjection(u,e){super.migrateProjection(u,e),this.painter.transform=u,this.fire(new o.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){var e,i,s,l,h;const f=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let x=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const A=this.transform.zoom,E=Ee.now();this.style.zoomHistory.update(A,E);const F=new o.C(A,{now:E,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),O=F.crossFadingFactor();O===1&&O===this._crossFadingFactor||(x=!0,this._crossFadingFactor=O),this.style.update(F)}const T=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==_;(s=this.style.projection)===null||s===void 0||s.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((l=this.style.projection)===null||l===void 0?void 0:l.transitionState,(h=this.style.projection)===null||h===void 0?void 0:h.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||T)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,f,this._crossSourceCollisions,T),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,showPadding:this.showPadding}),this.fire(new o.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,o.cn.mark(o.co.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||x)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const P=this._sourcesDirty||this._styleDirty||this._placementDirty;return P||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||P||(this._fullyLoaded=!0,o.cn.mark(o.co.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var u;this._hash&&this._hash.remove();for(const i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Ft.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),le.remove(this._canvasContainer),le.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cn.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ee.frame(this._frameRequest,u=>{o.cn.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cp(e)&&!function(i){return i.message===qo}(e))throw e}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get version(){return rt}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},S.MapMouseEvent=Ei,S.MapTouchEvent=ts,S.MapWheelEvent=Mc,S.Marker=Ma,S.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const e=this._map.getZoom(),i=e===this._map.getMaxZoom(),s=e===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,i)=>{const s=this._map._getUIString(`NavigationControl.${i}`);e.title=s,e.setAttribute("aria-label",s)},this.options=o.e({},zc,u),this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),le.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),le.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=le.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(u){return this._map=u,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Rc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){le.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,e){const i=le.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},S.Popup=class extends o.E{constructor(u){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:void 0)},this.remove=()=>(this._content&&le.remove(this._content),this._container&&(le.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new o.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=le.create("div","maplibregl-popup",this._map.getContainer()),this._tip=le.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const f of this.options.className.split(" "))this._container.classList.add(f);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=Dc(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const i=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let s=this.options.anchor;const l=cs(this.options.offset);if(!s){const f=this._container.offsetWidth,_=this._container.offsetHeight;let x;x=i.y+l.bottom.y<_?["top"]:i.y>this._map.transform.height-_?["bottom"]:[],i.x<f/2?x.push("left"):i.x>this._map.transform.width-f/2&&x.push("right"),s=x.length===0?"bottom":x.join("-")}let h=i.add(l[s]);this.options.subpixelPositioning||(h=h.round()),le.setTransform(this._container,`${qr[s]} translate(${h.x}px,${h.y}px)`),Ah(this._container,s,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(Lc),u)}addTo(u){return this._map&&this.remove(),this._map=u,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new o.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=o.Q.convert(u),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const e=document.createDocumentFragment(),i=document.createElement("body");let s;for(i.innerHTML=u;s=i.firstChild,s;)e.appendChild(s);return this.setDOMContent(e)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=le.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(u),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(u){return this._container&&this._container.classList.add(u),this}removeClassName(u){return this._container&&this._container.classList.remove(u),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){if(this._container)return this._container.classList.toggle(u)}setSubpixelPositioning(u){this.options.subpixelPositioning=u}_createCloseButton(){this.options.closeButton&&(this._closeButton=le.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(Bc);u&&u.focus()}},S.RasterDEMTileSource=Pn,S.RasterTileSource=br,S.ScaleControl=class{constructor(u){this._onMove=()=>{io(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,io(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},to),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){le.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=vt,S.Style=rc,S.TerrainControl=class{constructor(u){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=u}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=le.create("button","maplibregl-ctrl-terrain",this._container),le.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){le.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=sl,S.TwoFingersTouchRotateHandler=$e,S.TwoFingersTouchZoomHandler=ss,S.TwoFingersTouchZoomRotateHandler=Ac,S.VectorTileSource=hn,S.VideoSource=Ye,S.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(Nt(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{_t[i]=s})(u,e)}),S.clearPrewarmedResources=function(){const u=xr;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(cn),xr=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},S.createTileMesh=zs,S.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return Rr().getRTLTextPluginStatus()},S.getVersion=function(){return Fc},S.getWorkerCount=function(){return kr.workerCount},S.getWorkerUrl=function(){return o.a.WORKER_URL},S.importScriptInWorkers=function(u){return Sn().broadcast("IS",u)},S.prewarm=function(){vr().acquire(cn)},S.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,e){return Rr().setRTLTextPlugin(u,e)},S.setWorkerCount=function(u){kr.workerCount=u},S.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var B=b;return B})}(Iu)),Iu.exports}var sy=ay();const _d=ry(sy);class Ff{constructor(g,b,I,z,B){qt(this,"bounds1");qt(this,"bounds2");qt(this,"getBounds",(g,b,I,z)=>new _d.LngLatBounds([g,b],[I,z]));qt(this,"contains",(g,b)=>this.bounds1.contains([b,g])||this.bounds2.contains([b,g]));const S=g.unproject([b,I]),o=g.unproject([z,B]);if(S.lng<-180){this.bounds1=this.getBounds(-180,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(S.wrap().lng,S.lat,180,o.lat);return}if(o.lng>180){this.bounds1=this.getBounds(S.lng,S.lat,180,o.lat),this.bounds2=this.getBounds(-180,S.lat,o.wrap().lng,o.lat);return}this.bounds1=this.getBounds(S.lng,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(0,0,0,0)}}const oy={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(120, 120, 120, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(128, 128, 128, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(56, 56, 56, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(153, 153, 153, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(104, 104, 104, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(56, 56, 56, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(136, 136, 136, 1)","fill-outline-color":"rgba(102, 102, 102, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(50, 50, 50, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(52, 52, 52, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(88, 88, 88, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20],"line-color":"rgba(102, 102, 102, 1)"}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23],"line-color":"rgba(85, 85, 85, 1)"}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":2,"line-color":"rgba(85, 85, 85, 1)"}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(102, 102, 102, 1)",6,"rgba(85, 85, 85, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(102, 102, 102, 1)",6,"rgba(85, 85, 85, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(51, 51, 51, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(51, 51, 51, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(255, 255, 255, 1)","text-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]},ly={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(220, 220, 220, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(228, 228, 228, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(156, 156, 156, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(253, 253, 253, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(204, 204, 204, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(156, 156, 156, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(236, 236, 236, 1)","fill-outline-color":"rgba(202, 202, 202, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(185, 185, 185)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(150, 150, 150, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(152, 152, 152, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(188, 188, 188)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(185, 185, 185)","line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23]}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":2}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(151, 151, 151, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(151, 151, 151, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1.5}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(0, 0, 0, 1)","text-color":"rgba(0, 0, 0, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]};var Dt;(function(v){v.assertEqual=z=>z;function g(z){}v.assertIs=g;function b(z){throw new Error}v.assertNever=b,v.arrayToEnum=z=>{const B={};for(const S of z)B[S]=S;return B},v.getValidEnumValues=z=>{const B=v.objectKeys(z).filter(o=>typeof z[z[o]]!="number"),S={};for(const o of B)S[o]=z[o];return v.objectValues(S)},v.objectValues=z=>v.objectKeys(z).map(function(B){return z[B]}),v.objectKeys=typeof Object.keys=="function"?z=>Object.keys(z):z=>{const B=[];for(const S in z)Object.prototype.hasOwnProperty.call(z,S)&&B.push(S);return B},v.find=(z,B)=>{for(const S of z)if(B(S))return S},v.isInteger=typeof Number.isInteger=="function"?z=>Number.isInteger(z):z=>typeof z=="number"&&isFinite(z)&&Math.floor(z)===z;function I(z,B=" | "){return z.map(S=>typeof S=="string"?`'${S}'`:S).join(B)}v.joinValues=I,v.jsonStringifyReplacer=(z,B)=>typeof B=="bigint"?B.toString():B})(Dt||(Dt={}));var yd;(function(v){v.mergeShapes=(g,b)=>({...g,...b})})(yd||(yd={}));const Xe=Dt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),na=v=>{switch(typeof v){case"undefined":return Xe.undefined;case"string":return Xe.string;case"number":return isNaN(v)?Xe.nan:Xe.number;case"boolean":return Xe.boolean;case"function":return Xe.function;case"bigint":return Xe.bigint;case"symbol":return Xe.symbol;case"object":return Array.isArray(v)?Xe.array:v===null?Xe.null:v.then&&typeof v.then=="function"&&v.catch&&typeof v.catch=="function"?Xe.promise:typeof Map<"u"&&v instanceof Map?Xe.map:typeof Set<"u"&&v instanceof Set?Xe.set:typeof Date<"u"&&v instanceof Date?Xe.date:Xe.object;default:return Xe.unknown}},je=Dt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),cy=v=>JSON.stringify(v,null,2).replace(/"([^"]+)":/g,"$1:");class Jr extends Error{get errors(){return this.issues}constructor(g){super(),this.issues=[],this.addIssue=I=>{this.issues=[...this.issues,I]},this.addIssues=(I=[])=>{this.issues=[...this.issues,...I]};const b=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,b):this.__proto__=b,this.name="ZodError",this.issues=g}format(g){const b=g||function(B){return B.message},I={_errors:[]},z=B=>{for(const S of B.issues)if(S.code==="invalid_union")S.unionErrors.map(z);else if(S.code==="invalid_return_type")z(S.returnTypeError);else if(S.code==="invalid_arguments")z(S.argumentsError);else if(S.path.length===0)I._errors.push(b(S));else{let o=I,he=0;for(;he<S.path.length;){const me=S.path[he];he===S.path.length-1?(o[me]=o[me]||{_errors:[]},o[me]._errors.push(b(S))):o[me]=o[me]||{_errors:[]},o=o[me],he++}}};return z(this),I}static assert(g){if(!(g instanceof Jr))throw new Error(`Not a ZodError: ${g}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Dt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(g=b=>b.message){const b={},I=[];for(const z of this.issues)z.path.length>0?(b[z.path[0]]=b[z.path[0]]||[],b[z.path[0]].push(g(z))):I.push(g(z));return{formErrors:I,fieldErrors:b}}get formErrors(){return this.flatten()}}Jr.create=v=>new Jr(v);const xo=(v,g)=>{let b;switch(v.code){case je.invalid_type:v.received===Xe.undefined?b="Required":b=`Expected ${v.expected}, received ${v.received}`;break;case je.invalid_literal:b=`Invalid literal value, expected ${JSON.stringify(v.expected,Dt.jsonStringifyReplacer)}`;break;case je.unrecognized_keys:b=`Unrecognized key(s) in object: ${Dt.joinValues(v.keys,", ")}`;break;case je.invalid_union:b="Invalid input";break;case je.invalid_union_discriminator:b=`Invalid discriminator value. Expected ${Dt.joinValues(v.options)}`;break;case je.invalid_enum_value:b=`Invalid enum value. Expected ${Dt.joinValues(v.options)}, received '${v.received}'`;break;case je.invalid_arguments:b="Invalid function arguments";break;case je.invalid_return_type:b="Invalid function return type";break;case je.invalid_date:b="Invalid date";break;case je.invalid_string:typeof v.validation=="object"?"includes"in v.validation?(b=`Invalid input: must include "${v.validation.includes}"`,typeof v.validation.position=="number"&&(b=`${b} at one or more positions greater than or equal to ${v.validation.position}`)):"startsWith"in v.validation?b=`Invalid input: must start with "${v.validation.startsWith}"`:"endsWith"in v.validation?b=`Invalid input: must end with "${v.validation.endsWith}"`:Dt.assertNever(v.validation):v.validation!=="regex"?b=`Invalid ${v.validation}`:b="Invalid";break;case je.too_small:v.type==="array"?b=`Array must contain ${v.exact?"exactly":v.inclusive?"at least":"more than"} ${v.minimum} element(s)`:v.type==="string"?b=`String must contain ${v.exact?"exactly":v.inclusive?"at least":"over"} ${v.minimum} character(s)`:v.type==="number"?b=`Number must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${v.minimum}`:v.type==="date"?b=`Date must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(v.minimum))}`:b="Invalid input";break;case je.too_big:v.type==="array"?b=`Array must contain ${v.exact?"exactly":v.inclusive?"at most":"less than"} ${v.maximum} element(s)`:v.type==="string"?b=`String must contain ${v.exact?"exactly":v.inclusive?"at most":"under"} ${v.maximum} character(s)`:v.type==="number"?b=`Number must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="bigint"?b=`BigInt must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="date"?b=`Date must be ${v.exact?"exactly":v.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(v.maximum))}`:b="Invalid input";break;case je.custom:b="Invalid input";break;case je.invalid_intersection_types:b="Intersection results could not be merged";break;case je.not_multiple_of:b=`Number must be a multiple of ${v.multipleOf}`;break;case je.not_finite:b="Number must be finite";break;default:b=g.defaultError,Dt.assertNever(v)}return{message:b}};let Of=xo;function uy(v){Of=v}function Eu(){return Of}const Au=v=>{const{data:g,path:b,errorMaps:I,issueData:z}=v,B=[...b,...z.path||[]],S={...z,path:B};if(z.message!==void 0)return{...z,path:B,message:z.message};let o="";const he=I.filter(me=>!!me).slice().reverse();for(const me of he)o=me(S,{data:g,defaultError:o}).message;return{...z,path:B,message:o}},hy=[];function qe(v,g){const b=Eu(),I=Au({issueData:g,data:v.data,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,b,b===xo?void 0:xo].filter(z=>!!z)});v.common.issues.push(I)}class gr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(g,b){const I=[];for(const z of b){if(z.status==="aborted")return ht;z.status==="dirty"&&g.dirty(),I.push(z.value)}return{status:g.value,value:I}}static async mergeObjectAsync(g,b){const I=[];for(const z of b){const B=await z.key,S=await z.value;I.push({key:B,value:S})}return gr.mergeObjectSync(g,I)}static mergeObjectSync(g,b){const I={};for(const z of b){const{key:B,value:S}=z;if(B.status==="aborted"||S.status==="aborted")return ht;B.status==="dirty"&&g.dirty(),S.status==="dirty"&&g.dirty(),B.value!=="__proto__"&&(typeof S.value<"u"||z.alwaysSet)&&(I[B.value]=S.value)}return{status:g.value,value:I}}}const ht=Object.freeze({status:"aborted"}),vo=v=>({status:"dirty",value:v}),Er=v=>({status:"valid",value:v}),xd=v=>v.status==="aborted",vd=v=>v.status==="dirty",xs=v=>v.status==="valid",Al=v=>typeof Promise<"u"&&v instanceof Promise;function ku(v,g,b,I){if(typeof g=="function"?v!==g||!0:!g.has(v))throw new TypeError("Cannot read private member from an object whose class did not declare it");return g.get(v)}function jf(v,g,b,I,z){if(typeof g=="function"?v!==g||!0:!g.has(v))throw new TypeError("Cannot write private member to an object whose class did not declare it");return g.set(v,b),b}typeof SuppressedError=="function"&&SuppressedError;var tt;(function(v){v.errToObj=g=>typeof g=="string"?{message:g}:g||{},v.toString=g=>typeof g=="string"?g:g==null?void 0:g.message})(tt||(tt={}));var kl,zl;class Un{constructor(g,b,I,z){this._cachedPath=[],this.parent=g,this.data=b,this._path=I,this._key=z}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Nf=(v,g)=>{if(xs(g))return{success:!0,data:g.value};if(!v.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const b=new Jr(v.common.issues);return this._error=b,this._error}}};function yt(v){if(!v)return{};const{errorMap:g,invalid_type_error:b,required_error:I,description:z}=v;if(g&&(b||I))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return g?{errorMap:g,description:z}:{errorMap:(S,o)=>{var he,me;const{message:Pe}=v;return S.code==="invalid_enum_value"?{message:Pe??o.defaultError}:typeof o.data>"u"?{message:(he=Pe??I)!==null&&he!==void 0?he:o.defaultError}:S.code!=="invalid_type"?{message:o.defaultError}:{message:(me=Pe??b)!==null&&me!==void 0?me:o.defaultError}},description:z}}class wt{get description(){return this._def.description}_getType(g){return na(g.data)}_getOrReturnCtx(g,b){return b||{common:g.parent.common,data:g.data,parsedType:na(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}_processInputParams(g){return{status:new gr,ctx:{common:g.parent.common,data:g.data,parsedType:na(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}}_parseSync(g){const b=this._parse(g);if(Al(b))throw new Error("Synchronous parse encountered promise.");return b}_parseAsync(g){const b=this._parse(g);return Promise.resolve(b)}parse(g,b){const I=this.safeParse(g,b);if(I.success)return I.data;throw I.error}safeParse(g,b){var I;const z={common:{issues:[],async:(I=b==null?void 0:b.async)!==null&&I!==void 0?I:!1,contextualErrorMap:b==null?void 0:b.errorMap},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:na(g)},B=this._parseSync({data:g,path:z.path,parent:z});return Nf(z,B)}"~validate"(g){var b,I;const z={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:na(g)};if(!this["~standard"].async)try{const B=this._parseSync({data:g,path:[],parent:z});return xs(B)?{value:B.value}:{issues:z.common.issues}}catch(B){!((I=(b=B==null?void 0:B.message)===null||b===void 0?void 0:b.toLowerCase())===null||I===void 0)&&I.includes("encountered")&&(this["~standard"].async=!0),z.common={issues:[],async:!0}}return this._parseAsync({data:g,path:[],parent:z}).then(B=>xs(B)?{value:B.value}:{issues:z.common.issues})}async parseAsync(g,b){const I=await this.safeParseAsync(g,b);if(I.success)return I.data;throw I.error}async safeParseAsync(g,b){const I={common:{issues:[],contextualErrorMap:b==null?void 0:b.errorMap,async:!0},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:na(g)},z=this._parse({data:g,path:I.path,parent:I}),B=await(Al(z)?z:Promise.resolve(z));return Nf(I,B)}refine(g,b){const I=z=>typeof b=="string"||typeof b>"u"?{message:b}:typeof b=="function"?b(z):b;return this._refinement((z,B)=>{const S=g(z),o=()=>B.addIssue({code:je.custom,...I(z)});return typeof Promise<"u"&&S instanceof Promise?S.then(he=>he?!0:(o(),!1)):S?!0:(o(),!1)})}refinement(g,b){return this._refinement((I,z)=>g(I)?!0:(z.addIssue(typeof b=="function"?b(I,z):b),!1))}_refinement(g){return new wn({schema:this,typeName:ut.ZodEffects,effect:{type:"refinement",refinement:g}})}superRefine(g){return this._refinement(g)}constructor(g){this.spa=this.safeParseAsync,this._def=g,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:b=>this["~validate"](b)}}optional(){return Gn.create(this,this._def)}nullable(){return Fa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return bn.create(this)}promise(){return Mo.create(this,this._def)}or(g){return Bl.create([this,g],this._def)}and(g){return Fl.create(this,g,this._def)}transform(g){return new wn({...yt(this._def),schema:this,typeName:ut.ZodEffects,effect:{type:"transform",transform:g}})}default(g){const b=typeof g=="function"?g:()=>g;return new Vl({...yt(this._def),innerType:this,defaultValue:b,typeName:ut.ZodDefault})}brand(){return new Td({typeName:ut.ZodBranded,type:this,...yt(this._def)})}catch(g){const b=typeof g=="function"?g:()=>g;return new Ul({...yt(this._def),innerType:this,catchValue:b,typeName:ut.ZodCatch})}describe(g){const b=this.constructor;return new b({...this._def,description:g})}pipe(g){return $l.create(this,g)}readonly(){return Gl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const dy=/^c[^\s-]{8,}$/i,py=/^[0-9a-z]+$/,fy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,my=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,gy=/^[a-z0-9_-]{21}$/i,_y=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yy=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,xy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,vy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let bd;const by=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,wy=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ty=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,My=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Py=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zf="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Cy=new RegExp(`^${Zf}$`);function Vf(v){let g="[0-5]\\d";v.precision?g=`${g}\\.\\d{${v.precision}}`:v.precision==null&&(g=`${g}(\\.\\d+)?`);const b=v.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${g})${b}`}function Iy(v){return new RegExp(`^${Vf(v)}$`)}function Uf(v){let g=`${Zf}T${Vf(v)}`;const b=[];return b.push(v.local?"Z?":"Z"),v.offset&&b.push("([+-]\\d{2}:?\\d{2})"),g=`${g}(${b.join("|")})`,new RegExp(`^${g}$`)}function Ey(v,g){return!!((g==="v4"||!g)&&by.test(v)||(g==="v6"||!g)&&Ty.test(v))}function Ay(v,g){if(!_y.test(v))return!1;try{const[b]=v.split("."),I=b.replace(/-/g,"+").replace(/_/g,"/").padEnd(b.length+(4-b.length%4)%4,"="),z=JSON.parse(atob(I));return!(typeof z!="object"||z===null||!z.typ||!z.alg||g&&z.alg!==g)}catch{return!1}}function ky(v,g){return!!((g==="v4"||!g)&&wy.test(v)||(g==="v6"||!g)&&My.test(v))}class vn extends wt{_parse(g){if(this._def.coerce&&(g.data=String(g.data)),this._getType(g)!==Xe.string){const B=this._getOrReturnCtx(g);return qe(B,{code:je.invalid_type,expected:Xe.string,received:B.parsedType}),ht}const I=new gr;let z;for(const B of this._def.checks)if(B.kind==="min")g.data.length<B.value&&(z=this._getOrReturnCtx(g,z),qe(z,{code:je.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),I.dirty());else if(B.kind==="max")g.data.length>B.value&&(z=this._getOrReturnCtx(g,z),qe(z,{code:je.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),I.dirty());else if(B.kind==="length"){const S=g.data.length>B.value,o=g.data.length<B.value;(S||o)&&(z=this._getOrReturnCtx(g,z),S?qe(z,{code:je.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message}):o&&qe(z,{code:je.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message}),I.dirty())}else if(B.kind==="email")xy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"email",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="emoji")bd||(bd=new RegExp(vy,"u")),bd.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"emoji",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="uuid")my.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"uuid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="nanoid")gy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"nanoid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="cuid")dy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"cuid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="cuid2")py.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"cuid2",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="ulid")fy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"ulid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="url")try{new URL(g.data)}catch{z=this._getOrReturnCtx(g,z),qe(z,{validation:"url",code:je.invalid_string,message:B.message}),I.dirty()}else B.kind==="regex"?(B.regex.lastIndex=0,B.regex.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"regex",code:je.invalid_string,message:B.message}),I.dirty())):B.kind==="trim"?g.data=g.data.trim():B.kind==="includes"?g.data.includes(B.value,B.position)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:{includes:B.value,position:B.position},message:B.message}),I.dirty()):B.kind==="toLowerCase"?g.data=g.data.toLowerCase():B.kind==="toUpperCase"?g.data=g.data.toUpperCase():B.kind==="startsWith"?g.data.startsWith(B.value)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:{startsWith:B.value},message:B.message}),I.dirty()):B.kind==="endsWith"?g.data.endsWith(B.value)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:{endsWith:B.value},message:B.message}),I.dirty()):B.kind==="datetime"?Uf(B).test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:"datetime",message:B.message}),I.dirty()):B.kind==="date"?Cy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:"date",message:B.message}),I.dirty()):B.kind==="time"?Iy(B).test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{code:je.invalid_string,validation:"time",message:B.message}),I.dirty()):B.kind==="duration"?yy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"duration",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="ip"?Ey(g.data,B.version)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"ip",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="jwt"?Ay(g.data,B.alg)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"jwt",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="cidr"?ky(g.data,B.version)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"cidr",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="base64"?Sy.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"base64",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="base64url"?Py.test(g.data)||(z=this._getOrReturnCtx(g,z),qe(z,{validation:"base64url",code:je.invalid_string,message:B.message}),I.dirty()):Dt.assertNever(B);return{status:I.value,value:g.data}}_regex(g,b,I){return this.refinement(z=>g.test(z),{validation:b,code:je.invalid_string,...tt.errToObj(I)})}_addCheck(g){return new vn({...this._def,checks:[...this._def.checks,g]})}email(g){return this._addCheck({kind:"email",...tt.errToObj(g)})}url(g){return this._addCheck({kind:"url",...tt.errToObj(g)})}emoji(g){return this._addCheck({kind:"emoji",...tt.errToObj(g)})}uuid(g){return this._addCheck({kind:"uuid",...tt.errToObj(g)})}nanoid(g){return this._addCheck({kind:"nanoid",...tt.errToObj(g)})}cuid(g){return this._addCheck({kind:"cuid",...tt.errToObj(g)})}cuid2(g){return this._addCheck({kind:"cuid2",...tt.errToObj(g)})}ulid(g){return this._addCheck({kind:"ulid",...tt.errToObj(g)})}base64(g){return this._addCheck({kind:"base64",...tt.errToObj(g)})}base64url(g){return this._addCheck({kind:"base64url",...tt.errToObj(g)})}jwt(g){return this._addCheck({kind:"jwt",...tt.errToObj(g)})}ip(g){return this._addCheck({kind:"ip",...tt.errToObj(g)})}cidr(g){return this._addCheck({kind:"cidr",...tt.errToObj(g)})}datetime(g){var b,I;return typeof g=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:g}):this._addCheck({kind:"datetime",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,offset:(b=g==null?void 0:g.offset)!==null&&b!==void 0?b:!1,local:(I=g==null?void 0:g.local)!==null&&I!==void 0?I:!1,...tt.errToObj(g==null?void 0:g.message)})}date(g){return this._addCheck({kind:"date",message:g})}time(g){return typeof g=="string"?this._addCheck({kind:"time",precision:null,message:g}):this._addCheck({kind:"time",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,...tt.errToObj(g==null?void 0:g.message)})}duration(g){return this._addCheck({kind:"duration",...tt.errToObj(g)})}regex(g,b){return this._addCheck({kind:"regex",regex:g,...tt.errToObj(b)})}includes(g,b){return this._addCheck({kind:"includes",value:g,position:b==null?void 0:b.position,...tt.errToObj(b==null?void 0:b.message)})}startsWith(g,b){return this._addCheck({kind:"startsWith",value:g,...tt.errToObj(b)})}endsWith(g,b){return this._addCheck({kind:"endsWith",value:g,...tt.errToObj(b)})}min(g,b){return this._addCheck({kind:"min",value:g,...tt.errToObj(b)})}max(g,b){return this._addCheck({kind:"max",value:g,...tt.errToObj(b)})}length(g,b){return this._addCheck({kind:"length",value:g,...tt.errToObj(b)})}nonempty(g){return this.min(1,tt.errToObj(g))}trim(){return new vn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new vn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new vn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(g=>g.kind==="datetime")}get isDate(){return!!this._def.checks.find(g=>g.kind==="date")}get isTime(){return!!this._def.checks.find(g=>g.kind==="time")}get isDuration(){return!!this._def.checks.find(g=>g.kind==="duration")}get isEmail(){return!!this._def.checks.find(g=>g.kind==="email")}get isURL(){return!!this._def.checks.find(g=>g.kind==="url")}get isEmoji(){return!!this._def.checks.find(g=>g.kind==="emoji")}get isUUID(){return!!this._def.checks.find(g=>g.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(g=>g.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(g=>g.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(g=>g.kind==="cuid2")}get isULID(){return!!this._def.checks.find(g=>g.kind==="ulid")}get isIP(){return!!this._def.checks.find(g=>g.kind==="ip")}get isCIDR(){return!!this._def.checks.find(g=>g.kind==="cidr")}get isBase64(){return!!this._def.checks.find(g=>g.kind==="base64")}get isBase64url(){return!!this._def.checks.find(g=>g.kind==="base64url")}get minLength(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxLength(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}}vn.create=v=>{var g;return new vn({checks:[],typeName:ut.ZodString,coerce:(g=v==null?void 0:v.coerce)!==null&&g!==void 0?g:!1,...yt(v)})};function zy(v,g){const b=(v.toString().split(".")[1]||"").length,I=(g.toString().split(".")[1]||"").length,z=b>I?b:I,B=parseInt(v.toFixed(z).replace(".","")),S=parseInt(g.toFixed(z).replace(".",""));return B%S/Math.pow(10,z)}class Da extends wt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(g){if(this._def.coerce&&(g.data=Number(g.data)),this._getType(g)!==Xe.number){const B=this._getOrReturnCtx(g);return qe(B,{code:je.invalid_type,expected:Xe.number,received:B.parsedType}),ht}let I;const z=new gr;for(const B of this._def.checks)B.kind==="int"?Dt.isInteger(g.data)||(I=this._getOrReturnCtx(g,I),qe(I,{code:je.invalid_type,expected:"integer",received:"float",message:B.message}),z.dirty()):B.kind==="min"?(B.inclusive?g.data<B.value:g.data<=B.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.too_small,minimum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),z.dirty()):B.kind==="max"?(B.inclusive?g.data>B.value:g.data>=B.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.too_big,maximum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),z.dirty()):B.kind==="multipleOf"?zy(g.data,B.value)!==0&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.not_multiple_of,multipleOf:B.value,message:B.message}),z.dirty()):B.kind==="finite"?Number.isFinite(g.data)||(I=this._getOrReturnCtx(g,I),qe(I,{code:je.not_finite,message:B.message}),z.dirty()):Dt.assertNever(B);return{status:z.value,value:g.data}}gte(g,b){return this.setLimit("min",g,!0,tt.toString(b))}gt(g,b){return this.setLimit("min",g,!1,tt.toString(b))}lte(g,b){return this.setLimit("max",g,!0,tt.toString(b))}lt(g,b){return this.setLimit("max",g,!1,tt.toString(b))}setLimit(g,b,I,z){return new Da({...this._def,checks:[...this._def.checks,{kind:g,value:b,inclusive:I,message:tt.toString(z)}]})}_addCheck(g){return new Da({...this._def,checks:[...this._def.checks,g]})}int(g){return this._addCheck({kind:"int",message:tt.toString(g)})}positive(g){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tt.toString(g)})}multipleOf(g,b){return this._addCheck({kind:"multipleOf",value:g,message:tt.toString(b)})}finite(g){return this._addCheck({kind:"finite",message:tt.toString(g)})}safe(g){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tt.toString(g)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tt.toString(g)})}get minValue(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxValue(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}get isInt(){return!!this._def.checks.find(g=>g.kind==="int"||g.kind==="multipleOf"&&Dt.isInteger(g.value))}get isFinite(){let g=null,b=null;for(const I of this._def.checks){if(I.kind==="finite"||I.kind==="int"||I.kind==="multipleOf")return!0;I.kind==="min"?(b===null||I.value>b)&&(b=I.value):I.kind==="max"&&(g===null||I.value<g)&&(g=I.value)}return Number.isFinite(b)&&Number.isFinite(g)}}Da.create=v=>new Da({checks:[],typeName:ut.ZodNumber,coerce:(v==null?void 0:v.coerce)||!1,...yt(v)});class La extends wt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(g){if(this._def.coerce)try{g.data=BigInt(g.data)}catch{return this._getInvalidInput(g)}if(this._getType(g)!==Xe.bigint)return this._getInvalidInput(g);let I;const z=new gr;for(const B of this._def.checks)B.kind==="min"?(B.inclusive?g.data<B.value:g.data<=B.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.too_small,type:"bigint",minimum:B.value,inclusive:B.inclusive,message:B.message}),z.dirty()):B.kind==="max"?(B.inclusive?g.data>B.value:g.data>=B.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.too_big,type:"bigint",maximum:B.value,inclusive:B.inclusive,message:B.message}),z.dirty()):B.kind==="multipleOf"?g.data%B.value!==BigInt(0)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:je.not_multiple_of,multipleOf:B.value,message:B.message}),z.dirty()):Dt.assertNever(B);return{status:z.value,value:g.data}}_getInvalidInput(g){const b=this._getOrReturnCtx(g);return qe(b,{code:je.invalid_type,expected:Xe.bigint,received:b.parsedType}),ht}gte(g,b){return this.setLimit("min",g,!0,tt.toString(b))}gt(g,b){return this.setLimit("min",g,!1,tt.toString(b))}lte(g,b){return this.setLimit("max",g,!0,tt.toString(b))}lt(g,b){return this.setLimit("max",g,!1,tt.toString(b))}setLimit(g,b,I,z){return new La({...this._def,checks:[...this._def.checks,{kind:g,value:b,inclusive:I,message:tt.toString(z)}]})}_addCheck(g){return new La({...this._def,checks:[...this._def.checks,g]})}positive(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tt.toString(g)})}multipleOf(g,b){return this._addCheck({kind:"multipleOf",value:g,message:tt.toString(b)})}get minValue(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g}get maxValue(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g}}La.create=v=>{var g;return new La({checks:[],typeName:ut.ZodBigInt,coerce:(g=v==null?void 0:v.coerce)!==null&&g!==void 0?g:!1,...yt(v)})};class Rl extends wt{_parse(g){if(this._def.coerce&&(g.data=!!g.data),this._getType(g)!==Xe.boolean){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.boolean,received:I.parsedType}),ht}return Er(g.data)}}Rl.create=v=>new Rl({typeName:ut.ZodBoolean,coerce:(v==null?void 0:v.coerce)||!1,...yt(v)});class vs extends wt{_parse(g){if(this._def.coerce&&(g.data=new Date(g.data)),this._getType(g)!==Xe.date){const B=this._getOrReturnCtx(g);return qe(B,{code:je.invalid_type,expected:Xe.date,received:B.parsedType}),ht}if(isNaN(g.data.getTime())){const B=this._getOrReturnCtx(g);return qe(B,{code:je.invalid_date}),ht}const I=new gr;let z;for(const B of this._def.checks)B.kind==="min"?g.data.getTime()<B.value&&(z=this._getOrReturnCtx(g,z),qe(z,{code:je.too_small,message:B.message,inclusive:!0,exact:!1,minimum:B.value,type:"date"}),I.dirty()):B.kind==="max"?g.data.getTime()>B.value&&(z=this._getOrReturnCtx(g,z),qe(z,{code:je.too_big,message:B.message,inclusive:!0,exact:!1,maximum:B.value,type:"date"}),I.dirty()):Dt.assertNever(B);return{status:I.value,value:new Date(g.data.getTime())}}_addCheck(g){return new vs({...this._def,checks:[...this._def.checks,g]})}min(g,b){return this._addCheck({kind:"min",value:g.getTime(),message:tt.toString(b)})}max(g,b){return this._addCheck({kind:"max",value:g.getTime(),message:tt.toString(b)})}get minDate(){let g=null;for(const b of this._def.checks)b.kind==="min"&&(g===null||b.value>g)&&(g=b.value);return g!=null?new Date(g):null}get maxDate(){let g=null;for(const b of this._def.checks)b.kind==="max"&&(g===null||b.value<g)&&(g=b.value);return g!=null?new Date(g):null}}vs.create=v=>new vs({checks:[],coerce:(v==null?void 0:v.coerce)||!1,typeName:ut.ZodDate,...yt(v)});class zu extends wt{_parse(g){if(this._getType(g)!==Xe.symbol){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.symbol,received:I.parsedType}),ht}return Er(g.data)}}zu.create=v=>new zu({typeName:ut.ZodSymbol,...yt(v)});class Dl extends wt{_parse(g){if(this._getType(g)!==Xe.undefined){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.undefined,received:I.parsedType}),ht}return Er(g.data)}}Dl.create=v=>new Dl({typeName:ut.ZodUndefined,...yt(v)});class Ll extends wt{_parse(g){if(this._getType(g)!==Xe.null){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.null,received:I.parsedType}),ht}return Er(g.data)}}Ll.create=v=>new Ll({typeName:ut.ZodNull,...yt(v)});class bo extends wt{constructor(){super(...arguments),this._any=!0}_parse(g){return Er(g.data)}}bo.create=v=>new bo({typeName:ut.ZodAny,...yt(v)});class bs extends wt{constructor(){super(...arguments),this._unknown=!0}_parse(g){return Er(g.data)}}bs.create=v=>new bs({typeName:ut.ZodUnknown,...yt(v)});class aa extends wt{_parse(g){const b=this._getOrReturnCtx(g);return qe(b,{code:je.invalid_type,expected:Xe.never,received:b.parsedType}),ht}}aa.create=v=>new aa({typeName:ut.ZodNever,...yt(v)});class Ru extends wt{_parse(g){if(this._getType(g)!==Xe.undefined){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.void,received:I.parsedType}),ht}return Er(g.data)}}Ru.create=v=>new Ru({typeName:ut.ZodVoid,...yt(v)});class bn extends wt{_parse(g){const{ctx:b,status:I}=this._processInputParams(g),z=this._def;if(b.parsedType!==Xe.array)return qe(b,{code:je.invalid_type,expected:Xe.array,received:b.parsedType}),ht;if(z.exactLength!==null){const S=b.data.length>z.exactLength.value,o=b.data.length<z.exactLength.value;(S||o)&&(qe(b,{code:S?je.too_big:je.too_small,minimum:o?z.exactLength.value:void 0,maximum:S?z.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:z.exactLength.message}),I.dirty())}if(z.minLength!==null&&b.data.length<z.minLength.value&&(qe(b,{code:je.too_small,minimum:z.minLength.value,type:"array",inclusive:!0,exact:!1,message:z.minLength.message}),I.dirty()),z.maxLength!==null&&b.data.length>z.maxLength.value&&(qe(b,{code:je.too_big,maximum:z.maxLength.value,type:"array",inclusive:!0,exact:!1,message:z.maxLength.message}),I.dirty()),b.common.async)return Promise.all([...b.data].map((S,o)=>z.type._parseAsync(new Un(b,S,b.path,o)))).then(S=>gr.mergeArray(I,S));const B=[...b.data].map((S,o)=>z.type._parseSync(new Un(b,S,b.path,o)));return gr.mergeArray(I,B)}get element(){return this._def.type}min(g,b){return new bn({...this._def,minLength:{value:g,message:tt.toString(b)}})}max(g,b){return new bn({...this._def,maxLength:{value:g,message:tt.toString(b)}})}length(g,b){return new bn({...this._def,exactLength:{value:g,message:tt.toString(b)}})}nonempty(g){return this.min(1,g)}}bn.create=(v,g)=>new bn({type:v,minLength:null,maxLength:null,exactLength:null,typeName:ut.ZodArray,...yt(g)});function wo(v){if(v instanceof _i){const g={};for(const b in v.shape){const I=v.shape[b];g[b]=Gn.create(wo(I))}return new _i({...v._def,shape:()=>g})}else return v instanceof bn?new bn({...v._def,type:wo(v.element)}):v instanceof Gn?Gn.create(wo(v.unwrap())):v instanceof Fa?Fa.create(wo(v.unwrap())):v instanceof $n?$n.create(v.items.map(g=>wo(g))):v}class _i extends wt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const g=this._def.shape(),b=Dt.objectKeys(g);return this._cached={shape:g,keys:b}}_parse(g){if(this._getType(g)!==Xe.object){const me=this._getOrReturnCtx(g);return qe(me,{code:je.invalid_type,expected:Xe.object,received:me.parsedType}),ht}const{status:I,ctx:z}=this._processInputParams(g),{shape:B,keys:S}=this._getCached(),o=[];if(!(this._def.catchall instanceof aa&&this._def.unknownKeys==="strip"))for(const me in z.data)S.includes(me)||o.push(me);const he=[];for(const me of S){const Pe=B[me],Be=z.data[me];he.push({key:{status:"valid",value:me},value:Pe._parse(new Un(z,Be,z.path,me)),alwaysSet:me in z.data})}if(this._def.catchall instanceof aa){const me=this._def.unknownKeys;if(me==="passthrough")for(const Pe of o)he.push({key:{status:"valid",value:Pe},value:{status:"valid",value:z.data[Pe]}});else if(me==="strict")o.length>0&&(qe(z,{code:je.unrecognized_keys,keys:o}),I.dirty());else if(me!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const me=this._def.catchall;for(const Pe of o){const Be=z.data[Pe];he.push({key:{status:"valid",value:Pe},value:me._parse(new Un(z,Be,z.path,Pe)),alwaysSet:Pe in z.data})}}return z.common.async?Promise.resolve().then(async()=>{const me=[];for(const Pe of he){const Be=await Pe.key,Ee=await Pe.value;me.push({key:Be,value:Ee,alwaysSet:Pe.alwaysSet})}return me}).then(me=>gr.mergeObjectSync(I,me)):gr.mergeObjectSync(I,he)}get shape(){return this._def.shape()}strict(g){return tt.errToObj,new _i({...this._def,unknownKeys:"strict",...g!==void 0?{errorMap:(b,I)=>{var z,B,S,o;const he=(S=(B=(z=this._def).errorMap)===null||B===void 0?void 0:B.call(z,b,I).message)!==null&&S!==void 0?S:I.defaultError;return b.code==="unrecognized_keys"?{message:(o=tt.errToObj(g).message)!==null&&o!==void 0?o:he}:{message:he}}}:{}})}strip(){return new _i({...this._def,unknownKeys:"strip"})}passthrough(){return new _i({...this._def,unknownKeys:"passthrough"})}extend(g){return new _i({...this._def,shape:()=>({...this._def.shape(),...g})})}merge(g){return new _i({unknownKeys:g._def.unknownKeys,catchall:g._def.catchall,shape:()=>({...this._def.shape(),...g._def.shape()}),typeName:ut.ZodObject})}setKey(g,b){return this.augment({[g]:b})}catchall(g){return new _i({...this._def,catchall:g})}pick(g){const b={};return Dt.objectKeys(g).forEach(I=>{g[I]&&this.shape[I]&&(b[I]=this.shape[I])}),new _i({...this._def,shape:()=>b})}omit(g){const b={};return Dt.objectKeys(this.shape).forEach(I=>{g[I]||(b[I]=this.shape[I])}),new _i({...this._def,shape:()=>b})}deepPartial(){return wo(this)}partial(g){const b={};return Dt.objectKeys(this.shape).forEach(I=>{const z=this.shape[I];g&&!g[I]?b[I]=z:b[I]=z.optional()}),new _i({...this._def,shape:()=>b})}required(g){const b={};return Dt.objectKeys(this.shape).forEach(I=>{if(g&&!g[I])b[I]=this.shape[I];else{let B=this.shape[I];for(;B instanceof Gn;)B=B._def.innerType;b[I]=B}}),new _i({...this._def,shape:()=>b})}keyof(){return $f(Dt.objectKeys(this.shape))}}_i.create=(v,g)=>new _i({shape:()=>v,unknownKeys:"strip",catchall:aa.create(),typeName:ut.ZodObject,...yt(g)}),_i.strictCreate=(v,g)=>new _i({shape:()=>v,unknownKeys:"strict",catchall:aa.create(),typeName:ut.ZodObject,...yt(g)}),_i.lazycreate=(v,g)=>new _i({shape:v,unknownKeys:"strip",catchall:aa.create(),typeName:ut.ZodObject,...yt(g)});class Bl extends wt{_parse(g){const{ctx:b}=this._processInputParams(g),I=this._def.options;function z(B){for(const o of B)if(o.result.status==="valid")return o.result;for(const o of B)if(o.result.status==="dirty")return b.common.issues.push(...o.ctx.common.issues),o.result;const S=B.map(o=>new Jr(o.ctx.common.issues));return qe(b,{code:je.invalid_union,unionErrors:S}),ht}if(b.common.async)return Promise.all(I.map(async B=>{const S={...b,common:{...b.common,issues:[]},parent:null};return{result:await B._parseAsync({data:b.data,path:b.path,parent:S}),ctx:S}})).then(z);{let B;const S=[];for(const he of I){const me={...b,common:{...b.common,issues:[]},parent:null},Pe=he._parseSync({data:b.data,path:b.path,parent:me});if(Pe.status==="valid")return Pe;Pe.status==="dirty"&&!B&&(B={result:Pe,ctx:me}),me.common.issues.length&&S.push(me.common.issues)}if(B)return b.common.issues.push(...B.ctx.common.issues),B.result;const o=S.map(he=>new Jr(he));return qe(b,{code:je.invalid_union,unionErrors:o}),ht}}get options(){return this._def.options}}Bl.create=(v,g)=>new Bl({options:v,typeName:ut.ZodUnion,...yt(g)});const sa=v=>v instanceof jl?sa(v.schema):v instanceof wn?sa(v.innerType()):v instanceof Nl?[v.value]:v instanceof Ba?v.options:v instanceof Zl?Dt.objectValues(v.enum):v instanceof Vl?sa(v._def.innerType):v instanceof Dl?[void 0]:v instanceof Ll?[null]:v instanceof Gn?[void 0,...sa(v.unwrap())]:v instanceof Fa?[null,...sa(v.unwrap())]:v instanceof Td||v instanceof Gl?sa(v.unwrap()):v instanceof Ul?sa(v._def.innerType):[];class Du extends wt{_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Xe.object)return qe(b,{code:je.invalid_type,expected:Xe.object,received:b.parsedType}),ht;const I=this.discriminator,z=b.data[I],B=this.optionsMap.get(z);return B?b.common.async?B._parseAsync({data:b.data,path:b.path,parent:b}):B._parseSync({data:b.data,path:b.path,parent:b}):(qe(b,{code:je.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[I]}),ht)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(g,b,I){const z=new Map;for(const B of b){const S=sa(B.shape[g]);if(!S.length)throw new Error(`A discriminator value for key \`${g}\` could not be extracted from all schema options`);for(const o of S){if(z.has(o))throw new Error(`Discriminator property ${String(g)} has duplicate value ${String(o)}`);z.set(o,B)}}return new Du({typeName:ut.ZodDiscriminatedUnion,discriminator:g,options:b,optionsMap:z,...yt(I)})}}function wd(v,g){const b=na(v),I=na(g);if(v===g)return{valid:!0,data:v};if(b===Xe.object&&I===Xe.object){const z=Dt.objectKeys(g),B=Dt.objectKeys(v).filter(o=>z.indexOf(o)!==-1),S={...v,...g};for(const o of B){const he=wd(v[o],g[o]);if(!he.valid)return{valid:!1};S[o]=he.data}return{valid:!0,data:S}}else if(b===Xe.array&&I===Xe.array){if(v.length!==g.length)return{valid:!1};const z=[];for(let B=0;B<v.length;B++){const S=v[B],o=g[B],he=wd(S,o);if(!he.valid)return{valid:!1};z.push(he.data)}return{valid:!0,data:z}}else return b===Xe.date&&I===Xe.date&&+v==+g?{valid:!0,data:v}:{valid:!1}}class Fl extends wt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g),z=(B,S)=>{if(xd(B)||xd(S))return ht;const o=wd(B.value,S.value);return o.valid?((vd(B)||vd(S))&&b.dirty(),{status:b.value,value:o.data}):(qe(I,{code:je.invalid_intersection_types}),ht)};return I.common.async?Promise.all([this._def.left._parseAsync({data:I.data,path:I.path,parent:I}),this._def.right._parseAsync({data:I.data,path:I.path,parent:I})]).then(([B,S])=>z(B,S)):z(this._def.left._parseSync({data:I.data,path:I.path,parent:I}),this._def.right._parseSync({data:I.data,path:I.path,parent:I}))}}Fl.create=(v,g,b)=>new Fl({left:v,right:g,typeName:ut.ZodIntersection,...yt(b)});class $n extends wt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.array)return qe(I,{code:je.invalid_type,expected:Xe.array,received:I.parsedType}),ht;if(I.data.length<this._def.items.length)return qe(I,{code:je.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ht;!this._def.rest&&I.data.length>this._def.items.length&&(qe(I,{code:je.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b.dirty());const B=[...I.data].map((S,o)=>{const he=this._def.items[o]||this._def.rest;return he?he._parse(new Un(I,S,I.path,o)):null}).filter(S=>!!S);return I.common.async?Promise.all(B).then(S=>gr.mergeArray(b,S)):gr.mergeArray(b,B)}get items(){return this._def.items}rest(g){return new $n({...this._def,rest:g})}}$n.create=(v,g)=>{if(!Array.isArray(v))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $n({items:v,typeName:ut.ZodTuple,rest:null,...yt(g)})};class Ol extends wt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.object)return qe(I,{code:je.invalid_type,expected:Xe.object,received:I.parsedType}),ht;const z=[],B=this._def.keyType,S=this._def.valueType;for(const o in I.data)z.push({key:B._parse(new Un(I,o,I.path,o)),value:S._parse(new Un(I,I.data[o],I.path,o)),alwaysSet:o in I.data});return I.common.async?gr.mergeObjectAsync(b,z):gr.mergeObjectSync(b,z)}get element(){return this._def.valueType}static create(g,b,I){return b instanceof wt?new Ol({keyType:g,valueType:b,typeName:ut.ZodRecord,...yt(I)}):new Ol({keyType:vn.create(),valueType:g,typeName:ut.ZodRecord,...yt(b)})}}class Lu extends wt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.map)return qe(I,{code:je.invalid_type,expected:Xe.map,received:I.parsedType}),ht;const z=this._def.keyType,B=this._def.valueType,S=[...I.data.entries()].map(([o,he],me)=>({key:z._parse(new Un(I,o,I.path,[me,"key"])),value:B._parse(new Un(I,he,I.path,[me,"value"]))}));if(I.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const he of S){const me=await he.key,Pe=await he.value;if(me.status==="aborted"||Pe.status==="aborted")return ht;(me.status==="dirty"||Pe.status==="dirty")&&b.dirty(),o.set(me.value,Pe.value)}return{status:b.value,value:o}})}else{const o=new Map;for(const he of S){const me=he.key,Pe=he.value;if(me.status==="aborted"||Pe.status==="aborted")return ht;(me.status==="dirty"||Pe.status==="dirty")&&b.dirty(),o.set(me.value,Pe.value)}return{status:b.value,value:o}}}}Lu.create=(v,g,b)=>new Lu({valueType:g,keyType:v,typeName:ut.ZodMap,...yt(b)});class ws extends wt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.set)return qe(I,{code:je.invalid_type,expected:Xe.set,received:I.parsedType}),ht;const z=this._def;z.minSize!==null&&I.data.size<z.minSize.value&&(qe(I,{code:je.too_small,minimum:z.minSize.value,type:"set",inclusive:!0,exact:!1,message:z.minSize.message}),b.dirty()),z.maxSize!==null&&I.data.size>z.maxSize.value&&(qe(I,{code:je.too_big,maximum:z.maxSize.value,type:"set",inclusive:!0,exact:!1,message:z.maxSize.message}),b.dirty());const B=this._def.valueType;function S(he){const me=new Set;for(const Pe of he){if(Pe.status==="aborted")return ht;Pe.status==="dirty"&&b.dirty(),me.add(Pe.value)}return{status:b.value,value:me}}const o=[...I.data.values()].map((he,me)=>B._parse(new Un(I,he,I.path,me)));return I.common.async?Promise.all(o).then(he=>S(he)):S(o)}min(g,b){return new ws({...this._def,minSize:{value:g,message:tt.toString(b)}})}max(g,b){return new ws({...this._def,maxSize:{value:g,message:tt.toString(b)}})}size(g,b){return this.min(g,b).max(g,b)}nonempty(g){return this.min(1,g)}}ws.create=(v,g)=>new ws({valueType:v,minSize:null,maxSize:null,typeName:ut.ZodSet,...yt(g)});class To extends wt{constructor(){super(...arguments),this.validate=this.implement}_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Xe.function)return qe(b,{code:je.invalid_type,expected:Xe.function,received:b.parsedType}),ht;function I(o,he){return Au({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Eu(),xo].filter(me=>!!me),issueData:{code:je.invalid_arguments,argumentsError:he}})}function z(o,he){return Au({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Eu(),xo].filter(me=>!!me),issueData:{code:je.invalid_return_type,returnTypeError:he}})}const B={errorMap:b.common.contextualErrorMap},S=b.data;if(this._def.returns instanceof Mo){const o=this;return Er(async function(...he){const me=new Jr([]),Pe=await o._def.args.parseAsync(he,B).catch(le=>{throw me.addIssue(I(he,le)),me}),Be=await Reflect.apply(S,this,Pe);return await o._def.returns._def.type.parseAsync(Be,B).catch(le=>{throw me.addIssue(z(Be,le)),me})})}else{const o=this;return Er(function(...he){const me=o._def.args.safeParse(he,B);if(!me.success)throw new Jr([I(he,me.error)]);const Pe=Reflect.apply(S,this,me.data),Be=o._def.returns.safeParse(Pe,B);if(!Be.success)throw new Jr([z(Pe,Be.error)]);return Be.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...g){return new To({...this._def,args:$n.create(g).rest(bs.create())})}returns(g){return new To({...this._def,returns:g})}implement(g){return this.parse(g)}strictImplement(g){return this.parse(g)}static create(g,b,I){return new To({args:g||$n.create([]).rest(bs.create()),returns:b||bs.create(),typeName:ut.ZodFunction,...yt(I)})}}class jl extends wt{get schema(){return this._def.getter()}_parse(g){const{ctx:b}=this._processInputParams(g);return this._def.getter()._parse({data:b.data,path:b.path,parent:b})}}jl.create=(v,g)=>new jl({getter:v,typeName:ut.ZodLazy,...yt(g)});class Nl extends wt{_parse(g){if(g.data!==this._def.value){const b=this._getOrReturnCtx(g);return qe(b,{received:b.data,code:je.invalid_literal,expected:this._def.value}),ht}return{status:"valid",value:g.data}}get value(){return this._def.value}}Nl.create=(v,g)=>new Nl({value:v,typeName:ut.ZodLiteral,...yt(g)});function $f(v,g){return new Ba({values:v,typeName:ut.ZodEnum,...yt(g)})}class Ba extends wt{constructor(){super(...arguments),kl.set(this,void 0)}_parse(g){if(typeof g.data!="string"){const b=this._getOrReturnCtx(g),I=this._def.values;return qe(b,{expected:Dt.joinValues(I),received:b.parsedType,code:je.invalid_type}),ht}if(ku(this,kl)||jf(this,kl,new Set(this._def.values)),!ku(this,kl).has(g.data)){const b=this._getOrReturnCtx(g),I=this._def.values;return qe(b,{received:b.data,code:je.invalid_enum_value,options:I}),ht}return Er(g.data)}get options(){return this._def.values}get enum(){const g={};for(const b of this._def.values)g[b]=b;return g}get Values(){const g={};for(const b of this._def.values)g[b]=b;return g}get Enum(){const g={};for(const b of this._def.values)g[b]=b;return g}extract(g,b=this._def){return Ba.create(g,{...this._def,...b})}exclude(g,b=this._def){return Ba.create(this.options.filter(I=>!g.includes(I)),{...this._def,...b})}}kl=new WeakMap,Ba.create=$f;class Zl extends wt{constructor(){super(...arguments),zl.set(this,void 0)}_parse(g){const b=Dt.getValidEnumValues(this._def.values),I=this._getOrReturnCtx(g);if(I.parsedType!==Xe.string&&I.parsedType!==Xe.number){const z=Dt.objectValues(b);return qe(I,{expected:Dt.joinValues(z),received:I.parsedType,code:je.invalid_type}),ht}if(ku(this,zl)||jf(this,zl,new Set(Dt.getValidEnumValues(this._def.values))),!ku(this,zl).has(g.data)){const z=Dt.objectValues(b);return qe(I,{received:I.data,code:je.invalid_enum_value,options:z}),ht}return Er(g.data)}get enum(){return this._def.values}}zl=new WeakMap,Zl.create=(v,g)=>new Zl({values:v,typeName:ut.ZodNativeEnum,...yt(g)});class Mo extends wt{unwrap(){return this._def.type}_parse(g){const{ctx:b}=this._processInputParams(g);if(b.parsedType!==Xe.promise&&b.common.async===!1)return qe(b,{code:je.invalid_type,expected:Xe.promise,received:b.parsedType}),ht;const I=b.parsedType===Xe.promise?b.data:Promise.resolve(b.data);return Er(I.then(z=>this._def.type.parseAsync(z,{path:b.path,errorMap:b.common.contextualErrorMap})))}}Mo.create=(v,g)=>new Mo({type:v,typeName:ut.ZodPromise,...yt(g)});class wn extends wt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ut.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(g){const{status:b,ctx:I}=this._processInputParams(g),z=this._def.effect||null,B={addIssue:S=>{qe(I,S),S.fatal?b.abort():b.dirty()},get path(){return I.path}};if(B.addIssue=B.addIssue.bind(B),z.type==="preprocess"){const S=z.transform(I.data,B);if(I.common.async)return Promise.resolve(S).then(async o=>{if(b.value==="aborted")return ht;const he=await this._def.schema._parseAsync({data:o,path:I.path,parent:I});return he.status==="aborted"?ht:he.status==="dirty"||b.value==="dirty"?vo(he.value):he});{if(b.value==="aborted")return ht;const o=this._def.schema._parseSync({data:S,path:I.path,parent:I});return o.status==="aborted"?ht:o.status==="dirty"||b.value==="dirty"?vo(o.value):o}}if(z.type==="refinement"){const S=o=>{const he=z.refinement(o,B);if(I.common.async)return Promise.resolve(he);if(he instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(I.common.async===!1){const o=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});return o.status==="aborted"?ht:(o.status==="dirty"&&b.dirty(),S(o.value),{status:b.value,value:o.value})}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(o=>o.status==="aborted"?ht:(o.status==="dirty"&&b.dirty(),S(o.value).then(()=>({status:b.value,value:o.value}))))}if(z.type==="transform")if(I.common.async===!1){const S=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});if(!xs(S))return S;const o=z.transform(S.value,B);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:b.value,value:o}}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(S=>xs(S)?Promise.resolve(z.transform(S.value,B)).then(o=>({status:b.value,value:o})):S);Dt.assertNever(z)}}wn.create=(v,g,b)=>new wn({schema:v,typeName:ut.ZodEffects,effect:g,...yt(b)}),wn.createWithPreprocess=(v,g,b)=>new wn({schema:g,effect:{type:"preprocess",transform:v},typeName:ut.ZodEffects,...yt(b)});class Gn extends wt{_parse(g){return this._getType(g)===Xe.undefined?Er(void 0):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Gn.create=(v,g)=>new Gn({innerType:v,typeName:ut.ZodOptional,...yt(g)});class Fa extends wt{_parse(g){return this._getType(g)===Xe.null?Er(null):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Fa.create=(v,g)=>new Fa({innerType:v,typeName:ut.ZodNullable,...yt(g)});class Vl extends wt{_parse(g){const{ctx:b}=this._processInputParams(g);let I=b.data;return b.parsedType===Xe.undefined&&(I=this._def.defaultValue()),this._def.innerType._parse({data:I,path:b.path,parent:b})}removeDefault(){return this._def.innerType}}Vl.create=(v,g)=>new Vl({innerType:v,typeName:ut.ZodDefault,defaultValue:typeof g.default=="function"?g.default:()=>g.default,...yt(g)});class Ul extends wt{_parse(g){const{ctx:b}=this._processInputParams(g),I={...b,common:{...b.common,issues:[]}},z=this._def.innerType._parse({data:I.data,path:I.path,parent:{...I}});return Al(z)?z.then(B=>({status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new Jr(I.common.issues)},input:I.data})})):{status:"valid",value:z.status==="valid"?z.value:this._def.catchValue({get error(){return new Jr(I.common.issues)},input:I.data})}}removeCatch(){return this._def.innerType}}Ul.create=(v,g)=>new Ul({innerType:v,typeName:ut.ZodCatch,catchValue:typeof g.catch=="function"?g.catch:()=>g.catch,...yt(g)});class Bu extends wt{_parse(g){if(this._getType(g)!==Xe.nan){const I=this._getOrReturnCtx(g);return qe(I,{code:je.invalid_type,expected:Xe.nan,received:I.parsedType}),ht}return{status:"valid",value:g.data}}}Bu.create=v=>new Bu({typeName:ut.ZodNaN,...yt(v)});const Ry=Symbol("zod_brand");class Td extends wt{_parse(g){const{ctx:b}=this._processInputParams(g),I=b.data;return this._def.type._parse({data:I,path:b.path,parent:b})}unwrap(){return this._def.type}}class $l extends wt{_parse(g){const{status:b,ctx:I}=this._processInputParams(g);if(I.common.async)return(async()=>{const B=await this._def.in._parseAsync({data:I.data,path:I.path,parent:I});return B.status==="aborted"?ht:B.status==="dirty"?(b.dirty(),vo(B.value)):this._def.out._parseAsync({data:B.value,path:I.path,parent:I})})();{const z=this._def.in._parseSync({data:I.data,path:I.path,parent:I});return z.status==="aborted"?ht:z.status==="dirty"?(b.dirty(),{status:"dirty",value:z.value}):this._def.out._parseSync({data:z.value,path:I.path,parent:I})}}static create(g,b){return new $l({in:g,out:b,typeName:ut.ZodPipeline})}}class Gl extends wt{_parse(g){const b=this._def.innerType._parse(g),I=z=>(xs(z)&&(z.value=Object.freeze(z.value)),z);return Al(b)?b.then(z=>I(z)):I(b)}unwrap(){return this._def.innerType}}Gl.create=(v,g)=>new Gl({innerType:v,typeName:ut.ZodReadonly,...yt(g)});function Gf(v,g){const b=typeof v=="function"?v(g):typeof v=="string"?{message:v}:v;return typeof b=="string"?{message:b}:b}function qf(v,g={},b){return v?bo.create().superRefine((I,z)=>{var B,S;const o=v(I);if(o instanceof Promise)return o.then(he=>{var me,Pe;if(!he){const Be=Gf(g,I),Ee=(Pe=(me=Be.fatal)!==null&&me!==void 0?me:b)!==null&&Pe!==void 0?Pe:!0;z.addIssue({code:"custom",...Be,fatal:Ee})}});if(!o){const he=Gf(g,I),me=(S=(B=he.fatal)!==null&&B!==void 0?B:b)!==null&&S!==void 0?S:!0;z.addIssue({code:"custom",...he,fatal:me})}}):bo.create()}const Dy={object:_i.lazycreate};var ut;(function(v){v.ZodString="ZodString",v.ZodNumber="ZodNumber",v.ZodNaN="ZodNaN",v.ZodBigInt="ZodBigInt",v.ZodBoolean="ZodBoolean",v.ZodDate="ZodDate",v.ZodSymbol="ZodSymbol",v.ZodUndefined="ZodUndefined",v.ZodNull="ZodNull",v.ZodAny="ZodAny",v.ZodUnknown="ZodUnknown",v.ZodNever="ZodNever",v.ZodVoid="ZodVoid",v.ZodArray="ZodArray",v.ZodObject="ZodObject",v.ZodUnion="ZodUnion",v.ZodDiscriminatedUnion="ZodDiscriminatedUnion",v.ZodIntersection="ZodIntersection",v.ZodTuple="ZodTuple",v.ZodRecord="ZodRecord",v.ZodMap="ZodMap",v.ZodSet="ZodSet",v.ZodFunction="ZodFunction",v.ZodLazy="ZodLazy",v.ZodLiteral="ZodLiteral",v.ZodEnum="ZodEnum",v.ZodEffects="ZodEffects",v.ZodNativeEnum="ZodNativeEnum",v.ZodOptional="ZodOptional",v.ZodNullable="ZodNullable",v.ZodDefault="ZodDefault",v.ZodCatch="ZodCatch",v.ZodPromise="ZodPromise",v.ZodBranded="ZodBranded",v.ZodPipeline="ZodPipeline",v.ZodReadonly="ZodReadonly"})(ut||(ut={}));const Ly=(v,g={message:`Input not instance of ${v.name}`})=>qf(b=>b instanceof v,g),Hf=vn.create,Wf=Da.create,By=Bu.create,Fy=La.create,Xf=Rl.create,Oy=vs.create,jy=zu.create,Ny=Dl.create,Zy=Ll.create,Vy=bo.create,Uy=bs.create,$y=aa.create,Gy=Ru.create,qy=bn.create,Hy=_i.create,Wy=_i.strictCreate,Xy=Bl.create,Ky=Du.create,Yy=Fl.create,Jy=$n.create,Qy=Ol.create,ex=Lu.create,tx=ws.create,ix=To.create,rx=jl.create,nx=Nl.create,ax=Ba.create,sx=Zl.create,ox=Mo.create,Kf=wn.create,lx=Gn.create,cx=Fa.create,ux=wn.createWithPreprocess,hx=$l.create;var st=Object.freeze({__proto__:null,defaultErrorMap:xo,setErrorMap:uy,getErrorMap:Eu,makeIssue:Au,EMPTY_PATH:hy,addIssueToContext:qe,ParseStatus:gr,INVALID:ht,DIRTY:vo,OK:Er,isAborted:xd,isDirty:vd,isValid:xs,isAsync:Al,get util(){return Dt},get objectUtil(){return yd},ZodParsedType:Xe,getParsedType:na,ZodType:wt,datetimeRegex:Uf,ZodString:vn,ZodNumber:Da,ZodBigInt:La,ZodBoolean:Rl,ZodDate:vs,ZodSymbol:zu,ZodUndefined:Dl,ZodNull:Ll,ZodAny:bo,ZodUnknown:bs,ZodNever:aa,ZodVoid:Ru,ZodArray:bn,ZodObject:_i,ZodUnion:Bl,ZodDiscriminatedUnion:Du,ZodIntersection:Fl,ZodTuple:$n,ZodRecord:Ol,ZodMap:Lu,ZodSet:ws,ZodFunction:To,ZodLazy:jl,ZodLiteral:Nl,ZodEnum:Ba,ZodNativeEnum:Zl,ZodPromise:Mo,ZodEffects:wn,ZodTransformer:wn,ZodOptional:Gn,ZodNullable:Fa,ZodDefault:Vl,ZodCatch:Ul,ZodNaN:Bu,BRAND:Ry,ZodBranded:Td,ZodPipeline:$l,ZodReadonly:Gl,custom:qf,Schema:wt,ZodSchema:wt,late:Dy,get ZodFirstPartyTypeKind(){return ut},coerce:{string:v=>vn.create({...v,coerce:!0}),number:v=>Da.create({...v,coerce:!0}),boolean:v=>Rl.create({...v,coerce:!0}),bigint:v=>La.create({...v,coerce:!0}),date:v=>vs.create({...v,coerce:!0})},any:Vy,array:qy,bigint:Fy,boolean:Xf,date:Oy,discriminatedUnion:Ky,effect:Kf,enum:ax,function:ix,instanceof:Ly,intersection:Yy,lazy:rx,literal:nx,map:ex,nan:By,nativeEnum:sx,never:$y,null:Zy,nullable:cx,number:Wf,object:Hy,oboolean:()=>Xf().optional(),onumber:()=>Wf().optional(),optional:lx,ostring:()=>Hf().optional(),pipeline:hx,preprocess:ux,promise:ox,record:Qy,set:tx,strictObject:Wy,string:Hf,symbol:jy,transformer:Kf,tuple:Jy,undefined:Ny,union:Xy,unknown:Uy,void:Gy,NEVER:ht,ZodIssueCode:je,quotelessJson:cy,ZodError:Jr});const Fu=st.object({lat:st.number(),lng:st.number()}),dx=st.object({center:Fu,zoom:st.number()}),px=st.object({sw:Fu,ne:Fu}),fx=st.object({name:st.literal("dark").or(st.literal("light")),url:st.string().optional(),colors:st.object({primary:st.string().max(64),background:st.string().max(64),text:st.string().max(64)})}),mx=st.object({container:st.string(),position:st.object({center:st.object({lat:st.number(),lng:st.number()}),zoom:st.number()}),restriction:st.object({minZoom:st.number().min(gd).max(El).optional(),maxZoom:st.number().min(gd).max(El).optional(),maxBounds:px.optional()}).optional(),style:fx});st.enum(["idle","move","click","popup_click"]);const gx=st.function().returns(st.void()),_x=st.function().args(dx).returns(st.void()),yx=st.function().args(Fu).returns(st.void()),xx={idle:gx,move:_x,click:yx},Yf=st.object({id:st.string(),rank:st.number(),lat:st.number(),lng:st.number(),width:st.number(),height:st.number()}),vx=st.tuple([st.number(),st.array(st.tuple([st.number(),st.number()]))]),Jf=st.function().args(st.string()).returns(st.promise(st.any())),bx=st.object({data:Yf,state:vx,callbacks:st.object({body:Jf,pin:Jf.optional()})}),wx=st.array(bx);st.object({key:st.string(),data:st.array(Yf)});var Tx=od('<div class="container svelte-1l30n6h"><div class="map svelte-1l30n6h"></div> <div class="logo svelte-1l30n6h"><a href="https://arenarium.dev" target="_blank" class="svelte-1l30n6h">@arenarium/maps</a></div></div>');function Qf(v,g){pu(g,!0);let b,I,z,B,S,o=Zi(0),he=Zi(0),me=Zi(!1),Pe=Zi(void 0);Ef(()=>{mx.parse(g.options),Be(),Ee()});function Be(){var Ce,Ye,Ue;z=((Ce=g.options.restriction)==null?void 0:Ce.minZoom)??gd,B=((Ye=g.options.restriction)==null?void 0:Ye.maxZoom)??El,S=(Ue=g.options.restriction)==null?void 0:Ue.maxBounds,b=new _d.Map({style:yr(g.options.style),center:{lat:g.options.position.center.lat,lng:g.options.position.center.lng},zoom:g.options.position.zoom,minZoom:It(z),maxZoom:B,maxBounds:S?[S.sw.lng,S.sw.lat,S.ne.lng,S.ne.lat]:void 0,container:I,pitchWithRotate:!1,attributionControl:{compact:!1}})}function Ee(){b.on("load",le),b.on("move",Fe),b.on("idle",Bt),b.on("click",fi),b.dragRotate.disable(),b.keyboard.disable(),b.touchZoomRotate.disableRotation(),b.touchPitch.disable()}function le(){di(me,!0)}function Fe(){const Ce=b.getCenter(),Ye=b.getZoom();Ft("move",{center:Ce,zoom:Ye});const Ue=b.getBounds();di(Pe,{sw:{lat:Ue.getSouthWest().lat,lng:Ue.getSouthWest().lng},ne:{lat:Ue.getNorthEast().lat,lng:Ue.getNorthEast().lng}},!0)}function Bt(){Ft("idle",null);const Ce=b.getBounds();di(Pe,{sw:{lat:Ce.getSouthWest().lat,lng:Ce.getSouthWest().lng},ne:{lat:Ce.getNorthEast().lat,lng:Ce.getNorthEast().lng}},!0)}function fi(Ce){Ft("click",{lat:Ce.lngLat.lat,lng:Ce.lngLat.lng})}const ti=new Map;function yi(Ce,Ye){var Nt;const Ue=xx[Ce];if(!Ue)throw new Error(`No schema defined for event ${Ce}`);if(!Ue.safeParse(Ye).success)throw new Error(`Invalid handler for event ${Ce}`);ti.has(Ce)||ti.set(Ce,new Set),(Nt=ti.get(Ce))==null||Nt.add(Ye)}function Ki(Ce,Ye){const Ue=ti.get(Ce);Ue&&Ue.delete(Ye)&&Ue.size===0&&ti.delete(Ce)}function Ft(Ce,Ye){const Ue=ti.get(Ce);Ue&&Ue.size>0&&[...Ue].forEach(_t=>{try{_t(Ye)}catch(Nt){console.error(Nt)}})}function It(Ce){const Ye=zf,Ue=Math.ceil(Math.log2(ct(o)/Ye));return Math.max(Ce,Ue)}function $t(){const Ce=b.getCenter();return Ce?{lat:Ce.lat,lng:Ce.lng}:{lat:g.options.position.center.lat,lng:g.options.position.center.lng}}function _r(){return b.getZoom()??g.options.position.zoom}function jt(){if(!b)throw new Error("Map not loaded!");const Ce=b.getBounds();return{sw:{lat:Ce.getSouthWest().lat,lng:Ce.getSouthWest().lng},ne:{lat:Ce.getNorthEast().lat,lng:Ce.getNorthEast().lng}}}function Tn(Ce){if(!b)throw new Error("Map not loaded! Consider using the position option");b.setCenter(Ce)}function Mn(Ce){if(!b)throw new Error("Map not loaded! Consider using the position option");b.setZoom(Ce)}function Yi(){if(!b)throw new Error("Map not loaded! Consider using the position option");b.zoomIn()}function ar(){if(!b)throw new Error("Map not loaded! Consider using the position option.");b.zoomOut()}function Ji(Ce){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");z=Ce,b.setMinZoom(It(Ce))}function ot(Ce){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");B=Ce,b.setMaxZoom(Ce)}function Vi(Ce){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");S=Ce,b.setMaxBounds([Ce.sw.lng,Ce.sw.lat,Ce.ne.lng,Ce.ne.lat])}let xi=Zi(gs(g.options.style));go(()=>{ct(me)&&b.setStyle(yr(ct(xi)),{diff:!0})});function yr(Ce){if(Ce.url)return Ce.url;switch(Ce.name){case"light":return ly;case"dark":return oy}}function Et(){return o_(ct(xi))}function Ar(Ce){di(xi,Ce,!0),b.setStyle(yr(ct(xi)),{diff:!0})}class sr{constructor(Ye){qt(this,"id");qt(this,"lat");qt(this,"lng");qt(this,"zoom");qt(this,"element");qt(this,"component");qt(this,"libreMarker");this.id=Ye.data.id,this.lat=Ye.data.lat,this.lng=Ye.data.lng,this.zoom=Ye.state[0],this.element=void 0,this.component=void 0,this.libreMarker=void 0}createLibreMarker(){const Ye=this.element;if(!Ye)throw new Error("Failed to create libre marker");const Ue=new _d.Marker({element:Ye});Ue.setLngLat([this.lng,this.lat]),this.libreMarker=Ue}isCreated(){return this.element!=null}isInBlock(Ye,Ue){return this.zoom<=Ye&&Ue.contains(this.lat,this.lng)}}class cn extends sr{constructor(Ue){super(Ue);qt(this,"pinLoading",!1);qt(this,"pinLoaded",!1);qt(this,"pinContentCallback");this.pinContentCallback=Ue.content.pinCallback}createElement(){this.element=document.createElement("div"),this.element.classList.add("circle"),this.component=cd(iy,{target:this.element}),this.createLibreMarker(),this.updateZIndex()}updateZIndex(){const Ue=this.element;if(!Ue)return;const _t=Math.round((El-this.zoom)*Rf);Ue.style.zIndex=_t.toString()}updateMap(Ue){if(this.libreMarker==null)throw new Error("Failed to update circle map");this.libreMarker._map!=Ue&&(Ue?this.libreMarker.addTo(Ue):this.libreMarker.remove())}updateState(Ue){const _t=this.component;if(!_t)throw new Error("Failed to update circle state");if(this.zoom<=Ue)_t.setCollapsed(!0);else{const cr=1-(this.zoom-Ue)/Df*.5;_t.setScale(cr),_t.setCollapsed(!1)}}updatePin(){var _t;if(this.pinContentCallback==null||this.pinLoaded||this.pinLoading)return;const Ue=(_t=this.component)==null?void 0:_t.getPin();Ue!=null&&(this.pinLoading=!0,this.pinContentCallback(this.id).then(Nt=>{Ue.appendChild(Nt),this.pinLoaded=!0,this.pinLoading=!1}))}isPinLoaded(){return this.pinContentCallback==null||this.pinLoaded}}class kr extends sr{constructor(Ue){super(Ue);qt(this,"width");qt(this,"height");qt(this,"angles");qt(this,"bodyLoading",!1);qt(this,"bodyLoaded",!1);qt(this,"bodyContentCallback");this.id=Ue.data.id,this.angles=Ue.state[1],this.width=Ue.data.width,this.height=Ue.data.height,this.bodyContentCallback=Ue.content.bodyCallback}createElement(){this.element=document.createElement("div"),this.element.classList.add("marker"),this.component=cd(ey,{target:this.element,props:{width:this.width,height:this.height}}),this.createLibreMarker(),this.updateZIndex()}updateZIndex(){const Ue=this.element;if(!Ue)return;const _t=Math.round((El-this.zoom)*Rf)+1e6;Ue.style.zIndex=_t.toString()}updateMap(Ue){const _t=this.libreMarker,Nt=this.component;if(_t==null||Nt==null)throw new Error("Failed to update marker map");_t._map!=Ue&&(Ue?(_t.addTo(Ue),Nt.setDisplayed(!0)):(_t.remove(),Nt.setDisplayed(!1)))}updateState(Ue){const _t=this.component;if(!_t)throw new Error("Failed to update marker state");this.zoom<=Ue?(_t.setCollapsed(!1),_t.setAngle(this.getAngle(Ue))):_t.setCollapsed(!0)}updateBody(){var _t;if(this.bodyLoaded||this.bodyLoading)return;const Ue=(_t=this.component)==null?void 0:_t.getBody();Ue!=null&&(this.bodyLoading=!0,this.bodyContentCallback(this.id).then(Nt=>{Ue.appendChild(Nt),this.bodyLoading=!1,this.bodyLoaded=!0}))}getAngle(Ue){let _t=this.angles,Nt=_t[0],cr=0;for(;Nt[0]<Ue&&(cr++,cr!=_t.length);)Nt=_t[cr];return Nt[1]}getExpanded(){return this.component?this.component.getExpanded():!1}getCollapsed(){return this.component?this.component.getCollapsed():!1}isBodyLoaded(){return this.bodyLoaded}}class la{constructor(Ye){qt(this,"id");qt(this,"rank");qt(this,"lat");qt(this,"lng");qt(this,"zoom");qt(this,"circle");qt(this,"marker");this.id=Ye.data.id,this.rank=Ye.data.rank,this.lat=Ye.data.lat,this.lng=Ye.data.lng,this.zoom=Ye.state[0],this.circle=new cn(Ye),this.marker=new kr(Ye)}}let xr,Ht=new Array,vr=new Map,Qi=zf,Sn=mu(()=>ct(Pe)?new Ff(b,-512,ct(he)+Qi,ct(o)+Qi,-512):void 0),un=mu(()=>ct(Pe)?new Ff(b,0,ct(he),ct(o),0):void 0);Ef(()=>{const Ce=()=>{ca(),xr=window.setTimeout(Ce,25)};return Ce(),()=>clearInterval(xr)});function ca(){if(ct(me)==!1||ct(un)==null||ct(Sn)==null||Ht.length==0)return;const Ce=b.getZoom();if(Ce)for(const Ye of Ht)or(Ye.circle,Ce,ct(un)),lr(Ye.marker,Ce,ct(Sn))}function or(Ce,Ye,Ue){Ce.isInBlock(Ye+Df,Ue)?(Ce.isCreated()==!1&&Ce.createElement(),Ce.updateMap(b),Ce.updateState(Ye),Ce.isPinLoaded()==!1&&Ce.updatePin()):Ce.isCreated()==!0&&Ce.updateMap(null)}function lr(Ce,Ye,Ue){Ce.isInBlock(Ye+Y_,Ue)?(Ce.isCreated()==!1&&Ce.createElement(),Ce.updateMap(b),Ce.updateState(Ye),Ce.getExpanded()&&Ce.isBodyLoaded()==!1&&Ce.updateBody()):Ce.isCreated()==!0&&(Ce.getCollapsed()?Ce.updateMap(null):Ce.updateState(Ye))}async function Ui(Ce){var Nt,cr;const Ye=new Map(Ce.map(mi=>[mi.data.id,new la(mi)])),Ue=new Array,_t=Array.from(Ht);for(const mi of _t)Ye.has(mi.id)==!1&&((Nt=mi.circle.libreMarker)==null||Nt.remove(),(cr=mi.marker.libreMarker)==null||cr.remove(),vr.delete(mi.id),Ht.splice(Ht.indexOf(mi),1));for(const mi of Ce){const zr=vr.get(mi.data.id);if(zr)zr.circle.zoom=mi.state[0],zr.circle.updateZIndex(),zr.marker.zoom=mi.state[0],zr.marker.angles=mi.state[1],zr.marker.updateZIndex();else{const Rr=new la(mi);vr.set(mi.data.id,Rr),Ht.push(Rr),Ue.push(Rr)}}}function Zt(){var Ce,Ye;for(const Ue of Ht)(Ce=Ue.circle.libreMarker)==null||Ce.remove(),(Ye=Ue.marker.libreMarker)==null||Ye.remove();Ht.length=0,vr.clear()}async function Vr(Ce){if(!(await wx.safeParseAsync(Ce)).success)throw new Error("Invalid popups");await Ui(Ce)}function hn(){Zt()}function br(Ce){const Ye=vr.get(Ce);Ye!=null&&b.flyTo({center:{lat:Ye.lat,lng:Ye.lng},zoom:Ye.zoom})}var Pn=Tx();F_("resize",td,()=>b.setMinZoom(It(z)));var Cn=gu(Pn);return yo(Cn,Ce=>I=Ce,()=>I),id(()=>Pu(Pn,`--primary: ${ct(xi).colors.primary??""}; --background: ${ct(xi).colors.background??""}; --text: ${ct(xi).colors.text??""};`)),Cu(Cn,"clientWidth",Ce=>di(o,Ce)),Cu(Cn,"clientHeight",Ce=>di(he,Ce)),ld(v,Pn),fu({on:yi,off:Ki,emit:Ft,getCenter:$t,getZoom:_r,getBounds:jt,setCenter:Tn,setZoom:Mn,zoomIn:Yi,zoomOut:ar,setMinZoom:Ji,setMaxZoom:ot,setMaxBounds:Vi,getStyle:Et,setStyle:Ar,updatePopups:Vr,removePopups:hn,revealPopup:br})}function Mx(v){const g=document.getElementById(v.container);if(!g)throw new Error(`Container not found: ${v.container}`);return cd(Qf,{target:g,props:{options:v}})}function Sx(v){Z_(v)}Ot.Map=Qf,Ot.mountMap=Mx,Ot.unmountMap=Sx,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"})});