@arenarium/maps 1.0.34 → 1.0.37

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.
@@ -1,729 +0,0 @@
1
- (function(Ut,oi){typeof exports=="object"&&typeof module<"u"?oi(exports):typeof define=="function"&&define.amd?define(["exports"],oi):(Ut=typeof globalThis<"u"?globalThis:Ut||self,oi(Ut.arenarium={}))})(this,function(Ut){"use strict";var O0=Object.defineProperty;var n_=Ut=>{throw TypeError(Ut)};var j0=(Ut,oi,Ai)=>oi in Ut?O0(Ut,oi,{enumerable:!0,configurable:!0,writable:!0,value:Ai}):Ut[oi]=Ai;var ta=(Ut,oi,Ai)=>j0(Ut,typeof oi!="symbol"?oi+"":oi,Ai),of=(Ut,oi,Ai)=>oi.has(Ut)||n_("Cannot "+Ai);var Vt=(Ut,oi,Ai)=>(of(Ut,oi,"read from private field"),Ai?Ai.call(Ut):oi.get(Ut)),Mr=(Ut,oi,Ai)=>oi.has(Ut)?n_("Cannot add the same private member more than once"):oi instanceof WeakSet?oi.add(Ut):oi.set(Ut,Ai),xu=(Ut,oi,Ai,vu)=>(of(Ut,oi,"write to private field"),vu?vu.call(Ut,Ai):oi.set(Ut,Ai),Ai),a_=(Ut,oi,Ai)=>(of(Ut,oi,"access private method"),Ai);var Na,ko,ec,eh,s_,bm,la,Eo,tc,zs,ic,rc,nc,ac,sc,oc;var Ai=Array.isArray,vu=Array.prototype.indexOf,xd=Array.from,l_=Object.defineProperty,Ml=Object.getOwnPropertyDescriptor,lf=Object.prototype,c_=Array.prototype,cf=Object.getPrototypeOf,uf=Object.isExtensible;const u_=()=>{};function hf(_){for(var m=0;m<_.length;m++)_[m]()}const Cn=2,df=4,bu=8,vd=16,ia=32,fo=64,wu=128,Xr=256,Tu=512,Rr=1024,za=2048,mo=4096,ra=8192,Pu=16384,h_=32768,Su=65536,d_=1<<19,pf=1<<20,bd=1<<21,Mu=Symbol("$state");function ff(_){return _===this.v}function p_(_,m){return _!=_?m==m:_!==m||_!==null&&typeof _=="object"||typeof _=="function"}function mf(_){return!p_(_,this.v)}function f_(_){throw new Error("https://svelte.dev/e/effect_in_teardown")}function m_(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function g_(_){throw new Error("https://svelte.dev/e/effect_orphan")}function __(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function y_(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function x_(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function v_(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let N0=!1;const b_=1,w_=2,T_=16,P_=2,Ir=Symbol(),S_=[];function M_(_,m=!1){return Iu(_,new Map,"",S_)}function Iu(_,m,b,M,E=null){if(typeof _=="object"&&_!==null){var z=m.get(_);if(z!==void 0)return z;if(_ instanceof Map)return new Map(_);if(_ instanceof Set)return new Set(_);if(Ai(_)){var P=Array(_.length);m.set(_,P),E!==null&&m.set(E,P);for(var o=0;o<_.length;o+=1){var ue=_[o];o in _&&(P[o]=Iu(ue,m,b,M))}return P}if(cf(_)===lf){P={},m.set(_,P),E!==null&&m.set(E,P);for(var re in _)P[re]=Iu(_[re],m,b,M);return P}if(_ instanceof Date)return structuredClone(_);if(typeof _.toJSON=="function")return Iu(_.toJSON(),m,b,M,_)}if(_ instanceof EventTarget)return _;try{return structuredClone(_)}catch{return _}}function I_(_){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let Cr=null;function gf(_){Cr=_}function Cu(_,m=!1,b){var M=Cr={p:Cr,c:null,d:!1,e:null,m:!1,s:_,x:null,l:null};If(()=>{M.d=!0})}function ku(_){const m=Cr;if(m!==null){_!==void 0&&(m.x=_);const P=m.e;if(P!==null){var b=hi,M=Xt;m.e=null;try{for(var E=0;E<P.length;E++){var z=P[E];Ra(z.effect),An(z.reaction),Au(z.fn)}}finally{Ra(b),An(M)}}Cr=m.p,m.m=!0}return _||{}}function _f(){return!0}function na(_,m){if(typeof _!="object"||_===null||Mu in _)return _;const b=cf(_);if(b!==lf&&b!==c_)return _;var M=new Map,E=Ai(_),z=vi(0),P=Xt,o=ue=>{var re=Xt;An(P);var ne;return ne=ue(),An(re),ne};return E&&M.set("length",vi(_.length)),new Proxy(_,{defineProperty(ue,re,ne){(!("value"in ne)||ne.configurable===!1||ne.enumerable===!1||ne.writable===!1)&&y_();var _e=M.get(re);return _e===void 0?(_e=o(()=>vi(ne.value)),M.set(re,_e)):ti(_e,o(()=>na(ne.value))),!0},deleteProperty(ue,re){var ne=M.get(re);if(ne===void 0)re in ue&&M.set(re,o(()=>vi(Ir)));else{if(E&&typeof re=="string"){var _e=M.get("length"),ae=Number(re);Number.isInteger(ae)&&ae<_e.v&&ti(_e,ae)}ti(ne,Ir),yf(z)}return!0},get(ue,re,ne){var ve;if(re===Mu)return _;var _e=M.get(re),ae=re in ue;if(_e===void 0&&(!ae||(ve=Ml(ue,re))!=null&&ve.writable)&&(_e=o(()=>vi(na(ae?ue[re]:Ir))),M.set(re,_e)),_e!==void 0){var G=We(_e);return G===Ir?void 0:G}return Reflect.get(ue,re,ne)},getOwnPropertyDescriptor(ue,re){var ne=Reflect.getOwnPropertyDescriptor(ue,re);if(ne&&"value"in ne){var _e=M.get(re);_e&&(ne.value=We(_e))}else if(ne===void 0){var ae=M.get(re),G=ae==null?void 0:ae.v;if(ae!==void 0&&G!==Ir)return{enumerable:!0,configurable:!0,value:G,writable:!0}}return ne},has(ue,re){var G;if(re===Mu)return!0;var ne=M.get(re),_e=ne!==void 0&&ne.v!==Ir||Reflect.has(ue,re);if(ne!==void 0||hi!==null&&(!_e||(G=Ml(ue,re))!=null&&G.writable)){ne===void 0&&(ne=o(()=>vi(_e?na(ue[re]):Ir)),M.set(re,ne));var ae=We(ne);if(ae===Ir)return!1}return _e},set(ue,re,ne,_e){var gt;var ae=M.get(re),G=re in ue;if(E&&re==="length")for(var ve=ne;ve<ae.v;ve+=1){var Oe=M.get(ve+"");Oe!==void 0?ti(Oe,Ir):ve in ue&&(Oe=o(()=>vi(Ir)),M.set(ve+"",Oe))}ae===void 0?(!G||(gt=Ml(ue,re))!=null&&gt.writable)&&(ae=o(()=>vi(void 0)),ti(ae,o(()=>na(ne))),M.set(re,ae)):(G=ae.v!==Ir,ti(ae,o(()=>na(ne))));var Ke=Reflect.getOwnPropertyDescriptor(ue,re);if(Ke!=null&&Ke.set&&Ke.set.call(_e,ne),!G){if(E&&typeof re=="string"){var Qe=M.get("length"),ct=Number(re);Number.isInteger(ct)&&ct>=Qe.v&&ti(Qe,ct+1)}yf(z)}return!0},ownKeys(ue){We(z);var re=Reflect.ownKeys(ue).filter(ae=>{var G=M.get(ae);return G===void 0||G.v!==Ir});for(var[ne,_e]of M)_e.v!==Ir&&!(ne in ue)&&re.push(ne);return re},setPrototypeOf(){x_()}})}function yf(_,m=1){ti(_,_.v+m)}const Il=new Map;function go(_,m){var b={f:0,v:_,reactions:null,equals:ff,rv:0,wv:0};return b}function vi(_,m){const b=go(_);return Of(b),b}function C_(_,m=!1){const b=go(_);return m||(b.equals=mf),b}function ti(_,m,b=!1){Xt!==null&&!En&&_f()&&(Xt.f&(Cn|vd))!==0&&!(_r!=null&&_r.includes(_))&&v_();let M=b?na(m):m;return xf(_,M)}function xf(_,m){if(!_.equals(m)){var b=_.v;Al?Il.set(_,m):Il.set(_,b),_.v=m,_.wv=Nf(),vf(_,za),hi!==null&&(hi.f&Rr)!==0&&(hi.f&(ia|fo))===0&&(Kr===null?Z_([_]):Kr.push(_))}return m}function vf(_,m){var b=_.reactions;if(b!==null)for(var M=b.length,E=0;E<M;E++){var z=b[E],P=z.f;(P&za)===0&&(zn(z,m),(P&(Rr|Xr))!==0&&((P&Cn)!==0?vf(z,mo):Nu(z)))}}let k_=!1;var wd,bf,wf,Tf;function E_(){if(wd===void 0){wd=window,bf=/Firefox/.test(navigator.userAgent);var _=Element.prototype,m=Node.prototype,b=Text.prototype;wf=Ml(m,"firstChild").get,Tf=Ml(m,"nextSibling").get,uf(_)&&(_.__click=void 0,_.__className=void 0,_.__attributes=null,_.__style=void 0,_.__e=void 0),uf(b)&&(b.__t=void 0)}}function Pf(_=""){return document.createTextNode(_)}function Td(_){return wf.call(_)}function Pd(_){return Tf.call(_)}function Ps(_,m){return Td(_)}function Sd(_,m=1,b=!1){let M=_;for(;m--;)M=Pd(M);return M}function A_(_){_.textContent=""}function Md(_){var m=Cn|za,b=Xt!==null&&(Xt.f&Cn)!==0?Xt:null;return hi===null||b!==null&&(b.f&Xr)!==0?m|=Xr:hi.f|=pf,{ctx:Cr,deps:null,effects:null,equals:ff,f:m,fn:_,reactions:null,rv:0,v:null,wv:0,parent:b??hi}}function Eu(_){const m=Md(_);return Of(m),m}function z_(_){const m=Md(_);return m.equals=mf,m}function Sf(_){var m=_.effects;if(m!==null){_.effects=null;for(var b=0;b<m.length;b+=1)kn(m[b])}}function R_(_){for(var m=_.parent;m!==null;){if((m.f&Cn)===0)return m;m=m.parent}return null}function D_(_){var m,b=hi;Ra(R_(_));try{Sf(_),m=Vf(_)}finally{Ra(b)}return m}function Mf(_){var m=D_(_),b=(Da||(_.f&Xr)!==0)&&_.deps!==null?mo:Rr;zn(_,b),_.equals(m)||(_.v=m,_.wv=Nf())}function L_(_){hi===null&&Xt===null&&g_(),Xt!==null&&(Xt.f&Xr)!==0&&hi===null&&m_(),Al&&f_()}function F_(_,m){var b=m.last;b===null?m.last=m.first=_:(b.next=_,_.prev=b,m.last=_)}function _o(_,m,b,M=!0){var E=hi,z={ctx:Cr,deps:null,nodes_start:null,nodes_end:null,f:_|za,first:null,fn:m,last:null,next:null,parent:E,prev:null,teardown:null,transitions:null,wv:0};if(b)try{kd(z),z.f|=h_}catch(ue){throw kn(z),ue}else m!==null&&Nu(z);var P=b&&z.deps===null&&z.first===null&&z.nodes_start===null&&z.teardown===null&&(z.f&(pf|wu))===0;if(!P&&M&&(E!==null&&F_(z,E),Xt!==null&&(Xt.f&Cn)!==0)){var o=Xt;(o.effects??(o.effects=[])).push(z)}return z}function If(_){const m=_o(bu,null,!1);return zn(m,Rr),m.teardown=_,m}function yo(_){L_();var m=hi!==null&&(hi.f&ia)!==0&&Cr!==null&&!Cr.m;if(m){var b=Cr;(b.e??(b.e=[])).push({fn:_,effect:hi,reaction:Xt})}else{var M=Au(_);return M}}function B_(_){const m=_o(fo,_,!0);return(b={})=>new Promise(M=>{b.outro?zu(m,()=>{kn(m),M(void 0)}):(kn(m),M(void 0))})}function Au(_){return _o(df,_,!1)}function Cf(_){return _o(bu,_,!0)}function Cl(_,m=[],b=Md){const M=m.map(b);return kl(()=>_(...M.map(We)))}function kl(_,m=0){return _o(bu|vd|m,_,!0)}function Ss(_,m=!0){return _o(bu|ia,_,!0,m)}function kf(_){var m=_.teardown;if(m!==null){const b=Al,M=Xt;Bf(!0),An(null);try{m.call(null)}finally{Bf(b),An(M)}}}function Ef(_,m=!1){var b=_.first;for(_.first=_.last=null;b!==null;){var M=b.next;(b.f&fo)!==0?b.parent=null:kn(b,m),b=M}}function O_(_){for(var m=_.first;m!==null;){var b=m.next;(m.f&ia)===0&&kn(m),m=b}}function kn(_,m=!0){var b=!1;if((m||(_.f&d_)!==0)&&_.nodes_start!==null){for(var M=_.nodes_start,E=_.nodes_end;M!==null;){var z=M===E?null:Pd(M);M.remove(),M=z}b=!0}Ef(_,m&&!b),ju(_,0),zn(_,Pu);var P=_.transitions;if(P!==null)for(const ue of P)ue.stop();kf(_);var o=_.parent;o!==null&&o.first!==null&&Af(_),_.next=_.prev=_.teardown=_.ctx=_.deps=_.fn=_.nodes_start=_.nodes_end=null}function Af(_){var m=_.parent,b=_.prev,M=_.next;b!==null&&(b.next=M),M!==null&&(M.prev=b),m!==null&&(m.first===_&&(m.first=M),m.last===_&&(m.last=b))}function zu(_,m){var b=[];Id(_,b,!0),zf(b,()=>{kn(_),m&&m()})}function zf(_,m){var b=_.length;if(b>0){var M=()=>--b||m();for(var E of _)E.out(M)}else m()}function Id(_,m,b){if((_.f&ra)===0){if(_.f^=ra,_.transitions!==null)for(const P of _.transitions)(P.is_global||b)&&m.push(P);for(var M=_.first;M!==null;){var E=M.next,z=(M.f&Su)!==0||(M.f&ia)!==0;Id(M,m,z?b:!1),M=E}}}function Ru(_){Rf(_,!0)}function Rf(_,m){if((_.f&ra)!==0){_.f^=ra,(_.f&Rr)===0&&(_.f^=Rr),Rl(_)&&(zn(_,za),Nu(_));for(var b=_.first;b!==null;){var M=b.next,E=(b.f&Su)!==0||(b.f&ia)!==0;Rf(b,E?m:!1),b=M}if(_.transitions!==null)for(const z of _.transitions)(z.is_global||m)&&z.in()}}let El=[],Cd=[];function Df(){var _=El;El=[],hf(_)}function j_(){var _=Cd;Cd=[],hf(_)}function Lf(_){El.length===0&&queueMicrotask(Df),El.push(_)}function Ff(){El.length>0&&Df(),Cd.length>0&&j_()}let Du=!1,Lu=!1,Fu=null,Ms=!1,Al=!1;function Bf(_){Al=_}let zl=[],Z0=[],Xt=null,En=!1;function An(_){Xt=_}let hi=null;function Ra(_){hi=_}let _r=null;function N_(_){_r=_}function Of(_){Xt!==null&&Xt.f&bd&&(_r===null?N_([_]):_r.push(_))}let yr=null,Dr=0,Kr=null;function Z_(_){Kr=_}let jf=1,Bu=0,Da=!1;function Nf(){return++jf}function Rl(_){var _e;var m=_.f;if((m&za)!==0)return!0;if((m&mo)!==0){var b=_.deps,M=(m&Xr)!==0;if(b!==null){var E,z,P=(m&Tu)!==0,o=M&&hi!==null&&!Da,ue=b.length;if(P||o){var re=_,ne=re.parent;for(E=0;E<ue;E++)z=b[E],(P||!((_e=z==null?void 0:z.reactions)!=null&&_e.includes(re)))&&(z.reactions??(z.reactions=[])).push(re);P&&(re.f^=Tu),o&&ne!==null&&(ne.f&Xr)===0&&(re.f^=Xr)}for(E=0;E<ue;E++)if(z=b[E],Rl(z)&&Mf(z),z.wv>_.wv)return!0}(!M||hi!==null&&!Da)&&zn(_,Rr)}return!1}function V_(_,m){for(var b=m;b!==null;){if((b.f&wu)!==0)try{b.fn(_);return}catch{b.f^=wu}b=b.parent}throw Du=!1,_}function U_(_){return(_.f&Pu)===0&&(_.parent===null||(_.parent.f&wu)===0)}function Ou(_,m,b,M){if(Du){if(b===null&&(Du=!1),U_(m))throw _;return}b!==null&&(Du=!0);{V_(_,m);return}}function Zf(_,m,b=!0){var M=_.reactions;if(M!==null)for(var E=0;E<M.length;E++){var z=M[E];_r!=null&&_r.includes(_)||((z.f&Cn)!==0?Zf(z,m,!1):m===z&&(b?zn(z,za):(z.f&Rr)!==0&&zn(z,mo),Nu(z)))}}function Vf(_){var G;var m=yr,b=Dr,M=Kr,E=Xt,z=Da,P=_r,o=Cr,ue=En,re=_.f;yr=null,Dr=0,Kr=null,Da=(re&Xr)!==0&&(En||!Ms||Xt===null),Xt=(re&(ia|fo))===0?_:null,_r=null,gf(_.ctx),En=!1,Bu++,_.f|=bd;try{var ne=(0,_.fn)(),_e=_.deps;if(yr!==null){var ae;if(ju(_,Dr),_e!==null&&Dr>0)for(_e.length=Dr+yr.length,ae=0;ae<yr.length;ae++)_e[Dr+ae]=yr[ae];else _.deps=_e=yr;if(!Da)for(ae=Dr;ae<_e.length;ae++)((G=_e[ae]).reactions??(G.reactions=[])).push(_)}else _e!==null&&Dr<_e.length&&(ju(_,Dr),_e.length=Dr);if(_f()&&Kr!==null&&!En&&_e!==null&&(_.f&(Cn|mo|za))===0)for(ae=0;ae<Kr.length;ae++)Zf(Kr[ae],_);return E!==null&&(Bu++,Kr!==null&&(M===null?M=Kr:M.push(...Kr))),ne}finally{yr=m,Dr=b,Kr=M,Xt=E,Da=z,_r=P,gf(o),En=ue,_.f^=bd}}function $_(_,m){let b=m.reactions;if(b!==null){var M=vu.call(b,_);if(M!==-1){var E=b.length-1;E===0?b=m.reactions=null:(b[M]=b[E],b.pop())}}b===null&&(m.f&Cn)!==0&&(yr===null||!yr.includes(m))&&(zn(m,mo),(m.f&(Xr|Tu))===0&&(m.f^=Tu),Sf(m),ju(m,0))}function ju(_,m){var b=_.deps;if(b!==null)for(var M=m;M<b.length;M++)$_(_,b[M])}function kd(_){var m=_.f;if((m&Pu)===0){zn(_,Rr);var b=hi,M=Cr,E=Ms;hi=_,Ms=!0;try{(m&vd)!==0?O_(_):Ef(_),kf(_);var z=Vf(_);_.teardown=typeof z=="function"?z:null,_.wv=jf;var P=_.deps,o}catch(ue){Ou(ue,_,b,M||_.ctx)}finally{Ms=E,hi=b}}}function G_(){try{__()}catch(_){if(Fu!==null)Ou(_,Fu,null);else throw _}}function Uf(){var _=Ms;try{var m=0;for(Ms=!0;zl.length>0;){m++>1e3&&G_();var b=zl,M=b.length;zl=[];for(var E=0;E<M;E++){var z=W_(b[E]);q_(z)}}}finally{Lu=!1,Ms=_,Fu=null,Il.clear()}}function q_(_){var m=_.length;if(m!==0)for(var b=0;b<m;b++){var M=_[b];if((M.f&(Pu|ra))===0)try{Rl(M)&&(kd(M),M.deps===null&&M.first===null&&M.nodes_start===null&&(M.teardown===null?Af(M):M.fn=null))}catch(E){Ou(E,M,null,M.ctx)}}}function Nu(_){Lu||(Lu=!0,queueMicrotask(Uf));for(var m=Fu=_;m.parent!==null;){m=m.parent;var b=m.f;if((b&(fo|ia))!==0){if((b&Rr)===0)return;m.f^=Rr}}zl.push(m)}function W_(_){for(var m=[],b=_;b!==null;){var M=b.f,E=(M&(ia|fo))!==0,z=E&&(M&Rr)!==0;if(!z&&(M&ra)===0){if((M&df)!==0)m.push(b);else if(E)b.f^=Rr;else{var P=Xt;try{Xt=b,Rl(b)&&kd(b)}catch(re){Ou(re,b,null,b.ctx)}finally{Xt=P}}var o=b.first;if(o!==null){b=o;continue}}var ue=b.parent;for(b=b.next;b===null&&ue!==null;)b=ue.next,ue=ue.parent}return m}function H_(_){var m;for(Ff();zl.length>0;)Lu=!0,Uf(),Ff();return m}async function X_(){await Promise.resolve(),H_()}function We(_){var m=_.f,b=(m&Cn)!==0;if(Xt!==null&&!En){if(!(_r!=null&&_r.includes(_))){var M=Xt.deps;_.rv<Bu&&(_.rv=Bu,yr===null&&M!==null&&M[Dr]===_?Dr++:yr===null?yr=[_]:(!Da||!yr.includes(_))&&yr.push(_))}}else if(b&&_.deps===null&&_.effects===null){var E=_,z=E.parent;z!==null&&(z.f&Xr)===0&&(E.f^=Xr)}return b&&(E=_,Rl(E)&&Mf(E)),Al&&Il.has(_)?Il.get(_):_.v}function Ed(_){var m=En;try{return En=!0,_()}finally{En=m}}const K_=-7169;function zn(_,m){_.f=_.f&K_|m}const Y_=["touchstart","touchmove"];function J_(_){return Y_.includes(_)}function Q_(_){var m=Xt,b=hi;An(null),Ra(null);try{return _()}finally{An(m),Ra(b)}}const ey=new Set,$f=new Set;function ty(_,m,b,M={}){function E(z){if(M.capture||Dl.call(m,z),!z.cancelBubble)return Q_(()=>b==null?void 0:b.call(this,z))}return _.startsWith("pointer")||_.startsWith("touch")||_==="wheel"?Lf(()=>{m.addEventListener(_,E,M)}):m.addEventListener(_,E,M),E}function iy(_,m,b,M,E){var z={capture:M,passive:E},P=ty(_,m,b,z);(m===document.body||m===window||m===document)&&If(()=>{m.removeEventListener(_,P,z)})}function Dl(_){var ct;var m=this,b=m.ownerDocument,M=_.type,E=((ct=_.composedPath)==null?void 0:ct.call(_))||[],z=E[0]||_.target,P=0,o=_.__root;if(o){var ue=E.indexOf(o);if(ue!==-1&&(m===document||m===window)){_.__root=m;return}var re=E.indexOf(m);if(re===-1)return;ue<=re&&(P=ue)}if(z=E[P]||_.target,z!==m){l_(_,"currentTarget",{configurable:!0,get(){return z||b}});var ne=Xt,_e=hi;An(null),Ra(null);try{for(var ae,G=[];z!==null;){var ve=z.assignedSlot||z.parentNode||z.host||null;try{var Oe=z["__"+M];if(Oe!=null&&(!z.disabled||_.target===z))if(Ai(Oe)){var[Ke,...Qe]=Oe;Ke.apply(z,[_,...Qe])}else Oe.call(z,_)}catch(gt){ae?G.push(gt):ae=gt}if(_.cancelBubble||ve===m||ve===null)break;z=ve}if(ae){for(let gt of G)queueMicrotask(()=>{throw gt});throw ae}}finally{_.__root=m,delete _.currentTarget,An(ne),Ra(_e)}}}function Gf(_){var m=document.createElement("template");return m.innerHTML=_,m.content}function qf(_,m){var b=hi;b.nodes_start===null&&(b.nodes_start=_,b.nodes_end=m)}function Ll(_,m){var b=(m&P_)!==0,M,E=!_.startsWith("<!>");return()=>{M===void 0&&(M=Gf(E?_:"<!>"+_),M=Td(M));var z=b||bf?document.importNode(M,!0):M.cloneNode(!0);return qf(z,z),z}}function Fl(_,m){_!==null&&_.before(m)}function ry(_,m){return ny(_,m)}const xo=new Map;function ny(_,{target:m,anchor:b,props:M={},events:E,context:z,intro:P=!0}){E_();var o=new Set,ue=_e=>{for(var ae=0;ae<_e.length;ae++){var G=_e[ae];if(!o.has(G)){o.add(G);var ve=J_(G);m.addEventListener(G,Dl,{passive:ve});var Oe=xo.get(G);Oe===void 0?(document.addEventListener(G,Dl,{passive:ve}),xo.set(G,1)):xo.set(G,Oe+1)}}};ue(xd(ey)),$f.add(ue);var re=void 0,ne=B_(()=>{var _e=b??m.appendChild(Pf());return Ss(()=>{if(z){Cu({});var ae=Cr;ae.c=z}E&&(M.$$events=E),re=_(_e,M)||{},z&&ku()}),()=>{var ve;for(var ae of o){m.removeEventListener(ae,Dl);var G=xo.get(ae);--G===0?(document.removeEventListener(ae,Dl),xo.delete(ae)):xo.set(ae,G)}$f.delete(ue),_e!==b&&((ve=_e.parentNode)==null||ve.removeChild(_e))}});return Ad.set(re,ne),re}let Ad=new WeakMap;function ay(_,m){const b=Ad.get(_);return b?(Ad.delete(_),b(m)):Promise.resolve()}function Wf(_,m,[b,M]=[0,0]){var E=_,z=null,P=null,o=Ir,ue=b>0?Su:0,re=!1;const ne=(ae,G=!0)=>{re=!0,_e(G,ae)},_e=(ae,G)=>{o!==(o=ae)&&(o?(z?Ru(z):G&&(z=Ss(()=>G(E))),P&&zu(P,()=>{P=null})):(P?Ru(P):G&&(P=Ss(()=>G(E,[b+1,M]))),z&&zu(z,()=>{z=null})))};kl(()=>{re=!1,m(ne),re||_e(null,null)},ue)}function sy(_,m){return m}function oy(_,m,b,M){for(var E=[],z=m.length,P=0;P<z;P++)Id(m[P].e,E,!0);var o=z>0&&E.length===0&&b!==null;if(o){var ue=b.parentNode;A_(ue),ue.append(b),M.clear(),La(_,m[0].prev,m[z-1].next)}zf(E,()=>{for(var re=0;re<z;re++){var ne=m[re];o||(M.delete(ne.k),La(_,ne.prev,ne.next)),kn(ne.e,!o)}})}function ly(_,m,b,M,E,z=null){var P=_,o={flags:m,items:new Map,first:null};{var ue=_;P=ue.appendChild(Pf())}var re=null,ne=!1,_e=z_(()=>{var ae=b();return Ai(ae)?ae:ae==null?[]:xd(ae)});kl(()=>{var ae=We(_e),G=ae.length;ne&&G===0||(ne=G===0,cy(ae,o,P,E,m,M,b),z!==null&&(G===0?re?Ru(re):re=Ss(()=>z(P)):re!==null&&zu(re,()=>{re=null})),We(_e))})}function cy(_,m,b,M,E,z,P){var o=_.length,ue=m.items,re=m.first,ne=re,_e,ae=null,G=[],ve=[],Oe,Ke,Qe,ct;for(ct=0;ct<o;ct+=1){if(Oe=_[ct],Ke=z(Oe,ct),Qe=ue.get(Ke),Qe===void 0){var gt=ne?ne.e.nodes_start:b;ae=hy(gt,m,ae,ae===null?m.first:ae.next,Oe,Ke,ct,M,E,P),ue.set(Ke,ae),G=[],ve=[],ne=ae.next;continue}if(uy(Qe,Oe,ct),(Qe.e.f&ra)!==0&&Ru(Qe.e),Qe!==ne){if(_e!==void 0&&_e.has(Qe)){if(G.length<ve.length){var pt=ve[0],Mt;ae=pt.prev;var kt=G[0],Et=G[G.length-1];for(Mt=0;Mt<G.length;Mt+=1)Hf(G[Mt],pt,b);for(Mt=0;Mt<ve.length;Mt+=1)_e.delete(ve[Mt]);La(m,kt.prev,Et.next),La(m,ae,kt),La(m,Et,pt),ne=pt,ae=Et,ct-=1,G=[],ve=[]}else _e.delete(Qe),Hf(Qe,ne,b),La(m,Qe.prev,Qe.next),La(m,Qe,ae===null?m.first:ae.next),La(m,ae,Qe),ae=Qe;continue}for(G=[],ve=[];ne!==null&&ne.k!==Ke;)(ne.e.f&ra)===0&&(_e??(_e=new Set)).add(ne),ve.push(ne),ne=ne.next;if(ne===null)continue;Qe=ne}G.push(Qe),ae=Qe,ne=Qe.next}if(ne!==null||_e!==void 0){for(var wt=_e===void 0?[]:xd(_e);ne!==null;)(ne.e.f&ra)===0&&wt.push(ne),ne=ne.next;var Mi=wt.length;if(Mi>0){var Wi=o===0?b:null;oy(m,wt,Wi,ue)}}hi.first=m.first&&m.first.e,hi.last=ae&&ae.e}function uy(_,m,b,M){xf(_.v,m),_.i=b}function hy(_,m,b,M,E,z,P,o,ue,re){var ne=(ue&b_)!==0,_e=(ue&T_)===0,ae=ne?_e?C_(E):go(E):E,G=(ue&w_)===0?P:go(P),ve={i:G,v:ae,k:z,a:null,e:null,prev:b,next:M};try{return ve.e=Ss(()=>o(_,ae,G,re),k_),ve.e.prev=b&&b.e,ve.e.next=M&&M.e,b===null?m.first=ve:(b.next=ve,b.e.next=ve.e),M!==null&&(M.prev=ve,M.e.prev=ve.e),ve}finally{}}function Hf(_,m,b){for(var M=_.next?_.next.e.nodes_start:b,E=m?m.e.nodes_start:b,z=_.e.nodes_start;z!==M;){var P=Pd(z);E.before(z),z=P}}function La(_,m,b){m===null?_.first=b:(m.next=b,m.e.next=b&&b.e),b!==null&&(b.prev=m,b.e.prev=m&&m.e)}function dy(_,m,b,M,E){var z=_,P="",o;kl(()=>{P!==(P=m()??"")&&(o!==void 0&&(kn(o),o=void 0),P!==""&&(o=Ss(()=>{var ue=P+"",re=Gf(ue);qf(Td(re),re.lastChild),z.before(re)})))})}function py(_,m,...b){var M=_,E=u_,z;kl(()=>{E!==(E=m())&&(z&&(kn(z),z=null),z=Ss(()=>E(M,...b)))},Su)}const Xf=[...`
2
- \r\f \v\uFEFF`];function fy(_,m,b){var M=_==null?"":""+_;if(b){for(var E in b)if(b[E])M=M?M+" "+E:E;else if(M.length)for(var z=E.length,P=0;(P=M.indexOf(E,P))>=0;){var o=P+z;(P===0||Xf.includes(M[P-1]))&&(o===M.length||Xf.includes(M[o]))?M=(P===0?"":M.substring(0,P))+M.substring(o+1):P=o}}return M===""?null:M}function Kf(_,m=!1){var b=m?" !important;":";",M="";for(var E in _){var z=_[E];z!=null&&z!==""&&(M+=" "+E+": "+z+b)}return M}function zd(_){return _[0]!=="-"||_[1]!=="-"?_.toLowerCase():_}function my(_,m){if(m){var b="",M,E;if(Array.isArray(m)?(M=m[0],E=m[1]):M=m,_){_=String(_).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var z=!1,P=0,o=!1,ue=[];M&&ue.push(...Object.keys(M).map(zd)),E&&ue.push(...Object.keys(E).map(zd));var re=0,ne=-1;const Oe=_.length;for(var _e=0;_e<Oe;_e++){var ae=_[_e];if(o?ae==="/"&&_[_e-1]==="*"&&(o=!1):z?z===ae&&(z=!1):ae==="/"&&_[_e+1]==="*"?o=!0:ae==='"'||ae==="'"?z=ae:ae==="("?P++:ae===")"&&P--,!o&&z===!1&&P===0){if(ae===":"&&ne===-1)ne=_e;else if(ae===";"||_e===Oe-1){if(ne!==-1){var G=zd(_.substring(re,ne).trim());if(!ue.includes(G)){ae!==";"&&_e++;var ve=_.substring(re,_e).trim();b+=" "+ve+";"}}re=_e+1,ne=-1}}}}return M&&(b+=Kf(M)),E&&(b+=Kf(E,!0)),b=b.trim(),b===""?null:b}return _==null?null:String(_)}function Yf(_,m,b,M,E,z){var P=_.__className;if(P!==b||P===void 0){var o=fy(b,M,z);o==null?_.removeAttribute("class"):_.className=o,_.__className=b}else if(z&&E!==z)for(var ue in z){var re=!!z[ue];(E==null||re!==!!E[ue])&&_.classList.toggle(ue,re)}return z}function Rd(_,m={},b,M){for(var E in b){var z=b[E];m[E]!==z&&(b[E]==null?_.style.removeProperty(E):_.style.setProperty(E,z,M))}}function vo(_,m,b,M){var E=_.__style;if(E!==m){var z=my(m,M);z==null?_.removeAttribute("style"):_.style.cssText=z,_.__style=m}else M&&(Array.isArray(M)?(Rd(_,b==null?void 0:b[0],M[0]),Rd(_,b==null?void 0:b[1],M[1],"important")):Rd(_,b,M));return M}const gy=()=>performance.now(),Rn={tick:_=>requestAnimationFrame(_),now:()=>gy(),tasks:new Set};function Jf(){const _=Rn.now();Rn.tasks.forEach(m=>{m.c(_)||(Rn.tasks.delete(m),m.f())}),Rn.tasks.size!==0&&Rn.tick(Jf)}function _y(_){let m;return Rn.tasks.size===0&&Rn.tick(Jf),{promise:new Promise(b=>{Rn.tasks.add(m={c:_,f:b})}),abort(){Rn.tasks.delete(m)}}}const th=class th{constructor(m){Mr(this,eh);Mr(this,Na,new WeakMap);Mr(this,ko);Mr(this,ec);xu(this,ec,m)}observe(m,b){var M=Vt(this,Na).get(m)||new Set;return M.add(b),Vt(this,Na).set(m,M),a_(this,eh,s_).call(this).observe(m,Vt(this,ec)),()=>{var E=Vt(this,Na).get(m);E.delete(b),E.size===0&&(Vt(this,Na).delete(m),Vt(this,ko).unobserve(m))}}};Na=new WeakMap,ko=new WeakMap,ec=new WeakMap,eh=new WeakSet,s_=function(){return Vt(this,ko)??xu(this,ko,new ResizeObserver(m=>{for(var b of m){th.entries.set(b.target,b);for(var M of Vt(this,Na).get(b.target)||[])M(b)}}))},ta(th,"entries",new WeakMap);let Dd=th;var yy=new Dd({box:"border-box"});function Qf(_,m,b){var M=yy.observe(_,()=>b(_[m]));Au(()=>(Ed(()=>b(_[m])),M))}function em(_,m){return _===m||(_==null?void 0:_[Mu])===m}function bo(_={},m,b,M){return Au(()=>{var E,z;return Cf(()=>{E=z,z=(M==null?void 0:M())||[],Ed(()=>{_!==b(...z)&&(m(_,...z),E&&em(b(...E),_)&&m(null,...E))})}),()=>{Lf(()=>{z&&em(b(...z),_)&&m(null,...z)})}}),_}function tm(_){Cr===null&&I_(),yo(()=>{const m=Ed(_);if(typeof m=="function")return m})}const xy="5";typeof window<"u"&&((bm=window.__svelte??(window.__svelte={})).v??(bm.v=new Set)).add(xy);function im(_){return Object.prototype.toString.call(_)==="[object Date]"}function vy(_){return _}function by(_){return-.5*(Math.cos(Math.PI*_)-1)}function Ld(_,m){if(_===m||_!==_)return()=>_;const b=typeof _;if(b!==typeof m||Array.isArray(_)!==Array.isArray(m))throw new Error("Cannot interpolate values of different type");if(Array.isArray(_)){const M=m.map((E,z)=>Ld(_[z],E));return E=>M.map(z=>z(E))}if(b==="object"){if(!_||!m)throw new Error("Object cannot be null");if(im(_)&&im(m)){const z=_.getTime(),o=m.getTime()-z;return ue=>new Date(z+ue*o)}const M=Object.keys(m),E={};return M.forEach(z=>{E[z]=Ld(_[z],m[z])}),z=>{const P={};return M.forEach(o=>{P[o]=E[o](z)}),P}}if(b==="number"){const M=m-_;return E=>_+E*M}return()=>m}const qd=class qd{constructor(m,b={}){Mr(this,la,go(void 0));Mr(this,Eo,go(void 0));Mr(this,tc);Mr(this,zs,null);Vt(this,la).v=Vt(this,Eo).v=m,xu(this,tc,b)}static of(m,b){const M=new qd(m(),b);return Cf(()=>{M.set(m())}),M}set(m,b){var _e;ti(Vt(this,Eo),m);let{delay:M=0,duration:E=400,easing:z=vy,interpolate:P=Ld}={...Vt(this,tc),...b};if(E===0)return(_e=Vt(this,zs))==null||_e.abort(),ti(Vt(this,la),m),Promise.resolve();const o=Rn.now()+M;let ue,re=!1,ne=Vt(this,zs);return xu(this,zs,_y(ae=>{if(ae<o)return!0;if(!re){re=!0;const ve=Vt(this,la).v;ue=P(ve,m),typeof E=="function"&&(E=E(ve,m)),ne==null||ne.abort()}const G=ae-o;return G>E?(ti(Vt(this,la),m),!1):(ti(Vt(this,la),ue(z(G/E))),!0)})),Vt(this,zs).promise}get current(){return We(Vt(this,la))}get target(){return We(Vt(this,Eo))}set target(m){this.set(m)}};la=new WeakMap,Eo=new WeakMap,tc=new WeakMap,zs=new WeakMap;let Fd=qd;function Bd(_,m,b){const M=b*(Math.PI/180),E=_/2,z=m/2,P=Math.sqrt(E*E+z*z),o=Math.atan(z/E)*(180/Math.PI),ue=o,re=180-o,ne=180+o,_e=360-o;switch(!0){case(ue<=b&&b<=re):return{offsetX:P*Math.cos(M)-E,offsetY:0};case(re<=b&&b<=ne):return{offsetX:-_,offsetY:P*Math.sin(M)-z};case(ne<=b&&b<=_e):return{offsetX:P*Math.cos(M)-E,offsetY:-m};default:return{offsetX:0,offsetY:P*Math.sin(M)-z}}}function wy(_,m,b){const M=Bd(_,m,b),E=M.offsetX,z=M.offsetY,P=m,o=_,ue=Bd(P,o,b),re=P/2+ue.offsetX,ne=o/2+ue.offsetY,ae=Math.atan2(ne,re)/Math.PI*180-45,G=0,ve=30,Oe=E+_/2,Ke=z+m/2,Qe=Math.sqrt(Oe*Oe+Ke*Ke),ct=Math.min(_,m)/2,gt=Math.sqrt(_*_+m*m)/2,pt=(Qe-ct)/(gt-ct),Mt=G+pt*(ve-G);return{markerOffsetX:E,markerOffsetY:z,pinAngleDeg:ae,pinSkewDeg:Mt}}const Zu=512,wo=0,Bl=18,rm=3,Od=.5,Vu=270,Uu=8;var Ty=Ll('<div><div class="pin svelte-dfr45b"></div> <div class="marker svelte-dfr45b"><div class="bubble svelte-dfr45b"><div class="body svelte-dfr45b"><!></div></div></div></div>');function Py(_,m){Cu(m,!0);let b=vi(!0),M=vi(!1);function E(ut){ti(b,ut,!0)}function z(ut){ti(M,!ut)}function P(){return!We(M)}let o=Vu,ue=Vu,re=new Fd(Vu,{easing:by,interpolate:_e}),ne=!1;yo(()=>{We(M)&&(re.set(o,{duration:0}),ue=o,ct(ue))}),yo(()=>{ue=re.current});function _e(ut,Yt){if(Math.abs(Yt-ut)<180)return Jt=>ut+Jt*(Yt-ut);{const Jt=360-Math.abs(Yt-ut),cr=ut<Yt?-1:1;return Dt=>(360+ut+Dt*Jt*cr)%360}}function ae(){o!=ue&&(ct(ue),window.requestAnimationFrame(ae))}function G(ut){ut!=o&&(o=ut,ne?(re.set(ut,{duration:400}),window.requestAnimationFrame(ae)):(re.set(ut,{duration:0}),ue=ut,ct(ue))),ne=!0}let ve=vi(0),Oe=vi(0),Ke,Qe;yo(()=>{We(ve)&&We(Oe)&&(Qe.style.width=`${Math.min(We(ve),We(Oe))/4}px`,Qe.style.height=`${Math.min(We(ve),We(Oe))/4}px`)}),yo(()=>{We(ve)&&We(Oe)&&ct(ue)});function ct(ut){const Yt=wy(We(ve),We(Oe),ut),Jt=Math.round(Yt.markerOffsetX),cr=Math.round(Yt.markerOffsetY);Ke.style.transform=`translate(${Jt}px, ${cr}px)`;const Dt=Yt.pinAngleDeg,vr=Yt.pinSkewDeg;Qe.style.transform=`rotate(${Dt}deg) skew(${vr}deg, ${vr}deg)`}const gt=()=>We(ve),pt=()=>We(Oe);var Mt=Ty();let kt;var Et=Ps(Mt);bo(Et,ut=>Qe=ut,()=>Qe);var wt=Sd(Et,2);vo(wt,"",{},{padding:Uu+"px"});var Mi=Ps(wt),Wi=Ps(Mi);vo(Wi,"",{},{padding:Uu+"px"});var Hi=Ps(Wi);return py(Hi,()=>m.children),bo(wt,ut=>Ke=ut,()=>Ke),Cl(ut=>kt=Yf(Mt,1,"anchor svelte-dfr45b",null,kt,ut),[()=>({collapsed:We(b),hidden:We(M)})]),Qf(wt,"clientWidth",ut=>ti(ve,ut)),Qf(wt,"clientHeight",ut=>ti(Oe,ut)),Fl(_,Mt),ku({setCollapsed:E,setDisplayed:z,getDisplayed:P,setAngle:G,getWidth:gt,getHeight:pt})}var Sy=Ll("<div></div>");function My(_,m){Cu(m,!0);let b=vi(!0),M=vi(0),E=Eu(()=>1-.5*We(M)),z=Eu(()=>We(b)?"":`scale(${We(E)})`),P=Eu(()=>We(b)?"":`brightness(${We(E)})`),o=Eu(()=>We(b)||We(M)>0?"":"pulsing");function ue(G){ti(b,G,!0)}function re(G){ti(M,Math.max(0,Math.min(1,G)),!0)}var ne=Sy();let _e,ae;return Cl(G=>{_e=Yf(ne,1,"circle svelte-13nhxs0",null,_e,G),ae=vo(ne,"",ae,{transform:We(z),filter:We(P)})},[()=>({collapsed:We(b),pulsing:We(o)})]),Fl(_,ne),ku({setCollapsed:ue,setDistance:re})}function Iy(_,m){return!(_.x-_.left>m.x+m.right||_.x+_.right<m.x-m.left||_.y-_.top>m.y+m.bottom||_.y+_.bottom<m.y-m.top)}function Cy(_,m){let b=Math.abs(_.x-m.x),E=(_.x<m.x?_.right+m.left:_.left+m.right)/b,z=Math.abs(_.y-m.y),o=(_.y<m.y?_.bottom+m.top:_.top+m.bottom)/z,ue=Math.min(E,o);return Math.log2(ue)}function ky(_,m,b){let{offsetX:M,offsetY:E}=Bd(_.width,_.height,m),z=-M,P=_.width-z,o=-E,ue=_.height-o;return{x:_.x,y:_.y,left:z/b,right:P/b,top:o/b,bottom:ue/b}}var on;(_=>{let m;(P=>{P.COUNT=12,P.DEFAULT=Vu,P.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330],P.RADIANS=P.DEGREES.map(re=>re*Math.PI/180);function o(re,ne){const _e=Math.abs(ne/re);return _e<1?_e<.26795?0:1:_e<3.73205?2:3}function ue(re,ne){const _e=o(re,ne);return re>0?ne>0?0+_e:(12-_e)%12:ne>0?6-_e:6+_e}P.getAngleIndex=ue})(m=_.Angles||(_.Angles={}));function b(P,o){const re=Math.min(P.width,P.height)/2/o;return m.RADIANS.map(ne=>({x:P.x+re*Math.cos(ne),y:P.y+re*Math.sin(ne)}))}_.getPoints=b;function M(P){const o=new Array(P.length),ue=E(P);for(let _e=0;_e<P.length;_e++){const G=P[_e].center,ve=G.x-ue.x,Oe=G.y-ue.y;o[_e]=m.getAngleIndex(ve,Oe)}let re=!1,ne=new Set;for(;!re;){re=!0;for(let ae=0;ae<P.length;ae++){const G=P[ae],ve=o[ae],Oe=G.points[z(ve,-1)],Ke=G.points[ve],Qe=G.points[z(ve,1)];let ct=0,gt=0,pt=0;for(let kt=0;kt<P.length;kt++){if(ae===kt)continue;const Et=P[kt],wt=o[ae],Mi=Et.points[wt],Wi=Oe.x-Mi.x,Hi=Oe.y-Mi.y;ct+=1/(Wi*Wi+Hi*Hi);const ut=Ke.x-Mi.x,Yt=Ke.y-Mi.y;gt+=1/(ut*ut+Yt*Yt);const Jt=Qe.x-Mi.x,cr=Qe.y-Mi.y;pt+=1/(Jt*Jt+cr*cr)}let Mt=0;ct<gt&&ct<pt&&(Mt=-1),pt<gt&&pt<ct&&(Mt=1),o[ae]=z(ve,Mt),Mt!==0&&(re=!1)}const _e=o.join("-");if(ne.has(_e))break;ne.add(_e)}return o}_.updatePointIndexes=M;function E(P){if((P==null?void 0:P.length)===0)return{x:0,y:0};let o=0,ue=0;for(const re of P)o+=re.center.x,ue+=re.center.y;return o/=P.length,ue/=P.length,{x:o,y:ue}}function z(P,o){return o==0?P:((P+o)%m.COUNT+m.COUNT)%m.COUNT}})(on||(on={}));var Dn;(_=>{function m(ne){let _e=new Array(ne.length);for(let ae=0;ae<ne.length;ae++){const G=ne[ae];_e[ae]={marker:G,expanded:!0,angle:on.Angles.DEFAULT,particle:{center:{x:G.x,y:G.y},points:on.getPoints(G,1)}}}return _e}_.createNodes=m;function b(ne){const _e=new Array,ae=new Array(ne.length);for(let G=0;G<ne.length;G++){const Oe=ne[G].marker;ae[G]={x:Oe.x,y:Oe.y,left:Oe.width,right:Oe.width,top:Oe.height,bottom:Oe.height}}for(let G=0;G<ne.length;G++){const ve=ne[G],Oe=ae[G];for(let Ke=G+1;Ke<ne.length;Ke++){const Qe=ne[Ke],ct=ae[Ke],gt=Cy(Oe,ct);_e.push({zwt:gt,node1:ve,node2:Qe})}}return _e}_.createConnections=b;function M(ne){const _e=new Array;for(let ae=Is.MIN;ae<=Is.MAX;ae=Is.addSteps(ae,1))_e.push({zoom:ae,connections:[]});for(let ae=0;ae<ne.length;ae++){const G=ne[ae],ve=G.zwt;for(let Oe=0;Oe<_e.length;Oe++){const Ke=_e[Oe];if(ve<=Ke.zoom)break;Ke.connections.push(G)}}return _e}_.createLayers=M;function E(ne,_e){const ae=ne.find(G=>G.zoom==_e);if(!ae)throw new Error("Layer not found");return ae.connections.filter(G=>G.node1.expanded&&G.node2.expanded)}_.getExpandedConnections=E;function z(ne){const _e=new Array;for(let ae=0;ae<ne.length;ae++){const G=ne[ae],ve=G.node1,Oe=G.node2;let Ke,Qe;for(let gt=0;gt<_e.length;gt++){const pt=_e[gt];pt.has(ve)&&(Ke=pt),pt.has(Oe)&&(Qe=pt)}if(Ke!=null&&Qe!=null){Ke!=Qe&&(Qe.forEach(gt=>Ke.add(gt)),_e.splice(_e.indexOf(Qe),1));continue}if(Ke!=null&&Qe==null){Oe.expanded&&Ke.add(Oe);continue}if(Ke==null&&Qe!=null){ve.expanded&&Qe.add(ve);continue}const ct=new Set;ve.expanded&&ct.add(ve),Oe.expanded&&ct.add(Oe),_e.push(ct)}return _e}_.getNodeGraphs=z;function P(ne){return ne.length==1?[on.Angles.DEFAULT]:on.updatePointIndexes(ne.map(G=>G.particle)).map(G=>on.Angles.DEGREES[G])}_.getAngles=P;function o(ne,_e){const ae=new Array,G=new Array(ne.length);for(let Ke=0;Ke<ne.length;Ke++){const Qe=ne[Ke],ct=ky(Qe.marker,Qe.angle,_e);G[Ke]=ct;for(let gt=0;gt<Ke;gt++){const pt=G[gt];if(Iy(pt,ct)){const Mt=ne[gt];ae[Ke]==null?ae[Ke]=[Mt]:ae[Ke].push(Mt),ae[gt]==null?ae[gt]=[Qe]:ae[gt].push(Qe)}}}let ve=-1,Oe=0;for(let Ke=0;Ke<ae.length;Ke++){const Qe=ne[Ke],ct=ae[Ke];if(ct==null)continue;const gt=ct.reduce((pt,Mt)=>pt+(Mt.marker.rank-Qe.marker.rank),0);(ve==null||gt>Oe)&&(ve=Ke,Oe=gt)}return ve}_.getOverlapingNodeIndex=o;function ue(ne,_e){for(let ae=0;ae<ne.length;ae++){const G=ne[ae];G.particle.points=on.getPoints(G.marker,_e)}}_.updateNodeParticles=ue;function re(ne){if(ne.length==1){ne[0].angle=on.Angles.DEFAULT;return}const _e=on.updatePointIndexes(ne.map(ae=>ae.particle));for(let ae=0;ae<ne.length;ae++){const G=ne[ae];G.angle=on.Angles.DEGREES[_e[ae]]}}_.updateNodeAngles=re})(Dn||(Dn={}));var Is;(_=>{_.MIN=wo,_.MAX=Bl,_.SCALE=10,_.STEP=1/_.SCALE;function m(b,M){return Math.round((b+M*_.STEP)*_.SCALE)/_.SCALE}_.addSteps=m})(Is||(Is={}));var $u;(_=>{function m(b,M){return{zoom:M,ids:b.map(E=>E.marker.id),angles:b.map(E=>({id:E.marker.id,value:E.angle}))}}_.createEvent=m})($u||($u={}));function Ey(_){var o;let m=new Array;const b=Dn.createNodes(_),M=Dn.createConnections(b),E=Dn.createLayers(M),z=((o=E.at(-1))==null?void 0:o.zoom)??Bl,P=wo;m.push($u.createEvent(b,Is.addSteps(z,1)));for(let ue=z;ue>=P;ue=Is.addSteps(ue,-1)){const re=Math.pow(2,ue),ne=Dn.getExpandedConnections(E,ue),_e=Dn.getNodeGraphs(ne);for(let G=0;G<_e.length;G++){let ve=Array.from(_e[G]).toSorted((Oe,Ke)=>Oe.marker.rank-Ke.marker.rank);for(Dn.updateNodeParticles(ve,re);ve.length>1;){Dn.updateNodeAngles(ve);let Oe=Dn.getOverlapingNodeIndex(ve,re);if(Oe==-1)break;ve[Oe].expanded=!1,ve.splice(Oe,1)}}const ae=b.filter(G=>G.expanded);m.push($u.createEvent(ae,ue))}return m.reverse()}function Ay(_,m){let b=Math.sin(_*Math.PI/180);return b=Math.min(Math.max(b,-.9999),.9999),{x:Zu*(.5+m/360),y:Zu*(.5-Math.log((1+b)/(1-b))/(4*Math.PI))}}const zy=64;function nm(_,m){if(m==1)return 1;let b=(Bl-wo)/m,M=1/3*(Math.pow(4,b)-1);return Math.ceil(_/M)>zy?nm(_,Math.round(m/2)):m}function Ry(_){const m=_.map(G=>Ay(G.lat,G.lng)),b=_.map((G,ve)=>({id:G.id,x:m[ve].x,y:m[ve].y,width:G.width+4*Uu,height:G.height+4*Uu,rank:_.length-G.index})),M=Ey(b),E=_.map(G=>({id:G.id,lat:G.lat,lng:G.lng,width:G.width,height:G.height,zet:NaN,angs:[]})),z=new Map(E.map(G=>[G.id,G]));for(const G of M){for(const ve of G.ids){if(!ve)throw new Error("Marker id is not valid");const Oe=z.get(ve);if(!Oe)throw new Error("Marker not found");isNaN(Oe.zet)&&(Oe.zet=G.zoom)}for(const ve of G.angles){if(!ve.id)throw new Error("Marker angle id is not valid");if(ve.value==null||ve.value==null)throw new Error("Marker angle val is not valid");const Oe=z.get(ve.id);if(!Oe)throw new Error("Marker not found");(Oe.angs.length==0||Oe.angs[Oe.angs.length-1][1]!=ve.value)&&Oe.angs.push([G.zoom,ve.value])}}for(const G of E){if(isNaN(G.zet))throw new Error("Marker zet is NaN");if(G.angs.length==0)throw new Error("Marker angs is empty")}const P=new Array,o=wo,ue=nm(E.length,Bl-wo),re=-90,ne=90,_e=-180,ae=180;for(const G of E){let ve=P.filter(Oe=>Oe.zs<=G.zet&&G.zet<=Oe.ze).find(Oe=>Oe.sw.lat<=G.lat&&G.lat<=Oe.ne.lat&&Oe.sw.lng<=G.lng&&G.lng<=Oe.ne.lng);if(ve===void 0){const Oe=o+Math.floor((G.zet-o)/ue)*ue,Ke=Math.floor(Oe+ue),Qe=Math.floor((Oe-o)/ue),ct=Math.pow(2,Qe),gt=(ne-re)/ct,pt=(ae-_e)/ct,Mt=Math.floor((G.lat-re)/(ne-re)*ct),kt=Math.floor((G.lng-_e)/(ae-_e)*ct),Et=re+Mt*gt,wt=_e+kt*pt,Mi=Et+gt,Wi=wt+pt;ve={id:`${Qe}_${Mt}_${kt}`,sw:{lat:Et,lng:wt},ne:{lat:Mi,lng:Wi},zs:Oe,ze:Ke,markers:[]},P.push(ve)}ve.markers.push(G)}return P}class Dy{constructor(m){ta(this,"block");ta(this,"loaded");this.block=m,this.loaded=!1}}async function Ly(_){const m=performance.now(),b=await Ry(_);return console.log("getBlocks",performance.now()-m),b}function Fy(_){return _&&_.__esModule&&Object.prototype.hasOwnProperty.call(_,"default")?_.default:_}var Gu={exports:{}};/**
3
- * MapLibre GL JS
4
- * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.3.0/LICENSE.txt
5
- */var By=Gu.exports,am;function Oy(){return am||(am=1,function(_,m){(function(b,M){_.exports=M()})(By,function(){var b={},M={};function E(P,o,ue){if(M[P]=ue,P==="index"){var re="var sharedModule = {}; ("+M.shared+")(sharedModule); ("+M.worker+")(sharedModule);",ne={};return M.shared(ne),M.index(b,ne),typeof window<"u"&&b.setWorkerUrl(window.URL.createObjectURL(new Blob([re],{type:"text/javascript"}))),b}}E("shared",["exports"],function(P){function o(r,t,n,a){return new(n||(n=Promise))(function(c,d){function p(w){try{x(a.next(w))}catch(S){d(S)}}function g(w){try{x(a.throw(w))}catch(S){d(S)}}function x(w){var S;w.done?c(w.value):(S=w.value,S instanceof n?S:new n(function(I){I(S)})).then(p,g)}x((a=a.apply(r,t||[])).next())})}function ue(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var re,ne;function _e(){if(ne)return re;function r(t,n){this.x=t,this.y=n}return ne=1,re=r,r.prototype={clone:function(){return new r(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,n){return this.clone()._rotateAround(t,n)},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 n=t.x-this.x,a=t.y-this.y;return n*n+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,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},_matMult:function(t){var n=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=n,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 n=Math.cos(t),a=Math.sin(t),c=a*this.x+n*this.y;return this.x=n*this.x-a*this.y,this.y=c,this},_rotateAround:function(t,n){var a=Math.cos(t),c=Math.sin(t),d=n.y+c*(this.x-n.x)+a*(this.y-n.y);return this.x=n.x+a*(this.x-n.x)-c*(this.y-n.y),this.y=d,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t},re}typeof SuppressedError=="function"&&SuppressedError;var ae,G,ve=ue(_e()),Oe=function(){if(G)return ae;function r(t,n,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(c-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=a,this.p2y=c}return G=1,ae=r,r.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,n){if(n===void 0&&(n=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)<n)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var g=0,x=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<n));c++)t>d?g=a:x=a,a=.5*(x-g)+g;return a},solve:function(t,n){return this.sampleCurveY(this.solveCurveX(t,n))}},ae}(),Ke=ue(Oe);let Qe,ct;function gt(){return Qe==null&&(Qe=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Qe}function pt(){if(ct==null&&(ct=!1,gt())){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 n=t.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&n[a]!==a){ct=!0;break}}}return ct||!1}var Mt,kt=1e-6,Et=typeof Float32Array<"u"?Float32Array:Array;function wt(){var r=new Et(9);return Et!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function Mi(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Wi(){var r=new Et(3);return Et!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Hi(r,t,n){var a=new Et(3);return a[0]=r,a[1]=t,a[2]=n,a}function ut(r,t,n){var a=t[0],c=t[1],d=t[2],p=t[3];return r[0]=n[0]*a+n[4]*c+n[8]*d+n[12]*p,r[1]=n[1]*a+n[5]*c+n[9]*d+n[13]*p,r[2]=n[2]*a+n[6]*c+n[10]*d+n[14]*p,r[3]=n[3]*a+n[7]*c+n[11]*d+n[15]*p,r}function Yt(){var r=new Et(4);return Et!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Jt(){var r=new Et(2);return Et!=Float32Array&&(r[0]=0,r[1]=0),r}function cr(r,t){var n=new Et(2);return n[0]=r,n[1]=t,n}Math.hypot||(Math.hypot=function(){for(var r=0,t=arguments.length;t--;)r+=arguments[t]*arguments[t];return Math.sqrt(r)}),Wi(),Mt=new Et(4),Et!=Float32Array&&(Mt[0]=0,Mt[1]=0,Mt[2]=0,Mt[3]=0),Wi(),Hi(1,0,0),Hi(0,1,0),Yt(),Yt(),wt(),Jt();const Dt=8192;function vr(r,t,n){return t*(Dt/(r.tileSize*Math.pow(2,n-r.tileID.overscaledZ)))}function Fr(r,t){return(r%t+t)%t}function hn(r,t,n){return r*(1-n)+t*n}function lt(r){if(r<=0)return 0;if(r>=1)return 1;const t=r*r,n=t*r;return 4*(r<.5?n:3*(r-t)+n-.75)}function qt(r,t,n,a){const c=new Ke(r,t,n,a);return d=>c.solve(d)}const Ii=qt(.25,.1,.25,1);function li(r,t,n){return Math.min(n,Math.max(t,r))}function $t(r,t,n){const a=n-t,c=((r-t)%a+a)%a+t;return c===t?n:c}function ft(r,...t){for(const n of t)for(const a in n)r[a]=n[a];return r}let Qt=1;function Tt(r,t,n){const a={};for(const c in r)a[c]=t.call(this,r[c],c,r);return a}function Pt(r,t,n){const a={};for(const c in r)t.call(this,r[c],c,r)&&(a[c]=r[c]);return a}function rt(r){return Array.isArray(r)?r.map(rt):typeof r=="object"&&r?Tt(r,rt):r}const fi={};function bi(r){fi[r]||(typeof console<"u"&&console.warn(r),fi[r]=!0)}function Ci(r,t,n){return(n.y-r.y)*(t.x-r.x)>(t.y-r.y)*(n.x-r.x)}function dn(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let wi=null;function ca(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const ua="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Br(r,t,n,a,c){return o(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(r,{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 g=p.startsWith("BGR"),x=new Uint8ClampedArray(a*c*4);if(yield d.copyTo(x,function(w,S,I,R,L){const B=4*Math.max(1,0),j=(Math.max(0,I)-I)*R*4+B,$=4*R,X=Math.max(0,S),oe=Math.max(0,I);return{rect:{x:X,y:oe,width:Math.min(w.width,S+R)-X,height:Math.min(w.height,I+L)-oe},layout:[{offset:j,stride:$}]}}(r,t,n,a,c)),g)for(let w=0;w<x.length;w+=4){const S=x[w];x[w]=x[w+2],x[w+2]=S}return x}finally{d.close()}})}let On,jn;function Or(r,t,n,a){return r.addEventListener(t,n,a),{unsubscribe:()=>{r.removeEventListener(t,n,a)}}}function jr(r){return r/Math.PI*180}const Za={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Va={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},Rs="AbortError";function ha(){return new Error(Rs)}const Nn={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Ua(r){return Nn.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const pn="global-dispatcher";class Yr extends Error{constructor(t,n,a,c){super(`AJAXError: ${n} (${t}): ${a}`),this.status=t,this.statusText=n,this.url=a,this.body=c}}const fn=()=>dn(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,$a=function(r,t){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){const a=Ua(r.url);if(a)return a(r,t);if(dn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:pn},t)}if(!(/^file:/.test(n=r.url)||/^file:/.test(fn())&&!/^\w+:/.test(n))){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:fn(),signal:c.signal});let p,g;a.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");try{p=yield fetch(d)}catch(w){throw new Yr(0,w.message,a.url,new Blob)}if(!p.ok){const w=yield p.blob();throw new Yr(p.status,p.statusText,a.url,w)}g=a.type==="arrayBuffer"||a.type==="image"?p.arrayBuffer():a.type==="json"?p.json():p.text();const x=yield g;if(c.signal.aborted)throw ha();return{data:x,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(r,t);if(dn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:pn},t)}var n;return function(a,c){return new Promise((d,p)=>{var g;const x=new XMLHttpRequest;x.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(x.responseType="arraybuffer");for(const w in a.headers)x.setRequestHeader(w,a.headers[w]);a.type==="json"&&(x.responseType="text",!((g=a.headers)===null||g===void 0)&&g.Accept||x.setRequestHeader("Accept","application/json")),x.withCredentials=a.credentials==="include",x.onerror=()=>{p(new Error(x.statusText))},x.onload=()=>{if(!c.signal.aborted)if((x.status>=200&&x.status<300||x.status===0)&&x.response!==null){let w=x.response;if(a.type==="json")try{w=JSON.parse(x.response)}catch(S){return void p(S)}d({data:w,cacheControl:x.getResponseHeader("Cache-Control"),expires:x.getResponseHeader("Expires")})}else{const w=new Blob([x.response],{type:x.getResponseHeader("Content-Type")});p(new Yr(x.status,x.statusText,a.url,w))}},c.signal.addEventListener("abort",()=>{x.abort(),p(ha())}),x.send(a.body)})}(r,t)};function Ds(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;const t=new URL(r),n=window.location;return t.protocol===n.protocol&&t.host===n.host}function Ao(r,t,n){n[r]&&n[r].indexOf(t)!==-1||(n[r]=n[r]||[],n[r].push(t))}function mn(r,t,n){if(n&&n[r]){const a=n[r].indexOf(t);a!==-1&&n[r].splice(a,1)}}class pe{constructor(t,n={}){ft(this,n),this.type=t}}class N extends pe{constructor(t,n={}){super("error",ft({error:t},n))}}class V{on(t,n){return this._listeners=this._listeners||{},Ao(t,n,this._listeners),{unsubscribe:()=>{this.off(t,n)}}}off(t,n){return mn(t,n,this._listeners),mn(t,n,this._oneTimeListeners),this}once(t,n){return n?(this._oneTimeListeners=this._oneTimeListeners||{},Ao(t,n,this._oneTimeListeners),this):new Promise(a=>this.once(t,a))}fire(t,n){typeof t=="string"&&(t=new pe(t,n||{}));const a=t.type;if(this.listens(a)){t.target=this;const c=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const g of c)g.call(this,t);const d=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const g of d)mn(a,g,this._oneTimeListeners),g.call(this,t);const p=this._eventedParent;p&&(ft(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(t))}else t instanceof N&&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,n){return this._eventedParent=t,this._eventedParentData=n,this}}var F={$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"},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:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},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 J=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ce(r,t){const n={};for(const a in r)a!=="ref"&&(n[a]=r[a]);return J.forEach(a=>{a in t&&(n[a]=t[a])}),n}function le(r,t){if(Array.isArray(r)){if(!Array.isArray(t)||r.length!==t.length)return!1;for(let n=0;n<r.length;n++)if(!le(r[n],t[n]))return!1;return!0}if(typeof r=="object"&&r!==null&&t!==null){if(typeof t!="object"||Object.keys(r).length!==Object.keys(t).length)return!1;for(const n in r)if(!le(r[n],t[n]))return!1;return!0}return r===t}function me(r,t){r.push(t)}function de(r,t,n){me(n,{command:"addSource",args:[r,t[r]]})}function Me(r,t,n){me(t,{command:"removeSource",args:[r]}),n[r]=!0}function we(r,t,n,a){Me(r,n,a),de(r,t,n)}function fe(r,t,n){let a;for(a in r[n])if(Object.prototype.hasOwnProperty.call(r[n],a)&&a!=="data"&&!le(r[n][a],t[n][a]))return!1;for(a in t[n])if(Object.prototype.hasOwnProperty.call(t[n],a)&&a!=="data"&&!le(r[n][a],t[n][a]))return!1;return!0}function Ae(r,t,n,a,c,d){r=r||{},t=t||{};for(const p in r)Object.prototype.hasOwnProperty.call(r,p)&&(le(r[p],t[p])||n.push({command:d,args:[a,p,t[p],c]}));for(const p in t)Object.prototype.hasOwnProperty.call(t,p)&&!Object.prototype.hasOwnProperty.call(r,p)&&(le(r[p],t[p])||n.push({command:d,args:[a,p,t[p],c]}))}function Ve(r){return r.id}function Ue(r,t){return r[t.id]=t,r}class Te{constructor(t,n,a,c){this.message=(t?`${t}: `:"")+a,c&&(this.identifier=c),n!=null&&n.__line__&&(this.line=n.__line__)}}function dt(r,...t){for(const n of t)for(const a in n)r[a]=n[a];return r}class it extends Error{constructor(t,n){super(n),this.message=n,this.key=t}}class ht{constructor(t,n=[]){this.parent=t,this.bindings={};for(const[a,c]of n)this.bindings[a]=c}concat(t){return new ht(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 Lt={kind:"null"},De={kind:"number"},He={kind:"string"},Ze={kind:"boolean"},_t={kind:"color"},mi={kind:"projectionDefinition"},gn={kind:"object"},ot={kind:"value"},Fi={kind:"collator"},ii={kind:"formatted"},zo={kind:"padding"},Ga={kind:"resolvedImage"},Zn={kind:"variableAnchorOffsetCollection"};function ur(r,t){return{kind:"array",itemType:r,N:t}}function di(r){if(r.kind==="array"){const t=di(r.itemType);return typeof r.N=="number"?`array<${t}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${t}>`}return r.kind}const Wd=[Lt,De,He,Ze,_t,mi,ii,gn,ur(ot),zo,Ga,Zn];function qa(r,t){if(t.kind==="error")return null;if(r.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!qa(r.itemType,t.itemType))&&(typeof r.N!="number"||r.N===t.N))return null}else{if(r.kind===t.kind)return null;if(r.kind==="value"){for(const n of Wd)if(!qa(n,t))return null}}return`Expected ${di(r)} but found ${di(t)} instead.`}function lc(r,t){return t.some(n=>n.kind===r.kind)}function Vn(r,t){return t.some(n=>n==="null"?r===null:n==="array"?Array.isArray(r):n==="object"?r&&!Array.isArray(r)&&typeof r=="object":n===typeof r)}function Wa(r,t){return r.kind==="array"&&t.kind==="array"?r.itemType.kind===t.itemType.kind&&typeof r.N=="number":r.kind===t.kind}const ih=.96422,rh=.82521,nh=4/29,Ha=6/29,ah=3*Ha*Ha,Hd=Ha*Ha*Ha,sh=Math.PI/180,Ls=180/Math.PI;function oh(r){return(r%=360)<0&&(r+=360),r}function lh([r,t,n,a]){let c,d;const p=cc((.2225045*(r=da(r))+.7168786*(t=da(t))+.0606169*(n=da(n)))/1);r===t&&t===n?c=d=p:(c=cc((.4360747*r+.3850649*t+.1430804*n)/ih),d=cc((.0139322*r+.0971045*t+.7141733*n)/rh));const g=116*p-16;return[g<0?0:g,500*(c-p),200*(p-d),a]}function da(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function cc(r){return r>Hd?Math.pow(r,1/3):r/ah+nh}function ch([r,t,n,a]){let c=(r+16)/116,d=isNaN(t)?c:c+t/500,p=isNaN(n)?c:c-n/200;return c=1*Ro(c),d=ih*Ro(d),p=rh*Ro(p),[uc(3.1338561*d-1.6168667*c-.4906146*p),uc(-.9787684*d+1.9161415*c+.033454*p),uc(.0719453*d-.2289914*c+1.4052427*p),a]}function uc(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function Ro(r){return r>Ha?r*r*r:ah*(r-nh)}function Fs(r){return parseInt(r.padEnd(2,r),16)/255}function Nr(r,t){return It(t?r/100:r,0,1)}function It(r,t,n){return Math.min(Math.max(t,r),n)}function pa(r){return!r.some(Number.isNaN)}const Un={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 _n(r,t,n){return r+n*(t-r)}function Xa(r,t,n){return r.map((a,c)=>_n(a,t[c],n))}class Ft{constructor(t,n,a,c=1,d=!0){this.r=t,this.g=n,this.b=a,this.a=c,d||(this.r*=c,this.g*=c,this.b*=c,c||this.overwriteGetter("rgb",[t,n,a,c]))}static parse(t){if(t instanceof Ft)return t;if(typeof t!="string")return;const n=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const c=Un[a];if(c){const[p,g,x]=c;return[p/255,g/255,x/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 g=1;return[Fs(a.slice(g,g+=p)),Fs(a.slice(g,g+=p)),Fs(a.slice(g,g+=p)),Fs(a.slice(g,g+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[g,x,w,S,I,R,L,B,j,$,X,oe]=p,Y=[S||" ",L||" ",$].join("");if(Y===" "||Y===" /"||Y===",,"||Y===",,,"){const D=[w,R,j].join(""),U=D==="%%%"?100:D===""?255:0;if(U){const Q=[It(+x/U,0,1),It(+I/U,0,1),It(+B/U,0,1),X?Nr(+X,oe):1];if(pa(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,g,x,w,S,I,R,L,B]=d,j=[x||" ",S||" ",R].join("");if(j===" "||j===" /"||j===",,"||j===",,,"){const $=[+g,It(+w,0,100),It(+I,0,100),L?Nr(+L,B):1];if(pa($))return function([X,oe,Y,D]){function U(Q){const xe=(Q+X/30)%12,ze=oe*Math.min(Y,1-Y);return Y-ze*Math.max(-1,Math.min(xe-3,9-xe,1))}return X=oh(X),oe/=100,Y/=100,[U(0),U(8),U(4),D]}($)}}}(t);return n?new Ft(...n,!1):void 0}get rgb(){const{r:t,g:n,b:a,a:c}=this,d=c||1/0;return this.overwriteGetter("rgb",[t/d,n/d,a/d,c])}get hcl(){return this.overwriteGetter("hcl",function(t){const[n,a,c,d]=lh(t),p=Math.sqrt(a*a+c*c);return[Math.round(1e4*p)?oh(Math.atan2(c,a)*Ls):NaN,p,n,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",lh(this.rgb))}overwriteGetter(t,n){return Object.defineProperty(this,t,{value:n}),n}toString(){const[t,n,a,c]=this.rgb;return`rgba(${[t,n,a].map(d=>Math.round(255*d)).join(",")},${c})`}static interpolate(t,n,a,c="rgb"){switch(c){case"rgb":{const[d,p,g,x]=Xa(t.rgb,n.rgb,a);return new Ft(d,p,g,x,!1)}case"hcl":{const[d,p,g,x]=t.hcl,[w,S,I,R]=n.hcl;let L,B;if(isNaN(d)||isNaN(w))isNaN(d)?isNaN(w)?L=NaN:(L=w,g!==1&&g!==0||(B=S)):(L=d,I!==1&&I!==0||(B=p));else{let Y=w-d;w>d&&Y>180?Y-=360:w<d&&d-w>180&&(Y+=360),L=d+a*Y}const[j,$,X,oe]=function([Y,D,U,Q]){return Y=isNaN(Y)?0:Y*sh,ch([U,Math.cos(Y)*D,Math.sin(Y)*D,Q])}([L,B??_n(p,S,a),_n(g,I,a),_n(x,R,a)]);return new Ft(j,$,X,oe,!1)}case"lab":{const[d,p,g,x]=ch(Xa(t.lab,n.lab,a));return new Ft(d,p,g,x,!1)}}}}Ft.black=new Ft(0,0,0,1),Ft.white=new Ft(1,1,1,1),Ft.transparent=new Ft(0,0,0,0),Ft.red=new Ft(1,0,0,1);class kr{constructor(t,n,a){this.sensitivity=t?n?"variant":"case":n?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,n){return this.collator.compare(t,n)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Bs=["bottom","center","top"];class Ka{constructor(t,n,a,c,d,p){this.text=t,this.image=n,this.scale=a,this.fontStack=c,this.textColor=d,this.verticalAlign=p}}class nr{constructor(t){this.sections=t}static fromString(t){return new nr([new Ka(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 nr?t:nr.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class Xi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Xi)return t;if(typeof t=="number")return new Xi([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const n of t)if(typeof n!="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 Xi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,n,a){return new Xi(Xa(t.values,n.values,a))}}class ci{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Do=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class ar{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ar)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let n=0;n<t.length;n+=2){const a=t[n],c=t[n+1];if(typeof a!="string"||!Do.has(a)||!Array.isArray(c)||c.length!==2||typeof c[0]!="number"||typeof c[1]!="number")return}return new ar(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,n,a){const c=t.values,d=n.values;if(c.length!==d.length)throw new ci(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${n.toString()}`);const p=[];for(let g=0;g<c.length;g+=2){if(c[g]!==d[g])throw new ci(`Cannot interpolate values containing mismatched anchors. from[${g}]: ${c[g]}, to[${g}]: ${d[g]}`);p.push(c[g]);const[x,w]=c[g+1],[S,I]=d[g+1];p.push([_n(x,S,a),_n(w,I,a)])}return new ar(p)}}class hr{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new hr({name:t,available:!1}):null}}class Bi{constructor(t,n,a){this.from=t,this.to=n,this.transition=a}static interpolate(t,n,a){return new Bi(t,n,a)}static parse(t){return t instanceof Bi?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new Bi(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new Bi(t.from,t.to,t.transition):typeof t=="string"?new Bi(t,t,1):void 0}}function uh(r,t,n,a){return typeof r=="number"&&r>=0&&r<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof n=="number"&&n>=0&&n<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[r,t,n,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[r,t,n,a]:[r,t,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function $n(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof Bi||r instanceof Ft||r instanceof kr||r instanceof nr||r instanceof Xi||r instanceof ar||r instanceof hr)return!0;if(Array.isArray(r)){for(const t of r)if(!$n(t))return!1;return!0}if(typeof r=="object"){for(const t in r)if(!$n(r[t]))return!1;return!0}return!1}function ui(r){if(r===null)return Lt;if(typeof r=="string")return He;if(typeof r=="boolean")return Ze;if(typeof r=="number")return De;if(r instanceof Ft)return _t;if(r instanceof Bi)return mi;if(r instanceof kr)return Fi;if(r instanceof nr)return ii;if(r instanceof Xi)return zo;if(r instanceof ar)return Zn;if(r instanceof hr)return Ga;if(Array.isArray(r)){const t=r.length;let n;for(const a of r){const c=ui(a);if(n){if(n===c)continue;n=ot;break}n=c}return ur(n||ot,t)}return gn}function Ya(r){const t=typeof r;return r===null?"":t==="string"||t==="number"||t==="boolean"?String(r):r instanceof Ft||r instanceof Bi||r instanceof nr||r instanceof Xi||r instanceof ar||r instanceof hr?r.toString():JSON.stringify(r)}class Gn{constructor(t,n){this.type=t,this.value=n}static parse(t,n){if(t.length!==2)return n.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!$n(t[1]))return n.error("invalid value");const a=t[1];let c=ui(a);const d=n.expectedType;return c.kind!=="array"||c.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(c=d),new Gn(c,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Os={string:He,number:De,boolean:Ze,object:gn};class dr{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let a,c=1;const d=t[0];if(d==="array"){let g,x;if(t.length>2){const w=t[1];if(typeof w!="string"||!(w in Os)||w==="object")return n.error('The item type argument of "array" must be one of string, number, boolean',1);g=Os[w],c++}else g=ot;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return n.error('The length argument to "array" must be a positive integer literal',2);x=t[2],c++}a=ur(g,x)}else{if(!Os[d])throw new Error(`Types doesn't contain name = ${d}`);a=Os[d]}const p=[];for(;c<t.length;c++){const g=n.parse(t[c],c,ot);if(!g)return null;p.push(g)}return new dr(a,p)}evaluate(t){for(let n=0;n<this.args.length;n++){const a=this.args[n].evaluate(t);if(!qa(this.type,ui(a)))return a;if(n===this.args.length-1)throw new ci(`Expected value to be of type ${di(this.type)}, but found ${di(ui(a))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const ri={"to-boolean":Ze,"to-color":_t,"to-number":De,"to-string":He};class Jr{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const a=t[0];if(!ri[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 n.error("Expected one argument.");const c=ri[a],d=[];for(let p=1;p<t.length;p++){const g=n.parse(t[p],p,ot);if(!g)return null;d.push(g)}return new Jr(c,d)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let n,a;for(const c of this.args){if(n=c.evaluate(t),a=null,n instanceof Ft)return n;if(typeof n=="string"){const d=t.parseColor(n);if(d)return d}else if(Array.isArray(n)&&(a=n.length<3||n.length>4?`Invalid rgba value ${JSON.stringify(n)}: expected an array containing either three or four numeric values.`:uh(n[0],n[1],n[2],n[3]),!a))return new Ft(n[0]/255,n[1]/255,n[2]/255,n[3])}throw new ci(a||`Could not parse color from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"padding":{let n;for(const a of this.args){n=a.evaluate(t);const c=Xi.parse(n);if(c)return c}throw new ci(`Could not parse padding from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"variableAnchorOffsetCollection":{let n;for(const a of this.args){n=a.evaluate(t);const c=ar.parse(n);if(c)return c}throw new ci(`Could not parse variableAnchorOffsetCollection from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"number":{let n=null;for(const a of this.args){if(n=a.evaluate(t),n===null)return 0;const c=Number(n);if(!isNaN(c))return c}throw new ci(`Could not convert ${JSON.stringify(n)} to number.`)}case"formatted":return nr.fromString(Ya(this.args[0].evaluate(t)));case"resolvedImage":return hr.fromString(Ya(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return Ya(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Ot=["Unknown","Point","LineString","Polygon"];class vt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?Ot[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 n=this._parseColorCache[t];return n||(n=this._parseColorCache[t]=Ft.parse(t)),n}}class Ja{constructor(t,n,a=[],c,d=new ht,p=[]){this.registry=t,this.path=a,this.key=a.map(g=>`[${g}]`).join(""),this.scope=d,this.errors=p,this.expectedType=c,this._isConstant=n}parse(t,n,a,c,d={}){return n?this.concat(n,a,c)._parse(t,d):this._parse(t,d)}_parse(t,n){function a(c,d,p){return p==="assert"?new dr(d,[c]):p==="coerce"?new Jr(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 g=this.expectedType,x=p.type;if(g.kind!=="string"&&g.kind!=="number"&&g.kind!=="boolean"&&g.kind!=="object"&&g.kind!=="array"||x.kind!=="value")if(g.kind!=="projectionDefinition"||x.kind!=="string"&&x.kind!=="array")if(g.kind!=="color"&&g.kind!=="formatted"&&g.kind!=="resolvedImage"||x.kind!=="value"&&x.kind!=="string")if(g.kind!=="padding"||x.kind!=="value"&&x.kind!=="number"&&x.kind!=="array")if(g.kind!=="variableAnchorOffsetCollection"||x.kind!=="value"&&x.kind!=="array"){if(this.checkSubtype(g,x))return null}else p=a(p,g,n.typeAnnotation||"coerce");else p=a(p,g,n.typeAnnotation||"coerce");else p=a(p,g,n.typeAnnotation||"coerce");else p=a(p,g,n.typeAnnotation||"coerce");else p=a(p,g,n.typeAnnotation||"assert")}if(!(p instanceof Gn)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const g=new vt;try{p=new Gn(p.type,p.evaluate(g))}catch(x){return this.error(x.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,n,a){const c=typeof t=="number"?this.path.concat(t):this.path,d=a?this.scope.concat(a):this.scope;return new Ja(this.registry,this._isConstant,c,n||null,d,this.errors)}error(t,...n){const a=`${this.key}${n.map(c=>`[${c}]`).join("")}`;this.errors.push(new it(a,t))}checkSubtype(t,n){const a=qa(t,n);return a&&this.error(a),a}}class Rt{constructor(t,n){this.type=n.type,this.bindings=[].concat(t),this.result=n}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const n of this.bindings)t(n[1]);t(this.result)}static parse(t,n){if(t.length<4)return n.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 n.error(`Expected string, but found ${typeof p} instead.`,d);if(/[^a-zA-Z0-9_]/.test(p))return n.error("Variable names must contain only alphanumeric characters or '_'.",d);const g=n.parse(t[d+1],d+1);if(!g)return null;a.push([p,g])}const c=n.parse(t[t.length-1],t.length-1,n.expectedType,a);return c?new Rt(a,c):null}outputDefined(){return this.result.outputDefined()}}class Qa{constructor(t,n){this.type=n.type,this.name=t,this.boundExpression=n}static parse(t,n){if(t.length!==2||typeof t[1]!="string")return n.error("'var' expression requires exactly one string literal argument.");const a=t[1];return n.scope.has(a)?new Qa(a,n.scope.get(a)):n.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 Zr{constructor(t,n,a){this.type=t,this.index=n,this.input=a}static parse(t,n){if(t.length!==3)return n.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,De),c=n.parse(t[2],2,ur(n.expectedType||ot));return a&&c?new Zr(c.type.itemType,a,c):null}evaluate(t){const n=this.index.evaluate(t),a=this.input.evaluate(t);if(n<0)throw new ci(`Array index out of bounds: ${n} < 0.`);if(n>=a.length)throw new ci(`Array index out of bounds: ${n} > ${a.length-1}.`);if(n!==Math.floor(n))throw new ci(`Array index must be an integer, but found ${n} instead.`);return a[n]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class js{constructor(t,n){this.type=Ze,this.needle=t,this.haystack=n}static parse(t,n){if(t.length!==3)return n.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,ot),c=n.parse(t[2],2,ot);return a&&c?lc(a.type,[Ze,He,De,Lt,ot])?new js(a,c):n.error(`Expected first argument to be of type boolean, string, number or null, but found ${di(a.type)} instead`):null}evaluate(t){const n=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!a)return!1;if(!Vn(n,["boolean","string","number","null"]))throw new ci(`Expected first argument to be of type boolean, string, number or null, but found ${di(ui(n))} instead.`);if(!Vn(a,["string","array"]))throw new ci(`Expected second argument to be of type array or string, but found ${di(ui(a))} instead.`);return a.indexOf(n)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Ns{constructor(t,n,a){this.type=De,this.needle=t,this.haystack=n,this.fromIndex=a}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,ot),c=n.parse(t[2],2,ot);if(!a||!c)return null;if(!lc(a.type,[Ze,He,De,Lt,ot]))return n.error(`Expected first argument to be of type boolean, string, number or null, but found ${di(a.type)} instead`);if(t.length===4){const d=n.parse(t[3],3,De);return d?new Ns(a,c,d):null}return new Ns(a,c)}evaluate(t){const n=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!Vn(n,["boolean","string","number","null"]))throw new ci(`Expected first argument to be of type boolean, string, number or null, but found ${di(ui(n))} instead.`);let c;if(this.fromIndex&&(c=this.fromIndex.evaluate(t)),Vn(a,["string"])){const d=a.indexOf(n,c);return d===-1?-1:[...a.slice(0,d)].length}if(Vn(a,["array"]))return a.indexOf(n,c);throw new ci(`Expected second argument to be of type array or string, but found ${di(ui(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Lo{constructor(t,n,a,c,d,p){this.inputType=t,this.type=n,this.input=a,this.cases=c,this.outputs=d,this.otherwise=p}static parse(t,n){if(t.length<5)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return n.error("Expected an even number of arguments.");let a,c;n.expectedType&&n.expectedType.kind!=="value"&&(c=n.expectedType);const d={},p=[];for(let w=2;w<t.length-1;w+=2){let S=t[w];const I=t[w+1];Array.isArray(S)||(S=[S]);const R=n.concat(w);if(S.length===0)return R.error("Expected at least one branch label.");for(const B of S){if(typeof B!="number"&&typeof B!="string")return R.error("Branch labels must be numbers or strings.");if(typeof B=="number"&&Math.abs(B)>Number.MAX_SAFE_INTEGER)return R.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof B=="number"&&Math.floor(B)!==B)return R.error("Numeric branch labels must be integer values.");if(a){if(R.checkSubtype(a,ui(B)))return null}else a=ui(B);if(d[String(B)]!==void 0)return R.error("Branch labels must be unique.");d[String(B)]=p.length}const L=n.parse(I,w,c);if(!L)return null;c=c||L.type,p.push(L)}const g=n.parse(t[1],1,ot);if(!g)return null;const x=n.parse(t[t.length-1],t.length-1,c);return x?g.type.kind!=="value"&&n.concat(1).checkSubtype(a,g.type)?null:new Lo(a,c,g,d,p,x):null}evaluate(t){const n=this.input.evaluate(t);return(ui(n)===this.inputType&&this.outputs[this.cases[n]]||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 Zs{constructor(t,n,a){this.type=t,this.branches=n,this.otherwise=a}static parse(t,n){if(t.length<4)return n.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return n.error("Expected an odd number of arguments.");let a;n.expectedType&&n.expectedType.kind!=="value"&&(a=n.expectedType);const c=[];for(let p=1;p<t.length-1;p+=2){const g=n.parse(t[p],p,Ze);if(!g)return null;const x=n.parse(t[p+1],p+1,a);if(!x)return null;c.push([g,x]),a=a||x.type}const d=n.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 Zs(a,c,d)}evaluate(t){for(const[n,a]of this.branches)if(n.evaluate(t))return a.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[n,a]of this.branches)t(n),t(a);t(this.otherwise)}outputDefined(){return this.branches.every(([t,n])=>n.outputDefined())&&this.otherwise.outputDefined()}}class Vs{constructor(t,n,a,c){this.type=t,this.input=n,this.beginIndex=a,this.endIndex=c}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,ot),c=n.parse(t[2],2,De);if(!a||!c)return null;if(!lc(a.type,[ur(ot),He,ot]))return n.error(`Expected first argument to be of type array or string, but found ${di(a.type)} instead`);if(t.length===4){const d=n.parse(t[3],3,De);return d?new Vs(a.type,a,c,d):null}return new Vs(a.type,a,c)}evaluate(t){const n=this.input.evaluate(t),a=this.beginIndex.evaluate(t);let c;if(this.endIndex&&(c=this.endIndex.evaluate(t)),Vn(n,["string"]))return[...n].slice(a,c).join("");if(Vn(n,["array"]))return n.slice(a,c);throw new ci(`Expected first argument to be of type array or string, but found ${di(ui(n))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Fo(r,t){const n=r.length-1;let a,c,d=0,p=n,g=0;for(;d<=p;)if(g=Math.floor((d+p)/2),a=r[g],c=r[g+1],a<=t){if(g===n||t<c)return g;d=g+1}else{if(!(a>t))throw new ci("Input is not a number.");p=g-1}return 0}class es{constructor(t,n,a){this.type=t,this.input=n,this.labels=[],this.outputs=[];for(const[c,d]of a)this.labels.push(c),this.outputs.push(d)}static parse(t,n){if(t.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");const a=n.parse(t[1],1,De);if(!a)return null;const c=[];let d=null;n.expectedType&&n.expectedType.kind!=="value"&&(d=n.expectedType);for(let p=1;p<t.length;p+=2){const g=p===1?-1/0:t[p],x=t[p+1],w=p,S=p+1;if(typeof g!="number")return n.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]>=g)return n.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',w);const I=n.parse(x,S,d);if(!I)return null;d=d||I.type,c.push([g,I])}return new es(d,a,c)}evaluate(t){const n=this.labels,a=this.outputs;if(n.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=n[0])return a[0].evaluate(t);const d=n.length;return c>=n[d-1]?a[d-1].evaluate(t):a[Fo(n,c)].evaluate(t)}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function hh(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var fa,Ki,Bo=function(){if(Ki)return fa;function r(t,n,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(c-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=a,this.p2y=c}return Ki=1,fa=r,r.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,n){if(n===void 0&&(n=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)<n)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var g=0,x=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<n));c++)t>d?g=a:x=a,a=.5*(x-g)+g;return a},solve:function(t,n){return this.sampleCurveY(this.solveCurveX(t,n))}},fa}(),dh=hh(Bo);class er{constructor(t,n,a,c,d){this.type=t,this.operator=n,this.interpolation=a,this.input=c,this.labels=[],this.outputs=[];for(const[p,g]of d)this.labels.push(p),this.outputs.push(g)}static interpolationFactor(t,n,a,c){let d=0;if(t.name==="exponential")d=Ri(n,t.base,a,c);else if(t.name==="linear")d=Ri(n,1,a,c);else if(t.name==="cubic-bezier"){const p=t.controlPoints;d=new dh(p[0],p[1],p[2],p[3]).solve(Ri(n,1,a,c))}return d}static parse(t,n){let[a,c,d,...p]=t;if(!Array.isArray(c)||c.length===0)return n.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 n.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:w}}else{if(c[0]!=="cubic-bezier")return n.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const w=c.slice(1);if(w.length!==4||w.some(S=>typeof S!="number"||S<0||S>1))return n.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 n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(d=n.parse(d,2,De),!d)return null;const g=[];let x=null;a==="interpolate-hcl"||a==="interpolate-lab"?x=_t:n.expectedType&&n.expectedType.kind!=="value"&&(x=n.expectedType);for(let w=0;w<p.length;w+=2){const S=p[w],I=p[w+1],R=w+3,L=w+4;if(typeof S!="number")return n.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',R);if(g.length&&g[g.length-1][0]>=S)return n.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',R);const B=n.parse(I,L,x);if(!B)return null;x=x||B.type,g.push([S,B])}return Wa(x,De)||Wa(x,mi)||Wa(x,_t)||Wa(x,zo)||Wa(x,Zn)||Wa(x,ur(De))?new er(x,a,c,d,g):n.error(`Type ${di(x)} is not interpolatable.`)}evaluate(t){const n=this.labels,a=this.outputs;if(n.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=n[0])return a[0].evaluate(t);const d=n.length;if(c>=n[d-1])return a[d-1].evaluate(t);const p=Fo(n,c),g=er.interpolationFactor(this.interpolation,c,n[p],n[p+1]),x=a[p].evaluate(t),w=a[p+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return _n(x,w,g);case"color":return Ft.interpolate(x,w,g);case"padding":return Xi.interpolate(x,w,g);case"variableAnchorOffsetCollection":return ar.interpolate(x,w,g);case"array":return Xa(x,w,g);case"projectionDefinition":return Bi.interpolate(x,w,g)}case"interpolate-hcl":return Ft.interpolate(x,w,g,"hcl");case"interpolate-lab":return Ft.interpolate(x,w,g,"lab")}}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Ri(r,t,n,a){const c=a-n,d=r-n;return c===0?0:t===1?d/c:(Math.pow(t,d)-1)/(Math.pow(t,c)-1)}const Vr={color:Ft.interpolate,number:_n,padding:Xi.interpolate,variableAnchorOffsetCollection:ar.interpolate,array:Xa};class ts{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let a=null;const c=n.expectedType;c&&c.kind!=="value"&&(a=c);const d=[];for(const g of t.slice(1)){const x=n.parse(g,1+d.length,a,void 0,{typeAnnotation:"omit"});if(!x)return null;a=a||x.type,d.push(x)}if(!a)throw new Error("No output type");const p=c&&d.some(g=>qa(c,g.type));return new ts(p?ot:a,d)}evaluate(t){let n,a=null,c=0;for(const d of this.args)if(c++,a=d.evaluate(t),a&&a instanceof hr&&!a.available&&(n||(n=a.name),a=null,c===this.args.length&&(a=n)),a!==null)break;return a}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function hc(r,t){return r==="=="||r==="!="?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 ph(r,t,n,a){return a.compare(t,n)===0}function yn(r,t,n){const a=r!=="=="&&r!=="!=";return class o_{constructor(d,p,g){this.type=Ze,this.lhs=d,this.rhs=p,this.collator=g,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 g=d[0];let x=p.parse(d[1],1,ot);if(!x)return null;if(!hc(g,x.type))return p.concat(1).error(`"${g}" comparisons are not supported for type '${di(x.type)}'.`);let w=p.parse(d[2],2,ot);if(!w)return null;if(!hc(g,w.type))return p.concat(2).error(`"${g}" comparisons are not supported for type '${di(w.type)}'.`);if(x.type.kind!==w.type.kind&&x.type.kind!=="value"&&w.type.kind!=="value")return p.error(`Cannot compare types '${di(x.type)}' and '${di(w.type)}'.`);a&&(x.type.kind==="value"&&w.type.kind!=="value"?x=new dr(w.type,[x]):x.type.kind!=="value"&&w.type.kind==="value"&&(w=new dr(x.type,[w])));let S=null;if(d.length===4){if(x.type.kind!=="string"&&w.type.kind!=="string"&&x.type.kind!=="value"&&w.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(S=p.parse(d[3],3,Fi),!S)return null}return new o_(x,w,S)}evaluate(d){const p=this.lhs.evaluate(d),g=this.rhs.evaluate(d);if(a&&this.hasUntypedArgument){const x=ui(p),w=ui(g);if(x.kind!==w.kind||x.kind!=="string"&&x.kind!=="number")throw new ci(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${x.kind}, ${w.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const x=ui(p),w=ui(g);if(x.kind!=="string"||w.kind!=="string")return t(d,p,g)}return this.collator?n(d,p,g,this.collator.evaluate(d)):t(d,p,g)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}const dc=yn("==",function(r,t,n){return t===n},ph),Xd=yn("!=",function(r,t,n){return t!==n},function(r,t,n,a){return!ph(0,t,n,a)}),Oo=yn("<",function(r,t,n){return t<n},function(r,t,n,a){return a.compare(t,n)<0}),jo=yn(">",function(r,t,n){return t>n},function(r,t,n,a){return a.compare(t,n)>0}),Ur=yn("<=",function(r,t,n){return t<=n},function(r,t,n,a){return a.compare(t,n)<=0}),fh=yn(">=",function(r,t,n){return t>=n},function(r,t,n,a){return a.compare(t,n)>=0});class ma{constructor(t,n,a){this.type=Fi,this.locale=a,this.caseSensitive=t,this.diacriticSensitive=n}static parse(t,n){if(t.length!==2)return n.error("Expected one argument.");const a=t[1];if(typeof a!="object"||Array.isArray(a))return n.error("Collator options argument must be an object.");const c=n.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,Ze);if(!c)return null;const d=n.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,Ze);if(!d)return null;let p=null;return a.locale&&(p=n.parse(a.locale,1,He),!p)?null:new ma(c,d,p)}evaluate(t){return new kr(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 pc{constructor(t,n,a,c,d){this.type=He,this.number=t,this.locale=n,this.currency=a,this.minFractionDigits=c,this.maxFractionDigits=d}static parse(t,n){if(t.length!==3)return n.error("Expected two arguments.");const a=n.parse(t[1],1,De);if(!a)return null;const c=t[2];if(typeof c!="object"||Array.isArray(c))return n.error("NumberFormat options argument must be an object.");let d=null;if(c.locale&&(d=n.parse(c.locale,1,He),!d))return null;let p=null;if(c.currency&&(p=n.parse(c.currency,1,He),!p))return null;let g=null;if(c["min-fraction-digits"]&&(g=n.parse(c["min-fraction-digits"],1,De),!g))return null;let x=null;return c["max-fraction-digits"]&&(x=n.parse(c["max-fraction-digits"],1,De),!x)?null:new pc(a,d,p,g,x)}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 is{constructor(t){this.type=ii,this.sections=t}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const a=t[1];if(!Array.isArray(a)&&typeof a=="object")return n.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 g=t[p];if(d&&typeof g=="object"&&!Array.isArray(g)){d=!1;let x=null;if(g["font-scale"]&&(x=n.parse(g["font-scale"],1,De),!x))return null;let w=null;if(g["text-font"]&&(w=n.parse(g["text-font"],1,ur(He)),!w))return null;let S=null;if(g["text-color"]&&(S=n.parse(g["text-color"],1,_t),!S))return null;let I=null;if(g["vertical-align"]){if(typeof g["vertical-align"]=="string"&&!Bs.includes(g["vertical-align"]))return n.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${g["vertical-align"]}' instead.`);if(I=n.parse(g["vertical-align"],1,He),!I)return null}const R=c[c.length-1];R.scale=x,R.font=w,R.textColor=S,R.verticalAlign=I}else{const x=n.parse(t[p],1,ot);if(!x)return null;const w=x.type.kind;if(w!=="string"&&w!=="value"&&w!=="null"&&w!=="resolvedImage")return n.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,c.push({content:x,scale:null,font:null,textColor:null,verticalAlign:null})}}return new is(c)}evaluate(t){return new nr(this.sections.map(n=>{const a=n.content.evaluate(t);return ui(a)===Ga?new Ka("",a,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(t):null):new Ka(Ya(a),null,n.scale?n.scale.evaluate(t):null,n.font?n.font.evaluate(t).join(","):null,n.textColor?n.textColor.evaluate(t):null,n.verticalAlign?n.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const n of this.sections)t(n.content),n.scale&&t(n.scale),n.font&&t(n.font),n.textColor&&t(n.textColor),n.verticalAlign&&t(n.verticalAlign)}outputDefined(){return!1}}class fc{constructor(t){this.type=Ga,this.input=t}static parse(t,n){if(t.length!==2)return n.error("Expected two arguments.");const a=n.parse(t[1],1,He);return a?new fc(a):n.error("No image name provided.")}evaluate(t){const n=this.input.evaluate(t),a=hr.fromString(n);return a&&t.availableImages&&(a.available=t.availableImages.indexOf(n)>-1),a}eachChild(t){t(this.input)}outputDefined(){return!1}}class mc{constructor(t){this.type=De,this.input=t}static parse(t,n){if(t.length!==2)return n.error(`Expected 1 argument, but found ${t.length-1} instead.`);const a=n.parse(t[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?n.error(`Expected argument of type string or array, but found ${di(a.type)} instead.`):new mc(a):null}evaluate(t){const n=this.input.evaluate(t);if(typeof n=="string")return[...n].length;if(Array.isArray(n))return n.length;throw new ci(`Expected value to be of type string or array, but found ${di(ui(n))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Qr=8192;function Kd(r,t){const n=(180+r[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,c=Math.pow(2,t.z);return[Math.round(n*c*Qr),Math.round(a*c*Qr)]}function rs(r,t){const n=Math.pow(2,t.z);return[(c=(r[0]/Qr+t.x)/n,360*c-180),(a=(r[1]/Qr+t.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,c}function Us(r,t){r[0]=Math.min(r[0],t[0]),r[1]=Math.min(r[1],t[1]),r[2]=Math.max(r[2],t[0]),r[3]=Math.max(r[3],t[1])}function ns(r,t){return!(r[0]<=t[0]||r[2]>=t[2]||r[1]<=t[1]||r[3]>=t[3])}function mh(r,t,n){const a=r[0]-t[0],c=r[1]-t[1],d=r[0]-n[0],p=r[1]-n[1];return a*p-d*c==0&&a*d<=0&&c*p<=0}function No(r,t,n,a){return(c=[a[0]-n[0],a[1]-n[1]])[0]*(d=[t[0]-r[0],t[1]-r[1]])[1]-c[1]*d[0]!=0&&!(!yh(r,t,n,a)||!yh(n,a,r,t));var c,d}function gh(r,t,n){for(const a of n)for(let c=0;c<a.length-1;++c)if(No(r,t,a[c],a[c+1]))return!0;return!1}function as(r,t,n=!1){let a=!1;for(const g of t)for(let x=0;x<g.length-1;x++){if(mh(r,g[x],g[x+1]))return n;(d=g[x])[1]>(c=r)[1]!=(p=g[x+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 Yd(r,t){for(const n of t)if(as(r,n))return!0;return!1}function _h(r,t){for(const n of r)if(!as(n,t))return!1;for(let n=0;n<r.length-1;++n)if(gh(r[n],r[n+1],t))return!1;return!0}function Jd(r,t){for(const n of t)if(_h(r,n))return!0;return!1}function yh(r,t,n,a){const c=a[0]-n[0],d=a[1]-n[1],p=(r[0]-n[0])*d-c*(r[1]-n[1]),g=(t[0]-n[0])*d-c*(t[1]-n[1]);return p>0&&g<0||p<0&&g>0}function Zo(r,t,n){const a=[];for(let c=0;c<r.length;c++){const d=[];for(let p=0;p<r[c].length;p++){const g=Kd(r[c][p],n);Us(t,g),d.push(g)}a.push(d)}return a}function gc(r,t,n){const a=[];for(let c=0;c<r.length;c++){const d=Zo(r[c],t,n);a.push(d)}return a}function _c(r,t,n,a){if(r[0]<n[0]||r[0]>n[2]){const c=.5*a;let d=r[0]-n[0]>c?-a:n[0]-r[0]>c?a:0;d===0&&(d=r[0]-n[2]>c?-a:n[2]-r[0]>c?a:0),r[0]+=d}Us(t,r)}function xh(r,t,n,a){const c=Math.pow(2,a.z)*Qr,d=[a.x*Qr,a.y*Qr],p=[];for(const g of r)for(const x of g){const w=[x.x+d[0],x.y+d[1]];_c(w,t,n,c),p.push(w)}return p}function vh(r,t,n,a){const c=Math.pow(2,a.z)*Qr,d=[a.x*Qr,a.y*Qr],p=[];for(const x of r){const w=[];for(const S of x){const I=[S.x+d[0],S.y+d[1]];Us(t,I),w.push(I)}p.push(w)}if(t[2]-t[0]<=c/2){(g=t)[0]=g[1]=1/0,g[2]=g[3]=-1/0;for(const x of p)for(const w of x)_c(w,t,n,c)}var g;return p}class ga{constructor(t,n){this.type=Ze,this.geojson=t,this.geometries=n}static parse(t,n){if(t.length!==2)return n.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if($n(t[1])){const a=t[1];if(a.type==="FeatureCollection"){const c=[];for(const d of a.features){const{type:p,coordinates:g}=d.geometry;p==="Polygon"&&c.push(g),p==="MultiPolygon"&&c.push(...g)}if(c.length)return new ga(a,{type:"MultiPolygon",coordinates:c})}else if(a.type==="Feature"){const c=a.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new ga(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new ga(a,a)}return n.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(n,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=n.canonicalID();if(a.type==="Polygon"){const g=Zo(a.coordinates,d,p),x=xh(n.geometry(),c,d,p);if(!ns(c,d))return!1;for(const w of x)if(!as(w,g))return!1}if(a.type==="MultiPolygon"){const g=gc(a.coordinates,d,p),x=xh(n.geometry(),c,d,p);if(!ns(c,d))return!1;for(const w of x)if(!Yd(w,g))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(n,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=n.canonicalID();if(a.type==="Polygon"){const g=Zo(a.coordinates,d,p),x=vh(n.geometry(),c,d,p);if(!ns(c,d))return!1;for(const w of x)if(!_h(w,g))return!1}if(a.type==="MultiPolygon"){const g=gc(a.coordinates,d,p),x=vh(n.geometry(),c,d,p);if(!ns(c,d))return!1;for(const w of x)if(!Jd(w,g))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Vo=class{constructor(r=[],t=(n,a)=>n<a?-1:n>a?1:0){if(this.data=r,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:t,compare:n}=this,a=t[r];for(;r>0;){const c=r-1>>1,d=t[c];if(n(a,d)>=0)break;t[r]=d,r=c}t[r]=a}_down(r){const{data:t,compare:n}=this,a=this.length>>1,c=t[r];for(;r<a;){let d=1+(r<<1);const p=d+1;if(p<this.length&&n(t[p],t[d])<0&&(d=p),n(t[d],c)>=0)break;t[r]=t[d],r=d}t[r]=c}};function bh(r,t,n=0,a=r.length-1,c=Qd){for(;a>n;){if(a-n>600){const x=a-n+1,w=t-n+1,S=Math.log(x),I=.5*Math.exp(2*S/3),R=.5*Math.sqrt(S*I*(x-I)/x)*(w-x/2<0?-1:1);bh(r,t,Math.max(n,Math.floor(t-w*I/x+R)),Math.min(a,Math.floor(t+(x-w)*I/x+R)),c)}const d=r[t];let p=n,g=a;for($s(r,n,t),c(r[a],d)>0&&$s(r,n,a);p<g;){for($s(r,p,g),p++,g--;c(r[p],d)<0;)p++;for(;c(r[g],d)>0;)g--}c(r[n],d)===0?$s(r,n,g):(g++,$s(r,g,a)),g<=t&&(n=g+1),t<=g&&(a=g-1)}}function $s(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}function Qd(r,t){return r<t?-1:r>t?1:0}function Gs(r,t){if(r.length<=1)return[r];const n=[];let a,c;for(const d of r){const p=ep(d);p!==0&&(d.area=Math.abs(p),c===void 0&&(c=p<0),c===p<0?(a&&n.push(a),a=[d]):a.push(d))}if(a&&n.push(a),t>1)for(let d=0;d<n.length;d++)n[d].length<=t||(bh(n[d],t,1,n[d].length-1,wh),n[d]=n[d].slice(0,t));return n}function wh(r,t){return t.area-r.area}function ep(r){let t=0;for(let n,a,c=0,d=r.length,p=d-1;c<d;p=c++)n=r[c],a=r[p],t+=(a.x-n.x)*(n.y+a.y);return t}const Th=1/298.257223563,yc=Th*(2-Th),xc=Math.PI/180;class vc{constructor(t){const n=6378.137*xc*1e3,a=Math.cos(t*xc),c=1/(1-yc*(1-a*a)),d=Math.sqrt(c);this.kx=n*d*a,this.ky=n*d*c*(1-yc)}distance(t,n){const a=this.wrap(t[0]-n[0])*this.kx,c=(t[1]-n[1])*this.ky;return Math.sqrt(a*a+c*c)}pointOnLine(t,n){let a,c,d,p,g=1/0;for(let x=0;x<t.length-1;x++){let w=t[x][0],S=t[x][1],I=this.wrap(t[x+1][0]-w)*this.kx,R=(t[x+1][1]-S)*this.ky,L=0;I===0&&R===0||(L=(this.wrap(n[0]-w)*this.kx*I+(n[1]-S)*this.ky*R)/(I*I+R*R),L>1?(w=t[x+1][0],S=t[x+1][1]):L>0&&(w+=I/this.kx*L,S+=R/this.ky*L)),I=this.wrap(n[0]-w)*this.kx,R=(n[1]-S)*this.ky;const B=I*I+R*R;B<g&&(g=B,a=w,c=S,d=x,p=L)}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 Ph(r,t){return t[0]-r[0]}function Uo(r){return r[1]-r[0]+1}function en(r,t){return r[1]>=r[0]&&r[1]<t}function bc(r,t){if(r[0]>r[1])return[null,null];const n=Uo(r);if(t){if(n===2)return[r,null];const c=Math.floor(n/2);return[[r[0],r[0]+c],[r[0]+c,r[1]]]}if(n===1)return[r,null];const a=Math.floor(n/2)-1;return[[r[0],r[0]+a],[r[0]+a+1,r[1]]]}function wc(r,t){if(!en(t,r.length))return[1/0,1/0,-1/0,-1/0];const n=[1/0,1/0,-1/0,-1/0];for(let a=t[0];a<=t[1];++a)Us(n,r[a]);return n}function Tc(r){const t=[1/0,1/0,-1/0,-1/0];for(const n of r)for(const a of n)Us(t,a);return t}function Sh(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function jt(r,t,n){if(!Sh(r)||!Sh(t))return NaN;let a=0,c=0;return r[2]<t[0]&&(a=t[0]-r[2]),r[0]>t[2]&&(a=r[0]-t[2]),r[1]>t[3]&&(c=r[1]-t[3]),r[3]<t[1]&&(c=t[1]-r[3]),n.distance([0,0],[a,c])}function _a(r,t,n){const a=n.pointOnLine(t,r);return n.distance(r,a.point)}function Pc(r,t,n,a,c){const d=Math.min(_a(r,[n,a],c),_a(t,[n,a],c)),p=Math.min(_a(n,[r,t],c),_a(a,[r,t],c));return Math.min(d,p)}function tp(r,t,n,a,c){if(!en(t,r.length)||!en(a,n.length))return 1/0;let d=1/0;for(let p=t[0];p<t[1];++p){const g=r[p],x=r[p+1];for(let w=a[0];w<a[1];++w){const S=n[w],I=n[w+1];if(No(g,x,S,I))return 0;d=Math.min(d,Pc(g,x,S,I,c))}}return d}function ip(r,t,n,a,c){if(!en(t,r.length)||!en(a,n.length))return NaN;let d=1/0;for(let p=t[0];p<=t[1];++p)for(let g=a[0];g<=a[1];++g)if(d=Math.min(d,c.distance(r[p],n[g])),d===0)return d;return d}function rp(r,t,n){if(as(r,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,_a(r,[p,d],n)),a===0))return a;const g=n.pointOnLine(c,r);if(a=Math.min(a,n.distance(r,g.point)),a===0)return a}return a}function np(r,t,n,a){if(!en(t,r.length))return NaN;for(let d=t[0];d<=t[1];++d)if(as(r[d],n,!0))return 0;let c=1/0;for(let d=t[0];d<t[1];++d){const p=r[d],g=r[d+1];for(const x of n)for(let w=0,S=x.length,I=S-1;w<S;I=w++){const R=x[I],L=x[w];if(No(p,g,R,L))return 0;c=Math.min(c,Pc(p,g,R,L,a))}}return c}function Mh(r,t){for(const n of r)for(const a of n)if(as(a,t,!0))return!0;return!1}function ap(r,t,n,a=1/0){const c=Tc(r),d=Tc(t);if(a!==1/0&&jt(c,d,n)>=a)return a;if(ns(c,d)){if(Mh(r,t))return 0}else if(Mh(t,r))return 0;let p=1/0;for(const g of r)for(let x=0,w=g.length,S=w-1;x<w;S=x++){const I=g[S],R=g[x];for(const L of t)for(let B=0,j=L.length,$=j-1;B<j;$=B++){const X=L[$],oe=L[B];if(No(I,R,X,oe))return 0;p=Math.min(p,Pc(I,R,X,oe,n))}}return p}function Ih(r,t,n,a,c,d){if(!d)return;const p=jt(wc(a,d),c,n);p<t&&r.push([p,d,[0,0]])}function $o(r,t,n,a,c,d,p){if(!d||!p)return;const g=jt(wc(a,d),wc(c,p),n);g<t&&r.push([g,d,p])}function Go(r,t,n,a,c=1/0){let d=Math.min(a.distance(r[0],n[0][0]),c);if(d===0)return d;const p=new Vo([[0,[0,r.length-1],[0,0]]],Ph),g=Tc(n);for(;p.length>0;){const x=p.pop();if(x[0]>=d)continue;const w=x[1],S=t?50:100;if(Uo(w)<=S){if(!en(w,r.length))return NaN;if(t){const I=np(r,w,n,a);if(isNaN(I)||I===0)return I;d=Math.min(d,I)}else for(let I=w[0];I<=w[1];++I){const R=rp(r[I],n,a);if(d=Math.min(d,R),d===0)return 0}}else{const I=bc(w,t);Ih(p,d,a,r,g,I[0]),Ih(p,d,a,r,g,I[1])}}return d}function qo(r,t,n,a,c,d=1/0){let p=Math.min(d,c.distance(r[0],n[0]));if(p===0)return p;const g=new Vo([[0,[0,r.length-1],[0,n.length-1]]],Ph);for(;g.length>0;){const x=g.pop();if(x[0]>=p)continue;const w=x[1],S=x[2],I=t?50:100,R=a?50:100;if(Uo(w)<=I&&Uo(S)<=R){if(!en(w,r.length)&&en(S,n.length))return NaN;let L;if(t&&a)L=tp(r,w,n,S,c),p=Math.min(p,L);else if(t&&!a){const B=r.slice(w[0],w[1]+1);for(let j=S[0];j<=S[1];++j)if(L=_a(n[j],B,c),p=Math.min(p,L),p===0)return p}else if(!t&&a){const B=n.slice(S[0],S[1]+1);for(let j=w[0];j<=w[1];++j)if(L=_a(r[j],B,c),p=Math.min(p,L),p===0)return p}else L=ip(r,w,n,S,c),p=Math.min(p,L)}else{const L=bc(w,t),B=bc(S,a);$o(g,p,c,r,n,L[0],B[0]),$o(g,p,c,r,n,L[0],B[1]),$o(g,p,c,r,n,L[1],B[0]),$o(g,p,c,r,n,L[1],B[1])}}return p}function Sc(r){return r.type==="MultiPolygon"?r.coordinates.map(t=>({type:"Polygon",coordinates:t})):r.type==="MultiLineString"?r.coordinates.map(t=>({type:"LineString",coordinates:t})):r.type==="MultiPoint"?r.coordinates.map(t=>({type:"Point",coordinates:t})):[r]}class ya{constructor(t,n){this.type=De,this.geojson=t,this.geometries=n}static parse(t,n){if(t.length!==2)return n.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if($n(t[1])){const a=t[1];if(a.type==="FeatureCollection")return new ya(a,a.features.map(c=>Sc(c.geometry)).flat());if(a.type==="Feature")return new ya(a,Sc(a.geometry));if("type"in a&&"coordinates"in a)return new ya(a,Sc(a))}return n.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(n,a){const c=n.geometry(),d=c.flat().map(x=>rs([x.x,x.y],n.canonical));if(c.length===0)return NaN;const p=new vc(d[0][1]);let g=1/0;for(const x of a){switch(x.type){case"Point":g=Math.min(g,qo(d,!1,[x.coordinates],!1,p,g));break;case"LineString":g=Math.min(g,qo(d,!1,x.coordinates,!0,p,g));break;case"Polygon":g=Math.min(g,Go(d,!1,x.coordinates,p,g))}if(g===0)return g}return g}(t,this.geometries);if(t.geometryType()==="LineString")return function(n,a){const c=n.geometry(),d=c.flat().map(x=>rs([x.x,x.y],n.canonical));if(c.length===0)return NaN;const p=new vc(d[0][1]);let g=1/0;for(const x of a){switch(x.type){case"Point":g=Math.min(g,qo(d,!0,[x.coordinates],!1,p,g));break;case"LineString":g=Math.min(g,qo(d,!0,x.coordinates,!0,p,g));break;case"Polygon":g=Math.min(g,Go(d,!0,x.coordinates,p,g))}if(g===0)return g}return g}(t,this.geometries);if(t.geometryType()==="Polygon")return function(n,a){const c=n.geometry();if(c.length===0||c[0].length===0)return NaN;const d=Gs(c,0).map(x=>x.map(w=>w.map(S=>rs([S.x,S.y],n.canonical)))),p=new vc(d[0][0][0][1]);let g=1/0;for(const x of a)for(const w of d){switch(x.type){case"Point":g=Math.min(g,Go([x.coordinates],!1,w,p,g));break;case"LineString":g=Math.min(g,Go(x.coordinates,!0,w,p,g));break;case"Polygon":g=Math.min(g,ap(w,x.coordinates,p,g))}if(g===0)return g}return g}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const ss={"==":dc,"!=":Xd,">":jo,"<":Oo,">=":fh,"<=":Ur,array:dr,at:Zr,boolean:dr,case:Zs,coalesce:ts,collator:ma,format:is,image:fc,in:js,"index-of":Ns,interpolate:er,"interpolate-hcl":er,"interpolate-lab":er,length:mc,let:Rt,literal:Gn,match:Lo,number:dr,"number-format":pc,object:dr,slice:Vs,step:es,string:dr,"to-boolean":Jr,"to-color":Jr,"to-number":Jr,"to-string":Jr,var:Qa,within:ga,distance:ya};class Er{constructor(t,n,a,c){this.name=t,this.type=n,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,n){const a=t[0],c=Er.definitions[a];if(!c)return n.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,g=p.filter(([w])=>!Array.isArray(w)||w.length===t.length-1);let x=null;for(const[w,S]of g){x=new Ja(n.registry,Wo,n.path,null,n.scope);const I=[];let R=!1;for(let L=1;L<t.length;L++){const B=t[L],j=Array.isArray(w)?w[L-1]:w.type,$=x.parse(B,1+I.length,j);if(!$){R=!0;break}I.push($)}if(!R)if(Array.isArray(w)&&w.length!==I.length)x.error(`Expected ${w.length} arguments, but found ${I.length} instead.`);else{for(let L=0;L<I.length;L++){const B=Array.isArray(w)?w[L]:w.type,j=I[L];x.concat(L+1).checkSubtype(B,j.type)}if(x.errors.length===0)return new Er(a,d,S,I)}}if(g.length===1)n.errors.push(...x.errors);else{const w=(g.length?g:p).map(([I])=>{return R=I,Array.isArray(R)?`(${R.map(di).join(", ")})`:`(${di(R.type)}...)`;var R}).join(" | "),S=[];for(let I=1;I<t.length;I++){const R=n.parse(t[I],1+S.length);if(!R)return null;S.push(di(R.type))}n.error(`Expected arguments of type ${w}, but found (${S.join(", ")}) instead.`)}return null}static register(t,n){Er.definitions=n;for(const a in n)t[a]=Er}}function Ch(r,[t,n,a,c]){t=t.evaluate(r),n=n.evaluate(r),a=a.evaluate(r);const d=c?c.evaluate(r):1,p=uh(t,n,a,d);if(p)throw new ci(p);return new Ft(t/255,n/255,a/255,d,!1)}function kh(r,t){return r in t}function Mc(r,t){const n=t[r];return n===void 0?null:n}function xa(r){return{type:r}}function Wo(r){if(r instanceof Qa)return Wo(r.boundExpression);if(r instanceof Er&&r.name==="error"||r instanceof ma||r instanceof ga||r instanceof ya)return!1;const t=r instanceof Jr||r instanceof dr;let n=!0;return r.eachChild(a=>{n=t?n&&Wo(a):n&&a instanceof Gn}),!!n&&Ho(r)&&Xo(r,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ho(r){if(r instanceof Er&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof ga||r instanceof ya)return!1;let t=!0;return r.eachChild(n=>{t&&!Ho(n)&&(t=!1)}),t}function qs(r){if(r instanceof Er&&r.name==="feature-state")return!1;let t=!0;return r.eachChild(n=>{t&&!qs(n)&&(t=!1)}),t}function Xo(r,t){if(r instanceof Er&&t.indexOf(r.name)>=0)return!1;let n=!0;return r.eachChild(a=>{n&&!Xo(a,t)&&(n=!1)}),n}function Eh(r){return{result:"success",value:r}}function os(r){return{result:"error",value:r}}function ls(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function Ah(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function Ic(r){return!!r.expression&&r.expression.interpolated}function Bt(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function Ko(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Cc(r){return r}function zh(r,t){const n=t.type==="color",a=r.stops&&typeof r.stops[0][0]=="object",c=a||!(a||r.property!==void 0),d=r.type||(Ic(t)?"exponential":"interval");if(n||t.type==="padding"){const S=n?Ft.parse:Xi.parse;(r=dt({},r)).stops&&(r.stops=r.stops.map(I=>[I[0],S(I[1])])),r.default=S(r.default?r.default:t.default)}if(r.colorSpace&&(p=r.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var p;let g,x,w;if(d==="exponential")g=Dh;else if(d==="interval")g=Rh;else if(d==="categorical"){g=sp,x=Object.create(null);for(const S of r.stops)x[S[0]]=S[1];w=typeof r.stops[0][0]}else{if(d!=="identity")throw new Error(`Unknown function type "${d}"`);g=op}if(a){const S={},I=[];for(let B=0;B<r.stops.length;B++){const j=r.stops[B],$=j[0].zoom;S[$]===void 0&&(S[$]={zoom:$,type:r.type,property:r.property,default:r.default,stops:[]},I.push($)),S[$].stops.push([j[0].value,j[1]])}const R=[];for(const B of I)R.push([S[B].zoom,zh(S[B],t)]);const L={name:"linear"};return{kind:"composite",interpolationType:L,interpolationFactor:er.interpolationFactor.bind(void 0,L),zoomStops:R.map(B=>B[0]),evaluate:({zoom:B},j)=>Dh({stops:R,base:r.base},t,B).evaluate(B,j)}}if(c){const S=d==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:S,interpolationFactor:er.interpolationFactor.bind(void 0,S),zoomStops:r.stops.map(I=>I[0]),evaluate:({zoom:I})=>g(r,t,I,x,w)}}return{kind:"source",evaluate(S,I){const R=I&&I.properties?I.properties[r.property]:void 0;return R===void 0?Ws(r.default,t.default):g(r,t,R,x,w)}}}function Ws(r,t,n){return r!==void 0?r:t!==void 0?t:n!==void 0?n:void 0}function sp(r,t,n,a,c){return Ws(typeof n===c?a[n]:void 0,r.default,t.default)}function Rh(r,t,n){if(Bt(n)!=="number")return Ws(r.default,t.default);const a=r.stops.length;if(a===1||n<=r.stops[0][0])return r.stops[0][1];if(n>=r.stops[a-1][0])return r.stops[a-1][1];const c=Fo(r.stops.map(d=>d[0]),n);return r.stops[c][1]}function Dh(r,t,n){const a=r.base!==void 0?r.base:1;if(Bt(n)!=="number")return Ws(r.default,t.default);const c=r.stops.length;if(c===1||n<=r.stops[0][0])return r.stops[0][1];if(n>=r.stops[c-1][0])return r.stops[c-1][1];const d=Fo(r.stops.map(S=>S[0]),n),p=function(S,I,R,L){const B=L-R,j=S-R;return B===0?0:I===1?j/B:(Math.pow(I,j)-1)/(Math.pow(I,B)-1)}(n,a,r.stops[d][0],r.stops[d+1][0]),g=r.stops[d][1],x=r.stops[d+1][1],w=Vr[t.type]||Cc;return typeof g.evaluate=="function"?{evaluate(...S){const I=g.evaluate.apply(void 0,S),R=x.evaluate.apply(void 0,S);if(I!==void 0&&R!==void 0)return w(I,R,p,r.colorSpace)}}:w(g,x,p,r.colorSpace)}function op(r,t,n){switch(t.type){case"color":n=Ft.parse(n);break;case"formatted":n=nr.fromString(n.toString());break;case"resolvedImage":n=hr.fromString(n.toString());break;case"padding":n=Xi.parse(n);break;default:Bt(n)===t.type||t.type==="enum"&&t.values[n]||(n=void 0)}return Ws(n,r.default,t.default)}Er.register(ss,{error:[{kind:"error"},[He],(r,[t])=>{throw new ci(t.evaluate(r))}],typeof:[He,[ot],(r,[t])=>di(ui(t.evaluate(r)))],"to-rgba":[ur(De,4),[_t],(r,[t])=>{const[n,a,c,d]=t.evaluate(r).rgb;return[255*n,255*a,255*c,d]}],rgb:[_t,[De,De,De],Ch],rgba:[_t,[De,De,De,De],Ch],has:{type:Ze,overloads:[[[He],(r,[t])=>kh(t.evaluate(r),r.properties())],[[He,gn],(r,[t,n])=>kh(t.evaluate(r),n.evaluate(r))]]},get:{type:ot,overloads:[[[He],(r,[t])=>Mc(t.evaluate(r),r.properties())],[[He,gn],(r,[t,n])=>Mc(t.evaluate(r),n.evaluate(r))]]},"feature-state":[ot,[He],(r,[t])=>Mc(t.evaluate(r),r.featureState||{})],properties:[gn,[],r=>r.properties()],"geometry-type":[He,[],r=>r.geometryType()],id:[ot,[],r=>r.id()],zoom:[De,[],r=>r.globals.zoom],"heatmap-density":[De,[],r=>r.globals.heatmapDensity||0],"line-progress":[De,[],r=>r.globals.lineProgress||0],accumulated:[ot,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[De,xa(De),(r,t)=>{let n=0;for(const a of t)n+=a.evaluate(r);return n}],"*":[De,xa(De),(r,t)=>{let n=1;for(const a of t)n*=a.evaluate(r);return n}],"-":{type:De,overloads:[[[De,De],(r,[t,n])=>t.evaluate(r)-n.evaluate(r)],[[De],(r,[t])=>-t.evaluate(r)]]},"/":[De,[De,De],(r,[t,n])=>t.evaluate(r)/n.evaluate(r)],"%":[De,[De,De],(r,[t,n])=>t.evaluate(r)%n.evaluate(r)],ln2:[De,[],()=>Math.LN2],pi:[De,[],()=>Math.PI],e:[De,[],()=>Math.E],"^":[De,[De,De],(r,[t,n])=>Math.pow(t.evaluate(r),n.evaluate(r))],sqrt:[De,[De],(r,[t])=>Math.sqrt(t.evaluate(r))],log10:[De,[De],(r,[t])=>Math.log(t.evaluate(r))/Math.LN10],ln:[De,[De],(r,[t])=>Math.log(t.evaluate(r))],log2:[De,[De],(r,[t])=>Math.log(t.evaluate(r))/Math.LN2],sin:[De,[De],(r,[t])=>Math.sin(t.evaluate(r))],cos:[De,[De],(r,[t])=>Math.cos(t.evaluate(r))],tan:[De,[De],(r,[t])=>Math.tan(t.evaluate(r))],asin:[De,[De],(r,[t])=>Math.asin(t.evaluate(r))],acos:[De,[De],(r,[t])=>Math.acos(t.evaluate(r))],atan:[De,[De],(r,[t])=>Math.atan(t.evaluate(r))],min:[De,xa(De),(r,t)=>Math.min(...t.map(n=>n.evaluate(r)))],max:[De,xa(De),(r,t)=>Math.max(...t.map(n=>n.evaluate(r)))],abs:[De,[De],(r,[t])=>Math.abs(t.evaluate(r))],round:[De,[De],(r,[t])=>{const n=t.evaluate(r);return n<0?-Math.round(-n):Math.round(n)}],floor:[De,[De],(r,[t])=>Math.floor(t.evaluate(r))],ceil:[De,[De],(r,[t])=>Math.ceil(t.evaluate(r))],"filter-==":[Ze,[He,ot],(r,[t,n])=>r.properties()[t.value]===n.value],"filter-id-==":[Ze,[ot],(r,[t])=>r.id()===t.value],"filter-type-==":[Ze,[He],(r,[t])=>r.geometryType()===t.value],"filter-<":[Ze,[He,ot],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a<c}],"filter-id-<":[Ze,[ot],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n<a}],"filter->":[Ze,[He,ot],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a>c}],"filter-id->":[Ze,[ot],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n>a}],"filter-<=":[Ze,[He,ot],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a<=c}],"filter-id-<=":[Ze,[ot],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n<=a}],"filter->=":[Ze,[He,ot],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a>=c}],"filter-id->=":[Ze,[ot],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n>=a}],"filter-has":[Ze,[ot],(r,[t])=>t.value in r.properties()],"filter-has-id":[Ze,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[Ze,[ur(He)],(r,[t])=>t.value.indexOf(r.geometryType())>=0],"filter-id-in":[Ze,[ur(ot)],(r,[t])=>t.value.indexOf(r.id())>=0],"filter-in-small":[Ze,[He,ur(ot)],(r,[t,n])=>n.value.indexOf(r.properties()[t.value])>=0],"filter-in-large":[Ze,[He,ur(ot)],(r,[t,n])=>function(a,c,d,p){for(;d<=p;){const g=d+p>>1;if(c[g]===a)return!0;c[g]>a?p=g-1:d=g+1}return!1}(r.properties()[t.value],n.value,0,n.value.length-1)],all:{type:Ze,overloads:[[[Ze,Ze],(r,[t,n])=>t.evaluate(r)&&n.evaluate(r)],[xa(Ze),(r,t)=>{for(const n of t)if(!n.evaluate(r))return!1;return!0}]]},any:{type:Ze,overloads:[[[Ze,Ze],(r,[t,n])=>t.evaluate(r)||n.evaluate(r)],[xa(Ze),(r,t)=>{for(const n of t)if(n.evaluate(r))return!0;return!1}]]},"!":[Ze,[Ze],(r,[t])=>!t.evaluate(r)],"is-supported-script":[Ze,[He],(r,[t])=>{const n=r.globals&&r.globals.isSupportedScript;return!n||n(t.evaluate(r))}],upcase:[He,[He],(r,[t])=>t.evaluate(r).toUpperCase()],downcase:[He,[He],(r,[t])=>t.evaluate(r).toLowerCase()],concat:[He,xa(ot),(r,t)=>t.map(n=>Ya(n.evaluate(r))).join("")],"resolved-locale":[He,[Fi],(r,[t])=>t.evaluate(r).resolvedLocale()]});class cs{constructor(t,n){var a;this.expression=t,this._warningHistory={},this._evaluator=new vt,this._defaultValue=n?(a=n).type==="color"&&Ko(a.default)?new Ft(0,0,0,0):a.type==="color"?Ft.parse(a.default)||null:a.type==="padding"?Xi.parse(a.default)||null:a.type==="variableAnchorOffsetCollection"?ar.parse(a.default)||null:a.type==="projectionDefinition"?Bi.parse(a.default)||null:a.default===void 0?null:a.default:null,this._enumValues=n&&n.type==="enum"?n.values:null}evaluateWithoutErrorHandling(t,n,a,c,d,p){return this._evaluator.globals=t,this._evaluator.feature=n,this._evaluator.featureState=a,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(t,n,a,c,d,p){this._evaluator.globals=t,this._evaluator.feature=n||null,this._evaluator.featureState=a||null,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p||null;try{const g=this.expression.evaluate(this._evaluator);if(g==null||typeof g=="number"&&g!=g)return this._defaultValue;if(this._enumValues&&!(g in this._enumValues))throw new ci(`Expected value to be one of ${Object.keys(this._enumValues).map(x=>JSON.stringify(x)).join(", ")}, but found ${JSON.stringify(g)} instead.`);return g}catch(g){return this._warningHistory[g.message]||(this._warningHistory[g.message]=!0,typeof console<"u"&&console.warn(g.message)),this._defaultValue}}}function Hs(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in ss}function Yo(r,t){const n=new Ja(ss,Wo,[],t?function(c){const d={color:_t,string:He,number:De,enum:He,boolean:Ze,formatted:ii,padding:zo,projectionDefinition:mi,resolvedImage:Ga,variableAnchorOffsetCollection:Zn};return c.type==="array"?ur(d[c.value]||ot,c.length):d[c.type]}(t):void 0),a=n.parse(r,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?Eh(new cs(a,t)):os(n.errors)}class kc{constructor(t,n){this.kind=t,this._styleExpression=n,this.isStateDependent=t!=="constant"&&!qs(n.expression)}evaluateWithoutErrorHandling(t,n,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,n,a,c,d,p)}evaluate(t,n,a,c,d,p){return this._styleExpression.evaluate(t,n,a,c,d,p)}}class Ec{constructor(t,n,a,c){this.kind=t,this.zoomStops=a,this._styleExpression=n,this.isStateDependent=t!=="camera"&&!qs(n.expression),this.interpolationType=c}evaluateWithoutErrorHandling(t,n,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,n,a,c,d,p)}evaluate(t,n,a,c,d,p){return this._styleExpression.evaluate(t,n,a,c,d,p)}interpolationFactor(t,n,a){return this.interpolationType?er.interpolationFactor(this.interpolationType,t,n,a):0}}function Lh(r,t){const n=Yo(r,t);if(n.result==="error")return n;const a=n.value.expression,c=Ho(a);if(!c&&!ls(t))return os([new it("","data expressions not supported")]);const d=Xo(a,["zoom"]);if(!d&&!Ah(t))return os([new it("","zoom expressions not supported")]);const p=Xs(a);return p||d?p instanceof it?os([p]):p instanceof er&&!Ic(t)?os([new it("",'"interpolate" expressions cannot be used with this property')]):Eh(p?new Ec(c?"camera":"composite",n.value,p.labels,p instanceof er?p.interpolation:void 0):new kc(c?"constant":"source",n.value)):os([new it("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Jo{constructor(t,n){this._parameters=t,this._specification=n,dt(this,zh(this._parameters,this._specification))}static deserialize(t){return new Jo(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Xs(r){let t=null;if(r instanceof Rt)t=Xs(r.result);else if(r instanceof ts){for(const n of r.args)if(t=Xs(n),t)break}else(r instanceof es||r instanceof er)&&r.input instanceof Er&&r.input.name==="zoom"&&(t=r);return t instanceof it||r.eachChild(n=>{const a=Xs(n);a instanceof it?t=a:!t&&a?t=new it("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&a&&t!==a&&(t=new it("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function Qo(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const t of r.slice(1))if(!Qo(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const lp={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ac(r){if(r==null)return{filter:()=>!0,needGeometry:!1};Qo(r)||(r=Ks(r));const t=Yo(r,lp);if(t.result==="error")throw new Error(t.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,a,c)=>t.value.evaluate(n,a,{},c),needGeometry:zc(r)}}function Fh(r,t){return r<t?-1:r>t?1:0}function zc(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let t=1;t<r.length;t++)if(zc(r[t]))return!0;return!1}function Ks(r){if(!r)return!0;const t=r[0];return r.length<=1?t!=="any":t==="=="?el(r[1],r[2],"=="):t==="!="?us(el(r[1],r[2],"==")):t==="<"||t===">"||t==="<="||t===">="?el(r[1],r[2],t):t==="any"?(n=r.slice(1),["any"].concat(n.map(Ks))):t==="all"?["all"].concat(r.slice(1).map(Ks)):t==="none"?["all"].concat(r.slice(1).map(Ks).map(us)):t==="in"?tl(r[1],r.slice(2)):t==="!in"?us(tl(r[1],r.slice(2))):t==="has"?il(r[1]):t!=="!has"||us(il(r[1]));var n}function el(r,t,n){switch(r){case"$type":return[`filter-type-${n}`,t];case"$id":return[`filter-id-${n}`,t];default:return[`filter-${n}`,r,t]}}function tl(r,t){if(t.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(n=>typeof n!=typeof t[0])?["filter-in-large",r,["literal",t.sort(Fh)]]:["filter-in-small",r,["literal",t]]}}function il(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function us(r){return["!",r]}function hs(r){const t=typeof r;if(t==="number"||t==="boolean"||t==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let c="[";for(const d of r)c+=`${hs(d)},`;return`${c}]`}const n=Object.keys(r).sort();let a="{";for(let c=0;c<n.length;c++)a+=`${JSON.stringify(n[c])}:${hs(r[n[c]])},`;return`${a}}`}function cp(r){let t="";for(const n of J)t+=`/${hs(r[n])}`;return t}function Bh(r){const t=r.value;return t?[new Te(r.key,t,"constants have been deprecated as of v8")]:[]}function Ti(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function va(r){if(Array.isArray(r))return r.map(va);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const t={};for(const n in r)t[n]=va(r[n]);return t}return Ti(r)}function Ar(r){const t=r.key,n=r.value,a=r.valueSpec||{},c=r.objectElementValidators||{},d=r.style,p=r.styleSpec,g=r.validateSpec;let x=[];const w=Bt(n);if(w!=="object")return[new Te(t,n,`object expected, ${w} found`)];for(const S in n){const I=S.split(".")[0],R=a[I]||a["*"];let L;if(c[I])L=c[I];else if(a[I])L=g;else if(c["*"])L=c["*"];else{if(!a["*"]){x.push(new Te(t,n[S],`unknown property "${S}"`));continue}L=g}x=x.concat(L({key:(t&&`${t}.`)+S,value:n[S],valueSpec:R,style:d,styleSpec:p,object:n,objectKey:S,validateSpec:g},n))}for(const S in a)c[S]||a[S].required&&a[S].default===void 0&&n[S]===void 0&&x.push(new Te(t,n,`missing required property "${S}"`));return x}function Rc(r){const t=r.value,n=r.valueSpec,a=r.style,c=r.styleSpec,d=r.key,p=r.arrayElementValidator||r.validateSpec;if(Bt(t)!=="array")return[new Te(d,t,`array expected, ${Bt(t)} found`)];if(n.length&&t.length!==n.length)return[new Te(d,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new Te(d,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let g={type:n.value,values:n.values};c.$version<7&&(g.function=n.function),Bt(n.value)==="object"&&(g=n.value);let x=[];for(let w=0;w<t.length;w++)x=x.concat(p({array:t,arrayIndex:w,value:t[w],valueSpec:g,validateSpec:r.validateSpec,style:a,styleSpec:c,key:`${d}[${w}]`}));return x}function rl(r){const t=r.key,n=r.value,a=r.valueSpec;let c=Bt(n);return c==="number"&&n!=n&&(c="NaN"),c!=="number"?[new Te(t,n,`number expected, ${c} found`)]:"minimum"in a&&n<a.minimum?[new Te(t,n,`${n} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&n>a.maximum?[new Te(t,n,`${n} is greater than the maximum value ${a.maximum}`)]:[]}function Dc(r){const t=r.valueSpec,n=Ti(r.value.type);let a,c,d,p={};const g=n!=="categorical"&&r.value.property===void 0,x=!g,w=Bt(r.value.stops)==="array"&&Bt(r.value.stops[0])==="array"&&Bt(r.value.stops[0][0])==="object",S=Ar({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(L){if(n==="identity")return[new Te(L.key,L.value,'identity function may not have a "stops" property')];let B=[];const j=L.value;return B=B.concat(Rc({key:L.key,value:j,valueSpec:L.valueSpec,validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec,arrayElementValidator:I})),Bt(j)==="array"&&j.length===0&&B.push(new Te(L.key,j,"array must have at least one stop")),B},default:function(L){return L.validateSpec({key:L.key,value:L.value,valueSpec:t,validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec})}}});return n==="identity"&&g&&S.push(new Te(r.key,r.value,'missing required property "property"')),n==="identity"||r.value.stops||S.push(new Te(r.key,r.value,'missing required property "stops"')),n==="exponential"&&r.valueSpec.expression&&!Ic(r.valueSpec)&&S.push(new Te(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(x&&!ls(r.valueSpec)?S.push(new Te(r.key,r.value,"property functions not supported")):g&&!Ah(r.valueSpec)&&S.push(new Te(r.key,r.value,"zoom functions not supported"))),n!=="categorical"&&!w||r.value.property!==void 0||S.push(new Te(r.key,r.value,'"property" property is required')),S;function I(L){let B=[];const j=L.value,$=L.key;if(Bt(j)!=="array")return[new Te($,j,`array expected, ${Bt(j)} found`)];if(j.length!==2)return[new Te($,j,`array length 2 expected, length ${j.length} found`)];if(w){if(Bt(j[0])!=="object")return[new Te($,j,`object expected, ${Bt(j[0])} found`)];if(j[0].zoom===void 0)return[new Te($,j,"object stop key must have zoom")];if(j[0].value===void 0)return[new Te($,j,"object stop key must have value")];if(d&&d>Ti(j[0].zoom))return[new Te($,j[0].zoom,"stop zoom values must appear in ascending order")];Ti(j[0].zoom)!==d&&(d=Ti(j[0].zoom),c=void 0,p={}),B=B.concat(Ar({key:`${$}[0]`,value:j[0],valueSpec:{zoom:{}},validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec,objectElementValidators:{zoom:rl,value:R}}))}else B=B.concat(R({key:`${$}[0]`,value:j[0],validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec},j));return Hs(va(j[1]))?B.concat([new Te(`${$}[1]`,j[1],"expressions are not allowed in function stops.")]):B.concat(L.validateSpec({key:`${$}[1]`,value:j[1],valueSpec:t,validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec}))}function R(L,B){const j=Bt(L.value),$=Ti(L.value),X=L.value!==null?L.value:B;if(a){if(j!==a)return[new Te(L.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 Te(L.key,X,"stop domain value must be a number, string, or boolean")];if(j!=="number"&&n!=="categorical"){let oe=`number expected, ${j} found`;return ls(t)&&n===void 0&&(oe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Te(L.key,X,oe)]}return n!=="categorical"||j!=="number"||isFinite($)&&Math.floor($)===$?n!=="categorical"&&j==="number"&&c!==void 0&&$<c?[new Te(L.key,X,"stop domain values must appear in ascending order")]:(c=$,n==="categorical"&&$ in p?[new Te(L.key,X,"stop domain values must be unique")]:(p[$]=!0,[])):[new Te(L.key,X,`integer expected, found ${$}`)]}}function xn(r){const t=(r.expressionContext==="property"?Lh:Yo)(va(r.value),r.valueSpec);if(t.result==="error")return t.value.map(a=>new Te(`${r.key}${a.key}`,r.value,a.message));const n=t.value.expression||t.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!n.outputDefined())return[new Te(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!qs(n))return[new Te(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!qs(n))return[new Te(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Xo(n,["zoom","feature-state"]))return[new Te(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!Ho(n))return[new Te(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ys(r){const t=r.key,n=r.value,a=r.valueSpec,c=[];return Array.isArray(a.values)?a.values.indexOf(Ti(n))===-1&&c.push(new Te(t,n,`expected one of [${a.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(a.values).indexOf(Ti(n))===-1&&c.push(new Te(t,n,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(n)} found`)),c}function nl(r){return Qo(va(r.value))?xn(dt({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Lc(r)}function Lc(r){const t=r.value,n=r.key;if(Bt(t)!=="array")return[new Te(n,t,`array expected, ${Bt(t)} found`)];const a=r.styleSpec;let c,d=[];if(t.length<1)return[new Te(n,t,"filter array must have at least 1 element")];switch(d=d.concat(Ys({key:`${n}[0]`,value:t[0],valueSpec:a.filter_operator,style:r.style,styleSpec:r.styleSpec})),Ti(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&Ti(t[1])==="$type"&&d.push(new Te(n,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&d.push(new Te(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(c=Bt(t[1]),c!=="string"&&d.push(new Te(`${n}[1]`,t[1],`string expected, ${c} found`)));for(let p=2;p<t.length;p++)c=Bt(t[p]),Ti(t[1])==="$type"?d=d.concat(Ys({key:`${n}[${p}]`,value:t[p],valueSpec:a.geometry_type,style:r.style,styleSpec:r.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&d.push(new Te(`${n}[${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(Lc({key:`${n}[${p}]`,value:t[p],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":c=Bt(t[1]),t.length!==2?d.push(new Te(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):c!=="string"&&d.push(new Te(`${n}[1]`,t[1],`string expected, ${c} found`))}return d}function Oh(r,t){const n=r.key,a=r.validateSpec,c=r.style,d=r.styleSpec,p=r.value,g=r.objectKey,x=d[`${t}_${r.layerType}`];if(!x)return[];const w=g.match(/^(.*)-transition$/);if(t==="paint"&&w&&x[w[1]]&&x[w[1]].transition)return a({key:n,value:p,valueSpec:d.transition,style:c,styleSpec:d});const S=r.valueSpec||x[g];if(!S)return[new Te(n,p,`unknown property "${g}"`)];let I;if(Bt(p)==="string"&&ls(S)&&!S.tokens&&(I=/^{([^}]+)}$/.exec(p)))return[new Te(n,p,`"${g}" does not support interpolation syntax
6
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(I[1])} }\`.`)];const R=[];return r.layerType==="symbol"&&(g==="text-field"&&c&&!c.glyphs&&R.push(new Te(n,p,'use of "text-field" requires a style "glyphs" property')),g==="text-font"&&Ko(va(p))&&Ti(p.type)==="identity"&&R.push(new Te(n,p,'"text-font" does not support identity functions'))),R.concat(a({key:r.key,value:p,valueSpec:S,style:c,styleSpec:d,expressionContext:"property",propertyType:t,propertyKey:g}))}function Fc(r){return Oh(r,"paint")}function Bc(r){return Oh(r,"layout")}function ds(r){let t=[];const n=r.value,a=r.key,c=r.style,d=r.styleSpec;n.type||n.ref||t.push(new Te(a,n,'either "type" or "ref" is required'));let p=Ti(n.type);const g=Ti(n.ref);if(n.id){const x=Ti(n.id);for(let w=0;w<r.arrayIndex;w++){const S=c.layers[w];Ti(S.id)===x&&t.push(new Te(a,n.id,`duplicate layer id "${n.id}", previously used at line ${S.id.__line__}`))}}if("ref"in n){let x;["type","source","source-layer","filter","layout"].forEach(w=>{w in n&&t.push(new Te(a,n[w],`"${w}" is prohibited for ref layers`))}),c.layers.forEach(w=>{Ti(w.id)===g&&(x=w)}),x?x.ref?t.push(new Te(a,n.ref,"ref cannot reference another ref layer")):p=Ti(x.type):t.push(new Te(a,n.ref,`ref layer "${g}" not found`))}else if(p!=="background")if(n.source){const x=c.sources&&c.sources[n.source],w=x&&Ti(x.type);x?w==="vector"&&p==="raster"?t.push(new Te(a,n.source,`layer "${n.id}" requires a raster source`)):w!=="raster-dem"&&p==="hillshade"?t.push(new Te(a,n.source,`layer "${n.id}" requires a raster-dem source`)):w==="raster"&&p!=="raster"?t.push(new Te(a,n.source,`layer "${n.id}" requires a vector source`)):w!=="vector"||n["source-layer"]?w==="raster-dem"&&p!=="hillshade"?t.push(new Te(a,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!n.paint||!n.paint["line-gradient"]||w==="geojson"&&x.lineMetrics||t.push(new Te(a,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Te(a,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new Te(a,n.source,`source "${n.source}" not found`))}else t.push(new Te(a,n,'missing required property "source"'));return t=t.concat(Ar({key:a,value:n,valueSpec:d.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${a}.type`,value:n.type,valueSpec:d.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:n,objectKey:"type"}),filter:nl,layout:x=>Ar({layer:n,key:x.key,value:x.value,style:x.style,styleSpec:x.styleSpec,validateSpec:x.validateSpec,objectElementValidators:{"*":w=>Bc(dt({layerType:p},w))}}),paint:x=>Ar({layer:n,key:x.key,value:x.value,style:x.style,styleSpec:x.styleSpec,validateSpec:x.validateSpec,objectElementValidators:{"*":w=>Fc(dt({layerType:p},w))}})}})),t}function ba(r){const t=r.value,n=r.key,a=Bt(t);return a!=="string"?[new Te(n,t,`string expected, ${a} found`)]:[]}const jh={promoteId:function({key:r,value:t}){if(Bt(t)==="string")return ba({key:r,value:t});{const n=[];for(const a in t)n.push(...ba({key:`${r}.${a}`,value:t[a]}));return n}}};function Nh(r){const t=r.value,n=r.key,a=r.styleSpec,c=r.style,d=r.validateSpec;if(!t.type)return[new Te(n,t,'"type" is required')];const p=Ti(t.type);let g;switch(p){case"vector":case"raster":return g=Ar({key:n,value:t,valueSpec:a[`source_${p.replace("-","_")}`],style:r.style,styleSpec:a,objectElementValidators:jh,validateSpec:d}),g;case"raster-dem":return g=function(x){var w;const S=(w=x.sourceName)!==null&&w!==void 0?w:"",I=x.value,R=x.styleSpec,L=R.source_raster_dem,B=x.style;let j=[];const $=Bt(I);if(I===void 0)return j;if($!=="object")return j.push(new Te("source_raster_dem",I,`object expected, ${$} found`)),j;const X=Ti(I.encoding)==="custom",oe=["redFactor","greenFactor","blueFactor","baseShift"],Y=x.value.encoding?`"${x.value.encoding}"`:"Default";for(const D in I)!X&&oe.includes(D)?j.push(new Te(D,I[D],`In "${S}": "${D}" is only valid when "encoding" is set to "custom". ${Y} encoding found`)):L[D]?j=j.concat(x.validateSpec({key:D,value:I[D],valueSpec:L[D],validateSpec:x.validateSpec,style:B,styleSpec:R})):j.push(new Te(D,I[D],`unknown property "${D}"`));return j}({sourceName:n,value:t,style:r.style,styleSpec:a,validateSpec:d}),g;case"geojson":if(g=Ar({key:n,value:t,valueSpec:a.source_geojson,style:c,styleSpec:a,validateSpec:d,objectElementValidators:jh}),t.cluster)for(const x in t.clusterProperties){const[w,S]=t.clusterProperties[x],I=typeof w=="string"?[w,["accumulated"],["get",x]]:w;g.push(...xn({key:`${n}.${x}.map`,value:S,expressionContext:"cluster-map"})),g.push(...xn({key:`${n}.${x}.reduce`,value:I,expressionContext:"cluster-reduce"}))}return g;case"video":return Ar({key:n,value:t,valueSpec:a.source_video,style:c,validateSpec:d,styleSpec:a});case"image":return Ar({key:n,value:t,valueSpec:a.source_image,style:c,validateSpec:d,styleSpec:a});case"canvas":return[new Te(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ys({key:`${n}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Zh(r){const t=r.value,n=r.styleSpec,a=n.light,c=r.style;let d=[];const p=Bt(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new Te("light",t,`object expected, ${p} found`)]),d;for(const g in t){const x=g.match(/^(.*)-transition$/);d=d.concat(x&&a[x[1]]&&a[x[1]].transition?r.validateSpec({key:g,value:t[g],valueSpec:n.transition,validateSpec:r.validateSpec,style:c,styleSpec:n}):a[g]?r.validateSpec({key:g,value:t[g],valueSpec:a[g],validateSpec:r.validateSpec,style:c,styleSpec:n}):[new Te(g,t[g],`unknown property "${g}"`)])}return d}function Vh(r){const t=r.value,n=r.styleSpec,a=n.sky,c=r.style,d=Bt(t);if(t===void 0)return[];if(d!=="object")return[new Te("sky",t,`object expected, ${d} found`)];let p=[];for(const g in t)p=p.concat(a[g]?r.validateSpec({key:g,value:t[g],valueSpec:a[g],style:c,styleSpec:n}):[new Te(g,t[g],`unknown property "${g}"`)]);return p}function Uh(r){const t=r.value,n=r.styleSpec,a=n.terrain,c=r.style;let d=[];const p=Bt(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new Te("terrain",t,`object expected, ${p} found`)]),d;for(const g in t)d=d.concat(a[g]?r.validateSpec({key:g,value:t[g],valueSpec:a[g],validateSpec:r.validateSpec,style:c,styleSpec:n}):[new Te(g,t[g],`unknown property "${g}"`)]);return d}function ps(r){let t=[];const n=r.value,a=r.key;if(Array.isArray(n)){const c=[],d=[];for(const p in n)n[p].id&&c.includes(n[p].id)&&t.push(new Te(a,n,`all the sprites' ids must be unique, but ${n[p].id} is duplicated`)),c.push(n[p].id),n[p].url&&d.includes(n[p].url)&&t.push(new Te(a,n,`all the sprites' URLs must be unique, but ${n[p].url} is duplicated`)),d.push(n[p].url),t=t.concat(Ar({key:`${a}[${p}]`,value:n[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return t}return ba({key:a,value:n})}const fs={"*":()=>[],array:Rc,boolean:function(r){const t=r.value,n=r.key,a=Bt(t);return a!=="boolean"?[new Te(n,t,`boolean expected, ${a} found`)]:[]},number:rl,color:function(r){const t=r.key,n=r.value,a=Bt(n);return a!=="string"?[new Te(t,n,`color expected, ${a} found`)]:Ft.parse(String(n))?[]:[new Te(t,n,`color expected, "${n}" found`)]},constants:Bh,enum:Ys,filter:nl,function:Dc,layer:ds,object:Ar,source:Nh,light:Zh,sky:Vh,terrain:Uh,projection:function(r){const t=r.value,n=r.styleSpec,a=n.projection,c=r.style,d=Bt(t);if(t===void 0)return[];if(d!=="object")return[new Te("projection",t,`object expected, ${d} found`)];let p=[];for(const g in t)p=p.concat(a[g]?r.validateSpec({key:g,value:t[g],valueSpec:a[g],style:c,styleSpec:n}):[new Te(g,t[g],`unknown property "${g}"`)]);return p},projectionDefinition:function(r){const t=r.key;let n=r.value;n=n instanceof String?n.valueOf():n;const a=Bt(n);return a!=="array"||function(c){return Array.isArray(c)&&c.length===3&&typeof c[0]=="string"&&typeof c[1]=="string"&&typeof c[2]=="number"}(n)||function(c){return!!["interpolate","step","literal"].includes(c[0])}(n)?["array","string"].includes(a)?[]:[new Te(t,n,`projection expected, invalid type "${a}" found`)]:[new Te(t,n,`projection expected, invalid array ${JSON.stringify(n)} found`)]},string:ba,formatted:function(r){return ba(r).length===0?[]:xn(r)},resolvedImage:function(r){return ba(r).length===0?[]:xn(r)},padding:function(r){const t=r.key,n=r.value;if(Bt(n)==="array"){if(n.length<1||n.length>4)return[new Te(t,n,`padding requires 1 to 4 values; ${n.length} values found`)];const a={type:"number"};let c=[];for(let d=0;d<n.length;d++)c=c.concat(r.validateSpec({key:`${t}[${d}]`,value:n[d],validateSpec:r.validateSpec,valueSpec:a}));return c}return rl({key:t,value:n,valueSpec:{}})},variableAnchorOffsetCollection:function(r){const t=r.key,n=r.value,a=Bt(n),c=r.styleSpec;if(a!=="array"||n.length<1||n.length%2!=0)return[new Te(t,n,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let p=0;p<n.length;p+=2)d=d.concat(Ys({key:`${t}[${p}]`,value:n[p],valueSpec:c.layout_symbol["text-anchor"]})),d=d.concat(Rc({key:`${t}[${p+1}]`,value:n[p+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:c}));return d},sprite:ps};function tr(r){const t=r.value,n=r.valueSpec,a=r.styleSpec;return r.validateSpec=tr,n.expression&&Ko(Ti(t))?Dc(r):n.expression&&Hs(va(t))?xn(r):n.type&&fs[n.type]?fs[n.type](r):Ar(dt({},r,{valueSpec:n.type?a[n.type]:n}))}function ms(r){const t=r.value,n=r.key,a=ba(r);return a.length||(t.indexOf("{fontstack}")===-1&&a.push(new Te(n,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&a.push(new Te(n,t,'"glyphs" url must include a "{range}" token'))),a}function zr(r,t=F){let n=[];return n=n.concat(tr({key:"",value:r,valueSpec:t.$root,styleSpec:t,style:r,validateSpec:tr,objectElementValidators:{glyphs:ms,"*":()=>[]}})),r.constants&&(n=n.concat(Bh({key:"constants",value:r.constants}))),$h(n)}function tn(r){return function(t){return r({...t,validateSpec:tr})}}function $h(r){return[].concat(r).sort((t,n)=>t.line-n.line)}function pr(r){return function(...t){return $h(r.apply(this,t))}}zr.source=pr(tn(Nh)),zr.sprite=pr(tn(ps)),zr.glyphs=pr(tn(ms)),zr.light=pr(tn(Zh)),zr.sky=pr(tn(Vh)),zr.terrain=pr(tn(Uh)),zr.layer=pr(tn(ds)),zr.filter=pr(tn(nl)),zr.paintProperty=pr(tn(Fc)),zr.layoutProperty=pr(tn(Bc));const wa=zr,Oc=wa.light,up=wa.sky,jc=wa.paintProperty,hp=wa.layoutProperty;function gs(r,t){let n=!1;if(t&&t.length)for(const a of t)r.fire(new N(new Error(a.message))),n=!0;return n}class Js{constructor(t,n,a){const c=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const p=new Int32Array(this.arrayBuffer);t=p[0],this.d=(n=p[1])+2*(a=p[2]);for(let x=0;x<this.d*this.d;x++){const w=p[3+x],S=p[3+x+1];c.push(w===S?null:p.subarray(w,S))}const g=p[3+c.length+1];this.keys=p.subarray(p[3+c.length],g),this.bboxes=p.subarray(g),this.insert=this._insertReadonly}else{this.d=n+2*a;for(let p=0;p<this.d*this.d;p++)c.push([]);this.keys=[],this.bboxes=[]}this.n=n,this.extent=t,this.padding=a,this.scale=n/t,this.uid=0;const d=a/n*t;this.min=-d,this.max=t+d}insert(t,n,a,c,d){this._forEachCell(n,a,c,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(n),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,n,a,c,d,p){this.cells[d].push(p)}query(t,n,a,c,d){const p=this.min,g=this.max;if(t<=p&&n<=p&&g<=a&&g<=c&&!d)return Array.prototype.slice.call(this.keys);{const x=[];return this._forEachCell(t,n,a,c,this._queryCell,x,{},d),x}}_queryCell(t,n,a,c,d,p,g,x){const w=this.cells[d];if(w!==null){const S=this.keys,I=this.bboxes;for(let R=0;R<w.length;R++){const L=w[R];if(g[L]===void 0){const B=4*L;(x?x(I[B+0],I[B+1],I[B+2],I[B+3]):t<=I[B+2]&&n<=I[B+3]&&a>=I[B+0]&&c>=I[B+1])?(g[L]=!0,p.push(S[L])):g[L]=!1}}}}_forEachCell(t,n,a,c,d,p,g,x){const w=this._convertToCellCoord(t),S=this._convertToCellCoord(n),I=this._convertToCellCoord(a),R=this._convertToCellCoord(c);for(let L=w;L<=I;L++)for(let B=S;B<=R;B++){const j=this.d*B+L;if((!x||x(this._convertFromCellCoord(L),this._convertFromCellCoord(B),this._convertFromCellCoord(L+1),this._convertFromCellCoord(B+1)))&&d.call(this,t,n,a,c,j,p,g,x))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,n=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(n+a+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let d=n;for(let p=0;p<t.length;p++){const g=t[p];c[3+p]=d,c.set(g,d),d+=g.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,n){const a=t.toArrayBuffer();return n&&n.push(a),{buffer:a}}static deserialize(t){return new Js(t.buffer)}}const br={};function $e(r,t,n={}){if(br[r])throw new Error(`${r} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:r,writeable:!1}),br[r]={klass:t,omit:n.omit||[],shallow:n.shallow||[]}}$e("Object",Object),$e("TransferableGridIndex",Js),$e("Color",Ft),$e("Error",Error),$e("AJAXError",Yr),$e("ResolvedImage",hr),$e("StylePropertyFunction",Jo),$e("StyleExpression",cs,{omit:["_evaluator"]}),$e("ZoomDependentExpression",Ec),$e("ZoomConstantExpression",kc),$e("CompoundExpression",Er,{omit:["_evaluate"]});for(const r in ss)ss[r]._classRegistryKey||$e(`Expression_${r}`,ss[r]);function Gh(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function _s(r){return r.$name||r.constructor._classRegistryKey}function qh(r){return!function(t){if(t===null||typeof t!="object")return!1;const n=_s(t);return!(!n||n==="Object")}(r)&&(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||Gh(r)||ca(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function Ta(r,t){if(qh(r))return(Gh(r)||ca(r))&&t&&t.push(r),ArrayBuffer.isView(r)&&t&&t.push(r.buffer),r instanceof ImageData&&t&&t.push(r.data.buffer),r;if(Array.isArray(r)){const d=[];for(const p of r)d.push(Ta(p,t));return d}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const n=_s(r);if(!n)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!br[n])throw new Error(`${n} is not registered.`);const{klass:a}=br[n],c=a.serialize?a.serialize(r,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 r){if(!r.hasOwnProperty(d)||br[n].omit.indexOf(d)>=0)continue;const p=r[d];c[d]=br[n].shallow.indexOf(d)>=0?p:Ta(p,t)}r instanceof Error&&(c.message=r.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(c.$name=n),c}function qn(r){if(qh(r))return r;if(Array.isArray(r))return r.map(qn);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const t=_s(r)||"Object";if(!br[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:n}=br[t];if(!n)throw new Error(`can't deserialize unregistered class ${t}`);if(n.deserialize)return n.deserialize(r);const a=Object.create(n.prototype);for(const c of Object.keys(r)){if(c==="$name")continue;const d=r[c];a[c]=br[t].shallow.indexOf(c)>=0?d:qn(d)}return a}class Nc{constructor(){this.first=!0}update(t,n){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=n):this.lastFloorZoom<a&&(this.lastIntegerZoom=a,this.lastIntegerZoomTime=n),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=a,!0))}}const Ct={"Latin-1 Supplement":r=>r>=128&&r<=255,"Hangul Jamo":r=>r>=4352&&r<=4607,Khmer:r=>r>=6016&&r<=6143,"General Punctuation":r=>r>=8192&&r<=8303,"Letterlike Symbols":r=>r>=8448&&r<=8527,"Number Forms":r=>r>=8528&&r<=8591,"Miscellaneous Technical":r=>r>=8960&&r<=9215,"Control Pictures":r=>r>=9216&&r<=9279,"Optical Character Recognition":r=>r>=9280&&r<=9311,"Enclosed Alphanumerics":r=>r>=9312&&r<=9471,"Geometric Shapes":r=>r>=9632&&r<=9727,"Miscellaneous Symbols":r=>r>=9728&&r<=9983,"Miscellaneous Symbols and Arrows":r=>r>=11008&&r<=11263,"Ideographic Description Characters":r=>r>=12272&&r<=12287,"CJK Symbols and Punctuation":r=>r>=12288&&r<=12351,Hiragana:r=>r>=12352&&r<=12447,Katakana:r=>r>=12448&&r<=12543,Kanbun:r=>r>=12688&&r<=12703,"CJK Strokes":r=>r>=12736&&r<=12783,"Enclosed CJK Letters and Months":r=>r>=12800&&r<=13055,"CJK Compatibility":r=>r>=13056&&r<=13311,"Yijing Hexagram Symbols":r=>r>=19904&&r<=19967,"CJK Unified Ideographs":r=>r>=19968&&r<=40959,"Hangul Syllables":r=>r>=44032&&r<=55215,"Private Use Area":r=>r>=57344&&r<=63743,"Vertical Forms":r=>r>=65040&&r<=65055,"CJK Compatibility Forms":r=>r>=65072&&r<=65103,"Small Form Variants":r=>r>=65104&&r<=65135,"Halfwidth and Fullwidth Forms":r=>r>=65280&&r<=65519};function al(r){for(const t of r)if(Vc(t.charCodeAt(0)))return!0;return!1}function Wh(r){for(const t of r)if(!dp(t.charCodeAt(0)))return!1;return!0}function Qs(r){const t=r.map(n=>{try{return new RegExp(`\\p{sc=${n}}`,"u").source}catch{return null}}).filter(n=>n);return new RegExp(t.join("|"),"u")}const Hh=Qs(["Arab","Dupl","Mong","Ougr","Syrc"]);function dp(r){return!Hh.test(String.fromCodePoint(r))}const Zc=Qs(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Vc(r){return!(r!==746&&r!==747&&(r<4352||!(Ct["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||Ct["CJK Compatibility"](r)||Ct["CJK Strokes"](r)||!(!Ct["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||Ct["Enclosed CJK Letters and Months"](r)||Ct["Ideographic Description Characters"](r)||Ct.Kanbun(r)||Ct.Katakana(r)&&r!==12540||!(!Ct["Halfwidth and Fullwidth Forms"](r)||r===65288||r===65289||r===65293||r>=65306&&r<=65310||r===65339||r===65341||r===65343||r>=65371&&r<=65503||r===65507||r>=65512&&r<=65519)||!(!Ct["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||Ct["Vertical Forms"](r)||Ct["Yijing Hexagram Symbols"](r)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(r))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(r))||Zc.test(String.fromCodePoint(r)))))}function Uc(r){return!(Vc(r)||function(t){return!!(Ct["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||Ct["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)||Ct["Letterlike Symbols"](t)||Ct["Number Forms"](t)||Ct["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)||Ct["Control Pictures"](t)&&t!==9251||Ct["Optical Character Recognition"](t)||Ct["Enclosed Alphanumerics"](t)||Ct["Geometric Shapes"](t)||Ct["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Ct["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Ct["CJK Symbols and Punctuation"](t)||Ct.Katakana(t)||Ct["Private Use Area"](t)||Ct["CJK Compatibility Forms"](t)||Ct["Small Form Variants"](t)||Ct["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(r))}const Xh=Qs(["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 $c(r){return Xh.test(String.fromCodePoint(r))}function pp(r,t){return!(!t&&$c(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||Ct.Khmer(r))}function fp(r){for(const t of r)if($c(t.charCodeAt(0)))return!0;return!1}const vn=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(r){this.pluginStatus=r.pluginStatus,this.pluginURL=r.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(r){if(vn.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(r,t){return o(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(r.pluginStatus!=="loading")return this.setState(r),r;const n=r.pluginURL,a=new Promise(d=>{this.loadScriptResolve=d});t(n);const c=new Promise(d=>setTimeout(()=>d(),this.TIMEOUT));if(yield Promise.race([a,c]),this.isParsed()){const d={pluginStatus:"loaded",pluginURL:n};return this.setState(d),d}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${n}`)})}};class ni{constructor(t,n){this.zoom=t,n?(this.now=n.now,this.fadeDuration=n.fadeDuration,this.zoomHistory=n.zoomHistory,this.transition=n.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Nc,this.transition={})}isSupportedScript(t){return function(n,a){for(const c of n)if(!pp(c.charCodeAt(0),a))return!1;return!0}(t,vn.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,n=t-Math.floor(t),a=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:n+(1-n)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*n}}}class eo{constructor(t,n){this.property=t,this.value=n,this.expression=function(a,c){if(Ko(a))return new Jo(a,c);if(Hs(a)){const d=Lh(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=Ft.parse(a):c.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?c.type==="variableAnchorOffsetCollection"&&Array.isArray(a)?d=ar.parse(a):c.type==="projectionDefinition"&&typeof a=="string"&&(d=Bi.parse(a)):d=Xi.parse(a),{kind:"constant",evaluate:()=>d}}}(n===void 0?t.specification.default:n,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,n,a){return this.property.possiblyEvaluate(this,t,n,a)}}class sl{constructor(t){this.property=t,this.value=new eo(t,void 0)}transitioned(t,n){return new Kh(this.property,this.value,n,ft({},t.transition,this.transition),t.now)}untransitioned(){return new Kh(this.property,this.value,null,{},0)}}class to{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return rt(this._values[t].value.value)}setValue(t,n){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new sl(this._values[t].property)),this._values[t].value=new eo(this._values[t].property,n===null?void 0:rt(n))}getTransition(t){return rt(this._values[t].transition)}setTransition(t,n){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new sl(this._values[t].property)),this._values[t].transition=rt(n)||void 0}serialize(){const t={};for(const n of Object.keys(this._values)){const a=this.getValue(n);a!==void 0&&(t[n]=a);const c=this.getTransition(n);c!==void 0&&(t[`${n}-transition`]=c)}return t}transitioned(t,n){const a=new ol(this._properties);for(const c of Object.keys(this._values))a._values[c]=this._values[c].transitioned(t,n._values[c]);return a}untransitioned(){const t=new ol(this._properties);for(const n of Object.keys(this._values))t._values[n]=this._values[n].untransitioned();return t}}class Kh{constructor(t,n,a,c,d){this.property=t,this.value=n,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,n,a){const c=t.now||0,d=this.value.possiblyEvaluate(t,n,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,n,a);{const g=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(t,n,a),d,lt(g))}}return d}}class ol{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,n,a){const c=new io(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,n,a);return c}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class mp{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return rt(this._values[t].value)}setValue(t,n){this._values[t]=new eo(this._values[t].property,n===null?void 0:rt(n))}serialize(){const t={};for(const n of Object.keys(this._values)){const a=this.getValue(n);a!==void 0&&(t[n]=a)}return t}possiblyEvaluate(t,n,a){const c=new io(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,n,a);return c}}class rn{constructor(t,n,a){this.property=t,this.value=n,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,n,a,c){return this.property.evaluate(this.value,this.parameters,t,n,a,c)}}class io{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class et{constructor(t){this.specification=t}possiblyEvaluate(t,n){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(n)}interpolate(t,n,a){const c=Vr[this.specification.type];return c?c(t,n,a):t}}class st{constructor(t,n){this.specification=t,this.overrides=n}possiblyEvaluate(t,n,a,c){return new rn(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(n,null,{},a,c)}:t.expression,n)}interpolate(t,n,a){if(t.value.kind!=="constant"||n.value.kind!=="constant")return t;if(t.value.value===void 0||n.value.value===void 0)return new rn(this,{kind:"constant",value:void 0},t.parameters);const c=Vr[this.specification.type];if(c){const d=c(t.value.value,n.value.value,a);return new rn(this,{kind:"constant",value:d},t.parameters)}return t}evaluate(t,n,a,c,d,p){return t.kind==="constant"?t.value:t.evaluate(n,a,c,d,p)}}class ll extends st{possiblyEvaluate(t,n,a,c){if(t.value===void 0)return new rn(this,{kind:"constant",value:void 0},n);if(t.expression.kind==="constant"){const d=t.expression.evaluate(n,null,{},a,c),p=t.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,g=this._calculate(p,p,p,n);return new rn(this,{kind:"constant",value:g},n)}if(t.expression.kind==="camera"){const d=this._calculate(t.expression.evaluate({zoom:n.zoom-1}),t.expression.evaluate({zoom:n.zoom}),t.expression.evaluate({zoom:n.zoom+1}),n);return new rn(this,{kind:"constant",value:d},n)}return new rn(this,t.expression,n)}evaluate(t,n,a,c,d,p){if(t.kind==="source"){const g=t.evaluate(n,a,c,d,p);return this._calculate(g,g,g,n)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(n.zoom)-1},a,c),t.evaluate({zoom:Math.floor(n.zoom)},a,c),t.evaluate({zoom:Math.floor(n.zoom)+1},a,c),n):t.value}_calculate(t,n,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:n}:{from:a,to:n}}interpolate(t){return t}}class Gc{constructor(t){this.specification=t}possiblyEvaluate(t,n,a,c){if(t.value!==void 0){if(t.expression.kind==="constant"){const d=t.expression.evaluate(n,null,{},a,c);return this._calculate(d,d,d,n)}return this._calculate(t.expression.evaluate(new ni(Math.floor(n.zoom-1),n)),t.expression.evaluate(new ni(Math.floor(n.zoom),n)),t.expression.evaluate(new ni(Math.floor(n.zoom+1),n)),n)}}_calculate(t,n,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:n}:{from:a,to:n}}interpolate(t){return t}}class qc{constructor(t){this.specification=t}possiblyEvaluate(t,n,a,c){return!!t.expression.evaluate(n,null,{},a,c)}interpolate(){return!1}}class fr{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const n in t){const a=t[n];a.specification.overridable&&this.overridableProperties.push(n);const c=this.defaultPropertyValues[n]=new eo(a,void 0),d=this.defaultTransitionablePropertyValues[n]=new sl(a);this.defaultTransitioningPropertyValues[n]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=c.possiblyEvaluate({})}}}$e("DataDrivenProperty",st),$e("DataConstantProperty",et),$e("CrossFadedDataDrivenProperty",ll),$e("CrossFadedProperty",Gc),$e("ColorRampProperty",qc);const Yh="-transition";class sr extends V{constructor(t,n){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),n.layout&&(this._unevaluatedLayout=new mp(n.layout)),n.paint)){this._transitionablePaint=new to(n.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 io(n.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,n,a={}){n!=null&&this._validate(hp,`layers.${this.id}.layout.${t}`,t,n,a)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,n):this.visibility=n)}getPaintProperty(t){return t.endsWith(Yh)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,n,a={}){if(n!=null&&this._validate(jc,`layers.${this.id}.paint.${t}`,t,n,a))return!1;if(t.endsWith(Yh))return this._transitionablePaint.setTransition(t.slice(0,-11),n||void 0),!1;{const c=this._transitionablePaint._values[t],d=c.property.specification["property-type"]==="cross-faded-data-driven",p=c.value.isDataDriven(),g=c.value;this._transitionablePaint.setValue(t,n),this._handleSpecialPaintPropertyUpdate(t);const x=this._transitionablePaint._values[t].value;return x.isDataDriven()||p||d||this._handleOverridablePaintPropertyUpdate(t,g,x)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,n,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,n){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,n)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,n)}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),Pt(t,(n,a)=>!(n===void 0||a==="layout"&&!Object.keys(n).length||a==="paint"&&!Object.keys(n).length))}_validate(t,n,a,c,d={}){return(!d||d.validate!==!1)&&gs(this,t.call(wa,{key:n,layerType:this.type,objectKey:a,value:c,styleSpec:F,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const n=this.paint.get(t);if(n instanceof rn&&ls(n.property.specification)&&(n.value.kind==="source"||n.value.kind==="composite")&&n.value.isStateDependent)return!0}return!1}}const gp={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ro{constructor(t,n){this._structArray=t,this._pos1=n*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class gi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,n){return t._trim(),n&&(t.isTransferred=!0,n.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const n=Object.create(this.prototype);return n.arrayBuffer=t.arrayBuffer,n.length=t.length,n.capacity=t.arrayBuffer.byteLength/n.bytesPerElement,n._refreshViews(),n}_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 n=this.uint8;this._refreshViews(),n&&this.uint8.set(n)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Pi(r,t=1){let n=0,a=0;return{members:r.map(c=>{const d=gp[c.type].BYTES_PER_ELEMENT,p=n=Jh(n,Math.max(t,d)),g=c.components||1;return a=Math.max(a,d),n+=d*g,{name:c.name,type:c.type,components:g,offset:p}}),size:Jh(n,Math.max(a,t)),alignment:t}}function Jh(r,t){return Math.ceil(r/t)*t}class no extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const c=2*t;return this.int16[c+0]=n,this.int16[c+1]=a,t}}no.prototype.bytesPerElement=4,$e("StructArrayLayout2i4",no);class nn extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.int16[d+0]=n,this.int16[d+1]=a,this.int16[d+2]=c,t}}nn.prototype.bytesPerElement=6,$e("StructArrayLayout3i6",nn);class cl extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,n,a,c)}emplace(t,n,a,c,d){const p=4*t;return this.int16[p+0]=n,this.int16[p+1]=a,this.int16[p+2]=c,this.int16[p+3]=d,t}}cl.prototype.bytesPerElement=8,$e("StructArrayLayout4i8",cl);class ao extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const g=this.length;return this.resize(g+1),this.emplace(g,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,g){const x=6*t;return this.int16[x+0]=n,this.int16[x+1]=a,this.int16[x+2]=c,this.int16[x+3]=d,this.int16[x+4]=p,this.int16[x+5]=g,t}}ao.prototype.bytesPerElement=12,$e("StructArrayLayout2i4i12",ao);class ul extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const g=this.length;return this.resize(g+1),this.emplace(g,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,g){const x=4*t,w=8*t;return this.int16[x+0]=n,this.int16[x+1]=a,this.uint8[w+4]=c,this.uint8[w+5]=d,this.uint8[w+6]=p,this.uint8[w+7]=g,t}}ul.prototype.bytesPerElement=8,$e("StructArrayLayout2i4ub8",ul);class Pa extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const c=2*t;return this.float32[c+0]=n,this.float32[c+1]=a,t}}Pa.prototype.bytesPerElement=8,$e("StructArrayLayout2f8",Pa);class Wc extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,g,x,w,S){const I=this.length;return this.resize(I+1),this.emplace(I,t,n,a,c,d,p,g,x,w,S)}emplace(t,n,a,c,d,p,g,x,w,S,I){const R=10*t;return this.uint16[R+0]=n,this.uint16[R+1]=a,this.uint16[R+2]=c,this.uint16[R+3]=d,this.uint16[R+4]=p,this.uint16[R+5]=g,this.uint16[R+6]=x,this.uint16[R+7]=w,this.uint16[R+8]=S,this.uint16[R+9]=I,t}}Wc.prototype.bytesPerElement=20,$e("StructArrayLayout10ui20",Wc);class ys extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,g,x,w,S,I,R){const L=this.length;return this.resize(L+1),this.emplace(L,t,n,a,c,d,p,g,x,w,S,I,R)}emplace(t,n,a,c,d,p,g,x,w,S,I,R,L){const B=12*t;return this.int16[B+0]=n,this.int16[B+1]=a,this.int16[B+2]=c,this.int16[B+3]=d,this.uint16[B+4]=p,this.uint16[B+5]=g,this.uint16[B+6]=x,this.uint16[B+7]=w,this.int16[B+8]=S,this.int16[B+9]=I,this.int16[B+10]=R,this.int16[B+11]=L,t}}ys.prototype.bytesPerElement=24,$e("StructArrayLayout4i4ui4i24",ys);class Sa extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.float32[d+0]=n,this.float32[d+1]=a,this.float32[d+2]=c,t}}Sa.prototype.bytesPerElement=12,$e("StructArrayLayout3f12",Sa);class Hc extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const n=this.length;return this.resize(n+1),this.emplace(n,t)}emplace(t,n){return this.uint32[1*t+0]=n,t}}Hc.prototype.bytesPerElement=4,$e("StructArrayLayout1ul4",Hc);class hl extends gi{_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,n,a,c,d,p,g,x,w){const S=this.length;return this.resize(S+1),this.emplace(S,t,n,a,c,d,p,g,x,w)}emplace(t,n,a,c,d,p,g,x,w,S){const I=10*t,R=5*t;return this.int16[I+0]=n,this.int16[I+1]=a,this.int16[I+2]=c,this.int16[I+3]=d,this.int16[I+4]=p,this.int16[I+5]=g,this.uint32[R+3]=x,this.uint16[I+8]=w,this.uint16[I+9]=S,t}}hl.prototype.bytesPerElement=20,$e("StructArrayLayout6i1ul2ui20",hl);class Ma extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const g=this.length;return this.resize(g+1),this.emplace(g,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,g){const x=6*t;return this.int16[x+0]=n,this.int16[x+1]=a,this.int16[x+2]=c,this.int16[x+3]=d,this.int16[x+4]=p,this.int16[x+5]=g,t}}Ma.prototype.bytesPerElement=12,$e("StructArrayLayout2i2i2i12",Ma);class Xc extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d){const p=this.length;return this.resize(p+1),this.emplace(p,t,n,a,c,d)}emplace(t,n,a,c,d,p){const g=4*t,x=8*t;return this.float32[g+0]=n,this.float32[g+1]=a,this.float32[g+2]=c,this.int16[x+6]=d,this.int16[x+7]=p,t}}Xc.prototype.bytesPerElement=16,$e("StructArrayLayout2f1f2i16",Xc);class Kc extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const g=this.length;return this.resize(g+1),this.emplace(g,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,g){const x=16*t,w=4*t,S=8*t;return this.uint8[x+0]=n,this.uint8[x+1]=a,this.float32[w+1]=c,this.float32[w+2]=d,this.int16[S+6]=p,this.int16[S+7]=g,t}}Kc.prototype.bytesPerElement=16,$e("StructArrayLayout2ub2f2i16",Kc);class so extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.uint16[d+0]=n,this.uint16[d+1]=a,this.uint16[d+2]=c,t}}so.prototype.bytesPerElement=6,$e("StructArrayLayout3ui6",so);class Yc extends gi{_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,n,a,c,d,p,g,x,w,S,I,R,L,B,j,$,X){const oe=this.length;return this.resize(oe+1),this.emplace(oe,t,n,a,c,d,p,g,x,w,S,I,R,L,B,j,$,X)}emplace(t,n,a,c,d,p,g,x,w,S,I,R,L,B,j,$,X,oe){const Y=24*t,D=12*t,U=48*t;return this.int16[Y+0]=n,this.int16[Y+1]=a,this.uint16[Y+2]=c,this.uint16[Y+3]=d,this.uint32[D+2]=p,this.uint32[D+3]=g,this.uint32[D+4]=x,this.uint16[Y+10]=w,this.uint16[Y+11]=S,this.uint16[Y+12]=I,this.float32[D+7]=R,this.float32[D+8]=L,this.uint8[U+36]=B,this.uint8[U+37]=j,this.uint8[U+38]=$,this.uint32[D+10]=X,this.int16[Y+22]=oe,t}}Yc.prototype.bytesPerElement=48,$e("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Yc);class u extends gi{_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,n,a,c,d,p,g,x,w,S,I,R,L,B,j,$,X,oe,Y,D,U,Q,xe,ze,be,Pe,Le,Re){const Fe=this.length;return this.resize(Fe+1),this.emplace(Fe,t,n,a,c,d,p,g,x,w,S,I,R,L,B,j,$,X,oe,Y,D,U,Q,xe,ze,be,Pe,Le,Re)}emplace(t,n,a,c,d,p,g,x,w,S,I,R,L,B,j,$,X,oe,Y,D,U,Q,xe,ze,be,Pe,Le,Re,Fe){const Ce=32*t,Ge=16*t;return this.int16[Ce+0]=n,this.int16[Ce+1]=a,this.int16[Ce+2]=c,this.int16[Ce+3]=d,this.int16[Ce+4]=p,this.int16[Ce+5]=g,this.int16[Ce+6]=x,this.int16[Ce+7]=w,this.uint16[Ce+8]=S,this.uint16[Ce+9]=I,this.uint16[Ce+10]=R,this.uint16[Ce+11]=L,this.uint16[Ce+12]=B,this.uint16[Ce+13]=j,this.uint16[Ce+14]=$,this.uint16[Ce+15]=X,this.uint16[Ce+16]=oe,this.uint16[Ce+17]=Y,this.uint16[Ce+18]=D,this.uint16[Ce+19]=U,this.uint16[Ce+20]=Q,this.uint16[Ce+21]=xe,this.uint16[Ce+22]=ze,this.uint32[Ge+12]=be,this.float32[Ge+13]=Pe,this.float32[Ge+14]=Le,this.uint16[Ce+30]=Re,this.uint16[Ce+31]=Fe,t}}u.prototype.bytesPerElement=64,$e("StructArrayLayout8i15ui1ul2f2ui64",u);class e extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const n=this.length;return this.resize(n+1),this.emplace(n,t)}emplace(t,n){return this.float32[1*t+0]=n,t}}e.prototype.bytesPerElement=4,$e("StructArrayLayout1f4",e);class i extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.uint16[6*t+0]=n,this.float32[d+1]=a,this.float32[d+2]=c,t}}i.prototype.bytesPerElement=12,$e("StructArrayLayout1ui2f12",i);class s extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=4*t;return this.uint32[2*t+0]=n,this.uint16[d+2]=a,this.uint16[d+3]=c,t}}s.prototype.bytesPerElement=8,$e("StructArrayLayout1ul2ui8",s);class l extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const c=2*t;return this.uint16[c+0]=n,this.uint16[c+1]=a,t}}l.prototype.bytesPerElement=4,$e("StructArrayLayout2ui4",l);class h extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const n=this.length;return this.resize(n+1),this.emplace(n,t)}emplace(t,n){return this.uint16[1*t+0]=n,t}}h.prototype.bytesPerElement=2,$e("StructArrayLayout1ui2",h);class f extends gi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,n,a,c)}emplace(t,n,a,c,d){const p=4*t;return this.float32[p+0]=n,this.float32[p+1]=a,this.float32[p+2]=c,this.float32[p+3]=d,t}}f.prototype.bytesPerElement=16,$e("StructArrayLayout4f16",f);class y extends ro{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 ve(this.anchorPointX,this.anchorPointY)}}y.prototype.size=20;class v extends hl{get(t){return new y(this,t)}}$e("CollisionBoxArray",v);class T extends ro{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]}}T.prototype.size=48;class C extends Yc{get(t){return new T(this,t)}}$e("PlacedSymbolArray",C);class A extends ro{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]}}A.prototype.size=64;class k extends u{get(t){return new A(this,t)}}$e("SymbolInstanceArray",k);class O extends e{getoffsetX(t){return this.float32[1*t+0]}}$e("GlyphOffsetArray",O);class Z extends nn{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",Z);class W extends ro{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]}}W.prototype.size=12;class q extends i{get(t){return new W(this,t)}}$e("TextAnchorOffsetArray",q);class H extends ro{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]}}H.prototype.size=8;class K extends s{get(t){return new H(this,t)}}$e("FeatureIndexArray",K);class ee extends no{}class te extends no{}class ie extends no{}class he extends ao{}class se extends ul{}class ye extends Pa{}class ge extends Wc{}class Ie extends ys{}class ke extends Sa{}class Se extends Hc{}class Ne extends Ma{}class Be extends Kc{}class Ee extends so{}class Xe extends l{}const xt=Pi([{name:"a_pos",components:2,type:"Int16"}],4),{members:Nt}=xt;class bt{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,n,a,c){const d=this.segments[this.segments.length-1];return t>bt.MAX_VERTEX_ARRAY_LENGTH&&bi(`Max vertices per segment is ${bt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${bt.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!d||d.vertexLength+t>bt.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==c?this.createNewSegment(n,a,c):d}createNewSegment(t,n,a){const c={vertexOffset:t.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0,vaos:{}};return a!==void 0&&(c.sortKey=a),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(c),c}getOrCreateLatestSegment(t,n,a){return this.prepareSegment(0,t,n,a)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const n in t.vaos)t.vaos[n].destroy()}static simpleSegment(t,n,a,c){return new bt([{vertexOffset:t,primitiveOffset:n,vertexLength:a,primitiveLength:c,vaos:{},sortKey:0}])}}function Wt(r,t){return 256*(r=li(Math.floor(r),0,255))+li(Math.floor(t),0,255)}bt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,$e("SegmentVector",bt);const ei=Pi([{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 ai,Gt,Ht,ki={exports:{}},Oi={exports:{}},Vi={exports:{}},mr=function(){if(Ht)return ki.exports;Ht=1;var r=(ai||(ai=1,Oi.exports=function(n,a){var c,d,p,g,x,w,S,I;for(d=n.length-(c=3&n.length),p=a,x=3432918353,w=461845907,I=0;I<d;)S=255&n.charCodeAt(I)|(255&n.charCodeAt(++I))<<8|(255&n.charCodeAt(++I))<<16|(255&n.charCodeAt(++I))<<24,++I,p=27492+(65535&(g=5*(65535&(p=(p^=S=(65535&(S=(S=(65535&S)*x+(((S>>>16)*x&65535)<<16)&4294967295)<<15|S>>>17))*w+(((S>>>16)*w&65535)<<16)&4294967295)<<13|p>>>19))+((5*(p>>>16)&65535)<<16)&4294967295))+((58964+(g>>>16)&65535)<<16);switch(S=0,c){case 3:S^=(255&n.charCodeAt(I+2))<<16;case 2:S^=(255&n.charCodeAt(I+1))<<8;case 1:p^=S=(65535&(S=(S=(65535&(S^=255&n.charCodeAt(I)))*x+(((S>>>16)*x&65535)<<16)&4294967295)<<15|S>>>17))*w+(((S>>>16)*w&65535)<<16)&4294967295}return p^=n.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}),Oi.exports),t=(Gt||(Gt=1,Vi.exports=function(n,a){for(var c,d=n.length,p=a^d,g=0;d>=4;)c=1540483477*(65535&(c=255&n.charCodeAt(g)|(255&n.charCodeAt(++g))<<8|(255&n.charCodeAt(++g))<<16|(255&n.charCodeAt(++g))<<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,++g;switch(d){case 3:p^=(255&n.charCodeAt(g+2))<<16;case 2:p^=(255&n.charCodeAt(g+1))<<8;case 1:p=1540483477*(65535&(p^=255&n.charCodeAt(g)))+((1540483477*(p>>>16)&65535)<<16)}return p=1540483477*(65535&(p^=p>>>13))+((1540483477*(p>>>16)&65535)<<16),(p^=p>>>15)>>>0}),Vi.exports);return ki.exports=r,ki.exports.murmur3=r,ki.exports.murmur2=t,ki.exports}(),bn=ue(mr);class an{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,n,a,c){this.ids.push(Wn(t)),this.positions.push(n,a,c)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const n=Wn(t);let a=0,c=this.ids.length-1;for(;a<c;){const p=a+c>>1;this.ids[p]>=n?c=p:a=p+1}const d=[];for(;this.ids[a]===n;)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,n){const a=new Float64Array(t.ids),c=new Uint32Array(t.positions);return Hn(a,c,0,a.length-1),n&&n.push(a.buffer,c.buffer),{ids:a,positions:c}}static deserialize(t){const n=new an;return n.ids=t.ids,n.positions=t.positions,n.indexed=!0,n}}function Wn(r){const t=+r;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:bn(String(r))}function Hn(r,t,n,a){for(;n<a;){const c=r[n+a>>1];let d=n-1,p=a+1;for(;;){do d++;while(r[d]<c);do p--;while(r[p]>c);if(d>=p)break;Ia(r,d,p),Ia(t,3*d,3*p),Ia(t,3*d+1,3*p+1),Ia(t,3*d+2,3*p+2)}p-n<a-p?(Hn(r,t,n,p),n=p+1):(Hn(r,t,p+1,a),a=p)}}function Ia(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}$e("FeaturePositionMap",an);class sn{constructor(t,n){this.gl=t.gl,this.location=n}}class wn extends sn{constructor(t,n){super(t,n),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class wr extends sn{constructor(t,n){super(t,n),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 Tn extends sn{constructor(t,n){super(t,n),this.current=Ft.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 Ca=new Float32Array(16);function ka(r){return[Wt(255*r.r,255*r.g),Wt(255*r.b,255*r.a)]}class _i{constructor(t,n,a){this.value=t,this.uniformNames=n.map(c=>`u_${c}`),this.type=a}setUniform(t,n,a){t.set(a.constantOr(this.value))}getBinding(t,n,a){return this.type==="color"?new Tn(t,n):new wn(t,n)}}class yi{constructor(t,n){this.uniformNames=n.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,n){this.pixelRatioFrom=n.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=n.tlbr,this.patternTo=t.tlbr}setUniform(t,n,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,n,a){return a.substr(0,9)==="u_pattern"?new wr(t,n):new wn(t,n)}}class Di{constructor(t,n,a,c){this.expression=t,this.type=a,this.maxValue=0,this.paintVertexAttributes=n.map(d=>({name:`a_${d}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(t,n,a,c,d){const p=this.paintVertexArray.length,g=this.expression.evaluate(new ni(0),n,{},c,[],d);this.paintVertexArray.resize(t),this._setPaintValue(p,t,g)}updatePaintArray(t,n,a,c){const d=this.expression.evaluate({zoom:0},a,c);this._setPaintValue(t,n,d)}_setPaintValue(t,n,a){if(this.type==="color"){const c=ka(a);for(let d=t;d<n;d++)this.paintVertexArray.emplace(d,c[0],c[1])}else{for(let c=t;c<n;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 Kt{constructor(t,n,a,c,d,p){this.expression=t,this.uniformNames=n.map(g=>`u_${g}_t`),this.type=a,this.useIntegerZoom=c,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=n.map(g=>({name:`a_${g}`,type:"Float32",components:a==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(t,n,a,c,d){const p=this.expression.evaluate(new ni(this.zoom),n,{},c,[],d),g=this.expression.evaluate(new ni(this.zoom+1),n,{},c,[],d),x=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(x,t,p,g)}updatePaintArray(t,n,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,n,d,p)}_setPaintValue(t,n,a,c){if(this.type==="color"){const d=ka(a),p=ka(c);for(let g=t;g<n;g++)this.paintVertexArray.emplace(g,d[0],d[1],p[0],p[1])}else{for(let d=t;d<n;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,n){const a=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,c=li(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);t.set(c)}getBinding(t,n,a){return new wn(t,n)}}class Xn{constructor(t,n,a,c,d,p){this.expression=t,this.type=n,this.useIntegerZoom=a,this.zoom=c,this.layerId=p,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(t,n,a){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(c,t,n.patterns&&n.patterns[this.layerId],a)}updatePaintArray(t,n,a,c,d){this._setPaintValues(t,n,a.patterns&&a.patterns[this.layerId],d)}_setPaintValues(t,n,a,c){if(!c||!a)return;const{min:d,mid:p,max:g}=a,x=c[d],w=c[p],S=c[g];if(x&&w&&S)for(let I=t;I<n;I++)this.zoomInPaintVertexArray.emplace(I,w.tl[0],w.tl[1],w.br[0],w.br[1],x.tl[0],x.tl[1],x.br[0],x.br[1],w.pixelRatio,x.pixelRatio),this.zoomOutPaintVertexArray.emplace(I,w.tl[0],w.tl[1],w.br[0],w.br[1],S.tl[0],S.tl[1],S.br[0],S.br[1],w.pixelRatio,S.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,ei.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,ei.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Qh{constructor(t,n,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 rn&&ls(p.property.specification)))continue;const g=_p(d,t.type),x=p.value,w=p.property.specification.type,S=p.property.useIntegerZoom,I=p.property.specification["property-type"],R=I==="cross-faded"||I==="cross-faded-data-driven";if(x.kind==="constant")this.binders[d]=R?new yi(x.value,g):new _i(x.value,g,w),c.push(`/u_${d}`);else if(x.kind==="source"||R){const L=ed(d,w,"source");this.binders[d]=R?new Xn(x,w,S,n,L,t.id):new Di(x,g,w,L),c.push(`/a_${d}`)}else{const L=ed(d,w,"composite");this.binders[d]=new Kt(x,g,w,S,n,L),c.push(`/z_${d}`)}}this.cacheKey=c.sort().join("")}getMaxValue(t){const n=this.binders[t];return n instanceof Di||n instanceof Kt?n.maxValue:0}populatePaintArrays(t,n,a,c,d){for(const p in this.binders){const g=this.binders[p];(g instanceof Di||g instanceof Kt||g instanceof Xn)&&g.populatePaintArray(t,n,a,c,d)}}setConstantPatternPositions(t,n){for(const a in this.binders){const c=this.binders[a];c instanceof yi&&c.setConstantPatternPositions(t,n)}}updatePaintArrays(t,n,a,c,d){let p=!1;for(const g in t){const x=n.getPositions(g);for(const w of x){const S=a.feature(w.index);for(const I in this.binders){const R=this.binders[I];if((R instanceof Di||R instanceof Kt||R instanceof Xn)&&R.expression.isStateDependent===!0){const L=c.paint.get(I);R.expression=L.value,R.updatePaintArray(w.start,w.end,S,t[g],d),p=!0}}}}return p}defines(){const t=[];for(const n in this.binders){const a=this.binders[n];(a instanceof _i||a instanceof yi)&&t.push(...a.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return t}getBinderAttributes(){const t=[];for(const n in this.binders){const a=this.binders[n];if(a instanceof Di||a instanceof Kt)for(let c=0;c<a.paintVertexAttributes.length;c++)t.push(a.paintVertexAttributes[c].name);else if(a instanceof Xn)for(let c=0;c<ei.members.length;c++)t.push(ei.members[c].name)}return t}getBinderUniforms(){const t=[];for(const n in this.binders){const a=this.binders[n];if(a instanceof _i||a instanceof yi||a instanceof Kt)for(const c of a.uniformNames)t.push(c)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,n){const a=[];for(const c in this.binders){const d=this.binders[c];if(d instanceof _i||d instanceof yi||d instanceof Kt){for(const p of d.uniformNames)if(n[p]){const g=d.getBinding(t,n[p],p);a.push({name:p,property:c,binding:g})}}}return a}setUniforms(t,n,a,c){for(const{name:d,property:p,binding:g}of n)this.binders[p].setUniform(g,c,a.get(p),d)}updatePaintBuffers(t){this._buffers=[];for(const n in this.binders){const a=this.binders[n];if(t&&a instanceof Xn){const c=t.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(a instanceof Di||a instanceof Kt)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(t){for(const n in this.binders){const a=this.binders[n];(a instanceof Di||a instanceof Kt||a instanceof Xn)&&a.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const n=this.binders[t];(n instanceof Di||n instanceof Kt||n instanceof Xn)&&n.destroy()}}}class Ea{constructor(t,n,a=()=>!0){this.programConfigurations={};for(const c of t)this.programConfigurations[c.id]=new Qh(c,n,a);this.needsUpload=!1,this._featureMap=new an,this._bufferOffset=0}populatePaintArrays(t,n,a,c,d,p){for(const g in this.programConfigurations)this.programConfigurations[g].populatePaintArrays(t,n,c,d,p);n.id!==void 0&&this._featureMap.add(n.id,a,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,n,a,c){for(const d of a)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(t,this._featureMap,n,d,c)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const n in this.programConfigurations)this.programConfigurations[n].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function _p(r,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"]}[r]||[r.replace(`${t}-`,"").replace(/-/g,"_")]}function ed(r,t,n){const a={color:{source:Pa,composite:f},number:{source:e,composite:Pa}},c=function(d){return{"line-pattern":{source:ge,composite:ge},"fill-pattern":{source:ge,composite:ge},"fill-extrusion-pattern":{source:ge,composite:ge}}[d]}(r);return c&&c[n]||a[t][n]}$e("ConstantBinder",_i),$e("CrossFadedConstantBinder",yi),$e("SourceExpressionBinder",Di),$e("CrossFadedCompositeBinder",Xn),$e("CompositeExpressionBinder",Kt),$e("ProgramConfiguration",Qh,{omit:["_buffers"]}),$e("ProgramConfigurationSet",Ea);const Jc=Math.pow(2,14)-1,Kn=-Jc-1;function Yn(r){const t=Dt/r.extent,n=r.loadGeometry();for(let a=0;a<n.length;a++){const c=n[a];for(let d=0;d<c.length;d++){const p=c[d],g=Math.round(p.x*t),x=Math.round(p.y*t);p.x=li(g,Kn,Jc),p.y=li(x,Kn,Jc),(g<p.x||g>p.x+1||x<p.y||x>p.y+1)&&bi("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return n}function Jn(r,t){return{type:r.type,id:r.id,properties:r.properties,geometry:t?Yn(r):[]}}const Qc=-32768;function eu(r,t,n,a,c){r.emplaceBack(Qc+8*t+a,Qc+8*n+c)}class dl{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new te,this.indexArray=new Ee,this.segments=new bt,this.programConfigurations=new Ea(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){const c=this.layers[0],d=[];let p=null,g=!1,x=c.type==="heatmap";if(c.type==="circle"){const S=c;p=S.layout.get("circle-sort-key"),g=!p.isConstant(),x=x||S.paint.get("circle-pitch-alignment")==="map"}const w=x?n.subdivisionGranularity.circle:1;for(const{feature:S,id:I,index:R,sourceLayerIndex:L}of t){const B=this.layers[0]._featureFilter.needGeometry,j=Jn(S,B);if(!this.layers[0]._featureFilter.filter(new ni(this.zoom),j,a))continue;const $=g?p.evaluate(j,{},a):void 0,X={id:I,properties:S.properties,type:S.type,sourceLayerIndex:L,index:R,geometry:B?j.geometry:Yn(S),patterns:{},sortKey:$};d.push(X)}g&&d.sort((S,I)=>S.sortKey-I.sortKey);for(const S of d){const{geometry:I,index:R,sourceLayerIndex:L}=S,B=t[R].feature;this.addFeature(S,I,R,a,w),n.featureIndex.insert(B,I,R,L,this.index)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,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,Nt),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,n,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 g=p.length;for(const x of n)for(const w of x){const S=w.x,I=w.y;if(S<0||S>=Dt||I<0||I>=Dt)continue;const R=this.segments.prepareSegment(g*g,this.layoutVertexArray,this.indexArray,t.sortKey),L=R.vertexLength;for(let B=0;B<g;B++)for(let j=0;j<g;j++)eu(this.layoutVertexArray,S,I,p[j],p[B]);for(let B=0;B<g-1;B++)for(let j=0;j<g-1;j++){const $=L+B*g+j,X=L+(B+1)*g+j;this.indexArray.emplaceBack($,X+1,$+1),this.indexArray.emplaceBack($,X,X+1)}R.vertexLength+=g*g,R.primitiveLength+=(g-1)*(g-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,{},c)}}function pl(r,t){for(let n=0;n<r.length;n++)if(oo(t,r[n]))return!0;for(let n=0;n<t.length;n++)if(oo(r,t[n]))return!0;return!!yp(r,t)}function tv(r,t,n){return!!oo(r,t)||!!xp(t,r,n)}function wm(r,t){if(r.length===1)return Pm(t,r[0]);for(let n=0;n<t.length;n++){const a=t[n];for(let c=0;c<a.length;c++)if(oo(r,a[c]))return!0}for(let n=0;n<r.length;n++)if(Pm(t,r[n]))return!0;for(let n=0;n<t.length;n++)if(yp(r,t[n]))return!0;return!1}function iv(r,t,n){if(r.length>1){if(yp(r,t))return!0;for(let a=0;a<t.length;a++)if(xp(t[a],r,n))return!0}for(let a=0;a<r.length;a++)if(xp(r[a],t,n))return!0;return!1}function yp(r,t){if(r.length===0||t.length===0)return!1;for(let n=0;n<r.length-1;n++){const a=r[n],c=r[n+1];for(let d=0;d<t.length-1;d++)if(rv(a,c,t[d],t[d+1]))return!0}return!1}function rv(r,t,n,a){return Ci(r,n,a)!==Ci(t,n,a)&&Ci(r,t,n)!==Ci(r,t,a)}function xp(r,t,n){const a=n*n;if(t.length===1)return r.distSqr(t[0])<a;for(let c=1;c<t.length;c++)if(Tm(r,t[c-1],t[c])<a)return!0;return!1}function Tm(r,t,n){const a=t.distSqr(n);if(a===0)return r.distSqr(t);const c=((r.x-t.x)*(n.x-t.x)+(r.y-t.y)*(n.y-t.y))/a;return r.distSqr(c<0?t:c>1?n:n.sub(t)._mult(c)._add(t))}function Pm(r,t){for(let n=0;n<r.length;n++)if(oo(r[n],t))return!0;return!1}function oo(r,t){let n=!1;for(let a=0,c=r.length-1;a<r.length;c=a++){const d=r[a],p=r[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&&(n=!n)}return n}function nv(r,t,n){const a=n[0],c=n[2];if(r.x<a.x&&t.x<a.x||r.x>c.x&&t.x>c.x||r.y<a.y&&t.y<a.y||r.y>c.y&&t.y>c.y)return!1;const d=Ci(r,t,n[0]);return d!==Ci(r,t,n[1])||d!==Ci(r,t,n[2])||d!==Ci(r,t,n[3])}function tu(r,t,n){const a=t.paint.get(r).value;return a.kind==="constant"?a.value:n.programConfigurations.get(t.id).getMaxValue(r)}function td(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function id(r,t,n,a,c){if(!t[0]&&!t[1])return r;const d=ve.convert(t)._mult(c);n==="viewport"&&d._rotate(-a);const p=[];for(let g=0;g<r.length;g++)p.push(r[g].sub(d));return p}let Sm,Mm;$e("CircleBucket",dl,{omit:["layers"]});var av={get paint(){return Mm=Mm||new fr({"circle-radius":new st(F.paint_circle["circle-radius"]),"circle-color":new st(F.paint_circle["circle-color"]),"circle-blur":new st(F.paint_circle["circle-blur"]),"circle-opacity":new st(F.paint_circle["circle-opacity"]),"circle-translate":new et(F.paint_circle["circle-translate"]),"circle-translate-anchor":new et(F.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new et(F.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new et(F.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new st(F.paint_circle["circle-stroke-width"]),"circle-stroke-color":new st(F.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new st(F.paint_circle["circle-stroke-opacity"])})},get layout(){return Sm=Sm||new fr({"circle-sort-key":new st(F.layout_circle["circle-sort-key"])})}};class sv extends sr{constructor(t){super(t,av)}createBucket(t){return new dl(t)}queryRadius(t){const n=t;return tu("circle-radius",this,n)+tu("circle-stroke-width",this,n)+td(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,unwrappedTileID:g,getElevation:x}){const w=id(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-d.bearingInRadians,p),S=this.paint.get("circle-radius").evaluate(n,a)+this.paint.get("circle-stroke-width").evaluate(n,a),I=this.paint.get("circle-pitch-alignment")==="map",R=I?w:function(B,j,$,X){return B.map(oe=>Im(oe,j,$,X))}(w,d,g,x),L=I?S*p:S;for(const B of c)for(const j of B){const $=I?j:Im(j,d,g,x);let X=L;const oe=d.projectTileCoordinates(j.x,j.y,g,x).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?X*=oe/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(X*=d.cameraToCenterDistance/oe),tv(R,$,X))return!0}return!1}}function Im(r,t,n,a){const c=t.projectTileCoordinates(r.x,r.y,n,a).point;return new ve((.5*c.x+.5)*t.width,(.5*-c.y+.5)*t.height)}class Cm extends dl{}let km;$e("HeatmapBucket",Cm,{omit:["layers"]});var ov={get paint(){return km=km||new fr({"heatmap-radius":new st(F.paint_heatmap["heatmap-radius"]),"heatmap-weight":new st(F.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new et(F.paint_heatmap["heatmap-intensity"]),"heatmap-color":new qc(F.paint_heatmap["heatmap-color"]),"heatmap-opacity":new et(F.paint_heatmap["heatmap-opacity"])})}};function vp(r,{width:t,height:n},a,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==t*n*a)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${t*n*a}`)}else c=new Uint8Array(t*n*a);return r.width=t,r.height=n,r.data=c,r}function Em(r,{width:t,height:n},a){if(t===r.width&&n===r.height)return;const c=vp({},{width:t,height:n},a);bp(r,c,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,t),height:Math.min(r.height,n)},a),r.width=t,r.height=n,r.data=c.data}function bp(r,t,n,a,c,d){if(c.width===0||c.height===0)return t;if(c.width>r.width||c.height>r.height||n.x>r.width-c.width||n.y>r.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=r.data,g=t.data;if(p===g)throw new Error("srcData equals dstData, so image is already copied");for(let x=0;x<c.height;x++){const w=((n.y+x)*r.width+n.x)*d,S=((a.y+x)*t.width+a.x)*d;for(let I=0;I<c.width*d;I++)g[S+I]=p[w+I]}return t}class iu{constructor(t,n){vp(this,t,1,n)}resize(t){Em(this,t,1)}clone(){return new iu({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,a,c,d){bp(t,n,a,c,d,1)}}class $r{constructor(t,n){vp(this,t,4,n)}resize(t){Em(this,t,4)}replace(t,n){n?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new $r({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,a,c,d){bp(t,n,a,c,d,4)}}function Am(r){const t={},n=r.resolution||256,a=r.clips?r.clips.length:1,c=r.image||new $r({width:n,height:a});if(Math.log(n)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${n}`);const d=(p,g,x)=>{t[r.evaluationKey]=x;const w=r.expression.evaluate(t);c.data[p+g+0]=Math.floor(255*w.r/w.a),c.data[p+g+1]=Math.floor(255*w.g/w.a),c.data[p+g+2]=Math.floor(255*w.b/w.a),c.data[p+g+3]=Math.floor(255*w.a)};if(r.clips)for(let p=0,g=0;p<a;++p,g+=4*n)for(let x=0,w=0;x<n;x++,w+=4){const S=x/(n-1),{start:I,end:R}=r.clips[p];d(g,w,I*(1-S)+R*S)}else for(let p=0,g=0;p<n;p++,g+=4)d(0,g,p/(n-1));return c}$e("AlphaImage",iu),$e("RGBAImage",$r);const wp="big-fb";class lv extends sr{createBucket(t){return new Cm(t)}constructor(t){super(t,ov),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Am({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(wp)&&this.heatmapFbos.delete(wp)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let zm;var cv={get paint(){return zm=zm||new fr({"hillshade-illumination-direction":new et(F.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new et(F.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new et(F.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new et(F.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new et(F.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new et(F.paint_hillshade["hillshade-accent-color"])})}};class uv extends sr{constructor(t){super(t,cv)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const hv=Pi([{name:"a_pos",components:2,type:"Int16"}],4),{members:dv}=hv;function Tp(r,t,n){const a=n.patternDependencies;let c=!1;for(const d of t){const p=d.paint.get(`${r}-pattern`);p.isConstant()||(c=!0);const g=p.constantOr(null);g&&(c=!0,a[g.to]=!0,a[g.from]=!0)}return c}function Pp(r,t,n,a,c){const d=c.patternDependencies;for(const p of t){const g=p.paint.get(`${r}-pattern`).value;if(g.kind!=="constant"){let x=g.evaluate({zoom:a-1},n,{},c.availableImages),w=g.evaluate({zoom:a},n,{},c.availableImages),S=g.evaluate({zoom:a+1},n,{},c.availableImages);x=x&&x.name?x.name:x,w=w&&w.name?w.name:w,S=S&&S.name?S.name:S,d[x]=!0,d[w]=!0,d[S]=!0,n.patterns[p.id]={min:x,mid:w,max:S}}}return n}function Rm(r,t,n,a,c){let d;if(c===function(p,g,x,w){let S=0;for(let I=g,R=x-w;I<x;I+=w)S+=(p[R]-p[I])*(p[I+1]+p[R+1]),R=I;return S}(r,t,n,a)>0)for(let p=t;p<n;p+=a)d=Bm(p/a|0,r[p],r[p+1],d);else for(let p=n-a;p>=t;p-=a)d=Bm(p/a|0,r[p],r[p+1],d);return d&&fl(d,d.next)&&(su(d),d=d.next),d}function lo(r,t){if(!r)return r;t||(t=r);let n,a=r;do if(n=!1,a.steiner||!fl(a,a.next)&&Ei(a.prev,a,a.next)!==0)a=a.next;else{if(su(a),a=t=a.prev,a===a.next)break;n=!0}while(n||a!==t);return t}function ru(r,t,n,a,c,d,p){if(!r)return;!p&&d&&function(x,w,S,I){let R=x;do R.z===0&&(R.z=Sp(R.x,R.y,w,S,I)),R.prevZ=R.prev,R.nextZ=R.next,R=R.next;while(R!==x);R.prevZ.nextZ=null,R.prevZ=null,function(L){let B,j=1;do{let $,X=L;L=null;let oe=null;for(B=0;X;){B++;let Y=X,D=0;for(let Q=0;Q<j&&(D++,Y=Y.nextZ,Y);Q++);let U=j;for(;D>0||U>0&&Y;)D!==0&&(U===0||!Y||X.z<=Y.z)?($=X,X=X.nextZ,D--):($=Y,Y=Y.nextZ,U--),oe?oe.nextZ=$:L=$,$.prevZ=oe,oe=$;X=Y}oe.nextZ=null,j*=2}while(B>1)}(R)}(r,a,c,d);let g=r;for(;r.prev!==r.next;){const x=r.prev,w=r.next;if(d?fv(r,a,c,d):pv(r))t.push(x.i,r.i,w.i),su(r),r=w.next,g=w.next;else if((r=w)===g){p?p===1?ru(r=mv(lo(r),t),t,n,a,c,d,2):p===2&&gv(r,t,n,a,c,d):ru(lo(r),t,n,a,c,d,1);break}}}function pv(r){const t=r.prev,n=r,a=r.next;if(Ei(t,n,a)>=0)return!1;const c=t.x,d=n.x,p=a.x,g=t.y,x=n.y,w=a.y,S=Math.min(c,d,p),I=Math.min(g,x,w),R=Math.max(c,d,p),L=Math.max(g,x,w);let B=a.next;for(;B!==t;){if(B.x>=S&&B.x<=R&&B.y>=I&&B.y<=L&&nu(c,g,d,x,p,w,B.x,B.y)&&Ei(B.prev,B,B.next)>=0)return!1;B=B.next}return!0}function fv(r,t,n,a){const c=r.prev,d=r,p=r.next;if(Ei(c,d,p)>=0)return!1;const g=c.x,x=d.x,w=p.x,S=c.y,I=d.y,R=p.y,L=Math.min(g,x,w),B=Math.min(S,I,R),j=Math.max(g,x,w),$=Math.max(S,I,R),X=Sp(L,B,t,n,a),oe=Sp(j,$,t,n,a);let Y=r.prevZ,D=r.nextZ;for(;Y&&Y.z>=X&&D&&D.z<=oe;){if(Y.x>=L&&Y.x<=j&&Y.y>=B&&Y.y<=$&&Y!==c&&Y!==p&&nu(g,S,x,I,w,R,Y.x,Y.y)&&Ei(Y.prev,Y,Y.next)>=0||(Y=Y.prevZ,D.x>=L&&D.x<=j&&D.y>=B&&D.y<=$&&D!==c&&D!==p&&nu(g,S,x,I,w,R,D.x,D.y)&&Ei(D.prev,D,D.next)>=0))return!1;D=D.nextZ}for(;Y&&Y.z>=X;){if(Y.x>=L&&Y.x<=j&&Y.y>=B&&Y.y<=$&&Y!==c&&Y!==p&&nu(g,S,x,I,w,R,Y.x,Y.y)&&Ei(Y.prev,Y,Y.next)>=0)return!1;Y=Y.prevZ}for(;D&&D.z<=oe;){if(D.x>=L&&D.x<=j&&D.y>=B&&D.y<=$&&D!==c&&D!==p&&nu(g,S,x,I,w,R,D.x,D.y)&&Ei(D.prev,D,D.next)>=0)return!1;D=D.nextZ}return!0}function mv(r,t){let n=r;do{const a=n.prev,c=n.next.next;!fl(a,c)&&Lm(a,n,n.next,c)&&au(a,c)&&au(c,a)&&(t.push(a.i,n.i,c.i),su(n),su(n.next),n=r=c),n=n.next}while(n!==r);return lo(n)}function gv(r,t,n,a,c,d){let p=r;do{let g=p.next.next;for(;g!==p.prev;){if(p.i!==g.i&&bv(p,g)){let x=Fm(p,g);return p=lo(p,p.next),x=lo(x,x.next),ru(p,t,n,a,c,d,0),void ru(x,t,n,a,c,d,0)}g=g.next}p=p.next}while(p!==r)}function _v(r,t){let n=r.x-t.x;return n===0&&(n=r.y-t.y,n===0)&&(n=(r.next.y-r.y)/(r.next.x-r.x)-(t.next.y-t.y)/(t.next.x-t.x)),n}function yv(r,t){const n=function(c,d){let p=d;const g=c.x,x=c.y;let w,S=-1/0;if(fl(c,p))return p;do{if(fl(c,p.next))return p.next;if(x<=p.y&&x>=p.next.y&&p.next.y!==p.y){const j=p.x+(x-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(j<=g&&j>S&&(S=j,w=p.x<p.next.x?p:p.next,j===g))return w}p=p.next}while(p!==d);if(!w)return null;const I=w,R=w.x,L=w.y;let B=1/0;p=w;do{if(g>=p.x&&p.x>=R&&g!==p.x&&Dm(x<L?g:S,x,R,L,x<L?S:g,x,p.x,p.y)){const j=Math.abs(x-p.y)/(g-p.x);au(p,c)&&(j<B||j===B&&(p.x>w.x||p.x===w.x&&xv(w,p)))&&(w=p,B=j)}p=p.next}while(p!==I);return w}(r,t);if(!n)return t;const a=Fm(n,r);return lo(a,a.next),lo(n,n.next)}function xv(r,t){return Ei(r.prev,r,t.prev)<0&&Ei(t.next,r,r.next)<0}function Sp(r,t,n,a,c){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-n)*c|0)|r<<8))|r<<4))|r<<2))|r<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-a)*c|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function vv(r){let t=r,n=r;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==r);return n}function Dm(r,t,n,a,c,d,p,g){return(c-p)*(t-g)>=(r-p)*(d-g)&&(r-p)*(a-g)>=(n-p)*(t-g)&&(n-p)*(d-g)>=(c-p)*(a-g)}function nu(r,t,n,a,c,d,p,g){return!(r===p&&t===g)&&Dm(r,t,n,a,c,d,p,g)}function bv(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!function(n,a){let c=n;do{if(c.i!==n.i&&c.next.i!==n.i&&c.i!==a.i&&c.next.i!==a.i&&Lm(c,c.next,n,a))return!0;c=c.next}while(c!==n);return!1}(r,t)&&(au(r,t)&&au(t,r)&&function(n,a){let c=n,d=!1;const p=(n.x+a.x)/2,g=(n.y+a.y)/2;do c.y>g!=c.next.y>g&&c.next.y!==c.y&&p<(c.next.x-c.x)*(g-c.y)/(c.next.y-c.y)+c.x&&(d=!d),c=c.next;while(c!==n);return d}(r,t)&&(Ei(r.prev,r,t.prev)||Ei(r,t.prev,t))||fl(r,t)&&Ei(r.prev,r,r.next)>0&&Ei(t.prev,t,t.next)>0)}function Ei(r,t,n){return(t.y-r.y)*(n.x-t.x)-(t.x-r.x)*(n.y-t.y)}function fl(r,t){return r.x===t.x&&r.y===t.y}function Lm(r,t,n,a){const c=nd(Ei(r,t,n)),d=nd(Ei(r,t,a)),p=nd(Ei(n,a,r)),g=nd(Ei(n,a,t));return c!==d&&p!==g||!(c!==0||!rd(r,n,t))||!(d!==0||!rd(r,a,t))||!(p!==0||!rd(n,r,a))||!(g!==0||!rd(n,t,a))}function rd(r,t,n){return t.x<=Math.max(r.x,n.x)&&t.x>=Math.min(r.x,n.x)&&t.y<=Math.max(r.y,n.y)&&t.y>=Math.min(r.y,n.y)}function nd(r){return r>0?1:r<0?-1:0}function au(r,t){return Ei(r.prev,r,r.next)<0?Ei(r,t,r.next)>=0&&Ei(r,r.prev,t)>=0:Ei(r,t,r.prev)<0||Ei(r,r.next,t)<0}function Fm(r,t){const n=Mp(r.i,r.x,r.y),a=Mp(t.i,t.x,t.y),c=r.next,d=t.prev;return r.next=t,t.prev=r,n.next=c,c.prev=n,a.next=n,n.prev=a,d.next=a,a.prev=d,a}function Bm(r,t,n,a){const c=Mp(r,t,n);return a?(c.next=a.next,c.prev=a,a.next.prev=c,a.next=c):(c.prev=c,c.next=c),c}function su(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Mp(r,t,n){return{i:r,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class ml{constructor(t,n){if(n>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=n}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class ad{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}ad.noSubdivision=new ad({fill:new ml(0,0),line:new ml(0,0),tile:new ml(0,0),stencil:new ml(0,0),circle:1}),$e("SubdivisionGranularityExpression",ml),$e("SubdivisionGranularitySetting",ad);const gl=-32768,ou=32767;class wv{constructor(t,n){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=Dt/t,this._canonical=n}_getKey(t,n){return(t+=32768)<<16|(n+=32768)<<0}_vertexToIndex(t,n){if(t<-32768||n<-32768||t>32767||n>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const a=0|Math.round(t),c=0|Math.round(n),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 g=0;g<d.length;g+=3){const x=d[g],w=d[g+1],S=d[g+2],I=c[2*x],R=c[2*x+1];(c[2*w]-I)*(c[2*S+1]-R)-(c[2*w+1]-R)*(c[2*S]-I)>0?(p.push(x),p.push(S),p.push(w)):(p.push(x),p.push(w),p.push(S))}return p}(this._vertexBuffer,t);const n=[],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 g=1/0,x=1/0,w=-1/0,S=-1/0;for(let j=0;j<3;j++){const $=p[2*j],X=p[2*j+1];g=Math.min(g,$),w=Math.max(w,$),x=Math.min(x,X),S=Math.max(S,X)}if(g===w||x===S)continue;const I=Math.floor(g/this._granularityCellSize),R=Math.ceil(w/this._granularityCellSize),L=Math.floor(x/this._granularityCellSize),B=Math.ceil(S/this._granularityCellSize);if(I!==R||L!==B)for(let j=L;j<B;j++){const $=this._scanlineGenerateVertexRingForCellRow(j,p,d);Tv(this._vertexBuffer,$,n)}else n.push(...d)}return n}_scanlineGenerateVertexRingForCellRow(t,n,a){const c=t*this._granularityCellSize,d=c+this._granularityCellSize,p=[];for(let g=0;g<3;g++){const x=n[2*g],w=n[2*g+1],S=n[2*(g+1)%6],I=n[(2*(g+1)+1)%6],R=n[2*(g+2)%6],L=n[(2*(g+2)+1)%6],B=S-x,j=I-w,$=B===0,X=j===0,oe=(c-w)/j,Y=(d-w)/j,D=Math.min(oe,Y),U=Math.max(oe,Y);if(!X&&(D>=1||U<=0)||X&&(w<c||w>d)){I>=c&&I<=d&&p.push(a[(g+1)%3]);continue}!X&&D>0&&p.push(this._vertexToIndex(x+B*D,w+j*D));const Q=x+B*Math.max(D,0),xe=x+B*Math.min(U,1);$||this._generateIntraEdgeVertices(p,x,w,S,I,Q,xe),!X&&U<1&&p.push(this._vertexToIndex(x+B*U,w+j*U)),(X||I>=c&&I<=d)&&p.push(a[(g+1)%3]),!X&&(I<=c||I>=d)&&this._generateInterEdgeVertices(p,x,w,S,I,R,L,xe,c,d)}return p}_generateIntraEdgeVertices(t,n,a,c,d,p,g){const x=c-n,w=d-a,S=w===0,I=S?Math.min(n,c):Math.min(p,g),R=S?Math.max(n,c):Math.max(p,g),L=Math.floor(I/this._granularityCellSize)+1,B=Math.ceil(R/this._granularityCellSize)-1;if(S?n<c:p<g)for(let j=L;j<=B;j++){const $=j*this._granularityCellSize;t.push(this._vertexToIndex($,a+w*($-n)/x))}else for(let j=B;j>=L;j--){const $=j*this._granularityCellSize;t.push(this._vertexToIndex($,a+w*($-n)/x))}}_generateInterEdgeVertices(t,n,a,c,d,p,g,x,w,S){const I=d-a,R=p-c,L=g-d,B=(w-d)/L,j=(S-d)/L,$=Math.min(B,j),X=Math.max(B,j),oe=c+R*$;let Y=Math.floor(Math.min(oe,x)/this._granularityCellSize)+1,D=Math.ceil(Math.max(oe,x)/this._granularityCellSize)-1,U=x<oe;const Q=L===0;if(Q&&(g===w||g===S))return;if(Q||$>=1||X<=0){const ze=a-g,be=p+(n-p)*Math.min((w-g)/ze,(S-g)/ze);Y=Math.floor(Math.min(be,x)/this._granularityCellSize)+1,D=Math.ceil(Math.max(be,x)/this._granularityCellSize)-1,U=x<be}const xe=I>0?S:w;if(U)for(let ze=Y;ze<=D;ze++)t.push(this._vertexToIndex(ze*this._granularityCellSize,xe));else for(let ze=D;ze>=Y;ze--)t.push(this._vertexToIndex(ze*this._granularityCellSize,xe))}_generateOutline(t){const n=[];for(const a of t){const c=co(a,this._granularity,!0),d=this._pointArrayToIndices(c),p=[];for(let g=1;g<d.length;g++)p.push(d[g-1]),p.push(d[g]);n.push(p)}return n}_handlePoles(t){let n=!1,a=!1;this._canonical&&(this._canonical.y===0&&(n=!0),this._canonical.y===(1<<this._canonical.z)-1&&(a=!0)),(n||a)&&this._fillPoles(t,n,a)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let n=0;n<t.length;n+=2){const a=t[n+1];a===gl&&(t[n+1]=-32767),a===ou&&(t[n+1]=32766)}}_generatePoleQuad(t,n,a,c,d,p){c>d!=(p===gl)?(t.push(n),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(n),t.push(this._vertexToIndex(c,p)),t.push(this._vertexToIndex(d,p)),t.push(a),t.push(this._vertexToIndex(c,p)))}_fillPoles(t,n,a){const c=this._vertexBuffer,d=Dt,p=t.length;for(let g=2;g<p;g+=3){const x=t[g-2],w=t[g-1],S=t[g],I=c[2*x],R=c[2*x+1],L=c[2*w],B=c[2*w+1],j=c[2*S],$=c[2*S+1];n&&(R===0&&B===0&&this._generatePoleQuad(t,x,w,I,L,gl),B===0&&$===0&&this._generatePoleQuad(t,w,S,L,j,gl),$===0&&R===0&&this._generatePoleQuad(t,S,x,j,I,gl)),a&&(R===d&&B===d&&this._generatePoleQuad(t,x,w,I,L,ou),B===d&&$===d&&this._generatePoleQuad(t,w,S,L,j,ou),$===d&&R===d&&this._generatePoleQuad(t,S,x,j,I,ou))}}_initializeVertices(t){for(let n=0;n<t.length;n+=2)this._vertexToIndex(t[n],t[n+1])}subdividePolygonInternal(t,n){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:a,holeIndices:c}=function(g){const x=[],w=[];for(const S of g)if(S.length!==0){S!==g[0]&&x.push(w.length/2);for(let I=0;I<S.length;I++)w.push(S[I].x),w.push(S[I].y)}return{flattened:w,holeIndices:x}}(t);let d;this._initializeVertices(a);try{const g=function(w,S,I=2){const R=S&&S.length,L=R?S[0]*I:w.length;let B=Rm(w,0,L,I,!0);const j=[];if(!B||B.next===B.prev)return j;let $,X,oe;if(R&&(B=function(Y,D,U,Q){const xe=[];for(let ze=0,be=D.length;ze<be;ze++){const Pe=Rm(Y,D[ze]*Q,ze<be-1?D[ze+1]*Q:Y.length,Q,!1);Pe===Pe.next&&(Pe.steiner=!0),xe.push(vv(Pe))}xe.sort(_v);for(let ze=0;ze<xe.length;ze++)U=yv(xe[ze],U);return U}(w,S,B,I)),w.length>80*I){$=1/0,X=1/0;let Y=-1/0,D=-1/0;for(let U=I;U<L;U+=I){const Q=w[U],xe=w[U+1];Q<$&&($=Q),xe<X&&(X=xe),Q>Y&&(Y=Q),xe>D&&(D=xe)}oe=Math.max(Y-$,D-X),oe=oe!==0?32767/oe:0}return ru(B,j,I,$,X,oe,0),j}(a,c),x=this._convertIndices(a,g);d=this._subdivideTrianglesScanline(x)}catch(g){console.error(g)}let p=[];return n&&(p=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(d),{verticesFlattened:this._vertexBuffer,indicesTriangles:d,indicesLineList:p}}_convertIndices(t,n){const a=[];for(let c=0;c<n.length;c++)a.push(this._vertexToIndex(t[2*n[c]],t[2*n[c]+1]));return a}_pointArrayToIndices(t){const n=[];for(let a=0;a<t.length;a++){const c=t[a];n.push(this._vertexToIndex(c.x,c.y))}return n}}function Om(r,t,n,a=!0){return new wv(n,t).subdividePolygonInternal(r,a)}function co(r,t,n=!1){if(!r||r.length<1)return[];if(r.length<2)return[];const a=r[0],c=r[r.length-1],d=n&&(a.x!==c.x||a.y!==c.y);if(t<2)return d?[...r,r[0]]:[...r];const p=Math.floor(Dt/t),g=[];g.push(new ve(r[0].x,r[0].y));const x=r.length,w=d?x:x-1;for(let S=0;S<w;S++){const I=r[S],R=S<x-1?r[S+1]:r[0],L=I.x,B=I.y,j=R.x,$=R.y,X=L!==j,oe=B!==$;if(!X&&!oe)continue;const Y=j-L,D=$-B,U=Math.abs(Y),Q=Math.abs(D);let xe=L,ze=B;for(;;){const Pe=Y>0?(Math.floor(xe/p)+1)*p:(Math.ceil(xe/p)-1)*p,Le=D>0?(Math.floor(ze/p)+1)*p:(Math.ceil(ze/p)-1)*p,Re=Math.abs(xe-Pe),Fe=Math.abs(ze-Le),Ce=Math.abs(xe-j),Ge=Math.abs(ze-$),nt=X?Re/U:Number.POSITIVE_INFINITY,tt=oe?Fe/Q:Number.POSITIVE_INFINITY;if((Ce<=Re||!X)&&(Ge<=Fe||!oe))break;if(nt<tt&&X||!oe){xe=Pe,ze+=D*nt;const Ye=new ve(xe,Math.round(ze));g[g.length-1].x===Ye.x&&g[g.length-1].y===Ye.y||g.push(Ye)}else{xe+=Y*tt,ze=Le;const Ye=new ve(Math.round(xe),ze);g[g.length-1].x===Ye.x&&g[g.length-1].y===Ye.y||g.push(Ye)}}const be=new ve(j,$);g[g.length-1].x===be.x&&g[g.length-1].y===be.y||g.push(be)}return g}function Tv(r,t,n){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let a=0,c=r[2*t[0]];for(let x=1;x<t.length;x++){const w=r[2*t[x]];w<c&&(c=w,a=x)}const d=t.length;let p=a,g=(p+1)%d;for(;;){const x=p-1>=0?p-1:d-1,w=(g+1)%d,S=r[2*t[x]],I=r[2*t[w]],R=r[2*t[p]],L=r[2*t[p]+1],B=r[2*t[g]+1];let j=!1;if(S<I)j=!0;else if(S>I)j=!1;else{const $=B-L,X=-(r[2*t[g]]-R),oe=L<B?1:-1;((S-R)*$+(r[2*t[x]+1]-L)*X)*oe>((I-R)*$+(r[2*t[w]+1]-L)*X)*oe&&(j=!0)}if(j){const $=t[x],X=t[p],oe=t[g];$!==X&&$!==oe&&X!==oe&&n.push(oe,X,$),p--,p<0&&(p=d-1)}else{const $=t[w],X=t[p],oe=t[g];$!==X&&$!==oe&&X!==oe&&n.push(oe,X,$),g++,g>=d&&(g=0)}if(x===w)break}}function jm(r,t,n,a,c,d,p,g,x){const w=c.length/2,S=p&&g&&x;if(w<bt.MAX_VERTEX_ARRAY_LENGTH){const I=t.prepareSegment(w,n,a),R=I.vertexLength;for(let j=0;j<d.length;j+=3)a.emplaceBack(R+d[j],R+d[j+1],R+d[j+2]);let L,B;I.vertexLength+=w,I.primitiveLength+=d.length/3,S&&(B=p.prepareSegment(w,n,g),L=B.vertexLength,B.vertexLength+=w);for(let j=0;j<c.length;j+=2)r(c[j],c[j+1]);if(S)for(let j=0;j<x.length;j++){const $=x[j];for(let X=1;X<$.length;X+=2)g.emplaceBack(L+$[X-1],L+$[X]);B.primitiveLength+=$.length/2}}else(function(I,R,L,B,j,$){const X=[];for(let Q=0;Q<B.length/2;Q++)X.push(-1);const oe={count:0};let Y=0,D=I.getOrCreateLatestSegment(R,L),U=D.vertexLength;for(let Q=2;Q<j.length;Q+=3){const xe=j[Q-2],ze=j[Q-1],be=j[Q];let Pe=X[xe]<Y,Le=X[ze]<Y,Re=X[be]<Y;D.vertexLength+((Pe?1:0)+(Le?1:0)+(Re?1:0))>bt.MAX_VERTEX_ARRAY_LENGTH&&(D=I.createNewSegment(R,L),Y=oe.count,Pe=!0,Le=!0,Re=!0,U=0);const Fe=lu(X,B,$,oe,xe,Pe,D),Ce=lu(X,B,$,oe,ze,Le,D),Ge=lu(X,B,$,oe,be,Re,D);L.emplaceBack(U+Fe-Y,U+Ce-Y,U+Ge-Y),D.primitiveLength++}})(t,n,a,c,d,r),S&&function(I,R,L,B,j,$){const X=[];for(let Q=0;Q<B.length/2;Q++)X.push(-1);const oe={count:0};let Y=0,D=I.getOrCreateLatestSegment(R,L),U=D.vertexLength;for(let Q=0;Q<j.length;Q++){const xe=j[Q];for(let ze=1;ze<j[Q].length;ze+=2){const be=xe[ze-1],Pe=xe[ze];let Le=X[be]<Y,Re=X[Pe]<Y;D.vertexLength+((Le?1:0)+(Re?1:0))>bt.MAX_VERTEX_ARRAY_LENGTH&&(D=I.createNewSegment(R,L),Y=oe.count,Le=!0,Re=!0,U=0);const Fe=lu(X,B,$,oe,be,Le,D),Ce=lu(X,B,$,oe,Pe,Re,D);L.emplaceBack(U+Fe-Y,U+Ce-Y),D.primitiveLength++}}}(p,n,g,c,x,r),t.forceNewSegmentOnNextPrepare(),p==null||p.forceNewSegmentOnNextPrepare()}function lu(r,t,n,a,c,d,p){if(d){const g=a.count;return n(t[2*c],t[2*c+1]),r[c]=a.count,a.count++,p.vertexLength++,g}return r[c]}class Ip{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ie,this.indexArray=new Ee,this.indexArray2=new Xe,this.programConfigurations=new Ea(t.layers,t.zoom),this.segments=new bt,this.segments2=new bt,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.hasPattern=Tp("fill",this.layers,n);const c=this.layers[0].layout.get("fill-sort-key"),d=!c.isConstant(),p=[];for(const{feature:g,id:x,index:w,sourceLayerIndex:S}of t){const I=this.layers[0]._featureFilter.needGeometry,R=Jn(g,I);if(!this.layers[0]._featureFilter.filter(new ni(this.zoom),R,a))continue;const L=d?c.evaluate(R,{},a,n.availableImages):void 0,B={id:x,properties:g.properties,type:g.type,sourceLayerIndex:S,index:w,geometry:I?R.geometry:Yn(g),patterns:{},sortKey:L};p.push(B)}d&&p.sort((g,x)=>g.sortKey-x.sortKey);for(const g of p){const{geometry:x,index:w,sourceLayerIndex:S}=g;if(this.hasPattern){const I=Pp("fill",this.layers,g,this.zoom,n);this.patternFeatures.push(I)}else this.addFeature(g,x,w,a,{},n.subdivisionGranularity);n.featureIndex.insert(t[w].feature,x,w,S,this.index)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}addFeatures(t,n,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,n,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,dv),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,n,a,c,d,p){for(const g of Gs(n,500)){const x=Om(g,c,p.fill.getGranularityForZoomLevel(c.z)),w=this.layoutVertexArray;jm((S,I)=>{w.emplaceBack(S,I)},this.segments,this.layoutVertexArray,this.indexArray,x.verticesFlattened,x.indicesTriangles,this.segments2,this.indexArray2,x.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}}let Nm,Zm;$e("FillBucket",Ip,{omit:["layers","patternFeatures"]});var Pv={get paint(){return Zm=Zm||new fr({"fill-antialias":new et(F.paint_fill["fill-antialias"]),"fill-opacity":new st(F.paint_fill["fill-opacity"]),"fill-color":new st(F.paint_fill["fill-color"]),"fill-outline-color":new st(F.paint_fill["fill-outline-color"]),"fill-translate":new et(F.paint_fill["fill-translate"]),"fill-translate-anchor":new et(F.paint_fill["fill-translate-anchor"]),"fill-pattern":new ll(F.paint_fill["fill-pattern"])})},get layout(){return Nm=Nm||new fr({"fill-sort-key":new st(F.layout_fill["fill-sort-key"])})}};class Sv extends sr{constructor(t){super(t,Pv)}recalculate(t,n){super.recalculate(t,n);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 Ip(t)}queryRadius(){return td(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:n,transform:a,pixelsToTileUnits:c}){return wm(id(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-a.bearingInRadians,c),n)}isTileClipped(){return!0}}const Mv=Pi([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Iv=Pi([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Cv}=Mv;var Cp,Vm,kp,Um,Ep,$m,Gm,sd={};function qm(){if(Vm)return Cp;Vm=1;var r=_e();function t(c,d,p,g,x){this.properties={},this.extent=p,this.type=0,this._pbf=c,this._geometry=-1,this._keys=g,this._values=x,c.readFields(n,this,d)}function n(c,d,p){c==1?d.id=p.readVarint():c==2?function(g,x){for(var w=g.readVarint()+g.pos;g.pos<w;){var S=x._keys[g.readVarint()],I=x._values[g.readVarint()];x.properties[S]=I}}(p,d):c==3?d.type=p.readVarint():c==4&&(d._geometry=p.pos)}function a(c){for(var d,p,g=0,x=0,w=c.length,S=w-1;x<w;S=x++)g+=((p=c[S]).x-(d=c[x]).x)*(d.y+p.y);return g}return Cp=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,g=1,x=0,w=0,S=0,I=[];c.pos<p;){if(x<=0){var R=c.readVarint();g=7&R,x=R>>3}if(x--,g===1||g===2)w+=c.readSVarint(),S+=c.readSVarint(),g===1&&(d&&I.push(d),d=[]),d.push(new r(w,S));else{if(g!==7)throw new Error("unknown command "+g);d&&d.push(d[0].clone())}}return d&&I.push(d),I},t.prototype.bbox=function(){var c=this._pbf;c.pos=this._geometry;for(var d=c.readVarint()+c.pos,p=1,g=0,x=0,w=0,S=1/0,I=-1/0,R=1/0,L=-1/0;c.pos<d;){if(g<=0){var B=c.readVarint();p=7&B,g=B>>3}if(g--,p===1||p===2)(x+=c.readSVarint())<S&&(S=x),x>I&&(I=x),(w+=c.readSVarint())<R&&(R=w),w>L&&(L=w);else if(p!==7)throw new Error("unknown command "+p)}return[S,R,I,L]},t.prototype.toGeoJSON=function(c,d,p){var g,x,w=this.extent*Math.pow(2,p),S=this.extent*c,I=this.extent*d,R=this.loadGeometry(),L=t.types[this.type];function B(X){for(var oe=0;oe<X.length;oe++){var Y=X[oe];X[oe]=[360*(Y.x+S)/w-180,360/Math.PI*Math.atan(Math.exp((180-360*(Y.y+I)/w)*Math.PI/180))-90]}}switch(this.type){case 1:var j=[];for(g=0;g<R.length;g++)j[g]=R[g][0];B(R=j);break;case 2:for(g=0;g<R.length;g++)B(R[g]);break;case 3:for(R=function(X){var oe=X.length;if(oe<=1)return[X];for(var Y,D,U=[],Q=0;Q<oe;Q++){var xe=a(X[Q]);xe!==0&&(D===void 0&&(D=xe<0),D===xe<0?(Y&&U.push(Y),Y=[X[Q]]):Y.push(X[Q]))}return Y&&U.push(Y),U}(R),g=0;g<R.length;g++)for(x=0;x<R[g].length;x++)B(R[g][x])}R.length===1?R=R[0]:L="Multi"+L;var $={type:"Feature",geometry:{type:L,coordinates:R},properties:this.properties};return"id"in this&&($.id=this.id),$},Cp}function Wm(){if(Um)return kp;Um=1;var r=qm();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(n,this,c),this.length=this._features.length}function n(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 g=null,x=p.readVarint()+p.pos;p.pos<x;){var w=p.readVarint()>>3;g=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 g}(d))}return kp=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 r(this._pbf,c,this.extent,this._keys,this._values)},kp}function Hm(){return Gm||(Gm=1,sd.VectorTile=function(){if($m)return Ep;$m=1;var r=Wm();function t(n,a,c){if(n===3){var d=new r(c,c.readVarint()+c.pos);d.length&&(a[d.name]=d)}}return Ep=function(n,a){this.layers=n.readFields(t,{},a)},Ep}(),sd.VectorTileFeature=qm(),sd.VectorTileLayer=Wm()),sd}var cu=ue(Hm());const kv=cu.VectorTileFeature.types,Ap=Math.pow(2,13);function uu(r,t,n,a,c,d,p,g){r.emplaceBack(t,n,2*Math.floor(a*Ap)+p,c*Ap*2,d*Ap*2,Math.round(g))}class zp{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new he,this.centroidVertexArray=new ee,this.indexArray=new Ee,this.programConfigurations=new Ea(t.layers,t.zoom),this.segments=new bt,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.features=[],this.hasPattern=Tp("fill-extrusion",this.layers,n);for(const{feature:c,id:d,index:p,sourceLayerIndex:g}of t){const x=this.layers[0]._featureFilter.needGeometry,w=Jn(c,x);if(!this.layers[0]._featureFilter.filter(new ni(this.zoom),w,a))continue;const S={id:d,sourceLayerIndex:g,index:p,geometry:x?w.geometry:Yn(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(Pp("fill-extrusion",this.layers,S,this.zoom,n)):this.addFeature(S,S.geometry,p,a,{},n.subdivisionGranularity),n.featureIndex.insert(c,S.geometry,p,g,this.index,!0)}}addFeatures(t,n,a){for(const c of this.features){const{geometry:d}=c;this.addFeature(c,d,c.index,n,a,t.subdivisionGranularity)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,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,Cv),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Iv.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,n,a,c,d,p){for(const g of Gs(n,500)){const x={x:0,y:0,sampleCount:0},w=this.layoutVertexArray.length;this.processPolygon(x,c,t,g,p);const S=this.layoutVertexArray.length-w,I=Math.floor(x.x/x.sampleCount),R=Math.floor(x.y/x.sampleCount);for(let L=0;L<S;L++)this.centroidVertexArray.emplaceBack(I,R)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}processPolygon(t,n,a,c,d){if(c.length<1||Xm(c[0]))return;for(const I of c)I.length!==0&&Ev(t,I);const p={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},g=d.fill.getGranularityForZoomLevel(n.z),x=kv[a.type]==="Polygon";for(const I of c){if(I.length===0||Xm(I))continue;const R=co(I,g,x);this._generateSideFaces(R,p)}if(!x)return;const w=Om(c,n,g,!1),S=this.layoutVertexArray;jm((I,R)=>{uu(S,I,R,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,w.verticesFlattened,w.indicesTriangles)}_generateSideFaces(t,n){let a=0;for(let c=1;c<t.length;c++){const d=t[c],p=t[c-1];if(Av(d,p))continue;n.segment.vertexLength+4>bt.MAX_VERTEX_ARRAY_LENGTH&&(n.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const g=d.sub(p)._perp()._unit(),x=p.dist(d);a+x>32768&&(a=0),uu(this.layoutVertexArray,d.x,d.y,g.x,g.y,0,0,a),uu(this.layoutVertexArray,d.x,d.y,g.x,g.y,0,1,a),a+=x,uu(this.layoutVertexArray,p.x,p.y,g.x,g.y,0,0,a),uu(this.layoutVertexArray,p.x,p.y,g.x,g.y,0,1,a);const w=n.segment.vertexLength;this.indexArray.emplaceBack(w,w+2,w+1),this.indexArray.emplaceBack(w+1,w+2,w+3),n.segment.vertexLength+=4,n.segment.primitiveLength+=2}}}function Ev(r,t){for(let n=0;n<t.length;n++){const a=t[n];n===t.length-1&&t[0].x===a.x&&t[0].y===a.y||(r.x+=a.x,r.y+=a.y,r.sampleCount++)}}function Av(r,t){return r.x===t.x&&(r.x<0||r.x>Dt)||r.y===t.y&&(r.y<0||r.y>Dt)}function Xm(r){return r.every(t=>t.x<0)||r.every(t=>t.x>Dt)||r.every(t=>t.y<0)||r.every(t=>t.y>Dt)}let Km;$e("FillExtrusionBucket",zp,{omit:["layers","features"]});var zv={get paint(){return Km=Km||new fr({"fill-extrusion-opacity":new et(F["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new st(F["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new et(F["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new et(F["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ll(F["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new st(F["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new st(F["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new et(F["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Rv extends sr{constructor(t){super(t,zv)}createBucket(t){return new zp(t)}queryRadius(){return td(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,pixelPosMatrix:g}){const x=id(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(n,a),S=this.paint.get("fill-extrusion-base").evaluate(n,a),I=function(L,B,j){const $=[];for(const X of L){const oe=[X.x,X.y,0,1];ut(oe,oe,B),$.push(new ve(oe[0]/oe[3],oe[1]/oe[3]))}return $}(x,g),R=function(L,B,j,$){const X=[],oe=[],Y=$[8]*B,D=$[9]*B,U=$[10]*B,Q=$[11]*B,xe=$[8]*j,ze=$[9]*j,be=$[10]*j,Pe=$[11]*j;for(const Le of L){const Re=[],Fe=[];for(const Ce of Le){const Ge=Ce.x,nt=Ce.y,tt=$[0]*Ge+$[4]*nt+$[12],Ye=$[1]*Ge+$[5]*nt+$[13],At=$[2]*Ge+$[6]*nt+$[14],xi=$[3]*Ge+$[7]*nt+$[15],Ni=At+U,rr=xi+Q,qr=tt+xe,Pr=Ye+ze,Yi=At+be,pi=xi+Pe,Ui=new ve((tt+Y)/rr,(Ye+D)/rr);Ui.z=Ni/rr,Re.push(Ui);const Ji=new ve(qr/pi,Pr/pi);Ji.z=Yi/pi,Fe.push(Ji)}X.push(Re),oe.push(Fe)}return[X,oe]}(c,S,w,g);return function(L,B,j){let $=1/0;wm(j,B)&&($=Ym(j,B[0]));for(let X=0;X<B.length;X++){const oe=B[X],Y=L[X];for(let D=0;D<oe.length-1;D++){const U=oe[D],Q=[U,oe[D+1],Y[D+1],Y[D],U];pl(j,Q)&&($=Math.min($,Ym(j,Q)))}}return $!==1/0&&$}(R[0],R[1],I)}}function hu(r,t){return r.x*t.x+r.y*t.y}function Ym(r,t){if(r.length===1){let n=0;const a=t[n++];let c;for(;!c||a.equals(c);)if(c=t[n++],!c)return 1/0;for(;n<t.length;n++){const d=t[n],p=r[0],g=c.sub(a),x=d.sub(a),w=p.sub(a),S=hu(g,g),I=hu(g,x),R=hu(x,x),L=hu(w,g),B=hu(w,x),j=S*R-I*I,$=(R*L-I*B)/j,X=(S*B-I*L)/j,oe=a.z*(1-$-X)+c.z*$+d.z*X;if(isFinite(oe))return oe}return 1/0}{let n=1/0;for(const a of t)n=Math.min(n,a.z);return n}}const Dv=Pi([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Lv}=Dv,Fv=Pi([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Bv}=Fv,Ov=cu.VectorTileFeature.types,jv=Math.cos(Math.PI/180*37.5),Jm=Math.pow(2,14)/.5;class Rp{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(n=>{this.gradients[n.id]={}}),this.layoutVertexArray=new se,this.layoutVertexArray2=new ye,this.indexArray=new Ee,this.programConfigurations=new Ea(t.layers,t.zoom),this.segments=new bt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.hasPattern=Tp("line",this.layers,n);const c=this.layers[0].layout.get("line-sort-key"),d=!c.isConstant(),p=[];for(const{feature:g,id:x,index:w,sourceLayerIndex:S}of t){const I=this.layers[0]._featureFilter.needGeometry,R=Jn(g,I);if(!this.layers[0]._featureFilter.filter(new ni(this.zoom),R,a))continue;const L=d?c.evaluate(R,{},a):void 0,B={id:x,properties:g.properties,type:g.type,sourceLayerIndex:S,index:w,geometry:I?R.geometry:Yn(g),patterns:{},sortKey:L};p.push(B)}d&&p.sort((g,x)=>g.sortKey-x.sortKey);for(const g of p){const{geometry:x,index:w,sourceLayerIndex:S}=g;if(this.hasPattern){const I=Pp("line",this.layers,g,this.zoom,n);this.patternFeatures.push(I)}else this.addFeature(g,x,w,a,{},n.subdivisionGranularity);n.featureIndex.insert(t[w].feature,x,w,S,this.index)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}addFeatures(t,n,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,n,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,Bv)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Lv),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,n,a,c,d,p){const g=this.layers[0].layout,x=g.get("line-join").evaluate(t,{}),w=g.get("line-cap"),S=g.get("line-miter-limit"),I=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const R of n)this.addLine(R,t,x,w,S,I,c,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}addLine(t,n,a,c,d,p,g,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=co(t,g?x.line.getGranularityForZoomLevel(g.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=Ov[n.type]==="Polygon";let S=t.length;for(;S>=2&&t[S-1].equals(t[S-2]);)S--;let I=0;for(;I<S-1&&t[I].equals(t[I+1]);)I++;if(S<(w?3:2))return;a==="bevel"&&(d=1.05);const R=this.overscaling<=16?15*Dt/(512*this.overscaling):0,L=this.segments.prepareSegment(10*S,this.layoutVertexArray,this.indexArray);let B,j,$,X,oe;this.e1=this.e2=-1,w&&(B=t[S-2],oe=t[I].sub(B)._unit()._perp());for(let Y=I;Y<S;Y++){if($=Y===S-1?w?t[I+1]:void 0:t[Y+1],$&&t[Y].equals($))continue;oe&&(X=oe),B&&(j=B),B=t[Y],oe=$?$.sub(B)._unit()._perp():X,X=X||oe;let D=X.add(oe);D.x===0&&D.y===0||D._unit();const U=X.x*oe.x+X.y*oe.y,Q=D.x*oe.x+D.y*oe.y,xe=Q!==0?1/Q:1/0,ze=2*Math.sqrt(2-2*Q),be=Q<jv&&j&&$,Pe=X.x*oe.y-X.y*oe.x>0;if(be&&Y>I){const Fe=B.dist(j);if(Fe>2*R){const Ce=B.sub(B.sub(j)._mult(R/Fe)._round());this.updateDistance(j,Ce),this.addCurrentVertex(Ce,X,0,0,L),j=Ce}}const Le=j&&$;let Re=Le?a:w?"butt":c;if(Le&&Re==="round"&&(xe<p?Re="miter":xe<=2&&(Re="fakeround")),Re==="miter"&&xe>d&&(Re="bevel"),Re==="bevel"&&(xe>2&&(Re="flipbevel"),xe<d&&(Re="miter")),j&&this.updateDistance(j,B),Re==="miter")D._mult(xe),this.addCurrentVertex(B,D,0,0,L);else if(Re==="flipbevel"){if(xe>100)D=oe.mult(-1);else{const Fe=xe*X.add(oe).mag()/X.sub(oe).mag();D._perp()._mult(Fe*(Pe?-1:1))}this.addCurrentVertex(B,D,0,0,L),this.addCurrentVertex(B,D.mult(-1),0,0,L)}else if(Re==="bevel"||Re==="fakeround"){const Fe=-Math.sqrt(xe*xe-1),Ce=Pe?Fe:0,Ge=Pe?0:Fe;if(j&&this.addCurrentVertex(B,X,Ce,Ge,L),Re==="fakeround"){const nt=Math.round(180*ze/Math.PI/20);for(let tt=1;tt<nt;tt++){let Ye=tt/nt;if(Ye!==.5){const xi=Ye-.5;Ye+=Ye*xi*(Ye-1)*((1.0904+U*(U*(3.55645-1.43519*U)-3.2452))*xi*xi+(.848013+U*(.215638*U-1.06021)))}const At=oe.sub(X)._mult(Ye)._add(X)._unit()._mult(Pe?-1:1);this.addHalfVertex(B,At.x,At.y,!1,Pe,0,L)}}$&&this.addCurrentVertex(B,oe,-Ce,-Ge,L)}else if(Re==="butt")this.addCurrentVertex(B,D,0,0,L);else if(Re==="square"){const Fe=j?1:-1;this.addCurrentVertex(B,D,Fe,Fe,L)}else Re==="round"&&(j&&(this.addCurrentVertex(B,X,0,0,L),this.addCurrentVertex(B,X,1,1,L,!0)),$&&(this.addCurrentVertex(B,oe,-1,-1,L,!0),this.addCurrentVertex(B,oe,0,0,L)));if(be&&Y<S-1){const Fe=B.dist($);if(Fe>2*R){const Ce=B.add($.sub(B)._mult(R/Fe)._round());this.updateDistance(B,Ce),this.addCurrentVertex(Ce,oe,0,0,L),B=Ce}}}}addCurrentVertex(t,n,a,c,d,p=!1){const g=n.y*c-n.x,x=-n.y-n.x*c;this.addHalfVertex(t,n.x+n.y*a,n.y-n.x*a,p,!1,a,d),this.addHalfVertex(t,g,x,p,!0,-c,d),this.distance>Jm/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,n,a,c,d,p))}addHalfVertex({x:t,y:n},a,c,d,p,g,x){const w=.5*(this.lineClips?this.scaledDistance*(Jm-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(d?1:0),(n<<1)+(p?1:0),Math.round(63*a)+128,Math.round(63*c)+128,1+(g===0?0:g<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 S=x.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,S,this.e2),x.primitiveLength++),p?this.e2=S:this.e1=S}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,n){this.distance+=t.dist(n),this.updateScaledDistance()}}let Qm,eg;$e("LineBucket",Rp,{omit:["layers","patternFeatures"]});var tg={get paint(){return eg=eg||new fr({"line-opacity":new st(F.paint_line["line-opacity"]),"line-color":new st(F.paint_line["line-color"]),"line-translate":new et(F.paint_line["line-translate"]),"line-translate-anchor":new et(F.paint_line["line-translate-anchor"]),"line-width":new st(F.paint_line["line-width"]),"line-gap-width":new st(F.paint_line["line-gap-width"]),"line-offset":new st(F.paint_line["line-offset"]),"line-blur":new st(F.paint_line["line-blur"]),"line-dasharray":new Gc(F.paint_line["line-dasharray"]),"line-pattern":new ll(F.paint_line["line-pattern"]),"line-gradient":new qc(F.paint_line["line-gradient"])})},get layout(){return Qm=Qm||new fr({"line-cap":new et(F.layout_line["line-cap"]),"line-join":new st(F.layout_line["line-join"]),"line-miter-limit":new et(F.layout_line["line-miter-limit"]),"line-round-limit":new et(F.layout_line["line-round-limit"]),"line-sort-key":new st(F.layout_line["line-sort-key"])})}};class Nv extends st{possiblyEvaluate(t,n){return n=new ni(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,zoomHistory:n.zoomHistory,transition:n.transition}),super.possiblyEvaluate(t,n)}evaluate(t,n,a,c){return n=ft({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(t,n,a,c)}}let od;class Zv extends sr{constructor(t){super(t,tg),this.gradientVersion=0,od||(od=new Nv(tg.paint.properties["line-width"].specification),od.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const n=this.gradientExpression();this.stepInterpolant=!!function(a){return a._styleExpression!==void 0}(n)&&n._styleExpression.expression instanceof es,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,n){super.recalculate(t,n),this.paint._values["line-floorwidth"]=od.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Rp(t)}queryRadius(t){const n=t,a=ig(tu("line-width",this,n),tu("line-gap-width",this,n)),c=tu("line-offset",this,n);return a/2+Math.abs(c)+td(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p}){const g=id(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,p),x=p/2*ig(this.paint.get("line-width").evaluate(n,a),this.paint.get("line-gap-width").evaluate(n,a)),w=this.paint.get("line-offset").evaluate(n,a);return w&&(c=function(S,I){const R=[];for(let L=0;L<S.length;L++){const B=S[L],j=[];for(let $=0;$<B.length;$++){const X=B[$-1],oe=B[$],Y=B[$+1],D=$===0?new ve(0,0):oe.sub(X)._unit()._perp(),U=$===B.length-1?new ve(0,0):Y.sub(oe)._unit()._perp(),Q=D._add(U)._unit(),xe=Q.x*U.x+Q.y*U.y;xe!==0&&Q._mult(1/xe),j.push(Q._mult(I)._add(oe))}R.push(j)}return R}(c,w*p)),function(S,I,R){for(let L=0;L<I.length;L++){const B=I[L];if(S.length>=3){for(let j=0;j<B.length;j++)if(oo(S,B[j]))return!0}if(iv(S,B,R))return!0}return!1}(g,c,x)}isTileClipped(){return!0}}function ig(r,t){return t>0?t+2*r:r}const Vv=Pi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Uv=Pi([{name:"a_projected_pos",components:3,type:"Float32"}],4);Pi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const $v=Pi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Pi([{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 rg=Pi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Gv=Pi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function qv(r,t,n){return r.sections.forEach(a=>{a.text=function(c,d,p){const g=d.layout.get("text-transform").evaluate(p,{});return g==="uppercase"?c=c.toLocaleUpperCase():g==="lowercase"&&(c=c.toLocaleLowerCase()),vn.applyArabicShaping&&(c=vn.applyArabicShaping(c)),c}(a.text,t,n)}),r}Pi([{name:"triangle",components:3,type:"Uint16"}]),Pi([{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"}]),Pi([{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"}]),Pi([{type:"Float32",name:"offsetX"}]),Pi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Pi([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const du={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ng,Dp,ag,ji=24,Lp={};function Wv(){return ng||(ng=1,Lp.read=function(r,t,n,a,c){var d,p,g=8*c-a-1,x=(1<<g)-1,w=x>>1,S=-7,I=n?c-1:0,R=n?-1:1,L=r[t+I];for(I+=R,d=L&(1<<-S)-1,L>>=-S,S+=g;S>0;d=256*d+r[t+I],I+=R,S-=8);for(p=d&(1<<-S)-1,d>>=-S,S+=a;S>0;p=256*p+r[t+I],I+=R,S-=8);if(d===0)d=1-w;else{if(d===x)return p?NaN:1/0*(L?-1:1);p+=Math.pow(2,a),d-=w}return(L?-1:1)*p*Math.pow(2,d-a)},Lp.write=function(r,t,n,a,c,d){var p,g,x,w=8*d-c-1,S=(1<<w)-1,I=S>>1,R=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,L=a?0:d-1,B=a?1:-1,j=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(g=isNaN(t)?1:0,p=S):(p=Math.floor(Math.log(t)/Math.LN2),t*(x=Math.pow(2,-p))<1&&(p--,x*=2),(t+=p+I>=1?R/x:R*Math.pow(2,1-I))*x>=2&&(p++,x/=2),p+I>=S?(g=0,p=S):p+I>=1?(g=(t*x-1)*Math.pow(2,c),p+=I):(g=t*Math.pow(2,I-1)*Math.pow(2,c),p=0));c>=8;r[n+L]=255&g,L+=B,g/=256,c-=8);for(p=p<<c|g,w+=c;w>0;r[n+L]=255&p,L+=B,p/=256,w-=8);r[n+L-B]|=128*j}),Lp}function sg(){if(ag)return Dp;ag=1,Dp=t;var r=Wv();function t(D){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(D)?D:new Uint8Array(D||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 n=4294967296,a=1/n,c=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function d(D){return D.type===t.Bytes?D.readVarint()+D.pos:D.pos+1}function p(D,U,Q){return Q?4294967296*U+(D>>>0):4294967296*(U>>>0)+(D>>>0)}function g(D,U,Q){var xe=U<=16383?1:U<=2097151?2:U<=268435455?3:Math.floor(Math.log(U)/(7*Math.LN2));Q.realloc(xe);for(var ze=Q.pos-1;ze>=D;ze--)Q.buf[ze+xe]=Q.buf[ze]}function x(D,U){for(var Q=0;Q<D.length;Q++)U.writeVarint(D[Q])}function w(D,U){for(var Q=0;Q<D.length;Q++)U.writeSVarint(D[Q])}function S(D,U){for(var Q=0;Q<D.length;Q++)U.writeFloat(D[Q])}function I(D,U){for(var Q=0;Q<D.length;Q++)U.writeDouble(D[Q])}function R(D,U){for(var Q=0;Q<D.length;Q++)U.writeBoolean(D[Q])}function L(D,U){for(var Q=0;Q<D.length;Q++)U.writeFixed32(D[Q])}function B(D,U){for(var Q=0;Q<D.length;Q++)U.writeSFixed32(D[Q])}function j(D,U){for(var Q=0;Q<D.length;Q++)U.writeFixed64(D[Q])}function $(D,U){for(var Q=0;Q<D.length;Q++)U.writeSFixed64(D[Q])}function X(D,U){return(D[U]|D[U+1]<<8|D[U+2]<<16)+16777216*D[U+3]}function oe(D,U,Q){D[Q]=U,D[Q+1]=U>>>8,D[Q+2]=U>>>16,D[Q+3]=U>>>24}function Y(D,U){return(D[U]|D[U+1]<<8|D[U+2]<<16)+(D[U+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(D,U,Q){for(Q=Q||this.length;this.pos<Q;){var xe=this.readVarint(),ze=xe>>3,be=this.pos;this.type=7&xe,D(ze,U,this),this.pos===be&&this.skip(xe)}return U},readMessage:function(D,U){return this.readFields(D,U,this.readVarint()+this.pos)},readFixed32:function(){var D=X(this.buf,this.pos);return this.pos+=4,D},readSFixed32:function(){var D=Y(this.buf,this.pos);return this.pos+=4,D},readFixed64:function(){var D=X(this.buf,this.pos)+X(this.buf,this.pos+4)*n;return this.pos+=8,D},readSFixed64:function(){var D=X(this.buf,this.pos)+Y(this.buf,this.pos+4)*n;return this.pos+=8,D},readFloat:function(){var D=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,D},readDouble:function(){var D=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,D},readVarint:function(D){var U,Q,xe=this.buf;return U=127&(Q=xe[this.pos++]),Q<128?U:(U|=(127&(Q=xe[this.pos++]))<<7,Q<128?U:(U|=(127&(Q=xe[this.pos++]))<<14,Q<128?U:(U|=(127&(Q=xe[this.pos++]))<<21,Q<128?U:function(ze,be,Pe){var Le,Re,Fe=Pe.buf;if(Le=(112&(Re=Fe[Pe.pos++]))>>4,Re<128||(Le|=(127&(Re=Fe[Pe.pos++]))<<3,Re<128)||(Le|=(127&(Re=Fe[Pe.pos++]))<<10,Re<128)||(Le|=(127&(Re=Fe[Pe.pos++]))<<17,Re<128)||(Le|=(127&(Re=Fe[Pe.pos++]))<<24,Re<128)||(Le|=(1&(Re=Fe[Pe.pos++]))<<31,Re<128))return p(ze,Le,be);throw new Error("Expected varint not more than 10 bytes")}(U|=(15&(Q=xe[this.pos]))<<28,D,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var D=this.readVarint();return D%2==1?(D+1)/-2:D/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var D=this.readVarint()+this.pos,U=this.pos;return this.pos=D,D-U>=12&&c?function(Q,xe,ze){return c.decode(Q.subarray(xe,ze))}(this.buf,U,D):function(Q,xe,ze){for(var be="",Pe=xe;Pe<ze;){var Le,Re,Fe,Ce=Q[Pe],Ge=null,nt=Ce>239?4:Ce>223?3:Ce>191?2:1;if(Pe+nt>ze)break;nt===1?Ce<128&&(Ge=Ce):nt===2?(192&(Le=Q[Pe+1]))==128&&(Ge=(31&Ce)<<6|63&Le)<=127&&(Ge=null):nt===3?(Re=Q[Pe+2],(192&(Le=Q[Pe+1]))==128&&(192&Re)==128&&((Ge=(15&Ce)<<12|(63&Le)<<6|63&Re)<=2047||Ge>=55296&&Ge<=57343)&&(Ge=null)):nt===4&&(Re=Q[Pe+2],Fe=Q[Pe+3],(192&(Le=Q[Pe+1]))==128&&(192&Re)==128&&(192&Fe)==128&&((Ge=(15&Ce)<<18|(63&Le)<<12|(63&Re)<<6|63&Fe)<=65535||Ge>=1114112)&&(Ge=null)),Ge===null?(Ge=65533,nt=1):Ge>65535&&(Ge-=65536,be+=String.fromCharCode(Ge>>>10&1023|55296),Ge=56320|1023&Ge),be+=String.fromCharCode(Ge),Pe+=nt}return be}(this.buf,U,D)},readBytes:function(){var D=this.readVarint()+this.pos,U=this.buf.subarray(this.pos,D);return this.pos=D,U},readPackedVarint:function(D,U){if(this.type!==t.Bytes)return D.push(this.readVarint(U));var Q=d(this);for(D=D||[];this.pos<Q;)D.push(this.readVarint(U));return D},readPackedSVarint:function(D){if(this.type!==t.Bytes)return D.push(this.readSVarint());var U=d(this);for(D=D||[];this.pos<U;)D.push(this.readSVarint());return D},readPackedBoolean:function(D){if(this.type!==t.Bytes)return D.push(this.readBoolean());var U=d(this);for(D=D||[];this.pos<U;)D.push(this.readBoolean());return D},readPackedFloat:function(D){if(this.type!==t.Bytes)return D.push(this.readFloat());var U=d(this);for(D=D||[];this.pos<U;)D.push(this.readFloat());return D},readPackedDouble:function(D){if(this.type!==t.Bytes)return D.push(this.readDouble());var U=d(this);for(D=D||[];this.pos<U;)D.push(this.readDouble());return D},readPackedFixed32:function(D){if(this.type!==t.Bytes)return D.push(this.readFixed32());var U=d(this);for(D=D||[];this.pos<U;)D.push(this.readFixed32());return D},readPackedSFixed32:function(D){if(this.type!==t.Bytes)return D.push(this.readSFixed32());var U=d(this);for(D=D||[];this.pos<U;)D.push(this.readSFixed32());return D},readPackedFixed64:function(D){if(this.type!==t.Bytes)return D.push(this.readFixed64());var U=d(this);for(D=D||[];this.pos<U;)D.push(this.readFixed64());return D},readPackedSFixed64:function(D){if(this.type!==t.Bytes)return D.push(this.readSFixed64());var U=d(this);for(D=D||[];this.pos<U;)D.push(this.readSFixed64());return D},skip:function(D){var U=7&D;if(U===t.Varint)for(;this.buf[this.pos++]>127;);else if(U===t.Bytes)this.pos=this.readVarint()+this.pos;else if(U===t.Fixed32)this.pos+=4;else{if(U!==t.Fixed64)throw new Error("Unimplemented type: "+U);this.pos+=8}},writeTag:function(D,U){this.writeVarint(D<<3|U)},realloc:function(D){for(var U=this.length||16;U<this.pos+D;)U*=2;if(U!==this.length){var Q=new Uint8Array(U);Q.set(this.buf),this.buf=Q,this.length=U}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(D){this.realloc(4),oe(this.buf,D,this.pos),this.pos+=4},writeSFixed32:function(D){this.realloc(4),oe(this.buf,D,this.pos),this.pos+=4},writeFixed64:function(D){this.realloc(8),oe(this.buf,-1&D,this.pos),oe(this.buf,Math.floor(D*a),this.pos+4),this.pos+=8},writeSFixed64:function(D){this.realloc(8),oe(this.buf,-1&D,this.pos),oe(this.buf,Math.floor(D*a),this.pos+4),this.pos+=8},writeVarint:function(D){(D=+D||0)>268435455||D<0?function(U,Q){var xe,ze;if(U>=0?(xe=U%4294967296|0,ze=U/4294967296|0):(ze=~(-U/4294967296),4294967295^(xe=~(-U%4294967296))?xe=xe+1|0:(xe=0,ze=ze+1|0)),U>=18446744073709552e3||U<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");Q.realloc(10),function(be,Pe,Le){Le.buf[Le.pos++]=127&be|128,be>>>=7,Le.buf[Le.pos++]=127&be|128,be>>>=7,Le.buf[Le.pos++]=127&be|128,be>>>=7,Le.buf[Le.pos++]=127&be|128,Le.buf[Le.pos]=127&(be>>>=7)}(xe,0,Q),function(be,Pe){var Le=(7&be)<<4;Pe.buf[Pe.pos++]|=Le|((be>>>=3)?128:0),be&&(Pe.buf[Pe.pos++]=127&be|((be>>>=7)?128:0),be&&(Pe.buf[Pe.pos++]=127&be|((be>>>=7)?128:0),be&&(Pe.buf[Pe.pos++]=127&be|((be>>>=7)?128:0),be&&(Pe.buf[Pe.pos++]=127&be|((be>>>=7)?128:0),be&&(Pe.buf[Pe.pos++]=127&be)))))}(ze,Q)}(D,this):(this.realloc(4),this.buf[this.pos++]=127&D|(D>127?128:0),D<=127||(this.buf[this.pos++]=127&(D>>>=7)|(D>127?128:0),D<=127||(this.buf[this.pos++]=127&(D>>>=7)|(D>127?128:0),D<=127||(this.buf[this.pos++]=D>>>7&127))))},writeSVarint:function(D){this.writeVarint(D<0?2*-D-1:2*D)},writeBoolean:function(D){this.writeVarint(!!D)},writeString:function(D){D=String(D),this.realloc(4*D.length),this.pos++;var U=this.pos;this.pos=function(xe,ze,be){for(var Pe,Le,Re=0;Re<ze.length;Re++){if((Pe=ze.charCodeAt(Re))>55295&&Pe<57344){if(!Le){Pe>56319||Re+1===ze.length?(xe[be++]=239,xe[be++]=191,xe[be++]=189):Le=Pe;continue}if(Pe<56320){xe[be++]=239,xe[be++]=191,xe[be++]=189,Le=Pe;continue}Pe=Le-55296<<10|Pe-56320|65536,Le=null}else Le&&(xe[be++]=239,xe[be++]=191,xe[be++]=189,Le=null);Pe<128?xe[be++]=Pe:(Pe<2048?xe[be++]=Pe>>6|192:(Pe<65536?xe[be++]=Pe>>12|224:(xe[be++]=Pe>>18|240,xe[be++]=Pe>>12&63|128),xe[be++]=Pe>>6&63|128),xe[be++]=63&Pe|128)}return be}(this.buf,D,this.pos);var Q=this.pos-U;Q>=128&&g(U,Q,this),this.pos=U-1,this.writeVarint(Q),this.pos+=Q},writeFloat:function(D){this.realloc(4),r.write(this.buf,D,this.pos,!0,23,4),this.pos+=4},writeDouble:function(D){this.realloc(8),r.write(this.buf,D,this.pos,!0,52,8),this.pos+=8},writeBytes:function(D){var U=D.length;this.writeVarint(U),this.realloc(U);for(var Q=0;Q<U;Q++)this.buf[this.pos++]=D[Q]},writeRawMessage:function(D,U){this.pos++;var Q=this.pos;D(U,this);var xe=this.pos-Q;xe>=128&&g(Q,xe,this),this.pos=Q-1,this.writeVarint(xe),this.pos+=xe},writeMessage:function(D,U,Q){this.writeTag(D,t.Bytes),this.writeRawMessage(U,Q)},writePackedVarint:function(D,U){U.length&&this.writeMessage(D,x,U)},writePackedSVarint:function(D,U){U.length&&this.writeMessage(D,w,U)},writePackedBoolean:function(D,U){U.length&&this.writeMessage(D,R,U)},writePackedFloat:function(D,U){U.length&&this.writeMessage(D,S,U)},writePackedDouble:function(D,U){U.length&&this.writeMessage(D,I,U)},writePackedFixed32:function(D,U){U.length&&this.writeMessage(D,L,U)},writePackedSFixed32:function(D,U){U.length&&this.writeMessage(D,B,U)},writePackedFixed64:function(D,U){U.length&&this.writeMessage(D,j,U)},writePackedSFixed64:function(D,U){U.length&&this.writeMessage(D,$,U)},writeBytesField:function(D,U){this.writeTag(D,t.Bytes),this.writeBytes(U)},writeFixed32Field:function(D,U){this.writeTag(D,t.Fixed32),this.writeFixed32(U)},writeSFixed32Field:function(D,U){this.writeTag(D,t.Fixed32),this.writeSFixed32(U)},writeFixed64Field:function(D,U){this.writeTag(D,t.Fixed64),this.writeFixed64(U)},writeSFixed64Field:function(D,U){this.writeTag(D,t.Fixed64),this.writeSFixed64(U)},writeVarintField:function(D,U){this.writeTag(D,t.Varint),this.writeVarint(U)},writeSVarintField:function(D,U){this.writeTag(D,t.Varint),this.writeSVarint(U)},writeStringField:function(D,U){this.writeTag(D,t.Bytes),this.writeString(U)},writeFloatField:function(D,U){this.writeTag(D,t.Fixed32),this.writeFloat(U)},writeDoubleField:function(D,U){this.writeTag(D,t.Fixed64),this.writeDouble(U)},writeBooleanField:function(D,U){this.writeVarintField(D,!!U)}},Dp}var Fp=ue(sg());const Bp=3;function Hv(r,t,n){r===1&&n.readMessage(Xv,t)}function Xv(r,t,n){if(r===3){const{id:a,bitmap:c,width:d,height:p,left:g,top:x,advance:w}=n.readMessage(Kv,{});t.push({id:a,bitmap:new iu({width:d+2*Bp,height:p+2*Bp},c),metrics:{width:d,height:p,left:g,top:x,advance:w}})}}function Kv(r,t,n){r===1?t.id=n.readVarint():r===2?t.bitmap=n.readBytes():r===3?t.width=n.readVarint():r===4?t.height=n.readVarint():r===5?t.left=n.readSVarint():r===6?t.top=n.readSVarint():r===7&&(t.advance=n.readVarint())}const Yv=Bp;function og(r){let t=0,n=0;for(const p of r)t+=p.w*p.h,n=Math.max(n,p.w);r.sort((p,g)=>g.h-p.h);const a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}];let c=0,d=0;for(const p of r)for(let g=a.length-1;g>=0;g--){const x=a[g];if(!(p.w>x.w||p.h>x.h)){if(p.x=x.x,p.y=x.y,d=Math.max(d,p.y+p.h),c=Math.max(c,p.x+p.w),p.w===x.w&&p.h===x.h){const w=a.pop();g<a.length&&(a[g]=w)}else p.h===x.h?(x.x+=p.w,x.w-=p.w):p.w===x.w?(x.y+=p.h,x.h-=p.h):(a.push({x:x.x+p.w,y:x.y,w:x.w-p.w,h:p.h}),x.y+=p.h,x.h-=p.h);break}}return{w:c,h:d,fill:t/(c*d)||0}}const Tr=1;class Op{constructor(t,{pixelRatio:n,version:a,stretchX:c,stretchY:d,content:p,textFitWidth:g,textFitHeight:x}){this.paddedRect=t,this.pixelRatio=n,this.stretchX=c,this.stretchY=d,this.content=p,this.version=a,this.textFitWidth=g,this.textFitHeight=x}get tl(){return[this.paddedRect.x+Tr,this.paddedRect.y+Tr]}get br(){return[this.paddedRect.x+this.paddedRect.w-Tr,this.paddedRect.y+this.paddedRect.h-Tr]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Tr)/this.pixelRatio,(this.paddedRect.h-2*Tr)/this.pixelRatio]}}class lg{constructor(t,n){const a={},c={};this.haveRenderCallbacks=[];const d=[];this.addImages(t,a,d),this.addImages(n,c,d);const{w:p,h:g}=og(d),x=new $r({width:p||1,height:g||1});for(const w in t){const S=t[w],I=a[w].paddedRect;$r.copy(S.data,x,{x:0,y:0},{x:I.x+Tr,y:I.y+Tr},S.data)}for(const w in n){const S=n[w],I=c[w].paddedRect,R=I.x+Tr,L=I.y+Tr,B=S.data.width,j=S.data.height;$r.copy(S.data,x,{x:0,y:0},{x:R,y:L},S.data),$r.copy(S.data,x,{x:0,y:j-1},{x:R,y:L-1},{width:B,height:1}),$r.copy(S.data,x,{x:0,y:0},{x:R,y:L+j},{width:B,height:1}),$r.copy(S.data,x,{x:B-1,y:0},{x:R-1,y:L},{width:1,height:j}),$r.copy(S.data,x,{x:0,y:0},{x:R+B,y:L},{width:1,height:j})}this.image=x,this.iconPositions=a,this.patternPositions=c}addImages(t,n,a){for(const c in t){const d=t[c],p={x:0,y:0,w:d.data.width+2*Tr,h:d.data.height+2*Tr};a.push(p),n[c]=new Op(p,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(t,n){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const a in t.updatedImages)this.patchUpdatedImage(this.iconPositions[a],t.getImage(a),n),this.patchUpdatedImage(this.patternPositions[a],t.getImage(a),n)}patchUpdatedImage(t,n,a){if(!t||!n||t.version===n.version)return;t.version=n.version;const[c,d]=t.tl;a.update(n.data,void 0,{x:c,y:d})}}var xs;$e("ImagePosition",Op),$e("ImageAtlas",lg),P.ah=void 0,(xs=P.ah||(P.ah={}))[xs.none=0]="none",xs[xs.horizontal=1]="horizontal",xs[xs.vertical=2]="vertical",xs[xs.horizontalOnly=3]="horizontalOnly";const ld=-17;class pu{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,n,a){const c=new pu;return c.scale=t||1,c.fontStack=n,c.verticalAlign=a||"bottom",c}static forImage(t,n){const a=new pu;return a.imageName=t,a.verticalAlign=n||"bottom",a}}class _l{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,n){const a=new _l;for(let c=0;c<t.sections.length;c++){const d=t.sections[c];d.image?a.addImageSection(d):a.addTextSection(d,n)}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 n="";for(let a=0;a<t.length;a++){const c=t.charCodeAt(a+1)||null,d=t.charCodeAt(a-1)||null;n+=c&&Uc(c)&&!du[t[a+1]]||d&&Uc(d)&&!du[t[a-1]]||!du[t[a]]?t[a]:du[t[a]]}return n}(this.text)}trim(){let t=0;for(let a=0;a<this.text.length&&ud[this.text.charCodeAt(a)];a++)t++;let n=this.text.length;for(let a=this.text.length-1;a>=0&&a>=t&&ud[this.text.charCodeAt(a)];a--)n--;this.text=this.text.substring(t,n),this.sectionIndex=this.sectionIndex.slice(t,n)}substring(t,n){const a=new _l;return a.text=this.text.substring(t,n),a.sectionIndex=this.sectionIndex.slice(t,n),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,n)=>Math.max(t,this.sections[n].scale),0)}getMaxImageSize(t){let n=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 g=p.displaySize;n=Math.max(n,g[0]),a=Math.max(a,g[1])}}return{maxImageWidth:n,maxImageHeight:a}}addTextSection(t,n){this.text+=t.text,this.sections.push(pu.forText(t.scale,t.fontStack||n,t.verticalAlign));const a=this.sections.length-1;for(let c=0;c<t.text.length;++c)this.sectionIndex.push(a)}addImageSection(t){const n=t.image?t.image.name:"";if(n.length===0)return void bi("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push(pu.forImage(n,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):bi("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function cd(r,t,n,a,c,d,p,g,x,w,S,I,R,L,B){const j=_l.fromFeature(r,c);let $;I===P.ah.vertical&&j.verticalizePunctuation();const{processBidirectionalText:X,processStyledBidirectionalText:oe}=vn;if(X&&j.sections.length===1){$=[];const U=X(j.toString(),jp(j,w,d,t,a,L));for(const Q of U){const xe=new _l;xe.text=Q,xe.sections=j.sections;for(let ze=0;ze<Q.length;ze++)xe.sectionIndex.push(0);$.push(xe)}}else if(oe){$=[];const U=oe(j.text,j.sectionIndex,jp(j,w,d,t,a,L));for(const Q of U){const xe=new _l;xe.text=Q[0],xe.sectionIndex=Q[1],xe.sections=j.sections,$.push(xe)}}else $=function(U,Q){const xe=[],ze=U.text;let be=0;for(const Pe of Q)xe.push(U.substring(be,Pe)),be=Pe;return be<ze.length&&xe.push(U.substring(be,ze.length)),xe}(j,jp(j,w,d,t,a,L));const Y=[],D={positionedLines:Y,text:j.toString(),top:S[1],bottom:S[1],left:S[0],right:S[0],writingMode:I,iconsInText:!1,verticalizable:!1};return function(U,Q,xe,ze,be,Pe,Le,Re,Fe,Ce,Ge,nt){let tt=0,Ye=0,At=0,xi=0;const Ni=Re==="right"?1:Re==="left"?0:.5,rr=ji/nt;let qr=0;for(const pi of be){pi.trim();const Ui=pi.getMaxScale(),Ji={positionedGlyphs:[],lineOffset:0};U.positionedLines[qr]=Ji;const Qi=Ji.positionedGlyphs;let gr=0;if(!pi.length()){Ye+=Pe,++qr;continue}const Wr=t0(ze,pi,rr);for(let Sr=0;Sr<pi.length();Sr++){const Zi=pi.getSection(Sr),Gi=pi.getSectionIndex(Sr),qi=pi.getCharCode(Sr),Li=i0(Fe,Ge,qi);let si;if(Zi.imageName){if(U.iconsInText=!0,Zi.scale=Zi.scale*rr,si=n0(Zi,Li,Ui,Wr,ze),!si)continue;gr=Math.max(gr,si.imageOffset)}else if(si=r0(Zi,qi,Li,Wr,Q,xe),!si)continue;const{rect:Pn,metrics:bl,baselineOffset:Sn}=si;Qi.push({glyph:qi,imageName:Zi.imageName,x:tt,y:Ye+Sn+ld,vertical:Li,scale:Zi.scale,fontStack:Zi.fontStack,sectionIndex:Gi,metrics:bl,rect:Pn}),Li?(U.verticalizable=!0,tt+=(Zi.imageName?bl.advance:ji)*Zi.scale+Ce):tt+=bl.advance*Zi.scale+Ce}Qi.length!==0&&(At=Math.max(tt-Ce,At),a0(Qi,0,Qi.length-1,Ni)),tt=0,Ji.lineOffset=Math.max(gr,(Ui-1)*ji);const $i=Pe*Ui+gr;Ye+=$i,xi=Math.max($i,xi),++qr}const{horizontalAlign:Pr,verticalAlign:Yi}=Np(Le);(function(pi,Ui,Ji,Qi,gr,Wr,$i,Sr,Zi){const Gi=(Ui-Ji)*gr;let qi=0;qi=Wr!==$i?-Sr*Qi-ld:-Qi*Zi*$i+.5*$i;for(const Li of pi)for(const si of Li.positionedGlyphs)si.x+=Gi,si.y+=qi})(U.positionedLines,Ni,Pr,Yi,At,xi,Pe,Ye,be.length),U.top+=-Yi*Ye,U.bottom=U.top+Ye,U.left+=-Pr*At,U.right=U.left+At}(D,t,n,a,$,p,g,x,I,w,R,B),!function(U){for(const Q of U)if(Q.positionedGlyphs.length!==0)return!1;return!0}(Y)&&D}const ud={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Jv={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},Qv={40:!0};function cg(r,t,n,a,c,d){if(t.imageName){const p=a[t.imageName];return p?p.displaySize[0]*t.scale*ji/d+c:0}{const p=n[t.fontStack],g=p&&p[r];return g?g.metrics.advance*t.scale+c:0}}function ug(r,t,n,a){const c=Math.pow(r-t,2);return a?r<t?c/2:2*c:c+Math.abs(n)*n}function e0(r,t,n){let a=0;return r===10&&(a-=1e4),n&&(a+=150),r!==40&&r!==65288||(a+=50),t!==41&&t!==65289||(a+=50),a}function hg(r,t,n,a,c,d){let p=null,g=ug(t,n,c,d);for(const x of a){const w=ug(t-x.x,n,c,d)+x.badness;w<=g&&(p=x,g=w)}return{index:r,x:t,priorBreak:p,badness:g}}function dg(r){return r?dg(r.priorBreak).concat(r.index):[]}function jp(r,t,n,a,c,d){if(!r)return[];const p=[],g=function(I,R,L,B,j,$){let X=0;for(let oe=0;oe<I.length();oe++){const Y=I.getSection(oe);X+=cg(I.getCharCode(oe),Y,B,j,R,$)}return X/Math.max(1,Math.ceil(X/L))}(r,t,n,a,c,d),x=r.text.indexOf("​")>=0;let w=0;for(let I=0;I<r.length();I++){const R=r.getSection(I),L=r.getCharCode(I);if(ud[L]||(w+=cg(L,R,a,c,t,d)),I<r.length()-1){const B=!((S=L)<11904)&&(!!Ct["CJK Compatibility Forms"](S)||!!Ct["CJK Compatibility"](S)||!!Ct["CJK Strokes"](S)||!!Ct["CJK Symbols and Punctuation"](S)||!!Ct["Enclosed CJK Letters and Months"](S)||!!Ct["Halfwidth and Fullwidth Forms"](S)||!!Ct["Ideographic Description Characters"](S)||!!Ct["Vertical Forms"](S)||Zc.test(String.fromCodePoint(S)));(Jv[L]||B||R.imageName||I!==r.length()-2&&Qv[r.getCharCode(I+1)])&&p.push(hg(I+1,w,g,p,e0(L,r.getCharCode(I+1),B&&x),!1))}}var S;return dg(hg(r.length(),w,g,p,0,!0))}function Np(r){let t=.5,n=.5;switch(r){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":n=1;break;case"top":case"top-right":case"top-left":n=0}return{horizontalAlign:t,verticalAlign:n}}function t0(r,t,n){const a=t.getMaxScale()*ji,{maxImageWidth:c,maxImageHeight:d}=t.getMaxImageSize(r),p=Math.max(a,d*n);return{verticalLineContentWidth:Math.max(a,c*n),horizontalLineContentHeight:p}}function pg(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function i0(r,t,n){return!(r===P.ah.horizontal||!t&&!Vc(n)||t&&(ud[n]||(a=n,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(a)))));var a}function r0(r,t,n,a,c,d){const p=d[r.fontStack],g=function(w,S,I,R){if(w&&w.rect)return w;const L=S[I.fontStack],B=L&&L[R];return B?{rect:null,metrics:B.metrics}:null}(p&&p[t],c,r,t);if(g===null)return null;let x;if(n)x=a.verticalLineContentWidth-r.scale*ji;else{const w=pg(r.verticalAlign);x=(a.horizontalLineContentHeight-r.scale*ji)*w}return{rect:g.rect,metrics:g.metrics,baselineOffset:x}}function n0(r,t,n,a,c){const d=c[r.imageName];if(!d)return null;const p=d.paddedRect,g=d.displaySize,x={width:g[0],height:g[1],left:Tr,top:-3,advance:t?g[1]:g[0]};let w;if(t)w=a.verticalLineContentWidth-g[1]*r.scale;else{const S=pg(r.verticalAlign);w=(a.horizontalLineContentHeight-g[1]*r.scale)*S}return{rect:p,metrics:x,baselineOffset:w,imageOffset:(t?g[0]:g[1])*r.scale-ji*n}}function a0(r,t,n,a){if(a===0)return;const c=r[n],d=(r[n].x+c.metrics.advance*c.scale)*a;for(let p=t;p<=n;p++)r[p].x-=d}function s0(r,t,n){const{horizontalAlign:a,verticalAlign:c}=Np(n),d=t[0]-r.displaySize[0]*a,p=t[1]-r.displaySize[1]*c;return{image:r,top:p,bottom:p+r.displaySize[1],left:d,right:d+r.displaySize[0]}}function fg(r){var t,n;let a=r.left,c=r.top,d=r.right-a,p=r.bottom-c;const g=(t=r.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",x=(n=r.image.textFitHeight)!==null&&n!==void 0?n:"stretchOrShrink",w=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(x==="proportional"){if(g==="stretchOnly"&&d/p<w||g==="proportional"){const S=Math.ceil(p*w);a*=S/d,d=S}}else if(g==="proportional"&&x==="stretchOnly"&&w!==0&&d/p>w){const S=Math.ceil(d/w);c*=S/p,p=S}return{x1:a,y1:c,x2:a+d,y2:c+p}}function mg(r,t,n,a,c,d){const p=r.image;let g;if(p.content){const $=p.content,X=p.pixelRatio||1;g=[$[0]/X,$[1]/X,p.displaySize[0]-$[2]/X,p.displaySize[1]-$[3]/X]}const x=t.left*d,w=t.right*d;let S,I,R,L;n==="width"||n==="both"?(L=c[0]+x-a[3],I=c[0]+w+a[1]):(L=c[0]+(x+w-p.displaySize[0])/2,I=L+p.displaySize[0]);const B=t.top*d,j=t.bottom*d;return n==="height"||n==="both"?(S=c[1]+B-a[0],R=c[1]+j+a[2]):(S=c[1]+(B+j-p.displaySize[1])/2,R=S+p.displaySize[1]),{image:p,top:S,right:I,bottom:R,left:L,collisionPadding:g}}const fu=255,Qn=128,vs=fu*Qn;function gg(r,t){const{expression:n}=t;if(n.kind==="constant")return{kind:"constant",layoutSize:n.evaluate(new ni(r+1))};if(n.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:c}=n;let d=0;for(;d<a.length&&a[d]<=r;)d++;d=Math.max(0,d-1);let p=d;for(;p<a.length&&a[p]<r+1;)p++;p=Math.min(a.length-1,p);const g=a[d],x=a[p];return n.kind==="composite"?{kind:"composite",minZoom:g,maxZoom:x,interpolationType:c}:{kind:"camera",minZoom:g,maxZoom:x,minSize:n.evaluate(new ni(g)),maxSize:n.evaluate(new ni(x)),interpolationType:c}}}function Zp(r,t,n){let a="never";const c=r.get(t);return c?a=c:r.get(n)&&(a="always"),a}const o0=cu.VectorTileFeature.types,l0=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function hd(r,t,n,a,c,d,p,g,x,w,S,I,R){const L=g?Math.min(vs,Math.round(g[0])):0,B=g?Math.min(vs,Math.round(g[1])):0;r.emplaceBack(t,n,Math.round(32*a),Math.round(32*c),d,p,(L<<1)+(x?1:0),B,16*w,16*S,256*I,256*R)}function Vp(r,t,n){r.emplaceBack(t.x,t.y,n),r.emplaceBack(t.x,t.y,n),r.emplaceBack(t.x,t.y,n),r.emplaceBack(t.x,t.y,n)}function c0(r){for(const t of r.sections)if(fp(t.text))return!0;return!1}class Up{constructor(t){this.layoutVertexArray=new Ie,this.indexArray=new Ee,this.programConfigurations=t,this.segments=new bt,this.dynamicLayoutVertexArray=new ke,this.opacityVertexArray=new Se,this.hasVisibleVertices=!1,this.placedSymbolArray=new C}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,n,a,c){this.isEmpty()||(a&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Vv.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,n),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Uv.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,l0,!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",Up);class $p{constructor(t,n,a){this.layoutVertexArray=new t,this.layoutAttributes=n,this.indexArray=new a,this.segments=new bt,this.collisionVertexArray=new Be}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,$v.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}$e("CollisionBuffers",$p);class yl{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 n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=gg(this.zoom,n["text-size"]),this.iconSizeData=gg(this.zoom,n["icon-size"]);const a=this.layers[0].layout,c=a.get("symbol-sort-key"),d=a.get("symbol-z-order");this.canOverlap=Zp(a,"text-overlap","text-allow-overlap")!=="never"||Zp(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=>P.ah[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=t.sourceID}createArrays(){this.text=new Up(new Ea(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Up(new Ea(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new O,this.lineVertexArray=new Z,this.symbolInstances=new k,this.textAnchorOffsets=new q}calculateGlyphDependencies(t,n,a,c,d){for(let p=0;p<t.length;p++)if(n[t.charCodeAt(p)]=!0,(a||c)&&d){const g=du[t.charAt(p)];g&&(n[g.charCodeAt(0)]=!0)}}populate(t,n,a){const c=this.layers[0],d=c.layout,p=d.get("text-font"),g=d.get("text-field"),x=d.get("icon-image"),w=(g.value.kind!=="constant"||g.value.value instanceof nr&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),S=x.value.kind!=="constant"||!!x.value.value||Object.keys(x.parameters).length>0,I=d.get("symbol-sort-key");if(this.features=[],!w&&!S)return;const R=n.iconDependencies,L=n.glyphDependencies,B=n.availableImages,j=new ni(this.zoom);for(const{feature:$,id:X,index:oe,sourceLayerIndex:Y}of t){const D=c._featureFilter.needGeometry,U=Jn($,D);if(!c._featureFilter.filter(j,U,a))continue;let Q,xe;if(D||(U.geometry=Yn($)),w){const be=c.getValueAndResolveTokens("text-field",U,a,B),Pe=nr.factory(be),Le=this.hasRTLText=this.hasRTLText||c0(Pe);(!Le||vn.getRTLTextPluginStatus()==="unavailable"||Le&&vn.isParsed())&&(Q=qv(Pe,c,U))}if(S){const be=c.getValueAndResolveTokens("icon-image",U,a,B);xe=be instanceof hr?be:hr.fromString(be)}if(!Q&&!xe)continue;const ze=this.sortFeaturesByKey?I.evaluate(U,{},a):void 0;if(this.features.push({id:X,text:Q,icon:xe,index:oe,sourceLayerIndex:Y,geometry:U.geometry,properties:$.properties,type:o0[$.type],sortKey:ze}),xe&&(R[xe.name]=!0),Q){const be=p.evaluate(U,{},a).join(","),Pe=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(P.ah.vertical)>=0;for(const Le of Q.sections)if(Le.image)R[Le.image.name]=!0;else{const Re=al(Q.toString()),Fe=Le.fontStack||be,Ce=L[Fe]=L[Fe]||{};this.calculateGlyphDependencies(Le.text,Ce,Pe,this.allowVerticalPlacement,Re)}}}d.get("symbol-placement")==="line"&&(this.features=function($){const X={},oe={},Y=[];let D=0;function U(be){Y.push($[be]),D++}function Q(be,Pe,Le){const Re=oe[be];return delete oe[be],oe[Pe]=Re,Y[Re].geometry[0].pop(),Y[Re].geometry[0]=Y[Re].geometry[0].concat(Le[0]),Re}function xe(be,Pe,Le){const Re=X[Pe];return delete X[Pe],X[be]=Re,Y[Re].geometry[0].shift(),Y[Re].geometry[0]=Le[0].concat(Y[Re].geometry[0]),Re}function ze(be,Pe,Le){const Re=Le?Pe[0][Pe[0].length-1]:Pe[0][0];return`${be}:${Re.x}:${Re.y}`}for(let be=0;be<$.length;be++){const Pe=$[be],Le=Pe.geometry,Re=Pe.text?Pe.text.toString():null;if(!Re){U(be);continue}const Fe=ze(Re,Le),Ce=ze(Re,Le,!0);if(Fe in oe&&Ce in X&&oe[Fe]!==X[Ce]){const Ge=xe(Fe,Ce,Le),nt=Q(Fe,Ce,Y[Ge].geometry);delete X[Fe],delete oe[Ce],oe[ze(Re,Y[nt].geometry,!0)]=nt,Y[Ge].geometry=null}else Fe in oe?Q(Fe,Ce,Le):Ce in X?xe(Fe,Ce,Le):(U(be),X[Fe]=D-1,oe[Ce]=D-1)}return Y.filter(be=>be.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort(($,X)=>$.sortKey-X.sortKey)}update(t,n,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,n,this.layers,a),this.icon.programConfigurations.updatePaintArrays(t,n,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,n){const a=this.lineVertexArray.length;if(t.segment!==void 0){let c=t.dist(n[t.segment+1]),d=t.dist(n[t.segment]);const p={};for(let g=t.segment+1;g<n.length;g++)p[g]={x:n[g].x,y:n[g].y,tileUnitDistanceFromAnchor:c},g<n.length-1&&(c+=n[g+1].dist(n[g]));for(let g=t.segment||0;g>=0;g--)p[g]={x:n[g].x,y:n[g].y,tileUnitDistanceFromAnchor:d},g>0&&(d+=n[g-1].dist(n[g]));for(let g=0;g<n.length;g++){const x=p[g];this.lineVertexArray.emplaceBack(x.x,x.y,x.tileUnitDistanceFromAnchor)}}return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(t,n,a,c,d,p,g,x,w,S,I,R){const L=t.indexArray,B=t.layoutVertexArray,j=t.segments.prepareSegment(4*n.length,B,L,this.canOverlap?p.sortKey:void 0),$=this.glyphOffsetArray.length,X=j.vertexLength,oe=this.allowVerticalPlacement&&g===P.ah.vertical?Math.PI/2:0,Y=p.text&&p.text.sections;for(let D=0;D<n.length;D++){const{tl:U,tr:Q,bl:xe,br:ze,tex:be,pixelOffsetTL:Pe,pixelOffsetBR:Le,minFontScaleX:Re,minFontScaleY:Fe,glyphOffset:Ce,isSDF:Ge,sectionIndex:nt}=n[D],tt=j.vertexLength,Ye=Ce[1];hd(B,x.x,x.y,U.x,Ye+U.y,be.x,be.y,a,Ge,Pe.x,Pe.y,Re,Fe),hd(B,x.x,x.y,Q.x,Ye+Q.y,be.x+be.w,be.y,a,Ge,Le.x,Pe.y,Re,Fe),hd(B,x.x,x.y,xe.x,Ye+xe.y,be.x,be.y+be.h,a,Ge,Pe.x,Le.y,Re,Fe),hd(B,x.x,x.y,ze.x,Ye+ze.y,be.x+be.w,be.y+be.h,a,Ge,Le.x,Le.y,Re,Fe),Vp(t.dynamicLayoutVertexArray,x,oe),L.emplaceBack(tt,tt+2,tt+1),L.emplaceBack(tt+1,tt+2,tt+3),j.vertexLength+=4,j.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Ce[0]),D!==n.length-1&&nt===n[D+1].sectionIndex||t.programConfigurations.populatePaintArrays(B.length,p,p.index,{},R,Y&&Y[nt])}t.placedSymbolArray.emplaceBack(x.x,x.y,$,this.glyphOffsetArray.length-$,X,w,S,x.segment,a?a[0]:0,a?a[1]:0,c[0],c[1],g,0,!1,0,I)}_addCollisionDebugVertex(t,n,a,c,d,p){return n.emplaceBack(0,0),t.emplaceBack(a.x,a.y,c,d,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(t,n,a,c,d,p,g){const x=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),w=x.vertexLength,S=d.layoutVertexArray,I=d.collisionVertexArray,R=g.anchorX,L=g.anchorY;this._addCollisionDebugVertex(S,I,p,R,L,new ve(t,n)),this._addCollisionDebugVertex(S,I,p,R,L,new ve(a,n)),this._addCollisionDebugVertex(S,I,p,R,L,new ve(a,c)),this._addCollisionDebugVertex(S,I,p,R,L,new ve(t,c)),x.vertexLength+=4;const B=d.indexArray;B.emplaceBack(w,w+1),B.emplaceBack(w+1,w+2),B.emplaceBack(w+2,w+3),B.emplaceBack(w+3,w),x.primitiveLength+=4}addDebugCollisionBoxes(t,n,a,c){for(let d=t;d<n;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 $p(Ne,rg.members,Xe),this.iconCollisionBox=new $p(Ne,rg.members,Xe);for(let t=0;t<this.symbolInstances.length;t++){const n=this.symbolInstances.get(t);this.addDebugCollisionBoxes(n.textBoxStartIndex,n.textBoxEndIndex,n,!0),this.addDebugCollisionBoxes(n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n,!0),this.addDebugCollisionBoxes(n.iconBoxStartIndex,n.iconBoxEndIndex,n,!1),this.addDebugCollisionBoxes(n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex,n,!1)}}_deserializeCollisionBoxesForSymbol(t,n,a,c,d,p,g,x,w){const S={};for(let I=n;I<a;I++){const R=t.get(I);S.textBox={x1:R.x1,y1:R.y1,x2:R.x2,y2:R.y2,anchorPointX:R.anchorPointX,anchorPointY:R.anchorPointY},S.textFeatureIndex=R.featureIndex;break}for(let I=c;I<d;I++){const R=t.get(I);S.verticalTextBox={x1:R.x1,y1:R.y1,x2:R.x2,y2:R.y2,anchorPointX:R.anchorPointX,anchorPointY:R.anchorPointY},S.verticalTextFeatureIndex=R.featureIndex;break}for(let I=p;I<g;I++){const R=t.get(I);S.iconBox={x1:R.x1,y1:R.y1,x2:R.x2,y2:R.y2,anchorPointX:R.anchorPointX,anchorPointY:R.anchorPointY},S.iconFeatureIndex=R.featureIndex;break}for(let I=x;I<w;I++){const R=t.get(I);S.verticalIconBox={x1:R.x1,y1:R.y1,x2:R.x2,y2:R.y2,anchorPointX:R.anchorPointX,anchorPointY:R.anchorPointY},S.verticalIconFeatureIndex=R.featureIndex;break}return S}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let n=0;n<this.symbolInstances.length;n++){const a=this.symbolInstances.get(n);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,n){const a=t.placedSymbolArray.get(n),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 n=Math.sin(t),a=Math.cos(t),c=[],d=[],p=[];for(let g=0;g<this.symbolInstances.length;++g){p.push(g);const x=this.symbolInstances.get(g);c.push(0|Math.round(n*x.anchorX+a*x.anchorY)),d.push(x.featureIndex)}return p.sort((g,x)=>c[g]-c[x]||d[x]-d[g]),p}addToSortKeyRanges(t,n){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===n?a.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:n,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 n of this.symbolInstanceIndexes){const a=this.symbolInstances.get(n);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 _g,yg;$e("SymbolBucket",yl,{omit:["layers","collisionBoxArray","features","compareText"]}),yl.MAX_GLYPHS=65535,yl.addDynamicAttributes=Vp;var Gp={get paint(){return yg=yg||new fr({"icon-opacity":new st(F.paint_symbol["icon-opacity"]),"icon-color":new st(F.paint_symbol["icon-color"]),"icon-halo-color":new st(F.paint_symbol["icon-halo-color"]),"icon-halo-width":new st(F.paint_symbol["icon-halo-width"]),"icon-halo-blur":new st(F.paint_symbol["icon-halo-blur"]),"icon-translate":new et(F.paint_symbol["icon-translate"]),"icon-translate-anchor":new et(F.paint_symbol["icon-translate-anchor"]),"text-opacity":new st(F.paint_symbol["text-opacity"]),"text-color":new st(F.paint_symbol["text-color"],{runtimeType:_t,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new st(F.paint_symbol["text-halo-color"]),"text-halo-width":new st(F.paint_symbol["text-halo-width"]),"text-halo-blur":new st(F.paint_symbol["text-halo-blur"]),"text-translate":new et(F.paint_symbol["text-translate"]),"text-translate-anchor":new et(F.paint_symbol["text-translate-anchor"])})},get layout(){return _g=_g||new fr({"symbol-placement":new et(F.layout_symbol["symbol-placement"]),"symbol-spacing":new et(F.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new et(F.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new st(F.layout_symbol["symbol-sort-key"]),"symbol-z-order":new et(F.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new et(F.layout_symbol["icon-allow-overlap"]),"icon-overlap":new et(F.layout_symbol["icon-overlap"]),"icon-ignore-placement":new et(F.layout_symbol["icon-ignore-placement"]),"icon-optional":new et(F.layout_symbol["icon-optional"]),"icon-rotation-alignment":new et(F.layout_symbol["icon-rotation-alignment"]),"icon-size":new st(F.layout_symbol["icon-size"]),"icon-text-fit":new et(F.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new et(F.layout_symbol["icon-text-fit-padding"]),"icon-image":new st(F.layout_symbol["icon-image"]),"icon-rotate":new st(F.layout_symbol["icon-rotate"]),"icon-padding":new st(F.layout_symbol["icon-padding"]),"icon-keep-upright":new et(F.layout_symbol["icon-keep-upright"]),"icon-offset":new st(F.layout_symbol["icon-offset"]),"icon-anchor":new st(F.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new et(F.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new et(F.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new et(F.layout_symbol["text-rotation-alignment"]),"text-field":new st(F.layout_symbol["text-field"]),"text-font":new st(F.layout_symbol["text-font"]),"text-size":new st(F.layout_symbol["text-size"]),"text-max-width":new st(F.layout_symbol["text-max-width"]),"text-line-height":new et(F.layout_symbol["text-line-height"]),"text-letter-spacing":new st(F.layout_symbol["text-letter-spacing"]),"text-justify":new st(F.layout_symbol["text-justify"]),"text-radial-offset":new st(F.layout_symbol["text-radial-offset"]),"text-variable-anchor":new et(F.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new st(F.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new st(F.layout_symbol["text-anchor"]),"text-max-angle":new et(F.layout_symbol["text-max-angle"]),"text-writing-mode":new et(F.layout_symbol["text-writing-mode"]),"text-rotate":new st(F.layout_symbol["text-rotate"]),"text-padding":new et(F.layout_symbol["text-padding"]),"text-keep-upright":new et(F.layout_symbol["text-keep-upright"]),"text-transform":new st(F.layout_symbol["text-transform"]),"text-offset":new st(F.layout_symbol["text-offset"]),"text-allow-overlap":new et(F.layout_symbol["text-allow-overlap"]),"text-overlap":new et(F.layout_symbol["text-overlap"]),"text-ignore-placement":new et(F.layout_symbol["text-ignore-placement"]),"text-optional":new et(F.layout_symbol["text-optional"])})}};class xg{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:Lt,this.defaultValue=t}evaluate(t){if(t.formattedSection){const n=this.defaultValue.property.overrides;if(n&&n.hasOverride(t.formattedSection))return n.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",xg,{omit:["defaultValue"]});class dd extends sr{constructor(t){super(t,Gp)}recalculate(t,n){if(super.recalculate(t,n),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,n,a,c){const d=this.layout.get(t).evaluate(n,{},a,c),p=this._unevaluatedLayout._values[t];return p.isDataDriven()||Hs(p.value)||!d?d:function(g,x){return x.replace(/{([^{}]+)}/g,(w,S)=>g&&S in g?String(g[S]):"")}(n.properties,d)}createBucket(t){return new yl(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Gp.paint.overridableProperties){if(!dd.hasPaintOverride(this.layout,t))continue;const n=this.paint.get(t),a=new xg(n),c=new cs(a,n.property.specification);let d=null;d=n.value.kind==="constant"||n.value.kind==="source"?new kc("source",c):new Ec("composite",c,n.value.zoomStops),this.paint._values[t]=new rn(n.property,d,n.parameters)}}_handleOverridablePaintPropertyUpdate(t,n,a){return!(!this.layout||n.isDataDriven()||a.isDataDriven())&&dd.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,n){const a=t.get("text-field"),c=Gp.paint.properties[n];let d=!1;const p=g=>{for(const x of g)if(c.overrides&&c.overrides.hasOverride(x))return void(d=!0)};if(a.value.kind==="constant"&&a.value.value instanceof nr)p(a.value.value.sections);else if(a.value.kind==="source"){const g=w=>{d||(w instanceof Gn&&ui(w.value)===ii?p(w.value.sections):w instanceof is?p(w.sections):w.eachChild(g))},x=a.value;x._styleExpression&&g(x._styleExpression.expression)}return d}}let vg;var u0={get paint(){return vg=vg||new fr({"background-color":new et(F.paint_background["background-color"]),"background-pattern":new Gc(F.paint_background["background-pattern"]),"background-opacity":new et(F.paint_background["background-opacity"])})}};class h0 extends sr{constructor(t){super(t,u0)}}let bg;var d0={get paint(){return bg=bg||new fr({"raster-opacity":new et(F.paint_raster["raster-opacity"]),"raster-hue-rotate":new et(F.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new et(F.paint_raster["raster-brightness-min"]),"raster-brightness-max":new et(F.paint_raster["raster-brightness-max"]),"raster-saturation":new et(F.paint_raster["raster-saturation"]),"raster-contrast":new et(F.paint_raster["raster-contrast"]),"raster-resampling":new et(F.paint_raster["raster-resampling"]),"raster-fade-duration":new et(F.paint_raster["raster-fade-duration"])})}};class p0 extends sr{constructor(t){super(t,d0)}}class f0 extends sr{constructor(t){super(t,{}),this.onAdd=n=>{this.implementation.onAdd&&this.implementation.onAdd(n,n.painter.context.gl)},this.onRemove=n=>{this.implementation.onRemove&&this.implementation.onRemove(n,n.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 m0{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 g0={once:!0},qp=63710088e-1;class bs{constructor(t,n){if(isNaN(t)||isNaN(n))throw new Error(`Invalid LngLat object: (${t}, ${n})`);if(this.lng=+t,this.lat=+n,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new bs($t(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const n=Math.PI/180,a=this.lat*n,c=t.lat*n,d=Math.sin(a)*Math.sin(c)+Math.cos(a)*Math.cos(c)*Math.cos((t.lng-this.lng)*n);return qp*Math.acos(Math.min(d,1))}static convert(t){if(t instanceof bs)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new bs(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new bs(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 wg=2*Math.PI*qp;function Tg(r){return wg*Math.cos(r*Math.PI/180)}function Pg(r){return(180+r)/360}function Sg(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function Mg(r,t){return r/Tg(t)}function Wp(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Ig(r,t){return r*Tg(Wp(t))}class mu{constructor(t,n,a=0){this.x=+t,this.y=+n,this.z=+a}static fromLngLat(t,n=0){const a=bs.convert(t);return new mu(Pg(a.lng),Sg(a.lat),Mg(n,a.lat))}toLngLat(){return new bs(360*this.x-180,Wp(this.y))}toAltitude(){return Ig(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/wg*(t=Wp(this.y),1/Math.cos(t*Math.PI/180));var t}}function Cg(r,t,n){var a=2*Math.PI*6378137/256/Math.pow(2,n);return[r*a-2*Math.PI*6378137/2,t*a-2*Math.PI*6378137/2]}class Hp{constructor(t,n,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,n,a))throw new Error(`x=${n}, 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=n,this.y=a,this.key=xl(0,t,t,n,a)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,n,a){const c=(p=this.y,g=this.z,x=Cg(256*(d=this.x),256*(p=Math.pow(2,g)-p-1),g),w=Cg(256*(d+1),256*(p+1),g),x[0]+","+x[1]+","+w[0]+","+w[1]);var d,p,g,x,w;const S=function(I,R,L){let B,j="";for(let $=I;$>0;$--)B=1<<$-1,j+=(R&B?1:0)+(L&B?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,n>1?"@2x":"").replace(/{quadkey}/g,S).replace(/{bbox-epsg-3857}/g,c)}isChildOf(t){const n=this.z-t.z;return n>0&&t.x===this.x>>n&&t.y===this.y>>n}getTilePoint(t){const n=Math.pow(2,this.z);return new ve((t.x*n-this.x)*Dt,(t.y*n-this.y)*Dt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class kg{constructor(t,n){this.wrap=t,this.canonical=n,this.key=xl(t,n.z,n.z,n.x,n.y)}}class Gr{constructor(t,n,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=n,this.canonical=new Hp(a,+c,+d),this.key=xl(n,t,a,c,d)}clone(){return new Gr(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 n=this.canonical.z-t;return t>this.canonical.z?new Gr(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Gr(t,this.wrap,t,this.canonical.x>>n,this.canonical.y>>n)}calculateScaledKey(t,n){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?xl(this.wrap*+n,t,this.canonical.z,this.canonical.x,this.canonical.y):xl(this.wrap*+n,t,t,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const n=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>n&&t.canonical.y===this.canonical.y>>n}children(t){if(this.overscaledZ>=t)return[new Gr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const n=this.canonical.z+1,a=2*this.canonical.x,c=2*this.canonical.y;return[new Gr(n,this.wrap,n,a,c),new Gr(n,this.wrap,n,a+1,c),new Gr(n,this.wrap,n,a,c+1),new Gr(n,this.wrap,n,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 Gr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Gr(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 kg(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new mu(t.x-this.wrap,t.y))}}function xl(r,t,n,a,c){(r*=2)<0&&(r=-1*r-1);const d=1<<n;return(d*d*r+d*c+a).toString(36)+n.toString(36)+t.toString(36)}$e("CanonicalTileID",Hp),$e("OverscaledTileID",Gr,{omit:["terrainRttPosMatrix32f"]});class Eg{constructor(t,n,a,c=1,d=1,p=1,g=0){if(this.uid=t,n.height!==n.width)throw new RangeError("DEM tiles must be square");if(a&&!["mapbox","terrarium","custom"].includes(a))return void bi(`"${a}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=n.height;const x=this.dim=n.height-2;switch(this.data=new Uint32Array(n.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=g;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let w=0;w<x;w++)this.data[this._idx(-1,w)]=this.data[this._idx(0,w)],this.data[this._idx(x,w)]=this.data[this._idx(x-1,w)],this.data[this._idx(w,-1)]=this.data[this._idx(w,0)],this.data[this._idx(w,x)]=this.data[this._idx(w,x-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(x,-1)]=this.data[this._idx(x-1,0)],this.data[this._idx(-1,x)]=this.data[this._idx(0,x-1)],this.data[this._idx(x,x)]=this.data[this._idx(x-1,x-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let w=0;w<x;w++)for(let S=0;S<x;S++){const I=this.get(w,S);I>this.max&&(this.max=I),I<this.min&&(this.min=I)}}get(t,n){const a=new Uint8Array(this.data.buffer),c=4*this._idx(t,n);return this.unpack(a[c],a[c+1],a[c+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,n){if(t<-1||t>=this.dim+1||n<-1||n>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(n+1)*this.stride+(t+1)}unpack(t,n,a){return t*this.redFactor+n*this.greenFactor+a*this.blueFactor-this.baseShift}getPixels(){return new $r({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,n,a){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let c=n*this.dim,d=n*this.dim+this.dim,p=a*this.dim,g=a*this.dim+this.dim;switch(n){case-1:c=d-1;break;case 1:d=c+1}switch(a){case-1:p=g-1;break;case 1:g=p+1}const x=-n*this.dim,w=-a*this.dim;for(let S=p;S<g;S++)for(let I=c;I<d;I++)this.data[this._idx(I,S)]=t.data[this._idx(I+x,S+w)]}}$e("DEMData",Eg);class Ag{constructor(t){this._stringToNumber={},this._numberToString=[];for(let n=0;n<t.length;n++){const a=t[n];this._stringToNumber[a]=n,this._numberToString[n]=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 zg{constructor(t,n,a,c,d){this.type="Feature",this._vectorTileFeature=t,t._z=n,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 n in this)n!=="_geometry"&&n!=="_vectorTileFeature"&&(t[n]=this[n]);return t}}class Rg{constructor(t,n){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Js(Dt,16,0),this.grid3D=new Js(Dt,16,0),this.featureIndexArray=new K,this.promoteId=n}insert(t,n,a,c,d,p){const g=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,c,d);const x=p?this.grid3D:this.grid;for(let w=0;w<n.length;w++){const S=n[w],I=[1/0,1/0,-1/0,-1/0];for(let R=0;R<S.length;R++){const L=S[R];I[0]=Math.min(I[0],L.x),I[1]=Math.min(I[1],L.y),I[2]=Math.max(I[2],L.x),I[3]=Math.max(I[3],L.y)}I[0]<Dt&&I[1]<Dt&&I[2]>=0&&I[3]>=0&&x.insert(g,I[0],I[1],I[2],I[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new cu.VectorTile(new Fp(this.rawTileData)).layers,this.sourceLayerCoder=new Ag(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,n,a,c){this.loadVTLayers();const d=t.params,p=Dt/t.tileSize/t.scale,g=Ac(d.filter),x=t.queryGeometry,w=t.queryPadding*p,S=Lg(x),I=this.grid.query(S.minX-w,S.minY-w,S.maxX+w,S.maxY+w),R=Lg(t.cameraQueryGeometry),L=this.grid3D.query(R.minX-w,R.minY-w,R.maxX+w,R.maxY+w,($,X,oe,Y)=>function(D,U,Q,xe,ze){for(const Pe of D)if(U<=Pe.x&&Q<=Pe.y&&xe>=Pe.x&&ze>=Pe.y)return!0;const be=[new ve(U,Q),new ve(U,ze),new ve(xe,ze),new ve(xe,Q)];if(D.length>2){for(const Pe of be)if(oo(D,Pe))return!0}for(let Pe=0;Pe<D.length-1;Pe++)if(nv(D[Pe],D[Pe+1],be))return!0;return!1}(t.cameraQueryGeometry,$-w,X-w,oe+w,Y+w));for(const $ of L)I.push($);I.sort(_0);const B={};let j;for(let $=0;$<I.length;$++){const X=I[$];if(X===j)continue;j=X;const oe=this.featureIndexArray.get(X);let Y=null;this.loadMatchingFeature(B,oe.bucketIndex,oe.sourceLayerIndex,oe.featureIndex,g,d.layers,d.availableImages,n,a,c,(D,U,Q)=>(Y||(Y=Yn(D)),U.queryIntersectsFeature({queryGeometry:x,feature:D,featureState:Q,geometry:Y,zoom:this.z,transform:t.transform,pixelsToTileUnits:p,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return B}loadMatchingFeature(t,n,a,c,d,p,g,x,w,S,I){const R=this.bucketLayerIDs[n];if(p&&!R.some($=>p.has($)))return;const L=this.sourceLayerCoder.decode(a),B=this.vtLayers[L].feature(c);if(d.needGeometry){const $=Jn(B,!0);if(!d.filter(new ni(this.tileID.overscaledZ),$,this.tileID.canonical))return}else if(!d.filter(new ni(this.tileID.overscaledZ),B))return;const j=this.getId(B,L);for(let $=0;$<R.length;$++){const X=R[$];if(p&&!p.has(X))continue;const oe=x[X];if(!oe)continue;let Y={};j&&S&&(Y=S.getState(oe.sourceLayer||"_geojsonTileLayer",j));const D=ft({},w[X]);D.paint=Dg(D.paint,oe.paint,B,Y,g),D.layout=Dg(D.layout,oe.layout,B,Y,g);const U=!I||I(B,oe,Y);if(!U)continue;const Q=new zg(B,this.z,this.x,this.y,j);Q.layer=D;let xe=t[X];xe===void 0&&(xe=t[X]=[]),xe.push({featureIndex:c,feature:Q,intersectionZ:U})}}lookupSymbolFeatures(t,n,a,c,d,p,g,x){const w={};this.loadVTLayers();const S=Ac(d);for(const I of t)this.loadMatchingFeature(w,a,c,I,S,p,g,x,n);return w}hasLayer(t){for(const n of this.bucketLayerIDs)for(const a of n)if(t===a)return!0;return!1}getId(t,n){var a;let c=t.id;return this.promoteId&&(c=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[n]],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 Dg(r,t,n,a,c){return Tt(r,(d,p)=>{const g=t instanceof io?t.get(p):null;return g&&g.evaluate?g.evaluate(n,a,c):g})}function Lg(r){let t=1/0,n=1/0,a=-1/0,c=-1/0;for(const d of r)t=Math.min(t,d.x),n=Math.min(n,d.y),a=Math.max(a,d.x),c=Math.max(c,d.y);return{minX:t,minY:n,maxX:a,maxY:c}}function _0(r,t){return t-r}function Fg(r,t,n,a,c){const d=[];for(let p=0;p<r.length;p++){const g=r[p];let x;for(let w=0;w<g.length-1;w++){let S=g[w],I=g[w+1];S.x<t&&I.x<t||(S.x<t?S=new ve(t,S.y+(t-S.x)/(I.x-S.x)*(I.y-S.y))._round():I.x<t&&(I=new ve(t,S.y+(t-S.x)/(I.x-S.x)*(I.y-S.y))._round()),S.y<n&&I.y<n||(S.y<n?S=new ve(S.x+(n-S.y)/(I.y-S.y)*(I.x-S.x),n)._round():I.y<n&&(I=new ve(S.x+(n-S.y)/(I.y-S.y)*(I.x-S.x),n)._round()),S.x>=a&&I.x>=a||(S.x>=a?S=new ve(a,S.y+(a-S.x)/(I.x-S.x)*(I.y-S.y))._round():I.x>=a&&(I=new ve(a,S.y+(a-S.x)/(I.x-S.x)*(I.y-S.y))._round()),S.y>=c&&I.y>=c||(S.y>=c?S=new ve(S.x+(c-S.y)/(I.y-S.y)*(I.x-S.x),c)._round():I.y>=c&&(I=new ve(S.x+(c-S.y)/(I.y-S.y)*(I.x-S.x),c)._round()),x&&S.equals(x[x.length-1])||(x=[S],d.push(x)),x.push(I)))))}}return d}$e("FeatureIndex",Rg,{omit:["rawTileData","sourceLayerCoder"]});class ws extends ve{constructor(t,n,a,c){super(t,n),this.angle=a,c!==void 0&&(this.segment=c)}clone(){return new ws(this.x,this.y,this.angle,this.segment)}}function Bg(r,t,n,a,c){if(t.segment===void 0||n===0)return!0;let d=t,p=t.segment+1,g=0;for(;g>-n/2;){if(p--,p<0)return!1;g-=r[p].dist(d),d=r[p]}g+=r[p].dist(r[p+1]),p++;const x=[];let w=0;for(;g<n/2;){const S=r[p],I=r[p+1];if(!I)return!1;let R=r[p-1].angleTo(S)-S.angleTo(I);for(R=Math.abs((R+3*Math.PI)%(2*Math.PI)-Math.PI),x.push({distance:g,angleDelta:R}),w+=R;g-x[0].distance>a;)w-=x.shift().angleDelta;if(w>c)return!1;p++,g+=S.dist(I)}return!0}function Og(r){let t=0;for(let n=0;n<r.length-1;n++)t+=r[n].dist(r[n+1]);return t}function jg(r,t,n){return r?.6*t*n:0}function Ng(r,t){return Math.max(r?r.right-r.left:0,t?t.right-t.left:0)}function y0(r,t,n,a,c,d){const p=jg(n,c,d),g=Ng(n,a)*d;let x=0;const w=Og(r)/2;for(let S=0;S<r.length-1;S++){const I=r[S],R=r[S+1],L=I.dist(R);if(x+L>w){const B=(w-x)/L,j=Vr.number(I.x,R.x,B),$=Vr.number(I.y,R.y,B),X=new ws(j,$,R.angleTo(I),S);return X._round(),!p||Bg(r,X,g,p,t)?X:void 0}x+=L}}function x0(r,t,n,a,c,d,p,g,x){const w=jg(a,d,p),S=Ng(a,c),I=S*p,R=r[0].x===0||r[0].x===x||r[0].y===0||r[0].y===x;return t-I<t/4&&(t=I+t/4),Zg(r,R?t/2*g%t:(S/2+2*d)*p*g%t,t,w,n,I,R,!1,x)}function Zg(r,t,n,a,c,d,p,g,x){const w=d/2,S=Og(r);let I=0,R=t-n,L=[];for(let B=0;B<r.length-1;B++){const j=r[B],$=r[B+1],X=j.dist($),oe=$.angleTo(j);for(;R+n<I+X;){R+=n;const Y=(R-I)/X,D=Vr.number(j.x,$.x,Y),U=Vr.number(j.y,$.y,Y);if(D>=0&&D<x&&U>=0&&U<x&&R-w>=0&&R+w<=S){const Q=new ws(D,U,oe,B);Q._round(),a&&!Bg(r,Q,d,a,c)||L.push(Q)}}I+=X}return g||L.length||p||(L=Zg(r,I/2,n,a,c,d,p,!0,x)),L}$e("Anchor",ws);const gu=Tr;function Vg(r,t,n,a){const c=[],d=r.image,p=d.pixelRatio,g=d.paddedRect.w-2*gu,x=d.paddedRect.h-2*gu;let w={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const S=d.stretchX||[[0,g]],I=d.stretchY||[[0,x]],R=(Ce,Ge)=>Ce+Ge[1]-Ge[0],L=S.reduce(R,0),B=I.reduce(R,0),j=g-L,$=x-B;let X=0,oe=L,Y=0,D=B,U=0,Q=j,xe=0,ze=$;if(d.content&&a){const Ce=d.content,Ge=Ce[2]-Ce[0],nt=Ce[3]-Ce[1];(d.textFitWidth||d.textFitHeight)&&(w=fg(r)),X=pd(S,0,Ce[0]),Y=pd(I,0,Ce[1]),oe=pd(S,Ce[0],Ce[2]),D=pd(I,Ce[1],Ce[3]),U=Ce[0]-X,xe=Ce[1]-Y,Q=Ge-oe,ze=nt-D}const be=w.x1,Pe=w.y1,Le=w.x2-be,Re=w.y2-Pe,Fe=(Ce,Ge,nt,tt)=>{const Ye=fd(Ce.stretch-X,oe,Le,be),At=md(Ce.fixed-U,Q,Ce.stretch,L),xi=fd(Ge.stretch-Y,D,Re,Pe),Ni=md(Ge.fixed-xe,ze,Ge.stretch,B),rr=fd(nt.stretch-X,oe,Le,be),qr=md(nt.fixed-U,Q,nt.stretch,L),Pr=fd(tt.stretch-Y,D,Re,Pe),Yi=md(tt.fixed-xe,ze,tt.stretch,B),pi=new ve(Ye,xi),Ui=new ve(rr,xi),Ji=new ve(rr,Pr),Qi=new ve(Ye,Pr),gr=new ve(At/p,Ni/p),Wr=new ve(qr/p,Yi/p),$i=t*Math.PI/180;if($i){const Gi=Math.sin($i),qi=Math.cos($i),Li=[qi,-Gi,Gi,qi];pi._matMult(Li),Ui._matMult(Li),Qi._matMult(Li),Ji._matMult(Li)}const Sr=Ce.stretch+Ce.fixed,Zi=Ge.stretch+Ge.fixed;return{tl:pi,tr:Ui,bl:Qi,br:Ji,tex:{x:d.paddedRect.x+gu+Sr,y:d.paddedRect.y+gu+Zi,w:nt.stretch+nt.fixed-Sr,h:tt.stretch+tt.fixed-Zi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:gr,pixelOffsetBR:Wr,minFontScaleX:Q/p/Le,minFontScaleY:ze/p/Re,isSDF:n}};if(a&&(d.stretchX||d.stretchY)){const Ce=Ug(S,j,L),Ge=Ug(I,$,B);for(let nt=0;nt<Ce.length-1;nt++){const tt=Ce[nt],Ye=Ce[nt+1];for(let At=0;At<Ge.length-1;At++)c.push(Fe(tt,Ge[At],Ye,Ge[At+1]))}}else c.push(Fe({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:g+1},{fixed:0,stretch:x+1}));return c}function pd(r,t,n){let a=0;for(const c of r)a+=Math.max(t,Math.min(n,c[1]))-Math.max(t,Math.min(n,c[0]));return a}function Ug(r,t,n){const a=[{fixed:-1,stretch:0}];for(const[c,d]of r){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+gu,stretch:n}),a}function fd(r,t,n,a){return r/t*n+a}function md(r,t,n,a){return r-t*n/a}class gd{constructor(t,n,a,c,d,p,g,x,w,S){var I;if(this.boxStartIndex=t.length,w){let R=p.top,L=p.bottom;const B=p.collisionPadding;B&&(R-=B[1],L+=B[3]);let j=L-R;j>0&&(j=Math.max(10,j),this.circleDiameter=j)}else{const R=!((I=p.image)===null||I===void 0)&&I.content&&(p.image.textFitWidth||p.image.textFitHeight)?fg(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};R.y1=R.y1*g-x[0],R.y2=R.y2*g+x[2],R.x1=R.x1*g-x[3],R.x2=R.x2*g+x[1];const L=p.collisionPadding;if(L&&(R.x1-=L[0]*g,R.y1-=L[1]*g,R.x2+=L[2]*g,R.y2+=L[3]*g),S){const B=new ve(R.x1,R.y1),j=new ve(R.x2,R.y1),$=new ve(R.x1,R.y2),X=new ve(R.x2,R.y2),oe=S*Math.PI/180;B._rotate(oe),j._rotate(oe),$._rotate(oe),X._rotate(oe),R.x1=Math.min(B.x,j.x,$.x,X.x),R.x2=Math.max(B.x,j.x,$.x,X.x),R.y1=Math.min(B.y,j.y,$.y,X.y),R.y2=Math.max(B.y,j.y,$.y,X.y)}t.emplaceBack(n.x,n.y,R.x1,R.y1,R.x2,R.y2,a,c,d)}this.boxEndIndex=t.length}}class v0{constructor(t=[],n=(a,c)=>a<c?-1:a>c?1:0){if(this.data=t,this.length=this.data.length,this.compare=n,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],n=this.data.pop();return--this.length>0&&(this.data[0]=n,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:n,compare:a}=this,c=n[t];for(;t>0;){const d=t-1>>1,p=n[d];if(a(c,p)>=0)break;n[t]=p,t=d}n[t]=c}_down(t){const{data:n,compare:a}=this,c=this.length>>1,d=n[t];for(;t<c;){let p=1+(t<<1);const g=p+1;if(g<this.length&&a(n[g],n[p])<0&&(p=g),a(n[p],d)>=0)break;n[t]=n[p],t=p}n[t]=d}}function b0(r,t=1,n=!1){let a=1/0,c=1/0,d=-1/0,p=-1/0;const g=r[0];for(let L=0;L<g.length;L++){const B=g[L];(!L||B.x<a)&&(a=B.x),(!L||B.y<c)&&(c=B.y),(!L||B.x>d)&&(d=B.x),(!L||B.y>p)&&(p=B.y)}const x=Math.min(d-a,p-c);let w=x/2;const S=new v0([],w0);if(x===0)return new ve(a,c);for(let L=a;L<d;L+=x)for(let B=c;B<p;B+=x)S.push(new vl(L+w,B+w,w,r));let I=function(L){let B=0,j=0,$=0;const X=L[0];for(let oe=0,Y=X.length,D=Y-1;oe<Y;D=oe++){const U=X[oe],Q=X[D],xe=U.x*Q.y-Q.x*U.y;j+=(U.x+Q.x)*xe,$+=(U.y+Q.y)*xe,B+=3*xe}return new vl(j/B,$/B,0,L)}(r),R=S.length;for(;S.length;){const L=S.pop();(L.d>I.d||!I.d)&&(I=L,n&&console.log("found best %d after %d probes",Math.round(1e4*L.d)/1e4,R)),L.max-I.d<=t||(w=L.h/2,S.push(new vl(L.p.x-w,L.p.y-w,w,r)),S.push(new vl(L.p.x+w,L.p.y-w,w,r)),S.push(new vl(L.p.x-w,L.p.y+w,w,r)),S.push(new vl(L.p.x+w,L.p.y+w,w,r)),R+=4)}return n&&(console.log(`num probes: ${R}`),console.log(`best distance: ${I.d}`)),I.p}function w0(r,t){return t.max-r.max}function vl(r,t,n,a){this.p=new ve(r,t),this.h=n,this.d=function(c,d){let p=!1,g=1/0;for(let x=0;x<d.length;x++){const w=d[x];for(let S=0,I=w.length,R=I-1;S<I;R=S++){const L=w[S],B=w[R];L.y>c.y!=B.y>c.y&&c.x<(B.x-L.x)*(c.y-L.y)/(B.y-L.y)+L.x&&(p=!p),g=Math.min(g,Tm(c,L,B))}}return(p?1:-1)*Math.sqrt(g)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var ir;P.ay=void 0,(ir=P.ay||(P.ay={}))[ir.center=1]="center",ir[ir.left=2]="left",ir[ir.right=3]="right",ir[ir.top=4]="top",ir[ir.bottom=5]="bottom",ir[ir["top-left"]=6]="top-left",ir[ir["top-right"]=7]="top-right",ir[ir["bottom-left"]=8]="bottom-left",ir[ir["bottom-right"]=9]="bottom-right";const Ts=7,Xp=Number.POSITIVE_INFINITY;function $g(r,t){return t[1]!==Xp?function(n,a,c){let d=0,p=0;switch(a=Math.abs(a),c=Math.abs(c),n){case"top-right":case"top-left":case"top":p=c-Ts;break;case"bottom-right":case"bottom-left":case"bottom":p=-c+Ts}switch(n){case"top-right":case"bottom-right":case"right":d=-a;break;case"top-left":case"bottom-left":case"left":d=a}return[d,p]}(r,t[0],t[1]):function(n,a){let c=0,d=0;a<0&&(a=0);const p=a/Math.SQRT2;switch(n){case"top-right":case"top-left":d=p-Ts;break;case"bottom-right":case"bottom-left":d=-p+Ts;break;case"bottom":d=-a+Ts;break;case"top":d=a-Ts}switch(n){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]}(r,t[0])}function Gg(r,t,n){var a;const c=r.layout,d=(a=c.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(t,{},n);if(d){const g=d.values,x=[];for(let w=0;w<g.length;w+=2){const S=x[w]=g[w],I=g[w+1].map(R=>R*ji);S.startsWith("top")?I[1]-=Ts:S.startsWith("bottom")&&(I[1]+=Ts),x[w+1]=I}return new ar(x)}const p=c.get("text-variable-anchor");if(p){let g;g=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[c.get("text-radial-offset").evaluate(t,{},n)*ji,Xp]:c.get("text-offset").evaluate(t,{},n).map(w=>w*ji);const x=[];for(const w of p)x.push(w,$g(w,g));return new ar(x)}return null}function Kp(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function T0(r,t,n,a,c,d,p,g,x,w,S,I){let R=d.textMaxSize.evaluate(t,{});R===void 0&&(R=p);const L=r.layers[0].layout,B=L.get("icon-offset").evaluate(t,{},S),j=Wg(n.horizontal),$=p/24,X=r.tilePixelRatio*$,oe=r.tilePixelRatio*R/24,Y=r.tilePixelRatio*g,D=r.tilePixelRatio*L.get("symbol-spacing"),U=L.get("text-padding")*r.tilePixelRatio,Q=function(nt,tt,Ye,At=1){const xi=nt.get("icon-padding").evaluate(tt,{},Ye),Ni=xi&&xi.values;return[Ni[0]*At,Ni[1]*At,Ni[2]*At,Ni[3]*At]}(L,t,S,r.tilePixelRatio),xe=L.get("text-max-angle")/180*Math.PI,ze=L.get("text-rotation-alignment")!=="viewport"&&L.get("symbol-placement")!=="point",be=L.get("icon-rotation-alignment")==="map"&&L.get("symbol-placement")!=="point",Pe=L.get("symbol-placement"),Le=D/2,Re=L.get("icon-text-fit");let Fe;a&&Re!=="none"&&(r.allowVerticalPlacement&&n.vertical&&(Fe=mg(a,n.vertical,Re,L.get("icon-text-fit-padding"),B,$)),j&&(a=mg(a,j,Re,L.get("icon-text-fit-padding"),B,$)));const Ce=S?I.line.getGranularityForZoomLevel(S.z):1,Ge=(nt,tt)=>{tt.x<0||tt.x>=Dt||tt.y<0||tt.y>=Dt||function(Ye,At,xi,Ni,rr,qr,Pr,Yi,pi,Ui,Ji,Qi,gr,Wr,$i,Sr,Zi,Gi,qi,Li,si,Pn,bl,Sn,M0){const wl=Ye.addToLineVertexArray(At,xi);let uo,Tl,Pl,Sl,Yg=0,Jg=0,Qg=0,e_=0,af=-1,sf=-1;const Aa={};let t_=bn("");if(Ye.allowVerticalPlacement&&Ni.vertical){const or=Yi.layout.get("text-rotate").evaluate(si,{},Sn)+90;Pl=new gd(pi,At,Ui,Ji,Qi,Ni.vertical,gr,Wr,$i,or),Pr&&(Sl=new gd(pi,At,Ui,Ji,Qi,Pr,Zi,Gi,$i,or))}if(rr){const or=Yi.layout.get("icon-rotate").evaluate(si,{}),Hr=Yi.layout.get("icon-text-fit")!=="none",ho=Vg(rr,or,bl,Hr),In=Pr?Vg(Pr,or,bl,Hr):void 0;Tl=new gd(pi,At,Ui,Ji,Qi,rr,Zi,Gi,!1,or),Yg=4*ho.length;const po=Ye.iconSizeData;let ea=null;po.kind==="source"?(ea=[Qn*Yi.layout.get("icon-size").evaluate(si,{})],ea[0]>vs&&bi(`${Ye.layerIds[0]}: Value for "icon-size" is >= ${fu}. Reduce your "icon-size".`)):po.kind==="composite"&&(ea=[Qn*Pn.compositeIconSizes[0].evaluate(si,{},Sn),Qn*Pn.compositeIconSizes[1].evaluate(si,{},Sn)],(ea[0]>vs||ea[1]>vs)&&bi(`${Ye.layerIds[0]}: Value for "icon-size" is >= ${fu}. Reduce your "icon-size".`)),Ye.addSymbols(Ye.icon,ho,ea,Li,qi,si,P.ah.none,At,wl.lineStartIndex,wl.lineLength,-1,Sn),af=Ye.icon.placedSymbolArray.length-1,In&&(Jg=4*In.length,Ye.addSymbols(Ye.icon,In,ea,Li,qi,si,P.ah.vertical,At,wl.lineStartIndex,wl.lineLength,-1,Sn),sf=Ye.icon.placedSymbolArray.length-1)}const i_=Object.keys(Ni.horizontal);for(const or of i_){const Hr=Ni.horizontal[or];if(!uo){t_=bn(Hr.text);const In=Yi.layout.get("text-rotate").evaluate(si,{},Sn);uo=new gd(pi,At,Ui,Ji,Qi,Hr,gr,Wr,$i,In)}const ho=Hr.positionedLines.length===1;if(Qg+=qg(Ye,At,Hr,qr,Yi,$i,si,Sr,wl,Ni.vertical?P.ah.horizontal:P.ah.horizontalOnly,ho?i_:[or],Aa,af,Pn,Sn),ho)break}Ni.vertical&&(e_+=qg(Ye,At,Ni.vertical,qr,Yi,$i,si,Sr,wl,P.ah.vertical,["vertical"],Aa,sf,Pn,Sn));const I0=uo?uo.boxStartIndex:Ye.collisionBoxArray.length,C0=uo?uo.boxEndIndex:Ye.collisionBoxArray.length,k0=Pl?Pl.boxStartIndex:Ye.collisionBoxArray.length,E0=Pl?Pl.boxEndIndex:Ye.collisionBoxArray.length,A0=Tl?Tl.boxStartIndex:Ye.collisionBoxArray.length,z0=Tl?Tl.boxEndIndex:Ye.collisionBoxArray.length,R0=Sl?Sl.boxStartIndex:Ye.collisionBoxArray.length,D0=Sl?Sl.boxEndIndex:Ye.collisionBoxArray.length;let Mn=-1;const yd=(or,Hr)=>or&&or.circleDiameter?Math.max(or.circleDiameter,Hr):Hr;Mn=yd(uo,Mn),Mn=yd(Pl,Mn),Mn=yd(Tl,Mn),Mn=yd(Sl,Mn);const r_=Mn>-1?1:0;r_&&(Mn*=M0/ji),Ye.glyphOffsetArray.length>=yl.MAX_GLYPHS&&bi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),si.sortKey!==void 0&&Ye.addToSortKeyRanges(Ye.symbolInstances.length,si.sortKey);const L0=Gg(Yi,si,Sn),[F0,B0]=function(or,Hr){const ho=or.length,In=Hr==null?void 0:Hr.values;if((In==null?void 0:In.length)>0)for(let po=0;po<In.length;po+=2){const ea=In[po+1];or.emplaceBack(P.ay[In[po]],ea[0],ea[1])}return[ho,or.length]}(Ye.textAnchorOffsets,L0);Ye.symbolInstances.emplaceBack(At.x,At.y,Aa.right>=0?Aa.right:-1,Aa.center>=0?Aa.center:-1,Aa.left>=0?Aa.left:-1,Aa.vertical||-1,af,sf,t_,I0,C0,k0,E0,A0,z0,R0,D0,Ui,Qg,e_,Yg,Jg,r_,0,gr,Mn,F0,B0)}(r,tt,nt,n,a,c,Fe,r.layers[0],r.collisionBoxArray,t.index,t.sourceLayerIndex,r.index,X,[U,U,U,U],ze,x,Y,Q,be,B,t,d,w,S,p)};if(Pe==="line")for(const nt of Fg(t.geometry,0,0,Dt,Dt)){const tt=co(nt,Ce),Ye=x0(tt,D,xe,n.vertical||j,a,24,oe,r.overscaling,Dt);for(const At of Ye)j&&P0(r,j.text,Le,At)||Ge(tt,At)}else if(Pe==="line-center"){for(const nt of t.geometry)if(nt.length>1){const tt=co(nt,Ce),Ye=y0(tt,xe,n.vertical||j,a,24,oe);Ye&&Ge(tt,Ye)}}else if(t.type==="Polygon")for(const nt of Gs(t.geometry,0)){const tt=b0(nt,16);Ge(co(nt[0],Ce,!0),new ws(tt.x,tt.y,0))}else if(t.type==="LineString")for(const nt of t.geometry){const tt=co(nt,Ce);Ge(tt,new ws(tt[0].x,tt[0].y,0))}else if(t.type==="Point")for(const nt of t.geometry)for(const tt of nt)Ge([tt],new ws(tt.x,tt.y,0))}function qg(r,t,n,a,c,d,p,g,x,w,S,I,R,L,B){const j=function(oe,Y,D,U,Q,xe,ze,be){const Pe=U.layout.get("text-rotate").evaluate(xe,{})*Math.PI/180,Le=[];for(const Re of Y.positionedLines)for(const Fe of Re.positionedGlyphs){if(!Fe.rect)continue;const Ce=Fe.rect||{};let Ge=Yv+1,nt=!0,tt=1,Ye=0;const At=(Q||be)&&Fe.vertical,xi=Fe.metrics.advance*Fe.scale/2;if(be&&Y.verticalizable&&(Ye=Re.lineOffset/2-(Fe.imageName?-(ji-Fe.metrics.width*Fe.scale)/2:(Fe.scale-1)*ji)),Fe.imageName){const Gi=ze[Fe.imageName];nt=Gi.sdf,tt=Gi.pixelRatio,Ge=Tr/tt}const Ni=Q?[Fe.x+xi,Fe.y]:[0,0];let rr=Q?[0,0]:[Fe.x+xi+D[0],Fe.y+D[1]-Ye],qr=[0,0];At&&(qr=rr,rr=[0,0]);const Pr=Fe.metrics.isDoubleResolution?2:1,Yi=(Fe.metrics.left-Ge)*Fe.scale-xi+rr[0],pi=(-Fe.metrics.top-Ge)*Fe.scale+rr[1],Ui=Yi+Ce.w/Pr*Fe.scale/tt,Ji=pi+Ce.h/Pr*Fe.scale/tt,Qi=new ve(Yi,pi),gr=new ve(Ui,pi),Wr=new ve(Yi,Ji),$i=new ve(Ui,Ji);if(At){const Gi=new ve(-xi,xi-ld),qi=-Math.PI/2,Li=ji/2-xi,si=new ve(5-ld-Li,-(Fe.imageName?Li:0)),Pn=new ve(...qr);Qi._rotateAround(qi,Gi)._add(si)._add(Pn),gr._rotateAround(qi,Gi)._add(si)._add(Pn),Wr._rotateAround(qi,Gi)._add(si)._add(Pn),$i._rotateAround(qi,Gi)._add(si)._add(Pn)}if(Pe){const Gi=Math.sin(Pe),qi=Math.cos(Pe),Li=[qi,-Gi,Gi,qi];Qi._matMult(Li),gr._matMult(Li),Wr._matMult(Li),$i._matMult(Li)}const Sr=new ve(0,0),Zi=new ve(0,0);Le.push({tl:Qi,tr:gr,bl:Wr,br:$i,tex:Ce,writingMode:Y.writingMode,glyphOffset:Ni,sectionIndex:Fe.sectionIndex,isSDF:nt,pixelOffsetTL:Sr,pixelOffsetBR:Zi,minFontScaleX:0,minFontScaleY:0})}return Le}(0,n,g,c,d,p,a,r.allowVerticalPlacement),$=r.textSizeData;let X=null;$.kind==="source"?(X=[Qn*c.layout.get("text-size").evaluate(p,{})],X[0]>vs&&bi(`${r.layerIds[0]}: Value for "text-size" is >= ${fu}. Reduce your "text-size".`)):$.kind==="composite"&&(X=[Qn*L.compositeTextSizes[0].evaluate(p,{},B),Qn*L.compositeTextSizes[1].evaluate(p,{},B)],(X[0]>vs||X[1]>vs)&&bi(`${r.layerIds[0]}: Value for "text-size" is >= ${fu}. Reduce your "text-size".`)),r.addSymbols(r.text,j,X,g,d,p,w,t,x.lineStartIndex,x.lineLength,R,B);for(const oe of S)I[oe]=r.text.placedSymbolArray.length-1;return 4*j.length}function Wg(r){for(const t in r)return r[t];return null}function P0(r,t,n,a){const c=r.compareText;if(t in c){const d=c[t];for(let p=d.length-1;p>=0;p--)if(a.dist(d[p])<n)return!0}else c[t]=[];return c[t].push(a),!1}const Hg=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Yp{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,a]=new Uint8Array(t,0,2);if(n!==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=Hg[15&a];if(!d)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(t,2,1),[g]=new Uint32Array(t,4,1);return new Yp(g,p,d,t)}constructor(t,n=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(+n,2),65535),this.ArrayType=a,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const d=Hg.indexOf(this.ArrayType),p=2*t*this.ArrayType.BYTES_PER_ELEMENT,g=t*this.IndexArrayType.BYTES_PER_ELEMENT,x=(8-g%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+g+x,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+p+g+x),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+g+x,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]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=t,this.coords[this._pos++]=n,a}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Jp(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,a,c){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:p,nodeSize:g}=this,x=[0,d.length-1,0],w=[];for(;x.length;){const S=x.pop()||0,I=x.pop()||0,R=x.pop()||0;if(I-R<=g){for(let $=R;$<=I;$++){const X=p[2*$],oe=p[2*$+1];X>=t&&X<=a&&oe>=n&&oe<=c&&w.push(d[$])}continue}const L=R+I>>1,B=p[2*L],j=p[2*L+1];B>=t&&B<=a&&j>=n&&j<=c&&w.push(d[L]),(S===0?t<=B:n<=j)&&(x.push(R),x.push(L-1),x.push(1-S)),(S===0?a>=B:c>=j)&&(x.push(L+1),x.push(I),x.push(1-S))}return w}within(t,n,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:c,coords:d,nodeSize:p}=this,g=[0,c.length-1,0],x=[],w=a*a;for(;g.length;){const S=g.pop()||0,I=g.pop()||0,R=g.pop()||0;if(I-R<=p){for(let $=R;$<=I;$++)Kg(d[2*$],d[2*$+1],t,n)<=w&&x.push(c[$]);continue}const L=R+I>>1,B=d[2*L],j=d[2*L+1];Kg(B,j,t,n)<=w&&x.push(c[L]),(S===0?t-a<=B:n-a<=j)&&(g.push(R),g.push(L-1),g.push(1-S)),(S===0?t+a>=B:n+a>=j)&&(g.push(L+1),g.push(I),g.push(1-S))}return x}}function Jp(r,t,n,a,c,d){if(c-a<=n)return;const p=a+c>>1;Xg(r,t,p,a,c,d),Jp(r,t,n,a,p-1,1-d),Jp(r,t,n,p+1,c,1-d)}function Xg(r,t,n,a,c,d){for(;c>a;){if(c-a>600){const w=c-a+1,S=n-a+1,I=Math.log(w),R=.5*Math.exp(2*I/3),L=.5*Math.sqrt(I*R*(w-R)/w)*(S-w/2<0?-1:1);Xg(r,t,n,Math.max(a,Math.floor(n-S*R/w+L)),Math.min(c,Math.floor(n+(w-S)*R/w+L)),d)}const p=t[2*n+d];let g=a,x=c;for(_u(r,t,a,n),t[2*c+d]>p&&_u(r,t,a,c);g<x;){for(_u(r,t,g,x),g++,x--;t[2*g+d]<p;)g++;for(;t[2*x+d]>p;)x--}t[2*a+d]===p?_u(r,t,a,x):(x++,_u(r,t,x,c)),x<=n&&(a=x+1),n<=x&&(c=x-1)}}function _u(r,t,n,a){Qp(r,n,a),Qp(t,2*n,2*a),Qp(t,2*n+1,2*a+1)}function Qp(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}function Kg(r,t,n,a){const c=r-n,d=t-a;return c*c+d*d}var ef;P.ck=void 0,(ef=P.ck||(P.ck={})).create="create",ef.load="load",ef.fullLoad="fullLoad";let _d=null,yu=[];const tf=1e3/60,rf="loadTime",nf="fullLoadTime",S0={mark(r){performance.mark(r)},frame(r){const t=r;_d!=null&&yu.push(t-_d),_d=t},clearMetrics(){_d=null,yu=[],performance.clearMeasures(rf),performance.clearMeasures(nf);for(const r in P.ck)performance.clearMarks(P.ck[r])},getPerformanceMetrics(){performance.measure(rf,P.ck.create,P.ck.load),performance.measure(nf,P.ck.create,P.ck.fullLoad);const r=performance.getEntriesByName(rf)[0].duration,t=performance.getEntriesByName(nf)[0].duration,n=yu.length,a=1/(yu.reduce((d,p)=>d+p,0)/n/1e3),c=yu.filter(d=>d>tf).reduce((d,p)=>d+(p-tf)/tf,0);return{loadTime:r,fullLoadTime:t,fps:a,percentDroppedFrames:c/(n+c)*100,totalFrames:n}}};P.$=mu,P.A=Et,P.B=Vr,P.C=ni,P.D=et,P.E=V,P.F=up,P.G=function(r){if(wi==null){const t=r.navigator?r.navigator.userAgent:null;wi=!!r.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return wi},P.H=class{constructor(r,t){this.target=r,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new m0(()=>this.process()),this.subscription=Or(this.target,"message",n=>this.receive(n),!1),this.globalScope=dn(self)?r:window}registerMessageHandler(r,t){this.messageHandlers[r]=t}sendAsync(r,t){return new Promise((n,a)=>{const c=Math.round(1e18*Math.random()).toString(36).substring(0,10),d=t?Or(t.signal,"abort",()=>{d==null||d.unsubscribe(),delete this.resolveRejects[c];const x={id:c,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(x)},g0):null;this.resolveRejects[c]={resolve:x=>{d==null||d.unsubscribe(),n(x)},reject:x=>{d==null||d.unsubscribe(),a(x)}};const p=[],g=Object.assign(Object.assign({},r),{id:c,sourceMapId:this.mapId,origin:location.origin,data:Ta(r.data,p)});this.target.postMessage(g,{transfer:p})})}receive(r){const t=r.data,n=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[n];const a=this.abortControllers[n];return delete this.abortControllers[n],void(a&&a.abort())}if(dn(self)||t.mustQueue)return this.tasks[n]=t,this.taskQueue.push(n),void this.invoker.trigger();this.processTask(n,t)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),t=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(r,t)}processTask(r,t){return o(this,void 0,void 0,function*(){if(t.type==="<response>"){const c=this.resolveRejects[r];return delete this.resolveRejects[r],c?void(t.error?c.reject(qn(t.error)):c.resolve(qn(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const n=qn(t.data),a=new AbortController;this.abortControllers[r]=a;try{const c=yield this.messageHandlers[t.type](t.sourceMapId,n,a);this.completeTask(r,null,c)}catch(c){this.completeTask(r,c)}})}completeTask(r,t,n){const a=[];delete this.abortControllers[r];const c={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Ta(t):null,data:Ta(n,a)};this.target.postMessage(c,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},P.I=Op,P.J=pn,P.K=function(){var r=new Et(16);return Et!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},P.L=function(r,t,n){var a,c,d,p,g,x,w,S,I,R,L,B,j=n[0],$=n[1],X=n[2];return t===r?(r[12]=t[0]*j+t[4]*$+t[8]*X+t[12],r[13]=t[1]*j+t[5]*$+t[9]*X+t[13],r[14]=t[2]*j+t[6]*$+t[10]*X+t[14],r[15]=t[3]*j+t[7]*$+t[11]*X+t[15]):(c=t[1],d=t[2],p=t[3],g=t[4],x=t[5],w=t[6],S=t[7],I=t[8],R=t[9],L=t[10],B=t[11],r[0]=a=t[0],r[1]=c,r[2]=d,r[3]=p,r[4]=g,r[5]=x,r[6]=w,r[7]=S,r[8]=I,r[9]=R,r[10]=L,r[11]=B,r[12]=a*j+g*$+I*X+t[12],r[13]=c*j+x*$+R*X+t[13],r[14]=d*j+w*$+L*X+t[14],r[15]=p*j+S*$+B*X+t[15]),r},P.M=function(r,t,n){var a=n[0],c=n[1],d=n[2];return r[0]=t[0]*a,r[1]=t[1]*a,r[2]=t[2]*a,r[3]=t[3]*a,r[4]=t[4]*c,r[5]=t[5]*c,r[6]=t[6]*c,r[7]=t[7]*c,r[8]=t[8]*d,r[9]=t[9]*d,r[10]=t[10]*d,r[11]=t[11]*d,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},P.N=function(r,t,n){var a=t[0],c=t[1],d=t[2],p=t[3],g=t[4],x=t[5],w=t[6],S=t[7],I=t[8],R=t[9],L=t[10],B=t[11],j=t[12],$=t[13],X=t[14],oe=t[15],Y=n[0],D=n[1],U=n[2],Q=n[3];return r[0]=Y*a+D*g+U*I+Q*j,r[1]=Y*c+D*x+U*R+Q*$,r[2]=Y*d+D*w+U*L+Q*X,r[3]=Y*p+D*S+U*B+Q*oe,r[4]=(Y=n[4])*a+(D=n[5])*g+(U=n[6])*I+(Q=n[7])*j,r[5]=Y*c+D*x+U*R+Q*$,r[6]=Y*d+D*w+U*L+Q*X,r[7]=Y*p+D*S+U*B+Q*oe,r[8]=(Y=n[8])*a+(D=n[9])*g+(U=n[10])*I+(Q=n[11])*j,r[9]=Y*c+D*x+U*R+Q*$,r[10]=Y*d+D*w+U*L+Q*X,r[11]=Y*p+D*S+U*B+Q*oe,r[12]=(Y=n[12])*a+(D=n[13])*g+(U=n[14])*I+(Q=n[15])*j,r[13]=Y*c+D*x+U*R+Q*$,r[14]=Y*d+D*w+U*L+Q*X,r[15]=Y*p+D*S+U*B+Q*oe,r},P.O=function(r,t){const n={};for(let a=0;a<t.length;a++){const c=t[a];c in r&&(n[c]=r[c])}return n},P.P=ve,P.Q=bs,P.R=$r,P.S=Sg,P.T=to,P.U=Pg,P.V=gt,P.W=pt,P.X=Br,P.Y=Gr,P.Z=Dt,P._=o,P.a=Nn,P.a$=function(r,t,n){var a=Math.sin(n),c=Math.cos(n),d=t[4],p=t[5],g=t[6],x=t[7],w=t[8],S=t[9],I=t[10],R=t[11];return t!==r&&(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[4]=d*c+w*a,r[5]=p*c+S*a,r[6]=g*c+I*a,r[7]=x*c+R*a,r[8]=w*c-d*a,r[9]=S*c-p*a,r[10]=I*c-g*a,r[11]=R*c-x*a,r},P.a0=25,P.a1=Hp,P.a2=r=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(n=>{t.onloadstart=()=>{n(t)};for(const a of r){const c=window.document.createElement("source");Ds(a)||(t.crossOrigin="Anonymous"),c.src=a,t.appendChild(c)}})},P.a3=Te,P.a4=function(){return Qt++},P.a5=v,P.a6=yl,P.a7=Ac,P.a8=Jn,P.a9=zg,P.aA=Kp,P.aB=Np,P.aC=Yp,P.aD=Pi,P.aE=ad,P.aF=ee,P.aG=bt,P.aH=Ee,P.aI=function(r){return Math.pow(2,r)},P.aJ=85.051129,P.aK=Mg,P.aL=$t,P.aM=jr,P.aN=Ig,P.aO=function(r,t,n){return r[0]=t[0]*n,r[1]=t[1]*n,r[2]=t[2]*n,r},P.aP=function(r,t,n){return r[0]=t[0]+n[0],r[1]=t[1]+n[1],r[2]=t[2]+n[2],r},P.aQ=function(r){var t=new Et(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t},P.aR=function(r,t,n){return r[0]=t[0]*n[0],r[1]=t[1]*n[1],r[2]=t[2]*n[2],r[3]=t[3]*n[3],r},P.aS=function(r,t,n){return r[0]=t[0]-n[0],r[1]=t[1]-n[1],r[2]=t[2]-n[2],r},P.aT=function(r,t){var n=t[0],a=t[1],c=t[2],d=n*n+a*a+c*c;return d>0&&(d=1/Math.sqrt(d)),r[0]=t[0]*d,r[1]=t[1]*d,r[2]=t[2]*d,r},P.aU=function(r,t,n){var a=t[0],c=t[1],d=t[2],p=n[0],g=n[1],x=n[2];return r[0]=c*x-d*g,r[1]=d*p-a*x,r[2]=a*g-c*p,r},P.aV=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]},P.aW=kg,P.aX=xl,P.aY=function(r,t,n,a,c){var d,p=1/Math.tan(t/2);return r[0]=p/n,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=p,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,c!=null&&c!==1/0?(r[10]=(c+a)*(d=1/(a-c)),r[14]=2*c*a*d):(r[10]=-1,r[14]=-2*a),r},P.aZ=function(r){var t=new Et(16);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},P.a_=function(r,t,n){var a=Math.sin(n),c=Math.cos(n),d=t[0],p=t[1],g=t[2],x=t[3],w=t[4],S=t[5],I=t[6],R=t[7];return t!==r&&(r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=d*c+w*a,r[1]=p*c+S*a,r[2]=g*c+I*a,r[3]=x*c+R*a,r[4]=w*c-d*a,r[5]=S*c-p*a,r[6]=I*c-g*a,r[7]=R*c-x*a,r},P.aa=function(r){const t={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(n,a,c,d)=>{const p=c||d;return t[a]=!p||p.toLowerCase(),""}),t["max-age"]){const n=parseInt(t["max-age"],10);isNaN(n)?delete t["max-age"]:t["max-age"]=n}return t},P.ab=function(r){return Math.log(r)/Math.LN2},P.ac=function(r){var t=r[0],n=r[1];return t*t+n*n},P.ad=function(r){return r*Math.PI/180},P.ae=li,P.af=function(r,t){const n=[];for(const a in r)a in t||n.push(a);return n},P.ag=function(r,t){let n=0,a=0;if(r.kind==="constant")a=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:c,minZoom:d,maxZoom:p}=r,g=c?li(er.interpolationFactor(c,t,d,p),0,1):0;r.kind==="camera"?a=Vr.number(r.minSize,r.maxSize,g):n=g}return{uSizeT:n,uSize:a}},P.ai=function(r,{uSize:t,uSizeT:n},{lowerSize:a,upperSize:c}){return r.kind==="source"?a/Qn:r.kind==="composite"?Vr.number(a/Qn,c/Qn,n):t},P.aj=function(r,t){var n=t[0],a=t[1],c=t[2],d=t[3],p=t[4],g=t[5],x=t[6],w=t[7],S=t[8],I=t[9],R=t[10],L=t[11],B=t[12],j=t[13],$=t[14],X=t[15],oe=n*g-a*p,Y=n*x-c*p,D=n*w-d*p,U=a*x-c*g,Q=a*w-d*g,xe=c*w-d*x,ze=S*j-I*B,be=S*$-R*B,Pe=S*X-L*B,Le=I*$-R*j,Re=I*X-L*j,Fe=R*X-L*$,Ce=oe*Fe-Y*Re+D*Le+U*Pe-Q*be+xe*ze;return Ce?(r[0]=(g*Fe-x*Re+w*Le)*(Ce=1/Ce),r[1]=(c*Re-a*Fe-d*Le)*Ce,r[2]=(j*xe-$*Q+X*U)*Ce,r[3]=(R*Q-I*xe-L*U)*Ce,r[4]=(x*Pe-p*Fe-w*be)*Ce,r[5]=(n*Fe-c*Pe+d*be)*Ce,r[6]=($*D-B*xe-X*Y)*Ce,r[7]=(S*xe-R*D+L*Y)*Ce,r[8]=(p*Re-g*Pe+w*ze)*Ce,r[9]=(a*Pe-n*Re-d*ze)*Ce,r[10]=(B*Q-j*D+X*oe)*Ce,r[11]=(I*D-S*Q-L*oe)*Ce,r[12]=(g*be-p*Le-x*ze)*Ce,r[13]=(n*Le-a*be+c*ze)*Ce,r[14]=(j*Y-B*U-$*oe)*Ce,r[15]=(S*U-I*Y+R*oe)*Ce,r):null},P.ak=Jt,P.al=function(r){return Math.hypot(r[0],r[1])},P.am=function(r){return r[0]=0,r[1]=0,r},P.an=function(r,t,n){return r[0]=t[0]*n,r[1]=t[1]*n,r},P.ao=Vp,P.ap=ut,P.aq=function(r,t,n,a){const c=t.y-r.y,d=t.x-r.x,p=a.y-n.y,g=a.x-n.x,x=p*d-g*c;if(x===0)return null;const w=(g*(r.y-n.y)-p*(r.x-n.x))/x;return new ve(r.x+w*d,r.y+w*c)},P.ar=Fg,P.as=pl,P.at=Mi,P.au=function(r){let t=1/0,n=1/0,a=-1/0,c=-1/0;for(const d of r)t=Math.min(t,d.x),n=Math.min(n,d.y),a=Math.max(a,d.x),c=Math.max(c,d.y);return[t,n,a,c]},P.av=ji,P.aw=vr,P.ax=function(r,t,n,a,c=!1){if(!n[0]&&!n[1])return[0,0];const d=c?a==="map"?-r.bearingInRadians:0:a==="viewport"?r.bearingInRadians:0;if(d){const p=Math.sin(d),g=Math.cos(d);n=[n[0]*g-n[1]*p,n[0]*p+n[1]*g]}return[c?n[0]:vr(t,n[0],r.zoom),c?n[1]:vr(t,n[1],r.zoom)]},P.az=Zp,P.b=ca,P.b$=r=>r.type==="symbol",P.b0=function(){const r=new Float32Array(16);return Mi(r),r},P.b1=function(){const r=new Float64Array(16);return Mi(r),r},P.b2=function(){return new Float64Array(16)},P.b3=function(r,t,n){const a=new Float64Array(4);return function(c,d,p,g){var x=.5*Math.PI/180;d*=x,p*=x,g*=x;var w=Math.sin(d),S=Math.cos(d),I=Math.sin(p),R=Math.cos(p),L=Math.sin(g),B=Math.cos(g);c[0]=w*R*B-S*I*L,c[1]=S*I*B+w*R*L,c[2]=S*R*L-w*I*B,c[3]=S*R*B+w*I*L}(a,r,t-90,n),a},P.b4=function(r,t,n,a){var c,d,p,g,x,w=t[0],S=t[1],I=t[2],R=t[3],L=n[0],B=n[1],j=n[2],$=n[3];return(d=w*L+S*B+I*j+R*$)<0&&(d=-d,L=-L,B=-B,j=-j,$=-$),1-d>kt?(c=Math.acos(d),p=Math.sin(c),g=Math.sin((1-a)*c)/p,x=Math.sin(a*c)/p):(g=1-a,x=a),r[0]=g*w+x*L,r[1]=g*S+x*B,r[2]=g*I+x*j,r[3]=g*R+x*$,r},P.b5=function(r){const t=new Float64Array(9);var n,a,c,d,p,g,x,w,S,I,R,L,B,j,$,X,oe,Y;I=(c=(a=r)[0])*(x=c+c),R=(d=a[1])*x,B=(p=a[2])*x,j=p*(w=d+d),X=(g=a[3])*x,oe=g*w,Y=g*(S=p+p),(n=t)[0]=1-(L=d*w)-($=p*S),n[3]=R-Y,n[6]=B+oe,n[1]=R+Y,n[4]=1-I-$,n[7]=j-X,n[2]=B-oe,n[5]=j+X,n[8]=1-I-L;const D=jr(-Math.asin(li(t[2],-1,1)));let U,Q;return Math.hypot(t[5],t[8])<.001?(U=0,Q=-jr(Math.atan2(t[3],t[4]))):(U=jr(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),Q=jr(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:U,pitch:D+90,bearing:Q}},P.b6=function(r,t){return r.roll==t.roll&&r.pitch==t.pitch&&r.bearing==t.bearing},P.b7=Ft,P.b8=wn,P.b9=gl,P.bA=function(r,t){if(!r)return[{command:"setStyle",args:[t]}];let n=[];try{if(!le(r.version,t.version))return[{command:"setStyle",args:[t]}];le(r.center,t.center)||n.push({command:"setCenter",args:[t.center]}),le(r.centerAltitude,t.centerAltitude)||n.push({command:"setCenterAltitude",args:[t.centerAltitude]}),le(r.zoom,t.zoom)||n.push({command:"setZoom",args:[t.zoom]}),le(r.bearing,t.bearing)||n.push({command:"setBearing",args:[t.bearing]}),le(r.pitch,t.pitch)||n.push({command:"setPitch",args:[t.pitch]}),le(r.roll,t.roll)||n.push({command:"setRoll",args:[t.roll]}),le(r.sprite,t.sprite)||n.push({command:"setSprite",args:[t.sprite]}),le(r.glyphs,t.glyphs)||n.push({command:"setGlyphs",args:[t.glyphs]}),le(r.transition,t.transition)||n.push({command:"setTransition",args:[t.transition]}),le(r.light,t.light)||n.push({command:"setLight",args:[t.light]}),le(r.terrain,t.terrain)||n.push({command:"setTerrain",args:[t.terrain]}),le(r.sky,t.sky)||n.push({command:"setSky",args:[t.sky]}),le(r.projection,t.projection)||n.push({command:"setProjection",args:[t.projection]});const a={},c=[];(function(p,g,x,w){let S;for(S in g=g||{},p=p||{})Object.prototype.hasOwnProperty.call(p,S)&&(Object.prototype.hasOwnProperty.call(g,S)||Me(S,x,w));for(S in g)Object.prototype.hasOwnProperty.call(g,S)&&(Object.prototype.hasOwnProperty.call(p,S)?le(p[S],g[S])||(p[S].type==="geojson"&&g[S].type==="geojson"&&fe(p,g,S)?me(x,{command:"setGeoJSONSourceData",args:[S,g[S].data]}):we(S,g,x,w)):de(S,g,x))})(r.sources,t.sources,c,a);const d=[];r.layers&&r.layers.forEach(p=>{"source"in p&&a[p.source]?n.push({command:"removeLayer",args:[p.id]}):d.push(p)}),n=n.concat(c),function(p,g,x){g=g||[];const w=(p=p||[]).map(Ve),S=g.map(Ve),I=p.reduce(Ue,{}),R=g.reduce(Ue,{}),L=w.slice(),B=Object.create(null);let j,$,X,oe,Y;for(let D=0,U=0;D<w.length;D++)j=w[D],Object.prototype.hasOwnProperty.call(R,j)?U++:(me(x,{command:"removeLayer",args:[j]}),L.splice(L.indexOf(j,U),1));for(let D=0,U=0;D<S.length;D++)j=S[S.length-1-D],L[L.length-1-D]!==j&&(Object.prototype.hasOwnProperty.call(I,j)?(me(x,{command:"removeLayer",args:[j]}),L.splice(L.lastIndexOf(j,L.length-U),1)):U++,oe=L[L.length-D],me(x,{command:"addLayer",args:[R[j],oe]}),L.splice(L.length-D,0,j),B[j]=!0);for(let D=0;D<S.length;D++)if(j=S[D],$=I[j],X=R[j],!B[j]&&!le($,X))if(le($.source,X.source)&&le($["source-layer"],X["source-layer"])&&le($.type,X.type)){for(Y in Ae($.layout,X.layout,x,j,null,"setLayoutProperty"),Ae($.paint,X.paint,x,j,null,"setPaintProperty"),le($.filter,X.filter)||me(x,{command:"setFilter",args:[j,X.filter]}),le($.minzoom,X.minzoom)&&le($.maxzoom,X.maxzoom)||me(x,{command:"setLayerZoomRange",args:[j,X.minzoom,X.maxzoom]}),$)Object.prototype.hasOwnProperty.call($,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Ae($[Y],X[Y],x,j,Y.slice(6),"setPaintProperty"):le($[Y],X[Y])||me(x,{command:"setLayerProperty",args:[j,Y,X[Y]]}));for(Y in X)Object.prototype.hasOwnProperty.call(X,Y)&&!Object.prototype.hasOwnProperty.call($,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Ae($[Y],X[Y],x,j,Y.slice(6),"setPaintProperty"):le($[Y],X[Y])||me(x,{command:"setLayerProperty",args:[j,Y,X[Y]]}))}else me(x,{command:"removeLayer",args:[j]}),oe=L[L.lastIndexOf(j)+1],me(x,{command:"addLayer",args:[X,oe]})}(d,t.layers,n)}catch(a){console.warn("Unable to compute style diff:",a),n=[{command:"setStyle",args:[t]}]}return n},P.bB=function(r){const t=[],n=r.id;return n===void 0&&t.push({message:`layers.${n}: missing required property "id"`}),r.render===void 0&&t.push({message:`layers.${n}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&t.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),t},P.bC=function r(t,n){if(Array.isArray(t)){if(!Array.isArray(n)||t.length!==n.length)return!1;for(let a=0;a<t.length;a++)if(!r(t[a],n[a]))return!1;return!0}if(typeof t=="object"&&t!==null&&n!==null){if(typeof n!="object"||Object.keys(t).length!==Object.keys(n).length)return!1;for(const a in t)if(!r(t[a],n[a]))return!1;return!0}return t===n},P.bD=Tt,P.bE=Pt,P.bF=class extends sn{constructor(r,t){super(r,t),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},P.bG=Tn,P.bH=class extends sn{constructor(r,t){super(r,t),this.current=Ca}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let t=1;t<16;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},P.bI=wr,P.bJ=class extends sn{constructor(r,t){super(r,t),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},P.bK=class extends sn{constructor(r,t){super(r,t),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},P.bL=wt,P.bM=function(r,t){var n=Math.sin(t),a=Math.cos(t);return r[0]=a,r[1]=n,r[2]=0,r[3]=-n,r[4]=a,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},P.bN=function(r,t,n){var a=t[0],c=t[1],d=t[2];return r[0]=a*n[0]+c*n[3]+d*n[6],r[1]=a*n[1]+c*n[4]+d*n[7],r[2]=a*n[2]+c*n[5]+d*n[8],r},P.bO=function(r,t,n,a,c,d,p){var g=1/(t-n),x=1/(a-c),w=1/(d-p);return r[0]=-2*g,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*x,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*w,r[11]=0,r[12]=(t+n)*g,r[13]=(c+a)*x,r[14]=(p+d)*w,r[15]=1,r},P.bP=class extends Xc{},P.bQ=Gv,P.bR=class extends so{},P.bS=wp,P.bT=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},P.bU=Am,P.bV=function(r,t,n){var a=t[0],c=t[1],d=t[2],p=n[3]*a+n[7]*c+n[11]*d+n[15];return r[0]=(n[0]*a+n[4]*c+n[8]*d+n[12])/(p=p||1),r[1]=(n[1]*a+n[5]*c+n[9]*d+n[13])/p,r[2]=(n[2]*a+n[6]*c+n[10]*d+n[14])/p,r},P.bW=class extends cl{},P.bX=class extends h{},P.bY=function(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]&&r[9]===t[9]&&r[10]===t[10]&&r[11]===t[11]&&r[12]===t[12]&&r[13]===t[13]&&r[14]===t[14]&&r[15]===t[15]},P.bZ=function(r,t){var n=r[0],a=r[1],c=r[2],d=r[3],p=r[4],g=r[5],x=r[6],w=r[7],S=r[8],I=r[9],R=r[10],L=r[11],B=r[12],j=r[13],$=r[14],X=r[15],oe=t[0],Y=t[1],D=t[2],U=t[3],Q=t[4],xe=t[5],ze=t[6],be=t[7],Pe=t[8],Le=t[9],Re=t[10],Fe=t[11],Ce=t[12],Ge=t[13],nt=t[14],tt=t[15];return Math.abs(n-oe)<=kt*Math.max(1,Math.abs(n),Math.abs(oe))&&Math.abs(a-Y)<=kt*Math.max(1,Math.abs(a),Math.abs(Y))&&Math.abs(c-D)<=kt*Math.max(1,Math.abs(c),Math.abs(D))&&Math.abs(d-U)<=kt*Math.max(1,Math.abs(d),Math.abs(U))&&Math.abs(p-Q)<=kt*Math.max(1,Math.abs(p),Math.abs(Q))&&Math.abs(g-xe)<=kt*Math.max(1,Math.abs(g),Math.abs(xe))&&Math.abs(x-ze)<=kt*Math.max(1,Math.abs(x),Math.abs(ze))&&Math.abs(w-be)<=kt*Math.max(1,Math.abs(w),Math.abs(be))&&Math.abs(S-Pe)<=kt*Math.max(1,Math.abs(S),Math.abs(Pe))&&Math.abs(I-Le)<=kt*Math.max(1,Math.abs(I),Math.abs(Le))&&Math.abs(R-Re)<=kt*Math.max(1,Math.abs(R),Math.abs(Re))&&Math.abs(L-Fe)<=kt*Math.max(1,Math.abs(L),Math.abs(Fe))&&Math.abs(B-Ce)<=kt*Math.max(1,Math.abs(B),Math.abs(Ce))&&Math.abs(j-Ge)<=kt*Math.max(1,Math.abs(j),Math.abs(Ge))&&Math.abs($-nt)<=kt*Math.max(1,Math.abs($),Math.abs(nt))&&Math.abs(X-tt)<=kt*Math.max(1,Math.abs(X),Math.abs(tt))},P.b_=function(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},P.ba=ou,P.bb=ml,P.bc=hn,P.bd=lt,P.be=Bi,P.bf=function(r,t,n,a,c){return hn(a,c,li((r-t)/(n-t),0,1))},P.bg=Fr,P.bh=function(){return new Float64Array(4)},P.bi=function(){return new Float64Array(3)},P.bj=function(r,t,n,a){var c=[],d=[];return c[0]=t[0]-n[0],c[1]=t[1]-n[1],c[2]=t[2]-n[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],r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},P.bk=function(r,t,n,a){var c=[],d=[];return c[0]=t[0]-n[0],c[1]=t[1]-n[1],c[2]=t[2]-n[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),r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},P.bl=function(r,t,n,a){var c=[],d=[];return c[0]=t[0]-n[0],c[1]=t[1]-n[1],c[2]=t[2]-n[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),r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},P.bm=function(r,t,n){var a=Math.sin(n),c=Math.cos(n),d=t[0],p=t[1],g=t[2],x=t[3],w=t[8],S=t[9],I=t[10],R=t[11];return t!==r&&(r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=d*c-w*a,r[1]=p*c-S*a,r[2]=g*c-I*a,r[3]=x*c-R*a,r[8]=d*a+w*c,r[9]=p*a+S*c,r[10]=g*a+I*c,r[11]=x*a+R*c,r},P.bn=function(r,t){const n=Fr(r,360),a=Fr(t,360),c=a-n,d=a>n?c-360:c+360;return Math.abs(c)<Math.abs(d)?c:d},P.bo=function(r){return r[0]=0,r[1]=0,r[2]=0,r},P.bp=function(r,t,n,a){const c=Math.sqrt(r*r+t*t),d=Math.sqrt(n*n+a*a);r/=c,t/=c,n/=d,a/=d;const p=Math.acos(r*n+t*a);return-t*n+r*a>0?p:-p},P.bq=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]},P.br=qp,P.bs=function(r,t){const n=Fr(r,2*Math.PI),a=Fr(t,2*Math.PI);return Math.min(Math.abs(n-a),Math.abs(n-a+2*Math.PI),Math.abs(n-a-2*Math.PI))},P.bt=function(r){return Math.hypot(r[0],r[1],r[2])},P.bu=function(){const r={},t=F.$version;for(const n in F.$root){const a=F.$root[n];if(a.required){let c=null;c=n==="version"?t:a.type==="array"?[]:{},c!=null&&(r[n]=c)}}return r},P.bv=Nc,P.bw=fn,P.bx=function(r){r=r.slice();const t=Object.create(null);for(let n=0;n<r.length;n++)t[r[n].id]=r[n];for(let n=0;n<r.length;n++)"ref"in r[n]&&(r[n]=ce(r[n],t[r[n].ref]));return r},P.by=function(r){if(r.type==="custom")return new f0(r);switch(r.type){case"background":return new h0(r);case"circle":return new sv(r);case"fill":return new Sv(r);case"fill-extrusion":return new Rv(r);case"heatmap":return new lv(r);case"hillshade":return new uv(r);case"line":return new Zv(r);case"raster":return new p0(r);case"symbol":return new dd(r)}},P.bz=rt,P.c=ha,P.c0=r=>r.type==="circle",P.c1=r=>r.type==="heatmap",P.c2=r=>r.type==="line",P.c3=r=>r.type==="fill",P.c4=r=>r.type==="fill-extrusion",P.c5=r=>r.type==="hillshade",P.c6=r=>r.type==="raster",P.c7=r=>r.type==="background",P.c8=r=>r.type==="custom",P.c9=qt,P.cA=class{constructor(r){this._marks={start:[r.url,"start"].join("#"),end:[r.url,"end"].join("#"),measure:r.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let r=performance.getEntriesByName(this._marks.measure);return r.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),r=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),r}},P.cB=function(r,t,n,a,c){return o(this,void 0,void 0,function*(){if(pt())try{return yield Br(r,t,n,a,c)}catch{}return function(d,p,g,x,w){const S=d.width,I=d.height;On&&jn||(On=new OffscreenCanvas(S,I),jn=On.getContext("2d",{willReadFrequently:!0})),On.width=S,On.height=I,jn.drawImage(d,0,0,S,I);const R=jn.getImageData(p,g,x,w);return jn.clearRect(0,0,S,I),R.data}(r,t,n,a,c)})},P.cC=Eg,P.cD=ue,P.cE=_e,P.cF=Hm,P.cG=sg,P.cH=Yo,P.cI=vn,P.ca=function(r,t,n){const a=cr(t.x-n.x,t.y-n.y),c=cr(r.x-n.x,r.y-n.y);var d,p;return jr(Math.atan2(a[0]*c[1]-a[1]*c[0],(d=a)[0]*(p=c)[0]+d[1]*p[1]))},P.cb=Ii,P.cc=function(r,t){return Va[t]&&(r instanceof MouseEvent||r instanceof WheelEvent)},P.cd=function(r,t){return Za[t]&&"touches"in r},P.ce=function(r){return Za[r]||Va[r]},P.cf=function(r,t,n){var a=t[0],c=t[1];return r[0]=n[0]*a+n[4]*c+n[12],r[1]=n[1]*a+n[5]*c+n[13],r},P.cg=function(r,t){const{x:n,y:a}=mu.fromLngLat(t);return!(r<0||r>25||a<0||a>=1||n<0||n>=1)},P.ch=function(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},P.ci=class extends nn{},P.cj=S0,P.cl=function(r){return r.message===Rs},P.cm=Yr,P.cn=function(r,t){Nn.REGISTERED_PROTOCOLS[r]=t},P.co=function(r){delete Nn.REGISTERED_PROTOCOLS[r]},P.cp=function(r,t){const n={};for(let c=0;c<r.length;c++){const d=t&&t[r[c].id]||cp(r[c]);t&&(t[r[c].id]=d);let p=n[d];p||(p=n[d]=[]),p.push(r[c])}const a=[];for(const c in n)a.push(n[c]);return a},P.cq=$e,P.cr=Ag,P.cs=Rg,P.ct=lg,P.cu=function(r){r.bucket.createArrays(),r.bucket.tilePixelRatio=Dt/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const t=r.bucket.layers[0],n=t.layout,a=t._unevaluatedLayout._values,c={layoutIconSize:a["icon-size"].possiblyEvaluate(new ni(r.bucket.zoom+1),r.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new ni(r.bucket.zoom+1),r.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new ni(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:w,maxZoom:S}=r.bucket.textSizeData;c.compositeTextSizes=[a["text-size"].possiblyEvaluate(new ni(w),r.canonical),a["text-size"].possiblyEvaluate(new ni(S),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:w,maxZoom:S}=r.bucket.iconSizeData;c.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new ni(w),r.canonical),a["icon-size"].possiblyEvaluate(new ni(S),r.canonical)]}const d=n.get("text-line-height")*ji,p=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point",g=n.get("text-keep-upright"),x=n.get("text-size");for(const w of r.bucket.features){const S=n.get("text-font").evaluate(w,{},r.canonical).join(","),I=x.evaluate(w,{},r.canonical),R=c.layoutTextSize.evaluate(w,{},r.canonical),L=c.layoutIconSize.evaluate(w,{},r.canonical),B={horizontal:{},vertical:void 0},j=w.text;let $,X=[0,0];if(j){const D=j.toString(),U=n.get("text-letter-spacing").evaluate(w,{},r.canonical)*ji,Q=Wh(D)?U:0,xe=n.get("text-anchor").evaluate(w,{},r.canonical),ze=Gg(t,w,r.canonical);if(!ze){const Re=n.get("text-radial-offset").evaluate(w,{},r.canonical);X=Re?$g(xe,[Re*ji,Xp]):n.get("text-offset").evaluate(w,{},r.canonical).map(Fe=>Fe*ji)}let be=p?"center":n.get("text-justify").evaluate(w,{},r.canonical);const Pe=n.get("symbol-placement")==="point"?n.get("text-max-width").evaluate(w,{},r.canonical)*ji:1/0,Le=()=>{r.bucket.allowVerticalPlacement&&al(D)&&(B.vertical=cd(j,r.glyphMap,r.glyphPositions,r.imagePositions,S,Pe,d,xe,"left",Q,X,P.ah.vertical,!0,R,I))};if(!p&&ze){const Re=new Set;if(be==="auto")for(let Ce=0;Ce<ze.values.length;Ce+=2)Re.add(Kp(ze.values[Ce]));else Re.add(be);let Fe=!1;for(const Ce of Re)if(!B.horizontal[Ce])if(Fe)B.horizontal[Ce]=B.horizontal[0];else{const Ge=cd(j,r.glyphMap,r.glyphPositions,r.imagePositions,S,Pe,d,"center",Ce,Q,X,P.ah.horizontal,!1,R,I);Ge&&(B.horizontal[Ce]=Ge,Fe=Ge.positionedLines.length===1)}Le()}else{be==="auto"&&(be=Kp(xe));const Re=cd(j,r.glyphMap,r.glyphPositions,r.imagePositions,S,Pe,d,xe,be,Q,X,P.ah.horizontal,!1,R,I);Re&&(B.horizontal[be]=Re),Le(),al(D)&&p&&g&&(B.vertical=cd(j,r.glyphMap,r.glyphPositions,r.imagePositions,S,Pe,d,xe,be,Q,X,P.ah.vertical,!1,R,I))}}let oe=!1;if(w.icon&&w.icon.name){const D=r.imageMap[w.icon.name];D&&($=s0(r.imagePositions[w.icon.name],n.get("icon-offset").evaluate(w,{},r.canonical),n.get("icon-anchor").evaluate(w,{},r.canonical)),oe=!!D.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=oe:r.bucket.sdfIcons!==oe&&bi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(D.pixelRatio!==r.bucket.pixelRatio||n.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const Y=Wg(B.horizontal)||B.vertical;r.bucket.iconsInText=!!Y&&Y.iconsInText,(Y||$)&&T0(r.bucket,w,B,$,r.imageMap,c,R,L,X,oe,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},P.cv=Rp,P.cw=Ip,P.cx=zp,P.cy=cu,P.cz=Fp,P.d=Ds,P.e=ft,P.f=r=>o(void 0,void 0,void 0,function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(t)}catch(n){throw new Error(`Could not load image because of ${n.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),P.g=Ua,P.h=r=>new Promise((t,n)=>{const a=new Image;a.onload=()=>{t(a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame(()=>{a.src=ua})},a.onerror=()=>n(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(r)],{type:"image/png"});a.src=r.byteLength?URL.createObjectURL(c):ua}),P.i=dn,P.j=(r,t)=>$a(ft(r,{type:"json"}),t),P.k=N,P.l=pe,P.m=$a,P.n=(r,t)=>$a(ft(r,{type:"arrayBuffer"}),t),P.o=function(r){return new Fp(r).readFields(Hv,[])},P.p=og,P.q=iu,P.r=fr,P.s=Or,P.t=Oc,P.u=Ct,P.v=F,P.w=bi,P.x=gs,P.y=wa,P.z=function([r,t,n]){return t+=90,t*=Math.PI/180,n*=Math.PI/180,{x:r*Math.cos(t)*Math.sin(n),y:r*Math.sin(t)*Math.sin(n),z:r*Math.cos(n)}}}),E("worker",["./shared"],function(P){class o{constructor(N){this.keyCache={},N&&this.replace(N)}replace(N){this._layerConfigs={},this._layers={},this.update(N,[])}update(N,V){for(const J of N){this._layerConfigs[J.id]=J;const ce=this._layers[J.id]=P.by(J);ce._featureFilter=P.a7(ce.filter),this.keyCache[J.id]&&delete this.keyCache[J.id]}for(const J of V)delete this.keyCache[J],delete this._layerConfigs[J],delete this._layers[J];this.familiesBySource={};const F=P.cp(Object.values(this._layerConfigs),this.keyCache);for(const J of F){const ce=J.map(fe=>this._layers[fe.id]),le=ce[0];if(le.visibility==="none")continue;const me=le.source||"";let de=this.familiesBySource[me];de||(de=this.familiesBySource[me]={});const Me=le.sourceLayer||"_geojsonTileLayer";let we=de[Me];we||(we=de[Me]=[]),we.push(ce)}}}class ue{constructor(N){const V={},F=[];for(const me in N){const de=N[me],Me=V[me]={};for(const we in de){const fe=de[+we];if(!fe||fe.bitmap.width===0||fe.bitmap.height===0)continue;const Ae={x:0,y:0,w:fe.bitmap.width+2,h:fe.bitmap.height+2};F.push(Ae),Me[we]={rect:Ae,metrics:fe.metrics}}}const{w:J,h:ce}=P.p(F),le=new P.q({width:J||1,height:ce||1});for(const me in N){const de=N[me];for(const Me in de){const we=de[+Me];if(!we||we.bitmap.width===0||we.bitmap.height===0)continue;const fe=V[me][Me].rect;P.q.copy(we.bitmap,le,{x:0,y:0},{x:fe.x+1,y:fe.y+1},we.bitmap)}}this.image=le,this.positions=V}}P.cq("GlyphAtlas",ue);class re{constructor(N){this.tileID=new P.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,V,F,J,ce){return P._(this,void 0,void 0,function*(){this.status="parsing",this.data=N,this.collisionBoxArray=new P.a5;const le=new P.cr(Object.keys(N.layers).sort()),me=new P.cs(this.tileID,this.promoteId);me.bucketLayerIDs=[];const de={},Me={featureIndex:me,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:F,subdivisionGranularity:ce},we=V.familiesBySource[this.source];for(const Ze in we){const _t=N.layers[Ze];if(!_t)continue;_t.version===1&&P.w(`Vector tile source "${this.source}" layer "${Ze}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const mi=le.encode(Ze),gn=[];for(let ot=0;ot<_t.length;ot++){const Fi=_t.feature(ot),ii=me.getId(Fi,Ze);gn.push({feature:Fi,id:ii,index:ot,sourceLayerIndex:mi})}for(const ot of we[Ze]){const Fi=ot[0];Fi.source!==this.source&&P.w(`layer.source = ${Fi.source} does not equal this.source = ${this.source}`),Fi.minzoom&&this.zoom<Math.floor(Fi.minzoom)||Fi.maxzoom&&this.zoom>=Fi.maxzoom||Fi.visibility!=="none"&&(ne(ot,this.zoom,F),(de[Fi.id]=Fi.createBucket({index:me.bucketLayerIDs.length,layers:ot,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:mi,sourceID:this.source})).populate(gn,Me,this.tileID.canonical),me.bucketLayerIDs.push(ot.map(ii=>ii.id)))}}const fe=P.bD(Me.glyphDependencies,Ze=>Object.keys(Ze).map(Number));this.inFlightDependencies.forEach(Ze=>Ze==null?void 0:Ze.abort()),this.inFlightDependencies=[];let Ae=Promise.resolve({});if(Object.keys(fe).length){const Ze=new AbortController;this.inFlightDependencies.push(Ze),Ae=J.sendAsync({type:"GG",data:{stacks:fe,source:this.source,tileID:this.tileID,type:"glyphs"}},Ze)}const Ve=Object.keys(Me.iconDependencies);let Ue=Promise.resolve({});if(Ve.length){const Ze=new AbortController;this.inFlightDependencies.push(Ze),Ue=J.sendAsync({type:"GI",data:{icons:Ve,source:this.source,tileID:this.tileID,type:"icons"}},Ze)}const Te=Object.keys(Me.patternDependencies);let dt=Promise.resolve({});if(Te.length){const Ze=new AbortController;this.inFlightDependencies.push(Ze),dt=J.sendAsync({type:"GI",data:{icons:Te,source:this.source,tileID:this.tileID,type:"patterns"}},Ze)}const[it,ht,Lt]=yield Promise.all([Ae,Ue,dt]),De=new ue(it),He=new P.ct(ht,Lt);for(const Ze in de){const _t=de[Ze];_t instanceof P.a6?(ne(_t.layers,this.zoom,F),P.cu({bucket:_t,glyphMap:it,glyphPositions:De.positions,imageMap:ht,imagePositions:He.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:Me.subdivisionGranularity})):_t.hasPattern&&(_t instanceof P.cv||_t instanceof P.cw||_t instanceof P.cx)&&(ne(_t.layers,this.zoom,F),_t.addFeatures(Me,this.tileID.canonical,He.patternPositions))}return this.status="done",{buckets:Object.values(de).filter(Ze=>!Ze.isEmpty()),featureIndex:me,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:De.image,imageAtlas:He,glyphMap:this.returnDependencies?it:null,iconMap:this.returnDependencies?ht:null,glyphPositions:this.returnDependencies?De.positions:null}})}}function ne(pe,N,V){const F=new P.C(N);for(const J of pe)J.recalculate(F,V)}class _e{constructor(N,V,F){this.actor=N,this.layerIndex=V,this.availableImages=F,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(N,V){return P._(this,void 0,void 0,function*(){const F=yield P.n(N.request,V);try{return{vectorTile:new P.cy.VectorTile(new P.cz(F.data)),rawData:F.data,cacheControl:F.cacheControl,expires:F.expires}}catch(J){const ce=new Uint8Array(F.data);let le=`Unable to parse the tile at ${N.request.url}, `;throw le+=ce[0]===31&&ce[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(le)}})}loadTile(N){return P._(this,void 0,void 0,function*(){const V=N.uid,F=!!(N&&N.request&&N.request.collectResourceTiming)&&new P.cA(N.request),J=new re(N);this.loading[V]=J;const ce=new AbortController;J.abort=ce;try{const le=yield this.loadVectorTile(N,ce);if(delete this.loading[V],!le)return null;const me=le.rawData,de={};le.expires&&(de.expires=le.expires),le.cacheControl&&(de.cacheControl=le.cacheControl);const Me={};if(F){const fe=F.finish();fe&&(Me.resourceTiming=JSON.parse(JSON.stringify(fe)))}J.vectorTile=le.vectorTile;const we=J.parse(le.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);this.loaded[V]=J,this.fetching[V]={rawTileData:me,cacheControl:de,resourceTiming:Me};try{const fe=yield we;return P.e({rawTileData:me.slice(0)},fe,de,Me)}finally{delete this.fetching[V]}}catch(le){throw delete this.loading[V],J.status="done",this.loaded[V]=J,le}})}reloadTile(N){return P._(this,void 0,void 0,function*(){const V=N.uid;if(!this.loaded||!this.loaded[V])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const F=this.loaded[V];if(F.showCollisionBoxes=N.showCollisionBoxes,F.status==="parsing"){const J=yield F.parse(F.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);let ce;if(this.fetching[V]){const{rawTileData:le,cacheControl:me,resourceTiming:de}=this.fetching[V];delete this.fetching[V],ce=P.e({rawTileData:le.slice(0)},J,me,de)}else ce=J;return ce}if(F.status==="done"&&F.vectorTile)return F.parse(F.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity)})}abortTile(N){return P._(this,void 0,void 0,function*(){const V=this.loading,F=N.uid;V&&V[F]&&V[F].abort&&(V[F].abort.abort(),delete V[F])})}removeTile(N){return P._(this,void 0,void 0,function*(){this.loaded&&this.loaded[N.uid]&&delete this.loaded[N.uid]})}}class ae{constructor(){this.loaded={}}loadTile(N){return P._(this,void 0,void 0,function*(){const{uid:V,encoding:F,rawImageData:J,redFactor:ce,greenFactor:le,blueFactor:me,baseShift:de}=N,Me=J.width+2,we=J.height+2,fe=P.b(J)?new P.R({width:Me,height:we},yield P.cB(J,-1,-1,Me,we)):J,Ae=new P.cC(V,fe,F,ce,le,me,de);return this.loaded=this.loaded||{},this.loaded[V]=Ae,Ae})}removeTile(N){const V=this.loaded,F=N.uid;V&&V[F]&&delete V[F]}}var G,ve,Oe=function(){if(ve)return G;function pe(V,F){if(V.length!==0){N(V[0],F);for(var J=1;J<V.length;J++)N(V[J],!F)}}function N(V,F){for(var J=0,ce=0,le=0,me=V.length,de=me-1;le<me;de=le++){var Me=(V[le][0]-V[de][0])*(V[de][1]+V[le][1]),we=J+Me;ce+=Math.abs(J)>=Math.abs(Me)?J-we+Me:Me-we+J,J=we}J+ce>=0!=!!F&&V.reverse()}return ve=1,G=function V(F,J){var ce,le=F&&F.type;if(le==="FeatureCollection")for(ce=0;ce<F.features.length;ce++)V(F.features[ce],J);else if(le==="GeometryCollection")for(ce=0;ce<F.geometries.length;ce++)V(F.geometries[ce],J);else if(le==="Feature")V(F.geometry,J);else if(le==="Polygon")pe(F.coordinates,J);else if(le==="MultiPolygon")for(ce=0;ce<F.coordinates.length;ce++)pe(F.coordinates[ce],J);return F}}(),Ke=P.cD(Oe);const Qe=P.cy.VectorTileFeature.prototype.toGeoJSON;class ct{constructor(N){this._feature=N,this.extent=P.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 V of this._feature.geometry)N.push([new P.P(V[0],V[1])]);return N}{const N=[];for(const V of this._feature.geometry){const F=[];for(const J of V)F.push(new P.P(J[0],J[1]));N.push(F)}return N}}toGeoJSON(N,V,F){return Qe.call(this,N,V,F)}}class gt{constructor(N){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=P.Z,this.length=N.length,this._features=N}feature(N){return new ct(this._features[N])}}var pt,Mt,kt,Et={exports:{}},wt=function(){if(kt)return Et.exports;kt=1;var pe=P.cG(),N=function(){if(Mt)return pt;Mt=1;var we=P.cE(),fe=P.cF().VectorTileFeature;function Ae(Ue,Te){this.options=Te||{},this.features=Ue,this.length=Ue.length}function Ve(Ue,Te){this.id=typeof Ue.id=="number"?Ue.id:void 0,this.type=Ue.type,this.rawGeometry=Ue.type===1?[Ue.geometry]:Ue.geometry,this.properties=Ue.tags,this.extent=Te||4096}return pt=Ae,Ae.prototype.feature=function(Ue){return new Ve(this.features[Ue],this.options.extent)},Ve.prototype.loadGeometry=function(){var Ue=this.rawGeometry;this.geometry=[];for(var Te=0;Te<Ue.length;Te++){for(var dt=Ue[Te],it=[],ht=0;ht<dt.length;ht++)it.push(new we(dt[ht][0],dt[ht][1]));this.geometry.push(it)}return this.geometry},Ve.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Ue=this.geometry,Te=1/0,dt=-1/0,it=1/0,ht=-1/0,Lt=0;Lt<Ue.length;Lt++)for(var De=Ue[Lt],He=0;He<De.length;He++){var Ze=De[He];Te=Math.min(Te,Ze.x),dt=Math.max(dt,Ze.x),it=Math.min(it,Ze.y),ht=Math.max(ht,Ze.y)}return[Te,it,dt,ht]},Ve.prototype.toGeoJSON=fe.prototype.toGeoJSON,pt}();function V(we){var fe=new pe;return function(Ae,Ve){for(var Ue in Ae.layers)Ve.writeMessage(3,F,Ae.layers[Ue])}(we,fe),fe.finish()}function F(we,fe){var Ae;fe.writeVarintField(15,we.version||1),fe.writeStringField(1,we.name||""),fe.writeVarintField(5,we.extent||4096);var Ve={keys:[],values:[],keycache:{},valuecache:{}};for(Ae=0;Ae<we.length;Ae++)Ve.feature=we.feature(Ae),fe.writeMessage(2,J,Ve);var Ue=Ve.keys;for(Ae=0;Ae<Ue.length;Ae++)fe.writeStringField(3,Ue[Ae]);var Te=Ve.values;for(Ae=0;Ae<Te.length;Ae++)fe.writeMessage(4,Me,Te[Ae])}function J(we,fe){var Ae=we.feature;Ae.id!==void 0&&fe.writeVarintField(1,Ae.id),fe.writeMessage(2,ce,we),fe.writeVarintField(3,Ae.type),fe.writeMessage(4,de,Ae)}function ce(we,fe){var Ae=we.feature,Ve=we.keys,Ue=we.values,Te=we.keycache,dt=we.valuecache;for(var it in Ae.properties){var ht=Ae.properties[it],Lt=Te[it];if(ht!==null){Lt===void 0&&(Ve.push(it),Te[it]=Lt=Ve.length-1),fe.writeVarint(Lt);var De=typeof ht;De!=="string"&&De!=="boolean"&&De!=="number"&&(ht=JSON.stringify(ht));var He=De+":"+ht,Ze=dt[He];Ze===void 0&&(Ue.push(ht),dt[He]=Ze=Ue.length-1),fe.writeVarint(Ze)}}}function le(we,fe){return(fe<<3)+(7&we)}function me(we){return we<<1^we>>31}function de(we,fe){for(var Ae=we.loadGeometry(),Ve=we.type,Ue=0,Te=0,dt=Ae.length,it=0;it<dt;it++){var ht=Ae[it],Lt=1;Ve===1&&(Lt=ht.length),fe.writeVarint(le(1,Lt));for(var De=Ve===3?ht.length-1:ht.length,He=0;He<De;He++){He===1&&Ve!==1&&fe.writeVarint(le(2,De-1));var Ze=ht[He].x-Ue,_t=ht[He].y-Te;fe.writeVarint(me(Ze)),fe.writeVarint(me(_t)),Ue+=Ze,Te+=_t}Ve===3&&fe.writeVarint(le(7,1))}}function Me(we,fe){var Ae=typeof we;Ae==="string"?fe.writeStringField(1,we):Ae==="boolean"?fe.writeBooleanField(7,we):Ae==="number"&&(we%1!=0?fe.writeDoubleField(3,we):we<0?fe.writeSVarintField(6,we):fe.writeVarintField(5,we))}return Et.exports=V,Et.exports.fromVectorTileJs=V,Et.exports.fromGeojsonVt=function(we,fe){fe=fe||{};var Ae={};for(var Ve in we)Ae[Ve]=new N(we[Ve].features,fe),Ae[Ve].name=Ve,Ae[Ve].version=fe.version,Ae[Ve].extent=fe.extent;return V({layers:Ae})},Et.exports.GeoJSONWrapper=N,Et.exports}(),Mi=P.cD(wt);const Wi={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:pe=>pe},Hi=Math.fround||(ut=new Float32Array(1),pe=>(ut[0]=+pe,ut[0]));var ut;const Yt=3,Jt=5,cr=6;class Dt{constructor(N){this.options=Object.assign(Object.create(Wi),N),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(N){const{log:V,minZoom:F,maxZoom:J}=this.options;V&&console.time("total time");const ce=`prepare ${N.length} points`;V&&console.time(ce),this.points=N;const le=[];for(let de=0;de<N.length;de++){const Me=N[de];if(!Me.geometry)continue;const[we,fe]=Me.geometry.coordinates,Ae=Hi(hn(we)),Ve=Hi(lt(fe));le.push(Ae,Ve,1/0,de,-1,1),this.options.reduce&&le.push(0)}let me=this.trees[J+1]=this._createTree(le);V&&console.timeEnd(ce);for(let de=J;de>=F;de--){const Me=+Date.now();me=this.trees[de]=this._createTree(this._cluster(me,de)),V&&console.log("z%d: %d clusters in %dms",de,me.numItems,+Date.now()-Me)}return V&&console.timeEnd("total time"),this}getClusters(N,V){let F=((N[0]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,N[1]));let ce=N[2]===180?180:((N[2]+180)%360+360)%360-180;const le=Math.max(-90,Math.min(90,N[3]));if(N[2]-N[0]>=360)F=-180,ce=180;else if(F>ce){const fe=this.getClusters([F,J,180,le],V),Ae=this.getClusters([-180,J,ce,le],V);return fe.concat(Ae)}const me=this.trees[this._limitZoom(V)],de=me.range(hn(F),lt(le),hn(ce),lt(J)),Me=me.data,we=[];for(const fe of de){const Ae=this.stride*fe;we.push(Me[Ae+Jt]>1?vr(Me,Ae,this.clusterProps):this.points[Me[Ae+Yt]])}return we}getChildren(N){const V=this._getOriginId(N),F=this._getOriginZoom(N),J="No cluster with the specified id.",ce=this.trees[F];if(!ce)throw new Error(J);const le=ce.data;if(V*this.stride>=le.length)throw new Error(J);const me=this.options.radius/(this.options.extent*Math.pow(2,F-1)),de=ce.within(le[V*this.stride],le[V*this.stride+1],me),Me=[];for(const we of de){const fe=we*this.stride;le[fe+4]===N&&Me.push(le[fe+Jt]>1?vr(le,fe,this.clusterProps):this.points[le[fe+Yt]])}if(Me.length===0)throw new Error(J);return Me}getLeaves(N,V,F){const J=[];return this._appendLeaves(J,N,V=V||10,F=F||0,0),J}getTile(N,V,F){const J=this.trees[this._limitZoom(N)],ce=Math.pow(2,N),{extent:le,radius:me}=this.options,de=me/le,Me=(F-de)/ce,we=(F+1+de)/ce,fe={features:[]};return this._addTileFeatures(J.range((V-de)/ce,Me,(V+1+de)/ce,we),J.data,V,F,ce,fe),V===0&&this._addTileFeatures(J.range(1-de/ce,Me,1,we),J.data,ce,F,ce,fe),V===ce-1&&this._addTileFeatures(J.range(0,Me,de/ce,we),J.data,-1,F,ce,fe),fe.features.length?fe:null}getClusterExpansionZoom(N){let V=this._getOriginZoom(N)-1;for(;V<=this.options.maxZoom;){const F=this.getChildren(N);if(V++,F.length!==1)break;N=F[0].properties.cluster_id}return V}_appendLeaves(N,V,F,J,ce){const le=this.getChildren(V);for(const me of le){const de=me.properties;if(de&&de.cluster?ce+de.point_count<=J?ce+=de.point_count:ce=this._appendLeaves(N,de.cluster_id,F,J,ce):ce<J?ce++:N.push(me),N.length===F)break}return ce}_createTree(N){const V=new P.aC(N.length/this.stride|0,this.options.nodeSize,Float32Array);for(let F=0;F<N.length;F+=this.stride)V.add(N[F],N[F+1]);return V.finish(),V.data=N,V}_addTileFeatures(N,V,F,J,ce,le){for(const me of N){const de=me*this.stride,Me=V[de+Jt]>1;let we,fe,Ae;if(Me)we=Fr(V,de,this.clusterProps),fe=V[de],Ae=V[de+1];else{const Te=this.points[V[de+Yt]];we=Te.properties;const[dt,it]=Te.geometry.coordinates;fe=hn(dt),Ae=lt(it)}const Ve={type:1,geometry:[[Math.round(this.options.extent*(fe*ce-F)),Math.round(this.options.extent*(Ae*ce-J))]],tags:we};let Ue;Ue=Me||this.options.generateId?V[de+Yt]:this.points[V[de+Yt]].id,Ue!==void 0&&(Ve.id=Ue),le.features.push(Ve)}}_limitZoom(N){return Math.max(this.options.minZoom,Math.min(Math.floor(+N),this.options.maxZoom+1))}_cluster(N,V){const{radius:F,extent:J,reduce:ce,minPoints:le}=this.options,me=F/(J*Math.pow(2,V)),de=N.data,Me=[],we=this.stride;for(let fe=0;fe<de.length;fe+=we){if(de[fe+2]<=V)continue;de[fe+2]=V;const Ae=de[fe],Ve=de[fe+1],Ue=N.within(de[fe],de[fe+1],me),Te=de[fe+Jt];let dt=Te;for(const it of Ue){const ht=it*we;de[ht+2]>V&&(dt+=de[ht+Jt])}if(dt>Te&&dt>=le){let it,ht=Ae*Te,Lt=Ve*Te,De=-1;const He=((fe/we|0)<<5)+(V+1)+this.points.length;for(const Ze of Ue){const _t=Ze*we;if(de[_t+2]<=V)continue;de[_t+2]=V;const mi=de[_t+Jt];ht+=de[_t]*mi,Lt+=de[_t+1]*mi,de[_t+4]=He,ce&&(it||(it=this._map(de,fe,!0),De=this.clusterProps.length,this.clusterProps.push(it)),ce(it,this._map(de,_t)))}de[fe+4]=He,Me.push(ht/dt,Lt/dt,1/0,He,-1,dt),ce&&Me.push(De)}else{for(let it=0;it<we;it++)Me.push(de[fe+it]);if(dt>1)for(const it of Ue){const ht=it*we;if(!(de[ht+2]<=V)){de[ht+2]=V;for(let Lt=0;Lt<we;Lt++)Me.push(de[ht+Lt])}}}}return Me}_getOriginId(N){return N-this.points.length>>5}_getOriginZoom(N){return(N-this.points.length)%32}_map(N,V,F){if(N[V+Jt]>1){const le=this.clusterProps[N[V+cr]];return F?Object.assign({},le):le}const J=this.points[N[V+Yt]].properties,ce=this.options.map(J);return F&&ce===J?Object.assign({},ce):ce}}function vr(pe,N,V){return{type:"Feature",id:pe[N+Yt],properties:Fr(pe,N,V),geometry:{type:"Point",coordinates:[(F=pe[N],360*(F-.5)),qt(pe[N+1])]}};var F}function Fr(pe,N,V){const F=pe[N+Jt],J=F>=1e4?`${Math.round(F/1e3)}k`:F>=1e3?Math.round(F/100)/10+"k":F,ce=pe[N+cr],le=ce===-1?{}:Object.assign({},V[ce]);return Object.assign(le,{cluster:!0,cluster_id:pe[N+Yt],point_count:F,point_count_abbreviated:J})}function hn(pe){return pe/360+.5}function lt(pe){const N=Math.sin(pe*Math.PI/180),V=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return V<0?0:V>1?1:V}function qt(pe){const N=(180-360*pe)*Math.PI/180;return 360*Math.atan(Math.exp(N))/Math.PI-90}function Ii(pe,N,V,F){let J=F;const ce=N+(V-N>>1);let le,me=V-N;const de=pe[N],Me=pe[N+1],we=pe[V],fe=pe[V+1];for(let Ae=N+3;Ae<V;Ae+=3){const Ve=li(pe[Ae],pe[Ae+1],de,Me,we,fe);if(Ve>J)le=Ae,J=Ve;else if(Ve===J){const Ue=Math.abs(Ae-ce);Ue<me&&(le=Ae,me=Ue)}}J>F&&(le-N>3&&Ii(pe,N,le,F),pe[le+2]=J,V-le>3&&Ii(pe,le,V,F))}function li(pe,N,V,F,J,ce){let le=J-V,me=ce-F;if(le!==0||me!==0){const de=((pe-V)*le+(N-F)*me)/(le*le+me*me);de>1?(V=J,F=ce):de>0&&(V+=le*de,F+=me*de)}return le=pe-V,me=N-F,le*le+me*me}function $t(pe,N,V,F){const J={id:pe??null,type:N,geometry:V,tags:F,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(N==="Point"||N==="MultiPoint"||N==="LineString")ft(J,V);else if(N==="Polygon")ft(J,V[0]);else if(N==="MultiLineString")for(const ce of V)ft(J,ce);else if(N==="MultiPolygon")for(const ce of V)ft(J,ce[0]);return J}function ft(pe,N){for(let V=0;V<N.length;V+=3)pe.minX=Math.min(pe.minX,N[V]),pe.minY=Math.min(pe.minY,N[V+1]),pe.maxX=Math.max(pe.maxX,N[V]),pe.maxY=Math.max(pe.maxY,N[V+1])}function Qt(pe,N,V,F){if(!N.geometry)return;const J=N.geometry.coordinates;if(J&&J.length===0)return;const ce=N.geometry.type,le=Math.pow(V.tolerance/((1<<V.maxZoom)*V.extent),2);let me=[],de=N.id;if(V.promoteId?de=N.properties[V.promoteId]:V.generateId&&(de=F||0),ce==="Point")Tt(J,me);else if(ce==="MultiPoint")for(const Me of J)Tt(Me,me);else if(ce==="LineString")Pt(J,me,le,!1);else if(ce==="MultiLineString"){if(V.lineMetrics){for(const Me of J)me=[],Pt(Me,me,le,!1),pe.push($t(de,"LineString",me,N.properties));return}rt(J,me,le,!1)}else if(ce==="Polygon")rt(J,me,le,!0);else{if(ce!=="MultiPolygon"){if(ce==="GeometryCollection"){for(const Me of N.geometry.geometries)Qt(pe,{id:de,geometry:Me,properties:N.properties},V,F);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Me of J){const we=[];rt(Me,we,le,!0),me.push(we)}}pe.push($t(de,ce,me,N.properties))}function Tt(pe,N){N.push(fi(pe[0]),bi(pe[1]),0)}function Pt(pe,N,V,F){let J,ce,le=0;for(let de=0;de<pe.length;de++){const Me=fi(pe[de][0]),we=bi(pe[de][1]);N.push(Me,we,0),de>0&&(le+=F?(J*we-Me*ce)/2:Math.sqrt(Math.pow(Me-J,2)+Math.pow(we-ce,2))),J=Me,ce=we}const me=N.length-3;N[2]=1,Ii(N,0,me,V),N[me+2]=1,N.size=Math.abs(le),N.start=0,N.end=N.size}function rt(pe,N,V,F){for(let J=0;J<pe.length;J++){const ce=[];Pt(pe[J],ce,V,F),N.push(ce)}}function fi(pe){return pe/360+.5}function bi(pe){const N=Math.sin(pe*Math.PI/180),V=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return V<0?0:V>1?1:V}function Ci(pe,N,V,F,J,ce,le,me){if(F/=N,ce>=(V/=N)&&le<F)return pe;if(le<V||ce>=F)return null;const de=[];for(const Me of pe){const we=Me.geometry;let fe=Me.type;const Ae=J===0?Me.minX:Me.minY,Ve=J===0?Me.maxX:Me.maxY;if(Ae>=V&&Ve<F){de.push(Me);continue}if(Ve<V||Ae>=F)continue;let Ue=[];if(fe==="Point"||fe==="MultiPoint")dn(we,Ue,V,F,J);else if(fe==="LineString")wi(we,Ue,V,F,J,!1,me.lineMetrics);else if(fe==="MultiLineString")ua(we,Ue,V,F,J,!1);else if(fe==="Polygon")ua(we,Ue,V,F,J,!0);else if(fe==="MultiPolygon")for(const Te of we){const dt=[];ua(Te,dt,V,F,J,!0),dt.length&&Ue.push(dt)}if(Ue.length){if(me.lineMetrics&&fe==="LineString"){for(const Te of Ue)de.push($t(Me.id,fe,Te,Me.tags));continue}fe!=="LineString"&&fe!=="MultiLineString"||(Ue.length===1?(fe="LineString",Ue=Ue[0]):fe="MultiLineString"),fe!=="Point"&&fe!=="MultiPoint"||(fe=Ue.length===3?"Point":"MultiPoint"),de.push($t(Me.id,fe,Ue,Me.tags))}}return de.length?de:null}function dn(pe,N,V,F,J){for(let ce=0;ce<pe.length;ce+=3){const le=pe[ce+J];le>=V&&le<=F&&Br(N,pe[ce],pe[ce+1],pe[ce+2])}}function wi(pe,N,V,F,J,ce,le){let me=ca(pe);const de=J===0?On:jn;let Me,we,fe=pe.start;for(let dt=0;dt<pe.length-3;dt+=3){const it=pe[dt],ht=pe[dt+1],Lt=pe[dt+2],De=pe[dt+3],He=pe[dt+4],Ze=J===0?it:ht,_t=J===0?De:He;let mi=!1;le&&(Me=Math.sqrt(Math.pow(it-De,2)+Math.pow(ht-He,2))),Ze<V?_t>V&&(we=de(me,it,ht,De,He,V),le&&(me.start=fe+Me*we)):Ze>F?_t<F&&(we=de(me,it,ht,De,He,F),le&&(me.start=fe+Me*we)):Br(me,it,ht,Lt),_t<V&&Ze>=V&&(we=de(me,it,ht,De,He,V),mi=!0),_t>F&&Ze<=F&&(we=de(me,it,ht,De,He,F),mi=!0),!ce&&mi&&(le&&(me.end=fe+Me*we),N.push(me),me=ca(pe)),le&&(fe+=Me)}let Ae=pe.length-3;const Ve=pe[Ae],Ue=pe[Ae+1],Te=J===0?Ve:Ue;Te>=V&&Te<=F&&Br(me,Ve,Ue,pe[Ae+2]),Ae=me.length-3,ce&&Ae>=3&&(me[Ae]!==me[0]||me[Ae+1]!==me[1])&&Br(me,me[0],me[1],me[2]),me.length&&N.push(me)}function ca(pe){const N=[];return N.size=pe.size,N.start=pe.start,N.end=pe.end,N}function ua(pe,N,V,F,J,ce){for(const le of pe)wi(le,N,V,F,J,ce,!1)}function Br(pe,N,V,F){pe.push(N,V,F)}function On(pe,N,V,F,J,ce){const le=(ce-N)/(F-N);return Br(pe,ce,V+(J-V)*le,1),le}function jn(pe,N,V,F,J,ce){const le=(ce-V)/(J-V);return Br(pe,N+(F-N)*le,ce,1),le}function Or(pe,N){const V=[];for(let F=0;F<pe.length;F++){const J=pe[F],ce=J.type;let le;if(ce==="Point"||ce==="MultiPoint"||ce==="LineString")le=jr(J.geometry,N);else if(ce==="MultiLineString"||ce==="Polygon"){le=[];for(const me of J.geometry)le.push(jr(me,N))}else if(ce==="MultiPolygon"){le=[];for(const me of J.geometry){const de=[];for(const Me of me)de.push(jr(Me,N));le.push(de)}}V.push($t(J.id,ce,le,J.tags))}return V}function jr(pe,N){const V=[];V.size=pe.size,pe.start!==void 0&&(V.start=pe.start,V.end=pe.end);for(let F=0;F<pe.length;F+=3)V.push(pe[F]+N,pe[F+1],pe[F+2]);return V}function Za(pe,N){if(pe.transformed)return pe;const V=1<<pe.z,F=pe.x,J=pe.y;for(const ce of pe.features){const le=ce.geometry,me=ce.type;if(ce.geometry=[],me===1)for(let de=0;de<le.length;de+=2)ce.geometry.push(Va(le[de],le[de+1],N,V,F,J));else for(let de=0;de<le.length;de++){const Me=[];for(let we=0;we<le[de].length;we+=2)Me.push(Va(le[de][we],le[de][we+1],N,V,F,J));ce.geometry.push(Me)}}return pe.transformed=!0,pe}function Va(pe,N,V,F,J,ce){return[Math.round(V*(pe*F-J)),Math.round(V*(N*F-ce))]}function Rs(pe,N,V,F,J){const ce=N===J.maxZoom?0:J.tolerance/((1<<N)*J.extent),le={features:[],numPoints:0,numSimplified:0,numFeatures:pe.length,source:null,x:V,y:F,z:N,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const me of pe)ha(le,me,ce,J);return le}function ha(pe,N,V,F){const J=N.geometry,ce=N.type,le=[];if(pe.minX=Math.min(pe.minX,N.minX),pe.minY=Math.min(pe.minY,N.minY),pe.maxX=Math.max(pe.maxX,N.maxX),pe.maxY=Math.max(pe.maxY,N.maxY),ce==="Point"||ce==="MultiPoint")for(let me=0;me<J.length;me+=3)le.push(J[me],J[me+1]),pe.numPoints++,pe.numSimplified++;else if(ce==="LineString")Nn(le,J,pe,V,!1,!1);else if(ce==="MultiLineString"||ce==="Polygon")for(let me=0;me<J.length;me++)Nn(le,J[me],pe,V,ce==="Polygon",me===0);else if(ce==="MultiPolygon")for(let me=0;me<J.length;me++){const de=J[me];for(let Me=0;Me<de.length;Me++)Nn(le,de[Me],pe,V,!0,Me===0)}if(le.length){let me=N.tags||null;if(ce==="LineString"&&F.lineMetrics){me={};for(const Me in N.tags)me[Me]=N.tags[Me];me.mapbox_clip_start=J.start/J.size,me.mapbox_clip_end=J.end/J.size}const de={geometry:le,type:ce==="Polygon"||ce==="MultiPolygon"?3:ce==="LineString"||ce==="MultiLineString"?2:1,tags:me};N.id!==null&&(de.id=N.id),pe.features.push(de)}}function Nn(pe,N,V,F,J,ce){const le=F*F;if(F>0&&N.size<(J?le:F))return void(V.numPoints+=N.length/3);const me=[];for(let de=0;de<N.length;de+=3)(F===0||N[de+2]>le)&&(V.numSimplified++,me.push(N[de],N[de+1])),V.numPoints++;J&&function(de,Me){let we=0;for(let fe=0,Ae=de.length,Ve=Ae-2;fe<Ae;Ve=fe,fe+=2)we+=(de[fe]-de[Ve])*(de[fe+1]+de[Ve+1]);if(we>0===Me)for(let fe=0,Ae=de.length;fe<Ae/2;fe+=2){const Ve=de[fe],Ue=de[fe+1];de[fe]=de[Ae-2-fe],de[fe+1]=de[Ae-1-fe],de[Ae-2-fe]=Ve,de[Ae-1-fe]=Ue}}(me,ce),pe.push(me)}const Ua={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class pn{constructor(N,V){const F=(V=this.options=function(ce,le){for(const me in le)ce[me]=le[me];return ce}(Object.create(Ua),V)).debug;if(F&&console.time("preprocess data"),V.maxZoom<0||V.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(V.promoteId&&V.generateId)throw new Error("promoteId and generateId cannot be used together.");let J=function(ce,le){const me=[];if(ce.type==="FeatureCollection")for(let de=0;de<ce.features.length;de++)Qt(me,ce.features[de],le,de);else Qt(me,ce.type==="Feature"?ce:{geometry:ce},le);return me}(N,V);this.tiles={},this.tileCoords=[],F&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",V.indexMaxZoom,V.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),J=function(ce,le){const me=le.buffer/le.extent;let de=ce;const Me=Ci(ce,1,-1-me,me,0,-1,2,le),we=Ci(ce,1,1-me,2+me,0,-1,2,le);return(Me||we)&&(de=Ci(ce,1,-me,1+me,0,-1,2,le)||[],Me&&(de=Or(Me,1).concat(de)),we&&(de=de.concat(Or(we,-1)))),de}(J,V),J.length&&this.splitTile(J,0,0,0),F&&(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,V,F,J,ce,le,me){const de=[N,V,F,J],Me=this.options,we=Me.debug;for(;de.length;){J=de.pop(),F=de.pop(),V=de.pop(),N=de.pop();const fe=1<<V,Ae=Yr(V,F,J);let Ve=this.tiles[Ae];if(!Ve&&(we>1&&console.time("creation"),Ve=this.tiles[Ae]=Rs(N,V,F,J,Me),this.tileCoords.push({z:V,x:F,y:J}),we)){we>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,F,J,Ve.numFeatures,Ve.numPoints,Ve.numSimplified),console.timeEnd("creation"));const mi=`z${V}`;this.stats[mi]=(this.stats[mi]||0)+1,this.total++}if(Ve.source=N,ce==null){if(V===Me.indexMaxZoom||Ve.numPoints<=Me.indexMaxPoints)continue}else{if(V===Me.maxZoom||V===ce)continue;if(ce!=null){const mi=ce-V;if(F!==le>>mi||J!==me>>mi)continue}}if(Ve.source=null,N.length===0)continue;we>1&&console.time("clipping");const Ue=.5*Me.buffer/Me.extent,Te=.5-Ue,dt=.5+Ue,it=1+Ue;let ht=null,Lt=null,De=null,He=null,Ze=Ci(N,fe,F-Ue,F+dt,0,Ve.minX,Ve.maxX,Me),_t=Ci(N,fe,F+Te,F+it,0,Ve.minX,Ve.maxX,Me);N=null,Ze&&(ht=Ci(Ze,fe,J-Ue,J+dt,1,Ve.minY,Ve.maxY,Me),Lt=Ci(Ze,fe,J+Te,J+it,1,Ve.minY,Ve.maxY,Me),Ze=null),_t&&(De=Ci(_t,fe,J-Ue,J+dt,1,Ve.minY,Ve.maxY,Me),He=Ci(_t,fe,J+Te,J+it,1,Ve.minY,Ve.maxY,Me),_t=null),we>1&&console.timeEnd("clipping"),de.push(ht||[],V+1,2*F,2*J),de.push(Lt||[],V+1,2*F,2*J+1),de.push(De||[],V+1,2*F+1,2*J),de.push(He||[],V+1,2*F+1,2*J+1)}}getTile(N,V,F){N=+N,V=+V,F=+F;const J=this.options,{extent:ce,debug:le}=J;if(N<0||N>24)return null;const me=1<<N,de=Yr(N,V=V+me&me-1,F);if(this.tiles[de])return Za(this.tiles[de],ce);le>1&&console.log("drilling down to z%d-%d-%d",N,V,F);let Me,we=N,fe=V,Ae=F;for(;!Me&&we>0;)we--,fe>>=1,Ae>>=1,Me=this.tiles[Yr(we,fe,Ae)];return Me&&Me.source?(le>1&&(console.log("found parent tile z%d-%d-%d",we,fe,Ae),console.time("drilling down")),this.splitTile(Me.source,we,fe,Ae,N,V,F),le>1&&console.timeEnd("drilling down"),this.tiles[de]?Za(this.tiles[de],ce):null):null}}function Yr(pe,N,V){return 32*((1<<pe)*V+N)+pe}function fn(pe,N){return N?pe.properties[N]:pe.id}function $a(pe,N){if(pe==null)return!0;if(pe.type==="Feature")return fn(pe,N)!=null;if(pe.type==="FeatureCollection"){const V=new Set;for(const F of pe.features){const J=fn(F,N);if(J==null||V.has(J))return!1;V.add(J)}return!0}return!1}function Ds(pe,N){const V=new Map;if(pe!=null)if(pe.type==="Feature")V.set(fn(pe,N),pe);else for(const F of pe.features)V.set(fn(F,N),F);return V}class Ao extends _e{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(N,V){return P._(this,void 0,void 0,function*(){const F=N.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const J=this._geoJSONIndex.getTile(F.z,F.x,F.y);if(!J)return null;const ce=new gt(J.features);let le=Mi(ce);return le.byteOffset===0&&le.byteLength===le.buffer.byteLength||(le=new Uint8Array(le)),{vectorTile:ce,rawData:le.buffer}})}loadData(N){return P._(this,void 0,void 0,function*(){var V;(V=this._pendingRequest)===null||V===void 0||V.abort();const F=!!(N&&N.request&&N.request.collectResourceTiming)&&new P.cA(N.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(N,this._pendingRequest),this._geoJSONIndex=N.cluster?new Dt(function({superclusterOptions:le,clusterProperties:me}){if(!me||!le)return le;const de={},Me={},we={accumulated:null,zoom:0},fe={properties:null},Ae=Object.keys(me);for(const Ve of Ae){const[Ue,Te]=me[Ve],dt=P.cH(Te),it=P.cH(typeof Ue=="string"?[Ue,["accumulated"],["get",Ve]]:Ue);de[Ve]=dt.value,Me[Ve]=it.value}return le.map=Ve=>{fe.properties=Ve;const Ue={};for(const Te of Ae)Ue[Te]=de[Te].evaluate(we,fe);return Ue},le.reduce=(Ve,Ue)=>{fe.properties=Ue;for(const Te of Ae)we.accumulated=Ve[Te],Ve[Te]=Me[Te].evaluate(we,fe)},le}(N)).load((yield this._pendingData).features):(J=yield this._pendingData,new pn(J,N.geojsonVtOptions)),this.loaded={};const ce={};if(F){const le=F.finish();le&&(ce.resourceTiming={},ce.resourceTiming[N.source]=JSON.parse(JSON.stringify(le)))}return ce}catch(ce){if(delete this._pendingRequest,P.cl(ce))return{abandoned:!0};throw ce}var J})}getData(){return P._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(N){const V=this.loaded;return V&&V[N.uid]?super.reloadTile(N):this.loadTile(N)}loadAndProcessGeoJSON(N,V){return P._(this,void 0,void 0,function*(){let F=yield this.loadGeoJSON(N,V);if(delete this._pendingRequest,typeof F!="object")throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(Ke(F,!0),N.filter){const J=P.cH(N.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(J.result==="error")throw new Error(J.value.map(le=>`${le.key}: ${le.message}`).join(", "));F={type:"FeatureCollection",features:F.features.filter(le=>J.value.evaluate({zoom:0},le))}}return F})}loadGeoJSON(N,V){return P._(this,void 0,void 0,function*(){const{promoteId:F}=N;if(N.request){const J=yield P.j(N.request,V);return this._dataUpdateable=$a(J.data,F)?Ds(J.data,F):void 0,J.data}if(typeof N.data=="string")try{const J=JSON.parse(N.data);return this._dataUpdateable=$a(J,F)?Ds(J,F):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,ce,le){var me,de,Me,we;if(ce.removeAll&&J.clear(),ce.remove)for(const fe of ce.remove)J.delete(fe);if(ce.add)for(const fe of ce.add){const Ae=fn(fe,le);Ae!=null&&J.set(Ae,fe)}if(ce.update)for(const fe of ce.update){let Ae=J.get(fe.id);if(Ae==null)continue;const Ve=!fe.removeAllProperties&&(((me=fe.removeProperties)===null||me===void 0?void 0:me.length)>0||((de=fe.addOrUpdateProperties)===null||de===void 0?void 0:de.length)>0);if((fe.newGeometry||fe.removeAllProperties||Ve)&&(Ae=Object.assign({},Ae),J.set(fe.id,Ae),Ve&&(Ae.properties=Object.assign({},Ae.properties))),fe.newGeometry&&(Ae.geometry=fe.newGeometry),fe.removeAllProperties)Ae.properties={};else if(((Me=fe.removeProperties)===null||Me===void 0?void 0:Me.length)>0)for(const Ue of fe.removeProperties)Object.prototype.hasOwnProperty.call(Ae.properties,Ue)&&delete Ae.properties[Ue];if(((we=fe.addOrUpdateProperties)===null||we===void 0?void 0:we.length)>0)for(const{key:Ue,value:Te}of fe.addOrUpdateProperties)Ae.properties[Ue]=Te}}(this._dataUpdateable,N.dataDiff,F),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(N){return P._(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 mn{constructor(N){this.self=N,this.actor=new P.H(N),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(V,F)=>{if(this.externalWorkerSourceTypes[V])throw new Error(`Worker source with name "${V}" already registered.`);this.externalWorkerSourceTypes[V]=F},this.self.addProtocol=P.cn,this.self.removeProtocol=P.co,this.self.registerRTLTextPlugin=V=>{P.cI.setMethods(V)},this.actor.registerMessageHandler("LDT",(V,F)=>this._getDEMWorkerSource(V,F.source).loadTile(F)),this.actor.registerMessageHandler("RDT",(V,F)=>P._(this,void 0,void 0,function*(){this._getDEMWorkerSource(V,F.source).removeTile(F)})),this.actor.registerMessageHandler("GCEZ",(V,F)=>P._(this,void 0,void 0,function*(){return this._getWorkerSource(V,F.type,F.source).getClusterExpansionZoom(F)})),this.actor.registerMessageHandler("GCC",(V,F)=>P._(this,void 0,void 0,function*(){return this._getWorkerSource(V,F.type,F.source).getClusterChildren(F)})),this.actor.registerMessageHandler("GCL",(V,F)=>P._(this,void 0,void 0,function*(){return this._getWorkerSource(V,F.type,F.source).getClusterLeaves(F)})),this.actor.registerMessageHandler("LD",(V,F)=>this._getWorkerSource(V,F.type,F.source).loadData(F)),this.actor.registerMessageHandler("GD",(V,F)=>this._getWorkerSource(V,F.type,F.source).getData()),this.actor.registerMessageHandler("LT",(V,F)=>this._getWorkerSource(V,F.type,F.source).loadTile(F)),this.actor.registerMessageHandler("RT",(V,F)=>this._getWorkerSource(V,F.type,F.source).reloadTile(F)),this.actor.registerMessageHandler("AT",(V,F)=>this._getWorkerSource(V,F.type,F.source).abortTile(F)),this.actor.registerMessageHandler("RMT",(V,F)=>this._getWorkerSource(V,F.type,F.source).removeTile(F)),this.actor.registerMessageHandler("RS",(V,F)=>P._(this,void 0,void 0,function*(){if(!this.workerSources[V]||!this.workerSources[V][F.type]||!this.workerSources[V][F.type][F.source])return;const J=this.workerSources[V][F.type][F.source];delete this.workerSources[V][F.type][F.source],J.removeSource!==void 0&&J.removeSource(F)})),this.actor.registerMessageHandler("RM",V=>P._(this,void 0,void 0,function*(){delete this.layerIndexes[V],delete this.availableImages[V],delete this.workerSources[V],delete this.demWorkerSources[V]})),this.actor.registerMessageHandler("SR",(V,F)=>P._(this,void 0,void 0,function*(){this.referrer=F})),this.actor.registerMessageHandler("SRPS",(V,F)=>this._syncRTLPluginState(V,F)),this.actor.registerMessageHandler("IS",(V,F)=>P._(this,void 0,void 0,function*(){this.self.importScripts(F)})),this.actor.registerMessageHandler("SI",(V,F)=>this._setImages(V,F)),this.actor.registerMessageHandler("UL",(V,F)=>P._(this,void 0,void 0,function*(){this._getLayerIndex(V).update(F.layers,F.removedIds)})),this.actor.registerMessageHandler("SL",(V,F)=>P._(this,void 0,void 0,function*(){this._getLayerIndex(V).replace(F)}))}_setImages(N,V){return P._(this,void 0,void 0,function*(){this.availableImages[N]=V;for(const F in this.workerSources[N]){const J=this.workerSources[N][F];for(const ce in J)J[ce].availableImages=V}})}_syncRTLPluginState(N,V){return P._(this,void 0,void 0,function*(){return yield P.cI.syncState(V,this.self.importScripts)})}_getAvailableImages(N){let V=this.availableImages[N];return V||(V=[]),V}_getLayerIndex(N){let V=this.layerIndexes[N];return V||(V=this.layerIndexes[N]=new o),V}_getWorkerSource(N,V,F){if(this.workerSources[N]||(this.workerSources[N]={}),this.workerSources[N][V]||(this.workerSources[N][V]={}),!this.workerSources[N][V][F]){const J={sendAsync:(ce,le)=>(ce.targetMapId=N,this.actor.sendAsync(ce,le))};switch(V){case"vector":this.workerSources[N][V][F]=new _e(J,this._getLayerIndex(N),this._getAvailableImages(N));break;case"geojson":this.workerSources[N][V][F]=new Ao(J,this._getLayerIndex(N),this._getAvailableImages(N));break;default:this.workerSources[N][V][F]=new this.externalWorkerSourceTypes[V](J,this._getLayerIndex(N),this._getAvailableImages(N))}}return this.workerSources[N][V][F]}_getDEMWorkerSource(N,V){return this.demWorkerSources[N]||(this.demWorkerSources[N]={}),this.demWorkerSources[N][V]||(this.demWorkerSources[N][V]=new ae),this.demWorkerSources[N][V]}}return P.i(self)&&(self.worker=new mn(self)),mn}),E("index",["exports","./shared"],function(P,o){var ue="5.3.0";function re(){var u=new o.A(4);return o.A!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}let ne,_e;const ae={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=>(ne||(ne=document.createElement("a")),ne.href=u,ne.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(_e==null&&(_e=matchMedia("(prefers-reduced-motion: reduce)")),_e.matches)}};class G{static testProp(e){if(!G.docStyle)return e[0];for(let i=0;i<e.length;i++)if(e[i]in G.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(){G.docStyle&&G.selectProp&&(G.userSelect=G.docStyle[G.selectProp],G.docStyle[G.selectProp]="none")}static enableDrag(){G.docStyle&&G.selectProp&&(G.docStyle[G.selectProp]=G.userSelect)}static setTransform(e,i){e.style[G.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",G.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",G.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",G.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=G.getScale(e);return G.getPoint(e,s,i)}static touchPos(e,i){const s=[],l=G.getScale(e);for(let h=0;h<i.length;h++)s.push(G.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 G.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)G.removeAttributes(s),G.clean(s)}static removeAttributes(e){for(const{name:i,value:s}of e.attributes)G.isPossiblyDangerous(i,s)&&e.removeAttribute(i)}}G.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,G.selectProp=G.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),G.transformProp=G.testProp(["transform","WebkitTransform"]);const ve={supported:!1,testSupport:function(u){!Qe&&Ke&&(ct?gt(u):Oe=u)}};let Oe,Ke,Qe=!1,ct=!1;function gt(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,Ke),u.isContextLost())return;ve.supported=!0}catch{}u.deleteTexture(e),Qe=!0}var pt;typeof document<"u"&&(Ke=document.createElement("img"),Ke.onload=()=>{Oe&&gt(Oe),Oe=null,ct=!0},Ke.onerror=()=>{Qe=!0,Oe=null},Ke.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=v=>{const T=s++;return l[T]=v,T},u.removeThrottleControl=v=>{delete l[v],f()},u.getImage=(v,T,C=!0)=>new Promise((A,k)=>{ve.supported&&(v.headers||(v.headers={}),v.headers.accept="image/webp,*/*"),o.e(v,{type:"image"}),e.push({abortController:T,requestParameters:v,supportImageRefresh:C,state:"queued",onError:O=>{k(O)},onSuccess:O=>{A(O)}}),f()});const h=v=>o._(this,void 0,void 0,function*(){v.state="running";const{requestParameters:T,supportImageRefresh:C,onError:A,onSuccess:k,abortController:O}=v,Z=C===!1&&!o.i(self)&&!o.g(T.url)&&(!T.headers||Object.keys(T.headers).reduce((H,K)=>H&&K==="accept",!0));i++;const W=Z?y(T,O):o.m(T,O);try{const H=yield W;delete v.abortController,v.state="completed",H.data instanceof HTMLImageElement||o.b(H.data)?k(H):H.data&&k({data:yield(q=H.data,typeof createImageBitmap=="function"?o.f(q):o.h(q)),cacheControl:H.cacheControl,expires:H.expires})}catch(H){delete v.abortController,A(H)}finally{i--,f()}var q}),f=()=>{const v=(()=>{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<v&&e.length>0;T++){const C=e.shift();C.abortController.signal.aborted?T--:h(C)}},y=(v,T)=>new Promise((C,A)=>{const k=new Image,O=v.url,Z=v.credentials;Z&&Z==="include"?k.crossOrigin="use-credentials":(Z&&Z==="same-origin"||!o.d(O))&&(k.crossOrigin="anonymous"),T.signal.addEventListener("abort",()=>{k.src="",A(o.c())}),k.fetchPriority="high",k.onload=()=>{k.onerror=k.onload=null,C({data:k})},k.onerror=()=>{k.onerror=k.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."))},k.src=O})}(pt||(pt={})),pt.resetRequestQueue();class Mt{constructor(e){this._transformRequestFn=e}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function kt(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 Et(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 wt{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:y}=this,{gl:v}=y;if(this.useMipmap=!!(i&&i.useMipmap),v.bindTexture(v.TEXTURE_2D,this.texture),y.pixelStoreUnpackFlipY.set(!1),y.pixelStoreUnpack.set(1),y.pixelStoreUnpackPremultiplyAlpha.set(this.format===v.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)?v.texImage2D(v.TEXTURE_2D,0,this.format,this.format,v.UNSIGNED_BYTE,e):v.texImage2D(v.TEXTURE_2D,0,this.format,l,h,0,this.format,v.UNSIGNED_BYTE,e.data);else{const{x:T,y:C}=s||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||o.b(e)?v.texSubImage2D(v.TEXTURE_2D,0,T,C,v.RGBA,v.UNSIGNED_BYTE,e):v.texSubImage2D(v.TEXTURE_2D,0,T,C,l,h,v.RGBA,v.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&v.generateMipmap(v.TEXTURE_2D)}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 Mi(u){const{userImage:e}=u;return!!(e&&e.render&&e.render())&&(u.data.replace(new Uint8Array(e.data.buffer)),!0)}class Wi 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 wt(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],y=f.x+1,v=f.y+1,T=this.getImage(h).data,C=T.width,A=T.height;o.R.copy(T,l,{x:0,y:0},{x:y,y:v},{width:C,height:A}),o.R.copy(T,l,{x:0,y:A-1},{x:y,y:v-1},{width:C,height:1}),o.R.copy(T,l,{x:0,y:0},{x:y,y:v+A},{width:C,height:1}),o.R.copy(T,l,{x:C-1,y:0},{x:y-1,y:v},{width:1,height:A}),o.R.copy(T,l,{x:0,y:0},{x:y+C,y:v},{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`),Mi(s)&&this.updateImage(i,s)}}}const Hi=1e20;function ut(u,e,i,s,l,h,f,y,v){for(let T=e;T<e+s;T++)Yt(u,i*h+T,h,l,f,y,v);for(let T=i;T<i+l;T++)Yt(u,T*h+e,1,s,f,y,v)}function Yt(u,e,i,s,l,h,f){h[0]=0,f[0]=-1e20,f[1]=Hi,l[0]=u[e];for(let y=1,v=0,T=0;y<s;y++){l[y]=u[e+y*i];const C=y*y;do{const A=h[v];T=(l[y]-l[A]+C-A*A)/(y-A)/2}while(T<=f[v]&&--v>-1);v++,h[v]=y,f[v]=T,f[v+1]=Hi}for(let y=0,v=0;y<s;y++){for(;f[v+1]<y;)v++;const T=h[v],C=y-T;u[e+y*i]=l[T]+C*C}}class Jt{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:y}of s)l[h]||(l[h]={}),l[h][f]=y&&{id:y.id,bitmap:y.bitmap.clone(),metrics:y.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 y=Jt.loadGlyphRange(e,h,this.url,this.requestManager);s.requests[h]=y}const f=yield s.requests[h];for(const y in f)this._doesCharSupportLocalGlyph(+y)||(s.glyphs[+y]=f[+y]);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 y="400";/bold/i.test(i)?y="900":/medium/i.test(i)?y="500":/light/i.test(i)&&(y="200"),h=e.tinySDF=new Jt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:l,fontWeight:y})}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}}}}Jt.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"),y=yield o.n(f,new AbortController);if(!y||!y.data)throw new Error(`Could not load glyph range. range: ${e}, ${l}-${h}`);const v={};for(const T of o.o(y.data))v[T.id]=T;return v})},Jt.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 y=this.size=u+4*e,v=this._createCanvas(y),T=this.ctx=v.getContext("2d",{willReadFrequently:!0});T.font=`${f} ${h} ${u}px ${l}`,T.textBaseline="alphabetic",T.textAlign="left",T.fillStyle="black",this.gridOuter=new Float64Array(y*y),this.gridInner=new Float64Array(y*y),this.f=new Float64Array(y),this.z=new Float64Array(y+1),this.v=new Uint16Array(y)}_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),y=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-l))),v=Math.min(this.size-this.buffer,f+Math.ceil(s)),T=y+2*this.buffer,C=v+2*this.buffer,A=Math.max(T*C,0),k=new Uint8ClampedArray(A),O={data:k,width:T,height:C,glyphWidth:y,glyphHeight:v,glyphTop:f,glyphLeft:0,glyphAdvance:e};if(y===0||v===0)return O;const{ctx:Z,buffer:W,gridInner:q,gridOuter:H}=this;Z.clearRect(W,W,y,v),Z.fillText(u,W,W+f);const K=Z.getImageData(W,W,y,v);H.fill(Hi,0,A),q.fill(0,0,A);for(let ee=0;ee<v;ee++)for(let te=0;te<y;te++){const ie=K.data[4*(ee*y+te)+3]/255;if(ie===0)continue;const he=(ee+W)*T+te+W;if(ie===1)H[he]=0,q[he]=Hi;else{const se=.5-ie;H[he]=se>0?se*se:0,q[he]=se<0?se*se:0}}ut(H,0,0,T,C,T,this.f,this.v,this.z),ut(q,W,W,y,v,T,this.f,this.v,this.z);for(let ee=0;ee<A;ee++){const te=Math.sqrt(H[ee])-Math.sqrt(q[ee]);k[ee]=Math.round(255-255*(te/this.radius+this.cutoff))}return O}};class cr{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 Dt;class vr extends o.E{constructor(e){super(),Dt=Dt||new o.r({anchor:new o.D(o.v.light.anchor),position:new cr,color:new o.D(o.v.light.color),intensity:new o.D(o.v.light.intensity)}),this._transitionable=new o.T(Dt),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 Fr=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 hn extends o.E{constructor(e){super(),this._transitionable=new o.T(Fr),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 lt{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,y=!0;l.push({left:h,right:f,isDash:y,zeroLength:e[0]===0});let v=e[0];for(let T=1;T<e.length;T++){y=!y;const C=e[T];h=v*s,v+=C,f=v*s,l.push({left:h,right:f,isDash:y,zeroLength:C===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 y=0,v=e[y];for(let T=0;T<this.width;T++){T/v.right>1&&(v=e[++y]);const C=Math.abs(T-v.left),A=Math.abs(T-v.right),k=Math.min(C,A);let O;const Z=h/s*(l+1);if(v.isDash){const W=l-Math.abs(Z);O=Math.sqrt(k*k+W*W)}else O=l-Math.sqrt(k*k+Z*Z);this.data[f+T]=Math.max(0,Math.min(255,O+128))}}}addRegularDash(e){for(let y=e.length-1;y>=0;--y){const v=e[y],T=e[y+1];v.zeroLength?e.splice(y,1):T&&T.isDash===v.isDash&&(T.left=v.left,e.splice(y,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 y=0;y<this.width;y++){y/f.right>1&&(f=e[++h]);const v=Math.abs(y-f.left),T=Math.abs(y-f.right),C=Math.min(v,T);this.data[l+y]=Math.max(0,Math.min(255,(f.isDash?C:-C)+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 y=0;y<e.length;y++)h+=e[y];if(h!==0){const y=this.width/h,v=this.getDashRanges(e,this.width,y);i?this.addRoundDash(v,y,s):this.addRegularDash(v)}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 qt="maplibre_preloaded_worker_pool";class Ii{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Ii.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[qt]}numActive(){return Object.keys(this.active).length}}const li=Math.floor(ae.hardwareConcurrency/2);let $t,ft;function Qt(){return $t||($t=new Ii),$t}Ii.workerCount=o.G(globalThis)?Math.max(Math.min(li,3),1):1;class Tt{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 Pt(){return ft||(ft=new Tt(Qt(),o.J),ft.registerMessageHandler("GR",(u,e,i)=>o.m(e,i))),ft}function rt(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 fi(u,e,i,s,l,h,f){var y;const v=function(k,O,Z){if(k)for(const W of k){const q=O[W];if(q&&q.source===Z&&q.type==="fill-extrusion")return!0}else for(const W in O){const q=O[W];if(q.source===Z&&q.type==="fill-extrusion")return!0}return!1}((y=l==null?void 0:l.layers)!==null&&y!==void 0?y:null,e,u.id),T=h.maxPitchScaleFactor(),C=u.tilesIn(s,T,v);C.sort(bi);const A=[];for(const k of C)A.push({wrappedTileID:k.tileID.wrapped().key,queryResults:k.tile.queryRenderedFeatures(e,i,u._state,k.queryGeometry,k.cameraQueryGeometry,k.scale,l,h,T,rt(u.transform,k.tileID),f?(O,Z)=>f(k.tileID,O,Z):void 0)});return function(k,O){for(const Z in k)for(const W of k[Z])Ci(W,O);return k}(function(k){const O={},Z={};for(const W of k){const q=W.queryResults,H=W.wrappedTileID,K=Z[H]=Z[H]||{};for(const ee in q){const te=q[ee],ie=K[ee]=K[ee]||{},he=O[ee]=O[ee]||[];for(const se of te)ie[se.featureIndex]||(ie[se.featureIndex]=!0,he.push(se))}}return O}(A),u)}function bi(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 Ci(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 dn(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 ae.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 wi{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 wi))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(wi.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 wi?e:e&&new wi(e)}static fromLngLat(e,i=0){const s=360*i/40075017,l=s/Math.cos(Math.PI/180*e.lat);return new wi(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 wi(e,e.lng>i.lng?new o.Q(i.lng+360,i.lat):i)}}class ca{constructor(e,i,s){this.bounds=wi.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 ua 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 dn(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 ca(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 dn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(o.e(this,i),i.bounds&&(this.tileBounds=new ca(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 pt.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 wt(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 On 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 pt.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),y={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 v=yield e.actor.sendAsync({type:"LDT",data:y});e.dem=v,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 ae.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,y=i.x+1===s?e.wrap+1:e.wrap,v={};return v[new o.Y(e.overscaledZ,h,i.z,l,i.y).key]={backfilled:!1},v[new o.Y(e.overscaledZ,y,i.z,f,i.y).key]={backfilled:!1},i.y>0&&(v[new o.Y(e.overscaledZ,h,i.z,l,i.y-1).key]={backfilled:!1},v[new o.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},v[new o.Y(e.overscaledZ,y,i.z,f,i.y-1).key]={backfilled:!1}),i.y+1<s&&(v[new o.Y(e.overscaledZ,h,i.z,l,i.y+1).key]={backfilled:!1},v[new o.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},v[new o.Y(e.overscaledZ,y,i.z,f,i.y+1).key]={backfilled:!1}),v}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 jn 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 wi,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(ae.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 Or 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 pt.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,y=-1/0,v=-1/0;for(const k of l)h=Math.min(h,k.x),f=Math.min(f,k.y),y=Math.max(y,k.x),v=Math.max(v,k.y);const T=Math.max(y-h,v-f),C=Math.max(0,Math.floor(-Math.log(T)/Math.LN2)),A=Math.pow(2,C);return new o.a1(C,Math.floor((h+y)/2*A),Math.floor((f+v)/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 wt(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 y of e)i=Math.min(i,y.x),s=Math.min(s,y.y),l=Math.max(l,y.x),h=Math.max(h,y.y);const f={};for(let y=0;y<=o.a0;y++){const v=Math.pow(2,y),T=Math.floor(i*v),C=Math.floor(s*v),A=Math.floor(l*v),k=Math.floor(h*v);f[y]={minTileX:T,minTileY:C,maxTileX:A,maxTileY:k}}return f}}class jr extends Or{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 wt(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 Za extends Or{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 wt(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 Va={},Rs=u=>{switch(u){case"geojson":return jn;case"image":return Or;case"raster":return Br;case"raster-dem":return On;case"vector":return ua;case"video":return jr;case"canvas":return Za}return Va[u]},ha="RTLPluginLoaded";class Nn extends o.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Pt()}_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=ae.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(ha))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Ua=null;function pn(){return Ua||(Ua=new Nn),Ua}class Yr{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 y of l){const v=y.layerIds.map(T=>h.getLayer(T)).filter(Boolean);if(v.length!==0){y.layers=v,y.stateDependentLayerIds&&(y.stateDependentLayers=y.stateDependentLayerIds.map(T=>v.filter(C=>C.id===T)[0]));for(const T of v)f[T.id]=y}}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,pn().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 wt(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new wt(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,y,v,T,C,A){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:l,cameraQueryGeometry:h,scale:f,tileSize:this.tileSize,pixelPosMatrix:C,transform:v,params:y,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 y=o.a7(i&&i.filter),{z:v,x:T,y:C}=this.tileID.canonical,A={z:v,x:T,y:C};for(let k=0;k<f.length;k++){const O=f.feature(k);if(y.needGeometry){const q=o.a8(O,!0);if(!y.filter(new o.C(this.tileID.overscaledZ),q,this.tileID.canonical))continue}else if(!y.filter(new o.C(this.tileID.overscaledZ),O))continue;const Z=s.getId(O,h),W=new o.a9(O,v,T,C,Z);W.tile=A,e.push(W)}}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",y=s[f],v=e[f];if(!y||!v||Object.keys(v).length===0)continue;h.update(v,y,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<ae.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=ae.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 fn{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 $a{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 y of Object.keys(this.deletedStates[l][f]))delete this.state[l][f][y];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)}}function Ds(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 Ao(u,e,i,s,l){let h=u;const f=Math.atan(e/i),y=Math.hypot(e,i);return h=u+o.ab(s/y/Math.max(.5,Math.cos(o.ad(l/2)))),h+=1*o.ab(Math.cos(f))/2,h+=o.ae(u-h,-0,0),h}function mn(u,e){const i=(e.roundZoom?Math.round:Math.floor)(u.zoom+o.ab(u.tileSize/e.tileSize));return Math.max(0,i)}function pe(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(),y=f.allowVariableZoom(u,e),v=mn(u,e),T=e.minzoom||0,C=e.maxzoom!==void 0?e.maxzoom:u.maxZoom,A=Math.min(Math.max(0,v),C),k=Math.pow(2,A),O=[k*l.x,k*l.y,0],Z=[k*h.x,k*h.y,0],W=Math.hypot(h.x-l.x,h.y-l.y),q=Math.abs(h.z-l.z),H=Math.hypot(W,q),K=ie=>({zoom:0,x:0,y:0,wrap:ie,fullyVisible:!1}),ee=[],te=[];if(u.renderWorldCopies&&f.allowWorldCopies())for(let ie=1;ie<=3;ie++)ee.push(K(-ie)),ee.push(K(ie));for(ee.push(K(0));ee.length>0;){const ie=ee.pop(),he=ie.x,se=ie.y;let ye=ie.fullyVisible;const ge={x:he,y:se,z:ie.zoom},Ie=f.getTileAABB(ge,ie.wrap,u.elevation,e);if(!ye){const Be=Ds(i,Ie,s);if(Be===0)continue;ye=Be===2}const ke=f.distanceToTile2d(l.x,l.y,ge,Ie);let Se=v;y&&(Se=(e.calculateTileZoom||Ao)(u.zoom+o.ab(u.tileSize/e.tileSize),ke,q,H,u.fov)),Se=(e.roundZoom?Math.round:Math.floor)(Se),Se=Math.max(0,Se);const Ne=Math.min(Se,C);if(ie.wrap=f.getWrap(h,ge,ie.wrap),ie.zoom>=Ne){if(ie.zoom<T)continue;const Be=A-ie.zoom,Ee=O[0]-.5-(he<<Be),Xe=O[1]-.5-(se<<Be),xt=e.reparseOverscaled?Math.max(ie.zoom,Se):ie.zoom;te.push({tileID:new o.Y(ie.zoom===C?xt:ie.zoom,ie.wrap,ie.zoom,he,se),distanceSq:o.ac([Z[0]-.5-he,Z[1]-.5-se]),tileDistanceToCamera:Math.sqrt(Ee*Ee+Xe*Xe)})}else for(let Be=0;Be<4;Be++)ee.push({zoom:ie.zoom+1,x:(he<<1)+Be%2,y:(se<<1)+(Be>>1),wrap:ie.wrap,fullyVisible:ye})}return te.sort((ie,he)=>ie.distanceSq-he.distanceSq).map(ie=>ie.tileID)}class N 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,y)=>{const v=new(Rs(h.type))(l,h,f,y);if(v.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${v.id}`);return v})(e,i,s,this),this._tiles={},this._cache=new fn(0,l=>this._unloadTile(l)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new $a,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(V).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,y=new o.P(h.canonical.x,h.canonical.y)._rotate(-this.transform.bearingInRadians),v=new o.P(f.canonical.x,f.canonical.y)._rotate(-this.transform.bearingInRadians);return h.overscaledZ-f.overscaledZ||v.y-y.y||v.x-y.x}).map(s=>s.tileID.key):i.map(s=>s.tileID).sort(V).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=ae.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 y=h.tileID.canonical.y-l.tileID.canonical.y,v=Math.pow(2,l.tileID.canonical.z),T=h.tileID.key;f===0&&y===0||Math.abs(y)>1||(Math.abs(f)>1&&(Math.abs(f+v)===1?f+=v:Math.abs(f-v)===1&&(f-=v)),h.dem&&l.dem&&(l.dem.backfillBorder(h.dem,f,y),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 y=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()&&(y=T)}let v=y;for(;v.overscaledZ>i;)if(v=v.scaledTo(v.overscaledZ-1),e[v.key]||e[v.canonical.key]){l[y.key]=y;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 y={},v={},T=Object.keys(e),C=ae.now();for(const A of T){const k=e[A],O=this._tiles[A];if(!O||O.fadeEndTime!==0&&O.fadeEndTime<=C)continue;const Z=this.findLoadedParent(k,i),W=this.findLoadedSibling(k),q=Z||W||null;q&&(this._addTile(q.tileID),y[q.tileID.key]=q.tileID),v[A]=k}this._retainLoadedChildren(v,l,s,e);for(const A in y)e[A]||(this._coveredTiles[A]=!0,e[A]=y[A]);if(f){const A={},k={};for(const O of h)this._tiles[O.key].hasData()?A[O.key]=O:k[O.key]=O;for(const O in k){const Z=k[O].children(this._source.maxzoom);this._tiles[Z[0].key]&&this._tiles[Z[1].key]&&this._tiles[Z[2].key]&&this._tiles[Z[3].key]&&(A[Z[0].key]=e[Z[0].key]=Z[0],A[Z[1].key]=e[Z[1].key]=Z[1],A[Z[2].key]=e[Z[2].key]=Z[2],A[Z[3].key]=e[Z[3].key]=Z[3],delete k[O])}for(const O in k){const Z=k[O],W=this.findLoadedParent(Z,this._source.minzoom),q=this.findLoadedSibling(Z),H=W||q||null;if(H){A[H.tileID.key]=e[H.tileID.key]=H.tileID;for(const K in A)A[K].isChildOf(H.tileID)&&delete A[K]}}for(const O in this._tiles)A[O]||(this._coveredTiles[O]=!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(C=>new o.Y(C.canonical.z,C.wrap,C.canonical.z,C.canonical.x,C.canonical.y)):(s=pe(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(C=>this._source.hasTile(C)))):s=[];const l=mn(e,this._source),h=Math.max(l-N.maxOverzooming,this._source.minzoom),f=Math.max(l+N.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const C={};for(const A of s)if(A.canonical.z>this._source.minzoom){const k=A.scaledTo(A.canonical.z-1);C[k.key]=k;const O=A.scaledTo(Math.max(this._source.minzoom,Math.min(A.canonical.z,5)));C[O.key]=O}s=s.concat(Object.values(C))}const y=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,y&&this.fire(new o.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const v=this._updateRetainedTiles(s,l);F(this._source.type)&&this._updateCoveredAndRetainedTiles(v,h,f,l,s,i);for(const C in v)this._tiles[C].clearFadeHold();const T=o.af(this._tiles,v);for(const C of T){const A=this._tiles[C];A.hasSymbolBuckets&&!A.holdingForFade()?A.setHoldDuration(this.map._fadeDuration):A.hasSymbolBuckets&&!A.symbolFadeFinished()||this._removeTile(C)}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-N.maxOverzooming,this._source.minzoom),y=Math.max(i+N.maxUnderzooming,this._source.minzoom),v={};for(const T of e){const C=this._addTile(T);l[T.key]=T,C.hasData()||i<this._source.maxzoom&&(v[T.key]=T)}this._retainLoadedChildren(v,i,y,l);for(const T of e){let C=this._tiles[T.key];if(C.hasData())continue;if(i+1>this._source.maxzoom){const k=T.children(this._source.maxzoom)[0],O=this.getTile(k);if(O&&O.hasData()){l[k.key]=k;continue}}else{const k=T.children(this._source.maxzoom);if(l[k[0].key]&&l[k[1].key]&&l[k[2].key]&&l[k[3].key])continue}let A=C.wasRequested();for(let k=T.overscaledZ-1;k>=f;--k){const O=T.scaledTo(k);if(h[O.key])break;if(h[O.key]=!0,C=this.getTile(O),!C&&A&&(C=this._addTile(O)),C){const Z=C.hasData();if((Z||!(!((s=this.map)===null||s===void 0)&&s.cancelPendingTileRequestsWhileZooming)||A)&&(l[O.key]=O),A=C.wasRequested(),Z)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 Yr(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))}_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,y=e.map(Z=>h.screenPointToMercatorCoordinate(Z,this.terrain)),v=f.map(Z=>h.screenPointToMercatorCoordinate(Z,this.terrain)),T=this.getIds();let C=1/0,A=1/0,k=-1/0,O=-1/0;for(const Z of v)C=Math.min(C,Z.x),A=Math.min(A,Z.y),k=Math.max(k,Z.x),O=Math.max(O,Z.y);for(let Z=0;Z<T.length;Z++){const W=this._tiles[T[Z]];if(W.holdingForFade())continue;const q=W.tileID,H=Math.pow(2,h.zoom-W.tileID.overscaledZ),K=i*W.queryPadding*o.Z/W.tileSize/H,ee=[q.getTilePoint(new o.$(C,A)),q.getTilePoint(new o.$(k,O))];if(ee[0].x-K<o.Z&&ee[0].y-K<o.Z&&ee[1].x+K>=0&&ee[1].y+K>=0){const te=y.map(he=>q.getTilePoint(he)),ie=v.map(he=>q.getTilePoint(he));l.push({tile:W,tileID:q,queryGeometry:te,cameraQueryGeometry:ie,scale:H})}}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(F(this._source.type)){const e=ae.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 V(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 F(u){return u==="raster"||u==="image"||u==="video"}N.maxOverzooming=10,N.maxUnderzooming=3;class J{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],y=s-f,v=y>0?(l-f)/y:0;return this.points[h].mult(1-v).add(this.points[i].mult(v))}}function ce(u,e){let i=!0;return u==="always"||u!=="never"&&e!=="never"||(i=!1),i}class le{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,y){if(s<0||e>this.width||l<0||i>this.height)return[];const v=[];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++)v.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 C=this.circles[3*T],A=this.circles[3*T+1],k=this.circles[3*T+2];v.push({key:this.circleKeys[T],x1:C-k,y1:A-k,x2:C+k,y2:A+k})}}else this._forEachCell(e,i,s,l,this._queryCell,v,{hitTest:h,overlapMode:f,seenUids:{box:{},circle:{}}},y);return v}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,y=e+s,v=i-s,T=i+s;if(y<0||f>this.width||T<0||v>this.height)return!1;const C=[];return this._forEachCell(f,v,y,T,this._queryCellCircle,C,{hitTest:!0,overlapMode:l,circle:{x:e,y:i,radius:s},seenUids:{box:{},circle:{}}},h),C.length>0}_queryCell(e,i,s,l,h,f,y,v){const{seenUids:T,hitTest:C,overlapMode:A}=y,k=this.boxCells[h];if(k!==null){const Z=this.bboxes;for(const W of k)if(!T.box[W]){T.box[W]=!0;const q=4*W,H=this.boxKeys[W];if(e<=Z[q+2]&&i<=Z[q+3]&&s>=Z[q+0]&&l>=Z[q+1]&&(!v||v(H))&&(!C||!ce(A,H.overlapMode))&&(f.push({key:H,x1:Z[q],y1:Z[q+1],x2:Z[q+2],y2:Z[q+3]}),C))return!0}}const O=this.circleCells[h];if(O!==null){const Z=this.circles;for(const W of O)if(!T.circle[W]){T.circle[W]=!0;const q=3*W,H=this.circleKeys[W];if(this._circleAndRectCollide(Z[q],Z[q+1],Z[q+2],e,i,s,l)&&(!v||v(H))&&(!C||!ce(A,H.overlapMode))){const K=Z[q],ee=Z[q+1],te=Z[q+2];if(f.push({key:H,x1:K-te,y1:ee-te,x2:K+te,y2:ee+te}),C)return!0}}}return!1}_queryCellCircle(e,i,s,l,h,f,y,v){const{circle:T,seenUids:C,overlapMode:A}=y,k=this.boxCells[h];if(k!==null){const Z=this.bboxes;for(const W of k)if(!C.box[W]){C.box[W]=!0;const q=4*W,H=this.boxKeys[W];if(this._circleAndRectCollide(T.x,T.y,T.radius,Z[q+0],Z[q+1],Z[q+2],Z[q+3])&&(!v||v(H))&&!ce(A,H.overlapMode))return f.push(!0),!0}}const O=this.circleCells[h];if(O!==null){const Z=this.circles;for(const W of O)if(!C.circle[W]){C.circle[W]=!0;const q=3*W,H=this.circleKeys[W];if(this._circlesCollide(Z[q],Z[q+1],Z[q+2],T.x,T.y,T.radius)&&(!v||v(H))&&!ce(A,H.overlapMode))return f.push(!0),!0}}}_forEachCell(e,i,s,l,h,f,y,v){const T=this._convertToXCellCoord(e),C=this._convertToYCellCoord(i),A=this._convertToXCellCoord(s),k=this._convertToYCellCoord(l);for(let O=T;O<=A;O++)for(let Z=C;Z<=k;Z++)if(h.call(this,e,i,s,l,this.xCellCount*Z+O,f,y,v))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 y=l-e,v=h-i,T=s+f;return T*T>y*y+v*v}_circleAndRectCollide(e,i,s,l,h,f,y){const v=(f-l)/2,T=Math.abs(e-(l+v));if(T>v+s)return!1;const C=(y-h)/2,A=Math.abs(i-(h+C));if(A>C+s)return!1;if(T<=v||A<=C)return!0;const k=T-v,O=A-C;return k*k+O*O<=s*s}}function me(u,e,i){const s=o.K();if(!u){const{vecSouth:A,vecEast:k}=Me(e),O=re();O[0]=k[0],O[1]=k[1],O[2]=A[0],O[3]=A[1],l=O,(C=(f=(h=O)[0])*(T=h[3])-(v=h[2])*(y=h[1]))&&(l[0]=T*(C=1/C),l[1]=-y*C,l[2]=-v*C,l[3]=f*C),s[0]=O[0],s[1]=O[1],s[4]=O[2],s[5]=O[3]}var l,h,f,y,v,T,C;return o.M(s,s,[1/i,1/i,1]),s}function de(u,e,i,s){if(u){const l=o.K();if(!e){const{vecSouth:h,vecEast:f}=Me(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 Me(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.ak();f[0]=-l*s*i-h*e,f[1]=-h*s*i+l*e;const y=o.al(f);y<1e-9?o.am(f):o.an(f,f,1/y);const v=o.ak();v[0]=l*s*e-h*i,v[1]=h*s*e+l*i;const T=o.al(v);return T<1e-9?o.am(v):o.an(v,v,1/T),{vecEast:v,vecSouth:f}}function we(u,e,i,s){let l;s?(l=[u,e,s(u,e),1],o.ap(l,l,i)):(l=[u,e,0,1],Fi(l,l,i));const h=l[3];return{point:new o.P(l[0]/h,l[1]/h),signedDistanceFromCamera:h,isOccluded:!1}}function fe(u,e){return .5+u/e*.5}function Ae(u,e){return u.x>=-e[0]&&u.x<=e[0]&&u.y>=-e[1]&&u.y<=e[1]}function Ve(u,e,i,s,l,h,f,y,v,T,C,A,k){const O=i?u.textSizeData:u.iconSizeData,Z=o.ag(O,e.transform.zoom),W=[256/e.width*2+1,256/e.height*2+1],q=i?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;q.clear();const H=u.lineVertexArray,K=i?u.text.placedSymbolArray:u.icon.placedSymbolArray,ee=e.transform.width/e.transform.height;let te=!1;for(let ie=0;ie<K.length;ie++){const he=K.get(ie);if(he.hidden||he.writingMode===o.ah.vertical&&!te){ot(he.numGlyphs,q);continue}te=!1;const se=new o.P(he.anchorX,he.anchorY),ye={getElevation:k,pitchedLabelPlaneMatrix:s,lineVertexArray:H,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:se,unwrappedTileID:v,width:T,height:C,translation:A},ge=He(he.anchorX,he.anchorY,ye);if(!Ae(ge.point,W)){ot(he.numGlyphs,q);continue}const Ie=fe(e.transform.cameraToCenterDistance,ge.signedDistanceFromCamera),ke=o.ai(O,Z,he),Se=h?ke*e.transform.getPitchedTextCorrection(he.anchorX,he.anchorY,v)/Ie:ke*Ie,Ne=dt({projectionContext:ye,pitchedLabelPlaneMatrixInverse:l,symbol:he,fontSize:Se,flip:!1,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:ee,rotateToLine:y});te=Ne.useVertical,(Ne.notEnoughRoom||te||Ne.needsFlipping&&dt({projectionContext:ye,pitchedLabelPlaneMatrixInverse:l,symbol:he,fontSize:Se,flip:!0,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:ee,rotateToLine:y}).notEnoughRoom)&&ot(he.numGlyphs,q)}i?u.text.dynamicLayoutVertexBuffer.updateData(q):u.icon.dynamicLayoutVertexBuffer.updateData(q)}function Ue(u,e,i,s,l,h,f,y){const v=h.glyphStartIndex+h.numGlyphs,T=h.lineStartIndex,C=h.lineStartIndex+h.lineLength,A=e.getoffsetX(h.glyphStartIndex),k=e.getoffsetX(v-1),O=mi(u*A,i,s,l,h.segment,T,C,y,f);if(!O)return null;const Z=mi(u*k,i,s,l,h.segment,T,C,y,f);return Z?y.projectionCache.anyProjectionOccluded?null:{first:O,last:Z}:null}function Te(u,e,i,s){return u===o.ah.horizontal&&Math.abs(i.y-e.y)>Math.abs(i.x-e.x)*s?{useVertical:!0}:(u===o.ah.vertical?e.y<i.y:e.x>i.x)?{needsFlipping:!0}:null}function dt(u){const{projectionContext:e,pitchedLabelPlaneMatrixInverse:i,symbol:s,fontSize:l,flip:h,keepUpright:f,glyphOffsetArray:y,dynamicLayoutVertexArray:v,aspectRatio:T,rotateToLine:C}=u,A=l/24,k=s.lineOffsetX*A,O=s.lineOffsetY*A;let Z;if(s.numGlyphs>1){const W=s.glyphStartIndex+s.numGlyphs,q=s.lineStartIndex,H=s.lineStartIndex+s.lineLength,K=Ue(A,y,k,O,h,s,C,e);if(!K)return{notEnoughRoom:!0};const ee=De(K.first.point.x,K.first.point.y,e,i),te=De(K.last.point.x,K.last.point.y,e,i);if(f&&!h){const ie=Te(s.writingMode,ee,te,T);if(ie)return ie}Z=[K.first];for(let ie=s.glyphStartIndex+1;ie<W-1;ie++)Z.push(mi(A*y.getoffsetX(ie),k,O,h,s.segment,q,H,e,C));Z.push(K.last)}else{if(f&&!h){const q=Lt(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,H=s.lineStartIndex+s.segment+1,K=new o.P(e.lineVertexArray.getx(H),e.lineVertexArray.gety(H)),ee=Lt(K.x,K.y,e),te=ee.signedDistanceFromCamera>0?ee.point:it(e.tileAnchorPoint,K,q,1,e),ie=De(q.x,q.y,e,i),he=De(te.x,te.y,e,i),se=Te(s.writingMode,ie,he,T);if(se)return se}const W=mi(A*y.getoffsetX(s.glyphStartIndex),k,O,h,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,e,C);if(!W||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};Z=[W]}for(const W of Z)o.ao(v,W.point,W.angle);return{}}function it(u,e,i,s,l){const h=u.add(u.sub(e)._unit()),f=Lt(h.x,h.y,l).point,y=i.sub(f);return i.add(y._mult(s/y.mag()))}function ht(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=Lt(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 it(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 Lt(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 De(u,e,i,s){if(i.pitchWithMap){const l=[u,e,0,1];return o.ap(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 He(u,e,i){return i.transform.projectTileCoordinates(u,e,i.unwrappedTileID,i.getElevation)}function Ze(u,e,i){return u._unit()._perp()._mult(e*i)}function _t(u,e,i,s,l,h,f,y,v){if(y.projectionCache.offsets[u])return y.projectionCache.offsets[u];const T=i.add(e);if(u+v.direction<s||u+v.direction>=l)return y.projectionCache.offsets[u]=T,T;const C=ht(u+v.direction,y,v),A=Ze(C.sub(i),f,v.direction),k=i.add(A),O=C.add(A);return y.projectionCache.offsets[u]=o.aq(h,T,k,O)||T,y.projectionCache.offsets[u]}function mi(u,e,i,s,l,h,f,y,v){const T=s?u-e:u+e;let C=T>0?1:-1,A=0;s&&(C*=-1,A=Math.PI),C<0&&(A+=Math.PI);let k,O=C>0?h+l:h+l+1;y.projectionCache.cachedAnchorPoint?k=y.projectionCache.cachedAnchorPoint:(k=Lt(y.tileAnchorPoint.x,y.tileAnchorPoint.y,y).point,y.projectionCache.cachedAnchorPoint=k);let Z,W,q=k,H=k,K=0,ee=0;const te=Math.abs(T),ie=[];let he;for(;K+ee<=te;){if(O+=C,O<h||O>=f)return null;K+=ee,H=q,W=Z;const ge={absOffsetX:te,direction:C,distanceFromAnchor:K,previousVertex:H};if(q=ht(O,y,ge),i===0)ie.push(H),he=q.sub(H);else{let Ie;const ke=q.sub(H);Ie=ke.mag()===0?Ze(ht(O+C,y,ge).sub(q),i,C):Ze(ke,i,C),W||(W=H.add(Ie)),Z=_t(O,Ie,q,h,f,W,i,y,ge),ie.push(W),he=Z.sub(W)}ee=he.mag()}const se=he._mult((te-K)/ee)._add(W||H),ye=A+Math.atan2(q.y-H.y,q.x-H.x);return ie.push(se),{point:se,angle:v?ye:0,path:ie}}const gn=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ot(u,e){for(let i=0;i<u;i++){const s=e.length;e.resize(s+4),e.float32.set(gn,3*s)}}function Fi(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 ii=100;class zo{constructor(e,i=new le(e.width+200,e.height+200,25),s=new le(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+ii,this.screenBottomBoundary=e.height+ii,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,i,s,l,h,f,y,v,T,C,A,k){const O=this.projectAndGetPerspectiveRatio(e.anchorPointX+v[0],e.anchorPointY+v[1],h,C,k),Z=s*O.perspectiveRatio;let W;if(f||y)W=this._projectCollisionBox(e,Z,l,h,f,y,v,O,C,A,k);else{const he=O.x+(A?A.x*Z:0),se=O.y+(A?A.y*Z:0);W={allPointsOccluded:!1,box:[he+e.x1*Z,se+e.y1*Z,he+e.x2*Z,se+e.y2*Z]}}const[q,H,K,ee]=W.box,te=f?W.allPointsOccluded:O.isOccluded;let ie=te;return ie||(ie=O.perspectiveRatio<this.perspectiveRatioCutoff),ie||(ie=!this.isInsideGrid(q,H,K,ee)),ie||i!=="always"&&this.grid.hitTest(q,H,K,ee,i,T)?{box:[q,H,K,ee],placeable:!1,offscreen:!1,occluded:te}:{box:[q,H,K,ee],placeable:!0,offscreen:this.isOffscreen(q,H,K,ee),occluded:te}}placeCollisionCircles(e,i,s,l,h,f,y,v,T,C,A,k,O,Z){const W=[],q=new o.P(i.anchorX,i.anchorY),H=this.getPerspectiveRatio(q.x,q.y,f,Z),K=(T?h*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,f)/H:h*H)/o.av,ee={getElevation:Z,pitchedLabelPlaneMatrix:y,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:O},te=Ue(K,l,i.lineOffsetX*K,i.lineOffsetY*K,!1,i,!1,ee);let ie=!1,he=!1,se=!0;if(te){const ye=.5*A*H+k,ge=new o.P(-100,-100),Ie=new o.P(this.screenRightBoundary,this.screenBottomBoundary),ke=new J,Se=te.first,Ne=te.last;let Be=[];for(let xt=Se.path.length-1;xt>=1;xt--)Be.push(Se.path[xt]);for(let xt=1;xt<Ne.path.length;xt++)Be.push(Ne.path[xt]);const Ee=2.5*ye;if(T){const xt=this.projectPathToScreenSpace(Be,ee);Be=xt.some(Nt=>Nt.signedDistanceFromCamera<=0)?[]:xt.map(Nt=>Nt.point)}let Xe=[];if(Be.length>0){const xt=Be[0].clone(),Nt=Be[0].clone();for(let bt=1;bt<Be.length;bt++)xt.x=Math.min(xt.x,Be[bt].x),xt.y=Math.min(xt.y,Be[bt].y),Nt.x=Math.max(Nt.x,Be[bt].x),Nt.y=Math.max(Nt.y,Be[bt].y);Xe=xt.x>=ge.x&&Nt.x<=Ie.x&&xt.y>=ge.y&&Nt.y<=Ie.y?[Be]:Nt.x<ge.x||xt.x>Ie.x||Nt.y<ge.y||xt.y>Ie.y?[]:o.ar([Be],ge.x,ge.y,Ie.x,Ie.y)}for(const xt of Xe){ke.reset(xt,.25*ye);let Nt=0;Nt=ke.length<=.5*ye?1:Math.ceil(ke.paddedLength/Ee)+1;for(let bt=0;bt<Nt;bt++){const Wt=bt/Math.max(Nt-1,1),ei=ke.lerp(Wt),ai=ei.x+ii,Gt=ei.y+ii;W.push(ai,Gt,ye,0);const Ht=ai-ye,ki=Gt-ye,Oi=ai+ye,Vi=Gt+ye;if(se=se&&this.isOffscreen(Ht,ki,Oi,Vi),he=he||this.isInsideGrid(Ht,ki,Oi,Vi),e!=="always"&&this.grid.hitTestCircle(ai,Gt,ye,e,C)&&(ie=!0,!v))return{circles:[],offscreen:!1,collisionDetected:ie}}}}return{circles:!v&&ie||!he||H<this.perspectiveRatioCutoff?[]:W,offscreen:se,collisionDetected:ie}}projectPathToScreenSpace(e,i){const s=function(l,h){const f=o.K();return o.aj(f,h.pitchedLabelPlaneMatrix),l.map(y=>{const v=we(y.x,y.y,f,h.getElevation),T=h.transform.projectTileCoordinates(v.point.x,v.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,y=0,v=0;for(let T=0;T<l.length;T++)l[T].isOccluded?(y=T+1,v=0):(v++,v>f&&(f=v,h=y));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 C of e){const A=new o.P(C.x+ii,C.y+ii);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 y=this.grid.query(s,l,h,f).concat(this.ignoredGrid.query(s,l,h,f)),v={},T={};for(const C of y){const A=C.key;if(v[A.bucketInstanceId]===void 0&&(v[A.bucketInstanceId]={}),v[A.bucketInstanceId][A.featureIndex])continue;const k=[new o.P(C.x1,C.y1),new o.P(C.x2,C.y1),new o.P(C.x2,C.y2),new o.P(C.x1,C.y2)];o.as(i,k)&&(v[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 y=s?this.ignoredGrid:this.grid,v={bucketInstanceId:l,featureIndex:h,collisionGroupID:f,overlapMode:i};for(let T=0;T<e.length;T+=4)y.insertCircle(v,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.ap(f,f,h)):(f=[e,i,0,1],Fi(f,f,h));const y=f[3];return{x:(f[0]/y+1)/2*this.transform.width+ii,y:(-f[1]/y+1)/2*this.transform.height+ii,perspectiveRatio:.5+this.transform.cameraToCenterDistance/y*.5,isOccluded:!1,signedDistanceFromCamera:y}}{const f=this.transform.projectTileCoordinates(e,i,s,l);return{x:(f.point.x+1)/2*this.transform.width+ii,y:(1-f.point.y)/2*this.transform.height+ii,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<ii||e>=this.screenRightBoundary||l<ii||i>this.screenBottomBoundary}isInsideGrid(e,i,s,l){return s>=0&&e<this.gridRightBoundary&&l>=0&&i<this.gridBottomBoundary}getViewportMatrix(){const e=o.at([]);return o.L(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,s,l,h,f,y,v,T,C,A){let k=1,O=0,Z=0,W=1;const q=e.anchorPointX+y[0],H=e.anchorPointY+y[1];if(f&&!h){const Be=this.projectAndGetPerspectiveRatio(q+1,H,l,T,A),Ee=Be.x-v.x,Xe=Math.atan((Be.y-v.y)/Ee)+(Ee<0?Math.PI:0),xt=Math.sin(Xe),Nt=Math.cos(Xe);k=Nt,O=xt,Z=-xt,W=Nt}else if(!f&&h){const Be=Me(this.transform);k=Be.vecEast[0],O=Be.vecEast[1],Z=Be.vecSouth[0],W=Be.vecSouth[1]}let K=v.x,ee=v.y,te=i;h&&(K=q,ee=H,te=Math.pow(2,-(this.transform.zoom-s.overscaledZ)),te*=this.transform.getPitchedTextCorrection(q,H,l),C||(te*=o.ae(.5+v.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),C&&(K+=k*C.x*te+Z*C.y*te,ee+=O*C.x*te+W*C.y*te);const ie=e.x1*te,he=e.x2*te,se=(ie+he)/2,ye=e.y1*te,ge=e.y2*te,Ie=(ye+ge)/2,ke=[{offsetX:ie,offsetY:ye},{offsetX:se,offsetY:ye},{offsetX:he,offsetY:ye},{offsetX:he,offsetY:Ie},{offsetX:he,offsetY:ge},{offsetX:se,offsetY:ge},{offsetX:ie,offsetY:ge},{offsetX:ie,offsetY:Ie}];let Se=[];for(const{offsetX:Be,offsetY:Ee}of ke)Se.push(new o.P(K+k*Be+Z*Ee,ee+O*Be+W*Ee));let Ne=!1;if(h){const Be=Se.map(Ee=>this.projectAndGetPerspectiveRatio(Ee.x,Ee.y,l,T,A));Ne=Be.some(Ee=>!Ee.isOccluded),Se=Be.map(Ee=>new o.P(Ee.x,Ee.y))}else Ne=!0;return{box:o.au(Se),allPointsOccluded:!Ne}}}class Ga{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 Zn{constructor(e,i,s,l,h){this.text=new Ga(e?e.text:null,i,s,h),this.icon=new Ga(e?e.icon:null,i,l,h)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ur{constructor(e,i,s){this.text=e,this.icon=i,this.skipFade=s}}class di{constructor(e,i,s,l,h){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=s,this.bucketIndex=l,this.tileID=h}}class Wd{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 qa(u,e,i,s,l){const{horizontalAlign:h,verticalAlign:f}=o.aB(u);return new o.P(-(h-.5)*e+s[0]*l,-(f-.5)*i+s[1]*l)}class lc{constructor(e,i,s,l,h){this.transform=e.clone(),this.terrain=i,this.collisionIndex=new zo(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Wd(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 y=s.collisionBoxArray,v=h.layers[0].layout,T=h.layers[0].paint,C=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),A=s.tileSize/o.Z,k=s.tileID.toUnwrapped(),O=v.get("text-rotation-alignment")==="map",Z=o.aw(s,1,this.transform.zoom),W=o.ax(this.collisionIndex.transform,s,T.get("text-translate"),T.get("text-translate-anchor")),q=o.ax(this.collisionIndex.transform,s,T.get("icon-translate"),T.get("icon-translate-anchor")),H=me(O,this.transform,Z);this.retainedQueryData[h.bucketInstanceId]=new di(h.bucketInstanceId,f,h.sourceLayerIndex,h.index,s.tileID);const K={bucket:h,layout:v,translationText:W,translationIcon:q,unwrappedTileID:k,pitchedLabelPlaneMatrix:H,scale:C,textPixelRatio:A,holdingForFade:s.holdingForFade(),collisionBoxArray:y,partiallyEvaluatedTextSize:o.ag(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(l)for(const ee of h.sortKeyRanges){const{sortKey:te,symbolInstanceStart:ie,symbolInstanceEnd:he}=ee;e.push({sortKey:te,symbolInstanceStart:ie,symbolInstanceEnd:he,parameters:K})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:K})}attemptAnchorPlacement(e,i,s,l,h,f,y,v,T,C,A,k,O,Z,W,q,H,K,ee,te){const ie=o.ay[e.textAnchor],he=[e.textOffset0,e.textOffset1],se=qa(ie,s,l,he,h),ye=this.collisionIndex.placeCollisionBox(i,k,v,T,C,y,f,q,A.predicate,ee,se,te);if((!K||this.collisionIndex.placeCollisionBox(K,k,v,T,C,y,f,H,A.predicate,ee,se,te).placeable)&&ye.placeable){let ge;if(this.prevPlacement&&this.prevPlacement.variableOffsets[O.crossTileID]&&this.prevPlacement.placements[O.crossTileID]&&this.prevPlacement.placements[O.crossTileID].text&&(ge=this.prevPlacement.variableOffsets[O.crossTileID].anchor),O.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[O.crossTileID]={textOffset:he,width:s,height:l,anchor:ie,textBoxScale:h,prevAnchor:ge},this.markUsedJustification(Z,ie,O,W),Z.allowVerticalPlacement&&(this.markUsedOrientation(Z,W,O),this.placedOrientations[O.crossTileID]=W),{shift:se,placedGlyphBoxes:ye}}}placeLayerBucketPart(e,i,s){const{bucket:l,layout:h,translationText:f,translationIcon:y,unwrappedTileID:v,pitchedLabelPlaneMatrix:T,textPixelRatio:C,holdingForFade:A,collisionBoxArray:k,partiallyEvaluatedTextSize:O,collisionGroup:Z}=e.parameters,W=h.get("text-optional"),q=h.get("icon-optional"),H=o.az(h,"text-overlap","text-allow-overlap"),K=H==="always",ee=o.az(h,"icon-overlap","icon-allow-overlap"),te=ee==="always",ie=h.get("text-rotation-alignment")==="map",he=h.get("text-pitch-alignment")==="map",se=h.get("icon-text-fit")!=="none",ye=h.get("symbol-z-order")==="viewport-y",ge=K&&(te||!l.hasIconData()||q),Ie=te&&(K||!l.hasTextData()||W);!l.collisionArrays&&k&&l.deserializeCollisionBoxes(k);const ke=this.retainedQueryData[l.bucketInstanceId].tileID,Se=this._getTerrainElevationFunc(ke),Ne=this.transform.getFastPathSimpleProjectionMatrix(ke),Be=(Ee,Xe,xt)=>{var Nt,bt;if(i[Ee.crossTileID])return;if(A)return void(this.placements[Ee.crossTileID]=new ur(!1,!1,!1));let Wt=!1,ei=!1,ai=!0,Gt=null,Ht={box:null,placeable:!1,offscreen:null,occluded:!1},ki={placeable:!1},Oi=null,Vi=null,mr=null,bn=0,an=0,Wn=0;Xe.textFeatureIndex?bn=Xe.textFeatureIndex:Ee.useRuntimeCollisionCircles&&(bn=Ee.featureIndex),Xe.verticalTextFeatureIndex&&(an=Xe.verticalTextFeatureIndex);const Hn=Xe.textBox;if(Hn){const wr=_i=>{let yi=o.ah.horizontal;if(l.allowVerticalPlacement&&!_i&&this.prevPlacement){const Di=this.prevPlacement.placedOrientations[Ee.crossTileID];Di&&(this.placedOrientations[Ee.crossTileID]=Di,yi=Di,this.markUsedOrientation(l,yi,Ee))}return yi},Tn=(_i,yi)=>{if(l.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&Xe.verticalTextBox){for(const Di of l.writingModes)if(Di===o.ah.vertical?(Ht=yi(),ki=Ht):Ht=_i(),Ht&&Ht.placeable)break}else Ht=_i()},Ca=Ee.textAnchorOffsetStartIndex,ka=Ee.textAnchorOffsetEndIndex;if(ka===Ca){const _i=(yi,Di)=>{const Kt=this.collisionIndex.placeCollisionBox(yi,H,C,ke,v,he,ie,f,Z.predicate,Se,void 0,Ne);return Kt&&Kt.placeable&&(this.markUsedOrientation(l,Di,Ee),this.placedOrientations[Ee.crossTileID]=Di),Kt};Tn(()=>_i(Hn,o.ah.horizontal),()=>{const yi=Xe.verticalTextBox;return l.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&yi?_i(yi,o.ah.vertical):{box:null,offscreen:null}}),wr(Ht&&Ht.placeable)}else{let _i=o.ay[(bt=(Nt=this.prevPlacement)===null||Nt===void 0?void 0:Nt.variableOffsets[Ee.crossTileID])===null||bt===void 0?void 0:bt.anchor];const yi=(Kt,Xn,Qh)=>{const Ea=Kt.x2-Kt.x1,_p=Kt.y2-Kt.y1,ed=Ee.textBoxScale,Jc=se&&ee==="never"?Xn:null;let Kn=null,Yn=H==="never"?1:2,Jn="never";_i&&Yn++;for(let Qc=0;Qc<Yn;Qc++){for(let eu=Ca;eu<ka;eu++){const dl=l.textAnchorOffsets.get(eu);if(_i&&dl.textAnchor!==_i)continue;const pl=this.attemptAnchorPlacement(dl,Kt,Ea,_p,ed,ie,he,C,ke,v,Z,Jn,Ee,l,Qh,f,y,Jc,Se);if(pl&&(Kn=pl.placedGlyphBoxes,Kn&&Kn.placeable))return Wt=!0,Gt=pl.shift,Kn}_i?_i=null:Jn=H}return s&&!Kn&&(Kn={box:this.collisionIndex.placeCollisionBox(Hn,"always",C,ke,v,he,ie,f,Z.predicate,Se,void 0,Ne).box,offscreen:!1,placeable:!1,occluded:!1}),Kn};Tn(()=>yi(Hn,Xe.iconBox,o.ah.horizontal),()=>{const Kt=Xe.verticalTextBox;return l.allowVerticalPlacement&&(!Ht||!Ht.placeable)&&Ee.numVerticalGlyphVertices>0&&Kt?yi(Kt,Xe.verticalIconBox,o.ah.vertical):{box:null,occluded:!0,offscreen:null}}),Ht&&(Wt=Ht.placeable,ai=Ht.offscreen);const Di=wr(Ht&&Ht.placeable);if(!Wt&&this.prevPlacement){const Kt=this.prevPlacement.variableOffsets[Ee.crossTileID];Kt&&(this.variableOffsets[Ee.crossTileID]=Kt,this.markUsedJustification(l,Kt.anchor,Ee,Di))}}}if(Oi=Ht,Wt=Oi&&Oi.placeable,ai=Oi&&Oi.offscreen,Ee.useRuntimeCollisionCircles){const wr=l.text.placedSymbolArray.get(Ee.centerJustifiedTextSymbolIndex),Tn=o.ai(l.textSizeData,O,wr),Ca=h.get("text-padding");Vi=this.collisionIndex.placeCollisionCircles(H,wr,l.lineVertexArray,l.glyphOffsetArray,Tn,v,T,s,he,Z.predicate,Ee.collisionCircleDiameter,Ca,f,Se),Vi.circles.length&&Vi.collisionDetected&&!s&&o.w("Collisions detected, but collision boxes are not shown"),Wt=K||Vi.circles.length>0&&!Vi.collisionDetected,ai=ai&&Vi.offscreen}if(Xe.iconFeatureIndex&&(Wn=Xe.iconFeatureIndex),Xe.iconBox){const wr=Tn=>this.collisionIndex.placeCollisionBox(Tn,ee,C,ke,v,he,ie,y,Z.predicate,Se,se&&Gt?Gt:void 0,Ne);ki&&ki.placeable&&Xe.verticalIconBox?(mr=wr(Xe.verticalIconBox),ei=mr.placeable):(mr=wr(Xe.iconBox),ei=mr.placeable),ai=ai&&mr.offscreen}const Ia=W||Ee.numHorizontalGlyphVertices===0&&Ee.numVerticalGlyphVertices===0,sn=q||Ee.numIconVertices===0;Ia||sn?sn?Ia||(ei=ei&&Wt):Wt=ei&&Wt:ei=Wt=ei&&Wt;const wn=ei&&mr.placeable;if(Wt&&Oi.placeable&&this.collisionIndex.insertCollisionBox(Oi.box,H,h.get("text-ignore-placement"),l.bucketInstanceId,ki&&ki.placeable&&an?an:bn,Z.ID),wn&&this.collisionIndex.insertCollisionBox(mr.box,ee,h.get("icon-ignore-placement"),l.bucketInstanceId,Wn,Z.ID),Vi&&Wt&&this.collisionIndex.insertCollisionCircles(Vi.circles,H,h.get("text-ignore-placement"),l.bucketInstanceId,bn,Z.ID),s&&this.storeCollisionData(l.bucketInstanceId,xt,Xe,Oi,mr,Vi),Ee.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[Ee.crossTileID]=new ur((Wt||ge)&&!(Oi!=null&&Oi.occluded),(ei||Ie)&&!(mr!=null&&mr.occluded),ai||l.justReloaded),i[Ee.crossTileID]=!0};if(ye){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ee=l.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let Xe=Ee.length-1;Xe>=0;--Xe){const xt=Ee[Xe];Be(l.symbolInstances.get(xt),l.collisionArrays[xt],xt)}}else for(let Ee=e.symbolInstanceStart;Ee<e.symbolInstanceEnd;Ee++)Be(l.symbolInstances.get(Ee),l.collisionArrays[Ee],Ee);l.justReloaded=!1}storeCollisionData(e,i,s,l,h,f){if(s.textBox||s.iconBox){let y,v;this.collisionBoxArrays.has(e)?y=this.collisionBoxArrays.get(e):(y=new Map,this.collisionBoxArrays.set(e,y)),y.has(i)?v=y.get(i):(v={text:null,icon:null},y.set(i,v)),s.textBox&&(v.text=l.box),s.iconBox&&(v.icon=h.box)}if(f){let y=this.collisionCircleArrays[e];y===void 0&&(y=this.collisionCircleArrays[e]=[]);for(let v=0;v<f.circles.length;v+=4)y.push(f.circles[v+0]-ii),y.push(f.circles[v+1]-ii),y.push(f.circles[v+2]),y.push(f.collisionDetected?1:0)}}markUsedJustification(e,i,s,l){let h;h=l===o.ah.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[o.aA(i)];const f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const y of f)y>=0&&(e.text.placedSymbolArray.get(y).crossTileID=h>=0&&y!==h?0:s.crossTileID)}markUsedOrientation(e,i,s){const l=i===o.ah.horizontal||i===o.ah.horizontalOnly?i:0,h=i===o.ah.vertical?i:0,f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const y of f)e.text.placedSymbolArray.get(y).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:{},y=i?i.placedOrientations:{};for(const v in this.placements){const T=this.placements[v],C=h[v];C?(this.opacities[v]=new Zn(C,l,T.text,T.icon),s=s||T.text!==C.text.placed||T.icon!==C.icon.placed):(this.opacities[v]=new Zn(null,l,T.text,T.icon,T.skipFade),s=s||T.text||T.icon)}for(const v in h){const T=h[v];if(!this.opacities[v]){const C=new Zn(T,l,!1,!1);C.isHidden()||(this.opacities[v]=C,s=s||T.text.placed||T.icon.placed)}}for(const v in f)this.variableOffsets[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.variableOffsets[v]=f[v]);for(const v in y)this.placedOrientations[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.placedOrientations[v]=y[v]);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,y=new Zn(null,0,!1,!1,!0),v=f.get("text-allow-overlap"),T=f.get("icon-allow-overlap"),C=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),A=f.get("text-rotation-alignment")==="map",k=f.get("text-pitch-alignment")==="map",O=f.get("icon-text-fit")!=="none",Z=new Zn(null,0,v&&(T||!e.hasIconData()||f.get("icon-optional")),T&&(v||!e.hasTextData()||f.get("text-optional")),!0);!e.collisionArrays&&l&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(l);const W=(H,K,ee)=>{for(let te=0;te<K/4;te++)H.opacityVertexArray.emplaceBack(ee);H.hasVisibleVertices=H.hasVisibleVertices||ee!==Ls},q=this.collisionBoxArrays.get(e.bucketInstanceId);for(let H=0;H<e.symbolInstances.length;H++){const K=e.symbolInstances.get(H),{numHorizontalGlyphVertices:ee,numVerticalGlyphVertices:te,crossTileID:ie}=K;let he=this.opacities[ie];s[ie]?he=y:he||(he=Z,this.opacities[ie]=he),s[ie]=!0;const se=K.numIconVertices>0,ye=this.placedOrientations[K.crossTileID],ge=ye===o.ah.vertical,Ie=ye===o.ah.horizontal||ye===o.ah.horizontalOnly;if(ee>0||te>0){const Se=sh(he.text);W(e.text,ee,ge?Ls:Se),W(e.text,te,Ie?Ls:Se);const Ne=he.text.isHidden();[K.rightJustifiedTextSymbolIndex,K.centerJustifiedTextSymbolIndex,K.leftJustifiedTextSymbolIndex].forEach(Xe=>{Xe>=0&&(e.text.placedSymbolArray.get(Xe).hidden=Ne||ge?1:0)}),K.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(K.verticalPlacedTextSymbolIndex).hidden=Ne||Ie?1:0);const Be=this.variableOffsets[K.crossTileID];Be&&this.markUsedJustification(e,Be.anchor,K,ye);const Ee=this.placedOrientations[K.crossTileID];Ee&&(this.markUsedJustification(e,"left",K,Ee),this.markUsedOrientation(e,Ee,K))}if(se){const Se=sh(he.icon),Ne=!(O&&K.verticalPlacedIconSymbolIndex&&ge);K.placedIconSymbolIndex>=0&&(W(e.icon,K.numIconVertices,Ne?Se:Ls),e.icon.placedSymbolArray.get(K.placedIconSymbolIndex).hidden=he.icon.isHidden()),K.verticalPlacedIconSymbolIndex>=0&&(W(e.icon,K.numVerticalIconVertices,Ne?Ls:Se),e.icon.placedSymbolArray.get(K.verticalPlacedIconSymbolIndex).hidden=he.icon.isHidden())}const ke=q&&q.has(H)?q.get(H):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const Se=e.collisionArrays[H];if(Se){let Ne=new o.P(0,0);if(Se.textBox||Se.verticalTextBox){let Be=!0;if(C){const Ee=this.variableOffsets[ie];Ee?(Ne=qa(Ee.anchor,Ee.width,Ee.height,Ee.textOffset,Ee.textBoxScale),A&&Ne._rotate(k?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Be=!1}if(Se.textBox||Se.verticalTextBox){let Ee;Se.textBox&&(Ee=ge),Se.verticalTextBox&&(Ee=Ie),Vn(e.textCollisionBox.collisionVertexArray,he.text.placed,!Be||Ee,ke.text,Ne.x,Ne.y)}}if(Se.iconBox||Se.verticalIconBox){const Be=!!(!Ie&&Se.verticalIconBox);let Ee;Se.iconBox&&(Ee=Be),Se.verticalIconBox&&(Ee=!Be),Vn(e.iconCollisionBox.collisionVertexArray,he.icon.placed,Ee,ke.icon,O?Ne.x:0,O?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 Vn(u,e,i,s,l,h){s&&s.length!==0||(s=[0,0,0,0]);const f=s[0]-ii,y=s[1]-ii,v=s[2]-ii,T=s[3]-ii;u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,y),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,v,y),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,v,T),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,T)}const Wa=Math.pow(2,25),ih=Math.pow(2,24),rh=Math.pow(2,17),nh=Math.pow(2,16),Ha=Math.pow(2,9),ah=Math.pow(2,8),Hd=Math.pow(2,1);function sh(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*Wa+e*ih+i*rh+e*nh+i*Ha+e*ah+i*Hd+e}const Ls=0;class oh{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((y,v)=>y.sortKey-v.sortKey));this._currentPartIndex<f.length;)if(i.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,h())return!0;return!1}}class lh{constructor(e,i,s,l,h,f,y,v){this.placement=new lc(e,i,f,y,v),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=l,this._showCollisionBoxes=h,this._done=!1}isDone(){return this._done}continuePlacement(e,i,s){const l=ae.now(),h=()=>!this._forceFullPlacement&&ae.now()-l>2;for(;this._currentPlacementIndex>=0;){const f=i[e[this._currentPlacementIndex]],y=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=y)&&(!f.maxzoom||f.maxzoom>y)){if(this._inProgressLayer||(this._inProgressLayer=new oh(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 da=512/o.Z/2;class cc{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),y=f.key,v=l.get(y);v?v.push(f):l.set(y,[f])}for(const[h,f]of l){const y={positions:f.map(v=>({x:Math.floor(v.anchorX*da),y:Math.floor(v.anchorY*da)})),crossTileIDs:f.map(v=>v.crossTileID)};if(y.positions.length>128){const v=new o.aC(y.positions.length,16,Uint16Array);for(const{x:T,y:C}of y.positions)v.add(T,C);v.finish(),delete y.positions,y.index=v}this._symbolsByKey[h]=y}}getScaledCoordinates(e,i){const{x:s,y:l,z:h}=this.tileID.canonical,{x:f,y,z:v}=i.canonical,T=da/Math.pow(2,v-h),C=(y*o.Z+e.anchorY)*T,A=l*o.Z*da;return{x:Math.floor((f*o.Z+e.anchorX)*T-s*o.Z*da),y:Math.floor(C-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 y=this._symbolsByKey[f.key];if(!y)continue;const v=this.getScaledCoordinates(f,i);if(y.index){const T=y.index.range(v.x-l,v.y-l,v.x+l,v.y+l).sort();for(const C of T){const A=y.crossTileIDs[C];if(!s[A]){s[A]=!0,f.crossTileID=A;break}}}else if(y.positions)for(let T=0;T<y.positions.length;T++){const C=y.positions[T],A=y.crossTileIDs[T];if(Math.abs(C.x-v.x)<=l&&Math.abs(C.y-v.y)<=l&&!s[A]){s[A]=!0,f.crossTileID=A;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class ch{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class uc{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 y=l[f];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+i),h[y.tileID.key]=y}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 y in f){const v=f[y];v.tileID.isChildOf(e)&&v.findMatches(i.symbolInstances,e,l)}else{const y=f[e.scaledTo(Number(h)).key];y&&y.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 cc(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 Ro{constructor(){this.layerIndexes={},this.crossTileIDs=new ch,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,s){let l=this.layerIndexes[e.id];l===void 0&&(l=this.layerIndexes[e.id]=new uc);let h=!1;const f={};l.handleWrapJump(s);for(const y of i){const v=y.getBucket(e);v&&e.id===v.layerIds[0]&&(v.bucketInstanceId||(v.bucketInstanceId=++this.maxBucketInstanceId),l.addBucket(y.tileID,v,this.crossTileIDs)&&(h=!0),f[v.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 Fs="void main() {fragColor=vec4(1.0);}";const Nr={prelude:It(`#ifdef GL_ES
7
- precision mediump float;
8
- #else
9
- #if !defined(lowp)
10
- #define lowp
11
- #endif
12
- #if !defined(mediump)
13
- #define mediump
14
- #endif
15
- #if !defined(highp)
16
- #define highp
17
- #endif
18
- #endif
19
- out highp vec4 fragColor;`,`#ifdef GL_ES
20
- precision highp float;
21
- #else
22
- #if !defined(lowp)
23
- #define lowp
24
- #endif
25
- #if !defined(mediump)
26
- #define mediump
27
- #endif
28
- #if !defined(highp)
29
- #define highp
30
- #endif
31
- #endif
32
- vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
33
- );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c
34
- );}
35
- #ifdef TERRAIN3D
36
- uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
37
- #endif
38
- const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
39
- #ifdef TERRAIN3D
40
- highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
41
- #else
42
- return 1.0;
43
- #endif
44
- }float calculate_visibility(vec4 pos) {
45
- #ifdef TERRAIN3D
46
- vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
47
- #else
48
- return 1.0;
49
- #endif
50
- }float ele(vec2 pos) {
51
- #ifdef TERRAIN3D
52
- vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
53
- #else
54
- return 0.0;
55
- #endif
56
- }float get_elevation(vec2 pos) {
57
- #ifdef TERRAIN3D
58
- #ifdef GLOBE
59
- if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
60
- #endif
61
- vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
62
- #else
63
- return 0.0;
64
- #endif
65
- }const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:It("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:It("",`#define GLOBE_RADIUS 6371008.8
66
- uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
67
- );}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);
68
- if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len
69
- );if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:It(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
70
- #ifdef OVERDRAW_INSPECTOR
71
- fragColor=vec4(1.0);
72
- #endif
73
- }`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:It(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
74
- #ifdef OVERDRAW_INSPECTOR
75
- fragColor=vec4(1.0);
76
- #endif
77
- }`,"uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:It(`in vec3 v_data;in float v_visibility;
78
- #pragma mapbox: define highp vec4 color
79
- #pragma mapbox: define mediump float radius
80
- #pragma mapbox: define lowp float blur
81
- #pragma mapbox: define lowp float opacity
82
- #pragma mapbox: define highp vec4 stroke_color
83
- #pragma mapbox: define mediump float stroke_width
84
- #pragma mapbox: define lowp float stroke_opacity
85
- void main() {
86
- #pragma mapbox: initialize highp vec4 color
87
- #pragma mapbox: initialize mediump float radius
88
- #pragma mapbox: initialize lowp float blur
89
- #pragma mapbox: initialize lowp float opacity
90
- #pragma mapbox: initialize highp vec4 stroke_color
91
- #pragma mapbox: initialize mediump float stroke_width
92
- #pragma mapbox: initialize lowp float stroke_opacity
93
- vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}
94
- #ifdef OVERDRAW_INSPECTOR
95
- fragColor=vec4(1.0);
96
- #endif
97
- }`,`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;
98
- #pragma mapbox: define highp vec4 color
99
- #pragma mapbox: define mediump float radius
100
- #pragma mapbox: define lowp float blur
101
- #pragma mapbox: define lowp float opacity
102
- #pragma mapbox: define highp vec4 stroke_color
103
- #pragma mapbox: define mediump float stroke_width
104
- #pragma mapbox: define lowp float stroke_opacity
105
- void main(void) {
106
- #pragma mapbox: initialize highp vec4 color
107
- #pragma mapbox: initialize mediump float radius
108
- #pragma mapbox: initialize lowp float blur
109
- #pragma mapbox: initialize lowp float opacity
110
- #pragma mapbox: initialize highp vec4 stroke_color
111
- #pragma mapbox: initialize mediump float stroke_width
112
- #pragma mapbox: initialize lowp float stroke_opacity
113
- vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {
114
- #ifdef GLOBE
115
- vec3 center_vector=projectToSphere(circle_center);
116
- #endif
117
- float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {
118
- #ifdef GLOBE
119
- vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
120
- #else
121
- vec4 projected_center=projectTileWithElevation(circle_center,ele);
122
- #endif
123
- corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}
124
- #ifdef GLOBE
125
- vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
126
- #else
127
- gl_Position=projectTileWithElevation(corner_position,ele);
128
- #endif
129
- } else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:It(Fs,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:It(`uniform highp float u_intensity;in vec2 v_extrude;
130
- #pragma mapbox: define highp float weight
131
- #define GAUSS_COEF 0.3989422804014327
132
- void main() {
133
- #pragma mapbox: initialize highp float weight
134
- float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);
135
- #ifdef OVERDRAW_INSPECTOR
136
- fragColor=vec4(1.0);
137
- #endif
138
- }`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;
139
- #pragma mapbox: define highp float weight
140
- #pragma mapbox: define mediump float radius
141
- const highp float ZERO=1.0/255.0/16.0;
142
- #define GAUSS_COEF 0.3989422804014327
143
- void main(void) {
144
- #pragma mapbox: initialize highp float weight
145
- #pragma mapbox: initialize mediump float radius
146
- vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);
147
- #ifdef GLOBE
148
- vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);
149
- #else
150
- gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
151
- #endif
152
- }`),heatmapTexture:It(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
153
- #ifdef OVERDRAW_INSPECTOR
154
- fragColor=vec4(0.0);
155
- #endif
156
- }`,"uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:It("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:It("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:It("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:It(Fs,`in vec2 a_pos;void main() {
157
- #ifdef GLOBE
158
- gl_Position=projectTileFor3D(a_pos,0.0);
159
- #else
160
- gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
161
- #endif
162
- }`),fill:It(`#pragma mapbox: define highp vec4 color
163
- #pragma mapbox: define lowp float opacity
164
- void main() {
165
- #pragma mapbox: initialize highp vec4 color
166
- #pragma mapbox: initialize lowp float opacity
167
- fragColor=color*opacity;
168
- #ifdef OVERDRAW_INSPECTOR
169
- fragColor=vec4(1.0);
170
- #endif
171
- }`,`uniform vec2 u_fill_translate;in vec2 a_pos;
172
- #pragma mapbox: define highp vec4 color
173
- #pragma mapbox: define lowp float opacity
174
- void main() {
175
- #pragma mapbox: initialize highp vec4 color
176
- #pragma mapbox: initialize lowp float opacity
177
- gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:It(`in vec2 v_pos;
178
- #ifdef GLOBE
179
- in float v_depth;
180
- #endif
181
- #pragma mapbox: define highp vec4 outline_color
182
- #pragma mapbox: define lowp float opacity
183
- void main() {
184
- #pragma mapbox: initialize highp vec4 outline_color
185
- #pragma mapbox: initialize lowp float opacity
186
- float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
187
- #ifdef GLOBE
188
- if (v_depth > 1.0) {discard;}
189
- #endif
190
- #ifdef OVERDRAW_INSPECTOR
191
- fragColor=vec4(1.0);
192
- #endif
193
- }`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
194
- #ifdef GLOBE
195
- out float v_depth;
196
- #endif
197
- #pragma mapbox: define highp vec4 outline_color
198
- #pragma mapbox: define lowp float opacity
199
- void main() {
200
- #pragma mapbox: initialize highp vec4 outline_color
201
- #pragma mapbox: initialize lowp float opacity
202
- gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
203
- #ifdef GLOBE
204
- v_depth=gl_Position.z/gl_Position.w;
205
- #endif
206
- }`),fillOutlinePattern:It(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
207
- #ifdef GLOBE
208
- in float v_depth;
209
- #endif
210
- #pragma mapbox: define lowp float opacity
211
- #pragma mapbox: define lowp vec4 pattern_from
212
- #pragma mapbox: define lowp vec4 pattern_to
213
- void main() {
214
- #pragma mapbox: initialize lowp float opacity
215
- #pragma mapbox: initialize mediump vec4 pattern_from
216
- #pragma mapbox: initialize mediump vec4 pattern_to
217
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;
218
- #ifdef GLOBE
219
- if (v_depth > 1.0) {discard;}
220
- #endif
221
- #ifdef OVERDRAW_INSPECTOR
222
- fragColor=vec4(1.0);
223
- #endif
224
- }`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
225
- #ifdef GLOBE
226
- out float v_depth;
227
- #endif
228
- #pragma mapbox: define lowp float opacity
229
- #pragma mapbox: define lowp vec4 pattern_from
230
- #pragma mapbox: define lowp vec4 pattern_to
231
- #pragma mapbox: define lowp float pixel_ratio_from
232
- #pragma mapbox: define lowp float pixel_ratio_to
233
- void main() {
234
- #pragma mapbox: initialize lowp float opacity
235
- #pragma mapbox: initialize mediump vec4 pattern_from
236
- #pragma mapbox: initialize mediump vec4 pattern_to
237
- #pragma mapbox: initialize lowp float pixel_ratio_from
238
- #pragma mapbox: initialize lowp float pixel_ratio_to
239
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
240
- #ifdef GLOBE
241
- v_depth=gl_Position.z/gl_Position.w;
242
- #endif
243
- }`),fillPattern:It(`#ifdef GL_ES
244
- precision highp float;
245
- #endif
246
- uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
247
- #pragma mapbox: define lowp float opacity
248
- #pragma mapbox: define lowp vec4 pattern_from
249
- #pragma mapbox: define lowp vec4 pattern_to
250
- void main() {
251
- #pragma mapbox: initialize lowp float opacity
252
- #pragma mapbox: initialize mediump vec4 pattern_from
253
- #pragma mapbox: initialize mediump vec4 pattern_to
254
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;
255
- #ifdef OVERDRAW_INSPECTOR
256
- fragColor=vec4(1.0);
257
- #endif
258
- }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
259
- #pragma mapbox: define lowp float opacity
260
- #pragma mapbox: define lowp vec4 pattern_from
261
- #pragma mapbox: define lowp vec4 pattern_to
262
- #pragma mapbox: define lowp float pixel_ratio_from
263
- #pragma mapbox: define lowp float pixel_ratio_to
264
- void main() {
265
- #pragma mapbox: initialize lowp float opacity
266
- #pragma mapbox: initialize mediump vec4 pattern_from
267
- #pragma mapbox: initialize mediump vec4 pattern_to
268
- #pragma mapbox: initialize lowp float pixel_ratio_from
269
- #pragma mapbox: initialize lowp float pixel_ratio_to
270
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:It(`in vec4 v_color;void main() {fragColor=v_color;
271
- #ifdef OVERDRAW_INSPECTOR
272
- fragColor=vec4(1.0);
273
- #endif
274
- }`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;
275
- #ifdef TERRAIN3D
276
- in vec2 a_centroid;
277
- #endif
278
- out vec4 v_color;
279
- #pragma mapbox: define highp float base
280
- #pragma mapbox: define highp float height
281
- #pragma mapbox: define highp vec4 color
282
- void main() {
283
- #pragma mapbox: initialize highp float base
284
- #pragma mapbox: initialize highp float height
285
- #pragma mapbox: initialize highp vec4 color
286
- vec3 normal=a_normal_ed.xyz;
287
- #ifdef TERRAIN3D
288
- float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
289
- #else
290
- float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
291
- #endif
292
- base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
293
- #ifdef GLOBE
294
- vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
295
- #else
296
- gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
297
- #endif
298
- float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);
299
- #ifdef GLOBE
300
- mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
301
- #endif
302
- directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:It(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;
303
- #pragma mapbox: define lowp float base
304
- #pragma mapbox: define lowp float height
305
- #pragma mapbox: define lowp vec4 pattern_from
306
- #pragma mapbox: define lowp vec4 pattern_to
307
- #pragma mapbox: define lowp float pixel_ratio_from
308
- #pragma mapbox: define lowp float pixel_ratio_to
309
- void main() {
310
- #pragma mapbox: initialize lowp float base
311
- #pragma mapbox: initialize lowp float height
312
- #pragma mapbox: initialize mediump vec4 pattern_from
313
- #pragma mapbox: initialize mediump vec4 pattern_to
314
- #pragma mapbox: initialize lowp float pixel_ratio_from
315
- #pragma mapbox: initialize lowp float pixel_ratio_to
316
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;
317
- #ifdef OVERDRAW_INSPECTOR
318
- fragColor=vec4(1.0);
319
- #endif
320
- }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;
321
- #ifdef TERRAIN3D
322
- in vec2 a_centroid;
323
- #endif
324
- #ifdef GLOBE
325
- out vec3 v_sphere_pos;
326
- #endif
327
- out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
328
- #pragma mapbox: define lowp float base
329
- #pragma mapbox: define lowp float height
330
- #pragma mapbox: define lowp vec4 pattern_from
331
- #pragma mapbox: define lowp vec4 pattern_to
332
- #pragma mapbox: define lowp float pixel_ratio_from
333
- #pragma mapbox: define lowp float pixel_ratio_to
334
- void main() {
335
- #pragma mapbox: initialize lowp float base
336
- #pragma mapbox: initialize lowp float height
337
- #pragma mapbox: initialize mediump vec4 pattern_from
338
- #pragma mapbox: initialize mediump vec4 pattern_to
339
- #pragma mapbox: initialize lowp float pixel_ratio_from
340
- #pragma mapbox: initialize lowp float pixel_ratio_to
341
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
342
- #ifdef TERRAIN3D
343
- float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
344
- #else
345
- float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
346
- #endif
347
- base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
348
- #ifdef GLOBE
349
- vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
350
- #else
351
- gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
352
- #endif
353
- vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
354
- ? a_pos
355
- : vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:It(`#ifdef GL_ES
356
- precision highp float;
357
- #endif
358
- uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));fragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
359
- #ifdef OVERDRAW_INSPECTOR
360
- fragColor=vec4(1.0);
361
- #endif
362
- }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:It(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
363
- #define PI 3.141592653589793
364
- void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;
365
- #ifdef OVERDRAW_INSPECTOR
366
- fragColor=vec4(1.0);
367
- #endif
368
- }`,"uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:It(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
369
- #ifdef GLOBE
370
- in float v_depth;
371
- #endif
372
- #pragma mapbox: define highp vec4 color
373
- #pragma mapbox: define lowp float blur
374
- #pragma mapbox: define lowp float opacity
375
- void main() {
376
- #pragma mapbox: initialize highp vec4 color
377
- #pragma mapbox: initialize lowp float blur
378
- #pragma mapbox: initialize lowp float opacity
379
- float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);
380
- #ifdef GLOBE
381
- if (v_depth > 1.0) {discard;}
382
- #endif
383
- #ifdef OVERDRAW_INSPECTOR
384
- fragColor=vec4(1.0);
385
- #endif
386
- }`,`
387
- #define scale 0.015873016
388
- in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
389
- #ifdef GLOBE
390
- out float v_depth;
391
- #endif
392
- #pragma mapbox: define highp vec4 color
393
- #pragma mapbox: define lowp float blur
394
- #pragma mapbox: define lowp float opacity
395
- #pragma mapbox: define mediump float gapwidth
396
- #pragma mapbox: define lowp float offset
397
- #pragma mapbox: define mediump float width
398
- void main() {
399
- #pragma mapbox: initialize highp vec4 color
400
- #pragma mapbox: initialize lowp float blur
401
- #pragma mapbox: initialize lowp float opacity
402
- #pragma mapbox: initialize mediump float gapwidth
403
- #pragma mapbox: initialize lowp float offset
404
- #pragma mapbox: initialize mediump float width
405
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
406
- #ifdef GLOBE
407
- v_depth=gl_Position.z/gl_Position.w;
408
- #endif
409
- #ifdef TERRAIN3D
410
- v_gamma_scale=1.0;
411
- #else
412
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
413
- #endif
414
- v_width2=vec2(outset,inset);}`),lineGradient:It(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
415
- #ifdef GLOBE
416
- in float v_depth;
417
- #endif
418
- #pragma mapbox: define lowp float blur
419
- #pragma mapbox: define lowp float opacity
420
- void main() {
421
- #pragma mapbox: initialize lowp float blur
422
- #pragma mapbox: initialize lowp float opacity
423
- float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
424
- #ifdef GLOBE
425
- if (v_depth > 1.0) {discard;}
426
- #endif
427
- #ifdef OVERDRAW_INSPECTOR
428
- fragColor=vec4(1.0);
429
- #endif
430
- }`,`
431
- #define scale 0.015873016
432
- in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
433
- #ifdef GLOBE
434
- out float v_depth;
435
- #endif
436
- #pragma mapbox: define lowp float blur
437
- #pragma mapbox: define lowp float opacity
438
- #pragma mapbox: define mediump float gapwidth
439
- #pragma mapbox: define lowp float offset
440
- #pragma mapbox: define mediump float width
441
- void main() {
442
- #pragma mapbox: initialize lowp float blur
443
- #pragma mapbox: initialize lowp float opacity
444
- #pragma mapbox: initialize mediump float gapwidth
445
- #pragma mapbox: initialize lowp float offset
446
- #pragma mapbox: initialize mediump float width
447
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
448
- #ifdef GLOBE
449
- v_depth=gl_Position.z/gl_Position.w;
450
- #endif
451
- #ifdef TERRAIN3D
452
- v_gamma_scale=1.0;
453
- #else
454
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
455
- #endif
456
- v_width2=vec2(outset,inset);}`),linePattern:It(`#ifdef GL_ES
457
- precision highp float;
458
- #endif
459
- uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;
460
- #ifdef GLOBE
461
- in float v_depth;
462
- #endif
463
- #pragma mapbox: define lowp vec4 pattern_from
464
- #pragma mapbox: define lowp vec4 pattern_to
465
- #pragma mapbox: define lowp float pixel_ratio_from
466
- #pragma mapbox: define lowp float pixel_ratio_to
467
- #pragma mapbox: define lowp float blur
468
- #pragma mapbox: define lowp float opacity
469
- void main() {
470
- #pragma mapbox: initialize mediump vec4 pattern_from
471
- #pragma mapbox: initialize mediump vec4 pattern_to
472
- #pragma mapbox: initialize lowp float pixel_ratio_from
473
- #pragma mapbox: initialize lowp float pixel_ratio_to
474
- #pragma mapbox: initialize lowp float blur
475
- #pragma mapbox: initialize lowp float opacity
476
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;
477
- #ifdef GLOBE
478
- if (v_depth > 1.0) {discard;}
479
- #endif
480
- #ifdef OVERDRAW_INSPECTOR
481
- fragColor=vec4(1.0);
482
- #endif
483
- }`,`
484
- #define scale 0.015873016
485
- #define LINE_DISTANCE_SCALE 2.0
486
- in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;
487
- #ifdef GLOBE
488
- out float v_depth;
489
- #endif
490
- #pragma mapbox: define lowp float blur
491
- #pragma mapbox: define lowp float opacity
492
- #pragma mapbox: define lowp float offset
493
- #pragma mapbox: define mediump float gapwidth
494
- #pragma mapbox: define mediump float width
495
- #pragma mapbox: define lowp float floorwidth
496
- #pragma mapbox: define lowp vec4 pattern_from
497
- #pragma mapbox: define lowp vec4 pattern_to
498
- #pragma mapbox: define lowp float pixel_ratio_from
499
- #pragma mapbox: define lowp float pixel_ratio_to
500
- void main() {
501
- #pragma mapbox: initialize lowp float blur
502
- #pragma mapbox: initialize lowp float opacity
503
- #pragma mapbox: initialize lowp float offset
504
- #pragma mapbox: initialize mediump float gapwidth
505
- #pragma mapbox: initialize mediump float width
506
- #pragma mapbox: initialize lowp float floorwidth
507
- #pragma mapbox: initialize mediump vec4 pattern_from
508
- #pragma mapbox: initialize mediump vec4 pattern_to
509
- #pragma mapbox: initialize lowp float pixel_ratio_from
510
- #pragma mapbox: initialize lowp float pixel_ratio_to
511
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
512
- #ifdef GLOBE
513
- v_depth=gl_Position.z/gl_Position.w;
514
- #endif
515
- #ifdef TERRAIN3D
516
- v_gamma_scale=1.0;
517
- #else
518
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
519
- #endif
520
- v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:It(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
521
- #ifdef GLOBE
522
- in float v_depth;
523
- #endif
524
- #pragma mapbox: define highp vec4 color
525
- #pragma mapbox: define lowp float blur
526
- #pragma mapbox: define lowp float opacity
527
- #pragma mapbox: define mediump float width
528
- #pragma mapbox: define lowp float floorwidth
529
- void main() {
530
- #pragma mapbox: initialize highp vec4 color
531
- #pragma mapbox: initialize lowp float blur
532
- #pragma mapbox: initialize lowp float opacity
533
- #pragma mapbox: initialize mediump float width
534
- #pragma mapbox: initialize lowp float floorwidth
535
- float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
536
- #ifdef GLOBE
537
- if (v_depth > 1.0) {discard;}
538
- #endif
539
- #ifdef OVERDRAW_INSPECTOR
540
- fragColor=vec4(1.0);
541
- #endif
542
- }`,`
543
- #define scale 0.015873016
544
- #define LINE_DISTANCE_SCALE 2.0
545
- in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
546
- #ifdef GLOBE
547
- out float v_depth;
548
- #endif
549
- #pragma mapbox: define highp vec4 color
550
- #pragma mapbox: define lowp float blur
551
- #pragma mapbox: define lowp float opacity
552
- #pragma mapbox: define mediump float gapwidth
553
- #pragma mapbox: define lowp float offset
554
- #pragma mapbox: define mediump float width
555
- #pragma mapbox: define lowp float floorwidth
556
- void main() {
557
- #pragma mapbox: initialize highp vec4 color
558
- #pragma mapbox: initialize lowp float blur
559
- #pragma mapbox: initialize lowp float opacity
560
- #pragma mapbox: initialize mediump float gapwidth
561
- #pragma mapbox: initialize lowp float offset
562
- #pragma mapbox: initialize mediump float width
563
- #pragma mapbox: initialize lowp float floorwidth
564
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
565
- #ifdef GLOBE
566
- v_depth=gl_Position.z/gl_Position.w;
567
- #endif
568
- #ifdef TERRAIN3D
569
- v_gamma_scale=1.0;
570
- #else
571
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
572
- #endif
573
- v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:It(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
574
- #ifdef OVERDRAW_INSPECTOR
575
- fragColor=vec4(1.0);
576
- #endif
577
- }`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;
578
- #ifdef GLOBE
579
- if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
580
- #endif
581
- v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:It(`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;
582
- #pragma mapbox: define lowp float opacity
583
- void main() {
584
- #pragma mapbox: initialize lowp float opacity
585
- lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;
586
- #ifdef OVERDRAW_INSPECTOR
587
- fragColor=vec4(1.0);
588
- #endif
589
- }`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;
590
- #pragma mapbox: define lowp float opacity
591
- void main() {
592
- #pragma mapbox: initialize lowp float opacity
593
- vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
594
- camera_to_anchor_distance/u_camera_to_center_distance :
595
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
596
- #ifdef GLOBE
597
- if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
598
- #endif
599
- vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:It(`#define SDF_PX 8.0
600
- uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;
601
- #pragma mapbox: define highp vec4 fill_color
602
- #pragma mapbox: define highp vec4 halo_color
603
- #pragma mapbox: define lowp float opacity
604
- #pragma mapbox: define lowp float halo_width
605
- #pragma mapbox: define lowp float halo_blur
606
- void main() {
607
- #pragma mapbox: initialize highp vec4 fill_color
608
- #pragma mapbox: initialize highp vec4 halo_color
609
- #pragma mapbox: initialize lowp float opacity
610
- #pragma mapbox: initialize lowp float halo_width
611
- #pragma mapbox: initialize lowp float halo_blur
612
- float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);
613
- #ifdef OVERDRAW_INSPECTOR
614
- fragColor=vec4(1.0);
615
- #endif
616
- }`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;
617
- #pragma mapbox: define highp vec4 fill_color
618
- #pragma mapbox: define highp vec4 halo_color
619
- #pragma mapbox: define lowp float opacity
620
- #pragma mapbox: define lowp float halo_width
621
- #pragma mapbox: define lowp float halo_blur
622
- void main() {
623
- #pragma mapbox: initialize highp vec4 fill_color
624
- #pragma mapbox: initialize highp vec4 halo_color
625
- #pragma mapbox: initialize lowp float opacity
626
- #pragma mapbox: initialize lowp float halo_width
627
- #pragma mapbox: initialize lowp float halo_blur
628
- vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
629
- camera_to_anchor_distance/u_camera_to_center_distance :
630
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
631
- #ifdef GLOBE
632
- if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
633
- #endif
634
- vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:It(`#define SDF_PX 8.0
635
- #define SDF 1.0
636
- #define ICON 0.0
637
- uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;
638
- #pragma mapbox: define highp vec4 fill_color
639
- #pragma mapbox: define highp vec4 halo_color
640
- #pragma mapbox: define lowp float opacity
641
- #pragma mapbox: define lowp float halo_width
642
- #pragma mapbox: define lowp float halo_blur
643
- void main() {
644
- #pragma mapbox: initialize highp vec4 fill_color
645
- #pragma mapbox: initialize highp vec4 halo_color
646
- #pragma mapbox: initialize lowp float opacity
647
- #pragma mapbox: initialize lowp float halo_width
648
- #pragma mapbox: initialize lowp float halo_blur
649
- float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;
650
- #ifdef OVERDRAW_INSPECTOR
651
- fragColor=vec4(1.0);
652
- #endif
653
- return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);
654
- #ifdef OVERDRAW_INSPECTOR
655
- fragColor=vec4(1.0);
656
- #endif
657
- }`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;
658
- #pragma mapbox: define highp vec4 fill_color
659
- #pragma mapbox: define highp vec4 halo_color
660
- #pragma mapbox: define lowp float opacity
661
- #pragma mapbox: define lowp float halo_width
662
- #pragma mapbox: define lowp float halo_blur
663
- void main() {
664
- #pragma mapbox: initialize highp vec4 fill_color
665
- #pragma mapbox: initialize highp vec4 halo_color
666
- #pragma mapbox: initialize lowp float opacity
667
- #pragma mapbox: initialize lowp float halo_width
668
- #pragma mapbox: initialize lowp float halo_blur
669
- vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
670
- camera_to_anchor_distance/u_camera_to_center_distance :
671
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
672
- #ifdef GLOBE
673
- if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
674
- #endif
675
- vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:It("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:It("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:It("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:It("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:It(`in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
676
- );color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:It("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function It(u,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=e.match(/in ([\w]+) ([\w]+)/g),l=u.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),h=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=h?h.concat(l):l,y={};return{fragmentSource:u=u.replace(i,(v,T,C,A,k)=>(y[k]=!0,T==="define"?`
677
- #ifndef HAS_UNIFORM_u_${k}
678
- in ${C} ${A} ${k};
679
- #else
680
- uniform ${C} ${A} u_${k};
681
- #endif
682
- `:`
683
- #ifdef HAS_UNIFORM_u_${k}
684
- ${C} ${A} ${k} = u_${k};
685
- #endif
686
- `)),vertexSource:e=e.replace(i,(v,T,C,A,k)=>{const O=A==="float"?"vec2":"vec4",Z=k.match(/color/)?"color":O;return y[k]?T==="define"?`
687
- #ifndef HAS_UNIFORM_u_${k}
688
- uniform lowp float u_${k}_t;
689
- in ${C} ${O} a_${k};
690
- out ${C} ${A} ${k};
691
- #else
692
- uniform ${C} ${A} u_${k};
693
- #endif
694
- `:Z==="vec4"?`
695
- #ifndef HAS_UNIFORM_u_${k}
696
- ${k} = a_${k};
697
- #else
698
- ${C} ${A} ${k} = u_${k};
699
- #endif
700
- `:`
701
- #ifndef HAS_UNIFORM_u_${k}
702
- ${k} = unpack_mix_${Z}(a_${k}, u_${k}_t);
703
- #else
704
- ${C} ${A} ${k} = u_${k};
705
- #endif
706
- `:T==="define"?`
707
- #ifndef HAS_UNIFORM_u_${k}
708
- uniform lowp float u_${k}_t;
709
- in ${C} ${O} a_${k};
710
- #else
711
- uniform ${C} ${A} u_${k};
712
- #endif
713
- `:Z==="vec4"?`
714
- #ifndef HAS_UNIFORM_u_${k}
715
- ${C} ${A} ${k} = a_${k};
716
- #else
717
- ${C} ${A} ${k} = u_${k};
718
- #endif
719
- `:`
720
- #ifndef HAS_UNIFORM_u_${k}
721
- ${C} ${A} ${k} = unpack_mix_${Z}(a_${k}, u_${k}_t);
722
- #else
723
- ${C} ${A} ${k} = u_${k};
724
- #endif
725
- `}),staticAttributes:s,staticUniforms:f}}class pa{constructor(e,i,s){this.vertexBuffer=e,this.indexBuffer=i,this.segments=s}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Un=o.aD([{name:"a_pos",type:"Int16",components:2}]);const _n="#define PROJECTION_MERCATOR",Xa="mercator";class Ft{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Xa}get shaderDefine(){return _n}get shaderPreludeCode(){return Nr.projectionMercator}get vertexShaderPreludeCode(){return Nr.projectionMercator.vertexSource}get subdivisionGranularity(){return o.aE.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,i,s,l,h){if(this._cachedMesh)return this._cachedMesh;const f=new o.aF;f.emplaceBack(0,0),f.emplaceBack(o.Z,0),f.emplaceBack(0,o.Z),f.emplaceBack(o.Z,o.Z);const y=e.createVertexBuffer(f,Un.members),v=o.aG.simpleSegment(0,0,4,2),T=new o.aH;T.emplaceBack(1,0,2),T.emplaceBack(1,2,3);const C=e.createIndexBuffer(T);return this._cachedMesh=new pa(y,C,v),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}function kr(u,e){const i=o.ae(e.lat,-85.051129,o.aJ);return new o.P(o.U(e.lng)*u,o.S(i)*u)}function Bs(u,e){return new o.$(e.x/u,e.y/u).toLngLat()}function Ka(u){return u.cameraToCenterDistance*Math.min(.85*Math.tan(o.ad(90-u.pitch)),Math.tan(o.ad(89.25-u.pitch)))}function nr(u,e){const i=u.canonical,s=e/o.aI(i.z),l=i.x+Math.pow(2,i.z)*u.wrap,h=o.at(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 Xi(u,e,i,s,l){const h=o.$.fromLngLat(u,e),f=l*o.aK(1,u.lat),y=f*Math.cos(o.ad(i)),v=Math.sqrt(f*f-y*y),T=v*Math.sin(o.ad(-s)),C=v*Math.cos(o.ad(-s));return new o.$(h.x+T,h.y+C,h.z+y)}class ci{constructor(e=0,i=0,s=0,l=0){if(isNaN(e)||e<0||isNaN(i)||i<0||isNaN(s)||s<0||isNaN(l)||l<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=i,this.left=s,this.right=l}interpolate(e,i,s){return i.top!=null&&e.top!=null&&(this.top=o.B.number(e.top,i.top,s)),i.bottom!=null&&e.bottom!=null&&(this.bottom=o.B.number(e.bottom,i.bottom,s)),i.left!=null&&e.left!=null&&(this.left=o.B.number(e.left,i.left,s)),i.right!=null&&e.right!=null&&(this.right=o.B.number(e.right,i.right,s)),this}getCenter(e,i){const s=o.ae((this.left+e-this.right)/2,0,e),l=o.ae((this.top+i-this.bottom)/2,0,i);return new o.P(s,l)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new ci(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Do(u,e){if(!u.renderWorldCopies||u.lngRange)return;const i=e.lng-u.center.lng;e.lng+=i>180?-360:i<-180?360:0}function ar(u){return Math.max(0,Math.floor(u))}class hr{constructor(e,i,s,l,h,f){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=f===void 0||!!f,this._minZoom=i||0,this._maxZoom=s||22,this._minPitch=l??0,this._maxPitch=h??60,this.setMaxBounds(),this._width=0,this._height=0,this._center=new o.Q(0,0),this._elevation=0,this._zoom=0,this._tileZoom=ar(this._zoom),this._scale=o.aI(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new ci,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,i,s){this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=ar(this._zoom),this._scale=o.aI(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new ci(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!s&&e.autoCalculateNearFarZ,i&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new o.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){const i=o.aL(e,-180,180)*Math.PI/180;var s,l,h,f,y,v,T,C,A;this._bearingInRadians!==i&&(this._unmodified=!1,this._bearingInRadians=i,this._calcMatrices(),this._rotationMatrix=re(),s=this._rotationMatrix,h=-this._bearingInRadians,f=(l=this._rotationMatrix)[0],y=l[1],v=l[2],T=l[3],C=Math.sin(h),A=Math.cos(h),s[0]=f*A+v*C,s[1]=y*A+T*C,s[2]=f*-C+v*A,s[3]=y*-C+T*A)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const i=o.ae(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){const i=e/180*Math.PI;this._rollInRadians!==i&&(this._unmodified=!1,this._rollInRadians=i,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return o.aM(this._fovInRadians)}setFov(e){e=o.ae(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=o.ad(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){const i=this.getConstrained(this._center,e).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=o.aI(i),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,i){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=i,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,i,s){this._unmodified=!1,this._edgeInsets.interpolate(e,i,s),this._constrain(),this._calcMatrices()}resize(e,i,s=!0){this._width=e,this._height=i,s&&this._constrain(),this._calcMatrices()}getMaxBounds(){return this._latRange&&this._latRange.length===2&&this._lngRange&&this._lngRange.length===2?new wi([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-85.051129,o.aJ])}getConstrained(e,i){return this._callbacks.getConstrained(e,i)}getCameraQueryGeometry(e,i){if(i.length===1)return[i[0],e];{let s=e.x,l=e.y,h=e.x,f=e.y;for(const y of i)s=Math.min(s,y.x),l=Math.min(l,y.y),h=Math.max(h,y.x),f=Math.max(f,y.y);return[new o.P(s,l),new o.P(h,l),new o.P(h,f),new o.P(s,f),new o.P(s,l)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:i,zoom:s}=this.getConstrained(this.center,this.zoom);this.setCenter(i),this.setZoom(s),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=o.at(new Float64Array(16));o.M(e,e,[this._width/2,-this._height/2,1]),o.L(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=o.at(new Float64Array(16)),o.M(e,e,[1,-1,1]),o.L(e,e,[-1,-1,0]),o.M(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,i,s,l){const h=s!==void 0?s:this.bearing,f=l=l!==void 0?l:this.pitch,y=o.$.fromLngLat(e,i),v=-Math.cos(o.ad(f)),T=Math.sin(o.ad(f)),C=T*Math.sin(o.ad(h)),A=-T*Math.cos(o.ad(h));let k=this.elevation;const O=i-k;let Z;v*O>=0||Math.abs(v)<.1?(Z=1e4,k=i+Z*v):Z=-O/v;let W,q,H=o.aN(1,y.y),K=0;do{if(K+=1,K>10)break;q=Z/H,W=new o.$(y.x+C*q,y.y+A*q),H=1/W.meterInMercatorCoordinateUnits()}while(Math.abs(Z-q*H)>1e-12);return{center:W.toLngLat(),elevation:k,zoom:o.ab(this.height/2/Math.tan(this.fovInRadians/2)/q/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const i=o.aK(1,this.center.lat)*this.worldSize,s=this.cameraToCenterDistance/i,l=o.$.fromLngLat(this.center,this.elevation),h=Xi(this.center,this.elevation,this.pitch,this.bearing,s);this._elevation=e;const f=this.calculateCenterFromCameraLngLatAlt(h.toLngLat(),o.aN(h.z,l.y),this.bearing,this.pitch);this._elevation=f.elevation,this._center=f.center,this.setZoom(f.zoom)}getCameraPoint(){const e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new o.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const e=o.aK(1,this.center.lat)*this.worldSize;return Xi(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];const i=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/i,e.canonical.y/i,1/i/o.Z,1/i/o.Z]}}class Bi{constructor(e,i){this.min=e,this.max=i,this.center=o.aO([],o.aP([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],s=o.aQ(this.min),l=o.aQ(this.max);for(let h=0;h<i.length;h++)s[h]=i[h]?this.min[h]:this.center[h],l[h]=i[h]?this.center[h]:this.max[h];return l[2]=this.max[2],new Bi(s,l)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let i=!0;for(let s=0;s<e.planes.length;s++){const l=this.intersectsPlane(e.planes[s]);if(l===0)return 0;l===1&&(i=!1)}return i?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let i=e[3],s=e[3];for(let l=0;l<3;l++)e[l]>0?(i+=e[l]*this.min[l],s+=e[l]*this.max[l]):(s+=e[l]*this.min[l],i+=e[l]*this.max[l]);return i>=0?2:s<0?0:1}}class uh{distanceToTile2d(e,i,s,l){const h=l.distanceX([e,i]),f=l.distanceY([e,i]);return Math.hypot(h,f)}getWrap(e,i,s){return s}getTileAABB(e,i,s,l){var h,f;let y=s,v=s;if(l.terrain){const C=new o.Y(e.z,i,e.z,e.x,e.y),A=l.terrain.getMinMaxElevation(C);y=(h=A.minElevation)!==null&&h!==void 0?h:s,v=(f=A.maxElevation)!==null&&f!==void 0?f:s}const T=1<<e.z;return new Bi([i+e.x/T,e.y/T,y],[i+(e.x+1)/T,(e.y+1)/T,v])}allowVariableZoom(e,i){const s=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,l=o.ae(78.5-s/2,0,60);return!!i.terrain||e.pitch>l}allowWorldCopies(){return!0}recalculateCache(){}}class $n{constructor(e,i,s){this.points=e,this.planes=i,this.aabb=s}static fromInvProjectionMatrix(e,i=1,s=0){const l=Math.pow(2,s),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(T=>{const C=1/(T=o.ap([],T,e))[3]/i*l;return o.aR(T,T,[C,C,1/T[3],C])}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(T=>{const C=o.aS([],h[T[0]],h[T[1]]),A=o.aS([],h[T[2]],h[T[1]]),k=o.aT([],o.aU([],C,A)),O=-o.aV(k,h[T[1]]);return k.concat(O)}),y=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],v=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const T of h)for(let C=0;C<3;C++)y[C]=Math.min(y[C],T[C]),v[C]=Math.max(v[C],T[C]);return new $n(h,f,new Bi(y,v))}}class ui{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,i,s){return this._helper.interpolatePadding(e,i,s)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,i,s=!0){this._helper.resize(e,i,s)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,i){this._helper.overrideNearFarZ(e,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,i){}constructor(e,i,s,l,h){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new hr({calcMatrices:()=>{this._calcMatrices()},getConstrained:(f,y)=>this.getConstrained(f,y)},e,i,s,l,h),this._coveringTilesDetailsProvider=new uh}clone(){const e=new ui;return e.apply(this),e}apply(e,i,s){this._helper.apply(e,i,s)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){const i=[new o.aW(0,e)];if(this._helper._renderWorldCopies){const s=this.screenPointToMercatorCoordinate(new o.P(0,0)),l=this.screenPointToMercatorCoordinate(new o.P(this._helper._width,0)),h=this.screenPointToMercatorCoordinate(new o.P(this._helper._width,this._helper._height)),f=this.screenPointToMercatorCoordinate(new o.P(0,this._helper._height)),y=Math.floor(Math.min(s.x,l.x,h.x,f.x)),v=Math.floor(Math.max(s.x,l.x,h.x,f.x)),T=1;for(let C=y-T;C<=v+T;C++)C!==0&&i.push(new o.aW(C,e))}return i}getCameraFrustum(){return $n.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){const i=this.screenPointToLocation(this.centerPoint,e),s=e?e.getElevationForLngLatZoom(i,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(s)}setLocationAtPoint(e,i){const s=o.aK(this.elevation,this.center.lat),l=this.screenPointToMercatorCoordinateAtZ(i,s),h=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,s),f=o.$.fromLngLat(e),y=new o.$(f.x-(l.x-h.x),f.y-(l.y-h.y));this.setCenter(y==null?void 0:y.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,i){return i?this.coordinatePoint(o.$.fromLngLat(e),i.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(o.$.fromLngLat(e))}screenPointToLocation(e,i){var s;return(s=this.screenPointToMercatorCoordinate(e,i))===null||s===void 0?void 0:s.toLngLat()}screenPointToMercatorCoordinate(e,i){if(i){const s=i.pointCoordinate(e);if(s!=null)return s}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,i){const s=i||0,l=[e.x,e.y,0,1],h=[e.x,e.y,1,1];o.ap(l,l,this._pixelMatrixInverse),o.ap(h,h,this._pixelMatrixInverse);const f=l[3],y=h[3],v=l[1]/f,T=h[1]/y,C=l[2]/f,A=h[2]/y,k=C===A?0:(s-C)/(A-C);return new o.$(o.B.number(l[0]/f,h[0]/y,k)/this.worldSize,o.B.number(v,T,k)/this.worldSize,s)}coordinatePoint(e,i=0,s=this._pixelMatrix){const l=[e.x*this.worldSize,e.y*this.worldSize,i,1];return o.ap(l,l,s),new o.P(l[0]/l[3],l[1]/l[3])}getBounds(){const e=Math.max(0,this._helper._height/2-Ka(this));return new wi().extend(this.screenPointToLocation(new o.P(0,e))).extend(this.screenPointToLocation(new o.P(this._helper._width,e))).extend(this.screenPointToLocation(new o.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new o.P(0,this._helper._height)))}isPointOnMapSurface(e,i){return i?i.pointCoordinate(e)!=null:e.y>this.height/2-Ka(this)}calculatePosMatrix(e,i=!1,s){var l;const h=(l=e.key)!==null&&l!==void 0?l:o.aX(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),f=i?this._alignedPosMatrixCache:this._posMatrixCache;if(f.has(h)){const T=f.get(h);return s?T.f32:T.f64}const y=nr(e,this.worldSize);o.N(y,i?this._alignedProjMatrix:this._viewProjMatrix,y);const v={f64:y,f32:new Float32Array(y)};return f.set(h,v),s?v.f32:v.f64}calculateFogMatrix(e){const i=e.key,s=this._fogMatrixCacheF32;if(s.has(i))return s.get(i);const l=nr(e,this.worldSize);return o.N(l,this._fogMatrix,l),s.set(i,new Float32Array(l)),s.get(i)}getConstrained(e,i){i=o.ae(+i,this.minZoom,this.maxZoom);const s={center:new o.Q(e.lng,e.lat),zoom:i};let l=this._helper._lngRange;this._helper._renderWorldCopies||l!==null||(l=[-179.9999999999,180-1e-10]);const h=this.tileSize*o.aI(s.zoom);let f=0,y=h,v=0,T=h,C=0,A=0;const{x:k,y:O}=this.size;if(this._helper._latRange){const ee=this._helper._latRange;f=o.S(ee[1])*h,y=o.S(ee[0])*h,y-f<O&&(C=O/(y-f))}l&&(v=o.aL(o.U(l[0])*h,0,h),T=o.aL(o.U(l[1])*h,0,h),T<v&&(T+=h),T-v<k&&(A=k/(T-v)));const{x:Z,y:W}=kr(h,e);let q,H;const K=Math.max(A||0,C||0);if(K){const ee=new o.P(A?(T+v)/2:Z,C?(y+f)/2:W);return s.center=Bs(h,ee).wrap(),s.zoom+=o.ab(K),s}if(this._helper._latRange){const ee=O/2;W-ee<f&&(H=f+ee),W+ee>y&&(H=y-ee)}if(l){const ee=(v+T)/2;let te=Z;this._helper._renderWorldCopies&&(te=o.aL(Z,ee-h/2,ee+h/2));const ie=k/2;te-ie<v&&(q=v+ie),te+ie>T&&(q=T-ie)}if(q!==void 0||H!==void 0){const ee=new o.P(q??Z,H??W);s.center=Bs(h,ee).wrap()}return s}calculateCenterFromCameraLngLatAlt(e,i,s,l){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,s,l)}_calculateNearFarZIfNeeded(e,i,s){if(!this._helper.autoCalculateNearFarZ)return;const l=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),h=e-l*this._helper._pixelPerMeter/Math.cos(i),f=l<0?h:e,y=Math.PI/2+this.pitchInRadians,v=o.ad(this.fov)*(Math.abs(Math.cos(o.ad(this.roll)))*this.height+Math.abs(Math.sin(o.ad(this.roll)))*this.width)/this.height*(.5+s.y/this.height),T=Math.sin(v)*f/Math.sin(o.ae(Math.PI-y-v,.01,Math.PI-.01)),C=Ka(this),A=Math.atan(C/this._helper.cameraToCenterDistance),k=o.ad(.75),O=A>k?2*A*(.5+s.y/(2*C)):k,Z=Math.sin(O)*f/Math.sin(o.ae(Math.PI-y-O,.01,Math.PI-.01)),W=Math.min(T,Z);this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*W+f),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const e=this.centerOffset,i=kr(this.worldSize,this.center),s=i.x,l=i.y;this._helper._pixelPerMeter=o.aK(1,this.center.lat)*this.worldSize;const h=o.ad(Math.min(this.pitch,89.25)),f=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(h));let y;this._calculateNearFarZIfNeeded(f,h,e),y=new Float64Array(16),o.aY(y,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),o.aj(this._invProjMatrix,y),y[8]=2*-e.x/this._helper._width,y[9]=2*e.y/this._helper._height,this._projectionMatrix=o.aZ(y),o.M(y,y,[1,-1,1]),o.L(y,y,[0,0,-this._helper.cameraToCenterDistance]),o.a_(y,y,-this.rollInRadians),o.a$(y,y,this.pitchInRadians),o.a_(y,y,-this.bearingInRadians),o.L(y,y,[-s,-l,0]),this._mercatorMatrix=o.M([],y,[this.worldSize,this.worldSize,this.worldSize]),o.M(y,y,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=o.N(new Float64Array(16),this.clipSpaceToPixelsMatrix,y),o.L(y,y,[0,0,-this.elevation]),this._viewProjMatrix=y,this._invViewProjMatrix=o.aj([],y);const v=[0,0,-1,1];o.ap(v,v,this._invViewProjMatrix),this._cameraPosition=[v[0]/v[3],v[1]/v[3],v[2]/v[3]],this._fogMatrix=new Float64Array(16),o.aY(this._fogMatrix,this.fovInRadians,this.width/this.height,f,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,o.M(this._fogMatrix,this._fogMatrix,[1,-1,1]),o.L(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),o.a_(this._fogMatrix,this._fogMatrix,-this.rollInRadians),o.a$(this._fogMatrix,this._fogMatrix,this.pitchInRadians),o.a_(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),o.L(this._fogMatrix,this._fogMatrix,[-s,-l,0]),o.M(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),o.L(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=o.N(new Float64Array(16),this.clipSpaceToPixelsMatrix,y);const T=this._helper._width%2/2,C=this._helper._height%2/2,A=Math.cos(this.bearingInRadians),k=Math.sin(-this.bearingInRadians),O=s-Math.round(s)+A*T+k*C,Z=l-Math.round(l)+A*C+k*T,W=new Float64Array(y);if(o.L(W,W,[O>.5?O-1:O,Z>.5?Z-1:Z,0]),this._alignedProjMatrix=W,y=o.aj(new Float64Array(16),this._pixelMatrix),!y)throw new Error("failed to invert matrix");this._pixelMatrixInverse=y,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const e=this.screenPointToMercatorCoordinate(new o.P(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return o.ap(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=o.aK(1,this.center.lat)*this.worldSize;return Xi(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,i){const s=o.$.fromLngLat(e),l=[s.x*this.worldSize,s.y*this.worldSize,i,1];return o.ap(l,l,this._viewProjMatrix),l[2]/l[3]}getProjectionData(e){const{overscaledTileID:i,aligned:s,applyTerrainMatrix:l}=e,h=this._helper.getMercatorTileCoordinates(i),f=i?this.calculatePosMatrix(i,s,!0):null;let y;return y=i&&i.terrainRttPosMatrix32f&&l?i.terrainRttPosMatrix32f:f||o.b0(),{mainMatrix:y,tileMercatorCoords:h,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:y}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,i,s){return 1}transformLightDirection(e){return o.aQ(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,i,s,l){const h=this.calculatePosMatrix(s);let f;l?(f=[e,i,l(e,i),1],o.ap(f,f,h)):(f=[e,i,0,1],Fi(f,f,h));const y=f[3];return{point:new o.P(f[0]/y,f[1]/y),signedDistanceFromCamera:y,isOccluded:!1}}populateCache(e){for(const i of e)this.calculatePosMatrix(i)}getMatrixForModel(e,i){const s=o.$.fromLngLat(e,i),l=s.meterInMercatorCoordinateUnits(),h=o.b1();return o.L(h,h,[s.x,s.y,s.z]),o.a_(h,h,Math.PI),o.a$(h,h,Math.PI/2),o.M(h,h,[-l,l,l]),h}getProjectionDataForCustomLayer(e=!0){const i=new o.Y(0,0,0,0,0),s=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:e}),l=nr(i,this.worldSize);o.N(l,this._viewProjMatrix,l),s.tileMercatorCoords=[0,0,1,1];const h=[o.Z,o.Z,this.worldSize/this._helper.pixelsPerMeter],f=o.b2();return o.M(f,l,h),s.fallbackMatrix=f,s.mainMatrix=f,s}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function Ya(){o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Gn(u){if(u.useSlerp)if(u.k<1){const e=o.b3(u.startEulerAngles.roll,u.startEulerAngles.pitch,u.startEulerAngles.bearing),i=o.b3(u.endEulerAngles.roll,u.endEulerAngles.pitch,u.endEulerAngles.bearing),s=new Float64Array(4);o.b4(s,e,i,u.k);const l=o.b5(s);u.tr.setRoll(l.roll),u.tr.setPitch(l.pitch),u.tr.setBearing(l.bearing)}else u.tr.setRoll(u.endEulerAngles.roll),u.tr.setPitch(u.endEulerAngles.pitch),u.tr.setBearing(u.endEulerAngles.bearing);else u.tr.setRoll(o.B.number(u.startEulerAngles.roll,u.endEulerAngles.roll,u.k)),u.tr.setPitch(o.B.number(u.startEulerAngles.pitch,u.endEulerAngles.pitch,u.k)),u.tr.setBearing(o.B.number(u.startEulerAngles.bearing,u.endEulerAngles.bearing,u.k))}function Os(u,e,i,s,l){const h=l.padding,f=kr(l.worldSize,i.getNorthWest()),y=kr(l.worldSize,i.getNorthEast()),v=kr(l.worldSize,i.getSouthEast()),T=kr(l.worldSize,i.getSouthWest()),C=o.ad(-s),A=f.rotate(C),k=y.rotate(C),O=v.rotate(C),Z=T.rotate(C),W=new o.P(Math.max(A.x,k.x,Z.x,O.x),Math.max(A.y,k.y,Z.y,O.y)),q=new o.P(Math.min(A.x,k.x,Z.x,O.x),Math.min(A.y,k.y,Z.y,O.y)),H=W.sub(q),K=(l.width-(h.left+h.right+e.left+e.right))/H.x,ee=(l.height-(h.top+h.bottom+e.top+e.bottom))/H.y;if(ee<0||K<0)return void Ya();const te=Math.min(o.ab(l.scale*Math.min(K,ee)),u.maxZoom),ie=o.P.convert(u.offset),he=new o.P((e.left-e.right)/2,(e.top-e.bottom)/2).rotate(o.ad(s)),se=ie.add(he).mult(l.scale/o.aI(te));return{center:Bs(l.worldSize,f.add(v).div(2).sub(se)),zoom:te,bearing:s}}class dr{get useGlobeControls(){return!1}handlePanInertia(e,i){return{easingOffset:e,easingCenter:i.center}}handleMapControlsRollPitchBearingZoom(e,i){e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta),e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta)}handleMapControlsPan(e,i,s){e.around.distSqr(i.centerPoint)<.01||i.setLocationAtPoint(s,e.around)}cameraForBoxAndBearing(e,i,s,l,h){return Os(e,i,s,l,h)}handleJumpToCenterZoom(e,i){e.zoom!==(i.zoom!==void 0?+i.zoom:e.zoom)&&e.setZoom(+i.zoom),i.center!==void 0&&e.setCenter(o.Q.convert(i.center))}handleEaseTo(e,i){const s=e.zoom,l=e.padding,h={roll:e.roll,pitch:e.pitch,bearing:e.bearing},f={roll:i.roll===void 0?e.roll:i.roll,pitch:i.pitch===void 0?e.pitch:i.pitch,bearing:i.bearing===void 0?e.bearing:i.bearing},y=i.zoom!==void 0,v=!e.isPaddingEqual(i.padding);let T=!1;const C=y?+i.zoom:e.zoom;let A=e.centerPoint.add(i.offsetAsPoint);const k=e.screenPointToLocation(A),{center:O,zoom:Z}=e.getConstrained(o.Q.convert(i.center||k),C??s);Do(e,O);const W=kr(e.worldSize,k),q=kr(e.worldSize,O).sub(W),H=o.aI(Z-s);return T=Z!==s,{easeFunc:K=>{if(T&&e.setZoom(o.B.number(s,Z,K)),o.b6(h,f)||Gn({startEulerAngles:h,endEulerAngles:f,tr:e,k:K,useSlerp:h.roll!=f.roll}),v&&(e.interpolatePadding(l,i.padding,K),A=e.centerPoint.add(i.offsetAsPoint)),i.around)e.setLocationAtPoint(i.around,i.aroundPoint);else{const ee=o.aI(e.zoom-s),te=Z>s?Math.min(2,H):Math.max(.5,H),ie=Math.pow(te,1-K),he=Bs(e.worldSize,W.add(q.mult(K*ie)).mult(ee));e.setLocationAtPoint(e.renderWorldCopies?he.wrap():he,A)}},isZooming:T,elevationCenter:O}}handleFlyTo(e,i){const s=i.zoom!==void 0,l=e.zoom,h=e.getConstrained(o.Q.convert(i.center||i.locationAtOffset),s?+i.zoom:l),f=h.center,y=h.zoom;Do(e,f);const v=kr(e.worldSize,i.locationAtOffset),T=kr(e.worldSize,f).sub(v),C=T.mag(),A=o.aI(y-l);let k;if(i.minZoom!==void 0){const O=Math.min(+i.minZoom,l,y),Z=e.getConstrained(f,O).zoom;k=o.aI(Z-l)}return{easeFunc:(O,Z,W,q)=>{e.setZoom(O===1?y:l+o.ab(Z));const H=O===1?f:Bs(e.worldSize,v.add(T.mult(W)).mult(Z));e.setLocationAtPoint(e.renderWorldCopies?H.wrap():H,q)},scaleOfZoom:A,targetCenter:f,scaleOfMinZoom:k,pixelPathLength:C}}}class ri{constructor(e,i,s){this.blendFunction=e,this.blendColor=i,this.mask=s}}ri.Replace=[1,0],ri.disabled=new ri(ri.Replace,o.b7.transparent,[!1,!1,!1,!1]),ri.unblended=new ri(ri.Replace,o.b7.transparent,[!0,!0,!0,!0]),ri.alphaBlended=new ri([1,771],o.b7.transparent,[!0,!0,!0,!0]);const Jr=2305;class Ot{constructor(e,i,s){this.enable=e,this.mode=i,this.frontFace=s}}Ot.disabled=new Ot(!1,1029,Jr),Ot.backCCW=new Ot(!0,1029,Jr),Ot.frontCCW=new Ot(!0,1028,Jr);class vt{constructor(e,i,s){this.func=e,this.mask=i,this.range=s}}vt.ReadOnly=!1,vt.ReadWrite=!0,vt.disabled=new vt(519,vt.ReadOnly,[0,1]);const Ja=7680;class Rt{constructor(e,i,s,l,h,f){this.test=e,this.ref=i,this.mask=s,this.fail=l,this.depthFail=h,this.pass=f}}Rt.disabled=new Rt({func:519,mask:0},0,0,Ja,Ja,Ja);const Qa=new WeakMap;function Zr(u){var e;if(Qa.has(u))return Qa.get(u);{const i=(e=u.getParameter(u.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return Qa.set(u,i),i}}class js{get awaitingQuery(){return!!this._readbackQueue}constructor(e){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=e;const i=e.context,s=i.gl;this._texFormat=s.RGBA,this._texType=s.UNSIGNED_BYTE;const l=new o.aF;l.emplaceBack(-1,-1),l.emplaceBack(2,-1),l.emplaceBack(-1,2);const h=new o.aH;h.emplaceBack(0,1,2),this._fullscreenTriangle=new pa(i.createVertexBuffer(l,Un.members),i.createIndexBuffer(h),o.aG.simpleSegment(0,0,l.length,h.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(s.TEXTURE1);const f=s.createTexture();s.bindTexture(s.TEXTURE_2D,f),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texImage2D(s.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(f),Zr(s)&&(this._pbo=s.createBuffer(),s.bindBuffer(s.PIXEL_PACK_BUFFER,this._pbo),s.bufferData(s.PIXEL_PACK_BUFFER,4,s.STREAM_READ),s.bindBuffer(s.PIXEL_PACK_BUFFER,null))}destroy(){const e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,i){const s=this._updateCount;return this._readbackQueue?s>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():s>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,i),this._updateCount++,this._measuredError}_bindFramebuffer(){const e=this._cachedRenderContext.context,i=e.gl;e.activeTexture.set(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,i){const s=this._cachedRenderContext.context,l=s.gl;if(this._bindFramebuffer(),s.viewport.set([0,0,this._texWidth,this._texHeight]),s.clear({color:o.b7.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(s,l.TRIANGLES,vt.disabled,Rt.disabled,ri.unblended,Ot.disabled,((h,f)=>({u_input:h,u_output_expected:f}))(e,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Zr(l)){l.bindBuffer(l.PIXEL_PACK_BUFFER,this._pbo),l.readBuffer(l.COLOR_ATTACHMENT0),l.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null);const h=l.fenceSync(l.SYNC_GPU_COMMANDS_COMPLETE,0);l.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:h}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&Zr(e)){const i=e.clientWaitSync(this._readbackQueue.sync,0,0);if(i===e.WAIT_FAILED)return o.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(i===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=js._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let i=0;return i+=e[0]/256,i+=e[1]/65536,i+=e[2]/16777216,e[3]<127&&(i=-i),i/128}}const Ns=o.Z/128;function Lo(u,e){const i=u.granularity!==void 0?Math.max(u.granularity,1):1,s=i+(u.generateBorders?2:0),l=i+(u.extendToNorthPole||u.generateBorders?1:0)+(u.extendToSouthPole||u.generateBorders?1:0),h=s+1,f=l+1,y=u.generateBorders?-1:0,v=u.generateBorders||u.extendToNorthPole?-1:0,T=i+(u.generateBorders?1:0),C=i+(u.generateBorders||u.extendToSouthPole?1:0),A=h*f,k=s*l*6,O=h*f>65536;if(O&&e==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const Z=O||e==="32bit",W=new Int16Array(2*A);let q=0;for(let ee=v;ee<=C;ee++)for(let te=y;te<=T;te++){let ie=te/i*o.Z;te===-1&&(ie=-64),te===i+1&&(ie=o.Z+Ns);let he=ee/i*o.Z;ee===-1&&(he=u.extendToNorthPole?o.b9:-64),ee===i+1&&(he=u.extendToSouthPole?o.ba:o.Z+Ns),W[q++]=ie,W[q++]=he}const H=Z?new Uint32Array(k):new Uint16Array(k);let K=0;for(let ee=0;ee<l;ee++)for(let te=0;te<s;te++){const ie=te+1+ee*h,he=te+(ee+1)*h,se=te+1+(ee+1)*h;H[K++]=te+ee*h,H[K++]=he,H[K++]=ie,H[K++]=ie,H[K++]=he,H[K++]=se}return{vertices:W.buffer.slice(0),indices:H.buffer.slice(0),uses32bitIndices:Z}}const Zs=new o.aE({fill:new o.bb(128,2),line:new o.bb(512,0),tile:new o.bb(128,32),stencil:new o.bb(128,1),circle:3});class Vs{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return Nr.projectionGlobe}get vertexShaderPreludeCode(){return Nr.projectionMercator.vertexSource}get subdivisionGranularity(){return Zs}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new js(e));const i=o.S(this._errorQueryLatitudeDegrees),s=2*Math.atan(Math.exp(Math.PI-i*Math.PI*2))-.5*Math.PI,l=this._errorMeasurement.updateErrorLoop(i,s),h=ae.now();l!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=l,this._errorMeasurementLastChangeTime=h);const f=Math.min(Math.max((h-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=o.bc(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,o.bd(f))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,i,s,l,h){const f=(h==="stencil"?Zs.stencil:Zs.tile).getGranularityForZoomLevel(i.z);return this._getMesh(e,{granularity:f,generateBorders:s,extendToNorthPole:i.y===0&&l,extendToSouthPole:i.y===(1<<i.z)-1&&l})}_getMesh(e,i){const s=this._getMeshKey(i);if(s in this._tileMeshCache)return this._tileMeshCache[s];const l=function(h,f){const y=Lo(f,"16bit"),v=o.aF.deserialize({arrayBuffer:y.vertices,length:y.vertices.byteLength/2/2}),T=o.aH.deserialize({arrayBuffer:y.indices,length:y.indices.byteLength/2/3});return new pa(h.createVertexBuffer(v,Un.members),h.createIndexBuffer(T),o.aG.simpleSegment(0,0,v.length,T.length))}(e,i);return this._tileMeshCache[s]=l,l}recalculate(e){}hasTransition(){const e=ae.now();let i=!1;return i=i||(e-this._errorMeasurementLastChangeTime)/1e3<.7,i=i||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,i}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}}const Fo=new o.r({type:new o.D(o.v.projection.type)});class es extends o.E{constructor(e){super(),this._transitionable=new o.T(Fo),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new o.C(0)),this._mercatorProjection=new Ft,this._verticalPerspectiveProjection=new Vs}get transitionState(){const e=this.properties.get("type");if(typeof e=="string"&&e==="mercator")return 0;if(typeof e=="string"&&e==="vertical-perspective")return 1;if(e instanceof o.be){if(e.from==="vertical-perspective"&&e.to==="mercator")return 1-e.transition;if(e.from==="mercator"&&e.to==="vertical-perspective")return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,i,s,l,h){return this.currentProjection.getMeshFromTileID(e,i,s,l,h)}setProjection(e){this._transitionable.setValue("type",(e==null?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}}function hh(u){const e=Bo(u.worldSize,u.center.lat);return 2*Math.PI*e}function fa(u,e,i,s,l){const h=1/(1<<l),f=e/o.Z*h+s*h,y=o.bg((u/o.Z*h+i*h)*Math.PI*2+Math.PI,2*Math.PI),v=2*Math.atan(Math.exp(Math.PI-f*Math.PI*2))-.5*Math.PI,T=Math.cos(v),C=new Float64Array(3);return C[0]=Math.sin(y)*T,C[1]=Math.sin(v),C[2]=Math.cos(y)*T,C}function Ki(u){return function(e,i){const s=Math.cos(i),l=new Float64Array(3);return l[0]=Math.sin(e)*s,l[1]=Math.sin(i),l[2]=Math.cos(e)*s,l}(u.lng*Math.PI/180,u.lat*Math.PI/180)}function Bo(u,e){return u/(2*Math.PI)/Math.cos(e*Math.PI/180)}function dh(u){const e=Math.asin(u[1])/Math.PI*180,i=Math.sqrt(u[0]*u[0]+u[2]*u[2]);if(i>1e-6){const s=u[0]/i,l=Math.acos(u[2]/i),h=(s>0?l:-l)/Math.PI*180;return new o.Q(o.aL(h,-180,180),e)}return new o.Q(0,e)}function er(u){return Math.cos(u*Math.PI/180)}function Ri(u,e){const i=er(u),s=er(e);return o.ab(s/i)}function Vr(u,e){const i=u.rotate(e.bearingInRadians),s=e.zoom+Ri(e.center.lat,0),l=o.bc(1/er(e.center.lat),1/er(Math.min(Math.abs(e.center.lat),60)),o.bf(s,7,3,0,1)),h=360/hh({worldSize:e.worldSize,center:{lat:e.center.lat}});return new o.Q(e.center.lng-i.x*h*l,o.ae(e.center.lat+i.y*h,-85.051129,o.aJ))}function ts(u){const e=.5*u,i=Math.sin(e),s=Math.cos(e);return Math.log(i+s)-Math.log(s-i)}function hc(u,e,i,s){const l=u.lat+i*s;if(Math.abs(i)>1){const h=(Math.sign(u.lat+i)!==Math.sign(u.lat)?-Math.abs(u.lat):Math.abs(u.lat))*Math.PI/180,f=Math.abs(u.lat+i)*Math.PI/180,y=ts(h+s*(f-h)),v=ts(h),T=ts(f);return new o.Q(u.lng+e*((y-v)/(T-v)),l)}return new o.Q(u.lng+e*s,l)}class ph{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._aabbFactory=e}recalculateCache(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileAABB(e,i,s,l){const h=`${e.z}_${e.x}_${e.y}`,f=this._cache.get(h);if(f)return f;const y=this._cachePrevious.get(h);if(y)return this._cache.set(h,y),y;const v=this._aabbFactory(e,i,s,l);return this._cache.set(h,v),this._hadAnyChanges=!0,v}}function yn(u,e,i){const s=u-e;return s<0?-s:Math.max(0,s-i)}function dc(u,e,i,s,l){const h=u-i;let f;return f=h<0?Math.min(-h,1+h-l):h>1?Math.min(Math.max(h-l,0),1-h):0,Math.max(f,yn(e,s,l))}class Xd{constructor(){this._aabbCache=new ph(this._computeTileAABB)}recalculateCache(){this._aabbCache.recalculateCache()}distanceToTile2d(e,i,s,l){const h=1<<s.z,f=1/h,y=s.x/h,v=s.y/h;let T=2;return T=Math.min(T,dc(e,i,y,v,f)),T=Math.min(T,dc(e,i,y+.5,-v-f,f)),T=Math.min(T,dc(e,i,y+.5,2-v-f,f)),T}getWrap(e,i,s){const l=1<<i.z,h=1/l,f=i.x/l,y=yn(e.x,f,h),v=yn(e.x,f-1,h),T=yn(e.x,f+1,h),C=Math.min(y,v,T);return C===T?1:C===v?-1:0}allowVariableZoom(e,i){return mn(e,i)>4}allowWorldCopies(){return!1}getTileAABB(e,i,s,l){return this._aabbCache.getTileAABB(e,i,s,l)}_computeTileAABB(e,i,s,l){if(e.z<=0)return new Bi([-1,-1,-1],[1,1,1]);if(e.z===1)return new Bi([e.x===0?-1:0,e.y===0?0:-1,-1],[e.x===0?0:1,e.y===0?1:0,1]);{const h=[fa(0,0,e.x,e.y,e.z),fa(o.Z,0,e.x,e.y,e.z),fa(o.Z,o.Z,e.x,e.y,e.z),fa(0,o.Z,e.x,e.y,e.z)],f=[1,1,1],y=[-1,-1,-1];for(const v of h)for(let T=0;T<3;T++)f[T]=Math.min(f[T],v[T]),y[T]=Math.max(y[T],v[T]);if(e.y===0||e.y===(1<<e.z)-1){const v=[0,e.y===0?1:-1,0];for(let T=0;T<3;T++)f[T]=Math.min(f[T],v[T]),y[T]=Math.max(y[T],v[T])}return new Bi(f,y)}}}class Oo{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,i,s){return this._helper.interpolatePadding(e,i,s)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,i){this._helper.resize(e,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,i){this._helper.overrideNearFarZ(e,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(){this._cachedClippingPlane=o.bh(),this._projectionMatrix=o.b1(),this._globeViewProjMatrix32f=o.b0(),this._globeViewProjMatrixNoCorrection=o.b1(),this._globeViewProjMatrixNoCorrectionInverted=o.b1(),this._globeProjMatrixInverted=o.b1(),this._cameraPosition=o.bi(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new hr({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,i)=>this.getConstrained(e,i)}),this._coveringTilesDetailsProvider=new Xd}clone(){const e=new Oo;return e.apply(this),e}apply(e,i){this._globeLatitudeErrorCorrectionRadians=i||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const e=o.bi();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){const{overscaledTileID:i,applyGlobeMatrix:s}=e,l=this._helper.getMercatorTileCoordinates(i);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:l,clippingPlane:this._cachedClippingPlane,projectionTransition:s?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const i=this.pitchInRadians,s=this.cameraToCenterDistance/e,l=Math.sin(i)*s,h=Math.cos(i)*s+1,f=1/Math.sqrt(l*l+h*h)*1;let y=-l,v=h;const T=Math.sqrt(y*y+v*v);y/=T,v/=T;const C=[0,y,v];return o.bj(C,C,[0,0,0],-this.bearingInRadians),o.bk(C,C,[0,0,0],-1*this.center.lat*Math.PI/180),o.bl(C,C,[0,0,0],this.center.lng*Math.PI/180),o.aO(C,C,.25),[...C,.25*-f]}isLocationOccluded(e){return!this.isSurfacePointVisible(Ki(e))}transformLightDirection(e){const i=this._helper._center.lng*Math.PI/180,s=this._helper._center.lat*Math.PI/180,l=Math.cos(s),h=[Math.sin(i)*l,Math.sin(s),Math.cos(i)*l],f=[h[2],0,-h[0]],y=[0,0,0];o.aU(y,f,h),o.aT(f,f),o.aT(y,y);const v=[0,0,0];return o.aT(v,[f[0]*e[0]+y[0]*e[1]+h[0]*e[2],f[1]*e[0]+y[1]*e[1]+h[1]*e[2],f[2]*e[0]+y[2]*e[1]+h[2]*e[2]]),v}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,i,s){const l=function(y,v,T){const C=1/(1<<T.z);return new o.$(y/o.Z*C+T.x*C,v/o.Z*C+T.y*C)}(e,i,s.canonical),h=(f=l.y,[o.bg(l.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-f*Math.PI*2))-.5*Math.PI]);var f;return this.getCircleRadiusCorrection()/Math.cos(h[1])}projectTileCoordinates(e,i,s,l){const h=s.canonical,f=fa(e,i,h.x,h.y,h.z),y=1+(l?l(e,i):0)/o.br,v=[f[0]*y,f[1]*y,f[2]*y,1];o.ap(v,v,this._globeViewProjMatrixNoCorrection);const T=this._cachedClippingPlane,C=T[0]*f[0]+T[1]*f[1]+T[2]*f[2]+T[3]<0;return{point:new o.P(v[0]/v[3],v[1]/v[3]),signedDistanceFromCamera:v[3],isOccluded:C}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const e=Bo(this.worldSize,this.center.lat),i=o.b2(),s=o.b2();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),o.aY(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const l=this.centerOffset;i[8]=2*-l.x/this._helper._width,i[9]=2*l.y/this._helper._height,this._projectionMatrix=o.aZ(i),this._globeProjMatrixInverted=o.b2(),o.aj(this._globeProjMatrixInverted,i),o.L(i,i,[0,0,-this.cameraToCenterDistance]),o.a_(i,i,this.rollInRadians),o.a$(i,i,-this.pitchInRadians),o.a_(i,i,this.bearingInRadians),o.L(i,i,[0,0,-e]);const h=o.bi();h[0]=e,h[1]=e,h[2]=e,o.a$(s,i,this.center.lat*Math.PI/180),o.bm(s,s,-this.center.lng*Math.PI/180),o.M(s,s,h),this._globeViewProjMatrixNoCorrection=s,o.a$(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),o.bm(i,i,-this.center.lng*Math.PI/180),o.M(i,i,h),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=o.b2(),o.aj(this._globeViewProjMatrixNoCorrectionInverted,s);const f=o.bi();this._cameraPosition=o.bi(),this._cameraPosition[2]=this.cameraToCenterDistance/e,o.bj(this._cameraPosition,this._cameraPosition,f,-this.rollInRadians),o.bk(this._cameraPosition,this._cameraPosition,f,this.pitchInRadians),o.bj(this._cameraPosition,this._cameraPosition,f,-this.bearingInRadians),o.aP(this._cameraPosition,this._cameraPosition,[0,0,1]),o.bk(this._cameraPosition,this._cameraPosition,f,-this.center.lat*Math.PI/180),o.bl(this._cameraPosition,this._cameraPosition,f,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);const y=o.aZ(this._globeViewProjMatrixNoCorrectionInverted);o.M(y,y,[1,1,-1]),this._cachedFrustum=$n.fromInvProjectionMatrix(y)}calculateFogMatrix(e){o.w("calculateFogMatrix is not supported on globe projection.");const i=o.b2();return o.at(i),i}getVisibleUnwrappedCoordinates(e){return[new o.aW(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&o.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,i){if(!this._globeViewProjMatrixNoCorrection)return 1;const s=Ki(e);o.aO(s,s,1+i/o.br);const l=o.bh();return o.ap(l,[s[0],s[1],s[2],1],this._globeViewProjMatrixNoCorrection),l[2]/l[3]}populateCache(e){}getBounds(){const e=.5*this.width,i=.5*this.height,s=[new o.P(0,0),new o.P(e,0),new o.P(this.width,0),new o.P(this.width,i),new o.P(this.width,this.height),new o.P(e,this.height),new o.P(0,this.height),new o.P(0,i)],l=[];for(const A of s)l.push(this.unprojectScreenPoint(A));let h=0,f=0,y=0,v=0;const T=this.center;for(const A of l){const k=o.bn(T.lng,A.lng),O=o.bn(T.lat,A.lat);k<f&&(f=k),k>h&&(h=k),O<v&&(v=O),O>y&&(y=O)}const C=[T.lng+f,T.lat+v,T.lng+h,T.lat+y];return this.isSurfacePointOnScreen([0,1,0])&&(C[3]=90,C[0]=-180,C[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(C[1]=-90,C[0]=-180,C[2]=180),new wi(C)}getConstrained(e,i){const s=o.ae(e.lat,-85.051129,o.aJ),l=o.ae(+i,this.minZoom+Ri(0,s),this.maxZoom);return{center:new o.Q(e.lng,s),zoom:l}}calculateCenterFromCameraLngLatAlt(e,i,s,l){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,s,l)}setLocationAtPoint(e,i){const s=Ki(this.unprojectScreenPoint(i)),l=Ki(e),h=o.bi();o.bo(h);const f=o.bi();o.bl(f,s,h,-this.center.lng*Math.PI/180),o.bk(f,f,h,this.center.lat*Math.PI/180);const y=l[0]*l[0]+l[2]*l[2],v=f[0]*f[0];if(y<v)return;const T=Math.sqrt(y-v),C=-T,A=o.bp(l[0],l[2],f[0],T),k=o.bp(l[0],l[2],f[0],C),O=o.bi();o.bl(O,l,h,-A);const Z=o.bp(O[1],O[2],f[1],f[2]),W=o.bi();o.bl(W,l,h,-k);const q=o.bp(W[1],W[2],f[1],f[2]),H=.5*Math.PI,K=Z>=-H&&Z<=H,ee=q>=-H&&q<=H;let te,ie;if(K&&ee){const ge=this.center.lng*Math.PI/180,Ie=this.center.lat*Math.PI/180;o.bs(A,ge)+o.bs(Z,Ie)<o.bs(k,ge)+o.bs(q,Ie)?(te=A,ie=Z):(te=k,ie=q)}else if(K)te=A,ie=Z;else{if(!ee)return;te=k,ie=q}const he=te/Math.PI*180,se=ie/Math.PI*180,ye=this.center.lat;this.setCenter(new o.Q(he,o.ae(se,-90,90))),this.setZoom(this.zoom+Ri(ye,this.center.lat))}locationToScreenPoint(e,i){const s=Ki(e);if(i){const l=i.getElevationForLngLatZoom(e,this._helper._tileZoom);o.aO(s,s,1+l/o.br)}return this._projectSurfacePointToScreen(s)}_projectSurfacePointToScreen(e){const i=o.bh();return o.ap(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new o.P((.5*i[0]+.5)*this.width,(.5*-i[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,i){if(i){const s=i.pointCoordinate(e);if(s)return s}return o.$.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,i){var s;return(s=this.screenPointToMercatorCoordinate(e,i))===null||s===void 0?void 0:s.toLngLat()}isPointOnMapSurface(e,i){const s=this._cameraPosition,l=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(s,l)}getRayDirectionFromPixel(e){const i=o.bh();i[0]=e.x/this.width*2-1,i[1]=-1*(e.y/this.height*2-1),i[2]=1,i[3]=1,o.ap(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];const s=o.bi();s[0]=i[0]-this._cameraPosition[0],s[1]=i[1]-this._cameraPosition[1],s[2]=i[2]-this._cameraPosition[2];const l=o.bi();return o.aT(l,s),l}isSurfacePointVisible(e){const i=this._cachedClippingPlane;return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;const i=o.bh();return o.ap(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(e,i){const s=o.aV(e,i),l=o.bi(),h=o.bi();o.aO(h,i,s),o.aS(l,e,h);const f=1-o.aV(l,l);if(f<0)return null;const y=o.aV(e,e)-1,v=-s+(s<0?1:-1)*Math.sqrt(f),T=y/v,C=v;return{tMin:Math.min(T,C),tMax:Math.max(T,C)}}unprojectScreenPoint(e){const i=this._cameraPosition,s=this.getRayDirectionFromPixel(e),l=this.rayPlanetIntersection(i,s);if(l){const T=o.bi();o.aP(T,i,[s[0]*l.tMin,s[1]*l.tMin,s[2]*l.tMin]);const C=o.bi();return o.aT(C,T),dh(C)}const h=this._cachedClippingPlane[0]*s[0]+this._cachedClippingPlane[1]*s[1]+this._cachedClippingPlane[2]*s[2],f=-o.bq(this._cachedClippingPlane,i)/h,y=o.bi();if(f>0)o.aP(y,i,[s[0]*f,s[1]*f,s[2]*f]);else{const T=o.bi();o.aP(T,i,[2*s[0],2*s[1],2*s[2]]);const C=o.bq(this._cachedClippingPlane,T);o.aS(y,T,[this._cachedClippingPlane[0]*C,this._cachedClippingPlane[1]*C,this._cachedClippingPlane[2]*C])}const v=o.bi();return o.aT(v,y),dh(v)}getMatrixForModel(e,i){const s=o.Q.convert(e),l=1/o.br,h=o.b1();return o.bm(h,h,s.lng/180*Math.PI),o.a$(h,h,-s.lat/180*Math.PI),o.L(h,h,[0,0,1+i/o.br]),o.a$(h,h,.5*Math.PI),o.M(h,h,[l,l,l]),h}getProjectionDataForCustomLayer(e=!0){const i=this.getProjectionData({overscaledTileID:new o.Y(0,0,0,0,0),applyGlobeMatrix:e});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(e){}}class jo{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,i,s){return this._helper.interpolatePadding(e,i,s)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,i,s=!0){this._helper.resize(e,i,s)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,i){this._helper.overrideNearFarZ(e,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,i){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=i,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().recalculateCache(),this._mercatorTransform.getCoveringTilesDetailsProvider().recalculateCache()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new hr({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,i)=>this.getConstrained(e,i)}),this._globeness=1,this._mercatorTransform=new ui,this._verticalPerspectiveTransform=new Oo}clone(){const e=new jo;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this),e}apply(e){this._helper.apply(e),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){const i=this._mercatorTransform.getProjectionData(e),s=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?s.mainMatrix:i.mainMatrix,clippingPlane:s.clippingPlane,tileMercatorCoords:s.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:i.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return o.bc(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return o.bc(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,i,s){const l=this._mercatorTransform.getPitchedTextCorrection(e,i,s),h=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,i,s);return o.bc(l,h,this._globeness)}projectTileCoordinates(e,i,s,l){return this.currentTransform.projectTileCoordinates(e,i,s,l)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,i){return this.currentTransform.lngLatToCameraDepth(e,i)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}getConstrained(e,i){return this.currentTransform.getConstrained(e,i)}calculateCenterFromCameraLngLatAlt(e,i,s,l){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,s,l)}setLocationAtPoint(e,i){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,i),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(e,i),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(e,i){return this.currentTransform.locationToScreenPoint(e,i)}screenPointToMercatorCoordinate(e,i){return this.currentTransform.screenPointToMercatorCoordinate(e,i)}screenPointToLocation(e,i){return this.currentTransform.screenPointToLocation(e,i)}isPointOnMapSurface(e,i){return this.currentTransform.isPointOnMapSurface(e,i)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,i){return this.currentTransform.getMatrixForModel(e,i)}getProjectionDataForCustomLayer(e=!0){const i=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return i;const s=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return s.fallbackMatrix=i.mainMatrix,s}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class Ur{get useGlobeControls(){return!0}handlePanInertia(e,i){const s=Vr(e,i);return Math.abs(s.lng-i.center.lng)>180&&(s.lng=i.center.lng+179.5*Math.sign(s.lng-i.center.lng)),{easingCenter:s,easingOffset:new o.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,i){const s=e.around,l=i.screenPointToLocation(s);e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta);const h=i.zoom;e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta);const f=i.zoom-h;if(f===0)return;const y=o.bn(i.center.lng,l.lng),v=y/(Math.abs(y/180)+1),T=o.bn(i.center.lat,l.lat),C=i.getRayDirectionFromPixel(s),A=i.cameraPosition,k=-1*o.aV(A,C),O=o.bi();o.aP(O,A,[C[0]*k,C[1]*k,C[2]*k]);const Z=o.bt(O)-1,W=Math.exp(.5*-Math.max(Z-.3,0)),q=Bo(i.worldSize,i.center.lat)/Math.min(i.width,i.height),H=o.bf(q,.9,.5,1,.25),K=(1-o.aI(-f))*Math.min(W,H),ee=i.center.lat,te=i.zoom,ie=new o.Q(i.center.lng+v*K,o.ae(i.center.lat+T*K,-85.051129,o.aJ));i.setLocationAtPoint(l,s);const he=i.center,se=o.bf(Math.abs(y),45,85,0,1),ye=o.bf(q,.75,.35,0,1),ge=Math.pow(Math.max(se,ye),.25),Ie=o.bn(he.lng,ie.lng),ke=o.bn(he.lat,ie.lat);i.setCenter(new o.Q(he.lng+Ie*ge,he.lat+ke*ge).wrap()),i.setZoom(te+Ri(ee,i.center.lat))}handleMapControlsPan(e,i,s){if(!e.panDelta)return;const l=i.center.lat,h=i.zoom;i.setCenter(Vr(e.panDelta,i).wrap()),i.setZoom(h+Ri(l,i.center.lat))}cameraForBoxAndBearing(e,i,s,l,h){const f=Os(e,i,s,l,h),y=i.left/h.width*2-1,v=(h.width-i.right)/h.width*2-1,T=i.top/h.height*-2+1,C=(h.height-i.bottom)/h.height*-2+1,A=o.bn(s.getWest(),s.getEast())<0,k=A?s.getEast():s.getWest(),O=A?s.getWest():s.getEast(),Z=Math.max(s.getNorth(),s.getSouth()),W=Math.min(s.getNorth(),s.getSouth()),q=k+.5*o.bn(k,O),H=Z+.5*o.bn(Z,W),K=h.clone();K.setCenter(f.center),K.setBearing(f.bearing),K.setPitch(0),K.setRoll(0),K.setZoom(f.zoom);const ee=K.modelViewProjectionMatrix,te=[Ki(s.getNorthWest()),Ki(s.getNorthEast()),Ki(s.getSouthWest()),Ki(s.getSouthEast()),Ki(new o.Q(O,H)),Ki(new o.Q(k,H)),Ki(new o.Q(q,Z)),Ki(new o.Q(q,W))],ie=Ki(f.center);let he=Number.POSITIVE_INFINITY;for(const se of te)y<0&&(he=Ur.getLesserNonNegativeNonNull(he,Ur.solveVectorScale(se,ie,ee,"x",y))),v>0&&(he=Ur.getLesserNonNegativeNonNull(he,Ur.solveVectorScale(se,ie,ee,"x",v))),T>0&&(he=Ur.getLesserNonNegativeNonNull(he,Ur.solveVectorScale(se,ie,ee,"y",T))),C<0&&(he=Ur.getLesserNonNegativeNonNull(he,Ur.solveVectorScale(se,ie,ee,"y",C)));if(Number.isFinite(he)&&he!==0)return f.zoom=K.zoom+o.ab(he),f;Ya()}handleJumpToCenterZoom(e,i){const s=e.center.lat,l=e.getConstrained(i.center?o.Q.convert(i.center):e.center,e.zoom).center;e.setCenter(l.wrap());const h=i.zoom!==void 0?+i.zoom:e.zoom+Ri(s,l.lat);e.zoom!==h&&e.setZoom(h)}handleEaseTo(e,i){const s=e.zoom,l=e.center,h=e.padding,f={roll:e.roll,pitch:e.pitch,bearing:e.bearing},y={roll:i.roll===void 0?e.roll:i.roll,pitch:i.pitch===void 0?e.pitch:i.pitch,bearing:i.bearing===void 0?e.bearing:i.bearing},v=i.zoom!==void 0,T=!e.isPaddingEqual(i.padding);let C=!1;const A=i.center?o.Q.convert(i.center):l,k=e.getConstrained(A,s).center;Do(e,k);const O=e.clone();O.setCenter(k),O.setZoom(v?+i.zoom:s+Ri(l.lat,A.lat)),O.setBearing(i.bearing);const Z=new o.P(o.ae(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),o.ae(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));O.setLocationAtPoint(k,Z);const W=(i.offset&&i.offsetAsPoint.mag())>0?O.center:k,q=v?+i.zoom:s+Ri(l.lat,W.lat),H=s+Ri(l.lat,0),K=q+Ri(W.lat,0),ee=o.bn(l.lng,W.lng),te=o.bn(l.lat,W.lat),ie=o.aI(K-H);return C=q!==s,{easeFunc:he=>{if(o.b6(f,y)||Gn({startEulerAngles:f,endEulerAngles:y,tr:e,k:he,useSlerp:f.roll!=y.roll}),T&&e.interpolatePadding(h,i.padding,he),i.around)o.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(i.around,i.aroundPoint);else{const se=K>H?Math.min(2,ie):Math.max(.5,ie),ye=Math.pow(se,1-he),ge=hc(l,ee,te,he*ye);e.setCenter(ge.wrap())}if(C){const se=o.B.number(H,K,he)+Ri(0,e.center.lat);e.setZoom(se)}},isZooming:C,elevationCenter:W}}handleFlyTo(e,i){const s=i.zoom!==void 0,l=e.center,h=e.zoom,f=e.padding,y=!e.isPaddingEqual(i.padding),v=e.getConstrained(o.Q.convert(i.center||i.locationAtOffset),h).center,T=s?+i.zoom:e.zoom+Ri(e.center.lat,v.lat),C=e.clone();C.setCenter(v),C.setZoom(T),C.setBearing(i.bearing);const A=new o.P(o.ae(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),o.ae(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));C.setLocationAtPoint(v,A);const k=C.center;Do(e,k);const O=function(te,ie,he){const se=Ki(ie),ye=Ki(he),ge=o.aV(se,ye),Ie=Math.acos(ge),ke=hh(te);return Ie/(2*Math.PI)*ke}(e,l,k),Z=h+Ri(l.lat,0),W=T+Ri(k.lat,0),q=o.aI(W-Z);let H;if(typeof i.minZoom=="number"){const te=+i.minZoom+Ri(k.lat,0),ie=Math.min(te,Z,W)+Ri(0,k.lat),he=e.getConstrained(k,ie).zoom+Ri(k.lat,0);H=o.aI(he-Z)}const K=o.bn(l.lng,k.lng),ee=o.bn(l.lat,k.lat);return{easeFunc:(te,ie,he,se)=>{const ye=hc(l,K,ee,he);y&&e.interpolatePadding(f,i.padding,te);const ge=te===1?k:ye;e.setCenter(ge.wrap());const Ie=Z+o.ab(ie);e.setZoom(te===1?T:Ie+Ri(0,ge.lat))},scaleOfZoom:q,targetCenter:k,scaleOfMinZoom:H,pixelPathLength:O}}static solveVectorScale(e,i,s,l,h){const f=l==="x"?[s[0],s[4],s[8],s[12]]:[s[1],s[5],s[9],s[13]],y=[s[3],s[7],s[11],s[15]],v=e[0]*f[0]+e[1]*f[1]+e[2]*f[2],T=e[0]*y[0]+e[1]*y[1]+e[2]*y[2],C=i[0]*f[0]+i[1]*f[1]+i[2]*f[2],A=i[0]*y[0]+i[1]*y[1]+i[2]*y[2];return C+h*T===v+h*A||y[3]*(v-C)+f[3]*(A-T)+v*A==C*T?null:(C+f[3]-h*A-h*y[3])/(C-v-h*A+h*T)}static getLesserNonNegativeNonNull(e,i){return i!==null&&i>=0&&i<e?i:e}}class fh{constructor(e){this._globe=e,this._mercatorCameraHelper=new dr,this._verticalPerspectiveCameraHelper=new Ur}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,i){return this.currentHelper.handlePanInertia(e,i)}handleMapControlsRollPitchBearingZoom(e,i){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,i)}handleMapControlsPan(e,i,s){this.currentHelper.handleMapControlsPan(e,i,s)}cameraForBoxAndBearing(e,i,s,l,h){return this.currentHelper.cameraForBoxAndBearing(e,i,s,l,h)}handleJumpToCenterZoom(e,i){this.currentHelper.handleJumpToCenterZoom(e,i)}handleEaseTo(e,i){return this.currentHelper.handleEaseTo(e,i)}handleFlyTo(e,i){return this.currentHelper.handleFlyTo(e,i)}}const ma=(u,e)=>o.x(u,e&&e.filter(i=>i.identifier!=="source.canvas")),pc=o.bu();class is extends o.E{constructor(e,i={}){super(),this._rtlPluginLoaded=()=>{for(const s in this.sourceCaches){const l=this.sourceCaches[s].getSource().type;l!=="vector"&&l!=="geojson"||this.sourceCaches[s].reload()}},this.map=e,this.dispatcher=new Tt(Qt(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(s,l)=>this.getGlyphs(s,l)),this.dispatcher.registerMessageHandler("GI",(s,l)=>this.getImages(s,l)),this.imageManager=new Wi,this.imageManager.setEventedParent(this),this.glyphManager=new Jt(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new lt(256,512),this.crossTileSymbolIndex=new Ro,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new o.bv,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",o.bw()),pn().on(ha,this._rtlPluginLoaded),this.on("data",s=>{if(s.dataType!=="source"||s.sourceDataType!=="metadata")return;const l=this.sourceCaches[s.sourceId];if(!l)return;const h=l.getSource();if(h&&h.vectorLayerIds)for(const f in this._layers){const y=this._layers[f];y.source===h.id&&this._validateLayer(y)}})}loadURL(e,i={},s){this.fire(new o.l("dataloading",{dataType:"style"})),i.validate=typeof i.validate!="boolean"||i.validate;const l=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const h=this._loadStyleRequest;o.j(l,this._loadStyleRequest).then(f=>{this._loadStyleRequest=null,this._load(f.data,i,s)}).catch(f=>{this._loadStyleRequest=null,f&&!h.signal.aborted&&this.fire(new o.k(f))})}loadJSON(e,i={},s){this.fire(new o.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,ae.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,i.validate=i.validate!==!1,this._load(e,i,s)}).catch(()=>{})}loadEmpty(){this.fire(new o.l("dataloading",{dataType:"style"})),this._load(pc,{validate:!1})}_load(e,i,s){var l,h;const f=i.transformStyle?i.transformStyle(s,e):e;if(!i.validate||!ma(this,o.y(f))){this._loaded=!0,this.stylesheet=f;for(const y in f.sources)this.addSource(y,f.sources[y],{validate:!1});f.sprite?this._loadSprite(f.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(f.glyphs),this._createLayers(),this.light=new vr(this.stylesheet.light),this._setProjectionInternal(((l=this.stylesheet.projection)===null||l===void 0?void 0:l.type)||"mercator"),this.sky=new hn(this.stylesheet.sky),this.map.setTerrain((h=this.stylesheet.terrain)!==null&&h!==void 0?h:null),this.fire(new o.l("data",{dataType:"style"})),this.fire(new o.l("style.load"))}}_createLayers(){const e=o.bx(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(i=>i.id),this._layers={},this._serializedLayers=null;for(const i of e){const s=o.by(i);s.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=s}}_loadSprite(e,i=!1,s=void 0){let l;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(h,f,y,v){return o._(this,void 0,void 0,function*(){const T=kt(h),C=y>1?"@2x":"",A={},k={};for(const{id:O,url:Z}of T){const W=f.transformRequest(Et(Z,C,".json"),"SpriteJSON");A[O]=o.j(W,v);const q=f.transformRequest(Et(Z,C,".png"),"SpriteImage");k[O]=pt.getImage(q,v)}return yield Promise.all([...Object.values(A),...Object.values(k)]),function(O,Z){return o._(this,void 0,void 0,function*(){const W={};for(const q in O){W[q]={};const H=ae.getImageCanvasContext((yield Z[q]).data),K=(yield O[q]).data;for(const ee in K){const{width:te,height:ie,x:he,y:se,sdf:ye,pixelRatio:ge,stretchX:Ie,stretchY:ke,content:Se,textFitWidth:Ne,textFitHeight:Be}=K[ee];W[q][ee]={data:null,pixelRatio:ge,sdf:ye,stretchX:Ie,stretchY:ke,content:Se,textFitWidth:Ne,textFitHeight:Be,spriteData:{width:te,height:ie,x:he,y:se,context:H}}}}return W})}(A,k)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(h=>{if(this._spriteRequest=null,h)for(const f in h){this._spritesImagesIds[f]=[];const y=this._spritesImagesIds[f]?this._spritesImagesIds[f].filter(v=>!(v in h)):[];for(const v of y)this.imageManager.removeImage(v),this._changedImages[v]=!0;for(const v in h[f]){const T=f==="default"?v:`${f}:${v}`;this._spritesImagesIds[f].push(T),T in this.imageManager.images?this.imageManager.updateImage(T,h[f][v],!1):this.imageManager.addImage(T,h[f][v]),i&&(this._changedImages[T]=!0)}}}).catch(h=>{this._spriteRequest=null,l=h,this.fire(new o.k(l))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new o.l("data",{dataType:"style"})),s&&s(l)})}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new o.l("data",{dataType:"style"}))}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const s=e.sourceLayer;if(!s)return;const l=i.getSource();(l.type==="geojson"||l.vectorLayerIds&&l.vectorLayerIds.indexOf(s)===-1)&&this.fire(new o.k(new Error(`Source layer "${s}" does not exist on source "${l.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,i=!1){const s=this._serializedAllLayers();if(!e||e.length===0)return Object.values(i?o.bz(s):s);const l=[];for(const h of e)if(s[h]){const f=i?o.bz(s[h]):s[h];l.push(f)}return l}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const i=Object.keys(this._layers);for(const s of i){const l=this._layers[s];l.type!=="custom"&&(e[s]=l.serialize())}return e}hasTransitions(){var e,i,s;if(!((e=this.light)===null||e===void 0)&&e.hasTransition()||!((i=this.sky)===null||i===void 0)&&i.hasTransition()||!((s=this.projection)===null||s===void 0)&&s.hasTransition())return!0;for(const l in this.sourceCaches)if(this.sourceCaches[l].hasTransition())return!0;for(const l in this._layers)if(this._layers[l].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const i=this._changed;if(i){const l=Object.keys(this._updatedLayers),h=Object.keys(this._removedLayers);(l.length||h.length)&&this._updateWorkerLayers(l,h);for(const f in this._updatedSources){const y=this._updatedSources[f];if(y==="reload")this._reloadSource(f);else{if(y!=="clear")throw new Error(`Invalid action ${y}`);this._clearSource(f)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const f in this._updatedPaintProps)this._layers[f].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const s={};for(const l in this.sourceCaches){const h=this.sourceCaches[l];s[l]=h.used,h.used=!1}for(const l of this._order){const h=this._layers[l];h.recalculate(e,this._availableImages),!h.isHidden(e.zoom)&&h.source&&(this.sourceCaches[h.source].used=!0)}for(const l in s){const h=this.sourceCaches[l];!!s[l]!=!!h.used&&h.fire(new o.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:l}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,i&&this.fire(new o.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const i in this.sourceCaches)this.sourceCaches[i].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,i){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:i})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,i={}){var s;this._checkLoaded();const l=this.serialize();if(e=i.transformStyle?i.transformStyle(l,e):e,((s=i.validate)===null||s===void 0||s)&&ma(this,o.y(e)))return!1;(e=o.bz(e)).layers=o.bx(e.layers);const h=o.bA(l,e),f=this._getOperationsToPerform(h);if(f.unimplemented.length>0)throw new Error(`Unimplemented: ${f.unimplemented.join(", ")}.`);if(f.operations.length===0)return!1;for(const y of f.operations)y();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const i=[],s=[];for(const l of e)switch(l.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":i.push(()=>this.addLayer.apply(this,l.args));break;case"removeLayer":i.push(()=>this.removeLayer.apply(this,l.args));break;case"setPaintProperty":i.push(()=>this.setPaintProperty.apply(this,l.args));break;case"setLayoutProperty":i.push(()=>this.setLayoutProperty.apply(this,l.args));break;case"setFilter":i.push(()=>this.setFilter.apply(this,l.args));break;case"addSource":i.push(()=>this.addSource.apply(this,l.args));break;case"removeSource":i.push(()=>this.removeSource.apply(this,l.args));break;case"setLayerZoomRange":i.push(()=>this.setLayerZoomRange.apply(this,l.args));break;case"setLight":i.push(()=>this.setLight.apply(this,l.args));break;case"setGeoJSONSourceData":i.push(()=>this.setGeoJSONSourceData.apply(this,l.args));break;case"setGlyphs":i.push(()=>this.setGlyphs.apply(this,l.args));break;case"setSprite":i.push(()=>this.setSprite.apply(this,l.args));break;case"setTerrain":i.push(()=>this.map.setTerrain.apply(this,l.args));break;case"setSky":i.push(()=>this.setSky.apply(this,l.args));break;case"setProjection":this.setProjection.apply(this,l.args);break;case"setTransition":i.push(()=>{});break;default:s.push(l.command)}return{operations:i,unimplemented:s}}addImage(e,i){if(this.getImage(e))return this.fire(new o.k(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(e,i){this.imageManager.updateImage(e,i)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new o.k(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new o.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,s={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(o.y.source,`sources.${e}`,i,null,s))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const l=this.sourceCaches[e]=new N(e,i,this.dispatcher);l.style=this,l.setEventedParent(this,()=>({isSourceLoaded:l.loaded(),source:l.serialize(),sourceId:e})),l.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(const s in this._layers)if(this._layers[s].source===e)return this.fire(new o.k(new Error(`Source "${e}" cannot be removed while layer "${s}" is using it.`)));const i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new o.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,i){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);const s=this.sourceCaches[e].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(i),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,i,s={}){this._checkLoaded();const l=e.id;if(this.getLayer(l))return void this.fire(new o.k(new Error(`Layer "${l}" already exists on this map.`)));let h;if(e.type==="custom"){if(ma(this,o.bB(e)))return;h=o.by(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(l,e.source),e=o.bz(e),e=o.e(e,{source:l})),this._validate(o.y.layer,`layers.${l}`,e,{arrayIndex:-1},s))return;h=o.by(e),this._validateLayer(h),h.setEventedParent(this,{layer:{id:l}})}const f=i?this._order.indexOf(i):this._order.length;if(i&&f===-1)this.fire(new o.k(new Error(`Cannot add layer "${l}" before non-existing layer "${i}".`)));else{if(this._order.splice(f,0,l),this._layerOrderChanged=!0,this._layers[l]=h,this._removedLayers[l]&&h.source&&h.type!=="custom"){const y=this._removedLayers[l];delete this._removedLayers[l],y.type!==h.type?this._updatedSources[h.source]="clear":(this._updatedSources[h.source]="reload",this.sourceCaches[h.source].pause())}this._updateLayer(h),h.onAdd&&h.onAdd(this.map)}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new o.k(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const s=this._order.indexOf(e);this._order.splice(s,1);const l=i?this._order.indexOf(i):this._order.length;i&&l===-1?this.fire(new o.k(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(l,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new o.k(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const s=this._order.indexOf(e);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,i,s){this._checkLoaded();const l=this.getLayer(e);l?l.minzoom===i&&l.maxzoom===s||(i!=null&&(l.minzoom=i),s!=null&&(l.maxzoom=s),this._updateLayer(l)):this.fire(new o.k(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,s={}){this._checkLoaded();const l=this.getLayer(e);if(l){if(!o.bC(l.filter,i))return i==null?(l.filter=void 0,void this._updateLayer(l)):void(this._validate(o.y.filter,`layers.${l.id}.filter`,i,null,s)||(l.filter=o.bz(i),this._updateLayer(l)))}else this.fire(new o.k(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return o.bz(this.getLayer(e).filter)}setLayoutProperty(e,i,s,l={}){this._checkLoaded();const h=this.getLayer(e);h?o.bC(h.getLayoutProperty(i),s)||(h.setLayoutProperty(i,s,l),this._updateLayer(h)):this.fire(new o.k(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const s=this.getLayer(e);if(s)return s.getLayoutProperty(i);this.fire(new o.k(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,s,l={}){this._checkLoaded();const h=this.getLayer(e);h?o.bC(h.getPaintProperty(i),s)||(h.setPaintProperty(i,s,l)&&this._updateLayer(h),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new o.k(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,i){return this.getLayer(e).getPaintProperty(i)}setFeatureState(e,i){this._checkLoaded();const s=e.source,l=e.sourceLayer,h=this.sourceCaches[s];if(h===void 0)return void this.fire(new o.k(new Error(`The source '${s}' does not exist in the map's style.`)));const f=h.getSource().type;f==="geojson"&&l?this.fire(new o.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):f!=="vector"||l?(e.id===void 0&&this.fire(new o.k(new Error("The feature id parameter must be provided."))),h.setFeatureState(l,e.id,i)):this.fire(new o.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const s=e.source,l=this.sourceCaches[s];if(l===void 0)return void this.fire(new o.k(new Error(`The source '${s}' does not exist in the map's style.`)));const h=l.getSource().type,f=h==="vector"?e.sourceLayer:void 0;h!=="vector"||f?i&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new o.k(new Error("A feature id is required to remove its specific state property."))):l.removeFeatureState(f,e.id,i):this.fire(new o.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,s=e.sourceLayer,l=this.sourceCaches[i];if(l!==void 0)return l.getSource().type!=="vector"||s?(e.id===void 0&&this.fire(new o.k(new Error("The feature id parameter must be provided."))),l.getFeatureState(s,e.id)):void this.fire(new o.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new o.k(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return o.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=o.bD(this.sourceCaches,h=>h.serialize()),i=this._serializeByIds(this._order,!0),s=this.map.getTerrain()||void 0,l=this.stylesheet;return o.bE({version:l.version,name:l.name,metadata:l.metadata,light:l.light,sky:l.sky,center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch,sprite:l.sprite,glyphs:l.glyphs,transition:l.transition,projection:l.projection,sources:e,layers:i,terrain:s},h=>h!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const i=f=>this._layers[f].type==="fill-extrusion",s={},l=[];for(let f=this._order.length-1;f>=0;f--){const y=this._order[f];if(i(y)){s[y]=f;for(const v of e){const T=v[y];if(T)for(const C of T)l.push(C)}}}l.sort((f,y)=>y.intersectionZ-f.intersectionZ);const h=[];for(let f=this._order.length-1;f>=0;f--){const y=this._order[f];if(i(y))for(let v=l.length-1;v>=0;v--){const T=l[v].feature;if(s[T.layer.id]<f)break;h.push(T),l.pop()}else for(const v of e){const T=v[y];if(T)for(const C of T)h.push(C.feature)}}return h}queryRenderedFeatures(e,i,s){i&&i.filter&&this._validate(o.y.filter,"queryRenderedFeatures.filter",i.filter,null,i);const l={};if(i&&i.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new o.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const T of i.layers){const C=this._layers[T];if(!C)return this.fire(new o.k(new Error(`The layer '${T}' does not exist in the map's style and cannot be queried for features.`))),[];l[C.source]=!0}}const h=[];i.availableImages=this._availableImages;const f=this._serializedAllLayers(),y=i.layers instanceof Set?i.layers:Array.isArray(i.layers)?new Set(i.layers):null,v=Object.assign(Object.assign({},i),{layers:y});for(const T in this.sourceCaches)i.layers&&!l[T]||h.push(fi(this.sourceCaches[T],this._layers,f,e,v,s,this.map.terrain?(C,A,k)=>this.map.terrain.getElevation(C,A,k):void 0));return this.placement&&h.push(function(T,C,A,k,O,Z,W){const q={},H=Z.queryRenderedSymbols(k),K=[];for(const ee of Object.keys(H).map(Number))K.push(W[ee]);K.sort(bi);for(const ee of K){const te=ee.featureIndex.lookupSymbolFeatures(H[ee.bucketInstanceId],C,ee.bucketIndex,ee.sourceLayerIndex,O.filter,O.layers,O.availableImages,T);for(const ie in te){const he=q[ie]=q[ie]||[],se=te[ie];se.sort((ye,ge)=>{const Ie=ee.featureSortOrder;if(Ie){const ke=Ie.indexOf(ye.featureIndex);return Ie.indexOf(ge.featureIndex)-ke}return ge.featureIndex-ye.featureIndex});for(const ye of se)he.push(ye)}}return function(ee,te,ie){for(const he in ee)for(const se of ee[he])Ci(se,ie[te[he].source]);return ee}(q,T,A)}(this._layers,f,this.sourceCaches,e,v,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(h)}querySourceFeatures(e,i){i&&i.filter&&this._validate(o.y.filter,"querySourceFeatures.filter",i.filter,null,i);const s=this.sourceCaches[e];return s?function(l,h){const f=l.getRenderableIds().map(T=>l.getTileByID(T)),y=[],v={};for(let T=0;T<f.length;T++){const C=f[T],A=C.tileID.canonical.key;v[A]||(v[A]=!0,C.querySourceFeatures(y,h))}return y}(s,i):[]}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const s=this.light.getLight();let l=!1;for(const f in e)if(!o.bC(e[f],s[f])){l=!0;break}if(!l)return;const h={now:ae.now(),transition:o.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(h)}getProjection(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.projection}setProjection(e){if(this._checkLoaded(),this.projection){if(this.projection.name===e.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=e,this._setProjectionInternal(e.type)}getSky(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.sky}setSky(e,i={}){this._checkLoaded();const s=this.getSky();let l=!1;if(!e&&!s)return;if(e&&!s)l=!0;else if(!e&&s)l=!0;else for(const f in e)if(!o.bC(e[f],s[f])){l=!0;break}if(!l)return;const h={now:ae.now(),transition:o.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,i),this.sky.updateTransitions(h)}_setProjectionInternal(e){const i=function(s){if(Array.isArray(s)){const l=new es({type:s});return{projection:l,transform:new jo,cameraHelper:new fh(l)}}switch(s){case"mercator":return{projection:new Ft,transform:new ui,cameraHelper:new dr};case"globe":{const l=new es({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:l,transform:new jo,cameraHelper:new fh(l)}}case"vertical-perspective":return{projection:new Vs,transform:new Oo,cameraHelper:new Ur};default:return o.w(`Unknown projection name: ${s}. Falling back to mercator projection.`),{projection:new Ft,transform:new ui,cameraHelper:new dr}}}(e);this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper);for(const s in this.sourceCaches)this.sourceCaches[s].reload()}_validate(e,i,s,l,h={}){return(!h||h.validate!==!1)&&ma(this,e.call(o.y,o.e({key:i,style:this.serialize(),value:s,styleSpec:o.v},l)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),pn().off(ha,this._rtlPluginLoaded);for(const i in this._layers)this._layers[i].setEventedParent(null);for(const i in this.sourceCaches){const s=this.sourceCaches[i];s.setEventedParent(null),s.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(const i in this.sourceCaches)this.sourceCaches[i].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,i,s,l,h=!1){let f=!1,y=!1;const v={};for(const T of this._order){const C=this._layers[T];if(C.type!=="symbol")continue;if(!v[C.source]){const k=this.sourceCaches[C.source];v[C.source]=k.getRenderableIds(!0).map(O=>k.getTileByID(O)).sort((O,Z)=>Z.tileID.overscaledZ-O.tileID.overscaledZ||(O.tileID.isLessThan(Z.tileID)?-1:1))}const A=this.crossTileSymbolIndex.addLayer(C,v[C.source],e.center.lng);f=f||A}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((h=h||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(ae.now(),e.zoom))&&(this.pauseablePlacement=new lh(e,this.map.terrain,this._order,h,i,s,l,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,v),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(ae.now()),y=!0),f&&this.pauseablePlacement.placement.setStale()),y||f)for(const T of this._order){const C=this._layers[T];C.type==="symbol"&&this.placement.updateLayerOpacities(C,v[C.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(ae.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,i){return o._(this,void 0,void 0,function*(){const s=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const l=this.sourceCaches[i.source];return l&&l.setDependencies(i.tileID.key,i.type,i.icons),s})}getGlyphs(e,i){return o._(this,void 0,void 0,function*(){const s=yield this.glyphManager.getGlyphs(i.stacks),l=this.sourceCaches[i.source];return l&&l.setDependencies(i.tileID.key,i.type,[""]),s})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(o.y.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,i,s={},l){this._checkLoaded();const h=[{id:e,url:i}],f=[...kt(this.stylesheet.sprite),...h];this._validate(o.y.sprite,"sprite",f,null,s)||(this.stylesheet.sprite=f,this._loadSprite(h,!0,l))}removeSprite(e){this._checkLoaded();const i=kt(this.stylesheet.sprite);if(i.find(s=>s.id===e)){if(this._spritesImagesIds[e])for(const s of this._spritesImagesIds[e])this.imageManager.removeImage(s),this._changedImages[s]=!0;i.splice(i.findIndex(s=>s.id===e),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new o.l("data",{dataType:"style"}))}else this.fire(new o.k(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return kt(this.stylesheet.sprite)}setSprite(e,i={},s){this._checkLoaded(),e&&this._validate(o.y.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,s):(this._unloadSprite(),s&&s(null)))}}var fc=o.aD([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class mc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,i,s,l,h,f,y,v,T){this.context=e;let C=this.boundPaintVertexBuffers.length!==l.length;for(let A=0;!C&&A<l.length;A++)this.boundPaintVertexBuffers[A]!==l[A]&&(C=!0);!this.vao||this.boundProgram!==i||this.boundLayoutVertexBuffer!==s||C||this.boundIndexBuffer!==h||this.boundVertexOffset!==f||this.boundDynamicVertexBuffer!==y||this.boundDynamicVertexBuffer2!==v||this.boundDynamicVertexBuffer3!==T?this.freshBind(i,s,l,h,f,y,v,T):(e.bindVertexArray.set(this.vao),y&&y.bind(),h&&h.dynamicDraw&&h.bind(),v&&v.bind(),T&&T.bind())}freshBind(e,i,s,l,h,f,y,v){const T=e.numAttributes,C=this.context,A=C.gl;this.vao&&this.destroy(),this.vao=C.createVertexArray(),C.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=i,this.boundPaintVertexBuffers=s,this.boundIndexBuffer=l,this.boundVertexOffset=h,this.boundDynamicVertexBuffer=f,this.boundDynamicVertexBuffer2=y,this.boundDynamicVertexBuffer3=v,i.enableAttributes(A,e);for(const k of s)k.enableAttributes(A,e);f&&f.enableAttributes(A,e),y&&y.enableAttributes(A,e),v&&v.enableAttributes(A,e),i.bind(),i.setVertexAttribPointers(A,e,h);for(const k of s)k.bind(),k.setVertexAttribPointers(A,e,h);f&&(f.bind(),f.setVertexAttribPointers(A,e,h)),l&&l.bind(),y&&(y.bind(),y.setVertexAttribPointers(A,e,h)),v&&(v.bind(),v.setVertexAttribPointers(A,e,h)),C.currentNumAttributes=T}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Qr=(u,e,i,s,l)=>({u_texture:0,u_ele_delta:u,u_fog_matrix:e,u_fog_color:i?i.properties.get("fog-color"):o.b7.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:l?0:i?i.calculateFogBlendOpacity(s):0,u_horizon_color:i?i.properties.get("horizon-color"):o.b7.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:l?1:0}),Kd={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function rs(u){const e=[];for(let i=0;i<u.length;i++){if(u[i]===null)continue;const s=u[i].split(" ");e.push(s.pop())}return e}class Us{constructor(e,i,s,l,h,f,y,v){const T=e.gl;this.program=T.createProgram();const C=rs(i.staticAttributes),A=s?s.getBinderAttributes():[],k=C.concat(A),O=Nr.prelude.staticUniforms?rs(Nr.prelude.staticUniforms):[],Z=y.staticUniforms?rs(y.staticUniforms):[],W=i.staticUniforms?rs(i.staticUniforms):[],q=s?s.getBinderUniforms():[],H=O.concat(Z).concat(W).concat(q),K=[];for(const ge of H)K.indexOf(ge)<0&&K.push(ge);const ee=s?s.defines():[];Zr(T)&&ee.unshift("#version 300 es"),h&&ee.push("#define OVERDRAW_INSPECTOR;"),f&&ee.push("#define TERRAIN3D;"),v&&ee.push(v);let te=ee.concat(Nr.prelude.fragmentSource,y.fragmentSource,i.fragmentSource).join(`
726
- `),ie=ee.concat(Nr.prelude.vertexSource,y.vertexSource,i.vertexSource).join(`
727
- `);Zr(T)||(te=function(ge){return ge.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(te),ie=function(ge){return ge.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(ie));const he=T.createShader(T.FRAGMENT_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(he,te),T.compileShader(he),!T.getShaderParameter(he,T.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${T.getShaderInfoLog(he)}`);T.attachShader(this.program,he);const se=T.createShader(T.VERTEX_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(se,ie),T.compileShader(se),!T.getShaderParameter(se,T.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${T.getShaderInfoLog(se)}`);T.attachShader(this.program,se),this.attributes={};const ye={};this.numAttributes=k.length;for(let ge=0;ge<this.numAttributes;ge++)k[ge]&&(T.bindAttribLocation(this.program,ge,k[ge]),this.attributes[k[ge]]=ge);if(T.linkProgram(this.program),!T.getProgramParameter(this.program,T.LINK_STATUS))throw new Error(`Program failed to link: ${T.getProgramInfoLog(this.program)}`);T.deleteShader(se),T.deleteShader(he);for(let ge=0;ge<K.length;ge++){const Ie=K[ge];if(Ie&&!ye[Ie]){const ke=T.getUniformLocation(this.program,Ie);ke&&(ye[Ie]=ke)}}this.fixedUniforms=l(e,ye),this.terrainUniforms=((ge,Ie)=>({u_depth:new o.bF(ge,Ie.u_depth),u_terrain:new o.bF(ge,Ie.u_terrain),u_terrain_dim:new o.b8(ge,Ie.u_terrain_dim),u_terrain_matrix:new o.bH(ge,Ie.u_terrain_matrix),u_terrain_unpack:new o.bI(ge,Ie.u_terrain_unpack),u_terrain_exaggeration:new o.b8(ge,Ie.u_terrain_exaggeration)}))(e,ye),this.projectionUniforms=((ge,Ie)=>({u_projection_matrix:new o.bH(ge,Ie.u_projection_matrix),u_projection_tile_mercator_coords:new o.bI(ge,Ie.u_projection_tile_mercator_coords),u_projection_clipping_plane:new o.bI(ge,Ie.u_projection_clipping_plane),u_projection_transition:new o.b8(ge,Ie.u_projection_transition),u_projection_fallback_matrix:new o.bH(ge,Ie.u_projection_fallback_matrix)}))(e,ye),this.binderUniforms=s?s.getUniforms(e,ye):[]}draw(e,i,s,l,h,f,y,v,T,C,A,k,O,Z,W,q,H,K,ee){const te=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(s),e.setStencilMode(l),e.setColorMode(h),e.setCullFace(f),v){e.activeTexture.set(te.TEXTURE2),te.bindTexture(te.TEXTURE_2D,v.depthTexture),e.activeTexture.set(te.TEXTURE3),te.bindTexture(te.TEXTURE_2D,v.texture);for(const he in this.terrainUniforms)this.terrainUniforms[he].set(v[he])}if(T)for(const he in T)this.projectionUniforms[Kd[he]].set(T[he]);if(y)for(const he in this.fixedUniforms)this.fixedUniforms[he].set(y[he]);q&&q.setUniforms(e,this.binderUniforms,Z,{zoom:W});let ie=0;switch(i){case te.LINES:ie=2;break;case te.TRIANGLES:ie=3;break;case te.LINE_STRIP:ie=1}for(const he of O.get()){const se=he.vaos||(he.vaos={});(se[C]||(se[C]=new mc)).bind(e,this,A,q?q.getPaintVertexBuffers():[],k,he.vertexOffset,H,K,ee),te.drawElements(i,he.primitiveLength*ie,te.UNSIGNED_SHORT,he.primitiveOffset*ie*2)}}}function ns(u,e,i){const s=1/o.aw(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),y=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,y>>16],u_pixel_coord_lower:[65535&f,65535&y]}}const mh=(u,e,i,s)=>{const l=u.style.light,h=l.properties.get("position"),f=[h.x,h.y,h.z],y=o.bL();l.properties.get("anchor")==="viewport"&&o.bM(y,u.transform.bearingInRadians),o.bN(f,f,y);const v=u.transform.transformLightDirection(f),T=l.properties.get("color");return{u_lightpos:f,u_lightpos_globe:v,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}},No=(u,e,i,s,l,h,f)=>o.e(mh(u,e,i,s),ns(h,u,f),{u_height_factor:-Math.pow(2,l.overscaledZ)/f.tileSize/8}),gh=(u,e,i,s)=>o.e(ns(e,u,i),{u_fill_translate:s}),as=(u,e)=>({u_world:u,u_fill_translate:e}),Yd=(u,e,i,s,l)=>o.e(gh(u,e,i,l),{u_world:s}),_h=(u,e,i,s,l)=>{const h=u.transform;let f,y,v=0;if(i.paint.get("circle-pitch-alignment")==="map"){const T=o.aw(e,1,h.zoom);f=!0,y=[T,T],v=T/(o.Z*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*l}else f=!1,y=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:y,u_globe_extrude_scale:v,u_translate:s}},Jd=u=>({u_pixel_extrude_scale:[1/u.width,1/u.height]}),yh=u=>({u_viewport_size:[u.width,u.height]}),Zo=(u,e=1)=>({u_color:u,u_overlay:0,u_overlay_scale:e}),gc=(u,e,i,s)=>{const l=o.aw(u,1,e)/(o.Z*Math.pow(2,u.tileID.overscaledZ))*2*Math.PI*s;return{u_extrude_scale:o.aw(u,1,e),u_intensity:i,u_globe_extrude_scale:l}},_c=(u,e,i,s)=>{const l=o.K();o.bO(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")}},xh=(u,e,i)=>{const s=i.paint.get("hillshade-shadow-color"),l=i.paint.get("hillshade-highlight-color"),h=i.paint.get("hillshade-accent-color");let f=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);return i.paint.get("hillshade-illumination-anchor")==="viewport"&&(f+=u.transform.bearingInRadians),{u_image:0,u_latrange:ga(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),f],u_shadow:s,u_highlight:l,u_accent:h}},vh=(u,e)=>{const i=e.stride,s=o.K();return o.bO(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 ga(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 Vo=(u,e,i,s)=>{const l=u.transform;return{u_translation:wh(u,e,i),u_ratio:s/o.aw(e,1,l.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]]}},bh=(u,e,i,s,l)=>o.e(Vo(u,e,i,s),{u_image:0,u_image_height:l}),$s=(u,e,i,s,l)=>{const h=u.transform,f=Gs(e,h);return{u_translation:wh(u,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:s/o.aw(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]]}},Qd=(u,e,i,s,l,h)=>{const f=u.lineAtlas,y=Gs(e,u.transform),v=i.layout.get("line-cap")==="round",T=f.getDash(l.from,v),C=f.getDash(l.to,v),A=T.width*h.fromScale,k=C.width*h.toScale;return o.e(Vo(u,e,i,s),{u_patternscale_a:[y/A,-T.height/2],u_patternscale_b:[y/k,-C.height/2],u_sdfgamma:f.width/(256*Math.min(A,k)*u.pixelRatio)/2,u_image:0,u_tex_y_a:T.y,u_tex_y_b:C.y,u_mix:h.t})};function Gs(u,e){return 1/o.aw(u,1,e.tileZoom)}function wh(u,e,i){return o.ax(u.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const ep=(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 yc=(u,e,i,s,l,h,f,y,v,T,C,A,k)=>{const O=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:O.cameraToCenterDistance,u_pitch:O.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:O.width/O.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_label_plane_matrix:y,u_coord_matrix:v,u_is_text:+C,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:k}},xc=(u,e,i,s,l,h,f,y,v,T,C,A,k,O)=>{const Z=f.transform;return o.e(yc(u,e,i,s,l,h,f,y,v,T,C,A,O),{u_gamma_scale:s?Math.cos(Z.pitch*Math.PI/180)*Z.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:1})},vc=(u,e,i,s,l,h,f,y,v,T,C,A,k)=>o.e(xc(u,e,i,s,l,h,f,y,v,T,!0,C,0,k),{u_texsize_icon:A,u_texture_icon:1}),Ph=(u,e)=>({u_opacity:u,u_color:e}),Uo=(u,e,i,s,l)=>o.e(function(h,f,y,v){const T=y.imageManager.getPattern(h.from.toString()),C=y.imageManager.getPattern(h.to.toString()),{width:A,height:k}=y.imageManager.getPixelSize(),O=Math.pow(2,v.tileID.overscaledZ),Z=v.tileSize*Math.pow(2,y.transform.tileZoom)/O,W=Z*(v.tileID.canonical.x+v.tileID.wrap*O),q=Z*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:C.tl,u_pattern_br_b:C.br,u_texsize:[A,k],u_mix:f.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:C.displaySize,u_scale_a:f.fromScale,u_scale_b:f.toScale,u_tile_units_to_pixels:1/o.aw(v,1,y.transform.tileZoom),u_pixel_coord_upper:[W>>16,q>>16],u_pixel_coord_lower:[65535&W,65535&q]}}(i,l,e,s),{u_opacity:u}),en=(u,e)=>{},bc={fillExtrusion:(u,e)=>({u_lightpos:new o.bJ(u,e.u_lightpos),u_lightpos_globe:new o.bJ(u,e.u_lightpos_globe),u_lightintensity:new o.b8(u,e.u_lightintensity),u_lightcolor:new o.bJ(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.bK(u,e.u_fill_translate)}),fillExtrusionPattern:(u,e)=>({u_lightpos:new o.bJ(u,e.u_lightpos),u_lightpos_globe:new o.bJ(u,e.u_lightpos_globe),u_lightintensity:new o.b8(u,e.u_lightintensity),u_lightcolor:new o.bJ(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.bK(u,e.u_fill_translate),u_image:new o.bF(u,e.u_image),u_texsize:new o.bK(u,e.u_texsize),u_pixel_coord_upper:new o.bK(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bK(u,e.u_pixel_coord_lower),u_scale:new o.bJ(u,e.u_scale),u_fade:new o.b8(u,e.u_fade)}),fill:(u,e)=>({u_fill_translate:new o.bK(u,e.u_fill_translate)}),fillPattern:(u,e)=>({u_image:new o.bF(u,e.u_image),u_texsize:new o.bK(u,e.u_texsize),u_pixel_coord_upper:new o.bK(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bK(u,e.u_pixel_coord_lower),u_scale:new o.bJ(u,e.u_scale),u_fade:new o.b8(u,e.u_fade),u_fill_translate:new o.bK(u,e.u_fill_translate)}),fillOutline:(u,e)=>({u_world:new o.bK(u,e.u_world),u_fill_translate:new o.bK(u,e.u_fill_translate)}),fillOutlinePattern:(u,e)=>({u_world:new o.bK(u,e.u_world),u_image:new o.bF(u,e.u_image),u_texsize:new o.bK(u,e.u_texsize),u_pixel_coord_upper:new o.bK(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bK(u,e.u_pixel_coord_lower),u_scale:new o.bJ(u,e.u_scale),u_fade:new o.b8(u,e.u_fade),u_fill_translate:new o.bK(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.bF(u,e.u_scale_with_map),u_pitch_with_map:new o.bF(u,e.u_pitch_with_map),u_extrude_scale:new o.bK(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.bK(u,e.u_translate)}),collisionBox:(u,e)=>({u_pixel_extrude_scale:new o.bK(u,e.u_pixel_extrude_scale)}),collisionCircle:(u,e)=>({u_viewport_size:new o.bK(u,e.u_viewport_size)}),debug:(u,e)=>({u_color:new o.bG(u,e.u_color),u_overlay:new o.bF(u,e.u_overlay),u_overlay_scale:new o.b8(u,e.u_overlay_scale)}),depth:en,clippingMask:en,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.bH(u,e.u_matrix),u_world:new o.bK(u,e.u_world),u_image:new o.bF(u,e.u_image),u_color_ramp:new o.bF(u,e.u_color_ramp),u_opacity:new o.b8(u,e.u_opacity)}),hillshade:(u,e)=>({u_image:new o.bF(u,e.u_image),u_latrange:new o.bK(u,e.u_latrange),u_light:new o.bK(u,e.u_light),u_shadow:new o.bG(u,e.u_shadow),u_highlight:new o.bG(u,e.u_highlight),u_accent:new o.bG(u,e.u_accent)}),hillshadePrepare:(u,e)=>({u_matrix:new o.bH(u,e.u_matrix),u_image:new o.bF(u,e.u_image),u_dimension:new o.bK(u,e.u_dimension),u_zoom:new o.b8(u,e.u_zoom),u_unpack:new o.bI(u,e.u_unpack)}),line:(u,e)=>({u_translation:new o.bK(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.bK(u,e.u_units_to_pixels)}),lineGradient:(u,e)=>({u_translation:new o.bK(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.bK(u,e.u_units_to_pixels),u_image:new o.bF(u,e.u_image),u_image_height:new o.b8(u,e.u_image_height)}),linePattern:(u,e)=>({u_translation:new o.bK(u,e.u_translation),u_texsize:new o.bK(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.bF(u,e.u_image),u_units_to_pixels:new o.bK(u,e.u_units_to_pixels),u_scale:new o.bJ(u,e.u_scale),u_fade:new o.b8(u,e.u_fade)}),lineSDF:(u,e)=>({u_translation:new o.bK(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.bK(u,e.u_units_to_pixels),u_patternscale_a:new o.bK(u,e.u_patternscale_a),u_patternscale_b:new o.bK(u,e.u_patternscale_b),u_sdfgamma:new o.b8(u,e.u_sdfgamma),u_image:new o.bF(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.bK(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.bF(u,e.u_image0),u_image1:new o.bF(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.bJ(u,e.u_spin_weights),u_coords_top:new o.bI(u,e.u_coords_top),u_coords_bottom:new o.bI(u,e.u_coords_bottom)}),symbolIcon:(u,e)=>({u_is_size_zoom_constant:new o.bF(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bF(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.bF(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.bH(u,e.u_label_plane_matrix),u_coord_matrix:new o.bH(u,e.u_coord_matrix),u_is_text:new o.bF(u,e.u_is_text),u_pitch_with_map:new o.bF(u,e.u_pitch_with_map),u_is_along_line:new o.bF(u,e.u_is_along_line),u_is_variable_anchor:new o.bF(u,e.u_is_variable_anchor),u_texsize:new o.bK(u,e.u_texsize),u_texture:new o.bF(u,e.u_texture),u_translation:new o.bK(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.bF(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bF(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.bF(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.bH(u,e.u_label_plane_matrix),u_coord_matrix:new o.bH(u,e.u_coord_matrix),u_is_text:new o.bF(u,e.u_is_text),u_pitch_with_map:new o.bF(u,e.u_pitch_with_map),u_is_along_line:new o.bF(u,e.u_is_along_line),u_is_variable_anchor:new o.bF(u,e.u_is_variable_anchor),u_texsize:new o.bK(u,e.u_texsize),u_texture:new o.bF(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.bF(u,e.u_is_halo),u_translation:new o.bK(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.bF(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bF(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.bF(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.bH(u,e.u_label_plane_matrix),u_coord_matrix:new o.bH(u,e.u_coord_matrix),u_is_text:new o.bF(u,e.u_is_text),u_pitch_with_map:new o.bF(u,e.u_pitch_with_map),u_is_along_line:new o.bF(u,e.u_is_along_line),u_is_variable_anchor:new o.bF(u,e.u_is_variable_anchor),u_texsize:new o.bK(u,e.u_texsize),u_texsize_icon:new o.bK(u,e.u_texsize_icon),u_texture:new o.bF(u,e.u_texture),u_texture_icon:new o.bF(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.bF(u,e.u_is_halo),u_translation:new o.bK(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.bG(u,e.u_color)}),backgroundPattern:(u,e)=>({u_opacity:new o.b8(u,e.u_opacity),u_image:new o.bF(u,e.u_image),u_pattern_tl_a:new o.bK(u,e.u_pattern_tl_a),u_pattern_br_a:new o.bK(u,e.u_pattern_br_a),u_pattern_tl_b:new o.bK(u,e.u_pattern_tl_b),u_pattern_br_b:new o.bK(u,e.u_pattern_br_b),u_texsize:new o.bK(u,e.u_texsize),u_mix:new o.b8(u,e.u_mix),u_pattern_size_a:new o.bK(u,e.u_pattern_size_a),u_pattern_size_b:new o.bK(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.bK(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bK(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.bF(u,e.u_texture),u_ele_delta:new o.b8(u,e.u_ele_delta),u_fog_matrix:new o.bH(u,e.u_fog_matrix),u_fog_color:new o.bG(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.bG(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.bF(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.bJ(u,e.u_sun_pos),u_atmosphere_blend:new o.b8(u,e.u_atmosphere_blend),u_globe_position:new o.bJ(u,e.u_globe_position),u_globe_radius:new o.b8(u,e.u_globe_radius),u_inv_proj_matrix:new o.bH(u,e.u_inv_proj_matrix)}),sky:(u,e)=>({u_sky_color:new o.bG(u,e.u_sky_color),u_horizon_color:new o.bG(u,e.u_horizon_color),u_horizon:new o.bK(u,e.u_horizon),u_horizon_normal:new o.bK(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 wc{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 Tc={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Sh{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[Tc[h.type]],!1,this.itemSize,h.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class jt{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 _a extends jt{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 Pc extends jt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class tp extends jt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class ip extends jt{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 rp extends jt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class np extends jt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Mh extends jt{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 ap extends jt{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 Ih extends jt{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 $o extends jt{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 Go extends jt{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 qo extends jt{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Sc extends jt{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 ya extends jt{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 ss extends jt{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 Er extends jt{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class Ch extends jt{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 kh extends jt{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Mc extends jt{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class xa extends jt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Wo extends jt{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Ho extends jt{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 qs extends jt{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 Xo extends jt{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 Eh extends jt{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 os extends jt{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 ls extends jt{getDefault(){return null}set(e){const i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Ah extends jt{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;const s=this.gl;Zr(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 Ic extends jt{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 Bt extends jt{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 Ko extends jt{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 Cc extends jt{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class zh extends Cc{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 Ws extends Cc{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 sp extends Cc{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 Rh="Framebuffer is not complete";class Dh{constructor(e,i,s,l,h){this.context=e,this.width=i,this.height=s;const f=e.gl,y=this.framebuffer=f.createFramebuffer();if(this.colorAttachment=new zh(e,y),l)this.depthAttachment=h?new sp(e,y):new Ws(e,y);else if(h)throw new Error("Stencil cannot be set without depth");if(f.checkFramebufferStatus(f.FRAMEBUFFER)!==f.FRAMEBUFFER_COMPLETE)throw new Error(Rh)}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 op{constructor(e){var i,s;if(this.gl=e,this.clearColor=new _a(this),this.clearDepth=new Pc(this),this.clearStencil=new tp(this),this.colorMask=new ip(this),this.depthMask=new rp(this),this.stencilMask=new np(this),this.stencilFunc=new Mh(this),this.stencilOp=new ap(this),this.stencilTest=new Ih(this),this.depthRange=new $o(this),this.depthTest=new Go(this),this.depthFunc=new qo(this),this.blend=new Sc(this),this.blendFunc=new ya(this),this.blendColor=new ss(this),this.blendEquation=new Er(this),this.cullFace=new Ch(this),this.cullFaceSide=new kh(this),this.frontFace=new Mc(this),this.program=new xa(this),this.activeTexture=new Wo(this),this.viewport=new Ho(this),this.bindFramebuffer=new qs(this),this.bindRenderbuffer=new Xo(this),this.bindTexture=new Eh(this),this.bindVertexBuffer=new os(this),this.bindElementBuffer=new ls(this),this.bindVertexArray=new Ah(this),this.pixelStoreUnpack=new Ic(this),this.pixelStoreUnpackPremultiplyAlpha=new Bt(this),this.pixelStoreUnpackFlipY=new Ko(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),Zr(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 wc(this,e,i)}createVertexBuffer(e,i,s){return new Sh(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 Dh(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.bC(e.blendFunction,ri.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 Zr(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 Zr(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 cs;function Hs(u,e,i,s,l){const h=u.context,f=u.transform,y=h.gl,v=u.useProgram("collisionBox"),T=[];let C=0,A=0;for(let H=0;H<s.length;H++){const K=s[H],ee=e.getTile(K).getBucket(i);if(!ee)continue;const te=l?ee.textCollisionBox:ee.iconCollisionBox,ie=ee.collisionCircleArray;ie.length>0&&(T.push({circleArray:ie,circleOffset:A,coord:K}),C+=ie.length/4,A=C),te&&v.draw(h,y.LINES,vt.disabled,Rt.disabled,u.colorModeForRenderPass(),Ot.disabled,Jd(u.transform),u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),f.getProjectionData({overscaledTileID:K,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,null,u.transform.zoom,null,null,te.collisionVertexBuffer)}if(!l||!T.length)return;const k=u.useProgram("collisionCircle"),O=new o.bP;O.resize(4*C),O._trim();let Z=0;for(const H of T)for(let K=0;K<H.circleArray.length/4;K++){const ee=4*K,te=H.circleArray[ee+0],ie=H.circleArray[ee+1],he=H.circleArray[ee+2],se=H.circleArray[ee+3];O.emplace(Z++,te,ie,he,se,0),O.emplace(Z++,te,ie,he,se,1),O.emplace(Z++,te,ie,he,se,2),O.emplace(Z++,te,ie,he,se,3)}(!cs||cs.length<2*C)&&(cs=function(H){const K=2*H,ee=new o.bR;ee.resize(K),ee._trim();for(let te=0;te<K;te++){const ie=6*te;ee.uint16[ie+0]=4*te+0,ee.uint16[ie+1]=4*te+1,ee.uint16[ie+2]=4*te+2,ee.uint16[ie+3]=4*te+2,ee.uint16[ie+4]=4*te+3,ee.uint16[ie+5]=4*te+0}return ee}(C));const W=h.createIndexBuffer(cs,!0),q=h.createVertexBuffer(O,o.bQ.members,!0);for(const H of T){const K=yh(u.transform);k.draw(h,y.TRIANGLES,vt.disabled,Rt.disabled,u.colorModeForRenderPass(),Ot.disabled,K,u.style.map.terrain&&u.style.map.terrain.getTerrainData(H.coord),null,i.id,q,W,o.aG.simpleSegment(0,2*H.circleOffset,H.circleArray.length,H.circleArray.length/2),null,u.transform.zoom,null,null,null)}q.destroy(),W.destroy()}const Yo=o.at(new Float32Array(16));function kc(u,e,i,s,l,h){const{horizontalAlign:f,verticalAlign:y}=o.aB(u);return new o.P((-(f-.5)*e/l+s[0])*h,(-(y-.5)*i/l+s[1])*h)}function Ec(u,e,i,s,l,h){const f=e.tileAnchorPoint.add(new o.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let y=s.mult(h);i||(y=y.rotate(-l));const v=f.add(y);return we(v.x,v.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(i){const y=Lt(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(u),v=Math.atan(y.y/y.x)+(y.x<0?Math.PI:0);return u.add(s.rotate(v))}return u.add(s)}function Lh(u,e,i,s,l,h,f,y,v,T,C,A){const k=u.text.placedSymbolArray,O=u.text.dynamicLayoutVertexArray,Z=u.icon.dynamicLayoutVertexArray,W={};O.clear();for(let q=0;q<k.length;q++){const H=k.get(q),K=H.hidden||!H.crossTileID||u.allowVerticalPlacement&&!H.placedOrientation?null:s[H.crossTileID];if(K){const ee=new o.P(H.anchorX,H.anchorY),te={getElevation:A,width:l.width,height:l.height,pitchedLabelPlaneMatrix:h,pitchWithMap:i,transform:l,tileAnchorPoint:ee,translation:T,unwrappedTileID:C},ie=i?He(ee.x,ee.y,te):Lt(ee.x,ee.y,te),he=fe(l.cameraToCenterDistance,ie.signedDistanceFromCamera);let se=o.ai(u.textSizeData,y,H)*he/o.av;i&&(se*=u.tilePixelRatio/f);const{width:ye,height:ge,anchor:Ie,textOffset:ke,textBoxScale:Se}=K,Ne=kc(Ie,ye,ge,ke,Se,se),Be=l.getPitchedTextCorrection(ee.x+T[0],ee.y+T[1],C),Ee=Ec(ie.point,te,e,Ne,-l.bearingInRadians,Be),Xe=u.allowVerticalPlacement&&H.placedOrientation===o.ah.vertical?Math.PI/2:0;for(let xt=0;xt<H.numGlyphs;xt++)o.ao(O,Ee,Xe);v&&H.associatedIconIndex>=0&&(W[H.associatedIconIndex]={shiftedAnchor:Ee,angle:Xe})}else ot(H.numGlyphs,O)}if(v){Z.clear();const q=u.icon.placedSymbolArray;for(let H=0;H<q.length;H++){const K=q.get(H);if(K.hidden)ot(K.numGlyphs,Z);else{const ee=W[H];if(ee)for(let te=0;te<K.numGlyphs;te++)o.ao(Z,ee.shiftedAnchor,ee.angle);else ot(K.numGlyphs,Z)}}u.icon.dynamicLayoutVertexBuffer.updateData(Z)}u.text.dynamicLayoutVertexBuffer.updateData(O)}function Jo(u,e,i){return i.iconsInText&&e?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Xs(u,e,i,s,l,h,f,y,v,T,C,A,k){const O=u.context,Z=O.gl,W=u.transform,q=y==="map",H=v==="map",K=y!=="viewport"&&i.layout.get("symbol-placement")!=="point",ee=q&&!H&&!K,te=!i.layout.get("symbol-sort-key").isConstant();let ie=!1;const he=u.getDepthModeForSublayer(0,vt.ReadOnly),se=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),ye=[],ge=W.getCircleRadiusCorrection();for(const Ie of s){const ke=e.getTile(Ie),Se=ke.getBucket(i);if(!Se)continue;const Ne=l?Se.text:Se.icon;if(!Ne||!Ne.segments.get().length||!Ne.hasVisibleVertices)continue;const Be=Ne.programConfigurations.get(i.id),Ee=l||Se.sdfIcons,Xe=l?Se.textSizeData:Se.iconSizeData,xt=H||W.pitch!==0,Nt=u.useProgram(Jo(Ee,l,Se),Be),bt=o.ag(Xe,W.zoom),Wt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Ie);let ei,ai,Gt,Ht,ki=[0,0],Oi=null;if(l)ai=ke.glyphAtlasTexture,Gt=Z.LINEAR,ei=ke.glyphAtlasTexture.size,Se.iconsInText&&(ki=ke.imageAtlasTexture.size,Oi=ke.imageAtlasTexture,Ht=xt||u.options.rotating||u.options.zooming||Xe.kind==="composite"||Xe.kind==="camera"?Z.LINEAR:Z.NEAREST);else{const _i=i.layout.get("icon-size").constantOr(0)!==1||Se.iconsNeedLinear;ai=ke.imageAtlasTexture,Gt=Ee||u.options.rotating||u.options.zooming||_i||xt?Z.LINEAR:Z.NEAREST,ei=ke.imageAtlasTexture.size}const Vi=o.aw(ke,1,u.transform.zoom),mr=me(q,u.transform,Vi),bn=o.K();o.aj(bn,mr);const an=de(H,q,u.transform,Vi),Wn=o.ax(W,ke,h,f),Hn=W.getProjectionData({overscaledTileID:Ie,applyGlobeMatrix:!k,applyTerrainMatrix:!0}),Ia=se&&Se.hasTextData(),sn=i.layout.get("icon-text-fit")!=="none"&&Ia&&Se.hasIconData();if(K){const _i=u.style.map.terrain?(Di,Kt)=>u.style.map.terrain.getElevation(Ie,Di,Kt):null,yi=i.layout.get("text-rotation-alignment")==="map";Ve(Se,u,l,mr,bn,H,T,yi,Ie.toUnwrapped(),W.width,W.height,Wn,_i)}const wn=l&&se||sn,wr=K||wn?Yo:H?mr:u.transform.clipSpaceToPixelsMatrix,Tn=Ee&&i.paint.get(l?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Ca;Ca=Ee?Se.iconsInText?vc(Xe.kind,bt,ee,H,K,wn,u,wr,an,Wn,ei,ki,ge):xc(Xe.kind,bt,ee,H,K,wn,u,wr,an,Wn,l,ei,0,ge):yc(Xe.kind,bt,ee,H,K,wn,u,wr,an,Wn,l,ei,ge);const ka={program:Nt,buffers:Ne,uniformValues:Ca,projectionData:Hn,atlasTexture:ai,atlasTextureIcon:Oi,atlasInterpolation:Gt,atlasInterpolationIcon:Ht,isSDF:Ee,hasHalo:Tn};if(te&&Se.canOverlap){ie=!0;const _i=Ne.segments.get();for(const yi of _i)ye.push({segments:new o.aG([yi]),sortKey:yi.sortKey,state:ka,terrainData:Wt})}else ye.push({segments:Ne.segments,sortKey:0,state:ka,terrainData:Wt})}ie&&ye.sort((Ie,ke)=>Ie.sortKey-ke.sortKey);for(const Ie of ye){const ke=Ie.state;if(O.activeTexture.set(Z.TEXTURE0),ke.atlasTexture.bind(ke.atlasInterpolation,Z.CLAMP_TO_EDGE),ke.atlasTextureIcon&&(O.activeTexture.set(Z.TEXTURE1),ke.atlasTextureIcon&&ke.atlasTextureIcon.bind(ke.atlasInterpolationIcon,Z.CLAMP_TO_EDGE)),ke.isSDF){const Se=ke.uniformValues;ke.hasHalo&&(Se.u_is_halo=1,Qo(ke.buffers,Ie.segments,i,u,ke.program,he,C,A,Se,ke.projectionData,Ie.terrainData)),Se.u_is_halo=0}Qo(ke.buffers,Ie.segments,i,u,ke.program,he,C,A,ke.uniformValues,ke.projectionData,Ie.terrainData)}}function Qo(u,e,i,s,l,h,f,y,v,T,C){const A=s.context;l.draw(A,A.gl.TRIANGLES,h,f,y,Ot.backCCW,v,C,T,i.id,u.layoutVertexBuffer,u.indexBuffer,e,i.paint,s.transform.zoom,u.programConfigurations.get(i.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function lp(u,e,i,s,l){const h=u.context,f=h.gl,y=Rt.disabled,v=new ri([f.ONE,f.ONE],o.b7.transparent,[!0,!0,!0,!0]),T=e.getBucket(i);if(!T)return;const C=s.key;let A=i.heatmapFbos.get(C);A||(A=Fh(h,e.tileSize,e.tileSize),i.heatmapFbos.set(C,A)),h.bindFramebuffer.set(A.framebuffer),h.viewport.set([0,0,e.tileSize,e.tileSize]),h.clear({color:o.b7.transparent});const k=T.programConfigurations.get(i.id),O=u.useProgram("heatmap",k,!l),Z=u.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),W=u.style.map.terrain.getTerrainData(s);O.draw(h,f.TRIANGLES,vt.disabled,y,v,Ot.disabled,gc(e,u.transform.zoom,i.paint.get("heatmap-intensity"),1),W,Z,i.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,i.paint,u.transform.zoom,k)}function Ac(u,e,i,s,l){const h=u.context,f=h.gl,y=u.transform;h.setColorMode(u.colorModeForRenderPass());const v=zc(h,e),T=i.key,C=e.heatmapFbos.get(T);if(!C)return;h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,C.colorAttachment.get()),h.activeTexture.set(f.TEXTURE1),v.bind(f.LINEAR,f.CLAMP_TO_EDGE);const A=y.getProjectionData({overscaledTileID:i,applyTerrainMatrix:l,applyGlobeMatrix:!s});u.useProgram("heatmapTexture").draw(h,f.TRIANGLES,vt.disabled,Rt.disabled,u.colorModeForRenderPass(),Ot.disabled,_c(u,e,0,1),null,A,e.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments,e.paint,y.zoom),C.destroy(),e.heatmapFbos.delete(T)}function Fh(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 y=(s=u.HALF_FLOAT)!==null&&s!==void 0?s:h.UNSIGNED_BYTE,v=(l=u.RGBA16F)!==null&&l!==void 0?l:h.RGBA;h.texImage2D(h.TEXTURE_2D,0,v,e,i,0,h.RGBA,y,null);const T=u.createFramebuffer(e,i,!1,!1);return T.colorAttachment.set(f),T}function zc(u,e){return e.colorRampTexture||(e.colorRampTexture=new wt(u,e.colorRamp,u.gl.RGBA)),e.colorRampTexture}function Ks(u,e,i,s,l){if(!i||!s||!s.imageAtlas)return;const h=s.imageAtlas.patternPositions;let f=h[i.to.toString()],y=h[i.from.toString()];if(!f&&y&&(f=y),!y&&f&&(y=f),!f||!y){const v=l.getPaintProperty(e);f=h[v],y=h[v]}f&&y&&u.setConstantPatternPositions(f,y)}function el(u,e,i,s,l,h,f,y){const v=u.context.gl,T="fill-pattern",C=i.paint.get(T),A=C&&C.constantOr(1),k=i.getCrossfadeParameters();let O,Z,W,q,H;const K=u.transform,ee=i.paint.get("fill-translate"),te=i.paint.get("fill-translate-anchor");f?(Z=A&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",O=v.LINES):(Z=A?"fillPattern":"fill",O=v.TRIANGLES);const ie=C.constantOr(null);for(const he of s){const se=e.getTile(he);if(A&&!se.patternsLoaded())continue;const ye=se.getBucket(i);if(!ye)continue;const ge=ye.programConfigurations.get(i.id),Ie=u.useProgram(Z,ge),ke=u.style.map.terrain&&u.style.map.terrain.getTerrainData(he);A&&(u.context.activeTexture.set(v.TEXTURE0),se.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),ge.updatePaintBuffers(k)),Ks(ge,T,ie,se,i);const Se=K.getProjectionData({overscaledTileID:he,applyGlobeMatrix:!y,applyTerrainMatrix:!0}),Ne=o.ax(K,se,ee,te);if(f){q=ye.indexBuffer2,H=ye.segments2;const Ee=[v.drawingBufferWidth,v.drawingBufferHeight];W=Z==="fillOutlinePattern"&&A?Yd(u,k,se,Ee,Ne):as(Ee,Ne)}else q=ye.indexBuffer,H=ye.segments,W=A?gh(u,k,se,Ne):{u_fill_translate:Ne};let Be;if(u.renderPass==="translucent"&&y){const[Ee]=u.getStencilConfigForOverlapAndUpdateStencilID(s);Be=Ee[he.overscaledZ]}else Be=u.stencilModeForClipping(he);Ie.draw(u.context,O,l,Be,h,Ot.backCCW,W,ke,Se,i.id,ye.layoutVertexBuffer,q,H,i.paint,u.transform.zoom,ge)}}function tl(u,e,i,s,l,h,f,y){const v=u.context,T=v.gl,C="fill-extrusion-pattern",A=i.paint.get(C),k=A.constantOr(1),O=i.getCrossfadeParameters(),Z=i.paint.get("fill-extrusion-opacity"),W=A.constantOr(null),q=u.transform;for(const H of s){const K=e.getTile(H),ee=K.getBucket(i);if(!ee)continue;const te=u.style.map.terrain&&u.style.map.terrain.getTerrainData(H),ie=ee.programConfigurations.get(i.id),he=u.useProgram(k?"fillExtrusionPattern":"fillExtrusion",ie);k&&(u.context.activeTexture.set(T.TEXTURE0),K.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),ie.updatePaintBuffers(O));const se=q.getProjectionData({overscaledTileID:H,applyGlobeMatrix:!y,applyTerrainMatrix:!0});Ks(ie,C,W,K,i);const ye=o.ax(q,K,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),ge=i.paint.get("fill-extrusion-vertical-gradient"),Ie=k?No(u,ge,Z,ye,H,O,K):mh(u,ge,Z,ye);he.draw(v,v.gl.TRIANGLES,l,h,f,Ot.backCCW,Ie,te,se,i.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,i.paint,u.transform.zoom,ie,u.style.map.terrain&&ee.centroidVertexBuffer)}}function il(u,e,i,s,l,h,f,y,v){var T;const C=u.style.projection,A=u.context,k=u.transform,O=A.gl,Z=u.useProgram("hillshade"),W=!u.options.moving;for(const q of s){const H=e.getTile(q),K=H.fbo;if(!K)continue;const ee=C.getMeshFromTileID(A,q.canonical,y,!0,"raster"),te=(T=u.style.map.terrain)===null||T===void 0?void 0:T.getTerrainData(q);A.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,K.colorAttachment.get());const ie=k.getProjectionData({overscaledTileID:q,aligned:W,applyGlobeMatrix:!v,applyTerrainMatrix:!0});Z.draw(A,O.TRIANGLES,h,l[q.overscaledZ],f,Ot.backCCW,xh(u,H,i),te,ie,i.id,ee.vertexBuffer,ee.indexBuffer,ee.segments)}}const us=[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 hs(u,e,i,s,l,h,f,y,v=!1,T=!1){const C=s[s.length-1].overscaledZ,A=u.context,k=A.gl,O=u.useProgram("raster"),Z=u.transform,W=u.style.projection,q=u.colorModeForRenderPass(),H=!u.options.moving;for(const K of s){const ee=u.getDepthModeForSublayer(K.overscaledZ-C,i.paint.get("raster-opacity")===1?vt.ReadWrite:vt.ReadOnly,k.LESS),te=e.getTile(K);te.registerFadeDuration(i.paint.get("raster-fade-duration"));const ie=e.findLoadedParent(K,0),he=e.findLoadedSibling(K),se=cp(te,ie||he||null,e,i,u.transform,u.style.map.terrain);let ye,ge;const Ie=i.paint.get("raster-resampling")==="nearest"?k.NEAREST:k.LINEAR;A.activeTexture.set(k.TEXTURE0),te.texture.bind(Ie,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),A.activeTexture.set(k.TEXTURE1),ie?(ie.texture.bind(Ie,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),ye=Math.pow(2,ie.tileID.overscaledZ-te.tileID.overscaledZ),ge=[te.tileID.canonical.x*ye%1,te.tileID.canonical.y*ye%1]):te.texture.bind(Ie,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),te.texture.useMipmap&&A.extTextureFilterAnisotropic&&u.transform.pitch>20&&k.texParameterf(k.TEXTURE_2D,A.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,A.extTextureFilterAnisotropicMax);const ke=u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),Se=Z.getProjectionData({overscaledTileID:K,aligned:H,applyGlobeMatrix:!T,applyTerrainMatrix:!0}),Ne=ep(ge||[0,0],ye||1,se,i,y),Be=W.getMeshFromTileID(A,K.canonical,h,f,"raster");O.draw(A,k.TRIANGLES,ee,l?l[K.overscaledZ]:Rt.disabled,q,v?Ot.frontCCW:Ot.backCCW,Ne,ke,Se,i.id,Be.vertexBuffer,Be.indexBuffer,Be.segments)}}function cp(u,e,i,s,l,h){const f=s.paint.get("raster-fade-duration");if(!h&&f>0){const y=ae.now(),v=(y-u.timeAdded)/f,T=e?(y-e.timeAdded)/f:-1,C=i.getSource(),A=mn(l,{tileSize:C.tileSize,roundZoom:C.roundZoom}),k=!e||Math.abs(e.tileID.overscaledZ-A)>Math.abs(u.tileID.overscaledZ-A),O=k&&u.refreshedUponExpiration?1:o.ae(k?v:1-T,0,1);return u.refreshedUponExpiration&&v>=1&&(u.refreshedUponExpiration=!1),e?{opacity:1,mix:1-O}:{opacity:O,mix:0}}return{opacity:1,mix:0}}const Bh=new o.b7(1,0,0,1),Ti=new o.b7(0,1,0,1),va=new o.b7(0,0,1,1),Ar=new o.b7(1,0,1,1),Rc=new o.b7(0,1,1,1);function rl(u,e,i,s){xn(u,0,e+i/2,u.transform.width,i,s)}function Dc(u,e,i,s){xn(u,e-i/2,0,i,u.transform.height,s)}function xn(u,e,i,s,l,h){const f=u.context,y=f.gl;y.enable(y.SCISSOR_TEST),y.scissor(e*u.pixelRatio,i*u.pixelRatio,s*u.pixelRatio,l*u.pixelRatio),f.clear({color:h}),y.disable(y.SCISSOR_TEST)}function Ys(u,e,i){const s=u.context,l=s.gl,h=u.useProgram("debug"),f=vt.disabled,y=Rt.disabled,v=u.colorModeForRenderPass(),T="$debug",C=u.style.map.terrain&&u.style.map.terrain.getTerrainData(i);s.activeTexture.set(l.TEXTURE0);const A=e.getTileByID(i.key).latestRawTileData,k=Math.floor((A&&A.byteLength||0)/1024),O=e.getTile(i).tileSize,Z=512/Math.min(O,512)*(i.overscaledZ/u.transform.zoom)*.5;let W=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(W+=` => ${i.overscaledZ}`),function(H,K){H.initDebugOverlayCanvas();const ee=H.debugOverlayCanvas,te=H.context.gl,ie=H.debugOverlayCanvas.getContext("2d");ie.clearRect(0,0,ee.width,ee.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),H.debugOverlayTexture.update(ee),H.debugOverlayTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE)}(u,`${W} ${k}kB`);const q=u.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(s,l.TRIANGLES,f,y,ri.alphaBlended,Ot.disabled,Zo(o.b7.transparent,Z),null,q,T,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),h.draw(s,l.LINE_STRIP,f,y,v,Ot.disabled,Zo(o.b7.red),C,q,T,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function nl(u,e,i,s){const{isRenderingGlobe:l}=s,h=u.context,f=h.gl,y=u.transform,v=u.colorModeForRenderPass(),T=u.getDepthModeFor3D(),C=u.useProgram("terrain");h.bindFramebuffer.set(null),h.viewport.set([0,0,u.width,u.height]);for(const A of i){const k=e.getTerrainMesh(A.tileID),O=u.renderToTexture.getTexture(A),Z=e.getTerrainData(A.tileID);h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,O.texture);const W=e.getMeshFrameDelta(y.zoom),q=y.calculateFogMatrix(A.tileID.toUnwrapped()),H=Qr(W,q,u.style.sky,y.pitch,l),K=y.getProjectionData({overscaledTileID:A.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});C.draw(h,f.TRIANGLES,T,Rt.disabled,v,Ot.backCCW,H,Z,K,"terrain",k.vertexBuffer,k.indexBuffer,k.segments)}}function Lc(u,e){if(!e.mesh){const i=new o.aF;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const s=new o.aH;s.emplaceBack(0,1,2),s.emplaceBack(0,2,3),e.mesh=new pa(u.createVertexBuffer(i,Un.members),u.createIndexBuffer(s),o.aG.simpleSegment(0,0,i.length,s.length))}return e.mesh}class Oh{constructor(e,i){this.context=new op(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:o.at(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=N.maxUnderzooming+N.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ro}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.aF;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,Un.members),this.tileExtentSegments=o.aG.simpleSegment(0,0,4,2);const s=new o.aF;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,Un.members),this.debugSegments=o.aG.simpleSegment(0,0,4,5);const l=new o.bW;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,fc.members),this.rasterBoundsSegments=o.aG.simpleSegment(0,0,4,2);const h=new o.aF;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,Un.members),this.rasterBoundsSegmentsPosOnly=o.aG.simpleSegment(0,0,4,5);const f=new o.aF;f.emplaceBack(0,0),f.emplaceBack(1,0),f.emplaceBack(0,1),f.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(f,Un.members),this.viewportSegments=o.aG.simpleSegment(0,0,4,2);const y=new o.bX;y.emplaceBack(0),y.emplaceBack(1),y.emplaceBack(3),y.emplaceBack(2),y.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(y);const v=new o.aH;v.emplaceBack(1,0,2),v.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(v);const T=this.context.gl;this.stencilClearMode=new Rt({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO),this.tileExtentMesh=new pa(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.bO(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,vt.disabled,this.stencilClearMode,ri.disabled,Ot.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(ri.disabled),l.setDepthMode(vt.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,y=this.style.projection,v=this.transform,T=this.useProgram("clippingMask");for(const C of i){const A=e[C.key],k=this.style.map.terrain&&this.style.map.terrain.getTerrainData(C),O=y.getMeshFromTileID(this.context,C.canonical,l,!0,"stencil"),Z=v.getProjectionData({overscaledTileID:C,applyGlobeMatrix:!0,applyTerrainMatrix:!0});T.draw(h,f.TRIANGLES,vt.disabled,new Rt({func:f.ALWAYS,mask:0},A,255,f.KEEP,f.KEEP,f.REPLACE),ri.disabled,s?Ot.disabled:Ot.backCCW,null,k,Z,"$clipping",O.vertexBuffer,O.indexBuffer,O.segments)}}_renderTilesDepthBuffer(){const e=this.context,i=e.gl,s=this.style.projection,l=this.transform,h=this.useProgram("depth"),f=this.getDepthModeFor3D(),y=pe(l,{tileSize:l.tileSize});for(const v of y){const T=this.style.map.terrain&&this.style.map.terrain.getTerrainData(v),C=s.getMeshFromTileID(this.context,v.canonical,!0,!0,"raster"),A=l.getProjectionData({overscaledTileID:v,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(e,i.TRIANGLES,f,Rt.disabled,ri.disabled,Ot.backCCW,null,T,A,"$clipping",C.vertexBuffer,C.indexBuffer,C.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,i=this.context.gl;return new Rt({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){const i=this.context.gl;return new Rt({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,y)=>y.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 y=0;y<h;y++)f[y+l]=new Rt({func:i.GEQUAL,mask:255},y+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=h,[f,s]}return[{[l]:Rt.disabled},s]}stencilConfigForOverlapTwoPass(e){const i=this.context.gl,s=e.sort((f,y)=>y.overscaledZ-f.overscaledZ),l=s[s.length-1].overscaledZ,h=s[0].overscaledZ-l+1;if(this.clearStencil(),h>1){const f={},y={};for(let v=0;v<h;v++)f[v+l]=new Rt({func:i.GREATER,mask:255},h+1+v,255,i.KEEP,i.KEEP,i.REPLACE),y[v+l]=new Rt({func:i.GREATER,mask:255},1+v,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*h+1,[f,y,s]}return this.nextStencilID=3,[{[l]:new Rt({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[l]:new Rt({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},s]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new ri([e.CONSTANT_COLOR,e.ONE],new o.b7(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?ri.unblended:ri.alphaBlended}getDepthModeForSublayer(e,i,s){if(!this.opaquePassEnabledForLayer())return vt.disabled;const l=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new vt(s||this.context.gl.LEQUAL,i,[l,l])}getDepthModeFor3D(){return new vt(this.context.gl.LEQUAL,vt.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(ae.now()),this.imageManager.beginFrame();const h=this.style._order,f=this.style.sourceCaches,y={},v={},T={},C={isRenderingToTexture:!1,isRenderingGlobe:((s=e.projection)===null||s===void 0?void 0:s.transitionState)>0};for(const k in f){const O=f[k];O.used&&O.prepare(this.context),y[k]=O.getVisibleCoordinates(!1),v[k]=y[k].slice().reverse(),T[k]=O.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let k=0;k<h.length;k++)if(this.style._layers[h[k]].is3D()){this.opaquePassCutoff=k;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const k of h){const O=this.style._layers[k];if(!O.hasOffscreenPass()||O.isHidden(this.transform.zoom))continue;const Z=v[O.source];(O.type==="custom"||Z.length)&&this.renderLayer(this,f[O.source],O,Z,C)}if((l=this.style.projection)===null||l===void 0||l.updateGPUdependent({context:this.context,useProgram:k=>this.useProgram(k)}),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(k,O){const Z=k.context,W=Z.gl,q=((he,se,ye)=>{const ge=Math.cos(se.rollInRadians),Ie=Math.sin(se.rollInRadians),ke=Ka(se),Se=se.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:he.properties.get("sky-color"),u_horizon_color:he.properties.get("horizon-color"),u_horizon:[(se.width/2-ke*Ie)*ye,(se.height/2+ke*ge)*ye],u_horizon_normal:[-Ie,ge],u_sky_horizon_blend:he.properties.get("sky-horizon-blend")*se.height/2*ye,u_sky_blend:Se}})(O,k.style.map.transform,k.pixelRatio),H=new vt(W.LEQUAL,vt.ReadWrite,[0,1]),K=Rt.disabled,ee=k.colorModeForRenderPass(),te=k.useProgram("sky"),ie=Lc(Z,O);te.draw(Z,W.TRIANGLES,H,K,ee,Ot.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 k=this.style._layers[h[this.currentLayer]],O=f[k.source],Z=y[k.source];this._renderTileClippingMasks(k,Z,!1),this.renderLayer(this,O,k,Z,C)}this.renderPass="translucent";let A=!1;for(this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const k=this.style._layers[h[this.currentLayer]],O=f[k.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(k,C))continue;this.opaquePassEnabledForLayer()||A||(A=!0,C.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const Z=(k.type==="symbol"?T:v)[k.source];this._renderTileClippingMasks(k,y[k.source],!1),this.renderLayer(this,O,k,Z,C)}if(C.isRenderingGlobe&&function(k,O,Z){const W=k.context,q=W.gl,H=k.useProgram("atmosphere"),K=new vt(q.LEQUAL,vt.ReadOnly,[0,1]),ee=k.transform,te=function(Se,Ne){const Be=Se.properties.get("position"),Ee=[-Be.x,-Be.y,-Be.z],Xe=o.at(new Float64Array(16));return Se.properties.get("anchor")==="map"&&(o.a_(Xe,Xe,Ne.rollInRadians),o.a$(Xe,Xe,-Ne.pitchInRadians),o.a_(Xe,Xe,Ne.bearingInRadians),o.a$(Xe,Xe,Ne.center.lat*Math.PI/180),o.bm(Xe,Xe,-Ne.center.lng*Math.PI/180)),o.bV(Ee,Ee,Xe),Ee}(Z,k.transform),ie=ee.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),he=O.properties.get("atmosphere-blend")*ie.projectionTransition;if(he===0)return;const se=Bo(ee.worldSize,ee.center.lat),ye=ee.inverseProjectionMatrix,ge=new Float64Array(4);ge[3]=1,o.ap(ge,ge,ee.modelViewProjectionMatrix),ge[0]/=ge[3],ge[1]/=ge[3],ge[2]/=ge[3],ge[3]=1,o.ap(ge,ge,ye),ge[0]/=ge[3],ge[1]/=ge[3],ge[2]/=ge[3],ge[3]=1;const Ie=((Se,Ne,Be,Ee,Xe)=>({u_sun_pos:Se,u_atmosphere_blend:Ne,u_globe_position:Be,u_globe_radius:Ee,u_inv_proj_matrix:Xe}))(te,he,[ge[0],ge[1],ge[2]],se,ye),ke=Lc(W,O);H.draw(W,q.TRIANGLES,K,Rt.disabled,ri.alphaBlended,Ot.disabled,Ie,null,null,"atmosphere",ke.vertexBuffer,ke.indexBuffer,ke.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const k=function(O,Z){let W=null;const q=Object.values(O._layers).flatMap(te=>te.source&&!te.isHidden(Z)?[O.sourceCaches[te.source]]:[]),H=q.filter(te=>te.getSource().type==="vector"),K=q.filter(te=>te.getSource().type!=="vector"),ee=te=>{(!W||W.getSource().maxzoom<te.getSource().maxzoom)&&(W=te)};return H.forEach(te=>ee(te)),W||K.forEach(te=>ee(te)),W}(this.style,this.transform.zoom);k&&function(O,Z,W){for(let q=0;q<W.length;q++)Ys(O,Z,W[q])}(this,k,k.getVisibleCoordinates())}this.options.showPadding&&function(k){const O=k.transform.padding;rl(k,k.transform.height-(O.top||0),3,Bh),rl(k,O.bottom||0,3,Ti),Dc(k,O.left||0,3,va),Dc(k,k.transform.width-(O.right||0),3,Ar);const Z=k.transform.centerPoint;(function(W,q,H,K){xn(W,q-1,H-10,2,20,K),xn(W,q-10,H-1,20,2,K)})(k,Z.x,k.transform.height-Z.y,Rc)}(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.bY(i,s):!o.bZ(i,s)),l||(l=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),l&&(o.b_(i,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,f){const y=h.context,v=y.gl,T=h.transform,C=ri.unblended,A=new vt(v.LEQUAL,vt.ReadWrite,[0,1]),k=f.sourceCache.getRenderableTiles(),O=h.useProgram("terrainDepth");y.bindFramebuffer.set(f.getFramebuffer("depth").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:o.b7.transparent,depth:1});for(const Z of k){const W=f.getTerrainMesh(Z.tileID),q=f.getTerrainData(Z.tileID),H=T.getProjectionData({overscaledTileID:Z.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),K={u_ele_delta:f.getMeshFrameDelta(T.zoom)};O.draw(y,v.TRIANGLES,A,Rt.disabled,C,Ot.backCCW,K,q,H,"terrain",W.vertexBuffer,W.indexBuffer,W.segments)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,f){const y=h.context,v=y.gl,T=h.transform,C=ri.unblended,A=new vt(v.LEQUAL,vt.ReadWrite,[0,1]),k=f.getCoordsTexture(),O=f.sourceCache.getRenderableTiles(),Z=h.useProgram("terrainCoords");y.bindFramebuffer.set(f.getFramebuffer("coords").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:o.b7.transparent,depth:1}),f.coordsIndex=[];for(const W of O){const q=f.getTerrainMesh(W.tileID),H=f.getTerrainData(W.tileID);y.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,k.texture);const K={u_terrain_coords_id:(255-f.coordsIndex.length)/255,u_texture:0,u_ele_delta:f.getMeshFrameDelta(T.zoom)},ee=T.getProjectionData({overscaledTileID:W.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});Z.draw(y,v.TRIANGLES,A,Rt.disabled,C,Ot.backCCW,K,H,ee,"terrain",q.vertexBuffer,q.indexBuffer,q.segments),f.coordsIndex.push(W.tileID.key)}y.bindFramebuffer.set(null),y.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.b$(s)?function(f,y,v,T,C,A){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:k}=A,O=Rt.disabled,Z=f.colorModeForRenderPass();(v._unevaluatedLayout.hasValue("text-variable-anchor")||v._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(W,q,H,K,ee,te,ie,he,se){const ye=q.transform,ge=q.style.map.terrain,Ie=ee==="map",ke=te==="map";for(const Se of W){const Ne=K.getTile(Se),Be=Ne.getBucket(H);if(!Be||!Be.text||!Be.text.segments.get().length)continue;const Ee=o.ag(Be.textSizeData,ye.zoom),Xe=o.aw(Ne,1,q.transform.zoom),xt=me(Ie,q.transform,Xe),Nt=H.layout.get("icon-text-fit")!=="none"&&Be.hasIconData();if(Ee){const bt=Math.pow(2,ye.zoom-Ne.tileID.overscaledZ),Wt=ge?(ei,ai)=>ge.getElevation(Se,ei,ai):null;Lh(Be,Ie,ke,se,ye,xt,bt,Ee,Nt,o.ax(ye,Ne,ie,he),Se.toUnwrapped(),Wt)}}}(T,f,v,y,v.layout.get("text-rotation-alignment"),v.layout.get("text-pitch-alignment"),v.paint.get("text-translate"),v.paint.get("text-translate-anchor"),C),v.paint.get("icon-opacity").constantOr(1)!==0&&Xs(f,y,v,T,!1,v.paint.get("icon-translate"),v.paint.get("icon-translate-anchor"),v.layout.get("icon-rotation-alignment"),v.layout.get("icon-pitch-alignment"),v.layout.get("icon-keep-upright"),O,Z,k),v.paint.get("text-opacity").constantOr(1)!==0&&Xs(f,y,v,T,!0,v.paint.get("text-translate"),v.paint.get("text-translate-anchor"),v.layout.get("text-rotation-alignment"),v.layout.get("text-pitch-alignment"),v.layout.get("text-keep-upright"),O,Z,k),y.map.showCollisionBoxes&&(Hs(f,y,v,T,!0),Hs(f,y,v,T,!1))}(e,i,s,l,this.style.placement.variableOffsets,h):o.c0(s)?function(f,y,v,T,C){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=C,k=v.paint.get("circle-opacity"),O=v.paint.get("circle-stroke-width"),Z=v.paint.get("circle-stroke-opacity"),W=!v.layout.get("circle-sort-key").isConstant();if(k.constantOr(1)===0&&(O.constantOr(1)===0||Z.constantOr(1)===0))return;const q=f.context,H=q.gl,K=f.transform,ee=f.getDepthModeForSublayer(0,vt.ReadOnly),te=Rt.disabled,ie=f.colorModeForRenderPass(),he=[],se=K.getCircleRadiusCorrection();for(let ye=0;ye<T.length;ye++){const ge=T[ye],Ie=y.getTile(ge),ke=Ie.getBucket(v);if(!ke)continue;const Se=v.paint.get("circle-translate"),Ne=v.paint.get("circle-translate-anchor"),Be=o.ax(K,Ie,Se,Ne),Ee=ke.programConfigurations.get(v.id),Xe=f.useProgram("circle",Ee),xt=ke.layoutVertexBuffer,Nt=ke.indexBuffer,bt=f.style.map.terrain&&f.style.map.terrain.getTerrainData(ge),Wt={programConfiguration:Ee,program:Xe,layoutVertexBuffer:xt,indexBuffer:Nt,uniformValues:_h(f,Ie,v,Be,se),terrainData:bt,projectionData:K.getProjectionData({overscaledTileID:ge,applyGlobeMatrix:!A,applyTerrainMatrix:!0})};if(W){const ei=ke.segments.get();for(const ai of ei)he.push({segments:new o.aG([ai]),sortKey:ai.sortKey,state:Wt})}else he.push({segments:ke.segments,sortKey:0,state:Wt})}W&&he.sort((ye,ge)=>ye.sortKey-ge.sortKey);for(const ye of he){const{programConfiguration:ge,program:Ie,layoutVertexBuffer:ke,indexBuffer:Se,uniformValues:Ne,terrainData:Be,projectionData:Ee}=ye.state;Ie.draw(q,H.TRIANGLES,ee,te,ie,Ot.backCCW,Ne,Be,Ee,v.id,ke,Se,ye.segments,v.paint,f.transform.zoom,ge)}}(e,i,s,l,h):o.c1(s)?function(f,y,v,T,C){if(v.paint.get("heatmap-opacity")===0)return;const A=f.context,{isRenderingToTexture:k,isRenderingGlobe:O}=C;if(f.style.map.terrain){for(const Z of T){const W=y.getTile(Z);y.hasRenderableParent(Z)||(f.renderPass==="offscreen"?lp(f,W,v,Z,O):f.renderPass==="translucent"&&Ac(f,v,Z,k,O))}A.viewport.set([0,0,f.width,f.height])}else f.renderPass==="offscreen"?function(Z,W,q,H){const K=Z.context,ee=K.gl,te=Z.transform,ie=Rt.disabled,he=new ri([ee.ONE,ee.ONE],o.b7.transparent,[!0,!0,!0,!0]);(function(se,ye,ge){const Ie=se.gl;se.activeTexture.set(Ie.TEXTURE1),se.viewport.set([0,0,ye.width/4,ye.height/4]);let ke=ge.heatmapFbos.get(o.bS);ke?(Ie.bindTexture(Ie.TEXTURE_2D,ke.colorAttachment.get()),se.bindFramebuffer.set(ke.framebuffer)):(ke=Fh(se,ye.width/4,ye.height/4),ge.heatmapFbos.set(o.bS,ke))})(K,Z,q),K.clear({color:o.b7.transparent});for(let se=0;se<H.length;se++){const ye=H[se];if(W.hasRenderableParent(ye))continue;const ge=W.getTile(ye),Ie=ge.getBucket(q);if(!Ie)continue;const ke=Ie.programConfigurations.get(q.id),Se=Z.useProgram("heatmap",ke),Ne=te.getProjectionData({overscaledTileID:ye,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Be=te.getCircleRadiusCorrection();Se.draw(K,ee.TRIANGLES,vt.disabled,ie,he,Ot.backCCW,gc(ge,te.zoom,q.paint.get("heatmap-intensity"),Be),null,Ne,q.id,Ie.layoutVertexBuffer,Ie.indexBuffer,Ie.segments,q.paint,te.zoom,ke)}K.viewport.set([0,0,Z.width,Z.height])}(f,y,v,T):f.renderPass==="translucent"&&function(Z,W){const q=Z.context,H=q.gl;q.setColorMode(Z.colorModeForRenderPass());const K=W.heatmapFbos.get(o.bS);K&&(q.activeTexture.set(H.TEXTURE0),H.bindTexture(H.TEXTURE_2D,K.colorAttachment.get()),q.activeTexture.set(H.TEXTURE1),zc(q,W).bind(H.LINEAR,H.CLAMP_TO_EDGE),Z.useProgram("heatmapTexture").draw(q,H.TRIANGLES,vt.disabled,Rt.disabled,Z.colorModeForRenderPass(),Ot.disabled,_c(Z,W,0,1),null,null,W.id,Z.viewportBuffer,Z.quadTriangleIndexBuffer,Z.viewportSegments,W.paint,Z.transform.zoom))}(f,v)}(e,i,s,l,h):o.c2(s)?function(f,y,v,T,C){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=C,k=v.paint.get("line-opacity"),O=v.paint.get("line-width");if(k.constantOr(1)===0||O.constantOr(1)===0)return;const Z=f.getDepthModeForSublayer(0,vt.ReadOnly),W=f.colorModeForRenderPass(),q=v.paint.get("line-dasharray"),H=v.paint.get("line-pattern"),K=H.constantOr(1),ee=v.paint.get("line-gradient"),te=v.getCrossfadeParameters(),ie=K?"linePattern":q?"lineSDF":ee?"lineGradient":"line",he=f.context,se=he.gl,ye=f.transform;let ge=!0;for(const Ie of T){const ke=y.getTile(Ie);if(K&&!ke.patternsLoaded())continue;const Se=ke.getBucket(v);if(!Se)continue;const Ne=Se.programConfigurations.get(v.id),Be=f.context.program.get(),Ee=f.useProgram(ie,Ne),Xe=ge||Ee.program!==Be,xt=f.style.map.terrain&&f.style.map.terrain.getTerrainData(Ie),Nt=H.constantOr(null);if(Nt&&ke.imageAtlas){const Gt=ke.imageAtlas,Ht=Gt.patternPositions[Nt.to.toString()],ki=Gt.patternPositions[Nt.from.toString()];Ht&&ki&&Ne.setConstantPatternPositions(Ht,ki)}const bt=ye.getProjectionData({overscaledTileID:Ie,applyGlobeMatrix:!A,applyTerrainMatrix:!0}),Wt=ye.getPixelScale(),ei=K?$s(f,ke,v,Wt,te):q?Qd(f,ke,v,Wt,q,te):ee?bh(f,ke,v,Wt,Se.lineClipsArray.length):Vo(f,ke,v,Wt);if(K)he.activeTexture.set(se.TEXTURE0),ke.imageAtlasTexture.bind(se.LINEAR,se.CLAMP_TO_EDGE),Ne.updatePaintBuffers(te);else if(q&&(Xe||f.lineAtlas.dirty))he.activeTexture.set(se.TEXTURE0),f.lineAtlas.bind(he);else if(ee){const Gt=Se.gradients[v.id];let Ht=Gt.texture;if(v.gradientVersion!==Gt.version){let ki=256;if(v.stepInterpolant){const Oi=y.getSource().maxzoom,Vi=Ie.canonical.z===Oi?Math.ceil(1<<f.transform.maxZoom-Ie.canonical.z):1;ki=o.ae(o.bT(Se.maxLineLength/o.Z*1024*Vi),256,he.maxTextureSize)}Gt.gradient=o.bU({expression:v.gradientExpression(),evaluationKey:"lineProgress",resolution:ki,image:Gt.gradient||void 0,clips:Se.lineClipsArray}),Gt.texture?Gt.texture.update(Gt.gradient):Gt.texture=new wt(he,Gt.gradient,se.RGBA),Gt.version=v.gradientVersion,Ht=Gt.texture}he.activeTexture.set(se.TEXTURE0),Ht.bind(v.stepInterpolant?se.NEAREST:se.LINEAR,se.CLAMP_TO_EDGE)}let ai;if(A){const[Gt]=f.getStencilConfigForOverlapAndUpdateStencilID(T);ai=Gt[Ie.overscaledZ]}else ai=f.stencilModeForClipping(Ie);Ee.draw(he,se.TRIANGLES,Z,ai,W,Ot.disabled,ei,xt,bt,v.id,Se.layoutVertexBuffer,Se.indexBuffer,Se.segments,v.paint,f.transform.zoom,Ne,Se.layoutVertexBuffer2),ge=!1}}(e,i,s,l,h):o.c3(s)?function(f,y,v,T,C){const A=v.paint.get("fill-color"),k=v.paint.get("fill-opacity");if(k.constantOr(1)===0)return;const{isRenderingToTexture:O}=C,Z=f.colorModeForRenderPass(),W=v.paint.get("fill-pattern"),q=f.opaquePassEnabledForLayer()&&!W.constantOr(1)&&A.constantOr(o.b7.transparent).a===1&&k.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===q){const H=f.getDepthModeForSublayer(1,f.renderPass==="opaque"?vt.ReadWrite:vt.ReadOnly);el(f,y,v,T,H,Z,!1,O)}if(f.renderPass==="translucent"&&v.paint.get("fill-antialias")){const H=f.getDepthModeForSublayer(v.getPaintProperty("fill-outline-color")?2:0,vt.ReadOnly);el(f,y,v,T,H,Z,!0,O)}}(e,i,s,l,h):o.c4(s)?function(f,y,v,T,C){const A=v.paint.get("fill-extrusion-opacity");if(A===0)return;const{isRenderingToTexture:k}=C;if(f.renderPass==="translucent"){const O=new vt(f.context.gl.LEQUAL,vt.ReadWrite,f.depthRangeFor3D);if(A!==1||v.paint.get("fill-extrusion-pattern").constantOr(1))tl(f,y,v,T,O,Rt.disabled,ri.disabled,k),tl(f,y,v,T,O,f.stencilModeFor3D(),f.colorModeForRenderPass(),k);else{const Z=f.colorModeForRenderPass();tl(f,y,v,T,O,Rt.disabled,Z,k)}}}(e,i,s,l,h):o.c5(s)?function(f,y,v,T,C){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=C,k=f.context,O=f.style.projection.useSubdivision,Z=f.getDepthModeForSublayer(0,vt.ReadOnly),W=f.colorModeForRenderPass();if(f.renderPass==="offscreen")(function(q,H,K,ee,te,ie,he){const se=q.context,ye=se.gl;for(const ge of K){const Ie=H.getTile(ge),ke=Ie.dem;if(!ke||!ke.data||!Ie.needsHillshadePrepare)continue;const Se=ke.dim,Ne=ke.stride,Be=ke.getPixels();if(se.activeTexture.set(ye.TEXTURE1),se.pixelStoreUnpackPremultiplyAlpha.set(!1),Ie.demTexture=Ie.demTexture||q.getTileTexture(Ne),Ie.demTexture){const Xe=Ie.demTexture;Xe.update(Be,{premultiply:!1}),Xe.bind(ye.NEAREST,ye.CLAMP_TO_EDGE)}else Ie.demTexture=new wt(se,Be,ye.RGBA,{premultiply:!1}),Ie.demTexture.bind(ye.NEAREST,ye.CLAMP_TO_EDGE);se.activeTexture.set(ye.TEXTURE0);let Ee=Ie.fbo;if(!Ee){const Xe=new wt(se,{width:Se,height:Se,data:null},ye.RGBA);Xe.bind(ye.LINEAR,ye.CLAMP_TO_EDGE),Ee=Ie.fbo=se.createFramebuffer(Se,Se,!0,!1),Ee.colorAttachment.set(Xe.texture)}se.bindFramebuffer.set(Ee.framebuffer),se.viewport.set([0,0,Se,Se]),q.useProgram("hillshadePrepare").draw(se,ye.TRIANGLES,te,ie,he,Ot.disabled,vh(Ie.tileID,ke),null,null,ee.id,q.rasterBoundsBuffer,q.quadTriangleIndexBuffer,q.rasterBoundsSegments),Ie.needsHillshadePrepare=!1}})(f,y,T,v,Z,Rt.disabled,W),k.viewport.set([0,0,f.width,f.height]);else if(f.renderPass==="translucent")if(O){const[q,H,K]=f.stencilConfigForOverlapTwoPass(T);il(f,y,v,K,q,Z,W,!1,A),il(f,y,v,K,H,Z,W,!0,A)}else{const[q,H]=f.getStencilConfigForOverlapAndUpdateStencilID(T);il(f,y,v,H,q,Z,W,!1,A)}}(e,i,s,l,h):o.c6(s)?function(f,y,v,T,C){if(f.renderPass!=="translucent"||v.paint.get("raster-opacity")===0||!T.length)return;const{isRenderingToTexture:A}=C,k=y.getSource(),O=f.style.projection.useSubdivision;if(k instanceof Or)hs(f,y,v,T,null,!1,!1,k.tileCoords,k.flippedWindingOrder,A);else if(O){const[Z,W,q]=f.stencilConfigForOverlapTwoPass(T);hs(f,y,v,q,Z,!1,!0,us,!1,A),hs(f,y,v,q,W,!0,!0,us,!1,A)}else{const[Z,W]=f.getStencilConfigForOverlapAndUpdateStencilID(T);hs(f,y,v,W,Z,!1,!0,us,!1,A)}}(e,i,s,l,h):o.c7(s)?function(f,y,v,T,C){const A=v.paint.get("background-color"),k=v.paint.get("background-opacity");if(k===0)return;const{isRenderingToTexture:O}=C,Z=f.context,W=Z.gl,q=f.style.projection,H=f.transform,K=H.tileSize,ee=v.paint.get("background-pattern");if(f.isPatternMissing(ee))return;const te=!ee&&A.a===1&&k===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==te)return;const ie=Rt.disabled,he=f.getDepthModeForSublayer(0,te==="opaque"?vt.ReadWrite:vt.ReadOnly),se=f.colorModeForRenderPass(),ye=f.useProgram(ee?"backgroundPattern":"background"),ge=T||pe(H,{tileSize:K,terrain:f.style.map.terrain});ee&&(Z.activeTexture.set(W.TEXTURE0),f.imageManager.bind(f.context));const Ie=v.getCrossfadeParameters();for(const ke of ge){const Se=H.getProjectionData({overscaledTileID:ke,applyGlobeMatrix:!O,applyTerrainMatrix:!0}),Ne=ee?Uo(k,f,ee,{tileID:ke,tileSize:K},Ie):Ph(k,A),Be=f.style.map.terrain&&f.style.map.terrain.getTerrainData(ke),Ee=q.getMeshFromTileID(Z,ke.canonical,!1,!0,"raster");ye.draw(Z,W.TRIANGLES,he,ie,se,Ot.backCCW,Ne,Be,Se,v.id,Ee.vertexBuffer,Ee.indexBuffer,Ee.segments)}}(e,0,s,l,h):o.c8(s)&&function(f,y,v,T){const{isRenderingGlobe:C}=T,A=f.context,k=v.implementation,O=f.style.projection,Z=f.transform,W=Z.getProjectionDataForCustomLayer(C),q={farZ:Z.farZ,nearZ:Z.nearZ,fov:Z.fov*Math.PI/180,modelViewProjectionMatrix:Z.modelViewProjectionMatrix,projectionMatrix:Z.projectionMatrix,shaderData:{variantName:O.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
728
- uniform mat4 u_projection_matrix;
729
- ${O.shaderPreludeCode.vertexSource}`,define:O.shaderDefine},defaultProjectionData:W},H=k.renderingMode?k.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=k.prerender;K&&(f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),K.call(k,A.gl,q),A.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),A.setStencilMode(Rt.disabled);const K=H==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,vt.ReadOnly);A.setDepthMode(K),k.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){this.cache=this.cache||{};const l=!!this.style.map.terrain,h=this.style.projection,f=e+(i?i.cacheKey:"")+`/${s?Xa:h.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(l?"/terrain":"");return this.cache[f]||(this.cache[f]=new Us(this.context,Nr[e],i,bc[e],this._showOverdrawInspector,l,s?Nr.projectionMercator:h.shaderPreludeCode,s?_n:h.shaderDefine)),this.cache[f]}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 wt(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 Fc(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(...y)=>(s=!0,h=this,i=y,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=Fc(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,y=Math.round(i.lat*h)/h,v=this._map.getBearing(),T=this._map.getPitch();let C="";if(C+=e?`/${f}/${y}/${s}`:`${s}/${y}/${f}`,(v||T)&&(C+="/"+Math.round(10*v)/10),T&&(C+=`/${Math.round(T)}`),this._hashName){const A=this._hashName;let k=!1;const O=window.location.hash.slice(1).split("&").map(Z=>{const W=Z.split("=")[0];return W===A?(k=!0,`${W}=${C}`):Z}).filter(Z=>Z);return k||O.push(`${A}=${C}`),`#${O.join("&")}`}return`#${C}`}_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 ds={linearity:.3,easing:o.c9(0,0,.3,1)},ba=o.e({deceleration:2500,maxSpeed:1400},ds),jh=o.e({deceleration:20,maxSpeed:1400},ds),Nh=o.e({deceleration:1e3,maxSpeed:360},ds),Zh=o.e({deceleration:1e3,maxSpeed:90},ds),Vh=o.e({deceleration:1e3,maxSpeed:360},ds);class Uh{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ae.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=ae.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=fs(i.pan.mag(),s,o.e({},ba,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),y=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=y.easingCenter,l.offset=y.easingOffset,ps(l,h)}if(i.zoom){const h=fs(i.zoom,s,jh);l.zoom=this._map.transform.zoom+h.amount,ps(l,h)}if(i.bearing){const h=fs(i.bearing,s,Nh);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),ps(l,h)}if(i.pitch){const h=fs(i.pitch,s,Zh);l.pitch=this._map.transform.pitch+h.amount,ps(l,h)}if(i.roll){const h=fs(i.roll,s,Vh);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),ps(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 ps(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function fs(u,e,i){const{maxSpeed:s,linearity:l,deceleration:h}=i,f=o.ae(u*l/(e/1e3),-s,s),y=Math.abs(f)/(h*l);return{easing:i.easing,duration:1e3*y,amount:f*(y/2)}}class tr 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=G.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 ms 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=G.touchPos(i.getCanvasContainer(),l),f=h.map(v=>i.unproject(v)),y=h.reduce((v,T,C,A)=>v.add(T.div(A.length)),new o.P(0,0));super(e,{points:h,point:y,lngLats:f,lngLat:i.unproject(y),originalEvent:s}),this._defaultPrevented=!1}}class zr extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class tn{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new zr(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new tr(e.type,this._map,e))}mouseup(e){this._map.fire(new tr(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new tr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new tr(e.type,this._map,e))}mouseover(e){this._map.fire(new tr(e.type,this._map,e))}mouseout(e){this._map.fire(new tr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ms(e.type,this._map,e))}touchmove(e){this._map.fire(new ms(e.type,this._map,e))}touchend(e){this._map.fire(new ms(e.type,this._map,e))}touchcancel(e){this._map.fire(new ms(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class $h{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new tr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new tr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new tr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class pr{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 wa{constructor(e,i){this._map=e,this._tr=new pr(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&&(G.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=G.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),y=Math.min(l.y,s.y),v=Math.max(l.y,s.y);G.setTransform(this._box,`translate(${h}px,${y}px)`),this._box.style.width=f-h+"px",this._box.style.height=v-y+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),G.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&&(G.remove(this._box),this._box=null),G.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function Oc(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 up{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=Oc(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=Oc(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 jc{constructor(e){this.singleTap=new up(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 hp{constructor(e){this._tr=new pr(e),this._zoomIn=new jc({numTouches:1,numTaps:2}),this._zoomOut=new jc({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:y=>y.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(l)},{originalEvent:e})}):h?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.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 gs{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&&G.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 Js={0:1,2:2};class br{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=G.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=Js[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return G.mouseButton(e)===this._eventButton}}class $e{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 Gh{constructor(e=new br({checkCorrectEvent:()=>!0}),i=new $e){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 _s=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class qh{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=Oc(s,i),h=new o.P(0,0),f=new o.P(0,0);let y=0;for(const T in l){const C=l[T],A=this._touches[T];A&&(h._add(C),f._add(C.sub(A)),y++,l[T]=C)}if(this._touches=l,this._shouldBePrevented(y)||!f.mag())return;const v=f.div(y);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(y),panDelta:v}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ta{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=qn(s,i,l),y=qn(s,i,h);if(!f||!y)return;const v=this._aroundCenter?null:f.add(y).div(2);return this._move([f,y],v,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=qn(s,i,l),y=qn(s,i,h);f&&y||(this._active&&G.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 qn(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function Nc(u,e){return Math.log(u/e)/Math.LN2}class Ct extends Ta{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(Nc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Nc(this._distance,s),pinchAround:i}}}function al(u,e){return 180*u.angleWith(e)/Math.PI}class Wh extends Ta{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:al(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=al(e,this._startVector);return Math.abs(s)<i}}function Qs(u){return Math.abs(u.y)>Math.abs(u.x)}class Hh extends Ta{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,Qs(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 Qs(e)&&Qs(i)&&f}}const dp={panStep:100,bearingStep:15,pitchStep:10};class Zc{constructor(e){this._tr=new pr(e);const i=dp;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:y=>{const v=this._tr;y.easeTo({duration:300,easeId:"keyboardHandler",easing:Vc,zoom:i?Math.round(v.zoom)+i*(e.shiftKey?2:1):v.zoom,bearing:v.bearing+s*this._bearingStep,pitch:v.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:v.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 Vc(u){return u*(2-u)}const Uc=4.000244140625;class Xh{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new pr(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=ae.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%Uc==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=G.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 y=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=y),typeof this._targetZoom=="number"&&(this._targetZoom+=y)}if(this._delta!==0){const y=this._type==="wheel"&&Math.abs(this._delta)>Uc?this._wheelZoomRate:this._defaultZoomRate;let v=2/(1+Math.exp(-Math.abs(this._delta*y)));this._delta<0&&v!==0&&(v=1/v);const T=typeof this._targetZoom!="number"?e.scale:o.aI(this._targetZoom);this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,o.ab(T*v))),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 y=ae.now()-this._lastWheelEventTime,v=Math.min((y+5)/200,1),T=l(v);h=o.B.number(s,i,T),v<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.cb;if(this._prevEase){const s=this._prevEase,l=(ae.now()-s.start)/s.duration,h=s.easing(l+.01)-s.easing(l),f=.27/Math.sqrt(h*h+1e-4)*.01,y=Math.sqrt(.0729-f*f);i=o.c9(f,y,.25,1)}return this._prevEase={start:ae.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 $c{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 pp{constructor(e){this._tr=new pr(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 fp{constructor(){this._tap=new jc({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 vn{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 ni{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 eo{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 sl{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=G.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&&(G.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 to=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Kh extends o.l{}function ol(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class mp{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,y={needsRenderFrame:!1},v={},T={};for(const{handlerName:k,handler:O,allowed:Z}of this._handlers){if(!O.isEnabled())continue;let W;if(this._blockedByActive(T,Z,k))O.reset();else if(O[h||l.type]){if(o.cc(l,h||l.type)){const q=G.mousePos(this._map.getCanvas(),l);W=O[h||l.type](l,q)}else if(o.cd(l,h||l.type)){const q=this._getMapTouches(l.touches),H=G.touchPos(this._map.getCanvas(),q);W=O[h||l.type](l,H,q)}else o.ce(h||l.type)||(W=O[h||l.type](l));this.mergeHandlerResult(y,v,W,k,f),W&&W.needsRenderFrame&&this._triggerRenderFrame()}(W||O.isActive())&&(T[k]=O)}const C={};for(const k in this._previousActiveHandlers)T[k]||(C[k]=f);this._previousActiveHandlers=T,(Object.keys(C).length||ol(y))&&(this._changes.push([y,v,C]),this._triggerRenderFrame()),(Object.keys(T).length||ol(y))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:A}=y;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 Uh(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)G.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)G.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new tn(i,e));const l=i.boxZoom=new wa(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new sl(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new hp(i),y=new pp(i);i.doubleClickZoom=new $c(y,f),this._add("tapZoom",f),this._add("clickZoom",y),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const v=new fp;this._add("tapDragZoom",v);const T=i.touchPitch=new Hh(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const C=()=>i.project(i.getCenter()),A=function({enable:te,clickTolerance:ie,aroundCenter:he=!0,minPixelCenterThreshold:se=100,rotateDegreesPerPixelMoved:ye=.8},ge){const Ie=new br({checkCorrectEvent:ke=>G.mouseButton(ke)===0&&ke.ctrlKey||G.mouseButton(ke)===2&&!ke.ctrlKey});return new gs({clickTolerance:ie,move:(ke,Se)=>{const Ne=ge();if(he&&Math.abs(Ne.y-ke.y)>se)return{bearingDelta:o.ca(new o.P(ke.x,Se.y),Se,Ne)};let Be=(Se.x-ke.x)*ye;return he&&Se.y<Ne.y&&(Be=-Be),{bearingDelta:Be}},moveStateManager:Ie,enable:te,assignEvents:_s})}(e,C),k=function({enable:te,clickTolerance:ie,pitchDegreesPerPixelMoved:he=-.5}){const se=new br({checkCorrectEvent:ye=>G.mouseButton(ye)===0&&ye.ctrlKey||G.mouseButton(ye)===2});return new gs({clickTolerance:ie,move:(ye,ge)=>({pitchDelta:(ge.y-ye.y)*he}),moveStateManager:se,enable:te,assignEvents:_s})}(e),O=function({enable:te,clickTolerance:ie,rollDegreesPerPixelMoved:he=.3},se){const ye=new br({checkCorrectEvent:ge=>G.mouseButton(ge)===2&&ge.ctrlKey});return new gs({clickTolerance:ie,move:(ge,Ie)=>{const ke=se();let Se=(Ie.x-ge.x)*he;return Ie.y<ke.y&&(Se=-Se),{rollDelta:Se}},moveStateManager:ye,enable:te,assignEvents:_s})}(e,C);i.dragRotate=new ni(e,A,k,O),this._add("mouseRotate",A,["mousePitch"]),this._add("mousePitch",k,["mouseRotate","mouseRoll"]),this._add("mouseRoll",O,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const Z=function({enable:te,clickTolerance:ie}){const he=new br({checkCorrectEvent:se=>G.mouseButton(se)===0&&!se.ctrlKey});return new gs({clickTolerance:ie,move:(se,ye)=>({around:ye,panDelta:ye.sub(se)}),activateOnStart:!0,moveStateManager:he,enable:te,assignEvents:_s})}(e),W=new qh(e,i);i.dragPan=new vn(s,Z,W),this._add("mousePan",Z),this._add("touchPan",W,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const q=new Wh,H=new Ct;i.touchZoomRotate=new eo(s,H,q,v),this._add("touchRotate",q,["touchPan","touchZoom"]),this._add("touchZoom",H,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const K=i.scrollZoom=new Xh(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const ee=i.keyboard=new Zc(i);this._add("keyboard",ee),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new $h(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!!to(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(!(ol(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:y,zoomDelta:v,bearingDelta:T,pitchDelta:C,rollDelta:A,around:k,pinchAround:O}=e;O!==void 0&&(k=O),k=k||l.transform.centerPoint,f&&!h.isPointOnMapSurface(k)&&(k=h.centerPoint);const Z={panDelta:y,zoomDelta:v,rollDelta:A,pitchDelta:C,bearingDelta:T,around:k};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(k)&&(k=h.centerPoint);const W=k.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(y?k.sub(y):k);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(Z,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(y))):this._map.cameraHelper.handleMapControlsPan(Z,h,W):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(Z,h,W))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(Z,h),this._map.cameraHelper.handleMapControlsPan(Z,h,W)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=to(this._eventsInProgress),h=to(e),f={};for(const A in e){const{originalEvent:k}=e[A];this._eventsInProgress[A]||(f[`${A}start`]=k),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:k}=e[A];this._fireEvent(A,k)}const y={};let v;for(const A in this._eventsInProgress){const{handlerName:k,originalEvent:O}=this._eventsInProgress[A];this._handlersById[k].isActive()||(delete this._eventsInProgress[A],v=i[k]||O,y[`${A}end`]=v)}for(const A in y)this._fireEvent(A,y[A]);const T=to(this._eventsInProgress),C=(l||h)&&!T;if(C&&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&&C){this._updatingCamera=!0;const A=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),k=O=>O!==0&&-this._bearingSnap<O&&O<this._bearingSnap;!A||!A.essential&&ae.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:v})),k(this._map.getBearing())&&this._map.resetNorth()):(k(A.bearing||this._map.getBearing())&&(A.bearing=0),A.freezeElevation=!0,this._map.easeTo(A,{originalEvent:v})),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 Kh("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class rn extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((ae.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=wi.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 y=this.transform,v=new wi(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,v,s,y)}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 y=s.zoom;this.cameraHelper.handleJumpToCenterZoom(s,e);const v=s.zoom!==y;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)),v&&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),y=f.x-h.x,v=f.y-h.y,T=f.z-h.z,C=Math.hypot(y,v,T);if(C===0)throw new Error("Can't calculate camera options with same From and To");const A=Math.hypot(y,v),k=o.ab(this.transform.cameraToCenterDistance/C/this.transform.tileSize),O=180*Math.atan2(y,-v)/Math.PI;let Z=180*Math.acos(A/C)/Math.PI;return Z=T<0?90-Z:90+Z,{center:f.toLngLat(),elevation:l,zoom:k,pitch:Z,bearing:O}}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.cb},e)).animate===!1||!e.essential&&ae.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),l=this.getBearing(),h=s.pitch,f=s.roll,y="bearing"in e?this._normalizeBearing(e.bearing,l):l,v="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,C="padding"in e?e.padding:s.padding,A=o.P.convert(e.offset);let k,O;e.around&&(k=o.Q.convert(e.around),O=s.locationToScreenPoint(k));const Z={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},W=this.cameraHelper.handleEaseTo(s,{bearing:y,pitch:v,roll:T,padding:C,around:k,aroundPoint:O,offsetAsPoint:A,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==y,this._pitching=this._pitching||v!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(C),this._zooming=this._zooming||W.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,Z),this.terrain&&this._prepareElevation(W.elevationCenter),this._ease(q=>{W.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:y,roll:v,pitch:T,bearing:C,elevation:A}=l(h);f&&h.setCenter(f),A!==void 0&&h.setElevation(A),y!==void 0&&h.setZoom(y),v!==void 0&&h.setRoll(v),T!==void 0&&h.setPitch(T),C!==void 0&&h.setBearing(C),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&&ae.prefersReducedMotion){const Se=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(Se,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cb},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,y=s.padding,v="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,C="roll"in e?this._normalizeBearing(e.roll,f):f,A="padding"in e?e.padding:s.padding,k=o.P.convert(e.offset);let O=s.centerPoint.add(k);const Z=s.screenPointToLocation(O),W=this.cameraHelper.handleFlyTo(s,{bearing:v,pitch:T,roll:C,padding:A,locationAtOffset:Z,offsetAsPoint:k,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let q=e.curve;const H=Math.max(s.width,s.height),K=H/W.scaleOfZoom,ee=W.pixelPathLength;typeof W.scaleOfMinZoom=="number"&&(q=Math.sqrt(H/W.scaleOfMinZoom/ee*2));const te=q*q;function ie(Se){const Ne=(K*K-H*H+(Se?-1:1)*te*te*ee*ee)/(2*(Se?K:H)*te*ee);return Math.log(Math.sqrt(Ne*Ne+1)-Ne)}function he(Se){return(Math.exp(Se)-Math.exp(-Se))/2}function se(Se){return(Math.exp(Se)+Math.exp(-Se))/2}const ye=ie(!1);let ge=function(Se){return se(ye)/se(ye+q*Se)},Ie=function(Se){return H*((se(ye)*(he(Ne=ye+q*Se)/se(Ne))-he(ye))/te)/ee;var Ne},ke=(ie(!0)-ye)/q;if(Math.abs(ee)<2e-6||!isFinite(ke)){if(Math.abs(H-K)<1e-6)return this.easeTo(e,i);const Se=K<H?-1:1;ke=Math.abs(Math.log(K/H))/q,Ie=()=>0,ge=Ne=>Math.exp(Se*q*Ne)}return e.duration="duration"in e?+e.duration:1e3*ke/("screenSpeed"in e?+e.screenSpeed/q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==v,this._pitching=T!==h,this._rolling=C!==f,this._padding=!s.isPaddingEqual(A),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(W.targetCenter),this._ease(Se=>{const Ne=Se*ke,Be=1/ge(Ne),Ee=Ie(Ne);this._rotating&&s.setBearing(o.B.number(l,v,Se)),this._pitching&&s.setPitch(o.B.number(h,T,Se)),this._rolling&&s.setRoll(o.B.number(f,C,Se)),this._padding&&(s.interpolatePadding(y,A,Se),O=s.centerPoint.add(k)),W.easeFunc(Se,Be,Ee,O),this.terrain&&!e.freezeElevation&&this._updateElevation(Se),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=ae.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 io={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class et{constructor(e=io){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=G.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=G.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=G.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(){G.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=G.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class st{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=G.create("div","maplibregl-ctrl");const i=G.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(){G.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ll{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 Gc=o.aD([{name:"a_pos3d",type:"Int16",components:3}]);class qc extends o.E{constructor(e){super(),this._lastTilesetChange=ae.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 pe(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.bO(l.terrainRttPosMatrix32f,0,o.Z,o.Z,0,0,1),this._tiles[l.key]=new Yr(l,this.tileSize),this._lastTilesetChange=ae.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.bO(f,0,o.Z,o.Z,0,0,1);else if(l.canonical.isChildOf(e.canonical)){const y=l.canonical.z-e.canonical.z,v=l.canonical.x-(l.canonical.x>>y<<y),T=l.canonical.y-(l.canonical.y>>y<<y),C=o.Z>>y;o.bO(f,0,C,C,0,0,1),o.L(f,f,[-v*C,-T*C,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const y=e.canonical.z-l.canonical.z,v=e.canonical.x-(e.canonical.x>>y<<y),T=e.canonical.y-(e.canonical.y>>y<<y),C=o.Z>>y;o.bO(f,0,o.Z,o.Z,0,0,1),o.L(f,f,[v*C,T*C,0]),o.M(f,f,[1/2**y,1/2**y,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(),y=o.b2();if(h.canonical.z===e.canonical.z){const v=e.canonical.x-h.canonical.x,T=e.canonical.y-h.canonical.y;o.bO(y,0,o.Z,o.Z,0,0,1),o.L(y,y,[v*o.Z,T*o.Z,0])}else if(h.canonical.z>e.canonical.z){const v=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>v<<v),C=h.canonical.y-(h.canonical.y>>v<<v),A=e.canonical.x-(h.canonical.x>>v),k=e.canonical.y-(h.canonical.y>>v),O=o.Z>>v;o.bO(y,0,O,O,0,0,1),o.L(y,y,[-T*O+A*o.Z,-C*O+k*o.Z,0])}else{const v=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>v<<v),C=e.canonical.y-(e.canonical.y>>v<<v),A=(e.canonical.x>>v)-h.canonical.x,k=(e.canonical.y>>v)-h.canonical.y,O=o.Z<<v;o.bO(y,0,O,O,0,0,1),o.L(y,y,[T*o.Z+A*O,C*o.Z+k*O,0])}f.terrainRttPosMatrix32f=new Float32Array(y),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 fr{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new qc(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),y=(h=f.tile)===null||h===void 0?void 0:h.dem;if(!y)return 0;const v=o.cf([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[v[0]*y.dim,v[1]*y.dim],C=Math.floor(T[0]),A=Math.floor(T[1]),k=T[0]-C,O=T[1]-A;return y.get(C,A)*(1-k)*(1-O)+y.get(C+1,A)*k*(1-O)+y.get(C,A+1)*(1-k)*O+y.get(C+1,A+1)*k*O}getElevationForLngLatZoom(e,i){if(!o.cg(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 wt(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new wt(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.at([])}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 wt(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),y=e.canonical.y-(e.canonical.y>>h<<h),v=o.ch(new Float64Array(16),[1/(o.Z<<h),1/(o.Z<<h),0]);o.L(v,v,[f*o.Z,y*o.Z,0]),this._demMatrixCache[e.key]={matrix:v,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 wt(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 wt(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 y=0;y<this._coordsTextureSize;y++,f+=4)i[f+0]=255&y,i[f+1]=255&h,i[f+2]=y>>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 wt(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),y=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(h,y-f-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null);const v=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),C=this.coordsIndex[255-i[3]],A=C&&this.sourceCache.getTileByID(C);if(!A)return null;const k=this._coordsTextureSize,O=(1<<A.tileID.canonical.z)*k;return new o.$((A.tileID.canonical.x*k+v)/O+A.tileID.wrap,(A.tileID.canonical.y*k+T)/O,this.getElevation(A.tileID,v,T,k))}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 y=this.painter.context,v=new o.ci,T=new o.aH,C=this.meshSize,A=o.Z/C,k=C*C;for(let se=0;se<=C;se++)for(let ye=0;ye<=C;ye++)v.emplaceBack(ye*A,se*A,0);for(let se=0;se<k;se+=C+1)for(let ye=0;ye<C;ye++)T.emplaceBack(ye+se,C+ye+se+1,C+ye+se+2),T.emplaceBack(ye+se,C+ye+se+2,ye+se+1);const O=v.length,Z=O+(C+1),W=(C+1)*C,q=l?o.b9:0,H=l?0:1,K=h?o.ba:o.Z,ee=h?0:1;for(let se=0;se<=C;se++)v.emplaceBack(se*A,q,H);for(let se=0;se<=C;se++)v.emplaceBack(se*A,K,ee);for(let se=0;se<C;se++)T.emplaceBack(W+se,Z+se,Z+se+1),T.emplaceBack(W+se,Z+se+1,W+se+1),T.emplaceBack(0+se,O+se+1,O+se),T.emplaceBack(0+se,0+se+1,O+se+1);const te=v.length,ie=te+2*(C+1);for(const se of[0,1])for(let ye=0;ye<=C;ye++)for(const ge of[0,1])v.emplaceBack(se*o.Z,ye*A,ge);for(let se=0;se<2*C;se+=2)T.emplaceBack(te+se,te+se+1,te+se+3),T.emplaceBack(te+se,te+se+3,te+se+2),T.emplaceBack(ie+se,ie+se+3,ie+se+1),T.emplaceBack(ie+se,ie+se+2,ie+se+3);const he=new pa(y.createVertexBuffer(v,Gc.members),y.createIndexBuffer(T),o.aG.simpleSegment(0,0,v.length,T.length));return this._meshCache[f]=he,he}getMeshFrameDelta(e){return 2*Math.PI*o.br/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,y=Math.floor(h/o.Z),v=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,y,v),mercatorX:h,mercatorY:f}}}class Yh{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 wt(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 sr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class gp{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new Yh(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 Or?h.terrainTileRanges:null;for(const y of l){const v=this.terrain.sourceCache.getTerrainCoords(y,f);for(const T in v)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(v[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(sr[l.type]&&!this._coordsAscendingStr[h]){this._coordsAscendingStr[h]={};for(const f in this._coordsAscending[h])this._coordsAscendingStr[h][f]=this._coordsAscending[h][f].map(y=>y.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(sr[l]&&(this._prevType&&sr[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(sr[this._prevType]||sr[l]&&f){this._prevType=l;const y=this._stacks.length-1,v=this._stacks[y]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(nl(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[y]){const A=this.pool.getObjectForId(T.rtt[y].id);if(A.stamp===T.rtt[y].stamp){this.pool.useObject(A);continue}}const C=this.pool.getOrCreateFreeObject();this.pool.useObject(C),this.pool.stampObject(C),T.rtt[y]={id:C.id,stamp:C.stamp},h.context.bindFramebuffer.set(C.fbo.framebuffer),h.context.clear({color:o.b7.transparent,stencil:0}),h.currentStencilSource=void 0;for(let A=0;A<v.length;A++){const k=h.style._layers[v[A]],O=k.source?this._coordsAscending[k.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,C.fbo.width,C.fbo.height]),h._renderTileClippingMasks(k,O,!0),h.renderLayer(h,h.style.sourceCaches[k.source],k,O,s),k.source&&(T.rttCoords[k.source]=this._coordsAscendingStr[k.source][T.tileID.key])}}return nl(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),sr[l]}return!1}}const ro={"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"},gi=ue,Pi={hash:!1,interactive:!0,bearingSnap:7,attributionControl:io,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},Jh={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class no{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,G.mousePos(this.element,h)),G.addEventListener(window,"mousemove",this.mousemove),G.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,G.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=G.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),G.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),G.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=G.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 Gh;this._rotatePitchHanlder=new gs({clickTolerance:3,move:(h,f)=>{const y=i.getBoundingClientRect(),v=new o.P((y.bottom-y.top)/2,(y.right-y.left)/2);return{bearingDelta:o.ca(new o.P(h.x,f.y),f,v),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,G.addEventListener(i,"mousedown",this.mousedown),G.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),G.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),G.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;G.removeEventListener(e,"mousedown",this.mousedown),G.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),G.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),G.removeEventListener(window,"touchend",this.touchend),G.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){G.enableDrag(),G.removeEventListener(window,"mousemove",this.mousemove),G.removeEventListener(window,"mouseup",this.mouseup),G.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),G.removeEventListener(window,"touchend",this.touchend)}}let nn;function cl(u,e,i){const s=new o.Q(u.lng,u.lat);if(u=new o.Q(u.lng,u.lat),e){const l=new o.Q(u.lng-360,u.lat),h=new o.Q(u.lng+360,u.lat),f=i.locationToScreenPoint(u).distSqr(e);i.locationToScreenPoint(l).distSqr(e)<f?u=l:i.locationToScreenPoint(h).distSqr(e)<f&&(u=h)}for(;Math.abs(u.lng-i.center.lng)>180;){const l=i.locationToScreenPoint(u);if(l.x>=0&&l.y>=0&&l.x<=i.width&&l.y<=i.height)break;u.lng>i.center.lng?u.lng-=360:u.lng+=360}return u.lng!==s.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(u))?u:s}const ao={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 ul(u,e,i){const s=u.classList;for(const l in ao)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class Pa 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=>{var s;if(!this._map)return;const l=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!l)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?cl(this._lngLat,this._flatPos,this._map.transform):(s=this._lngLat)===null||s===void 0?void 0:s.wrap(),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 h="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?h=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(h=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let f="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?f="rotateX(0deg)":this._pitchAlignment==="map"&&(f=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),G.setTransform(this._element,`${ao[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${f} ${h}`),ae.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=G.create("div");const i=G.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=G.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=G.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const y=G.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const v=[{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 H of v){const K=G.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",H.rx),K.setAttributeNS(null,"ry",H.ry),y.appendChild(K)}const T=G.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const C=G.createNS("http://www.w3.org/2000/svg","path");C.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(C);const A=G.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"opacity","0.25"),A.setAttributeNS(null,"fill","#000000");const k=G.createNS("http://www.w3.org/2000/svg","path");k.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(k);const O=G.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(6.0, 7.0)"),O.setAttributeNS(null,"fill","#FFFFFF");const Z=G.createNS("http://www.w3.org/2000/svg","g");Z.setAttributeNS(null,"transform","translate(8.0, 8.0)");const W=G.createNS("http://www.w3.org/2000/svg","circle");W.setAttributeNS(null,"fill","#000000"),W.setAttributeNS(null,"opacity","0.25"),W.setAttributeNS(null,"cx","5.5"),W.setAttributeNS(null,"cy","5.5"),W.setAttributeNS(null,"r","5.4999962");const q=G.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"),Z.appendChild(W),Z.appendChild(q),f.appendChild(y),f.appendChild(T),f.appendChild(A),f.appendChild(O),f.appendChild(Z),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()}),ul(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.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),G.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;if(!(!((i=this._map)===null||i===void 0)&&i.terrain)){const A=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==A&&(this._element.style.opacity=A))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const l=this._map,h=l.terrain.depthAtPoint(this._pos),f=l.terrain.getElevationForLngLatZoom(this._lngLat,l.transform.tileZoom);if(l.transform.lngLatToCameraDepth(this._lngLat,f)-h<.006)return void(this._element.style.opacity=this._opacity);const y=-this._offset.y/l.transform.pixelsPerMeter,v=Math.sin(l.getPitch()*Math.PI/180)*y,T=l.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),C=l.transform.lngLatToCameraDepth(this._lngLat,f+v)-T>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&C&&this._popup.remove(),this._element.style.opacity=C?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 Wc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ys=0,Sa=!1;const Hc={maxWidth:100,unit:"metric"};function hl(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]),y=u.unproject([h+s/2,l]),v=Math.round(u.project(y).x-u.project(f).x),T=Math.min(s,v,u._container.clientWidth),C=f.distanceTo(y);if(i&&i.unit==="imperial"){const A=3.2808*C;A>5280?Ma(e,T,A/5280,u._getUIString("ScaleControl.Miles")):Ma(e,T,A,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?Ma(e,T,C/1852,u._getUIString("ScaleControl.NauticalMiles")):C>=1e3?Ma(e,T,C/1e3,u._getUIString("ScaleControl.Kilometers")):Ma(e,T,C,u._getUIString("ScaleControl.Meters"))}function Ma(u,e,i,s){const l=function(h){const f=Math.pow(10,`${Math.floor(h)}`.length-1);let y=h/f;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(v){const T=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*T)/T}(y),f*y}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l}&nbsp;${s}`}const Xc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Kc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function so(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 so(new o.P(0,0))}const Yc=ue;P.AJAXError=o.cm,P.Event=o.l,P.Evented=o.E,P.LngLat=o.Q,P.MercatorCoordinate=o.$,P.Point=o.P,P.addProtocol=o.cn,P.config=o.a,P.removeProtocol=o.co,P.AttributionControl=et,P.BoxZoomHandler=wa,P.CanvasSource=Za,P.CooperativeGesturesHandler=sl,P.DoubleClickZoomHandler=$c,P.DragPanHandler=vn,P.DragRotateHandler=ni,P.EdgeInsets=ci,P.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=G.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){G.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=G.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);G.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()}},P.GeoJSONSource=jn,P.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=wi.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(this.options.trackUserLocation)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&&Sa)return;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=G.create("button","maplibregl-ctrl-geolocate",this._container),G.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=G.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Pa({element:this._dotElement}),this._circleElement=G.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Pa({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({},Wc,u)}onAdd(u){return this._map=u,this._container=G.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(nn!==void 0&&!e)return nn;if(window.navigator.permissions===void 0)return nn=!!window.navigator.geolocation,nn;try{nn=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{nn=!!window.navigator.geolocation}return nn})}().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(),G.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ys=0,Sa=!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":ys--,Sa=!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"),ys++,ys>1?(u={maximumAge:6e5,timeout:0},Sa=!0):(u=this.options.positionOptions,Sa=!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)}},P.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=G.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=G.create("button","maplibregl-ctrl-globe",this._container),G.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(){G.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},P.Hash=Bc,P.ImageSource=Or,P.KeyboardHandler=Zc,P.LngLatBounds=wi,P.LogoControl=st,P.Map=class extends rn{constructor(u){var e,i;o.cj.mark(o.ck.create);const s=Object.assign(Object.assign(Object.assign({},Pi),u),{canvasContextAttributes:Object.assign(Object.assign({},Pi.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 ui,h=new dr;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 ll,this._controls=[],this._mapId=o.a4(),this._contextLost=y=>{y.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new o.l("webglcontextlost",{originalEvent:y}))},this._contextRestored=y=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.l("webglcontextrestored",{originalEvent:y}))},this._onMapScroll=y=>{if(y.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({},ro),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=pt.addThrottleControl(()=>this.isMoving()),this._requestManager=new Mt(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 y=!1;const v=Fc(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{y?v(T):y=!0}),this._resizeObserver.observe(this._container)}this.handlers=new mp(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 et(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new st,s.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const y=o.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(y)}}),this.on("data",y=>{this._update(y.dataType==="style"),this.fire(new o.l(`${y.dataType}data`,y))}),this.on("dataloading",y=>{this.fire(new o.l(`${y.dataType}dataloading`,y))}),this.on("dataabort",y=>{this.fire(new o.l("sourcedataabort",y))})}_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 y=this._getClampedPixelRatio(i,s);this._resizeCanvas(i,s,y),this.painter.resize(i,s,y)}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(wi.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(v=>this.getLayer(v)),y=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];y.length?s||(s=!0,i.call(this,new tr(u,this,h.originalEvent,{features:y}))):s=!1},mouseout:()=>{s=!1}}}}if(u==="mouseleave"||u==="mouseout"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:f=>{const y=e.filter(v=>this.getLayer(v));(y.length!==0?this.queryRenderedFeatures(f.point,{layers:y}):[]).length?s=!0:s&&(s=!1,i.call(this,new tr(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new tr(u,this,f.originalEvent)))}}}}{const s=l=>{const h=e.filter(y=>this.getLayer(y)),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]=(...y)=>{this._removeDelegatedListener(u,s,i),f(...y)}}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 is(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 is(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 fr(this.painter,e,u),this.painter.renderToTexture=new gp(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)}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:y,textFitWidth:v,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:C,height:A,data:k}=e,O=e;return this.style.addImage(u,{data:new o.R({width:C,height:A},new Uint8Array(k)),pixelRatio:s,stretchX:h,stretchY:f,content:y,textFitWidth:v,textFitHeight:T,sdf:l,version:0,userImage:O}),O.onAdd&&O.onAdd(this,u),this}}{const{width:C,height:A,data:k}=ae.getImageData(e);this.style.addImage(u,{data:new o.R({width:C,height:A},k),pixelRatio:s,stretchX:h,stretchY:f,content:y,textFitWidth:v,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)?ae.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 y=!(e instanceof HTMLImageElement||o.b(e));return i.data.replace(f,y),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 pt.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=G.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=G.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=G.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=G.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 Oh(i,this.transform),ve.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,y=((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 v=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const A=this.transform.zoom,k=ae.now();this.style.zoomHistory.update(A,k);const O=new o.C(A,{now:k,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),Z=O.crossFadingFactor();Z===1&&Z===this._crossFadingFactor||(v=!0,this._crossFadingFactor=Z),this.style.update(O)}const T=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==y;(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.cj.mark(o.ck.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||v)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const C=this._sourcesDirty||this._styleDirty||this._placementDirty;return C||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||C||(this._fullyLoaded=!0,o.cj.mark(o.ck.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),pt.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),G.remove(this._canvasContainer),G.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cj.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,ae.frame(this._frameRequest,u=>{o.cj.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cl(e)&&!function(i){return i.message===Rh}(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 gi}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},P.MapMouseEvent=tr,P.MapTouchEvent=ms,P.MapWheelEvent=zr,P.Marker=Pa,P.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({},Jh,u),this._container=G.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})),G.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})),G.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=G.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 no(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){G.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=G.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},P.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&&G.remove(this._content),this._container&&(G.remove(this._container),delete this._container),this._closeButton&&this._closeButton.removeEventListener("click",this._onClose),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=>{var i;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=G.create("div","maplibregl-popup",this._map.getContainer()),this._tip=G.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const y of this.options.className.split(" "))this._container.classList.add(y);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=this._map.transform.renderWorldCopies&&!this._trackPointer?cl(this._lngLat,this._flatPos,this._map.transform):(i=this._lngLat)===null||i===void 0?void 0:i.wrap(),this._trackPointer&&!e)return;const s=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 l=this.options.anchor;const h=so(this.options.offset);if(!l){const y=this._container.offsetWidth,v=this._container.offsetHeight;let T;T=s.y+h.bottom.y<v?["top"]:s.y>this._map.transform.height-v?["bottom"]:[],s.x<y/2?T.push("left"):s.x>this._map.transform.width-y/2&&T.push("right"),l=T.length===0?"bottom":T.join("-")}let f=s.add(h[l]);this.options.subpixelPositioning||(f=f.round()),G.setTransform(this._container,`${ao[l]} translate(${f.x}px,${f.y}px)`),ul(this._container,l,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(Xc),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=G.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=G.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(Kc);u&&u.focus()}},P.RasterDEMTileSource=On,P.RasterTileSource=Br,P.ScaleControl=class{constructor(u){this._onMove=()=>{hl(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,hl(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Hc),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=G.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){G.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},P.ScrollZoomHandler=Xh,P.Style=is,P.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=G.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=G.create("button","maplibregl-ctrl-terrain",this._container),G.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(){G.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},P.TwoFingersTouchPitchHandler=Hh,P.TwoFingersTouchRotateHandler=Wh,P.TwoFingersTouchZoomHandler=Ct,P.TwoFingersTouchZoomRotateHandler=eo,P.VectorTileSource=ua,P.VideoSource=jr,P.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(Rs(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{Va[i]=s})(u,e)}),P.clearPrewarmedResources=function(){const u=$t;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(qt),$t=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()"))},P.createTileMesh=Lo,P.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},P.getRTLTextPluginStatus=function(){return pn().getRTLTextPluginStatus()},P.getVersion=function(){return Yc},P.getWorkerCount=function(){return Ii.workerCount},P.getWorkerUrl=function(){return o.a.WORKER_URL},P.importScriptInWorkers=function(u){return Pt().broadcast("IS",u)},P.prewarm=function(){Qt().acquire(qt)},P.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},P.setRTLTextPlugin=function(u,e){return pn().setRTLTextPlugin(u,e)},P.setWorkerCount=function(u){Ii.workerCount=u},P.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var z=b;return z})}(Gu)),Gu.exports}var jy=Oy();const jd=Fy(jy);class Ny{constructor(m){ta(this,"marker");ta(this,"libreMarker");Mr(this,ic,vi());Mr(this,rc,vi());Mr(this,nc,vi());Mr(this,ac,vi(!1));Mr(this,sc,vi());Mr(this,oc,vi(!1));this.marker=m,this.libreMarker=void 0,this.content=void 0,this.element=void 0,this.component=void 0,this.componentRendered=!1,this.circle=void 0,this.circleRendered=!1}get element(){return We(Vt(this,ic))}set element(m){ti(Vt(this,ic),m,!0)}get content(){return We(Vt(this,rc))}set content(m){ti(Vt(this,rc),m,!0)}get component(){return We(Vt(this,nc))}set component(m){ti(Vt(this,nc),m,!0)}get componentRendered(){return We(Vt(this,ac))}set componentRendered(m){ti(Vt(this,ac),m,!0)}get circle(){return We(Vt(this,sc))}set circle(m){ti(Vt(this,sc),m,!0)}get circleRendered(){return We(Vt(this,oc))}set circleRendered(m){ti(Vt(this,oc),m,!0)}}ic=new WeakMap,rc=new WeakMap,nc=new WeakMap,ac=new WeakMap,sc=new WeakMap,oc=new WeakMap;class sm{constructor(m,b,M,E,z){ta(this,"bounds1");ta(this,"bounds2");ta(this,"getBounds",(m,b,M,E)=>new jd.LngLatBounds([m,b],[M,E]));ta(this,"contains",(m,b)=>this.bounds1.contains([b,m])||this.bounds2.contains([b,m]));const P=m.unproject([b,M]),o=m.unproject([E,z]);if(P.lng<-180){this.bounds1=this.getBounds(-180,P.lat,o.lng,o.lat),this.bounds2=this.getBounds(P.wrap().lng,P.lat,180,o.lat);return}if(o.lng>180){this.bounds1=this.getBounds(P.lng,P.lat,180,o.lat),this.bounds2=this.getBounds(-180,P.lat,o.wrap().lng,o.lat);return}this.bounds1=this.getBounds(P.lng,P.lat,o.lng,o.lat),this.bounds2=this.getBounds(0,0,0,0)}}const Zy={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}}]},Vy={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 Zt;(function(_){_.assertEqual=E=>E;function m(E){}_.assertIs=m;function b(E){throw new Error}_.assertNever=b,_.arrayToEnum=E=>{const z={};for(const P of E)z[P]=P;return z},_.getValidEnumValues=E=>{const z=_.objectKeys(E).filter(o=>typeof E[E[o]]!="number"),P={};for(const o of z)P[o]=E[o];return _.objectValues(P)},_.objectValues=E=>_.objectKeys(E).map(function(z){return E[z]}),_.objectKeys=typeof Object.keys=="function"?E=>Object.keys(E):E=>{const z=[];for(const P in E)Object.prototype.hasOwnProperty.call(E,P)&&z.push(P);return z},_.find=(E,z)=>{for(const P of E)if(z(P))return P},_.isInteger=typeof Number.isInteger=="function"?E=>Number.isInteger(E):E=>typeof E=="number"&&isFinite(E)&&Math.floor(E)===E;function M(E,z=" | "){return E.map(P=>typeof P=="string"?`'${P}'`:P).join(z)}_.joinValues=M,_.jsonStringifyReplacer=(E,z)=>typeof z=="bigint"?z.toString():z})(Zt||(Zt={}));var Nd;(function(_){_.mergeShapes=(m,b)=>({...m,...b})})(Nd||(Nd={}));const Je=Zt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),aa=_=>{switch(typeof _){case"undefined":return Je.undefined;case"string":return Je.string;case"number":return isNaN(_)?Je.nan:Je.number;case"boolean":return Je.boolean;case"function":return Je.function;case"bigint":return Je.bigint;case"symbol":return Je.symbol;case"object":return Array.isArray(_)?Je.array:_===null?Je.null:_.then&&typeof _.then=="function"&&_.catch&&typeof _.catch=="function"?Je.promise:typeof Map<"u"&&_ instanceof Map?Je.map:typeof Set<"u"&&_ instanceof Set?Je.set:typeof Date<"u"&&_ instanceof Date?Je.date:Je.object;default:return Je.unknown}},je=Zt.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"]),Uy=_=>JSON.stringify(_,null,2).replace(/"([^"]+)":/g,"$1:");class Lr extends Error{get errors(){return this.issues}constructor(m){super(),this.issues=[],this.addIssue=M=>{this.issues=[...this.issues,M]},this.addIssues=(M=[])=>{this.issues=[...this.issues,...M]};const b=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,b):this.__proto__=b,this.name="ZodError",this.issues=m}format(m){const b=m||function(z){return z.message},M={_errors:[]},E=z=>{for(const P of z.issues)if(P.code==="invalid_union")P.unionErrors.map(E);else if(P.code==="invalid_return_type")E(P.returnTypeError);else if(P.code==="invalid_arguments")E(P.argumentsError);else if(P.path.length===0)M._errors.push(b(P));else{let o=M,ue=0;for(;ue<P.path.length;){const re=P.path[ue];ue===P.path.length-1?(o[re]=o[re]||{_errors:[]},o[re]._errors.push(b(P))):o[re]=o[re]||{_errors:[]},o=o[re],ue++}}};return E(this),M}static assert(m){if(!(m instanceof Lr))throw new Error(`Not a ZodError: ${m}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Zt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(m=b=>b.message){const b={},M=[];for(const E of this.issues)E.path.length>0?(b[E.path[0]]=b[E.path[0]]||[],b[E.path[0]].push(m(E))):M.push(m(E));return{formErrors:M,fieldErrors:b}}get formErrors(){return this.flatten()}}Lr.create=_=>new Lr(_);const To=(_,m)=>{let b;switch(_.code){case je.invalid_type:_.received===Je.undefined?b="Required":b=`Expected ${_.expected}, received ${_.received}`;break;case je.invalid_literal:b=`Invalid literal value, expected ${JSON.stringify(_.expected,Zt.jsonStringifyReplacer)}`;break;case je.unrecognized_keys:b=`Unrecognized key(s) in object: ${Zt.joinValues(_.keys,", ")}`;break;case je.invalid_union:b="Invalid input";break;case je.invalid_union_discriminator:b=`Invalid discriminator value. Expected ${Zt.joinValues(_.options)}`;break;case je.invalid_enum_value:b=`Invalid enum value. Expected ${Zt.joinValues(_.options)}, received '${_.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 _.validation=="object"?"includes"in _.validation?(b=`Invalid input: must include "${_.validation.includes}"`,typeof _.validation.position=="number"&&(b=`${b} at one or more positions greater than or equal to ${_.validation.position}`)):"startsWith"in _.validation?b=`Invalid input: must start with "${_.validation.startsWith}"`:"endsWith"in _.validation?b=`Invalid input: must end with "${_.validation.endsWith}"`:Zt.assertNever(_.validation):_.validation!=="regex"?b=`Invalid ${_.validation}`:b="Invalid";break;case je.too_small:_.type==="array"?b=`Array must contain ${_.exact?"exactly":_.inclusive?"at least":"more than"} ${_.minimum} element(s)`:_.type==="string"?b=`String must contain ${_.exact?"exactly":_.inclusive?"at least":"over"} ${_.minimum} character(s)`:_.type==="number"?b=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`:_.type==="date"?b=`Date must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(_.minimum))}`:b="Invalid input";break;case je.too_big:_.type==="array"?b=`Array must contain ${_.exact?"exactly":_.inclusive?"at most":"less than"} ${_.maximum} element(s)`:_.type==="string"?b=`String must contain ${_.exact?"exactly":_.inclusive?"at most":"under"} ${_.maximum} character(s)`:_.type==="number"?b=`Number must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`:_.type==="bigint"?b=`BigInt must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`:_.type==="date"?b=`Date must be ${_.exact?"exactly":_.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(_.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 ${_.multipleOf}`;break;case je.not_finite:b="Number must be finite";break;default:b=m.defaultError,Zt.assertNever(_)}return{message:b}};let om=To;function $y(_){om=_}function qu(){return om}const Wu=_=>{const{data:m,path:b,errorMaps:M,issueData:E}=_,z=[...b,...E.path||[]],P={...E,path:z};if(E.message!==void 0)return{...E,path:z,message:E.message};let o="";const ue=M.filter(re=>!!re).slice().reverse();for(const re of ue)o=re(P,{data:m,defaultError:o}).message;return{...E,path:z,message:o}},Gy=[];function qe(_,m){const b=qu(),M=Wu({issueData:m,data:_.data,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,b,b===To?void 0:To].filter(E=>!!E)});_.common.issues.push(M)}class lr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(m,b){const M=[];for(const E of b){if(E.status==="aborted")return yt;E.status==="dirty"&&m.dirty(),M.push(E.value)}return{status:m.value,value:M}}static async mergeObjectAsync(m,b){const M=[];for(const E of b){const z=await E.key,P=await E.value;M.push({key:z,value:P})}return lr.mergeObjectSync(m,M)}static mergeObjectSync(m,b){const M={};for(const E of b){const{key:z,value:P}=E;if(z.status==="aborted"||P.status==="aborted")return yt;z.status==="dirty"&&m.dirty(),P.status==="dirty"&&m.dirty(),z.value!=="__proto__"&&(typeof P.value<"u"||E.alwaysSet)&&(M[z.value]=P.value)}return{status:m.value,value:M}}}const yt=Object.freeze({status:"aborted"}),Po=_=>({status:"dirty",value:_}),xr=_=>({status:"valid",value:_}),Zd=_=>_.status==="aborted",Vd=_=>_.status==="dirty",Cs=_=>_.status==="valid",Ol=_=>typeof Promise<"u"&&_ instanceof Promise;function Hu(_,m,b,M){if(typeof m=="function"?_!==m||!0:!m.has(_))throw new TypeError("Cannot read private member from an object whose class did not declare it");return m.get(_)}function lm(_,m,b,M,E){if(typeof m=="function"?_!==m||!0:!m.has(_))throw new TypeError("Cannot write private member to an object whose class did not declare it");return m.set(_,b),b}typeof SuppressedError=="function"&&SuppressedError;var at;(function(_){_.errToObj=m=>typeof m=="string"?{message:m}:m||{},_.toString=m=>typeof m=="string"?m:m==null?void 0:m.message})(at||(at={}));var jl,Nl;class Ln{constructor(m,b,M,E){this._cachedPath=[],this.parent=m,this.data=b,this._path=M,this._key=E}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 cm=(_,m)=>{if(Cs(m))return{success:!0,data:m.value};if(!_.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 Lr(_.common.issues);return this._error=b,this._error}}};function St(_){if(!_)return{};const{errorMap:m,invalid_type_error:b,required_error:M,description:E}=_;if(m&&(b||M))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return m?{errorMap:m,description:E}:{errorMap:(P,o)=>{var ue,re;const{message:ne}=_;return P.code==="invalid_enum_value"?{message:ne??o.defaultError}:typeof o.data>"u"?{message:(ue=ne??M)!==null&&ue!==void 0?ue:o.defaultError}:P.code!=="invalid_type"?{message:o.defaultError}:{message:(re=ne??b)!==null&&re!==void 0?re:o.defaultError}},description:E}}class zt{get description(){return this._def.description}_getType(m){return aa(m.data)}_getOrReturnCtx(m,b){return b||{common:m.parent.common,data:m.data,parsedType:aa(m.data),schemaErrorMap:this._def.errorMap,path:m.path,parent:m.parent}}_processInputParams(m){return{status:new lr,ctx:{common:m.parent.common,data:m.data,parsedType:aa(m.data),schemaErrorMap:this._def.errorMap,path:m.path,parent:m.parent}}}_parseSync(m){const b=this._parse(m);if(Ol(b))throw new Error("Synchronous parse encountered promise.");return b}_parseAsync(m){const b=this._parse(m);return Promise.resolve(b)}parse(m,b){const M=this.safeParse(m,b);if(M.success)return M.data;throw M.error}safeParse(m,b){var M;const E={common:{issues:[],async:(M=b==null?void 0:b.async)!==null&&M!==void 0?M:!1,contextualErrorMap:b==null?void 0:b.errorMap},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:aa(m)},z=this._parseSync({data:m,path:E.path,parent:E});return cm(E,z)}"~validate"(m){var b,M;const E={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:aa(m)};if(!this["~standard"].async)try{const z=this._parseSync({data:m,path:[],parent:E});return Cs(z)?{value:z.value}:{issues:E.common.issues}}catch(z){!((M=(b=z==null?void 0:z.message)===null||b===void 0?void 0:b.toLowerCase())===null||M===void 0)&&M.includes("encountered")&&(this["~standard"].async=!0),E.common={issues:[],async:!0}}return this._parseAsync({data:m,path:[],parent:E}).then(z=>Cs(z)?{value:z.value}:{issues:E.common.issues})}async parseAsync(m,b){const M=await this.safeParseAsync(m,b);if(M.success)return M.data;throw M.error}async safeParseAsync(m,b){const M={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:m,parsedType:aa(m)},E=this._parse({data:m,path:M.path,parent:M}),z=await(Ol(E)?E:Promise.resolve(E));return cm(M,z)}refine(m,b){const M=E=>typeof b=="string"||typeof b>"u"?{message:b}:typeof b=="function"?b(E):b;return this._refinement((E,z)=>{const P=m(E),o=()=>z.addIssue({code:je.custom,...M(E)});return typeof Promise<"u"&&P instanceof Promise?P.then(ue=>ue?!0:(o(),!1)):P?!0:(o(),!1)})}refinement(m,b){return this._refinement((M,E)=>m(M)?!0:(E.addIssue(typeof b=="function"?b(M,E):b),!1))}_refinement(m){return new un({schema:this,typeName:mt.ZodEffects,effect:{type:"refinement",refinement:m}})}superRefine(m){return this._refinement(m)}constructor(m){this.spa=this.safeParseAsync,this._def=m,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 Bn.create(this,this._def)}nullable(){return ja.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return cn.create(this)}promise(){return Co.create(this,this._def)}or(m){return $l.create([this,m],this._def)}and(m){return Gl.create(this,m,this._def)}transform(m){return new un({...St(this._def),schema:this,typeName:mt.ZodEffects,effect:{type:"transform",transform:m}})}default(m){const b=typeof m=="function"?m:()=>m;return new Kl({...St(this._def),innerType:this,defaultValue:b,typeName:mt.ZodDefault})}brand(){return new Gd({typeName:mt.ZodBranded,type:this,...St(this._def)})}catch(m){const b=typeof m=="function"?m:()=>m;return new Yl({...St(this._def),innerType:this,catchValue:b,typeName:mt.ZodCatch})}describe(m){const b=this.constructor;return new b({...this._def,description:m})}pipe(m){return Jl.create(this,m)}readonly(){return Ql.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const qy=/^c[^\s-]{8,}$/i,Wy=/^[0-9a-z]+$/,Hy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Xy=/^[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,Ky=/^[a-z0-9_-]{21}$/i,Yy=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Jy=/^[-+]?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)?)??$/,Qy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ud;const tx=/^(?:(?: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])$/,ix=/^(?:(?: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])$/,rx=/^(([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]))$/,nx=/^(([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])$/,ax=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sx=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,um="((\\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])))",ox=new RegExp(`^${um}$`);function hm(_){let m="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return _.precision?m=`${m}\\.\\d{${_.precision}}`:_.precision==null&&(m=`${m}(\\.\\d+)?`),m}function lx(_){return new RegExp(`^${hm(_)}$`)}function dm(_){let m=`${um}T${hm(_)}`;const b=[];return b.push(_.local?"Z?":"Z"),_.offset&&b.push("([+-]\\d{2}:?\\d{2})"),m=`${m}(${b.join("|")})`,new RegExp(`^${m}$`)}function cx(_,m){return!!((m==="v4"||!m)&&tx.test(_)||(m==="v6"||!m)&&rx.test(_))}function ux(_,m){if(!Yy.test(_))return!1;try{const[b]=_.split("."),M=b.replace(/-/g,"+").replace(/_/g,"/").padEnd(b.length+(4-b.length%4)%4,"="),E=JSON.parse(atob(M));return!(typeof E!="object"||E===null||!E.typ||!E.alg||m&&E.alg!==m)}catch{return!1}}function hx(_,m){return!!((m==="v4"||!m)&&ix.test(_)||(m==="v6"||!m)&&nx.test(_))}class ln extends zt{_parse(m){if(this._def.coerce&&(m.data=String(m.data)),this._getType(m)!==Je.string){const z=this._getOrReturnCtx(m);return qe(z,{code:je.invalid_type,expected:Je.string,received:z.parsedType}),yt}const M=new lr;let E;for(const z of this._def.checks)if(z.kind==="min")m.data.length<z.value&&(E=this._getOrReturnCtx(m,E),qe(E,{code:je.too_small,minimum:z.value,type:"string",inclusive:!0,exact:!1,message:z.message}),M.dirty());else if(z.kind==="max")m.data.length>z.value&&(E=this._getOrReturnCtx(m,E),qe(E,{code:je.too_big,maximum:z.value,type:"string",inclusive:!0,exact:!1,message:z.message}),M.dirty());else if(z.kind==="length"){const P=m.data.length>z.value,o=m.data.length<z.value;(P||o)&&(E=this._getOrReturnCtx(m,E),P?qe(E,{code:je.too_big,maximum:z.value,type:"string",inclusive:!0,exact:!0,message:z.message}):o&&qe(E,{code:je.too_small,minimum:z.value,type:"string",inclusive:!0,exact:!0,message:z.message}),M.dirty())}else if(z.kind==="email")Qy.test(m.data)||(E=this._getOrReturnCtx(m,E),qe(E,{validation:"email",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="emoji")Ud||(Ud=new RegExp(ex,"u")),Ud.test(m.data)||(E=this._getOrReturnCtx(m,E),qe(E,{validation:"emoji",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="uuid")Xy.test(m.data)||(E=this._getOrReturnCtx(m,E),qe(E,{validation:"uuid",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="nanoid")Ky.test(m.data)||(E=this._getOrReturnCtx(m,E),qe(E,{validation:"nanoid",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="cuid")qy.test(m.data)||(E=this._getOrReturnCtx(m,E),qe(E,{validation:"cuid",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="cuid2")Wy.test(m.data)||(E=this._getOrReturnCtx(m,E),qe(E,{validation:"cuid2",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="ulid")Hy.test(m.data)||(E=this._getOrReturnCtx(m,E),qe(E,{validation:"ulid",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="url")try{new URL(m.data)}catch{E=this._getOrReturnCtx(m,E),qe(E,{validation:"url",code:je.invalid_string,message:z.message}),M.dirty()}else z.kind==="regex"?(z.regex.lastIndex=0,z.regex.test(m.data)||(E=this._getOrReturnCtx(m,E),qe(E,{validation:"regex",code:je.invalid_string,message:z.message}),M.dirty())):z.kind==="trim"?m.data=m.data.trim():z.kind==="includes"?m.data.includes(z.value,z.position)||(E=this._getOrReturnCtx(m,E),qe(E,{code:je.invalid_string,validation:{includes:z.value,position:z.position},message:z.message}),M.dirty()):z.kind==="toLowerCase"?m.data=m.data.toLowerCase():z.kind==="toUpperCase"?m.data=m.data.toUpperCase():z.kind==="startsWith"?m.data.startsWith(z.value)||(E=this._getOrReturnCtx(m,E),qe(E,{code:je.invalid_string,validation:{startsWith:z.value},message:z.message}),M.dirty()):z.kind==="endsWith"?m.data.endsWith(z.value)||(E=this._getOrReturnCtx(m,E),qe(E,{code:je.invalid_string,validation:{endsWith:z.value},message:z.message}),M.dirty()):z.kind==="datetime"?dm(z).test(m.data)||(E=this._getOrReturnCtx(m,E),qe(E,{code:je.invalid_string,validation:"datetime",message:z.message}),M.dirty()):z.kind==="date"?ox.test(m.data)||(E=this._getOrReturnCtx(m,E),qe(E,{code:je.invalid_string,validation:"date",message:z.message}),M.dirty()):z.kind==="time"?lx(z).test(m.data)||(E=this._getOrReturnCtx(m,E),qe(E,{code:je.invalid_string,validation:"time",message:z.message}),M.dirty()):z.kind==="duration"?Jy.test(m.data)||(E=this._getOrReturnCtx(m,E),qe(E,{validation:"duration",code:je.invalid_string,message:z.message}),M.dirty()):z.kind==="ip"?cx(m.data,z.version)||(E=this._getOrReturnCtx(m,E),qe(E,{validation:"ip",code:je.invalid_string,message:z.message}),M.dirty()):z.kind==="jwt"?ux(m.data,z.alg)||(E=this._getOrReturnCtx(m,E),qe(E,{validation:"jwt",code:je.invalid_string,message:z.message}),M.dirty()):z.kind==="cidr"?hx(m.data,z.version)||(E=this._getOrReturnCtx(m,E),qe(E,{validation:"cidr",code:je.invalid_string,message:z.message}),M.dirty()):z.kind==="base64"?ax.test(m.data)||(E=this._getOrReturnCtx(m,E),qe(E,{validation:"base64",code:je.invalid_string,message:z.message}),M.dirty()):z.kind==="base64url"?sx.test(m.data)||(E=this._getOrReturnCtx(m,E),qe(E,{validation:"base64url",code:je.invalid_string,message:z.message}),M.dirty()):Zt.assertNever(z);return{status:M.value,value:m.data}}_regex(m,b,M){return this.refinement(E=>m.test(E),{validation:b,code:je.invalid_string,...at.errToObj(M)})}_addCheck(m){return new ln({...this._def,checks:[...this._def.checks,m]})}email(m){return this._addCheck({kind:"email",...at.errToObj(m)})}url(m){return this._addCheck({kind:"url",...at.errToObj(m)})}emoji(m){return this._addCheck({kind:"emoji",...at.errToObj(m)})}uuid(m){return this._addCheck({kind:"uuid",...at.errToObj(m)})}nanoid(m){return this._addCheck({kind:"nanoid",...at.errToObj(m)})}cuid(m){return this._addCheck({kind:"cuid",...at.errToObj(m)})}cuid2(m){return this._addCheck({kind:"cuid2",...at.errToObj(m)})}ulid(m){return this._addCheck({kind:"ulid",...at.errToObj(m)})}base64(m){return this._addCheck({kind:"base64",...at.errToObj(m)})}base64url(m){return this._addCheck({kind:"base64url",...at.errToObj(m)})}jwt(m){return this._addCheck({kind:"jwt",...at.errToObj(m)})}ip(m){return this._addCheck({kind:"ip",...at.errToObj(m)})}cidr(m){return this._addCheck({kind:"cidr",...at.errToObj(m)})}datetime(m){var b,M;return typeof m=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:m}):this._addCheck({kind:"datetime",precision:typeof(m==null?void 0:m.precision)>"u"?null:m==null?void 0:m.precision,offset:(b=m==null?void 0:m.offset)!==null&&b!==void 0?b:!1,local:(M=m==null?void 0:m.local)!==null&&M!==void 0?M:!1,...at.errToObj(m==null?void 0:m.message)})}date(m){return this._addCheck({kind:"date",message:m})}time(m){return typeof m=="string"?this._addCheck({kind:"time",precision:null,message:m}):this._addCheck({kind:"time",precision:typeof(m==null?void 0:m.precision)>"u"?null:m==null?void 0:m.precision,...at.errToObj(m==null?void 0:m.message)})}duration(m){return this._addCheck({kind:"duration",...at.errToObj(m)})}regex(m,b){return this._addCheck({kind:"regex",regex:m,...at.errToObj(b)})}includes(m,b){return this._addCheck({kind:"includes",value:m,position:b==null?void 0:b.position,...at.errToObj(b==null?void 0:b.message)})}startsWith(m,b){return this._addCheck({kind:"startsWith",value:m,...at.errToObj(b)})}endsWith(m,b){return this._addCheck({kind:"endsWith",value:m,...at.errToObj(b)})}min(m,b){return this._addCheck({kind:"min",value:m,...at.errToObj(b)})}max(m,b){return this._addCheck({kind:"max",value:m,...at.errToObj(b)})}length(m,b){return this._addCheck({kind:"length",value:m,...at.errToObj(b)})}nonempty(m){return this.min(1,at.errToObj(m))}trim(){return new ln({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ln({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ln({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(m=>m.kind==="datetime")}get isDate(){return!!this._def.checks.find(m=>m.kind==="date")}get isTime(){return!!this._def.checks.find(m=>m.kind==="time")}get isDuration(){return!!this._def.checks.find(m=>m.kind==="duration")}get isEmail(){return!!this._def.checks.find(m=>m.kind==="email")}get isURL(){return!!this._def.checks.find(m=>m.kind==="url")}get isEmoji(){return!!this._def.checks.find(m=>m.kind==="emoji")}get isUUID(){return!!this._def.checks.find(m=>m.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(m=>m.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(m=>m.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(m=>m.kind==="cuid2")}get isULID(){return!!this._def.checks.find(m=>m.kind==="ulid")}get isIP(){return!!this._def.checks.find(m=>m.kind==="ip")}get isCIDR(){return!!this._def.checks.find(m=>m.kind==="cidr")}get isBase64(){return!!this._def.checks.find(m=>m.kind==="base64")}get isBase64url(){return!!this._def.checks.find(m=>m.kind==="base64url")}get minLength(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m}get maxLength(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m}}ln.create=_=>{var m;return new ln({checks:[],typeName:mt.ZodString,coerce:(m=_==null?void 0:_.coerce)!==null&&m!==void 0?m:!1,...St(_)})};function dx(_,m){const b=(_.toString().split(".")[1]||"").length,M=(m.toString().split(".")[1]||"").length,E=b>M?b:M,z=parseInt(_.toFixed(E).replace(".","")),P=parseInt(m.toFixed(E).replace(".",""));return z%P/Math.pow(10,E)}class Fa extends zt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(m){if(this._def.coerce&&(m.data=Number(m.data)),this._getType(m)!==Je.number){const z=this._getOrReturnCtx(m);return qe(z,{code:je.invalid_type,expected:Je.number,received:z.parsedType}),yt}let M;const E=new lr;for(const z of this._def.checks)z.kind==="int"?Zt.isInteger(m.data)||(M=this._getOrReturnCtx(m,M),qe(M,{code:je.invalid_type,expected:"integer",received:"float",message:z.message}),E.dirty()):z.kind==="min"?(z.inclusive?m.data<z.value:m.data<=z.value)&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.too_small,minimum:z.value,type:"number",inclusive:z.inclusive,exact:!1,message:z.message}),E.dirty()):z.kind==="max"?(z.inclusive?m.data>z.value:m.data>=z.value)&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.too_big,maximum:z.value,type:"number",inclusive:z.inclusive,exact:!1,message:z.message}),E.dirty()):z.kind==="multipleOf"?dx(m.data,z.value)!==0&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.not_multiple_of,multipleOf:z.value,message:z.message}),E.dirty()):z.kind==="finite"?Number.isFinite(m.data)||(M=this._getOrReturnCtx(m,M),qe(M,{code:je.not_finite,message:z.message}),E.dirty()):Zt.assertNever(z);return{status:E.value,value:m.data}}gte(m,b){return this.setLimit("min",m,!0,at.toString(b))}gt(m,b){return this.setLimit("min",m,!1,at.toString(b))}lte(m,b){return this.setLimit("max",m,!0,at.toString(b))}lt(m,b){return this.setLimit("max",m,!1,at.toString(b))}setLimit(m,b,M,E){return new Fa({...this._def,checks:[...this._def.checks,{kind:m,value:b,inclusive:M,message:at.toString(E)}]})}_addCheck(m){return new Fa({...this._def,checks:[...this._def.checks,m]})}int(m){return this._addCheck({kind:"int",message:at.toString(m)})}positive(m){return this._addCheck({kind:"min",value:0,inclusive:!1,message:at.toString(m)})}negative(m){return this._addCheck({kind:"max",value:0,inclusive:!1,message:at.toString(m)})}nonpositive(m){return this._addCheck({kind:"max",value:0,inclusive:!0,message:at.toString(m)})}nonnegative(m){return this._addCheck({kind:"min",value:0,inclusive:!0,message:at.toString(m)})}multipleOf(m,b){return this._addCheck({kind:"multipleOf",value:m,message:at.toString(b)})}finite(m){return this._addCheck({kind:"finite",message:at.toString(m)})}safe(m){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:at.toString(m)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:at.toString(m)})}get minValue(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m}get maxValue(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m}get isInt(){return!!this._def.checks.find(m=>m.kind==="int"||m.kind==="multipleOf"&&Zt.isInteger(m.value))}get isFinite(){let m=null,b=null;for(const M of this._def.checks){if(M.kind==="finite"||M.kind==="int"||M.kind==="multipleOf")return!0;M.kind==="min"?(b===null||M.value>b)&&(b=M.value):M.kind==="max"&&(m===null||M.value<m)&&(m=M.value)}return Number.isFinite(b)&&Number.isFinite(m)}}Fa.create=_=>new Fa({checks:[],typeName:mt.ZodNumber,coerce:(_==null?void 0:_.coerce)||!1,...St(_)});class Ba extends zt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(m){if(this._def.coerce)try{m.data=BigInt(m.data)}catch{return this._getInvalidInput(m)}if(this._getType(m)!==Je.bigint)return this._getInvalidInput(m);let M;const E=new lr;for(const z of this._def.checks)z.kind==="min"?(z.inclusive?m.data<z.value:m.data<=z.value)&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.too_small,type:"bigint",minimum:z.value,inclusive:z.inclusive,message:z.message}),E.dirty()):z.kind==="max"?(z.inclusive?m.data>z.value:m.data>=z.value)&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.too_big,type:"bigint",maximum:z.value,inclusive:z.inclusive,message:z.message}),E.dirty()):z.kind==="multipleOf"?m.data%z.value!==BigInt(0)&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.not_multiple_of,multipleOf:z.value,message:z.message}),E.dirty()):Zt.assertNever(z);return{status:E.value,value:m.data}}_getInvalidInput(m){const b=this._getOrReturnCtx(m);return qe(b,{code:je.invalid_type,expected:Je.bigint,received:b.parsedType}),yt}gte(m,b){return this.setLimit("min",m,!0,at.toString(b))}gt(m,b){return this.setLimit("min",m,!1,at.toString(b))}lte(m,b){return this.setLimit("max",m,!0,at.toString(b))}lt(m,b){return this.setLimit("max",m,!1,at.toString(b))}setLimit(m,b,M,E){return new Ba({...this._def,checks:[...this._def.checks,{kind:m,value:b,inclusive:M,message:at.toString(E)}]})}_addCheck(m){return new Ba({...this._def,checks:[...this._def.checks,m]})}positive(m){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:at.toString(m)})}negative(m){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:at.toString(m)})}nonpositive(m){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:at.toString(m)})}nonnegative(m){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:at.toString(m)})}multipleOf(m,b){return this._addCheck({kind:"multipleOf",value:m,message:at.toString(b)})}get minValue(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m}get maxValue(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m}}Ba.create=_=>{var m;return new Ba({checks:[],typeName:mt.ZodBigInt,coerce:(m=_==null?void 0:_.coerce)!==null&&m!==void 0?m:!1,...St(_)})};class Zl extends zt{_parse(m){if(this._def.coerce&&(m.data=!!m.data),this._getType(m)!==Je.boolean){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.boolean,received:M.parsedType}),yt}return xr(m.data)}}Zl.create=_=>new Zl({typeName:mt.ZodBoolean,coerce:(_==null?void 0:_.coerce)||!1,...St(_)});class ks extends zt{_parse(m){if(this._def.coerce&&(m.data=new Date(m.data)),this._getType(m)!==Je.date){const z=this._getOrReturnCtx(m);return qe(z,{code:je.invalid_type,expected:Je.date,received:z.parsedType}),yt}if(isNaN(m.data.getTime())){const z=this._getOrReturnCtx(m);return qe(z,{code:je.invalid_date}),yt}const M=new lr;let E;for(const z of this._def.checks)z.kind==="min"?m.data.getTime()<z.value&&(E=this._getOrReturnCtx(m,E),qe(E,{code:je.too_small,message:z.message,inclusive:!0,exact:!1,minimum:z.value,type:"date"}),M.dirty()):z.kind==="max"?m.data.getTime()>z.value&&(E=this._getOrReturnCtx(m,E),qe(E,{code:je.too_big,message:z.message,inclusive:!0,exact:!1,maximum:z.value,type:"date"}),M.dirty()):Zt.assertNever(z);return{status:M.value,value:new Date(m.data.getTime())}}_addCheck(m){return new ks({...this._def,checks:[...this._def.checks,m]})}min(m,b){return this._addCheck({kind:"min",value:m.getTime(),message:at.toString(b)})}max(m,b){return this._addCheck({kind:"max",value:m.getTime(),message:at.toString(b)})}get minDate(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m!=null?new Date(m):null}get maxDate(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m!=null?new Date(m):null}}ks.create=_=>new ks({checks:[],coerce:(_==null?void 0:_.coerce)||!1,typeName:mt.ZodDate,...St(_)});class Xu extends zt{_parse(m){if(this._getType(m)!==Je.symbol){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.symbol,received:M.parsedType}),yt}return xr(m.data)}}Xu.create=_=>new Xu({typeName:mt.ZodSymbol,...St(_)});class Vl extends zt{_parse(m){if(this._getType(m)!==Je.undefined){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.undefined,received:M.parsedType}),yt}return xr(m.data)}}Vl.create=_=>new Vl({typeName:mt.ZodUndefined,...St(_)});class Ul extends zt{_parse(m){if(this._getType(m)!==Je.null){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.null,received:M.parsedType}),yt}return xr(m.data)}}Ul.create=_=>new Ul({typeName:mt.ZodNull,...St(_)});class So extends zt{constructor(){super(...arguments),this._any=!0}_parse(m){return xr(m.data)}}So.create=_=>new So({typeName:mt.ZodAny,...St(_)});class Es extends zt{constructor(){super(...arguments),this._unknown=!0}_parse(m){return xr(m.data)}}Es.create=_=>new Es({typeName:mt.ZodUnknown,...St(_)});class sa extends zt{_parse(m){const b=this._getOrReturnCtx(m);return qe(b,{code:je.invalid_type,expected:Je.never,received:b.parsedType}),yt}}sa.create=_=>new sa({typeName:mt.ZodNever,...St(_)});class Ku extends zt{_parse(m){if(this._getType(m)!==Je.undefined){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.void,received:M.parsedType}),yt}return xr(m.data)}}Ku.create=_=>new Ku({typeName:mt.ZodVoid,...St(_)});class cn extends zt{_parse(m){const{ctx:b,status:M}=this._processInputParams(m),E=this._def;if(b.parsedType!==Je.array)return qe(b,{code:je.invalid_type,expected:Je.array,received:b.parsedType}),yt;if(E.exactLength!==null){const P=b.data.length>E.exactLength.value,o=b.data.length<E.exactLength.value;(P||o)&&(qe(b,{code:P?je.too_big:je.too_small,minimum:o?E.exactLength.value:void 0,maximum:P?E.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:E.exactLength.message}),M.dirty())}if(E.minLength!==null&&b.data.length<E.minLength.value&&(qe(b,{code:je.too_small,minimum:E.minLength.value,type:"array",inclusive:!0,exact:!1,message:E.minLength.message}),M.dirty()),E.maxLength!==null&&b.data.length>E.maxLength.value&&(qe(b,{code:je.too_big,maximum:E.maxLength.value,type:"array",inclusive:!0,exact:!1,message:E.maxLength.message}),M.dirty()),b.common.async)return Promise.all([...b.data].map((P,o)=>E.type._parseAsync(new Ln(b,P,b.path,o)))).then(P=>lr.mergeArray(M,P));const z=[...b.data].map((P,o)=>E.type._parseSync(new Ln(b,P,b.path,o)));return lr.mergeArray(M,z)}get element(){return this._def.type}min(m,b){return new cn({...this._def,minLength:{value:m,message:at.toString(b)}})}max(m,b){return new cn({...this._def,maxLength:{value:m,message:at.toString(b)}})}length(m,b){return new cn({...this._def,exactLength:{value:m,message:at.toString(b)}})}nonempty(m){return this.min(1,m)}}cn.create=(_,m)=>new cn({type:_,minLength:null,maxLength:null,exactLength:null,typeName:mt.ZodArray,...St(m)});function Mo(_){if(_ instanceof Si){const m={};for(const b in _.shape){const M=_.shape[b];m[b]=Bn.create(Mo(M))}return new Si({..._._def,shape:()=>m})}else return _ instanceof cn?new cn({..._._def,type:Mo(_.element)}):_ instanceof Bn?Bn.create(Mo(_.unwrap())):_ instanceof ja?ja.create(Mo(_.unwrap())):_ instanceof Fn?Fn.create(_.items.map(m=>Mo(m))):_}class Si extends zt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const m=this._def.shape(),b=Zt.objectKeys(m);return this._cached={shape:m,keys:b}}_parse(m){if(this._getType(m)!==Je.object){const re=this._getOrReturnCtx(m);return qe(re,{code:je.invalid_type,expected:Je.object,received:re.parsedType}),yt}const{status:M,ctx:E}=this._processInputParams(m),{shape:z,keys:P}=this._getCached(),o=[];if(!(this._def.catchall instanceof sa&&this._def.unknownKeys==="strip"))for(const re in E.data)P.includes(re)||o.push(re);const ue=[];for(const re of P){const ne=z[re],_e=E.data[re];ue.push({key:{status:"valid",value:re},value:ne._parse(new Ln(E,_e,E.path,re)),alwaysSet:re in E.data})}if(this._def.catchall instanceof sa){const re=this._def.unknownKeys;if(re==="passthrough")for(const ne of o)ue.push({key:{status:"valid",value:ne},value:{status:"valid",value:E.data[ne]}});else if(re==="strict")o.length>0&&(qe(E,{code:je.unrecognized_keys,keys:o}),M.dirty());else if(re!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const re=this._def.catchall;for(const ne of o){const _e=E.data[ne];ue.push({key:{status:"valid",value:ne},value:re._parse(new Ln(E,_e,E.path,ne)),alwaysSet:ne in E.data})}}return E.common.async?Promise.resolve().then(async()=>{const re=[];for(const ne of ue){const _e=await ne.key,ae=await ne.value;re.push({key:_e,value:ae,alwaysSet:ne.alwaysSet})}return re}).then(re=>lr.mergeObjectSync(M,re)):lr.mergeObjectSync(M,ue)}get shape(){return this._def.shape()}strict(m){return at.errToObj,new Si({...this._def,unknownKeys:"strict",...m!==void 0?{errorMap:(b,M)=>{var E,z,P,o;const ue=(P=(z=(E=this._def).errorMap)===null||z===void 0?void 0:z.call(E,b,M).message)!==null&&P!==void 0?P:M.defaultError;return b.code==="unrecognized_keys"?{message:(o=at.errToObj(m).message)!==null&&o!==void 0?o:ue}:{message:ue}}}:{}})}strip(){return new Si({...this._def,unknownKeys:"strip"})}passthrough(){return new Si({...this._def,unknownKeys:"passthrough"})}extend(m){return new Si({...this._def,shape:()=>({...this._def.shape(),...m})})}merge(m){return new Si({unknownKeys:m._def.unknownKeys,catchall:m._def.catchall,shape:()=>({...this._def.shape(),...m._def.shape()}),typeName:mt.ZodObject})}setKey(m,b){return this.augment({[m]:b})}catchall(m){return new Si({...this._def,catchall:m})}pick(m){const b={};return Zt.objectKeys(m).forEach(M=>{m[M]&&this.shape[M]&&(b[M]=this.shape[M])}),new Si({...this._def,shape:()=>b})}omit(m){const b={};return Zt.objectKeys(this.shape).forEach(M=>{m[M]||(b[M]=this.shape[M])}),new Si({...this._def,shape:()=>b})}deepPartial(){return Mo(this)}partial(m){const b={};return Zt.objectKeys(this.shape).forEach(M=>{const E=this.shape[M];m&&!m[M]?b[M]=E:b[M]=E.optional()}),new Si({...this._def,shape:()=>b})}required(m){const b={};return Zt.objectKeys(this.shape).forEach(M=>{if(m&&!m[M])b[M]=this.shape[M];else{let z=this.shape[M];for(;z instanceof Bn;)z=z._def.innerType;b[M]=z}}),new Si({...this._def,shape:()=>b})}keyof(){return pm(Zt.objectKeys(this.shape))}}Si.create=(_,m)=>new Si({shape:()=>_,unknownKeys:"strip",catchall:sa.create(),typeName:mt.ZodObject,...St(m)}),Si.strictCreate=(_,m)=>new Si({shape:()=>_,unknownKeys:"strict",catchall:sa.create(),typeName:mt.ZodObject,...St(m)}),Si.lazycreate=(_,m)=>new Si({shape:_,unknownKeys:"strip",catchall:sa.create(),typeName:mt.ZodObject,...St(m)});class $l extends zt{_parse(m){const{ctx:b}=this._processInputParams(m),M=this._def.options;function E(z){for(const o of z)if(o.result.status==="valid")return o.result;for(const o of z)if(o.result.status==="dirty")return b.common.issues.push(...o.ctx.common.issues),o.result;const P=z.map(o=>new Lr(o.ctx.common.issues));return qe(b,{code:je.invalid_union,unionErrors:P}),yt}if(b.common.async)return Promise.all(M.map(async z=>{const P={...b,common:{...b.common,issues:[]},parent:null};return{result:await z._parseAsync({data:b.data,path:b.path,parent:P}),ctx:P}})).then(E);{let z;const P=[];for(const ue of M){const re={...b,common:{...b.common,issues:[]},parent:null},ne=ue._parseSync({data:b.data,path:b.path,parent:re});if(ne.status==="valid")return ne;ne.status==="dirty"&&!z&&(z={result:ne,ctx:re}),re.common.issues.length&&P.push(re.common.issues)}if(z)return b.common.issues.push(...z.ctx.common.issues),z.result;const o=P.map(ue=>new Lr(ue));return qe(b,{code:je.invalid_union,unionErrors:o}),yt}}get options(){return this._def.options}}$l.create=(_,m)=>new $l({options:_,typeName:mt.ZodUnion,...St(m)});const oa=_=>_ instanceof Wl?oa(_.schema):_ instanceof un?oa(_.innerType()):_ instanceof Hl?[_.value]:_ instanceof Oa?_.options:_ instanceof Xl?Zt.objectValues(_.enum):_ instanceof Kl?oa(_._def.innerType):_ instanceof Vl?[void 0]:_ instanceof Ul?[null]:_ instanceof Bn?[void 0,...oa(_.unwrap())]:_ instanceof ja?[null,...oa(_.unwrap())]:_ instanceof Gd||_ instanceof Ql?oa(_.unwrap()):_ instanceof Yl?oa(_._def.innerType):[];class Yu extends zt{_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Je.object)return qe(b,{code:je.invalid_type,expected:Je.object,received:b.parsedType}),yt;const M=this.discriminator,E=b.data[M],z=this.optionsMap.get(E);return z?b.common.async?z._parseAsync({data:b.data,path:b.path,parent:b}):z._parseSync({data:b.data,path:b.path,parent:b}):(qe(b,{code:je.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[M]}),yt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(m,b,M){const E=new Map;for(const z of b){const P=oa(z.shape[m]);if(!P.length)throw new Error(`A discriminator value for key \`${m}\` could not be extracted from all schema options`);for(const o of P){if(E.has(o))throw new Error(`Discriminator property ${String(m)} has duplicate value ${String(o)}`);E.set(o,z)}}return new Yu({typeName:mt.ZodDiscriminatedUnion,discriminator:m,options:b,optionsMap:E,...St(M)})}}function $d(_,m){const b=aa(_),M=aa(m);if(_===m)return{valid:!0,data:_};if(b===Je.object&&M===Je.object){const E=Zt.objectKeys(m),z=Zt.objectKeys(_).filter(o=>E.indexOf(o)!==-1),P={..._,...m};for(const o of z){const ue=$d(_[o],m[o]);if(!ue.valid)return{valid:!1};P[o]=ue.data}return{valid:!0,data:P}}else if(b===Je.array&&M===Je.array){if(_.length!==m.length)return{valid:!1};const E=[];for(let z=0;z<_.length;z++){const P=_[z],o=m[z],ue=$d(P,o);if(!ue.valid)return{valid:!1};E.push(ue.data)}return{valid:!0,data:E}}else return b===Je.date&&M===Je.date&&+_==+m?{valid:!0,data:_}:{valid:!1}}class Gl extends zt{_parse(m){const{status:b,ctx:M}=this._processInputParams(m),E=(z,P)=>{if(Zd(z)||Zd(P))return yt;const o=$d(z.value,P.value);return o.valid?((Vd(z)||Vd(P))&&b.dirty(),{status:b.value,value:o.data}):(qe(M,{code:je.invalid_intersection_types}),yt)};return M.common.async?Promise.all([this._def.left._parseAsync({data:M.data,path:M.path,parent:M}),this._def.right._parseAsync({data:M.data,path:M.path,parent:M})]).then(([z,P])=>E(z,P)):E(this._def.left._parseSync({data:M.data,path:M.path,parent:M}),this._def.right._parseSync({data:M.data,path:M.path,parent:M}))}}Gl.create=(_,m,b)=>new Gl({left:_,right:m,typeName:mt.ZodIntersection,...St(b)});class Fn extends zt{_parse(m){const{status:b,ctx:M}=this._processInputParams(m);if(M.parsedType!==Je.array)return qe(M,{code:je.invalid_type,expected:Je.array,received:M.parsedType}),yt;if(M.data.length<this._def.items.length)return qe(M,{code:je.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),yt;!this._def.rest&&M.data.length>this._def.items.length&&(qe(M,{code:je.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b.dirty());const z=[...M.data].map((P,o)=>{const ue=this._def.items[o]||this._def.rest;return ue?ue._parse(new Ln(M,P,M.path,o)):null}).filter(P=>!!P);return M.common.async?Promise.all(z).then(P=>lr.mergeArray(b,P)):lr.mergeArray(b,z)}get items(){return this._def.items}rest(m){return new Fn({...this._def,rest:m})}}Fn.create=(_,m)=>{if(!Array.isArray(_))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fn({items:_,typeName:mt.ZodTuple,rest:null,...St(m)})};class ql extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(m){const{status:b,ctx:M}=this._processInputParams(m);if(M.parsedType!==Je.object)return qe(M,{code:je.invalid_type,expected:Je.object,received:M.parsedType}),yt;const E=[],z=this._def.keyType,P=this._def.valueType;for(const o in M.data)E.push({key:z._parse(new Ln(M,o,M.path,o)),value:P._parse(new Ln(M,M.data[o],M.path,o)),alwaysSet:o in M.data});return M.common.async?lr.mergeObjectAsync(b,E):lr.mergeObjectSync(b,E)}get element(){return this._def.valueType}static create(m,b,M){return b instanceof zt?new ql({keyType:m,valueType:b,typeName:mt.ZodRecord,...St(M)}):new ql({keyType:ln.create(),valueType:m,typeName:mt.ZodRecord,...St(b)})}}class Ju extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(m){const{status:b,ctx:M}=this._processInputParams(m);if(M.parsedType!==Je.map)return qe(M,{code:je.invalid_type,expected:Je.map,received:M.parsedType}),yt;const E=this._def.keyType,z=this._def.valueType,P=[...M.data.entries()].map(([o,ue],re)=>({key:E._parse(new Ln(M,o,M.path,[re,"key"])),value:z._parse(new Ln(M,ue,M.path,[re,"value"]))}));if(M.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const ue of P){const re=await ue.key,ne=await ue.value;if(re.status==="aborted"||ne.status==="aborted")return yt;(re.status==="dirty"||ne.status==="dirty")&&b.dirty(),o.set(re.value,ne.value)}return{status:b.value,value:o}})}else{const o=new Map;for(const ue of P){const re=ue.key,ne=ue.value;if(re.status==="aborted"||ne.status==="aborted")return yt;(re.status==="dirty"||ne.status==="dirty")&&b.dirty(),o.set(re.value,ne.value)}return{status:b.value,value:o}}}}Ju.create=(_,m,b)=>new Ju({valueType:m,keyType:_,typeName:mt.ZodMap,...St(b)});class As extends zt{_parse(m){const{status:b,ctx:M}=this._processInputParams(m);if(M.parsedType!==Je.set)return qe(M,{code:je.invalid_type,expected:Je.set,received:M.parsedType}),yt;const E=this._def;E.minSize!==null&&M.data.size<E.minSize.value&&(qe(M,{code:je.too_small,minimum:E.minSize.value,type:"set",inclusive:!0,exact:!1,message:E.minSize.message}),b.dirty()),E.maxSize!==null&&M.data.size>E.maxSize.value&&(qe(M,{code:je.too_big,maximum:E.maxSize.value,type:"set",inclusive:!0,exact:!1,message:E.maxSize.message}),b.dirty());const z=this._def.valueType;function P(ue){const re=new Set;for(const ne of ue){if(ne.status==="aborted")return yt;ne.status==="dirty"&&b.dirty(),re.add(ne.value)}return{status:b.value,value:re}}const o=[...M.data.values()].map((ue,re)=>z._parse(new Ln(M,ue,M.path,re)));return M.common.async?Promise.all(o).then(ue=>P(ue)):P(o)}min(m,b){return new As({...this._def,minSize:{value:m,message:at.toString(b)}})}max(m,b){return new As({...this._def,maxSize:{value:m,message:at.toString(b)}})}size(m,b){return this.min(m,b).max(m,b)}nonempty(m){return this.min(1,m)}}As.create=(_,m)=>new As({valueType:_,minSize:null,maxSize:null,typeName:mt.ZodSet,...St(m)});class Io extends zt{constructor(){super(...arguments),this.validate=this.implement}_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Je.function)return qe(b,{code:je.invalid_type,expected:Je.function,received:b.parsedType}),yt;function M(o,ue){return Wu({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,qu(),To].filter(re=>!!re),issueData:{code:je.invalid_arguments,argumentsError:ue}})}function E(o,ue){return Wu({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,qu(),To].filter(re=>!!re),issueData:{code:je.invalid_return_type,returnTypeError:ue}})}const z={errorMap:b.common.contextualErrorMap},P=b.data;if(this._def.returns instanceof Co){const o=this;return xr(async function(...ue){const re=new Lr([]),ne=await o._def.args.parseAsync(ue,z).catch(G=>{throw re.addIssue(M(ue,G)),re}),_e=await Reflect.apply(P,this,ne);return await o._def.returns._def.type.parseAsync(_e,z).catch(G=>{throw re.addIssue(E(_e,G)),re})})}else{const o=this;return xr(function(...ue){const re=o._def.args.safeParse(ue,z);if(!re.success)throw new Lr([M(ue,re.error)]);const ne=Reflect.apply(P,this,re.data),_e=o._def.returns.safeParse(ne,z);if(!_e.success)throw new Lr([E(ne,_e.error)]);return _e.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...m){return new Io({...this._def,args:Fn.create(m).rest(Es.create())})}returns(m){return new Io({...this._def,returns:m})}implement(m){return this.parse(m)}strictImplement(m){return this.parse(m)}static create(m,b,M){return new Io({args:m||Fn.create([]).rest(Es.create()),returns:b||Es.create(),typeName:mt.ZodFunction,...St(M)})}}class Wl extends zt{get schema(){return this._def.getter()}_parse(m){const{ctx:b}=this._processInputParams(m);return this._def.getter()._parse({data:b.data,path:b.path,parent:b})}}Wl.create=(_,m)=>new Wl({getter:_,typeName:mt.ZodLazy,...St(m)});class Hl extends zt{_parse(m){if(m.data!==this._def.value){const b=this._getOrReturnCtx(m);return qe(b,{received:b.data,code:je.invalid_literal,expected:this._def.value}),yt}return{status:"valid",value:m.data}}get value(){return this._def.value}}Hl.create=(_,m)=>new Hl({value:_,typeName:mt.ZodLiteral,...St(m)});function pm(_,m){return new Oa({values:_,typeName:mt.ZodEnum,...St(m)})}class Oa extends zt{constructor(){super(...arguments),jl.set(this,void 0)}_parse(m){if(typeof m.data!="string"){const b=this._getOrReturnCtx(m),M=this._def.values;return qe(b,{expected:Zt.joinValues(M),received:b.parsedType,code:je.invalid_type}),yt}if(Hu(this,jl)||lm(this,jl,new Set(this._def.values)),!Hu(this,jl).has(m.data)){const b=this._getOrReturnCtx(m),M=this._def.values;return qe(b,{received:b.data,code:je.invalid_enum_value,options:M}),yt}return xr(m.data)}get options(){return this._def.values}get enum(){const m={};for(const b of this._def.values)m[b]=b;return m}get Values(){const m={};for(const b of this._def.values)m[b]=b;return m}get Enum(){const m={};for(const b of this._def.values)m[b]=b;return m}extract(m,b=this._def){return Oa.create(m,{...this._def,...b})}exclude(m,b=this._def){return Oa.create(this.options.filter(M=>!m.includes(M)),{...this._def,...b})}}jl=new WeakMap,Oa.create=pm;class Xl extends zt{constructor(){super(...arguments),Nl.set(this,void 0)}_parse(m){const b=Zt.getValidEnumValues(this._def.values),M=this._getOrReturnCtx(m);if(M.parsedType!==Je.string&&M.parsedType!==Je.number){const E=Zt.objectValues(b);return qe(M,{expected:Zt.joinValues(E),received:M.parsedType,code:je.invalid_type}),yt}if(Hu(this,Nl)||lm(this,Nl,new Set(Zt.getValidEnumValues(this._def.values))),!Hu(this,Nl).has(m.data)){const E=Zt.objectValues(b);return qe(M,{received:M.data,code:je.invalid_enum_value,options:E}),yt}return xr(m.data)}get enum(){return this._def.values}}Nl=new WeakMap,Xl.create=(_,m)=>new Xl({values:_,typeName:mt.ZodNativeEnum,...St(m)});class Co extends zt{unwrap(){return this._def.type}_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Je.promise&&b.common.async===!1)return qe(b,{code:je.invalid_type,expected:Je.promise,received:b.parsedType}),yt;const M=b.parsedType===Je.promise?b.data:Promise.resolve(b.data);return xr(M.then(E=>this._def.type.parseAsync(E,{path:b.path,errorMap:b.common.contextualErrorMap})))}}Co.create=(_,m)=>new Co({type:_,typeName:mt.ZodPromise,...St(m)});class un extends zt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===mt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(m){const{status:b,ctx:M}=this._processInputParams(m),E=this._def.effect||null,z={addIssue:P=>{qe(M,P),P.fatal?b.abort():b.dirty()},get path(){return M.path}};if(z.addIssue=z.addIssue.bind(z),E.type==="preprocess"){const P=E.transform(M.data,z);if(M.common.async)return Promise.resolve(P).then(async o=>{if(b.value==="aborted")return yt;const ue=await this._def.schema._parseAsync({data:o,path:M.path,parent:M});return ue.status==="aborted"?yt:ue.status==="dirty"||b.value==="dirty"?Po(ue.value):ue});{if(b.value==="aborted")return yt;const o=this._def.schema._parseSync({data:P,path:M.path,parent:M});return o.status==="aborted"?yt:o.status==="dirty"||b.value==="dirty"?Po(o.value):o}}if(E.type==="refinement"){const P=o=>{const ue=E.refinement(o,z);if(M.common.async)return Promise.resolve(ue);if(ue instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(M.common.async===!1){const o=this._def.schema._parseSync({data:M.data,path:M.path,parent:M});return o.status==="aborted"?yt:(o.status==="dirty"&&b.dirty(),P(o.value),{status:b.value,value:o.value})}else return this._def.schema._parseAsync({data:M.data,path:M.path,parent:M}).then(o=>o.status==="aborted"?yt:(o.status==="dirty"&&b.dirty(),P(o.value).then(()=>({status:b.value,value:o.value}))))}if(E.type==="transform")if(M.common.async===!1){const P=this._def.schema._parseSync({data:M.data,path:M.path,parent:M});if(!Cs(P))return P;const o=E.transform(P.value,z);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:M.data,path:M.path,parent:M}).then(P=>Cs(P)?Promise.resolve(E.transform(P.value,z)).then(o=>({status:b.value,value:o})):P);Zt.assertNever(E)}}un.create=(_,m,b)=>new un({schema:_,typeName:mt.ZodEffects,effect:m,...St(b)}),un.createWithPreprocess=(_,m,b)=>new un({schema:m,effect:{type:"preprocess",transform:_},typeName:mt.ZodEffects,...St(b)});class Bn extends zt{_parse(m){return this._getType(m)===Je.undefined?xr(void 0):this._def.innerType._parse(m)}unwrap(){return this._def.innerType}}Bn.create=(_,m)=>new Bn({innerType:_,typeName:mt.ZodOptional,...St(m)});class ja extends zt{_parse(m){return this._getType(m)===Je.null?xr(null):this._def.innerType._parse(m)}unwrap(){return this._def.innerType}}ja.create=(_,m)=>new ja({innerType:_,typeName:mt.ZodNullable,...St(m)});class Kl extends zt{_parse(m){const{ctx:b}=this._processInputParams(m);let M=b.data;return b.parsedType===Je.undefined&&(M=this._def.defaultValue()),this._def.innerType._parse({data:M,path:b.path,parent:b})}removeDefault(){return this._def.innerType}}Kl.create=(_,m)=>new Kl({innerType:_,typeName:mt.ZodDefault,defaultValue:typeof m.default=="function"?m.default:()=>m.default,...St(m)});class Yl extends zt{_parse(m){const{ctx:b}=this._processInputParams(m),M={...b,common:{...b.common,issues:[]}},E=this._def.innerType._parse({data:M.data,path:M.path,parent:{...M}});return Ol(E)?E.then(z=>({status:"valid",value:z.status==="valid"?z.value:this._def.catchValue({get error(){return new Lr(M.common.issues)},input:M.data})})):{status:"valid",value:E.status==="valid"?E.value:this._def.catchValue({get error(){return new Lr(M.common.issues)},input:M.data})}}removeCatch(){return this._def.innerType}}Yl.create=(_,m)=>new Yl({innerType:_,typeName:mt.ZodCatch,catchValue:typeof m.catch=="function"?m.catch:()=>m.catch,...St(m)});class Qu extends zt{_parse(m){if(this._getType(m)!==Je.nan){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.nan,received:M.parsedType}),yt}return{status:"valid",value:m.data}}}Qu.create=_=>new Qu({typeName:mt.ZodNaN,...St(_)});const px=Symbol("zod_brand");class Gd extends zt{_parse(m){const{ctx:b}=this._processInputParams(m),M=b.data;return this._def.type._parse({data:M,path:b.path,parent:b})}unwrap(){return this._def.type}}class Jl extends zt{_parse(m){const{status:b,ctx:M}=this._processInputParams(m);if(M.common.async)return(async()=>{const z=await this._def.in._parseAsync({data:M.data,path:M.path,parent:M});return z.status==="aborted"?yt:z.status==="dirty"?(b.dirty(),Po(z.value)):this._def.out._parseAsync({data:z.value,path:M.path,parent:M})})();{const E=this._def.in._parseSync({data:M.data,path:M.path,parent:M});return E.status==="aborted"?yt:E.status==="dirty"?(b.dirty(),{status:"dirty",value:E.value}):this._def.out._parseSync({data:E.value,path:M.path,parent:M})}}static create(m,b){return new Jl({in:m,out:b,typeName:mt.ZodPipeline})}}class Ql extends zt{_parse(m){const b=this._def.innerType._parse(m),M=E=>(Cs(E)&&(E.value=Object.freeze(E.value)),E);return Ol(b)?b.then(E=>M(E)):M(b)}unwrap(){return this._def.innerType}}Ql.create=(_,m)=>new Ql({innerType:_,typeName:mt.ZodReadonly,...St(m)});function fm(_,m){const b=typeof _=="function"?_(m):typeof _=="string"?{message:_}:_;return typeof b=="string"?{message:b}:b}function mm(_,m={},b){return _?So.create().superRefine((M,E)=>{var z,P;const o=_(M);if(o instanceof Promise)return o.then(ue=>{var re,ne;if(!ue){const _e=fm(m,M),ae=(ne=(re=_e.fatal)!==null&&re!==void 0?re:b)!==null&&ne!==void 0?ne:!0;E.addIssue({code:"custom",..._e,fatal:ae})}});if(!o){const ue=fm(m,M),re=(P=(z=ue.fatal)!==null&&z!==void 0?z:b)!==null&&P!==void 0?P:!0;E.addIssue({code:"custom",...ue,fatal:re})}}):So.create()}const fx={object:Si.lazycreate};var mt;(function(_){_.ZodString="ZodString",_.ZodNumber="ZodNumber",_.ZodNaN="ZodNaN",_.ZodBigInt="ZodBigInt",_.ZodBoolean="ZodBoolean",_.ZodDate="ZodDate",_.ZodSymbol="ZodSymbol",_.ZodUndefined="ZodUndefined",_.ZodNull="ZodNull",_.ZodAny="ZodAny",_.ZodUnknown="ZodUnknown",_.ZodNever="ZodNever",_.ZodVoid="ZodVoid",_.ZodArray="ZodArray",_.ZodObject="ZodObject",_.ZodUnion="ZodUnion",_.ZodDiscriminatedUnion="ZodDiscriminatedUnion",_.ZodIntersection="ZodIntersection",_.ZodTuple="ZodTuple",_.ZodRecord="ZodRecord",_.ZodMap="ZodMap",_.ZodSet="ZodSet",_.ZodFunction="ZodFunction",_.ZodLazy="ZodLazy",_.ZodLiteral="ZodLiteral",_.ZodEnum="ZodEnum",_.ZodEffects="ZodEffects",_.ZodNativeEnum="ZodNativeEnum",_.ZodOptional="ZodOptional",_.ZodNullable="ZodNullable",_.ZodDefault="ZodDefault",_.ZodCatch="ZodCatch",_.ZodPromise="ZodPromise",_.ZodBranded="ZodBranded",_.ZodPipeline="ZodPipeline",_.ZodReadonly="ZodReadonly"})(mt||(mt={}));const mx=(_,m={message:`Input not instance of ${_.name}`})=>mm(b=>b instanceof _,m),gm=ln.create,_m=Fa.create,gx=Qu.create,_x=Ba.create,ym=Zl.create,yx=ks.create,xx=Xu.create,vx=Vl.create,bx=Ul.create,wx=So.create,Tx=Es.create,Px=sa.create,Sx=Ku.create,Mx=cn.create,Ix=Si.create,Cx=Si.strictCreate,kx=$l.create,Ex=Yu.create,Ax=Gl.create,zx=Fn.create,Rx=ql.create,Dx=Ju.create,Lx=As.create,Fx=Io.create,Bx=Wl.create,Ox=Hl.create,jx=Oa.create,Nx=Xl.create,Zx=Co.create,xm=un.create,Vx=Bn.create,Ux=ja.create,$x=un.createWithPreprocess,Gx=Jl.create;var zi=Object.freeze({__proto__:null,defaultErrorMap:To,setErrorMap:$y,getErrorMap:qu,makeIssue:Wu,EMPTY_PATH:Gy,addIssueToContext:qe,ParseStatus:lr,INVALID:yt,DIRTY:Po,OK:xr,isAborted:Zd,isDirty:Vd,isValid:Cs,isAsync:Ol,get util(){return Zt},get objectUtil(){return Nd},ZodParsedType:Je,getParsedType:aa,ZodType:zt,datetimeRegex:dm,ZodString:ln,ZodNumber:Fa,ZodBigInt:Ba,ZodBoolean:Zl,ZodDate:ks,ZodSymbol:Xu,ZodUndefined:Vl,ZodNull:Ul,ZodAny:So,ZodUnknown:Es,ZodNever:sa,ZodVoid:Ku,ZodArray:cn,ZodObject:Si,ZodUnion:$l,ZodDiscriminatedUnion:Yu,ZodIntersection:Gl,ZodTuple:Fn,ZodRecord:ql,ZodMap:Ju,ZodSet:As,ZodFunction:Io,ZodLazy:Wl,ZodLiteral:Hl,ZodEnum:Oa,ZodNativeEnum:Xl,ZodPromise:Co,ZodEffects:un,ZodTransformer:un,ZodOptional:Bn,ZodNullable:ja,ZodDefault:Kl,ZodCatch:Yl,ZodNaN:Qu,BRAND:px,ZodBranded:Gd,ZodPipeline:Jl,ZodReadonly:Ql,custom:mm,Schema:zt,ZodSchema:zt,late:fx,get ZodFirstPartyTypeKind(){return mt},coerce:{string:_=>ln.create({..._,coerce:!0}),number:_=>Fa.create({..._,coerce:!0}),boolean:_=>Zl.create({..._,coerce:!0}),bigint:_=>Ba.create({..._,coerce:!0}),date:_=>ks.create({..._,coerce:!0})},any:wx,array:Mx,bigint:_x,boolean:ym,date:yx,discriminatedUnion:Ex,effect:xm,enum:jx,function:Fx,instanceof:mx,intersection:Ax,lazy:Bx,literal:Ox,map:Dx,nan:gx,nativeEnum:Nx,never:Px,null:bx,nullable:Ux,number:_m,object:Ix,oboolean:()=>ym().optional(),onumber:()=>_m().optional(),optional:Vx,ostring:()=>gm().optional(),pipeline:Gx,preprocess:$x,promise:Zx,record:Rx,set:Lx,strictObject:Cx,string:gm,symbol:xx,transformer:xm,tuple:zx,undefined:vx,union:kx,unknown:Tx,void:Sx,NEVER:yt,ZodIssueCode:je,quotelessJson:Uy,ZodError:Lr});const qx=zi.object({name:zi.literal("dark").or(zi.literal("light")),colors:zi.object({primary:zi.string().max(64),background:zi.string().max(64),text:zi.string().max(64)})}),Wx=zi.object({container:zi.string(),position:zi.object({center:zi.object({lat:zi.number(),lng:zi.number()}),zoom:zi.number()}),theme:qx}),Hx=zi.object({id:zi.string(),index:zi.number(),lat:zi.number(),lng:zi.number(),width:zi.number(),height:zi.number()}),Xx=zi.array(Hx);var Kx=Ll('<div class="popup svelte-18qqsss"><!></div>'),Yx=Ll('<div class="marker"><!> <!></div>'),Jx=Ll('<div class="container svelte-18qqsss"><div class="map svelte-18qqsss"></div> <div class="markers svelte-18qqsss"></div></div>');function vm(_,m){Cu(m,!0);let b,M,E=0,z=vi(!1);tm(()=>{Wx.parse(m.options),P(),o()});function P(){const lt=m.options.position;b=new jd.Map({style:Mt(m.options.theme.name),center:{lat:lt.center.lat,lng:lt.center.lng},zoom:lt.zoom,minZoom:G(),maxZoom:Bl,container:M,pitchWithRotate:!1,attributionControl:{compact:!1}})}function o(){b.on("load",ue),b.on("move",re),b.on("idle",ne),b.on("click",_e),b.dragRotate.disable(),b.keyboard.disable(),b.touchZoomRotate.disableRotation(),b.touchPitch.disable()}function ue(){ti(z,!0)}function re(){}function ne(){}function _e(lt){}function ae(){ve(G())}function G(){const qt=Math.ceil(Math.log2(E/Zu));return Math.max(wo,qt)}function ve(lt){b==null||b.setMinZoom(lt)}function Oe(){const lt=b==null?void 0:b.getCenter();if(lt)return{lat:lt.lat,lng:lt.lng}}function Ke(){const lt=b==null?void 0:b.getBounds();if(lt)return{sw:{lat:lt.getSouthWest().lat,lng:lt.getSouthWest().lng},ne:{lat:lt.getNorthEast().lat,lng:lt.getNorthEast().lng}}}function Qe(){return(b==null?void 0:b.getZoom())??m.options.position.zoom}function ct(){b==null||b.zoomIn()}function gt(){b==null||b.zoomOut()}let pt=vi(na(m.options.theme));yo(()=>{We(z)&&b.setStyle(Mt(We(pt).name))});function Mt(lt){switch(lt){case"light":return Vy;case"dark":return Zy}}function kt(){return M_(We(pt))}function Et(lt){ti(pt,lt,!0),b.setStyle(Mt(We(pt).name),{diff:!0})}let wt,Mi,Wi,Hi=vi(na(new Array)),ut=vi(na(new Array));tm(()=>{const lt=async()=>{await Yt(),Mi=window.setTimeout(lt,50)},qt=()=>{Jt(),Wi=window.setTimeout(qt,25)};return lt(),qt(),()=>{clearInterval(Mi),clearInterval(Wi)}});async function Yt(){if(!wt||!We(z)||We(Hi).length==0)return;const lt=Ke(),qt=Qe();if(!lt)return;const Ii=We(Hi).filter($t=>!$t.loaded);if(Ii.length==0)return;const li=Ii.filter($t=>{const ft=$t.block;return!(qt+Od<ft.zs||ft.ne.lng<lt.sw.lng||lt.ne.lng<ft.sw.lng||ft.ne.lat<lt.sw.lat||lt.ne.lat<ft.sw.lat)});if(li.length!=0)try{const $t=li.flatMap(Tt=>Tt.block.markers).map(Tt=>Tt.id),ft=await wt($t),Qt=new Map;for(let Tt=0;Tt<We(ut).length;Tt++){const Pt=We(ut)[Tt];Qt.set(Pt.marker.id,Pt)}for(let Tt=0;Tt<$t.length;Tt++){const Pt=$t[Tt],rt=ft[Tt],fi=Qt.get(Pt);if(!fi)throw new Error("Failed to find marker data.");fi.content=rt}li.forEach(Tt=>Tt.loaded=!0)}catch($t){console.error($t),li.forEach(ft=>ft.loaded=!1)}}function Jt(){var ft;if(!We(z)||We(ut).length==0)return;const lt=b.getZoom();if(!lt)return;const qt=new Array,Ii=Zu,li=new sm(b,-512,window.innerHeight+Ii,window.innerWidth+Ii,-512),$t=new sm(b,0,window.innerHeight,window.innerWidth,0);for(let Qt=0;Qt<We(ut).length;Qt++){const Tt=We(ut)[Qt],Pt=Tt.marker,rt=Tt.libreMarker;if(rt){if(Pt.zet<=lt&&li.contains(Pt.lat,Pt.lng)){rt._map!=b&&rt.addTo(b),qt.push(Tt);continue}if(Pt.zet<=lt+rm&&$t.contains(Pt.lat,Pt.lng)){rt._map!=b&&rt.addTo(b),qt.push(Tt);continue}rt._map!=null&&rt.remove()}}for(let Qt=0;Qt<qt.length;Qt++){const Tt=qt[Qt],Pt=Tt.marker,rt=Tt.component,fi=Tt.circle;Tt.circleRendered||(Tt.circleRendered=!0),!Tt.componentRendered&&Tt.marker.zet<=lt+Od&&(Tt.componentRendered=!0),Pt.zet<=lt+Od?rt==null||rt.setDisplayed(!0):rt==null||rt.setDisplayed(!1),Pt.zet<=lt&&rt!=null?(fi==null||fi.setCollapsed(!0),rt==null||rt.setCollapsed(!1),rt==null||rt.setAngle((ft=Pt.angs.findLast(bi=>bi[0]<=lt))==null?void 0:ft[1])):(rt==null||rt.setCollapsed(!0),fi==null||fi.setCollapsed(!1),fi==null||fi.setDistance((Pt.zet-lt)/rm))}}async function cr(lt){wt=lt}async function Dt(lt){var $t;if(!(await Xx.safeParseAsync(lt)).success)throw new Error("Invalid markers input");for(let ft=0;ft<We(ut).length;ft++)($t=We(ut)[ft].libreMarker)==null||$t.remove();We(ut).length=0;const Ii=await Ly(lt),li=Ii.flatMap(ft=>ft.markers).toSorted((ft,Qt)=>ft.zet-Qt.zet);ti(Hi,Ii.map(ft=>new Dy(ft)),!0),ti(ut,li.map(ft=>new Ny(ft)),!0),await X_();for(let ft=0;ft<We(ut).length;ft++){const Qt=We(ut)[ft],Tt=Qt.marker,Pt=Qt.element;if(!Pt)throw new Error("Failed to render marker element.");const rt=new jd.Marker({element:Pt});rt.setLngLat([Tt.lng,Tt.lat]),Qt.libreMarker=rt}}var vr=Jx();iy("resize",wd,ae);var Fr=Ps(vr);bo(Fr,lt=>M=lt,()=>M);var hn=Sd(Fr,2);return ly(hn,21,()=>We(ut),sy,(lt,qt,Ii)=>{var li=Yx(),$t=Ps(li);{var ft=Pt=>{bo(My(Pt,{}),(rt,fi)=>fi.circle=rt,rt=>rt==null?void 0:rt.circle,()=>[We(qt)])};Wf($t,Pt=>{We(qt).circleRendered&&Pt(ft)})}var Qt=Sd($t,2);{var Tt=Pt=>{bo(Py(Pt,{children:(rt,fi)=>{var bi=Kx(),Ci=Ps(bi);dy(Ci,()=>We(qt).content),Cl(()=>vo(bi,`width: ${We(qt).marker.width??""}px; height: ${We(qt).marker.height??""}px;`)),Fl(rt,bi)},$$slots:{default:!0}}),(rt,fi)=>fi.component=rt,rt=>rt==null?void 0:rt.component,()=>[We(qt)])};Wf(Qt,Pt=>{We(qt).componentRendered&&We(qt).content&&Pt(Tt)})}bo(li,(Pt,rt)=>rt.element=Pt,Pt=>Pt==null?void 0:Pt.element,()=>[We(qt)]),Cl(()=>vo(li,`z-index: ${We(ut).length-Ii};`)),Fl(lt,li)}),Cl(()=>vo(vr,`--primary: ${We(pt).colors.primary??""}; --background: ${We(pt).colors.background??""}; --text: ${We(pt).colors.text??""};`)),Fl(_,vr),ku({getCenter:Oe,getBounds:Ke,getZoom:Qe,zoomIn:ct,zoomOut:gt,getTheme:kt,setTheme:Et,setPopupsContentCallback:cr,setPopups:Dt})}function Qx(_){const m=document.getElementById(_.container);if(!m)throw new Error(`Container not found: ${_.container}`);return ry(vm,{target:m,props:{options:_}})}function ev(_){ay(_)}Ut.Map=vm,Ut.mountMap=Qx,Ut.unmountMap=ev,Object.defineProperty(Ut,Symbol.toStringTag,{value:"Module"})});