@arenarium/maps 1.0.114 → 1.0.116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,750 +1,2 @@
1
- (function(jt,Yt){typeof exports=="object"&&typeof module<"u"?Yt(exports):typeof define=="function"&&define.amd?define(["exports"],Yt):(jt=typeof globalThis<"u"?globalThis:jt||self,Yt(jt.arenarium={}))})(this,function(jt){"use strict";var Gv=Object.defineProperty;var Vg=jt=>{throw TypeError(jt)};var qv=(jt,Yt,Si)=>Yt in jt?Gv(jt,Yt,{enumerable:!0,configurable:!0,writable:!0,value:Si}):jt[Yt]=Si;var kt=(jt,Yt,Si)=>qv(jt,typeof Yt!="symbol"?Yt+"":Yt,Si),Np=(jt,Yt,Si)=>Yt.has(jt)||Vg("Cannot "+Si);var Ti=(jt,Yt,Si)=>(Np(jt,Yt,"read from private field"),Si?Si.call(jt):Yt.get(jt)),Ca=(jt,Yt,Si)=>Yt.has(jt)?Vg("Cannot add the same private member more than once"):Yt instanceof WeakSet?Yt.add(jt):Yt.set(jt,Si),Hc=(jt,Yt,Si,Xc)=>(Np(jt,Yt,"write to private field"),Xc?Xc.call(jt,Si):Yt.set(jt,Si),Si),Zg=(jt,Yt,Si)=>(Np(jt,Yt,"access private method"),Si);var ja,Mo,Ll,Pu,Ug,em,ca,Co,Bl,ws;var Si=Array.isArray,Xc=Array.prototype.indexOf,Gg=Array.from,qg=Object.defineProperty,Sl=Object.getOwnPropertyDescriptor,Vp=Object.prototype,Wg=Array.prototype,Zp=Object.getPrototypeOf,Up=Object.isExtensible;function Hg(v){for(var g=0;g<v.length;g++)v[g]()}const Sn=2,$p=4,Yc=8,Oh=16,Ia=32,fo=64,Kc=128,Xr=256,Jc=512,dn=1024,Ea=2048,ys=4096,Qc=8192,eu=16384,Xg=32768,Yg=65536,Kg=1<<19,Gp=1<<20,jh=1<<21,tu=Symbol("$state");function qp(v){return v===this.v}function Jg(v){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Qg(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function e_(v){throw new Error("https://svelte.dev/e/effect_orphan")}function t_(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function i_(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function r_(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function n_(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let Wv=!1;const a_=2,Yr=Symbol(),s_=[];function Wp(v,g=!1){return iu(v,new Map,"",s_)}function iu(v,g,w,z,D=null){if(typeof v=="object"&&v!==null){var F=g.get(v);if(F!==void 0)return F;if(v instanceof Map)return new Map(v);if(v instanceof Set)return new Set(v);if(Si(v)){var P=Array(v.length);g.set(v,P),D!==null&&g.set(D,P);for(var o=0;o<v.length;o+=1){var fe=v[o];o in v&&(P[o]=iu(fe,g,w,z))}return P}if(Zp(v)===Vp){P={},g.set(v,P),D!==null&&g.set(D,P);for(var xe in v)P[xe]=iu(v[xe],g,w,z);return P}if(v instanceof Date)return structuredClone(v);if(typeof v.toJSON=="function")return iu(v.toJSON(),g,w,z,v)}if(v instanceof EventTarget)return v;try{return structuredClone(v)}catch{return v}}function o_(v){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let Or=null;function Hp(v){Or=v}function ru(v,g=!1,w){var z=Or={p:Or,c:null,d:!1,e:null,m:!1,s:v,x:null,l:null};lf(()=>{z.d=!0})}function nu(v){const g=Or;if(g!==null){v!==void 0&&(g.x=v);const P=g.e;if(P!==null){var w=di,z=Kt;g.e=null;try{for(var D=0;D<P.length;D++){var F=P[D];Aa(F.effect),Vn(F.reaction),su(F.fn)}}finally{Aa(w),Vn(z)}}Or=g.p,g.m=!0}return v||{}}function Xp(){return!0}function za(v){if(typeof v!="object"||v===null||tu in v)return v;const g=Zp(v);if(g!==Vp&&g!==Wg)return v;var w=new Map,z=Si(v),D=Qi(0),F=Kt,P=o=>{var fe=Kt;Vn(F);var xe=o();return Vn(fe),xe};return z&&w.set("length",Qi(v.length)),new Proxy(v,{defineProperty(o,fe,xe){(!("value"in xe)||xe.configurable===!1||xe.enumerable===!1||xe.writable===!1)&&i_();var ke=w.get(fe);return ke===void 0?(ke=P(()=>Qi(xe.value)),w.set(fe,ke)):mi(ke,P(()=>za(xe.value))),!0},deleteProperty(o,fe){var xe=w.get(fe);if(xe===void 0)fe in o&&(w.set(fe,P(()=>Qi(Yr))),Nh(D));else{if(z&&typeof fe=="string"){var ke=w.get("length"),Ve=Number(fe);Number.isInteger(Ve)&&Ve<ke.v&&mi(ke,Ve)}mi(xe,Yr),Nh(D)}return!0},get(o,fe,xe){var ue;if(fe===tu)return v;var ke=w.get(fe),Ve=fe in o;if(ke===void 0&&(!Ve||(ue=Sl(o,fe))!=null&&ue.writable)&&(ke=P(()=>Qi(za(Ve?o[fe]:Yr))),w.set(fe,ke)),ke!==void 0){var Ce=dt(ke);return Ce===Yr?void 0:Ce}return Reflect.get(o,fe,xe)},getOwnPropertyDescriptor(o,fe){var xe=Reflect.getOwnPropertyDescriptor(o,fe);if(xe&&"value"in xe){var ke=w.get(fe);ke&&(xe.value=dt(ke))}else if(xe===void 0){var Ve=w.get(fe),Ce=Ve==null?void 0:Ve.v;if(Ve!==void 0&&Ce!==Yr)return{enumerable:!0,configurable:!0,value:Ce,writable:!0}}return xe},has(o,fe){var Ce;if(fe===tu)return!0;var xe=w.get(fe),ke=xe!==void 0&&xe.v!==Yr||Reflect.has(o,fe);if(xe!==void 0||di!==null&&(!ke||(Ce=Sl(o,fe))!=null&&Ce.writable)){xe===void 0&&(xe=P(()=>Qi(ke?za(o[fe]):Yr)),w.set(fe,xe));var Ve=dt(xe);if(Ve===Yr)return!1}return ke},set(o,fe,xe,ke){var pi;var Ve=w.get(fe),Ce=fe in o;if(z&&fe==="length")for(var ue=xe;ue<Ve.v;ue+=1){var Ue=w.get(ue+"");Ue!==void 0?mi(Ue,Yr):ue in o&&(Ue=P(()=>Qi(Yr)),w.set(ue+"",Ue))}Ve===void 0?(!Ce||(pi=Sl(o,fe))!=null&&pi.writable)&&(Ve=P(()=>Qi(void 0)),mi(Ve,P(()=>za(xe))),w.set(fe,Ve)):(Ce=Ve.v!==Yr,mi(Ve,P(()=>za(xe))));var Vt=Reflect.getOwnPropertyDescriptor(o,fe);if(Vt!=null&&Vt.set&&Vt.set.call(ke,xe),!Ce){if(z&&typeof fe=="string"){var wt=w.get("length"),Pi=Number(fe);Number.isInteger(Pi)&&Pi>=wt.v&&mi(wt,Pi+1)}Nh(D)}return!0},ownKeys(o){dt(D);var fe=Reflect.ownKeys(o).filter(Ve=>{var Ce=w.get(Ve);return Ce===void 0||Ce.v!==Yr});for(var[xe,ke]of w)ke.v!==Yr&&!(xe in o)&&fe.push(xe);return fe},setPrototypeOf(){r_()}})}function Nh(v,g=1){mi(v,v.v+g)}function Yp(v){var g=Sn|Ea,w=Kt!==null&&(Kt.f&Sn)!==0?Kt:null;return di===null||w!==null&&(w.f&Xr)!==0?g|=Xr:di.f|=Gp,{ctx:Or,deps:null,effects:null,equals:qp,f:g,fn:v,reactions:null,rv:0,v:null,wv:0,parent:w??di}}function Kp(v){const g=Yp(v);return gf(g),g}function Jp(v){var g=v.effects;if(g!==null){v.effects=null;for(var w=0;w<g.length;w+=1)xs(g[w])}}function l_(v){for(var g=v.parent;g!==null;){if((g.f&Sn)===0)return g;g=g.parent}return null}function Qp(v){var g,w=di;Aa(l_(v));try{Jp(v),g=bf(v)}finally{Aa(w)}return g}function ef(v){var g=Qp(v);if(v.equals(g)||(v.v=g,v.wv=yf()),!go){var w=(ka||(v.f&Xr)!==0)&&v.deps!==null?ys:dn;Zn(v,w)}}const Pl=new Map;function Vh(v,g){var w={f:0,v,reactions:null,equals:qp,rv:0,wv:0};return w}function Qi(v,g){const w=Vh(v);return gf(w),w}function mi(v,g,w=!1){Kt!==null&&!Nn&&Xp()&&(Kt.f&(Sn|Oh))!==0&&!(Mr!=null&&Mr.includes(v))&&n_();let z=w?za(g):g;return c_(v,z)}function c_(v,g){if(!v.equals(g)){var w=v.v;go?Pl.set(v,g):Pl.set(v,w),v.v=g,(v.f&Sn)!==0&&((v.f&Ea)!==0&&Qp(v),Zn(v,(v.f&Xr)===0?dn:ys)),v.wv=yf(),tf(v,Ea),di!==null&&(di.f&dn)!==0&&(di.f&(Ia|fo))===0&&(fn===null?T_([v]):fn.push(v))}return g}function tf(v,g){var w=v.reactions;if(w!==null)for(var z=w.length,D=0;D<z;D++){var F=w[D],P=F.f;(P&Ea)===0&&(Zn(F,g),(P&(dn|Xr))!==0&&((P&Sn)!==0?tf(F,ys):qh(F)))}}var Zh,rf,nf,af;function u_(){if(Zh===void 0){Zh=window,rf=/Firefox/.test(navigator.userAgent);var v=Element.prototype,g=Node.prototype,w=Text.prototype;nf=Sl(g,"firstChild").get,af=Sl(g,"nextSibling").get,Up(v)&&(v.__click=void 0,v.__className=void 0,v.__attributes=null,v.__style=void 0,v.__e=void 0),Up(w)&&(w.__t=void 0)}}function h_(v=""){return document.createTextNode(v)}function sf(v){return nf.call(v)}function of(v){return af.call(v)}function au(v,g){return sf(v)}function d_(v,g=1,w=!1){let z=v;for(;g--;)z=of(z);return z}function p_(v){di===null&&Kt===null&&e_(),Kt!==null&&(Kt.f&Xr)!==0&&di===null&&Qg(),go&&Jg()}function f_(v,g){var w=g.last;w===null?g.last=g.first=v:(w.next=v,v.prev=w,g.last=v)}function mo(v,g,w,z=!0){var D=di,F={ctx:Or,deps:null,nodes_start:null,nodes_end:null,f:v|Ea,first:null,fn:g,last:null,next:null,parent:D,prev:null,teardown:null,transitions:null,wv:0};if(w)try{Gh(F),F.f|=Xg}catch(fe){throw xs(F),fe}else g!==null&&qh(F);var P=w&&F.deps===null&&F.first===null&&F.nodes_start===null&&F.teardown===null&&(F.f&(Gp|Kc))===0;if(!P&&z&&(D!==null&&f_(F,D),Kt!==null&&(Kt.f&Sn)!==0)){var o=Kt;(o.effects??(o.effects=[])).push(F)}return F}function lf(v){const g=mo(Yc,null,!1);return Zn(g,dn),g.teardown=v,g}function pn(v){p_();var g=di!==null&&(di.f&Ia)!==0&&Or!==null&&!Or.m;if(g){var w=Or;(w.e??(w.e=[])).push({fn:v,effect:di,reaction:Kt})}else{var z=su(v);return z}}function m_(v){const g=mo(fo,v,!0);return(w={})=>new Promise(z=>{w.outro?v_(g,()=>{xs(g),z(void 0)}):(xs(g),z(void 0))})}function su(v){return mo($p,v,!1)}function cf(v){return mo(Yc,v,!0)}function Uh(v,g=[],w=Yp){const z=g.map(w);return g_(()=>v(...z.map(dt)))}function g_(v,g=0){return mo(Yc|Oh|g,v,!0)}function __(v,g=!0){return mo(Yc|Ia,v,!0,g)}function uf(v){var g=v.teardown;if(g!==null){const w=go,z=Kt;mf(!0),Vn(null);try{g.call(null)}finally{mf(w),Vn(z)}}}function hf(v,g=!1){var w=v.first;for(v.first=v.last=null;w!==null;){var z=w.next;(w.f&fo)!==0?w.parent=null:xs(w,g),w=z}}function y_(v){for(var g=v.first;g!==null;){var w=g.next;(g.f&Ia)===0&&xs(g),g=w}}function xs(v,g=!0){var w=!1;(g||(v.f&Kg)!==0)&&v.nodes_start!==null&&(x_(v.nodes_start,v.nodes_end),w=!0),hf(v,g&&!w),fu(v,0),Zn(v,eu);var z=v.transitions;if(z!==null)for(const F of z)F.stop();uf(v);var D=v.parent;D!==null&&D.first!==null&&df(v),v.next=v.prev=v.teardown=v.ctx=v.deps=v.fn=v.nodes_start=v.nodes_end=null}function x_(v,g){for(;v!==null;){var w=v===g?null:of(v);v.remove(),v=w}}function df(v){var g=v.parent,w=v.prev,z=v.next;w!==null&&(w.next=z),z!==null&&(z.prev=w),g!==null&&(g.first===v&&(g.first=z),g.last===v&&(g.last=w))}function v_(v,g){var w=[];pf(v,w,!0),b_(w,()=>{xs(v),g&&g()})}function b_(v,g){var w=v.length;if(w>0){var z=()=>--w||g();for(var D of v)D.out(z)}else g()}function pf(v,g,w){if((v.f&Qc)===0){if(v.f^=Qc,v.transitions!==null)for(const P of v.transitions)(P.is_global||w)&&g.push(P);for(var z=v.first;z!==null;){var D=z.next,F=(z.f&Yg)!==0||(z.f&Ia)!==0;pf(z,g,F?w:!1),z=D}}}let ou=[];function w_(){var v=ou;ou=[],Hg(v)}function ff(v){ou.length===0&&queueMicrotask(w_),ou.push(v)}let lu=!1,$h=!1,cu=null,vs=!1,go=!1;function mf(v){go=v}let uu=[],Hv=[],Kt=null,Nn=!1;function Vn(v){Kt=v}let di=null;function Aa(v){di=v}let Mr=null;function gf(v){Kt!==null&&Kt.f&jh&&(Mr===null?Mr=[v]:Mr.push(v))}let Cr=null,Kr=0,fn=null;function T_(v){fn=v}let _f=1,hu=0,ka=!1;function yf(){return++_f}function du(v){var Ve;var g=v.f;if((g&Ea)!==0)return!0;if((g&ys)!==0){var w=v.deps,z=(g&Xr)!==0;if(w!==null){var D,F,P=(g&Jc)!==0,o=z&&di!==null&&!ka,fe=w.length;if(P||o){var xe=v,ke=xe.parent;for(D=0;D<fe;D++)F=w[D],(P||!((Ve=F==null?void 0:F.reactions)!=null&&Ve.includes(xe)))&&(F.reactions??(F.reactions=[])).push(xe);P&&(xe.f^=Jc),o&&ke!==null&&(ke.f&Xr)===0&&(xe.f^=Xr)}for(D=0;D<fe;D++)if(F=w[D],du(F)&&ef(F),F.wv>v.wv)return!0}(!z||di!==null&&!ka)&&Zn(v,dn)}return!1}function S_(v,g){for(var w=g;w!==null;){if((w.f&Kc)!==0)try{w.fn(v);return}catch{w.f^=Kc}w=w.parent}throw lu=!1,v}function xf(v){return(v.f&eu)===0&&(v.parent===null||(v.parent.f&Kc)===0)}function pu(v,g,w,z){if(lu){if(w===null&&(lu=!1),xf(g))throw v;return}if(w!==null&&(lu=!0),S_(v,g),xf(g))throw v}function vf(v,g,w=!0){var z=v.reactions;if(z!==null)for(var D=0;D<z.length;D++){var F=z[D];Mr!=null&&Mr.includes(v)||((F.f&Sn)!==0?vf(F,g,!1):g===F&&(w?Zn(F,Ea):(F.f&dn)!==0&&Zn(F,ys),qh(F)))}}function bf(v){var ue;var g=Cr,w=Kr,z=fn,D=Kt,F=ka,P=Mr,o=Or,fe=Nn,xe=v.f;Cr=null,Kr=0,fn=null,ka=(xe&Xr)!==0&&(Nn||!vs||Kt===null),Kt=(xe&(Ia|fo))===0?v:null,Mr=null,Hp(v.ctx),Nn=!1,hu++,v.f|=jh;try{var ke=(0,v.fn)(),Ve=v.deps;if(Cr!==null){var Ce;if(fu(v,Kr),Ve!==null&&Kr>0)for(Ve.length=Kr+Cr.length,Ce=0;Ce<Cr.length;Ce++)Ve[Kr+Ce]=Cr[Ce];else v.deps=Ve=Cr;if(!ka)for(Ce=Kr;Ce<Ve.length;Ce++)((ue=Ve[Ce]).reactions??(ue.reactions=[])).push(v)}else Ve!==null&&Kr<Ve.length&&(fu(v,Kr),Ve.length=Kr);if(Xp()&&fn!==null&&!Nn&&Ve!==null&&(v.f&(Sn|ys|Ea))===0)for(Ce=0;Ce<fn.length;Ce++)vf(fn[Ce],v);return D!==null&&D!==v&&(hu++,fn!==null&&(z===null?z=fn:z.push(...fn))),ke}finally{Cr=g,Kr=w,fn=z,Kt=D,ka=F,Mr=P,Hp(o),Nn=fe,v.f^=jh}}function P_(v,g){let w=g.reactions;if(w!==null){var z=Xc.call(w,v);if(z!==-1){var D=w.length-1;D===0?w=g.reactions=null:(w[z]=w[D],w.pop())}}w===null&&(g.f&Sn)!==0&&(Cr===null||!Cr.includes(g))&&(Zn(g,ys),(g.f&(Xr|Jc))===0&&(g.f^=Jc),Jp(g),fu(g,0))}function fu(v,g){var w=v.deps;if(w!==null)for(var z=g;z<w.length;z++)P_(v,w[z])}function Gh(v){var g=v.f;if((g&eu)===0){Zn(v,dn);var w=di,z=Or,D=vs;di=v,vs=!0;try{(g&Oh)!==0?y_(v):hf(v),uf(v);var F=bf(v);v.teardown=typeof F=="function"?F:null,v.wv=_f;var P=v.deps,o}catch(fe){pu(fe,v,w,z||v.ctx)}finally{vs=D,di=w}}}function M_(){try{t_()}catch(v){if(cu!==null)pu(v,cu,null);else throw v}}function C_(){var v=vs;try{var g=0;for(vs=!0;uu.length>0;){g++>1e3&&M_();var w=uu,z=w.length;uu=[];for(var D=0;D<z;D++){var F=E_(w[D]);I_(F)}Pl.clear()}}finally{$h=!1,vs=v,cu=null}}function I_(v){var g=v.length;if(g!==0)for(var w=0;w<g;w++){var z=v[w];if((z.f&(eu|Qc))===0)try{du(z)&&(Gh(z),z.deps===null&&z.first===null&&z.nodes_start===null&&(z.teardown===null?df(z):z.fn=null))}catch(D){pu(D,z,null,z.ctx)}}}function qh(v){$h||($h=!0,queueMicrotask(C_));for(var g=cu=v;g.parent!==null;){g=g.parent;var w=g.f;if((w&(fo|Ia))!==0){if((w&dn)===0)return;g.f^=dn}}uu.push(g)}function E_(v){for(var g=[],w=v;w!==null;){var z=w.f,D=(z&(Ia|fo))!==0,F=D&&(z&dn)!==0;if(!F&&(z&Qc)===0){if((z&$p)!==0)g.push(w);else if(D)w.f^=dn;else try{du(w)&&Gh(w)}catch(fe){pu(fe,w,null,w.ctx)}var P=w.first;if(P!==null){w=P;continue}}var o=w.parent;for(w=w.next;w===null&&o!==null;)w=o.next,o=o.parent}return g}function dt(v){var g=v.f,w=(g&Sn)!==0;if(Kt!==null&&!Nn){if(!(Mr!=null&&Mr.includes(v))){var z=Kt.deps;v.rv<hu&&(v.rv=hu,Cr===null&&z!==null&&z[Kr]===v?Kr++:Cr===null?Cr=[v]:(!ka||!Cr.includes(v))&&Cr.push(v))}}else if(w&&v.deps===null&&v.effects===null){var D=v,F=D.parent;F!==null&&(F.f&Xr)===0&&(D.f^=Xr)}return w&&(D=v,du(D)&&ef(D)),go&&Pl.has(v)?Pl.get(v):v.v}function Wh(v){var g=Nn;try{return Nn=!0,v()}finally{Nn=g}}const z_=-7169;function Zn(v,g){v.f=v.f&z_|g}const A_=["touchstart","touchmove"];function k_(v){return A_.includes(v)}function R_(v){var g=Kt,w=di;Vn(null),Aa(null);try{return v()}finally{Vn(g),Aa(w)}}const D_=new Set,wf=new Set;function L_(v,g,w,z={}){function D(F){if(z.capture||Ml.call(g,F),!F.cancelBubble)return R_(()=>w==null?void 0:w.call(this,F))}return v.startsWith("pointer")||v.startsWith("touch")||v==="wheel"?ff(()=>{g.addEventListener(v,D,z)}):g.addEventListener(v,D,z),D}function B_(v,g,w,z,D){var F={capture:z,passive:D},P=L_(v,g,w,F);(g===document.body||g===window||g===document||g instanceof HTMLMediaElement)&&lf(()=>{g.removeEventListener(v,P,F)})}function Ml(v){var pi;var g=this,w=g.ownerDocument,z=v.type,D=((pi=v.composedPath)==null?void 0:pi.call(v))||[],F=D[0]||v.target,P=0,o=v.__root;if(o){var fe=D.indexOf(o);if(fe!==-1&&(g===document||g===window)){v.__root=g;return}var xe=D.indexOf(g);if(xe===-1)return;fe<=xe&&(P=fe)}if(F=D[P]||v.target,F!==g){qg(v,"currentTarget",{configurable:!0,get(){return F||w}});var ke=Kt,Ve=di;Vn(null),Aa(null);try{for(var Ce,ue=[];F!==null;){var Ue=F.assignedSlot||F.parentNode||F.host||null;try{var Vt=F["__"+z];if(Vt!=null&&(!F.disabled||v.target===F))if(Si(Vt)){var[wt,...Pi]=Vt;wt.apply(F,[v,...Pi])}else Vt.call(F,v)}catch(Vi){Ce?ue.push(Vi):Ce=Vi}if(v.cancelBubble||Ue===g||Ue===null)break;F=Ue}if(Ce){for(let Vi of ue)queueMicrotask(()=>{throw Vi});throw Ce}}finally{v.__root=g,delete v.currentTarget,Vn(ke),Aa(Ve)}}}function F_(v){var g=document.createElement("template");return g.innerHTML=v.replaceAll("<!>","<!---->"),g.content}function O_(v,g){var w=di;w.nodes_start===null&&(w.nodes_start=v,w.nodes_end=g)}function Hh(v,g){var w=(g&a_)!==0,z,D=!v.startsWith("<!>");return()=>{z===void 0&&(z=F_(D?v:"<!>"+v),z=sf(z));var F=w||rf?document.importNode(z,!0):z.cloneNode(!0);return O_(F,F),F}}function Xh(v,g){v!==null&&v.before(g)}function Yh(v,g){return j_(v,g)}const _o=new Map;function j_(v,{target:g,anchor:w,props:z={},events:D,context:F,intro:P=!0}){u_();var o=new Set,fe=Ve=>{for(var Ce=0;Ce<Ve.length;Ce++){var ue=Ve[Ce];if(!o.has(ue)){o.add(ue);var Ue=k_(ue);g.addEventListener(ue,Ml,{passive:Ue});var Vt=_o.get(ue);Vt===void 0?(document.addEventListener(ue,Ml,{passive:Ue}),_o.set(ue,1)):_o.set(ue,Vt+1)}}};fe(Gg(D_)),wf.add(fe);var xe=void 0,ke=m_(()=>{var Ve=w??g.appendChild(h_());return __(()=>{if(F){ru({});var Ce=Or;Ce.c=F}D&&(z.$$events=D),xe=v(Ve,z)||{},F&&nu()}),()=>{var Ue;for(var Ce of o){g.removeEventListener(Ce,Ml);var ue=_o.get(Ce);--ue===0?(document.removeEventListener(Ce,Ml),_o.delete(Ce)):_o.set(Ce,ue)}wf.delete(fe),Ve!==w&&((Ue=Ve.parentNode)==null||Ue.removeChild(Ve))}});return Kh.set(xe,ke),xe}let Kh=new WeakMap;function N_(v,g){const w=Kh.get(v);return w?(Kh.delete(v),w(g)):Promise.resolve()}const Tf=[...`
2
- \r\f \v\uFEFF`];function V_(v,g,w){var z=v==null?"":""+v;if(w){for(var D in w)if(w[D])z=z?z+" "+D:D;else if(z.length)for(var F=D.length,P=0;(P=z.indexOf(D,P))>=0;){var o=P+F;(P===0||Tf.includes(z[P-1]))&&(o===z.length||Tf.includes(z[o]))?z=(P===0?"":z.substring(0,P))+z.substring(o+1):P=o}}return z===""?null:z}function Sf(v,g=!1){var w=g?" !important;":";",z="";for(var D in v){var F=v[D];F!=null&&F!==""&&(z+=" "+D+": "+F+w)}return z}function Jh(v){return v[0]!=="-"||v[1]!=="-"?v.toLowerCase():v}function Z_(v,g){if(g){var w="",z,D;if(Array.isArray(g)?(z=g[0],D=g[1]):z=g,v){v=String(v).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var F=!1,P=0,o=!1,fe=[];z&&fe.push(...Object.keys(z).map(Jh)),D&&fe.push(...Object.keys(D).map(Jh));var xe=0,ke=-1;const Vt=v.length;for(var Ve=0;Ve<Vt;Ve++){var Ce=v[Ve];if(o?Ce==="/"&&v[Ve-1]==="*"&&(o=!1):F?F===Ce&&(F=!1):Ce==="/"&&v[Ve+1]==="*"?o=!0:Ce==='"'||Ce==="'"?F=Ce:Ce==="("?P++:Ce===")"&&P--,!o&&F===!1&&P===0){if(Ce===":"&&ke===-1)ke=Ve;else if(Ce===";"||Ve===Vt-1){if(ke!==-1){var ue=Jh(v.substring(xe,ke).trim());if(!fe.includes(ue)){Ce!==";"&&Ve++;var Ue=v.substring(xe,Ve).trim();w+=" "+Ue+";"}}xe=Ve+1,ke=-1}}}}return z&&(w+=Sf(z)),D&&(w+=Sf(D,!0)),w=w.trim(),w===""?null:w}return v==null?null:String(v)}function Pf(v,g,w,z,D,F){var P=v.__className;if(P!==w||P===void 0){var o=V_(w,z,F);o==null?v.removeAttribute("class"):v.className=o,v.__className=w}else if(F&&D!==F)for(var fe in F){var xe=!!F[fe];(D==null||xe!==!!D[fe])&&v.classList.toggle(fe,xe)}return F}function Qh(v,g={},w,z){for(var D in w){var F=w[D];g[D]!==F&&(w[D]==null?v.style.removeProperty(D):v.style.setProperty(D,F,z))}}function ed(v,g,w,z){var D=v.__style;if(D!==g){var F=Z_(g,z);F==null?v.removeAttribute("style"):v.style.cssText=F,v.__style=g}else z&&(Array.isArray(z)?(Qh(v,w==null?void 0:w[0],z[0]),Qh(v,w==null?void 0:w[1],z[1],"important")):Qh(v,w,z));return z}const U_=()=>performance.now(),Un={tick:v=>requestAnimationFrame(v),now:()=>U_(),tasks:new Set};function Mf(){const v=Un.now();Un.tasks.forEach(g=>{g.c(v)||(Un.tasks.delete(g),g.f())}),Un.tasks.size!==0&&Un.tick(Mf)}function $_(v){let g;return Un.tasks.size===0&&Un.tick(Mf),{promise:new Promise(w=>{Un.tasks.add(g={c:v,f:w})}),abort(){Un.tasks.delete(g)}}}const Mu=class Mu{constructor(g){Ca(this,Pu);Ca(this,ja,new WeakMap);Ca(this,Mo);Ca(this,Ll);Hc(this,Ll,g)}observe(g,w){var z=Ti(this,ja).get(g)||new Set;return z.add(w),Ti(this,ja).set(g,z),Zg(this,Pu,Ug).call(this).observe(g,Ti(this,Ll)),()=>{var D=Ti(this,ja).get(g);D.delete(w),D.size===0&&(Ti(this,ja).delete(g),Ti(this,Mo).unobserve(g))}}};ja=new WeakMap,Mo=new WeakMap,Ll=new WeakMap,Pu=new WeakSet,Ug=function(){return Ti(this,Mo)??Hc(this,Mo,new ResizeObserver(g=>{for(var w of g){Mu.entries.set(w.target,w);for(var z of Ti(this,ja).get(w.target)||[])z(w)}}))},kt(Mu,"entries",new WeakMap);let td=Mu;var G_=new td({box:"border-box"});function Cf(v,g,w){var z=G_.observe(v,()=>w(v[g]));su(()=>(Wh(()=>w(v[g])),z))}function If(v,g){return v===g||(v==null?void 0:v[tu])===g}function bs(v={},g,w,z){return su(()=>{var D,F;return cf(()=>{D=F,F=[],Wh(()=>{v!==w(...F)&&(g(v,...F),D&&If(w(...D),v)&&g(null,...D))})}),()=>{ff(()=>{F&&If(w(...F),v)&&g(null,...F)})}}),v}function Ef(v){Or===null&&o_(),pn(()=>{const g=Wh(v);if(typeof g=="function")return g})}const q_="5";typeof window<"u"&&((em=window.__svelte??(window.__svelte={})).v??(em.v=new Set)).add(q_);function W_(v){return v}function id(v){return-.5*(Math.cos(Math.PI*v)-1)}function H_(v){const g=Math.cos(v*Math.PI*.5);return Math.abs(g)<1e-14?1:1-g}function X_(v){return Math.sin(v*Math.PI/2)}const Y_=128,K_=0,rd=1,J_=2;class Q_{constructor(){kt(this,"animationsStarted",!1);kt(this,"animationsCount",0);kt(this,"animationsLimit",Y_);kt(this,"layers",new Array)}start(){window.requestAnimationFrame(this.tick.bind(this))}tick(){try{this.animationsCount=0;for(let g=0;g<this.layers.length;g++){const w=this.layers[g];if(w==null)continue;const z=w.animations;if(z!=null)for(let D=0;D<z.length;D++){const F=z[D];if(F!=null){for(const P of F.values())if(!P.executed&&(P.executed=!0,P.function(),this.animationsCount++,this.animationsCount==this.animationsLimit))return}}}}finally{window.requestAnimationFrame(this.tick.bind(this))}}equeue(g,w,z,D){let F=this.layers[g];F==null&&(F=this.layers[g]={animations:new Array});let P=F.animations[w];P==null&&(P=F.animations[w]=new Map);let o={id:z,priority:w,executed:!1,function:D};P.set(z,o),this.animationsStarted==!1&&(this.animationsStarted=!0,this.start())}clear(g,w){for(let z=0;z<this.layers.length;z++){let D=this.layers[z];if(D==null)continue;let F=D.animations[g];if(F==null)return;let P=F.get(w);if(P==null||P.executed==!1)return;F.delete(w)}}speed(){return Math.pow(2,2*this.animationsCount/this.animationsLimit)}stacked(){return this.animationsCount==this.animationsLimit}setLimit(g){this.animationsLimit=g}}const oa=new Q_;function zf(v){return Object.prototype.toString.call(v)==="[object Date]"}function nd(v,g){if(v===g||v!==v)return()=>v;const w=typeof v;if(w!==typeof g||Array.isArray(v)!==Array.isArray(g))throw new Error("Cannot interpolate values of different type");if(Array.isArray(v)){const z=g.map((D,F)=>nd(v[F],D));return D=>z.map(F=>F(D))}if(w==="object"){if(!v||!g)throw new Error("Object cannot be null");if(zf(v)&&zf(g)){const F=v.getTime(),o=g.getTime()-F;return fe=>new Date(F+fe*o)}const z=Object.keys(g),D={};return z.forEach(F=>{D[F]=nd(v[F],g[F])}),F=>{const P={};return z.forEach(o=>{P[o]=D[o](F)}),P}}if(w==="number"){const z=g-v;return D=>v+D*z}return()=>g}const Td=class Td{constructor(g,w={}){Ca(this,ca,Vh(void 0));Ca(this,Co,Vh(void 0));Ca(this,Bl);Ca(this,ws,null);Ti(this,ca).v=Ti(this,Co).v=g,Hc(this,Bl,w)}static of(g,w){const z=new Td(g(),w);return cf(()=>{z.set(g())}),z}set(g,w){var Ve;mi(Ti(this,Co),g);let{delay:z=0,duration:D=400,easing:F=W_,interpolate:P=nd}={...Ti(this,Bl),...w};if(D===0)return(Ve=Ti(this,ws))==null||Ve.abort(),mi(Ti(this,ca),g),Promise.resolve();const o=Un.now()+z;let fe,xe=!1,ke=Ti(this,ws);return Hc(this,ws,$_(Ce=>{if(Ce<o)return!0;if(!xe){xe=!0;const Ue=Ti(this,ca).v;fe=P(Ue,g),typeof D=="function"&&(D=D(Ue,g)),ke==null||ke.abort()}const ue=Ce-o;return ue>D?(mi(Ti(this,ca),g),!1):(mi(Ti(this,ca),fe(F(ue/D))),!0)})),Ti(this,ws).promise}get current(){return dt(Ti(this,ca))}get target(){return dt(Ti(this,Co))}set target(g){this.set(g)}};ca=new WeakMap,Co=new WeakMap,Bl=new WeakMap,ws=new WeakMap;let ad=Td;class mu{constructor(g,w){kt(this,"value");kt(this,"motion");this.value=g,this.motion=new ad(g,w)}set(g,w){this.value=g,this.motion.set(g,w)}update(g){this.motion.set(this.value,g)}snap(){this.motion.set(this.value,{duration:0})}}function Af(v,g,w){const z=w*(Math.PI/180),D=v/2,F=g/2,P=Math.sqrt(D*D+F*F),o=Math.atan(F/D)*(180/Math.PI),fe=o,xe=180-o,ke=180+o,Ve=360-o;switch(!0){case(fe<=w&&w<=xe):return{offsetX:P*Math.cos(z)-D,offsetY:0};case(xe<=w&&w<=ke):return{offsetX:-v,offsetY:P*Math.sin(z)-F};case(ke<=w&&w<=Ve):return{offsetX:P*Math.cos(z)-D,offsetY:-g};default:return{offsetX:0,offsetY:P*Math.sin(z)-F}}}const kf=512,sd=0,Cl=18,gu=10,ey=1e6,ty=2,iy=128,ry=270,od=8;var _u;(v=>{v.COUNT=12,v.DEFAULT=ry,v.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330]})(_u||(_u={}));var ny=Hh('<div><div class="pin svelte-1q5zkd1"></div> <div class="marker svelte-1q5zkd1"><div class="body svelte-1q5zkd1"></div></div></div>');function ay(v,g){ru(g,!0);let w,z,D,F;const P=g.width+2*od,o=g.height+2*od,fe=()=>F;pn(()=>{D.style.width=`${Math.min(P,o)/4}px`,D.style.height=`${Math.min(P,o)/4}px`});let xe=Qi(!0);function ke(It){mi(xe,It,!0)}function Ve(){return dt(xe)}let Ce=Qi(!0);function ue(It){mi(Ce,It,!0)}function Ue(){return wt.motion.current==0}function Vt(){return dt(Ce)==!1}let wt=new mu(0),Pi=rd;pn(()=>{pi(wt.motion.current)}),pn(()=>{dt(xe)==!1&&(wt.snap(),oa.clear(g.priority,g.id+"_scale"))}),pn(()=>{dt(Ce)==!0&&wt.value!=0&&(Pi=K_,oa.stacked()?wt.set(0,{duration:0}):wt.set(0,{duration:150,easing:H_})),dt(Ce)==!1&&wt.value!=1&&(Pi=rd,wt.set(1,{duration:150,easing:X_}))});function pi(It){!w||!z||!D||oa.equeue(Pi,g.priority,g.id+"_scale",()=>{w.style.opacity=`${It}`,z.style.scale=`${It}`,D.style.scale=`${It}`})}let Vi=NaN,li=Qi(!1),Et=new mu(-P/2,{easing:id}),Ft=new mu(-o/2,{easing:id});pn(()=>{or(Et.motion.current,Ft.motion.current)}),pn(()=>{dt(xe)==!1&&(Et.snap(),Et.snap(),oa.clear(g.priority,g.id+"_angle"))}),pn(()=>{dt(Ce)==!0&&dt(li)&&(Et.update({duration:75}),Et.update({duration:75}))});function or(It,Jt){if(!w||!z||!D)return;const cr=It+P/2,tr=Jt+o/2,Ir=o<P?cr*o/P:cr,gi=o>P?tr*P/o:tr,ur=Math.atan2(gi,Ir)/Math.PI*180-45,Ui=0,Zr=30,Er=Math.sqrt(cr*cr+tr*tr),xr=Math.min(P,o)/2,Mn=Math.sqrt(P*P+o*o)/2,zt=(Er-xr)/(Mn-xr),$i=Ui+zt*(Zr-Ui),_i=Er<xr?Er/xr:1;oa.equeue(rd,g.priority,g.id+"_angle",()=>{z.style.transform=`translate(${Math.round(It)}px, ${Math.round(Jt)}px)`,D.style.transform=`scale(${_i}) rotate(${ur}deg) skew(${$i}deg, ${$i}deg)`})}function Pn(It){if(dt(li)==!1){let Jt=Af(P,o,It);Et.set(Math.round(Jt.offsetX),{duration:0}),Ft.set(Math.round(Jt.offsetY),{duration:0}),or(Et.value,Ft.value),Vi=It,mi(li,!0)}else if(It!=Vi){let Jt=Math.abs(It-Vi),cr=Jt<180?Jt:360-Jt,tr=Math.log(cr)*75,Ir=Af(P,o,It);Et.set(Math.round(Ir.offsetX),{duration:dt(li)?tr:0}),Ft.set(Math.round(Ir.offsetY),{duration:dt(li)?tr:0}),Vi=It}}var Qr=ny();let Nr;var en=au(Qr);bs(en,It=>D=It,()=>D);var yr=d_(en,2);let Zi;var Vr=au(yr);let lr;return bs(Vr,It=>F=It,()=>F),bs(yr,It=>z=It,()=>z),bs(Qr,It=>w=It,()=>w),Uh(It=>{Nr=Pf(Qr,1,"anchor svelte-1q5zkd1",null,Nr,It),Zi=ed(yr,"",Zi,{padding:od+"px"}),lr=ed(Vr,"",lr,{width:`${g.width}px`,height:`${g.height}px`})},[()=>({displayed:dt(xe)})]),Xh(v,Qr),nu({getBody:fe,setDisplayed:ke,getDisplayed:Ve,setCollapsed:ue,getCollapsed:Ue,getExpanded:Vt,setAngle:Pn})}var sy=Hh('<div><div class="body svelte-piqgmq"></div></div>');function oy(v,g){ru(g,!0);let w,z;function D(){return z}let F=Qi(!1);function P(wt){mi(F,wt,!0)}function o(){return dt(F)}let fe=new mu(0,{easing:id});pn(()=>{xe(fe.motion.current)}),pn(()=>{dt(F)==!1&&(fe.snap(),oa.clear(g.priority,g.id))});function xe(wt){w&&oa.equeue(J_,g.priority,g.id,()=>{w.style.scale=wt.toString(),w.style.filter=`brightness(${.25+.75*wt})`,z.style.opacity=wt.toString()})}function ke(wt){wt!=fe.value&&fe.set(wt,{duration:75})}function Ve(){return fe.motion.current==0}function Ce(){return fe.value}var ue=sy();let Ue;var Vt=au(ue);return bs(Vt,wt=>z=wt,()=>z),bs(ue,wt=>w=wt,()=>w),Uh(wt=>Ue=Pf(ue,1,"circle svelte-piqgmq",null,Ue,wt),[()=>({displayed:dt(F)})]),Xh(v,ue),nu({getBody:D,setDisplayed:P,getDisplayed:o,setScale:ke,getCollapsed:Ve,getScale:Ce})}async function yo(v,g){try{await fetch("https://arenarium.dev/api/public/v1/log?log="+encodeURIComponent(JSON.stringify({title:v,content:g})))}catch(w){console.error(w)}}function ly(v){return v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v.default:v}var yu={exports:{}};/**
3
- * MapLibre GL JS
4
- * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.6.0/LICENSE.txt
5
- */var cy=yu.exports,Rf;function uy(){return Rf||(Rf=1,function(v,g){(function(w,z){v.exports=z()})(cy,function(){var w={},z={};function D(P,o,fe){if(z[P]=fe,P==="index"){var xe="var sharedModule = {}; ("+z.shared+")(sharedModule); ("+z.worker+")(sharedModule);",ke={};return z.shared(ke),z.index(w,ke),typeof window<"u"&&w.setWorkerUrl(window.URL.createObjectURL(new Blob([xe],{type:"text/javascript"}))),w}}D("shared",["exports"],function(P){function o(n,t,r,a){return new(r||(r=Promise))(function(c,d){function p(b){try{y(a.next(b))}catch(S){d(S)}}function m(b){try{y(a.throw(b))}catch(S){d(S)}}function y(b){var S;b.done?c(b.value):(S=b.value,S instanceof r?S:new r(function(C){C(S)})).then(p,m)}y((a=a.apply(n,t||[])).next())})}function fe(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var xe,ke;function Ve(){if(ke)return xe;function n(t,r){this.x=t,this.y=r}return ke=1,xe=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,r){return this.clone()._rotateAround(t,r)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var r=t.x-this.x,a=t.y-this.y;return r*r+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,r){return Math.atan2(this.x*r-this.y*t,this.x*t+this.y*r)},_matMult:function(t){var r=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var r=Math.cos(t),a=Math.sin(t),c=a*this.x+r*this.y;return this.x=r*this.x-a*this.y,this.y=c,this},_rotateAround:function(t,r){var a=Math.cos(t),c=Math.sin(t),d=r.y+c*(this.x-r.x)+a*(this.y-r.y);return this.x=r.x+a*(this.x-r.x)-c*(this.y-r.y),this.y=d,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t},xe}typeof SuppressedError=="function"&&SuppressedError;var Ce,ue,Ue=fe(Ve()),Vt=function(){if(ue)return Ce;function n(t,r,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(c-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=a,this.p2y=c}return ue=1,Ce=n,n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var a=t,c=0;c<8;c++){var d=this.sampleCurveX(a)-t;if(Math.abs(d)<r)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var m=0,y=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<r));c++)t>d?m=a:y=a,a=.5*(y-m)+m;return a},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},Ce}(),wt=fe(Vt);let Pi,pi;function Vi(){return Pi==null&&(Pi=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Pi}function li(){if(pi==null&&(pi=!1,Vi())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let a=0;a<5*5;a++){const c=4*a;t.fillStyle=`rgb(${c},${c+1},${c+2})`,t.fillRect(a%5,Math.floor(a/5),1,1)}const r=t.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&r[a]!==a){pi=!0;break}}}return pi||!1}var Et=1e-6,Ft=typeof Float32Array<"u"?Float32Array:Array;function or(){var n=new Ft(9);return Ft!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[5]=0,n[6]=0,n[7]=0),n[0]=1,n[4]=1,n[8]=1,n}function Pn(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function Qr(){var n=new Ft(3);return Ft!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function Nr(n){return Math.hypot(n[0],n[1],n[2])}function en(n,t,r){var a=new Ft(3);return a[0]=n,a[1]=t,a[2]=r,a}function yr(n,t,r){return n[0]=t[0]+r[0],n[1]=t[1]+r[1],n[2]=t[2]+r[2],n}function Zi(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n[2]=t[2]*r,n}function Vr(n,t,r){var a=t[0],c=t[1],d=t[2],p=r[0],m=r[1],y=r[2];return n[0]=c*y-d*m,n[1]=d*p-a*y,n[2]=a*m-c*p,n}Math.hypot||(Math.hypot=function(){for(var n=0,t=arguments.length;t--;)n+=arguments[t]*arguments[t];return Math.sqrt(n)});var lr,It=Nr;function Jt(n,t,r){var a=t[0],c=t[1],d=t[2],p=t[3];return n[0]=r[0]*a+r[4]*c+r[8]*d+r[12]*p,n[1]=r[1]*a+r[5]*c+r[9]*d+r[13]*p,n[2]=r[2]*a+r[6]*c+r[10]*d+r[14]*p,n[3]=r[3]*a+r[7]*c+r[11]*d+r[15]*p,n}function cr(){var n=new Ft(4);return Ft!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n[3]=1,n}function tr(n,t,r,a){var c=.5*Math.PI/180;t*=c,r*=c,a*=c;var d=Math.sin(t),p=Math.cos(t),m=Math.sin(r),y=Math.cos(r),b=Math.sin(a),S=Math.cos(a);return n[0]=d*y*S-p*m*b,n[1]=p*m*S+d*y*b,n[2]=p*y*b-d*m*S,n[3]=p*y*S+d*m*b,n}function Ir(){var n=new Ft(2);return Ft!=Float32Array&&(n[0]=0,n[1]=0),n}function gi(n,t){var r=new Ft(2);return r[0]=n,r[1]=t,r}Qr(),lr=new Ft(4),Ft!=Float32Array&&(lr[0]=0,lr[1]=0,lr[2]=0,lr[3]=0),Qr(),en(1,0,0),en(0,1,0),cr(),cr(),or(),Ir();const Rt=8192;function ur(n,t,r){return t*(Rt/(n.tileSize*Math.pow(2,r-n.tileID.overscaledZ)))}function Ui(n,t){return(n%t+t)%t}function Zr(n,t,r){return n*(1-r)+t*r}function Er(n){if(n<=0)return 0;if(n>=1)return 1;const t=n*n,r=t*n;return 4*(n<.5?r:3*(n-t)+r-.75)}function xr(n,t,r,a){const c=new wt(n,t,r,a);return d=>c.solve(d)}const Mn=xr(.25,.1,.25,1);function zt(n,t,r){return Math.min(r,Math.max(t,n))}function $i(n,t,r){const a=r-t,c=((n-t)%a+a)%a+t;return c===t?r:c}function _i(n,...t){for(const r of t)for(const a in r)n[a]=r[a];return n}let Gn=1;function Wt(n,t,r){const a={};for(const c in n)a[c]=t.call(this,n[c],c,n);return a}function zr(n,t,r){const a={};for(const c in n)t.call(this,n[c],c,n)&&(a[c]=n[c]);return a}function vr(n){return Array.isArray(n)?n.map(vr):typeof n=="object"&&n?Wt(n,vr):n}const qn={};function Mi(n){qn[n]||(typeof console<"u"&&console.warn(n),qn[n]=!0)}function hr(n,t,r){return(r.y-n.y)*(t.x-n.x)>(t.y-n.y)*(r.x-n.x)}function ir(n){return typeof WorkerGlobalScope<"u"&&n!==void 0&&n instanceof WorkerGlobalScope}let Cn=null;function gn(n){return typeof ImageBitmap<"u"&&n instanceof ImageBitmap}const ua="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function tn(n,t,r,a,c){return o(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(n,{timestamp:0});try{const p=d==null?void 0:d.format;if(!p||!p.startsWith("BGR")&&!p.startsWith("RGB"))throw new Error(`Unrecognized format ${p}`);const m=p.startsWith("BGR"),y=new Uint8ClampedArray(a*c*4);if(yield d.copyTo(y,function(b,S,C,A,L){const B=4*Math.max(1,0),j=(Math.max(0,C)-C)*A*4+B,U=4*A,H=Math.max(0,S),se=Math.max(0,C);return{rect:{x:H,y:se,width:Math.min(b.width,S+A)-H,height:Math.min(b.height,C+L)-se},layout:[{offset:j,stride:U}]}}(n,t,r,a,c)),m)for(let b=0;b<y.length;b+=4){const S=y[b];y[b]=y[b+2],y[b+2]=S}return y}finally{d.close()}})}let Ar,Ae;function Oe(n,t,r,a){return n.addEventListener(t,r,a),{unsubscribe:()=>{n.removeEventListener(t,r,a)}}}function Le(n){return n*Math.PI/180}function Je(n){return n/Math.PI*180}const ei={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},rn={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},Ur="AbortError";function he(){return new Error(Ur)}const N={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function V(n){return N.REGISTERED_PROTOCOLS[n.substring(0,n.indexOf("://"))]}const $="global-dispatcher";class J extends Error{constructor(t,r,a,c){super(`AJAXError: ${r} (${t}): ${a}`),this.status=t,this.statusText=r,this.url=a,this.body=c}}const re=()=>ir(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,oe=function(n,t){if(/:\/\//.test(n.url)&&!/^https?:|^file:/.test(n.url)){const a=V(n.url);if(a)return a(n,t);if(ir(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,targetMapId:$},t)}if(!(/^file:/.test(r=n.url)||/^file:/.test(re())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(a,c){return o(this,void 0,void 0,function*(){const d=new Request(a.url,{method:a.method||"GET",body:a.body,credentials:a.credentials,headers:a.headers,cache:a.cache,referrer:re(),signal:c.signal});let p,m;a.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");try{p=yield fetch(d)}catch(b){throw new J(0,b.message,a.url,new Blob)}if(!p.ok){const b=yield p.blob();throw new J(p.status,p.statusText,a.url,b)}m=a.type==="arrayBuffer"||a.type==="image"?p.arrayBuffer():a.type==="json"?p.json():p.text();const y=yield m;if(c.signal.aborted)throw he();return{data:y,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(n,t);if(ir(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,mustQueue:!0,targetMapId:$},t)}var r;return function(a,c){return new Promise((d,p)=>{var m;const y=new XMLHttpRequest;y.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(y.responseType="arraybuffer");for(const b in a.headers)y.setRequestHeader(b,a.headers[b]);a.type==="json"&&(y.responseType="text",!((m=a.headers)===null||m===void 0)&&m.Accept||y.setRequestHeader("Accept","application/json")),y.withCredentials=a.credentials==="include",y.onerror=()=>{p(new Error(y.statusText))},y.onload=()=>{if(!c.signal.aborted)if((y.status>=200&&y.status<300||y.status===0)&&y.response!==null){let b=y.response;if(a.type==="json")try{b=JSON.parse(y.response)}catch(S){return void p(S)}d({data:b,cacheControl:y.getResponseHeader("Cache-Control"),expires:y.getResponseHeader("Expires")})}else{const b=new Blob([y.response],{type:y.getResponseHeader("Content-Type")});p(new J(y.status,y.statusText,a.url,b))}},c.signal.addEventListener("abort",()=>{y.abort(),p(he())}),y.send(a.body)})}(n,t)};function _e(n){if(!n||n.indexOf("://")<=0||n.indexOf("data:image/")===0||n.indexOf("blob:")===0)return!0;const t=new URL(n),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function ce(n,t,r){r[n]&&r[n].indexOf(t)!==-1||(r[n]=r[n]||[],r[n].push(t))}function Se(n,t,r){if(r&&r[n]){const a=r[n].indexOf(t);a!==-1&&r[n].splice(a,1)}}class we{constructor(t,r={}){_i(this,r),this.type=t}}class de extends we{constructor(t,r={}){super("error",_i({error:t},r))}}class Me{on(t,r){return this._listeners=this._listeners||{},ce(t,r,this._listeners),{unsubscribe:()=>{this.off(t,r)}}}off(t,r){return Se(t,r,this._listeners),Se(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},ce(t,r,this._oneTimeListeners),this):new Promise(a=>this.once(t,a))}fire(t,r){typeof t=="string"&&(t=new we(t,r||{}));const a=t.type;if(this.listens(a)){t.target=this;const c=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const m of c)m.call(this,t);const d=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const m of d)Se(a,m,this._oneTimeListeners),m.call(this,t);const p=this._eventedParent;p&&(_i(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(t))}else t instanceof de&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var ae={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},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_color-relief","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"}},"layout_color-relief":{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_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},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 $e=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function at(n,t){const r={};for(const a in n)a!=="ref"&&(r[a]=n[a]);return $e.forEach(a=>{a in t&&(r[a]=t[a])}),r}function qe(n,t){if(Array.isArray(n)){if(!Array.isArray(t)||n.length!==t.length)return!1;for(let r=0;r<n.length;r++)if(!qe(n[r],t[r]))return!1;return!0}if(typeof n=="object"&&n!==null&&t!==null){if(typeof t!="object"||Object.keys(n).length!==Object.keys(t).length)return!1;for(const r in n)if(!qe(n[r],t[r]))return!1;return!0}return n===t}function et(n,t){n.push(t)}function lt(n,t,r){et(r,{command:"addSource",args:[n,t[n]]})}function qt(n,t,r){et(t,{command:"removeSource",args:[n]}),r[n]=!0}function Ot(n,t,r,a){qt(n,r,a),lt(n,t,r)}function At(n,t,r){let a;for(a in n[r])if(Object.prototype.hasOwnProperty.call(n[r],a)&&a!=="data"&&!qe(n[r][a],t[r][a]))return!1;for(a in t[r])if(Object.prototype.hasOwnProperty.call(t[r],a)&&a!=="data"&&!qe(n[r][a],t[r][a]))return!1;return!0}function ot(n,t,r,a,c,d){n=n||{},t=t||{};for(const p in n)Object.prototype.hasOwnProperty.call(n,p)&&(qe(n[p],t[p])||r.push({command:d,args:[a,p,t[p],c]}));for(const p in t)Object.prototype.hasOwnProperty.call(t,p)&&!Object.prototype.hasOwnProperty.call(n,p)&&(qe(n[p],t[p])||r.push({command:d,args:[a,p,t[p],c]}))}function St(n){return n.id}function Ai(n,t){return n[t.id]=t,n}class Be{constructor(t,r,a,c){this.message=(t?`${t}: `:"")+a,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Gi(n,...t){for(const r of t)for(const a in r)n[a]=r[a];return n}class ti extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class Wn{constructor(t,r=[]){this.parent=t,this.bindings={};for(const[a,c]of r)this.bindings[a]=c}concat(t){return new Wn(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 ha={kind:"null"},Ne={kind:"number"},mt={kind:"string"},gt={kind:"boolean"},kr={kind:"color"},Io={kind:"projectionDefinition"},_n={kind:"object"},_t={kind:"value"},In={kind:"collator"},da={kind:"formatted"},yi={kind:"padding"},Ts={kind:"colorArray"},Ss={kind:"numberArray"},En={kind:"resolvedImage"},Ps={kind:"variableAnchorOffsetCollection"};function Rr(n,t){return{kind:"array",itemType:n,N:t}}function ii(n){if(n.kind==="array"){const t=ii(n.itemType);return typeof n.N=="number"?`array<${t}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${t}>`}return n.kind}const Cu=[ha,Ne,mt,gt,kr,Io,da,_n,Rr(_t),yi,Ss,Ts,En,Ps];function Ms(n,t){if(t.kind==="error")return null;if(n.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Ms(n.itemType,t.itemType))&&(typeof n.N!="number"||n.N===t.N))return null}else{if(n.kind===t.kind)return null;if(n.kind==="value"){for(const r of Cu)if(!Ms(r,t))return null}}return`Expected ${ii(n)} but found ${ii(t)} instead.`}function Eo(n,t){return t.some(r=>r.kind===n.kind)}function pa(n,t){return t.some(r=>r==="null"?n===null:r==="array"?Array.isArray(n):r==="object"?n&&!Array.isArray(n)&&typeof n=="object":r===typeof n)}function Hn(n,t){return n.kind==="array"&&t.kind==="array"?n.itemType.kind===t.itemType.kind&&typeof n.N=="number":n.kind===t.kind}const Iu=.96422,Eu=.82521,zu=4/29,Na=6/29,Au=3*Na*Na,ku=Na*Na*Na,Cs=Math.PI/180,Sd=180/Math.PI;function Ru(n){return(n%=360)<0&&(n+=360),n}function Va([n,t,r,a]){let c,d;const p=Ol((.2225045*(n=Fl(n))+.7168786*(t=Fl(t))+.0606169*(r=Fl(r)))/1);n===t&&t===r?c=d=p:(c=Ol((.4360747*n+.3850649*t+.1430804*r)/Iu),d=Ol((.0139322*n+.0971045*t+.7141733*r)/Eu));const m=116*p-16;return[m<0?0:m,500*(c-p),200*(p-d),a]}function Fl(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Ol(n){return n>ku?Math.pow(n,1/3):n/Au+zu}function Du([n,t,r,a]){let c=(n+16)/116,d=isNaN(t)?c:c+t/500,p=isNaN(r)?c:c-r/200;return c=1*Ao(c),d=Iu*Ao(d),p=Eu*Ao(p),[zo(3.1338561*d-1.6168667*c-.4906146*p),zo(-.9787684*d+1.9161415*c+.033454*p),zo(.0719453*d-.2289914*c+1.4052427*p),a]}function zo(n){return(n=n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055)<0?0:n>1?1:n}function Ao(n){return n>Na?n*n*n:Au*(n-zu)}const yn=Object.hasOwn||function(n,t){return Object.prototype.hasOwnProperty.call(n,t)};function yt(n,t){return yn(n,t)?n[t]:void 0}function zn(n){return parseInt(n.padEnd(2,n),16)/255}function An(n,t){return fa(t?n/100:n,0,1)}function fa(n,t,r){return Math.min(Math.max(t,n),r)}function jl(n){return!n.some(Number.isNaN)}const Nl={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 $r(n,t,r){return n+r*(t-n)}function kn(n,t,r){return n.map((a,c)=>$r(a,t[c],r))}class xt{constructor(t,r,a,c=1,d=!0){this.r=t,this.g=r,this.b=a,this.a=c,d||(this.r*=c,this.g*=c,this.b*=c,c||this.overwriteGetter("rgb",[t,r,a,c]))}static parse(t){if(t instanceof xt)return t;if(typeof t!="string")return;const r=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const c=yt(Nl,a);if(c){const[p,m,y]=c;return[p/255,m/255,y/255,1]}if(a.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(a)){const p=a.length<6?1:2;let m=1;return[zn(a.slice(m,m+=p)),zn(a.slice(m,m+=p)),zn(a.slice(m,m+=p)),zn(a.slice(m,m+p)||"ff")]}if(a.startsWith("rgb")){const p=a.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[m,y,b,S,C,A,L,B,j,U,H,se]=p,Q=[S||" ",L||" ",U].join("");if(Q===" "||Q===" /"||Q===",,"||Q===",,,"){const R=[b,A,j].join(""),Z=R==="%%%"?100:R===""?255:0;if(Z){const te=[fa(+y/Z,0,1),fa(+C/Z,0,1),fa(+B/Z,0,1),H?An(+H,se):1];if(jl(te))return te}}return}}const d=a.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[p,m,y,b,S,C,A,L,B]=d,j=[y||" ",S||" ",A].join("");if(j===" "||j===" /"||j===",,"||j===",,,"){const U=[+m,fa(+b,0,100),fa(+C,0,100),L?An(+L,B):1];if(jl(U))return function([H,se,Q,R]){function Z(te){const ge=(te+H/30)%12,Ie=se*Math.min(Q,1-Q);return Q-Ie*Math.max(-1,Math.min(ge-3,9-ge,1))}return H=Ru(H),se/=100,Q/=100,[Z(0),Z(8),Z(4),R]}(U)}}}(t);return r?new xt(...r,!1):void 0}get rgb(){const{r:t,g:r,b:a,a:c}=this,d=c||1/0;return this.overwriteGetter("rgb",[t/d,r/d,a/d,c])}get hcl(){return this.overwriteGetter("hcl",function(t){const[r,a,c,d]=Va(t),p=Math.sqrt(a*a+c*c);return[Math.round(1e4*p)?Ru(Math.atan2(c,a)*Sd):NaN,p,r,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Va(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){const[t,r,a,c]=this.rgb;return`rgba(${[t,r,a].map(d=>Math.round(255*d)).join(",")},${c})`}static interpolate(t,r,a,c="rgb"){switch(c){case"rgb":{const[d,p,m,y]=kn(t.rgb,r.rgb,a);return new xt(d,p,m,y,!1)}case"hcl":{const[d,p,m,y]=t.hcl,[b,S,C,A]=r.hcl;let L,B;if(isNaN(d)||isNaN(b))isNaN(d)?isNaN(b)?L=NaN:(L=b,m!==1&&m!==0||(B=S)):(L=d,C!==1&&C!==0||(B=p));else{let Q=b-d;b>d&&Q>180?Q-=360:b<d&&d-b>180&&(Q+=360),L=d+a*Q}const[j,U,H,se]=function([Q,R,Z,te]){return Q=isNaN(Q)?0:Q*Cs,Du([Z,Math.cos(Q)*R,Math.sin(Q)*R,te])}([L,B??$r(p,S,a),$r(m,C,a),$r(y,A,a)]);return new xt(j,U,H,se,!1)}case"lab":{const[d,p,m,y]=Du(kn(t.lab,r.lab,a));return new xt(d,p,m,y,!1)}}}}xt.black=new xt(0,0,0,1),xt.white=new xt(1,1,1,1),xt.transparent=new xt(0,0,0,0),xt.red=new xt(1,0,0,1);class Is{constructor(t,r,a){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const ko=["bottom","center","top"];class Vl{constructor(t,r,a,c,d,p){this.text=t,this.image=r,this.scale=a,this.fontStack=c,this.textColor=d,this.verticalAlign=p}}class rr{constructor(t){this.sections=t}static fromString(t){return new rr([new Vl(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 rr?t:rr.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class vi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof vi)return t;if(typeof t=="number")return new vi([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new vi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a){return new vi(kn(t.values,r.values,a))}}class nr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof nr)return t;if(typeof t=="number")return new nr([t]);if(Array.isArray(t)){for(const r of t)if(typeof r!="number")return;return new nr(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a){return new nr(kn(t.values,r.values,a))}}class ki{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ki)return t;if(typeof t=="string"){const a=xt.parse(t);return a?new ki([a]):void 0}if(!Array.isArray(t))return;const r=[];for(const a of t){if(typeof a!="string")return;const c=xt.parse(a);if(!c)return;r.push(c)}return new ki(r)}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a,c="rgb"){const d=[];if(t.values.length!=r.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let p=0;p<t.values.length;p++)d.push(xt.interpolate(t.values[p],r.values[p],a,c));return new ki(d)}}class ri extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const Ro=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Pt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Pt)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r<t.length;r+=2){const a=t[r],c=t[r+1];if(typeof a!="string"||!Ro.has(a)||!Array.isArray(c)||c.length!==2||typeof c[0]!="number"||typeof c[1]!="number")return}return new Pt(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a){const c=t.values,d=r.values;if(c.length!==d.length)throw new ri(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${r.toString()}`);const p=[];for(let m=0;m<c.length;m+=2){if(c[m]!==d[m])throw new ri(`Cannot interpolate values containing mismatched anchors. from[${m}]: ${c[m]}, to[${m}]: ${d[m]}`);p.push(c[m]);const[y,b]=c[m+1],[S,C]=d[m+1];p.push([$r(y,S,a),$r(b,C,a)])}return new Pt(p)}}class br{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new br({name:t,available:!1}):null}}class ct{constructor(t,r,a){this.from=t,this.to=r,this.transition=a}static interpolate(t,r,a){return new ct(t,r,a)}static parse(t){return t instanceof ct?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new ct(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new ct(t.from,t.to,t.transition):typeof t=="string"?new ct(t,t,1):void 0}}function ut(n,t,r,a){return typeof n=="number"&&n>=0&&n<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[n,t,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[n,t,r,a]:[n,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ma(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof ct||n instanceof xt||n instanceof Is||n instanceof rr||n instanceof vi||n instanceof nr||n instanceof ki||n instanceof Pt||n instanceof br)return!0;if(Array.isArray(n)){for(const t of n)if(!ma(t))return!1;return!0}if(typeof n=="object"){for(const t in n)if(!ma(n[t]))return!1;return!0}return!1}function st(n){if(n===null)return ha;if(typeof n=="string")return mt;if(typeof n=="boolean")return gt;if(typeof n=="number")return Ne;if(n instanceof xt)return kr;if(n instanceof ct)return Io;if(n instanceof Is)return In;if(n instanceof rr)return da;if(n instanceof vi)return yi;if(n instanceof nr)return Ss;if(n instanceof ki)return Ts;if(n instanceof Pt)return Ps;if(n instanceof br)return En;if(Array.isArray(n)){const t=n.length;let r;for(const a of n){const c=st(a);if(r){if(r===c)continue;r=_t;break}r=c}return Rr(r||_t,t)}return _n}function ga(n){const t=typeof n;return n===null?"":t==="string"||t==="number"||t==="boolean"?String(n):n instanceof xt||n instanceof ct||n instanceof rr||n instanceof vi||n instanceof nr||n instanceof ki||n instanceof Pt||n instanceof br?n.toString():JSON.stringify(n)}class dr{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!ma(t[1]))return r.error("invalid value");const a=t[1];let c=st(a);const d=r.expectedType;return c.kind!=="array"||c.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(c=d),new dr(c,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Za={string:mt,number:Ne,boolean:gt,object:_n};class Gr{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a,c=1;const d=t[0];if(d==="array"){let m,y;if(t.length>2){const b=t[1];if(typeof b!="string"||!(b in Za)||b==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=Za[b],c++}else m=_t;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);y=t[2],c++}a=Rr(m,y)}else{if(!Za[d])throw new Error(`Types doesn't contain name = ${d}`);a=Za[d]}const p=[];for(;c<t.length;c++){const m=r.parse(t[c],c,_t);if(!m)return null;p.push(m)}return new Gr(a,p)}evaluate(t){for(let r=0;r<this.args.length;r++){const a=this.args[r].evaluate(t);if(!Ms(this.type,st(a)))return a;if(r===this.args.length-1)throw new ri(`Expected value to be of type ${ii(this.type)}, but found ${ii(st(a))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Zl={"to-boolean":gt,"to-color":kr,"to-number":Ne,"to-string":mt};class xn{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const a=t[0];if(!Zl[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&t.length!==2)return r.error("Expected one argument.");const c=Zl[a],d=[];for(let p=1;p<t.length;p++){const m=r.parse(t[p],p,_t);if(!m)return null;d.push(m)}return new xn(c,d)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,a;for(const c of this.args){if(r=c.evaluate(t),a=null,r instanceof xt)return r;if(typeof r=="string"){const d=t.parseColor(r);if(d)return d}else if(Array.isArray(r)&&(a=r.length<3||r.length>4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:ut(r[0],r[1],r[2],r[3]),!a))return new xt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ri(a||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const a of this.args){r=a.evaluate(t);const c=vi.parse(r);if(c)return c}throw new ri(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"numberArray":{let r;for(const a of this.args){r=a.evaluate(t);const c=nr.parse(r);if(c)return c}throw new ri(`Could not parse numberArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"colorArray":{let r;for(const a of this.args){r=a.evaluate(t);const c=ki.parse(r);if(c)return c}throw new ri(`Could not parse colorArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const a of this.args){r=a.evaluate(t);const c=Pt.parse(r);if(c)return c}throw new ri(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const a of this.args){if(r=a.evaluate(t),r===null)return 0;const c=Number(r);if(!isNaN(c))return c}throw new ri(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return rr.fromString(ga(this.args[0].evaluate(t)));case"resolvedImage":return br.fromString(ga(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return ga(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Lu=["Unknown","Point","LineString","Polygon"];class Bu{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Lu[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let r=this._parseColorCache.get(t);return r||(r=xt.parse(t),this._parseColorCache.set(t,r)),r}}class Es{constructor(t,r,a=[],c,d=new Wn,p=[]){this.registry=t,this.path=a,this.key=a.map(m=>`[${m}]`).join(""),this.scope=d,this.errors=p,this.expectedType=c,this._isConstant=r}parse(t,r,a,c,d={}){return r?this.concat(r,a,c)._parse(t,d):this._parse(t,d)}_parse(t,r){function a(c,d,p){return p==="assert"?new Gr(d,[c]):p==="coerce"?new xn(d,[c]):c}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const c=t[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const d=this.registry[c];if(d){let p=d.parse(t,this);if(!p)return null;if(this.expectedType){const m=this.expectedType,y=p.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||y.kind!=="value"){if(m.kind==="projectionDefinition"&&["string","array"].includes(y.kind)||["color","formatted","resolvedImage"].includes(m.kind)&&["value","string"].includes(y.kind)||["padding","numberArray"].includes(m.kind)&&["value","number","array"].includes(y.kind)||m.kind==="colorArray"&&["value","string","array"].includes(y.kind)||m.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(y.kind))p=a(p,m,r.typeAnnotation||"coerce");else if(this.checkSubtype(m,y))return null}else p=a(p,m,r.typeAnnotation||"assert")}if(!(p instanceof dr)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const m=new Bu;try{p=new dr(p.type,p.evaluate(m))}catch(y){return this.error(y.message),null}}return p}return this.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,a){const c=typeof t=="number"?this.path.concat(t):this.path,d=a?this.scope.concat(a):this.scope;return new Es(this.registry,this._isConstant,c,r||null,d,this.errors)}error(t,...r){const a=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new ti(a,t))}checkSubtype(t,r){const a=Ms(t,r);return a&&this.error(a),a}}class zs{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const a=[];for(let d=1;d<t.length-1;d+=2){const p=t[d];if(typeof p!="string")return r.error(`Expected string, but found ${typeof p} instead.`,d);if(/[^a-zA-Z0-9_]/.test(p))return r.error("Variable names must contain only alphanumeric characters or '_'.",d);const m=r.parse(t[d+1],d+1);if(!m)return null;a.push([p,m])}const c=r.parse(t[t.length-1],t.length-1,r.expectedType,a);return c?new zs(a,c):null}outputDefined(){return this.result.outputDefined()}}class nn{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const a=t[1];return r.scope.has(a)?new nn(a,r.scope.get(a)):r.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Ri{constructor(t,r,a){this.type=t,this.index=r,this.input=a}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,Ne),c=r.parse(t[2],2,Rr(r.expectedType||_t));return a&&c?new Ri(c.type.itemType,a,c):null}evaluate(t){const r=this.index.evaluate(t),a=this.input.evaluate(t);if(r<0)throw new ri(`Array index out of bounds: ${r} < 0.`);if(r>=a.length)throw new ri(`Array index out of bounds: ${r} > ${a.length-1}.`);if(r!==Math.floor(r))throw new ri(`Array index must be an integer, but found ${r} instead.`);return a[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Ua{constructor(t,r){this.type=gt,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,_t),c=r.parse(t[2],2,_t);return a&&c?Eo(a.type,[gt,mt,Ne,ha,_t])?new Ua(a,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ii(a.type)} instead`):null}evaluate(t){const r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!a)return!1;if(!pa(r,["boolean","string","number","null"]))throw new ri(`Expected first argument to be of type boolean, string, number or null, but found ${ii(st(r))} instead.`);if(!pa(a,["string","array"]))throw new ri(`Expected second argument to be of type array or string, but found ${ii(st(a))} instead.`);return a.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class As{constructor(t,r,a){this.type=Ne,this.needle=t,this.haystack=r,this.fromIndex=a}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,_t),c=r.parse(t[2],2,_t);if(!a||!c)return null;if(!Eo(a.type,[gt,mt,Ne,ha,_t]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ii(a.type)} instead`);if(t.length===4){const d=r.parse(t[3],3,Ne);return d?new As(a,c,d):null}return new As(a,c)}evaluate(t){const r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!pa(r,["boolean","string","number","null"]))throw new ri(`Expected first argument to be of type boolean, string, number or null, but found ${ii(st(r))} instead.`);let c;if(this.fromIndex&&(c=this.fromIndex.evaluate(t)),pa(a,["string"])){const d=a.indexOf(r,c);return d===-1?-1:[...a.slice(0,d)].length}if(pa(a,["array"]))return a.indexOf(r,c);throw new ri(`Expected second argument to be of type array or string, but found ${ii(st(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class $a{constructor(t,r,a,c,d,p){this.inputType=t,this.type=r,this.input=a,this.cases=c,this.outputs=d,this.otherwise=p}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let a,c;r.expectedType&&r.expectedType.kind!=="value"&&(c=r.expectedType);const d={},p=[];for(let b=2;b<t.length-1;b+=2){let S=t[b];const C=t[b+1];Array.isArray(S)||(S=[S]);const A=r.concat(b);if(S.length===0)return A.error("Expected at least one branch label.");for(const B of S){if(typeof B!="number"&&typeof B!="string")return A.error("Branch labels must be numbers or strings.");if(typeof B=="number"&&Math.abs(B)>Number.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof B=="number"&&Math.floor(B)!==B)return A.error("Numeric branch labels must be integer values.");if(a){if(A.checkSubtype(a,st(B)))return null}else a=st(B);if(d[String(B)]!==void 0)return A.error("Branch labels must be unique.");d[String(B)]=p.length}const L=r.parse(C,b,c);if(!L)return null;c=c||L.type,p.push(L)}const m=r.parse(t[1],1,_t);if(!m)return null;const y=r.parse(t[t.length-1],t.length-1,c);return y?m.type.kind!=="value"&&r.concat(1).checkSubtype(a,m.type)?null:new $a(a,c,m,d,p,y):null}evaluate(t){const r=this.input.evaluate(t);return(st(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class bi{constructor(t,r,a){this.type=t,this.branches=r,this.otherwise=a}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let a;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);const c=[];for(let p=1;p<t.length-1;p+=2){const m=r.parse(t[p],p,gt);if(!m)return null;const y=r.parse(t[p+1],p+1,a);if(!y)return null;c.push([m,y]),a=a||y.type}const d=r.parse(t[t.length-1],t.length-1,a);if(!d)return null;if(!a)throw new Error("Can't infer output type");return new bi(a,c,d)}evaluate(t){for(const[r,a]of this.branches)if(r.evaluate(t))return a.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[r,a]of this.branches)t(r),t(a);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class ks{constructor(t,r,a,c){this.type=t,this.input=r,this.beginIndex=a,this.endIndex=c}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,_t),c=r.parse(t[2],2,Ne);if(!a||!c)return null;if(!Eo(a.type,[Rr(_t),mt,_t]))return r.error(`Expected first argument to be of type array or string, but found ${ii(a.type)} instead`);if(t.length===4){const d=r.parse(t[3],3,Ne);return d?new ks(a.type,a,c,d):null}return new ks(a.type,a,c)}evaluate(t){const r=this.input.evaluate(t),a=this.beginIndex.evaluate(t);let c;if(this.endIndex&&(c=this.endIndex.evaluate(t)),pa(r,["string"]))return[...r].slice(a,c).join("");if(pa(r,["array"]))return r.slice(a,c);throw new ri(`Expected first argument to be of type array or string, but found ${ii(st(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Ga(n,t){const r=n.length-1;let a,c,d=0,p=r,m=0;for(;d<=p;)if(m=Math.floor((d+p)/2),a=n[m],c=n[m+1],a<=t){if(m===r||t<c)return m;d=m+1}else{if(!(a>t))throw new ri("Input is not a number.");p=m-1}return 0}class qa{constructor(t,r,a){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(const[c,d]of a)this.labels.push(c),this.outputs.push(d)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");const a=r.parse(t[1],1,Ne);if(!a)return null;const c=[];let d=null;r.expectedType&&r.expectedType.kind!=="value"&&(d=r.expectedType);for(let p=1;p<t.length;p+=2){const m=p===1?-1/0:t[p],y=t[p+1],b=p,S=p+1;if(typeof m!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',b);if(c.length&&c[c.length-1][0]>=m)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',b);const C=r.parse(y,S,d);if(!C)return null;d=d||C.type,c.push([m,C])}return new qa(d,a,c)}evaluate(t){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=r[0])return a[0].evaluate(t);const d=r.length;return c>=r[d-1]?a[d-1].evaluate(t):a[Ga(r,c)].evaluate(t)}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Pd(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Xn,Rs,Ul=function(){if(Rs)return Xn;function n(t,r,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(c-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=a,this.p2y=c}return Rs=1,Xn=n,n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var a=t,c=0;c<8;c++){var d=this.sampleCurveX(a)-t;if(Math.abs(d)<r)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var m=0,y=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<r));c++)t>d?m=a:y=a,a=.5*(y-m)+m;return a},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},Xn}(),Md=Pd(Ul);class pr{constructor(t,r,a,c,d){this.type=t,this.operator=r,this.interpolation=a,this.input=c,this.labels=[],this.outputs=[];for(const[p,m]of d)this.labels.push(p),this.outputs.push(m)}static interpolationFactor(t,r,a,c){let d=0;if(t.name==="exponential")d=Wa(r,t.base,a,c);else if(t.name==="linear")d=Wa(r,1,a,c);else if(t.name==="cubic-bezier"){const p=t.controlPoints;d=new Md(p[0],p[1],p[2],p[3]).solve(Wa(r,1,a,c))}return d}static parse(t,r){let[a,c,d,...p]=t;if(!Array.isArray(c)||c.length===0)return r.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const b=c[1];if(typeof b!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:b}}else{if(c[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const b=c.slice(1);if(b.length!==4||b.some(S=>typeof S!="number"||S<0||S>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:b}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(d=r.parse(d,2,Ne),!d)return null;const m=[];let y=null;a!=="interpolate-hcl"&&a!=="interpolate-lab"||r.expectedType==Ts?r.expectedType&&r.expectedType.kind!=="value"&&(y=r.expectedType):y=kr;for(let b=0;b<p.length;b+=2){const S=p[b],C=p[b+1],A=b+3,L=b+4;if(typeof S!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',A);if(m.length&&m[m.length-1][0]>=S)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const B=r.parse(C,L,y);if(!B)return null;y=y||B.type,m.push([S,B])}return Hn(y,Ne)||Hn(y,Io)||Hn(y,kr)||Hn(y,yi)||Hn(y,Ss)||Hn(y,Ts)||Hn(y,Ps)||Hn(y,Rr(Ne))?new pr(y,a,c,d,m):r.error(`Type ${ii(y)} is not interpolatable.`)}evaluate(t){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=r[0])return a[0].evaluate(t);const d=r.length;if(c>=r[d-1])return a[d-1].evaluate(t);const p=Ga(r,c),m=pr.interpolationFactor(this.interpolation,c,r[p],r[p+1]),y=a[p].evaluate(t),b=a[p+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return $r(y,b,m);case"color":return xt.interpolate(y,b,m);case"padding":return vi.interpolate(y,b,m);case"colorArray":return ki.interpolate(y,b,m);case"numberArray":return nr.interpolate(y,b,m);case"variableAnchorOffsetCollection":return Pt.interpolate(y,b,m);case"array":return kn(y,b,m);case"projectionDefinition":return ct.interpolate(y,b,m)}case"interpolate-hcl":switch(this.type.kind){case"color":return xt.interpolate(y,b,m,"hcl");case"colorArray":return ki.interpolate(y,b,m,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return xt.interpolate(y,b,m,"lab");case"colorArray":return ki.interpolate(y,b,m,"lab")}}}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Wa(n,t,r,a){const c=a-r,d=n-r;return c===0?0:t===1?d/c:(Math.pow(t,d)-1)/(Math.pow(t,c)-1)}const Dr={color:xt.interpolate,number:$r,padding:vi.interpolate,numberArray:nr.interpolate,colorArray:ki.interpolate,variableAnchorOffsetCollection:Pt.interpolate,array:kn};class wr{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a=null;const c=r.expectedType;c&&c.kind!=="value"&&(a=c);const d=[];for(const m of t.slice(1)){const y=r.parse(m,1+d.length,a,void 0,{typeAnnotation:"omit"});if(!y)return null;a=a||y.type,d.push(y)}if(!a)throw new Error("No output type");const p=c&&d.some(m=>Ms(c,m.type));return new wr(p?_t:a,d)}evaluate(t){let r,a=null,c=0;for(const d of this.args)if(c++,a=d.evaluate(t),a&&a instanceof br&&!a.available&&(r||(r=a.name),a=null,c===this.args.length&&(a=r)),a!==null)break;return a}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function $l(n,t){return n==="=="||n==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function Ds(n,t,r,a){return a.compare(t,r)===0}function Ha(n,t,r){const a=n!=="=="&&n!=="!=";return class $g{constructor(d,p,m){this.type=gt,this.lhs=d,this.rhs=p,this.collator=m,this.hasUntypedArgument=d.type.kind==="value"||p.type.kind==="value"}static parse(d,p){if(d.length!==3&&d.length!==4)return p.error("Expected two or three arguments.");const m=d[0];let y=p.parse(d[1],1,_t);if(!y)return null;if(!$l(m,y.type))return p.concat(1).error(`"${m}" comparisons are not supported for type '${ii(y.type)}'.`);let b=p.parse(d[2],2,_t);if(!b)return null;if(!$l(m,b.type))return p.concat(2).error(`"${m}" comparisons are not supported for type '${ii(b.type)}'.`);if(y.type.kind!==b.type.kind&&y.type.kind!=="value"&&b.type.kind!=="value")return p.error(`Cannot compare types '${ii(y.type)}' and '${ii(b.type)}'.`);a&&(y.type.kind==="value"&&b.type.kind!=="value"?y=new Gr(b.type,[y]):y.type.kind!=="value"&&b.type.kind==="value"&&(b=new Gr(y.type,[b])));let S=null;if(d.length===4){if(y.type.kind!=="string"&&b.type.kind!=="string"&&y.type.kind!=="value"&&b.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(S=p.parse(d[3],3,In),!S)return null}return new $g(y,b,S)}evaluate(d){const p=this.lhs.evaluate(d),m=this.rhs.evaluate(d);if(a&&this.hasUntypedArgument){const y=st(p),b=st(m);if(y.kind!==b.kind||y.kind!=="string"&&y.kind!=="number")throw new ri(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${y.kind}, ${b.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const y=st(p),b=st(m);if(y.kind!=="string"||b.kind!=="string")return t(d,p,m)}return this.collator?r(d,p,m,this.collator.evaluate(d)):t(d,p,m)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}const Gl=Ha("==",function(n,t,r){return t===r},Ds),Cd=Ha("!=",function(n,t,r){return t!==r},function(n,t,r,a){return!Ds(0,t,r,a)}),Id=Ha("<",function(n,t,r){return t<r},function(n,t,r,a){return a.compare(t,r)<0}),Ed=Ha(">",function(n,t,r){return t>r},function(n,t,r,a){return a.compare(t,r)>0}),zd=Ha("<=",function(n,t,r){return t<=r},function(n,t,r,a){return a.compare(t,r)<=0}),Do=Ha(">=",function(n,t,r){return t>=r},function(n,t,r,a){return a.compare(t,r)>=0});class Lo{constructor(t,r,a){this.type=In,this.locale=a,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");const a=t[1];if(typeof a!="object"||Array.isArray(a))return r.error("Collator options argument must be an object.");const c=r.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,gt);if(!c)return null;const d=r.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,gt);if(!d)return null;let p=null;return a.locale&&(p=r.parse(a.locale,1,mt),!p)?null:new Lo(c,d,p)}evaluate(t){return new Is(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 Bo{constructor(t,r,a,c,d){this.type=mt,this.number=t,this.locale=r,this.currency=a,this.minFractionDigits=c,this.maxFractionDigits=d}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");const a=r.parse(t[1],1,Ne);if(!a)return null;const c=t[2];if(typeof c!="object"||Array.isArray(c))return r.error("NumberFormat options argument must be an object.");let d=null;if(c.locale&&(d=r.parse(c.locale,1,mt),!d))return null;let p=null;if(c.currency&&(p=r.parse(c.currency,1,mt),!p))return null;let m=null;if(c["min-fraction-digits"]&&(m=r.parse(c["min-fraction-digits"],1,Ne),!m))return null;let y=null;return c["max-fraction-digits"]&&(y=r.parse(c["max-fraction-digits"],1,Ne),!y)?null:new Bo(a,d,p,m,y)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Ls{constructor(t){this.type=da,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const a=t[1];if(!Array.isArray(a)&&typeof a=="object")return r.error("First argument must be an image or text section.");const c=[];let d=!1;for(let p=1;p<=t.length-1;++p){const m=t[p];if(d&&typeof m=="object"&&!Array.isArray(m)){d=!1;let y=null;if(m["font-scale"]&&(y=r.parse(m["font-scale"],1,Ne),!y))return null;let b=null;if(m["text-font"]&&(b=r.parse(m["text-font"],1,Rr(mt)),!b))return null;let S=null;if(m["text-color"]&&(S=r.parse(m["text-color"],1,kr),!S))return null;let C=null;if(m["vertical-align"]){if(typeof m["vertical-align"]=="string"&&!ko.includes(m["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${m["vertical-align"]}' instead.`);if(C=r.parse(m["vertical-align"],1,mt),!C)return null}const A=c[c.length-1];A.scale=y,A.font=b,A.textColor=S,A.verticalAlign=C}else{const y=r.parse(t[p],1,_t);if(!y)return null;const b=y.type.kind;if(b!=="string"&&b!=="value"&&b!=="null"&&b!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,c.push({content:y,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Ls(c)}evaluate(t){return new rr(this.sections.map(r=>{const a=r.content.evaluate(t);return st(a)===En?new Vl("",a,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new Vl(ga(a),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null,r.verticalAlign?r.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor),r.verticalAlign&&t(r.verticalAlign)}outputDefined(){return!1}}class ql{constructor(t){this.type=En,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");const a=r.parse(t[1],1,mt);return a?new ql(a):r.error("No image name provided.")}evaluate(t){const r=this.input.evaluate(t),a=br.fromString(r);return a&&t.availableImages&&(a.available=t.availableImages.indexOf(r)>-1),a}eachChild(t){t(this.input)}outputDefined(){return!1}}class Fo{constructor(t){this.type=Ne,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const a=r.parse(t[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${ii(a.type)} instead.`):new Fo(a):null}evaluate(t){const r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new ri(`Expected value to be of type string or array, but found ${ii(st(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const vn=8192;function Ad(n,t){const r=(180+n[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n[1]*Math.PI/360)))/360,c=Math.pow(2,t.z);return[Math.round(r*c*vn),Math.round(a*c*vn)]}function Wl(n,t){const r=Math.pow(2,t.z);return[(c=(n[0]/vn+t.x)/r,360*c-180),(a=(n[1]/vn+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,c}function Bs(n,t){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function Fs(n,t){return!(n[0]<=t[0]||n[2]>=t[2]||n[1]<=t[1]||n[3]>=t[3])}function Fu(n,t,r){const a=n[0]-t[0],c=n[1]-t[1],d=n[0]-r[0],p=n[1]-r[1];return a*p-d*c==0&&a*d<=0&&c*p<=0}function Os(n,t,r,a){return(c=[a[0]-r[0],a[1]-r[1]])[0]*(d=[t[0]-n[0],t[1]-n[1]])[1]-c[1]*d[0]!=0&&!(!Oo(n,t,r,a)||!Oo(r,a,n,t));var c,d}function Ou(n,t,r){for(const a of r)for(let c=0;c<a.length-1;++c)if(Os(n,t,a[c],a[c+1]))return!0;return!1}function Xa(n,t,r=!1){let a=!1;for(const m of t)for(let y=0;y<m.length-1;y++){if(Fu(n,m[y],m[y+1]))return r;(d=m[y])[1]>(c=n)[1]!=(p=m[y+1])[1]>c[1]&&c[0]<(p[0]-d[0])*(c[1]-d[1])/(p[1]-d[1])+d[0]&&(a=!a)}var c,d,p;return a}function kd(n,t){for(const r of t)if(Xa(n,r))return!0;return!1}function ju(n,t){for(const r of n)if(!Xa(r,t))return!1;for(let r=0;r<n.length-1;++r)if(Ou(n[r],n[r+1],t))return!1;return!0}function Rd(n,t){for(const r of t)if(ju(n,r))return!0;return!1}function Oo(n,t,r,a){const c=a[0]-r[0],d=a[1]-r[1],p=(n[0]-r[0])*d-c*(n[1]-r[1]),m=(t[0]-r[0])*d-c*(t[1]-r[1]);return p>0&&m<0||p<0&&m>0}function Hl(n,t,r){const a=[];for(let c=0;c<n.length;c++){const d=[];for(let p=0;p<n[c].length;p++){const m=Ad(n[c][p],r);Bs(t,m),d.push(m)}a.push(d)}return a}function Nu(n,t,r){const a=[];for(let c=0;c<n.length;c++){const d=Hl(n[c],t,r);a.push(d)}return a}function Vu(n,t,r,a){if(n[0]<r[0]||n[0]>r[2]){const c=.5*a;let d=n[0]-r[0]>c?-a:r[0]-n[0]>c?a:0;d===0&&(d=n[0]-r[2]>c?-a:r[2]-n[0]>c?a:0),n[0]+=d}Bs(t,n)}function Xl(n,t,r,a){const c=Math.pow(2,a.z)*vn,d=[a.x*vn,a.y*vn],p=[];for(const m of n)for(const y of m){const b=[y.x+d[0],y.y+d[1]];Vu(b,t,r,c),p.push(b)}return p}function Yl(n,t,r,a){const c=Math.pow(2,a.z)*vn,d=[a.x*vn,a.y*vn],p=[];for(const y of n){const b=[];for(const S of y){const C=[S.x+d[0],S.y+d[1]];Bs(t,C),b.push(C)}p.push(b)}if(t[2]-t[0]<=c/2){(m=t)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const y of p)for(const b of y)Vu(b,t,r,c)}var m;return p}class _a{constructor(t,r){this.type=gt,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(ma(t[1])){const a=t[1];if(a.type==="FeatureCollection"){const c=[];for(const d of a.features){const{type:p,coordinates:m}=d.geometry;p==="Polygon"&&c.push(m),p==="MultiPolygon"&&c.push(...m)}if(c.length)return new _a(a,{type:"MultiPolygon",coordinates:c})}else if(a.type==="Feature"){const c=a.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new _a(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new _a(a,a)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(a.type==="Polygon"){const m=Hl(a.coordinates,d,p),y=Xl(r.geometry(),c,d,p);if(!Fs(c,d))return!1;for(const b of y)if(!Xa(b,m))return!1}if(a.type==="MultiPolygon"){const m=Nu(a.coordinates,d,p),y=Xl(r.geometry(),c,d,p);if(!Fs(c,d))return!1;for(const b of y)if(!kd(b,m))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(a.type==="Polygon"){const m=Hl(a.coordinates,d,p),y=Yl(r.geometry(),c,d,p);if(!Fs(c,d))return!1;for(const b of y)if(!ju(b,m))return!1}if(a.type==="MultiPolygon"){const m=Nu(a.coordinates,d,p),y=Yl(r.geometry(),c,d,p);if(!Fs(c,d))return!1;for(const b of y)if(!Rd(b,m))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Zu=class{constructor(n=[],t=(r,a)=>r<a?-1:r>a?1:0){if(this.data=n,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(n){this.data.push(n),this._up(this.length++)}pop(){if(this.length===0)return;const n=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:t,compare:r}=this,a=t[n];for(;n>0;){const c=n-1>>1,d=t[c];if(r(a,d)>=0)break;t[n]=d,n=c}t[n]=a}_down(n){const{data:t,compare:r}=this,a=this.length>>1,c=t[n];for(;n<a;){let d=1+(n<<1);const p=d+1;if(p<this.length&&r(t[p],t[d])<0&&(d=p),r(t[d],c)>=0)break;t[n]=t[d],n=d}t[n]=c}};function Kl(n,t,r=0,a=n.length-1,c=Dd){for(;a>r;){if(a-r>600){const y=a-r+1,b=t-r+1,S=Math.log(y),C=.5*Math.exp(2*S/3),A=.5*Math.sqrt(S*C*(y-C)/y)*(b-y/2<0?-1:1);Kl(n,t,Math.max(r,Math.floor(t-b*C/y+A)),Math.min(a,Math.floor(t+(y-b)*C/y+A)),c)}const d=n[t];let p=r,m=a;for(Ya(n,r,t),c(n[a],d)>0&&Ya(n,r,a);p<m;){for(Ya(n,p,m),p++,m--;c(n[p],d)<0;)p++;for(;c(n[m],d)>0;)m--}c(n[r],d)===0?Ya(n,r,m):(m++,Ya(n,m,a)),m<=t&&(r=m+1),t<=m&&(a=m-1)}}function Ya(n,t,r){const a=n[t];n[t]=n[r],n[r]=a}function Dd(n,t){return n<t?-1:n>t?1:0}function jo(n,t){if(n.length<=1)return[n];const r=[];let a,c;for(const d of n){const p=Uu(d);p!==0&&(d.area=Math.abs(p),c===void 0&&(c=p<0),c===p<0?(a&&r.push(a),a=[d]):a.push(d))}if(a&&r.push(a),t>1)for(let d=0;d<r.length;d++)r[d].length<=t||(Kl(r[d],t,1,r[d].length-1,Ld),r[d]=r[d].slice(0,t));return r}function Ld(n,t){return t.area-n.area}function Uu(n){let t=0;for(let r,a,c=0,d=n.length,p=d-1;c<d;p=c++)r=n[c],a=n[p],t+=(a.x-r.x)*(r.y+a.y);return t}const $u=1/298.257223563,Gu=$u*(2-$u),qu=Math.PI/180;class Jl{constructor(t){const r=6378.137*qu*1e3,a=Math.cos(t*qu),c=1/(1-Gu*(1-a*a)),d=Math.sqrt(c);this.kx=r*d*a,this.ky=r*d*c*(1-Gu)}distance(t,r){const a=this.wrap(t[0]-r[0])*this.kx,c=(t[1]-r[1])*this.ky;return Math.sqrt(a*a+c*c)}pointOnLine(t,r){let a,c,d,p,m=1/0;for(let y=0;y<t.length-1;y++){let b=t[y][0],S=t[y][1],C=this.wrap(t[y+1][0]-b)*this.kx,A=(t[y+1][1]-S)*this.ky,L=0;C===0&&A===0||(L=(this.wrap(r[0]-b)*this.kx*C+(r[1]-S)*this.ky*A)/(C*C+A*A),L>1?(b=t[y+1][0],S=t[y+1][1]):L>0&&(b+=C/this.kx*L,S+=A/this.ky*L)),C=this.wrap(r[0]-b)*this.kx,A=(r[1]-S)*this.ky;const B=C*C+A*A;B<m&&(m=B,a=b,c=S,d=y,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 Dt(n,t){return t[0]-n[0]}function No(n){return n[1]-n[0]+1}function Rn(n,t){return n[1]>=n[0]&&n[1]<t}function Ql(n,t){if(n[0]>n[1])return[null,null];const r=No(n);if(t){if(r===2)return[n,null];const c=Math.floor(r/2);return[[n[0],n[0]+c],[n[0]+c,n[1]]]}if(r===1)return[n,null];const a=Math.floor(r/2)-1;return[[n[0],n[0]+a],[n[0]+a+1,n[1]]]}function ec(n,t){if(!Rn(t,n.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let a=t[0];a<=t[1];++a)Bs(r,n[a]);return r}function tc(n){const t=[1/0,1/0,-1/0,-1/0];for(const r of n)for(const a of r)Bs(t,a);return t}function Wu(n){return n[0]!==-1/0&&n[1]!==-1/0&&n[2]!==1/0&&n[3]!==1/0}function ic(n,t,r){if(!Wu(n)||!Wu(t))return NaN;let a=0,c=0;return n[2]<t[0]&&(a=t[0]-n[2]),n[0]>t[2]&&(a=n[0]-t[2]),n[1]>t[3]&&(c=n[1]-t[3]),n[3]<t[1]&&(c=t[1]-n[3]),r.distance([0,0],[a,c])}function ya(n,t,r){const a=r.pointOnLine(t,n);return r.distance(n,a.point)}function rc(n,t,r,a,c){const d=Math.min(ya(n,[r,a],c),ya(t,[r,a],c)),p=Math.min(ya(r,[n,t],c),ya(a,[n,t],c));return Math.min(d,p)}function Bd(n,t,r,a,c){if(!Rn(t,n.length)||!Rn(a,r.length))return 1/0;let d=1/0;for(let p=t[0];p<t[1];++p){const m=n[p],y=n[p+1];for(let b=a[0];b<a[1];++b){const S=r[b],C=r[b+1];if(Os(m,y,S,C))return 0;d=Math.min(d,rc(m,y,S,C,c))}}return d}function Fd(n,t,r,a,c){if(!Rn(t,n.length)||!Rn(a,r.length))return NaN;let d=1/0;for(let p=t[0];p<=t[1];++p)for(let m=a[0];m<=a[1];++m)if(d=Math.min(d,c.distance(n[p],r[m])),d===0)return d;return d}function Od(n,t,r){if(Xa(n,t,!0))return 0;let a=1/0;for(const c of t){const d=c[0],p=c[c.length-1];if(d!==p&&(a=Math.min(a,ya(n,[p,d],r)),a===0))return a;const m=r.pointOnLine(c,n);if(a=Math.min(a,r.distance(n,m.point)),a===0)return a}return a}function jd(n,t,r,a){if(!Rn(t,n.length))return NaN;for(let d=t[0];d<=t[1];++d)if(Xa(n[d],r,!0))return 0;let c=1/0;for(let d=t[0];d<t[1];++d){const p=n[d],m=n[d+1];for(const y of r)for(let b=0,S=y.length,C=S-1;b<S;C=b++){const A=y[C],L=y[b];if(Os(p,m,A,L))return 0;c=Math.min(c,rc(p,m,A,L,a))}}return c}function Hu(n,t){for(const r of n)for(const a of r)if(Xa(a,t,!0))return!0;return!1}function Nd(n,t,r,a=1/0){const c=tc(n),d=tc(t);if(a!==1/0&&ic(c,d,r)>=a)return a;if(Fs(c,d)){if(Hu(n,t))return 0}else if(Hu(t,n))return 0;let p=1/0;for(const m of n)for(let y=0,b=m.length,S=b-1;y<b;S=y++){const C=m[S],A=m[y];for(const L of t)for(let B=0,j=L.length,U=j-1;B<j;U=B++){const H=L[U],se=L[B];if(Os(C,A,H,se))return 0;p=Math.min(p,rc(C,A,H,se,r))}}return p}function Xu(n,t,r,a,c,d){if(!d)return;const p=ic(ec(a,d),c,r);p<t&&n.push([p,d,[0,0]])}function Vo(n,t,r,a,c,d,p){if(!d||!p)return;const m=ic(ec(a,d),ec(c,p),r);m<t&&n.push([m,d,p])}function Zo(n,t,r,a,c=1/0){let d=Math.min(a.distance(n[0],r[0][0]),c);if(d===0)return d;const p=new Zu([[0,[0,n.length-1],[0,0]]],Dt),m=tc(r);for(;p.length>0;){const y=p.pop();if(y[0]>=d)continue;const b=y[1],S=t?50:100;if(No(b)<=S){if(!Rn(b,n.length))return NaN;if(t){const C=jd(n,b,r,a);if(isNaN(C)||C===0)return C;d=Math.min(d,C)}else for(let C=b[0];C<=b[1];++C){const A=Od(n[C],r,a);if(d=Math.min(d,A),d===0)return 0}}else{const C=Ql(b,t);Xu(p,d,a,n,m,C[0]),Xu(p,d,a,n,m,C[1])}}return d}function Uo(n,t,r,a,c,d=1/0){let p=Math.min(d,c.distance(n[0],r[0]));if(p===0)return p;const m=new Zu([[0,[0,n.length-1],[0,r.length-1]]],Dt);for(;m.length>0;){const y=m.pop();if(y[0]>=p)continue;const b=y[1],S=y[2],C=t?50:100,A=a?50:100;if(No(b)<=C&&No(S)<=A){if(!Rn(b,n.length)&&Rn(S,r.length))return NaN;let L;if(t&&a)L=Bd(n,b,r,S,c),p=Math.min(p,L);else if(t&&!a){const B=n.slice(b[0],b[1]+1);for(let j=S[0];j<=S[1];++j)if(L=ya(r[j],B,c),p=Math.min(p,L),p===0)return p}else if(!t&&a){const B=r.slice(S[0],S[1]+1);for(let j=b[0];j<=b[1];++j)if(L=ya(n[j],B,c),p=Math.min(p,L),p===0)return p}else L=Fd(n,b,r,S,c),p=Math.min(p,L)}else{const L=Ql(b,t),B=Ql(S,a);Vo(m,p,c,n,r,L[0],B[0]),Vo(m,p,c,n,r,L[0],B[1]),Vo(m,p,c,n,r,L[1],B[0]),Vo(m,p,c,n,r,L[1],B[1])}}return p}function nc(n){return n.type==="MultiPolygon"?n.coordinates.map(t=>({type:"Polygon",coordinates:t})):n.type==="MultiLineString"?n.coordinates.map(t=>({type:"LineString",coordinates:t})):n.type==="MultiPoint"?n.coordinates.map(t=>({type:"Point",coordinates:t})):[n]}class xa{constructor(t,r){this.type=Ne,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(ma(t[1])){const a=t[1];if(a.type==="FeatureCollection")return new xa(a,a.features.map(c=>nc(c.geometry)).flat());if(a.type==="Feature")return new xa(a,nc(a.geometry));if("type"in a&&"coordinates"in a)return new xa(a,nc(a))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,a){const c=r.geometry(),d=c.flat().map(y=>Wl([y.x,y.y],r.canonical));if(c.length===0)return NaN;const p=new Jl(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,Uo(d,!1,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,Uo(d,!1,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,Zo(d,!1,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,a){const c=r.geometry(),d=c.flat().map(y=>Wl([y.x,y.y],r.canonical));if(c.length===0)return NaN;const p=new Jl(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,Uo(d,!0,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,Uo(d,!0,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,Zo(d,!0,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries);if(t.geometryType()==="Polygon")return function(r,a){const c=r.geometry();if(c.length===0||c[0].length===0)return NaN;const d=jo(c,0).map(y=>y.map(b=>b.map(S=>Wl([S.x,S.y],r.canonical)))),p=new Jl(d[0][0][0][1]);let m=1/0;for(const y of a)for(const b of d){switch(y.type){case"Point":m=Math.min(m,Zo([y.coordinates],!1,b,p,m));break;case"LineString":m=Math.min(m,Zo(y.coordinates,!0,b,p,m));break;case"Polygon":m=Math.min(m,Nd(b,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class js{constructor(t){this.type=_t,this.key=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const a=t[1];return a==null?r.error("Global state property must be defined."):typeof a!="string"?r.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new js(a)}evaluate(t){var r;const a=(r=t.globals)===null||r===void 0?void 0:r.globalState;return a&&Object.keys(a).length!==0?yt(a,this.key):null}eachChild(){}outputDefined(){return!1}}const Ka={"==":Gl,"!=":Cd,">":Ed,"<":Id,">=":Do,"<=":zd,array:Gr,at:Ri,boolean:Gr,case:bi,coalesce:wr,collator:Lo,format:Ls,image:ql,in:Ua,"index-of":As,interpolate:pr,"interpolate-hcl":pr,"interpolate-lab":pr,length:Fo,let:zs,literal:dr,match:$a,number:Gr,"number-format":Bo,object:Gr,slice:ks,step:qa,string:Gr,"to-boolean":xn,"to-color":xn,"to-number":xn,"to-string":xn,var:nn,within:_a,distance:xa,"global-state":js};class qr{constructor(t,r,a,c){this.name=t,this.type=r,this._evaluate=a,this.args=c}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){const a=t[0],c=qr.definitions[a];if(!c)return r.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);const d=Array.isArray(c)?c[0]:c.type,p=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,m=p.filter(([b])=>!Array.isArray(b)||b.length===t.length-1);let y=null;for(const[b,S]of m){y=new Es(r.registry,$o,r.path,null,r.scope);const C=[];let A=!1;for(let L=1;L<t.length;L++){const B=t[L],j=Array.isArray(b)?b[L-1]:b.type,U=y.parse(B,1+C.length,j);if(!U){A=!0;break}C.push(U)}if(!A)if(Array.isArray(b)&&b.length!==C.length)y.error(`Expected ${b.length} arguments, but found ${C.length} instead.`);else{for(let L=0;L<C.length;L++){const B=Array.isArray(b)?b[L]:b.type,j=C[L];y.concat(L+1).checkSubtype(B,j.type)}if(y.errors.length===0)return new qr(a,d,S,C)}}if(m.length===1)r.errors.push(...y.errors);else{const b=(m.length?m:p).map(([C])=>{return A=C,Array.isArray(A)?`(${A.map(ii).join(", ")})`:`(${ii(A.type)}...)`;var A}).join(" | "),S=[];for(let C=1;C<t.length;C++){const A=r.parse(t[C],1+S.length);if(!A)return null;S.push(ii(A.type))}r.error(`Expected arguments of type ${b}, but found (${S.join(", ")}) instead.`)}return null}static register(t,r){qr.definitions=r;for(const a in r)t[a]=qr}}function Yu(n,[t,r,a,c]){t=t.evaluate(n),r=r.evaluate(n),a=a.evaluate(n);const d=c?c.evaluate(n):1,p=ut(t,r,a,d);if(p)throw new ri(p);return new xt(t/255,r/255,a/255,d,!1)}function Ku(n,t){return n in t}function ac(n,t){const r=t[n];return r===void 0?null:r}function va(n){return{type:n}}function $o(n){if(n instanceof nn)return $o(n.boundExpression);if(n instanceof qr&&n.name==="error"||n instanceof Lo||n instanceof _a||n instanceof xa||n instanceof js)return!1;const t=n instanceof xn||n instanceof Gr;let r=!0;return n.eachChild(a=>{r=t?r&&$o(a):r&&a instanceof dr}),!!r&&Go(n)&&Ja(n,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Go(n){if(n instanceof qr&&(n.name==="get"&&n.args.length===1||n.name==="feature-state"||n.name==="has"&&n.args.length===1||n.name==="properties"||n.name==="geometry-type"||n.name==="id"||/^filter-/.test(n.name))||n instanceof _a||n instanceof xa)return!1;let t=!0;return n.eachChild(r=>{t&&!Go(r)&&(t=!1)}),t}function Ns(n){if(n instanceof qr&&n.name==="feature-state")return!1;let t=!0;return n.eachChild(r=>{t&&!Ns(r)&&(t=!1)}),t}function Ja(n,t){if(n instanceof qr&&t.indexOf(n.name)>=0)return!1;let r=!0;return n.eachChild(a=>{r&&!Ja(a,t)&&(r=!1)}),r}function Ju(n){return{result:"success",value:n}}function Qa(n){return{result:"error",value:n}}function es(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function sc(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function oc(n){return!!n.expression&&n.expression.interpolated}function vt(n){return n instanceof Number?"number":n instanceof String?"string":n instanceof Boolean?"boolean":Array.isArray(n)?"array":n===null?"null":typeof n}function ba(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&st(n)===_n}function Qu(n){return n}function eh(n,t){const r=n.stops&&typeof n.stops[0][0]=="object",a=r||!(r||n.property!==void 0),c=n.type||(oc(t)?"exponential":"interval"),d=function(S){switch(S.type){case"color":return xt.parse;case"padding":return vi.parse;case"numberArray":return nr.parse;case"colorArray":return ki.parse;default:return null}}(t);if(d&&((n=Gi({},n)).stops&&(n.stops=n.stops.map(S=>[S[0],d(S[1])])),n.default=d(n.default?n.default:t.default)),n.colorSpace&&(p=n.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${n.colorSpace}"`);var p;const m=function(S){switch(S){case"exponential":return th;case"interval":return Zd;case"categorical":return Vd;case"identity":return ih;default:throw new Error(`Unknown function type "${S}"`)}}(c);let y,b;if(c==="categorical"){y=Object.create(null);for(const S of n.stops)y[S[0]]=S[1];b=typeof n.stops[0][0]}if(r){const S={},C=[];for(let B=0;B<n.stops.length;B++){const j=n.stops[B],U=j[0].zoom;S[U]===void 0&&(S[U]={zoom:U,type:n.type,property:n.property,default:n.default,stops:[]},C.push(U)),S[U].stops.push([j[0].value,j[1]])}const A=[];for(const B of C)A.push([S[B].zoom,eh(S[B],t)]);const L={name:"linear"};return{kind:"composite",interpolationType:L,interpolationFactor:pr.interpolationFactor.bind(void 0,L),zoomStops:A.map(B=>B[0]),evaluate:({zoom:B},j)=>th({stops:A,base:n.base},t,B).evaluate(B,j)}}if(a){const S=c==="exponential"?{name:"exponential",base:n.base!==void 0?n.base:1}:null;return{kind:"camera",interpolationType:S,interpolationFactor:pr.interpolationFactor.bind(void 0,S),zoomStops:n.stops.map(C=>C[0]),evaluate:({zoom:C})=>m(n,t,C,y,b)}}return{kind:"source",evaluate(S,C){const A=C&&C.properties?C.properties[n.property]:void 0;return A===void 0?Vs(n.default,t.default):m(n,t,A,y,b)}}}function Vs(n,t,r){return n!==void 0?n:t!==void 0?t:r!==void 0?r:void 0}function Vd(n,t,r,a,c){return Vs(typeof r===c?a[r]:void 0,n.default,t.default)}function Zd(n,t,r){if(vt(r)!=="number")return Vs(n.default,t.default);const a=n.stops.length;if(a===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[a-1][0])return n.stops[a-1][1];const c=Ga(n.stops.map(d=>d[0]),r);return n.stops[c][1]}function th(n,t,r){const a=n.base!==void 0?n.base:1;if(vt(r)!=="number")return Vs(n.default,t.default);const c=n.stops.length;if(c===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[c-1][0])return n.stops[c-1][1];const d=Ga(n.stops.map(S=>S[0]),r),p=function(S,C,A,L){const B=L-A,j=S-A;return B===0?0:C===1?j/B:(Math.pow(C,j)-1)/(Math.pow(C,B)-1)}(r,a,n.stops[d][0],n.stops[d+1][0]),m=n.stops[d][1],y=n.stops[d+1][1],b=Dr[t.type]||Qu;return typeof m.evaluate=="function"?{evaluate(...S){const C=m.evaluate.apply(void 0,S),A=y.evaluate.apply(void 0,S);if(C!==void 0&&A!==void 0)return b(C,A,p,n.colorSpace)}}:b(m,y,p,n.colorSpace)}function ih(n,t,r){switch(t.type){case"color":r=xt.parse(r);break;case"formatted":r=rr.fromString(r.toString());break;case"resolvedImage":r=br.fromString(r.toString());break;case"padding":r=vi.parse(r);break;case"colorArray":r=ki.parse(r);break;case"numberArray":r=nr.parse(r);break;default:vt(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return Vs(r,n.default,t.default)}qr.register(Ka,{error:[{kind:"error"},[mt],(n,[t])=>{throw new ri(t.evaluate(n))}],typeof:[mt,[_t],(n,[t])=>ii(st(t.evaluate(n)))],"to-rgba":[Rr(Ne,4),[kr],(n,[t])=>{const[r,a,c,d]=t.evaluate(n).rgb;return[255*r,255*a,255*c,d]}],rgb:[kr,[Ne,Ne,Ne],Yu],rgba:[kr,[Ne,Ne,Ne,Ne],Yu],has:{type:gt,overloads:[[[mt],(n,[t])=>Ku(t.evaluate(n),n.properties())],[[mt,_n],(n,[t,r])=>Ku(t.evaluate(n),r.evaluate(n))]]},get:{type:_t,overloads:[[[mt],(n,[t])=>ac(t.evaluate(n),n.properties())],[[mt,_n],(n,[t,r])=>ac(t.evaluate(n),r.evaluate(n))]]},"feature-state":[_t,[mt],(n,[t])=>ac(t.evaluate(n),n.featureState||{})],properties:[_n,[],n=>n.properties()],"geometry-type":[mt,[],n=>n.geometryType()],id:[_t,[],n=>n.id()],zoom:[Ne,[],n=>n.globals.zoom],"heatmap-density":[Ne,[],n=>n.globals.heatmapDensity||0],elevation:[Ne,[],n=>n.globals.elevation||0],"line-progress":[Ne,[],n=>n.globals.lineProgress||0],accumulated:[_t,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[Ne,va(Ne),(n,t)=>{let r=0;for(const a of t)r+=a.evaluate(n);return r}],"*":[Ne,va(Ne),(n,t)=>{let r=1;for(const a of t)r*=a.evaluate(n);return r}],"-":{type:Ne,overloads:[[[Ne,Ne],(n,[t,r])=>t.evaluate(n)-r.evaluate(n)],[[Ne],(n,[t])=>-t.evaluate(n)]]},"/":[Ne,[Ne,Ne],(n,[t,r])=>t.evaluate(n)/r.evaluate(n)],"%":[Ne,[Ne,Ne],(n,[t,r])=>t.evaluate(n)%r.evaluate(n)],ln2:[Ne,[],()=>Math.LN2],pi:[Ne,[],()=>Math.PI],e:[Ne,[],()=>Math.E],"^":[Ne,[Ne,Ne],(n,[t,r])=>Math.pow(t.evaluate(n),r.evaluate(n))],sqrt:[Ne,[Ne],(n,[t])=>Math.sqrt(t.evaluate(n))],log10:[Ne,[Ne],(n,[t])=>Math.log(t.evaluate(n))/Math.LN10],ln:[Ne,[Ne],(n,[t])=>Math.log(t.evaluate(n))],log2:[Ne,[Ne],(n,[t])=>Math.log(t.evaluate(n))/Math.LN2],sin:[Ne,[Ne],(n,[t])=>Math.sin(t.evaluate(n))],cos:[Ne,[Ne],(n,[t])=>Math.cos(t.evaluate(n))],tan:[Ne,[Ne],(n,[t])=>Math.tan(t.evaluate(n))],asin:[Ne,[Ne],(n,[t])=>Math.asin(t.evaluate(n))],acos:[Ne,[Ne],(n,[t])=>Math.acos(t.evaluate(n))],atan:[Ne,[Ne],(n,[t])=>Math.atan(t.evaluate(n))],min:[Ne,va(Ne),(n,t)=>Math.min(...t.map(r=>r.evaluate(n)))],max:[Ne,va(Ne),(n,t)=>Math.max(...t.map(r=>r.evaluate(n)))],abs:[Ne,[Ne],(n,[t])=>Math.abs(t.evaluate(n))],round:[Ne,[Ne],(n,[t])=>{const r=t.evaluate(n);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ne,[Ne],(n,[t])=>Math.floor(t.evaluate(n))],ceil:[Ne,[Ne],(n,[t])=>Math.ceil(t.evaluate(n))],"filter-==":[gt,[mt,_t],(n,[t,r])=>n.properties()[t.value]===r.value],"filter-id-==":[gt,[_t],(n,[t])=>n.id()===t.value],"filter-type-==":[gt,[mt],(n,[t])=>n.geometryType()===t.value],"filter-<":[gt,[mt,_t],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a<c}],"filter-id-<":[gt,[_t],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r<a}],"filter->":[gt,[mt,_t],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a>c}],"filter-id->":[gt,[_t],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r>a}],"filter-<=":[gt,[mt,_t],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a<=c}],"filter-id-<=":[gt,[_t],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r<=a}],"filter->=":[gt,[mt,_t],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a>=c}],"filter-id->=":[gt,[_t],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r>=a}],"filter-has":[gt,[_t],(n,[t])=>t.value in n.properties()],"filter-has-id":[gt,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[gt,[Rr(mt)],(n,[t])=>t.value.indexOf(n.geometryType())>=0],"filter-id-in":[gt,[Rr(_t)],(n,[t])=>t.value.indexOf(n.id())>=0],"filter-in-small":[gt,[mt,Rr(_t)],(n,[t,r])=>r.value.indexOf(n.properties()[t.value])>=0],"filter-in-large":[gt,[mt,Rr(_t)],(n,[t,r])=>function(a,c,d,p){for(;d<=p;){const m=d+p>>1;if(c[m]===a)return!0;c[m]>a?p=m-1:d=m+1}return!1}(n.properties()[t.value],r.value,0,r.value.length-1)],all:{type:gt,overloads:[[[gt,gt],(n,[t,r])=>t.evaluate(n)&&r.evaluate(n)],[va(gt),(n,t)=>{for(const r of t)if(!r.evaluate(n))return!1;return!0}]]},any:{type:gt,overloads:[[[gt,gt],(n,[t,r])=>t.evaluate(n)||r.evaluate(n)],[va(gt),(n,t)=>{for(const r of t)if(r.evaluate(n))return!0;return!1}]]},"!":[gt,[gt],(n,[t])=>!t.evaluate(n)],"is-supported-script":[gt,[mt],(n,[t])=>{const r=n.globals&&n.globals.isSupportedScript;return!r||r(t.evaluate(n))}],upcase:[mt,[mt],(n,[t])=>t.evaluate(n).toUpperCase()],downcase:[mt,[mt],(n,[t])=>t.evaluate(n).toLowerCase()],concat:[mt,va(_t),(n,t)=>t.map(r=>ga(r.evaluate(n))).join("")],"resolved-locale":[mt,[In],(n,[t])=>t.evaluate(n).resolvedLocale()]});class qo{constructor(t,r){this.expression=t,this._warningHistory={},this._evaluator=new Bu,this._defaultValue=r?function(a){if(a.type==="color"&&ba(a.default))return new xt(0,0,0,0);switch(a.type){case"color":return xt.parse(a.default)||null;case"padding":return vi.parse(a.default)||null;case"numberArray":return nr.parse(a.default)||null;case"colorArray":return ki.parse(a.default)||null;case"variableAnchorOffsetCollection":return Pt.parse(a.default)||null;case"projectionDefinition":return ct.parse(a.default)||null;default:return a.default===void 0?null:a.default}}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,a,c,d,p){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=a,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(t,r,a,c,d,p){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=a||null,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p||null;try{const m=this.expression.evaluate(this._evaluator);if(m==null||typeof m=="number"&&m!=m)return this._defaultValue;if(this._enumValues&&!(m in this._enumValues))throw new ri(`Expected value to be one of ${Object.keys(this._enumValues).map(y=>JSON.stringify(y)).join(", ")}, but found ${JSON.stringify(m)} instead.`);return m}catch(m){return this._warningHistory[m.message]||(this._warningHistory[m.message]=!0,typeof console<"u"&&console.warn(m.message)),this._defaultValue}}}function Wo(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in Ka}function Ho(n,t){const r=new Es(Ka,$o,[],t?function(c){const d={color:kr,string:mt,number:Ne,enum:mt,boolean:gt,formatted:da,padding:yi,numberArray:Ss,colorArray:Ts,projectionDefinition:Io,resolvedImage:En,variableAnchorOffsetCollection:Ps};return c.type==="array"?Rr(d[c.value]||_t,c.length):d[c.type]}(t):void 0),a=r.parse(n,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?Ju(new qo(a,t)):Qa(r.errors)}class Zs{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!Ns(r.expression),this.globalStateRefs=is(r.expression)}evaluateWithoutErrorHandling(t,r,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,r,a,c,d,p)}evaluate(t,r,a,c,d,p){return this._styleExpression.evaluate(t,r,a,c,d,p)}}class Xo{constructor(t,r,a,c){this.kind=t,this.zoomStops=a,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!Ns(r.expression),this.globalStateRefs=is(r.expression),this.interpolationType=c}evaluateWithoutErrorHandling(t,r,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,r,a,c,d,p)}evaluate(t,r,a,c,d,p){return this._styleExpression.evaluate(t,r,a,c,d,p)}interpolationFactor(t,r,a){return this.interpolationType?pr.interpolationFactor(this.interpolationType,t,r,a):0}}function lc(n,t){const r=Ho(n,t);if(r.result==="error")return r;const a=r.value.expression,c=Go(a);if(!c&&!es(t))return Qa([new ti("","data expressions not supported")]);const d=Ja(a,["zoom"]);if(!d&&!sc(t))return Qa([new ti("","zoom expressions not supported")]);const p=ts(a);return p||d?p instanceof ti?Qa([p]):p instanceof pr&&!oc(t)?Qa([new ti("",'"interpolate" expressions cannot be used with this property')]):Ju(p?new Xo(c?"camera":"composite",r.value,p.labels,p instanceof pr?p.interpolation:void 0):new Zs(c?"constant":"source",r.value)):Qa([new ti("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Us{constructor(t,r){this._parameters=t,this._specification=r,Gi(this,eh(this._parameters,this._specification))}static deserialize(t){return new Us(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function ts(n){let t=null;if(n instanceof zs)t=ts(n.result);else if(n instanceof wr){for(const r of n.args)if(t=ts(r),t)break}else(n instanceof qa||n instanceof pr)&&n.input instanceof qr&&n.input.name==="zoom"&&(t=n);return t instanceof ti||n.eachChild(r=>{const a=ts(r);a instanceof ti?t=a:!t&&a?t=new ti("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&a&&t!==a&&(t=new ti("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function is(n,t=new Set){return n instanceof js&&t.add(n.key),n.eachChild(r=>{is(r,t)}),t}function $s(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const t of n.slice(1))if(!$s(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const cc={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Yn(n){if(n==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};$s(n)||(n=Yo(n));const t=Ho(n,cc);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,a,c)=>t.value.evaluate(r,a,{},c),needGeometry:rh(n),getGlobalStateRefs:()=>is(t.value.expression)}}function Ud(n,t){return n<t?-1:n>t?1:0}function rh(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let t=1;t<n.length;t++)if(rh(n[t]))return!0;return!1}function Yo(n){if(!n)return!0;const t=n[0];return n.length<=1?t!=="any":t==="=="?uc(n[1],n[2],"=="):t==="!="?Gs(uc(n[1],n[2],"==")):t==="<"||t===">"||t==="<="||t===">="?uc(n[1],n[2],t):t==="any"?(r=n.slice(1),["any"].concat(r.map(Yo))):t==="all"?["all"].concat(n.slice(1).map(Yo)):t==="none"?["all"].concat(n.slice(1).map(Yo).map(Gs)):t==="in"?nh(n[1],n.slice(2)):t==="!in"?Gs(nh(n[1],n.slice(2))):t==="has"?ah(n[1]):t!=="!has"||Gs(ah(n[1]));var r}function uc(n,t,r){switch(n){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,n,t]}}function nh(n,t){if(t.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",n,["literal",t.sort(Ud)]]:["filter-in-small",n,["literal",t]]}}function ah(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function Gs(n){return["!",n]}function Ko(n){const t=typeof n;if(t==="number"||t==="boolean"||t==="string"||n==null)return JSON.stringify(n);if(Array.isArray(n)){let c="[";for(const d of n)c+=`${Ko(d)},`;return`${c}]`}const r=Object.keys(n).sort();let a="{";for(let c=0;c<r.length;c++)a+=`${JSON.stringify(r[c])}:${Ko(n[r[c]])},`;return`${a}}`}function Jo(n){let t="";for(const r of $e)t+=`/${Ko(n[r])}`;return t}function sh(n){const t=n.value;return t?[new Be(n.key,t,"constants have been deprecated as of v8")]:[]}function ci(n){return n instanceof Number||n instanceof String||n instanceof Boolean?n.valueOf():n}function Kn(n){if(Array.isArray(n))return n.map(Kn);if(n instanceof Object&&!(n instanceof Number||n instanceof String||n instanceof Boolean)){const t={};for(const r in n)t[r]=Kn(n[r]);return t}return ci(n)}function Wr(n){const t=n.key,r=n.value,a=n.valueSpec||{},c=n.objectElementValidators||{},d=n.style,p=n.styleSpec,m=n.validateSpec;let y=[];const b=vt(r);if(b!=="object")return[new Be(t,r,`object expected, ${b} found`)];for(const S in r){const C=S.split(".")[0],A=yt(a,C)||a["*"];let L;if(yt(c,C))L=c[C];else if(yt(a,C))L=m;else if(c["*"])L=c["*"];else{if(!a["*"]){y.push(new Be(t,r[S],`unknown property "${S}"`));continue}L=m}y=y.concat(L({key:(t&&`${t}.`)+S,value:r[S],valueSpec:A,style:d,styleSpec:p,object:r,objectKey:S,validateSpec:m},r))}for(const S in a)c[S]||a[S].required&&a[S].default===void 0&&r[S]===void 0&&y.push(new Be(t,r,`missing required property "${S}"`));return y}function Qo(n){const t=n.value,r=n.valueSpec,a=n.style,c=n.styleSpec,d=n.key,p=n.arrayElementValidator||n.validateSpec;if(vt(t)!=="array")return[new Be(d,t,`array expected, ${vt(t)} found`)];if(r.length&&t.length!==r.length)return[new Be(d,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new Be(d,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let m={type:r.value,values:r.values};c.$version<7&&(m.function=r.function),vt(r.value)==="object"&&(m=r.value);let y=[];for(let b=0;b<t.length;b++)y=y.concat(p({array:t,arrayIndex:b,value:t[b],valueSpec:m,validateSpec:n.validateSpec,style:a,styleSpec:c,key:`${d}[${b}]`}));return y}function qs(n){const t=n.key,r=n.value,a=n.valueSpec;let c=vt(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new Be(t,r,`number expected, ${c} found`)]:"minimum"in a&&r<a.minimum?[new Be(t,r,`${r} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&r>a.maximum?[new Be(t,r,`${r} is greater than the maximum value ${a.maximum}`)]:[]}function rs(n){const t=n.valueSpec,r=ci(n.value.type);let a,c,d,p={};const m=r!=="categorical"&&n.value.property===void 0,y=!m,b=vt(n.value.stops)==="array"&&vt(n.value.stops[0])==="array"&&vt(n.value.stops[0][0])==="object",S=Wr({key:n.key,value:n.value,valueSpec:n.styleSpec.function,validateSpec:n.validateSpec,style:n.style,styleSpec:n.styleSpec,objectElementValidators:{stops:function(L){if(r==="identity")return[new Be(L.key,L.value,'identity function may not have a "stops" property')];let B=[];const j=L.value;return B=B.concat(Qo({key:L.key,value:j,valueSpec:L.valueSpec,validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec,arrayElementValidator:C})),vt(j)==="array"&&j.length===0&&B.push(new Be(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 r==="identity"&&m&&S.push(new Be(n.key,n.value,'missing required property "property"')),r==="identity"||n.value.stops||S.push(new Be(n.key,n.value,'missing required property "stops"')),r==="exponential"&&n.valueSpec.expression&&!oc(n.valueSpec)&&S.push(new Be(n.key,n.value,"exponential functions not supported")),n.styleSpec.$version>=8&&(y&&!es(n.valueSpec)?S.push(new Be(n.key,n.value,"property functions not supported")):m&&!sc(n.valueSpec)&&S.push(new Be(n.key,n.value,"zoom functions not supported"))),r!=="categorical"&&!b||n.value.property!==void 0||S.push(new Be(n.key,n.value,'"property" property is required')),S;function C(L){let B=[];const j=L.value,U=L.key;if(vt(j)!=="array")return[new Be(U,j,`array expected, ${vt(j)} found`)];if(j.length!==2)return[new Be(U,j,`array length 2 expected, length ${j.length} found`)];if(b){if(vt(j[0])!=="object")return[new Be(U,j,`object expected, ${vt(j[0])} found`)];if(j[0].zoom===void 0)return[new Be(U,j,"object stop key must have zoom")];if(j[0].value===void 0)return[new Be(U,j,"object stop key must have value")];if(d&&d>ci(j[0].zoom))return[new Be(U,j[0].zoom,"stop zoom values must appear in ascending order")];ci(j[0].zoom)!==d&&(d=ci(j[0].zoom),c=void 0,p={}),B=B.concat(Wr({key:`${U}[0]`,value:j[0],valueSpec:{zoom:{}},validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec,objectElementValidators:{zoom:qs,value:A}}))}else B=B.concat(A({key:`${U}[0]`,value:j[0],validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec},j));return Wo(Kn(j[1]))?B.concat([new Be(`${U}[1]`,j[1],"expressions are not allowed in function stops.")]):B.concat(L.validateSpec({key:`${U}[1]`,value:j[1],valueSpec:t,validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec}))}function A(L,B){const j=vt(L.value),U=ci(L.value),H=L.value!==null?L.value:B;if(a){if(j!==a)return[new Be(L.key,H,`${j} stop domain type must match previous stop domain type ${a}`)]}else a=j;if(j!=="number"&&j!=="string"&&j!=="boolean")return[new Be(L.key,H,"stop domain value must be a number, string, or boolean")];if(j!=="number"&&r!=="categorical"){let se=`number expected, ${j} found`;return es(t)&&r===void 0&&(se+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Be(L.key,H,se)]}return r!=="categorical"||j!=="number"||isFinite(U)&&Math.floor(U)===U?r!=="categorical"&&j==="number"&&c!==void 0&&U<c?[new Be(L.key,H,"stop domain values must appear in ascending order")]:(c=U,r==="categorical"&&U in p?[new Be(L.key,H,"stop domain values must be unique")]:(p[U]=!0,[])):[new Be(L.key,H,`integer expected, found ${U}`)]}}function ns(n){const t=(n.expressionContext==="property"?lc:Ho)(Kn(n.value),n.valueSpec);if(t.result==="error")return t.value.map(a=>new Be(`${n.key}${a.key}`,n.value,a.message));const r=t.value.expression||t.value._styleExpression.expression;if(n.expressionContext==="property"&&n.propertyKey==="text-font"&&!r.outputDefined())return[new Be(n.key,n.value,`Invalid data expression for "${n.propertyKey}". Output values must be contained as literals within the expression.`)];if(n.expressionContext==="property"&&n.propertyType==="layout"&&!Ns(r))return[new Be(n.key,n.value,'"feature-state" data expressions are not supported with layout properties.')];if(n.expressionContext==="filter"&&!Ns(r))return[new Be(n.key,n.value,'"feature-state" data expressions are not supported with filters.')];if(n.expressionContext&&n.expressionContext.indexOf("cluster")===0){if(!Ja(r,["zoom","feature-state"]))return[new Be(n.key,n.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(n.expressionContext==="cluster-initial"&&!Go(r))return[new Be(n.key,n.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function hc(n){const t=n.key,r=n.value,a=vt(r);return a!=="string"?[new Be(t,r,`color expected, ${a} found`)]:xt.parse(String(r))?[]:[new Be(t,r,`color expected, "${r}" found`)]}function Ws(n){const t=n.key,r=n.value,a=n.valueSpec,c=[];return Array.isArray(a.values)?a.values.indexOf(ci(r))===-1&&c.push(new Be(t,r,`expected one of [${a.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(a.values).indexOf(ci(r))===-1&&c.push(new Be(t,r,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function dc(n){return $s(Kn(n.value))?ns(Gi({},n,{expressionContext:"filter",valueSpec:{value:"boolean"}})):oh(n)}function oh(n){const t=n.value,r=n.key;if(vt(t)!=="array")return[new Be(r,t,`array expected, ${vt(t)} found`)];const a=n.styleSpec;let c,d=[];if(t.length<1)return[new Be(r,t,"filter array must have at least 1 element")];switch(d=d.concat(Ws({key:`${r}[0]`,value:t[0],valueSpec:a.filter_operator,style:n.style,styleSpec:n.styleSpec})),ci(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&ci(t[1])==="$type"&&d.push(new Be(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&d.push(new Be(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(c=vt(t[1]),c!=="string"&&d.push(new Be(`${r}[1]`,t[1],`string expected, ${c} found`)));for(let p=2;p<t.length;p++)c=vt(t[p]),ci(t[1])==="$type"?d=d.concat(Ws({key:`${r}[${p}]`,value:t[p],valueSpec:a.geometry_type,style:n.style,styleSpec:n.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&d.push(new Be(`${r}[${p}]`,t[p],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let p=1;p<t.length;p++)d=d.concat(oh({key:`${r}[${p}]`,value:t[p],style:n.style,styleSpec:n.styleSpec}));break;case"has":case"!has":c=vt(t[1]),t.length!==2?d.push(new Be(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):c!=="string"&&d.push(new Be(`${r}[1]`,t[1],`string expected, ${c} found`))}return d}function lh(n,t){const r=n.key,a=n.validateSpec,c=n.style,d=n.styleSpec,p=n.value,m=n.objectKey,y=d[`${t}_${n.layerType}`];if(!y)return[];const b=m.match(/^(.*)-transition$/);if(t==="paint"&&b&&y[b[1]]&&y[b[1]].transition)return a({key:r,value:p,valueSpec:d.transition,style:c,styleSpec:d});const S=n.valueSpec||y[m];if(!S)return[new Be(r,p,`unknown property "${m}"`)];let C;if(vt(p)==="string"&&es(S)&&!S.tokens&&(C=/^{([^}]+)}$/.exec(p)))return[new Be(r,p,`"${m}" does not support interpolation syntax
6
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(C[1])} }\`.`)];const A=[];return n.layerType==="symbol"&&(m==="text-field"&&c&&!c.glyphs&&A.push(new Be(r,p,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&ba(Kn(p))&&ci(p.type)==="identity"&&A.push(new Be(r,p,'"text-font" does not support identity functions'))),A.concat(a({key:n.key,value:p,valueSpec:S,style:c,styleSpec:d,expressionContext:"property",propertyType:t,propertyKey:m}))}function as(n){return lh(n,"paint")}function ss(n){return lh(n,"layout")}function Tr(n){let t=[];const r=n.value,a=n.key,c=n.style,d=n.styleSpec;if(vt(r)!=="object")return[new Be(a,r,`object expected, ${vt(r)} found`)];r.type||r.ref||t.push(new Be(a,r,'either "type" or "ref" is required'));let p=ci(r.type);const m=ci(r.ref);if(r.id){const y=ci(r.id);for(let b=0;b<n.arrayIndex;b++){const S=c.layers[b];ci(S.id)===y&&t.push(new Be(a,r.id,`duplicate layer id "${r.id}", previously used at line ${S.id.__line__}`))}}if("ref"in r){let y;["type","source","source-layer","filter","layout"].forEach(b=>{b in r&&t.push(new Be(a,r[b],`"${b}" is prohibited for ref layers`))}),c.layers.forEach(b=>{ci(b.id)===m&&(y=b)}),y?y.ref?t.push(new Be(a,r.ref,"ref cannot reference another ref layer")):p=ci(y.type):t.push(new Be(a,r.ref,`ref layer "${m}" not found`))}else if(p!=="background")if(r.source){const y=c.sources&&c.sources[r.source],b=y&&ci(y.type);y?b==="vector"&&p==="raster"?t.push(new Be(a,r.source,`layer "${r.id}" requires a raster source`)):b!=="raster-dem"&&p==="hillshade"||b!=="raster-dem"&&p==="color-relief"?t.push(new Be(a,r.source,`layer "${r.id}" requires a raster-dem source`)):b==="raster"&&p!=="raster"?t.push(new Be(a,r.source,`layer "${r.id}" requires a vector source`)):b!=="vector"||r["source-layer"]?b==="raster-dem"&&p!=="hillshade"&&p!=="color-relief"?t.push(new Be(a,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||b==="geojson"&&y.lineMetrics||t.push(new Be(a,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Be(a,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new Be(a,r.source,`source "${r.source}" not found`))}else t.push(new Be(a,r,'missing required property "source"'));return t=t.concat(Wr({key:a,value:r,valueSpec:d.layer,style:n.style,styleSpec:n.styleSpec,validateSpec:n.validateSpec,objectElementValidators:{"*":()=>[],type:()=>n.validateSpec({key:`${a}.type`,value:r.type,valueSpec:d.layer.type,style:n.style,styleSpec:n.styleSpec,validateSpec:n.validateSpec,object:r,objectKey:"type"}),filter:dc,layout:y=>Wr({layer:r,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":b=>ss(Gi({layerType:p},b))}}),paint:y=>Wr({layer:r,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":b=>as(Gi({layerType:p},b))}})}})),t}function an(n){const t=n.value,r=n.key,a=vt(t);return a!=="string"?[new Be(r,t,`string expected, ${a} found`)]:[]}const pc={promoteId:function({key:n,value:t}){if(vt(t)==="string")return an({key:n,value:t});{const r=[];for(const a in t)r.push(...an({key:`${n}.${a}`,value:t[a]}));return r}}};function ch(n){const t=n.value,r=n.key,a=n.styleSpec,c=n.style,d=n.validateSpec;if(!t.type)return[new Be(r,t,'"type" is required')];const p=ci(t.type);let m;switch(p){case"vector":case"raster":return m=Wr({key:r,value:t,valueSpec:a[`source_${p.replace("-","_")}`],style:n.style,styleSpec:a,objectElementValidators:pc,validateSpec:d}),m;case"raster-dem":return m=function(y){var b;const S=(b=y.sourceName)!==null&&b!==void 0?b:"",C=y.value,A=y.styleSpec,L=A.source_raster_dem,B=y.style;let j=[];const U=vt(C);if(C===void 0)return j;if(U!=="object")return j.push(new Be("source_raster_dem",C,`object expected, ${U} found`)),j;const H=ci(C.encoding)==="custom",se=["redFactor","greenFactor","blueFactor","baseShift"],Q=y.value.encoding?`"${y.value.encoding}"`:"Default";for(const R in C)!H&&se.includes(R)?j.push(new Be(R,C[R],`In "${S}": "${R}" is only valid when "encoding" is set to "custom". ${Q} encoding found`)):L[R]?j=j.concat(y.validateSpec({key:R,value:C[R],valueSpec:L[R],validateSpec:y.validateSpec,style:B,styleSpec:A})):j.push(new Be(R,C[R],`unknown property "${R}"`));return j}({sourceName:r,value:t,style:n.style,styleSpec:a,validateSpec:d}),m;case"geojson":if(m=Wr({key:r,value:t,valueSpec:a.source_geojson,style:c,styleSpec:a,validateSpec:d,objectElementValidators:pc}),t.cluster)for(const y in t.clusterProperties){const[b,S]=t.clusterProperties[y],C=typeof b=="string"?[b,["accumulated"],["get",y]]:b;m.push(...ns({key:`${r}.${y}.map`,value:S,expressionContext:"cluster-map"})),m.push(...ns({key:`${r}.${y}.reduce`,value:C,expressionContext:"cluster-reduce"}))}return m;case"video":return Wr({key:r,value:t,valueSpec:a.source_video,style:c,validateSpec:d,styleSpec:a});case"image":return Wr({key:r,value:t,valueSpec:a.source_image,style:c,validateSpec:d,styleSpec:a});case"canvas":return[new Be(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ws({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function uh(n){const t=n.value,r=n.styleSpec,a=r.light,c=n.style;let d=[];const p=vt(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new Be("light",t,`object expected, ${p} found`)]),d;for(const m in t){const y=m.match(/^(.*)-transition$/);d=d.concat(y&&a[y[1]]&&a[y[1]].transition?n.validateSpec({key:m,value:t[m],valueSpec:r.transition,validateSpec:n.validateSpec,style:c,styleSpec:r}):a[m]?n.validateSpec({key:m,value:t[m],valueSpec:a[m],validateSpec:n.validateSpec,style:c,styleSpec:r}):[new Be(m,t[m],`unknown property "${m}"`)])}return d}function os(n){const t=n.value,r=n.styleSpec,a=r.sky,c=n.style,d=vt(t);if(t===void 0)return[];if(d!=="object")return[new Be("sky",t,`object expected, ${d} found`)];let p=[];for(const m in t)p=p.concat(a[m]?n.validateSpec({key:m,value:t[m],valueSpec:a[m],style:c,styleSpec:r}):[new Be(m,t[m],`unknown property "${m}"`)]);return p}function fc(n){const t=n.value,r=n.styleSpec,a=r.terrain,c=n.style;let d=[];const p=vt(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new Be("terrain",t,`object expected, ${p} found`)]),d;for(const m in t)d=d.concat(a[m]?n.validateSpec({key:m,value:t[m],valueSpec:a[m],validateSpec:n.validateSpec,style:c,styleSpec:r}):[new Be(m,t[m],`unknown property "${m}"`)]);return d}function el(n){let t=[];const r=n.value,a=n.key;if(Array.isArray(r)){const c=[],d=[];for(const p in r)r[p].id&&c.includes(r[p].id)&&t.push(new Be(a,r,`all the sprites' ids must be unique, but ${r[p].id} is duplicated`)),c.push(r[p].id),r[p].url&&d.includes(r[p].url)&&t.push(new Be(a,r,`all the sprites' URLs must be unique, but ${r[p].url} is duplicated`)),d.push(r[p].url),t=t.concat(Wr({key:`${a}[${p}]`,value:r[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:n.validateSpec}));return t}return an({key:a,value:r})}function hh(n){return t=n.value,t&&t.constructor===Object?[]:[new Be(n.key,n.value,`object expected, ${vt(n.value)} found`)];var t}const tl={"*":()=>[],array:Qo,boolean:function(n){const t=n.value,r=n.key,a=vt(t);return a!=="boolean"?[new Be(r,t,`boolean expected, ${a} found`)]:[]},number:qs,color:hc,constants:sh,enum:Ws,filter:dc,function:rs,layer:Tr,object:Wr,source:ch,light:uh,sky:os,terrain:fc,projection:function(n){const t=n.value,r=n.styleSpec,a=r.projection,c=n.style,d=vt(t);if(t===void 0)return[];if(d!=="object")return[new Be("projection",t,`object expected, ${d} found`)];let p=[];for(const m in t)p=p.concat(a[m]?n.validateSpec({key:m,value:t[m],valueSpec:a[m],style:c,styleSpec:r}):[new Be(m,t[m],`unknown property "${m}"`)]);return p},projectionDefinition:function(n){const t=n.key;let r=n.value;r=r instanceof String?r.valueOf():r;const a=vt(r);return a!=="array"||function(c){return Array.isArray(c)&&c.length===3&&typeof c[0]=="string"&&typeof c[1]=="string"&&typeof c[2]=="number"}(r)||function(c){return!!["interpolate","step","literal"].includes(c[0])}(r)?["array","string"].includes(a)?[]:[new Be(t,r,`projection expected, invalid type "${a}" found`)]:[new Be(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:an,formatted:function(n){return an(n).length===0?[]:ns(n)},resolvedImage:function(n){return an(n).length===0?[]:ns(n)},padding:function(n){const t=n.key,r=n.value;if(vt(r)==="array"){if(r.length<1||r.length>4)return[new Be(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];const a={type:"number"};let c=[];for(let d=0;d<r.length;d++)c=c.concat(n.validateSpec({key:`${t}[${d}]`,value:r[d],validateSpec:n.validateSpec,valueSpec:a}));return c}return qs({key:t,value:r,valueSpec:{}})},numberArray:function(n){const t=n.key,r=n.value;if(vt(r)==="array"){const a={type:"number"};if(r.length<1)return[new Be(t,r,"array length at least 1 expected, length 0 found")];let c=[];for(let d=0;d<r.length;d++)c=c.concat(n.validateSpec({key:`${t}[${d}]`,value:r[d],validateSpec:n.validateSpec,valueSpec:a}));return c}return qs({key:t,value:r,valueSpec:{}})},colorArray:function(n){const t=n.key,r=n.value;if(vt(r)==="array"){if(r.length<1)return[new Be(t,r,"array length at least 1 expected, length 0 found")];let a=[];for(let c=0;c<r.length;c++)a=a.concat(hc({key:`${t}[${c}]`,value:r[c]}));return a}return hc({key:t,value:r})},variableAnchorOffsetCollection:function(n){const t=n.key,r=n.value,a=vt(r),c=n.styleSpec;if(a!=="array"||r.length<1||r.length%2!=0)return[new Be(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let p=0;p<r.length;p+=2)d=d.concat(Ws({key:`${t}[${p}]`,value:r[p],valueSpec:c.layout_symbol["text-anchor"]})),d=d.concat(Qo({key:`${t}[${p+1}]`,value:r[p+1],valueSpec:{length:2,value:"number"},validateSpec:n.validateSpec,style:n.style,styleSpec:c}));return d},sprite:el,state:hh};function il(n){const t=n.value,r=n.valueSpec,a=n.styleSpec;return n.validateSpec=il,r.expression&&ba(ci(t))?rs(n):r.expression&&Wo(Kn(t))?ns(n):r.type&&tl[r.type]?tl[r.type](n):Wr(Gi({},n,{valueSpec:r.type?a[r.type]:r}))}function ls(n){const t=n.value,r=n.key,a=an(n);return a.length||(t.indexOf("{fontstack}")===-1&&a.push(new Be(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&a.push(new Be(r,t,'"glyphs" url must include a "{range}" token'))),a}function Hr(n,t=ae){let r=[];return r=r.concat(il({key:"",value:n,valueSpec:t.$root,styleSpec:t,style:n,validateSpec:il,objectElementValidators:{glyphs:ls,"*":()=>[]}})),n.constants&&(r=r.concat(sh({key:"constants",value:n.constants}))),dh(r)}function sn(n){return function(t){return n({...t,validateSpec:il})}}function dh(n){return[].concat(n).sort((t,r)=>t.line-r.line)}function fr(n){return function(...t){return dh(n.apply(this,t))}}Hr.source=fr(sn(ch)),Hr.sprite=fr(sn(el)),Hr.glyphs=fr(sn(ls)),Hr.light=fr(sn(uh)),Hr.sky=fr(sn(os)),Hr.terrain=fr(sn(fc)),Hr.state=fr(sn(hh)),Hr.layer=fr(sn(Tr)),Hr.filter=fr(sn(dc)),Hr.paintProperty=fr(sn(as)),Hr.layoutProperty=fr(sn(ss));const cs=Hr,$d=cs.light,rl=cs.sky,Gd=cs.paintProperty,mc=cs.layoutProperty;function Hs(n,t){let r=!1;if(t&&t.length)for(const a of t)n.fire(new de(new Error(a.message))),r=!0;return r}class us{constructor(t,r,a){const c=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const p=new Int32Array(this.arrayBuffer);t=p[0],this.d=(r=p[1])+2*(a=p[2]);for(let y=0;y<this.d*this.d;y++){const b=p[3+y],S=p[3+y+1];c.push(b===S?null:p.subarray(b,S))}const m=p[3+c.length+1];this.keys=p.subarray(p[3+c.length],m),this.bboxes=p.subarray(m),this.insert=this._insertReadonly}else{this.d=r+2*a;for(let p=0;p<this.d*this.d;p++)c.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=a,this.scale=r/t,this.uid=0;const d=a/r*t;this.min=-d,this.max=t+d}insert(t,r,a,c,d){this._forEachCell(r,a,c,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(c),this.bboxes.push(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,a,c,d,p){this.cells[d].push(p)}query(t,r,a,c,d){const p=this.min,m=this.max;if(t<=p&&r<=p&&m<=a&&m<=c&&!d)return Array.prototype.slice.call(this.keys);{const y=[];return this._forEachCell(t,r,a,c,this._queryCell,y,{},d),y}}_queryCell(t,r,a,c,d,p,m,y){const b=this.cells[d];if(b!==null){const S=this.keys,C=this.bboxes;for(let A=0;A<b.length;A++){const L=b[A];if(m[L]===void 0){const B=4*L;(y?y(C[B+0],C[B+1],C[B+2],C[B+3]):t<=C[B+2]&&r<=C[B+3]&&a>=C[B+0]&&c>=C[B+1])?(m[L]=!0,p.push(S[L])):m[L]=!1}}}}_forEachCell(t,r,a,c,d,p,m,y){const b=this._convertToCellCoord(t),S=this._convertToCellCoord(r),C=this._convertToCellCoord(a),A=this._convertToCellCoord(c);for(let L=b;L<=C;L++)for(let B=S;B<=A;B++){const j=this.d*B+L;if((!y||y(this._convertFromCellCoord(L),this._convertFromCellCoord(B),this._convertFromCellCoord(L+1),this._convertFromCellCoord(B+1)))&&d.call(this,t,r,a,c,j,p,m,y))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,r=3+this.cells.length+1+1;let a=0;for(let p=0;p<this.cells.length;p++)a+=this.cells[p].length;const c=new Int32Array(r+a+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let d=r;for(let p=0;p<t.length;p++){const m=t[p];c[3+p]=d,c.set(m,d),d+=m.length}return c[3+t.length]=d,c.set(this.keys,d),d+=this.keys.length,c[3+t.length+1]=d,c.set(this.bboxes,d),d+=this.bboxes.length,c.buffer}static serialize(t,r){const a=t.toArrayBuffer();return r&&r.push(a),{buffer:a}}static deserialize(t){return new us(t.buffer)}}const bn={};function Ge(n,t,r={}){if(bn[n])throw new Error(`${n} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:n,writeable:!1}),bn[n]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}Ge("Object",Object),Ge("Set",Set),Ge("TransferableGridIndex",us),Ge("Color",xt),Ge("Error",Error),Ge("AJAXError",J),Ge("ResolvedImage",br),Ge("StylePropertyFunction",Us),Ge("StyleExpression",qo,{omit:["_evaluator"]}),Ge("ZoomDependentExpression",Xo),Ge("ZoomConstantExpression",Zs),Ge("CompoundExpression",qr,{omit:["_evaluate"]});for(const n in Ka)Ka[n]._classRegistryKey||Ge(`Expression_${n}`,Ka[n]);function gc(n){return n&&typeof ArrayBuffer<"u"&&(n instanceof ArrayBuffer||n.constructor&&n.constructor.name==="ArrayBuffer")}function Xs(n){return n.$name||n.constructor._classRegistryKey}function _c(n){return!function(t){if(t===null||typeof t!="object")return!1;const r=Xs(t);return!(!r||r==="Object")}(n)&&(n==null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"||n instanceof Boolean||n instanceof Number||n instanceof String||n instanceof Date||n instanceof RegExp||n instanceof Blob||n instanceof Error||gc(n)||gn(n)||ArrayBuffer.isView(n)||n instanceof ImageData)}function Ys(n,t){if(_c(n))return(gc(n)||gn(n))&&t&&t.push(n),ArrayBuffer.isView(n)&&t&&t.push(n.buffer),n instanceof ImageData&&t&&t.push(n.data.buffer),n;if(Array.isArray(n)){const d=[];for(const p of n)d.push(Ys(p,t));return d}if(typeof n!="object")throw new Error("can't serialize object of type "+typeof n);const r=Xs(n);if(!r)throw new Error(`can't serialize object of unregistered class ${n.constructor.name}`);if(!bn[r])throw new Error(`${r} is not registered.`);const{klass:a}=bn[r],c=a.serialize?a.serialize(n,t):{};if(a.serialize){if(t&&c===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const d in n){if(!n.hasOwnProperty(d)||bn[r].omit.indexOf(d)>=0)continue;const p=n[d];c[d]=bn[r].shallow.indexOf(d)>=0?p:Ys(p,t)}n instanceof Error&&(c.message=n.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(c.$name=r),c}function hs(n){if(_c(n))return n;if(Array.isArray(n))return n.map(hs);if(typeof n!="object")throw new Error("can't deserialize object of type "+typeof n);const t=Xs(n)||"Object";if(!bn[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:r}=bn[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(n);const a=Object.create(r.prototype);for(const c of Object.keys(n)){if(c==="$name")continue;const d=n[c];a[c]=bn[t].shallow.indexOf(c)>=0?d:hs(d)}return a}class yc{constructor(){this.first=!0}update(t,r){const a=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<a&&(this.lastIntegerZoom=a,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=a,!0))}}const bt={"Latin-1 Supplement":n=>n>=128&&n<=255,"Hangul Jamo":n=>n>=4352&&n<=4607,Khmer:n=>n>=6016&&n<=6143,"General Punctuation":n=>n>=8192&&n<=8303,"Letterlike Symbols":n=>n>=8448&&n<=8527,"Number Forms":n=>n>=8528&&n<=8591,"Miscellaneous Technical":n=>n>=8960&&n<=9215,"Control Pictures":n=>n>=9216&&n<=9279,"Optical Character Recognition":n=>n>=9280&&n<=9311,"Enclosed Alphanumerics":n=>n>=9312&&n<=9471,"Geometric Shapes":n=>n>=9632&&n<=9727,"Miscellaneous Symbols":n=>n>=9728&&n<=9983,"Miscellaneous Symbols and Arrows":n=>n>=11008&&n<=11263,"Ideographic Description Characters":n=>n>=12272&&n<=12287,"CJK Symbols and Punctuation":n=>n>=12288&&n<=12351,Hiragana:n=>n>=12352&&n<=12447,Katakana:n=>n>=12448&&n<=12543,Kanbun:n=>n>=12688&&n<=12703,"CJK Strokes":n=>n>=12736&&n<=12783,"Enclosed CJK Letters and Months":n=>n>=12800&&n<=13055,"CJK Compatibility":n=>n>=13056&&n<=13311,"Yijing Hexagram Symbols":n=>n>=19904&&n<=19967,"CJK Unified Ideographs":n=>n>=19968&&n<=40959,"Hangul Syllables":n=>n>=44032&&n<=55215,"Private Use Area":n=>n>=57344&&n<=63743,"Vertical Forms":n=>n>=65040&&n<=65055,"CJK Compatibility Forms":n=>n>=65072&&n<=65103,"Small Form Variants":n=>n>=65104&&n<=65135,"Halfwidth and Fullwidth Forms":n=>n>=65280&&n<=65519};function xc(n){for(const t of n)if(al(t.charCodeAt(0)))return!0;return!1}function ph(n){for(const t of n)if(!Wd(t.charCodeAt(0)))return!1;return!0}function nl(n){const t=n.map(r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(t.join("|"),"u")}const qd=nl(["Arab","Dupl","Mong","Ougr","Syrc"]);function Wd(n){return!qd.test(String.fromCodePoint(n))}const vc=nl(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function al(n){return!(n!==746&&n!==747&&(n<4352||!(bt["CJK Compatibility Forms"](n)&&!(n>=65097&&n<=65103)||bt["CJK Compatibility"](n)||bt["CJK Strokes"](n)||!(!bt["CJK Symbols and Punctuation"](n)||n>=12296&&n<=12305||n>=12308&&n<=12319||n===12336)||bt["Enclosed CJK Letters and Months"](n)||bt["Ideographic Description Characters"](n)||bt.Kanbun(n)||bt.Katakana(n)&&n!==12540||!(!bt["Halfwidth and Fullwidth Forms"](n)||n===65288||n===65289||n===65293||n>=65306&&n<=65310||n===65339||n===65341||n===65343||n>=65371&&n<=65503||n===65507||n>=65512&&n<=65519)||!(!bt["Small Form Variants"](n)||n>=65112&&n<=65118||n>=65123&&n<=65126)||bt["Vertical Forms"](n)||bt["Yijing Hexagram Symbols"](n)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(n))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(n))||vc.test(String.fromCodePoint(n)))))}function bc(n){return!(al(n)||function(t){return!!(bt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||bt["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)||bt["Letterlike Symbols"](t)||bt["Number Forms"](t)||bt["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)||bt["Control Pictures"](t)&&t!==9251||bt["Optical Character Recognition"](t)||bt["Enclosed Alphanumerics"](t)||bt["Geometric Shapes"](t)||bt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||bt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||bt["CJK Symbols and Punctuation"](t)||bt.Katakana(t)||bt["Private Use Area"](t)||bt["CJK Compatibility Forms"](t)||bt["Small Form Variants"](t)||bt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(n))}const fh=nl(["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 Ks(n){return fh.test(String.fromCodePoint(n))}function Hd(n,t){return!(!t&&Ks(n)||n>=2304&&n<=3583||n>=3840&&n<=4255||bt.Khmer(n))}function wc(n){for(const t of n)if(Ks(t.charCodeAt(0)))return!0;return!1}const Jn=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(n){this.pluginStatus=n.pluginStatus,this.pluginURL=n.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(n){if(Jn.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=n.applyArabicShaping,this.processBidirectionalText=n.processBidirectionalText,this.processStyledBidirectionalText=n.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(n,t){return o(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(n.pluginStatus!=="loading")return this.setState(n),n;const r=n.pluginURL,a=new Promise(d=>{this.loadScriptResolve=d});t(r);const c=new Promise(d=>setTimeout(()=>d(),this.TIMEOUT));if(yield Promise.race([a,c]),this.isParsed()){const d={pluginStatus:"loaded",pluginURL:r};return this.setState(d),d}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${r}`)})}};class Qt{constructor(t,r){this.zoom=t,r?(this.now=r.now||0,this.fadeDuration=r.fadeDuration||0,this.zoomHistory=r.zoomHistory||new yc,this.transition=r.transition||{},this.globalState=r.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new yc,this.transition={},this.globalState={})}isSupportedScript(t){return function(r,a){for(const c of r)if(!Hd(c.charCodeAt(0),a))return!1;return!0}(t,Jn.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,r=t-Math.floor(t),a=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*r}}}class Js{constructor(t,r){this.property=t,this.value=r,this.expression=function(a,c){if(ba(a))return new Us(a,c);if(Wo(a)){const d=lc(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=xt.parse(a):c.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?c.type!=="numberArray"||typeof a!="number"&&!Array.isArray(a)?c.type!=="colorArray"||typeof a!="string"&&!Array.isArray(a)?c.type==="variableAnchorOffsetCollection"&&Array.isArray(a)?d=Pt.parse(a):c.type==="projectionDefinition"&&typeof a=="string"&&(d=ct.parse(a)):d=ki.parse(a):d=nr.parse(a):d=vi.parse(a),{globalStateRefs:new Set,kind:"constant",evaluate:()=>d}}}(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,r,a){return this.property.possiblyEvaluate(this,t,r,a)}}class sl{constructor(t){this.property=t,this.value=new Js(t,void 0)}transitioned(t,r){return new mh(this.property,this.value,r,_i({},t.transition,this.transition),t.now)}untransitioned(){return new mh(this.property,this.value,null,{},0)}}class Tc{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return vr(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new sl(this._values[t].property)),this._values[t].value=new Js(this._values[t].property,r===null?void 0:vr(r))}getTransition(t){return vr(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new sl(this._values[t].property)),this._values[t].transition=vr(r)||void 0}serialize(){const t={};for(const r of Object.keys(this._values)){const a=this.getValue(r);a!==void 0&&(t[r]=a);const c=this.getTransition(r);c!==void 0&&(t[`${r}-transition`]=c)}return t}transitioned(t,r){const a=new gh(this._properties);for(const c of Object.keys(this._values))a._values[c]=this._values[c].transitioned(t,r._values[c]);return a}untransitioned(){const t=new gh(this._properties);for(const r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class mh{constructor(t,r,a,c,d){this.property=t,this.value=r,this.begin=d+c.delay||0,this.end=this.begin+c.duration||0,t.specification.transition&&(c.delay||c.duration)&&(this.prior=a)}possiblyEvaluate(t,r,a){const c=t.now||0,d=this.value.possiblyEvaluate(t,r,a),p=this.prior;if(p){if(c>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(c<this.begin)return p.possiblyEvaluate(t,r,a);{const m=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(t,r,a),d,Er(m))}}return d}}class gh{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,a){const c=new ol(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,r,a);return c}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Xd{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return vr(this._values[t].value)}setValue(t,r){this._values[t]=new Js(this._values[t].property,r===null?void 0:vr(r))}serialize(){const t={};for(const r of Object.keys(this._values)){const a=this.getValue(r);a!==void 0&&(t[r]=a)}return t}possiblyEvaluate(t,r,a){const c=new ol(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,r,a);return c}}class wn{constructor(t,r,a){this.property=t,this.value=r,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,a,c){return this.property.evaluate(this.value,this.parameters,t,r,a,c)}}class ol{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Xe{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,a){const c=Dr[this.specification.type];return c?c(t,r,a):t}}class nt{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,a,c){return new wn(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},a,c)}:t.expression,r)}interpolate(t,r,a){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new wn(this,{kind:"constant",value:void 0},t.parameters);const c=Dr[this.specification.type];if(c){const d=c(t.value.value,r.value.value,a);return new wn(this,{kind:"constant",value:d},t.parameters)}return t}evaluate(t,r,a,c,d,p){return t.kind==="constant"?t.value:t.evaluate(r,a,c,d,p)}}class ll extends nt{possiblyEvaluate(t,r,a,c){if(t.value===void 0)return new wn(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){const d=t.expression.evaluate(r,null,{},a,c),p=t.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,m=this._calculate(p,p,p,r);return new wn(this,{kind:"constant",value:m},r)}if(t.expression.kind==="camera"){const d=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new wn(this,{kind:"constant",value:d},r)}return new wn(this,t.expression,r)}evaluate(t,r,a,c,d,p){if(t.kind==="source"){const m=t.evaluate(r,a,c,d,p);return this._calculate(m,m,m,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},a,c),t.evaluate({zoom:Math.floor(r.zoom)},a,c),t.evaluate({zoom:Math.floor(r.zoom)+1},a,c),r):t.value}_calculate(t,r,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:a,to:r}}interpolate(t){return t}}class Sc{constructor(t){this.specification=t}possiblyEvaluate(t,r,a,c){if(t.value!==void 0){if(t.expression.kind==="constant"){const d=t.expression.evaluate(r,null,{},a,c);return this._calculate(d,d,d,r)}return this._calculate(t.expression.evaluate(new Qt(Math.floor(r.zoom-1),r)),t.expression.evaluate(new Qt(Math.floor(r.zoom),r)),t.expression.evaluate(new Qt(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:a,to:r}}interpolate(t){return t}}class Qs{constructor(t){this.specification=t}possiblyEvaluate(t,r,a,c){return!!t.expression.evaluate(r,null,{},a,c)}interpolate(){return!1}}class mr{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in t){const a=t[r];a.specification.overridable&&this.overridableProperties.push(r);const c=this.defaultPropertyValues[r]=new Js(a,void 0),d=this.defaultTransitionablePropertyValues[r]=new sl(a);this.defaultTransitioningPropertyValues[r]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}Ge("DataDrivenProperty",nt),Ge("DataConstantProperty",Xe),Ge("CrossFadedDataDrivenProperty",ll),Ge("CrossFadedProperty",Sc),Ge("ColorRampProperty",Qs);const _h="-transition";class qi extends Me{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},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,this._featureFilter=Yn(t.filter)),r.layout&&(this._unevaluatedLayout=new Xd(r.layout)),r.paint)){this._transitionablePaint=new Tc(r.paint);for(const a in t.paint)this.setPaintProperty(a,t.paint[a],{validate:!1});for(const a in t.layout)this.setLayoutProperty(a,t.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ol(r.paint)}}setFilter(t){this.filter=t,this._featureFilter=Yn(t)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){const t=new Set;if(this._unevaluatedLayout)for(const r in this._unevaluatedLayout._values){const a=this._unevaluatedLayout._values[r];for(const c of a.getGlobalStateRefs())t.add(c)}for(const r of this._featureFilter.getGlobalStateRefs())t.add(r);return t}setLayoutProperty(t,r,a={}){r!=null&&this._validate(mc,`layers.${this.id}.layout.${t}`,t,r,a)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(_h)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,a={}){if(r!=null&&this._validate(Gd,`layers.${this.id}.paint.${t}`,t,r,a))return!1;if(t.endsWith(_h))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{const c=this._transitionablePaint._values[t],d=c.property.specification["property-type"]==="cross-faded-data-driven",p=c.value.isDataDriven(),m=c.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);const y=this._transitionablePaint._values[t].value;return y.isDataDriven()||p||d||this._handleOverridablePaintPropertyUpdate(t,m,y)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,a){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),zr(t,(r,a)=>!(r===void 0||a==="layout"&&!Object.keys(r).length||a==="paint"&&!Object.keys(r).length))}_validate(t,r,a,c,d={}){return(!d||d.validate!==!1)&&Hs(this,t.call(cs,{key:r,layerType:this.type,objectKey:a,value:c,styleSpec:ae,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const r=this.paint.get(t);if(r instanceof wn&&es(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const yh={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class wa{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ni{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ui(n,t=1){let r=0,a=0;return{members:n.map(c=>{const d=yh[c.type].BYTES_PER_ELEMENT,p=r=xh(r,Math.max(t,d)),m=c.components||1;return a=Math.max(a,d),r+=d*m,{name:c.name,type:c.type,components:m,offset:p}}),size:xh(r,Math.max(a,t)),alignment:t}}function xh(n,t){return Math.ceil(n/t)*t}class Qn extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){const a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){const c=2*t;return this.int16[c+0]=r,this.int16[c+1]=a,t}}Qn.prototype.bytesPerElement=4,Ge("StructArrayLayout2i4",Qn);class ea extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=3*t;return this.int16[d+0]=r,this.int16[d+1]=a,this.int16[d+2]=c,t}}ea.prototype.bytesPerElement=6,Ge("StructArrayLayout3i6",ea);class Pc extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,r,a,c)}emplace(t,r,a,c,d){const p=4*t;return this.int16[p+0]=r,this.int16[p+1]=a,this.int16[p+2]=c,this.int16[p+3]=d,t}}Pc.prototype.bytesPerElement=8,Ge("StructArrayLayout4i8",Pc);class cl extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,a,c,d,p)}emplace(t,r,a,c,d,p,m){const y=6*t;return this.int16[y+0]=r,this.int16[y+1]=a,this.int16[y+2]=c,this.int16[y+3]=d,this.int16[y+4]=p,this.int16[y+5]=m,t}}cl.prototype.bytesPerElement=12,Ge("StructArrayLayout2i4i12",cl);class Ta extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,a,c,d,p)}emplace(t,r,a,c,d,p,m){const y=4*t,b=8*t;return this.int16[y+0]=r,this.int16[y+1]=a,this.uint8[b+4]=c,this.uint8[b+5]=d,this.uint8[b+6]=p,this.uint8[b+7]=m,t}}Ta.prototype.bytesPerElement=8,Ge("StructArrayLayout2i4ub8",Ta);class eo extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){const a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){const c=2*t;return this.float32[c+0]=r,this.float32[c+1]=a,t}}eo.prototype.bytesPerElement=8,Ge("StructArrayLayout2f8",eo);class Mc extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,b,S){const C=this.length;return this.resize(C+1),this.emplace(C,t,r,a,c,d,p,m,y,b,S)}emplace(t,r,a,c,d,p,m,y,b,S,C){const A=10*t;return this.uint16[A+0]=r,this.uint16[A+1]=a,this.uint16[A+2]=c,this.uint16[A+3]=d,this.uint16[A+4]=p,this.uint16[A+5]=m,this.uint16[A+6]=y,this.uint16[A+7]=b,this.uint16[A+8]=S,this.uint16[A+9]=C,t}}Mc.prototype.bytesPerElement=20,Ge("StructArrayLayout10ui20",Mc);class ul extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,b,S,C,A){const L=this.length;return this.resize(L+1),this.emplace(L,t,r,a,c,d,p,m,y,b,S,C,A)}emplace(t,r,a,c,d,p,m,y,b,S,C,A,L){const B=12*t;return this.int16[B+0]=r,this.int16[B+1]=a,this.int16[B+2]=c,this.int16[B+3]=d,this.uint16[B+4]=p,this.uint16[B+5]=m,this.uint16[B+6]=y,this.uint16[B+7]=b,this.int16[B+8]=S,this.int16[B+9]=C,this.int16[B+10]=A,this.int16[B+11]=L,t}}ul.prototype.bytesPerElement=24,Ge("StructArrayLayout4i4ui4i24",ul);class Cc extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=3*t;return this.float32[d+0]=r,this.float32[d+1]=a,this.float32[d+2]=c,t}}Cc.prototype.bytesPerElement=12,Ge("StructArrayLayout3f12",Cc);class u extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}u.prototype.bytesPerElement=4,Ge("StructArrayLayout1ul4",u);class e extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,b){const S=this.length;return this.resize(S+1),this.emplace(S,t,r,a,c,d,p,m,y,b)}emplace(t,r,a,c,d,p,m,y,b,S){const C=10*t,A=5*t;return this.int16[C+0]=r,this.int16[C+1]=a,this.int16[C+2]=c,this.int16[C+3]=d,this.int16[C+4]=p,this.int16[C+5]=m,this.uint32[A+3]=y,this.uint16[C+8]=b,this.uint16[C+9]=S,t}}e.prototype.bytesPerElement=20,Ge("StructArrayLayout6i1ul2ui20",e);class i extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,a,c,d,p)}emplace(t,r,a,c,d,p,m){const y=6*t;return this.int16[y+0]=r,this.int16[y+1]=a,this.int16[y+2]=c,this.int16[y+3]=d,this.int16[y+4]=p,this.int16[y+5]=m,t}}i.prototype.bytesPerElement=12,Ge("StructArrayLayout2i2i2i12",i);class s extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d){const p=this.length;return this.resize(p+1),this.emplace(p,t,r,a,c,d)}emplace(t,r,a,c,d,p){const m=4*t,y=8*t;return this.float32[m+0]=r,this.float32[m+1]=a,this.float32[m+2]=c,this.int16[y+6]=d,this.int16[y+7]=p,t}}s.prototype.bytesPerElement=16,Ge("StructArrayLayout2f1f2i16",s);class l extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,a,c,d,p)}emplace(t,r,a,c,d,p,m){const y=16*t,b=4*t,S=8*t;return this.uint8[y+0]=r,this.uint8[y+1]=a,this.float32[b+1]=c,this.float32[b+2]=d,this.int16[S+6]=p,this.int16[S+7]=m,t}}l.prototype.bytesPerElement=16,Ge("StructArrayLayout2ub2f2i16",l);class h extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=3*t;return this.uint16[d+0]=r,this.uint16[d+1]=a,this.uint16[d+2]=c,t}}h.prototype.bytesPerElement=6,Ge("StructArrayLayout3ui6",h);class f extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,b,S,C,A,L,B,j,U,H){const se=this.length;return this.resize(se+1),this.emplace(se,t,r,a,c,d,p,m,y,b,S,C,A,L,B,j,U,H)}emplace(t,r,a,c,d,p,m,y,b,S,C,A,L,B,j,U,H,se){const Q=24*t,R=12*t,Z=48*t;return this.int16[Q+0]=r,this.int16[Q+1]=a,this.uint16[Q+2]=c,this.uint16[Q+3]=d,this.uint32[R+2]=p,this.uint32[R+3]=m,this.uint32[R+4]=y,this.uint16[Q+10]=b,this.uint16[Q+11]=S,this.uint16[Q+12]=C,this.float32[R+7]=A,this.float32[R+8]=L,this.uint8[Z+36]=B,this.uint8[Z+37]=j,this.uint8[Z+38]=U,this.uint32[R+10]=H,this.int16[Q+22]=se,t}}f.prototype.bytesPerElement=48,Ge("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",f);class _ extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,b,S,C,A,L,B,j,U,H,se,Q,R,Z,te,ge,Ie,be,Te,Re,ze){const De=this.length;return this.resize(De+1),this.emplace(De,t,r,a,c,d,p,m,y,b,S,C,A,L,B,j,U,H,se,Q,R,Z,te,ge,Ie,be,Te,Re,ze)}emplace(t,r,a,c,d,p,m,y,b,S,C,A,L,B,j,U,H,se,Q,R,Z,te,ge,Ie,be,Te,Re,ze,De){const Pe=32*t,He=16*t;return this.int16[Pe+0]=r,this.int16[Pe+1]=a,this.int16[Pe+2]=c,this.int16[Pe+3]=d,this.int16[Pe+4]=p,this.int16[Pe+5]=m,this.int16[Pe+6]=y,this.int16[Pe+7]=b,this.uint16[Pe+8]=S,this.uint16[Pe+9]=C,this.uint16[Pe+10]=A,this.uint16[Pe+11]=L,this.uint16[Pe+12]=B,this.uint16[Pe+13]=j,this.uint16[Pe+14]=U,this.uint16[Pe+15]=H,this.uint16[Pe+16]=se,this.uint16[Pe+17]=Q,this.uint16[Pe+18]=R,this.uint16[Pe+19]=Z,this.uint16[Pe+20]=te,this.uint16[Pe+21]=ge,this.uint16[Pe+22]=Ie,this.uint32[He+12]=be,this.float32[He+13]=Te,this.float32[He+14]=Re,this.uint16[Pe+30]=ze,this.uint16[Pe+31]=De,t}}_.prototype.bytesPerElement=64,Ge("StructArrayLayout8i15ui1ul2f2ui64",_);class x extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}x.prototype.bytesPerElement=4,Ge("StructArrayLayout1f4",x);class T extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=3*t;return this.uint16[6*t+0]=r,this.float32[d+1]=a,this.float32[d+2]=c,t}}T.prototype.bytesPerElement=12,Ge("StructArrayLayout1ui2f12",T);class M extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=4*t;return this.uint32[2*t+0]=r,this.uint16[d+2]=a,this.uint16[d+3]=c,t}}M.prototype.bytesPerElement=8,Ge("StructArrayLayout1ul2ui8",M);class E extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){const a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){const c=2*t;return this.uint16[c+0]=r,this.uint16[c+1]=a,t}}E.prototype.bytesPerElement=4,Ge("StructArrayLayout2ui4",E);class I extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}I.prototype.bytesPerElement=2,Ge("StructArrayLayout1ui2",I);class k extends ni{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,r,a,c)}emplace(t,r,a,c,d){const p=4*t;return this.float32[p+0]=r,this.float32[p+1]=a,this.float32[p+2]=c,this.float32[p+3]=d,t}}k.prototype.bytesPerElement=16,Ge("StructArrayLayout4f16",k);class O extends wa{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 Ue(this.anchorPointX,this.anchorPointY)}}O.prototype.size=20;class q extends e{get(t){return new O(this,t)}}Ge("CollisionBoxArray",q);class G extends wa{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]}}G.prototype.size=48;class W extends f{get(t){return new G(this,t)}}Ge("PlacedSymbolArray",W);class X extends wa{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]}}X.prototype.size=64;class ee extends _{get(t){return new X(this,t)}}Ge("SymbolInstanceArray",ee);class Y extends x{getoffsetX(t){return this.float32[1*t+0]}}Ge("GlyphOffsetArray",Y);class ie extends ea{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Ge("SymbolLineVertexArray",ie);class ne extends wa{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]}}ne.prototype.size=12;class K extends T{get(t){return new ne(this,t)}}Ge("TextAnchorOffsetArray",K);class le extends wa{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]}}le.prototype.size=8;class ye extends M{get(t){return new le(this,t)}}Ge("FeatureIndexArray",ye);class pe extends Qn{}class me extends Qn{}class ve extends Qn{}class je extends cl{}class Fe extends Ta{}class Ee extends eo{}class We extends Mc{}class ht extends ul{}class Lt extends Cc{}class ai extends u{}class Zt extends i{}class si extends l{}class $t extends h{}class Ut extends E{}const Gt=ui([{name:"a_pos",components:2,type:"Int16"}],4),{members:Wi}=Gt;class Ct{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,r,a,c){const d=this.segments[this.segments.length-1];return t>Ct.MAX_VERTEX_ARRAY_LENGTH&&Mi(`Max vertices per segment is ${Ct.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Ct.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!d||d.vertexLength+t>Ct.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==c?this.createNewSegment(r,a,c):d}createNewSegment(t,r,a){const c={vertexOffset:t.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return a!==void 0&&(c.sortKey=a),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(c),c}getOrCreateLatestSegment(t,r,a){return this.prepareSegment(0,t,r,a)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,a,c){return new Ct([{vertexOffset:t,primitiveOffset:r,vertexLength:a,primitiveLength:c,vaos:{},sortKey:0}])}}function Di(n,t){return 256*(n=zt(Math.floor(n),0,255))+zt(Math.floor(t),0,255)}Ct.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ge("SegmentVector",Ct);const Hi=ui([{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 ta,ia,ra,Tn={exports:{}},to={exports:{}},io={exports:{}},ds=function(){if(ra)return Tn.exports;ra=1;var n=(ta||(ta=1,to.exports=function(r,a){var c,d,p,m,y,b,S,C;for(d=r.length-(c=3&r.length),p=a,y=3432918353,b=461845907,C=0;C<d;)S=255&r.charCodeAt(C)|(255&r.charCodeAt(++C))<<8|(255&r.charCodeAt(++C))<<16|(255&r.charCodeAt(++C))<<24,++C,p=27492+(65535&(m=5*(65535&(p=(p^=S=(65535&(S=(S=(65535&S)*y+(((S>>>16)*y&65535)<<16)&4294967295)<<15|S>>>17))*b+(((S>>>16)*b&65535)<<16)&4294967295)<<13|p>>>19))+((5*(p>>>16)&65535)<<16)&4294967295))+((58964+(m>>>16)&65535)<<16);switch(S=0,c){case 3:S^=(255&r.charCodeAt(C+2))<<16;case 2:S^=(255&r.charCodeAt(C+1))<<8;case 1:p^=S=(65535&(S=(S=(65535&(S^=255&r.charCodeAt(C)))*y+(((S>>>16)*y&65535)<<16)&4294967295)<<15|S>>>17))*b+(((S>>>16)*b&65535)<<16)&4294967295}return p^=r.length,p=2246822507*(65535&(p^=p>>>16))+((2246822507*(p>>>16)&65535)<<16)&4294967295,p=3266489909*(65535&(p^=p>>>13))+((3266489909*(p>>>16)&65535)<<16)&4294967295,(p^=p>>>16)>>>0}),to.exports),t=(ia||(ia=1,io.exports=function(r,a){for(var c,d=r.length,p=a^d,m=0;d>=4;)c=1540483477*(65535&(c=255&r.charCodeAt(m)|(255&r.charCodeAt(++m))<<8|(255&r.charCodeAt(++m))<<16|(255&r.charCodeAt(++m))<<24))+((1540483477*(c>>>16)&65535)<<16),p=1540483477*(65535&p)+((1540483477*(p>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),d-=4,++m;switch(d){case 3:p^=(255&r.charCodeAt(m+2))<<16;case 2:p^=(255&r.charCodeAt(m+1))<<8;case 1:p=1540483477*(65535&(p^=255&r.charCodeAt(m)))+((1540483477*(p>>>16)&65535)<<16)}return p=1540483477*(65535&(p^=p>>>13))+((1540483477*(p>>>16)&65535)<<16),(p^=p>>>15)>>>0}),io.exports);return Tn.exports=n,Tn.exports.murmur3=n,Tn.exports.murmur2=t,Tn.exports}(),Sr=fe(ds);class on{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,a,c){this.ids.push(na(t)),this.positions.push(r,a,c)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=na(t);let a=0,c=this.ids.length-1;for(;a<c;){const p=a+c>>1;this.ids[p]>=r?c=p:a=p+1}const d=[];for(;this.ids[a]===r;)d.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return d}static serialize(t,r){const a=new Float64Array(t.ids),c=new Uint32Array(t.positions);return Sa(a,c,0,a.length-1),r&&r.push(a.buffer,c.buffer),{ids:a,positions:c}}static deserialize(t){const r=new on;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function na(n){const t=+n;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:Sr(String(n))}function Sa(n,t,r,a){for(;r<a;){const c=n[r+a>>1];let d=r-1,p=a+1;for(;;){do d++;while(n[d]<c);do p--;while(n[p]>c);if(d>=p)break;fi(n,d,p),fi(t,3*d,3*p),fi(t,3*d+1,3*p+1),fi(t,3*d+2,3*p+2)}p-r<a-p?(Sa(n,t,r,p),r=p+1):(Sa(n,t,p+1,a),a=p)}}function fi(n,t,r){const a=n[t];n[t]=n[r],n[r]=a}Ge("FeaturePositionMap",on);class Ht{constructor(t,r){this.gl=t.gl,this.location=r}}class gr extends Ht{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Ci extends Ht{constructor(t,r){super(t,r),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class vh extends Ht{constructor(t,r){super(t,r),this.current=xt.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 Yd=new Float32Array(16);function Ic(n){return[Di(255*n.r,255*n.g),Di(255*n.b,255*n.a)]}class ro{constructor(t,r,a){this.value=t,this.uniformNames=r.map(c=>`u_${c}`),this.type=a}setUniform(t,r,a){t.set(a.constantOr(this.value))}getBinding(t,r,a){return this.type==="color"?new vh(t,r):new gr(t,r)}}class ps{constructor(t,r){this.uniformNames=r.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,a,c){const d=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;d&&t.set(d)}getBinding(t,r,a){return a.substr(0,9)==="u_pattern"?new Ci(t,r):new gr(t,r)}}class Dn{constructor(t,r,a,c){this.expression=t,this.type=a,this.maxValue=0,this.paintVertexAttributes=r.map(d=>({name:`a_${d}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(t,r,a,c,d){const p=this.paintVertexArray.length,m=this.expression.evaluate(new Qt(0),r,{},c,[],d);this.paintVertexArray.resize(t),this._setPaintValue(p,t,m)}updatePaintArray(t,r,a,c){const d=this.expression.evaluate({zoom:0},a,c);this._setPaintValue(t,r,d)}_setPaintValue(t,r,a){if(this.type==="color"){const c=Ic(a);for(let d=t;d<r;d++)this.paintVertexArray.emplace(d,c[0],c[1])}else{for(let c=t;c<r;c++)this.paintVertexArray.emplace(c,a);this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Xi{constructor(t,r,a,c,d,p){this.expression=t,this.uniformNames=r.map(m=>`u_${m}_t`),this.type=a,this.useIntegerZoom=c,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:a==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(t,r,a,c,d){const p=this.expression.evaluate(new Qt(this.zoom),r,{},c,[],d),m=this.expression.evaluate(new Qt(this.zoom+1),r,{},c,[],d),y=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(y,t,p,m)}updatePaintArray(t,r,a,c){const d=this.expression.evaluate({zoom:this.zoom},a,c),p=this.expression.evaluate({zoom:this.zoom+1},a,c);this._setPaintValue(t,r,d,p)}_setPaintValue(t,r,a,c){if(this.type==="color"){const d=Ic(a),p=Ic(c);for(let m=t;m<r;m++)this.paintVertexArray.emplace(m,d[0],d[1],p[0],p[1])}else{for(let d=t;d<r;d++)this.paintVertexArray.emplace(d,a,c);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(c))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,r){const a=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,c=zt(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);t.set(c)}getBinding(t,r,a){return new gr(t,r)}}class Ln{constructor(t,r,a,c,d,p){this.expression=t,this.type=r,this.useIntegerZoom=a,this.zoom=c,this.layerId=p,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(t,r,a){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(c,t,r.patterns&&r.patterns[this.layerId],a)}updatePaintArray(t,r,a,c,d){this._setPaintValues(t,r,a.patterns&&a.patterns[this.layerId],d)}_setPaintValues(t,r,a,c){if(!c||!a)return;const{min:d,mid:p,max:m}=a,y=c[d],b=c[p],S=c[m];if(y&&b&&S)for(let C=t;C<r;C++)this.zoomInPaintVertexArray.emplace(C,b.tl[0],b.tl[1],b.br[0],b.br[1],y.tl[0],y.tl[1],y.br[0],y.br[1],b.pixelRatio,y.pixelRatio),this.zoomOutPaintVertexArray.emplace(C,b.tl[0],b.tl[1],b.br[0],b.br[1],S.tl[0],S.tl[1],S.br[0],S.br[1],b.pixelRatio,S.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Hi.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Hi.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Ec{constructor(t,r,a){this.binders={},this._buffers=[];const c=[];for(const d in t.paint._values){if(!a(d))continue;const p=t.paint.get(d);if(!(p instanceof wn&&es(p.property.specification)))continue;const m=zc(d,t.type),y=p.value,b=p.property.specification.type,S=p.property.useIntegerZoom,C=p.property.specification["property-type"],A=C==="cross-faded"||C==="cross-faded-data-driven";if(y.kind==="constant")this.binders[d]=A?new ps(y.value,m):new ro(y.value,m,b),c.push(`/u_${d}`);else if(y.kind==="source"||A){const L=Ac(d,b,"source");this.binders[d]=A?new Ln(y,b,S,r,L,t.id):new Dn(y,m,b,L),c.push(`/a_${d}`)}else{const L=Ac(d,b,"composite");this.binders[d]=new Xi(y,m,b,S,r,L),c.push(`/z_${d}`)}}this.cacheKey=c.sort().join("")}getMaxValue(t){const r=this.binders[t];return r instanceof Dn||r instanceof Xi?r.maxValue:0}populatePaintArrays(t,r,a,c,d){for(const p in this.binders){const m=this.binders[p];(m instanceof Dn||m instanceof Xi||m instanceof Ln)&&m.populatePaintArray(t,r,a,c,d)}}setConstantPatternPositions(t,r){for(const a in this.binders){const c=this.binders[a];c instanceof ps&&c.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,a,c,d){let p=!1;for(const m in t){const y=r.getPositions(m);for(const b of y){const S=a.feature(b.index);for(const C in this.binders){const A=this.binders[C];if((A instanceof Dn||A instanceof Xi||A instanceof Ln)&&A.expression.isStateDependent===!0){const L=c.paint.get(C);A.expression=L.value,A.updatePaintArray(b.start,b.end,S,t[m],d),p=!0}}}}return p}defines(){const t=[];for(const r in this.binders){const a=this.binders[r];(a instanceof ro||a instanceof ps)&&t.push(...a.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return t}getBinderAttributes(){const t=[];for(const r in this.binders){const a=this.binders[r];if(a instanceof Dn||a instanceof Xi)for(let c=0;c<a.paintVertexAttributes.length;c++)t.push(a.paintVertexAttributes[c].name);else if(a instanceof Ln)for(let c=0;c<Hi.members.length;c++)t.push(Hi.members[c].name)}return t}getBinderUniforms(){const t=[];for(const r in this.binders){const a=this.binders[r];if(a instanceof ro||a instanceof ps||a instanceof Xi)for(const c of a.uniformNames)t.push(c)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){const a=[];for(const c in this.binders){const d=this.binders[c];if(d instanceof ro||d instanceof ps||d instanceof Xi){for(const p of d.uniformNames)if(r[p]){const m=d.getBinding(t,r[p],p);a.push({name:p,property:c,binding:m})}}}return a}setUniforms(t,r,a,c){for(const{name:d,property:p,binding:m}of r)this.binders[p].setUniform(m,c,a.get(p),d)}updatePaintBuffers(t){this._buffers=[];for(const r in this.binders){const a=this.binders[r];if(t&&a instanceof Ln){const c=t.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(a instanceof Dn||a instanceof Xi)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(t){for(const r in this.binders){const a=this.binders[r];(a instanceof Dn||a instanceof Xi||a instanceof Ln)&&a.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const r=this.binders[t];(r instanceof Dn||r instanceof Xi||r instanceof Ln)&&r.destroy()}}}class aa{constructor(t,r,a=()=>!0){this.programConfigurations={};for(const c of t)this.programConfigurations[c.id]=new Ec(c,r,a);this.needsUpload=!1,this._featureMap=new on,this._bufferOffset=0}populatePaintArrays(t,r,a,c,d,p){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(t,r,c,d,p);r.id!==void 0&&this._featureMap.add(r.id,a,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,a,c){for(const d of a)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(t,this._featureMap,r,d,c)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function zc(n,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[n]||[n.replace(`${t}-`,"").replace(/-/g,"_")]}function Ac(n,t,r){const a={color:{source:eo,composite:k},number:{source:x,composite:eo}},c=function(d){return{"line-pattern":{source:We,composite:We},"fill-pattern":{source:We,composite:We},"fill-extrusion-pattern":{source:We,composite:We}}[d]}(n);return c&&c[r]||a[t][r]}Ge("ConstantBinder",ro),Ge("CrossFadedConstantBinder",ps),Ge("SourceExpressionBinder",Dn),Ge("CrossFadedCompositeBinder",Ln),Ge("CompositeExpressionBinder",Xi),Ge("ProgramConfiguration",Ec,{omit:["_buffers"]}),Ge("ProgramConfigurationSet",aa);const no=Math.pow(2,14)-1,tm=-no-1;function ao(n){const t=Rt/n.extent,r=n.loadGeometry();for(let a=0;a<r.length;a++){const c=r[a];for(let d=0;d<c.length;d++){const p=c[d],m=Math.round(p.x*t),y=Math.round(p.y*t);p.x=zt(m,tm,no),p.y=zt(y,tm,no),(m<p.x||m>p.x+1||y<p.y||y>p.y+1)&&Mi("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function so(n,t){return{type:n.type,id:n.id,properties:n.properties,geometry:t?ao(n):[]}}const im=-32768;function sx(n,t,r,a,c){n.emplaceBack(im+8*t+a,im+8*r+c)}class Kd{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new me,this.indexArray=new $t,this.segments=new Ct,this.programConfigurations=new aa(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){const c=this.layers[0],d=[];let p=null,m=!1,y=c.type==="heatmap";if(c.type==="circle"){const S=c;p=S.layout.get("circle-sort-key"),m=!p.isConstant(),y=y||S.paint.get("circle-pitch-alignment")==="map"}const b=y?r.subdivisionGranularity.circle:1;for(const{feature:S,id:C,index:A,sourceLayerIndex:L}of t){const B=this.layers[0]._featureFilter.needGeometry,j=so(S,B);if(!this.layers[0]._featureFilter.filter(new Qt(this.zoom,{globalState:this.globalState}),j,a))continue;const U=m?p.evaluate(j,{},a):void 0,H={id:C,properties:S.properties,type:S.type,sourceLayerIndex:L,index:A,geometry:B?j.geometry:ao(S),patterns:{},sortKey:U};d.push(H)}m&&d.sort((S,C)=>S.sortKey-C.sortKey);for(const S of d){const{geometry:C,index:A,sourceLayerIndex:L}=S,B=t[A].feature;this.addFeature(S,C,A,a,b),r.featureIndex.insert(B,C,A,L,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Wi),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,a,c,d=1){let p;switch(d){case 1:p=[0,7];break;case 3:p=[0,2,5,7];break;case 5:p=[0,1,3,4,6,7];break;case 7:p=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${d}; valid values are 1, 3, 5, 7.`)}const m=p.length;for(const y of r)for(const b of y){const S=b.x,C=b.y;if(S<0||S>=Rt||C<0||C>=Rt)continue;const A=this.segments.prepareSegment(m*m,this.layoutVertexArray,this.indexArray,t.sortKey),L=A.vertexLength;for(let B=0;B<m;B++)for(let j=0;j<m;j++)sx(this.layoutVertexArray,S,C,p[j],p[B]);for(let B=0;B<m-1;B++)for(let j=0;j<m-1;j++){const U=L+B*m+j,H=L+(B+1)*m+j;this.indexArray.emplaceBack(U,H+1,U+1),this.indexArray.emplaceBack(U,H,H+1)}A.vertexLength+=m*m,A.primitiveLength+=(m-1)*(m-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,{},c)}}function rm(n,t){for(let r=0;r<n.length;r++)if(hl(t,n[r]))return!0;for(let r=0;r<t.length;r++)if(hl(n,t[r]))return!0;return!!Jd(n,t)}function ox(n,t,r){return!!hl(n,t)||!!Qd(t,n,r)}function nm(n,t){if(n.length===1)return sm(t,n[0]);for(let r=0;r<t.length;r++){const a=t[r];for(let c=0;c<a.length;c++)if(hl(n,a[c]))return!0}for(let r=0;r<n.length;r++)if(sm(t,n[r]))return!0;for(let r=0;r<t.length;r++)if(Jd(n,t[r]))return!0;return!1}function lx(n,t,r){if(n.length>1){if(Jd(n,t))return!0;for(let a=0;a<t.length;a++)if(Qd(t[a],n,r))return!0}for(let a=0;a<n.length;a++)if(Qd(n[a],t,r))return!0;return!1}function Jd(n,t){if(n.length===0||t.length===0)return!1;for(let r=0;r<n.length-1;r++){const a=n[r],c=n[r+1];for(let d=0;d<t.length-1;d++)if(cx(a,c,t[d],t[d+1]))return!0}return!1}function cx(n,t,r,a){return hr(n,r,a)!==hr(t,r,a)&&hr(n,t,r)!==hr(n,t,a)}function Qd(n,t,r){const a=r*r;if(t.length===1)return n.distSqr(t[0])<a;for(let c=1;c<t.length;c++)if(am(n,t[c-1],t[c])<a)return!0;return!1}function am(n,t,r){const a=t.distSqr(r);if(a===0)return n.distSqr(t);const c=((n.x-t.x)*(r.x-t.x)+(n.y-t.y)*(r.y-t.y))/a;return n.distSqr(c<0?t:c>1?r:r.sub(t)._mult(c)._add(t))}function sm(n,t){let r,a,c,d=!1;for(let p=0;p<n.length;p++){r=n[p];for(let m=0,y=r.length-1;m<r.length;y=m++)a=r[m],c=r[y],a.y>t.y!=c.y>t.y&&t.x<(c.x-a.x)*(t.y-a.y)/(c.y-a.y)+a.x&&(d=!d)}return d}function hl(n,t){let r=!1;for(let a=0,c=n.length-1;a<n.length;c=a++){const d=n[a],p=n[c];d.y>t.y!=p.y>t.y&&t.x<(p.x-d.x)*(t.y-d.y)/(p.y-d.y)+d.x&&(r=!r)}return r}function ux(n,t,r){const a=r[0],c=r[2];if(n.x<a.x&&t.x<a.x||n.x>c.x&&t.x>c.x||n.y<a.y&&t.y<a.y||n.y>c.y&&t.y>c.y)return!1;const d=hr(n,t,r[0]);return d!==hr(n,t,r[1])||d!==hr(n,t,r[2])||d!==hr(n,t,r[3])}function kc(n,t,r){const a=t.paint.get(n).value;return a.kind==="constant"?a.value:r.programConfigurations.get(t.id).getMaxValue(n)}function bh(n){return Math.sqrt(n[0]*n[0]+n[1]*n[1])}function wh(n,t,r,a,c){if(!t[0]&&!t[1])return n;const d=Ue.convert(t)._mult(c);r==="viewport"&&d._rotate(-a);const p=[];for(let m=0;m<n.length;m++)p.push(n[m].sub(d));return p}let om,lm;Ge("CircleBucket",Kd,{omit:["layers"]});var hx={get paint(){return lm=lm||new mr({"circle-radius":new nt(ae.paint_circle["circle-radius"]),"circle-color":new nt(ae.paint_circle["circle-color"]),"circle-blur":new nt(ae.paint_circle["circle-blur"]),"circle-opacity":new nt(ae.paint_circle["circle-opacity"]),"circle-translate":new Xe(ae.paint_circle["circle-translate"]),"circle-translate-anchor":new Xe(ae.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Xe(ae.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Xe(ae.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new nt(ae.paint_circle["circle-stroke-width"]),"circle-stroke-color":new nt(ae.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new nt(ae.paint_circle["circle-stroke-opacity"])})},get layout(){return om=om||new mr({"circle-sort-key":new nt(ae.layout_circle["circle-sort-key"])})}};class dx extends qi{constructor(t){super(t,hx)}createBucket(t){return new Kd(t)}queryRadius(t){const r=t;return kc("circle-radius",this,r)+kc("circle-stroke-width",this,r)+bh(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,unwrappedTileID:m,getElevation:y}){const b=wh(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-d.bearingInRadians,p),S=this.paint.get("circle-radius").evaluate(r,a)+this.paint.get("circle-stroke-width").evaluate(r,a),C=this.paint.get("circle-pitch-alignment")==="map",A=C?b:function(B,j,U,H){return B.map(se=>cm(se,j,U,H))}(b,d,m,y),L=C?S*p:S;for(const B of c)for(const j of B){const U=C?j:cm(j,d,m,y);let H=L;const se=d.projectTileCoordinates(j.x,j.y,m,y).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?H*=se/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(H*=d.cameraToCenterDistance/se),ox(A,U,H))return!0}return!1}}function cm(n,t,r,a){const c=t.projectTileCoordinates(n.x,n.y,r,a).point;return new Ue((.5*c.x+.5)*t.width,(.5*-c.y+.5)*t.height)}class um extends Kd{}let hm;Ge("HeatmapBucket",um,{omit:["layers"]});var px={get paint(){return hm=hm||new mr({"heatmap-radius":new nt(ae.paint_heatmap["heatmap-radius"]),"heatmap-weight":new nt(ae.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Xe(ae.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Qs(ae.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Xe(ae.paint_heatmap["heatmap-opacity"])})}};function ep(n,{width:t,height:r},a,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==t*r*a)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${t*r*a}`)}else c=new Uint8Array(t*r*a);return n.width=t,n.height=r,n.data=c,n}function dm(n,{width:t,height:r},a){if(t===n.width&&r===n.height)return;const c=ep({},{width:t,height:r},a);tp(n,c,{x:0,y:0},{x:0,y:0},{width:Math.min(n.width,t),height:Math.min(n.height,r)},a),n.width=t,n.height=r,n.data=c.data}function tp(n,t,r,a,c,d){if(c.width===0||c.height===0)return t;if(c.width>n.width||c.height>n.height||r.x>n.width-c.width||r.y>n.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>t.width||c.height>t.height||a.x>t.width-c.width||a.y>t.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const p=n.data,m=t.data;if(p===m)throw new Error("srcData equals dstData, so image is already copied");for(let y=0;y<c.height;y++){const b=((r.y+y)*n.width+r.x)*d,S=((a.y+y)*t.width+a.x)*d;for(let C=0;C<c.width*d;C++)m[S+C]=p[b+C]}return t}class Rc{constructor(t,r){ep(this,t,1,r)}resize(t){dm(this,t,1)}clone(){return new Rc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,a,c,d){tp(t,r,a,c,d,1)}}class Lr{constructor(t,r){ep(this,t,4,r)}resize(t){dm(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Lr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,a,c,d){tp(t,r,a,c,d,4)}setPixel(t,r,a){const c=4*(t*this.width+r);this.data[c+0]=Math.round(255*a.r/a.a),this.data[c+1]=Math.round(255*a.g/a.a),this.data[c+2]=Math.round(255*a.b/a.a),this.data[c+3]=Math.round(255*a.a)}}function pm(n){const t={},r=n.resolution||256,a=n.clips?n.clips.length:1,c=n.image||new Lr({width:r,height:a});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const d=(p,m,y)=>{t[n.evaluationKey]=y;const b=n.expression.evaluate(t);c.setPixel(p/4/r,m/4,b)};if(n.clips)for(let p=0,m=0;p<a;++p,m+=4*r)for(let y=0,b=0;y<r;y++,b+=4){const S=y/(r-1),{start:C,end:A}=n.clips[p];d(m,b,C*(1-S)+A*S)}else for(let p=0,m=0;p<r;p++,m+=4)d(0,m,p/(r-1));return c}Ge("AlphaImage",Rc),Ge("RGBAImage",Lr);const ip="big-fb";class fx extends qi{createBucket(t){return new um(t)}constructor(t){super(t,px),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=pm({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(ip)&&this.heatmapFbos.delete(ip)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let fm;var mx={get paint(){return fm=fm||new mr({"hillshade-illumination-direction":new Xe(ae.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Xe(ae.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Xe(ae.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Xe(ae.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Xe(ae.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Xe(ae.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Xe(ae.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Xe(ae.paint_hillshade["hillshade-method"])})}};class gx extends qi{constructor(t){super(t,mx),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,r=this.paint.get("hillshade-illumination-altitude").values,a=this.paint.get("hillshade-highlight-color").values,c=this.paint.get("hillshade-shadow-color").values;const d=Math.max(t.length,r.length,a.length,c.length);t=t.concat(Array(d-t.length).fill(t.at(-1))),r=r.concat(Array(d-r.length).fill(r.at(-1))),a=a.concat(Array(d-a.length).fill(a.at(-1))),c=c.concat(Array(d-c.length).fill(c.at(-1)));const p=r.map(Le);return{directionRadians:t.map(Le),altitudeRadians:p,shadowColor:c,highlightColor:a}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}let mm;var _x={get paint(){return mm=mm||new mr({"color-relief-opacity":new Xe(ae["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Qs(ae["paint_color-relief"]["color-relief-color"])})}};class rp{constructor(t,r,a,c){this.context=t,this.format=a,this.texture=t.gl.createTexture(),this.update(r,c)}update(t,r,a){const{width:c,height:d}=t,p=!(this.size&&this.size[0]===c&&this.size[1]===d||a),{context:m}=this,{gl:y}=m;if(this.useMipmap=!!(r&&r.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),m.pixelStoreUnpackFlipY.set(!1),m.pixelStoreUnpack.set(1),m.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!r||r.premultiply!==!1)),p)this.size=[c,d],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||gn(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,c,d,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:b,y:S}=a||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||gn(t)?y.texSubImage2D(y.TEXTURE_2D,0,b,S,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,b,S,c,d,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D),m.pixelStoreUnpackFlipY.setDefault(),m.pixelStoreUnpack.setDefault(),m.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(t,r,a){const{context:c}=this,{gl:d}=c;d.bindTexture(d.TEXTURE_2D,this.texture),a!==d.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=d.LINEAR),t!==this.filter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,t),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,a||t),this.filter=t),r!==this.wrap&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,r),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,r),this.wrap=r)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}class gm{constructor(t,r,a,c=1,d=1,p=1,m=0){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(a&&!["mapbox","terrarium","custom"].includes(a))return void Mi(`"${a}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const y=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),a){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=c,this.greenFactor=d,this.blueFactor=p,this.baseShift=m;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let b=0;b<y;b++)this.data[this._idx(-1,b)]=this.data[this._idx(0,b)],this.data[this._idx(y,b)]=this.data[this._idx(y-1,b)],this.data[this._idx(b,-1)]=this.data[this._idx(b,0)],this.data[this._idx(b,y)]=this.data[this._idx(b,y-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(y,-1)]=this.data[this._idx(y-1,0)],this.data[this._idx(-1,y)]=this.data[this._idx(0,y-1)],this.data[this._idx(y,y)]=this.data[this._idx(y-1,y-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let b=0;b<y;b++)for(let S=0;S<y;S++){const C=this.get(b,S);C>this.max&&(this.max=C),C<this.min&&(this.min=C)}}get(t,r){const a=new Uint8Array(this.data.buffer),c=4*this._idx(t,r);return this.unpack(a[c],a[c+1],a[c+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,a){return t*this.redFactor+r*this.greenFactor+a*this.blueFactor-this.baseShift}pack(t){return _m(t,this.getUnpackVector())}getPixels(){return new Lr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,a){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let c=r*this.dim,d=r*this.dim+this.dim,p=a*this.dim,m=a*this.dim+this.dim;switch(r){case-1:c=d-1;break;case 1:d=c+1}switch(a){case-1:p=m-1;break;case 1:m=p+1}const y=-r*this.dim,b=-a*this.dim;for(let S=p;S<m;S++)for(let C=c;C<d;C++)this.data[this._idx(C,S)]=t.data[this._idx(C+y,S+b)]}}function _m(n,t){const r=t[0],a=t[1],c=t[2],d=t[3],p=Math.min(r,a,c),m=Math.round((n+d)/p);return{r:Math.floor(m*p/r)%256,g:Math.floor(m*p/a)%256,b:Math.floor(m*p/c)%256}}Ge("DEMData",gm);class yx extends qi{constructor(t){super(t,_x)}_createColorRamp(t){const r={elevationStops:[],colorStops:[]},a=this._transitionablePaint._values["color-relief-color"].value.expression;if(a instanceof Zs&&a._styleExpression.expression instanceof pr){this.colorRampExpression=a;const p=a._styleExpression.expression;r.elevationStops=p.labels,r.colorStops=[];for(const m of r.elevationStops)r.colorStops.push(p.evaluate({globals:{elevation:m}}))}if(r.elevationStops.length<1&&(r.elevationStops=[0],r.colorStops=[xt.transparent]),r.elevationStops.length<2&&(r.elevationStops.push(r.elevationStops[0]+1),r.colorStops.push(r.colorStops[0])),r.elevationStops.length<=t)return r;const c={elevationStops:[],colorStops:[]},d=(r.elevationStops.length-1)/(t-1);for(let p=0;p<r.elevationStops.length-.5;p+=d)c.elevationStops.push(r.elevationStops[Math.round(p)]),c.colorStops.push(r.colorStops[Math.round(p)]);return Mi(`Too many colors in specification of ${this.id} color-relief layer, may not render properly.`),c}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,r,a){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const c=this._createColorRamp(r),d=new Lr({width:c.colorStops.length,height:1}),p=new Lr({width:c.colorStops.length,height:1});for(let m=0;m<c.elevationStops.length;m++){const y=_m(c.elevationStops[m],a);p.setPixel(0,m,new xt(y.r/255,y.g/255,y.b/255,1)),d.setPixel(0,m,c.colorStops[m])}return this.colorRampTextures={elevationTexture:new rp(t,p,t.gl.RGBA),colorTexture:new rp(t,d,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}}const xx=ui([{name:"a_pos",components:2,type:"Int16"}],4),{members:vx}=xx;function np(n,t,r){const a=r.patternDependencies;let c=!1;for(const d of t){const p=d.paint.get(`${n}-pattern`);p.isConstant()||(c=!0);const m=p.constantOr(null);m&&(c=!0,a[m.to]=!0,a[m.from]=!0)}return c}function ap(n,t,r,a,c){const d=c.patternDependencies;for(const p of t){const m=p.paint.get(`${n}-pattern`).value;if(m.kind!=="constant"){let y=m.evaluate({zoom:a-1},r,{},c.availableImages),b=m.evaluate({zoom:a},r,{},c.availableImages),S=m.evaluate({zoom:a+1},r,{},c.availableImages);y=y&&y.name?y.name:y,b=b&&b.name?b.name:b,S=S&&S.name?S.name:S,d[y]=!0,d[b]=!0,d[S]=!0,r.patterns[p.id]={min:y,mid:b,max:S}}}return r}function ym(n,t,r,a,c){let d;if(c===function(p,m,y,b){let S=0;for(let C=m,A=y-b;C<y;C+=b)S+=(p[A]-p[C])*(p[C+1]+p[A+1]),A=C;return S}(n,t,r,a)>0)for(let p=t;p<r;p+=a)d=wm(p/a|0,n[p],n[p+1],d);else for(let p=r-a;p>=t;p-=a)d=wm(p/a|0,n[p],n[p+1],d);return d&&dl(d,d.next)&&(Fc(d),d=d.next),d}function oo(n,t){if(!n)return n;t||(t=n);let r,a=n;do if(r=!1,a.steiner||!dl(a,a.next)&&xi(a.prev,a,a.next)!==0)a=a.next;else{if(Fc(a),a=t=a.prev,a===a.next)break;r=!0}while(r||a!==t);return t}function Dc(n,t,r,a,c,d,p){if(!n)return;!p&&d&&function(y,b,S,C){let A=y;do A.z===0&&(A.z=sp(A.x,A.y,b,S,C)),A.prevZ=A.prev,A.nextZ=A.next,A=A.next;while(A!==y);A.prevZ.nextZ=null,A.prevZ=null,function(L){let B,j=1;do{let U,H=L;L=null;let se=null;for(B=0;H;){B++;let Q=H,R=0;for(let te=0;te<j&&(R++,Q=Q.nextZ,Q);te++);let Z=j;for(;R>0||Z>0&&Q;)R!==0&&(Z===0||!Q||H.z<=Q.z)?(U=H,H=H.nextZ,R--):(U=Q,Q=Q.nextZ,Z--),se?se.nextZ=U:L=U,U.prevZ=se,se=U;H=Q}se.nextZ=null,j*=2}while(B>1)}(A)}(n,a,c,d);let m=n;for(;n.prev!==n.next;){const y=n.prev,b=n.next;if(d?wx(n,a,c,d):bx(n))t.push(y.i,n.i,b.i),Fc(n),n=b.next,m=b.next;else if((n=b)===m){p?p===1?Dc(n=Tx(oo(n),t),t,r,a,c,d,2):p===2&&Sx(n,t,r,a,c,d):Dc(oo(n),t,r,a,c,d,1);break}}}function bx(n){const t=n.prev,r=n,a=n.next;if(xi(t,r,a)>=0)return!1;const c=t.x,d=r.x,p=a.x,m=t.y,y=r.y,b=a.y,S=Math.min(c,d,p),C=Math.min(m,y,b),A=Math.max(c,d,p),L=Math.max(m,y,b);let B=a.next;for(;B!==t;){if(B.x>=S&&B.x<=A&&B.y>=C&&B.y<=L&&Lc(c,m,d,y,p,b,B.x,B.y)&&xi(B.prev,B,B.next)>=0)return!1;B=B.next}return!0}function wx(n,t,r,a){const c=n.prev,d=n,p=n.next;if(xi(c,d,p)>=0)return!1;const m=c.x,y=d.x,b=p.x,S=c.y,C=d.y,A=p.y,L=Math.min(m,y,b),B=Math.min(S,C,A),j=Math.max(m,y,b),U=Math.max(S,C,A),H=sp(L,B,t,r,a),se=sp(j,U,t,r,a);let Q=n.prevZ,R=n.nextZ;for(;Q&&Q.z>=H&&R&&R.z<=se;){if(Q.x>=L&&Q.x<=j&&Q.y>=B&&Q.y<=U&&Q!==c&&Q!==p&&Lc(m,S,y,C,b,A,Q.x,Q.y)&&xi(Q.prev,Q,Q.next)>=0||(Q=Q.prevZ,R.x>=L&&R.x<=j&&R.y>=B&&R.y<=U&&R!==c&&R!==p&&Lc(m,S,y,C,b,A,R.x,R.y)&&xi(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;Q&&Q.z>=H;){if(Q.x>=L&&Q.x<=j&&Q.y>=B&&Q.y<=U&&Q!==c&&Q!==p&&Lc(m,S,y,C,b,A,Q.x,Q.y)&&xi(Q.prev,Q,Q.next)>=0)return!1;Q=Q.prevZ}for(;R&&R.z<=se;){if(R.x>=L&&R.x<=j&&R.y>=B&&R.y<=U&&R!==c&&R!==p&&Lc(m,S,y,C,b,A,R.x,R.y)&&xi(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function Tx(n,t){let r=n;do{const a=r.prev,c=r.next.next;!dl(a,c)&&vm(a,r,r.next,c)&&Bc(a,c)&&Bc(c,a)&&(t.push(a.i,r.i,c.i),Fc(r),Fc(r.next),r=n=c),r=r.next}while(r!==n);return oo(r)}function Sx(n,t,r,a,c,d){let p=n;do{let m=p.next.next;for(;m!==p.prev;){if(p.i!==m.i&&Ex(p,m)){let y=bm(p,m);return p=oo(p,p.next),y=oo(y,y.next),Dc(p,t,r,a,c,d,0),void Dc(y,t,r,a,c,d,0)}m=m.next}p=p.next}while(p!==n)}function Px(n,t){let r=n.x-t.x;return r===0&&(r=n.y-t.y,r===0)&&(r=(n.next.y-n.y)/(n.next.x-n.x)-(t.next.y-t.y)/(t.next.x-t.x)),r}function Mx(n,t){const r=function(c,d){let p=d;const m=c.x,y=c.y;let b,S=-1/0;if(dl(c,p))return p;do{if(dl(c,p.next))return p.next;if(y<=p.y&&y>=p.next.y&&p.next.y!==p.y){const j=p.x+(y-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(j<=m&&j>S&&(S=j,b=p.x<p.next.x?p:p.next,j===m))return b}p=p.next}while(p!==d);if(!b)return null;const C=b,A=b.x,L=b.y;let B=1/0;p=b;do{if(m>=p.x&&p.x>=A&&m!==p.x&&xm(y<L?m:S,y,A,L,y<L?S:m,y,p.x,p.y)){const j=Math.abs(y-p.y)/(m-p.x);Bc(p,c)&&(j<B||j===B&&(p.x>b.x||p.x===b.x&&Cx(b,p)))&&(b=p,B=j)}p=p.next}while(p!==C);return b}(n,t);if(!r)return t;const a=bm(r,n);return oo(a,a.next),oo(r,r.next)}function Cx(n,t){return xi(n.prev,n,t.prev)<0&&xi(t.next,n,n.next)<0}function sp(n,t,r,a,c){return(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-r)*c|0)|n<<8))|n<<4))|n<<2))|n<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-a)*c|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Ix(n){let t=n,r=n;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==n);return r}function xm(n,t,r,a,c,d,p,m){return(c-p)*(t-m)>=(n-p)*(d-m)&&(n-p)*(a-m)>=(r-p)*(t-m)&&(r-p)*(d-m)>=(c-p)*(a-m)}function Lc(n,t,r,a,c,d,p,m){return!(n===p&&t===m)&&xm(n,t,r,a,c,d,p,m)}function Ex(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!function(r,a){let c=r;do{if(c.i!==r.i&&c.next.i!==r.i&&c.i!==a.i&&c.next.i!==a.i&&vm(c,c.next,r,a))return!0;c=c.next}while(c!==r);return!1}(n,t)&&(Bc(n,t)&&Bc(t,n)&&function(r,a){let c=r,d=!1;const p=(r.x+a.x)/2,m=(r.y+a.y)/2;do c.y>m!=c.next.y>m&&c.next.y!==c.y&&p<(c.next.x-c.x)*(m-c.y)/(c.next.y-c.y)+c.x&&(d=!d),c=c.next;while(c!==r);return d}(n,t)&&(xi(n.prev,n,t.prev)||xi(n,t.prev,t))||dl(n,t)&&xi(n.prev,n,n.next)>0&&xi(t.prev,t,t.next)>0)}function xi(n,t,r){return(t.y-n.y)*(r.x-t.x)-(t.x-n.x)*(r.y-t.y)}function dl(n,t){return n.x===t.x&&n.y===t.y}function vm(n,t,r,a){const c=Sh(xi(n,t,r)),d=Sh(xi(n,t,a)),p=Sh(xi(r,a,n)),m=Sh(xi(r,a,t));return c!==d&&p!==m||!(c!==0||!Th(n,r,t))||!(d!==0||!Th(n,a,t))||!(p!==0||!Th(r,n,a))||!(m!==0||!Th(r,t,a))}function Th(n,t,r){return t.x<=Math.max(n.x,r.x)&&t.x>=Math.min(n.x,r.x)&&t.y<=Math.max(n.y,r.y)&&t.y>=Math.min(n.y,r.y)}function Sh(n){return n>0?1:n<0?-1:0}function Bc(n,t){return xi(n.prev,n,n.next)<0?xi(n,t,n.next)>=0&&xi(n,n.prev,t)>=0:xi(n,t,n.prev)<0||xi(n,n.next,t)<0}function bm(n,t){const r=op(n.i,n.x,n.y),a=op(t.i,t.x,t.y),c=n.next,d=t.prev;return n.next=t,t.prev=n,r.next=c,c.prev=r,a.next=r,r.prev=a,d.next=a,a.prev=d,a}function wm(n,t,r,a){const c=op(n,t,r);return a?(c.next=a.next,c.prev=a,a.next.prev=c,a.next=c):(c.prev=c,c.next=c),c}function Fc(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function op(n,t,r){return{i:n,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class pl{constructor(t,r){if(r>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=r}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class Ph{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}Ph.noSubdivision=new Ph({fill:new pl(0,0),line:new pl(0,0),tile:new pl(0,0),stencil:new pl(0,0),circle:1}),Ge("SubdivisionGranularityExpression",pl),Ge("SubdivisionGranularitySetting",Ph);const fl=-32768,Oc=32767;class zx{constructor(t,r){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=Rt/t,this._canonical=r}_getKey(t,r){return(t+=32768)<<16|r+32768}_vertexToIndex(t,r){if(t<-32768||r<-32768||t>32767||r>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const a=0|Math.round(t),c=0|Math.round(r),d=this._getKey(a,c);if(this._vertexDictionary.has(d))return this._vertexDictionary.get(d);const p=this._vertexBuffer.length/2;return this._vertexDictionary.set(d,p),this._vertexBuffer.push(a,c),p}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(c,d){const p=[];for(let m=0;m<d.length;m+=3){const y=d[m],b=d[m+1],S=d[m+2],C=c[2*y],A=c[2*y+1];(c[2*b]-C)*(c[2*S+1]-A)-(c[2*b+1]-A)*(c[2*S]-C)>0?(p.push(y),p.push(S),p.push(b)):(p.push(y),p.push(b),p.push(S))}return p}(this._vertexBuffer,t);const r=[],a=t.length;for(let c=0;c<a;c+=3){const d=[t[c+0],t[c+1],t[c+2]],p=[this._vertexBuffer[2*t[c+0]+0],this._vertexBuffer[2*t[c+0]+1],this._vertexBuffer[2*t[c+1]+0],this._vertexBuffer[2*t[c+1]+1],this._vertexBuffer[2*t[c+2]+0],this._vertexBuffer[2*t[c+2]+1]];let m=1/0,y=1/0,b=-1/0,S=-1/0;for(let j=0;j<3;j++){const U=p[2*j],H=p[2*j+1];m=Math.min(m,U),b=Math.max(b,U),y=Math.min(y,H),S=Math.max(S,H)}if(m===b||y===S)continue;const C=Math.floor(m/this._granularityCellSize),A=Math.ceil(b/this._granularityCellSize),L=Math.floor(y/this._granularityCellSize),B=Math.ceil(S/this._granularityCellSize);if(C!==A||L!==B)for(let j=L;j<B;j++){const U=this._scanlineGenerateVertexRingForCellRow(j,p,d);Ax(this._vertexBuffer,U,r)}else r.push(...d)}return r}_scanlineGenerateVertexRingForCellRow(t,r,a){const c=t*this._granularityCellSize,d=c+this._granularityCellSize,p=[];for(let m=0;m<3;m++){const y=r[2*m],b=r[2*m+1],S=r[2*(m+1)%6],C=r[(2*(m+1)+1)%6],A=r[2*(m+2)%6],L=r[(2*(m+2)+1)%6],B=S-y,j=C-b,U=B===0,H=j===0,se=(c-b)/j,Q=(d-b)/j,R=Math.min(se,Q),Z=Math.max(se,Q);if(!H&&(R>=1||Z<=0)||H&&(b<c||b>d)){C>=c&&C<=d&&p.push(a[(m+1)%3]);continue}!H&&R>0&&p.push(this._vertexToIndex(y+B*R,b+j*R));const te=y+B*Math.max(R,0),ge=y+B*Math.min(Z,1);U||this._generateIntraEdgeVertices(p,y,b,S,C,te,ge),!H&&Z<1&&p.push(this._vertexToIndex(y+B*Z,b+j*Z)),(H||C>=c&&C<=d)&&p.push(a[(m+1)%3]),!H&&(C<=c||C>=d)&&this._generateInterEdgeVertices(p,y,b,S,C,A,L,ge,c,d)}return p}_generateIntraEdgeVertices(t,r,a,c,d,p,m){const y=c-r,b=d-a,S=b===0,C=S?Math.min(r,c):Math.min(p,m),A=S?Math.max(r,c):Math.max(p,m),L=Math.floor(C/this._granularityCellSize)+1,B=Math.ceil(A/this._granularityCellSize)-1;if(S?r<c:p<m)for(let j=L;j<=B;j++){const U=j*this._granularityCellSize;t.push(this._vertexToIndex(U,a+b*(U-r)/y))}else for(let j=B;j>=L;j--){const U=j*this._granularityCellSize;t.push(this._vertexToIndex(U,a+b*(U-r)/y))}}_generateInterEdgeVertices(t,r,a,c,d,p,m,y,b,S){const C=d-a,A=p-c,L=m-d,B=(b-d)/L,j=(S-d)/L,U=Math.min(B,j),H=Math.max(B,j),se=c+A*U;let Q=Math.floor(Math.min(se,y)/this._granularityCellSize)+1,R=Math.ceil(Math.max(se,y)/this._granularityCellSize)-1,Z=y<se;const te=L===0;if(te&&(m===b||m===S))return;if(te||U>=1||H<=0){const Ie=a-m,be=p+(r-p)*Math.min((b-m)/Ie,(S-m)/Ie);Q=Math.floor(Math.min(be,y)/this._granularityCellSize)+1,R=Math.ceil(Math.max(be,y)/this._granularityCellSize)-1,Z=y<be}const ge=C>0?S:b;if(Z)for(let Ie=Q;Ie<=R;Ie++)t.push(this._vertexToIndex(Ie*this._granularityCellSize,ge));else for(let Ie=R;Ie>=Q;Ie--)t.push(this._vertexToIndex(Ie*this._granularityCellSize,ge))}_generateOutline(t){const r=[];for(const a of t){const c=lo(a,this._granularity,!0),d=this._pointArrayToIndices(c),p=[];for(let m=1;m<d.length;m++)p.push(d[m-1]),p.push(d[m]);r.push(p)}return r}_handlePoles(t){let r=!1,a=!1;this._canonical&&(this._canonical.y===0&&(r=!0),this._canonical.y===(1<<this._canonical.z)-1&&(a=!0)),(r||a)&&this._fillPoles(t,r,a)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let r=0;r<t.length;r+=2){const a=t[r+1];a===fl&&(t[r+1]=-32767),a===Oc&&(t[r+1]=32766)}}_generatePoleQuad(t,r,a,c,d,p){c>d!=(p===fl)?(t.push(r),t.push(a),t.push(this._vertexToIndex(c,p)),t.push(a),t.push(this._vertexToIndex(d,p)),t.push(this._vertexToIndex(c,p))):(t.push(a),t.push(r),t.push(this._vertexToIndex(c,p)),t.push(this._vertexToIndex(d,p)),t.push(a),t.push(this._vertexToIndex(c,p)))}_fillPoles(t,r,a){const c=this._vertexBuffer,d=Rt,p=t.length;for(let m=2;m<p;m+=3){const y=t[m-2],b=t[m-1],S=t[m],C=c[2*y],A=c[2*y+1],L=c[2*b],B=c[2*b+1],j=c[2*S],U=c[2*S+1];r&&(A===0&&B===0&&this._generatePoleQuad(t,y,b,C,L,fl),B===0&&U===0&&this._generatePoleQuad(t,b,S,L,j,fl),U===0&&A===0&&this._generatePoleQuad(t,S,y,j,C,fl)),a&&(A===d&&B===d&&this._generatePoleQuad(t,y,b,C,L,Oc),B===d&&U===d&&this._generatePoleQuad(t,b,S,L,j,Oc),U===d&&A===d&&this._generatePoleQuad(t,S,y,j,C,Oc))}}_initializeVertices(t){for(let r=0;r<t.length;r+=2)this._vertexToIndex(t[r],t[r+1])}subdividePolygonInternal(t,r){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:a,holeIndices:c}=function(m){const y=[],b=[];for(const S of m)if(S.length!==0){S!==m[0]&&y.push(b.length/2);for(let C=0;C<S.length;C++)b.push(S[C].x),b.push(S[C].y)}return{flattened:b,holeIndices:y}}(t);let d;this._initializeVertices(a);try{const m=function(b,S,C=2){const A=S&&S.length,L=A?S[0]*C:b.length;let B=ym(b,0,L,C,!0);const j=[];if(!B||B.next===B.prev)return j;let U,H,se;if(A&&(B=function(Q,R,Z,te){const ge=[];for(let Ie=0,be=R.length;Ie<be;Ie++){const Te=ym(Q,R[Ie]*te,Ie<be-1?R[Ie+1]*te:Q.length,te,!1);Te===Te.next&&(Te.steiner=!0),ge.push(Ix(Te))}ge.sort(Px);for(let Ie=0;Ie<ge.length;Ie++)Z=Mx(ge[Ie],Z);return Z}(b,S,B,C)),b.length>80*C){U=1/0,H=1/0;let Q=-1/0,R=-1/0;for(let Z=C;Z<L;Z+=C){const te=b[Z],ge=b[Z+1];te<U&&(U=te),ge<H&&(H=ge),te>Q&&(Q=te),ge>R&&(R=ge)}se=Math.max(Q-U,R-H),se=se!==0?32767/se:0}return Dc(B,j,C,U,H,se,0),j}(a,c),y=this._convertIndices(a,m);d=this._subdivideTrianglesScanline(y)}catch(m){console.error(m)}let p=[];return r&&(p=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(d),{verticesFlattened:this._vertexBuffer,indicesTriangles:d,indicesLineList:p}}_convertIndices(t,r){const a=[];for(let c=0;c<r.length;c++)a.push(this._vertexToIndex(t[2*r[c]],t[2*r[c]+1]));return a}_pointArrayToIndices(t){const r=[];for(let a=0;a<t.length;a++){const c=t[a];r.push(this._vertexToIndex(c.x,c.y))}return r}}function Tm(n,t,r,a=!0){return new zx(r,t).subdividePolygonInternal(n,a)}function lo(n,t,r=!1){if(!n||n.length<1)return[];if(n.length<2)return[];const a=n[0],c=n[n.length-1],d=r&&(a.x!==c.x||a.y!==c.y);if(t<2)return d?[...n,n[0]]:[...n];const p=Math.floor(Rt/t),m=[];m.push(new Ue(n[0].x,n[0].y));const y=n.length,b=d?y:y-1;for(let S=0;S<b;S++){const C=n[S],A=S<y-1?n[S+1]:n[0],L=C.x,B=C.y,j=A.x,U=A.y,H=L!==j,se=B!==U;if(!H&&!se)continue;const Q=j-L,R=U-B,Z=Math.abs(Q),te=Math.abs(R);let ge=L,Ie=B;for(;;){const Te=Q>0?(Math.floor(ge/p)+1)*p:(Math.ceil(ge/p)-1)*p,Re=R>0?(Math.floor(Ie/p)+1)*p:(Math.ceil(Ie/p)-1)*p,ze=Math.abs(ge-Te),De=Math.abs(Ie-Re),Pe=Math.abs(ge-j),He=Math.abs(Ie-U),it=H?ze/Z:Number.POSITIVE_INFINITY,tt=se?De/te:Number.POSITIVE_INFINITY;if((Pe<=ze||!H)&&(He<=De||!se))break;if(it<tt&&H||!se){ge=Te,Ie+=R*it;const Ke=new Ue(ge,Math.round(Ie));m[m.length-1].x===Ke.x&&m[m.length-1].y===Ke.y||m.push(Ke)}else{ge+=Q*tt,Ie=Re;const Ke=new Ue(Math.round(ge),Ie);m[m.length-1].x===Ke.x&&m[m.length-1].y===Ke.y||m.push(Ke)}}const be=new Ue(j,U);m[m.length-1].x===be.x&&m[m.length-1].y===be.y||m.push(be)}return m}function Ax(n,t,r){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let a=0,c=n[2*t[0]];for(let y=1;y<t.length;y++){const b=n[2*t[y]];b<c&&(c=b,a=y)}const d=t.length;let p=a,m=(p+1)%d;for(;;){const y=p-1>=0?p-1:d-1,b=(m+1)%d,S=n[2*t[y]],C=n[2*t[b]],A=n[2*t[p]],L=n[2*t[p]+1],B=n[2*t[m]+1];let j=!1;if(S<C)j=!0;else if(S>C)j=!1;else{const U=B-L,H=-(n[2*t[m]]-A),se=L<B?1:-1;((S-A)*U+(n[2*t[y]+1]-L)*H)*se>((C-A)*U+(n[2*t[b]+1]-L)*H)*se&&(j=!0)}if(j){const U=t[y],H=t[p],se=t[m];U!==H&&U!==se&&H!==se&&r.push(se,H,U),p--,p<0&&(p=d-1)}else{const U=t[b],H=t[p],se=t[m];U!==H&&U!==se&&H!==se&&r.push(se,H,U),m++,m>=d&&(m=0)}if(y===b)break}}function Sm(n,t,r,a,c,d,p,m,y){const b=c.length/2,S=p&&m&&y;if(b<Ct.MAX_VERTEX_ARRAY_LENGTH){const C=t.prepareSegment(b,r,a),A=C.vertexLength;for(let j=0;j<d.length;j+=3)a.emplaceBack(A+d[j],A+d[j+1],A+d[j+2]);let L,B;C.vertexLength+=b,C.primitiveLength+=d.length/3,S&&(B=p.prepareSegment(b,r,m),L=B.vertexLength,B.vertexLength+=b);for(let j=0;j<c.length;j+=2)n(c[j],c[j+1]);if(S)for(let j=0;j<y.length;j++){const U=y[j];for(let H=1;H<U.length;H+=2)m.emplaceBack(L+U[H-1],L+U[H]);B.primitiveLength+=U.length/2}}else(function(C,A,L,B,j,U){const H=[];for(let te=0;te<B.length/2;te++)H.push(-1);const se={count:0};let Q=0,R=C.getOrCreateLatestSegment(A,L),Z=R.vertexLength;for(let te=2;te<j.length;te+=3){const ge=j[te-2],Ie=j[te-1],be=j[te];let Te=H[ge]<Q,Re=H[Ie]<Q,ze=H[be]<Q;R.vertexLength+((Te?1:0)+(Re?1:0)+(ze?1:0))>Ct.MAX_VERTEX_ARRAY_LENGTH&&(R=C.createNewSegment(A,L),Q=se.count,Te=!0,Re=!0,ze=!0,Z=0);const De=jc(H,B,U,se,ge,Te,R),Pe=jc(H,B,U,se,Ie,Re,R),He=jc(H,B,U,se,be,ze,R);L.emplaceBack(Z+De-Q,Z+Pe-Q,Z+He-Q),R.primitiveLength++}})(t,r,a,c,d,n),S&&function(C,A,L,B,j,U){const H=[];for(let te=0;te<B.length/2;te++)H.push(-1);const se={count:0};let Q=0,R=C.getOrCreateLatestSegment(A,L),Z=R.vertexLength;for(let te=0;te<j.length;te++){const ge=j[te];for(let Ie=1;Ie<j[te].length;Ie+=2){const be=ge[Ie-1],Te=ge[Ie];let Re=H[be]<Q,ze=H[Te]<Q;R.vertexLength+((Re?1:0)+(ze?1:0))>Ct.MAX_VERTEX_ARRAY_LENGTH&&(R=C.createNewSegment(A,L),Q=se.count,Re=!0,ze=!0,Z=0);const De=jc(H,B,U,se,be,Re,R),Pe=jc(H,B,U,se,Te,ze,R);L.emplaceBack(Z+De-Q,Z+Pe-Q),R.primitiveLength++}}}(p,r,m,c,y,n),t.forceNewSegmentOnNextPrepare(),p==null||p.forceNewSegmentOnNextPrepare()}function jc(n,t,r,a,c,d,p){if(d){const m=a.count;return r(t[2*c],t[2*c+1]),n[c]=a.count,a.count++,p.vertexLength++,m}return n[c]}class lp{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ve,this.indexArray=new $t,this.indexArray2=new Ut,this.programConfigurations=new aa(t.layers,t.zoom),this.segments=new Ct,this.segments2=new Ct,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.hasPattern=np("fill",this.layers,r);const c=this.layers[0].layout.get("fill-sort-key"),d=!c.isConstant(),p=[];for(const{feature:m,id:y,index:b,sourceLayerIndex:S}of t){const C=this.layers[0]._featureFilter.needGeometry,A=so(m,C);if(!this.layers[0]._featureFilter.filter(new Qt(this.zoom,{globalState:this.globalState}),A,a))continue;const L=d?c.evaluate(A,{},a,r.availableImages):void 0,B={id:y,properties:m.properties,type:m.type,sourceLayerIndex:S,index:b,geometry:C?A.geometry:ao(m),patterns:{},sortKey:L};p.push(B)}d&&p.sort((m,y)=>m.sortKey-y.sortKey);for(const m of p){const{geometry:y,index:b,sourceLayerIndex:S}=m;if(this.hasPattern){const C=ap("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(C)}else this.addFeature(m,y,b,a,{},r.subdivisionGranularity);r.featureIndex.insert(t[b].feature,y,b,S,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}addFeatures(t,r,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,vx),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,r,a,c,d,p){for(const m of jo(r,500)){const y=Tm(m,c,p.fill.getGranularityForZoomLevel(c.z)),b=this.layoutVertexArray;Sm((S,C)=>{b.emplaceBack(S,C)},this.segments,this.layoutVertexArray,this.indexArray,y.verticesFlattened,y.indicesTriangles,this.segments2,this.indexArray2,y.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}}let Pm,Mm;Ge("FillBucket",lp,{omit:["layers","patternFeatures"]});var kx={get paint(){return Mm=Mm||new mr({"fill-antialias":new Xe(ae.paint_fill["fill-antialias"]),"fill-opacity":new nt(ae.paint_fill["fill-opacity"]),"fill-color":new nt(ae.paint_fill["fill-color"]),"fill-outline-color":new nt(ae.paint_fill["fill-outline-color"]),"fill-translate":new Xe(ae.paint_fill["fill-translate"]),"fill-translate-anchor":new Xe(ae.paint_fill["fill-translate-anchor"]),"fill-pattern":new ll(ae.paint_fill["fill-pattern"])})},get layout(){return Pm=Pm||new mr({"fill-sort-key":new nt(ae.layout_fill["fill-sort-key"])})}};class Rx extends qi{constructor(t){super(t,kx)}recalculate(t,r){super.recalculate(t,r);const a=this.paint._values["fill-outline-color"];a.value.kind==="constant"&&a.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new lp(t)}queryRadius(){return bh(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:r,transform:a,pixelsToTileUnits:c}){return nm(wh(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-a.bearingInRadians,c),r)}isTileClipped(){return!0}}const Dx=ui([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Lx=ui([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Bx}=Dx;var cp,Cm,up,Im,hp,Em,zm,Mh={};function Am(){if(Cm)return cp;Cm=1;var n=Ve();function t(c,d,p,m,y){this.properties={},this.extent=p,this.type=0,this._pbf=c,this._geometry=-1,this._keys=m,this._values=y,c.readFields(r,this,d)}function r(c,d,p){c==1?d.id=p.readVarint():c==2?function(m,y){for(var b=m.readVarint()+m.pos;m.pos<b;){var S=y._keys[m.readVarint()],C=y._values[m.readVarint()];y.properties[S]=C}}(p,d):c==3?d.type=p.readVarint():c==4&&(d._geometry=p.pos)}function a(c){for(var d,p,m=0,y=0,b=c.length,S=b-1;y<b;S=y++)m+=((p=c[S]).x-(d=c[y]).x)*(d.y+p.y);return m}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,m=1,y=0,b=0,S=0,C=[];c.pos<p;){if(y<=0){var A=c.readVarint();m=7&A,y=A>>3}if(y--,m===1||m===2)b+=c.readSVarint(),S+=c.readSVarint(),m===1&&(d&&C.push(d),d=[]),d.push(new n(b,S));else{if(m!==7)throw new Error("unknown command "+m);d&&d.push(d[0].clone())}}return d&&C.push(d),C},t.prototype.bbox=function(){var c=this._pbf;c.pos=this._geometry;for(var d=c.readVarint()+c.pos,p=1,m=0,y=0,b=0,S=1/0,C=-1/0,A=1/0,L=-1/0;c.pos<d;){if(m<=0){var B=c.readVarint();p=7&B,m=B>>3}if(m--,p===1||p===2)(y+=c.readSVarint())<S&&(S=y),y>C&&(C=y),(b+=c.readSVarint())<A&&(A=b),b>L&&(L=b);else if(p!==7)throw new Error("unknown command "+p)}return[S,A,C,L]},t.prototype.toGeoJSON=function(c,d,p){var m,y,b=this.extent*Math.pow(2,p),S=this.extent*c,C=this.extent*d,A=this.loadGeometry(),L=t.types[this.type];function B(H){for(var se=0;se<H.length;se++){var Q=H[se];H[se]=[360*(Q.x+S)/b-180,360/Math.PI*Math.atan(Math.exp((180-360*(Q.y+C)/b)*Math.PI/180))-90]}}switch(this.type){case 1:var j=[];for(m=0;m<A.length;m++)j[m]=A[m][0];B(A=j);break;case 2:for(m=0;m<A.length;m++)B(A[m]);break;case 3:for(A=function(H){var se=H.length;if(se<=1)return[H];for(var Q,R,Z=[],te=0;te<se;te++){var ge=a(H[te]);ge!==0&&(R===void 0&&(R=ge<0),R===ge<0?(Q&&Z.push(Q),Q=[H[te]]):Q.push(H[te]))}return Q&&Z.push(Q),Z}(A),m=0;m<A.length;m++)for(y=0;y<A[m].length;y++)B(A[m][y])}A.length===1?A=A[0]:L="Multi"+L;var U={type:"Feature",geometry:{type:L,coordinates:A},properties:this.properties};return"id"in this&&(U.id=this.id),U},cp}function km(){if(Im)return up;Im=1;var n=Am();function t(a,c){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=a,this._keys=[],this._values=[],this._features=[],a.readFields(r,this,c),this.length=this._features.length}function r(a,c,d){a===15?c.version=d.readVarint():a===1?c.name=d.readString():a===5?c.extent=d.readVarint():a===2?c._features.push(d.pos):a===3?c._keys.push(d.readString()):a===4&&c._values.push(function(p){for(var m=null,y=p.readVarint()+p.pos;p.pos<y;){var b=p.readVarint()>>3;m=b===1?p.readString():b===2?p.readFloat():b===3?p.readDouble():b===4?p.readVarint64():b===5?p.readVarint():b===6?p.readSVarint():b===7?p.readBoolean():null}return m}(d))}return up=t,t.prototype.feature=function(a){if(a<0||a>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[a];var c=this._pbf.readVarint()+this._pbf.pos;return new n(this._pbf,c,this.extent,this._keys,this._values)},up}function Rm(){return zm||(zm=1,Mh.VectorTile=function(){if(Em)return hp;Em=1;var n=km();function t(r,a,c){if(r===3){var d=new n(c,c.readVarint()+c.pos);d.length&&(a[d.name]=d)}}return hp=function(r,a){this.layers=r.readFields(t,{},a)},hp}(),Mh.VectorTileFeature=Am(),Mh.VectorTileLayer=km()),Mh}var Nc=fe(Rm());const Fx=Nc.VectorTileFeature.types,dp=Math.pow(2,13);function Vc(n,t,r,a,c,d,p,m){n.emplaceBack(t,r,2*Math.floor(a*dp)+p,c*dp*2,d*dp*2,Math.round(m))}class pp{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new je,this.centroidVertexArray=new pe,this.indexArray=new $t,this.programConfigurations=new aa(t.layers,t.zoom),this.segments=new Ct,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.features=[],this.hasPattern=np("fill-extrusion",this.layers,r);for(const{feature:c,id:d,index:p,sourceLayerIndex:m}of t){const y=this.layers[0]._featureFilter.needGeometry,b=so(c,y);if(!this.layers[0]._featureFilter.filter(new Qt(this.zoom,{globalState:this.globalState}),b,a))continue;const S={id:d,sourceLayerIndex:m,index:p,geometry:y?b.geometry:ao(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(ap("fill-extrusion",this.layers,S,this.zoom,r)):this.addFeature(S,S.geometry,p,a,{},r.subdivisionGranularity),r.featureIndex.insert(c,S.geometry,p,m,this.index,!0)}}addFeatures(t,r,a){for(const c of this.features){const{geometry:d}=c;this.addFeature(c,d,c.index,r,a,t.subdivisionGranularity)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Bx),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Lx.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,a,c,d,p){for(const m of jo(r,500)){const y={x:0,y:0,sampleCount:0},b=this.layoutVertexArray.length;this.processPolygon(y,c,t,m,p);const S=this.layoutVertexArray.length-b,C=Math.floor(y.x/y.sampleCount),A=Math.floor(y.y/y.sampleCount);for(let L=0;L<S;L++)this.centroidVertexArray.emplaceBack(C,A)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}processPolygon(t,r,a,c,d){if(c.length<1||Dm(c[0]))return;for(const C of c)C.length!==0&&Ox(t,C);const p={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},m=d.fill.getGranularityForZoomLevel(r.z),y=Fx[a.type]==="Polygon";for(const C of c){if(C.length===0||Dm(C))continue;const A=lo(C,m,y);this._generateSideFaces(A,p)}if(!y)return;const b=Tm(c,r,m,!1),S=this.layoutVertexArray;Sm((C,A)=>{Vc(S,C,A,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,b.verticesFlattened,b.indicesTriangles)}_generateSideFaces(t,r){let a=0;for(let c=1;c<t.length;c++){const d=t[c],p=t[c-1];if(jx(d,p))continue;r.segment.vertexLength+4>Ct.MAX_VERTEX_ARRAY_LENGTH&&(r.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const m=d.sub(p)._perp()._unit(),y=p.dist(d);a+y>32768&&(a=0),Vc(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,0,a),Vc(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,1,a),a+=y,Vc(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,0,a),Vc(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,1,a);const b=r.segment.vertexLength;this.indexArray.emplaceBack(b,b+2,b+1),this.indexArray.emplaceBack(b+1,b+2,b+3),r.segment.vertexLength+=4,r.segment.primitiveLength+=2}}}function Ox(n,t){for(let r=0;r<t.length;r++){const a=t[r];r===t.length-1&&t[0].x===a.x&&t[0].y===a.y||(n.x+=a.x,n.y+=a.y,n.sampleCount++)}}function jx(n,t){return n.x===t.x&&(n.x<0||n.x>Rt)||n.y===t.y&&(n.y<0||n.y>Rt)}function Dm(n){return n.every(t=>t.x<0)||n.every(t=>t.x>Rt)||n.every(t=>t.y<0)||n.every(t=>t.y>Rt)}let Lm;Ge("FillExtrusionBucket",pp,{omit:["layers","features"]});var Nx={get paint(){return Lm=Lm||new mr({"fill-extrusion-opacity":new Xe(ae["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new nt(ae["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Xe(ae["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Xe(ae["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ll(ae["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new nt(ae["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new nt(ae["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Xe(ae["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Vx extends qi{constructor(t){super(t,Nx)}createBucket(t){return new pp(t)}queryRadius(){return bh(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,pixelPosMatrix:m}){const y=wh(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-d.bearingInRadians,p),b=this.paint.get("fill-extrusion-height").evaluate(r,a),S=this.paint.get("fill-extrusion-base").evaluate(r,a),C=function(L,B){const j=[];for(const U of L){const H=[U.x,U.y,0,1];Jt(H,H,B),j.push(new Ue(H[0]/H[3],H[1]/H[3]))}return j}(y,m),A=function(L,B,j,U){const H=[],se=[],Q=U[8]*B,R=U[9]*B,Z=U[10]*B,te=U[11]*B,ge=U[8]*j,Ie=U[9]*j,be=U[10]*j,Te=U[11]*j;for(const Re of L){const ze=[],De=[];for(const Pe of Re){const He=Pe.x,it=Pe.y,tt=U[0]*He+U[4]*it+U[12],Ke=U[1]*He+U[5]*it+U[13],Tt=U[2]*He+U[6]*it+U[14],hi=U[3]*He+U[7]*it+U[15],Ii=Tt+Z,sr=hi+te,cn=tt+ge,Br=Ke+Ie,Yi=Tt+be,oi=hi+Te,Bi=new Ue((tt+Q)/sr,(Ke+R)/sr);Bi.z=Ii/sr,ze.push(Bi);const Ki=new Ue(cn/oi,Br/oi);Ki.z=Yi/oi,De.push(Ki)}H.push(ze),se.push(De)}return[H,se]}(c,S,b,m);return function(L,B,j){let U=1/0;nm(j,B)&&(U=Bm(j,B[0]));for(let H=0;H<B.length;H++){const se=B[H],Q=L[H];for(let R=0;R<se.length-1;R++){const Z=se[R],te=[Z,se[R+1],Q[R+1],Q[R],Z];rm(j,te)&&(U=Math.min(U,Bm(j,te)))}}return U!==1/0&&U}(A[0],A[1],C)}}function Zc(n,t){return n.x*t.x+n.y*t.y}function Bm(n,t){if(n.length===1){let r=0;const a=t[r++];let c;for(;!c||a.equals(c);)if(c=t[r++],!c)return 1/0;for(;r<t.length;r++){const d=t[r],p=n[0],m=c.sub(a),y=d.sub(a),b=p.sub(a),S=Zc(m,m),C=Zc(m,y),A=Zc(y,y),L=Zc(b,m),B=Zc(b,y),j=S*A-C*C,U=(A*L-C*B)/j,H=(S*B-C*L)/j,se=a.z*(1-U-H)+c.z*U+d.z*H;if(isFinite(se))return se}return 1/0}{let r=1/0;for(const a of t)r=Math.min(r,a.z);return r}}const Zx=ui([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Ux}=Zx,$x=ui([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Gx}=$x,qx=Nc.VectorTileFeature.types,Wx=Math.cos(Math.PI/180*37.5),Fm=Math.pow(2,14)/.5;class fp{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Fe,this.layoutVertexArray2=new Ee,this.indexArray=new $t,this.programConfigurations=new aa(t.layers,t.zoom),this.segments=new Ct,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.hasPattern=np("line",this.layers,r);const c=this.layers[0].layout.get("line-sort-key"),d=!c.isConstant(),p=[];for(const{feature:m,id:y,index:b,sourceLayerIndex:S}of t){const C=this.layers[0]._featureFilter.needGeometry,A=so(m,C);if(!this.layers[0]._featureFilter.filter(new Qt(this.zoom,{globalState:this.globalState}),A,a))continue;const L=d?c.evaluate(A,{},a):void 0,B={id:y,properties:m.properties,type:m.type,sourceLayerIndex:S,index:b,geometry:C?A.geometry:ao(m),patterns:{},sortKey:L};p.push(B)}d&&p.sort((m,y)=>m.sortKey-y.sortKey);for(const m of p){const{geometry:y,index:b,sourceLayerIndex:S}=m;if(this.hasPattern){const C=ap("line",this.layers,m,this.zoom,r);this.patternFeatures.push(C)}else this.addFeature(m,y,b,a,{},r.subdivisionGranularity);r.featureIndex.insert(t[b].feature,y,b,S,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}addFeatures(t,r,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Gx)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ux),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,a,c,d,p){const m=this.layers[0].layout,y=m.get("line-join").evaluate(t,{}),b=m.get("line-cap"),S=m.get("line-miter-limit"),C=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const A of r)this.addLine(A,t,y,b,S,C,c,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}addLine(t,r,a,c,d,p,m,y){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=lo(t,m?y.line.getGranularityForZoomLevel(m.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Q=0;Q<t.length-1;Q++)this.totalDistance+=t[Q].dist(t[Q+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const b=qx[r.type]==="Polygon";let S=t.length;for(;S>=2&&t[S-1].equals(t[S-2]);)S--;let C=0;for(;C<S-1&&t[C].equals(t[C+1]);)C++;if(S<(b?3:2))return;a==="bevel"&&(d=1.05);const A=this.overscaling<=16?122880/(512*this.overscaling):0,L=this.segments.prepareSegment(10*S,this.layoutVertexArray,this.indexArray);let B,j,U,H,se;this.e1=this.e2=-1,b&&(B=t[S-2],se=t[C].sub(B)._unit()._perp());for(let Q=C;Q<S;Q++){if(U=Q===S-1?b?t[C+1]:void 0:t[Q+1],U&&t[Q].equals(U))continue;se&&(H=se),B&&(j=B),B=t[Q],se=U?U.sub(B)._unit()._perp():H,H=H||se;let R=H.add(se);R.x===0&&R.y===0||R._unit();const Z=H.x*se.x+H.y*se.y,te=R.x*se.x+R.y*se.y,ge=te!==0?1/te:1/0,Ie=2*Math.sqrt(2-2*te),be=te<Wx&&j&&U,Te=H.x*se.y-H.y*se.x>0;if(be&&Q>C){const De=B.dist(j);if(De>2*A){const Pe=B.sub(B.sub(j)._mult(A/De)._round());this.updateDistance(j,Pe),this.addCurrentVertex(Pe,H,0,0,L),j=Pe}}const Re=j&&U;let ze=Re?a:b?"butt":c;if(Re&&ze==="round"&&(ge<p?ze="miter":ge<=2&&(ze="fakeround")),ze==="miter"&&ge>d&&(ze="bevel"),ze==="bevel"&&(ge>2&&(ze="flipbevel"),ge<d&&(ze="miter")),j&&this.updateDistance(j,B),ze==="miter")R._mult(ge),this.addCurrentVertex(B,R,0,0,L);else if(ze==="flipbevel"){if(ge>100)R=se.mult(-1);else{const De=ge*H.add(se).mag()/H.sub(se).mag();R._perp()._mult(De*(Te?-1:1))}this.addCurrentVertex(B,R,0,0,L),this.addCurrentVertex(B,R.mult(-1),0,0,L)}else if(ze==="bevel"||ze==="fakeround"){const De=-Math.sqrt(ge*ge-1),Pe=Te?De:0,He=Te?0:De;if(j&&this.addCurrentVertex(B,H,Pe,He,L),ze==="fakeround"){const it=Math.round(180*Ie/Math.PI/20);for(let tt=1;tt<it;tt++){let Ke=tt/it;if(Ke!==.5){const hi=Ke-.5;Ke+=Ke*hi*(Ke-1)*((1.0904+Z*(Z*(3.55645-1.43519*Z)-3.2452))*hi*hi+(.848013+Z*(.215638*Z-1.06021)))}const Tt=se.sub(H)._mult(Ke)._add(H)._unit()._mult(Te?-1:1);this.addHalfVertex(B,Tt.x,Tt.y,!1,Te,0,L)}}U&&this.addCurrentVertex(B,se,-Pe,-He,L)}else if(ze==="butt")this.addCurrentVertex(B,R,0,0,L);else if(ze==="square"){const De=j?1:-1;this.addCurrentVertex(B,R,De,De,L)}else ze==="round"&&(j&&(this.addCurrentVertex(B,H,0,0,L),this.addCurrentVertex(B,H,1,1,L,!0)),U&&(this.addCurrentVertex(B,se,-1,-1,L,!0),this.addCurrentVertex(B,se,0,0,L)));if(be&&Q<S-1){const De=B.dist(U);if(De>2*A){const Pe=B.add(U.sub(B)._mult(A/De)._round());this.updateDistance(B,Pe),this.addCurrentVertex(Pe,se,0,0,L),B=Pe}}}}addCurrentVertex(t,r,a,c,d,p=!1){const m=r.y*c-r.x,y=-r.y-r.x*c;this.addHalfVertex(t,r.x+r.y*a,r.y-r.x*a,p,!1,a,d),this.addHalfVertex(t,m,y,p,!0,-c,d),this.distance>Fm/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,a,c,d,p))}addHalfVertex({x:t,y:r},a,c,d,p,m,y){const b=.5*(this.lineClips?this.scaledDistance*(Fm-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(d?1:0),(r<<1)+(p?1:0),Math.round(63*a)+128,Math.round(63*c)+128,1+(m===0?0:m<0?-1:1)|(63&b)<<2,b>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const S=y.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,S,this.e2),y.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,r){this.distance+=t.dist(r),this.updateScaledDistance()}}let Om,jm;Ge("LineBucket",fp,{omit:["layers","patternFeatures"]});var Nm={get paint(){return jm=jm||new mr({"line-opacity":new nt(ae.paint_line["line-opacity"]),"line-color":new nt(ae.paint_line["line-color"]),"line-translate":new Xe(ae.paint_line["line-translate"]),"line-translate-anchor":new Xe(ae.paint_line["line-translate-anchor"]),"line-width":new nt(ae.paint_line["line-width"]),"line-gap-width":new nt(ae.paint_line["line-gap-width"]),"line-offset":new nt(ae.paint_line["line-offset"]),"line-blur":new nt(ae.paint_line["line-blur"]),"line-dasharray":new Sc(ae.paint_line["line-dasharray"]),"line-pattern":new ll(ae.paint_line["line-pattern"]),"line-gradient":new Qs(ae.paint_line["line-gradient"])})},get layout(){return Om=Om||new mr({"line-cap":new Xe(ae.layout_line["line-cap"]),"line-join":new nt(ae.layout_line["line-join"]),"line-miter-limit":new Xe(ae.layout_line["line-miter-limit"]),"line-round-limit":new Xe(ae.layout_line["line-round-limit"]),"line-sort-key":new nt(ae.layout_line["line-sort-key"])})}};class Hx extends nt{possiblyEvaluate(t,r){return r=new Qt(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,a,c){return r=_i({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,a,c)}}let Ch;class Xx extends qi{constructor(t){super(t,Nm),this.gradientVersion=0,Ch||(Ch=new Hx(Nm.paint.properties["line-width"].specification),Ch.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(a){return a._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof qa,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=Ch.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new fp(t)}queryRadius(t){const r=t,a=Vm(kc("line-width",this,r),kc("line-gap-width",this,r)),c=kc("line-offset",this,r);return a/2+Math.abs(c)+bh(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p}){const m=wh(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,p),y=p/2*Vm(this.paint.get("line-width").evaluate(r,a),this.paint.get("line-gap-width").evaluate(r,a)),b=this.paint.get("line-offset").evaluate(r,a);return b&&(c=function(S,C){const A=[];for(let L=0;L<S.length;L++){const B=S[L],j=[];for(let U=0;U<B.length;U++){const H=B[U-1],se=B[U],Q=B[U+1],R=U===0?new Ue(0,0):se.sub(H)._unit()._perp(),Z=U===B.length-1?new Ue(0,0):Q.sub(se)._unit()._perp(),te=R._add(Z)._unit(),ge=te.x*Z.x+te.y*Z.y;ge!==0&&te._mult(1/ge),j.push(te._mult(C)._add(se))}A.push(j)}return A}(c,b*p)),function(S,C,A){for(let L=0;L<C.length;L++){const B=C[L];if(S.length>=3){for(let j=0;j<B.length;j++)if(hl(S,B[j]))return!0}if(lx(S,B,A))return!0}return!1}(m,c,y)}isTileClipped(){return!0}}function Vm(n,t){return t>0?t+2*n:n}const Yx=ui([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Kx=ui([{name:"a_projected_pos",components:3,type:"Float32"}],4);ui([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Jx=ui([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ui([{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 Zm=ui([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Qx=ui([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ev(n,t,r){return n.sections.forEach(a=>{a.text=function(c,d,p){const m=d.layout.get("text-transform").evaluate(p,{});return m==="uppercase"?c=c.toLocaleUpperCase():m==="lowercase"&&(c=c.toLocaleLowerCase()),Jn.applyArabicShaping&&(c=Jn.applyArabicShaping(c)),c}(a.text,t,r)}),n}ui([{name:"triangle",components:3,type:"Uint16"}]),ui([{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"}]),ui([{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"}]),ui([{type:"Float32",name:"offsetX"}]),ui([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ui([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Uc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Um,mp,$m,Li=24,gp={};function tv(){return Um||(Um=1,gp.read=function(n,t,r,a,c){var d,p,m=8*c-a-1,y=(1<<m)-1,b=y>>1,S=-7,C=r?c-1:0,A=r?-1:1,L=n[t+C];for(C+=A,d=L&(1<<-S)-1,L>>=-S,S+=m;S>0;d=256*d+n[t+C],C+=A,S-=8);for(p=d&(1<<-S)-1,d>>=-S,S+=a;S>0;p=256*p+n[t+C],C+=A,S-=8);if(d===0)d=1-b;else{if(d===y)return p?NaN:1/0*(L?-1:1);p+=Math.pow(2,a),d-=b}return(L?-1:1)*p*Math.pow(2,d-a)},gp.write=function(n,t,r,a,c,d){var p,m,y,b=8*d-c-1,S=(1<<b)-1,C=S>>1,A=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?(m=isNaN(t)?1:0,p=S):(p=Math.floor(Math.log(t)/Math.LN2),t*(y=Math.pow(2,-p))<1&&(p--,y*=2),(t+=p+C>=1?A/y:A*Math.pow(2,1-C))*y>=2&&(p++,y/=2),p+C>=S?(m=0,p=S):p+C>=1?(m=(t*y-1)*Math.pow(2,c),p+=C):(m=t*Math.pow(2,C-1)*Math.pow(2,c),p=0));c>=8;n[r+L]=255&m,L+=B,m/=256,c-=8);for(p=p<<c|m,b+=c;b>0;n[r+L]=255&p,L+=B,p/=256,b-=8);n[r+L-B]|=128*j}),gp}function Gm(){if($m)return mp;$m=1,mp=t;var n=tv();function t(R){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(R)?R:new Uint8Array(R||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var r=4294967296,a=1/r,c=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function d(R){return R.type===t.Bytes?R.readVarint()+R.pos:R.pos+1}function p(R,Z,te){return te?4294967296*Z+(R>>>0):4294967296*(Z>>>0)+(R>>>0)}function m(R,Z,te){var ge=Z<=16383?1:Z<=2097151?2:Z<=268435455?3:Math.floor(Math.log(Z)/(7*Math.LN2));te.realloc(ge);for(var Ie=te.pos-1;Ie>=R;Ie--)te.buf[Ie+ge]=te.buf[Ie]}function y(R,Z){for(var te=0;te<R.length;te++)Z.writeVarint(R[te])}function b(R,Z){for(var te=0;te<R.length;te++)Z.writeSVarint(R[te])}function S(R,Z){for(var te=0;te<R.length;te++)Z.writeFloat(R[te])}function C(R,Z){for(var te=0;te<R.length;te++)Z.writeDouble(R[te])}function A(R,Z){for(var te=0;te<R.length;te++)Z.writeBoolean(R[te])}function L(R,Z){for(var te=0;te<R.length;te++)Z.writeFixed32(R[te])}function B(R,Z){for(var te=0;te<R.length;te++)Z.writeSFixed32(R[te])}function j(R,Z){for(var te=0;te<R.length;te++)Z.writeFixed64(R[te])}function U(R,Z){for(var te=0;te<R.length;te++)Z.writeSFixed64(R[te])}function H(R,Z){return(R[Z]|R[Z+1]<<8|R[Z+2]<<16)+16777216*R[Z+3]}function se(R,Z,te){R[te]=Z,R[te+1]=Z>>>8,R[te+2]=Z>>>16,R[te+3]=Z>>>24}function Q(R,Z){return(R[Z]|R[Z+1]<<8|R[Z+2]<<16)+(R[Z+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(R,Z,te){for(te=te||this.length;this.pos<te;){var ge=this.readVarint(),Ie=ge>>3,be=this.pos;this.type=7&ge,R(Ie,Z,this),this.pos===be&&this.skip(ge)}return Z},readMessage:function(R,Z){return this.readFields(R,Z,this.readVarint()+this.pos)},readFixed32:function(){var R=H(this.buf,this.pos);return this.pos+=4,R},readSFixed32:function(){var R=Q(this.buf,this.pos);return this.pos+=4,R},readFixed64:function(){var R=H(this.buf,this.pos)+H(this.buf,this.pos+4)*r;return this.pos+=8,R},readSFixed64:function(){var R=H(this.buf,this.pos)+Q(this.buf,this.pos+4)*r;return this.pos+=8,R},readFloat:function(){var R=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,R},readDouble:function(){var R=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,R},readVarint:function(R){var Z,te,ge=this.buf;return Z=127&(te=ge[this.pos++]),te<128?Z:(Z|=(127&(te=ge[this.pos++]))<<7,te<128?Z:(Z|=(127&(te=ge[this.pos++]))<<14,te<128?Z:(Z|=(127&(te=ge[this.pos++]))<<21,te<128?Z:function(Ie,be,Te){var Re,ze,De=Te.buf;if(Re=(112&(ze=De[Te.pos++]))>>4,ze<128||(Re|=(127&(ze=De[Te.pos++]))<<3,ze<128)||(Re|=(127&(ze=De[Te.pos++]))<<10,ze<128)||(Re|=(127&(ze=De[Te.pos++]))<<17,ze<128)||(Re|=(127&(ze=De[Te.pos++]))<<24,ze<128)||(Re|=(1&(ze=De[Te.pos++]))<<31,ze<128))return p(Ie,Re,be);throw new Error("Expected varint not more than 10 bytes")}(Z|=(15&(te=ge[this.pos]))<<28,R,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var R=this.readVarint();return R%2==1?(R+1)/-2:R/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var R=this.readVarint()+this.pos,Z=this.pos;return this.pos=R,R-Z>=12&&c?function(te,ge,Ie){return c.decode(te.subarray(ge,Ie))}(this.buf,Z,R):function(te,ge,Ie){for(var be="",Te=ge;Te<Ie;){var Re,ze,De,Pe=te[Te],He=null,it=Pe>239?4:Pe>223?3:Pe>191?2:1;if(Te+it>Ie)break;it===1?Pe<128&&(He=Pe):it===2?(192&(Re=te[Te+1]))==128&&(He=(31&Pe)<<6|63&Re)<=127&&(He=null):it===3?(ze=te[Te+2],(192&(Re=te[Te+1]))==128&&(192&ze)==128&&((He=(15&Pe)<<12|(63&Re)<<6|63&ze)<=2047||He>=55296&&He<=57343)&&(He=null)):it===4&&(ze=te[Te+2],De=te[Te+3],(192&(Re=te[Te+1]))==128&&(192&ze)==128&&(192&De)==128&&((He=(15&Pe)<<18|(63&Re)<<12|(63&ze)<<6|63&De)<=65535||He>=1114112)&&(He=null)),He===null?(He=65533,it=1):He>65535&&(He-=65536,be+=String.fromCharCode(He>>>10&1023|55296),He=56320|1023&He),be+=String.fromCharCode(He),Te+=it}return be}(this.buf,Z,R)},readBytes:function(){var R=this.readVarint()+this.pos,Z=this.buf.subarray(this.pos,R);return this.pos=R,Z},readPackedVarint:function(R,Z){if(this.type!==t.Bytes)return R.push(this.readVarint(Z));var te=d(this);for(R=R||[];this.pos<te;)R.push(this.readVarint(Z));return R},readPackedSVarint:function(R){if(this.type!==t.Bytes)return R.push(this.readSVarint());var Z=d(this);for(R=R||[];this.pos<Z;)R.push(this.readSVarint());return R},readPackedBoolean:function(R){if(this.type!==t.Bytes)return R.push(this.readBoolean());var Z=d(this);for(R=R||[];this.pos<Z;)R.push(this.readBoolean());return R},readPackedFloat:function(R){if(this.type!==t.Bytes)return R.push(this.readFloat());var Z=d(this);for(R=R||[];this.pos<Z;)R.push(this.readFloat());return R},readPackedDouble:function(R){if(this.type!==t.Bytes)return R.push(this.readDouble());var Z=d(this);for(R=R||[];this.pos<Z;)R.push(this.readDouble());return R},readPackedFixed32:function(R){if(this.type!==t.Bytes)return R.push(this.readFixed32());var Z=d(this);for(R=R||[];this.pos<Z;)R.push(this.readFixed32());return R},readPackedSFixed32:function(R){if(this.type!==t.Bytes)return R.push(this.readSFixed32());var Z=d(this);for(R=R||[];this.pos<Z;)R.push(this.readSFixed32());return R},readPackedFixed64:function(R){if(this.type!==t.Bytes)return R.push(this.readFixed64());var Z=d(this);for(R=R||[];this.pos<Z;)R.push(this.readFixed64());return R},readPackedSFixed64:function(R){if(this.type!==t.Bytes)return R.push(this.readSFixed64());var Z=d(this);for(R=R||[];this.pos<Z;)R.push(this.readSFixed64());return R},skip:function(R){var Z=7&R;if(Z===t.Varint)for(;this.buf[this.pos++]>127;);else if(Z===t.Bytes)this.pos=this.readVarint()+this.pos;else if(Z===t.Fixed32)this.pos+=4;else{if(Z!==t.Fixed64)throw new Error("Unimplemented type: "+Z);this.pos+=8}},writeTag:function(R,Z){this.writeVarint(R<<3|Z)},realloc:function(R){for(var Z=this.length||16;Z<this.pos+R;)Z*=2;if(Z!==this.length){var te=new Uint8Array(Z);te.set(this.buf),this.buf=te,this.length=Z}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(R){this.realloc(4),se(this.buf,R,this.pos),this.pos+=4},writeSFixed32:function(R){this.realloc(4),se(this.buf,R,this.pos),this.pos+=4},writeFixed64:function(R){this.realloc(8),se(this.buf,-1&R,this.pos),se(this.buf,Math.floor(R*a),this.pos+4),this.pos+=8},writeSFixed64:function(R){this.realloc(8),se(this.buf,-1&R,this.pos),se(this.buf,Math.floor(R*a),this.pos+4),this.pos+=8},writeVarint:function(R){(R=+R||0)>268435455||R<0?function(Z,te){var ge,Ie;if(Z>=0?(ge=Z%4294967296|0,Ie=Z/4294967296|0):(Ie=~(-Z/4294967296),4294967295^(ge=~(-Z%4294967296))?ge=ge+1|0:(ge=0,Ie=Ie+1|0)),Z>=18446744073709552e3||Z<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");te.realloc(10),function(be,Te,Re){Re.buf[Re.pos++]=127&be|128,be>>>=7,Re.buf[Re.pos++]=127&be|128,be>>>=7,Re.buf[Re.pos++]=127&be|128,be>>>=7,Re.buf[Re.pos++]=127&be|128,Re.buf[Re.pos]=127&(be>>>=7)}(ge,0,te),function(be,Te){var Re=(7&be)<<4;Te.buf[Te.pos++]|=Re|((be>>>=3)?128:0),be&&(Te.buf[Te.pos++]=127&be|((be>>>=7)?128:0),be&&(Te.buf[Te.pos++]=127&be|((be>>>=7)?128:0),be&&(Te.buf[Te.pos++]=127&be|((be>>>=7)?128:0),be&&(Te.buf[Te.pos++]=127&be|((be>>>=7)?128:0),be&&(Te.buf[Te.pos++]=127&be)))))}(Ie,te)}(R,this):(this.realloc(4),this.buf[this.pos++]=127&R|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=R>>>7&127))))},writeSVarint:function(R){this.writeVarint(R<0?2*-R-1:2*R)},writeBoolean:function(R){this.writeVarint(!!R)},writeString:function(R){R=String(R),this.realloc(4*R.length),this.pos++;var Z=this.pos;this.pos=function(ge,Ie,be){for(var Te,Re,ze=0;ze<Ie.length;ze++){if((Te=Ie.charCodeAt(ze))>55295&&Te<57344){if(!Re){Te>56319||ze+1===Ie.length?(ge[be++]=239,ge[be++]=191,ge[be++]=189):Re=Te;continue}if(Te<56320){ge[be++]=239,ge[be++]=191,ge[be++]=189,Re=Te;continue}Te=Re-55296<<10|Te-56320|65536,Re=null}else Re&&(ge[be++]=239,ge[be++]=191,ge[be++]=189,Re=null);Te<128?ge[be++]=Te:(Te<2048?ge[be++]=Te>>6|192:(Te<65536?ge[be++]=Te>>12|224:(ge[be++]=Te>>18|240,ge[be++]=Te>>12&63|128),ge[be++]=Te>>6&63|128),ge[be++]=63&Te|128)}return be}(this.buf,R,this.pos);var te=this.pos-Z;te>=128&&m(Z,te,this),this.pos=Z-1,this.writeVarint(te),this.pos+=te},writeFloat:function(R){this.realloc(4),n.write(this.buf,R,this.pos,!0,23,4),this.pos+=4},writeDouble:function(R){this.realloc(8),n.write(this.buf,R,this.pos,!0,52,8),this.pos+=8},writeBytes:function(R){var Z=R.length;this.writeVarint(Z),this.realloc(Z);for(var te=0;te<Z;te++)this.buf[this.pos++]=R[te]},writeRawMessage:function(R,Z){this.pos++;var te=this.pos;R(Z,this);var ge=this.pos-te;ge>=128&&m(te,ge,this),this.pos=te-1,this.writeVarint(ge),this.pos+=ge},writeMessage:function(R,Z,te){this.writeTag(R,t.Bytes),this.writeRawMessage(Z,te)},writePackedVarint:function(R,Z){Z.length&&this.writeMessage(R,y,Z)},writePackedSVarint:function(R,Z){Z.length&&this.writeMessage(R,b,Z)},writePackedBoolean:function(R,Z){Z.length&&this.writeMessage(R,A,Z)},writePackedFloat:function(R,Z){Z.length&&this.writeMessage(R,S,Z)},writePackedDouble:function(R,Z){Z.length&&this.writeMessage(R,C,Z)},writePackedFixed32:function(R,Z){Z.length&&this.writeMessage(R,L,Z)},writePackedSFixed32:function(R,Z){Z.length&&this.writeMessage(R,B,Z)},writePackedFixed64:function(R,Z){Z.length&&this.writeMessage(R,j,Z)},writePackedSFixed64:function(R,Z){Z.length&&this.writeMessage(R,U,Z)},writeBytesField:function(R,Z){this.writeTag(R,t.Bytes),this.writeBytes(Z)},writeFixed32Field:function(R,Z){this.writeTag(R,t.Fixed32),this.writeFixed32(Z)},writeSFixed32Field:function(R,Z){this.writeTag(R,t.Fixed32),this.writeSFixed32(Z)},writeFixed64Field:function(R,Z){this.writeTag(R,t.Fixed64),this.writeFixed64(Z)},writeSFixed64Field:function(R,Z){this.writeTag(R,t.Fixed64),this.writeSFixed64(Z)},writeVarintField:function(R,Z){this.writeTag(R,t.Varint),this.writeVarint(Z)},writeSVarintField:function(R,Z){this.writeTag(R,t.Varint),this.writeSVarint(Z)},writeStringField:function(R,Z){this.writeTag(R,t.Bytes),this.writeString(Z)},writeFloatField:function(R,Z){this.writeTag(R,t.Fixed32),this.writeFloat(Z)},writeDoubleField:function(R,Z){this.writeTag(R,t.Fixed64),this.writeDouble(Z)},writeBooleanField:function(R,Z){this.writeVarintField(R,!!Z)}},mp}var fs,_p=fe(Gm());function iv(n,t,r){n===1&&r.readMessage(rv,t)}function rv(n,t,r){if(n===3){const{id:a,bitmap:c,width:d,height:p,left:m,top:y,advance:b}=r.readMessage(nv,{});t.push({id:a,bitmap:new Rc({width:d+6,height:p+6},c),metrics:{width:d,height:p,left:m,top:y,advance:b}})}}function nv(n,t,r){n===1?t.id=r.readVarint():n===2?t.bitmap=r.readBytes():n===3?t.width=r.readVarint():n===4?t.height=r.readVarint():n===5?t.left=r.readSVarint():n===6?t.top=r.readSVarint():n===7&&(t.advance=r.readVarint())}function qm(n){let t=0,r=0;for(const p of n)t+=p.w*p.h,r=Math.max(r,p.w);n.sort((p,m)=>m.h-p.h);const a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let c=0,d=0;for(const p of n)for(let m=a.length-1;m>=0;m--){const y=a[m];if(!(p.w>y.w||p.h>y.h)){if(p.x=y.x,p.y=y.y,d=Math.max(d,p.y+p.h),c=Math.max(c,p.x+p.w),p.w===y.w&&p.h===y.h){const b=a.pop();m<a.length&&(a[m]=b)}else p.h===y.h?(y.x+=p.w,y.w-=p.w):p.w===y.w?(y.y+=p.h,y.h-=p.h):(a.push({x:y.x+p.w,y:y.y,w:y.w-p.w,h:p.h}),y.y+=p.h,y.h-=p.h);break}}return{w:c,h:d,fill:t/(c*d)||0}}class yp{constructor(t,{pixelRatio:r,version:a,stretchX:c,stretchY:d,content:p,textFitWidth:m,textFitHeight:y}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=c,this.stretchY=d,this.content=p,this.version=a,this.textFitWidth=m,this.textFitHeight=y}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Wm{constructor(t,r){const a={},c={};this.haveRenderCallbacks=[];const d=[];this.addImages(t,a,d),this.addImages(r,c,d);const{w:p,h:m}=qm(d),y=new Lr({width:p||1,height:m||1});for(const b in t){const S=t[b],C=a[b].paddedRect;Lr.copy(S.data,y,{x:0,y:0},{x:C.x+1,y:C.y+1},S.data)}for(const b in r){const S=r[b],C=c[b].paddedRect,A=C.x+1,L=C.y+1,B=S.data.width,j=S.data.height;Lr.copy(S.data,y,{x:0,y:0},{x:A,y:L},S.data),Lr.copy(S.data,y,{x:0,y:j-1},{x:A,y:L-1},{width:B,height:1}),Lr.copy(S.data,y,{x:0,y:0},{x:A,y:L+j},{width:B,height:1}),Lr.copy(S.data,y,{x:B-1,y:0},{x:A-1,y:L},{width:1,height:j}),Lr.copy(S.data,y,{x:0,y:0},{x:A+B,y:L},{width:1,height:j})}this.image=y,this.iconPositions=a,this.patternPositions=c}addImages(t,r,a){for(const c in t){const d=t[c],p={x:0,y:0,w:d.data.width+2,h:d.data.height+2};a.push(p),r[c]=new yp(p,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const a in t.updatedImages)this.patchUpdatedImage(this.iconPositions[a],t.getImage(a),r),this.patchUpdatedImage(this.patternPositions[a],t.getImage(a),r)}patchUpdatedImage(t,r,a){if(!t||!r||t.version===r.version)return;t.version=r.version;const[c,d]=t.tl;a.update(r.data,void 0,{x:c,y:d})}}Ge("ImagePosition",yp),Ge("ImageAtlas",Wm),P.an=void 0,(fs=P.an||(P.an={}))[fs.none=0]="none",fs[fs.horizontal=1]="horizontal",fs[fs.vertical=2]="vertical",fs[fs.horizontalOnly=3]="horizontalOnly";class $c{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,r,a){const c=new $c;return c.scale=t||1,c.fontStack=r,c.verticalAlign=a||"bottom",c}static forImage(t,r){const a=new $c;return a.imageName=t,a.verticalAlign=r||"bottom",a}}class ml{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){const a=new ml;for(let c=0;c<t.sections.length;c++){const d=t.sections[c];d.image?a.addImageSection(d):a.addTextSection(d,r)}return a}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let r="";for(let a=0;a<t.length;a++){const c=t.charCodeAt(a+1)||null,d=t.charCodeAt(a-1)||null;r+=c&&bc(c)&&!Uc[t[a+1]]||d&&bc(d)&&!Uc[t[a-1]]||!Uc[t[a]]?t[a]:Uc[t[a]]}return r}(this.text)}trim(){let t=0;for(let a=0;a<this.text.length&&Eh[this.text.charCodeAt(a)];a++)t++;let r=this.text.length;for(let a=this.text.length-1;a>=0&&a>=t&&Eh[this.text.charCodeAt(a)];a--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){const a=new ml;return a.text=this.text.substring(t,r),a.sectionIndex=this.sectionIndex.slice(t,r),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}getMaxImageSize(t){let r=0,a=0;for(let c=0;c<this.length();c++){const d=this.getSection(c);if(d.imageName){const p=t[d.imageName];if(!p)continue;const m=p.displaySize;r=Math.max(r,m[0]),a=Math.max(a,m[1])}}return{maxImageWidth:r,maxImageHeight:a}}addTextSection(t,r){this.text+=t.text,this.sections.push($c.forText(t.scale,t.fontStack||r,t.verticalAlign));const a=this.sections.length-1;for(let c=0;c<t.text.length;++c)this.sectionIndex.push(a)}addImageSection(t){const r=t.image?t.image.name:"";if(r.length===0)return void Mi("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push($c.forImage(r,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):Mi("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ih(n,t,r,a,c,d,p,m,y,b,S,C,A,L,B){const j=ml.fromFeature(n,c);let U;C===P.an.vertical&&j.verticalizePunctuation();const{processBidirectionalText:H,processStyledBidirectionalText:se}=Jn;if(H&&j.sections.length===1){U=[];const Z=H(j.toString(),xp(j,b,d,t,a,L));for(const te of Z){const ge=new ml;ge.text=te,ge.sections=j.sections;for(let Ie=0;Ie<te.length;Ie++)ge.sectionIndex.push(0);U.push(ge)}}else if(se){U=[];const Z=se(j.text,j.sectionIndex,xp(j,b,d,t,a,L));for(const te of Z){const ge=new ml;ge.text=te[0],ge.sectionIndex=te[1],ge.sections=j.sections,U.push(ge)}}else U=function(Z,te){const ge=[],Ie=Z.text;let be=0;for(const Te of te)ge.push(Z.substring(be,Te)),be=Te;return be<Ie.length&&ge.push(Z.substring(be,Ie.length)),ge}(j,xp(j,b,d,t,a,L));const Q=[],R={positionedLines:Q,text:j.toString(),top:S[1],bottom:S[1],left:S[0],right:S[0],writingMode:C,iconsInText:!1,verticalizable:!1};return function(Z,te,ge,Ie,be,Te,Re,ze,De,Pe,He,it){let tt=0,Ke=0,Tt=0,hi=0;const Ii=ze==="right"?1:ze==="left"?0:.5,sr=Li/it;let cn=0;for(const oi of be){oi.trim();const Bi=oi.getMaxScale(),Ki={positionedGlyphs:[],lineOffset:0};Z.positionedLines[cn]=Ki;const Ji=Ki.positionedGlyphs;let Pr=0;if(!oi.length()){Ke+=Te,++cn;continue}const un=lv(Ie,oi,sr);for(let Fr=0;Fr<oi.length();Fr++){const Ei=oi.getSection(Fr),Oi=oi.getSectionIndex(Fr),ji=oi.getCharCode(Fr),wi=cv(De,He,ji);let Xt;if(Ei.imageName){if(Z.iconsInText=!0,Ei.scale=Ei.scale*sr,Xt=hv(Ei,wi,Bi,un,Ie),!Xt)continue;Pr=Math.max(Pr,Xt.imageOffset)}else if(Xt=uv(Ei,ji,wi,un,te,ge),!Xt)continue;const{rect:Bn,metrics:xl,baselineOffset:Fn}=Xt;Ji.push({glyph:ji,imageName:Ei.imageName,x:tt,y:Ke+Fn+-17,vertical:wi,scale:Ei.scale,fontStack:Ei.fontStack,sectionIndex:Oi,metrics:xl,rect:Bn}),wi?(Z.verticalizable=!0,tt+=(Ei.imageName?xl.advance:Li)*Ei.scale+Pe):tt+=xl.advance*Ei.scale+Pe}Ji.length!==0&&(Tt=Math.max(tt-Pe,Tt),dv(Ji,0,Ji.length-1,Ii)),tt=0,Ki.lineOffset=Math.max(Pr,(Bi-1)*Li);const Fi=Te*Bi+Pr;Ke+=Fi,hi=Math.max(Fi,hi),++cn}const{horizontalAlign:Br,verticalAlign:Yi}=vp(Re);(function(oi,Bi,Ki,Ji,Pr,un,Fi,Fr,Ei){const Oi=(Bi-Ki)*Pr;let ji=0;ji=un!==Fi?-Fr*Ji- -17:-Ji*Ei*Fi+.5*Fi;for(const wi of oi)for(const Xt of wi.positionedGlyphs)Xt.x+=Oi,Xt.y+=ji})(Z.positionedLines,Ii,Br,Yi,Tt,hi,Te,Ke,be.length),Z.top+=-Yi*Ke,Z.bottom=Z.top+Ke,Z.left+=-Br*Tt,Z.right=Z.left+Tt}(R,t,r,a,U,p,m,y,C,b,A,B),!function(Z){for(const te of Z)if(te.positionedGlyphs.length!==0)return!1;return!0}(Q)&&R}const Eh={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},av={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},sv={40:!0};function Hm(n,t,r,a,c,d){if(t.imageName){const p=a[t.imageName];return p?p.displaySize[0]*t.scale*Li/d+c:0}{const p=r[t.fontStack],m=p&&p[n];return m?m.metrics.advance*t.scale+c:0}}function Xm(n,t,r,a){const c=Math.pow(n-t,2);return a?n<t?c/2:2*c:c+Math.abs(r)*r}function ov(n,t,r){let a=0;return n===10&&(a-=1e4),r&&(a+=150),n!==40&&n!==65288||(a+=50),t!==41&&t!==65289||(a+=50),a}function Ym(n,t,r,a,c,d){let p=null,m=Xm(t,r,c,d);for(const y of a){const b=Xm(t-y.x,r,c,d)+y.badness;b<=m&&(p=y,m=b)}return{index:n,x:t,priorBreak:p,badness:m}}function Km(n){return n?Km(n.priorBreak).concat(n.index):[]}function xp(n,t,r,a,c,d){if(!n)return[];const p=[],m=function(C,A,L,B,j,U){let H=0;for(let se=0;se<C.length();se++){const Q=C.getSection(se);H+=Hm(C.getCharCode(se),Q,B,j,A,U)}return H/Math.max(1,Math.ceil(H/L))}(n,t,r,a,c,d),y=n.text.indexOf("​")>=0;let b=0;for(let C=0;C<n.length();C++){const A=n.getSection(C),L=n.getCharCode(C);if(Eh[L]||(b+=Hm(L,A,a,c,t,d)),C<n.length()-1){const B=!((S=L)<11904)&&(!!bt["CJK Compatibility Forms"](S)||!!bt["CJK Compatibility"](S)||!!bt["CJK Strokes"](S)||!!bt["CJK Symbols and Punctuation"](S)||!!bt["Enclosed CJK Letters and Months"](S)||!!bt["Halfwidth and Fullwidth Forms"](S)||!!bt["Ideographic Description Characters"](S)||!!bt["Vertical Forms"](S)||vc.test(String.fromCodePoint(S)));(av[L]||B||A.imageName||C!==n.length()-2&&sv[n.getCharCode(C+1)])&&p.push(Ym(C+1,b,m,p,ov(L,n.getCharCode(C+1),B&&y),!1))}}var S;return Km(Ym(n.length(),b,m,p,0,!0))}function vp(n){let t=.5,r=.5;switch(n){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(n){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function lv(n,t,r){const a=t.getMaxScale()*Li,{maxImageWidth:c,maxImageHeight:d}=t.getMaxImageSize(n),p=Math.max(a,d*r);return{verticalLineContentWidth:Math.max(a,c*r),horizontalLineContentHeight:p}}function Jm(n){switch(n){case"top":return 0;case"center":return .5;default:return 1}}function cv(n,t,r){return!(n===P.an.horizontal||!t&&!al(r)||t&&(Eh[r]||(a=r,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(a)))));var a}function uv(n,t,r,a,c,d){const p=d[n.fontStack],m=function(b,S,C,A){if(b&&b.rect)return b;const L=S[C.fontStack],B=L&&L[A];return B?{rect:null,metrics:B.metrics}:null}(p&&p[t],c,n,t);if(m===null)return null;let y;if(r)y=a.verticalLineContentWidth-n.scale*Li;else{const b=Jm(n.verticalAlign);y=(a.horizontalLineContentHeight-n.scale*Li)*b}return{rect:m.rect,metrics:m.metrics,baselineOffset:y}}function hv(n,t,r,a,c){const d=c[n.imageName];if(!d)return null;const p=d.paddedRect,m=d.displaySize,y={width:m[0],height:m[1],left:1,top:-3,advance:t?m[1]:m[0]};let b;if(t)b=a.verticalLineContentWidth-m[1]*n.scale;else{const S=Jm(n.verticalAlign);b=(a.horizontalLineContentHeight-m[1]*n.scale)*S}return{rect:p,metrics:y,baselineOffset:b,imageOffset:(t?m[0]:m[1])*n.scale-Li*r}}function dv(n,t,r,a){if(a===0)return;const c=n[r],d=(n[r].x+c.metrics.advance*c.scale)*a;for(let p=t;p<=r;p++)n[p].x-=d}function pv(n,t,r){const{horizontalAlign:a,verticalAlign:c}=vp(r),d=t[0]-n.displaySize[0]*a,p=t[1]-n.displaySize[1]*c;return{image:n,top:p,bottom:p+n.displaySize[1],left:d,right:d+n.displaySize[0]}}function Qm(n){var t,r;let a=n.left,c=n.top,d=n.right-a,p=n.bottom-c;const m=(t=n.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",y=(r=n.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",b=(n.image.content[2]-n.image.content[0])/(n.image.content[3]-n.image.content[1]);if(y==="proportional"){if(m==="stretchOnly"&&d/p<b||m==="proportional"){const S=Math.ceil(p*b);a*=S/d,d=S}}else if(m==="proportional"&&y==="stretchOnly"&&b!==0&&d/p>b){const S=Math.ceil(d/b);c*=S/p,p=S}return{x1:a,y1:c,x2:a+d,y2:c+p}}function eg(n,t,r,a,c,d){const p=n.image;let m;if(p.content){const U=p.content,H=p.pixelRatio||1;m=[U[0]/H,U[1]/H,p.displaySize[0]-U[2]/H,p.displaySize[1]-U[3]/H]}const y=t.left*d,b=t.right*d;let S,C,A,L;r==="width"||r==="both"?(L=c[0]+y-a[3],C=c[0]+b+a[1]):(L=c[0]+(y+b-p.displaySize[0])/2,C=L+p.displaySize[0]);const B=t.top*d,j=t.bottom*d;return r==="height"||r==="both"?(S=c[1]+B-a[0],A=c[1]+j+a[2]):(S=c[1]+(B+j-p.displaySize[1])/2,A=S+p.displaySize[1]),{image:p,top:S,right:C,bottom:A,left:L,collisionPadding:m}}const Pa=128,ms=32640;function tg(n,t){const{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Qt(n+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:c}=r;let d=0;for(;d<a.length&&a[d]<=n;)d++;d=Math.max(0,d-1);let p=d;for(;p<a.length&&a[p]<n+1;)p++;p=Math.min(a.length-1,p);const m=a[d],y=a[p];return r.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:y,interpolationType:c}:{kind:"camera",minZoom:m,maxZoom:y,minSize:r.evaluate(new Qt(m)),maxSize:r.evaluate(new Qt(y)),interpolationType:c}}}function bp(n,t,r){let a="never";const c=n.get(t);return c?a=c:n.get(r)&&(a="always"),a}const fv=Nc.VectorTileFeature.types,mv=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function zh(n,t,r,a,c,d,p,m,y,b,S,C,A){const L=m?Math.min(ms,Math.round(m[0])):0,B=m?Math.min(ms,Math.round(m[1])):0;n.emplaceBack(t,r,Math.round(32*a),Math.round(32*c),d,p,(L<<1)+(y?1:0),B,16*b,16*S,256*C,256*A)}function wp(n,t,r){n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r)}function gv(n){for(const t of n.sections)if(wc(t.text))return!0;return!1}class Tp{constructor(t){this.layoutVertexArray=new ht,this.indexArray=new $t,this.programConfigurations=t,this.segments=new Ct,this.dynamicLayoutVertexArray=new Lt,this.opacityVertexArray=new ai,this.hasVisibleVertices=!1,this.placedSymbolArray=new W}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,a,c){this.isEmpty()||(a&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Yx.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Kx.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,mv,!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())}}Ge("SymbolBuffers",Tp);class Sp{constructor(t,r,a){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new a,this.segments=new Ct,this.collisionVertexArray=new si}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Jx.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ge("CollisionBuffers",Sp);class gl{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(p=>p.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=tg(this.zoom,r["text-size"]),this.iconSizeData=tg(this.zoom,r["icon-size"]);const a=this.layers[0].layout,c=a.get("symbol-sort-key"),d=a.get("symbol-z-order");this.canOverlap=bp(a,"text-overlap","text-allow-overlap")!=="never"||bp(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.an[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=t.sourceID}createArrays(){this.text=new Tp(new aa(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Tp(new aa(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new Y,this.lineVertexArray=new ie,this.symbolInstances=new ee,this.textAnchorOffsets=new K}calculateGlyphDependencies(t,r,a,c,d){for(let p=0;p<t.length;p++)if(r[t.charCodeAt(p)]=!0,(a||c)&&d){const m=Uc[t.charAt(p)];m&&(r[m.charCodeAt(0)]=!0)}}populate(t,r,a){const c=this.layers[0],d=c.layout,p=d.get("text-font"),m=d.get("text-field"),y=d.get("icon-image"),b=(m.value.kind!=="constant"||m.value.value instanceof rr&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),S=y.value.kind!=="constant"||!!y.value.value||Object.keys(y.parameters).length>0,C=d.get("symbol-sort-key");if(this.features=[],!b&&!S)return;const A=r.iconDependencies,L=r.glyphDependencies,B=r.availableImages,j=new Qt(this.zoom,{globalState:this.globalState});for(const{feature:U,id:H,index:se,sourceLayerIndex:Q}of t){const R=c._featureFilter.needGeometry,Z=so(U,R);if(!c._featureFilter.filter(j,Z,a))continue;let te,ge;if(R||(Z.geometry=ao(U)),b){const be=c.getValueAndResolveTokens("text-field",Z,a,B),Te=rr.factory(be),Re=this.hasRTLText=this.hasRTLText||gv(Te);(!Re||Jn.getRTLTextPluginStatus()==="unavailable"||Re&&Jn.isParsed())&&(te=ev(Te,c,Z))}if(S){const be=c.getValueAndResolveTokens("icon-image",Z,a,B);ge=be instanceof br?be:br.fromString(be)}if(!te&&!ge)continue;const Ie=this.sortFeaturesByKey?C.evaluate(Z,{},a):void 0;if(this.features.push({id:H,text:te,icon:ge,index:se,sourceLayerIndex:Q,geometry:Z.geometry,properties:U.properties,type:fv[U.type],sortKey:Ie}),ge&&(A[ge.name]=!0),te){const be=p.evaluate(Z,{},a).join(","),Te=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(P.an.vertical)>=0;for(const Re of te.sections)if(Re.image)A[Re.image.name]=!0;else{const ze=xc(te.toString()),De=Re.fontStack||be,Pe=L[De]=L[De]||{};this.calculateGlyphDependencies(Re.text,Pe,Te,this.allowVerticalPlacement,ze)}}}d.get("symbol-placement")==="line"&&(this.features=function(U){const H={},se={},Q=[];let R=0;function Z(be){Q.push(U[be]),R++}function te(be,Te,Re){const ze=se[be];return delete se[be],se[Te]=ze,Q[ze].geometry[0].pop(),Q[ze].geometry[0]=Q[ze].geometry[0].concat(Re[0]),ze}function ge(be,Te,Re){const ze=H[Te];return delete H[Te],H[be]=ze,Q[ze].geometry[0].shift(),Q[ze].geometry[0]=Re[0].concat(Q[ze].geometry[0]),ze}function Ie(be,Te,Re){const ze=Re?Te[0][Te[0].length-1]:Te[0][0];return`${be}:${ze.x}:${ze.y}`}for(let be=0;be<U.length;be++){const Te=U[be],Re=Te.geometry,ze=Te.text?Te.text.toString():null;if(!ze){Z(be);continue}const De=Ie(ze,Re),Pe=Ie(ze,Re,!0);if(De in se&&Pe in H&&se[De]!==H[Pe]){const He=ge(De,Pe,Re),it=te(De,Pe,Q[He].geometry);delete H[De],delete se[Pe],se[Ie(ze,Q[it].geometry,!0)]=it,Q[He].geometry=null}else De in se?te(De,Pe,Re):Pe in H?ge(De,Pe,Re):(Z(be),H[De]=R-1,se[Pe]=R-1)}return Q.filter(be=>be.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((U,H)=>U.sortKey-H.sortKey)}update(t,r,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,a),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,a))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,r){const a=this.lineVertexArray.length;if(t.segment!==void 0){let c=t.dist(r[t.segment+1]),d=t.dist(r[t.segment]);const p={};for(let m=t.segment+1;m<r.length;m++)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:c},m<r.length-1&&(c+=r[m+1].dist(r[m]));for(let m=t.segment||0;m>=0;m--)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:d},m>0&&(d+=r[m-1].dist(r[m]));for(let m=0;m<r.length;m++){const y=p[m];this.lineVertexArray.emplaceBack(y.x,y.y,y.tileUnitDistanceFromAnchor)}}return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(t,r,a,c,d,p,m,y,b,S,C,A){const L=t.indexArray,B=t.layoutVertexArray,j=t.segments.prepareSegment(4*r.length,B,L,this.canOverlap?p.sortKey:void 0),U=this.glyphOffsetArray.length,H=j.vertexLength,se=this.allowVerticalPlacement&&m===P.an.vertical?Math.PI/2:0,Q=p.text&&p.text.sections;for(let R=0;R<r.length;R++){const{tl:Z,tr:te,bl:ge,br:Ie,tex:be,pixelOffsetTL:Te,pixelOffsetBR:Re,minFontScaleX:ze,minFontScaleY:De,glyphOffset:Pe,isSDF:He,sectionIndex:it}=r[R],tt=j.vertexLength,Ke=Pe[1];zh(B,y.x,y.y,Z.x,Ke+Z.y,be.x,be.y,a,He,Te.x,Te.y,ze,De),zh(B,y.x,y.y,te.x,Ke+te.y,be.x+be.w,be.y,a,He,Re.x,Te.y,ze,De),zh(B,y.x,y.y,ge.x,Ke+ge.y,be.x,be.y+be.h,a,He,Te.x,Re.y,ze,De),zh(B,y.x,y.y,Ie.x,Ke+Ie.y,be.x+be.w,be.y+be.h,a,He,Re.x,Re.y,ze,De),wp(t.dynamicLayoutVertexArray,y,se),L.emplaceBack(tt,tt+2,tt+1),L.emplaceBack(tt+1,tt+2,tt+3),j.vertexLength+=4,j.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Pe[0]),R!==r.length-1&&it===r[R+1].sectionIndex||t.programConfigurations.populatePaintArrays(B.length,p,p.index,{},A,Q&&Q[it])}t.placedSymbolArray.emplaceBack(y.x,y.y,U,this.glyphOffsetArray.length-U,H,b,S,y.segment,a?a[0]:0,a?a[1]:0,c[0],c[1],m,0,!1,0,C)}_addCollisionDebugVertex(t,r,a,c,d,p){return r.emplaceBack(0,0),t.emplaceBack(a.x,a.y,c,d,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(t,r,a,c,d,p,m){const y=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),b=y.vertexLength,S=d.layoutVertexArray,C=d.collisionVertexArray,A=m.anchorX,L=m.anchorY;this._addCollisionDebugVertex(S,C,p,A,L,new Ue(t,r)),this._addCollisionDebugVertex(S,C,p,A,L,new Ue(a,r)),this._addCollisionDebugVertex(S,C,p,A,L,new Ue(a,c)),this._addCollisionDebugVertex(S,C,p,A,L,new Ue(t,c)),y.vertexLength+=4;const B=d.indexArray;B.emplaceBack(b,b+1),B.emplaceBack(b+1,b+2),B.emplaceBack(b+2,b+3),B.emplaceBack(b+3,b),y.primitiveLength+=4}addDebugCollisionBoxes(t,r,a,c){for(let d=t;d<r;d++){const p=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,c?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,a)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Sp(Zt,Zm.members,Ut),this.iconCollisionBox=new Sp(Zt,Zm.members,Ut);for(let t=0;t<this.symbolInstances.length;t++){const r=this.symbolInstances.get(t);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(t,r,a,c,d,p,m,y,b){const S={};for(let C=r;C<a;C++){const A=t.get(C);S.textBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.textFeatureIndex=A.featureIndex;break}for(let C=c;C<d;C++){const A=t.get(C);S.verticalTextBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.verticalTextFeatureIndex=A.featureIndex;break}for(let C=p;C<m;C++){const A=t.get(C);S.iconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.iconFeatureIndex=A.featureIndex;break}for(let C=y;C<b;C++){const A=t.get(C);S.verticalIconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.verticalIconFeatureIndex=A.featureIndex;break}return S}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const a=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,r){const a=t.placedSymbolArray.get(r),c=a.vertexStartIndex+4*a.numGlyphs;for(let d=a.vertexStartIndex;d<c;d+=4)t.indexArray.emplaceBack(d,d+2,d+1),t.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(t),a=Math.cos(t),c=[],d=[],p=[];for(let m=0;m<this.symbolInstances.length;++m){p.push(m);const y=this.symbolInstances.get(m);c.push(0|Math.round(r*y.anchorX+a*y.anchorY)),d.push(y.featureIndex)}return p.sort((m,y)=>c[m]-c[y]||d[y]-d[m]),p}addToSortKeyRanges(t,r){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===r?a.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const a=this.symbolInstances.get(r);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((c,d,p)=>{c>=0&&p.indexOf(c)===d&&this.addIndicesForPlacedSymbol(this.text,c)}),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let ig,rg;Ge("SymbolBucket",gl,{omit:["layers","collisionBoxArray","features","compareText"]}),gl.MAX_GLYPHS=65535,gl.addDynamicAttributes=wp;var Pp={get paint(){return rg=rg||new mr({"icon-opacity":new nt(ae.paint_symbol["icon-opacity"]),"icon-color":new nt(ae.paint_symbol["icon-color"]),"icon-halo-color":new nt(ae.paint_symbol["icon-halo-color"]),"icon-halo-width":new nt(ae.paint_symbol["icon-halo-width"]),"icon-halo-blur":new nt(ae.paint_symbol["icon-halo-blur"]),"icon-translate":new Xe(ae.paint_symbol["icon-translate"]),"icon-translate-anchor":new Xe(ae.paint_symbol["icon-translate-anchor"]),"text-opacity":new nt(ae.paint_symbol["text-opacity"]),"text-color":new nt(ae.paint_symbol["text-color"],{runtimeType:kr,getOverride:n=>n.textColor,hasOverride:n=>!!n.textColor}),"text-halo-color":new nt(ae.paint_symbol["text-halo-color"]),"text-halo-width":new nt(ae.paint_symbol["text-halo-width"]),"text-halo-blur":new nt(ae.paint_symbol["text-halo-blur"]),"text-translate":new Xe(ae.paint_symbol["text-translate"]),"text-translate-anchor":new Xe(ae.paint_symbol["text-translate-anchor"])})},get layout(){return ig=ig||new mr({"symbol-placement":new Xe(ae.layout_symbol["symbol-placement"]),"symbol-spacing":new Xe(ae.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Xe(ae.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new nt(ae.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Xe(ae.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Xe(ae.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Xe(ae.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Xe(ae.layout_symbol["icon-ignore-placement"]),"icon-optional":new Xe(ae.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Xe(ae.layout_symbol["icon-rotation-alignment"]),"icon-size":new nt(ae.layout_symbol["icon-size"]),"icon-text-fit":new Xe(ae.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Xe(ae.layout_symbol["icon-text-fit-padding"]),"icon-image":new nt(ae.layout_symbol["icon-image"]),"icon-rotate":new nt(ae.layout_symbol["icon-rotate"]),"icon-padding":new nt(ae.layout_symbol["icon-padding"]),"icon-keep-upright":new Xe(ae.layout_symbol["icon-keep-upright"]),"icon-offset":new nt(ae.layout_symbol["icon-offset"]),"icon-anchor":new nt(ae.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Xe(ae.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Xe(ae.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Xe(ae.layout_symbol["text-rotation-alignment"]),"text-field":new nt(ae.layout_symbol["text-field"]),"text-font":new nt(ae.layout_symbol["text-font"]),"text-size":new nt(ae.layout_symbol["text-size"]),"text-max-width":new nt(ae.layout_symbol["text-max-width"]),"text-line-height":new Xe(ae.layout_symbol["text-line-height"]),"text-letter-spacing":new nt(ae.layout_symbol["text-letter-spacing"]),"text-justify":new nt(ae.layout_symbol["text-justify"]),"text-radial-offset":new nt(ae.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Xe(ae.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new nt(ae.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new nt(ae.layout_symbol["text-anchor"]),"text-max-angle":new Xe(ae.layout_symbol["text-max-angle"]),"text-writing-mode":new Xe(ae.layout_symbol["text-writing-mode"]),"text-rotate":new nt(ae.layout_symbol["text-rotate"]),"text-padding":new Xe(ae.layout_symbol["text-padding"]),"text-keep-upright":new Xe(ae.layout_symbol["text-keep-upright"]),"text-transform":new nt(ae.layout_symbol["text-transform"]),"text-offset":new nt(ae.layout_symbol["text-offset"]),"text-allow-overlap":new Xe(ae.layout_symbol["text-allow-overlap"]),"text-overlap":new Xe(ae.layout_symbol["text-overlap"]),"text-ignore-placement":new Xe(ae.layout_symbol["text-ignore-placement"]),"text-optional":new Xe(ae.layout_symbol["text-optional"])})}};class ng{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:ha,this.defaultValue=t}evaluate(t){if(t.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ge("FormatSectionOverride",ng,{omit:["defaultValue"]});class Ah extends qi{constructor(t){super(t,Pp)}recalculate(t,r){if(super.recalculate(t,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const a=this.layout.get("text-writing-mode");if(a){const c=[];for(const d of a)c.indexOf(d)<0&&c.push(d);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,a,c){const d=this.layout.get(t).evaluate(r,{},a,c),p=this._unevaluatedLayout._values[t];return p.isDataDriven()||Wo(p.value)||!d?d:function(m,y){return y.replace(/{([^{}]+)}/g,(b,S)=>m&&S in m?String(m[S]):"")}(r.properties,d)}createBucket(t){return new gl(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Pp.paint.overridableProperties){if(!Ah.hasPaintOverride(this.layout,t))continue;const r=this.paint.get(t),a=new ng(r),c=new qo(a,r.property.specification);let d=null;d=r.value.kind==="constant"||r.value.kind==="source"?new Zs("source",c):new Xo("composite",c,r.value.zoomStops),this.paint._values[t]=new wn(r.property,d,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven())&&Ah.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){const a=t.get("text-field"),c=Pp.paint.properties[r];let d=!1;const p=m=>{for(const y of m)if(c.overrides&&c.overrides.hasOverride(y))return void(d=!0)};if(a.value.kind==="constant"&&a.value.value instanceof rr)p(a.value.value.sections);else if(a.value.kind==="source"){const m=b=>{d||(b instanceof dr&&st(b.value)===da?p(b.value.sections):b instanceof Ls?p(b.sections):b.eachChild(m))},y=a.value;y._styleExpression&&m(y._styleExpression.expression)}return d}}let ag;var _v={get paint(){return ag=ag||new mr({"background-color":new Xe(ae.paint_background["background-color"]),"background-pattern":new Sc(ae.paint_background["background-pattern"]),"background-opacity":new Xe(ae.paint_background["background-opacity"])})}};class yv extends qi{constructor(t){super(t,_v)}}let sg;var xv={get paint(){return sg=sg||new mr({"raster-opacity":new Xe(ae.paint_raster["raster-opacity"]),"raster-hue-rotate":new Xe(ae.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Xe(ae.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Xe(ae.paint_raster["raster-brightness-max"]),"raster-saturation":new Xe(ae.paint_raster["raster-saturation"]),"raster-contrast":new Xe(ae.paint_raster["raster-contrast"]),"raster-resampling":new Xe(ae.paint_raster["raster-resampling"]),"raster-fade-duration":new Xe(ae.paint_raster["raster-fade-duration"])})}};class vv extends qi{constructor(t){super(t,xv)}}class bv extends qi{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class wv{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 Tv={once:!0},Mp=63710088e-1;class gs{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new gs($i(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const r=Math.PI/180,a=this.lat*r,c=t.lat*r,d=Math.sin(a)*Math.sin(c)+Math.cos(a)*Math.cos(c)*Math.cos((t.lng-this.lng)*r);return Mp*Math.acos(Math.min(d,1))}static convert(t){if(t instanceof gs)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new gs(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new gs(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 og=2*Math.PI*Mp;function lg(n){return og*Math.cos(n*Math.PI/180)}function cg(n){return(180+n)/360}function ug(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function hg(n,t){return n/lg(t)}function Cp(n){return 360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90}function dg(n,t){return n*lg(Cp(t))}class Gc{constructor(t,r,a=0){this.x=+t,this.y=+r,this.z=+a}static fromLngLat(t,r=0){const a=gs.convert(t);return new Gc(cg(a.lng),ug(a.lat),hg(r,a.lat))}toLngLat(){return new gs(360*this.x-180,Cp(this.y))}toAltitude(){return dg(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/og*(t=Cp(this.y),1/Math.cos(t*Math.PI/180));var t}}function pg(n,t,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[n*a-2*Math.PI*6378137/2,t*a-2*Math.PI*6378137/2]}class Ip{constructor(t,r,a){if(!function(c,d,p){return!(c<0||c>25||p<0||p>=Math.pow(2,c)||d<0||d>=Math.pow(2,c))}(t,r,a))throw new Error(`x=${r}, y=${a}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=r,this.y=a,this.key=_l(0,t,t,r,a)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,a){const c=(p=this.y,m=this.z,y=pg(256*(d=this.x),256*(p=Math.pow(2,m)-p-1),m),b=pg(256*(d+1),256*(p+1),m),y[0]+","+y[1]+","+b[0]+","+b[1]);var d,p,m,y,b;const S=function(C,A,L){let B,j="";for(let U=C;U>0;U--)B=1<<U-1,j+=(A&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,r>1?"@2x":"").replace(/{quadkey}/g,S).replace(/{bbox-epsg-3857}/g,c)}isChildOf(t){const r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){const r=Math.pow(2,this.z);return new Ue((t.x*r-this.x)*Rt,(t.y*r-this.y)*Rt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class fg{constructor(t,r){this.wrap=t,this.canonical=r,this.key=_l(t,r.z,r.z,r.x,r.y)}}class ln{constructor(t,r,a,c,d){if(this.terrainRttPosMatrix32f=null,t<a)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${a}`);this.overscaledZ=t,this.wrap=r,this.canonical=new Ip(a,+c,+d),this.key=_l(r,t,a,c,d)}clone(){return new ln(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?new ln(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ln(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-t;return t>this.canonical.z?_l(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):_l(this.wrap*+r,t,t,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new ln(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,a=2*this.canonical.x,c=2*this.canonical.y;return[new ln(r,this.wrap,r,a,c),new ln(r,this.wrap,r,a+1,c),new ln(r,this.wrap,r,a,c+1),new ln(r,this.wrap,r,a+1,c+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new ln(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new ln(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 fg(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Gc(t.x-this.wrap,t.y))}}function _l(n,t,r,a,c){(n*=2)<0&&(n=-1*n-1);const d=1<<r;return(d*d*n+d*c+a).toString(36)+r.toString(36)+t.toString(36)}Ge("CanonicalTileID",Ip),Ge("OverscaledTileID",ln,{omit:["terrainRttPosMatrix32f"]});class co{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){const r=new co;return r.extend(t(new Ue(this.minX,this.minY))),r.extend(t(new Ue(this.maxX,this.minY))),r.extend(t(new Ue(this.minX,this.maxY))),r.extend(t(new Ue(this.maxX,this.maxY))),r}static fromPoints(t){const r=new co;for(const a of t)r.extend(a);return r}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}}class mg{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){const a=t[r];this._stringToNumber[a]=r,this._numberToString[r]=a}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class gg{constructor(t,r,a,c,d){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=a,t._y=c,this.properties=t.properties,this.id=d}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class _g{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new us(Rt,16,0),this.grid3D=new us(Rt,16,0),this.featureIndexArray=new ye,this.promoteId=r}insert(t,r,a,c,d,p){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,c,d);const y=p?this.grid3D:this.grid;for(let b=0;b<r.length;b++){const S=r[b],C=[1/0,1/0,-1/0,-1/0];for(let A=0;A<S.length;A++){const L=S[A];C[0]=Math.min(C[0],L.x),C[1]=Math.min(C[1],L.y),C[2]=Math.max(C[2],L.x),C[3]=Math.max(C[3],L.y)}C[0]<Rt&&C[1]<Rt&&C[2]>=0&&C[3]>=0&&y.insert(m,C[0],C[1],C[2],C[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Nc.VectorTile(new _p(this.rawTileData)).layers,this.sourceLayerCoder=new mg(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,a,c){this.loadVTLayers();const d=t.params,p=Rt/t.tileSize/t.scale,m=Yn(d.filter),y=t.queryGeometry,b=t.queryPadding*p,S=co.fromPoints(y),C=this.grid.query(S.minX-b,S.minY-b,S.maxX+b,S.maxY+b),A=co.fromPoints(t.cameraQueryGeometry).expandBy(b),L=this.grid3D.query(A.minX,A.minY,A.maxX,A.maxY,(U,H,se,Q)=>function(R,Z,te,ge,Ie){for(const Te of R)if(Z<=Te.x&&te<=Te.y&&ge>=Te.x&&Ie>=Te.y)return!0;const be=[new Ue(Z,te),new Ue(Z,Ie),new Ue(ge,Ie),new Ue(ge,te)];if(R.length>2){for(const Te of be)if(hl(R,Te))return!0}for(let Te=0;Te<R.length-1;Te++)if(ux(R[Te],R[Te+1],be))return!0;return!1}(t.cameraQueryGeometry,U-b,H-b,se+b,Q+b));for(const U of L)C.push(U);C.sort(Sv);const B={};let j;for(let U=0;U<C.length;U++){const H=C[U];if(H===j)continue;j=H;const se=this.featureIndexArray.get(H);let Q=null;this.loadMatchingFeature(B,se.bucketIndex,se.sourceLayerIndex,se.featureIndex,m,d.layers,d.availableImages,r,a,c,(R,Z,te)=>(Q||(Q=ao(R)),Z.queryIntersectsFeature({queryGeometry:y,feature:R,featureState:te,geometry:Q,zoom:this.z,transform:t.transform,pixelsToTileUnits:p,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return B}loadMatchingFeature(t,r,a,c,d,p,m,y,b,S,C){const A=this.bucketLayerIDs[r];if(p&&!A.some(U=>p.has(U)))return;const L=this.sourceLayerCoder.decode(a),B=this.vtLayers[L].feature(c);if(d.needGeometry){const U=so(B,!0);if(!d.filter(new Qt(this.tileID.overscaledZ),U,this.tileID.canonical))return}else if(!d.filter(new Qt(this.tileID.overscaledZ),B))return;const j=this.getId(B,L);for(let U=0;U<A.length;U++){const H=A[U];if(p&&!p.has(H))continue;const se=y[H];if(!se)continue;let Q={};j&&S&&(Q=S.getState(se.sourceLayer||"_geojsonTileLayer",j));const R=_i({},b[H]);R.paint=yg(R.paint,se.paint,B,Q,m),R.layout=yg(R.layout,se.layout,B,Q,m);const Z=!C||C(B,se,Q);if(!Z)continue;const te=new gg(B,this.z,this.x,this.y,j);te.layer=R;let ge=t[H];ge===void 0&&(ge=t[H]=[]),ge.push({featureIndex:c,feature:te,intersectionZ:Z})}}lookupSymbolFeatures(t,r,a,c,d,p,m,y){const b={};this.loadVTLayers();const S=Yn(d);for(const C of t)this.loadMatchingFeature(b,a,c,C,S,p,m,y,r);return b}hasLayer(t){for(const r of this.bucketLayerIDs)for(const a of r)if(t===a)return!0;return!1}getId(t,r){var a;let c=t.id;return this.promoteId&&(c=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof c=="boolean"&&(c=Number(c)),c===void 0&&(!((a=t.properties)===null||a===void 0)&&a.cluster)&&this.promoteId&&(c=Number(t.properties.cluster_id))),c}}function yg(n,t,r,a,c){return Wt(n,(d,p)=>{const m=t instanceof ol?t.get(p):null;return m&&m.evaluate?m.evaluate(r,a,c):m})}function Sv(n,t){return t-n}function xg(n,t,r,a,c){const d=[];for(let p=0;p<n.length;p++){const m=n[p];let y;for(let b=0;b<m.length-1;b++){let S=m[b],C=m[b+1];S.x<t&&C.x<t||(S.x<t?S=new Ue(t,S.y+(t-S.x)/(C.x-S.x)*(C.y-S.y))._round():C.x<t&&(C=new Ue(t,S.y+(t-S.x)/(C.x-S.x)*(C.y-S.y))._round()),S.y<r&&C.y<r||(S.y<r?S=new Ue(S.x+(r-S.y)/(C.y-S.y)*(C.x-S.x),r)._round():C.y<r&&(C=new Ue(S.x+(r-S.y)/(C.y-S.y)*(C.x-S.x),r)._round()),S.x>=a&&C.x>=a||(S.x>=a?S=new Ue(a,S.y+(a-S.x)/(C.x-S.x)*(C.y-S.y))._round():C.x>=a&&(C=new Ue(a,S.y+(a-S.x)/(C.x-S.x)*(C.y-S.y))._round()),S.y>=c&&C.y>=c||(S.y>=c?S=new Ue(S.x+(c-S.y)/(C.y-S.y)*(C.x-S.x),c)._round():C.y>=c&&(C=new Ue(S.x+(c-S.y)/(C.y-S.y)*(C.x-S.x),c)._round()),y&&S.equals(y[y.length-1])||(y=[S],d.push(y)),y.push(C)))))}}return d}Ge("FeatureIndex",_g,{omit:["rawTileData","sourceLayerCoder"]});class _s extends Ue{constructor(t,r,a,c){super(t,r),this.angle=a,c!==void 0&&(this.segment=c)}clone(){return new _s(this.x,this.y,this.angle,this.segment)}}function vg(n,t,r,a,c){if(t.segment===void 0||r===0)return!0;let d=t,p=t.segment+1,m=0;for(;m>-r/2;){if(p--,p<0)return!1;m-=n[p].dist(d),d=n[p]}m+=n[p].dist(n[p+1]),p++;const y=[];let b=0;for(;m<r/2;){const S=n[p],C=n[p+1];if(!C)return!1;let A=n[p-1].angleTo(S)-S.angleTo(C);for(A=Math.abs((A+3*Math.PI)%(2*Math.PI)-Math.PI),y.push({distance:m,angleDelta:A}),b+=A;m-y[0].distance>a;)b-=y.shift().angleDelta;if(b>c)return!1;p++,m+=S.dist(C)}return!0}function bg(n){let t=0;for(let r=0;r<n.length-1;r++)t+=n[r].dist(n[r+1]);return t}function wg(n,t,r){return n?.6*t*r:0}function Tg(n,t){return Math.max(n?n.right-n.left:0,t?t.right-t.left:0)}function Pv(n,t,r,a,c,d){const p=wg(r,c,d),m=Tg(r,a)*d;let y=0;const b=bg(n)/2;for(let S=0;S<n.length-1;S++){const C=n[S],A=n[S+1],L=C.dist(A);if(y+L>b){const B=(b-y)/L,j=Dr.number(C.x,A.x,B),U=Dr.number(C.y,A.y,B),H=new _s(j,U,A.angleTo(C),S);return H._round(),!p||vg(n,H,m,p,t)?H:void 0}y+=L}}function Mv(n,t,r,a,c,d,p,m,y){const b=wg(a,d,p),S=Tg(a,c),C=S*p,A=n[0].x===0||n[0].x===y||n[0].y===0||n[0].y===y;return t-C<t/4&&(t=C+t/4),Sg(n,A?t/2*m%t:(S/2+2*d)*p*m%t,t,b,r,C,A,!1,y)}function Sg(n,t,r,a,c,d,p,m,y){const b=d/2,S=bg(n);let C=0,A=t-r,L=[];for(let B=0;B<n.length-1;B++){const j=n[B],U=n[B+1],H=j.dist(U),se=U.angleTo(j);for(;A+r<C+H;){A+=r;const Q=(A-C)/H,R=Dr.number(j.x,U.x,Q),Z=Dr.number(j.y,U.y,Q);if(R>=0&&R<y&&Z>=0&&Z<y&&A-b>=0&&A+b<=S){const te=new _s(R,Z,se,B);te._round(),a&&!vg(n,te,d,a,c)||L.push(te)}}C+=H}return m||L.length||p||(L=Sg(n,C/2,r,a,c,d,p,!0,y)),L}function Pg(n,t,r,a){const c=[],d=n.image,p=d.pixelRatio,m=d.paddedRect.w-2,y=d.paddedRect.h-2;let b={x1:n.left,y1:n.top,x2:n.right,y2:n.bottom};const S=d.stretchX||[[0,m]],C=d.stretchY||[[0,y]],A=(Pe,He)=>Pe+He[1]-He[0],L=S.reduce(A,0),B=C.reduce(A,0),j=m-L,U=y-B;let H=0,se=L,Q=0,R=B,Z=0,te=j,ge=0,Ie=U;if(d.content&&a){const Pe=d.content,He=Pe[2]-Pe[0],it=Pe[3]-Pe[1];(d.textFitWidth||d.textFitHeight)&&(b=Qm(n)),H=kh(S,0,Pe[0]),Q=kh(C,0,Pe[1]),se=kh(S,Pe[0],Pe[2]),R=kh(C,Pe[1],Pe[3]),Z=Pe[0]-H,ge=Pe[1]-Q,te=He-se,Ie=it-R}const be=b.x1,Te=b.y1,Re=b.x2-be,ze=b.y2-Te,De=(Pe,He,it,tt)=>{const Ke=Rh(Pe.stretch-H,se,Re,be),Tt=Dh(Pe.fixed-Z,te,Pe.stretch,L),hi=Rh(He.stretch-Q,R,ze,Te),Ii=Dh(He.fixed-ge,Ie,He.stretch,B),sr=Rh(it.stretch-H,se,Re,be),cn=Dh(it.fixed-Z,te,it.stretch,L),Br=Rh(tt.stretch-Q,R,ze,Te),Yi=Dh(tt.fixed-ge,Ie,tt.stretch,B),oi=new Ue(Ke,hi),Bi=new Ue(sr,hi),Ki=new Ue(sr,Br),Ji=new Ue(Ke,Br),Pr=new Ue(Tt/p,Ii/p),un=new Ue(cn/p,Yi/p),Fi=t*Math.PI/180;if(Fi){const Oi=Math.sin(Fi),ji=Math.cos(Fi),wi=[ji,-Oi,Oi,ji];oi._matMult(wi),Bi._matMult(wi),Ji._matMult(wi),Ki._matMult(wi)}const Fr=Pe.stretch+Pe.fixed,Ei=He.stretch+He.fixed;return{tl:oi,tr:Bi,bl:Ji,br:Ki,tex:{x:d.paddedRect.x+1+Fr,y:d.paddedRect.y+1+Ei,w:it.stretch+it.fixed-Fr,h:tt.stretch+tt.fixed-Ei},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Pr,pixelOffsetBR:un,minFontScaleX:te/p/Re,minFontScaleY:Ie/p/ze,isSDF:r}};if(a&&(d.stretchX||d.stretchY)){const Pe=Mg(S,j,L),He=Mg(C,U,B);for(let it=0;it<Pe.length-1;it++){const tt=Pe[it],Ke=Pe[it+1];for(let Tt=0;Tt<He.length-1;Tt++)c.push(De(tt,He[Tt],Ke,He[Tt+1]))}}else c.push(De({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:y+1}));return c}function kh(n,t,r){let a=0;for(const c of n)a+=Math.max(t,Math.min(r,c[1]))-Math.max(t,Math.min(r,c[0]));return a}function Mg(n,t,r){const a=[{fixed:-1,stretch:0}];for(const[c,d]of n){const p=a[a.length-1];a.push({fixed:c-p.stretch,stretch:p.stretch}),a.push({fixed:c-p.stretch,stretch:p.stretch+(d-c)})}return a.push({fixed:t+1,stretch:r}),a}function Rh(n,t,r,a){return n/t*r+a}function Dh(n,t,r,a){return n-t*r/a}Ge("Anchor",_s);class Lh{constructor(t,r,a,c,d,p,m,y,b,S){var C;if(this.boxStartIndex=t.length,b){let A=p.top,L=p.bottom;const B=p.collisionPadding;B&&(A-=B[1],L+=B[3]);let j=L-A;j>0&&(j=Math.max(10,j),this.circleDiameter=j)}else{const A=!((C=p.image)===null||C===void 0)&&C.content&&(p.image.textFitWidth||p.image.textFitHeight)?Qm(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};A.y1=A.y1*m-y[0],A.y2=A.y2*m+y[2],A.x1=A.x1*m-y[3],A.x2=A.x2*m+y[1];const L=p.collisionPadding;if(L&&(A.x1-=L[0]*m,A.y1-=L[1]*m,A.x2+=L[2]*m,A.y2+=L[3]*m),S){const B=new Ue(A.x1,A.y1),j=new Ue(A.x2,A.y1),U=new Ue(A.x1,A.y2),H=new Ue(A.x2,A.y2),se=S*Math.PI/180;B._rotate(se),j._rotate(se),U._rotate(se),H._rotate(se),A.x1=Math.min(B.x,j.x,U.x,H.x),A.x2=Math.max(B.x,j.x,U.x,H.x),A.y1=Math.min(B.y,j.y,U.y,H.y),A.y2=Math.max(B.y,j.y,U.y,H.y)}t.emplaceBack(r.x,r.y,A.x1,A.y1,A.x2,A.y2,a,c,d)}this.boxEndIndex=t.length}}class Cv{constructor(t=[],r=(a,c)=>a<c?-1:a>c?1:0){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:r,compare:a}=this,c=r[t];for(;t>0;){const d=t-1>>1,p=r[d];if(a(c,p)>=0)break;r[t]=p,t=d}r[t]=c}_down(t){const{data:r,compare:a}=this,c=this.length>>1,d=r[t];for(;t<c;){let p=1+(t<<1);const m=p+1;if(m<this.length&&a(r[m],r[p])<0&&(p=m),a(r[p],d)>=0)break;r[t]=r[p],t=p}r[t]=d}}function Iv(n,t=1,r=!1){const a=co.fromPoints(n[0]),c=Math.min(a.width(),a.height());let d=c/2;const p=new Cv([],Ev),{minX:m,minY:y,maxX:b,maxY:S}=a;if(c===0)return new Ue(m,y);for(let L=m;L<b;L+=c)for(let B=y;B<S;B+=c)p.push(new yl(L+d,B+d,d,n));let C=function(L){let B=0,j=0,U=0;const H=L[0];for(let se=0,Q=H.length,R=Q-1;se<Q;R=se++){const Z=H[se],te=H[R],ge=Z.x*te.y-te.x*Z.y;j+=(Z.x+te.x)*ge,U+=(Z.y+te.y)*ge,B+=3*ge}return new yl(j/B,U/B,0,L)}(n),A=p.length;for(;p.length;){const L=p.pop();(L.d>C.d||!C.d)&&(C=L,r&&console.log("found best %d after %d probes",Math.round(1e4*L.d)/1e4,A)),L.max-C.d<=t||(d=L.h/2,p.push(new yl(L.p.x-d,L.p.y-d,d,n)),p.push(new yl(L.p.x+d,L.p.y-d,d,n)),p.push(new yl(L.p.x-d,L.p.y+d,d,n)),p.push(new yl(L.p.x+d,L.p.y+d,d,n)),A+=4)}return r&&(console.log(`num probes: ${A}`),console.log(`best distance: ${C.d}`)),C.p}function Ev(n,t){return t.max-n.max}function yl(n,t,r,a){this.p=new Ue(n,t),this.h=r,this.d=function(c,d){let p=!1,m=1/0;for(let y=0;y<d.length;y++){const b=d[y];for(let S=0,C=b.length,A=C-1;S<C;A=S++){const L=b[S],B=b[A];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),m=Math.min(m,am(c,L,B))}}return(p?1:-1)*Math.sqrt(m)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var ar;P.aD=void 0,(ar=P.aD||(P.aD={}))[ar.center=1]="center",ar[ar.left=2]="left",ar[ar.right=3]="right",ar[ar.top=4]="top",ar[ar.bottom=5]="bottom",ar[ar["top-left"]=6]="top-left",ar[ar["top-right"]=7]="top-right",ar[ar["bottom-left"]=8]="bottom-left",ar[ar["bottom-right"]=9]="bottom-right";const Ep=Number.POSITIVE_INFINITY;function Cg(n,t){return t[1]!==Ep?function(r,a,c){let d=0,p=0;switch(a=Math.abs(a),c=Math.abs(c),r){case"top-right":case"top-left":case"top":p=c-7;break;case"bottom-right":case"bottom-left":case"bottom":p=7-c}switch(r){case"top-right":case"bottom-right":case"right":d=-a;break;case"top-left":case"bottom-left":case"left":d=a}return[d,p]}(n,t[0],t[1]):function(r,a){let c=0,d=0;a<0&&(a=0);const p=a/Math.SQRT2;switch(r){case"top-right":case"top-left":d=p-7;break;case"bottom-right":case"bottom-left":d=7-p;break;case"bottom":d=7-a;break;case"top":d=a-7}switch(r){case"top-right":case"bottom-right":c=-p;break;case"top-left":case"bottom-left":c=p;break;case"left":c=a;break;case"right":c=-a}return[c,d]}(n,t[0])}function Ig(n,t,r){var a;const c=n.layout,d=(a=c.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(t,{},r);if(d){const m=d.values,y=[];for(let b=0;b<m.length;b+=2){const S=y[b]=m[b],C=m[b+1].map(A=>A*Li);S.startsWith("top")?C[1]-=7:S.startsWith("bottom")&&(C[1]+=7),y[b+1]=C}return new Pt(y)}const p=c.get("text-variable-anchor");if(p){let m;m=n._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[c.get("text-radial-offset").evaluate(t,{},r)*Li,Ep]:c.get("text-offset").evaluate(t,{},r).map(b=>b*Li);const y=[];for(const b of p)y.push(b,Cg(b,m));return new Pt(y)}return null}function zp(n){switch(n){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function zv(n,t,r,a,c,d,p,m,y,b,S,C){let A=d.textMaxSize.evaluate(t,{});A===void 0&&(A=p);const L=n.layers[0].layout,B=L.get("icon-offset").evaluate(t,{},S),j=zg(r.horizontal),U=p/24,H=n.tilePixelRatio*U,se=n.tilePixelRatio*A/24,Q=n.tilePixelRatio*m,R=n.tilePixelRatio*L.get("symbol-spacing"),Z=L.get("text-padding")*n.tilePixelRatio,te=function(it,tt,Ke,Tt=1){const hi=it.get("icon-padding").evaluate(tt,{},Ke),Ii=hi&&hi.values;return[Ii[0]*Tt,Ii[1]*Tt,Ii[2]*Tt,Ii[3]*Tt]}(L,t,S,n.tilePixelRatio),ge=L.get("text-max-angle")/180*Math.PI,Ie=L.get("text-rotation-alignment")!=="viewport"&&L.get("symbol-placement")!=="point",be=L.get("icon-rotation-alignment")==="map"&&L.get("symbol-placement")!=="point",Te=L.get("symbol-placement"),Re=R/2,ze=L.get("icon-text-fit");let De;a&&ze!=="none"&&(n.allowVerticalPlacement&&r.vertical&&(De=eg(a,r.vertical,ze,L.get("icon-text-fit-padding"),B,U)),j&&(a=eg(a,j,ze,L.get("icon-text-fit-padding"),B,U)));const Pe=S?C.line.getGranularityForZoomLevel(S.z):1,He=(it,tt)=>{tt.x<0||tt.x>=Rt||tt.y<0||tt.y>=Rt||function(Ke,Tt,hi,Ii,sr,cn,Br,Yi,oi,Bi,Ki,Ji,Pr,un,Fi,Fr,Ei,Oi,ji,wi,Xt,Bn,xl,Fn,Rv){const vl=Ke.addToLineVertexArray(Tt,hi);let uo,bl,wl,Tl,Dg=0,Lg=0,Bg=0,Fg=0,Op=-1,jp=-1;const Ma={};let Og=Sr("");if(Ke.allowVerticalPlacement&&Ii.vertical){const _r=Yi.layout.get("text-rotate").evaluate(Xt,{},Fn)+90;wl=new Lh(oi,Tt,Bi,Ki,Ji,Ii.vertical,Pr,un,Fi,_r),Br&&(Tl=new Lh(oi,Tt,Bi,Ki,Ji,Br,Ei,Oi,Fi,_r))}if(sr){const _r=Yi.layout.get("icon-rotate").evaluate(Xt,{}),hn=Yi.layout.get("icon-text-fit")!=="none",ho=Pg(sr,_r,xl,hn),jn=Br?Pg(Br,_r,xl,hn):void 0;bl=new Lh(oi,Tt,Bi,Ki,Ji,sr,Ei,Oi,!1,_r),Dg=4*ho.length;const po=Ke.iconSizeData;let sa=null;po.kind==="source"?(sa=[Pa*Yi.layout.get("icon-size").evaluate(Xt,{})],sa[0]>ms&&Mi(`${Ke.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):po.kind==="composite"&&(sa=[Pa*Bn.compositeIconSizes[0].evaluate(Xt,{},Fn),Pa*Bn.compositeIconSizes[1].evaluate(Xt,{},Fn)],(sa[0]>ms||sa[1]>ms)&&Mi(`${Ke.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Ke.addSymbols(Ke.icon,ho,sa,wi,ji,Xt,P.an.none,Tt,vl.lineStartIndex,vl.lineLength,-1,Fn),Op=Ke.icon.placedSymbolArray.length-1,jn&&(Lg=4*jn.length,Ke.addSymbols(Ke.icon,jn,sa,wi,ji,Xt,P.an.vertical,Tt,vl.lineStartIndex,vl.lineLength,-1,Fn),jp=Ke.icon.placedSymbolArray.length-1)}const jg=Object.keys(Ii.horizontal);for(const _r of jg){const hn=Ii.horizontal[_r];if(!uo){Og=Sr(hn.text);const jn=Yi.layout.get("text-rotate").evaluate(Xt,{},Fn);uo=new Lh(oi,Tt,Bi,Ki,Ji,hn,Pr,un,Fi,jn)}const ho=hn.positionedLines.length===1;if(Bg+=Eg(Ke,Tt,hn,cn,Yi,Fi,Xt,Fr,vl,Ii.vertical?P.an.horizontal:P.an.horizontalOnly,ho?jg:[_r],Ma,Op,Bn,Fn),ho)break}Ii.vertical&&(Fg+=Eg(Ke,Tt,Ii.vertical,cn,Yi,Fi,Xt,Fr,vl,P.an.vertical,["vertical"],Ma,jp,Bn,Fn));const Dv=uo?uo.boxStartIndex:Ke.collisionBoxArray.length,Lv=uo?uo.boxEndIndex:Ke.collisionBoxArray.length,Bv=wl?wl.boxStartIndex:Ke.collisionBoxArray.length,Fv=wl?wl.boxEndIndex:Ke.collisionBoxArray.length,Ov=bl?bl.boxStartIndex:Ke.collisionBoxArray.length,jv=bl?bl.boxEndIndex:Ke.collisionBoxArray.length,Nv=Tl?Tl.boxStartIndex:Ke.collisionBoxArray.length,Vv=Tl?Tl.boxEndIndex:Ke.collisionBoxArray.length;let On=-1;const Fh=(_r,hn)=>_r&&_r.circleDiameter?Math.max(_r.circleDiameter,hn):hn;On=Fh(uo,On),On=Fh(wl,On),On=Fh(bl,On),On=Fh(Tl,On);const Ng=On>-1?1:0;Ng&&(On*=Rv/Li),Ke.glyphOffsetArray.length>=gl.MAX_GLYPHS&&Mi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Xt.sortKey!==void 0&&Ke.addToSortKeyRanges(Ke.symbolInstances.length,Xt.sortKey);const Zv=Ig(Yi,Xt,Fn),[Uv,$v]=function(_r,hn){const ho=_r.length,jn=hn==null?void 0:hn.values;if((jn==null?void 0:jn.length)>0)for(let po=0;po<jn.length;po+=2){const sa=jn[po+1];_r.emplaceBack(P.aD[jn[po]],sa[0],sa[1])}return[ho,_r.length]}(Ke.textAnchorOffsets,Zv);Ke.symbolInstances.emplaceBack(Tt.x,Tt.y,Ma.right>=0?Ma.right:-1,Ma.center>=0?Ma.center:-1,Ma.left>=0?Ma.left:-1,Ma.vertical||-1,Op,jp,Og,Dv,Lv,Bv,Fv,Ov,jv,Nv,Vv,Bi,Bg,Fg,Dg,Lg,Ng,0,Pr,On,Uv,$v)}(n,tt,it,r,a,c,De,n.layers[0],n.collisionBoxArray,t.index,t.sourceLayerIndex,n.index,H,[Z,Z,Z,Z],Ie,y,Q,te,be,B,t,d,b,S,p)};if(Te==="line")for(const it of xg(t.geometry,0,0,Rt,Rt)){const tt=lo(it,Pe),Ke=Mv(tt,R,ge,r.vertical||j,a,24,se,n.overscaling,Rt);for(const Tt of Ke)j&&Av(n,j.text,Re,Tt)||He(tt,Tt)}else if(Te==="line-center"){for(const it of t.geometry)if(it.length>1){const tt=lo(it,Pe),Ke=Pv(tt,ge,r.vertical||j,a,24,se);Ke&&He(tt,Ke)}}else if(t.type==="Polygon")for(const it of jo(t.geometry,0)){const tt=Iv(it,16);He(lo(it[0],Pe,!0),new _s(tt.x,tt.y,0))}else if(t.type==="LineString")for(const it of t.geometry){const tt=lo(it,Pe);He(tt,new _s(tt[0].x,tt[0].y,0))}else if(t.type==="Point")for(const it of t.geometry)for(const tt of it)He([tt],new _s(tt.x,tt.y,0))}function Eg(n,t,r,a,c,d,p,m,y,b,S,C,A,L,B){const j=function(se,Q,R,Z,te,ge,Ie,be){const Te=Z.layout.get("text-rotate").evaluate(ge,{})*Math.PI/180,Re=[];for(const ze of Q.positionedLines)for(const De of ze.positionedGlyphs){if(!De.rect)continue;const Pe=De.rect||{};let He=4,it=!0,tt=1,Ke=0;const Tt=(te||be)&&De.vertical,hi=De.metrics.advance*De.scale/2;if(be&&Q.verticalizable&&(Ke=ze.lineOffset/2-(De.imageName?-(Li-De.metrics.width*De.scale)/2:(De.scale-1)*Li)),De.imageName){const Oi=Ie[De.imageName];it=Oi.sdf,tt=Oi.pixelRatio,He=1/tt}const Ii=te?[De.x+hi,De.y]:[0,0];let sr=te?[0,0]:[De.x+hi+R[0],De.y+R[1]-Ke],cn=[0,0];Tt&&(cn=sr,sr=[0,0]);const Br=De.metrics.isDoubleResolution?2:1,Yi=(De.metrics.left-He)*De.scale-hi+sr[0],oi=(-De.metrics.top-He)*De.scale+sr[1],Bi=Yi+Pe.w/Br*De.scale/tt,Ki=oi+Pe.h/Br*De.scale/tt,Ji=new Ue(Yi,oi),Pr=new Ue(Bi,oi),un=new Ue(Yi,Ki),Fi=new Ue(Bi,Ki);if(Tt){const Oi=new Ue(-hi,hi- -17),ji=-Math.PI/2,wi=12-hi,Xt=new Ue(22-wi,-(De.imageName?wi:0)),Bn=new Ue(...cn);Ji._rotateAround(ji,Oi)._add(Xt)._add(Bn),Pr._rotateAround(ji,Oi)._add(Xt)._add(Bn),un._rotateAround(ji,Oi)._add(Xt)._add(Bn),Fi._rotateAround(ji,Oi)._add(Xt)._add(Bn)}if(Te){const Oi=Math.sin(Te),ji=Math.cos(Te),wi=[ji,-Oi,Oi,ji];Ji._matMult(wi),Pr._matMult(wi),un._matMult(wi),Fi._matMult(wi)}const Fr=new Ue(0,0),Ei=new Ue(0,0);Re.push({tl:Ji,tr:Pr,bl:un,br:Fi,tex:Pe,writingMode:Q.writingMode,glyphOffset:Ii,sectionIndex:De.sectionIndex,isSDF:it,pixelOffsetTL:Fr,pixelOffsetBR:Ei,minFontScaleX:0,minFontScaleY:0})}return Re}(0,r,m,c,d,p,a,n.allowVerticalPlacement),U=n.textSizeData;let H=null;U.kind==="source"?(H=[Pa*c.layout.get("text-size").evaluate(p,{})],H[0]>ms&&Mi(`${n.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):U.kind==="composite"&&(H=[Pa*L.compositeTextSizes[0].evaluate(p,{},B),Pa*L.compositeTextSizes[1].evaluate(p,{},B)],(H[0]>ms||H[1]>ms)&&Mi(`${n.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),n.addSymbols(n.text,j,H,m,d,p,b,t,y.lineStartIndex,y.lineLength,A,B);for(const se of S)C[se]=n.text.placedSymbolArray.length-1;return 4*j.length}function zg(n){for(const t in n)return n[t];return null}function Av(n,t,r,a){const c=n.compareText;if(t in c){const d=c[t];for(let p=d.length-1;p>=0;p--)if(a.dist(d[p])<r)return!0}else c[t]=[];return c[t].push(a),!1}const Ag=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Ap{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,a]=new Uint8Array(t,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const c=a>>4;if(c!==1)throw new Error(`Got v${c} data when expected v1.`);const d=Ag[15&a];if(!d)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(t,2,1),[m]=new Uint32Array(t,4,1);return new Ap(m,p,d,t)}constructor(t,r=64,a=Float64Array,c){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=a,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const d=Ag.indexOf(this.ArrayType),p=2*t*this.ArrayType.BYTES_PER_ELEMENT,m=t*this.IndexArrayType.BYTES_PER_ELEMENT,y=(8-m%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${a}.`);c&&c instanceof ArrayBuffer?(this.data=c,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+m+y,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+p+m+y),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+m+y,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){const a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=t,this.coords[this._pos++]=r,a}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return kp(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,a,c){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:p,nodeSize:m}=this,y=[0,d.length-1,0],b=[];for(;y.length;){const S=y.pop()||0,C=y.pop()||0,A=y.pop()||0;if(C-A<=m){for(let U=A;U<=C;U++){const H=p[2*U],se=p[2*U+1];H>=t&&H<=a&&se>=r&&se<=c&&b.push(d[U])}continue}const L=A+C>>1,B=p[2*L],j=p[2*L+1];B>=t&&B<=a&&j>=r&&j<=c&&b.push(d[L]),(S===0?t<=B:r<=j)&&(y.push(A),y.push(L-1),y.push(1-S)),(S===0?a>=B:c>=j)&&(y.push(L+1),y.push(C),y.push(1-S))}return b}within(t,r,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:c,coords:d,nodeSize:p}=this,m=[0,c.length-1,0],y=[],b=a*a;for(;m.length;){const S=m.pop()||0,C=m.pop()||0,A=m.pop()||0;if(C-A<=p){for(let U=A;U<=C;U++)Rg(d[2*U],d[2*U+1],t,r)<=b&&y.push(c[U]);continue}const L=A+C>>1,B=d[2*L],j=d[2*L+1];Rg(B,j,t,r)<=b&&y.push(c[L]),(S===0?t-a<=B:r-a<=j)&&(m.push(A),m.push(L-1),m.push(1-S)),(S===0?t+a>=B:r+a>=j)&&(m.push(L+1),m.push(C),m.push(1-S))}return y}}function kp(n,t,r,a,c,d){if(c-a<=r)return;const p=a+c>>1;kg(n,t,p,a,c,d),kp(n,t,r,a,p-1,1-d),kp(n,t,r,p+1,c,1-d)}function kg(n,t,r,a,c,d){for(;c>a;){if(c-a>600){const b=c-a+1,S=r-a+1,C=Math.log(b),A=.5*Math.exp(2*C/3),L=.5*Math.sqrt(C*A*(b-A)/b)*(S-b/2<0?-1:1);kg(n,t,r,Math.max(a,Math.floor(r-S*A/b+L)),Math.min(c,Math.floor(r+(b-S)*A/b+L)),d)}const p=t[2*r+d];let m=a,y=c;for(qc(n,t,a,r),t[2*c+d]>p&&qc(n,t,a,c);m<y;){for(qc(n,t,m,y),m++,y--;t[2*m+d]<p;)m++;for(;t[2*y+d]>p;)y--}t[2*a+d]===p?qc(n,t,a,y):(y++,qc(n,t,y,c)),y<=r&&(a=y+1),r<=y&&(c=y-1)}}function qc(n,t,r,a){Rp(n,r,a),Rp(t,2*r,2*a),Rp(t,2*r+1,2*a+1)}function Rp(n,t,r){const a=n[t];n[t]=n[r],n[r]=a}function Rg(n,t,r,a){const c=n-r,d=t-a;return c*c+d*d}var Dp;P.cw=void 0,(Dp=P.cw||(P.cw={})).create="create",Dp.load="load",Dp.fullLoad="fullLoad";let Bh=null,Wc=[];const Lp=1e3/60,Bp="loadTime",Fp="fullLoadTime",kv={mark(n){performance.mark(n)},frame(n){const t=n;Bh!=null&&Wc.push(t-Bh),Bh=t},clearMetrics(){Bh=null,Wc=[],performance.clearMeasures(Bp),performance.clearMeasures(Fp);for(const n in P.cw)performance.clearMarks(P.cw[n])},getPerformanceMetrics(){performance.measure(Bp,P.cw.create,P.cw.load),performance.measure(Fp,P.cw.create,P.cw.fullLoad);const n=performance.getEntriesByName(Bp)[0].duration,t=performance.getEntriesByName(Fp)[0].duration,r=Wc.length,a=1/(Wc.reduce((d,p)=>d+p,0)/r/1e3),c=Wc.filter(d=>d>Lp).reduce((d,p)=>d+(p-Lp)/Lp,0);return{loadTime:n,fullLoadTime:t,fps:a,percentDroppedFrames:c/(r+c)*100,totalFrames:r}}};P.$=Rt,P.A=Ft,P.B=function([n,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:n*Math.cos(t)*Math.sin(r),y:n*Math.sin(t)*Math.sin(r),z:n*Math.cos(r)}},P.C=Dr,P.D=Xe,P.E=Me,P.F=Qt,P.G=rl,P.H=function(n){if(Cn==null){const t=n.navigator?n.navigator.userAgent:null;Cn=!!n.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Cn},P.I=yp,P.J=class{constructor(n,t){this.target=n,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new wv(()=>this.process()),this.subscription=Oe(this.target,"message",r=>this.receive(r),!1),this.globalScope=ir(self)?n:window}registerMessageHandler(n,t){this.messageHandlers[n]=t}sendAsync(n,t){return new Promise((r,a)=>{const c=Math.round(1e18*Math.random()).toString(36).substring(0,10),d=t?Oe(t.signal,"abort",()=>{d==null||d.unsubscribe(),delete this.resolveRejects[c];const y={id:c,type:"<cancel>",origin:location.origin,targetMapId:n.targetMapId,sourceMapId:this.mapId};this.target.postMessage(y)},Tv):null;this.resolveRejects[c]={resolve:y=>{d==null||d.unsubscribe(),r(y)},reject:y=>{d==null||d.unsubscribe(),a(y)}};const p=[],m=Object.assign(Object.assign({},n),{id:c,sourceMapId:this.mapId,origin:location.origin,data:Ys(n.data,p)});this.target.postMessage(m,{transfer:p})})}receive(n){const t=n.data,r=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[r];const a=this.abortControllers[r];return delete this.abortControllers[r],void(a&&a.abort())}if(ir(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;const n=this.taskQueue.shift(),t=this.tasks[n];delete this.tasks[n],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(n,t)}processTask(n,t){return o(this,void 0,void 0,function*(){if(t.type==="<response>"){const c=this.resolveRejects[n];return delete this.resolveRejects[n],c?void(t.error?c.reject(hs(t.error)):c.resolve(hs(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(n,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=hs(t.data),a=new AbortController;this.abortControllers[n]=a;try{const c=yield this.messageHandlers[t.type](t.sourceMapId,r,a);this.completeTask(n,null,c)}catch(c){this.completeTask(n,c)}})}completeTask(n,t,r){const a=[];delete this.abortControllers[n];const c={id:n,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Ys(t):null,data:Ys(r,a)};this.target.postMessage(c,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},P.K=$,P.L=function(){var n=new Ft(16);return Ft!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0),n[0]=1,n[5]=1,n[10]=1,n[15]=1,n},P.M=function(n,t,r){var a,c,d,p,m,y,b,S,C,A,L,B,j=r[0],U=r[1],H=r[2];return t===n?(n[12]=t[0]*j+t[4]*U+t[8]*H+t[12],n[13]=t[1]*j+t[5]*U+t[9]*H+t[13],n[14]=t[2]*j+t[6]*U+t[10]*H+t[14],n[15]=t[3]*j+t[7]*U+t[11]*H+t[15]):(c=t[1],d=t[2],p=t[3],m=t[4],y=t[5],b=t[6],S=t[7],C=t[8],A=t[9],L=t[10],B=t[11],n[0]=a=t[0],n[1]=c,n[2]=d,n[3]=p,n[4]=m,n[5]=y,n[6]=b,n[7]=S,n[8]=C,n[9]=A,n[10]=L,n[11]=B,n[12]=a*j+m*U+C*H+t[12],n[13]=c*j+y*U+A*H+t[13],n[14]=d*j+b*U+L*H+t[14],n[15]=p*j+S*U+B*H+t[15]),n},P.N=function(n,t,r){var a=r[0],c=r[1],d=r[2];return n[0]=t[0]*a,n[1]=t[1]*a,n[2]=t[2]*a,n[3]=t[3]*a,n[4]=t[4]*c,n[5]=t[5]*c,n[6]=t[6]*c,n[7]=t[7]*c,n[8]=t[8]*d,n[9]=t[9]*d,n[10]=t[10]*d,n[11]=t[11]*d,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},P.O=function(n,t,r){var a=t[0],c=t[1],d=t[2],p=t[3],m=t[4],y=t[5],b=t[6],S=t[7],C=t[8],A=t[9],L=t[10],B=t[11],j=t[12],U=t[13],H=t[14],se=t[15],Q=r[0],R=r[1],Z=r[2],te=r[3];return n[0]=Q*a+R*m+Z*C+te*j,n[1]=Q*c+R*y+Z*A+te*U,n[2]=Q*d+R*b+Z*L+te*H,n[3]=Q*p+R*S+Z*B+te*se,n[4]=(Q=r[4])*a+(R=r[5])*m+(Z=r[6])*C+(te=r[7])*j,n[5]=Q*c+R*y+Z*A+te*U,n[6]=Q*d+R*b+Z*L+te*H,n[7]=Q*p+R*S+Z*B+te*se,n[8]=(Q=r[8])*a+(R=r[9])*m+(Z=r[10])*C+(te=r[11])*j,n[9]=Q*c+R*y+Z*A+te*U,n[10]=Q*d+R*b+Z*L+te*H,n[11]=Q*p+R*S+Z*B+te*se,n[12]=(Q=r[12])*a+(R=r[13])*m+(Z=r[14])*C+(te=r[15])*j,n[13]=Q*c+R*y+Z*A+te*U,n[14]=Q*d+R*b+Z*L+te*H,n[15]=Q*p+R*S+Z*B+te*se,n},P.P=Ue,P.Q=function(n,t){const r={};for(let a=0;a<t.length;a++){const c=t[a];c in n&&(r[c]=n[c])}return r},P.R=Lr,P.S=gs,P.T=rp,P.U=ug,P.V=cg,P.W=Vi,P.X=li,P.Y=tn,P.Z=ln,P._=o,P.a=N,P.a$=function(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n[2]=t[2]*r,n[3]=t[3]*r,n},P.a0=Gc,P.a1=co,P.a2=25,P.a3=Ip,P.a4=n=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(const a of n){const c=window.document.createElement("source");_e(a)||(t.crossOrigin="Anonymous"),c.src=a,t.appendChild(c)}})},P.a5=Be,P.a6=function(){return Gn++},P.a7=q,P.a8=gl,P.a9=Yn,P.aA=Li,P.aB=ur,P.aC=function(n,t,r,a,c=!1){if(!r[0]&&!r[1])return[0,0];const d=c?a==="map"?-n.bearingInRadians:0:a==="viewport"?n.bearingInRadians:0;if(d){const p=Math.sin(d),m=Math.cos(d);r=[r[0]*m-r[1]*p,r[0]*p+r[1]*m]}return[c?r[0]:ur(t,r[0],n.zoom),c?r[1]:ur(t,r[1],n.zoom)]},P.aE=bp,P.aF=zp,P.aG=vp,P.aH=Ap,P.aI=ui,P.aJ=Ph,P.aK=pe,P.aL=Ct,P.aM=$t,P.aN=$i,P.aO=Je,P.aP=dg,P.aQ=Zi,P.aR=yr,P.aS=function(n){var t=new Ft(3);return t[0]=n[0],t[1]=n[1],t[2]=n[2],t},P.aT=function(n,t,r){return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],n},P.aU=function(n,t){var r=t[0],a=t[1],c=t[2],d=r*r+a*a+c*c;return d>0&&(d=1/Math.sqrt(d)),n[0]=t[0]*d,n[1]=t[1]*d,n[2]=t[2]*d,n},P.aV=Vr,P.aW=function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]},P.aX=function(n,t,r){return n[0]=t[0]*r[0],n[1]=t[1]*r[1],n[2]=t[2]*r[2],n[3]=t[3]*r[3],n},P.aY=Nr,P.aZ=function(n,t,r){const a=t[0]*r[0]+t[1]*r[1]+t[2]*r[2];return a===0?null:(-(n[0]*r[0]+n[1]*r[1]+n[2]*r[2])-r[3])/a},P.a_=It,P.aa=so,P.ab=gg,P.ac=function(n){const t={};if(n.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,a,c,d)=>{const p=c||d;return t[a]=!p||p.toLowerCase(),""}),t["max-age"]){const r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},P.ad=Le,P.ae=function(n){return Math.pow(2,n)},P.af=Pn,P.ag=zt,P.ah=85.051129,P.ai=hg,P.aj=function(n){return Math.log(n)/Math.LN2},P.ak=function(n){var t=n[0],r=n[1];return t*t+r*r},P.al=function(n,t){const r=[];for(const a in n)a in t||r.push(a);return r},P.am=function(n,t){let r=0,a=0;if(n.kind==="constant")a=n.layoutSize;else if(n.kind!=="source"){const{interpolationType:c,minZoom:d,maxZoom:p}=n,m=c?zt(pr.interpolationFactor(c,t,d,p),0,1):0;n.kind==="camera"?a=Dr.number(n.minSize,n.maxSize,m):r=m}return{uSizeT:r,uSize:a}},P.ao=function(n,{uSize:t,uSizeT:r},{lowerSize:a,upperSize:c}){return n.kind==="source"?a/Pa:n.kind==="composite"?Dr.number(a/Pa,c/Pa,r):t},P.ap=function(n,t){var r=t[0],a=t[1],c=t[2],d=t[3],p=t[4],m=t[5],y=t[6],b=t[7],S=t[8],C=t[9],A=t[10],L=t[11],B=t[12],j=t[13],U=t[14],H=t[15],se=r*m-a*p,Q=r*y-c*p,R=r*b-d*p,Z=a*y-c*m,te=a*b-d*m,ge=c*b-d*y,Ie=S*j-C*B,be=S*U-A*B,Te=S*H-L*B,Re=C*U-A*j,ze=C*H-L*j,De=A*H-L*U,Pe=se*De-Q*ze+R*Re+Z*Te-te*be+ge*Ie;return Pe?(n[0]=(m*De-y*ze+b*Re)*(Pe=1/Pe),n[1]=(c*ze-a*De-d*Re)*Pe,n[2]=(j*ge-U*te+H*Z)*Pe,n[3]=(A*te-C*ge-L*Z)*Pe,n[4]=(y*Te-p*De-b*be)*Pe,n[5]=(r*De-c*Te+d*be)*Pe,n[6]=(U*R-B*ge-H*Q)*Pe,n[7]=(S*ge-A*R+L*Q)*Pe,n[8]=(p*ze-m*Te+b*Ie)*Pe,n[9]=(a*Te-r*ze-d*Ie)*Pe,n[10]=(B*te-j*R+H*se)*Pe,n[11]=(C*R-S*te-L*se)*Pe,n[12]=(m*be-p*Re-y*Ie)*Pe,n[13]=(r*Re-a*be+c*Ie)*Pe,n[14]=(j*Q-B*Z-U*se)*Pe,n[15]=(S*Z-C*Q+A*se)*Pe,n):null},P.aq=Ir,P.ar=function(n){return Math.hypot(n[0],n[1])},P.as=function(n){return n[0]=0,n[1]=0,n},P.at=function(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n},P.au=wp,P.av=Jt,P.aw=function(n,t,r,a){const c=t.y-n.y,d=t.x-n.x,p=a.y-r.y,m=a.x-r.x,y=p*d-m*c;if(y===0)return null;const b=(m*(n.y-r.y)-p*(n.x-r.x))/y;return new Ue(n.x+b*d,n.y+b*c)},P.ax=xg,P.ay=rm,P.az=function(n){let t=1/0,r=1/0,a=-1/0,c=-1/0;for(const d of n)t=Math.min(t,d.x),r=Math.min(r,d.y),a=Math.max(a,d.x),c=Math.max(c,d.y);return[t,r,a,c]},P.b=gn,P.b$=Qx,P.b0=function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]},P.b1=fg,P.b2=_l,P.b3=function(n,t,r,a,c){var d,p=1/Math.tan(t/2);return n[0]=p/r,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=p,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,c!=null&&c!==1/0?(n[10]=(c+a)*(d=1/(a-c)),n[14]=2*c*a*d):(n[10]=-1,n[14]=-2*a),n},P.b4=function(n){var t=new Ft(16);return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},P.b5=function(n,t,r){var a=Math.sin(r),c=Math.cos(r),d=t[0],p=t[1],m=t[2],y=t[3],b=t[4],S=t[5],C=t[6],A=t[7];return t!==n&&(n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=d*c+b*a,n[1]=p*c+S*a,n[2]=m*c+C*a,n[3]=y*c+A*a,n[4]=b*c-d*a,n[5]=S*c-p*a,n[6]=C*c-m*a,n[7]=A*c-y*a,n},P.b6=function(n,t,r){var a=Math.sin(r),c=Math.cos(r),d=t[4],p=t[5],m=t[6],y=t[7],b=t[8],S=t[9],C=t[10],A=t[11];return t!==n&&(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[4]=d*c+b*a,n[5]=p*c+S*a,n[6]=m*c+C*a,n[7]=y*c+A*a,n[8]=b*c-d*a,n[9]=S*c-p*a,n[10]=C*c-m*a,n[11]=A*c-y*a,n},P.b7=function(){const n=new Float32Array(16);return Pn(n),n},P.b8=function(){const n=new Float64Array(16);return Pn(n),n},P.b9=function(){return new Float64Array(16)},P.bA=function(n){return n[0]=0,n[1]=0,n[2]=0,n},P.bB=function(n,t,r,a){const c=Math.sqrt(n*n+t*t),d=Math.sqrt(r*r+a*a);n/=c,t/=c,r/=d,a/=d;const p=Math.acos(n*r+t*a);return-t*r+n*a>0?p:-p},P.bC=function(n,t){const r=Ui(n,2*Math.PI),a=Ui(t,2*Math.PI);return Math.min(Math.abs(r-a),Math.abs(r-a+2*Math.PI),Math.abs(r-a-2*Math.PI))},P.bD=function(){const n={},t=ae.$version;for(const r in ae.$root){const a=ae.$root[r];if(a.required){let c=null;c=r==="version"?t:a.type==="array"?[]:{},c!=null&&(n[r]=c)}}return n},P.bE=yc,P.bF=re,P.bG=function n(t,r){if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let a=0;a<t.length;a++)if(!n(t[a],r[a]))return!1;return!0}if(typeof t=="object"&&t!==null&&r!==null){if(typeof r!="object"||Object.keys(t).length!==Object.keys(r).length)return!1;for(const a in t)if(!n(t[a],r[a]))return!1;return!0}return t===r},P.bH=function(n){n=n.slice();const t=Object.create(null);for(let r=0;r<n.length;r++)t[n[r].id]=n[r];for(let r=0;r<n.length;r++)"ref"in n[r]&&(n[r]=at(n[r],t[n[r].ref]));return n},P.bI=function(n){if(n.type==="custom")return new bv(n);switch(n.type){case"background":return new yv(n);case"circle":return new dx(n);case"color-relief":return new yx(n);case"fill":return new Rx(n);case"fill-extrusion":return new Vx(n);case"heatmap":return new fx(n);case"hillshade":return new gx(n);case"line":return new Xx(n);case"raster":return new vv(n);case"symbol":return new Ah(n)}},P.bJ=vr,P.bK=function(n,t){if(!n)return[{command:"setStyle",args:[t]}];let r=[];try{if(!qe(n.version,t.version))return[{command:"setStyle",args:[t]}];qe(n.center,t.center)||r.push({command:"setCenter",args:[t.center]}),qe(n.state,t.state)||r.push({command:"setGlobalState",args:[t.state]}),qe(n.centerAltitude,t.centerAltitude)||r.push({command:"setCenterAltitude",args:[t.centerAltitude]}),qe(n.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),qe(n.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),qe(n.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),qe(n.roll,t.roll)||r.push({command:"setRoll",args:[t.roll]}),qe(n.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),qe(n.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),qe(n.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),qe(n.light,t.light)||r.push({command:"setLight",args:[t.light]}),qe(n.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),qe(n.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),qe(n.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});const a={},c=[];(function(p,m,y,b){let S;for(S in m=m||{},p=p||{})Object.prototype.hasOwnProperty.call(p,S)&&(Object.prototype.hasOwnProperty.call(m,S)||qt(S,y,b));for(S in m)Object.prototype.hasOwnProperty.call(m,S)&&(Object.prototype.hasOwnProperty.call(p,S)?qe(p[S],m[S])||(p[S].type==="geojson"&&m[S].type==="geojson"&&At(p,m,S)?et(y,{command:"setGeoJSONSourceData",args:[S,m[S].data]}):Ot(S,m,y,b)):lt(S,m,y))})(n.sources,t.sources,c,a);const d=[];n.layers&&n.layers.forEach(p=>{"source"in p&&a[p.source]?r.push({command:"removeLayer",args:[p.id]}):d.push(p)}),r=r.concat(c),function(p,m,y){m=m||[];const b=(p=p||[]).map(St),S=m.map(St),C=p.reduce(Ai,{}),A=m.reduce(Ai,{}),L=b.slice(),B=Object.create(null);let j,U,H,se,Q;for(let R=0,Z=0;R<b.length;R++)j=b[R],Object.prototype.hasOwnProperty.call(A,j)?Z++:(et(y,{command:"removeLayer",args:[j]}),L.splice(L.indexOf(j,Z),1));for(let R=0,Z=0;R<S.length;R++)j=S[S.length-1-R],L[L.length-1-R]!==j&&(Object.prototype.hasOwnProperty.call(C,j)?(et(y,{command:"removeLayer",args:[j]}),L.splice(L.lastIndexOf(j,L.length-Z),1)):Z++,se=L[L.length-R],et(y,{command:"addLayer",args:[A[j],se]}),L.splice(L.length-R,0,j),B[j]=!0);for(let R=0;R<S.length;R++)if(j=S[R],U=C[j],H=A[j],!B[j]&&!qe(U,H))if(qe(U.source,H.source)&&qe(U["source-layer"],H["source-layer"])&&qe(U.type,H.type)){for(Q in ot(U.layout,H.layout,y,j,null,"setLayoutProperty"),ot(U.paint,H.paint,y,j,null,"setPaintProperty"),qe(U.filter,H.filter)||et(y,{command:"setFilter",args:[j,H.filter]}),qe(U.minzoom,H.minzoom)&&qe(U.maxzoom,H.maxzoom)||et(y,{command:"setLayerZoomRange",args:[j,H.minzoom,H.maxzoom]}),U)Object.prototype.hasOwnProperty.call(U,Q)&&Q!=="layout"&&Q!=="paint"&&Q!=="filter"&&Q!=="metadata"&&Q!=="minzoom"&&Q!=="maxzoom"&&(Q.indexOf("paint.")===0?ot(U[Q],H[Q],y,j,Q.slice(6),"setPaintProperty"):qe(U[Q],H[Q])||et(y,{command:"setLayerProperty",args:[j,Q,H[Q]]}));for(Q in H)Object.prototype.hasOwnProperty.call(H,Q)&&!Object.prototype.hasOwnProperty.call(U,Q)&&Q!=="layout"&&Q!=="paint"&&Q!=="filter"&&Q!=="metadata"&&Q!=="minzoom"&&Q!=="maxzoom"&&(Q.indexOf("paint.")===0?ot(U[Q],H[Q],y,j,Q.slice(6),"setPaintProperty"):qe(U[Q],H[Q])||et(y,{command:"setLayerProperty",args:[j,Q,H[Q]]}))}else et(y,{command:"removeLayer",args:[j]}),se=L[L.lastIndexOf(j)+1],et(y,{command:"addLayer",args:[H,se]})}(d,t.layers,r)}catch(a){console.warn("Unable to compute style diff:",a),r=[{command:"setStyle",args:[t]}]}return r},P.bL=function(n){const t=[],r=n.id;return r===void 0&&t.push({message:`layers.${r}: missing required property "id"`}),n.render===void 0&&t.push({message:`layers.${r}: missing required method "render"`}),n.renderingMode&&n.renderingMode!=="2d"&&n.renderingMode!=="3d"&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},P.bM=Wt,P.bN=zr,P.bO=class extends Ht{constructor(n,t){super(n,t),this.current=0}set(n){this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}},P.bP=vh,P.bQ=class extends Ht{constructor(n,t){super(n,t),this.current=Yd}set(n){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let t=1;t<16;t++)if(n[t]!==this.current[t]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}},P.bR=Ci,P.bS=class extends Ht{constructor(n,t){super(n,t),this.current=[0,0,0]}set(n){n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2]))}},P.bT=class extends Ht{constructor(n,t){super(n,t),this.current=[0,0]}set(n){n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1]))}},P.bU=or,P.bV=function(n,t){var r=Math.sin(t),a=Math.cos(t);return n[0]=a,n[1]=r,n[2]=0,n[3]=-r,n[4]=a,n[5]=0,n[6]=0,n[7]=0,n[8]=1,n},P.bW=function(n,t,r){var a=t[0],c=t[1],d=t[2];return n[0]=a*r[0]+c*r[3]+d*r[6],n[1]=a*r[1]+c*r[4]+d*r[7],n[2]=a*r[2]+c*r[5]+d*r[8],n},P.bX=function(n,t,r,a,c,d,p){var m=1/(t-r),y=1/(a-c),b=1/(d-p);return n[0]=-2*m,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*y,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*b,n[11]=0,n[12]=(t+r)*m,n[13]=(c+a)*y,n[14]=(p+d)*b,n[15]=1,n},P.bY=class extends Ht{constructor(n,t){super(n,t),this.current=new Array}set(n){if(n!=this.current){this.current=n;const t=new Float32Array(4*n.length);for(let r=0;r<n.length;r++)t[4*r]=n[r].r,t[4*r+1]=n[r].g,t[4*r+2]=n[r].b,t[4*r+3]=n[r].a;this.gl.uniform4fv(this.location,t)}}},P.bZ=class extends Ht{constructor(n,t){super(n,t),this.current=new Array}set(n){if(n!=this.current){this.current=n;const t=new Float32Array(n);this.gl.uniform1fv(this.location,t)}}},P.b_=class extends s{},P.ba=function(n,t,r){const a=new Float64Array(4);return tr(a,n,t-90,r),a},P.bb=function(n,t,r,a){var c,d,p,m,y,b=t[0],S=t[1],C=t[2],A=t[3],L=r[0],B=r[1],j=r[2],U=r[3];return(d=b*L+S*B+C*j+A*U)<0&&(d=-d,L=-L,B=-B,j=-j,U=-U),1-d>Et?(c=Math.acos(d),p=Math.sin(c),m=Math.sin((1-a)*c)/p,y=Math.sin(a*c)/p):(m=1-a,y=a),n[0]=m*b+y*L,n[1]=m*S+y*B,n[2]=m*C+y*j,n[3]=m*A+y*U,n},P.bc=function(n){const t=new Float64Array(9);var r,a,c,d,p,m,y,b,S,C,A,L,B,j,U,H,se,Q;C=(c=(a=n)[0])*(y=c+c),A=(d=a[1])*y,B=(p=a[2])*y,j=p*(b=d+d),H=(m=a[3])*y,se=m*b,Q=m*(S=p+p),(r=t)[0]=1-(L=d*b)-(U=p*S),r[3]=A-Q,r[6]=B+se,r[1]=A+Q,r[4]=1-C-U,r[7]=j-H,r[2]=B-se,r[5]=j+H,r[8]=1-C-L;const R=Je(-Math.asin(zt(t[2],-1,1)));let Z,te;return Math.hypot(t[5],t[8])<.001?(Z=0,te=-Je(Math.atan2(t[3],t[4]))):(Z=Je(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),te=Je(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:Z,pitch:R+90,bearing:te}},P.bd=function(n,t){return n.roll==t.roll&&n.pitch==t.pitch&&n.bearing==t.bearing},P.be=xt,P.bf=gr,P.bg=fl,P.bh=Oc,P.bi=pl,P.bj=Zr,P.bk=Er,P.bl=ct,P.bm=function(n,t,r,a,c){return Zr(a,c,zt((n-t)/(r-t),0,1))},P.bn=Ui,P.bo=function(){return new Float64Array(3)},P.bp=function(n,t,r,a){return n[0]=t[0]+r[0]*a,n[1]=t[1]+r[1]*a,n[2]=t[2]+r[2]*a,n},P.bq=tr,P.br=function(n,t,r){var a=r[0],c=r[1],d=r[2],p=t[0],m=t[1],y=t[2],b=c*y-d*m,S=d*p-a*y,C=a*m-c*p,A=c*C-d*S,L=d*b-a*C,B=a*S-c*b,j=2*r[3];return S*=j,C*=j,L*=2,B*=2,n[0]=p+(b*=j)+(A*=2),n[1]=m+S+L,n[2]=y+C+B,n},P.bs=function(n,t,r){const a=(c=[n[0],n[1],n[2],t[0],t[1],t[2],r[0],r[1],r[2]])[0]*((S=c[8])*(p=c[4])-(m=c[5])*(b=c[7]))+c[1]*(-S*(d=c[3])+m*(y=c[6]))+c[2]*(b*d-p*y);var c,d,p,m,y,b,S;if(a===0)return null;const C=Vr([],[t[0],t[1],t[2]],[r[0],r[1],r[2]]),A=Vr([],[r[0],r[1],r[2]],[n[0],n[1],n[2]]),L=Vr([],[n[0],n[1],n[2]],[t[0],t[1],t[2]]),B=Zi([],C,-n[3]);return yr(B,B,Zi([],A,-t[3])),yr(B,B,Zi([],L,-r[3])),Zi(B,B,1/a),B},P.bt=Mp,P.bu=function(){return new Float64Array(4)},P.bv=function(n,t,r,a){var c=[],d=[];return c[0]=t[0]-r[0],c[1]=t[1]-r[1],c[2]=t[2]-r[2],d[0]=c[0]*Math.cos(a)-c[1]*Math.sin(a),d[1]=c[0]*Math.sin(a)+c[1]*Math.cos(a),d[2]=c[2],n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},P.bw=function(n,t,r,a){var c=[],d=[];return c[0]=t[0]-r[0],c[1]=t[1]-r[1],c[2]=t[2]-r[2],d[0]=c[0],d[1]=c[1]*Math.cos(a)-c[2]*Math.sin(a),d[2]=c[1]*Math.sin(a)+c[2]*Math.cos(a),n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},P.bx=function(n,t,r,a){var c=[],d=[];return c[0]=t[0]-r[0],c[1]=t[1]-r[1],c[2]=t[2]-r[2],d[0]=c[2]*Math.sin(a)+c[0]*Math.cos(a),d[1]=c[1],d[2]=c[2]*Math.cos(a)-c[0]*Math.sin(a),n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},P.by=function(n,t,r){var a=Math.sin(r),c=Math.cos(r),d=t[0],p=t[1],m=t[2],y=t[3],b=t[8],S=t[9],C=t[10],A=t[11];return t!==n&&(n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=d*c-b*a,n[1]=p*c-S*a,n[2]=m*c-C*a,n[3]=y*c-A*a,n[8]=d*a+b*c,n[9]=p*a+S*c,n[10]=m*a+C*c,n[11]=y*a+A*c,n},P.bz=function(n,t){const r=Ui(n,360),a=Ui(t,360),c=a-r,d=a>r?c-360:c+360;return Math.abs(c)<Math.abs(d)?c:d},P.c=he,P.c0=class extends h{},P.c1=ip,P.c2=function(n){return n<=1?1:Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))},P.c3=pm,P.c4=function(n,t,r){var a=t[0],c=t[1],d=t[2],p=r[3]*a+r[7]*c+r[11]*d+r[15];return n[0]=(r[0]*a+r[4]*c+r[8]*d+r[12])/(p=p||1),n[1]=(r[1]*a+r[5]*c+r[9]*d+r[13])/p,n[2]=(r[2]*a+r[6]*c+r[10]*d+r[14])/p,n},P.c5=class extends Pc{},P.c6=class extends I{},P.c7=function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]&&n[3]===t[3]&&n[4]===t[4]&&n[5]===t[5]&&n[6]===t[6]&&n[7]===t[7]&&n[8]===t[8]&&n[9]===t[9]&&n[10]===t[10]&&n[11]===t[11]&&n[12]===t[12]&&n[13]===t[13]&&n[14]===t[14]&&n[15]===t[15]},P.c8=function(n,t){var r=n[0],a=n[1],c=n[2],d=n[3],p=n[4],m=n[5],y=n[6],b=n[7],S=n[8],C=n[9],A=n[10],L=n[11],B=n[12],j=n[13],U=n[14],H=n[15],se=t[0],Q=t[1],R=t[2],Z=t[3],te=t[4],ge=t[5],Ie=t[6],be=t[7],Te=t[8],Re=t[9],ze=t[10],De=t[11],Pe=t[12],He=t[13],it=t[14],tt=t[15];return Math.abs(r-se)<=Et*Math.max(1,Math.abs(r),Math.abs(se))&&Math.abs(a-Q)<=Et*Math.max(1,Math.abs(a),Math.abs(Q))&&Math.abs(c-R)<=Et*Math.max(1,Math.abs(c),Math.abs(R))&&Math.abs(d-Z)<=Et*Math.max(1,Math.abs(d),Math.abs(Z))&&Math.abs(p-te)<=Et*Math.max(1,Math.abs(p),Math.abs(te))&&Math.abs(m-ge)<=Et*Math.max(1,Math.abs(m),Math.abs(ge))&&Math.abs(y-Ie)<=Et*Math.max(1,Math.abs(y),Math.abs(Ie))&&Math.abs(b-be)<=Et*Math.max(1,Math.abs(b),Math.abs(be))&&Math.abs(S-Te)<=Et*Math.max(1,Math.abs(S),Math.abs(Te))&&Math.abs(C-Re)<=Et*Math.max(1,Math.abs(C),Math.abs(Re))&&Math.abs(A-ze)<=Et*Math.max(1,Math.abs(A),Math.abs(ze))&&Math.abs(L-De)<=Et*Math.max(1,Math.abs(L),Math.abs(De))&&Math.abs(B-Pe)<=Et*Math.max(1,Math.abs(B),Math.abs(Pe))&&Math.abs(j-He)<=Et*Math.max(1,Math.abs(j),Math.abs(He))&&Math.abs(U-it)<=Et*Math.max(1,Math.abs(U),Math.abs(it))&&Math.abs(H-tt)<=Et*Math.max(1,Math.abs(H),Math.abs(tt))},P.c9=function(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},P.cA=function(n){delete N.REGISTERED_PROTOCOLS[n]},P.cB=function(n,t){const r={};for(let c=0;c<n.length;c++){const d=t&&t[n[c].id]||Jo(n[c]);t&&(t[n[c].id]=d);let p=r[d];p||(p=r[d]=[]),p.push(n[c])}const a=[];for(const c in r)a.push(r[c]);return a},P.cC=Ge,P.cD=mg,P.cE=_g,P.cF=Wm,P.cG=function(n){n.bucket.createArrays(),n.bucket.tilePixelRatio=Rt/(512*n.bucket.overscaling),n.bucket.compareText={},n.bucket.iconsNeedLinear=!1;const t=n.bucket.layers[0],r=t.layout,a=t._unevaluatedLayout._values,c={layoutIconSize:a["icon-size"].possiblyEvaluate(new Qt(n.bucket.zoom+1),n.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new Qt(n.bucket.zoom+1),n.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new Qt(18))};if(n.bucket.textSizeData.kind==="composite"){const{minZoom:b,maxZoom:S}=n.bucket.textSizeData;c.compositeTextSizes=[a["text-size"].possiblyEvaluate(new Qt(b),n.canonical),a["text-size"].possiblyEvaluate(new Qt(S),n.canonical)]}if(n.bucket.iconSizeData.kind==="composite"){const{minZoom:b,maxZoom:S}=n.bucket.iconSizeData;c.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new Qt(b),n.canonical),a["icon-size"].possiblyEvaluate(new Qt(S),n.canonical)]}const d=r.get("text-line-height")*Li,p=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",m=r.get("text-keep-upright"),y=r.get("text-size");for(const b of n.bucket.features){const S=r.get("text-font").evaluate(b,{},n.canonical).join(","),C=y.evaluate(b,{},n.canonical),A=c.layoutTextSize.evaluate(b,{},n.canonical),L=c.layoutIconSize.evaluate(b,{},n.canonical),B={horizontal:{},vertical:void 0},j=b.text;let U,H=[0,0];if(j){const R=j.toString(),Z=r.get("text-letter-spacing").evaluate(b,{},n.canonical)*Li,te=ph(R)?Z:0,ge=r.get("text-anchor").evaluate(b,{},n.canonical),Ie=Ig(t,b,n.canonical);if(!Ie){const ze=r.get("text-radial-offset").evaluate(b,{},n.canonical);H=ze?Cg(ge,[ze*Li,Ep]):r.get("text-offset").evaluate(b,{},n.canonical).map(De=>De*Li)}let be=p?"center":r.get("text-justify").evaluate(b,{},n.canonical);const Te=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(b,{},n.canonical)*Li:1/0,Re=()=>{n.bucket.allowVerticalPlacement&&xc(R)&&(B.vertical=Ih(j,n.glyphMap,n.glyphPositions,n.imagePositions,S,Te,d,ge,"left",te,H,P.an.vertical,!0,A,C))};if(!p&&Ie){const ze=new Set;if(be==="auto")for(let Pe=0;Pe<Ie.values.length;Pe+=2)ze.add(zp(Ie.values[Pe]));else ze.add(be);let De=!1;for(const Pe of ze)if(!B.horizontal[Pe])if(De)B.horizontal[Pe]=B.horizontal[0];else{const He=Ih(j,n.glyphMap,n.glyphPositions,n.imagePositions,S,Te,d,"center",Pe,te,H,P.an.horizontal,!1,A,C);He&&(B.horizontal[Pe]=He,De=He.positionedLines.length===1)}Re()}else{be==="auto"&&(be=zp(ge));const ze=Ih(j,n.glyphMap,n.glyphPositions,n.imagePositions,S,Te,d,ge,be,te,H,P.an.horizontal,!1,A,C);ze&&(B.horizontal[be]=ze),Re(),xc(R)&&p&&m&&(B.vertical=Ih(j,n.glyphMap,n.glyphPositions,n.imagePositions,S,Te,d,ge,be,te,H,P.an.vertical,!1,A,C))}}let se=!1;if(b.icon&&b.icon.name){const R=n.imageMap[b.icon.name];R&&(U=pv(n.imagePositions[b.icon.name],r.get("icon-offset").evaluate(b,{},n.canonical),r.get("icon-anchor").evaluate(b,{},n.canonical)),se=!!R.sdf,n.bucket.sdfIcons===void 0?n.bucket.sdfIcons=se:n.bucket.sdfIcons!==se&&Mi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(R.pixelRatio!==n.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(n.bucket.iconsNeedLinear=!0))}const Q=zg(B.horizontal)||B.vertical;n.bucket.iconsInText=!!Q&&Q.iconsInText,(Q||U)&&zv(n.bucket,b,B,U,n.imageMap,c,A,L,H,se,n.canonical,n.subdivisionGranularity)}n.showCollisionBoxes&&n.bucket.generateCollisionDebugBuffers()},P.cH=fp,P.cI=lp,P.cJ=pp,P.cK=Nc,P.cL=_p,P.cM=class{constructor(n){this._marks={start:[n.url,"start"].join("#"),end:[n.url,"end"].join("#"),measure:n.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let n=performance.getEntriesByName(this._marks.measure);return n.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),n=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),n}},P.cN=function(n,t,r,a,c){return o(this,void 0,void 0,function*(){if(li())try{return yield tn(n,t,r,a,c)}catch{}return function(d,p,m,y,b){const S=d.width,C=d.height;Ar&&Ae||(Ar=new OffscreenCanvas(S,C),Ae=Ar.getContext("2d",{willReadFrequently:!0})),Ar.width=S,Ar.height=C,Ae.drawImage(d,0,0,S,C);const A=Ae.getImageData(p,m,y,b);return Ae.clearRect(0,0,S,C),A.data}(n,t,r,a,c)})},P.cO=gm,P.cP=fe,P.cQ=Ve,P.cR=Rm,P.cS=Gm,P.cT=Ho,P.cU=Jn,P.ca=n=>n.type==="symbol",P.cb=n=>n.type==="circle",P.cc=n=>n.type==="heatmap",P.cd=n=>n.type==="line",P.ce=n=>n.type==="fill",P.cf=n=>n.type==="fill-extrusion",P.cg=n=>n.type==="hillshade",P.ch=n=>n.type==="color-relief",P.ci=n=>n.type==="raster",P.cj=n=>n.type==="background",P.ck=n=>n.type==="custom",P.cl=xr,P.cm=function(n,t,r){const a=gi(t.x-r.x,t.y-r.y),c=gi(n.x-r.x,n.y-r.y);var d,p;return Je(Math.atan2(a[0]*c[1]-a[1]*c[0],(d=a)[0]*(p=c)[0]+d[1]*p[1]))},P.cn=Mn,P.co=function(n,t){return rn[t]&&(n instanceof MouseEvent||n instanceof WheelEvent)},P.cp=function(n,t){return ei[t]&&"touches"in n},P.cq=function(n){return ei[n]||rn[n]},P.cr=function(n,t,r){var a=t[0],c=t[1];return n[0]=r[0]*a+r[4]*c+r[12],n[1]=r[1]*a+r[5]*c+r[13],n},P.cs=function(n,t){const{x:r,y:a}=Gc.fromLngLat(t);return!(n<0||n>25||a<0||a>=1||r<0||r>=1)},P.ct=function(n,t){return n[0]=t[0],n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=t[1],n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=t[2],n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n},P.cu=class extends ea{},P.cv=kv,P.cx=function(n){return n.message===Ur},P.cy=J,P.cz=function(n,t){N.REGISTERED_PROTOCOLS[n]=t},P.d=_e,P.e=_i,P.f=n=>o(void 0,void 0,void 0,function*(){if(n.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(n)],{type:"image/png"});try{return createImageBitmap(t)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),P.g=V,P.h=n=>new Promise((t,r)=>{const a=new Image;a.onload=()=>{t(a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame(()=>{a.src=ua})},a.onerror=()=>r(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const c=new Blob([new Uint8Array(n)],{type:"image/png"});a.src=n.byteLength?URL.createObjectURL(c):ua}),P.i=ir,P.j=(n,t)=>oe(_i(n,{type:"json"}),t),P.k=de,P.l=we,P.m=oe,P.n=(n,t)=>oe(_i(n,{type:"arrayBuffer"}),t),P.o=function(n){return new _p(n).readFields(iv,[])},P.p=qm,P.q=Rc,P.r=mr,P.s=Oe,P.t=Tc,P.u=bt,P.v=ae,P.w=Mi,P.x=$d,P.y=Hs,P.z=cs}),D("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 re=this._layers[J.id]=P.bI(J);re._featureFilter=P.a9(re.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 $=P.cB(Object.values(this._layerConfigs),this.keyCache);for(const J of $){const re=J.map(de=>this._layers[de.id]),oe=re[0];if(oe.visibility==="none")continue;const _e=oe.source||"";let ce=this.familiesBySource[_e];ce||(ce=this.familiesBySource[_e]={});const Se=oe.sourceLayer||"_geojsonTileLayer";let we=ce[Se];we||(we=ce[Se]=[]),we.push(re)}}}class fe{constructor(N){const V={},$=[];for(const _e in N){const ce=N[_e],Se=V[_e]={};for(const we in ce){const de=ce[+we];if(!de||de.bitmap.width===0||de.bitmap.height===0)continue;const Me={x:0,y:0,w:de.bitmap.width+2,h:de.bitmap.height+2};$.push(Me),Se[we]={rect:Me,metrics:de.metrics}}}const{w:J,h:re}=P.p($),oe=new P.q({width:J||1,height:re||1});for(const _e in N){const ce=N[_e];for(const Se in ce){const we=ce[+Se];if(!we||we.bitmap.width===0||we.bitmap.height===0)continue;const de=V[_e][Se].rect;P.q.copy(we.bitmap,oe,{x:0,y:0},{x:de.x+1,y:de.y+1},we.bitmap)}}this.image=oe,this.positions=V}}P.cC("GlyphAtlas",fe);class xe{constructor(N){this.tileID=new P.Z(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=[],this.globalState=N.globalState}parse(N,V,$,J,re){return P._(this,void 0,void 0,function*(){this.status="parsing",this.data=N,this.collisionBoxArray=new P.a7;const oe=new P.cD(Object.keys(N.layers).sort()),_e=new P.cE(this.tileID,this.promoteId);_e.bucketLayerIDs=[];const ce={},Se={featureIndex:_e,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:$,subdivisionGranularity:re},we=V.familiesBySource[this.source];for(const ot in we){const St=N.layers[ot];if(!St)continue;St.version===1&&P.w(`Vector tile source "${this.source}" layer "${ot}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ai=oe.encode(ot),Be=[];for(let Gi=0;Gi<St.length;Gi++){const ti=St.feature(Gi),Wn=_e.getId(ti,ot);Be.push({feature:ti,id:Wn,index:Gi,sourceLayerIndex:Ai})}for(const Gi of we[ot]){const ti=Gi[0];ti.source!==this.source&&P.w(`layer.source = ${ti.source} does not equal this.source = ${this.source}`),ti.minzoom&&this.zoom<Math.floor(ti.minzoom)||ti.maxzoom&&this.zoom>=ti.maxzoom||ti.visibility!=="none"&&(ke(Gi,this.zoom,$),(ce[ti.id]=ti.createBucket({index:_e.bucketLayerIDs.length,layers:Gi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ai,sourceID:this.source,globalState:this.globalState})).populate(Be,Se,this.tileID.canonical),_e.bucketLayerIDs.push(Gi.map(Wn=>Wn.id)))}}const de=P.bM(Se.glyphDependencies,ot=>Object.keys(ot).map(Number));this.inFlightDependencies.forEach(ot=>ot==null?void 0:ot.abort()),this.inFlightDependencies=[];let Me=Promise.resolve({});if(Object.keys(de).length){const ot=new AbortController;this.inFlightDependencies.push(ot),Me=J.sendAsync({type:"GG",data:{stacks:de,source:this.source,tileID:this.tileID,type:"glyphs"}},ot)}const ae=Object.keys(Se.iconDependencies);let $e=Promise.resolve({});if(ae.length){const ot=new AbortController;this.inFlightDependencies.push(ot),$e=J.sendAsync({type:"GI",data:{icons:ae,source:this.source,tileID:this.tileID,type:"icons"}},ot)}const at=Object.keys(Se.patternDependencies);let qe=Promise.resolve({});if(at.length){const ot=new AbortController;this.inFlightDependencies.push(ot),qe=J.sendAsync({type:"GI",data:{icons:at,source:this.source,tileID:this.tileID,type:"patterns"}},ot)}const[et,lt,qt]=yield Promise.all([Me,$e,qe]),Ot=new fe(et),At=new P.cF(lt,qt);for(const ot in ce){const St=ce[ot];St instanceof P.a8?(ke(St.layers,this.zoom,$),P.cG({bucket:St,glyphMap:et,glyphPositions:Ot.positions,imageMap:lt,imagePositions:At.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:Se.subdivisionGranularity})):St.hasPattern&&(St instanceof P.cH||St instanceof P.cI||St instanceof P.cJ)&&(ke(St.layers,this.zoom,$),St.addFeatures(Se,this.tileID.canonical,At.patternPositions))}return this.status="done",{buckets:Object.values(ce).filter(ot=>!ot.isEmpty()),featureIndex:_e,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Ot.image,imageAtlas:At,glyphMap:this.returnDependencies?et:null,iconMap:this.returnDependencies?lt:null,glyphPositions:this.returnDependencies?Ot.positions:null}})}}function ke(he,N,V){const $=new P.F(N);for(const J of he)J.recalculate($,V)}class Ve{constructor(N,V,$){this.actor=N,this.layerIndex=V,this.availableImages=$,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(N,V){return P._(this,void 0,void 0,function*(){const $=yield P.n(N.request,V);try{return{vectorTile:new P.cK.VectorTile(new P.cL($.data)),rawData:$.data,cacheControl:$.cacheControl,expires:$.expires}}catch(J){const re=new Uint8Array($.data);let oe=`Unable to parse the tile at ${N.request.url}, `;throw oe+=re[0]===31&&re[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(oe)}})}loadTile(N){return P._(this,void 0,void 0,function*(){const V=N.uid,$=!!(N&&N.request&&N.request.collectResourceTiming)&&new P.cM(N.request),J=new xe(N);this.loading[V]=J;const re=new AbortController;J.abort=re;try{const oe=yield this.loadVectorTile(N,re);if(delete this.loading[V],!oe)return null;const _e=oe.rawData,ce={};oe.expires&&(ce.expires=oe.expires),oe.cacheControl&&(ce.cacheControl=oe.cacheControl);const Se={};if($){const de=$.finish();de&&(Se.resourceTiming=JSON.parse(JSON.stringify(de)))}J.vectorTile=oe.vectorTile;const we=J.parse(oe.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);this.loaded[V]=J,this.fetching[V]={rawTileData:_e,cacheControl:ce,resourceTiming:Se};try{const de=yield we;return P.e({rawTileData:_e.slice(0)},de,ce,Se)}finally{delete this.fetching[V]}}catch(oe){throw delete this.loading[V],J.status="done",this.loaded[V]=J,oe}})}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 $=this.loaded[V];if($.showCollisionBoxes=N.showCollisionBoxes,$.globalState=N.globalState,$.status==="parsing"){const J=yield $.parse($.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);let re;if(this.fetching[V]){const{rawTileData:oe,cacheControl:_e,resourceTiming:ce}=this.fetching[V];delete this.fetching[V],re=P.e({rawTileData:oe.slice(0)},J,_e,ce)}else re=J;return re}if($.status==="done"&&$.vectorTile)return $.parse($.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity)})}abortTile(N){return P._(this,void 0,void 0,function*(){const V=this.loading,$=N.uid;V&&V[$]&&V[$].abort&&(V[$].abort.abort(),delete V[$])})}removeTile(N){return P._(this,void 0,void 0,function*(){this.loaded&&this.loaded[N.uid]&&delete this.loaded[N.uid]})}}class Ce{constructor(){this.loaded={}}loadTile(N){return P._(this,void 0,void 0,function*(){const{uid:V,encoding:$,rawImageData:J,redFactor:re,greenFactor:oe,blueFactor:_e,baseShift:ce}=N,Se=J.width+2,we=J.height+2,de=P.b(J)?new P.R({width:Se,height:we},yield P.cN(J,-1,-1,Se,we)):J,Me=new P.cO(V,de,$,re,oe,_e,ce);return this.loaded=this.loaded||{},this.loaded[V]=Me,Me})}removeTile(N){const V=this.loaded,$=N.uid;V&&V[$]&&delete V[$]}}var ue,Ue,Vt=function(){if(Ue)return ue;function he(V,$){if(V.length!==0){N(V[0],$);for(var J=1;J<V.length;J++)N(V[J],!$)}}function N(V,$){for(var J=0,re=0,oe=0,_e=V.length,ce=_e-1;oe<_e;ce=oe++){var Se=(V[oe][0]-V[ce][0])*(V[ce][1]+V[oe][1]),we=J+Se;re+=Math.abs(J)>=Math.abs(Se)?J-we+Se:Se-we+J,J=we}J+re>=0!=!!$&&V.reverse()}return Ue=1,ue=function V($,J){var re,oe=$&&$.type;if(oe==="FeatureCollection")for(re=0;re<$.features.length;re++)V($.features[re],J);else if(oe==="GeometryCollection")for(re=0;re<$.geometries.length;re++)V($.geometries[re],J);else if(oe==="Feature")V($.geometry,J);else if(oe==="Polygon")he($.coordinates,J);else if(oe==="MultiPolygon")for(re=0;re<$.coordinates.length;re++)he($.coordinates[re],J);return $}}(),wt=P.cP(Vt);const Pi=P.cK.VectorTileFeature.prototype.toGeoJSON;class pi{constructor(N){this._feature=N,this.extent=P.$,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 $=[];for(const J of V)$.push(new P.P(J[0],J[1]));N.push($)}return N}}toGeoJSON(N,V,$){return Pi.call(this,N,V,$)}}class Vi{constructor(N){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=P.$,this.length=N.length,this._features=N}feature(N){return new pi(this._features[N])}}var li,Et,Ft,or={exports:{}},Pn=function(){if(Ft)return or.exports;Ft=1;var he=P.cS(),N=function(){if(Et)return li;Et=1;var we=P.cQ(),de=P.cR().VectorTileFeature;function Me($e,at){this.options=at||{},this.features=$e,this.length=$e.length}function ae($e,at){this.id=typeof $e.id=="number"?$e.id:void 0,this.type=$e.type,this.rawGeometry=$e.type===1?[$e.geometry]:$e.geometry,this.properties=$e.tags,this.extent=at||4096}return li=Me,Me.prototype.feature=function($e){return new ae(this.features[$e],this.options.extent)},ae.prototype.loadGeometry=function(){var $e=this.rawGeometry;this.geometry=[];for(var at=0;at<$e.length;at++){for(var qe=$e[at],et=[],lt=0;lt<qe.length;lt++)et.push(new we(qe[lt][0],qe[lt][1]));this.geometry.push(et)}return this.geometry},ae.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var $e=this.geometry,at=1/0,qe=-1/0,et=1/0,lt=-1/0,qt=0;qt<$e.length;qt++)for(var Ot=$e[qt],At=0;At<Ot.length;At++){var ot=Ot[At];at=Math.min(at,ot.x),qe=Math.max(qe,ot.x),et=Math.min(et,ot.y),lt=Math.max(lt,ot.y)}return[at,et,qe,lt]},ae.prototype.toGeoJSON=de.prototype.toGeoJSON,li}();function V(we){var de=new he;return function(Me,ae){for(var $e in Me.layers)ae.writeMessage(3,$,Me.layers[$e])}(we,de),de.finish()}function $(we,de){var Me;de.writeVarintField(15,we.version||1),de.writeStringField(1,we.name||""),de.writeVarintField(5,we.extent||4096);var ae={keys:[],values:[],keycache:{},valuecache:{}};for(Me=0;Me<we.length;Me++)ae.feature=we.feature(Me),de.writeMessage(2,J,ae);var $e=ae.keys;for(Me=0;Me<$e.length;Me++)de.writeStringField(3,$e[Me]);var at=ae.values;for(Me=0;Me<at.length;Me++)de.writeMessage(4,Se,at[Me])}function J(we,de){var Me=we.feature;Me.id!==void 0&&de.writeVarintField(1,Me.id),de.writeMessage(2,re,we),de.writeVarintField(3,Me.type),de.writeMessage(4,ce,Me)}function re(we,de){var Me=we.feature,ae=we.keys,$e=we.values,at=we.keycache,qe=we.valuecache;for(var et in Me.properties){var lt=Me.properties[et],qt=at[et];if(lt!==null){qt===void 0&&(ae.push(et),at[et]=qt=ae.length-1),de.writeVarint(qt);var Ot=typeof lt;Ot!=="string"&&Ot!=="boolean"&&Ot!=="number"&&(lt=JSON.stringify(lt));var At=Ot+":"+lt,ot=qe[At];ot===void 0&&($e.push(lt),qe[At]=ot=$e.length-1),de.writeVarint(ot)}}}function oe(we,de){return(de<<3)+(7&we)}function _e(we){return we<<1^we>>31}function ce(we,de){for(var Me=we.loadGeometry(),ae=we.type,$e=0,at=0,qe=Me.length,et=0;et<qe;et++){var lt=Me[et],qt=1;ae===1&&(qt=lt.length),de.writeVarint(oe(1,qt));for(var Ot=ae===3?lt.length-1:lt.length,At=0;At<Ot;At++){At===1&&ae!==1&&de.writeVarint(oe(2,Ot-1));var ot=lt[At].x-$e,St=lt[At].y-at;de.writeVarint(_e(ot)),de.writeVarint(_e(St)),$e+=ot,at+=St}ae===3&&de.writeVarint(oe(7,1))}}function Se(we,de){var Me=typeof we;Me==="string"?de.writeStringField(1,we):Me==="boolean"?de.writeBooleanField(7,we):Me==="number"&&(we%1!=0?de.writeDoubleField(3,we):we<0?de.writeSVarintField(6,we):de.writeVarintField(5,we))}return or.exports=V,or.exports.fromVectorTileJs=V,or.exports.fromGeojsonVt=function(we,de){de=de||{};var Me={};for(var ae in we)Me[ae]=new N(we[ae].features,de),Me[ae].name=ae,Me[ae].version=de.version,Me[ae].extent=de.extent;return V({layers:Me})},or.exports.GeoJSONWrapper=N,or.exports}(),Qr=P.cP(Pn);const Nr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:he=>he},en=Math.fround||(yr=new Float32Array(1),he=>(yr[0]=+he,yr[0]));var yr;class Zi{constructor(N){this.options=Object.assign(Object.create(Nr),N),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(N){const{log:V,minZoom:$,maxZoom:J}=this.options;V&&console.time("total time");const re=`prepare ${N.length} points`;V&&console.time(re),this.points=N;const oe=[];for(let ce=0;ce<N.length;ce++){const Se=N[ce];if(!Se.geometry)continue;const[we,de]=Se.geometry.coordinates,Me=en(It(we)),ae=en(Jt(de));oe.push(Me,ae,1/0,ce,-1,1),this.options.reduce&&oe.push(0)}let _e=this.trees[J+1]=this._createTree(oe);V&&console.timeEnd(re);for(let ce=J;ce>=$;ce--){const Se=+Date.now();_e=this.trees[ce]=this._createTree(this._cluster(_e,ce)),V&&console.log("z%d: %d clusters in %dms",ce,_e.numItems,+Date.now()-Se)}return V&&console.timeEnd("total time"),this}getClusters(N,V){let $=((N[0]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,N[1]));let re=N[2]===180?180:((N[2]+180)%360+360)%360-180;const oe=Math.max(-90,Math.min(90,N[3]));if(N[2]-N[0]>=360)$=-180,re=180;else if($>re){const de=this.getClusters([$,J,180,oe],V),Me=this.getClusters([-180,J,re,oe],V);return de.concat(Me)}const _e=this.trees[this._limitZoom(V)],ce=_e.range(It($),Jt(oe),It(re),Jt(J)),Se=_e.data,we=[];for(const de of ce){const Me=this.stride*de;we.push(Se[Me+5]>1?Vr(Se,Me,this.clusterProps):this.points[Se[Me+3]])}return we}getChildren(N){const V=this._getOriginId(N),$=this._getOriginZoom(N),J="No cluster with the specified id.",re=this.trees[$];if(!re)throw new Error(J);const oe=re.data;if(V*this.stride>=oe.length)throw new Error(J);const _e=this.options.radius/(this.options.extent*Math.pow(2,$-1)),ce=re.within(oe[V*this.stride],oe[V*this.stride+1],_e),Se=[];for(const we of ce){const de=we*this.stride;oe[de+4]===N&&Se.push(oe[de+5]>1?Vr(oe,de,this.clusterProps):this.points[oe[de+3]])}if(Se.length===0)throw new Error(J);return Se}getLeaves(N,V,$){const J=[];return this._appendLeaves(J,N,V=V||10,$=$||0,0),J}getTile(N,V,$){const J=this.trees[this._limitZoom(N)],re=Math.pow(2,N),{extent:oe,radius:_e}=this.options,ce=_e/oe,Se=($-ce)/re,we=($+1+ce)/re,de={features:[]};return this._addTileFeatures(J.range((V-ce)/re,Se,(V+1+ce)/re,we),J.data,V,$,re,de),V===0&&this._addTileFeatures(J.range(1-ce/re,Se,1,we),J.data,re,$,re,de),V===re-1&&this._addTileFeatures(J.range(0,Se,ce/re,we),J.data,-1,$,re,de),de.features.length?de:null}getClusterExpansionZoom(N){let V=this._getOriginZoom(N)-1;for(;V<=this.options.maxZoom;){const $=this.getChildren(N);if(V++,$.length!==1)break;N=$[0].properties.cluster_id}return V}_appendLeaves(N,V,$,J,re){const oe=this.getChildren(V);for(const _e of oe){const ce=_e.properties;if(ce&&ce.cluster?re+ce.point_count<=J?re+=ce.point_count:re=this._appendLeaves(N,ce.cluster_id,$,J,re):re<J?re++:N.push(_e),N.length===$)break}return re}_createTree(N){const V=new P.aH(N.length/this.stride|0,this.options.nodeSize,Float32Array);for(let $=0;$<N.length;$+=this.stride)V.add(N[$],N[$+1]);return V.finish(),V.data=N,V}_addTileFeatures(N,V,$,J,re,oe){for(const _e of N){const ce=_e*this.stride,Se=V[ce+5]>1;let we,de,Me;if(Se)we=lr(V,ce,this.clusterProps),de=V[ce],Me=V[ce+1];else{const at=this.points[V[ce+3]];we=at.properties;const[qe,et]=at.geometry.coordinates;de=It(qe),Me=Jt(et)}const ae={type:1,geometry:[[Math.round(this.options.extent*(de*re-$)),Math.round(this.options.extent*(Me*re-J))]],tags:we};let $e;$e=Se||this.options.generateId?V[ce+3]:this.points[V[ce+3]].id,$e!==void 0&&(ae.id=$e),oe.features.push(ae)}}_limitZoom(N){return Math.max(this.options.minZoom,Math.min(Math.floor(+N),this.options.maxZoom+1))}_cluster(N,V){const{radius:$,extent:J,reduce:re,minPoints:oe}=this.options,_e=$/(J*Math.pow(2,V)),ce=N.data,Se=[],we=this.stride;for(let de=0;de<ce.length;de+=we){if(ce[de+2]<=V)continue;ce[de+2]=V;const Me=ce[de],ae=ce[de+1],$e=N.within(ce[de],ce[de+1],_e),at=ce[de+5];let qe=at;for(const et of $e){const lt=et*we;ce[lt+2]>V&&(qe+=ce[lt+5])}if(qe>at&&qe>=oe){let et,lt=Me*at,qt=ae*at,Ot=-1;const At=(de/we<<5)+(V+1)+this.points.length;for(const ot of $e){const St=ot*we;if(ce[St+2]<=V)continue;ce[St+2]=V;const Ai=ce[St+5];lt+=ce[St]*Ai,qt+=ce[St+1]*Ai,ce[St+4]=At,re&&(et||(et=this._map(ce,de,!0),Ot=this.clusterProps.length,this.clusterProps.push(et)),re(et,this._map(ce,St)))}ce[de+4]=At,Se.push(lt/qe,qt/qe,1/0,At,-1,qe),re&&Se.push(Ot)}else{for(let et=0;et<we;et++)Se.push(ce[de+et]);if(qe>1)for(const et of $e){const lt=et*we;if(!(ce[lt+2]<=V)){ce[lt+2]=V;for(let qt=0;qt<we;qt++)Se.push(ce[lt+qt])}}}}return Se}_getOriginId(N){return N-this.points.length>>5}_getOriginZoom(N){return(N-this.points.length)%32}_map(N,V,$){if(N[V+5]>1){const oe=this.clusterProps[N[V+6]];return $?Object.assign({},oe):oe}const J=this.points[N[V+3]].properties,re=this.options.map(J);return $&&re===J?Object.assign({},re):re}}function Vr(he,N,V){return{type:"Feature",id:he[N+3],properties:lr(he,N,V),geometry:{type:"Point",coordinates:[($=he[N],360*($-.5)),cr(he[N+1])]}};var $}function lr(he,N,V){const $=he[N+5],J=$>=1e4?`${Math.round($/1e3)}k`:$>=1e3?Math.round($/100)/10+"k":$,re=he[N+6],oe=re===-1?{}:Object.assign({},V[re]);return Object.assign(oe,{cluster:!0,cluster_id:he[N+3],point_count:$,point_count_abbreviated:J})}function It(he){return he/360+.5}function Jt(he){const N=Math.sin(he*Math.PI/180),V=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return V<0?0:V>1?1:V}function cr(he){const N=(180-360*he)*Math.PI/180;return 360*Math.atan(Math.exp(N))/Math.PI-90}function tr(he,N,V,$){let J=$;const re=N+(V-N>>1);let oe,_e=V-N;const ce=he[N],Se=he[N+1],we=he[V],de=he[V+1];for(let Me=N+3;Me<V;Me+=3){const ae=Ir(he[Me],he[Me+1],ce,Se,we,de);if(ae>J)oe=Me,J=ae;else if(ae===J){const $e=Math.abs(Me-re);$e<_e&&(oe=Me,_e=$e)}}J>$&&(oe-N>3&&tr(he,N,oe,$),he[oe+2]=J,V-oe>3&&tr(he,oe,V,$))}function Ir(he,N,V,$,J,re){let oe=J-V,_e=re-$;if(oe!==0||_e!==0){const ce=((he-V)*oe+(N-$)*_e)/(oe*oe+_e*_e);ce>1?(V=J,$=re):ce>0&&(V+=oe*ce,$+=_e*ce)}return oe=he-V,_e=N-$,oe*oe+_e*_e}function gi(he,N,V,$){const J={id:he??null,type:N,geometry:V,tags:$,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(N==="Point"||N==="MultiPoint"||N==="LineString")Rt(J,V);else if(N==="Polygon")Rt(J,V[0]);else if(N==="MultiLineString")for(const re of V)Rt(J,re);else if(N==="MultiPolygon")for(const re of V)Rt(J,re[0]);return J}function Rt(he,N){for(let V=0;V<N.length;V+=3)he.minX=Math.min(he.minX,N[V]),he.minY=Math.min(he.minY,N[V+1]),he.maxX=Math.max(he.maxX,N[V]),he.maxY=Math.max(he.maxY,N[V+1])}function ur(he,N,V,$){if(!N.geometry)return;const J=N.geometry.coordinates;if(J&&J.length===0)return;const re=N.geometry.type,oe=Math.pow(V.tolerance/((1<<V.maxZoom)*V.extent),2);let _e=[],ce=N.id;if(V.promoteId?ce=N.properties[V.promoteId]:V.generateId&&(ce=$||0),re==="Point")Ui(J,_e);else if(re==="MultiPoint")for(const Se of J)Ui(Se,_e);else if(re==="LineString")Zr(J,_e,oe,!1);else if(re==="MultiLineString"){if(V.lineMetrics){for(const Se of J)_e=[],Zr(Se,_e,oe,!1),he.push(gi(ce,"LineString",_e,N.properties));return}Er(J,_e,oe,!1)}else if(re==="Polygon")Er(J,_e,oe,!0);else{if(re!=="MultiPolygon"){if(re==="GeometryCollection"){for(const Se of N.geometry.geometries)ur(he,{id:ce,geometry:Se,properties:N.properties},V,$);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Se of J){const we=[];Er(Se,we,oe,!0),_e.push(we)}}he.push(gi(ce,re,_e,N.properties))}function Ui(he,N){N.push(xr(he[0]),Mn(he[1]),0)}function Zr(he,N,V,$){let J,re,oe=0;for(let ce=0;ce<he.length;ce++){const Se=xr(he[ce][0]),we=Mn(he[ce][1]);N.push(Se,we,0),ce>0&&(oe+=$?(J*we-Se*re)/2:Math.sqrt(Math.pow(Se-J,2)+Math.pow(we-re,2))),J=Se,re=we}const _e=N.length-3;N[2]=1,tr(N,0,_e,V),N[_e+2]=1,N.size=Math.abs(oe),N.start=0,N.end=N.size}function Er(he,N,V,$){for(let J=0;J<he.length;J++){const re=[];Zr(he[J],re,V,$),N.push(re)}}function xr(he){return he/360+.5}function Mn(he){const N=Math.sin(he*Math.PI/180),V=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return V<0?0:V>1?1:V}function zt(he,N,V,$,J,re,oe,_e){if($/=N,re>=(V/=N)&&oe<$)return he;if(oe<V||re>=$)return null;const ce=[];for(const Se of he){const we=Se.geometry;let de=Se.type;const Me=J===0?Se.minX:Se.minY,ae=J===0?Se.maxX:Se.maxY;if(Me>=V&&ae<$){ce.push(Se);continue}if(ae<V||Me>=$)continue;let $e=[];if(de==="Point"||de==="MultiPoint")$i(we,$e,V,$,J);else if(de==="LineString")_i(we,$e,V,$,J,!1,_e.lineMetrics);else if(de==="MultiLineString")Wt(we,$e,V,$,J,!1);else if(de==="Polygon")Wt(we,$e,V,$,J,!0);else if(de==="MultiPolygon")for(const at of we){const qe=[];Wt(at,qe,V,$,J,!0),qe.length&&$e.push(qe)}if($e.length){if(_e.lineMetrics&&de==="LineString"){for(const at of $e)ce.push(gi(Se.id,de,at,Se.tags));continue}de!=="LineString"&&de!=="MultiLineString"||($e.length===1?(de="LineString",$e=$e[0]):de="MultiLineString"),de!=="Point"&&de!=="MultiPoint"||(de=$e.length===3?"Point":"MultiPoint"),ce.push(gi(Se.id,de,$e,Se.tags))}}return ce.length?ce:null}function $i(he,N,V,$,J){for(let re=0;re<he.length;re+=3){const oe=he[re+J];oe>=V&&oe<=$&&zr(N,he[re],he[re+1],he[re+2])}}function _i(he,N,V,$,J,re,oe){let _e=Gn(he);const ce=J===0?vr:qn;let Se,we,de=he.start;for(let qe=0;qe<he.length-3;qe+=3){const et=he[qe],lt=he[qe+1],qt=he[qe+2],Ot=he[qe+3],At=he[qe+4],ot=J===0?et:lt,St=J===0?Ot:At;let Ai=!1;oe&&(Se=Math.sqrt(Math.pow(et-Ot,2)+Math.pow(lt-At,2))),ot<V?St>V&&(we=ce(_e,et,lt,Ot,At,V),oe&&(_e.start=de+Se*we)):ot>$?St<$&&(we=ce(_e,et,lt,Ot,At,$),oe&&(_e.start=de+Se*we)):zr(_e,et,lt,qt),St<V&&ot>=V&&(we=ce(_e,et,lt,Ot,At,V),Ai=!0),St>$&&ot<=$&&(we=ce(_e,et,lt,Ot,At,$),Ai=!0),!re&&Ai&&(oe&&(_e.end=de+Se*we),N.push(_e),_e=Gn(he)),oe&&(de+=Se)}let Me=he.length-3;const ae=he[Me],$e=he[Me+1],at=J===0?ae:$e;at>=V&&at<=$&&zr(_e,ae,$e,he[Me+2]),Me=_e.length-3,re&&Me>=3&&(_e[Me]!==_e[0]||_e[Me+1]!==_e[1])&&zr(_e,_e[0],_e[1],_e[2]),_e.length&&N.push(_e)}function Gn(he){const N=[];return N.size=he.size,N.start=he.start,N.end=he.end,N}function Wt(he,N,V,$,J,re){for(const oe of he)_i(oe,N,V,$,J,re,!1)}function zr(he,N,V,$){he.push(N,V,$)}function vr(he,N,V,$,J,re){const oe=(re-N)/($-N);return zr(he,re,V+(J-V)*oe,1),oe}function qn(he,N,V,$,J,re){const oe=(re-V)/(J-V);return zr(he,N+($-N)*oe,re,1),oe}function Mi(he,N){const V=[];for(let $=0;$<he.length;$++){const J=he[$],re=J.type;let oe;if(re==="Point"||re==="MultiPoint"||re==="LineString")oe=hr(J.geometry,N);else if(re==="MultiLineString"||re==="Polygon"){oe=[];for(const _e of J.geometry)oe.push(hr(_e,N))}else if(re==="MultiPolygon"){oe=[];for(const _e of J.geometry){const ce=[];for(const Se of _e)ce.push(hr(Se,N));oe.push(ce)}}V.push(gi(J.id,re,oe,J.tags))}return V}function hr(he,N){const V=[];V.size=he.size,he.start!==void 0&&(V.start=he.start,V.end=he.end);for(let $=0;$<he.length;$+=3)V.push(he[$]+N,he[$+1],he[$+2]);return V}function ir(he,N){if(he.transformed)return he;const V=1<<he.z,$=he.x,J=he.y;for(const re of he.features){const oe=re.geometry,_e=re.type;if(re.geometry=[],_e===1)for(let ce=0;ce<oe.length;ce+=2)re.geometry.push(Cn(oe[ce],oe[ce+1],N,V,$,J));else for(let ce=0;ce<oe.length;ce++){const Se=[];for(let we=0;we<oe[ce].length;we+=2)Se.push(Cn(oe[ce][we],oe[ce][we+1],N,V,$,J));re.geometry.push(Se)}}return he.transformed=!0,he}function Cn(he,N,V,$,J,re){return[Math.round(V*(he*$-J)),Math.round(V*(N*$-re))]}function gn(he,N,V,$,J){const re=N===J.maxZoom?0:J.tolerance/((1<<N)*J.extent),oe={features:[],numPoints:0,numSimplified:0,numFeatures:he.length,source:null,x:V,y:$,z:N,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const _e of he)ua(oe,_e,re,J);return oe}function ua(he,N,V,$){const J=N.geometry,re=N.type,oe=[];if(he.minX=Math.min(he.minX,N.minX),he.minY=Math.min(he.minY,N.minY),he.maxX=Math.max(he.maxX,N.maxX),he.maxY=Math.max(he.maxY,N.maxY),re==="Point"||re==="MultiPoint")for(let _e=0;_e<J.length;_e+=3)oe.push(J[_e],J[_e+1]),he.numPoints++,he.numSimplified++;else if(re==="LineString")tn(oe,J,he,V,!1,!1);else if(re==="MultiLineString"||re==="Polygon")for(let _e=0;_e<J.length;_e++)tn(oe,J[_e],he,V,re==="Polygon",_e===0);else if(re==="MultiPolygon")for(let _e=0;_e<J.length;_e++){const ce=J[_e];for(let Se=0;Se<ce.length;Se++)tn(oe,ce[Se],he,V,!0,Se===0)}if(oe.length){let _e=N.tags||null;if(re==="LineString"&&$.lineMetrics){_e={};for(const Se in N.tags)_e[Se]=N.tags[Se];_e.mapbox_clip_start=J.start/J.size,_e.mapbox_clip_end=J.end/J.size}const ce={geometry:oe,type:re==="Polygon"||re==="MultiPolygon"?3:re==="LineString"||re==="MultiLineString"?2:1,tags:_e};N.id!==null&&(ce.id=N.id),he.features.push(ce)}}function tn(he,N,V,$,J,re){const oe=$*$;if($>0&&N.size<(J?oe:$))return void(V.numPoints+=N.length/3);const _e=[];for(let ce=0;ce<N.length;ce+=3)($===0||N[ce+2]>oe)&&(V.numSimplified++,_e.push(N[ce],N[ce+1])),V.numPoints++;J&&function(ce,Se){let we=0;for(let de=0,Me=ce.length,ae=Me-2;de<Me;ae=de,de+=2)we+=(ce[de]-ce[ae])*(ce[de+1]+ce[ae+1]);if(we>0===Se)for(let de=0,Me=ce.length;de<Me/2;de+=2){const ae=ce[de],$e=ce[de+1];ce[de]=ce[Me-2-de],ce[de+1]=ce[Me-1-de],ce[Me-2-de]=ae,ce[Me-1-de]=$e}}(_e,re),he.push(_e)}const Ar={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Ae{constructor(N,V){const $=(V=this.options=function(re,oe){for(const _e in oe)re[_e]=oe[_e];return re}(Object.create(Ar),V)).debug;if($&&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(re,oe){const _e=[];if(re.type==="FeatureCollection")for(let ce=0;ce<re.features.length;ce++)ur(_e,re.features[ce],oe,ce);else ur(_e,re.type==="Feature"?re:{geometry:re},oe);return _e}(N,V);this.tiles={},this.tileCoords=[],$&&(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(re,oe){const _e=oe.buffer/oe.extent;let ce=re;const Se=zt(re,1,-1-_e,_e,0,-1,2,oe),we=zt(re,1,1-_e,2+_e,0,-1,2,oe);return(Se||we)&&(ce=zt(re,1,-_e,1+_e,0,-1,2,oe)||[],Se&&(ce=Mi(Se,1).concat(ce)),we&&(ce=ce.concat(Mi(we,-1)))),ce}(J,V),J.length&&this.splitTile(J,0,0,0),$&&(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,$,J,re,oe,_e){const ce=[N,V,$,J],Se=this.options,we=Se.debug;for(;ce.length;){J=ce.pop(),$=ce.pop(),V=ce.pop(),N=ce.pop();const de=1<<V,Me=Oe(V,$,J);let ae=this.tiles[Me];if(!ae&&(we>1&&console.time("creation"),ae=this.tiles[Me]=gn(N,V,$,J,Se),this.tileCoords.push({z:V,x:$,y:J}),we)){we>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,$,J,ae.numFeatures,ae.numPoints,ae.numSimplified),console.timeEnd("creation"));const Ai=`z${V}`;this.stats[Ai]=(this.stats[Ai]||0)+1,this.total++}if(ae.source=N,re==null){if(V===Se.indexMaxZoom||ae.numPoints<=Se.indexMaxPoints)continue}else{if(V===Se.maxZoom||V===re)continue;if(re!=null){const Ai=re-V;if($!==oe>>Ai||J!==_e>>Ai)continue}}if(ae.source=null,N.length===0)continue;we>1&&console.time("clipping");const $e=.5*Se.buffer/Se.extent,at=.5-$e,qe=.5+$e,et=1+$e;let lt=null,qt=null,Ot=null,At=null,ot=zt(N,de,$-$e,$+qe,0,ae.minX,ae.maxX,Se),St=zt(N,de,$+at,$+et,0,ae.minX,ae.maxX,Se);N=null,ot&&(lt=zt(ot,de,J-$e,J+qe,1,ae.minY,ae.maxY,Se),qt=zt(ot,de,J+at,J+et,1,ae.minY,ae.maxY,Se),ot=null),St&&(Ot=zt(St,de,J-$e,J+qe,1,ae.minY,ae.maxY,Se),At=zt(St,de,J+at,J+et,1,ae.minY,ae.maxY,Se),St=null),we>1&&console.timeEnd("clipping"),ce.push(lt||[],V+1,2*$,2*J),ce.push(qt||[],V+1,2*$,2*J+1),ce.push(Ot||[],V+1,2*$+1,2*J),ce.push(At||[],V+1,2*$+1,2*J+1)}}getTile(N,V,$){N=+N,V=+V,$=+$;const J=this.options,{extent:re,debug:oe}=J;if(N<0||N>24)return null;const _e=1<<N,ce=Oe(N,V=V+_e&_e-1,$);if(this.tiles[ce])return ir(this.tiles[ce],re);oe>1&&console.log("drilling down to z%d-%d-%d",N,V,$);let Se,we=N,de=V,Me=$;for(;!Se&&we>0;)we--,de>>=1,Me>>=1,Se=this.tiles[Oe(we,de,Me)];return Se&&Se.source?(oe>1&&(console.log("found parent tile z%d-%d-%d",we,de,Me),console.time("drilling down")),this.splitTile(Se.source,we,de,Me,N,V,$),oe>1&&console.timeEnd("drilling down"),this.tiles[ce]?ir(this.tiles[ce],re):null):null}}function Oe(he,N,V){return 32*((1<<he)*V+N)+he}function Le(he,N){return N?he.properties[N]:he.id}function Je(he,N){if(he==null)return!0;if(he.type==="Feature")return Le(he,N)!=null;if(he.type==="FeatureCollection"){const V=new Set;for(const $ of he.features){const J=Le($,N);if(J==null||V.has(J))return!1;V.add(J)}return!0}return!1}function ei(he,N){const V=new Map;if(he!=null)if(he.type==="Feature")V.set(Le(he,N),he);else for(const $ of he.features)V.set(Le($,N),$);return V}class rn extends Ve{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(N,V){return P._(this,void 0,void 0,function*(){const $=N.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const J=this._geoJSONIndex.getTile($.z,$.x,$.y);if(!J)return null;const re=new Vi(J.features);let oe=Qr(re);return oe.byteOffset===0&&oe.byteLength===oe.buffer.byteLength||(oe=new Uint8Array(oe)),{vectorTile:re,rawData:oe.buffer}})}loadData(N){return P._(this,void 0,void 0,function*(){var V;(V=this._pendingRequest)===null||V===void 0||V.abort();const $=!!(N&&N.request&&N.request.collectResourceTiming)&&new P.cM(N.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(N,this._pendingRequest),this._geoJSONIndex=N.cluster?new Zi(function({superclusterOptions:oe,clusterProperties:_e}){if(!_e||!oe)return oe;const ce={},Se={},we={accumulated:null,zoom:0},de={properties:null},Me=Object.keys(_e);for(const ae of Me){const[$e,at]=_e[ae],qe=P.cT(at),et=P.cT(typeof $e=="string"?[$e,["accumulated"],["get",ae]]:$e);ce[ae]=qe.value,Se[ae]=et.value}return oe.map=ae=>{de.properties=ae;const $e={};for(const at of Me)$e[at]=ce[at].evaluate(we,de);return $e},oe.reduce=(ae,$e)=>{de.properties=$e;for(const at of Me)we.accumulated=ae[at],ae[at]=Se[at].evaluate(we,de)},oe}(N)).load((yield this._pendingData).features):(J=yield this._pendingData,new Ae(J,N.geojsonVtOptions)),this.loaded={};const re={};if($){const oe=$.finish();oe&&(re.resourceTiming={},re.resourceTiming[N.source]=JSON.parse(JSON.stringify(oe)))}return re}catch(re){if(delete this._pendingRequest,P.cx(re))return{abandoned:!0};throw re}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 $=yield this.loadGeoJSON(N,V);if(delete this._pendingRequest,typeof $!="object")throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(wt($,!0),N.filter){const J=P.cT(N.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(J.result==="error")throw new Error(J.value.map(oe=>`${oe.key}: ${oe.message}`).join(", "));$={type:"FeatureCollection",features:$.features.filter(oe=>J.value.evaluate({zoom:0},oe))}}return $})}loadGeoJSON(N,V){return P._(this,void 0,void 0,function*(){const{promoteId:$}=N;if(N.request){const J=yield P.j(N.request,V);return this._dataUpdateable=Je(J.data,$)?ei(J.data,$):void 0,J.data}if(typeof N.data=="string")try{const J=JSON.parse(N.data);return this._dataUpdateable=Je(J,$)?ei(J,$):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,re,oe){var _e,ce,Se,we;if(re.removeAll&&J.clear(),re.remove)for(const de of re.remove)J.delete(de);if(re.add)for(const de of re.add){const Me=Le(de,oe);Me!=null&&J.set(Me,de)}if(re.update)for(const de of re.update){let Me=J.get(de.id);if(Me==null)continue;const ae=!de.removeAllProperties&&(((_e=de.removeProperties)===null||_e===void 0?void 0:_e.length)>0||((ce=de.addOrUpdateProperties)===null||ce===void 0?void 0:ce.length)>0);if((de.newGeometry||de.removeAllProperties||ae)&&(Me=Object.assign({},Me),J.set(de.id,Me),ae&&(Me.properties=Object.assign({},Me.properties))),de.newGeometry&&(Me.geometry=de.newGeometry),de.removeAllProperties)Me.properties={};else if(((Se=de.removeProperties)===null||Se===void 0?void 0:Se.length)>0)for(const $e of de.removeProperties)Object.prototype.hasOwnProperty.call(Me.properties,$e)&&delete Me.properties[$e];if(((we=de.addOrUpdateProperties)===null||we===void 0?void 0:we.length)>0)for(const{key:$e,value:at}of de.addOrUpdateProperties)Me.properties[$e]=at}}(this._dataUpdateable,N.dataDiff,$),{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 Ur{constructor(N){this.self=N,this.actor=new P.J(N),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(V,$)=>{if(this.externalWorkerSourceTypes[V])throw new Error(`Worker source with name "${V}" already registered.`);this.externalWorkerSourceTypes[V]=$},this.self.addProtocol=P.cz,this.self.removeProtocol=P.cA,this.self.registerRTLTextPlugin=V=>{P.cU.setMethods(V)},this.actor.registerMessageHandler("LDT",(V,$)=>this._getDEMWorkerSource(V,$.source).loadTile($)),this.actor.registerMessageHandler("RDT",(V,$)=>P._(this,void 0,void 0,function*(){this._getDEMWorkerSource(V,$.source).removeTile($)})),this.actor.registerMessageHandler("GCEZ",(V,$)=>P._(this,void 0,void 0,function*(){return this._getWorkerSource(V,$.type,$.source).getClusterExpansionZoom($)})),this.actor.registerMessageHandler("GCC",(V,$)=>P._(this,void 0,void 0,function*(){return this._getWorkerSource(V,$.type,$.source).getClusterChildren($)})),this.actor.registerMessageHandler("GCL",(V,$)=>P._(this,void 0,void 0,function*(){return this._getWorkerSource(V,$.type,$.source).getClusterLeaves($)})),this.actor.registerMessageHandler("LD",(V,$)=>this._getWorkerSource(V,$.type,$.source).loadData($)),this.actor.registerMessageHandler("GD",(V,$)=>this._getWorkerSource(V,$.type,$.source).getData()),this.actor.registerMessageHandler("LT",(V,$)=>this._getWorkerSource(V,$.type,$.source).loadTile($)),this.actor.registerMessageHandler("RT",(V,$)=>this._getWorkerSource(V,$.type,$.source).reloadTile($)),this.actor.registerMessageHandler("AT",(V,$)=>this._getWorkerSource(V,$.type,$.source).abortTile($)),this.actor.registerMessageHandler("RMT",(V,$)=>this._getWorkerSource(V,$.type,$.source).removeTile($)),this.actor.registerMessageHandler("RS",(V,$)=>P._(this,void 0,void 0,function*(){if(!this.workerSources[V]||!this.workerSources[V][$.type]||!this.workerSources[V][$.type][$.source])return;const J=this.workerSources[V][$.type][$.source];delete this.workerSources[V][$.type][$.source],J.removeSource!==void 0&&J.removeSource($)})),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,$)=>P._(this,void 0,void 0,function*(){this.referrer=$})),this.actor.registerMessageHandler("SRPS",(V,$)=>this._syncRTLPluginState(V,$)),this.actor.registerMessageHandler("IS",(V,$)=>P._(this,void 0,void 0,function*(){this.self.importScripts($)})),this.actor.registerMessageHandler("SI",(V,$)=>this._setImages(V,$)),this.actor.registerMessageHandler("UL",(V,$)=>P._(this,void 0,void 0,function*(){this._getLayerIndex(V).update($.layers,$.removedIds)})),this.actor.registerMessageHandler("SL",(V,$)=>P._(this,void 0,void 0,function*(){this._getLayerIndex(V).replace($)}))}_setImages(N,V){return P._(this,void 0,void 0,function*(){this.availableImages[N]=V;for(const $ in this.workerSources[N]){const J=this.workerSources[N][$];for(const re in J)J[re].availableImages=V}})}_syncRTLPluginState(N,V){return P._(this,void 0,void 0,function*(){return yield P.cU.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,$){if(this.workerSources[N]||(this.workerSources[N]={}),this.workerSources[N][V]||(this.workerSources[N][V]={}),!this.workerSources[N][V][$]){const J={sendAsync:(re,oe)=>(re.targetMapId=N,this.actor.sendAsync(re,oe))};switch(V){case"vector":this.workerSources[N][V][$]=new Ve(J,this._getLayerIndex(N),this._getAvailableImages(N));break;case"geojson":this.workerSources[N][V][$]=new rn(J,this._getLayerIndex(N),this._getAvailableImages(N));break;default:this.workerSources[N][V][$]=new this.externalWorkerSourceTypes[V](J,this._getLayerIndex(N),this._getAvailableImages(N))}}return this.workerSources[N][V][$]}_getDEMWorkerSource(N,V){return this.demWorkerSources[N]||(this.demWorkerSources[N]={}),this.demWorkerSources[N][V]||(this.demWorkerSources[N][V]=new Ce),this.demWorkerSources[N][V]}}return P.i(self)&&(self.worker=new Ur(self)),Ur}),D("index",["exports","./shared"],function(P,o){var fe="5.6.0";function xe(){var u=new o.A(4);return o.A!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}let ke,Ve;const Ce={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=>(ke||(ke=document.createElement("a")),ke.href=u,ke.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Ve==null&&(Ve=matchMedia("(prefers-reduced-motion: reduce)")),Ve.matches)}};class ue{static testProp(e){if(!ue.docStyle)return e[0];for(let i=0;i<e.length;i++)if(e[i]in ue.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(){ue.docStyle&&ue.selectProp&&(ue.userSelect=ue.docStyle[ue.selectProp],ue.docStyle[ue.selectProp]="none")}static enableDrag(){ue.docStyle&&ue.selectProp&&(ue.docStyle[ue.selectProp]=ue.userSelect)}static setTransform(e,i){e.style[ue.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",ue.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ue.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",ue.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=ue.getScale(e);return ue.getPoint(e,s,i)}static touchPos(e,i){const s=[],l=ue.getScale(e);for(let h=0;h<i.length;h++)s.push(ue.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 ue.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)ue.removeAttributes(s),ue.clean(s)}static removeAttributes(e){for(const{name:i,value:s}of e.attributes)ue.isPossiblyDangerous(i,s)&&e.removeAttribute(i)}}ue.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,ue.selectProp=ue.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),ue.transformProp=ue.testProp(["transform","WebkitTransform"]);const Ue={supported:!1,testSupport:function(u){!Pi&&wt&&(pi?Vi(u):Vt=u)}};let Vt,wt,Pi=!1,pi=!1;function Vi(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,wt),u.isContextLost())return;Ue.supported=!0}catch{}u.deleteTexture(e),Pi=!0}var li;typeof document<"u"&&(wt=document.createElement("img"),wt.onload=()=>{Vt&&Vi(Vt),Vt=null,pi=!0},wt.onerror=()=>{Pi=!0,Vt=null},wt.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(u){let e,i,s,l;u.resetRequestQueue=()=>{e=[],i=0,s=0,l={}},u.addThrottleControl=x=>{const T=s++;return l[T]=x,T},u.removeThrottleControl=x=>{delete l[x],f()},u.getImage=(x,T,M=!0)=>new Promise((E,I)=>{Ue.supported&&(x.headers||(x.headers={}),x.headers.accept="image/webp,*/*"),o.e(x,{type:"image"}),e.push({abortController:T,requestParameters:x,supportImageRefresh:M,state:"queued",onError:k=>{I(k)},onSuccess:k=>{E(k)}}),f()});const h=x=>o._(this,void 0,void 0,function*(){x.state="running";const{requestParameters:T,supportImageRefresh:M,onError:E,onSuccess:I,abortController:k}=x,O=M===!1&&!o.i(self)&&!o.g(T.url)&&(!T.headers||Object.keys(T.headers).reduce((W,X)=>W&&X==="accept",!0));i++;const q=O?_(T,k):o.m(T,k);try{const W=yield q;delete x.abortController,x.state="completed",W.data instanceof HTMLImageElement||o.b(W.data)?I(W):W.data&&I({data:yield(G=W.data,typeof createImageBitmap=="function"?o.f(G):o.h(G)),cacheControl:W.cacheControl,expires:W.expires})}catch(W){delete x.abortController,E(W)}finally{i--,f()}var G}),f=()=>{const x=(()=>{for(const T of Object.keys(l))if(l[T]())return!0;return!1})()?o.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:o.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let T=i;T<x&&e.length>0;T++){const M=e.shift();M.abortController.signal.aborted?T--:h(M)}},_=(x,T)=>new Promise((M,E)=>{const I=new Image,k=x.url,O=x.credentials;O&&O==="include"?I.crossOrigin="use-credentials":(O&&O==="same-origin"||!o.d(k))&&(I.crossOrigin="anonymous"),T.signal.addEventListener("abort",()=>{I.src="",E(o.c())}),I.fetchPriority="high",I.onload=()=>{I.onerror=I.onload=null,M({data:I})},I.onerror=()=>{I.onerror=I.onload=null,T.signal.aborted||E(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."))},I.src=k})}(li||(li={})),li.resetRequestQueue();class Et{constructor(e){this._transformRequestFn=e}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function Ft(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 or(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`)}}function Pn(u){const{userImage:e}=u;return!!(e&&e.render&&e.render())&&(u.data.replace(new Uint8Array(e.data.buffer)),!0)}class Qr 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 o.T(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const h in this.patterns)e.push(this.patterns[h].bin);const{w:i,h:s}=o.p(e),l=this.atlasImage;l.resize({width:i||1,height:s||1});for(const h in this.patterns){const{bin:f}=this.patterns[h],_=f.x+1,x=f.y+1,T=this.getImage(h).data,M=T.width,E=T.height;o.R.copy(T,l,{x:0,y:0},{x:_,y:x},{width:M,height:E}),o.R.copy(T,l,{x:0,y:E-1},{x:_,y:x-1},{width:M,height:1}),o.R.copy(T,l,{x:0,y:0},{x:_,y:x+E},{width:M,height:1}),o.R.copy(T,l,{x:M-1,y:0},{x:_-1,y:x},{width:1,height:E}),o.R.copy(T,l,{x:0,y:0},{x:_+M,y:x},{width:1,height:E})}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`),Pn(s)&&this.updateImage(i,s)}}}const Nr=1e20;function en(u,e,i,s,l,h,f,_,x){for(let T=e;T<e+s;T++)yr(u,i*h+T,h,l,f,_,x);for(let T=i;T<i+l;T++)yr(u,T*h+e,1,s,f,_,x)}function yr(u,e,i,s,l,h,f){h[0]=0,f[0]=-1e20,f[1]=Nr,l[0]=u[e];for(let _=1,x=0,T=0;_<s;_++){l[_]=u[e+_*i];const M=_*_;do{const E=h[x];T=(l[_]-l[E]+M-E*E)/(_-E)/2}while(T<=f[x]&&--x>-1);x++,h[x]=_,f[x]=T,f[x+1]=Nr}for(let _=0,x=0;_<s;_++){for(;f[x+1]<_;)x++;const T=h[x],M=_-T;u[e+_*i]=l[T]+M*M}}class Zi{constructor(e,i){this.requestManager=e,this.localIdeographFontFamily=i,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return o._(this,void 0,void 0,function*(){const i=[];for(const h in e)for(const f of e[h])i.push(this._getAndCacheGlyphsPromise(h,f));const s=yield Promise.all(i),l={};for(const{stack:h,id:f,glyph:_}of s)l[h]||(l[h]={}),l[h][f]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return l})}_getAndCacheGlyphsPromise(e,i){return o._(this,void 0,void 0,function*(){let s=this.entries[e];s||(s=this.entries[e]={glyphs:{},requests:{},ranges:{}});let l=s.glyphs[i];if(l!==void 0)return{stack:e,id:i,glyph:l};if(l=this._tinySDF(s,e,i),l)return s.glyphs[i]=l,{stack:e,id:i,glyph:l};const h=Math.floor(i/256);if(256*h>65535)throw new Error("glyphs > 65535 not supported");if(s.ranges[h])return{stack:e,id:i,glyph:l};if(!this.url)throw new Error("glyphsUrl is not set");if(!s.requests[h]){const _=Zi.loadGlyphRange(e,h,this.url,this.requestManager);s.requests[h]=_}const f=yield s.requests[h];for(const _ in f)this._doesCharSupportLocalGlyph(+_)||(s.glyphs[+_]=f[+_]);return s.ranges[h]=!0,{stack:e,id:i,glyph:f[i]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))||o.u["CJK Unified Ideographs"](e)||o.u["Hangul Syllables"](e)||o.u.Hiragana(e)||o.u.Katakana(e)||o.u["CJK Symbols and Punctuation"](e)||o.u["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,i,s){const l=this.localIdeographFontFamily;if(!l||!this._doesCharSupportLocalGlyph(s))return;let h=e.tinySDF;if(!h){let _="400";/bold/i.test(i)?_="900":/medium/i.test(i)?_="500":/light/i.test(i)&&(_="200"),h=e.tinySDF=new Zi.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:l,fontWeight:_})}const f=h.draw(String.fromCharCode(s));return{id:s,bitmap:new o.q({width:f.width||60,height:f.height||60},f.data),metrics:{width:f.glyphWidth/2||24,height:f.glyphHeight/2||24,left:f.glyphLeft/2+.5||0,top:f.glyphTop/2-27.5||-8,advance:f.glyphAdvance/2||24,isDoubleResolution:!0}}}}Zi.loadGlyphRange=function(u,e,i,s){return o._(this,void 0,void 0,function*(){const l=256*e,h=l+255,f=s.transformRequest(i.replace("{fontstack}",u).replace("{range}",`${l}-${h}`),"Glyphs"),_=yield o.n(f,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${l}-${h}`);const x={};for(const T of o.o(_.data))x[T.id]=T;return x})},Zi.TinySDF=class{constructor({fontSize:u=24,buffer:e=3,radius:i=8,cutoff:s=.25,fontFamily:l="sans-serif",fontWeight:h="normal",fontStyle:f="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=i;const _=this.size=u+4*e,x=this._createCanvas(_),T=this.ctx=x.getContext("2d",{willReadFrequently:!0});T.font=`${f} ${h} ${u}px ${l}`,T.textBaseline="alphabetic",T.textAlign="left",T.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(u){const e=document.createElement("canvas");return e.width=e.height=u,e}draw(u){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:l,actualBoundingBoxRight:h}=this.ctx.measureText(u),f=Math.ceil(i),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-l))),x=Math.min(this.size-this.buffer,f+Math.ceil(s)),T=_+2*this.buffer,M=x+2*this.buffer,E=Math.max(T*M,0),I=new Uint8ClampedArray(E),k={data:I,width:T,height:M,glyphWidth:_,glyphHeight:x,glyphTop:f,glyphLeft:0,glyphAdvance:e};if(_===0||x===0)return k;const{ctx:O,buffer:q,gridInner:G,gridOuter:W}=this;O.clearRect(q,q,_,x),O.fillText(u,q,q+f);const X=O.getImageData(q,q,_,x);W.fill(Nr,0,E),G.fill(0,0,E);for(let ee=0;ee<x;ee++)for(let Y=0;Y<_;Y++){const ie=X.data[4*(ee*_+Y)+3]/255;if(ie===0)continue;const ne=(ee+q)*T+Y+q;if(ie===1)W[ne]=0,G[ne]=Nr;else{const K=.5-ie;W[ne]=K>0?K*K:0,G[ne]=K<0?K*K:0}}en(W,0,0,T,M,T,this.f,this.v,this.z),en(G,q,q,_,x,T,this.f,this.v,this.z);for(let ee=0;ee<E;ee++){const Y=Math.sqrt(W[ee])-Math.sqrt(G[ee]);I[ee]=Math.round(255-255*(Y/this.radius+this.cutoff))}return k}};class Vr{constructor(){this.specification=o.v.light.position}possiblyEvaluate(e,i){return o.B(e.expression.evaluate(i))}interpolate(e,i,s){return{x:o.C.number(e.x,i.x,s),y:o.C.number(e.y,i.y,s),z:o.C.number(e.z,i.z,s)}}}let lr;class It extends o.E{constructor(e){super(),lr=lr||new o.r({anchor:new o.D(o.v.light.anchor),position:new Vr,color:new o.D(o.v.light.color),intensity:new o.D(o.v.light.intensity)}),this._transitionable=new o.t(lr),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(o.x,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.y(this,e.call(o.z,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:o.v}))}}const Jt=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 cr extends o.E{constructor(e){super(),this._transitionable=new o.t(Jt),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new o.F(0))}setSky(e,i={}){if(!this._validate(o.G,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.y(this,e.call(o.z,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 tr{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,i){const s=e.join(",")+String(i);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(e,i)),this.dashEntry[s]}getDashRanges(e,i,s){const l=[];let h=e.length%2==1?-e[e.length-1]*s:0,f=e[0]*s,_=!0;l.push({left:h,right:f,isDash:_,zeroLength:e[0]===0});let x=e[0];for(let T=1;T<e.length;T++){_=!_;const M=e[T];h=x*s,x+=M,f=x*s,l.push({left:h,right:f,isDash:_,zeroLength:M===0})}return l}addRoundDash(e,i,s){const l=i/2;for(let h=-s;h<=s;h++){const f=this.width*(this.nextRow+s+h);let _=0,x=e[_];for(let T=0;T<this.width;T++){T/x.right>1&&(x=e[++_]);const M=Math.abs(T-x.left),E=Math.abs(T-x.right),I=Math.min(M,E);let k;const O=h/s*(l+1);if(x.isDash){const q=l-Math.abs(O);k=Math.sqrt(I*I+q*q)}else k=l-Math.sqrt(I*I+O*O);this.data[f+T]=Math.max(0,Math.min(255,k+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){const x=e[_],T=e[_+1];x.zeroLength?e.splice(_,1):T&&T.isDash===x.isDash&&(T.left=x.left,e.splice(_,1))}const i=e[0],s=e[e.length-1];i.isDash===s.isDash&&(i.left=s.left-this.width,s.right=i.right+this.width);const l=this.width*this.nextRow;let h=0,f=e[h];for(let _=0;_<this.width;_++){_/f.right>1&&(f=e[++h]);const x=Math.abs(_-f.left),T=Math.abs(_-f.right),M=Math.min(x,T);this.data[l+_]=Math.max(0,Math.min(255,(f.isDash?M:-M)+128))}}addDash(e,i){const s=i?7:0,l=2*s+1;if(this.nextRow+l>this.height)return o.w("LineAtlas out of space"),null;let h=0;for(let _=0;_<e.length;_++)h+=e[_];if(h!==0){const _=this.width/h,x=this.getDashRanges(e,this.width,_);i?this.addRoundDash(x,_,s):this.addRegularDash(x)}const f={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:h};return this.nextRow+=l,this.dirty=!0,f}bind(e){const i=e.gl;this.texture?(i.bindTexture(i.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,i.texSubImage2D(i.TEXTURE_2D,0,0,0,this.width,this.height,i.ALPHA,i.UNSIGNED_BYTE,this.data))):(this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texImage2D(i.TEXTURE_2D,0,i.ALPHA,this.width,this.height,0,i.ALPHA,i.UNSIGNED_BYTE,this.data))}}const Ir="maplibre_preloaded_worker_pool";class gi{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<gi.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[Ir]}numActive(){return Object.keys(this.active).length}}const Rt=Math.floor(Ce.hardwareConcurrency/2);let ur,Ui;function Zr(){return ur||(ur=new gi),ur}gi.workerCount=o.H(globalThis)?Math.max(Math.min(Rt,3),1):1;class Er{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.J(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 xr(){return Ui||(Ui=new Er(Zr(),o.K),Ui.registerMessageHandler("GR",(u,e,i)=>o.m(e,i))),Ui}function Mn(u,e){const i=o.L();return o.M(i,i,[1,1,0]),o.N(i,i,[.5*u.width,.5*u.height,1]),u.calculatePosMatrix?o.O(i,i,u.calculatePosMatrix(e.toUnwrapped())):i}function zt(u,e,i,s,l,h,f){var _;const x=function(I,k,O){if(I)for(const q of I){const G=k[q];if(G&&G.source===O&&G.type==="fill-extrusion")return!0}else for(const q in k){const G=k[q];if(G.source===O&&G.type==="fill-extrusion")return!0}return!1}((_=l==null?void 0:l.layers)!==null&&_!==void 0?_:null,e,u.id),T=h.maxPitchScaleFactor(),M=u.tilesIn(s,T,x);M.sort($i);const E=[];for(const I of M)E.push({wrappedTileID:I.tileID.wrapped().key,queryResults:I.tile.queryRenderedFeatures(e,i,u._state,I.queryGeometry,I.cameraQueryGeometry,I.scale,l,h,T,Mn(u.transform,I.tileID),f?(k,O)=>f(I.tileID,k,O):void 0)});return function(I,k){for(const O in I)for(const q of I[O])_i(q,k);return I}(function(I){const k={},O={};for(const q of I){const G=q.queryResults,W=q.wrappedTileID,X=O[W]=O[W]||{};for(const ee in G){const Y=G[ee],ie=X[ee]=X[ee]||{},ne=k[ee]=k[ee]||[];for(const K of Y)ie[K.featureIndex]||(ie[K.featureIndex]=!0,ne.push(K))}}return k}(E),u)}function $i(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 _i(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 Gn(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 Ce.frameAsync(i),!s)return null;const l=o.Q(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 Wt{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.S?new o.S(e.lng,e.lat):o.S.convert(e),this}setSouthWest(e){return this._sw=e instanceof o.S?new o.S(e.lng,e.lat):o.S.convert(e),this}extend(e){const i=this._sw,s=this._ne;let l,h;if(e instanceof o.S)l=e,h=e;else{if(!(e instanceof Wt))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Wt.convert(e)):this.extend(o.S.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(o.S.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.S(l.lng,l.lat),this._ne=new o.S(h.lng,h.lat)),this}getCenter(){return new o.S((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new o.S(this.getWest(),this.getNorth())}getSouthEast(){return new o.S(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:s}=o.S.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 Wt?e:e&&new Wt(e)}static fromLngLat(e,i=0){const s=360*i/40075017,l=s/Math.cos(Math.PI/180*e.lat);return new Wt(new o.S(e.lng-l,e.lat-s),new o.S(e.lng+l,e.lat+s))}adjustAntiMeridian(){const e=new o.S(this._sw.lng,this._sw.lat),i=new o.S(this._ne.lng,this._ne.lat);return new Wt(e,e.lng>i.lng?new o.S(i.lng+360,i.lat):i)}}class zr{constructor(e,i,s){this.bounds=Wt.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.V(this.bounds.getWest())*i),l=Math.floor(o.U(this.bounds.getNorth())*i),h=Math.ceil(o.V(this.bounds.getEast())*i),f=Math.ceil(o.U(this.bounds.getSouth())*i);return e.x>=s&&e.x<h&&e.y>=l&&e.y<f}}class vr 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.Q(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 Gn(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 zr(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,globalState:this.map.getGlobalState()};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 qn 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.Q(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 Gn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(o.e(this,i),i.bounds&&(this.tileBounds=new zr(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 li.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 o.T(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 Mi extends qn{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 li.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.W()?h:yield this.readImageNow(h),_={type:this.type,uid:e.uid,source:this.id,rawImageData:f,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const x=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=x,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(l){if(delete e.abortController,e.aborted)e.state="unloaded";else if(l)throw e.state="errored",l}})}readImageNow(e){return o._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&o.X()){const i=e.width+2,s=e.height+2;try{return new o.R({width:i,height:s},yield o.Y(e,-1,-1,i,s))}catch{}}return Ce.getImageData(e,1)})}_getNeighboringTiles(e){const i=e.canonical,s=Math.pow(2,i.z),l=(i.x-1+s)%s,h=i.x===0?e.wrap-1:e.wrap,f=(i.x+1+s)%s,_=i.x+1===s?e.wrap+1:e.wrap,x={};return x[new o.Z(e.overscaledZ,h,i.z,l,i.y).key]={backfilled:!1},x[new o.Z(e.overscaledZ,_,i.z,f,i.y).key]={backfilled:!1},i.y>0&&(x[new o.Z(e.overscaledZ,h,i.z,l,i.y-1).key]={backfilled:!1},x[new o.Z(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},x[new o.Z(e.overscaledZ,_,i.z,f,i.y-1).key]={backfilled:!1}),i.y+1<s&&(x[new o.Z(e.overscaledZ,h,i.z,l,i.y+1).key]={backfilled:!1},x[new o.Z(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},x[new o.Z(e.overscaledZ,_,i.z,f,i.y+1).key]={backfilled:!1}),x}unloadTile(e){return o._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}class hr 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.$,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(i.clusterMaxZoom),minPoints:Math.max(2,i.clusterMinPoints||2),extent:o.$,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.$/this.tileSize)}_getClusterMaxZoom(e){const i=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||o.w(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${i}"`),i}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 Wt,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=this._getClusterMaxZoom(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(Ce.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,globalState:this.map.getGlobalState()};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 ir 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 li.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.a0.fromLngLat);var s;return this.tileID=function(l){const h=o.a1.fromPoints(l),f=h.width(),_=h.height(),x=Math.max(f,_),T=Math.max(0,Math.floor(-Math.log(x)/Math.LN2)),M=Math.pow(2,T);return new o.a3(T,Math.floor((h.minX+h.maxX)/2*M),Math.floor((h.minY+h.maxY)/2*M))}(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 o.T(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){const{minX:i,minY:s,maxX:l,maxY:h}=o.a1.fromPoints(e),f={};for(let _=0;_<=o.a2;_++){const x=Math.pow(2,_),T=Math.floor(i*x),M=Math.floor(s*x),E=Math.floor(l*x),I=Math.floor(h*x);f[_]={minTileX:T,minTileY:M,maxTileX:E,maxTileY:I}}return f}}class Cn extends ir{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.a4(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.a5(`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 o.T(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 gn extends ir{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.a5(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.k(new o.a5(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&typeof i.animate!="boolean"&&this.fire(new o.k(new o.a5(`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.a5(`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.a5(`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 o.T(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 ua={},tn=u=>{switch(u){case"geojson":return hr;case"image":return ir;case"raster":return qn;case"raster-dem":return Mi;case"vector":return vr;case"video":return Cn;case"canvas":return gn}return ua[u]},Ar="RTLPluginLoaded";class Ae extends o.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=xr()}_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=Ce.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(Ar))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Oe=null;function Le(){return Oe||(Oe=new Ae),Oe}class Je{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=o.a6(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const i=e+this.timeAdded;i<this.fadeEndTime||(this.fadeEndTime=i)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(l,h){const f={};if(!h)return f;for(const _ of l){const x=_.layerIds.map(T=>h.getLayer(T)).filter(Boolean);if(x.length!==0){_.layers=x,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(T=>x.filter(M=>M.id===T)[0]));for(const T of x)f[T.id]=_}}return f}(e.buckets,i==null?void 0:i.style),this.hasSymbolBuckets=!1;for(const l in this.buckets){const h=this.buckets[l];if(h instanceof o.a8){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.a8&&h.hasRTLText){this.hasRTLText=!0,Le().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.a7}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 o.T(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new o.T(e,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,i,s,l,h,f,_,x,T,M,E){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:l,cameraQueryGeometry:h,scale:f,tileSize:this.tileSize,pixelPosMatrix:M,transform:x,params:_,queryPadding:this.queryPadding*T,getElevation:E},e,i,s):{}}querySourceFeatures(e,i){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const l=s.loadVTLayers(),h=i&&i.sourceLayer?i.sourceLayer:"",f=l._geojsonTileLayer||l[h];if(!f)return;const _=o.a9(i&&i.filter),{z:x,x:T,y:M}=this.tileID.canonical,E={z:x,x:T,y:M};for(let I=0;I<f.length;I++){const k=f.feature(I);if(_.needGeometry){const G=o.aa(k,!0);if(!_.filter(new o.F(this.tileID.overscaledZ),G,this.tileID.canonical))continue}else if(!_.filter(new o.F(this.tileID.overscaledZ),k))continue;const O=s.getId(k,h),q=new o.ab(k,x,T,M,O);q.tile=E,e.push(q)}}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.ac(e.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const s=Date.now();let l=!1;if(this.expirationTime>s)l=!1;else if(i)if(this.expirationTime<i)l=!0;else{const h=this.expirationTime-i;h?this.expirationTime=s+Math.max(h,3e4):l=!0}else l=!0;l?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,i){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const l in this.buckets){if(!i.style.hasLayer(l))continue;const h=this.buckets[l],f=h.layers[0].sourceLayer||"_geojsonTileLayer",_=s[f],x=e[f];if(!_||!x||Object.keys(x).length===0)continue;h.update(x,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const T=i&&i.style&&i.style.getLayer(l);T&&(this.queryPadding=Math.max(this.queryPadding,T.queryRadius(h)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Ce.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=Ce.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 ei{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 rn{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,s){const l=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][l]=this.stateChanges[e][l]||{},o.e(this.stateChanges[e][l],s),this.deletedStates[e]===null){this.deletedStates[e]={};for(const h in this.state[e])h!==l&&(this.deletedStates[e][h]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][l]===null){this.deletedStates[e][l]={};for(const h in this.state[e][l])s[h]||(this.deletedStates[e][l][h]=null)}else for(const h in s)this.deletedStates[e]&&this.deletedStates[e][l]&&this.deletedStates[e][l][h]===null&&delete this.deletedStates[e][l][h]}removeFeatureState(e,i,s){if(this.deletedStates[e]===null)return;const l=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},s&&i!==void 0)this.deletedStates[e][l]!==null&&(this.deletedStates[e][l]=this.deletedStates[e][l]||{},this.deletedStates[e][l][s]=null);else if(i!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][l])for(s in this.deletedStates[e][l]={},this.stateChanges[e][l])this.deletedStates[e][l][s]=null;else this.deletedStates[e][l]=null;else this.deletedStates[e]=null}getState(e,i){const s=String(i),l=o.e({},(this.state[e]||{})[s],(this.stateChanges[e]||{})[s]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const h=this.deletedStates[e][i];if(h===null)return{};for(const f in h)delete l[f]}return l}initializeTileState(e,i){e.setFeatureState(this.state,i)}coalesceChanges(e,i){const s={};for(const l in this.stateChanges){this.state[l]=this.state[l]||{};const h={};for(const f in this.stateChanges[l])this.state[l][f]||(this.state[l][f]={}),o.e(this.state[l][f],this.stateChanges[l][f]),h[f]=this.state[l][f];s[l]=h}for(const l in this.deletedStates){this.state[l]=this.state[l]||{};const h={};if(this.deletedStates[l]===null)for(const f in this.state[l])h[f]={},this.state[l][f]={};else for(const f in this.deletedStates[l]){if(this.deletedStates[l][f]===null)this.state[l][f]={};else for(const _ of Object.keys(this.deletedStates[l][f]))delete this.state[l][f][_];h[f]=this.state[l][f]}s[l]=s[l]||{},o.e(s[l],h)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const l in e)e[l].setFeatureState(s,i)}}const Ur=89.25;function he(u,e){const i=o.ag(e.lat,-85.051129,o.ah);return new o.P(o.V(e.lng)*u,o.U(i)*u)}function N(u,e){return new o.a0(e.x/u,e.y/u).toLngLat()}function V(u){return u.cameraToCenterDistance*Math.min(.85*Math.tan(o.ad(90-u.pitch)),Math.tan(o.ad(Ur-u.pitch)))}function $(u,e){const i=u.canonical,s=e/o.ae(i.z),l=i.x+Math.pow(2,i.z)*u.wrap,h=o.af(new Float64Array(16));return o.M(h,h,[l*s,i.y*s,0]),o.N(h,h,[s/o.$,s/o.$,1]),h}function J(u,e,i,s,l){const h=o.a0.fromLngLat(u,e),f=l*o.ai(1,u.lat),_=f*Math.cos(o.ad(i)),x=Math.sqrt(f*f-_*_),T=x*Math.sin(o.ad(-s)),M=x*Math.cos(o.ad(-s));return new o.a0(h.x+T,h.y+M,h.z+_)}function re(u,e,i){const s=e.intersectsFrustum(u);if(!i||s===0)return s;const l=e.intersectsPlane(i);return l===0?0:s===2&&l===2?2:1}function oe(u,e,i){let s=0;const l=(i-e)/10;for(let h=0;h<10;h++)s+=l*Math.pow(Math.cos(e+(h+.5)/10*(i-e)),u);return s}function _e(u,e){return function(i,s,l,h,f){const _=2*((u-1)/o.aj(Math.cos(o.ad(Ur-f))/Math.cos(o.ad(Ur)))-1),x=Math.acos(l/h),T=2*oe(_-1,0,o.ad(f/2)),M=Math.min(o.ad(Ur),x+o.ad(f/2)),E=oe(_-1,Math.min(M,x-o.ad(f/2)),M),I=Math.atan(s/l),k=Math.hypot(s,l);let O=i;return O+=o.aj(h/k/Math.max(.5,Math.cos(o.ad(f/2)))),O+=_*o.aj(Math.cos(I))/2,O-=o.aj(Math.max(1,E/T/e))/2,O}}const ce=_e(9.314,3);function Se(u,e){const i=(e.roundZoom?Math.round:Math.floor)(u.zoom+o.aj(u.tileSize/e.tileSize));return Math.max(0,i)}function we(u,e){const i=u.getCameraFrustum(),s=u.getClippingPlane(),l=u.screenPointToMercatorCoordinate(u.getCameraPoint()),h=o.a0.fromLngLat(u.center,u.elevation);l.z=h.z+Math.cos(u.pitchInRadians)*u.cameraToCenterDistance/u.worldSize;const f=u.getCoveringTilesDetailsProvider(),_=f.allowVariableZoom(u,e),x=Se(u,e),T=e.minzoom||0,M=e.maxzoom!==void 0?e.maxzoom:u.maxZoom,E=Math.min(Math.max(0,x),M),I=Math.pow(2,E),k=[I*l.x,I*l.y,0],O=[I*h.x,I*h.y,0],q=Math.hypot(h.x-l.x,h.y-l.y),G=Math.abs(h.z-l.z),W=Math.hypot(q,G),X=ie=>({zoom:0,x:0,y:0,wrap:ie,fullyVisible:!1}),ee=[],Y=[];if(u.renderWorldCopies&&f.allowWorldCopies())for(let ie=1;ie<=3;ie++)ee.push(X(-ie)),ee.push(X(ie));for(ee.push(X(0));ee.length>0;){const ie=ee.pop(),ne=ie.x,K=ie.y;let le=ie.fullyVisible;const ye={x:ne,y:K,z:ie.zoom},pe=f.getTileBoundingVolume(ye,ie.wrap,u.elevation,e);if(!le){const Fe=re(i,pe,s);if(Fe===0)continue;le=Fe===2}const me=f.distanceToTile2d(l.x,l.y,ye,pe);let ve=x;_&&(ve=(e.calculateTileZoom||ce)(u.zoom+o.aj(u.tileSize/e.tileSize),me,G,W,u.fov)),ve=(e.roundZoom?Math.round:Math.floor)(ve),ve=Math.max(0,ve);const je=Math.min(ve,M);if(ie.wrap=f.getWrap(h,ye,ie.wrap),ie.zoom>=je){if(ie.zoom<T)continue;const Fe=E-ie.zoom,Ee=k[0]-.5-(ne<<Fe),We=k[1]-.5-(K<<Fe),ht=e.reparseOverscaled?Math.max(ie.zoom,ve):ie.zoom;Y.push({tileID:new o.Z(ie.zoom===M?ht:ie.zoom,ie.wrap,ie.zoom,ne,K),distanceSq:o.ak([O[0]-.5-ne,O[1]-.5-K]),tileDistanceToCamera:Math.sqrt(Ee*Ee+We*We)})}else for(let Fe=0;Fe<4;Fe++)ee.push({zoom:ie.zoom+1,x:(ne<<1)+Fe%2,y:(K<<1)+(Fe>>1),wrap:ie.wrap,fullyVisible:le})}return Y.sort((ie,ne)=>ie.distanceSq-ne.distanceSq).map(ie=>ie.tileID)}const de=o.a1.fromPoints([new o.P(0,0),new o.P(o.$,o.$)]);class Me extends o.E{constructor(e,i,s){super(),this.id=e,this.dispatcher=s,this.on("data",l=>this._dataHandler(l)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((l,h,f,_)=>{const x=new(tn(h.type))(l,h,f,_);if(x.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${x.id}`);return x})(e,i,s,this),this._tiles={},this._cache=new ei(0,l=>this._unloadTile(l)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new rn,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(ae).map(e=>e.key)}getRenderableIds(e){const i=[];for(const s in this._tiles)this._isIdRenderable(s,e)&&i.push(this._tiles[s]);return e?i.sort((s,l)=>{const h=s.tileID,f=l.tileID,_=new o.P(h.canonical.x,h.canonical.y)._rotate(-this.transform.bearingInRadians),x=new o.P(f.canonical.x,f.canonical.y)._rotate(-this.transform.bearingInRadians);return h.overscaledZ-f.overscaledZ||x.y-_.y||x.x-_.x}).map(s=>s.tileID.key):i.map(s=>s.tileID).sort(ae).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._reloadTile(i,"expired"):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=Ce.now(),s==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new o.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const i=this.getRenderableIds();for(let l=0;l<i.length;l++){const h=i[l];if(e.neighboringTiles&&e.neighboringTiles[h]){const f=this.getTileByID(h);s(e,f),s(f,e)}}function s(l,h){l.needsHillshadePrepare=!0,l.needsTerrainPrepare=!0;let f=h.tileID.canonical.x-l.tileID.canonical.x;const _=h.tileID.canonical.y-l.tileID.canonical.y,x=Math.pow(2,l.tileID.canonical.z),T=h.tileID.key;f===0&&_===0||Math.abs(_)>1||(Math.abs(f)>1&&(Math.abs(f+x)===1?f+=x:Math.abs(f-x)===1&&(f-=x)),h.dem&&l.dem&&(l.dem.backfillBorder(h.dem,f,_),l.neighboringTiles&&l.neighboringTiles[T]&&(l.neighboringTiles[T].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,s,l){for(const h in this._tiles){let f=this._tiles[h];if(l[h]||!f.hasData()||f.tileID.overscaledZ<=i||f.tileID.overscaledZ>s)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>i+1;){const T=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[T.key],f&&f.hasData()&&(_=T)}let x=_;for(;x.overscaledZ>i;)if(x=x.scaledTo(x.overscaledZ-1),e[x.key]||e[x.canonical.key]){l[_.key]=_;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){const s=this._loadedParentTiles[e.key];return s&&s.tileID.overscaledZ>=i?s:null}for(let s=e.overscaledZ-1;s>=i;s--){const l=e.scaledTo(s),h=this._getLoadedTile(l);if(h)return h}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,s=Math.ceil(e.height/this._source.tileSize)+1,l=Math.floor(i*s*(this._maxTileCacheZoomLevels===null?o.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),h=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,l):l;this._cache.setMaxSize(h)}handleWrapJump(e){const i=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,i){const s={};for(const l in this._tiles){const h=this._tiles[l];h.tileID=h.tileID.unwrapTo(h.tileID.wrap+i),s[h.tileID.key]=h}this._tiles=s;for(const l in this._timers)clearTimeout(this._timers[l]),delete this._timers[l];for(const l in this._tiles)this._setTileReloadTimer(l,this._tiles[l])}}_updateCoveredAndRetainedTiles(e,i,s,l,h,f){const _={},x={},T=Object.keys(e),M=Ce.now();for(const E of T){const I=e[E],k=this._tiles[E];if(!k||k.fadeEndTime!==0&&k.fadeEndTime<=M)continue;const O=this.findLoadedParent(I,i),q=this.findLoadedSibling(I),G=O||q||null;G&&(this._addTile(G.tileID),_[G.tileID.key]=G.tileID),x[E]=I}this._retainLoadedChildren(x,l,s,e);for(const E in _)e[E]||(this._coveredTiles[E]=!0,e[E]=_[E]);if(f){const E={},I={};for(const k of h)this._tiles[k.key].hasData()?E[k.key]=k:I[k.key]=k;for(const k in I){const O=I[k].children(this._source.maxzoom);this._tiles[O[0].key]&&this._tiles[O[1].key]&&this._tiles[O[2].key]&&this._tiles[O[3].key]&&(E[O[0].key]=e[O[0].key]=O[0],E[O[1].key]=e[O[1].key]=O[1],E[O[2].key]=e[O[2].key]=O[2],E[O[3].key]=e[O[3].key]=O[3],delete I[k])}for(const k in I){const O=I[k],q=this.findLoadedParent(O,this._source.minzoom),G=this.findLoadedSibling(O),W=q||G||null;if(W){E[W.tileID.key]=e[W.tileID.key]=W.tileID;for(const X in E)E[X].isChildOf(W.tileID)&&delete E[X]}}for(const k in this._tiles)E[k]||(this._coveredTiles[k]=!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(M=>new o.Z(M.canonical.z,M.wrap,M.canonical.z,M.canonical.x,M.canonical.y)):(s=we(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(M=>this._source.hasTile(M)))):s=[];const l=Se(e,this._source),h=Math.max(l-Me.maxOverzooming,this._source.minzoom),f=Math.max(l+Me.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const M={};for(const E of s)if(E.canonical.z>this._source.minzoom){const I=E.scaledTo(E.canonical.z-1);M[I.key]=I;const k=E.scaledTo(Math.max(this._source.minzoom,Math.min(E.canonical.z,5)));M[k.key]=k}s=s.concat(Object.values(M))}const _=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new o.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const x=this._updateRetainedTiles(s,l);$e(this._source.type)&&this._updateCoveredAndRetainedTiles(x,h,f,l,s,i);for(const M in x)this._tiles[M].clearFadeHold();const T=o.al(this._tiles,x);for(const M of T){const E=this._tiles[M];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.symbolFadeFinished()||this._removeTile(M)}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-Me.maxOverzooming,this._source.minzoom),_=Math.max(i+Me.maxUnderzooming,this._source.minzoom),x={};for(const T of e){const M=this._addTile(T);l[T.key]=T,M.hasData()||i<this._source.maxzoom&&(x[T.key]=T)}this._retainLoadedChildren(x,i,_,l);for(const T of e){let M=this._tiles[T.key];if(M.hasData())continue;if(i+1>this._source.maxzoom){const I=T.children(this._source.maxzoom)[0],k=this.getTile(I);if(k&&k.hasData()){l[I.key]=I;continue}}else{const I=T.children(this._source.maxzoom);if(l[I[0].key]&&l[I[1].key]&&l[I[2].key]&&l[I[3].key])continue}let E=M.wasRequested();for(let I=T.overscaledZ-1;I>=f;--I){const k=T.scaledTo(I);if(h[k.key])break;if(h[k.key]=!0,M=this.getTile(k),!M&&E&&(M=this._addTile(k)),M){const O=M.hasData();if((O||!(!((s=this.map)===null||s===void 0)&&s.cancelPendingTileRequestsWhileZooming)||E)&&(l[k.key]=k),E=M.wasRequested(),O)break}}}return l}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const i=[];let s,l=this._tiles[e].tileID;for(;l.overscaledZ>0;){if(l.key in this._loadedParentTiles){s=this._loadedParentTiles[l.key];break}i.push(l.key);const h=l.scaledTo(l.overscaledZ-1);if(s=this._getLoadedTile(h),s)break;l=h}for(const h of i)this._loadedParentTiles[h]=s}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const i=this._tiles[e].tileID,s=this._getLoadedTile(i);this._loadedSiblingTiles[i.key]=s}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const s=i;return i||(i=new Je(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._tiles[e.key]=i,s||this._source.fire(new o.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const s=i.getExpiryTimeout();s&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},s))}refreshTiles(e){for(const i in this._tiles)(this._isIdRenderable(i)||this._tiles[i].state=="errored")&&e.some(s=>s.equals(this._tiles[i].tileID.canonical))&&this._reloadTile(i,"expired")}_removeTile(e){const i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&i.state!=="reloading"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(e){const i=e.sourceDataType;e.dataType==="source"&&i==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&i==="content"&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,i,s){const l=[],h=this.transform;if(!h)return l;const f=h.getCoveringTilesDetailsProvider().allowWorldCopies(),_=s?h.getCameraQueryGeometry(e):e,x=k=>h.screenPointToMercatorCoordinate(k,this.terrain),T=this.transformBbox(e,x,!f),M=this.transformBbox(_,x,!f),E=this.getIds(),I=o.a1.fromPoints(M);for(let k=0;k<E.length;k++){const O=this._tiles[E[k]];if(O.holdingForFade())continue;const q=f?[O.tileID]:[O.tileID.unwrapTo(-1),O.tileID.unwrapTo(0)],G=Math.pow(2,h.zoom-O.tileID.overscaledZ),W=i*O.queryPadding*o.$/O.tileSize/G;for(const X of q){const ee=I.map(Y=>X.getTilePoint(new o.a0(Y.x,Y.y)));if(ee.expandBy(W),ee.intersects(de)){const Y=T.map(ne=>X.getTilePoint(ne)),ie=M.map(ne=>X.getTilePoint(ne));l.push({tile:O,tileID:f?X:X.unwrapTo(0),queryGeometry:Y,cameraQueryGeometry:ie,scale:G})}}}return l}transformBbox(e,i,s){let l=e.map(i);if(s){const h=o.a1.fromPoints(e);h.shrinkBy(.001*Math.min(h.width(),h.height()));const f=h.map(i);o.a1.fromPoints(l).covers(f)||(l=l.map(_=>_.x>.5?new o.a0(_.x-1,_.y,_.z):_))}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($e(this._source.type)){const e=Ce.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 ae(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 $e(u){return u==="raster"||u==="image"||u==="video"}Me.maxOverzooming=10,Me.maxUnderzooming=3;class at{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.ag(e,0,1);let i=1,s=this._distances[i];const l=e*this.paddedLength+this.padding;for(;s<l&&i<this._distances.length;)s=this._distances[++i];const h=i-1,f=this._distances[h],_=s-f,x=_>0?(l-f)/_:0;return this.points[h].mult(1-x).add(this.points[i].mult(x))}}function qe(u,e){let i=!0;return u==="always"||u!=="never"&&e!=="never"||(i=!1),i}class et{constructor(e,i,s){const l=this.boxCells=[],h=this.circleCells=[];this.xCellCount=Math.ceil(e/s),this.yCellCount=Math.ceil(i/s);for(let f=0;f<this.xCellCount*this.yCellCount;f++)l.push([]),h.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=i,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,i,s,l,h){this._forEachCell(i,s,l,h,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(h)}insertCircle(e,i,s,l){this._forEachCell(i-l,s-l,i+l,s+l,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(i),this.circles.push(s),this.circles.push(l)}_insertBoxCell(e,i,s,l,h,f){this.boxCells[h].push(f)}_insertCircleCell(e,i,s,l,h,f){this.circleCells[h].push(f)}_query(e,i,s,l,h,f,_){if(s<0||e>this.width||l<0||i>this.height)return[];const x=[];if(e<=0&&i<=0&&this.width<=s&&this.height<=l){if(h)return[{key:null,x1:e,y1:i,x2:s,y2:l}];for(let T=0;T<this.boxKeys.length;T++)x.push({key:this.boxKeys[T],x1:this.bboxes[4*T],y1:this.bboxes[4*T+1],x2:this.bboxes[4*T+2],y2:this.bboxes[4*T+3]});for(let T=0;T<this.circleKeys.length;T++){const M=this.circles[3*T],E=this.circles[3*T+1],I=this.circles[3*T+2];x.push({key:this.circleKeys[T],x1:M-I,y1:E-I,x2:M+I,y2:E+I})}}else this._forEachCell(e,i,s,l,this._queryCell,x,{hitTest:h,overlapMode:f,seenUids:{box:{},circle:{}}},_);return x}query(e,i,s,l){return this._query(e,i,s,l,!1,null)}hitTest(e,i,s,l,h,f){return this._query(e,i,s,l,!0,h,f).length>0}hitTestCircle(e,i,s,l,h){const f=e-s,_=e+s,x=i-s,T=i+s;if(_<0||f>this.width||T<0||x>this.height)return!1;const M=[];return this._forEachCell(f,x,_,T,this._queryCellCircle,M,{hitTest:!0,overlapMode:l,circle:{x:e,y:i,radius:s},seenUids:{box:{},circle:{}}},h),M.length>0}_queryCell(e,i,s,l,h,f,_,x){const{seenUids:T,hitTest:M,overlapMode:E}=_,I=this.boxCells[h];if(I!==null){const O=this.bboxes;for(const q of I)if(!T.box[q]){T.box[q]=!0;const G=4*q,W=this.boxKeys[q];if(e<=O[G+2]&&i<=O[G+3]&&s>=O[G+0]&&l>=O[G+1]&&(!x||x(W))&&(!M||!qe(E,W.overlapMode))&&(f.push({key:W,x1:O[G],y1:O[G+1],x2:O[G+2],y2:O[G+3]}),M))return!0}}const k=this.circleCells[h];if(k!==null){const O=this.circles;for(const q of k)if(!T.circle[q]){T.circle[q]=!0;const G=3*q,W=this.circleKeys[q];if(this._circleAndRectCollide(O[G],O[G+1],O[G+2],e,i,s,l)&&(!x||x(W))&&(!M||!qe(E,W.overlapMode))){const X=O[G],ee=O[G+1],Y=O[G+2];if(f.push({key:W,x1:X-Y,y1:ee-Y,x2:X+Y,y2:ee+Y}),M)return!0}}}return!1}_queryCellCircle(e,i,s,l,h,f,_,x){const{circle:T,seenUids:M,overlapMode:E}=_,I=this.boxCells[h];if(I!==null){const O=this.bboxes;for(const q of I)if(!M.box[q]){M.box[q]=!0;const G=4*q,W=this.boxKeys[q];if(this._circleAndRectCollide(T.x,T.y,T.radius,O[G+0],O[G+1],O[G+2],O[G+3])&&(!x||x(W))&&!qe(E,W.overlapMode))return f.push(!0),!0}}const k=this.circleCells[h];if(k!==null){const O=this.circles;for(const q of k)if(!M.circle[q]){M.circle[q]=!0;const G=3*q,W=this.circleKeys[q];if(this._circlesCollide(O[G],O[G+1],O[G+2],T.x,T.y,T.radius)&&(!x||x(W))&&!qe(E,W.overlapMode))return f.push(!0),!0}}}_forEachCell(e,i,s,l,h,f,_,x){const T=this._convertToXCellCoord(e),M=this._convertToYCellCoord(i),E=this._convertToXCellCoord(s),I=this._convertToYCellCoord(l);for(let k=T;k<=E;k++)for(let O=M;O<=I;O++)if(h.call(this,e,i,s,l,this.xCellCount*O+k,f,_,x))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,i,s,l,h,f){const _=l-e,x=h-i,T=s+f;return T*T>_*_+x*x}_circleAndRectCollide(e,i,s,l,h,f,_){const x=(f-l)/2,T=Math.abs(e-(l+x));if(T>x+s)return!1;const M=(_-h)/2,E=Math.abs(i-(h+M));if(E>M+s)return!1;if(T<=x||E<=M)return!0;const I=T-x,k=E-M;return I*I+k*k<=s*s}}function lt(u,e,i){const s=o.L();if(!u){const{vecSouth:E,vecEast:I}=Ot(e),k=xe();k[0]=I[0],k[1]=I[1],k[2]=E[0],k[3]=E[1],l=k,(M=(f=(h=k)[0])*(T=h[3])-(x=h[2])*(_=h[1]))&&(l[0]=T*(M=1/M),l[1]=-_*M,l[2]=-x*M,l[3]=f*M),s[0]=k[0],s[1]=k[1],s[4]=k[2],s[5]=k[3]}var l,h,f,_,x,T,M;return o.N(s,s,[1/i,1/i,1]),s}function qt(u,e,i,s){if(u){const l=o.L();if(!e){const{vecSouth:h,vecEast:f}=Ot(i);l[0]=f[0],l[1]=f[1],l[4]=h[0],l[5]=h[1]}return o.N(l,l,[s,s,1]),l}return i.pixelsToClipSpaceMatrix}function Ot(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.aq();f[0]=-l*s*i-h*e,f[1]=-h*s*i+l*e;const _=o.ar(f);_<1e-9?o.as(f):o.at(f,f,1/_);const x=o.aq();x[0]=l*s*e-h*i,x[1]=h*s*e+l*i;const T=o.ar(x);return T<1e-9?o.as(x):o.at(x,x,1/T),{vecEast:x,vecSouth:f}}function At(u,e,i,s){let l;s?(l=[u,e,s(u,e),1],o.av(l,l,i)):(l=[u,e,0,1],da(l,l,i));const h=l[3];return{point:new o.P(l[0]/h,l[1]/h),signedDistanceFromCamera:h,isOccluded:!1}}function ot(u,e){return .5+u/e*.5}function St(u,e){return u.x>=-e[0]&&u.x<=e[0]&&u.y>=-e[1]&&u.y<=e[1]}function Ai(u,e,i,s,l,h,f,_,x,T,M,E,I){const k=i?u.textSizeData:u.iconSizeData,O=o.am(k,e.transform.zoom),q=[256/e.width*2+1,256/e.height*2+1],G=i?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;G.clear();const W=u.lineVertexArray,X=i?u.text.placedSymbolArray:u.icon.placedSymbolArray,ee=e.transform.width/e.transform.height;let Y=!1;for(let ie=0;ie<X.length;ie++){const ne=X.get(ie);if(ne.hidden||ne.writingMode===o.an.vertical&&!Y){In(ne.numGlyphs,G);continue}Y=!1;const K=new o.P(ne.anchorX,ne.anchorY),le={getElevation:I,pitchedLabelPlaneMatrix:s,lineVertexArray:W,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:K,unwrappedTileID:x,width:T,height:M,translation:E},ye=gt(ne.anchorX,ne.anchorY,le);if(!St(ye.point,q)){In(ne.numGlyphs,G);continue}const pe=ot(e.transform.cameraToCenterDistance,ye.signedDistanceFromCamera),me=o.ao(k,O,ne),ve=h?me*e.transform.getPitchedTextCorrection(ne.anchorX,ne.anchorY,x)/pe:me*pe,je=ti({projectionContext:le,pitchedLabelPlaneMatrixInverse:l,symbol:ne,fontSize:ve,flip:!1,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:G,aspectRatio:ee,rotateToLine:_});Y=je.useVertical,(je.notEnoughRoom||Y||je.needsFlipping&&ti({projectionContext:le,pitchedLabelPlaneMatrixInverse:l,symbol:ne,fontSize:ve,flip:!0,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:G,aspectRatio:ee,rotateToLine:_}).notEnoughRoom)&&In(ne.numGlyphs,G)}i?u.text.dynamicLayoutVertexBuffer.updateData(G):u.icon.dynamicLayoutVertexBuffer.updateData(G)}function Be(u,e,i,s,l,h,f,_){const x=h.glyphStartIndex+h.numGlyphs,T=h.lineStartIndex,M=h.lineStartIndex+h.lineLength,E=e.getoffsetX(h.glyphStartIndex),I=e.getoffsetX(x-1),k=_n(u*E,i,s,l,h.segment,T,M,_,f);if(!k)return null;const O=_n(u*I,i,s,l,h.segment,T,M,_,f);return O?_.projectionCache.anyProjectionOccluded?null:{first:k,last:O}:null}function Gi(u,e,i,s){return u===o.an.horizontal&&Math.abs(i.y-e.y)>Math.abs(i.x-e.x)*s?{useVertical:!0}:(u===o.an.vertical?e.y<i.y:e.x>i.x)?{needsFlipping:!0}:null}function ti(u){const{projectionContext:e,pitchedLabelPlaneMatrixInverse:i,symbol:s,fontSize:l,flip:h,keepUpright:f,glyphOffsetArray:_,dynamicLayoutVertexArray:x,aspectRatio:T,rotateToLine:M}=u,E=l/24,I=s.lineOffsetX*E,k=s.lineOffsetY*E;let O;if(s.numGlyphs>1){const q=s.glyphStartIndex+s.numGlyphs,G=s.lineStartIndex,W=s.lineStartIndex+s.lineLength,X=Be(E,_,I,k,h,s,M,e);if(!X)return{notEnoughRoom:!0};const ee=mt(X.first.point.x,X.first.point.y,e,i),Y=mt(X.last.point.x,X.last.point.y,e,i);if(f&&!h){const ie=Gi(s.writingMode,ee,Y,T);if(ie)return ie}O=[X.first];for(let ie=s.glyphStartIndex+1;ie<q-1;ie++){const ne=_n(E*_.getoffsetX(ie),I,k,h,s.segment,G,W,e,M);if(!ne)return{notEnoughRoom:!0};O.push(ne)}O.push(X.last)}else{if(f&&!h){const G=Ne(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,W=s.lineStartIndex+s.segment+1,X=new o.P(e.lineVertexArray.getx(W),e.lineVertexArray.gety(W)),ee=Ne(X.x,X.y,e),Y=ee.signedDistanceFromCamera>0?ee.point:Wn(e.tileAnchorPoint,X,G,1,e),ie=mt(G.x,G.y,e,i),ne=mt(Y.x,Y.y,e,i),K=Gi(s.writingMode,ie,ne,T);if(K)return K}const q=_n(E*_.getoffsetX(s.glyphStartIndex),I,k,h,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,e,M);if(!q||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};O=[q]}for(const q of O)o.au(x,q.point,q.angle);return{}}function Wn(u,e,i,s,l){const h=u.add(u.sub(e)._unit()),f=Ne(h.x,h.y,l).point,_=i.sub(f);return i.add(_._mult(s/_.mag()))}function ha(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=Ne(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 Wn(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 Ne(u,e,i){const s=u+i.translation[0],l=e+i.translation[1];let h;return i.pitchWithMap?(h=At(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 mt(u,e,i,s){if(i.pitchWithMap){const l=[u,e,0,1];return o.av(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 gt(u,e,i){return i.transform.projectTileCoordinates(u,e,i.unwrappedTileID,i.getElevation)}function kr(u,e,i){return u._unit()._perp()._mult(e*i)}function Io(u,e,i,s,l,h,f,_,x){if(_.projectionCache.offsets[u])return _.projectionCache.offsets[u];const T=i.add(e);if(u+x.direction<s||u+x.direction>=l)return _.projectionCache.offsets[u]=T,T;const M=ha(u+x.direction,_,x),E=kr(M.sub(i),f,x.direction),I=i.add(E),k=M.add(E);return _.projectionCache.offsets[u]=o.aw(h,T,I,k)||T,_.projectionCache.offsets[u]}function _n(u,e,i,s,l,h,f,_,x){const T=s?u-e:u+e;let M=T>0?1:-1,E=0;s&&(M*=-1,E=Math.PI),M<0&&(E+=Math.PI);let I,k=M>0?h+l:h+l+1;_.projectionCache.cachedAnchorPoint?I=_.projectionCache.cachedAnchorPoint:(I=Ne(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=I);let O,q,G=I,W=I,X=0,ee=0;const Y=Math.abs(T),ie=[];let ne;for(;X+ee<=Y;){if(k+=M,k<h||k>=f)return null;X+=ee,W=G,q=O;const ye={absOffsetX:Y,direction:M,distanceFromAnchor:X,previousVertex:W};if(G=ha(k,_,ye),i===0)ie.push(W),ne=G.sub(W);else{let pe;const me=G.sub(W);pe=me.mag()===0?kr(ha(k+M,_,ye).sub(G),i,M):kr(me,i,M),q||(q=W.add(pe)),O=Io(k,pe,G,h,f,q,i,_,ye),ie.push(q),ne=O.sub(q)}ee=ne.mag()}const K=ne._mult((Y-X)/ee)._add(q||W),le=E+Math.atan2(G.y-W.y,G.x-W.x);return ie.push(K),{point:K,angle:x?le:0,path:ie}}const _t=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function In(u,e){for(let i=0;i<u;i++){const s=e.length;e.resize(s+4),e.float32.set(_t,3*s)}}function da(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 yi=100;class Ts{constructor(e,i=new et(e.width+200,e.height+200,25),s=new et(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+yi,this.screenBottomBoundary=e.height+yi,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,i,s,l,h,f,_,x,T,M,E,I){const k=this.projectAndGetPerspectiveRatio(e.anchorPointX+x[0],e.anchorPointY+x[1],h,M,I),O=s*k.perspectiveRatio;let q;if(f||_)q=this._projectCollisionBox(e,O,l,h,f,_,x,k,M,E,I);else{const ne=k.x+(E?E.x*O:0),K=k.y+(E?E.y*O:0);q={allPointsOccluded:!1,box:[ne+e.x1*O,K+e.y1*O,ne+e.x2*O,K+e.y2*O]}}const[G,W,X,ee]=q.box,Y=f?q.allPointsOccluded:k.isOccluded;let ie=Y;return ie||(ie=k.perspectiveRatio<this.perspectiveRatioCutoff),ie||(ie=!this.isInsideGrid(G,W,X,ee)),ie||i!=="always"&&this.grid.hitTest(G,W,X,ee,i,T)?{box:[G,W,X,ee],placeable:!1,offscreen:!1,occluded:Y}:{box:[G,W,X,ee],placeable:!0,offscreen:this.isOffscreen(G,W,X,ee),occluded:Y}}placeCollisionCircles(e,i,s,l,h,f,_,x,T,M,E,I,k,O){const q=[],G=new o.P(i.anchorX,i.anchorY),W=this.getPerspectiveRatio(G.x,G.y,f,O),X=(T?h*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,f)/W:h*W)/o.aA,ee={getElevation:O,pitchedLabelPlaneMatrix:_,lineVertexArray:s,pitchWithMap:T,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:G,unwrappedTileID:f,width:this.transform.width,height:this.transform.height,translation:k},Y=Be(X,l,i.lineOffsetX*X,i.lineOffsetY*X,!1,i,!1,ee);let ie=!1,ne=!1,K=!0;if(Y){const le=.5*E*W+I,ye=new o.P(-100,-100),pe=new o.P(this.screenRightBoundary,this.screenBottomBoundary),me=new at,ve=Y.first,je=Y.last;let Fe=[];for(let ht=ve.path.length-1;ht>=1;ht--)Fe.push(ve.path[ht]);for(let ht=1;ht<je.path.length;ht++)Fe.push(je.path[ht]);const Ee=2.5*le;if(T){const ht=this.projectPathToScreenSpace(Fe,ee);Fe=ht.some(Lt=>Lt.signedDistanceFromCamera<=0)?[]:ht.map(Lt=>Lt.point)}let We=[];if(Fe.length>0){const ht=Fe[0].clone(),Lt=Fe[0].clone();for(let ai=1;ai<Fe.length;ai++)ht.x=Math.min(ht.x,Fe[ai].x),ht.y=Math.min(ht.y,Fe[ai].y),Lt.x=Math.max(Lt.x,Fe[ai].x),Lt.y=Math.max(Lt.y,Fe[ai].y);We=ht.x>=ye.x&&Lt.x<=pe.x&&ht.y>=ye.y&&Lt.y<=pe.y?[Fe]:Lt.x<ye.x||ht.x>pe.x||Lt.y<ye.y||ht.y>pe.y?[]:o.ax([Fe],ye.x,ye.y,pe.x,pe.y)}for(const ht of We){me.reset(ht,.25*le);let Lt=0;Lt=me.length<=.5*le?1:Math.ceil(me.paddedLength/Ee)+1;for(let ai=0;ai<Lt;ai++){const Zt=ai/Math.max(Lt-1,1),si=me.lerp(Zt),$t=si.x+yi,Ut=si.y+yi;q.push($t,Ut,le,0);const Gt=$t-le,Wi=Ut-le,Ct=$t+le,Di=Ut+le;if(K=K&&this.isOffscreen(Gt,Wi,Ct,Di),ne=ne||this.isInsideGrid(Gt,Wi,Ct,Di),e!=="always"&&this.grid.hitTestCircle($t,Ut,le,e,M)&&(ie=!0,!x))return{circles:[],offscreen:!1,collisionDetected:ie}}}}return{circles:!x&&ie||!ne||W<this.perspectiveRatioCutoff?[]:q,offscreen:K,collisionDetected:ie}}projectPathToScreenSpace(e,i){const s=function(l,h){const f=o.L();return o.ap(f,h.pitchedLabelPlaneMatrix),l.map(_=>{const x=At(_.x,_.y,f,h.getElevation),T=h.transform.projectTileCoordinates(x.point.x,x.point.y,h.unwrappedTileID,h.getElevation);return T.point.x=(.5*T.point.x+.5)*h.width,T.point.y=(.5*-T.point.y+.5)*h.height,T})}(e,i);return function(l){let h=0,f=0,_=0,x=0;for(let T=0;T<l.length;T++)l[T].isOccluded?(_=T+1,x=0):(x++,x>f&&(f=x,h=_));return l.slice(h,h+f)}(s)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const i=[],s=new o.a1;for(const E of e){const I=new o.P(E.x+yi,E.y+yi);s.extend(I),i.push(I)}const{minX:l,minY:h,maxX:f,maxY:_}=s,x=this.grid.query(l,h,f,_).concat(this.ignoredGrid.query(l,h,f,_)),T={},M={};for(const E of x){const I=E.key;if(T[I.bucketInstanceId]===void 0&&(T[I.bucketInstanceId]={}),T[I.bucketInstanceId][I.featureIndex])continue;const k=[new o.P(E.x1,E.y1),new o.P(E.x2,E.y1),new o.P(E.x2,E.y2),new o.P(E.x1,E.y2)];o.ay(i,k)&&(T[I.bucketInstanceId][I.featureIndex]=!0,M[I.bucketInstanceId]===void 0&&(M[I.bucketInstanceId]=[]),M[I.bucketInstanceId].push(I.featureIndex))}return M}insertCollisionBox(e,i,s,l,h,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:l,featureIndex:h,collisionGroupID:f,overlapMode:i},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,i,s,l,h,f){const _=s?this.ignoredGrid:this.grid,x={bucketInstanceId:l,featureIndex:h,collisionGroupID:f,overlapMode:i};for(let T=0;T<e.length;T+=4)_.insertCircle(x,e[T],e[T+1],e[T+2])}projectAndGetPerspectiveRatio(e,i,s,l,h){if(h){let f;l?(f=[e,i,l(e,i),1],o.av(f,f,h)):(f=[e,i,0,1],da(f,f,h));const _=f[3];return{x:(f[0]/_+1)/2*this.transform.width+yi,y:(-f[1]/_+1)/2*this.transform.height+yi,perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}{const f=this.transform.projectTileCoordinates(e,i,s,l);return{x:(f.point.x+1)/2*this.transform.width+yi,y:(1-f.point.y)/2*this.transform.height+yi,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<yi||e>=this.screenRightBoundary||l<yi||i>this.screenBottomBoundary}isInsideGrid(e,i,s,l){return s>=0&&e<this.gridRightBoundary&&l>=0&&i<this.gridBottomBoundary}getViewportMatrix(){const e=o.af([]);return o.M(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,s,l,h,f,_,x,T,M,E){let I=1,k=0,O=0,q=1;const G=e.anchorPointX+_[0],W=e.anchorPointY+_[1];if(f&&!h){const Fe=this.projectAndGetPerspectiveRatio(G+1,W,l,T,E),Ee=Fe.x-x.x,We=Math.atan((Fe.y-x.y)/Ee)+(Ee<0?Math.PI:0),ht=Math.sin(We),Lt=Math.cos(We);I=Lt,k=ht,O=-ht,q=Lt}else if(!f&&h){const Fe=Ot(this.transform);I=Fe.vecEast[0],k=Fe.vecEast[1],O=Fe.vecSouth[0],q=Fe.vecSouth[1]}let X=x.x,ee=x.y,Y=i;h&&(X=G,ee=W,Y=Math.pow(2,-(this.transform.zoom-s.overscaledZ)),Y*=this.transform.getPitchedTextCorrection(G,W,l),M||(Y*=o.ag(.5+x.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),M&&(X+=I*M.x*Y+O*M.y*Y,ee+=k*M.x*Y+q*M.y*Y);const ie=e.x1*Y,ne=e.x2*Y,K=(ie+ne)/2,le=e.y1*Y,ye=e.y2*Y,pe=(le+ye)/2,me=[{offsetX:ie,offsetY:le},{offsetX:K,offsetY:le},{offsetX:ne,offsetY:le},{offsetX:ne,offsetY:pe},{offsetX:ne,offsetY:ye},{offsetX:K,offsetY:ye},{offsetX:ie,offsetY:ye},{offsetX:ie,offsetY:pe}];let ve=[];for(const{offsetX:Fe,offsetY:Ee}of me)ve.push(new o.P(X+I*Fe+O*Ee,ee+k*Fe+q*Ee));let je=!1;if(h){const Fe=ve.map(Ee=>this.projectAndGetPerspectiveRatio(Ee.x,Ee.y,l,T,E));je=Fe.some(Ee=>!Ee.isOccluded),ve=Fe.map(Ee=>new o.P(Ee.x,Ee.y))}else je=!0;return{box:o.az(ve),allPointsOccluded:!je}}}class Ss{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 En{constructor(e,i,s,l,h){this.text=new Ss(e?e.text:null,i,s,h),this.icon=new Ss(e?e.icon:null,i,l,h)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ps{constructor(e,i,s){this.text=e,this.icon=i,this.skipFade=s}}class Rr{constructor(e,i,s,l,h){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=s,this.bucketIndex=l,this.tileID=h}}class ii{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 Cu(u,e,i,s,l){const{horizontalAlign:h,verticalAlign:f}=o.aG(u);return new o.P(-(h-.5)*e+s[0]*l,-(f-.5)*i+s[1]*l)}class Ms{constructor(e,i,s,l,h){this.transform=e.clone(),this.terrain=i,this.collisionIndex=new Ts(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new ii(l),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=h,h&&(h.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const i=this.terrain;return i?(s,l)=>i.getElevation(e,s,l):null}getBucketParts(e,i,s,l){const h=s.getBucket(i),f=s.latestFeatureIndex;if(!h||!f||i.id!==h.layerIds[0])return;const _=s.collisionBoxArray,x=h.layers[0].layout,T=h.layers[0].paint,M=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),E=s.tileSize/o.$,I=s.tileID.toUnwrapped(),k=x.get("text-rotation-alignment")==="map",O=o.aB(s,1,this.transform.zoom),q=o.aC(this.collisionIndex.transform,s,T.get("text-translate"),T.get("text-translate-anchor")),G=o.aC(this.collisionIndex.transform,s,T.get("icon-translate"),T.get("icon-translate-anchor")),W=lt(k,this.transform,O);this.retainedQueryData[h.bucketInstanceId]=new Rr(h.bucketInstanceId,f,h.sourceLayerIndex,h.index,s.tileID);const X={bucket:h,layout:x,translationText:q,translationIcon:G,unwrappedTileID:I,pitchedLabelPlaneMatrix:W,scale:M,textPixelRatio:E,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:o.am(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(l)for(const ee of h.sortKeyRanges){const{sortKey:Y,symbolInstanceStart:ie,symbolInstanceEnd:ne}=ee;e.push({sortKey:Y,symbolInstanceStart:ie,symbolInstanceEnd:ne,parameters:X})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:X})}attemptAnchorPlacement(e,i,s,l,h,f,_,x,T,M,E,I,k,O,q,G,W,X,ee,Y){const ie=o.aD[e.textAnchor],ne=[e.textOffset0,e.textOffset1],K=Cu(ie,s,l,ne,h),le=this.collisionIndex.placeCollisionBox(i,I,x,T,M,_,f,G,E.predicate,ee,K,Y);if((!X||this.collisionIndex.placeCollisionBox(X,I,x,T,M,_,f,W,E.predicate,ee,K,Y).placeable)&&le.placeable){let ye;if(this.prevPlacement&&this.prevPlacement.variableOffsets[k.crossTileID]&&this.prevPlacement.placements[k.crossTileID]&&this.prevPlacement.placements[k.crossTileID].text&&(ye=this.prevPlacement.variableOffsets[k.crossTileID].anchor),k.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[k.crossTileID]={textOffset:ne,width:s,height:l,anchor:ie,textBoxScale:h,prevAnchor:ye},this.markUsedJustification(O,ie,k,q),O.allowVerticalPlacement&&(this.markUsedOrientation(O,q,k),this.placedOrientations[k.crossTileID]=q),{shift:K,placedGlyphBoxes:le}}}placeLayerBucketPart(e,i,s){const{bucket:l,layout:h,translationText:f,translationIcon:_,unwrappedTileID:x,pitchedLabelPlaneMatrix:T,textPixelRatio:M,holdingForFade:E,collisionBoxArray:I,partiallyEvaluatedTextSize:k,collisionGroup:O}=e.parameters,q=h.get("text-optional"),G=h.get("icon-optional"),W=o.aE(h,"text-overlap","text-allow-overlap"),X=W==="always",ee=o.aE(h,"icon-overlap","icon-allow-overlap"),Y=ee==="always",ie=h.get("text-rotation-alignment")==="map",ne=h.get("text-pitch-alignment")==="map",K=h.get("icon-text-fit")!=="none",le=h.get("symbol-z-order")==="viewport-y",ye=X&&(Y||!l.hasIconData()||G),pe=Y&&(X||!l.hasTextData()||q);!l.collisionArrays&&I&&l.deserializeCollisionBoxes(I);const me=this.retainedQueryData[l.bucketInstanceId].tileID,ve=this._getTerrainElevationFunc(me),je=this.transform.getFastPathSimpleProjectionMatrix(me),Fe=(Ee,We,ht)=>{var Lt,ai;if(i[Ee.crossTileID])return;if(E)return void(this.placements[Ee.crossTileID]=new Ps(!1,!1,!1));let Zt=!1,si=!1,$t=!0,Ut=null,Gt={box:null,placeable:!1,offscreen:null,occluded:!1},Wi={placeable:!1},Ct=null,Di=null,Hi=null,ta=0,ia=0,ra=0;We.textFeatureIndex?ta=We.textFeatureIndex:Ee.useRuntimeCollisionCircles&&(ta=Ee.featureIndex),We.verticalTextFeatureIndex&&(ia=We.verticalTextFeatureIndex);const Tn=We.textBox;if(Tn){const Sr=fi=>{let Ht=o.an.horizontal;if(l.allowVerticalPlacement&&!fi&&this.prevPlacement){const gr=this.prevPlacement.placedOrientations[Ee.crossTileID];gr&&(this.placedOrientations[Ee.crossTileID]=gr,Ht=gr,this.markUsedOrientation(l,Ht,Ee))}return Ht},on=(fi,Ht)=>{if(l.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&We.verticalTextBox){for(const gr of l.writingModes)if(gr===o.an.vertical?(Gt=Ht(),Wi=Gt):Gt=fi(),Gt&&Gt.placeable)break}else Gt=fi()},na=Ee.textAnchorOffsetStartIndex,Sa=Ee.textAnchorOffsetEndIndex;if(Sa===na){const fi=(Ht,gr)=>{const Ci=this.collisionIndex.placeCollisionBox(Ht,W,M,me,x,ne,ie,f,O.predicate,ve,void 0,je);return Ci&&Ci.placeable&&(this.markUsedOrientation(l,gr,Ee),this.placedOrientations[Ee.crossTileID]=gr),Ci};on(()=>fi(Tn,o.an.horizontal),()=>{const Ht=We.verticalTextBox;return l.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&Ht?fi(Ht,o.an.vertical):{box:null,offscreen:null}}),Sr(Gt&&Gt.placeable)}else{let fi=o.aD[(ai=(Lt=this.prevPlacement)===null||Lt===void 0?void 0:Lt.variableOffsets[Ee.crossTileID])===null||ai===void 0?void 0:ai.anchor];const Ht=(Ci,vh,Yd)=>{const Ic=Ci.x2-Ci.x1,ro=Ci.y2-Ci.y1,ps=Ee.textBoxScale,Dn=K&&ee==="never"?vh:null;let Xi=null,Ln=W==="never"?1:2,Ec="never";fi&&Ln++;for(let aa=0;aa<Ln;aa++){for(let zc=na;zc<Sa;zc++){const Ac=l.textAnchorOffsets.get(zc);if(fi&&Ac.textAnchor!==fi)continue;const no=this.attemptAnchorPlacement(Ac,Ci,Ic,ro,ps,ie,ne,M,me,x,O,Ec,Ee,l,Yd,f,_,Dn,ve);if(no&&(Xi=no.placedGlyphBoxes,Xi&&Xi.placeable))return Zt=!0,Ut=no.shift,Xi}fi?fi=null:Ec=W}return s&&!Xi&&(Xi={box:this.collisionIndex.placeCollisionBox(Tn,"always",M,me,x,ne,ie,f,O.predicate,ve,void 0,je).box,offscreen:!1,placeable:!1,occluded:!1}),Xi};on(()=>Ht(Tn,We.iconBox,o.an.horizontal),()=>{const Ci=We.verticalTextBox;return l.allowVerticalPlacement&&(!Gt||!Gt.placeable)&&Ee.numVerticalGlyphVertices>0&&Ci?Ht(Ci,We.verticalIconBox,o.an.vertical):{box:null,occluded:!0,offscreen:null}}),Gt&&(Zt=Gt.placeable,$t=Gt.offscreen);const gr=Sr(Gt&&Gt.placeable);if(!Zt&&this.prevPlacement){const Ci=this.prevPlacement.variableOffsets[Ee.crossTileID];Ci&&(this.variableOffsets[Ee.crossTileID]=Ci,this.markUsedJustification(l,Ci.anchor,Ee,gr))}}}if(Ct=Gt,Zt=Ct&&Ct.placeable,$t=Ct&&Ct.offscreen,Ee.useRuntimeCollisionCircles){const Sr=l.text.placedSymbolArray.get(Ee.centerJustifiedTextSymbolIndex),on=o.ao(l.textSizeData,k,Sr),na=h.get("text-padding");Di=this.collisionIndex.placeCollisionCircles(W,Sr,l.lineVertexArray,l.glyphOffsetArray,on,x,T,s,ne,O.predicate,Ee.collisionCircleDiameter,na,f,ve),Di.circles.length&&Di.collisionDetected&&!s&&o.w("Collisions detected, but collision boxes are not shown"),Zt=X||Di.circles.length>0&&!Di.collisionDetected,$t=$t&&Di.offscreen}if(We.iconFeatureIndex&&(ra=We.iconFeatureIndex),We.iconBox){const Sr=on=>this.collisionIndex.placeCollisionBox(on,ee,M,me,x,ne,ie,_,O.predicate,ve,K&&Ut?Ut:void 0,je);Wi&&Wi.placeable&&We.verticalIconBox?(Hi=Sr(We.verticalIconBox),si=Hi.placeable):(Hi=Sr(We.iconBox),si=Hi.placeable),$t=$t&&Hi.offscreen}const to=q||Ee.numHorizontalGlyphVertices===0&&Ee.numVerticalGlyphVertices===0,io=G||Ee.numIconVertices===0;to||io?io?to||(si=si&&Zt):Zt=si&&Zt:si=Zt=si&&Zt;const ds=si&&Hi.placeable;if(Zt&&Ct.placeable&&this.collisionIndex.insertCollisionBox(Ct.box,W,h.get("text-ignore-placement"),l.bucketInstanceId,Wi&&Wi.placeable&&ia?ia:ta,O.ID),ds&&this.collisionIndex.insertCollisionBox(Hi.box,ee,h.get("icon-ignore-placement"),l.bucketInstanceId,ra,O.ID),Di&&Zt&&this.collisionIndex.insertCollisionCircles(Di.circles,W,h.get("text-ignore-placement"),l.bucketInstanceId,ta,O.ID),s&&this.storeCollisionData(l.bucketInstanceId,ht,We,Ct,Hi,Di),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 Ps((Zt||ye)&&!(Ct!=null&&Ct.occluded),(si||pe)&&!(Hi!=null&&Hi.occluded),$t||l.justReloaded),i[Ee.crossTileID]=!0};if(le){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ee=l.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let We=Ee.length-1;We>=0;--We){const ht=Ee[We];Fe(l.symbolInstances.get(ht),l.collisionArrays[ht],ht)}}else for(let Ee=e.symbolInstanceStart;Ee<e.symbolInstanceEnd;Ee++)Fe(l.symbolInstances.get(Ee),l.collisionArrays[Ee],Ee);l.justReloaded=!1}storeCollisionData(e,i,s,l,h,f){if(s.textBox||s.iconBox){let _,x;this.collisionBoxArrays.has(e)?_=this.collisionBoxArrays.get(e):(_=new Map,this.collisionBoxArrays.set(e,_)),_.has(i)?x=_.get(i):(x={text:null,icon:null},_.set(i,x)),s.textBox&&(x.text=l.box),s.iconBox&&(x.icon=h.box)}if(f){let _=this.collisionCircleArrays[e];_===void 0&&(_=this.collisionCircleArrays[e]=[]);for(let x=0;x<f.circles.length;x+=4)_.push(f.circles[x+0]-yi),_.push(f.circles[x+1]-yi),_.push(f.circles[x+2]),_.push(f.collisionDetected?1:0)}}markUsedJustification(e,i,s,l){let h;h=l===o.an.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[o.aF(i)];const f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const _ of f)_>=0&&(e.text.placedSymbolArray.get(_).crossTileID=h>=0&&_!==h?0:s.crossTileID)}markUsedOrientation(e,i,s){const l=i===o.an.horizontal||i===o.an.horizontalOnly?i:0,h=i===o.an.vertical?i:0,f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of f)e.text.placedSymbolArray.get(_).placedOrientation=l;s.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=h)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const i=this.prevPlacement;let s=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;const l=i?i.symbolFadeChange(e):1,h=i?i.opacities:{},f=i?i.variableOffsets:{},_=i?i.placedOrientations:{};for(const x in this.placements){const T=this.placements[x],M=h[x];M?(this.opacities[x]=new En(M,l,T.text,T.icon),s=s||T.text!==M.text.placed||T.icon!==M.icon.placed):(this.opacities[x]=new En(null,l,T.text,T.icon,T.skipFade),s=s||T.text||T.icon)}for(const x in h){const T=h[x];if(!this.opacities[x]){const M=new En(T,l,!1,!1);M.isHidden()||(this.opacities[x]=M,s=s||T.text.placed||T.icon.placed)}}for(const x in f)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=f[x]);for(const x in _)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=_[x]);if(i&&i.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:e)}updateLayerOpacities(e,i){const s={};for(const l of i){const h=l.getBucket(e);h&&l.latestFeatureIndex&&e.id===h.layerIds[0]&&this.updateBucketOpacities(h,l.tileID,s,l.collisionBoxArray)}}updateBucketOpacities(e,i,s,l){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const h=e.layers[0],f=h.layout,_=new En(null,0,!1,!1,!0),x=f.get("text-allow-overlap"),T=f.get("icon-allow-overlap"),M=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=f.get("text-rotation-alignment")==="map",I=f.get("text-pitch-alignment")==="map",k=f.get("icon-text-fit")!=="none",O=new En(null,0,x&&(T||!e.hasIconData()||f.get("icon-optional")),T&&(x||!e.hasTextData()||f.get("text-optional")),!0);!e.collisionArrays&&l&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(l);const q=(W,X,ee)=>{for(let Y=0;Y<X/4;Y++)W.opacityVertexArray.emplaceBack(ee);W.hasVisibleVertices=W.hasVisibleVertices||ee!==Cs},G=this.collisionBoxArrays.get(e.bucketInstanceId);for(let W=0;W<e.symbolInstances.length;W++){const X=e.symbolInstances.get(W),{numHorizontalGlyphVertices:ee,numVerticalGlyphVertices:Y,crossTileID:ie}=X;let ne=this.opacities[ie];s[ie]?ne=_:ne||(ne=O,this.opacities[ie]=ne),s[ie]=!0;const K=X.numIconVertices>0,le=this.placedOrientations[X.crossTileID],ye=le===o.an.vertical,pe=le===o.an.horizontal||le===o.an.horizontalOnly;if(ee>0||Y>0){const ve=ku(ne.text);q(e.text,ee,ye?Cs:ve),q(e.text,Y,pe?Cs:ve);const je=ne.text.isHidden();[X.rightJustifiedTextSymbolIndex,X.centerJustifiedTextSymbolIndex,X.leftJustifiedTextSymbolIndex].forEach(We=>{We>=0&&(e.text.placedSymbolArray.get(We).hidden=je||ye?1:0)}),X.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(X.verticalPlacedTextSymbolIndex).hidden=je||pe?1:0);const Fe=this.variableOffsets[X.crossTileID];Fe&&this.markUsedJustification(e,Fe.anchor,X,le);const Ee=this.placedOrientations[X.crossTileID];Ee&&(this.markUsedJustification(e,"left",X,Ee),this.markUsedOrientation(e,Ee,X))}if(K){const ve=ku(ne.icon),je=!(k&&X.verticalPlacedIconSymbolIndex&&ye);X.placedIconSymbolIndex>=0&&(q(e.icon,X.numIconVertices,je?ve:Cs),e.icon.placedSymbolArray.get(X.placedIconSymbolIndex).hidden=ne.icon.isHidden()),X.verticalPlacedIconSymbolIndex>=0&&(q(e.icon,X.numVerticalIconVertices,je?Cs:ve),e.icon.placedSymbolArray.get(X.verticalPlacedIconSymbolIndex).hidden=ne.icon.isHidden())}const me=G&&G.has(W)?G.get(W):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const ve=e.collisionArrays[W];if(ve){let je=new o.P(0,0);if(ve.textBox||ve.verticalTextBox){let Fe=!0;if(M){const Ee=this.variableOffsets[ie];Ee?(je=Cu(Ee.anchor,Ee.width,Ee.height,Ee.textOffset,Ee.textBoxScale),E&&je._rotate(I?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Fe=!1}if(ve.textBox||ve.verticalTextBox){let Ee;ve.textBox&&(Ee=ye),ve.verticalTextBox&&(Ee=pe),Eo(e.textCollisionBox.collisionVertexArray,ne.text.placed,!Fe||Ee,me.text,je.x,je.y)}}if(ve.iconBox||ve.verticalIconBox){const Fe=!!(!pe&&ve.verticalIconBox);let Ee;ve.iconBox&&(Ee=Fe),ve.verticalIconBox&&(Ee=!Fe),Eo(e.iconCollisionBox.collisionVertexArray,ne.icon.placed,Ee,me.icon,k?je.x:0,k?je.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 Eo(u,e,i,s,l,h){s&&s.length!==0||(s=[0,0,0,0]);const f=s[0]-yi,_=s[1]-yi,x=s[2]-yi,T=s[3]-yi;u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,x,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,x,T),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,T)}const pa=Math.pow(2,25),Hn=Math.pow(2,24),Iu=Math.pow(2,17),Eu=Math.pow(2,16),zu=Math.pow(2,9),Na=Math.pow(2,8),Au=Math.pow(2,1);function ku(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*pa+e*Hn+i*Iu+e*Eu+i*zu+e*Na+i*Au+e}const Cs=0;class Sd{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,i,s,l,h){const f=this._bucketParts;for(;this._currentTileIndex<e.length;)if(i.getBucketParts(f,l,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,h())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,f.sort((_,x)=>_.sortKey-x.sortKey));this._currentPartIndex<f.length;)if(i.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,h())return!0;return!1}}class Ru{constructor(e,i,s,l,h,f,_,x){this.placement=new Ms(e,i,f,_,x),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=l,this._showCollisionBoxes=h,this._done=!1}isDone(){return this._done}continuePlacement(e,i,s){const l=Ce.now(),h=()=>!this._forceFullPlacement&&Ce.now()-l>2;for(;this._currentPlacementIndex>=0;){const f=i[e[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=_)&&(!f.maxzoom||f.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new Sd(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 Va=512/o.$/2;class Fl{constructor(e,i,s){this.tileID=e,this.bucketInstanceId=s,this._symbolsByKey={};const l=new Map;for(let h=0;h<i.length;h++){const f=i.get(h),_=f.key,x=l.get(_);x?x.push(f):l.set(_,[f])}for(const[h,f]of l){const _={positions:f.map(x=>({x:Math.floor(x.anchorX*Va),y:Math.floor(x.anchorY*Va)})),crossTileIDs:f.map(x=>x.crossTileID)};if(_.positions.length>128){const x=new o.aH(_.positions.length,16,Uint16Array);for(const{x:T,y:M}of _.positions)x.add(T,M);x.finish(),delete _.positions,_.index=x}this._symbolsByKey[h]=_}}getScaledCoordinates(e,i){const{x:s,y:l,z:h}=this.tileID.canonical,{x:f,y:_,z:x}=i.canonical,T=Va/Math.pow(2,x-h),M=(_*o.$+e.anchorY)*T,E=l*o.$*Va;return{x:Math.floor((f*o.$+e.anchorX)*T-s*o.$*Va),y:Math.floor(M-E)}}findMatches(e,i,s){const l=this.tileID.canonical.z<i.canonical.z?1:Math.pow(2,this.tileID.canonical.z-i.canonical.z);for(let h=0;h<e.length;h++){const f=e.get(h);if(f.crossTileID)continue;const _=this._symbolsByKey[f.key];if(!_)continue;const x=this.getScaledCoordinates(f,i);if(_.index){const T=_.index.range(x.x-l,x.y-l,x.x+l,x.y+l).sort();for(const M of T){const E=_.crossTileIDs[M];if(!s[E]){s[E]=!0,f.crossTileID=E;break}}}else if(_.positions)for(let T=0;T<_.positions.length;T++){const M=_.positions[T],E=_.crossTileIDs[T];if(Math.abs(M.x-x.x)<=l&&Math.abs(M.y-x.y)<=l&&!s[E]){s[E]=!0,f.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class Ol{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Du{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const i=Math.round((e-this.lng)/360);if(i!==0)for(const s in this.indexes){const l=this.indexes[s],h={};for(const f in l){const _=l[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+i),h[_.tileID.key]=_}this.indexes[s]=h}this.lng=e}addBucket(e,i,s){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let h=0;h<i.symbolInstances.length;h++)i.symbolInstances.get(h).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const l=this.usedCrossTileIDs[e.overscaledZ];for(const h in this.indexes){const f=this.indexes[h];if(Number(h)>e.overscaledZ)for(const _ in f){const x=f[_];x.tileID.isChildOf(e)&&x.findMatches(i.symbolInstances,e,l)}else{const _=f[e.scaledTo(Number(h)).key];_&&_.findMatches(i.symbolInstances,e,l)}}for(let h=0;h<i.symbolInstances.length;h++){const f=i.symbolInstances.get(h);f.crossTileID||(f.crossTileID=s.generate(),l[f.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Fl(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 zo{constructor(){this.layerIndexes={},this.crossTileIDs=new Ol,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,s){let l=this.layerIndexes[e.id];l===void 0&&(l=this.layerIndexes[e.id]=new Du);let h=!1;const f={};l.handleWrapJump(s);for(const _ of i){const x=_.getBucket(e);x&&e.id===x.layerIds[0]&&(x.bucketInstanceId||(x.bucketInstanceId=++this.maxBucketInstanceId),l.addBucket(_.tileID,x,this.crossTileIDs)&&(h=!0),f[x.bucketInstanceId]=!0)}return l.removeStaleBuckets(f)&&(h=!0),h}pruneUnusedLayers(e){const i={};e.forEach(s=>{i[s]=!0});for(const s in this.layerIndexes)i[s]||delete this.layerIndexes[s]}}var Ao="void main() {fragColor=vec4(1.0);}";const yn={prelude:yt(`#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:yt("","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:yt("",`#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:yt(`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:yt(`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:yt(`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:yt(Ao,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:yt(`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:yt(`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:yt("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:yt("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);}"),colorRelief:yt(`#ifdef GL_ES
157
- precision highp float;
158
- #endif
159
- uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(textureSize(u_elevation_stops,0)[0]);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int num_elevation_stops=textureSize(u_elevation_stops,0)[0];int r=(num_elevation_stops-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else
160
- {l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(textureSize(u_color_stops,0)[0]);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));
161
- #ifdef OVERDRAW_INSPECTOR
162
- fragColor=vec4(1.0);
163
- #endif
164
- }`,"uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:yt("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:yt(Ao,`in vec2 a_pos;void main() {
165
- #ifdef GLOBE
166
- gl_Position=projectTileFor3D(a_pos,0.0);
167
- #else
168
- gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
169
- #endif
170
- }`),fill:yt(`#pragma mapbox: define highp vec4 color
171
- #pragma mapbox: define lowp float opacity
172
- void main() {
173
- #pragma mapbox: initialize highp vec4 color
174
- #pragma mapbox: initialize lowp float opacity
175
- fragColor=color*opacity;
176
- #ifdef OVERDRAW_INSPECTOR
177
- fragColor=vec4(1.0);
178
- #endif
179
- }`,`uniform vec2 u_fill_translate;in vec2 a_pos;
180
- #pragma mapbox: define highp vec4 color
181
- #pragma mapbox: define lowp float opacity
182
- void main() {
183
- #pragma mapbox: initialize highp vec4 color
184
- #pragma mapbox: initialize lowp float opacity
185
- gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:yt(`in vec2 v_pos;
186
- #ifdef GLOBE
187
- in float v_depth;
188
- #endif
189
- #pragma mapbox: define highp vec4 outline_color
190
- #pragma mapbox: define lowp float opacity
191
- void main() {
192
- #pragma mapbox: initialize highp vec4 outline_color
193
- #pragma mapbox: initialize lowp float opacity
194
- float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
195
- #ifdef GLOBE
196
- if (v_depth > 1.0) {discard;}
197
- #endif
198
- #ifdef OVERDRAW_INSPECTOR
199
- fragColor=vec4(1.0);
200
- #endif
201
- }`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
202
- #ifdef GLOBE
203
- out float v_depth;
204
- #endif
205
- #pragma mapbox: define highp vec4 outline_color
206
- #pragma mapbox: define lowp float opacity
207
- void main() {
208
- #pragma mapbox: initialize highp vec4 outline_color
209
- #pragma mapbox: initialize lowp float opacity
210
- gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
211
- #ifdef GLOBE
212
- v_depth=gl_Position.z/gl_Position.w;
213
- #endif
214
- }`),fillOutlinePattern:yt(`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;
215
- #ifdef GLOBE
216
- in float v_depth;
217
- #endif
218
- #pragma mapbox: define lowp float opacity
219
- #pragma mapbox: define lowp vec4 pattern_from
220
- #pragma mapbox: define lowp vec4 pattern_to
221
- void main() {
222
- #pragma mapbox: initialize lowp float opacity
223
- #pragma mapbox: initialize mediump vec4 pattern_from
224
- #pragma mapbox: initialize mediump vec4 pattern_to
225
- 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;
226
- #ifdef GLOBE
227
- if (v_depth > 1.0) {discard;}
228
- #endif
229
- #ifdef OVERDRAW_INSPECTOR
230
- fragColor=vec4(1.0);
231
- #endif
232
- }`,`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;
233
- #ifdef GLOBE
234
- out float v_depth;
235
- #endif
236
- #pragma mapbox: define lowp float opacity
237
- #pragma mapbox: define lowp vec4 pattern_from
238
- #pragma mapbox: define lowp vec4 pattern_to
239
- #pragma mapbox: define lowp float pixel_ratio_from
240
- #pragma mapbox: define lowp float pixel_ratio_to
241
- void main() {
242
- #pragma mapbox: initialize lowp float opacity
243
- #pragma mapbox: initialize mediump vec4 pattern_from
244
- #pragma mapbox: initialize mediump vec4 pattern_to
245
- #pragma mapbox: initialize lowp float pixel_ratio_from
246
- #pragma mapbox: initialize lowp float pixel_ratio_to
247
- 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;
248
- #ifdef GLOBE
249
- v_depth=gl_Position.z/gl_Position.w;
250
- #endif
251
- }`),fillPattern:yt(`#ifdef GL_ES
252
- precision highp float;
253
- #endif
254
- uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
255
- #pragma mapbox: define lowp float opacity
256
- #pragma mapbox: define lowp vec4 pattern_from
257
- #pragma mapbox: define lowp vec4 pattern_to
258
- void main() {
259
- #pragma mapbox: initialize lowp float opacity
260
- #pragma mapbox: initialize mediump vec4 pattern_from
261
- #pragma mapbox: initialize mediump vec4 pattern_to
262
- 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;
263
- #ifdef OVERDRAW_INSPECTOR
264
- fragColor=vec4(1.0);
265
- #endif
266
- }`,`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;
267
- #pragma mapbox: define lowp float opacity
268
- #pragma mapbox: define lowp vec4 pattern_from
269
- #pragma mapbox: define lowp vec4 pattern_to
270
- #pragma mapbox: define lowp float pixel_ratio_from
271
- #pragma mapbox: define lowp float pixel_ratio_to
272
- void main() {
273
- #pragma mapbox: initialize lowp float opacity
274
- #pragma mapbox: initialize mediump vec4 pattern_from
275
- #pragma mapbox: initialize mediump vec4 pattern_to
276
- #pragma mapbox: initialize lowp float pixel_ratio_from
277
- #pragma mapbox: initialize lowp float pixel_ratio_to
278
- 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:yt(`in vec4 v_color;void main() {fragColor=v_color;
279
- #ifdef OVERDRAW_INSPECTOR
280
- fragColor=vec4(1.0);
281
- #endif
282
- }`,`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;
283
- #ifdef TERRAIN3D
284
- in vec2 a_centroid;
285
- #endif
286
- out vec4 v_color;
287
- #pragma mapbox: define highp float base
288
- #pragma mapbox: define highp float height
289
- #pragma mapbox: define highp vec4 color
290
- void main() {
291
- #pragma mapbox: initialize highp float base
292
- #pragma mapbox: initialize highp float height
293
- #pragma mapbox: initialize highp vec4 color
294
- vec3 normal=a_normal_ed.xyz;
295
- #ifdef TERRAIN3D
296
- float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
297
- #else
298
- float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
299
- #endif
300
- 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;
301
- #ifdef GLOBE
302
- vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
303
- #else
304
- gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
305
- #endif
306
- 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);
307
- #ifdef GLOBE
308
- mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
309
- #endif
310
- 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:yt(`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;
311
- #pragma mapbox: define lowp float base
312
- #pragma mapbox: define lowp float height
313
- #pragma mapbox: define lowp vec4 pattern_from
314
- #pragma mapbox: define lowp vec4 pattern_to
315
- #pragma mapbox: define lowp float pixel_ratio_from
316
- #pragma mapbox: define lowp float pixel_ratio_to
317
- void main() {
318
- #pragma mapbox: initialize lowp float base
319
- #pragma mapbox: initialize lowp float height
320
- #pragma mapbox: initialize mediump vec4 pattern_from
321
- #pragma mapbox: initialize mediump vec4 pattern_to
322
- #pragma mapbox: initialize lowp float pixel_ratio_from
323
- #pragma mapbox: initialize lowp float pixel_ratio_to
324
- 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;
325
- #ifdef OVERDRAW_INSPECTOR
326
- fragColor=vec4(1.0);
327
- #endif
328
- }`,`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;
329
- #ifdef TERRAIN3D
330
- in vec2 a_centroid;
331
- #endif
332
- #ifdef GLOBE
333
- out vec3 v_sphere_pos;
334
- #endif
335
- out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
336
- #pragma mapbox: define lowp float base
337
- #pragma mapbox: define lowp float height
338
- #pragma mapbox: define lowp vec4 pattern_from
339
- #pragma mapbox: define lowp vec4 pattern_to
340
- #pragma mapbox: define lowp float pixel_ratio_from
341
- #pragma mapbox: define lowp float pixel_ratio_to
342
- void main() {
343
- #pragma mapbox: initialize lowp float base
344
- #pragma mapbox: initialize lowp float height
345
- #pragma mapbox: initialize mediump vec4 pattern_from
346
- #pragma mapbox: initialize mediump vec4 pattern_to
347
- #pragma mapbox: initialize lowp float pixel_ratio_from
348
- #pragma mapbox: initialize lowp float pixel_ratio_to
349
- 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;
350
- #ifdef TERRAIN3D
351
- float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
352
- #else
353
- float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
354
- #endif
355
- 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;
356
- #ifdef GLOBE
357
- vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
358
- #else
359
- gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
360
- #endif
361
- vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
362
- ? a_pos
363
- : 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:yt(`#ifdef GL_ES
364
- precision highp float;
365
- #endif
366
- 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);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;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))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);
367
- #ifdef OVERDRAW_INSPECTOR
368
- fragColor=vec4(1.0);
369
- #endif
370
- }`,"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:yt(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
371
- #define PI 3.141592653589793
372
- #define STANDARD 0
373
- #define COMBINED 1
374
- #define IGOR 2
375
- #define MULTIDIRECTIONAL 3
376
- #define BASIC 4
377
- float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;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_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else
378
- {fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else
379
- {fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;switch(u_method){case BASIC:
380
- basic_hillshade(deriv);break;case COMBINED:
381
- combined_hillshade(deriv);break;case IGOR:
382
- igor_hillshade(deriv);break;case MULTIDIRECTIONAL:
383
- multidirectional_hillshade(deriv);break;case STANDARD:
384
- default:
385
- standard_hillshade(deriv);break;}
386
- #ifdef OVERDRAW_INSPECTOR
387
- fragColor=vec4(1.0);
388
- #endif
389
- }`,"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:yt(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
390
- #ifdef GLOBE
391
- in float v_depth;
392
- #endif
393
- #pragma mapbox: define highp vec4 color
394
- #pragma mapbox: define lowp float blur
395
- #pragma mapbox: define lowp float opacity
396
- void main() {
397
- #pragma mapbox: initialize highp vec4 color
398
- #pragma mapbox: initialize lowp float blur
399
- #pragma mapbox: initialize lowp float opacity
400
- 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);
401
- #ifdef GLOBE
402
- if (v_depth > 1.0) {discard;}
403
- #endif
404
- #ifdef OVERDRAW_INSPECTOR
405
- fragColor=vec4(1.0);
406
- #endif
407
- }`,`
408
- #define scale 0.015873016
409
- 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;
410
- #ifdef GLOBE
411
- out float v_depth;
412
- #endif
413
- #pragma mapbox: define highp vec4 color
414
- #pragma mapbox: define lowp float blur
415
- #pragma mapbox: define lowp float opacity
416
- #pragma mapbox: define mediump float gapwidth
417
- #pragma mapbox: define lowp float offset
418
- #pragma mapbox: define mediump float width
419
- void main() {
420
- #pragma mapbox: initialize highp vec4 color
421
- #pragma mapbox: initialize lowp float blur
422
- #pragma mapbox: initialize lowp float opacity
423
- #pragma mapbox: initialize mediump float gapwidth
424
- #pragma mapbox: initialize lowp float offset
425
- #pragma mapbox: initialize mediump float width
426
- 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;
427
- #ifdef GLOBE
428
- v_depth=gl_Position.z/gl_Position.w;
429
- #endif
430
- #ifdef TERRAIN3D
431
- v_gamma_scale=1.0;
432
- #else
433
- 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;
434
- #endif
435
- v_width2=vec2(outset,inset);}`),lineGradient:yt(`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;
436
- #ifdef GLOBE
437
- in float v_depth;
438
- #endif
439
- #pragma mapbox: define lowp float blur
440
- #pragma mapbox: define lowp float opacity
441
- void main() {
442
- #pragma mapbox: initialize lowp float blur
443
- #pragma mapbox: initialize lowp float opacity
444
- 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);
445
- #ifdef GLOBE
446
- if (v_depth > 1.0) {discard;}
447
- #endif
448
- #ifdef OVERDRAW_INSPECTOR
449
- fragColor=vec4(1.0);
450
- #endif
451
- }`,`
452
- #define scale 0.015873016
453
- 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;
454
- #ifdef GLOBE
455
- out float v_depth;
456
- #endif
457
- #pragma mapbox: define lowp float blur
458
- #pragma mapbox: define lowp float opacity
459
- #pragma mapbox: define mediump float gapwidth
460
- #pragma mapbox: define lowp float offset
461
- #pragma mapbox: define mediump float width
462
- void main() {
463
- #pragma mapbox: initialize lowp float blur
464
- #pragma mapbox: initialize lowp float opacity
465
- #pragma mapbox: initialize mediump float gapwidth
466
- #pragma mapbox: initialize lowp float offset
467
- #pragma mapbox: initialize mediump float width
468
- 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;
469
- #ifdef GLOBE
470
- v_depth=gl_Position.z/gl_Position.w;
471
- #endif
472
- #ifdef TERRAIN3D
473
- v_gamma_scale=1.0;
474
- #else
475
- 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;
476
- #endif
477
- v_width2=vec2(outset,inset);}`),linePattern:yt(`#ifdef GL_ES
478
- precision highp float;
479
- #endif
480
- 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;
481
- #ifdef GLOBE
482
- in float v_depth;
483
- #endif
484
- #pragma mapbox: define lowp vec4 pattern_from
485
- #pragma mapbox: define lowp vec4 pattern_to
486
- #pragma mapbox: define lowp float pixel_ratio_from
487
- #pragma mapbox: define lowp float pixel_ratio_to
488
- #pragma mapbox: define lowp float blur
489
- #pragma mapbox: define lowp float opacity
490
- void main() {
491
- #pragma mapbox: initialize mediump vec4 pattern_from
492
- #pragma mapbox: initialize mediump vec4 pattern_to
493
- #pragma mapbox: initialize lowp float pixel_ratio_from
494
- #pragma mapbox: initialize lowp float pixel_ratio_to
495
- #pragma mapbox: initialize lowp float blur
496
- #pragma mapbox: initialize lowp float opacity
497
- 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;
498
- #ifdef GLOBE
499
- if (v_depth > 1.0) {discard;}
500
- #endif
501
- #ifdef OVERDRAW_INSPECTOR
502
- fragColor=vec4(1.0);
503
- #endif
504
- }`,`
505
- #define scale 0.015873016
506
- #define LINE_DISTANCE_SCALE 2.0
507
- 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;
508
- #ifdef GLOBE
509
- out float v_depth;
510
- #endif
511
- #pragma mapbox: define lowp float blur
512
- #pragma mapbox: define lowp float opacity
513
- #pragma mapbox: define lowp float offset
514
- #pragma mapbox: define mediump float gapwidth
515
- #pragma mapbox: define mediump float width
516
- #pragma mapbox: define lowp float floorwidth
517
- #pragma mapbox: define lowp vec4 pattern_from
518
- #pragma mapbox: define lowp vec4 pattern_to
519
- #pragma mapbox: define lowp float pixel_ratio_from
520
- #pragma mapbox: define lowp float pixel_ratio_to
521
- void main() {
522
- #pragma mapbox: initialize lowp float blur
523
- #pragma mapbox: initialize lowp float opacity
524
- #pragma mapbox: initialize lowp float offset
525
- #pragma mapbox: initialize mediump float gapwidth
526
- #pragma mapbox: initialize mediump float width
527
- #pragma mapbox: initialize lowp float floorwidth
528
- #pragma mapbox: initialize mediump vec4 pattern_from
529
- #pragma mapbox: initialize mediump vec4 pattern_to
530
- #pragma mapbox: initialize lowp float pixel_ratio_from
531
- #pragma mapbox: initialize lowp float pixel_ratio_to
532
- 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;
533
- #ifdef GLOBE
534
- v_depth=gl_Position.z/gl_Position.w;
535
- #endif
536
- #ifdef TERRAIN3D
537
- v_gamma_scale=1.0;
538
- #else
539
- 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;
540
- #endif
541
- v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:yt(`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;
542
- #ifdef GLOBE
543
- in float v_depth;
544
- #endif
545
- #pragma mapbox: define highp vec4 color
546
- #pragma mapbox: define lowp float blur
547
- #pragma mapbox: define lowp float opacity
548
- #pragma mapbox: define mediump float width
549
- #pragma mapbox: define lowp float floorwidth
550
- void main() {
551
- #pragma mapbox: initialize highp vec4 color
552
- #pragma mapbox: initialize lowp float blur
553
- #pragma mapbox: initialize lowp float opacity
554
- #pragma mapbox: initialize mediump float width
555
- #pragma mapbox: initialize lowp float floorwidth
556
- 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);
557
- #ifdef GLOBE
558
- if (v_depth > 1.0) {discard;}
559
- #endif
560
- #ifdef OVERDRAW_INSPECTOR
561
- fragColor=vec4(1.0);
562
- #endif
563
- }`,`
564
- #define scale 0.015873016
565
- #define LINE_DISTANCE_SCALE 2.0
566
- 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;
567
- #ifdef GLOBE
568
- out float v_depth;
569
- #endif
570
- #pragma mapbox: define highp vec4 color
571
- #pragma mapbox: define lowp float blur
572
- #pragma mapbox: define lowp float opacity
573
- #pragma mapbox: define mediump float gapwidth
574
- #pragma mapbox: define lowp float offset
575
- #pragma mapbox: define mediump float width
576
- #pragma mapbox: define lowp float floorwidth
577
- void main() {
578
- #pragma mapbox: initialize highp vec4 color
579
- #pragma mapbox: initialize lowp float blur
580
- #pragma mapbox: initialize lowp float opacity
581
- #pragma mapbox: initialize mediump float gapwidth
582
- #pragma mapbox: initialize lowp float offset
583
- #pragma mapbox: initialize mediump float width
584
- #pragma mapbox: initialize lowp float floorwidth
585
- 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;
586
- #ifdef GLOBE
587
- v_depth=gl_Position.z/gl_Position.w;
588
- #endif
589
- #ifdef TERRAIN3D
590
- v_gamma_scale=1.0;
591
- #else
592
- 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;
593
- #endif
594
- 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:yt(`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);
595
- #ifdef OVERDRAW_INSPECTOR
596
- fragColor=vec4(1.0);
597
- #endif
598
- }`,`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;
599
- #ifdef GLOBE
600
- if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
601
- #endif
602
- v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:yt(`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;
603
- #pragma mapbox: define lowp float opacity
604
- void main() {
605
- #pragma mapbox: initialize lowp float opacity
606
- lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;
607
- #ifdef OVERDRAW_INSPECTOR
608
- fragColor=vec4(1.0);
609
- #endif
610
- }`,`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;
611
- #pragma mapbox: define lowp float opacity
612
- void main() {
613
- #pragma mapbox: initialize lowp float opacity
614
- 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 ?
615
- camera_to_anchor_distance/u_camera_to_center_distance :
616
- 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;
617
- #ifdef GLOBE
618
- 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);}
619
- #endif
620
- 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:yt(`#define SDF_PX 8.0
621
- 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;
622
- #pragma mapbox: define highp vec4 fill_color
623
- #pragma mapbox: define highp vec4 halo_color
624
- #pragma mapbox: define lowp float opacity
625
- #pragma mapbox: define lowp float halo_width
626
- #pragma mapbox: define lowp float halo_blur
627
- void main() {
628
- #pragma mapbox: initialize highp vec4 fill_color
629
- #pragma mapbox: initialize highp vec4 halo_color
630
- #pragma mapbox: initialize lowp float opacity
631
- #pragma mapbox: initialize lowp float halo_width
632
- #pragma mapbox: initialize lowp float halo_blur
633
- 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);
634
- #ifdef OVERDRAW_INSPECTOR
635
- fragColor=vec4(1.0);
636
- #endif
637
- }`,`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;
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
- 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 ?
650
- camera_to_anchor_distance/u_camera_to_center_distance :
651
- 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;
652
- #ifdef GLOBE
653
- 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);}
654
- #endif
655
- 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:yt(`#define SDF_PX 8.0
656
- #define SDF 1.0
657
- #define ICON 0.0
658
- 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;
659
- #pragma mapbox: define highp vec4 fill_color
660
- #pragma mapbox: define highp vec4 halo_color
661
- #pragma mapbox: define lowp float opacity
662
- #pragma mapbox: define lowp float halo_width
663
- #pragma mapbox: define lowp float halo_blur
664
- void main() {
665
- #pragma mapbox: initialize highp vec4 fill_color
666
- #pragma mapbox: initialize highp vec4 halo_color
667
- #pragma mapbox: initialize lowp float opacity
668
- #pragma mapbox: initialize lowp float halo_width
669
- #pragma mapbox: initialize lowp float halo_blur
670
- 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;
671
- #ifdef OVERDRAW_INSPECTOR
672
- fragColor=vec4(1.0);
673
- #endif
674
- 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);
675
- #ifdef OVERDRAW_INSPECTOR
676
- fragColor=vec4(1.0);
677
- #endif
678
- }`,`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;
679
- #pragma mapbox: define highp vec4 fill_color
680
- #pragma mapbox: define highp vec4 halo_color
681
- #pragma mapbox: define lowp float opacity
682
- #pragma mapbox: define lowp float halo_width
683
- #pragma mapbox: define lowp float halo_blur
684
- void main() {
685
- #pragma mapbox: initialize highp vec4 fill_color
686
- #pragma mapbox: initialize highp vec4 halo_color
687
- #pragma mapbox: initialize lowp float opacity
688
- #pragma mapbox: initialize lowp float halo_width
689
- #pragma mapbox: initialize lowp float halo_blur
690
- 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 ?
691
- camera_to_anchor_distance/u_camera_to_center_distance :
692
- 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;
693
- #ifdef GLOBE
694
- 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);}
695
- #endif
696
- 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:yt("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:yt("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:yt("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:yt("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:yt(`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
697
- );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:yt("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 yt(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,_={};return{fragmentSource:u=u.replace(i,(x,T,M,E,I)=>(_[I]=!0,T==="define"?`
698
- #ifndef HAS_UNIFORM_u_${I}
699
- in ${M} ${E} ${I};
700
- #else
701
- uniform ${M} ${E} u_${I};
702
- #endif
703
- `:`
704
- #ifdef HAS_UNIFORM_u_${I}
705
- ${M} ${E} ${I} = u_${I};
706
- #endif
707
- `)),vertexSource:e=e.replace(i,(x,T,M,E,I)=>{const k=E==="float"?"vec2":"vec4",O=I.match(/color/)?"color":k;return _[I]?T==="define"?`
708
- #ifndef HAS_UNIFORM_u_${I}
709
- uniform lowp float u_${I}_t;
710
- in ${M} ${k} a_${I};
711
- out ${M} ${E} ${I};
712
- #else
713
- uniform ${M} ${E} u_${I};
714
- #endif
715
- `:O==="vec4"?`
716
- #ifndef HAS_UNIFORM_u_${I}
717
- ${I} = a_${I};
718
- #else
719
- ${M} ${E} ${I} = u_${I};
720
- #endif
721
- `:`
722
- #ifndef HAS_UNIFORM_u_${I}
723
- ${I} = unpack_mix_${O}(a_${I}, u_${I}_t);
724
- #else
725
- ${M} ${E} ${I} = u_${I};
726
- #endif
727
- `:T==="define"?`
728
- #ifndef HAS_UNIFORM_u_${I}
729
- uniform lowp float u_${I}_t;
730
- in ${M} ${k} a_${I};
731
- #else
732
- uniform ${M} ${E} u_${I};
733
- #endif
734
- `:O==="vec4"?`
735
- #ifndef HAS_UNIFORM_u_${I}
736
- ${M} ${E} ${I} = a_${I};
737
- #else
738
- ${M} ${E} ${I} = u_${I};
739
- #endif
740
- `:`
741
- #ifndef HAS_UNIFORM_u_${I}
742
- ${M} ${E} ${I} = unpack_mix_${O}(a_${I}, u_${I}_t);
743
- #else
744
- ${M} ${E} ${I} = u_${I};
745
- #endif
746
- `}),staticAttributes:s,staticUniforms:f}}class zn{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 An=o.aI([{name:"a_pos",type:"Int16",components:2}]);const fa="#define PROJECTION_MERCATOR",jl="mercator";class Nl{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return jl}get shaderDefine(){return fa}get shaderPreludeCode(){return yn.projectionMercator}get vertexShaderPreludeCode(){return yn.projectionMercator.vertexSource}get subdivisionGranularity(){return o.aJ.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.aK;f.emplaceBack(0,0),f.emplaceBack(o.$,0),f.emplaceBack(0,o.$),f.emplaceBack(o.$,o.$);const _=e.createVertexBuffer(f,An.members),x=o.aL.simpleSegment(0,0,4,2),T=new o.aM;T.emplaceBack(1,0,2),T.emplaceBack(1,2,3);const M=e.createIndexBuffer(T);return this._cachedMesh=new zn(_,M,x),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class $r{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.C.number(e.top,i.top,s)),i.bottom!=null&&e.bottom!=null&&(this.bottom=o.C.number(e.bottom,i.bottom,s)),i.left!=null&&e.left!=null&&(this.left=o.C.number(e.left,i.left,s)),i.right!=null&&e.right!=null&&(this.right=o.C.number(e.right,i.right,s)),this}getCenter(e,i){const s=o.ag((this.left+e-this.right)/2,0,e),l=o.ag((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 $r(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function kn(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 xt(u){return Math.max(0,Math.floor(u))}class Is{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.S(0,0),this._elevation=0,this._zoom=0,this._tileZoom=xt(this._zoom),this._scale=o.ae(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new $r,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=xt(this._zoom),this._scale=o.ae(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 $r(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.aN(e,-180,180)*Math.PI/180;var s,l,h,f,_,x,T,M,E;this._bearingInRadians!==i&&(this._unmodified=!1,this._bearingInRadians=i,this._calcMatrices(),this._rotationMatrix=xe(),s=this._rotationMatrix,h=-this._bearingInRadians,f=(l=this._rotationMatrix)[0],_=l[1],x=l[2],T=l[3],M=Math.sin(h),E=Math.cos(h),s[0]=f*E+x*M,s[1]=_*E+T*M,s[2]=f*-M+x*E,s[3]=_*-M+T*E)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const i=o.ag(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.aO(this._fovInRadians)}setFov(e){e=o.ag(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.ae(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 Wt([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.ah])}getConstrained(e,i){return this._callbacks.getConstrained(e,i)}getCameraQueryGeometry(e,i){if(i.length===1)return[i[0],e];{const{minX:s,minY:l,maxX:h,maxY:f}=o.a1.fromPoints(i).extend(e);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.af(new Float64Array(16));o.N(e,e,[this._width/2,-this._height/2,1]),o.M(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=o.af(new Float64Array(16)),o.N(e,e,[1,-1,1]),o.M(e,e,[-1,-1,0]),o.N(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,_=o.a0.fromLngLat(e,i),x=-Math.cos(o.ad(f)),T=Math.sin(o.ad(f)),M=T*Math.sin(o.ad(h)),E=-T*Math.cos(o.ad(h));let I=this.elevation;const k=i-I;let O;x*k>=0||Math.abs(x)<.1?(O=1e4,I=i+O*x):O=-k/x;let q,G,W=o.aP(1,_.y),X=0;do{if(X+=1,X>10)break;G=O/W,q=new o.a0(_.x+M*G,_.y+E*G),W=1/q.meterInMercatorCoordinateUnits()}while(Math.abs(O-G*W)>1e-12);return{center:q.toLngLat(),elevation:I,zoom:o.aj(this.height/2/Math.tan(this.fovInRadians/2)/G/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const i=o.ai(1,this.center.lat)*this.worldSize,s=this.cameraToCenterDistance/i,l=o.a0.fromLngLat(this.center,this.elevation),h=J(this.center,this.elevation,this.pitch,this.bearing,s);this._elevation=e;const f=this.calculateCenterFromCameraLngLatAlt(h.toLngLat(),o.aP(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.ai(1,this.center.lat)*this.worldSize;return J(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.$,1/i/o.$]}}class ko{constructor(e,i){this.min=e,this.max=i,this.center=o.aQ([],o.aR([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],s=o.aS(this.min),l=o.aS(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 ko(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 Vl{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}getTileBoundingVolume(e,i,s,l){var h,f;let _=s,x=s;if(l!=null&&l.terrain){const M=new o.Z(e.z,i,e.z,e.x,e.y),E=l.terrain.getMinMaxElevation(M);_=(h=E.minElevation)!==null&&h!==void 0?h:s,x=(f=E.maxElevation)!==null&&f!==void 0?f:s}const T=1<<e.z;return new ko([i+e.x/T,e.y/T,_],[i+(e.x+1)/T,(e.y+1)/T,x])}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.ag(78.5-s/2,0,60);return!!i.terrain||e.pitch>l}allowWorldCopies(){return!0}prepareNextFrame(){}}class rr{constructor(e,i,s){this.points=e,this.planes=i,this.aabb=s}static fromInvProjectionMatrix(e,i=1,s=0,l,h){const f=h?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],_=Math.pow(2,s),x=[[-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(I=>function(k,O,q,G){const W=o.av([],k,O),X=1/W[3]/q*G;return o.aX(W,W,[X,X,1/W[3],X])}(I,e,i,_));l&&function(I,k,O,q){const G=q?4:0,W=q?0:4;let X=0;const ee=[],Y=[];for(let K=0;K<4;K++){const le=o.aT([],I[K+W],I[K+G]),ye=o.aY(le);o.aQ(le,le,1/ye),ee.push(ye),Y.push(le)}for(let K=0;K<4;K++){const le=o.aZ(I[K+G],Y[K],O);X=le!==null&&le>=0?Math.max(X,le):Math.max(X,ee[K])}const ie=function(K,le){const ye=o.aT([],K[le[0]],K[le[1]]),pe=o.aT([],K[le[2]],K[le[1]]),me=[0,0,0,0];return o.aU(me,o.aV([],ye,pe)),me[3]=-o.aW(me,K[le[0]]),me}(I,k),ne=function(K,le){const ye=o.a_(K),pe=o.a$([],K,1/ye),me=o.aT([],le,o.aQ([],pe,o.aW(le,pe))),ve=o.a_(me);if(ve>0){const je=Math.sqrt(1-pe[3]*pe[3]),Fe=o.aQ([],pe,-pe[3]),Ee=o.aR([],Fe,o.aQ([],me,je/ve));return o.b0(le,Ee)}return null}(O,ie);if(ne!==null){const K=ne/o.aW(Y[0],ie);X=Math.min(X,K)}for(let K=0;K<4;K++){const le=Math.min(X,ee[K]);I[K+W]=[I[K+G][0]+Y[K][0]*le,I[K+G][1]+Y[K][1]*le,I[K+G][2]+Y[K][2]*le,1]}}(x,f[0],l,h);const T=f.map(I=>{const k=o.aT([],x[I[0]],x[I[1]]),O=o.aT([],x[I[2]],x[I[1]]),q=o.aU([],o.aV([],k,O)),G=-o.aW(q,x[I[1]]);return q.concat(G)}),M=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],E=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const I of x)for(let k=0;k<3;k++)M[k]=Math.min(M[k],I[k]),E[k]=Math.max(E[k],I[k]);return new rr(x,T,new ko(M,E))}}class vi{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 Is({calcMatrices:()=>{this._calcMatrices()},getConstrained:(f,_)=>this.getConstrained(f,_)},e,i,s,l,h),this._coveringTilesDetailsProvider=new Vl}clone(){const e=new vi;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.b1(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)),_=Math.floor(Math.min(s.x,l.x,h.x,f.x)),x=Math.floor(Math.max(s.x,l.x,h.x,f.x)),T=1;for(let M=_-T;M<=x+T;M++)M!==0&&i.push(new o.b1(M,e))}return i}getCameraFrustum(){return rr.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.ai(this.elevation,this.center.lat),l=this.screenPointToMercatorCoordinateAtZ(i,s),h=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,s),f=o.a0.fromLngLat(e),_=new o.a0(f.x-(l.x-h.x),f.y-(l.y-h.y));this.setCenter(_==null?void 0:_.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,i){return i?this.coordinatePoint(o.a0.fromLngLat(e),i.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(o.a0.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.av(l,l,this._pixelMatrixInverse),o.av(h,h,this._pixelMatrixInverse);const f=l[3],_=h[3],x=l[1]/f,T=h[1]/_,M=l[2]/f,E=h[2]/_,I=M===E?0:(s-M)/(E-M);return new o.a0(o.C.number(l[0]/f,h[0]/_,I)/this.worldSize,o.C.number(x,T,I)/this.worldSize,s)}coordinatePoint(e,i=0,s=this._pixelMatrix){const l=[e.x*this.worldSize,e.y*this.worldSize,i,1];return o.av(l,l,s),new o.P(l[0]/l[3],l[1]/l[3])}getBounds(){const e=Math.max(0,this._helper._height/2-V(this));return new Wt().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-V(this)}calculatePosMatrix(e,i=!1,s){var l;const h=(l=e.key)!==null&&l!==void 0?l:o.b2(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 _=$(e,this.worldSize);o.O(_,i?this._alignedProjMatrix:this._viewProjMatrix,_);const x={f64:_,f32:new Float32Array(_)};return f.set(h,x),s?x.f32:x.f64}calculateFogMatrix(e){const i=e.key,s=this._fogMatrixCacheF32;if(s.has(i))return s.get(i);const l=$(e,this.worldSize);return o.O(l,this._fogMatrix,l),s.set(i,new Float32Array(l)),s.get(i)}getConstrained(e,i){i=o.ag(+i,this.minZoom,this.maxZoom);const s={center:new o.S(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.ae(s.zoom);let f=0,_=h,x=0,T=h,M=0,E=0;const{x:I,y:k}=this.size;if(this._helper._latRange){const ee=this._helper._latRange;f=o.U(ee[1])*h,_=o.U(ee[0])*h,_-f<k&&(M=k/(_-f))}l&&(x=o.aN(o.V(l[0])*h,0,h),T=o.aN(o.V(l[1])*h,0,h),T<x&&(T+=h),T-x<I&&(E=I/(T-x)));const{x:O,y:q}=he(h,e);let G,W;const X=Math.max(E||0,M||0);if(X){const ee=new o.P(E?(T+x)/2:O,M?(_+f)/2:q);return s.center=N(h,ee).wrap(),s.zoom+=o.aj(X),s}if(this._helper._latRange){const ee=k/2;q-ee<f&&(W=f+ee),q+ee>_&&(W=_-ee)}if(l){const ee=(x+T)/2;let Y=O;this._helper._renderWorldCopies&&(Y=o.aN(O,ee-h/2,ee+h/2));const ie=I/2;Y-ie<x&&(G=x+ie),Y+ie>T&&(G=T-ie)}if(G!==void 0||W!==void 0){const ee=new o.P(G??O,W??q);s.center=N(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,_=Math.PI/2+this.pitchInRadians,x=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(x)*f/Math.sin(o.ag(Math.PI-_-x,.01,Math.PI-.01)),M=V(this),E=Math.atan(M/this._helper.cameraToCenterDistance),I=o.ad(.75),k=E>I?2*E*(.5+s.y/(2*M)):I,O=Math.sin(k)*f/Math.sin(o.ag(Math.PI-_-k,.01,Math.PI-.01)),q=Math.min(T,O);this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*q+f),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const e=this.centerOffset,i=he(this.worldSize,this.center),s=i.x,l=i.y;this._helper._pixelPerMeter=o.ai(1,this.center.lat)*this.worldSize;const h=o.ad(Math.min(this.pitch,Ur)),f=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(h));let _;this._calculateNearFarZIfNeeded(f,h,e),_=new Float64Array(16),o.b3(_,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),o.ap(this._invProjMatrix,_),_[8]=2*-e.x/this._helper._width,_[9]=2*e.y/this._helper._height,this._projectionMatrix=o.b4(_),o.N(_,_,[1,-1,1]),o.M(_,_,[0,0,-this._helper.cameraToCenterDistance]),o.b5(_,_,-this.rollInRadians),o.b6(_,_,this.pitchInRadians),o.b5(_,_,-this.bearingInRadians),o.M(_,_,[-s,-l,0]),this._mercatorMatrix=o.N([],_,[this.worldSize,this.worldSize,this.worldSize]),o.N(_,_,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=o.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,_),o.M(_,_,[0,0,-this.elevation]),this._viewProjMatrix=_,this._invViewProjMatrix=o.ap([],_);const x=[0,0,-1,1];o.av(x,x,this._invViewProjMatrix),this._cameraPosition=[x[0]/x[3],x[1]/x[3],x[2]/x[3]],this._fogMatrix=new Float64Array(16),o.b3(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.N(this._fogMatrix,this._fogMatrix,[1,-1,1]),o.M(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),o.b5(this._fogMatrix,this._fogMatrix,-this.rollInRadians),o.b6(this._fogMatrix,this._fogMatrix,this.pitchInRadians),o.b5(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),o.M(this._fogMatrix,this._fogMatrix,[-s,-l,0]),o.N(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),o.M(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=o.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,_);const T=this._helper._width%2/2,M=this._helper._height%2/2,E=Math.cos(this.bearingInRadians),I=Math.sin(-this.bearingInRadians),k=s-Math.round(s)+E*T+I*M,O=l-Math.round(l)+E*M+I*T,q=new Float64Array(_);if(o.M(q,q,[k>.5?k-1:k,O>.5?O-1:O,0]),this._alignedProjMatrix=q,_=o.ap(new Float64Array(16),this._pixelMatrix),!_)throw new Error("failed to invert matrix");this._pixelMatrixInverse=_,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.av(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=o.ai(1,this.center.lat)*this.worldSize;return J(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,i){const s=o.a0.fromLngLat(e),l=[s.x*this.worldSize,s.y*this.worldSize,i,1];return o.av(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 _;return _=i&&i.terrainRttPosMatrix32f&&l?i.terrainRttPosMatrix32f:f||o.b7(),{mainMatrix:_,tileMercatorCoords:h,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:_}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,i,s){return 1}transformLightDirection(e){return o.aS(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.av(f,f,h)):(f=[e,i,0,1],da(f,f,h));const _=f[3];return{point:new o.P(f[0]/_,f[1]/_),signedDistanceFromCamera:_,isOccluded:!1}}populateCache(e){for(const i of e)this.calculatePosMatrix(i)}getMatrixForModel(e,i){const s=o.a0.fromLngLat(e,i),l=s.meterInMercatorCoordinateUnits(),h=o.b8();return o.M(h,h,[s.x,s.y,s.z]),o.b5(h,h,Math.PI),o.b6(h,h,Math.PI/2),o.N(h,h,[-l,l,l]),h}getProjectionDataForCustomLayer(e=!0){const i=new o.Z(0,0,0,0,0),s=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:e}),l=$(i,this.worldSize);o.O(l,this._viewProjMatrix,l),s.tileMercatorCoords=[0,0,1,1];const h=[o.$,o.$,this.worldSize/this._helper.pixelsPerMeter],f=o.b9();return o.N(f,l,h),s.fallbackMatrix=f,s.mainMatrix=f,s}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function nr(){o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function ki(u){if(u.useSlerp)if(u.k<1){const e=o.ba(u.startEulerAngles.roll,u.startEulerAngles.pitch,u.startEulerAngles.bearing),i=o.ba(u.endEulerAngles.roll,u.endEulerAngles.pitch,u.endEulerAngles.bearing),s=new Float64Array(4);o.bb(s,e,i,u.k);const l=o.bc(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.C.number(u.startEulerAngles.roll,u.endEulerAngles.roll,u.k)),u.tr.setPitch(o.C.number(u.startEulerAngles.pitch,u.endEulerAngles.pitch,u.k)),u.tr.setBearing(o.C.number(u.startEulerAngles.bearing,u.endEulerAngles.bearing,u.k))}function ri(u,e,i,s,l){const h=l.padding,f=he(l.worldSize,i.getNorthWest()),_=he(l.worldSize,i.getNorthEast()),x=he(l.worldSize,i.getSouthEast()),T=he(l.worldSize,i.getSouthWest()),M=o.ad(-s),E=f.rotate(M),I=_.rotate(M),k=x.rotate(M),O=T.rotate(M),q=new o.P(Math.max(E.x,I.x,O.x,k.x),Math.max(E.y,I.y,O.y,k.y)),G=new o.P(Math.min(E.x,I.x,O.x,k.x),Math.min(E.y,I.y,O.y,k.y)),W=q.sub(G),X=(l.width-(h.left+h.right+e.left+e.right))/W.x,ee=(l.height-(h.top+h.bottom+e.top+e.bottom))/W.y;if(ee<0||X<0)return void nr();const Y=Math.min(o.aj(l.scale*Math.min(X,ee)),u.maxZoom),ie=o.P.convert(u.offset),ne=new o.P((e.left-e.right)/2,(e.top-e.bottom)/2).rotate(o.ad(s)),K=ie.add(ne).mult(l.scale/o.ae(Y));return{center:N(l.worldSize,f.add(x).div(2).sub(K)),zoom:Y,bearing:s}}class Ro{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 ri(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.S.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},_=i.zoom!==void 0,x=!e.isPaddingEqual(i.padding);let T=!1;const M=_?+i.zoom:e.zoom;let E=e.centerPoint.add(i.offsetAsPoint);const I=e.screenPointToLocation(E),{center:k,zoom:O}=e.getConstrained(o.S.convert(i.center||I),M??s);kn(e,k);const q=he(e.worldSize,I),G=he(e.worldSize,k).sub(q),W=o.ae(O-s);return T=O!==s,{easeFunc:X=>{if(T&&e.setZoom(o.C.number(s,O,X)),o.bd(h,f)||ki({startEulerAngles:h,endEulerAngles:f,tr:e,k:X,useSlerp:h.roll!=f.roll}),x&&(e.interpolatePadding(l,i.padding,X),E=e.centerPoint.add(i.offsetAsPoint)),i.around)e.setLocationAtPoint(i.around,i.aroundPoint);else{const ee=o.ae(e.zoom-s),Y=O>s?Math.min(2,W):Math.max(.5,W),ie=Math.pow(Y,1-X),ne=N(e.worldSize,q.add(G.mult(X*ie)).mult(ee));e.setLocationAtPoint(e.renderWorldCopies?ne.wrap():ne,E)}},isZooming:T,elevationCenter:k}}handleFlyTo(e,i){const s=i.zoom!==void 0,l=e.zoom,h=e.getConstrained(o.S.convert(i.center||i.locationAtOffset),s?+i.zoom:l),f=h.center,_=h.zoom;kn(e,f);const x=he(e.worldSize,i.locationAtOffset),T=he(e.worldSize,f).sub(x),M=T.mag(),E=o.ae(_-l);let I;if(i.minZoom!==void 0){const k=Math.min(+i.minZoom,l,_),O=e.getConstrained(f,k).zoom;I=o.ae(O-l)}return{easeFunc:(k,O,q,G)=>{e.setZoom(k===1?_:l+o.aj(O));const W=k===1?f:N(e.worldSize,x.add(T.mult(q)).mult(O));e.setLocationAtPoint(e.renderWorldCopies?W.wrap():W,G)},scaleOfZoom:E,targetCenter:f,scaleOfMinZoom:I,pixelPathLength:M}}}class Pt{constructor(e,i,s){this.blendFunction=e,this.blendColor=i,this.mask=s}}Pt.Replace=[1,0],Pt.disabled=new Pt(Pt.Replace,o.be.transparent,[!1,!1,!1,!1]),Pt.unblended=new Pt(Pt.Replace,o.be.transparent,[!0,!0,!0,!0]),Pt.alphaBlended=new Pt([1,771],o.be.transparent,[!0,!0,!0,!0]);const br=2305;class ct{constructor(e,i,s){this.enable=e,this.mode=i,this.frontFace=s}}ct.disabled=new ct(!1,1029,br),ct.backCCW=new ct(!0,1029,br),ct.frontCCW=new ct(!0,1028,br);class ut{constructor(e,i,s){this.func=e,this.mask=i,this.range=s}}ut.ReadOnly=!1,ut.ReadWrite=!0,ut.disabled=new ut(519,ut.ReadOnly,[0,1]);const ma=7680;class st{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}}st.disabled=new st({func:519,mask:0},0,0,ma,ma,ma);const ga=new WeakMap;function dr(u){var e;if(ga.has(u))return ga.get(u);{const i=(e=u.getParameter(u.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return ga.set(u,i),i}}class Za{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.aK;l.emplaceBack(-1,-1),l.emplaceBack(2,-1),l.emplaceBack(-1,2);const h=new o.aM;h.emplaceBack(0,1,2),this._fullscreenTriangle=new zn(i.createVertexBuffer(l,An.members),i.createIndexBuffer(h),o.aL.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),dr(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.be.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(s,l.TRIANGLES,ut.disabled,st.disabled,Pt.unblended,ct.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&&dr(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&&dr(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=Za._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 Gr=o.$/128;function Zl(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,_=u.generateBorders?-1:0,x=u.generateBorders||u.extendToNorthPole?-1:0,T=i+(u.generateBorders?1:0),M=i+(u.generateBorders||u.extendToSouthPole?1:0),E=h*f,I=s*l*6,k=h*f>65536;if(k&&e==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const O=k||e==="32bit",q=new Int16Array(2*E);let G=0;for(let ee=x;ee<=M;ee++)for(let Y=_;Y<=T;Y++){let ie=Y/i*o.$;Y===-1&&(ie=-64),Y===i+1&&(ie=o.$+Gr);let ne=ee/i*o.$;ee===-1&&(ne=u.extendToNorthPole?o.bg:-64),ee===i+1&&(ne=u.extendToSouthPole?o.bh:o.$+Gr),q[G++]=ie,q[G++]=ne}const W=O?new Uint32Array(I):new Uint16Array(I);let X=0;for(let ee=0;ee<l;ee++)for(let Y=0;Y<s;Y++){const ie=Y+1+ee*h,ne=Y+(ee+1)*h,K=Y+1+(ee+1)*h;W[X++]=Y+ee*h,W[X++]=ne,W[X++]=ie,W[X++]=ie,W[X++]=ne,W[X++]=K}return{vertices:q.buffer.slice(0),indices:W.buffer.slice(0),uses32bitIndices:O}}const xn=new o.aJ({fill:new o.bi(128,2),line:new o.bi(512,0),tile:new o.bi(128,32),stencil:new o.bi(128,1),circle:3});class Lu{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 yn.projectionGlobe}get vertexShaderPreludeCode(){return yn.projectionMercator.vertexSource}get subdivisionGranularity(){return xn}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new Za(e));const i=o.U(this._errorQueryLatitudeDegrees),s=2*Math.atan(Math.exp(Math.PI-i*Math.PI*2))-.5*Math.PI,l=this._errorMeasurement.updateErrorLoop(i,s),h=Ce.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.bj(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,o.bk(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"?xn.stencil:xn.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 _=Zl(f,"16bit"),x=o.aK.deserialize({arrayBuffer:_.vertices,length:_.vertices.byteLength/2/2}),T=o.aM.deserialize({arrayBuffer:_.indices,length:_.indices.byteLength/2/3});return new zn(h.createVertexBuffer(x,An.members),h.createIndexBuffer(T),o.aL.simpleSegment(0,0,x.length,T.length))}(e,i);return this._tileMeshCache[s]=l,l}recalculate(e){}hasTransition(){const e=Ce.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 Bu=new o.r({type:new o.D(o.v.projection.type)});class Es extends o.E{constructor(e){super(),this._transitionable=new o.t(Bu),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new o.F(0)),this._mercatorProjection=new Nl,this._verticalPerspectiveProjection=new Lu}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.bl){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 zs(u){const e=Ua(u.worldSize,u.center.lat);return 2*Math.PI*e}function nn(u,e,i,s,l){const h=1/(1<<l),f=e/o.$*h+s*h,_=o.bn((u/o.$*h+i*h)*Math.PI*2+Math.PI,2*Math.PI),x=2*Math.atan(Math.exp(Math.PI-f*Math.PI*2))-.5*Math.PI,T=Math.cos(x),M=new Float64Array(3);return M[0]=Math.sin(_)*T,M[1]=Math.sin(x),M[2]=Math.cos(_)*T,M}function Ri(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 Ua(u,e){return u/(2*Math.PI)/Math.cos(e*Math.PI/180)}function As(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.S(o.aN(h,-180,180),e)}return new o.S(0,e)}function $a(u){return Math.cos(u*Math.PI/180)}function bi(u,e){const i=$a(u),s=$a(e);return o.aj(s/i)}function ks(u,e){const i=u.rotate(e.bearingInRadians),s=e.zoom+bi(e.center.lat,0),l=o.bj(1/$a(e.center.lat),1/$a(Math.min(Math.abs(e.center.lat),60)),o.bm(s,7,3,0,1)),h=360/zs({worldSize:e.worldSize,center:{lat:e.center.lat}});return new o.S(e.center.lng-i.x*h*l,o.ag(e.center.lat+i.y*h,-85.051129,o.ah))}function Ga(u){const e=.5*u,i=Math.sin(e),s=Math.cos(e);return Math.log(i+s)-Math.log(s-i)}function qa(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,_=Ga(h+s*(f-h)),x=Ga(h),T=Ga(f);return new o.S(u.lng+e*((_-x)/(T-x)),l)}return new o.S(u.lng+e*s,l)}class Pd{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,i,s,l){const h=`${e.z}_${e.x}_${e.y}_${l!=null&&l.terrain?"t":""}`,f=this._cache.get(h);if(f)return f;const _=this._cachePrevious.get(h);if(_)return this._cache.set(h,_),_;const x=this._boundingVolumeFactory(e,i,s,l);return this._cache.set(h,x),this._hadAnyChanges=!0,x}}class Xn{constructor(e,i,s,l){this.min=s,this.max=l,this.points=e,this.planes=i}static fromAabb(e,i){const s=[];for(let l=0;l<8;l++)s.push([1&~l?e[0]:i[0],(l>>1&1)==1?i[1]:e[1],(l>>2&1)==1?i[2]:e[2]]);return new Xn(s,[[-1,0,0,i[0]],[1,0,0,-e[0]],[0,-1,0,i[1]],[0,1,0,-e[1]],[0,0,-1,i[2]],[0,0,1,-e[2]]],e,i)}static fromCenterSizeAngles(e,i,s){const l=o.bq([],s[0],s[1],s[2]),h=o.br([],[i[0],0,0],l),f=o.br([],[0,i[1],0],l),_=o.br([],[0,0,i[2]],l),x=[...e],T=[...e];for(let E=0;E<8;E++)for(let I=0;I<3;I++){const k=e[I]+h[I]*(1&~E?-1:1)+f[I]*((E>>1&1)==1?1:-1)+_[I]*((E>>2&1)==1?1:-1);x[I]=Math.min(x[I],k),T[I]=Math.max(T[I],k)}const M=[];for(let E=0;E<8;E++){const I=[...e];o.aR(I,I,o.aQ([],h,1&~E?-1:1)),o.aR(I,I,o.aQ([],f,(E>>1&1)==1?1:-1)),o.aR(I,I,o.aQ([],_,(E>>2&1)==1?1:-1)),M.push(I)}return new Xn(M,[[...h,-o.aW(h,M[0])],[...f,-o.aW(f,M[0])],[..._,-o.aW(_,M[0])],[-h[0],-h[1],-h[2],-o.aW(h,M[7])],[-f[0],-f[1],-f[2],-o.aW(f,M[7])],[-_[0],-_[1],-_[2],-o.aW(_,M[7])]],x,T)}intersectsFrustum(e){let i=!0;const s=this.points.length,l=this.planes.length,h=e.planes.length,f=e.points.length;for(let _=0;_<h;_++){const x=e.planes[_];let T=0;for(let M=0;M<s;M++){const E=this.points[M];x[0]*E[0]+x[1]*E[1]+x[2]*E[2]+x[3]>=0&&T++}if(T===0)return 0;T<s&&(i=!1)}if(i)return 2;for(let _=0;_<l;_++){const x=this.planes[_];let T=0;for(let M=0;M<f;M++){const E=e.points[M];x[0]*E[0]+x[1]*E[1]+x[2]*E[2]+x[3]>=0&&T++}if(T===0)return 0}return 1}intersectsPlane(e){const i=this.points.length;let s=0;for(let l=0;l<i;l++){const h=this.points[l];e[0]*h[0]+e[1]*h[1]+e[2]*h[2]+e[3]>=0&&s++}return s===i?2:s===0?0:1}}function Rs(u,e,i){const s=u-e;return s<0?-s:Math.max(0,s-i)}function Ul(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,Rs(e,s,l))}class Md{constructor(){this._boundingVolumeCache=new Pd(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,i,s,l){const h=1<<s.z,f=1/h,_=s.x/h,x=s.y/h;let T=2;return T=Math.min(T,Ul(e,i,_,x,f)),T=Math.min(T,Ul(e,i,_+.5,-x-f,f)),T=Math.min(T,Ul(e,i,_+.5,2-x-f,f)),T}getWrap(e,i,s){const l=1<<i.z,h=1/l,f=i.x/l,_=Rs(e.x,f,h),x=Rs(e.x,f-1,h),T=Rs(e.x,f+1,h),M=Math.min(_,x,T);return M===T?1:M===x?-1:0}allowVariableZoom(e,i){return Se(e,i)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,i,s,l){return this._boundingVolumeCache.getTileBoundingVolume(e,i,s,l)}_computeTileBoundingVolume(e,i,s,l){var h,f;let _=s,x=s;if(l!=null&&l.terrain){const T=new o.Z(e.z,i,e.z,e.x,e.y),M=l.terrain.getMinMaxElevation(T);_=(h=M.minElevation)!==null&&h!==void 0?h:s,x=(f=M.maxElevation)!==null&&f!==void 0?f:s}if(_/=o.bt,x/=o.bt,_+=1,x+=1,e.z<=0)return Xn.fromAabb([-x,-x,-x],[x,x,x]);if(e.z===1)return Xn.fromAabb([e.x===0?-x:0,e.y===0?0:-x,-x],[e.x===0?0:x,e.y===0?x:0,x]);{const T=[nn(0,0,e.x,e.y,e.z),nn(o.$,0,e.x,e.y,e.z),nn(o.$,o.$,e.x,e.y,e.z),nn(0,o.$,e.x,e.y,e.z)],M=[];for(const me of T)M.push(o.aQ([],me,x));if(x!==_)for(const me of T)M.push(o.aQ([],me,_));e.y===0&&M.push([0,1,0]),e.y===(1<<e.z)-1&&M.push([0,-1,0]);const E=[1,1,1],I=[-1,-1,-1];for(const me of M)for(let ve=0;ve<3;ve++)E[ve]=Math.min(E[ve],me[ve]),I[ve]=Math.max(I[ve],me[ve]);const k=nn(o.$/2,o.$/2,e.x,e.y,e.z),O=o.aV([],[0,1,0],k);o.aU(O,O);const q=o.aV([],k,O);o.aU(q,q);const G=o.aV([],T[2],T[1]);o.aU(G,G);const W=o.aV([],T[0],T[3]);o.aU(W,W),M.push(o.aQ([],k,x)),e.y>=(1<<e.z)/2&&M.push(o.aQ([],nn(o.$/2,0,e.x,e.y,e.z),x)),e.y<(1<<e.z)/2&&M.push(o.aQ([],nn(o.$/2,o.$,e.x,e.y,e.z),x));const X=pr(k,M),ee=pr(q,M),Y=[-k[0],-k[1],-k[2],X.max],ie=[k[0],k[1],k[2],-X.min],ne=[-q[0],-q[1],-q[2],ee.max],K=[q[0],q[1],q[2],-ee.min],le=[...G,0],ye=[...W,0],pe=[];return e.y===0?pe.push(o.bs(ye,le,Y),o.bs(ye,le,ie)):pe.push(o.bs(ne,le,Y),o.bs(ne,le,ie),o.bs(ne,ye,Y),o.bs(ne,ye,ie)),e.y===(1<<e.z)-1?pe.push(o.bs(ye,le,Y),o.bs(ye,le,ie)):pe.push(o.bs(K,le,Y),o.bs(K,le,ie),o.bs(K,ye,Y),o.bs(K,ye,ie)),new Xn(pe,[Y,ie,ne,K,le,ye],E,I)}}}function pr(u,e){let i=1/0,s=-1/0;for(const l of e){const h=o.aW(u,l);i=Math.min(i,h),s=Math.max(s,h)}return{min:i,max:s}}class Wa{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.bu(),this._projectionMatrix=o.b8(),this._globeViewProjMatrix32f=o.b7(),this._globeViewProjMatrixNoCorrection=o.b8(),this._globeViewProjMatrixNoCorrectionInverted=o.b8(),this._globeProjMatrixInverted=o.b8(),this._cameraPosition=o.bo(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new Is({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,i)=>this.getConstrained(e,i)}),this._coveringTilesDetailsProvider=new Md}clone(){const e=new Wa;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.bo();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 _=-l,x=h;const T=Math.sqrt(_*_+x*x);_/=T,x/=T;const M=[0,_,x];o.bv(M,M,[0,0,0],-this.bearingInRadians),o.bw(M,M,[0,0,0],-1*this.center.lat*Math.PI/180),o.bx(M,M,[0,0,0],this.center.lng*Math.PI/180);const E=1/o.aY(M);return o.aQ(M,M,E),[...M,-f*E]}isLocationOccluded(e){return!this.isSurfacePointVisible(Ri(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]],_=[0,0,0];o.aV(_,f,h),o.aU(f,f),o.aU(_,_);const x=[0,0,0];return o.aU(x,[f[0]*e[0]+_[0]*e[1]+h[0]*e[2],f[1]*e[0]+_[1]*e[1]+h[1]*e[2],f[2]*e[0]+_[2]*e[1]+h[2]*e[2]]),x}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(_,x,T){const M=1/(1<<T.z);return new o.a0(_/o.$*M+T.x*M,x/o.$*M+T.y*M)}(e,i,s.canonical),h=(f=l.y,[o.bn(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=nn(e,i,h.x,h.y,h.z),_=1+(l?l(e,i):0)/o.bt,x=[f[0]*_,f[1]*_,f[2]*_,1];o.av(x,x,this._globeViewProjMatrixNoCorrection);const T=this._cachedClippingPlane,M=T[0]*f[0]+T[1]*f[1]+T[2]*f[2]+T[3]<0;return{point:new o.P(x[0]/x[3],x[1]/x[3]),signedDistanceFromCamera:x[3],isOccluded:M}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const e=Ua(this.worldSize,this.center.lat),i=o.b9(),s=o.b9();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),o.b3(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.b4(i),this._globeProjMatrixInverted=o.b9(),o.ap(this._globeProjMatrixInverted,i),o.M(i,i,[0,0,-this.cameraToCenterDistance]),o.b5(i,i,this.rollInRadians),o.b6(i,i,-this.pitchInRadians),o.b5(i,i,this.bearingInRadians),o.M(i,i,[0,0,-e]);const h=o.bo();h[0]=e,h[1]=e,h[2]=e,o.b6(s,i,this.center.lat*Math.PI/180),o.by(s,s,-this.center.lng*Math.PI/180),o.N(s,s,h),this._globeViewProjMatrixNoCorrection=s,o.b6(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),o.by(i,i,-this.center.lng*Math.PI/180),o.N(i,i,h),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=o.b9(),o.ap(this._globeViewProjMatrixNoCorrectionInverted,s);const f=o.bo();this._cameraPosition=o.bo(),this._cameraPosition[2]=this.cameraToCenterDistance/e,o.bv(this._cameraPosition,this._cameraPosition,f,-this.rollInRadians),o.bw(this._cameraPosition,this._cameraPosition,f,this.pitchInRadians),o.bv(this._cameraPosition,this._cameraPosition,f,-this.bearingInRadians),o.aR(this._cameraPosition,this._cameraPosition,[0,0,1]),o.bw(this._cameraPosition,this._cameraPosition,f,-this.center.lat*Math.PI/180),o.bx(this._cameraPosition,this._cameraPosition,f,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);const _=o.b4(this._globeViewProjMatrixNoCorrectionInverted);o.N(_,_,[1,1,-1]),this._cachedFrustum=rr.fromInvProjectionMatrix(_,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){o.w("calculateFogMatrix is not supported on globe projection.");const i=o.b9();return o.af(i),i}getVisibleUnwrappedCoordinates(e){return[new o.b1(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=Ri(e);o.aQ(s,s,1+i/o.bt);const l=o.bu();return o.av(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 E of s)l.push(this.unprojectScreenPoint(E));let h=0,f=0,_=0,x=0;const T=this.center;for(const E of l){const I=o.bz(T.lng,E.lng),k=o.bz(T.lat,E.lat);I<f&&(f=I),I>h&&(h=I),k<x&&(x=k),k>_&&(_=k)}const M=[T.lng+f,T.lat+x,T.lng+h,T.lat+_];return this.isSurfacePointOnScreen([0,1,0])&&(M[3]=90,M[0]=-180,M[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(M[1]=-90,M[0]=-180,M[2]=180),new Wt(M)}getConstrained(e,i){const s=o.ag(e.lat,-85.051129,o.ah),l=o.ag(+i,this.minZoom+bi(0,s),this.maxZoom);return{center:new o.S(e.lng,s),zoom:l}}calculateCenterFromCameraLngLatAlt(e,i,s,l){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,s,l)}setLocationAtPoint(e,i){const s=Ri(this.unprojectScreenPoint(i)),l=Ri(e),h=o.bo();o.bA(h);const f=o.bo();o.bx(f,s,h,-this.center.lng*Math.PI/180),o.bw(f,f,h,this.center.lat*Math.PI/180);const _=l[0]*l[0]+l[2]*l[2],x=f[0]*f[0];if(_<x)return;const T=Math.sqrt(_-x),M=-T,E=o.bB(l[0],l[2],f[0],T),I=o.bB(l[0],l[2],f[0],M),k=o.bo();o.bx(k,l,h,-E);const O=o.bB(k[1],k[2],f[1],f[2]),q=o.bo();o.bx(q,l,h,-I);const G=o.bB(q[1],q[2],f[1],f[2]),W=.5*Math.PI,X=O>=-W&&O<=W,ee=G>=-W&&G<=W;let Y,ie;if(X&&ee){const ye=this.center.lng*Math.PI/180,pe=this.center.lat*Math.PI/180;o.bC(E,ye)+o.bC(O,pe)<o.bC(I,ye)+o.bC(G,pe)?(Y=E,ie=O):(Y=I,ie=G)}else if(X)Y=E,ie=O;else{if(!ee)return;Y=I,ie=G}const ne=Y/Math.PI*180,K=ie/Math.PI*180,le=this.center.lat;this.setCenter(new o.S(ne,o.ag(K,-90,90))),this.setZoom(this.zoom+bi(le,this.center.lat))}locationToScreenPoint(e,i){const s=Ri(e);if(i){const l=i.getElevationForLngLatZoom(e,this._helper._tileZoom);o.aQ(s,s,1+l/o.bt)}return this._projectSurfacePointToScreen(s)}_projectSurfacePointToScreen(e){const i=o.bu();return o.av(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.a0.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.bu();i[0]=e.x/this.width*2-1,i[1]=-1*(e.y/this.height*2-1),i[2]=1,i[3]=1,o.av(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];const s=o.bo();s[0]=i[0]-this._cameraPosition[0],s[1]=i[1]-this._cameraPosition[1],s[2]=i[2]-this._cameraPosition[2];const l=o.bo();return o.aU(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.bu();return o.av(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.aW(e,i),l=o.bo(),h=o.bo();o.aQ(h,i,s),o.aT(l,e,h);const f=1-o.aW(l,l);if(f<0)return null;const _=o.aW(e,e)-1,x=-s+(s<0?1:-1)*Math.sqrt(f),T=_/x,M=x;return{tMin:Math.min(T,M),tMax:Math.max(T,M)}}unprojectScreenPoint(e){const i=this._cameraPosition,s=this.getRayDirectionFromPixel(e),l=this.rayPlanetIntersection(i,s);if(l){const M=o.bo();o.aR(M,i,[s[0]*l.tMin,s[1]*l.tMin,s[2]*l.tMin]);const E=o.bo();return o.aU(E,M),As(E)}const h=this._cachedClippingPlane,f=h[0]*s[0]+h[1]*s[1]+h[2]*s[2],_=-o.b0(h,i)/f,x=o.bo();if(_>0)o.aR(x,i,[s[0]*_,s[1]*_,s[2]*_]);else{const M=o.bo();o.aR(M,i,[2*s[0],2*s[1],2*s[2]]);const E=o.b0(this._cachedClippingPlane,M);o.aT(x,M,[this._cachedClippingPlane[0]*E,this._cachedClippingPlane[1]*E,this._cachedClippingPlane[2]*E])}const T=function(M){const E=o.bo();return E[0]=M[0]*-M[3],E[1]=M[1]*-M[3],E[2]=M[2]*-M[3],{center:E,radius:Math.sqrt(1-M[3]*M[3])}}(h);return As(function(M,E,I){const k=o.bo();o.aT(k,I,M);const O=o.bo();return o.bp(O,M,k,E/o.a_(k)),O}(T.center,T.radius,x))}getMatrixForModel(e,i){const s=o.S.convert(e),l=1/o.bt,h=o.b8();return o.by(h,h,s.lng/180*Math.PI),o.b6(h,h,-s.lat/180*Math.PI),o.M(h,h,[0,0,1+i/o.bt]),o.b6(h,h,.5*Math.PI),o.N(h,h,[l,l,l]),h}getProjectionDataForCustomLayer(e=!0){const i=this.getProjectionData({overscaledTileID:new o.Z(0,0,0,0,0),applyGlobeMatrix:e});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(e){}}class Dr{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().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new Is({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,i)=>this.getConstrained(e,i)}),this._globeness=1,this._mercatorTransform=new vi,this._verticalPerspectiveTransform=new Wa}clone(){const e=new Dr;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.bj(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return o.bj(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.bj(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 wr{get useGlobeControls(){return!0}handlePanInertia(e,i){const s=ks(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 _=o.bz(i.center.lng,l.lng),x=_/(Math.abs(_/180)+1),T=o.bz(i.center.lat,l.lat),M=i.getRayDirectionFromPixel(s),E=i.cameraPosition,I=-1*o.aW(E,M),k=o.bo();o.aR(k,E,[M[0]*I,M[1]*I,M[2]*I]);const O=o.aY(k)-1,q=Math.exp(.5*-Math.max(O-.3,0)),G=Ua(i.worldSize,i.center.lat)/Math.min(i.width,i.height),W=o.bm(G,.9,.5,1,.25),X=(1-o.ae(-f))*Math.min(q,W),ee=i.center.lat,Y=i.zoom,ie=new o.S(i.center.lng+x*X,o.ag(i.center.lat+T*X,-85.051129,o.ah));i.setLocationAtPoint(l,s);const ne=i.center,K=o.bm(Math.abs(_),45,85,0,1),le=o.bm(G,.75,.35,0,1),ye=Math.pow(Math.max(K,le),.25),pe=o.bz(ne.lng,ie.lng),me=o.bz(ne.lat,ie.lat);i.setCenter(new o.S(ne.lng+pe*ye,ne.lat+me*ye).wrap()),i.setZoom(Y+bi(ee,i.center.lat))}handleMapControlsPan(e,i,s){if(!e.panDelta)return;const l=i.center.lat,h=i.zoom;i.setCenter(ks(e.panDelta,i).wrap()),i.setZoom(h+bi(l,i.center.lat))}cameraForBoxAndBearing(e,i,s,l,h){const f=ri(e,i,s,l,h),_=i.left/h.width*2-1,x=(h.width-i.right)/h.width*2-1,T=i.top/h.height*-2+1,M=(h.height-i.bottom)/h.height*-2+1,E=o.bz(s.getWest(),s.getEast())<0,I=E?s.getEast():s.getWest(),k=E?s.getWest():s.getEast(),O=Math.max(s.getNorth(),s.getSouth()),q=Math.min(s.getNorth(),s.getSouth()),G=I+.5*o.bz(I,k),W=O+.5*o.bz(O,q),X=h.clone();X.setCenter(f.center),X.setBearing(f.bearing),X.setPitch(0),X.setRoll(0),X.setZoom(f.zoom);const ee=X.modelViewProjectionMatrix,Y=[Ri(s.getNorthWest()),Ri(s.getNorthEast()),Ri(s.getSouthWest()),Ri(s.getSouthEast()),Ri(new o.S(k,W)),Ri(new o.S(I,W)),Ri(new o.S(G,O)),Ri(new o.S(G,q))],ie=Ri(f.center);let ne=Number.POSITIVE_INFINITY;for(const K of Y)_<0&&(ne=wr.getLesserNonNegativeNonNull(ne,wr.solveVectorScale(K,ie,ee,"x",_))),x>0&&(ne=wr.getLesserNonNegativeNonNull(ne,wr.solveVectorScale(K,ie,ee,"x",x))),T>0&&(ne=wr.getLesserNonNegativeNonNull(ne,wr.solveVectorScale(K,ie,ee,"y",T))),M<0&&(ne=wr.getLesserNonNegativeNonNull(ne,wr.solveVectorScale(K,ie,ee,"y",M)));if(Number.isFinite(ne)&&ne!==0)return f.zoom=X.zoom+o.aj(ne),f;nr()}handleJumpToCenterZoom(e,i){const s=e.center.lat,l=e.getConstrained(i.center?o.S.convert(i.center):e.center,e.zoom).center;e.setCenter(l.wrap());const h=i.zoom!==void 0?+i.zoom:e.zoom+bi(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},_={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},x=i.zoom!==void 0,T=!e.isPaddingEqual(i.padding);let M=!1;const E=i.center?o.S.convert(i.center):l,I=e.getConstrained(E,s).center;kn(e,I);const k=e.clone();k.setCenter(I),k.setZoom(x?+i.zoom:s+bi(l.lat,E.lat)),k.setBearing(i.bearing);const O=new o.P(o.ag(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),o.ag(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));k.setLocationAtPoint(I,O);const q=(i.offset&&i.offsetAsPoint.mag())>0?k.center:I,G=x?+i.zoom:s+bi(l.lat,q.lat),W=s+bi(l.lat,0),X=G+bi(q.lat,0),ee=o.bz(l.lng,q.lng),Y=o.bz(l.lat,q.lat),ie=o.ae(X-W);return M=G!==s,{easeFunc:ne=>{if(o.bd(f,_)||ki({startEulerAngles:f,endEulerAngles:_,tr:e,k:ne,useSlerp:f.roll!=_.roll}),T&&e.interpolatePadding(h,i.padding,ne),i.around)o.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(i.around,i.aroundPoint);else{const K=X>W?Math.min(2,ie):Math.max(.5,ie),le=Math.pow(K,1-ne),ye=qa(l,ee,Y,ne*le);e.setCenter(ye.wrap())}if(M){const K=o.C.number(W,X,ne)+bi(0,e.center.lat);e.setZoom(K)}},isZooming:M,elevationCenter:q}}handleFlyTo(e,i){const s=i.zoom!==void 0,l=e.center,h=e.zoom,f=e.padding,_=!e.isPaddingEqual(i.padding),x=e.getConstrained(o.S.convert(i.center||i.locationAtOffset),h).center,T=s?+i.zoom:e.zoom+bi(e.center.lat,x.lat),M=e.clone();M.setCenter(x),M.setZoom(T),M.setBearing(i.bearing);const E=new o.P(o.ag(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),o.ag(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));M.setLocationAtPoint(x,E);const I=M.center;kn(e,I);const k=function(Y,ie,ne){const K=Ri(ie),le=Ri(ne),ye=o.aW(K,le),pe=Math.acos(ye),me=zs(Y);return pe/(2*Math.PI)*me}(e,l,I),O=h+bi(l.lat,0),q=T+bi(I.lat,0),G=o.ae(q-O);let W;if(typeof i.minZoom=="number"){const Y=+i.minZoom+bi(I.lat,0),ie=Math.min(Y,O,q)+bi(0,I.lat),ne=e.getConstrained(I,ie).zoom+bi(I.lat,0);W=o.ae(ne-O)}const X=o.bz(l.lng,I.lng),ee=o.bz(l.lat,I.lat);return{easeFunc:(Y,ie,ne,K)=>{const le=qa(l,X,ee,ne);_&&e.interpolatePadding(f,i.padding,Y);const ye=Y===1?I:le;e.setCenter(ye.wrap());const pe=O+o.aj(ie);e.setZoom(Y===1?T:pe+bi(0,ye.lat))},scaleOfZoom:G,targetCenter:I,scaleOfMinZoom:W,pixelPathLength:k}}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]],_=[s[3],s[7],s[11],s[15]],x=e[0]*f[0]+e[1]*f[1]+e[2]*f[2],T=e[0]*_[0]+e[1]*_[1]+e[2]*_[2],M=i[0]*f[0]+i[1]*f[1]+i[2]*f[2],E=i[0]*_[0]+i[1]*_[1]+i[2]*_[2];return M+h*T===x+h*E||_[3]*(x-M)+f[3]*(E-T)+x*E==M*T?null:(M+f[3]-h*E-h*_[3])/(M-x-h*E+h*T)}static getLesserNonNegativeNonNull(e,i){return i!==null&&i>=0&&i<e?i:e}}class $l{constructor(e){this._globe=e,this._mercatorCameraHelper=new Ro,this._verticalPerspectiveCameraHelper=new wr}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 Ds=(u,e)=>o.y(u,e&&e.filter(i=>i.identifier!=="source.canvas")),Ha=o.bD();class Gl 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 Er(Zr(),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 Qr,this.imageManager.setEventedParent(this),this.glyphManager=new Zi(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new tr(256,512),this.crossTileSymbolIndex=new zo,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new o.bE,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",o.bF()),Le().on(Ar,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 _=this._layers[f];_.source===h.id&&this._validateLayer(_)}})}setGlobalStateProperty(e,i){var s,l,h;this._checkLoaded();const f=i===null?(h=(l=(s=this.stylesheet.state)===null||s===void 0?void 0:s[e])===null||l===void 0?void 0:l.default)!==null&&h!==void 0?h:null:i;if(o.bG(f,this._globalState[e]))return this;this._globalState[e]=f;const _=this._findGlobalStateAffectedSources([e]);for(const x in this.sourceCaches)_.has(x)&&(this._reloadSource(x),this._changed=!0)}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();const i=[];for(const l in e)!o.bG(this._globalState[l],e[l].default)&&(i.push(l),this._globalState[l]=e[l].default);const s=this._findGlobalStateAffectedSources(i);for(const l in this.sourceCaches)s.has(l)&&(this._reloadSource(l),this._changed=!0)}_findGlobalStateAffectedSources(e){if(e.length===0)return new Set;const i=new Set;for(const s in this._layers){const l=this._layers[s],h=l.getLayoutAffectingGlobalStateRefs();for(const f of e)h.has(f)&&i.add(l.source)}return i}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,Ce.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(Ha,{validate:!1})}_load(e,i,s){var l,h,f;const _=i.transformStyle?i.transformStyle(s,e):e;if(!i.validate||!Ds(this,o.z(_))){this._loaded=!0,this.stylesheet=_;for(const x in _.sources)this.addSource(x,_.sources[x],{validate:!1});_.sprite?this._loadSprite(_.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(_.glyphs),this._createLayers(),this.light=new It(this.stylesheet.light),this._setProjectionInternal(((l=this.stylesheet.projection)===null||l===void 0?void 0:l.type)||"mercator"),this.sky=new cr(this.stylesheet.sky),this.map.setTerrain((h=this.stylesheet.terrain)!==null&&h!==void 0?h:null),this.setGlobalState((f=this.stylesheet.state)!==null&&f!==void 0?f:null),this.fire(new o.l("data",{dataType:"style"})),this.fire(new o.l("style.load"))}}_createLayers(){const e=o.bH(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.bI(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,_,x){return o._(this,void 0,void 0,function*(){const T=Ft(h),M=_>1?"@2x":"",E={},I={};for(const{id:k,url:O}of T){const q=f.transformRequest(or(O,M,".json"),"SpriteJSON");E[k]=o.j(q,x);const G=f.transformRequest(or(O,M,".png"),"SpriteImage");I[k]=li.getImage(G,x)}return yield Promise.all([...Object.values(E),...Object.values(I)]),function(k,O){return o._(this,void 0,void 0,function*(){const q={};for(const G in k){q[G]={};const W=Ce.getImageCanvasContext((yield O[G]).data),X=(yield k[G]).data;for(const ee in X){const{width:Y,height:ie,x:ne,y:K,sdf:le,pixelRatio:ye,stretchX:pe,stretchY:me,content:ve,textFitWidth:je,textFitHeight:Fe}=X[ee];q[G][ee]={data:null,pixelRatio:ye,sdf:le,stretchX:pe,stretchY:me,content:ve,textFitWidth:je,textFitHeight:Fe,spriteData:{width:Y,height:ie,x:ne,y:K,context:W}}}}return q})}(E,I)})}(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 _=this._spritesImagesIds[f]?this._spritesImagesIds[f].filter(x=>!(x in h)):[];for(const x of _)this.imageManager.removeImage(x),this._changedImages[x]=!0;for(const x in h[f]){const T=f==="default"?x:`${f}:${x}`;this._spritesImagesIds[f].push(T),T in this.imageManager.images?this.imageManager.updateImage(T,h[f][x],!1):this.imageManager.addImage(T,h[f][x]),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.bJ(s):s);const l=[];for(const h of e)if(s[h]){const f=i?o.bJ(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 _=this._updatedSources[f];if(_==="reload")this._reloadSource(f);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);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)&&Ds(this,o.z(e)))return!1;(e=o.bJ(e)).layers=o.bH(e.layers);const h=o.bK(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 _ of f.operations)_();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"setGlobalState":i.push(()=>this.setGlobalState.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.z.source,`sources.${e}`,i,null,s))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const l=this.sourceCaches[e]=new Me(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(Ds(this,o.bL(e)))return;h=o.bI(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(l,e.source),e=o.bJ(e),e=o.e(e,{source:l})),this._validate(o.z.layer,`layers.${l}`,e,{arrayIndex:-1},s))return;h=o.bI(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 _=this._removedLayers[l];delete this._removedLayers[l],_.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.bG(l.filter,i))return i==null?(l.setFilter(void 0),void this._updateLayer(l)):void(this._validate(o.z.filter,`layers.${l.id}.filter`,i,null,s)||(l.setFilter(o.bJ(i)),this._updateLayer(l)))}else this.fire(new o.k(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return o.bJ(this.getLayer(e).filter)}setLayoutProperty(e,i,s,l={}){this._checkLoaded();const h=this.getLayer(e);h?o.bG(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.bG(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.bM(this.sourceCaches,h=>h.serialize()),i=this._serializeByIds(this._order,!0),s=this.map.getTerrain()||void 0,l=this.stylesheet;return o.bN({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 _=this._order[f];if(i(_)){s[_]=f;for(const x of e){const T=x[_];if(T)for(const M of T)l.push(M)}}}l.sort((f,_)=>_.intersectionZ-f.intersectionZ);const h=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(i(_))for(let x=l.length-1;x>=0;x--){const T=l[x].feature;if(s[T.layer.id]<f)break;h.push(T),l.pop()}else for(const x of e){const T=x[_];if(T)for(const M of T)h.push(M.feature)}}return h}queryRenderedFeatures(e,i,s){i&&i.filter&&this._validate(o.z.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 M=this._layers[T];if(!M)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[M.source]=!0}}const h=[];i.availableImages=this._availableImages;const f=this._serializedAllLayers(),_=i.layers instanceof Set?i.layers:Array.isArray(i.layers)?new Set(i.layers):null,x=Object.assign(Object.assign({},i),{layers:_});for(const T in this.sourceCaches)i.layers&&!l[T]||h.push(zt(this.sourceCaches[T],this._layers,f,e,x,s,this.map.terrain?(M,E,I)=>this.map.terrain.getElevation(M,E,I):void 0));return this.placement&&h.push(function(T,M,E,I,k,O,q){const G={},W=O.queryRenderedSymbols(I),X=[];for(const ee of Object.keys(W).map(Number))X.push(q[ee]);X.sort($i);for(const ee of X){const Y=ee.featureIndex.lookupSymbolFeatures(W[ee.bucketInstanceId],M,ee.bucketIndex,ee.sourceLayerIndex,k.filter,k.layers,k.availableImages,T);for(const ie in Y){const ne=G[ie]=G[ie]||[],K=Y[ie];K.sort((le,ye)=>{const pe=ee.featureSortOrder;if(pe){const me=pe.indexOf(le.featureIndex);return pe.indexOf(ye.featureIndex)-me}return ye.featureIndex-le.featureIndex});for(const le of K)ne.push(le)}}return function(ee,Y,ie){for(const ne in ee)for(const K of ee[ne])_i(K,ie[Y[ne].source]);return ee}(G,T,E)}(this._layers,f,this.sourceCaches,e,x,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(h)}querySourceFeatures(e,i){i&&i.filter&&this._validate(o.z.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)),_=[],x={};for(let T=0;T<f.length;T++){const M=f[T],E=M.tileID.canonical.key;x[E]||(x[E]=!0,M.querySourceFeatures(_,h))}return _}(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.bG(e[f],s[f])){l=!0;break}if(!l)return;const h={now:Ce.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.bG(e[f],s[f])){l=!0;break}if(!l)return;const h={now:Ce.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 Dr,cameraHelper:new $l(l)}}switch(s){case"mercator":return{projection:new Nl,transform:new vi,cameraHelper:new Ro};case"globe":{const l=new Es({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:l,transform:new Dr,cameraHelper:new $l(l)}}case"vertical-perspective":return{projection:new Lu,transform:new Wa,cameraHelper:new wr};default:return o.w(`Unknown projection name: ${s}. Falling back to mercator projection.`),{projection:new Nl,transform:new vi,cameraHelper:new Ro}}}(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)&&Ds(this,e.call(o.z,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),Le().off(Ar,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,_=!1;const x={};for(const T of this._order){const M=this._layers[T];if(M.type!=="symbol")continue;if(!x[M.source]){const I=this.sourceCaches[M.source];x[M.source]=I.getRenderableIds(!0).map(k=>I.getTileByID(k)).sort((k,O)=>O.tileID.overscaledZ-k.tileID.overscaledZ||(k.tileID.isLessThan(O.tileID)?-1:1))}const E=this.crossTileSymbolIndex.addLayer(M,x[M.source],e.center.lng);f=f||E}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((h=h||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(Ce.now(),e.zoom))&&(this.pauseablePlacement=new Ru(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,x),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(Ce.now()),_=!0),f&&this.pauseablePlacement.placement.setStale()),_||f)for(const T of this._order){const M=this._layers[T];M.type==="symbol"&&this.placement.updateLayerOpacities(M,x[M.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(Ce.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.z.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=[...Ft(this.stylesheet.sprite),...h];this._validate(o.z.sprite,"sprite",f,null,s)||(this.stylesheet.sprite=f,this._loadSprite(h,!0,l))}removeSprite(e){this._checkLoaded();const i=Ft(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 Ft(this.stylesheet.sprite)}setSprite(e,i={},s){this._checkLoaded(),e&&this._validate(o.z.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,s):(this._unloadSprite(),s&&s(null)))}}var Cd=o.aI([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Id{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,_,x,T){this.context=e;let M=this.boundPaintVertexBuffers.length!==l.length;for(let E=0;!M&&E<l.length;E++)this.boundPaintVertexBuffers[E]!==l[E]&&(M=!0);!this.vao||this.boundProgram!==i||this.boundLayoutVertexBuffer!==s||M||this.boundIndexBuffer!==h||this.boundVertexOffset!==f||this.boundDynamicVertexBuffer!==_||this.boundDynamicVertexBuffer2!==x||this.boundDynamicVertexBuffer3!==T?this.freshBind(i,s,l,h,f,_,x,T):(e.bindVertexArray.set(this.vao),_&&_.bind(),h&&h.dynamicDraw&&h.bind(),x&&x.bind(),T&&T.bind())}freshBind(e,i,s,l,h,f,_,x){const T=e.numAttributes,M=this.context,E=M.gl;this.vao&&this.destroy(),this.vao=M.createVertexArray(),M.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=i,this.boundPaintVertexBuffers=s,this.boundIndexBuffer=l,this.boundVertexOffset=h,this.boundDynamicVertexBuffer=f,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=x,i.enableAttributes(E,e);for(const I of s)I.enableAttributes(E,e);f&&f.enableAttributes(E,e),_&&_.enableAttributes(E,e),x&&x.enableAttributes(E,e),i.bind(),i.setVertexAttribPointers(E,e,h);for(const I of s)I.bind(),I.setVertexAttribPointers(E,e,h);f&&(f.bind(),f.setVertexAttribPointers(E,e,h)),l&&l.bind(),_&&(_.bind(),_.setVertexAttribPointers(E,e,h)),x&&(x.bind(),x.setVertexAttribPointers(E,e,h)),M.currentNumAttributes=T}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Ed=(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.be.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.be.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:l?1:0}),zd={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 Do(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 Lo{constructor(e,i,s,l,h,f,_,x,T=[]){const M=e.gl;this.program=M.createProgram();const E=Do(i.staticAttributes),I=s?s.getBinderAttributes():[],k=E.concat(I),O=yn.prelude.staticUniforms?Do(yn.prelude.staticUniforms):[],q=_.staticUniforms?Do(_.staticUniforms):[],G=i.staticUniforms?Do(i.staticUniforms):[],W=s?s.getBinderUniforms():[],X=O.concat(q).concat(G).concat(W),ee=[];for(const pe of X)ee.indexOf(pe)<0&&ee.push(pe);const Y=s?s.defines():[];dr(M)&&Y.unshift("#version 300 es"),h&&Y.push("#define OVERDRAW_INSPECTOR;"),f&&Y.push("#define TERRAIN3D;"),x&&Y.push(x),T&&Y.push(...T);let ie=Y.concat(yn.prelude.fragmentSource,_.fragmentSource,i.fragmentSource).join(`
747
- `),ne=Y.concat(yn.prelude.vertexSource,_.vertexSource,i.vertexSource).join(`
748
- `);dr(M)||(ie=function(pe){return pe.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(ie),ne=function(pe){return pe.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(ne));const K=M.createShader(M.FRAGMENT_SHADER);if(M.isContextLost())return void(this.failedToCreate=!0);if(M.shaderSource(K,ie),M.compileShader(K),!M.getShaderParameter(K,M.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${M.getShaderInfoLog(K)}`);M.attachShader(this.program,K);const le=M.createShader(M.VERTEX_SHADER);if(M.isContextLost())return void(this.failedToCreate=!0);if(M.shaderSource(le,ne),M.compileShader(le),!M.getShaderParameter(le,M.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${M.getShaderInfoLog(le)}`);M.attachShader(this.program,le),this.attributes={};const ye={};this.numAttributes=k.length;for(let pe=0;pe<this.numAttributes;pe++)k[pe]&&(M.bindAttribLocation(this.program,pe,k[pe]),this.attributes[k[pe]]=pe);if(M.linkProgram(this.program),!M.getProgramParameter(this.program,M.LINK_STATUS))throw new Error(`Program failed to link: ${M.getProgramInfoLog(this.program)}`);M.deleteShader(le),M.deleteShader(K);for(let pe=0;pe<ee.length;pe++){const me=ee[pe];if(me&&!ye[me]){const ve=M.getUniformLocation(this.program,me);ve&&(ye[me]=ve)}}this.fixedUniforms=l(e,ye),this.terrainUniforms=((pe,me)=>({u_depth:new o.bO(pe,me.u_depth),u_terrain:new o.bO(pe,me.u_terrain),u_terrain_dim:new o.bf(pe,me.u_terrain_dim),u_terrain_matrix:new o.bQ(pe,me.u_terrain_matrix),u_terrain_unpack:new o.bR(pe,me.u_terrain_unpack),u_terrain_exaggeration:new o.bf(pe,me.u_terrain_exaggeration)}))(e,ye),this.projectionUniforms=((pe,me)=>({u_projection_matrix:new o.bQ(pe,me.u_projection_matrix),u_projection_tile_mercator_coords:new o.bR(pe,me.u_projection_tile_mercator_coords),u_projection_clipping_plane:new o.bR(pe,me.u_projection_clipping_plane),u_projection_transition:new o.bf(pe,me.u_projection_transition),u_projection_fallback_matrix:new o.bQ(pe,me.u_projection_fallback_matrix)}))(e,ye),this.binderUniforms=s?s.getUniforms(e,ye):[]}draw(e,i,s,l,h,f,_,x,T,M,E,I,k,O,q,G,W,X,ee){const Y=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(s),e.setStencilMode(l),e.setColorMode(h),e.setCullFace(f),x){e.activeTexture.set(Y.TEXTURE2),Y.bindTexture(Y.TEXTURE_2D,x.depthTexture),e.activeTexture.set(Y.TEXTURE3),Y.bindTexture(Y.TEXTURE_2D,x.texture);for(const ne in this.terrainUniforms)this.terrainUniforms[ne].set(x[ne])}if(T)for(const ne in T)this.projectionUniforms[zd[ne]].set(T[ne]);if(_)for(const ne in this.fixedUniforms)this.fixedUniforms[ne].set(_[ne]);G&&G.setUniforms(e,this.binderUniforms,O,{zoom:q});let ie=0;switch(i){case Y.LINES:ie=2;break;case Y.TRIANGLES:ie=3;break;case Y.LINE_STRIP:ie=1}for(const ne of k.get()){const K=ne.vaos||(ne.vaos={});(K[M]||(K[M]=new Id)).bind(e,this,E,G?G.getPaintVertexBuffers():[],I,ne.vertexOffset,W,X,ee),Y.drawElements(i,ne.primitiveLength*ie,Y.UNSIGNED_SHORT,ne.primitiveOffset*ie*2)}}}function Bo(u,e,i){const s=1/o.aB(i,1,e.transform.tileZoom),l=Math.pow(2,i.tileID.overscaledZ),h=i.tileSize*Math.pow(2,e.transform.tileZoom)/l,f=h*(i.tileID.canonical.x+i.tileID.wrap*l),_=h*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[s,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const Ls=(u,e,i,s)=>{const l=u.style.light,h=l.properties.get("position"),f=[h.x,h.y,h.z],_=o.bU();l.properties.get("anchor")==="viewport"&&o.bV(_,u.transform.bearingInRadians),o.bW(f,f,_);const x=u.transform.transformLightDirection(f),T=l.properties.get("color");return{u_lightpos:f,u_lightpos_globe:x,u_lightintensity:l.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+e,u_opacity:i,u_fill_translate:s}},ql=(u,e,i,s,l,h,f)=>o.e(Ls(u,e,i,s),Bo(h,u,f),{u_height_factor:-Math.pow(2,l.overscaledZ)/f.tileSize/8}),Fo=(u,e,i,s)=>o.e(Bo(e,u,i),{u_fill_translate:s}),vn=(u,e)=>({u_world:u,u_fill_translate:e}),Ad=(u,e,i,s,l)=>o.e(Fo(u,e,i,l),{u_world:s}),Wl=(u,e,i,s,l)=>{const h=u.transform;let f,_,x=0;if(i.paint.get("circle-pitch-alignment")==="map"){const T=o.aB(e,1,h.zoom);f=!0,_=[T,T],x=T/(o.$*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*l}else f=!1,_=h.pixelsToGLUnits;return{u_camera_to_center_distance:h.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+f,u_device_pixel_ratio:u.pixelRatio,u_extrude_scale:_,u_globe_extrude_scale:x,u_translate:s}},Bs=u=>({u_pixel_extrude_scale:[1/u.width,1/u.height]}),Fs=u=>({u_viewport_size:[u.width,u.height]}),Fu=(u,e=1)=>({u_color:u,u_overlay:0,u_overlay_scale:e}),Os=(u,e,i,s)=>{const l=o.aB(u,1,e)/(o.$*Math.pow(2,u.tileID.overscaledZ))*2*Math.PI*s;return{u_extrude_scale:o.aB(u,1,e),u_intensity:i,u_globe_extrude_scale:l}},Ou=(u,e,i,s)=>{const l=o.L();o.bX(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")}},Xa=(u,e,i)=>{const s=i.paint.get("hillshade-accent-color");let l;switch(i.paint.get("hillshade-method")){case"basic":l=4;break;case"combined":l=1;break;case"igor":l=2;break;case"multidirectional":l=3;break;default:l=0}const h=i.getIlluminationProperties();for(let f=0;f<h.directionRadians.length;f++)i.paint.get("hillshade-illumination-anchor")==="viewport"&&(h.directionRadians[f]+=u.transform.bearingInRadians);return{u_image:0,u_latrange:ju(0,e.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:h.altitudeRadians,u_azimuths:h.directionRadians,u_accent:s,u_method:l,u_highlights:h.highlightColor,u_shadows:h.shadowColor}},kd=(u,e)=>{const i=e.stride,s=o.L();return o.bX(s,0,o.$,-8192,0,0,1),o.M(s,s,[0,-8192,0]),{u_matrix:s,u_image:1,u_dimension:[i,i],u_zoom:u.overscaledZ,u_unpack:e.getUnpackVector()}};function ju(u,e){const i=Math.pow(2,e.canonical.z),s=e.canonical.y;return[new o.a0(0,s/i).toLngLat().lat,new o.a0(0,(s+1)/i).toLngLat().lat]}const Rd=(u,e)=>({u_image:0,u_unpack:e.getUnpackVector(),u_dimension:[e.stride,e.stride],u_elevation_stops:1,u_color_stops:4,u_opacity:u.paint.get("color-relief-opacity")}),Oo=(u,e,i,s)=>{const l=u.transform;return{u_translation:Yl(u,e,i),u_ratio:s/o.aB(e,1,l.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]]}},Hl=(u,e,i,s,l)=>o.e(Oo(u,e,i,s),{u_image:0,u_image_height:l}),Nu=(u,e,i,s,l)=>{const h=u.transform,f=Xl(e,h);return{u_translation:Yl(u,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:s/o.aB(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]]}},Vu=(u,e,i,s,l,h)=>{const f=u.lineAtlas,_=Xl(e,u.transform),x=i.layout.get("line-cap")==="round",T=f.getDash(l.from,x),M=f.getDash(l.to,x),E=T.width*h.fromScale,I=M.width*h.toScale;return o.e(Oo(u,e,i,s),{u_patternscale_a:[_/E,-T.height/2],u_patternscale_b:[_/I,-M.height/2],u_sdfgamma:f.width/(256*Math.min(E,I)*u.pixelRatio)/2,u_image:0,u_tex_y_a:T.y,u_tex_y_b:M.y,u_mix:h.t})};function Xl(u,e){return 1/o.aB(u,1,e.tileZoom)}function Yl(u,e,i){return o.aC(u.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const _a=(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:Zu(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 Zu(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 Kl=(u,e,i,s,l,h,f,_,x,T,M,E,I)=>{const k=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:k.cameraToCenterDistance,u_pitch:k.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:k.width/k.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:x,u_is_text:+M,u_pitch_with_map:+s,u_is_along_line:l,u_is_variable_anchor:h,u_texsize:E,u_texture:0,u_translation:T,u_pitched_scale:I}},Ya=(u,e,i,s,l,h,f,_,x,T,M,E,I,k)=>{const O=f.transform;return o.e(Kl(u,e,i,s,l,h,f,_,x,T,M,E,k),{u_gamma_scale:s?Math.cos(O.pitch*Math.PI/180)*O.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:1})},Dd=(u,e,i,s,l,h,f,_,x,T,M,E,I)=>o.e(Ya(u,e,i,s,l,h,f,_,x,T,!0,M,0,I),{u_texsize_icon:E,u_texture_icon:1}),jo=(u,e)=>({u_opacity:u,u_color:e}),Ld=(u,e,i,s,l)=>o.e(function(h,f,_,x){const T=_.imageManager.getPattern(h.from.toString()),M=_.imageManager.getPattern(h.to.toString()),{width:E,height:I}=_.imageManager.getPixelSize(),k=Math.pow(2,x.tileID.overscaledZ),O=x.tileSize*Math.pow(2,_.transform.tileZoom)/k,q=O*(x.tileID.canonical.x+x.tileID.wrap*k),G=O*x.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:M.tl,u_pattern_br_b:M.br,u_texsize:[E,I],u_mix:f.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:M.displaySize,u_scale_a:f.fromScale,u_scale_b:f.toScale,u_tile_units_to_pixels:1/o.aB(x,1,_.transform.tileZoom),u_pixel_coord_upper:[q>>16,G>>16],u_pixel_coord_lower:[65535&q,65535&G]}}(i,l,e,s),{u_opacity:u}),Uu=(u,e)=>{},$u={fillExtrusion:(u,e)=>({u_lightpos:new o.bS(u,e.u_lightpos),u_lightpos_globe:new o.bS(u,e.u_lightpos_globe),u_lightintensity:new o.bf(u,e.u_lightintensity),u_lightcolor:new o.bS(u,e.u_lightcolor),u_vertical_gradient:new o.bf(u,e.u_vertical_gradient),u_opacity:new o.bf(u,e.u_opacity),u_fill_translate:new o.bT(u,e.u_fill_translate)}),fillExtrusionPattern:(u,e)=>({u_lightpos:new o.bS(u,e.u_lightpos),u_lightpos_globe:new o.bS(u,e.u_lightpos_globe),u_lightintensity:new o.bf(u,e.u_lightintensity),u_lightcolor:new o.bS(u,e.u_lightcolor),u_vertical_gradient:new o.bf(u,e.u_vertical_gradient),u_height_factor:new o.bf(u,e.u_height_factor),u_opacity:new o.bf(u,e.u_opacity),u_fill_translate:new o.bT(u,e.u_fill_translate),u_image:new o.bO(u,e.u_image),u_texsize:new o.bT(u,e.u_texsize),u_pixel_coord_upper:new o.bT(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bT(u,e.u_pixel_coord_lower),u_scale:new o.bS(u,e.u_scale),u_fade:new o.bf(u,e.u_fade)}),fill:(u,e)=>({u_fill_translate:new o.bT(u,e.u_fill_translate)}),fillPattern:(u,e)=>({u_image:new o.bO(u,e.u_image),u_texsize:new o.bT(u,e.u_texsize),u_pixel_coord_upper:new o.bT(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bT(u,e.u_pixel_coord_lower),u_scale:new o.bS(u,e.u_scale),u_fade:new o.bf(u,e.u_fade),u_fill_translate:new o.bT(u,e.u_fill_translate)}),fillOutline:(u,e)=>({u_world:new o.bT(u,e.u_world),u_fill_translate:new o.bT(u,e.u_fill_translate)}),fillOutlinePattern:(u,e)=>({u_world:new o.bT(u,e.u_world),u_image:new o.bO(u,e.u_image),u_texsize:new o.bT(u,e.u_texsize),u_pixel_coord_upper:new o.bT(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bT(u,e.u_pixel_coord_lower),u_scale:new o.bS(u,e.u_scale),u_fade:new o.bf(u,e.u_fade),u_fill_translate:new o.bT(u,e.u_fill_translate)}),circle:(u,e)=>({u_camera_to_center_distance:new o.bf(u,e.u_camera_to_center_distance),u_scale_with_map:new o.bO(u,e.u_scale_with_map),u_pitch_with_map:new o.bO(u,e.u_pitch_with_map),u_extrude_scale:new o.bT(u,e.u_extrude_scale),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_globe_extrude_scale:new o.bf(u,e.u_globe_extrude_scale),u_translate:new o.bT(u,e.u_translate)}),collisionBox:(u,e)=>({u_pixel_extrude_scale:new o.bT(u,e.u_pixel_extrude_scale)}),collisionCircle:(u,e)=>({u_viewport_size:new o.bT(u,e.u_viewport_size)}),debug:(u,e)=>({u_color:new o.bP(u,e.u_color),u_overlay:new o.bO(u,e.u_overlay),u_overlay_scale:new o.bf(u,e.u_overlay_scale)}),depth:Uu,clippingMask:Uu,heatmap:(u,e)=>({u_extrude_scale:new o.bf(u,e.u_extrude_scale),u_intensity:new o.bf(u,e.u_intensity),u_globe_extrude_scale:new o.bf(u,e.u_globe_extrude_scale)}),heatmapTexture:(u,e)=>({u_matrix:new o.bQ(u,e.u_matrix),u_world:new o.bT(u,e.u_world),u_image:new o.bO(u,e.u_image),u_color_ramp:new o.bO(u,e.u_color_ramp),u_opacity:new o.bf(u,e.u_opacity)}),hillshade:(u,e)=>({u_image:new o.bO(u,e.u_image),u_latrange:new o.bT(u,e.u_latrange),u_exaggeration:new o.bf(u,e.u_exaggeration),u_altitudes:new o.bZ(u,e.u_altitudes),u_azimuths:new o.bZ(u,e.u_azimuths),u_accent:new o.bP(u,e.u_accent),u_method:new o.bO(u,e.u_method),u_shadows:new o.bY(u,e.u_shadows),u_highlights:new o.bY(u,e.u_highlights)}),hillshadePrepare:(u,e)=>({u_matrix:new o.bQ(u,e.u_matrix),u_image:new o.bO(u,e.u_image),u_dimension:new o.bT(u,e.u_dimension),u_zoom:new o.bf(u,e.u_zoom),u_unpack:new o.bR(u,e.u_unpack)}),colorRelief:(u,e)=>({u_image:new o.bO(u,e.u_image),u_unpack:new o.bR(u,e.u_unpack),u_dimension:new o.bT(u,e.u_dimension),u_elevation_stops:new o.bO(u,e.u_elevation_stops),u_color_stops:new o.bO(u,e.u_color_stops),u_opacity:new o.bf(u,e.u_opacity)}),line:(u,e)=>({u_translation:new o.bT(u,e.u_translation),u_ratio:new o.bf(u,e.u_ratio),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bT(u,e.u_units_to_pixels)}),lineGradient:(u,e)=>({u_translation:new o.bT(u,e.u_translation),u_ratio:new o.bf(u,e.u_ratio),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bT(u,e.u_units_to_pixels),u_image:new o.bO(u,e.u_image),u_image_height:new o.bf(u,e.u_image_height)}),linePattern:(u,e)=>({u_translation:new o.bT(u,e.u_translation),u_texsize:new o.bT(u,e.u_texsize),u_ratio:new o.bf(u,e.u_ratio),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_image:new o.bO(u,e.u_image),u_units_to_pixels:new o.bT(u,e.u_units_to_pixels),u_scale:new o.bS(u,e.u_scale),u_fade:new o.bf(u,e.u_fade)}),lineSDF:(u,e)=>({u_translation:new o.bT(u,e.u_translation),u_ratio:new o.bf(u,e.u_ratio),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bT(u,e.u_units_to_pixels),u_patternscale_a:new o.bT(u,e.u_patternscale_a),u_patternscale_b:new o.bT(u,e.u_patternscale_b),u_sdfgamma:new o.bf(u,e.u_sdfgamma),u_image:new o.bO(u,e.u_image),u_tex_y_a:new o.bf(u,e.u_tex_y_a),u_tex_y_b:new o.bf(u,e.u_tex_y_b),u_mix:new o.bf(u,e.u_mix)}),raster:(u,e)=>({u_tl_parent:new o.bT(u,e.u_tl_parent),u_scale_parent:new o.bf(u,e.u_scale_parent),u_buffer_scale:new o.bf(u,e.u_buffer_scale),u_fade_t:new o.bf(u,e.u_fade_t),u_opacity:new o.bf(u,e.u_opacity),u_image0:new o.bO(u,e.u_image0),u_image1:new o.bO(u,e.u_image1),u_brightness_low:new o.bf(u,e.u_brightness_low),u_brightness_high:new o.bf(u,e.u_brightness_high),u_saturation_factor:new o.bf(u,e.u_saturation_factor),u_contrast_factor:new o.bf(u,e.u_contrast_factor),u_spin_weights:new o.bS(u,e.u_spin_weights),u_coords_top:new o.bR(u,e.u_coords_top),u_coords_bottom:new o.bR(u,e.u_coords_bottom)}),symbolIcon:(u,e)=>({u_is_size_zoom_constant:new o.bO(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bO(u,e.u_is_size_feature_constant),u_size_t:new o.bf(u,e.u_size_t),u_size:new o.bf(u,e.u_size),u_camera_to_center_distance:new o.bf(u,e.u_camera_to_center_distance),u_pitch:new o.bf(u,e.u_pitch),u_rotate_symbol:new o.bO(u,e.u_rotate_symbol),u_aspect_ratio:new o.bf(u,e.u_aspect_ratio),u_fade_change:new o.bf(u,e.u_fade_change),u_label_plane_matrix:new o.bQ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bQ(u,e.u_coord_matrix),u_is_text:new o.bO(u,e.u_is_text),u_pitch_with_map:new o.bO(u,e.u_pitch_with_map),u_is_along_line:new o.bO(u,e.u_is_along_line),u_is_variable_anchor:new o.bO(u,e.u_is_variable_anchor),u_texsize:new o.bT(u,e.u_texsize),u_texture:new o.bO(u,e.u_texture),u_translation:new o.bT(u,e.u_translation),u_pitched_scale:new o.bf(u,e.u_pitched_scale)}),symbolSDF:(u,e)=>({u_is_size_zoom_constant:new o.bO(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bO(u,e.u_is_size_feature_constant),u_size_t:new o.bf(u,e.u_size_t),u_size:new o.bf(u,e.u_size),u_camera_to_center_distance:new o.bf(u,e.u_camera_to_center_distance),u_pitch:new o.bf(u,e.u_pitch),u_rotate_symbol:new o.bO(u,e.u_rotate_symbol),u_aspect_ratio:new o.bf(u,e.u_aspect_ratio),u_fade_change:new o.bf(u,e.u_fade_change),u_label_plane_matrix:new o.bQ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bQ(u,e.u_coord_matrix),u_is_text:new o.bO(u,e.u_is_text),u_pitch_with_map:new o.bO(u,e.u_pitch_with_map),u_is_along_line:new o.bO(u,e.u_is_along_line),u_is_variable_anchor:new o.bO(u,e.u_is_variable_anchor),u_texsize:new o.bT(u,e.u_texsize),u_texture:new o.bO(u,e.u_texture),u_gamma_scale:new o.bf(u,e.u_gamma_scale),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_is_halo:new o.bO(u,e.u_is_halo),u_translation:new o.bT(u,e.u_translation),u_pitched_scale:new o.bf(u,e.u_pitched_scale)}),symbolTextAndIcon:(u,e)=>({u_is_size_zoom_constant:new o.bO(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bO(u,e.u_is_size_feature_constant),u_size_t:new o.bf(u,e.u_size_t),u_size:new o.bf(u,e.u_size),u_camera_to_center_distance:new o.bf(u,e.u_camera_to_center_distance),u_pitch:new o.bf(u,e.u_pitch),u_rotate_symbol:new o.bO(u,e.u_rotate_symbol),u_aspect_ratio:new o.bf(u,e.u_aspect_ratio),u_fade_change:new o.bf(u,e.u_fade_change),u_label_plane_matrix:new o.bQ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bQ(u,e.u_coord_matrix),u_is_text:new o.bO(u,e.u_is_text),u_pitch_with_map:new o.bO(u,e.u_pitch_with_map),u_is_along_line:new o.bO(u,e.u_is_along_line),u_is_variable_anchor:new o.bO(u,e.u_is_variable_anchor),u_texsize:new o.bT(u,e.u_texsize),u_texsize_icon:new o.bT(u,e.u_texsize_icon),u_texture:new o.bO(u,e.u_texture),u_texture_icon:new o.bO(u,e.u_texture_icon),u_gamma_scale:new o.bf(u,e.u_gamma_scale),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_is_halo:new o.bO(u,e.u_is_halo),u_translation:new o.bT(u,e.u_translation),u_pitched_scale:new o.bf(u,e.u_pitched_scale)}),background:(u,e)=>({u_opacity:new o.bf(u,e.u_opacity),u_color:new o.bP(u,e.u_color)}),backgroundPattern:(u,e)=>({u_opacity:new o.bf(u,e.u_opacity),u_image:new o.bO(u,e.u_image),u_pattern_tl_a:new o.bT(u,e.u_pattern_tl_a),u_pattern_br_a:new o.bT(u,e.u_pattern_br_a),u_pattern_tl_b:new o.bT(u,e.u_pattern_tl_b),u_pattern_br_b:new o.bT(u,e.u_pattern_br_b),u_texsize:new o.bT(u,e.u_texsize),u_mix:new o.bf(u,e.u_mix),u_pattern_size_a:new o.bT(u,e.u_pattern_size_a),u_pattern_size_b:new o.bT(u,e.u_pattern_size_b),u_scale_a:new o.bf(u,e.u_scale_a),u_scale_b:new o.bf(u,e.u_scale_b),u_pixel_coord_upper:new o.bT(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bT(u,e.u_pixel_coord_lower),u_tile_units_to_pixels:new o.bf(u,e.u_tile_units_to_pixels)}),terrain:(u,e)=>({u_texture:new o.bO(u,e.u_texture),u_ele_delta:new o.bf(u,e.u_ele_delta),u_fog_matrix:new o.bQ(u,e.u_fog_matrix),u_fog_color:new o.bP(u,e.u_fog_color),u_fog_ground_blend:new o.bf(u,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new o.bf(u,e.u_fog_ground_blend_opacity),u_horizon_color:new o.bP(u,e.u_horizon_color),u_horizon_fog_blend:new o.bf(u,e.u_horizon_fog_blend),u_is_globe_mode:new o.bf(u,e.u_is_globe_mode)}),terrainDepth:(u,e)=>({u_ele_delta:new o.bf(u,e.u_ele_delta)}),terrainCoords:(u,e)=>({u_texture:new o.bO(u,e.u_texture),u_terrain_coords_id:new o.bf(u,e.u_terrain_coords_id),u_ele_delta:new o.bf(u,e.u_ele_delta)}),projectionErrorMeasurement:(u,e)=>({u_input:new o.bf(u,e.u_input),u_output_expected:new o.bf(u,e.u_output_expected)}),atmosphere:(u,e)=>({u_sun_pos:new o.bS(u,e.u_sun_pos),u_atmosphere_blend:new o.bf(u,e.u_atmosphere_blend),u_globe_position:new o.bS(u,e.u_globe_position),u_globe_radius:new o.bf(u,e.u_globe_radius),u_inv_proj_matrix:new o.bQ(u,e.u_inv_proj_matrix)}),sky:(u,e)=>({u_sky_color:new o.bP(u,e.u_sky_color),u_horizon_color:new o.bP(u,e.u_horizon_color),u_horizon:new o.bT(u,e.u_horizon),u_horizon_normal:new o.bT(u,e.u_horizon_normal),u_sky_horizon_blend:new o.bf(u,e.u_sky_horizon_blend),u_sky_blend:new o.bf(u,e.u_sky_blend)})};class Gu{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 qu={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Jl{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[qu[h.type]],!1,this.itemSize,h.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Dt{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 No extends Dt{getDefault(){return o.be.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 Rn extends Dt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Ql extends Dt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class ec extends Dt{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 tc extends Dt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Wu extends Dt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class ic extends Dt{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 ya extends Dt{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 rc extends Dt{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 Bd extends Dt{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 Fd extends Dt{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 Od extends Dt{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class jd extends Dt{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 Hu extends Dt{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 Nd extends Dt{getDefault(){return o.be.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 Xu extends Dt{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class Vo extends Dt{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 Zo extends Dt{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Uo extends Dt{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class nc extends Dt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class xa extends Dt{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class js extends Dt{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 Ka extends Dt{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 qr extends Dt{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 Yu extends Dt{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 Ku extends Dt{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 ac extends Dt{getDefault(){return null}set(e){const i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class va extends Dt{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;const s=this.gl;dr(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 $o extends Dt{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 Go extends Dt{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 Ns extends Dt{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 Ja extends Dt{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class Ju extends Ja{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 Qa extends Ja{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 es extends Ja{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 sc="Framebuffer is not complete";class oc{constructor(e,i,s,l,h){this.context=e,this.width=i,this.height=s;const f=e.gl,_=this.framebuffer=f.createFramebuffer();if(this.colorAttachment=new Ju(e,_),l)this.depthAttachment=h?new es(e,_):new Qa(e,_);else if(h)throw new Error("Stencil cannot be set without depth");if(f.checkFramebufferStatus(f.FRAMEBUFFER)!==f.FRAMEBUFFER_COMPLETE)throw new Error(sc)}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 vt{constructor(e){var i,s;if(this.gl=e,this.clearColor=new No(this),this.clearDepth=new Rn(this),this.clearStencil=new Ql(this),this.colorMask=new ec(this),this.depthMask=new tc(this),this.stencilMask=new Wu(this),this.stencilFunc=new ic(this),this.stencilOp=new ya(this),this.stencilTest=new rc(this),this.depthRange=new Bd(this),this.depthTest=new Fd(this),this.depthFunc=new Od(this),this.blend=new jd(this),this.blendFunc=new Hu(this),this.blendColor=new Nd(this),this.blendEquation=new Xu(this),this.cullFace=new Vo(this),this.cullFaceSide=new Zo(this),this.frontFace=new Uo(this),this.program=new nc(this),this.activeTexture=new xa(this),this.viewport=new js(this),this.bindFramebuffer=new Ka(this),this.bindRenderbuffer=new qr(this),this.bindTexture=new Yu(this),this.bindVertexBuffer=new Ku(this),this.bindElementBuffer=new ac(this),this.bindVertexArray=new va(this),this.pixelStoreUnpack=new $o(this),this.pixelStoreUnpackPremultiplyAlpha=new Go(this),this.pixelStoreUnpackFlipY=new Ns(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),dr(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 Gu(this,e,i)}createVertexBuffer(e,i,s){return new Jl(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 oc(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.bG(e.blendFunction,Pt.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 dr(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 dr(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 ba;function Qu(u,e,i,s,l){const h=u.context,f=u.transform,_=h.gl,x=u.useProgram("collisionBox"),T=[];let M=0,E=0;for(let W=0;W<s.length;W++){const X=s[W],ee=e.getTile(X).getBucket(i);if(!ee)continue;const Y=l?ee.textCollisionBox:ee.iconCollisionBox,ie=ee.collisionCircleArray;ie.length>0&&(T.push({circleArray:ie,circleOffset:E,coord:X}),M+=ie.length/4,E=M),Y&&x.draw(h,_.LINES,ut.disabled,st.disabled,u.colorModeForRenderPass(),ct.disabled,Bs(u.transform),u.style.map.terrain&&u.style.map.terrain.getTerrainData(X),f.getProjectionData({overscaledTileID:X,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,Y.layoutVertexBuffer,Y.indexBuffer,Y.segments,null,u.transform.zoom,null,null,Y.collisionVertexBuffer)}if(!l||!T.length)return;const I=u.useProgram("collisionCircle"),k=new o.b_;k.resize(4*M),k._trim();let O=0;for(const W of T)for(let X=0;X<W.circleArray.length/4;X++){const ee=4*X,Y=W.circleArray[ee+0],ie=W.circleArray[ee+1],ne=W.circleArray[ee+2],K=W.circleArray[ee+3];k.emplace(O++,Y,ie,ne,K,0),k.emplace(O++,Y,ie,ne,K,1),k.emplace(O++,Y,ie,ne,K,2),k.emplace(O++,Y,ie,ne,K,3)}(!ba||ba.length<2*M)&&(ba=function(W){const X=2*W,ee=new o.c0;ee.resize(X),ee._trim();for(let Y=0;Y<X;Y++){const ie=6*Y;ee.uint16[ie+0]=4*Y+0,ee.uint16[ie+1]=4*Y+1,ee.uint16[ie+2]=4*Y+2,ee.uint16[ie+3]=4*Y+2,ee.uint16[ie+4]=4*Y+3,ee.uint16[ie+5]=4*Y+0}return ee}(M));const q=h.createIndexBuffer(ba,!0),G=h.createVertexBuffer(k,o.b$.members,!0);for(const W of T){const X=Fs(u.transform);I.draw(h,_.TRIANGLES,ut.disabled,st.disabled,u.colorModeForRenderPass(),ct.disabled,X,u.style.map.terrain&&u.style.map.terrain.getTerrainData(W.coord),null,i.id,G,q,o.aL.simpleSegment(0,2*W.circleOffset,W.circleArray.length,W.circleArray.length/2),null,u.transform.zoom,null,null,null)}G.destroy(),q.destroy()}const eh=o.af(new Float32Array(16));function Vs(u,e,i,s,l,h){const{horizontalAlign:f,verticalAlign:_}=o.aG(u);return new o.P((-(f-.5)*e/l+s[0])*h,(-(_-.5)*i/l+s[1])*h)}function Vd(u,e,i,s,l,h){const f=e.tileAnchorPoint.add(new o.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let _=s.mult(h);i||(_=_.rotate(-l));const x=f.add(_);return At(x.x,x.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(i){const _=Ne(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(u),x=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return u.add(s.rotate(x))}return u.add(s)}function Zd(u,e,i,s,l,h,f,_,x,T,M,E){const I=u.text.placedSymbolArray,k=u.text.dynamicLayoutVertexArray,O=u.icon.dynamicLayoutVertexArray,q={};k.clear();for(let G=0;G<I.length;G++){const W=I.get(G),X=W.hidden||!W.crossTileID||u.allowVerticalPlacement&&!W.placedOrientation?null:s[W.crossTileID];if(X){const ee=new o.P(W.anchorX,W.anchorY),Y={getElevation:E,width:l.width,height:l.height,pitchedLabelPlaneMatrix:h,pitchWithMap:i,transform:l,tileAnchorPoint:ee,translation:T,unwrappedTileID:M},ie=i?gt(ee.x,ee.y,Y):Ne(ee.x,ee.y,Y),ne=ot(l.cameraToCenterDistance,ie.signedDistanceFromCamera);let K=o.ao(u.textSizeData,_,W)*ne/o.aA;i&&(K*=u.tilePixelRatio/f);const{width:le,height:ye,anchor:pe,textOffset:me,textBoxScale:ve}=X,je=Vs(pe,le,ye,me,ve,K),Fe=l.getPitchedTextCorrection(ee.x+T[0],ee.y+T[1],M),Ee=Vd(ie.point,Y,e,je,-l.bearingInRadians,Fe),We=u.allowVerticalPlacement&&W.placedOrientation===o.an.vertical?Math.PI/2:0;for(let ht=0;ht<W.numGlyphs;ht++)o.au(k,Ee,We);x&&W.associatedIconIndex>=0&&(q[W.associatedIconIndex]={shiftedAnchor:Ee,angle:We})}else In(W.numGlyphs,k)}if(x){O.clear();const G=u.icon.placedSymbolArray;for(let W=0;W<G.length;W++){const X=G.get(W);if(X.hidden)In(X.numGlyphs,O);else{const ee=q[W];if(ee)for(let Y=0;Y<X.numGlyphs;Y++)o.au(O,ee.shiftedAnchor,ee.angle);else In(X.numGlyphs,O)}}u.icon.dynamicLayoutVertexBuffer.updateData(O)}u.text.dynamicLayoutVertexBuffer.updateData(k)}function th(u,e,i){return i.iconsInText&&e?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function ih(u,e,i,s,l,h,f,_,x,T,M,E,I){const k=u.context,O=k.gl,q=u.transform,G=_==="map",W=x==="map",X=_!=="viewport"&&i.layout.get("symbol-placement")!=="point",ee=G&&!W&&!X,Y=!i.layout.get("symbol-sort-key").isConstant();let ie=!1;const ne=u.getDepthModeForSublayer(0,ut.ReadOnly),K=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),le=[],ye=q.getCircleRadiusCorrection();for(const pe of s){const me=e.getTile(pe),ve=me.getBucket(i);if(!ve)continue;const je=l?ve.text:ve.icon;if(!je||!je.segments.get().length||!je.hasVisibleVertices)continue;const Fe=je.programConfigurations.get(i.id),Ee=l||ve.sdfIcons,We=l?ve.textSizeData:ve.iconSizeData,ht=W||q.pitch!==0,Lt=u.useProgram(th(Ee,l,ve),Fe),ai=o.am(We,q.zoom),Zt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(pe);let si,$t,Ut,Gt,Wi=[0,0],Ct=null;if(l)$t=me.glyphAtlasTexture,Ut=O.LINEAR,si=me.glyphAtlasTexture.size,ve.iconsInText&&(Wi=me.imageAtlasTexture.size,Ct=me.imageAtlasTexture,Gt=ht||u.options.rotating||u.options.zooming||We.kind==="composite"||We.kind==="camera"?O.LINEAR:O.NEAREST);else{const fi=i.layout.get("icon-size").constantOr(0)!==1||ve.iconsNeedLinear;$t=me.imageAtlasTexture,Ut=Ee||u.options.rotating||u.options.zooming||fi||ht?O.LINEAR:O.NEAREST,si=me.imageAtlasTexture.size}const Di=o.aB(me,1,u.transform.zoom),Hi=lt(G,u.transform,Di),ta=o.L();o.ap(ta,Hi);const ia=qt(W,G,u.transform,Di),ra=o.aC(q,me,h,f),Tn=q.getProjectionData({overscaledTileID:pe,applyGlobeMatrix:!I,applyTerrainMatrix:!0}),to=K&&ve.hasTextData(),io=i.layout.get("icon-text-fit")!=="none"&&to&&ve.hasIconData();if(X){const fi=u.style.map.terrain?(gr,Ci)=>u.style.map.terrain.getElevation(pe,gr,Ci):null,Ht=i.layout.get("text-rotation-alignment")==="map";Ai(ve,u,l,Hi,ta,W,T,Ht,pe.toUnwrapped(),q.width,q.height,ra,fi)}const ds=l&&K||io,Sr=X||ds?eh:W?Hi:u.transform.clipSpaceToPixelsMatrix,on=Ee&&i.paint.get(l?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let na;na=Ee?ve.iconsInText?Dd(We.kind,ai,ee,W,X,ds,u,Sr,ia,ra,si,Wi,ye):Ya(We.kind,ai,ee,W,X,ds,u,Sr,ia,ra,l,si,0,ye):Kl(We.kind,ai,ee,W,X,ds,u,Sr,ia,ra,l,si,ye);const Sa={program:Lt,buffers:je,uniformValues:na,projectionData:Tn,atlasTexture:$t,atlasTextureIcon:Ct,atlasInterpolation:Ut,atlasInterpolationIcon:Gt,isSDF:Ee,hasHalo:on};if(Y&&ve.canOverlap){ie=!0;const fi=je.segments.get();for(const Ht of fi)le.push({segments:new o.aL([Ht]),sortKey:Ht.sortKey,state:Sa,terrainData:Zt})}else le.push({segments:je.segments,sortKey:0,state:Sa,terrainData:Zt})}ie&&le.sort((pe,me)=>pe.sortKey-me.sortKey);for(const pe of le){const me=pe.state;if(k.activeTexture.set(O.TEXTURE0),me.atlasTexture.bind(me.atlasInterpolation,O.CLAMP_TO_EDGE),me.atlasTextureIcon&&(k.activeTexture.set(O.TEXTURE1),me.atlasTextureIcon&&me.atlasTextureIcon.bind(me.atlasInterpolationIcon,O.CLAMP_TO_EDGE)),me.isSDF){const ve=me.uniformValues;me.hasHalo&&(ve.u_is_halo=1,qo(me.buffers,pe.segments,i,u,me.program,ne,M,E,ve,me.projectionData,pe.terrainData)),ve.u_is_halo=0}qo(me.buffers,pe.segments,i,u,me.program,ne,M,E,me.uniformValues,me.projectionData,pe.terrainData)}}function qo(u,e,i,s,l,h,f,_,x,T,M){const E=s.context;l.draw(E,E.gl.TRIANGLES,h,f,_,ct.backCCW,x,M,T,i.id,u.layoutVertexBuffer,u.indexBuffer,e,i.paint,s.transform.zoom,u.programConfigurations.get(i.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function Wo(u,e,i,s,l){const h=u.context,f=h.gl,_=st.disabled,x=new Pt([f.ONE,f.ONE],o.be.transparent,[!0,!0,!0,!0]),T=e.getBucket(i);if(!T)return;const M=s.key;let E=i.heatmapFbos.get(M);E||(E=Zs(h,e.tileSize,e.tileSize),i.heatmapFbos.set(M,E)),h.bindFramebuffer.set(E.framebuffer),h.viewport.set([0,0,e.tileSize,e.tileSize]),h.clear({color:o.be.transparent});const I=T.programConfigurations.get(i.id),k=u.useProgram("heatmap",I,!l),O=u.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),q=u.style.map.terrain.getTerrainData(s);k.draw(h,f.TRIANGLES,ut.disabled,_,x,ct.disabled,Os(e,u.transform.zoom,i.paint.get("heatmap-intensity"),1),q,O,i.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,i.paint,u.transform.zoom,I)}function Ho(u,e,i,s,l){const h=u.context,f=h.gl,_=u.transform;h.setColorMode(u.colorModeForRenderPass());const x=Xo(h,e),T=i.key,M=e.heatmapFbos.get(T);if(!M)return;h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,M.colorAttachment.get()),h.activeTexture.set(f.TEXTURE1),x.bind(f.LINEAR,f.CLAMP_TO_EDGE);const E=_.getProjectionData({overscaledTileID:i,applyTerrainMatrix:l,applyGlobeMatrix:!s});u.useProgram("heatmapTexture").draw(h,f.TRIANGLES,ut.disabled,st.disabled,u.colorModeForRenderPass(),ct.disabled,Ou(u,e,0,1),null,E,e.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments,e.paint,_.zoom),M.destroy(),e.heatmapFbos.delete(T)}function Zs(u,e,i){var s,l;const h=u.gl,f=h.createTexture();h.bindTexture(h.TEXTURE_2D,f),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.LINEAR),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.LINEAR);const _=(s=u.HALF_FLOAT)!==null&&s!==void 0?s:h.UNSIGNED_BYTE,x=(l=u.RGBA16F)!==null&&l!==void 0?l:h.RGBA;h.texImage2D(h.TEXTURE_2D,0,x,e,i,0,h.RGBA,_,null);const T=u.createFramebuffer(e,i,!1,!1);return T.colorAttachment.set(f),T}function Xo(u,e){return e.colorRampTexture||(e.colorRampTexture=new o.T(u,e.colorRamp,u.gl.RGBA)),e.colorRampTexture}function lc(u,e,i,s,l){if(!i||!s||!s.imageAtlas)return;const h=s.imageAtlas.patternPositions;let f=h[i.to.toString()],_=h[i.from.toString()];if(!f&&_&&(f=_),!_&&f&&(_=f),!f||!_){const x=l.getPaintProperty(e);f=h[x],_=h[x]}f&&_&&u.setConstantPatternPositions(f,_)}function Us(u,e,i,s,l,h,f,_){const x=u.context.gl,T="fill-pattern",M=i.paint.get(T),E=M&&M.constantOr(1),I=i.getCrossfadeParameters();let k,O,q,G,W;const X=u.transform,ee=i.paint.get("fill-translate"),Y=i.paint.get("fill-translate-anchor");f?(O=E&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",k=x.LINES):(O=E?"fillPattern":"fill",k=x.TRIANGLES);const ie=M.constantOr(null);for(const ne of s){const K=e.getTile(ne);if(E&&!K.patternsLoaded())continue;const le=K.getBucket(i);if(!le)continue;const ye=le.programConfigurations.get(i.id),pe=u.useProgram(O,ye),me=u.style.map.terrain&&u.style.map.terrain.getTerrainData(ne);E&&(u.context.activeTexture.set(x.TEXTURE0),K.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),ye.updatePaintBuffers(I)),lc(ye,T,ie,K,i);const ve=X.getProjectionData({overscaledTileID:ne,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),je=o.aC(X,K,ee,Y);if(f){G=le.indexBuffer2,W=le.segments2;const Ee=[x.drawingBufferWidth,x.drawingBufferHeight];q=O==="fillOutlinePattern"&&E?Ad(u,I,K,Ee,je):vn(Ee,je)}else G=le.indexBuffer,W=le.segments,q=E?Fo(u,I,K,je):{u_fill_translate:je};const Fe=u.stencilModeForClipping(ne);pe.draw(u.context,k,l,Fe,h,ct.backCCW,q,me,ve,i.id,le.layoutVertexBuffer,G,W,i.paint,u.transform.zoom,ye)}}function ts(u,e,i,s,l,h,f,_){const x=u.context,T=x.gl,M="fill-extrusion-pattern",E=i.paint.get(M),I=E.constantOr(1),k=i.getCrossfadeParameters(),O=i.paint.get("fill-extrusion-opacity"),q=E.constantOr(null),G=u.transform;for(const W of s){const X=e.getTile(W),ee=X.getBucket(i);if(!ee)continue;const Y=u.style.map.terrain&&u.style.map.terrain.getTerrainData(W),ie=ee.programConfigurations.get(i.id),ne=u.useProgram(I?"fillExtrusionPattern":"fillExtrusion",ie);I&&(u.context.activeTexture.set(T.TEXTURE0),X.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),ie.updatePaintBuffers(k));const K=G.getProjectionData({overscaledTileID:W,applyGlobeMatrix:!_,applyTerrainMatrix:!0});lc(ie,M,q,X,i);const le=o.aC(G,X,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),ye=i.paint.get("fill-extrusion-vertical-gradient"),pe=I?ql(u,ye,O,le,W,k,X):Ls(u,ye,O,le);ne.draw(x,x.gl.TRIANGLES,l,h,f,ct.backCCW,pe,Y,K,i.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,i.paint,u.transform.zoom,ie,u.style.map.terrain&&ee.centroidVertexBuffer)}}function is(u,e,i,s,l,h,f,_,x){var T;const M=u.style.projection,E=u.context,I=u.transform,k=E.gl,O=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],q=u.useProgram("hillshade",null,!1,O),G=!u.options.moving;for(const W of s){const X=e.getTile(W),ee=X.fbo;if(!ee)continue;const Y=M.getMeshFromTileID(E,W.canonical,_,!0,"raster"),ie=(T=u.style.map.terrain)===null||T===void 0?void 0:T.getTerrainData(W);E.activeTexture.set(k.TEXTURE0),k.bindTexture(k.TEXTURE_2D,ee.colorAttachment.get());const ne=I.getProjectionData({overscaledTileID:W,aligned:G,applyGlobeMatrix:!x,applyTerrainMatrix:!0});q.draw(E,k.TRIANGLES,h,l[W.overscaledZ],f,ct.backCCW,Xa(u,X,i),ie,ne,i.id,Y.vertexBuffer,Y.indexBuffer,Y.segments)}}function $s(u,e,i,s,l,h,f,_,x){var T;const M=u.style.projection,E=u.context,I=u.transform,k=E.gl,O=u.useProgram("colorRelief"),q=!u.options.moving;let G=!0;for(const W of s){const X=e.getTile(W),ee=X.dem;if(G){const ye=k.getParameter(k.MAX_TEXTURE_SIZE),{elevationTexture:pe,colorTexture:me}=i.getColorRampTextures(E,ye,ee.getUnpackVector());E.activeTexture.set(k.TEXTURE1),pe.bind(k.NEAREST,k.CLAMP_TO_EDGE),E.activeTexture.set(k.TEXTURE4),me.bind(k.LINEAR,k.CLAMP_TO_EDGE),G=!1}if(!ee||!ee.data)continue;const Y=ee.stride,ie=ee.getPixels();if(E.activeTexture.set(k.TEXTURE0),E.pixelStoreUnpackPremultiplyAlpha.set(!1),X.demTexture=X.demTexture||u.getTileTexture(Y),X.demTexture){const ye=X.demTexture;ye.update(ie,{premultiply:!1}),ye.bind(k.LINEAR,k.CLAMP_TO_EDGE)}else X.demTexture=new o.T(E,ie,k.RGBA,{premultiply:!1}),X.demTexture.bind(k.LINEAR,k.CLAMP_TO_EDGE);const ne=M.getMeshFromTileID(E,W.canonical,_,!0,"raster"),K=(T=u.style.map.terrain)===null||T===void 0?void 0:T.getTerrainData(W),le=I.getProjectionData({overscaledTileID:W,aligned:q,applyGlobeMatrix:!x,applyTerrainMatrix:!0});O.draw(E,k.TRIANGLES,h,l[W.overscaledZ],f,ct.backCCW,Rd(i,X.dem),K,le,i.id,ne.vertexBuffer,ne.indexBuffer,ne.segments)}}const cc=[new o.P(0,0),new o.P(o.$,0),new o.P(o.$,o.$),new o.P(0,o.$)];function Yn(u,e,i,s,l,h,f,_,x=!1,T=!1){const M=s[s.length-1].overscaledZ,E=u.context,I=E.gl,k=u.useProgram("raster"),O=u.transform,q=u.style.projection,G=u.colorModeForRenderPass(),W=!u.options.moving;for(const X of s){const ee=u.getDepthModeForSublayer(X.overscaledZ-M,i.paint.get("raster-opacity")===1?ut.ReadWrite:ut.ReadOnly,I.LESS),Y=e.getTile(X);Y.registerFadeDuration(i.paint.get("raster-fade-duration"));const ie=e.findLoadedParent(X,0),ne=e.findLoadedSibling(X),K=Ud(Y,ie||ne||null,e,i,u.transform,u.style.map.terrain);let le,ye;const pe=i.paint.get("raster-resampling")==="nearest"?I.NEAREST:I.LINEAR;E.activeTexture.set(I.TEXTURE0),Y.texture.bind(pe,I.CLAMP_TO_EDGE,I.LINEAR_MIPMAP_NEAREST),E.activeTexture.set(I.TEXTURE1),ie?(ie.texture.bind(pe,I.CLAMP_TO_EDGE,I.LINEAR_MIPMAP_NEAREST),le=Math.pow(2,ie.tileID.overscaledZ-Y.tileID.overscaledZ),ye=[Y.tileID.canonical.x*le%1,Y.tileID.canonical.y*le%1]):Y.texture.bind(pe,I.CLAMP_TO_EDGE,I.LINEAR_MIPMAP_NEAREST),Y.texture.useMipmap&&E.extTextureFilterAnisotropic&&u.transform.pitch>20&&I.texParameterf(I.TEXTURE_2D,E.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,E.extTextureFilterAnisotropicMax);const me=u.style.map.terrain&&u.style.map.terrain.getTerrainData(X),ve=O.getProjectionData({overscaledTileID:X,aligned:W,applyGlobeMatrix:!T,applyTerrainMatrix:!0}),je=_a(ye||[0,0],le||1,K,i,_),Fe=q.getMeshFromTileID(E,X.canonical,h,f,"raster");k.draw(E,I.TRIANGLES,ee,l?l[X.overscaledZ]:st.disabled,G,x?ct.frontCCW:ct.backCCW,je,me,ve,i.id,Fe.vertexBuffer,Fe.indexBuffer,Fe.segments)}}function Ud(u,e,i,s,l,h){const f=s.paint.get("raster-fade-duration");if(!h&&f>0){const _=Ce.now(),x=(_-u.timeAdded)/f,T=e?(_-e.timeAdded)/f:-1,M=i.getSource(),E=Se(l,{tileSize:M.tileSize,roundZoom:M.roundZoom}),I=!e||Math.abs(e.tileID.overscaledZ-E)>Math.abs(u.tileID.overscaledZ-E),k=I&&u.refreshedUponExpiration?1:o.ag(I?x:1-T,0,1);return u.refreshedUponExpiration&&x>=1&&(u.refreshedUponExpiration=!1),e?{opacity:1,mix:1-k}:{opacity:k,mix:0}}return{opacity:1,mix:0}}const rh=new o.be(1,0,0,1),Yo=new o.be(0,1,0,1),uc=new o.be(0,0,1,1),nh=new o.be(1,0,1,1),ah=new o.be(0,1,1,1);function Gs(u,e,i,s){Jo(u,0,e+i/2,u.transform.width,i,s)}function Ko(u,e,i,s){Jo(u,e-i/2,0,i,u.transform.height,s)}function Jo(u,e,i,s,l,h){const f=u.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*u.pixelRatio,i*u.pixelRatio,s*u.pixelRatio,l*u.pixelRatio),f.clear({color:h}),_.disable(_.SCISSOR_TEST)}function sh(u,e,i){const s=u.context,l=s.gl,h=u.useProgram("debug"),f=ut.disabled,_=st.disabled,x=u.colorModeForRenderPass(),T="$debug",M=u.style.map.terrain&&u.style.map.terrain.getTerrainData(i);s.activeTexture.set(l.TEXTURE0);const E=e.getTileByID(i.key).latestRawTileData,I=Math.floor((E&&E.byteLength||0)/1024),k=e.getTile(i).tileSize,O=512/Math.min(k,512)*(i.overscaledZ/u.transform.zoom)*.5;let q=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(q+=` => ${i.overscaledZ}`),function(W,X){W.initDebugOverlayCanvas();const ee=W.debugOverlayCanvas,Y=W.context.gl,ie=W.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(X,5,5),ie.strokeText(X,5,5),W.debugOverlayTexture.update(ee),W.debugOverlayTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE)}(u,`${q} ${I}kB`);const G=u.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(s,l.TRIANGLES,f,_,Pt.alphaBlended,ct.disabled,Fu(o.be.transparent,O),null,G,T,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),h.draw(s,l.LINE_STRIP,f,_,x,ct.disabled,Fu(o.be.red),M,G,T,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function ci(u,e,i,s){const{isRenderingGlobe:l}=s,h=u.context,f=h.gl,_=u.transform,x=u.colorModeForRenderPass(),T=u.getDepthModeFor3D(),M=u.useProgram("terrain");h.bindFramebuffer.set(null),h.viewport.set([0,0,u.width,u.height]);for(const E of i){const I=e.getTerrainMesh(E.tileID),k=u.renderToTexture.getTexture(E),O=e.getTerrainData(E.tileID);h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,k.texture);const q=e.getMeshFrameDelta(_.zoom),G=_.calculateFogMatrix(E.tileID.toUnwrapped()),W=Ed(q,G,u.style.sky,_.pitch,l),X=_.getProjectionData({overscaledTileID:E.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});M.draw(h,f.TRIANGLES,T,st.disabled,x,ct.backCCW,W,O,X,"terrain",I.vertexBuffer,I.indexBuffer,I.segments)}}function Kn(u,e){if(!e.mesh){const i=new o.aK;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const s=new o.aM;s.emplaceBack(0,1,2),s.emplaceBack(0,2,3),e.mesh=new zn(u.createVertexBuffer(i,An.members),u.createIndexBuffer(s),o.aL.simpleSegment(0,0,i.length,s.length))}return e.mesh}class Wr{constructor(e,i){this.context=new vt(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:o.af(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Me.maxUnderzooming+Me.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new zo}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.aK;i.emplaceBack(0,0),i.emplaceBack(o.$,0),i.emplaceBack(0,o.$),i.emplaceBack(o.$,o.$),this.tileExtentBuffer=e.createVertexBuffer(i,An.members),this.tileExtentSegments=o.aL.simpleSegment(0,0,4,2);const s=new o.aK;s.emplaceBack(0,0),s.emplaceBack(o.$,0),s.emplaceBack(0,o.$),s.emplaceBack(o.$,o.$),this.debugBuffer=e.createVertexBuffer(s,An.members),this.debugSegments=o.aL.simpleSegment(0,0,4,5);const l=new o.c5;l.emplaceBack(0,0,0,0),l.emplaceBack(o.$,0,o.$,0),l.emplaceBack(0,o.$,0,o.$),l.emplaceBack(o.$,o.$,o.$,o.$),this.rasterBoundsBuffer=e.createVertexBuffer(l,Cd.members),this.rasterBoundsSegments=o.aL.simpleSegment(0,0,4,2);const h=new o.aK;h.emplaceBack(0,0),h.emplaceBack(o.$,0),h.emplaceBack(0,o.$),h.emplaceBack(o.$,o.$),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(h,An.members),this.rasterBoundsSegmentsPosOnly=o.aL.simpleSegment(0,0,4,5);const f=new o.aK;f.emplaceBack(0,0),f.emplaceBack(1,0),f.emplaceBack(0,1),f.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(f,An.members),this.viewportSegments=o.aL.simpleSegment(0,0,4,2);const _=new o.c6;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(_);const x=new o.aM;x.emplaceBack(1,0,2),x.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(x);const T=this.context.gl;this.stencilClearMode=new st({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO),this.tileExtentMesh=new zn(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=o.L();o.bX(s,0,this.width,this.height,0,0,1),o.N(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,ut.disabled,this.stencilClearMode,Pt.disabled,ct.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(Pt.disabled),l.setDepthMode(ut.disabled);const h={};for(const f of i)h[f.key]=this.nextStencilID++;this._renderTileMasks(h,i,s,!0),this._renderTileMasks(h,i,s,!1),this._tileClippingMaskIDs=h}_renderTileMasks(e,i,s,l){const h=this.context,f=h.gl,_=this.style.projection,x=this.transform,T=this.useProgram("clippingMask");for(const M of i){const E=e[M.key],I=this.style.map.terrain&&this.style.map.terrain.getTerrainData(M),k=_.getMeshFromTileID(this.context,M.canonical,l,!0,"stencil"),O=x.getProjectionData({overscaledTileID:M,applyGlobeMatrix:!s,applyTerrainMatrix:!0});T.draw(h,f.TRIANGLES,ut.disabled,new st({func:f.ALWAYS,mask:0},E,255,f.KEEP,f.KEEP,f.REPLACE),Pt.disabled,s?ct.disabled:ct.backCCW,null,I,O,"$clipping",k.vertexBuffer,k.indexBuffer,k.segments)}}_renderTilesDepthBuffer(){const e=this.context,i=e.gl,s=this.style.projection,l=this.transform,h=this.useProgram("depth"),f=this.getDepthModeFor3D(),_=we(l,{tileSize:l.tileSize});for(const x of _){const T=this.style.map.terrain&&this.style.map.terrain.getTerrainData(x),M=s.getMeshFromTileID(this.context,x.canonical,!0,!0,"raster"),E=l.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(e,i.TRIANGLES,f,st.disabled,Pt.disabled,ct.backCCW,null,T,E,"$clipping",M.vertexBuffer,M.indexBuffer,M.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,i=this.context.gl;return new st({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){const i=this.context.gl;return new st({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,i.KEEP,i.KEEP,i.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const i=this.context.gl,s=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),l=s[s.length-1].overscaledZ,h=s[0].overscaledZ-l+1;if(h>1){this.currentStencilSource=void 0,this.nextStencilID+h>256&&this.clearStencil();const f={};for(let _=0;_<h;_++)f[_+l]=new st({func:i.GEQUAL,mask:255},_+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=h,[f,s]}return[{[l]:st.disabled},s]}stencilConfigForOverlapTwoPass(e){const i=this.context.gl,s=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),l=s[s.length-1].overscaledZ,h=s[0].overscaledZ-l+1;if(this.clearStencil(),h>1){const f={},_={};for(let x=0;x<h;x++)f[x+l]=new st({func:i.GREATER,mask:255},h+1+x,255,i.KEEP,i.KEEP,i.REPLACE),_[x+l]=new st({func:i.GREATER,mask:255},1+x,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*h+1,[f,_,s]}return this.nextStencilID=3,[{[l]:new st({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[l]:new st({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},s]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new Pt([e.CONSTANT_COLOR,e.ONE],new o.be(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Pt.unblended:Pt.alphaBlended}getDepthModeForSublayer(e,i,s){if(!this.opaquePassEnabledForLayer())return ut.disabled;const l=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new ut(s||this.context.gl.LEQUAL,i,[l,l])}getDepthModeFor3D(){return new ut(this.context.gl.LEQUAL,ut.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(Ce.now()),this.imageManager.beginFrame();const h=this.style._order,f=this.style.sourceCaches,_={},x={},T={},M={isRenderingToTexture:!1,isRenderingGlobe:((s=e.projection)===null||s===void 0?void 0:s.transitionState)>0};for(const I in f){const k=f[I];k.used&&k.prepare(this.context),_[I]=k.getVisibleCoordinates(!1),x[I]=_[I].slice().reverse(),T[I]=k.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let I=0;I<h.length;I++)if(this.style._layers[h[I]].is3D()){this.opaquePassCutoff=I;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const I of h){const k=this.style._layers[I];if(!k.hasOffscreenPass()||k.isHidden(this.transform.zoom))continue;const O=x[k.source];(k.type==="custom"||O.length)&&this.renderLayer(this,f[k.source],k,O,M)}if((l=this.style.projection)===null||l===void 0||l.updateGPUdependent({context:this.context,useProgram:I=>this.useProgram(I)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?o.be.black:o.be.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(I,k){const O=I.context,q=O.gl,G=((ne,K,le)=>{const ye=Math.cos(K.rollInRadians),pe=Math.sin(K.rollInRadians),me=V(K),ve=K.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:ne.properties.get("sky-color"),u_horizon_color:ne.properties.get("horizon-color"),u_horizon:[(K.width/2-me*pe)*le,(K.height/2+me*ye)*le],u_horizon_normal:[-pe,ye],u_sky_horizon_blend:ne.properties.get("sky-horizon-blend")*K.height/2*le,u_sky_blend:ve}})(k,I.style.map.transform,I.pixelRatio),W=new ut(q.LEQUAL,ut.ReadWrite,[0,1]),X=st.disabled,ee=I.colorModeForRenderPass(),Y=I.useProgram("sky"),ie=Kn(O,k);Y.draw(O,q.TRIANGLES,W,X,ee,ct.disabled,G,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 I=this.style._layers[h[this.currentLayer]],k=f[I.source],O=_[I.source];this._renderTileClippingMasks(I,O,!1),this.renderLayer(this,k,I,O,M)}this.renderPass="translucent";let E=!1;for(this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const I=this.style._layers[h[this.currentLayer]],k=f[I.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(I,M))continue;this.opaquePassEnabledForLayer()||E||(E=!0,M.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const O=(I.type==="symbol"?T:x)[I.source];this._renderTileClippingMasks(I,_[I.source],!!this.renderToTexture),this.renderLayer(this,k,I,O,M)}if(M.isRenderingGlobe&&function(I,k,O){const q=I.context,G=q.gl,W=I.useProgram("atmosphere"),X=new ut(G.LEQUAL,ut.ReadOnly,[0,1]),ee=I.transform,Y=function(ve,je){const Fe=ve.properties.get("position"),Ee=[-Fe.x,-Fe.y,-Fe.z],We=o.af(new Float64Array(16));return ve.properties.get("anchor")==="map"&&(o.b5(We,We,je.rollInRadians),o.b6(We,We,-je.pitchInRadians),o.b5(We,We,je.bearingInRadians),o.b6(We,We,je.center.lat*Math.PI/180),o.by(We,We,-je.center.lng*Math.PI/180)),o.c4(Ee,Ee,We),Ee}(O,I.transform),ie=ee.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),ne=k.properties.get("atmosphere-blend")*ie.projectionTransition;if(ne===0)return;const K=Ua(ee.worldSize,ee.center.lat),le=ee.inverseProjectionMatrix,ye=new Float64Array(4);ye[3]=1,o.av(ye,ye,ee.modelViewProjectionMatrix),ye[0]/=ye[3],ye[1]/=ye[3],ye[2]/=ye[3],ye[3]=1,o.av(ye,ye,le),ye[0]/=ye[3],ye[1]/=ye[3],ye[2]/=ye[3],ye[3]=1;const pe=((ve,je,Fe,Ee,We)=>({u_sun_pos:ve,u_atmosphere_blend:je,u_globe_position:Fe,u_globe_radius:Ee,u_inv_proj_matrix:We}))(Y,ne,[ye[0],ye[1],ye[2]],K,le),me=Kn(q,k);W.draw(q,G.TRIANGLES,X,st.disabled,Pt.alphaBlended,ct.disabled,pe,null,null,"atmosphere",me.vertexBuffer,me.indexBuffer,me.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const I=function(k,O){let q=null;const G=Object.values(k._layers).flatMap(Y=>Y.source&&!Y.isHidden(O)?[k.sourceCaches[Y.source]]:[]),W=G.filter(Y=>Y.getSource().type==="vector"),X=G.filter(Y=>Y.getSource().type!=="vector"),ee=Y=>{(!q||q.getSource().maxzoom<Y.getSource().maxzoom)&&(q=Y)};return W.forEach(Y=>ee(Y)),q||X.forEach(Y=>ee(Y)),q}(this.style,this.transform.zoom);I&&function(k,O,q){for(let G=0;G<q.length;G++)sh(k,O,q[G])}(this,I,I.getVisibleCoordinates())}this.options.showPadding&&function(I){const k=I.transform.padding;Gs(I,I.transform.height-(k.top||0),3,rh),Gs(I,k.bottom||0,3,Yo),Ko(I,k.left||0,3,uc),Ko(I,I.transform.width-(k.right||0),3,nh);const O=I.transform.centerPoint;(function(q,G,W,X){Jo(q,G-1,W-10,2,20,X),Jo(q,G-10,W-1,20,2,X)})(I,O.x,I.transform.height-O.y,ah)}(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.c7(i,s):!o.c8(i,s)),l||(l=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),l&&(o.c9(i,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,f){const _=h.context,x=_.gl,T=h.transform,M=Pt.unblended,E=new ut(x.LEQUAL,ut.ReadWrite,[0,1]),I=f.sourceCache.getRenderableTiles(),k=h.useProgram("terrainDepth");_.bindFramebuffer.set(f.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:o.be.transparent,depth:1});for(const O of I){const q=f.getTerrainMesh(O.tileID),G=f.getTerrainData(O.tileID),W=T.getProjectionData({overscaledTileID:O.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),X={u_ele_delta:f.getMeshFrameDelta(T.zoom)};k.draw(_,x.TRIANGLES,E,st.disabled,M,ct.backCCW,X,G,W,"terrain",q.vertexBuffer,q.indexBuffer,q.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,f){const _=h.context,x=_.gl,T=h.transform,M=Pt.unblended,E=new ut(x.LEQUAL,ut.ReadWrite,[0,1]),I=f.getCoordsTexture(),k=f.sourceCache.getRenderableTiles(),O=h.useProgram("terrainCoords");_.bindFramebuffer.set(f.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:o.be.transparent,depth:1}),f.coordsIndex=[];for(const q of k){const G=f.getTerrainMesh(q.tileID),W=f.getTerrainData(q.tileID);_.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,I.texture);const X={u_terrain_coords_id:(255-f.coordsIndex.length)/255,u_texture:0,u_ele_delta:f.getMeshFrameDelta(T.zoom)},ee=T.getProjectionData({overscaledTileID:q.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});O.draw(_,x.TRIANGLES,E,st.disabled,M,ct.backCCW,X,W,ee,"terrain",G.vertexBuffer,G.indexBuffer,G.segments),f.coordsIndex.push(q.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(e,i,s,l,h){s.isHidden(this.transform.zoom)||(s.type==="background"||s.type==="custom"||(l||[]).length)&&(this.id=s.id,o.ca(s)?function(f,_,x,T,M,E){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:I}=E,k=st.disabled,O=f.colorModeForRenderPass();(x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(q,G,W,X,ee,Y,ie,ne,K){const le=G.transform,ye=G.style.map.terrain,pe=ee==="map",me=Y==="map";for(const ve of q){const je=X.getTile(ve),Fe=je.getBucket(W);if(!Fe||!Fe.text||!Fe.text.segments.get().length)continue;const Ee=o.am(Fe.textSizeData,le.zoom),We=o.aB(je,1,G.transform.zoom),ht=lt(pe,G.transform,We),Lt=W.layout.get("icon-text-fit")!=="none"&&Fe.hasIconData();if(Ee){const ai=Math.pow(2,le.zoom-je.tileID.overscaledZ),Zt=ye?(si,$t)=>ye.getElevation(ve,si,$t):null;Zd(Fe,pe,me,K,le,ht,ai,Ee,Lt,o.aC(le,je,ie,ne),ve.toUnwrapped(),Zt)}}}(T,f,x,_,x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),M),x.paint.get("icon-opacity").constantOr(1)!==0&&ih(f,_,x,T,!1,x.paint.get("icon-translate"),x.paint.get("icon-translate-anchor"),x.layout.get("icon-rotation-alignment"),x.layout.get("icon-pitch-alignment"),x.layout.get("icon-keep-upright"),k,O,I),x.paint.get("text-opacity").constantOr(1)!==0&&ih(f,_,x,T,!0,x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.layout.get("text-keep-upright"),k,O,I),_.map.showCollisionBoxes&&(Qu(f,_,x,T,!0),Qu(f,_,x,T,!1))}(e,i,s,l,this.style.placement.variableOffsets,h):o.cb(s)?function(f,_,x,T,M){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=M,I=x.paint.get("circle-opacity"),k=x.paint.get("circle-stroke-width"),O=x.paint.get("circle-stroke-opacity"),q=!x.layout.get("circle-sort-key").isConstant();if(I.constantOr(1)===0&&(k.constantOr(1)===0||O.constantOr(1)===0))return;const G=f.context,W=G.gl,X=f.transform,ee=f.getDepthModeForSublayer(0,ut.ReadOnly),Y=st.disabled,ie=f.colorModeForRenderPass(),ne=[],K=X.getCircleRadiusCorrection();for(let le=0;le<T.length;le++){const ye=T[le],pe=_.getTile(ye),me=pe.getBucket(x);if(!me)continue;const ve=x.paint.get("circle-translate"),je=x.paint.get("circle-translate-anchor"),Fe=o.aC(X,pe,ve,je),Ee=me.programConfigurations.get(x.id),We=f.useProgram("circle",Ee),ht=me.layoutVertexBuffer,Lt=me.indexBuffer,ai=f.style.map.terrain&&f.style.map.terrain.getTerrainData(ye),Zt={programConfiguration:Ee,program:We,layoutVertexBuffer:ht,indexBuffer:Lt,uniformValues:Wl(f,pe,x,Fe,K),terrainData:ai,projectionData:X.getProjectionData({overscaledTileID:ye,applyGlobeMatrix:!E,applyTerrainMatrix:!0})};if(q){const si=me.segments.get();for(const $t of si)ne.push({segments:new o.aL([$t]),sortKey:$t.sortKey,state:Zt})}else ne.push({segments:me.segments,sortKey:0,state:Zt})}q&&ne.sort((le,ye)=>le.sortKey-ye.sortKey);for(const le of ne){const{programConfiguration:ye,program:pe,layoutVertexBuffer:me,indexBuffer:ve,uniformValues:je,terrainData:Fe,projectionData:Ee}=le.state;pe.draw(G,W.TRIANGLES,ee,Y,ie,ct.backCCW,je,Fe,Ee,x.id,me,ve,le.segments,x.paint,f.transform.zoom,ye)}}(e,i,s,l,h):o.cc(s)?function(f,_,x,T,M){if(x.paint.get("heatmap-opacity")===0)return;const E=f.context,{isRenderingToTexture:I,isRenderingGlobe:k}=M;if(f.style.map.terrain){for(const O of T){const q=_.getTile(O);_.hasRenderableParent(O)||(f.renderPass==="offscreen"?Wo(f,q,x,O,k):f.renderPass==="translucent"&&Ho(f,x,O,I,k))}E.viewport.set([0,0,f.width,f.height])}else f.renderPass==="offscreen"?function(O,q,G,W){const X=O.context,ee=X.gl,Y=O.transform,ie=st.disabled,ne=new Pt([ee.ONE,ee.ONE],o.be.transparent,[!0,!0,!0,!0]);(function(K,le,ye){const pe=K.gl;K.activeTexture.set(pe.TEXTURE1),K.viewport.set([0,0,le.width/4,le.height/4]);let me=ye.heatmapFbos.get(o.c1);me?(pe.bindTexture(pe.TEXTURE_2D,me.colorAttachment.get()),K.bindFramebuffer.set(me.framebuffer)):(me=Zs(K,le.width/4,le.height/4),ye.heatmapFbos.set(o.c1,me))})(X,O,G),X.clear({color:o.be.transparent});for(let K=0;K<W.length;K++){const le=W[K];if(q.hasRenderableParent(le))continue;const ye=q.getTile(le),pe=ye.getBucket(G);if(!pe)continue;const me=pe.programConfigurations.get(G.id),ve=O.useProgram("heatmap",me),je=Y.getProjectionData({overscaledTileID:le,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Fe=Y.getCircleRadiusCorrection();ve.draw(X,ee.TRIANGLES,ut.disabled,ie,ne,ct.backCCW,Os(ye,Y.zoom,G.paint.get("heatmap-intensity"),Fe),null,je,G.id,pe.layoutVertexBuffer,pe.indexBuffer,pe.segments,G.paint,Y.zoom,me)}X.viewport.set([0,0,O.width,O.height])}(f,_,x,T):f.renderPass==="translucent"&&function(O,q){const G=O.context,W=G.gl;G.setColorMode(O.colorModeForRenderPass());const X=q.heatmapFbos.get(o.c1);X&&(G.activeTexture.set(W.TEXTURE0),W.bindTexture(W.TEXTURE_2D,X.colorAttachment.get()),G.activeTexture.set(W.TEXTURE1),Xo(G,q).bind(W.LINEAR,W.CLAMP_TO_EDGE),O.useProgram("heatmapTexture").draw(G,W.TRIANGLES,ut.disabled,st.disabled,O.colorModeForRenderPass(),ct.disabled,Ou(O,q,0,1),null,null,q.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments,q.paint,O.transform.zoom))}(f,x)}(e,i,s,l,h):o.cd(s)?function(f,_,x,T,M){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=M,I=x.paint.get("line-opacity"),k=x.paint.get("line-width");if(I.constantOr(1)===0||k.constantOr(1)===0)return;const O=f.getDepthModeForSublayer(0,ut.ReadOnly),q=f.colorModeForRenderPass(),G=x.paint.get("line-dasharray"),W=x.paint.get("line-pattern"),X=W.constantOr(1),ee=x.paint.get("line-gradient"),Y=x.getCrossfadeParameters(),ie=X?"linePattern":G?"lineSDF":ee?"lineGradient":"line",ne=f.context,K=ne.gl,le=f.transform;let ye=!0;for(const pe of T){const me=_.getTile(pe);if(X&&!me.patternsLoaded())continue;const ve=me.getBucket(x);if(!ve)continue;const je=ve.programConfigurations.get(x.id),Fe=f.context.program.get(),Ee=f.useProgram(ie,je),We=ye||Ee.program!==Fe,ht=f.style.map.terrain&&f.style.map.terrain.getTerrainData(pe),Lt=W.constantOr(null);if(Lt&&me.imageAtlas){const Ut=me.imageAtlas,Gt=Ut.patternPositions[Lt.to.toString()],Wi=Ut.patternPositions[Lt.from.toString()];Gt&&Wi&&je.setConstantPatternPositions(Gt,Wi)}const ai=le.getProjectionData({overscaledTileID:pe,applyGlobeMatrix:!E,applyTerrainMatrix:!0}),Zt=le.getPixelScale(),si=X?Nu(f,me,x,Zt,Y):G?Vu(f,me,x,Zt,G,Y):ee?Hl(f,me,x,Zt,ve.lineClipsArray.length):Oo(f,me,x,Zt);if(X)ne.activeTexture.set(K.TEXTURE0),me.imageAtlasTexture.bind(K.LINEAR,K.CLAMP_TO_EDGE),je.updatePaintBuffers(Y);else if(G&&(We||f.lineAtlas.dirty))ne.activeTexture.set(K.TEXTURE0),f.lineAtlas.bind(ne);else if(ee){const Ut=ve.gradients[x.id];let Gt=Ut.texture;if(x.gradientVersion!==Ut.version){let Wi=256;if(x.stepInterpolant){const Ct=_.getSource().maxzoom,Di=pe.canonical.z===Ct?Math.ceil(1<<f.transform.maxZoom-pe.canonical.z):1;Wi=o.ag(o.c2(ve.maxLineLength/o.$*1024*Di),256,ne.maxTextureSize)}Ut.gradient=o.c3({expression:x.gradientExpression(),evaluationKey:"lineProgress",resolution:Wi,image:Ut.gradient||void 0,clips:ve.lineClipsArray}),Ut.texture?Ut.texture.update(Ut.gradient):Ut.texture=new o.T(ne,Ut.gradient,K.RGBA),Ut.version=x.gradientVersion,Gt=Ut.texture}ne.activeTexture.set(K.TEXTURE0),Gt.bind(x.stepInterpolant?K.NEAREST:K.LINEAR,K.CLAMP_TO_EDGE)}const $t=f.stencilModeForClipping(pe);Ee.draw(ne,K.TRIANGLES,O,$t,q,ct.disabled,si,ht,ai,x.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,x.paint,f.transform.zoom,je,ve.layoutVertexBuffer2),ye=!1}}(e,i,s,l,h):o.ce(s)?function(f,_,x,T,M){const E=x.paint.get("fill-color"),I=x.paint.get("fill-opacity");if(I.constantOr(1)===0)return;const{isRenderingToTexture:k}=M,O=f.colorModeForRenderPass(),q=x.paint.get("fill-pattern"),G=f.opaquePassEnabledForLayer()&&!q.constantOr(1)&&E.constantOr(o.be.transparent).a===1&&I.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===G){const W=f.getDepthModeForSublayer(1,f.renderPass==="opaque"?ut.ReadWrite:ut.ReadOnly);Us(f,_,x,T,W,O,!1,k)}if(f.renderPass==="translucent"&&x.paint.get("fill-antialias")){const W=f.getDepthModeForSublayer(x.getPaintProperty("fill-outline-color")?2:0,ut.ReadOnly);Us(f,_,x,T,W,O,!0,k)}}(e,i,s,l,h):o.cf(s)?function(f,_,x,T,M){const E=x.paint.get("fill-extrusion-opacity");if(E===0)return;const{isRenderingToTexture:I}=M;if(f.renderPass==="translucent"){const k=new ut(f.context.gl.LEQUAL,ut.ReadWrite,f.depthRangeFor3D);if(E!==1||x.paint.get("fill-extrusion-pattern").constantOr(1))ts(f,_,x,T,k,st.disabled,Pt.disabled,I),ts(f,_,x,T,k,f.stencilModeFor3D(),f.colorModeForRenderPass(),I);else{const O=f.colorModeForRenderPass();ts(f,_,x,T,k,st.disabled,O,I)}}}(e,i,s,l,h):o.cg(s)?function(f,_,x,T,M){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=M,I=f.context,k=f.style.projection.useSubdivision,O=f.getDepthModeForSublayer(0,ut.ReadOnly),q=f.colorModeForRenderPass();if(f.renderPass==="offscreen")(function(G,W,X,ee,Y,ie,ne){const K=G.context,le=K.gl;for(const ye of X){const pe=W.getTile(ye),me=pe.dem;if(!me||!me.data||!pe.needsHillshadePrepare)continue;const ve=me.dim,je=me.stride,Fe=me.getPixels();if(K.activeTexture.set(le.TEXTURE1),K.pixelStoreUnpackPremultiplyAlpha.set(!1),pe.demTexture=pe.demTexture||G.getTileTexture(je),pe.demTexture){const We=pe.demTexture;We.update(Fe,{premultiply:!1}),We.bind(le.NEAREST,le.CLAMP_TO_EDGE)}else pe.demTexture=new o.T(K,Fe,le.RGBA,{premultiply:!1}),pe.demTexture.bind(le.NEAREST,le.CLAMP_TO_EDGE);K.activeTexture.set(le.TEXTURE0);let Ee=pe.fbo;if(!Ee){const We=new o.T(K,{width:ve,height:ve,data:null},le.RGBA);We.bind(le.LINEAR,le.CLAMP_TO_EDGE),Ee=pe.fbo=K.createFramebuffer(ve,ve,!0,!1),Ee.colorAttachment.set(We.texture)}K.bindFramebuffer.set(Ee.framebuffer),K.viewport.set([0,0,ve,ve]),G.useProgram("hillshadePrepare").draw(K,le.TRIANGLES,Y,ie,ne,ct.disabled,kd(pe.tileID,me),null,null,ee.id,G.rasterBoundsBuffer,G.quadTriangleIndexBuffer,G.rasterBoundsSegments),pe.needsHillshadePrepare=!1}})(f,_,T,x,O,st.disabled,q),I.viewport.set([0,0,f.width,f.height]);else if(f.renderPass==="translucent")if(k){const[G,W,X]=f.stencilConfigForOverlapTwoPass(T);is(f,_,x,X,G,O,q,!1,E),is(f,_,x,X,W,O,q,!0,E)}else{const[G,W]=f.getStencilConfigForOverlapAndUpdateStencilID(T);is(f,_,x,W,G,O,q,!1,E)}}(e,i,s,l,h):o.ch(s)?function(f,_,x,T,M){if(f.renderPass!=="translucent"||!T.length)return;const{isRenderingToTexture:E}=M,I=f.style.projection.useSubdivision,k=f.getDepthModeForSublayer(0,ut.ReadOnly),O=f.colorModeForRenderPass();if(I){const[q,G,W]=f.stencilConfigForOverlapTwoPass(T);$s(f,_,x,W,q,k,O,!1,E),$s(f,_,x,W,G,k,O,!0,E)}else{const[q,G]=f.getStencilConfigForOverlapAndUpdateStencilID(T);$s(f,_,x,G,q,k,O,!1,E)}}(e,i,s,l,h):o.ci(s)?function(f,_,x,T,M){if(f.renderPass!=="translucent"||x.paint.get("raster-opacity")===0||!T.length)return;const{isRenderingToTexture:E}=M,I=_.getSource(),k=f.style.projection.useSubdivision;if(I instanceof ir)Yn(f,_,x,T,null,!1,!1,I.tileCoords,I.flippedWindingOrder,E);else if(k){const[O,q,G]=f.stencilConfigForOverlapTwoPass(T);Yn(f,_,x,G,O,!1,!0,cc,!1,E),Yn(f,_,x,G,q,!0,!0,cc,!1,E)}else{const[O,q]=f.getStencilConfigForOverlapAndUpdateStencilID(T);Yn(f,_,x,q,O,!1,!0,cc,!1,E)}}(e,i,s,l,h):o.cj(s)?function(f,_,x,T,M){const E=x.paint.get("background-color"),I=x.paint.get("background-opacity");if(I===0)return;const{isRenderingToTexture:k}=M,O=f.context,q=O.gl,G=f.style.projection,W=f.transform,X=W.tileSize,ee=x.paint.get("background-pattern");if(f.isPatternMissing(ee))return;const Y=!ee&&E.a===1&&I===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==Y)return;const ie=st.disabled,ne=f.getDepthModeForSublayer(0,Y==="opaque"?ut.ReadWrite:ut.ReadOnly),K=f.colorModeForRenderPass(),le=f.useProgram(ee?"backgroundPattern":"background"),ye=T||we(W,{tileSize:X,terrain:f.style.map.terrain});ee&&(O.activeTexture.set(q.TEXTURE0),f.imageManager.bind(f.context));const pe=x.getCrossfadeParameters();for(const me of ye){const ve=W.getProjectionData({overscaledTileID:me,applyGlobeMatrix:!k,applyTerrainMatrix:!0}),je=ee?Ld(I,f,ee,{tileID:me,tileSize:X},pe):jo(I,E),Fe=f.style.map.terrain&&f.style.map.terrain.getTerrainData(me),Ee=G.getMeshFromTileID(O,me.canonical,!1,!0,"raster");le.draw(O,q.TRIANGLES,ne,ie,K,ct.backCCW,je,Fe,ve,x.id,Ee.vertexBuffer,Ee.indexBuffer,Ee.segments)}}(e,0,s,l,h):o.ck(s)&&function(f,_,x,T){const{isRenderingGlobe:M}=T,E=f.context,I=x.implementation,k=f.style.projection,O=f.transform,q=O.getProjectionDataForCustomLayer(M),G={farZ:O.farZ,nearZ:O.nearZ,fov:O.fov*Math.PI/180,modelViewProjectionMatrix:O.modelViewProjectionMatrix,projectionMatrix:O.projectionMatrix,shaderData:{variantName:k.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
749
- uniform mat4 u_projection_matrix;
750
- ${k.shaderPreludeCode.vertexSource}`,define:k.shaderDefine},defaultProjectionData:q},W=I.renderingMode?I.renderingMode:"2d";if(f.renderPass==="offscreen"){const X=I.prerender;X&&(f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),X.call(I,E.gl,G),E.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),E.setStencilMode(st.disabled);const X=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,ut.ReadOnly);E.setDepthMode(X),I.render(E.gl,G),E.setDirty(),f.setBaseState(),E.bindFramebuffer.set(null)}}(e,0,s,h))}saveTileTexture(e){const i=this._tileTextures[e.size[0]];i?i.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const i=this._tileTextures[e];return i&&i.length>0?i.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const i=this.imageManager.getPattern(e.from.toString()),s=this.imageManager.getPattern(e.to.toString());return!i||!s}useProgram(e,i,s=!1,l=[]){this.cache=this.cache||{};const h=!!this.style.map.terrain,f=this.style.projection,_=s?yn.projectionMercator:f.shaderPreludeCode,x=s?fa:f.shaderDefine,T=e+(i?i.cacheKey:"")+`/${s?jl:f.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(h?"/terrain":"")+(l?`/${l.join("/")}`:"");return this.cache[T]||(this.cache[T]=new Lo(this.context,yn[e],i,$u[e],this._showOverdrawInspector,h,_,x,l)),this.cache[T]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new o.T(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 Qo(u,e){let i,s=!1,l=null,h=null;const f=()=>{l=null,s&&(u.apply(h,i),l=setTimeout(f,e),s=!1)};return(..._)=>(s=!0,h=this,i=_,l||f(),l)}class qs{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=Qo(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const i=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,l=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,l),f=Math.round(i.lng*h)/h,_=Math.round(i.lat*h)/h,x=this._map.getBearing(),T=this._map.getPitch();let M="";if(M+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(x||T)&&(M+="/"+Math.round(10*x)/10),T&&(M+=`/${Math.round(T)}`),this._hashName){const E=this._hashName;let I=!1;const k=window.location.hash.slice(1).split("&").map(O=>{const q=O.split("=")[0];return q===E?(I=!0,`${q}=${M}`):O}).filter(O=>O);return I||k.push(`${E}=${M}`),`#${k.join("&")}`}return`#${M}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new o.S(+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 rs={linearity:.3,easing:o.cl(0,0,.3,1)},ns=o.e({deceleration:2500,maxSpeed:1400},rs),hc=o.e({deceleration:20,maxSpeed:1400},rs),Ws=o.e({deceleration:1e3,maxSpeed:360},rs),dc=o.e({deceleration:1e3,maxSpeed:90},rs),oh=o.e({deceleration:1e3,maxSpeed:360},rs);class lh{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Ce.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=Ce.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=ss(i.pan.mag(),s,o.e({},ns,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,as(l,h)}if(i.zoom){const h=ss(i.zoom,s,hc);l.zoom=this._map.transform.zoom+h.amount,as(l,h)}if(i.bearing){const h=ss(i.bearing,s,Ws);l.bearing=this._map.transform.bearing+o.ag(h.amount,-179,179),as(l,h)}if(i.pitch){const h=ss(i.pitch,s,dc);l.pitch=this._map.transform.pitch+h.amount,as(l,h)}if(i.roll){const h=ss(i.roll,s,oh);l.roll=this._map.transform.roll+o.ag(h.amount,-179,179),as(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 as(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function ss(u,e,i){const{maxSpeed:s,linearity:l,deceleration:h}=i,f=o.ag(u*l/(e/1e3),-s,s),_=Math.abs(f)/(h*l);return{easing:i.easing,duration:1e3*_,amount:f*(_/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=ue.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 an 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=ue.touchPos(i.getCanvasContainer(),l),f=h.map(x=>i.unproject(x)),_=h.reduce((x,T,M,E)=>x.add(T.div(E.length)),new o.P(0,0));super(e,{points:h,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class pc extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class ch{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new pc(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 an(e.type,this._map,e))}touchmove(e){this._map.fire(new an(e.type,this._map,e))}touchend(e){this._map.fire(new an(e.type,this._map,e))}touchcancel(e){this._map.fire(new an(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class uh{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 os{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 fc{constructor(e,i){this._map=e,this._tr=new os(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&&(ue.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=ue.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const h=Math.min(l.x,s.x),f=Math.max(l.x,s.x),_=Math.min(l.y,s.y),x=Math.max(l.y,s.y);ue.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=x-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),ue.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&&(ue.remove(this._box),this._box=null),ue.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function el(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 hh{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=el(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=el(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 tl{constructor(e){this.singleTap=new hh(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 il{constructor(e){this._tr=new os(e),this._zoomIn=new tl({numTouches:1,numTaps:2}),this._zoomOut=new tl({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,s){this._zoomIn.touchstart(e,i,s),this._zoomOut.touchstart(e,i,s)}touchmove(e,i,s){this._zoomIn.touchmove(e,i,s),this._zoomOut.touchmove(e,i,s)}touchend(e,i,s){const l=this._zoomIn.touchend(e,i,s),h=this._zoomOut.touchend(e,i,s),f=this._tr;return l?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(l)},{originalEvent:e})}):h?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom-1,around:f.unproject(h)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ls{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&&ue.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 Hr=0,sn=2,dh={[Hr]:1,[sn]:2};class fr{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=ue.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=dh[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return ue.mouseButton(e)===this._eventButton}}class cs{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 $d{constructor(e=new fr({checkCorrectEvent:()=>!0}),i=new cs){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(e,i,s){return e instanceof MouseEvent?i(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?s(e):void 0}startMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.startMove(i),i=>this.oneFingerTouchMoveStateManager.startMove(i))}endMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.endMove(i),i=>this.oneFingerTouchMoveStateManager.endMove(i))}isValidStartEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidStartEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidStartEvent(i))}isValidMoveEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidMoveEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(i))}isValidEndEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidEndEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidEndEvent(i))}}const rl=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class Gd{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=el(s,i),h=new o.P(0,0),f=new o.P(0,0);let _=0;for(const T in l){const M=l[T],E=this._touches[T];E&&(h._add(M),f._add(M.sub(E)),_++,l[T]=M)}if(this._touches=l,this._shouldBePrevented(_)||!f.mag())return;const x=f.div(_);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:x}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class mc{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=Hs(s,i,l),_=Hs(s,i,h);if(!f||!_)return;const x=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],x,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=Hs(s,i,l),_=Hs(s,i,h);f&&_||(this._active&&ue.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 Hs(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function us(u,e){return Math.log(u/e)/Math.LN2}class bn extends mc{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(us(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:us(this._distance,s),pinchAround:i}}}function Ge(u,e){return 180*u.angleWith(e)/Math.PI}class gc extends mc{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:Ge(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=Ge(e,this._startVector);return Math.abs(s)<i}}function Xs(u){return Math.abs(u.y)>Math.abs(u.x)}class _c extends mc{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,Xs(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 Xs(e)&&Xs(i)&&f}}const Ys={panStep:100,bearingStep:15,pitchStep:10};class hs{constructor(e){this._tr=new os(e);const i=Ys;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,s=0,l=0,h=0,f=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?s=-1:(e.preventDefault(),h=-1);break;case 39:e.shiftKey?s=1:(e.preventDefault(),h=1);break;case 38:e.shiftKey?l=1:(e.preventDefault(),f=-1);break;case 40:e.shiftKey?l=-1:(e.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,l=0),{cameraAnimation:_=>{const x=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:yc,zoom:i?Math.round(x.zoom)+i*(e.shiftKey?2:1):x.zoom,bearing:x.bearing+s*this._bearingStep,pitch:x.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:x.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function yc(u){return u*(2-u)}const bt=4.000244140625,xc=1/450;class ph{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new os(e),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=xc}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=Ce.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%bt==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=ue.mousePos(this._map.getCanvas(),e),s=this._tr;this._aroundPoint=this._aroundCenter?s.transform.locationToScreenPoint(o.S.convert(s.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>bt?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&x!==0&&(x=1/x);const T=typeof this._targetZoom!="number"?e.scale:o.ae(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),o.aj(T*x)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,s=this._startZoom,l=this._easing;let h,f=!1;if(this._type==="wheel"&&s&&l){const _=Ce.now()-this._lastWheelEventTime,x=Math.min((_+5)/200,1),T=l(x);h=o.C.number(s,i,T),x<1?this._frameId||(this._frameId=!0):f=!0}else h=i,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=h,{noInertia:!0,needsRenderFrame:!f,zoomDelta:h-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=o.cn;if(this._prevEase){const s=this._prevEase,l=(Ce.now()-s.start)/s.duration,h=s.easing(l+.01)-s.easing(l),f=.27/Math.sqrt(h*h+1e-4)*.01,_=Math.sqrt(.0729-f*f);i=o.cl(f,_,.25,1)}return this._prevEase={start:Ce.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 nl{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 qd{constructor(e){this._tr=new os(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 Wd{constructor(){this._tap=new tl({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 vc{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 al{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 bc{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 fh{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=ue.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&&(ue.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 Ks=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Hd extends o.l{}function wc(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class Jn{constructor(e,i){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,h)=>{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const f=l.type==="renderFrame"?void 0:l,_={needsRenderFrame:!1},x={},T={};for(const{handlerName:I,handler:k,allowed:O}of this._handlers){if(!k.isEnabled())continue;let q;if(this._blockedByActive(T,O,I))k.reset();else if(k[h||l.type]){if(o.co(l,h||l.type)){const G=ue.mousePos(this._map.getCanvas(),l);q=k[h||l.type](l,G)}else if(o.cp(l,h||l.type)){const G=this._getMapTouches(l.touches),W=ue.touchPos(this._map.getCanvas(),G);q=k[h||l.type](l,W,G)}else o.cq(h||l.type)||(q=k[h||l.type](l));this.mergeHandlerResult(_,x,q,I,f),q&&q.needsRenderFrame&&this._triggerRenderFrame()}(q||k.isActive())&&(T[I]=k)}const M={};for(const I in this._previousActiveHandlers)T[I]||(M[I]=f);this._previousActiveHandlers=T,(Object.keys(M).length||wc(_))&&(this._changes.push([_,x,M]),this._triggerRenderFrame()),(Object.keys(T).length||wc(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:E}=_;E&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],E(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new lh(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)ue.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)ue.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new ch(i,e));const l=i.boxZoom=new fc(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new fh(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new il(i),_=new qd(i);i.doubleClickZoom=new nl(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const x=new Wd;this._add("tapDragZoom",x);const T=i.touchPitch=new _c(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const M=()=>i.project(i.getCenter()),E=function({enable:Y,clickTolerance:ie,aroundCenter:ne=!0,minPixelCenterThreshold:K=100,rotateDegreesPerPixelMoved:le=.8},ye){const pe=new fr({checkCorrectEvent:me=>ue.mouseButton(me)===0&&me.ctrlKey||ue.mouseButton(me)===2&&!me.ctrlKey});return new ls({clickTolerance:ie,move:(me,ve)=>{const je=ye();if(ne&&Math.abs(je.y-me.y)>K)return{bearingDelta:o.cm(new o.P(me.x,ve.y),ve,je)};let Fe=(ve.x-me.x)*le;return ne&&ve.y<je.y&&(Fe=-Fe),{bearingDelta:Fe}},moveStateManager:pe,enable:Y,assignEvents:rl})}(e,M),I=function({enable:Y,clickTolerance:ie,pitchDegreesPerPixelMoved:ne=-.5}){const K=new fr({checkCorrectEvent:le=>ue.mouseButton(le)===0&&le.ctrlKey||ue.mouseButton(le)===2});return new ls({clickTolerance:ie,move:(le,ye)=>({pitchDelta:(ye.y-le.y)*ne}),moveStateManager:K,enable:Y,assignEvents:rl})}(e),k=function({enable:Y,clickTolerance:ie,rollDegreesPerPixelMoved:ne=.3},K){const le=new fr({checkCorrectEvent:ye=>ue.mouseButton(ye)===2&&ye.ctrlKey});return new ls({clickTolerance:ie,move:(ye,pe)=>{const me=K();let ve=(pe.x-ye.x)*ne;return pe.y<me.y&&(ve=-ve),{rollDelta:ve}},moveStateManager:le,enable:Y,assignEvents:rl})}(e,M);i.dragRotate=new al(e,E,I,k),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",I,["mouseRotate","mouseRoll"]),this._add("mouseRoll",k,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const O=function({enable:Y,clickTolerance:ie}){const ne=new fr({checkCorrectEvent:K=>ue.mouseButton(K)===0&&!K.ctrlKey});return new ls({clickTolerance:ie,move:(K,le)=>({around:le,panDelta:le.sub(K)}),activateOnStart:!0,moveStateManager:ne,enable:Y,assignEvents:rl})}(e),q=new Gd(e,i);i.dragPan=new vc(s,O,q),this._add("mousePan",O),this._add("touchPan",q,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const G=new gc,W=new bn;i.touchZoomRotate=new bc(s,W,G,x),this._add("touchRotate",G,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const X=i.scrollZoom=new ph(i,()=>this._triggerRenderFrame());this._add("scrollZoom",X,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const ee=i.keyboard=new hs(i);this._add("keyboard",ee),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new uh(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!!Ks(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(!(wc(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:T,pitchDelta:M,rollDelta:E,around:I,pinchAround:k}=e;k!==void 0&&(I=k),I=I||l.transform.centerPoint,f&&!h.isPointOnMapSurface(I)&&(I=h.centerPoint);const O={panDelta:_,zoomDelta:x,rollDelta:E,pitchDelta:M,bearingDelta:T,around:I};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(I)&&(I=h.centerPoint);const q=I.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?I.sub(_):I);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(O,h,q):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(O,h,q))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._map.cameraHelper.handleMapControlsPan(O,h,q)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=Ks(this._eventsInProgress),h=Ks(e),f={};for(const E in e){const{originalEvent:I}=e[E];this._eventsInProgress[E]||(f[`${E}start`]=I),this._eventsInProgress[E]=e[E]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const E in f)this._fireEvent(E,f[E]);h&&this._fireEvent("move",h.originalEvent);for(const E in e){const{originalEvent:I}=e[E];this._fireEvent(E,I)}const _={};let x;for(const E in this._eventsInProgress){const{handlerName:I,originalEvent:k}=this._eventsInProgress[E];this._handlersById[I].isActive()||(delete this._eventsInProgress[E],x=i[I]||k,_[`${E}end`]=x)}for(const E in _)this._fireEvent(E,_[E]);const T=Ks(this._eventsInProgress),M=(l||h)&&!T;if(M&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const E=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&E.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(E)}if(s&&M){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),I=k=>k!==0&&-this._bearingSnap<k&&k<this._bearingSnap;!E||!E.essential&&Ce.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:x})),I(this._map.getBearing())&&this._map.resetNorth()):(I(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new o.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Hd("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Qt extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((Ce.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.S(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=Wt.convert(e).adjustAntiMeridian();const s=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),s,i)}_cameraForBoxAndBearing(e,i,s,l){const h={top:0,bottom:0,right:0,left:0};if(typeof(l=o.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},l)).padding=="number"){const T=l.padding;l.padding={top:T,bottom:T,right:T,left:T}}const f=o.e(h,l.padding);l.padding=f;const _=this.transform,x=new Wt(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,x,s,_)}fitBounds(e,i,s){return this._fitInternal(this.cameraForBounds(e,i),i,s)}fitScreenCoordinates(e,i,s,l,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(o.P.convert(e)),this.transform.screenPointToLocation(o.P.convert(i)),s,l),l,h)}_fitInternal(e,i,s){return e?(delete(i=o.e(e,i)).padding,i.linear?this.easeTo(i,s):this.flyTo(i,s)):this}jumpTo(e,i){this.stop();const s=this._getTransformForUpdate();let l=!1,h=!1,f=!1;const _=s.zoom;this.cameraHelper.handleJumpToCenterZoom(s,e);const x=s.zoom!==_;return"elevation"in e&&s.elevation!==+e.elevation&&s.setElevation(+e.elevation),"bearing"in e&&s.bearing!==+e.bearing&&(l=!0,s.setBearing(+e.bearing)),"pitch"in e&&s.pitch!==+e.pitch&&(h=!0,s.setPitch(+e.pitch)),"roll"in e&&s.roll!==+e.roll&&(f=!0,s.setRoll(+e.roll)),e.padding==null||s.isPaddingEqual(e.padding)||s.setPadding(e.padding),this._applyUpdatedTransform(s),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)),x&&this.fire(new o.l("zoomstart",i)).fire(new o.l("zoom",i)).fire(new o.l("zoomend",i)),l&&this.fire(new o.l("rotatestart",i)).fire(new o.l("rotate",i)).fire(new o.l("rotateend",i)),h&&this.fire(new o.l("pitchstart",i)).fire(new o.l("pitch",i)).fire(new o.l("pitchend",i)),f&&this.fire(new o.l("rollstart",i)).fire(new o.l("roll",i)).fire(new o.l("rollend",i)),this.fire(new o.l("moveend",i))}calculateCameraOptionsFromTo(e,i,s,l=0){const h=o.a0.fromLngLat(e,i),f=o.a0.fromLngLat(s,l),_=f.x-h.x,x=f.y-h.y,T=f.z-h.z,M=Math.hypot(_,x,T);if(M===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(_,x),I=o.aj(this.transform.cameraToCenterDistance/M/this.transform.tileSize),k=180*Math.atan2(_,-x)/Math.PI;let O=180*Math.acos(E/M)/Math.PI;return O=T<0?90-O:90+O,{center:f.toLngLat(),elevation:l,zoom:I,pitch:O,bearing:k}}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.cn},e)).animate===!1||!e.essential&&Ce.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),l=this.getBearing(),h=s.pitch,f=s.roll,_="bearing"in e?this._normalizeBearing(e.bearing,l):l,x="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,M="padding"in e?e.padding:s.padding,E=o.P.convert(e.offset);let I,k;e.around&&(I=o.S.convert(e.around),k=s.locationToScreenPoint(I));const O={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},q=this.cameraHelper.handleEaseTo(s,{bearing:_,pitch:x,roll:T,padding:M,around:I,aroundPoint:k,offsetAsPoint:E,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||x!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(M),this._zooming=this._zooming||q.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,O),this.terrain&&this._prepareElevation(q.elevationCenter),this._ease(G=>{q.easeFunc(G),this.terrain&&!e.freezeElevation&&this._updateElevation(G),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},G=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,G)},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.C.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),s=e.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(s<l){const h=this.calculateCameraOptionsFromTo(i,l,e.center,e.elevation);return{pitch:h.pitch,zoom:h.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(l=>this._elevateCameraIfInsideTerrain(l)),this.transformCameraUpdate&&i.push(l=>this.transformCameraUpdate(l)),!i.length)return;const s=e.clone();for(const l of i){const h=s.clone(),{center:f,zoom:_,roll:x,pitch:T,bearing:M,elevation:E}=l(h);f&&h.setCenter(f),E!==void 0&&h.setElevation(E),_!==void 0&&h.setZoom(_),x!==void 0&&h.setRoll(x),T!==void 0&&h.setPitch(T),M!==void 0&&h.setBearing(M),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&&Ce.prefersReducedMotion){const ve=o.Q(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(ve,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cn},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,_=s.padding,x="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,M="roll"in e?this._normalizeBearing(e.roll,f):f,E="padding"in e?e.padding:s.padding,I=o.P.convert(e.offset);let k=s.centerPoint.add(I);const O=s.screenPointToLocation(k),q=this.cameraHelper.handleFlyTo(s,{bearing:x,pitch:T,roll:M,padding:E,locationAtOffset:O,offsetAsPoint:I,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let G=e.curve;const W=Math.max(s.width,s.height),X=W/q.scaleOfZoom,ee=q.pixelPathLength;typeof q.scaleOfMinZoom=="number"&&(G=Math.sqrt(W/q.scaleOfMinZoom/ee*2));const Y=G*G;function ie(ve){const je=(X*X-W*W+(ve?-1:1)*Y*Y*ee*ee)/(2*(ve?X:W)*Y*ee);return Math.log(Math.sqrt(je*je+1)-je)}function ne(ve){return(Math.exp(ve)-Math.exp(-ve))/2}function K(ve){return(Math.exp(ve)+Math.exp(-ve))/2}const le=ie(!1);let ye=function(ve){return K(le)/K(le+G*ve)},pe=function(ve){return W*((K(le)*(ne(je=le+G*ve)/K(je))-ne(le))/Y)/ee;var je},me=(ie(!0)-le)/G;if(Math.abs(ee)<2e-6||!isFinite(me)){if(Math.abs(W-X)<1e-6)return this.easeTo(e,i);const ve=X<W?-1:1;me=Math.abs(Math.log(X/W))/G,pe=()=>0,ye=je=>Math.exp(ve*G*je)}return e.duration="duration"in e?+e.duration:1e3*me/("screenSpeed"in e?+e.screenSpeed/G:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==x,this._pitching=T!==h,this._rolling=M!==f,this._padding=!s.isPaddingEqual(E),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(q.targetCenter),this._ease(ve=>{const je=ve*me,Fe=1/ye(je),Ee=pe(je);this._rotating&&s.setBearing(o.C.number(l,x,ve)),this._pitching&&s.setPitch(o.C.number(h,T,ve)),this._rolling&&s.setRoll(o.C.number(f,M,ve)),this._padding&&(s.interpolatePadding(_,E,ve),k=s.centerPoint.add(I)),q.easeFunc(ve,Fe,Ee,k),this.terrain&&!e.freezeElevation&&this._updateElevation(ve),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=Ce.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=o.aN(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.S.convert(e),this.transform.tileZoom):null}}const Js={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class sl{constructor(e=Js){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=ue.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ue.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ue.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(){ue.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=ue.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Tc{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=ue.create("div","maplibregl-ctrl");const i=ue.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(){ue.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class mh{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 gh=o.aI([{name:"a_pos3d",type:"Int16",components:3}]);class Xd extends o.E{constructor(e){super(),this._lastTilesetChange=Ce.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 we(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.bX(l.terrainRttPosMatrix32f,0,o.$,o.$,0,0,1),this._tiles[l.key]=new Je(l,this.tileSize),this._lastTilesetChange=Ce.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.b9();if(l.canonical.equals(e.canonical))o.bX(f,0,o.$,o.$,0,0,1);else if(l.canonical.isChildOf(e.canonical)){const _=l.canonical.z-e.canonical.z,x=l.canonical.x-(l.canonical.x>>_<<_),T=l.canonical.y-(l.canonical.y>>_<<_),M=o.$>>_;o.bX(f,0,M,M,0,0,1),o.M(f,f,[-x*M,-T*M,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const _=e.canonical.z-l.canonical.z,x=e.canonical.x-(e.canonical.x>>_<<_),T=e.canonical.y-(e.canonical.y>>_<<_),M=o.$>>_;o.bX(f,0,o.$,o.$,0,0,1),o.M(f,f,[x*M,T*M,0]),o.N(f,f,[1/2**_,1/2**_,0])}}h.terrainRttPosMatrix32f=new Float32Array(f),i[s]=h}return i}_getTerrainCoordsForTileRanges(e,i){const s={};for(const l of this._renderableTilesKeys){const h=this._tiles[l].tileID;if(!this._isWithinTileRanges(h,i))continue;const f=e.clone(),_=o.b9();if(h.canonical.z===e.canonical.z){const x=e.canonical.x-h.canonical.x,T=e.canonical.y-h.canonical.y;o.bX(_,0,o.$,o.$,0,0,1),o.M(_,_,[x*o.$,T*o.$,0])}else if(h.canonical.z>e.canonical.z){const x=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>x<<x),M=h.canonical.y-(h.canonical.y>>x<<x),E=e.canonical.x-(h.canonical.x>>x),I=e.canonical.y-(h.canonical.y>>x),k=o.$>>x;o.bX(_,0,k,k,0,0,1),o.M(_,_,[-T*k+E*o.$,-M*k+I*o.$,0])}else{const x=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>x<<x),M=e.canonical.y-(e.canonical.y>>x<<x),E=(e.canonical.x>>x)-h.canonical.x,I=(e.canonical.y>>x)-h.canonical.y,k=o.$<<x;o.bX(_,0,k,k,0,0,1),o.M(_,_,[T*o.$+E*k,M*o.$+I*k,0])}f.terrainRttPosMatrix32f=new Float32Array(_),s[l]=f}return s}getSourceTile(e,i){const s=this.sourceCache._source;let l=e.overscaledZ-this.deltaZoom;if(l>s.maxzoom&&(l=s.maxzoom),l<s.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(l).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!h||!h.dem)&&i)for(;l>=s.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(e.scaledTo(l--).key);return h}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,i){return i[e.canonical.z]&&e.canonical.x>=i[e.canonical.z].minTileX&&e.canonical.x<=i[e.canonical.z].maxTileX&&e.canonical.y>=i[e.canonical.z].minTileY&&e.canonical.y<=i[e.canonical.z].maxTileY}}class wn{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new Xd(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.$){var h;if(!(i>=0&&i<l&&s>=0&&s<l))return 0;const f=this.getTerrainData(e),_=(h=f.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const x=o.cr([],[i/l*o.$,s/l*o.$],f.u_terrain_matrix),T=[x[0]*_.dim,x[1]*_.dim],M=Math.floor(T[0]),E=Math.floor(T[1]),I=T[0]-M,k=T[1]-E;return _.get(M,E)*(1-I)*(1-k)+_.get(M+1,E)*I*(1-k)+_.get(M,E+1)*(1-I)*k+_.get(M+1,E+1)*I*k}getElevationForLngLatZoom(e,i){if(!o.cs(i,e.wrap()))return 0;const{tileID:s,mercatorX:l,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(s,l%o.$,h%o.$,o.$)}getElevation(e,i,s,l=o.$){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 o.T(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new o.T(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.af([])}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 o.T(l,i.dem.getPixels(),l.gl.RGBA,{premultiply:!1}),i.demTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const s=i&&i+i.tileID.key+e.key;if(s&&!this._demMatrixCache[s]){const l=this.sourceCache.sourceCache._source.maxzoom;let h=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=l?h=e.canonical.z-l:o.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=e.canonical.x-(e.canonical.x>>h<<h),_=e.canonical.y-(e.canonical.y>>h<<h),x=o.ct(new Float64Array(16),[1/(o.$<<h),1/(o.$<<h),0]);o.M(x,x,[f*o.$,_*o.$,0]),this._demMatrixCache[e.key]={matrix:x,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const i=this.painter,s=i.width/devicePixelRatio,l=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===l||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new o.T(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 o.T(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(s,l,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,s,l))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let h=0,f=0;h<this._coordsTextureSize;h++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)i[f+0]=255&_,i[f+1]=255&h,i[f+2]=_>>8<<4|h>>8,i[f+3]=0;const s=new o.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),l=new o.T(e,s,e.gl.RGBA,{premultiply:!1});return l.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),s=this.painter.context,l=s.gl,h=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),f=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(h,_-f-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null);const x=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),M=this.coordsIndex[255-i[3]],E=M&&this.sourceCache.getTileByID(M);if(!E)return null;const I=this._coordsTextureSize,k=(1<<E.tileID.canonical.z)*I;return new o.a0((E.tileID.canonical.x*I+x)/k+E.tileID.wrap,(E.tileID.canonical.y*I+T)/k,this.getElevation(E.tileID,x,T,I))}depthAtPoint(e){const i=new Uint8Array(4),s=this.painter.context,l=s.gl;return s.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),l.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null),(i[0]/16777216+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(e){var i;const s=((i=this.painter.style.projection)===null||i===void 0?void 0:i.transitionState)>0,l=s&&e.canonical.y===0,h=s&&e.canonical.y===(1<<e.canonical.z)-1,f=`m_${l?"n":""}_${h?"s":""}`;if(this._meshCache[f])return this._meshCache[f];const _=this.painter.context,x=new o.cu,T=new o.aM,M=this.meshSize,E=o.$/M,I=M*M;for(let K=0;K<=M;K++)for(let le=0;le<=M;le++)x.emplaceBack(le*E,K*E,0);for(let K=0;K<I;K+=M+1)for(let le=0;le<M;le++)T.emplaceBack(le+K,M+le+K+1,M+le+K+2),T.emplaceBack(le+K,M+le+K+2,le+K+1);const k=x.length,O=k+(M+1),q=(M+1)*M,G=l?o.bg:0,W=l?0:1,X=h?o.bh:o.$,ee=h?0:1;for(let K=0;K<=M;K++)x.emplaceBack(K*E,G,W);for(let K=0;K<=M;K++)x.emplaceBack(K*E,X,ee);for(let K=0;K<M;K++)T.emplaceBack(q+K,O+K,O+K+1),T.emplaceBack(q+K,O+K+1,q+K+1),T.emplaceBack(0+K,k+K+1,k+K),T.emplaceBack(0+K,0+K+1,k+K+1);const Y=x.length,ie=Y+2*(M+1);for(const K of[0,1])for(let le=0;le<=M;le++)for(const ye of[0,1])x.emplaceBack(K*o.$,le*E,ye);for(let K=0;K<2*M;K+=2)T.emplaceBack(Y+K,Y+K+1,Y+K+3),T.emplaceBack(Y+K,Y+K+3,Y+K+2),T.emplaceBack(ie+K,ie+K+3,ie+K+1),T.emplaceBack(ie+K,ie+K+2,ie+K+3);const ne=new zn(_.createVertexBuffer(x,gh.members),_.createIndexBuffer(T),o.aL.simpleSegment(0,0,x.length,T.length));return this._meshCache[f]=ne,ne}getMeshFrameDelta(e){return 2*Math.PI*o.bt/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.a0.fromLngLat(e.wrap()),l=(1<<i)*o.$,h=s.x*l,f=s.y*l,_=Math.floor(h/o.$),x=Math.floor(f/o.$);return{tileID:new o.Z(i,0,i,_,x),mercatorX:h,mercatorY:f}}}class ol{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 o.T(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 Xe={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class nt{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new ol(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 ir?h.terrainTileRanges:null;for(const _ of l){const x=this.terrain.sourceCache.getTerrainCoords(_,f);for(const T in x)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(x[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(Xe[l.type]&&!this._coordsAscendingStr[h]){this._coordsAscendingStr[h]={};for(const f in this._coordsAscending[h])this._coordsAscendingStr[h][f]=this._coordsAscending[h][f].map(_=>_.key).sort().join()}}for(const s of this._renderableTiles)for(const l in this._coordsAscendingStr){const h=this._coordsAscendingStr[l][s.tileID.key];h&&h!==s.rttCoords[l]&&(s.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const s=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),l=e.type,h=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Xe[l]&&(this._prevType&&Xe[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(Xe[this._prevType]||Xe[l]&&f){this._prevType=l;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(ci(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[_]){const E=this.pool.getObjectForId(T.rtt[_].id);if(E.stamp===T.rtt[_].stamp){this.pool.useObject(E);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),T.rtt[_]={id:M.id,stamp:M.stamp},h.context.bindFramebuffer.set(M.fbo.framebuffer),h.context.clear({color:o.be.transparent,stencil:0}),h.currentStencilSource=void 0;for(let E=0;E<x.length;E++){const I=h.style._layers[x[E]],k=I.source?this._coordsAscending[I.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,M.fbo.width,M.fbo.height]),h._renderTileClippingMasks(I,k,!0),h.renderLayer(h,h.style.sourceCaches[I.source],I,k,s),I.source&&(T.rttCoords[I.source]=this._coordsAscendingStr[I.source][T.tileID.key])}}return ci(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),Xe[l]}return!1}}const ll={"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"},Sc=fe,Qs={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Js,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},mr={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class _h{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,ue.mousePos(this.element,h)),ue.addEventListener(window,"mousemove",this.mousemove),ue.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,ue.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=ue.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),ue.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ue.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=ue.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 $d;this._rotatePitchHanlder=new ls({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),x=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.cm(new o.P(h.x,f.y),f,x),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,ue.addEventListener(i,"mousedown",this.mousedown),ue.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),ue.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),ue.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;ue.removeEventListener(e,"mousedown",this.mousedown),ue.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),ue.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ue.removeEventListener(window,"touchend",this.touchend),ue.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){ue.enableDrag(),ue.removeEventListener(window,"mousemove",this.mousemove),ue.removeEventListener(window,"mouseup",this.mouseup),ue.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ue.removeEventListener(window,"touchend",this.touchend)}}let qi;function yh(u,e,i,s=!1){if(s||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return u==null?void 0:u.wrap();const l=new o.S(u.lng,u.lat);if(u=new o.S(u.lng,u.lat),e){const h=new o.S(u.lng-360,u.lat),f=new o.S(u.lng+360,u.lat),_=i.locationToScreenPoint(u).distSqr(e);i.locationToScreenPoint(h).distSqr(e)<_?u=h:i.locationToScreenPoint(f).distSqr(e)<_&&(u=f)}for(;Math.abs(u.lng-i.center.lng)>180;){const h=i.locationToScreenPoint(u);if(h.x>=0&&h.y>=0&&h.x<=i.width&&h.y<=i.height)break;u.lng>i.center.lng?u.lng-=360:u.lng+=360}return u.lng!==l.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(u))?u:l}const wa={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 ni(u,e,i){const s=u.classList;for(const l in wa)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class ui extends o.E{constructor(e){if(super(),this._onKeyPress=i=>{const s=i.code,l=i.charCode||i.keyCode;s!=="Space"&&s!=="Enter"&&l!==32&&l!==13||this.togglePopup()},this._onMapClick=i=>{const s=i.originalEvent.target,l=this._element;this._popup&&(s===l||l.contains(s))&&this.togglePopup()},this._update=i=>{if(!this._map)return;const s=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!s)&&this._map.once("render",this._update),this._lngLat=yh(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let l="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?l=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(l=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let h="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?h="rotateX(0deg)":this._pitchAlignment==="map"&&(h=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),ue.setTransform(this._element,`${wa[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${l}`),Ce.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=ue.create("div");const i=ue.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=ue.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=ue.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=ue.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const x=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const W of x){const X=ue.createNS("http://www.w3.org/2000/svg","ellipse");X.setAttributeNS(null,"opacity","0.04"),X.setAttributeNS(null,"cx","10.5"),X.setAttributeNS(null,"cy","5.80029008"),X.setAttributeNS(null,"rx",W.rx),X.setAttributeNS(null,"ry",W.ry),_.appendChild(X)}const T=ue.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const M=ue.createNS("http://www.w3.org/2000/svg","path");M.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(M);const E=ue.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const I=ue.createNS("http://www.w3.org/2000/svg","path");I.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"),E.appendChild(I);const k=ue.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"transform","translate(6.0, 7.0)"),k.setAttributeNS(null,"fill","#FFFFFF");const O=ue.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const q=ue.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#000000"),q.setAttributeNS(null,"opacity","0.25"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962");const G=ue.createNS("http://www.w3.org/2000/svg","circle");G.setAttributeNS(null,"fill","#FFFFFF"),G.setAttributeNS(null,"cx","5.5"),G.setAttributeNS(null,"cy","5.5"),G.setAttributeNS(null,"r","5.4999962"),O.appendChild(q),O.appendChild(G),f.appendChild(_),f.appendChild(T),f.appendChild(E),f.appendChild(k),f.appendChild(O),i.appendChild(f),i.setAttributeNS(null,"height",s*this._scale+"px"),i.setAttributeNS(null,"width",l*this._scale+"px"),this._element.appendChild(i),this._offset=o.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),ni(this._element,this._anchor,"marker"),e&&e.className)for(const i of e.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),ue.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=o.S.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const l=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[l,-1*(38.1-13.5+l)],"bottom-right":[-l,-1*(38.1-13.5+l)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,s;const l=(i=this._map)===null||i===void 0?void 0:i.terrain,h=this._map.transform.isLocationOccluded(this._lngLat);if(!l||h){const k=h?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==k&&(this._element.style.opacity=k))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const f=this._map,_=f.terrain.depthAtPoint(this._pos),x=f.terrain.getElevationForLngLatZoom(this._lngLat,f.transform.tileZoom);if(f.transform.lngLatToCameraDepth(this._lngLat,x)-_<.006)return void(this._element.style.opacity=this._opacity);const T=-this._offset.y/f.transform.pixelsPerMeter,M=Math.sin(f.getPitch()*Math.PI/180)*T,E=f.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),I=f.transform.lngLatToCameraDepth(this._lngLat,x+M)-E>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&I&&this._popup.remove(),this._element.style.opacity=I?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 xh={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Qn=0,ea=!1;const Pc={maxWidth:100,unit:"metric"};function cl(u,e,i){const s=i&&i.maxWidth||100,l=u._container.clientHeight/2,h=u._container.clientWidth/2,f=u.unproject([h-s/2,l]),_=u.unproject([h+s/2,l]),x=Math.round(u.project(_).x-u.project(f).x),T=Math.min(s,x,u._container.clientWidth),M=f.distanceTo(_);if(i&&i.unit==="imperial"){const E=3.2808*M;E>5280?Ta(e,T,E/5280,u._getUIString("ScaleControl.Miles")):Ta(e,T,E,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?Ta(e,T,M/1852,u._getUIString("ScaleControl.NauticalMiles")):M>=1e3?Ta(e,T,M/1e3,u._getUIString("ScaleControl.Kilometers")):Ta(e,T,M,u._getUIString("ScaleControl.Meters"))}function Ta(u,e,i,s){const l=function(h){const f=Math.pow(10,`${Math.floor(h)}`.length-1);let _=h/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T}(_),f*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l}&nbsp;${s}`}const eo={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Mc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ul(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 ul(new o.P(0,0))}const Cc=fe;P.AJAXError=o.cy,P.Event=o.l,P.Evented=o.E,P.LngLat=o.S,P.MercatorCoordinate=o.a0,P.Point=o.P,P.addProtocol=o.cz,P.config=o.a,P.removeProtocol=o.cA,P.AttributionControl=sl,P.BoxZoomHandler=fc,P.CanvasSource=gn,P.CooperativeGesturesHandler=fh,P.DoubleClickZoomHandler=nl,P.DragPanHandler=vc,P.DragRotateHandler=al,P.EdgeInsets=$r,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=ue.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ue.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=ue.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ue.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=hr,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.S(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,l=this._map.getBearing(),h=o.e({bearing:l},this.options.fitBoundsOptions),f=Wt.fromLngLat(i,s);this._map.fitBounds(f,h,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new o.S(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&ea)return;this.options.trackUserLocation&&this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new o.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=ue.create("button","maplibregl-ctrl-geolocate",this._container),ue.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=ue.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ui({element:this._dotElement}),this._circleElement=ue.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ui({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({},xh,u)}onAdd(u){return this._map=u,this._container=ue.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(qi!==void 0&&!e)return qi;if(window.navigator.permissions===void 0)return qi=!!window.navigator.geolocation,qi;try{qi=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{qi=!!window.navigator.geolocation}return qi})}().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(),ue.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Qn=0,ea=!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":Qn--,ea=!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"),Qn++,Qn>1?(u={maximumAge:6e5,timeout:0},ea=!0):(u=this.options.positionOptions,ea=!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=ue.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ue.create("button","maplibregl-ctrl-globe",this._container),ue.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(){ue.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},P.Hash=qs,P.ImageSource=ir,P.KeyboardHandler=hs,P.LngLatBounds=Wt,P.LogoControl=Tc,P.Map=class extends Qt{constructor(u){var e,i;o.cv.mark(o.cw.create);const s=Object.assign(Object.assign(Object.assign({},Qs),u),{canvasContextAttributes:Object.assign(Object.assign({},Qs.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 vi,h=new Ro;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 mh,this._controls=[],this._mapId=o.a6(),this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new o.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.l("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},s.canvasContextAttributes),this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._centerClampedToGround=s.centerClampedToGround,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},ll),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=li.addThrottleControl(()=>this.isMoving()),this._requestManager=new Et(s.transformRequest),typeof s.container=="string"){if(this._container=document.getElementById(s.container),!this._container)throw new Error(`Container '${s.container}' not found.`)}else{if(!(s.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=s.container}if(s.maxBounds&&this.setMaxBounds(s.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let _=!1;const x=Qo(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{_?x(T):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Jn(this,s),this._hash=s.hash&&new qs(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 sl(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new Tc,s.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const _=o.Q(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new o.l(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new o.l(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new o.l("sourcedataabort",_))})}_getMapId(){return this._mapId}setGlobalStateProperty(u,e){return this.style.setGlobalStateProperty(u,e),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(u,e){if(e===void 0&&(e=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new o.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=u.onAdd(this);this._controls.push(u);const s=this._controlPositions[e];return e.indexOf("bottom")!==-1?s.insertBefore(i,s.firstChild):s.appendChild(i),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new o.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(u);return e>-1&&this._controls.splice(e,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,e,i,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,e,i,s)}resize(u,e=!0){const[i,s]=this._containerDimensions(),l=this._getClampedPixelRatio(i,s);if(this._resizeCanvas(i,s,l),this.painter.resize(i,s,l),this.painter.overLimit()){const f=this.painter.context.gl;this._maxCanvasSize=[f.drawingBufferWidth,f.drawingBufferHeight];const _=this._getClampedPixelRatio(i,s);this._resizeCanvas(i,s,_),this.painter.resize(i,s,_)}this._resizeTransform(e);const h=!this._moving;return h&&(this.stop(),this.fire(new o.l("movestart",u)).fire(new o.l("move",u))),this.fire(new o.l("resize",u)),h&&this.fire(new o.l("moveend",u)),this}_resizeTransform(u=!0){var e;const[i,s]=this._containerDimensions();this.transform.resize(i,s,u),(e=this._requestedCameraState)===null||e===void 0||e.resize(i,s,u)}_getClampedPixelRatio(u,e){const{0:i,1:s}=this._maxCanvasSize,l=this.getPixelRatio(),h=u*l,f=e*l;return Math.min(h>i?i/h:1,f>s?s/f:1)*l}getPixelRatio(){var u;return(u=this._overridePixelRatio)!==null&&u!==void 0?u:devicePixelRatio}setPixelRatio(u){this._overridePixelRatio=u,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(u){return this.transform.setMaxBounds(Wt.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.S.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.screenPointToLocation(o.P.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,e,i){if(u==="mouseenter"||u==="mouseover"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:h=>{const f=e.filter(x=>this.getLayer(x)),_=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];_.length?s||(s=!0,i.call(this,new Tr(u,this,h.originalEvent,{features:_}))):s=!1},mouseout:()=>{s=!1}}}}if(u==="mouseleave"||u==="mouseout"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:f=>{const _=e.filter(x=>this.getLayer(x));(_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[]).length?s=!0:s&&(s=!1,i.call(this,new 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(_=>this.getLayer(_)),f=h.length!==0?this.queryRenderedFeatures(l.point,{layers:h}):[];f.length&&(l.features=f,i.call(this,l),delete l.features)};return{layers:e,listener:i,delegates:{[u]:s}}}}_saveDelegatedListener(u,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(e)}_removeDelegatedListener(u,e,i){if(!this._delegatedListeners||!this._delegatedListeners[u])return;const s=this._delegatedListeners[u];for(let l=0;l<s.length;l++){const h=s[l];if(h.listener===i&&h.layers.length===e.length&&h.layers.every(f=>e.includes(f))){for(const f in h.delegates)this.off(f,h.delegates[f]);return void s.splice(l,1)}}}on(u,e,i){if(i===void 0)return super.on(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);this._saveDelegatedListener(u,l);for(const h in l.delegates)this.on(h,l.delegates[h]);return{unsubscribe:()=>{this._removeDelegatedListener(u,s,i)}}}once(u,e,i){if(i===void 0)return super.once(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);for(const h in l.delegates){const f=l.delegates[h];l.delegates[h]=(..._)=>{this._removeDelegatedListener(u,s,i),f(..._)}}this._saveDelegatedListener(u,l);for(const h in l.delegates)this.once(h,l.delegates[h]);return this}off(u,e,i){return i===void 0?super.off(u,e):(this._removeDelegatedListener(u,typeof e=="string"?[e]:e,i),this)}queryRenderedFeatures(u,e){if(!this.style)return[];let i;const s=u instanceof o.P||Array.isArray(u),l=s?u:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(s?{}:u)||{},l instanceof o.P||typeof l[0]=="number")i=[o.P.convert(l)];else{const h=o.P.convert(l[0]),f=o.P.convert(l[1]);i=[h,new o.P(f.x,h.y),f,new o.P(h.x,f.y),h]}return this.style.queryRenderedFeatures(i,e,this.transform)}querySourceFeatures(u,e){return this.style.querySourceFeatures(u,e)}setStyle(u,e){return(e=o.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(u,e))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const e=this._locale[u];if(e==null)throw new Error(`Missing UI string '${u}'`);return e}_updateStyle(u,e){var i,s;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,e));const l=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new Gl(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 Gl(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."),s.type==="color-relief"&&s.source===u.source&&o.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new wn(this.painter,e,u),this.painter.renderToTexture=new nt(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var s;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId!==u.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((s=i.source)===null||s===void 0?void 0:s.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new o.l("terrain",{terrain:u})),this}getTerrain(){var u,e;return(e=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const e in u){const i=u[e]._tiles;for(const s in i){const l=i[s];if(l.state!=="loaded"&&l.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}setSourceTileLodParams(u,e,i){if(i){const s=this.getSource(i);if(!s)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);s.calculateTileZoom=_e(Math.max(1,u),Math.max(1,e))}else for(const s in this.style.sourceCaches)this.style.sourceCaches[s].getSource().calculateTileZoom=_e(Math.max(1,u),Math.max(1,e));return this._update(!0),this}refreshTiles(u,e){const i=this.style.sourceCaches[u];if(!i)throw new Error(`There is no source cache with ID "${u}", cannot refresh tile`);e===void 0?i.reload(!0):i.refreshTiles(e.map(s=>new o.a3(s.z,s.x,s.y)))}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||o.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new o.k(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:M,height:E,data:I}=e,k=e;return this.style.addImage(u,{data:new o.R({width:M,height:E},new Uint8Array(I)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0,userImage:k}),k.onAdd&&k.onAdd(this,u),this}}{const{width:M,height:E,data:I}=Ce.getImageData(e);this.style.addImage(u,{data:new o.R({width:M,height:E},I),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0})}}updateImage(u,e){const i=this.style.getImage(u);if(!i)return this.fire(new o.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=e instanceof HTMLImageElement||o.b(e)?Ce.getImageData(e):e,{width:l,height:h,data:f}=s;if(l===void 0||h===void 0)return this.fire(new o.k(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(l!==i.data.width||h!==i.data.height)return this.fire(new o.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||o.b(e));return i.data.replace(f,_),this.style.updateImage(u,i),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new o.k(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return li.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=ue.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=ue.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=ue.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=ue.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 Wr(i,this.transform),Ue.testSupport(i)}migrateProjection(u,e){super.migrateProjection(u,e),this.painter.transform=u,this.fire(new o.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){var e,i,s,l,h;const f=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let x=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const E=this.transform.zoom,I=Ce.now();this.style.zoomHistory.update(E,I);const k=new o.F(E,{now:I,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition(),globalState:this.style.getGlobalState()}),O=k.crossFadingFactor();O===1&&O===this._crossFadingFactor||(x=!0,this._crossFadingFactor=O),this.style.update(k)}const T=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==_;(s=this.style.projection)===null||s===void 0||s.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((l=this.style.projection)===null||l===void 0?void 0:l.transitionState,(h=this.style.projection)===null||h===void 0?void 0:h.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||T)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,f,this._crossSourceCollisions,T),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,showPadding:this.showPadding}),this.fire(new o.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,o.cv.mark(o.cw.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||x)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const M=this._sourcesDirty||this._styleDirty||this._placementDirty;return M||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||M||(this._fullyLoaded=!0,o.cv.mark(o.cw.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),li.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),ue.remove(this._canvasContainer),ue.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cv.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ce.frame(this._frameRequest,u=>{o.cv.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cx(e)&&!function(i){return i.message===sc}(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 Sc}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=an,P.MapWheelEvent=pc,P.Marker=ui,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({},mr,u),this._container=ue.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})),ue.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})),ue.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=ue.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 _h(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ue.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=ue.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&&ue.remove(this._content),this._container&&(ue.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new o.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ue.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ue.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const f of this.options.className.split(" "))this._container.classList.add(f);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=yh(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const i=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let s=this.options.anchor;const l=ul(this.options.offset);if(!s){const f=this._container.offsetWidth,_=this._container.offsetHeight;let x;x=i.y+l.bottom.y<_?["top"]:i.y>this._map.transform.height-_?["bottom"]:[],i.x<f/2?x.push("left"):i.x>this._map.transform.width-f/2&&x.push("right"),s=x.length===0?"bottom":x.join("-")}let h=i.add(l[s]);this.options.subpixelPositioning||(h=h.round()),ue.setTransform(this._container,`${wa[s]} translate(${h.x}px,${h.y}px)`),ni(this._container,s,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(eo),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.S.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=ue.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=ue.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(Mc);u&&u.focus()}},P.RasterDEMTileSource=Mi,P.RasterTileSource=qn,P.ScaleControl=class{constructor(u){this._onMove=()=>{cl(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,cl(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Pc),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=ue.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ue.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},P.ScrollZoomHandler=ph,P.Style=Gl,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=ue.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ue.create("button","maplibregl-ctrl-terrain",this._container),ue.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(){ue.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},P.TwoFingersTouchPitchHandler=_c,P.TwoFingersTouchRotateHandler=gc,P.TwoFingersTouchZoomHandler=bn,P.TwoFingersTouchZoomRotateHandler=bc,P.VectorTileSource=vr,P.VideoSource=Cn,P.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(tn(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{ua[i]=s})(u,e)}),P.clearPrewarmedResources=function(){const u=ur;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Ir),ur=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=Zl,P.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},P.getRTLTextPluginStatus=function(){return Le().getRTLTextPluginStatus()},P.getVersion=function(){return Cc},P.getWorkerCount=function(){return gi.workerCount},P.getWorkerUrl=function(){return o.a.WORKER_URL},P.importScriptInWorkers=function(u){return xr().broadcast("IS",u)},P.prewarm=function(){Zr().acquire(Ir)},P.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},P.setRTLTextPlugin=function(u,e){return Le().setRTLTextPlugin(u,e)},P.setWorkerCount=function(u){gi.workerCount=u},P.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var F=w;return F})}(yu)),yu.exports}var hy=uy();const ld=ly(hy);class Df{constructor(g,w,z,D,F){kt(this,"bounds1");kt(this,"bounds2");kt(this,"getBounds",(g,w,z,D)=>new ld.LngLatBounds([g,w],[z,D]));kt(this,"contains",(g,w)=>this.bounds1.contains([w,g])||this.bounds2.contains([w,g]));const P=g.unproject([w,z]),o=g.unproject([D,F]);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 dy={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}}]},py={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 Nt;(function(v){v.assertEqual=D=>{};function g(D){}v.assertIs=g;function w(D){throw new Error}v.assertNever=w,v.arrayToEnum=D=>{const F={};for(const P of D)F[P]=P;return F},v.getValidEnumValues=D=>{const F=v.objectKeys(D).filter(o=>typeof D[D[o]]!="number"),P={};for(const o of F)P[o]=D[o];return v.objectValues(P)},v.objectValues=D=>v.objectKeys(D).map(function(F){return D[F]}),v.objectKeys=typeof Object.keys=="function"?D=>Object.keys(D):D=>{const F=[];for(const P in D)Object.prototype.hasOwnProperty.call(D,P)&&F.push(P);return F},v.find=(D,F)=>{for(const P of D)if(F(P))return P},v.isInteger=typeof Number.isInteger=="function"?D=>Number.isInteger(D):D=>typeof D=="number"&&Number.isFinite(D)&&Math.floor(D)===D;function z(D,F=" | "){return D.map(P=>typeof P=="string"?`'${P}'`:P).join(F)}v.joinValues=z,v.jsonStringifyReplacer=(D,F)=>typeof F=="bigint"?F.toString():F})(Nt||(Nt={}));var Lf;(function(v){v.mergeShapes=(g,w)=>({...g,...w})})(Lf||(Lf={}));const Qe=Nt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ra=v=>{switch(typeof v){case"undefined":return Qe.undefined;case"string":return Qe.string;case"number":return Number.isNaN(v)?Qe.nan:Qe.number;case"boolean":return Qe.boolean;case"function":return Qe.function;case"bigint":return Qe.bigint;case"symbol":return Qe.symbol;case"object":return Array.isArray(v)?Qe.array:v===null?Qe.null:v.then&&typeof v.then=="function"&&v.catch&&typeof v.catch=="function"?Qe.promise:typeof Map<"u"&&v instanceof Map?Qe.map:typeof Set<"u"&&v instanceof Set?Qe.set:typeof Date<"u"&&v instanceof Date?Qe.date:Qe.object;default:return Qe.unknown}},Ze=Nt.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"]);class mn extends Error{get errors(){return this.issues}constructor(g){super(),this.issues=[],this.addIssue=z=>{this.issues=[...this.issues,z]},this.addIssues=(z=[])=>{this.issues=[...this.issues,...z]};const w=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,w):this.__proto__=w,this.name="ZodError",this.issues=g}format(g){const w=g||function(F){return F.message},z={_errors:[]},D=F=>{for(const P of F.issues)if(P.code==="invalid_union")P.unionErrors.map(D);else if(P.code==="invalid_return_type")D(P.returnTypeError);else if(P.code==="invalid_arguments")D(P.argumentsError);else if(P.path.length===0)z._errors.push(w(P));else{let o=z,fe=0;for(;fe<P.path.length;){const xe=P.path[fe];fe===P.path.length-1?(o[xe]=o[xe]||{_errors:[]},o[xe]._errors.push(w(P))):o[xe]=o[xe]||{_errors:[]},o=o[xe],fe++}}};return D(this),z}static assert(g){if(!(g instanceof mn))throw new Error(`Not a ZodError: ${g}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Nt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(g=w=>w.message){const w={},z=[];for(const D of this.issues)D.path.length>0?(w[D.path[0]]=w[D.path[0]]||[],w[D.path[0]].push(g(D))):z.push(g(D));return{formErrors:z,fieldErrors:w}}get formErrors(){return this.flatten()}}mn.create=v=>new mn(v);const Il=(v,g)=>{let w;switch(v.code){case Ze.invalid_type:v.received===Qe.undefined?w="Required":w=`Expected ${v.expected}, received ${v.received}`;break;case Ze.invalid_literal:w=`Invalid literal value, expected ${JSON.stringify(v.expected,Nt.jsonStringifyReplacer)}`;break;case Ze.unrecognized_keys:w=`Unrecognized key(s) in object: ${Nt.joinValues(v.keys,", ")}`;break;case Ze.invalid_union:w="Invalid input";break;case Ze.invalid_union_discriminator:w=`Invalid discriminator value. Expected ${Nt.joinValues(v.options)}`;break;case Ze.invalid_enum_value:w=`Invalid enum value. Expected ${Nt.joinValues(v.options)}, received '${v.received}'`;break;case Ze.invalid_arguments:w="Invalid function arguments";break;case Ze.invalid_return_type:w="Invalid function return type";break;case Ze.invalid_date:w="Invalid date";break;case Ze.invalid_string:typeof v.validation=="object"?"includes"in v.validation?(w=`Invalid input: must include "${v.validation.includes}"`,typeof v.validation.position=="number"&&(w=`${w} at one or more positions greater than or equal to ${v.validation.position}`)):"startsWith"in v.validation?w=`Invalid input: must start with "${v.validation.startsWith}"`:"endsWith"in v.validation?w=`Invalid input: must end with "${v.validation.endsWith}"`:Nt.assertNever(v.validation):v.validation!=="regex"?w=`Invalid ${v.validation}`:w="Invalid";break;case Ze.too_small:v.type==="array"?w=`Array must contain ${v.exact?"exactly":v.inclusive?"at least":"more than"} ${v.minimum} element(s)`:v.type==="string"?w=`String must contain ${v.exact?"exactly":v.inclusive?"at least":"over"} ${v.minimum} character(s)`:v.type==="number"?w=`Number must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${v.minimum}`:v.type==="date"?w=`Date must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(v.minimum))}`:w="Invalid input";break;case Ze.too_big:v.type==="array"?w=`Array must contain ${v.exact?"exactly":v.inclusive?"at most":"less than"} ${v.maximum} element(s)`:v.type==="string"?w=`String must contain ${v.exact?"exactly":v.inclusive?"at most":"under"} ${v.maximum} character(s)`:v.type==="number"?w=`Number must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="bigint"?w=`BigInt must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="date"?w=`Date must be ${v.exact?"exactly":v.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(v.maximum))}`:w="Invalid input";break;case Ze.custom:w="Invalid input";break;case Ze.invalid_intersection_types:w="Intersection results could not be merged";break;case Ze.not_multiple_of:w=`Number must be a multiple of ${v.multipleOf}`;break;case Ze.not_finite:w="Number must be finite";break;default:w=g.defaultError,Nt.assertNever(v)}return{message:w}};let fy=Il;function cd(){return fy}const ud=v=>{const{data:g,path:w,errorMaps:z,issueData:D}=v,F=[...w,...D.path||[]],P={...D,path:F};if(D.message!==void 0)return{...D,path:F,message:D.message};let o="";const fe=z.filter(xe=>!!xe).slice().reverse();for(const xe of fe)o=xe(P,{data:g,defaultError:o}).message;return{...D,path:F,message:o}};function Ye(v,g){const w=cd(),z=ud({issueData:g,data:v.data,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,w,w===Il?void 0:Il].filter(D=>!!D)});v.common.issues.push(z)}class Jr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(g,w){const z=[];for(const D of w){if(D.status==="aborted")return pt;D.status==="dirty"&&g.dirty(),z.push(D.value)}return{status:g.value,value:z}}static async mergeObjectAsync(g,w){const z=[];for(const D of w){const F=await D.key,P=await D.value;z.push({key:F,value:P})}return Jr.mergeObjectSync(g,z)}static mergeObjectSync(g,w){const z={};for(const D of w){const{key:F,value:P}=D;if(F.status==="aborted"||P.status==="aborted")return pt;F.status==="dirty"&&g.dirty(),P.status==="dirty"&&g.dirty(),F.value!=="__proto__"&&(typeof P.value<"u"||D.alwaysSet)&&(z[F.value]=P.value)}return{status:g.value,value:z}}}const pt=Object.freeze({status:"aborted"}),El=v=>({status:"dirty",value:v}),jr=v=>({status:"valid",value:v}),Bf=v=>v.status==="aborted",Ff=v=>v.status==="dirty",xo=v=>v.status==="valid",xu=v=>typeof Promise<"u"&&v instanceof Promise;var rt;(function(v){v.errToObj=g=>typeof g=="string"?{message:g}:g||{},v.toString=g=>typeof g=="string"?g:g==null?void 0:g.message})(rt||(rt={}));class Da{constructor(g,w,z,D){this._cachedPath=[],this.parent=g,this.data=w,this._path=z,this._key=D}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Of=(v,g)=>{if(xo(g))return{success:!0,data:g.value};if(!v.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const w=new mn(v.common.issues);return this._error=w,this._error}}};function Mt(v){if(!v)return{};const{errorMap:g,invalid_type_error:w,required_error:z,description:D}=v;if(g&&(w||z))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return g?{errorMap:g,description:D}:{errorMap:(P,o)=>{const{message:fe}=v;return P.code==="invalid_enum_value"?{message:fe??o.defaultError}:typeof o.data>"u"?{message:fe??z??o.defaultError}:P.code!=="invalid_type"?{message:o.defaultError}:{message:fe??w??o.defaultError}},description:D}}class Bt{get description(){return this._def.description}_getType(g){return Ra(g.data)}_getOrReturnCtx(g,w){return w||{common:g.parent.common,data:g.data,parsedType:Ra(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}_processInputParams(g){return{status:new Jr,ctx:{common:g.parent.common,data:g.data,parsedType:Ra(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}}_parseSync(g){const w=this._parse(g);if(xu(w))throw new Error("Synchronous parse encountered promise.");return w}_parseAsync(g){const w=this._parse(g);return Promise.resolve(w)}parse(g,w){const z=this.safeParse(g,w);if(z.success)return z.data;throw z.error}safeParse(g,w){const z={common:{issues:[],async:(w==null?void 0:w.async)??!1,contextualErrorMap:w==null?void 0:w.errorMap},path:(w==null?void 0:w.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:Ra(g)},D=this._parseSync({data:g,path:z.path,parent:z});return Of(z,D)}"~validate"(g){var z,D;const w={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:Ra(g)};if(!this["~standard"].async)try{const F=this._parseSync({data:g,path:[],parent:w});return xo(F)?{value:F.value}:{issues:w.common.issues}}catch(F){(D=(z=F==null?void 0:F.message)==null?void 0:z.toLowerCase())!=null&&D.includes("encountered")&&(this["~standard"].async=!0),w.common={issues:[],async:!0}}return this._parseAsync({data:g,path:[],parent:w}).then(F=>xo(F)?{value:F.value}:{issues:w.common.issues})}async parseAsync(g,w){const z=await this.safeParseAsync(g,w);if(z.success)return z.data;throw z.error}async safeParseAsync(g,w){const z={common:{issues:[],contextualErrorMap:w==null?void 0:w.errorMap,async:!0},path:(w==null?void 0:w.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:Ra(g)},D=this._parse({data:g,path:z.path,parent:z}),F=await(xu(D)?D:Promise.resolve(D));return Of(z,F)}refine(g,w){const z=D=>typeof w=="string"||typeof w>"u"?{message:w}:typeof w=="function"?w(D):w;return this._refinement((D,F)=>{const P=g(D),o=()=>F.addIssue({code:Ze.custom,...z(D)});return typeof Promise<"u"&&P instanceof Promise?P.then(fe=>fe?!0:(o(),!1)):P?!0:(o(),!1)})}refinement(g,w){return this._refinement((z,D)=>g(z)?!0:(D.addIssue(typeof w=="function"?w(z,D):w),!1))}_refinement(g){return new So({schema:this,typeName:ft.ZodEffects,effect:{type:"refinement",refinement:g}})}superRefine(g){return this._refinement(g)}constructor(g){this.spa=this.safeParseAsync,this._def=g,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:w=>this["~validate"](w)}}optional(){return Fa.create(this,this._def)}nullable(){return Po.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $n.create(this)}promise(){return Rl.create(this,this._def)}or(g){return bu.create([this,g],this._def)}and(g){return wu.create(this,g,this._def)}transform(g){return new So({...Mt(this._def),schema:this,typeName:ft.ZodEffects,effect:{type:"transform",transform:g}})}default(g){const w=typeof g=="function"?g:()=>g;return new _d({...Mt(this._def),innerType:this,defaultValue:w,typeName:ft.ZodDefault})}brand(){return new Fy({typeName:ft.ZodBranded,type:this,...Mt(this._def)})}catch(g){const w=typeof g=="function"?g:()=>g;return new yd({...Mt(this._def),innerType:this,catchValue:w,typeName:ft.ZodCatch})}describe(g){const w=this.constructor;return new w({...this._def,description:g})}pipe(g){return xd.create(this,g)}readonly(){return vd.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const my=/^c[^\s-]{8,}$/i,gy=/^[0-9a-z]+$/,_y=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yy=/^[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,xy=/^[a-z0-9_-]{21}$/i,vy=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,by=/^[-+]?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)?)??$/,wy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ty="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let hd;const Sy=/^(?:(?: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])$/,Py=/^(?:(?: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])$/,My=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Cy=/^(([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])$/,Iy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ey=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,jf="((\\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])))",zy=new RegExp(`^${jf}$`);function Nf(v){let g="[0-5]\\d";v.precision?g=`${g}\\.\\d{${v.precision}}`:v.precision==null&&(g=`${g}(\\.\\d+)?`);const w=v.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${g})${w}`}function Ay(v){return new RegExp(`^${Nf(v)}$`)}function ky(v){let g=`${jf}T${Nf(v)}`;const w=[];return w.push(v.local?"Z?":"Z"),v.offset&&w.push("([+-]\\d{2}:?\\d{2})"),g=`${g}(${w.join("|")})`,new RegExp(`^${g}$`)}function Ry(v,g){return!!((g==="v4"||!g)&&Sy.test(v)||(g==="v6"||!g)&&My.test(v))}function Dy(v,g){if(!vy.test(v))return!1;try{const[w]=v.split("."),z=w.replace(/-/g,"+").replace(/_/g,"/").padEnd(w.length+(4-w.length%4)%4,"="),D=JSON.parse(atob(z));return!(typeof D!="object"||D===null||"typ"in D&&(D==null?void 0:D.typ)!=="JWT"||!D.alg||g&&D.alg!==g)}catch{return!1}}function Ly(v,g){return!!((g==="v4"||!g)&&Py.test(v)||(g==="v6"||!g)&&Cy.test(v))}class La extends Bt{_parse(g){if(this._def.coerce&&(g.data=String(g.data)),this._getType(g)!==Qe.string){const F=this._getOrReturnCtx(g);return Ye(F,{code:Ze.invalid_type,expected:Qe.string,received:F.parsedType}),pt}const z=new Jr;let D;for(const F of this._def.checks)if(F.kind==="min")g.data.length<F.value&&(D=this._getOrReturnCtx(g,D),Ye(D,{code:Ze.too_small,minimum:F.value,type:"string",inclusive:!0,exact:!1,message:F.message}),z.dirty());else if(F.kind==="max")g.data.length>F.value&&(D=this._getOrReturnCtx(g,D),Ye(D,{code:Ze.too_big,maximum:F.value,type:"string",inclusive:!0,exact:!1,message:F.message}),z.dirty());else if(F.kind==="length"){const P=g.data.length>F.value,o=g.data.length<F.value;(P||o)&&(D=this._getOrReturnCtx(g,D),P?Ye(D,{code:Ze.too_big,maximum:F.value,type:"string",inclusive:!0,exact:!0,message:F.message}):o&&Ye(D,{code:Ze.too_small,minimum:F.value,type:"string",inclusive:!0,exact:!0,message:F.message}),z.dirty())}else if(F.kind==="email")wy.test(g.data)||(D=this._getOrReturnCtx(g,D),Ye(D,{validation:"email",code:Ze.invalid_string,message:F.message}),z.dirty());else if(F.kind==="emoji")hd||(hd=new RegExp(Ty,"u")),hd.test(g.data)||(D=this._getOrReturnCtx(g,D),Ye(D,{validation:"emoji",code:Ze.invalid_string,message:F.message}),z.dirty());else if(F.kind==="uuid")yy.test(g.data)||(D=this._getOrReturnCtx(g,D),Ye(D,{validation:"uuid",code:Ze.invalid_string,message:F.message}),z.dirty());else if(F.kind==="nanoid")xy.test(g.data)||(D=this._getOrReturnCtx(g,D),Ye(D,{validation:"nanoid",code:Ze.invalid_string,message:F.message}),z.dirty());else if(F.kind==="cuid")my.test(g.data)||(D=this._getOrReturnCtx(g,D),Ye(D,{validation:"cuid",code:Ze.invalid_string,message:F.message}),z.dirty());else if(F.kind==="cuid2")gy.test(g.data)||(D=this._getOrReturnCtx(g,D),Ye(D,{validation:"cuid2",code:Ze.invalid_string,message:F.message}),z.dirty());else if(F.kind==="ulid")_y.test(g.data)||(D=this._getOrReturnCtx(g,D),Ye(D,{validation:"ulid",code:Ze.invalid_string,message:F.message}),z.dirty());else if(F.kind==="url")try{new URL(g.data)}catch{D=this._getOrReturnCtx(g,D),Ye(D,{validation:"url",code:Ze.invalid_string,message:F.message}),z.dirty()}else F.kind==="regex"?(F.regex.lastIndex=0,F.regex.test(g.data)||(D=this._getOrReturnCtx(g,D),Ye(D,{validation:"regex",code:Ze.invalid_string,message:F.message}),z.dirty())):F.kind==="trim"?g.data=g.data.trim():F.kind==="includes"?g.data.includes(F.value,F.position)||(D=this._getOrReturnCtx(g,D),Ye(D,{code:Ze.invalid_string,validation:{includes:F.value,position:F.position},message:F.message}),z.dirty()):F.kind==="toLowerCase"?g.data=g.data.toLowerCase():F.kind==="toUpperCase"?g.data=g.data.toUpperCase():F.kind==="startsWith"?g.data.startsWith(F.value)||(D=this._getOrReturnCtx(g,D),Ye(D,{code:Ze.invalid_string,validation:{startsWith:F.value},message:F.message}),z.dirty()):F.kind==="endsWith"?g.data.endsWith(F.value)||(D=this._getOrReturnCtx(g,D),Ye(D,{code:Ze.invalid_string,validation:{endsWith:F.value},message:F.message}),z.dirty()):F.kind==="datetime"?ky(F).test(g.data)||(D=this._getOrReturnCtx(g,D),Ye(D,{code:Ze.invalid_string,validation:"datetime",message:F.message}),z.dirty()):F.kind==="date"?zy.test(g.data)||(D=this._getOrReturnCtx(g,D),Ye(D,{code:Ze.invalid_string,validation:"date",message:F.message}),z.dirty()):F.kind==="time"?Ay(F).test(g.data)||(D=this._getOrReturnCtx(g,D),Ye(D,{code:Ze.invalid_string,validation:"time",message:F.message}),z.dirty()):F.kind==="duration"?by.test(g.data)||(D=this._getOrReturnCtx(g,D),Ye(D,{validation:"duration",code:Ze.invalid_string,message:F.message}),z.dirty()):F.kind==="ip"?Ry(g.data,F.version)||(D=this._getOrReturnCtx(g,D),Ye(D,{validation:"ip",code:Ze.invalid_string,message:F.message}),z.dirty()):F.kind==="jwt"?Dy(g.data,F.alg)||(D=this._getOrReturnCtx(g,D),Ye(D,{validation:"jwt",code:Ze.invalid_string,message:F.message}),z.dirty()):F.kind==="cidr"?Ly(g.data,F.version)||(D=this._getOrReturnCtx(g,D),Ye(D,{validation:"cidr",code:Ze.invalid_string,message:F.message}),z.dirty()):F.kind==="base64"?Iy.test(g.data)||(D=this._getOrReturnCtx(g,D),Ye(D,{validation:"base64",code:Ze.invalid_string,message:F.message}),z.dirty()):F.kind==="base64url"?Ey.test(g.data)||(D=this._getOrReturnCtx(g,D),Ye(D,{validation:"base64url",code:Ze.invalid_string,message:F.message}),z.dirty()):Nt.assertNever(F);return{status:z.value,value:g.data}}_regex(g,w,z){return this.refinement(D=>g.test(D),{validation:w,code:Ze.invalid_string,...rt.errToObj(z)})}_addCheck(g){return new La({...this._def,checks:[...this._def.checks,g]})}email(g){return this._addCheck({kind:"email",...rt.errToObj(g)})}url(g){return this._addCheck({kind:"url",...rt.errToObj(g)})}emoji(g){return this._addCheck({kind:"emoji",...rt.errToObj(g)})}uuid(g){return this._addCheck({kind:"uuid",...rt.errToObj(g)})}nanoid(g){return this._addCheck({kind:"nanoid",...rt.errToObj(g)})}cuid(g){return this._addCheck({kind:"cuid",...rt.errToObj(g)})}cuid2(g){return this._addCheck({kind:"cuid2",...rt.errToObj(g)})}ulid(g){return this._addCheck({kind:"ulid",...rt.errToObj(g)})}base64(g){return this._addCheck({kind:"base64",...rt.errToObj(g)})}base64url(g){return this._addCheck({kind:"base64url",...rt.errToObj(g)})}jwt(g){return this._addCheck({kind:"jwt",...rt.errToObj(g)})}ip(g){return this._addCheck({kind:"ip",...rt.errToObj(g)})}cidr(g){return this._addCheck({kind:"cidr",...rt.errToObj(g)})}datetime(g){return typeof g=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:g}):this._addCheck({kind:"datetime",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,offset:(g==null?void 0:g.offset)??!1,local:(g==null?void 0:g.local)??!1,...rt.errToObj(g==null?void 0:g.message)})}date(g){return this._addCheck({kind:"date",message:g})}time(g){return typeof g=="string"?this._addCheck({kind:"time",precision:null,message:g}):this._addCheck({kind:"time",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,...rt.errToObj(g==null?void 0:g.message)})}duration(g){return this._addCheck({kind:"duration",...rt.errToObj(g)})}regex(g,w){return this._addCheck({kind:"regex",regex:g,...rt.errToObj(w)})}includes(g,w){return this._addCheck({kind:"includes",value:g,position:w==null?void 0:w.position,...rt.errToObj(w==null?void 0:w.message)})}startsWith(g,w){return this._addCheck({kind:"startsWith",value:g,...rt.errToObj(w)})}endsWith(g,w){return this._addCheck({kind:"endsWith",value:g,...rt.errToObj(w)})}min(g,w){return this._addCheck({kind:"min",value:g,...rt.errToObj(w)})}max(g,w){return this._addCheck({kind:"max",value:g,...rt.errToObj(w)})}length(g,w){return this._addCheck({kind:"length",value:g,...rt.errToObj(w)})}nonempty(g){return this.min(1,rt.errToObj(g))}trim(){return new La({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new La({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new La({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(g=>g.kind==="datetime")}get isDate(){return!!this._def.checks.find(g=>g.kind==="date")}get isTime(){return!!this._def.checks.find(g=>g.kind==="time")}get isDuration(){return!!this._def.checks.find(g=>g.kind==="duration")}get isEmail(){return!!this._def.checks.find(g=>g.kind==="email")}get isURL(){return!!this._def.checks.find(g=>g.kind==="url")}get isEmoji(){return!!this._def.checks.find(g=>g.kind==="emoji")}get isUUID(){return!!this._def.checks.find(g=>g.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(g=>g.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(g=>g.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(g=>g.kind==="cuid2")}get isULID(){return!!this._def.checks.find(g=>g.kind==="ulid")}get isIP(){return!!this._def.checks.find(g=>g.kind==="ip")}get isCIDR(){return!!this._def.checks.find(g=>g.kind==="cidr")}get isBase64(){return!!this._def.checks.find(g=>g.kind==="base64")}get isBase64url(){return!!this._def.checks.find(g=>g.kind==="base64url")}get minLength(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g}get maxLength(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g}}La.create=v=>new La({checks:[],typeName:ft.ZodString,coerce:(v==null?void 0:v.coerce)??!1,...Mt(v)});function By(v,g){const w=(v.toString().split(".")[1]||"").length,z=(g.toString().split(".")[1]||"").length,D=w>z?w:z,F=Number.parseInt(v.toFixed(D).replace(".","")),P=Number.parseInt(g.toFixed(D).replace(".",""));return F%P/10**D}class vo extends Bt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(g){if(this._def.coerce&&(g.data=Number(g.data)),this._getType(g)!==Qe.number){const F=this._getOrReturnCtx(g);return Ye(F,{code:Ze.invalid_type,expected:Qe.number,received:F.parsedType}),pt}let z;const D=new Jr;for(const F of this._def.checks)F.kind==="int"?Nt.isInteger(g.data)||(z=this._getOrReturnCtx(g,z),Ye(z,{code:Ze.invalid_type,expected:"integer",received:"float",message:F.message}),D.dirty()):F.kind==="min"?(F.inclusive?g.data<F.value:g.data<=F.value)&&(z=this._getOrReturnCtx(g,z),Ye(z,{code:Ze.too_small,minimum:F.value,type:"number",inclusive:F.inclusive,exact:!1,message:F.message}),D.dirty()):F.kind==="max"?(F.inclusive?g.data>F.value:g.data>=F.value)&&(z=this._getOrReturnCtx(g,z),Ye(z,{code:Ze.too_big,maximum:F.value,type:"number",inclusive:F.inclusive,exact:!1,message:F.message}),D.dirty()):F.kind==="multipleOf"?By(g.data,F.value)!==0&&(z=this._getOrReturnCtx(g,z),Ye(z,{code:Ze.not_multiple_of,multipleOf:F.value,message:F.message}),D.dirty()):F.kind==="finite"?Number.isFinite(g.data)||(z=this._getOrReturnCtx(g,z),Ye(z,{code:Ze.not_finite,message:F.message}),D.dirty()):Nt.assertNever(F);return{status:D.value,value:g.data}}gte(g,w){return this.setLimit("min",g,!0,rt.toString(w))}gt(g,w){return this.setLimit("min",g,!1,rt.toString(w))}lte(g,w){return this.setLimit("max",g,!0,rt.toString(w))}lt(g,w){return this.setLimit("max",g,!1,rt.toString(w))}setLimit(g,w,z,D){return new vo({...this._def,checks:[...this._def.checks,{kind:g,value:w,inclusive:z,message:rt.toString(D)}]})}_addCheck(g){return new vo({...this._def,checks:[...this._def.checks,g]})}int(g){return this._addCheck({kind:"int",message:rt.toString(g)})}positive(g){return this._addCheck({kind:"min",value:0,inclusive:!1,message:rt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:0,inclusive:!1,message:rt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:0,inclusive:!0,message:rt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:0,inclusive:!0,message:rt.toString(g)})}multipleOf(g,w){return this._addCheck({kind:"multipleOf",value:g,message:rt.toString(w)})}finite(g){return this._addCheck({kind:"finite",message:rt.toString(g)})}safe(g){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:rt.toString(g)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:rt.toString(g)})}get minValue(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g}get maxValue(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g}get isInt(){return!!this._def.checks.find(g=>g.kind==="int"||g.kind==="multipleOf"&&Nt.isInteger(g.value))}get isFinite(){let g=null,w=null;for(const z of this._def.checks){if(z.kind==="finite"||z.kind==="int"||z.kind==="multipleOf")return!0;z.kind==="min"?(w===null||z.value>w)&&(w=z.value):z.kind==="max"&&(g===null||z.value<g)&&(g=z.value)}return Number.isFinite(w)&&Number.isFinite(g)}}vo.create=v=>new vo({checks:[],typeName:ft.ZodNumber,coerce:(v==null?void 0:v.coerce)||!1,...Mt(v)});class zl extends Bt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(g){if(this._def.coerce)try{g.data=BigInt(g.data)}catch{return this._getInvalidInput(g)}if(this._getType(g)!==Qe.bigint)return this._getInvalidInput(g);let z;const D=new Jr;for(const F of this._def.checks)F.kind==="min"?(F.inclusive?g.data<F.value:g.data<=F.value)&&(z=this._getOrReturnCtx(g,z),Ye(z,{code:Ze.too_small,type:"bigint",minimum:F.value,inclusive:F.inclusive,message:F.message}),D.dirty()):F.kind==="max"?(F.inclusive?g.data>F.value:g.data>=F.value)&&(z=this._getOrReturnCtx(g,z),Ye(z,{code:Ze.too_big,type:"bigint",maximum:F.value,inclusive:F.inclusive,message:F.message}),D.dirty()):F.kind==="multipleOf"?g.data%F.value!==BigInt(0)&&(z=this._getOrReturnCtx(g,z),Ye(z,{code:Ze.not_multiple_of,multipleOf:F.value,message:F.message}),D.dirty()):Nt.assertNever(F);return{status:D.value,value:g.data}}_getInvalidInput(g){const w=this._getOrReturnCtx(g);return Ye(w,{code:Ze.invalid_type,expected:Qe.bigint,received:w.parsedType}),pt}gte(g,w){return this.setLimit("min",g,!0,rt.toString(w))}gt(g,w){return this.setLimit("min",g,!1,rt.toString(w))}lte(g,w){return this.setLimit("max",g,!0,rt.toString(w))}lt(g,w){return this.setLimit("max",g,!1,rt.toString(w))}setLimit(g,w,z,D){return new zl({...this._def,checks:[...this._def.checks,{kind:g,value:w,inclusive:z,message:rt.toString(D)}]})}_addCheck(g){return new zl({...this._def,checks:[...this._def.checks,g]})}positive(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:rt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:rt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:rt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:rt.toString(g)})}multipleOf(g,w){return this._addCheck({kind:"multipleOf",value:g,message:rt.toString(w)})}get minValue(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g}get maxValue(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g}}zl.create=v=>new zl({checks:[],typeName:ft.ZodBigInt,coerce:(v==null?void 0:v.coerce)??!1,...Mt(v)});class dd extends Bt{_parse(g){if(this._def.coerce&&(g.data=!!g.data),this._getType(g)!==Qe.boolean){const z=this._getOrReturnCtx(g);return Ye(z,{code:Ze.invalid_type,expected:Qe.boolean,received:z.parsedType}),pt}return jr(g.data)}}dd.create=v=>new dd({typeName:ft.ZodBoolean,coerce:(v==null?void 0:v.coerce)||!1,...Mt(v)});class vu extends Bt{_parse(g){if(this._def.coerce&&(g.data=new Date(g.data)),this._getType(g)!==Qe.date){const F=this._getOrReturnCtx(g);return Ye(F,{code:Ze.invalid_type,expected:Qe.date,received:F.parsedType}),pt}if(Number.isNaN(g.data.getTime())){const F=this._getOrReturnCtx(g);return Ye(F,{code:Ze.invalid_date}),pt}const z=new Jr;let D;for(const F of this._def.checks)F.kind==="min"?g.data.getTime()<F.value&&(D=this._getOrReturnCtx(g,D),Ye(D,{code:Ze.too_small,message:F.message,inclusive:!0,exact:!1,minimum:F.value,type:"date"}),z.dirty()):F.kind==="max"?g.data.getTime()>F.value&&(D=this._getOrReturnCtx(g,D),Ye(D,{code:Ze.too_big,message:F.message,inclusive:!0,exact:!1,maximum:F.value,type:"date"}),z.dirty()):Nt.assertNever(F);return{status:z.value,value:new Date(g.data.getTime())}}_addCheck(g){return new vu({...this._def,checks:[...this._def.checks,g]})}min(g,w){return this._addCheck({kind:"min",value:g.getTime(),message:rt.toString(w)})}max(g,w){return this._addCheck({kind:"max",value:g.getTime(),message:rt.toString(w)})}get minDate(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g!=null?new Date(g):null}get maxDate(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g!=null?new Date(g):null}}vu.create=v=>new vu({checks:[],coerce:(v==null?void 0:v.coerce)||!1,typeName:ft.ZodDate,...Mt(v)});class Vf extends Bt{_parse(g){if(this._getType(g)!==Qe.symbol){const z=this._getOrReturnCtx(g);return Ye(z,{code:Ze.invalid_type,expected:Qe.symbol,received:z.parsedType}),pt}return jr(g.data)}}Vf.create=v=>new Vf({typeName:ft.ZodSymbol,...Mt(v)});class Zf extends Bt{_parse(g){if(this._getType(g)!==Qe.undefined){const z=this._getOrReturnCtx(g);return Ye(z,{code:Ze.invalid_type,expected:Qe.undefined,received:z.parsedType}),pt}return jr(g.data)}}Zf.create=v=>new Zf({typeName:ft.ZodUndefined,...Mt(v)});class Uf extends Bt{_parse(g){if(this._getType(g)!==Qe.null){const z=this._getOrReturnCtx(g);return Ye(z,{code:Ze.invalid_type,expected:Qe.null,received:z.parsedType}),pt}return jr(g.data)}}Uf.create=v=>new Uf({typeName:ft.ZodNull,...Mt(v)});class pd extends Bt{constructor(){super(...arguments),this._any=!0}_parse(g){return jr(g.data)}}pd.create=v=>new pd({typeName:ft.ZodAny,...Mt(v)});class bo extends Bt{constructor(){super(...arguments),this._unknown=!0}_parse(g){return jr(g.data)}}bo.create=v=>new bo({typeName:ft.ZodUnknown,...Mt(v)});class Ba extends Bt{_parse(g){const w=this._getOrReturnCtx(g);return Ye(w,{code:Ze.invalid_type,expected:Qe.never,received:w.parsedType}),pt}}Ba.create=v=>new Ba({typeName:ft.ZodNever,...Mt(v)});class fd extends Bt{_parse(g){if(this._getType(g)!==Qe.undefined){const z=this._getOrReturnCtx(g);return Ye(z,{code:Ze.invalid_type,expected:Qe.void,received:z.parsedType}),pt}return jr(g.data)}}fd.create=v=>new fd({typeName:ft.ZodVoid,...Mt(v)});class $n extends Bt{_parse(g){const{ctx:w,status:z}=this._processInputParams(g),D=this._def;if(w.parsedType!==Qe.array)return Ye(w,{code:Ze.invalid_type,expected:Qe.array,received:w.parsedType}),pt;if(D.exactLength!==null){const P=w.data.length>D.exactLength.value,o=w.data.length<D.exactLength.value;(P||o)&&(Ye(w,{code:P?Ze.too_big:Ze.too_small,minimum:o?D.exactLength.value:void 0,maximum:P?D.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:D.exactLength.message}),z.dirty())}if(D.minLength!==null&&w.data.length<D.minLength.value&&(Ye(w,{code:Ze.too_small,minimum:D.minLength.value,type:"array",inclusive:!0,exact:!1,message:D.minLength.message}),z.dirty()),D.maxLength!==null&&w.data.length>D.maxLength.value&&(Ye(w,{code:Ze.too_big,maximum:D.maxLength.value,type:"array",inclusive:!0,exact:!1,message:D.maxLength.message}),z.dirty()),w.common.async)return Promise.all([...w.data].map((P,o)=>D.type._parseAsync(new Da(w,P,w.path,o)))).then(P=>Jr.mergeArray(z,P));const F=[...w.data].map((P,o)=>D.type._parseSync(new Da(w,P,w.path,o)));return Jr.mergeArray(z,F)}get element(){return this._def.type}min(g,w){return new $n({...this._def,minLength:{value:g,message:rt.toString(w)}})}max(g,w){return new $n({...this._def,maxLength:{value:g,message:rt.toString(w)}})}length(g,w){return new $n({...this._def,exactLength:{value:g,message:rt.toString(w)}})}nonempty(g){return this.min(1,g)}}$n.create=(v,g)=>new $n({type:v,minLength:null,maxLength:null,exactLength:null,typeName:ft.ZodArray,...Mt(g)});function wo(v){if(v instanceof zi){const g={};for(const w in v.shape){const z=v.shape[w];g[w]=Fa.create(wo(z))}return new zi({...v._def,shape:()=>g})}else return v instanceof $n?new $n({...v._def,type:wo(v.element)}):v instanceof Fa?Fa.create(wo(v.unwrap())):v instanceof Po?Po.create(wo(v.unwrap())):v instanceof la?la.create(v.items.map(g=>wo(g))):v}class zi extends Bt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const g=this._def.shape(),w=Nt.objectKeys(g);return this._cached={shape:g,keys:w},this._cached}_parse(g){if(this._getType(g)!==Qe.object){const xe=this._getOrReturnCtx(g);return Ye(xe,{code:Ze.invalid_type,expected:Qe.object,received:xe.parsedType}),pt}const{status:z,ctx:D}=this._processInputParams(g),{shape:F,keys:P}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ba&&this._def.unknownKeys==="strip"))for(const xe in D.data)P.includes(xe)||o.push(xe);const fe=[];for(const xe of P){const ke=F[xe],Ve=D.data[xe];fe.push({key:{status:"valid",value:xe},value:ke._parse(new Da(D,Ve,D.path,xe)),alwaysSet:xe in D.data})}if(this._def.catchall instanceof Ba){const xe=this._def.unknownKeys;if(xe==="passthrough")for(const ke of o)fe.push({key:{status:"valid",value:ke},value:{status:"valid",value:D.data[ke]}});else if(xe==="strict")o.length>0&&(Ye(D,{code:Ze.unrecognized_keys,keys:o}),z.dirty());else if(xe!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const xe=this._def.catchall;for(const ke of o){const Ve=D.data[ke];fe.push({key:{status:"valid",value:ke},value:xe._parse(new Da(D,Ve,D.path,ke)),alwaysSet:ke in D.data})}}return D.common.async?Promise.resolve().then(async()=>{const xe=[];for(const ke of fe){const Ve=await ke.key,Ce=await ke.value;xe.push({key:Ve,value:Ce,alwaysSet:ke.alwaysSet})}return xe}).then(xe=>Jr.mergeObjectSync(z,xe)):Jr.mergeObjectSync(z,fe)}get shape(){return this._def.shape()}strict(g){return rt.errToObj,new zi({...this._def,unknownKeys:"strict",...g!==void 0?{errorMap:(w,z)=>{var F,P;const D=((P=(F=this._def).errorMap)==null?void 0:P.call(F,w,z).message)??z.defaultError;return w.code==="unrecognized_keys"?{message:rt.errToObj(g).message??D}:{message:D}}}:{}})}strip(){return new zi({...this._def,unknownKeys:"strip"})}passthrough(){return new zi({...this._def,unknownKeys:"passthrough"})}extend(g){return new zi({...this._def,shape:()=>({...this._def.shape(),...g})})}merge(g){return new zi({unknownKeys:g._def.unknownKeys,catchall:g._def.catchall,shape:()=>({...this._def.shape(),...g._def.shape()}),typeName:ft.ZodObject})}setKey(g,w){return this.augment({[g]:w})}catchall(g){return new zi({...this._def,catchall:g})}pick(g){const w={};for(const z of Nt.objectKeys(g))g[z]&&this.shape[z]&&(w[z]=this.shape[z]);return new zi({...this._def,shape:()=>w})}omit(g){const w={};for(const z of Nt.objectKeys(this.shape))g[z]||(w[z]=this.shape[z]);return new zi({...this._def,shape:()=>w})}deepPartial(){return wo(this)}partial(g){const w={};for(const z of Nt.objectKeys(this.shape)){const D=this.shape[z];g&&!g[z]?w[z]=D:w[z]=D.optional()}return new zi({...this._def,shape:()=>w})}required(g){const w={};for(const z of Nt.objectKeys(this.shape))if(g&&!g[z])w[z]=this.shape[z];else{let F=this.shape[z];for(;F instanceof Fa;)F=F._def.innerType;w[z]=F}return new zi({...this._def,shape:()=>w})}keyof(){return qf(Nt.objectKeys(this.shape))}}zi.create=(v,g)=>new zi({shape:()=>v,unknownKeys:"strip",catchall:Ba.create(),typeName:ft.ZodObject,...Mt(g)}),zi.strictCreate=(v,g)=>new zi({shape:()=>v,unknownKeys:"strict",catchall:Ba.create(),typeName:ft.ZodObject,...Mt(g)}),zi.lazycreate=(v,g)=>new zi({shape:v,unknownKeys:"strip",catchall:Ba.create(),typeName:ft.ZodObject,...Mt(g)});class bu extends Bt{_parse(g){const{ctx:w}=this._processInputParams(g),z=this._def.options;function D(F){for(const o of F)if(o.result.status==="valid")return o.result;for(const o of F)if(o.result.status==="dirty")return w.common.issues.push(...o.ctx.common.issues),o.result;const P=F.map(o=>new mn(o.ctx.common.issues));return Ye(w,{code:Ze.invalid_union,unionErrors:P}),pt}if(w.common.async)return Promise.all(z.map(async F=>{const P={...w,common:{...w.common,issues:[]},parent:null};return{result:await F._parseAsync({data:w.data,path:w.path,parent:P}),ctx:P}})).then(D);{let F;const P=[];for(const fe of z){const xe={...w,common:{...w.common,issues:[]},parent:null},ke=fe._parseSync({data:w.data,path:w.path,parent:xe});if(ke.status==="valid")return ke;ke.status==="dirty"&&!F&&(F={result:ke,ctx:xe}),xe.common.issues.length&&P.push(xe.common.issues)}if(F)return w.common.issues.push(...F.ctx.common.issues),F.result;const o=P.map(fe=>new mn(fe));return Ye(w,{code:Ze.invalid_union,unionErrors:o}),pt}}get options(){return this._def.options}}bu.create=(v,g)=>new bu({options:v,typeName:ft.ZodUnion,...Mt(g)});function md(v,g){const w=Ra(v),z=Ra(g);if(v===g)return{valid:!0,data:v};if(w===Qe.object&&z===Qe.object){const D=Nt.objectKeys(g),F=Nt.objectKeys(v).filter(o=>D.indexOf(o)!==-1),P={...v,...g};for(const o of F){const fe=md(v[o],g[o]);if(!fe.valid)return{valid:!1};P[o]=fe.data}return{valid:!0,data:P}}else if(w===Qe.array&&z===Qe.array){if(v.length!==g.length)return{valid:!1};const D=[];for(let F=0;F<v.length;F++){const P=v[F],o=g[F],fe=md(P,o);if(!fe.valid)return{valid:!1};D.push(fe.data)}return{valid:!0,data:D}}else return w===Qe.date&&z===Qe.date&&+v==+g?{valid:!0,data:v}:{valid:!1}}class wu extends Bt{_parse(g){const{status:w,ctx:z}=this._processInputParams(g),D=(F,P)=>{if(Bf(F)||Bf(P))return pt;const o=md(F.value,P.value);return o.valid?((Ff(F)||Ff(P))&&w.dirty(),{status:w.value,value:o.data}):(Ye(z,{code:Ze.invalid_intersection_types}),pt)};return z.common.async?Promise.all([this._def.left._parseAsync({data:z.data,path:z.path,parent:z}),this._def.right._parseAsync({data:z.data,path:z.path,parent:z})]).then(([F,P])=>D(F,P)):D(this._def.left._parseSync({data:z.data,path:z.path,parent:z}),this._def.right._parseSync({data:z.data,path:z.path,parent:z}))}}wu.create=(v,g,w)=>new wu({left:v,right:g,typeName:ft.ZodIntersection,...Mt(w)});class la extends Bt{_parse(g){const{status:w,ctx:z}=this._processInputParams(g);if(z.parsedType!==Qe.array)return Ye(z,{code:Ze.invalid_type,expected:Qe.array,received:z.parsedType}),pt;if(z.data.length<this._def.items.length)return Ye(z,{code:Ze.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pt;!this._def.rest&&z.data.length>this._def.items.length&&(Ye(z,{code:Ze.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w.dirty());const F=[...z.data].map((P,o)=>{const fe=this._def.items[o]||this._def.rest;return fe?fe._parse(new Da(z,P,z.path,o)):null}).filter(P=>!!P);return z.common.async?Promise.all(F).then(P=>Jr.mergeArray(w,P)):Jr.mergeArray(w,F)}get items(){return this._def.items}rest(g){return new la({...this._def,rest:g})}}la.create=(v,g)=>{if(!Array.isArray(v))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new la({items:v,typeName:ft.ZodTuple,rest:null,...Mt(g)})};class $f extends Bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:w,ctx:z}=this._processInputParams(g);if(z.parsedType!==Qe.map)return Ye(z,{code:Ze.invalid_type,expected:Qe.map,received:z.parsedType}),pt;const D=this._def.keyType,F=this._def.valueType,P=[...z.data.entries()].map(([o,fe],xe)=>({key:D._parse(new Da(z,o,z.path,[xe,"key"])),value:F._parse(new Da(z,fe,z.path,[xe,"value"]))}));if(z.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const fe of P){const xe=await fe.key,ke=await fe.value;if(xe.status==="aborted"||ke.status==="aborted")return pt;(xe.status==="dirty"||ke.status==="dirty")&&w.dirty(),o.set(xe.value,ke.value)}return{status:w.value,value:o}})}else{const o=new Map;for(const fe of P){const xe=fe.key,ke=fe.value;if(xe.status==="aborted"||ke.status==="aborted")return pt;(xe.status==="dirty"||ke.status==="dirty")&&w.dirty(),o.set(xe.value,ke.value)}return{status:w.value,value:o}}}}$f.create=(v,g,w)=>new $f({valueType:g,keyType:v,typeName:ft.ZodMap,...Mt(w)});class Al extends Bt{_parse(g){const{status:w,ctx:z}=this._processInputParams(g);if(z.parsedType!==Qe.set)return Ye(z,{code:Ze.invalid_type,expected:Qe.set,received:z.parsedType}),pt;const D=this._def;D.minSize!==null&&z.data.size<D.minSize.value&&(Ye(z,{code:Ze.too_small,minimum:D.minSize.value,type:"set",inclusive:!0,exact:!1,message:D.minSize.message}),w.dirty()),D.maxSize!==null&&z.data.size>D.maxSize.value&&(Ye(z,{code:Ze.too_big,maximum:D.maxSize.value,type:"set",inclusive:!0,exact:!1,message:D.maxSize.message}),w.dirty());const F=this._def.valueType;function P(fe){const xe=new Set;for(const ke of fe){if(ke.status==="aborted")return pt;ke.status==="dirty"&&w.dirty(),xe.add(ke.value)}return{status:w.value,value:xe}}const o=[...z.data.values()].map((fe,xe)=>F._parse(new Da(z,fe,z.path,xe)));return z.common.async?Promise.all(o).then(fe=>P(fe)):P(o)}min(g,w){return new Al({...this._def,minSize:{value:g,message:rt.toString(w)}})}max(g,w){return new Al({...this._def,maxSize:{value:g,message:rt.toString(w)}})}size(g,w){return this.min(g,w).max(g,w)}nonempty(g){return this.min(1,g)}}Al.create=(v,g)=>new Al({valueType:v,minSize:null,maxSize:null,typeName:ft.ZodSet,...Mt(g)});class kl extends Bt{constructor(){super(...arguments),this.validate=this.implement}_parse(g){const{ctx:w}=this._processInputParams(g);if(w.parsedType!==Qe.function)return Ye(w,{code:Ze.invalid_type,expected:Qe.function,received:w.parsedType}),pt;function z(o,fe){return ud({data:o,path:w.path,errorMaps:[w.common.contextualErrorMap,w.schemaErrorMap,cd(),Il].filter(xe=>!!xe),issueData:{code:Ze.invalid_arguments,argumentsError:fe}})}function D(o,fe){return ud({data:o,path:w.path,errorMaps:[w.common.contextualErrorMap,w.schemaErrorMap,cd(),Il].filter(xe=>!!xe),issueData:{code:Ze.invalid_return_type,returnTypeError:fe}})}const F={errorMap:w.common.contextualErrorMap},P=w.data;if(this._def.returns instanceof Rl){const o=this;return jr(async function(...fe){const xe=new mn([]),ke=await o._def.args.parseAsync(fe,F).catch(ue=>{throw xe.addIssue(z(fe,ue)),xe}),Ve=await Reflect.apply(P,this,ke);return await o._def.returns._def.type.parseAsync(Ve,F).catch(ue=>{throw xe.addIssue(D(Ve,ue)),xe})})}else{const o=this;return jr(function(...fe){const xe=o._def.args.safeParse(fe,F);if(!xe.success)throw new mn([z(fe,xe.error)]);const ke=Reflect.apply(P,this,xe.data),Ve=o._def.returns.safeParse(ke,F);if(!Ve.success)throw new mn([D(ke,Ve.error)]);return Ve.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...g){return new kl({...this._def,args:la.create(g).rest(bo.create())})}returns(g){return new kl({...this._def,returns:g})}implement(g){return this.parse(g)}strictImplement(g){return this.parse(g)}static create(g,w,z){return new kl({args:g||la.create([]).rest(bo.create()),returns:w||bo.create(),typeName:ft.ZodFunction,...Mt(z)})}}class Gf extends Bt{get schema(){return this._def.getter()}_parse(g){const{ctx:w}=this._processInputParams(g);return this._def.getter()._parse({data:w.data,path:w.path,parent:w})}}Gf.create=(v,g)=>new Gf({getter:v,typeName:ft.ZodLazy,...Mt(g)});class gd extends Bt{_parse(g){if(g.data!==this._def.value){const w=this._getOrReturnCtx(g);return Ye(w,{received:w.data,code:Ze.invalid_literal,expected:this._def.value}),pt}return{status:"valid",value:g.data}}get value(){return this._def.value}}gd.create=(v,g)=>new gd({value:v,typeName:ft.ZodLiteral,...Mt(g)});function qf(v,g){return new To({values:v,typeName:ft.ZodEnum,...Mt(g)})}class To extends Bt{_parse(g){if(typeof g.data!="string"){const w=this._getOrReturnCtx(g),z=this._def.values;return Ye(w,{expected:Nt.joinValues(z),received:w.parsedType,code:Ze.invalid_type}),pt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(g.data)){const w=this._getOrReturnCtx(g),z=this._def.values;return Ye(w,{received:w.data,code:Ze.invalid_enum_value,options:z}),pt}return jr(g.data)}get options(){return this._def.values}get enum(){const g={};for(const w of this._def.values)g[w]=w;return g}get Values(){const g={};for(const w of this._def.values)g[w]=w;return g}get Enum(){const g={};for(const w of this._def.values)g[w]=w;return g}extract(g,w=this._def){return To.create(g,{...this._def,...w})}exclude(g,w=this._def){return To.create(this.options.filter(z=>!g.includes(z)),{...this._def,...w})}}To.create=qf;class Wf extends Bt{_parse(g){const w=Nt.getValidEnumValues(this._def.values),z=this._getOrReturnCtx(g);if(z.parsedType!==Qe.string&&z.parsedType!==Qe.number){const D=Nt.objectValues(w);return Ye(z,{expected:Nt.joinValues(D),received:z.parsedType,code:Ze.invalid_type}),pt}if(this._cache||(this._cache=new Set(Nt.getValidEnumValues(this._def.values))),!this._cache.has(g.data)){const D=Nt.objectValues(w);return Ye(z,{received:z.data,code:Ze.invalid_enum_value,options:D}),pt}return jr(g.data)}get enum(){return this._def.values}}Wf.create=(v,g)=>new Wf({values:v,typeName:ft.ZodNativeEnum,...Mt(g)});class Rl extends Bt{unwrap(){return this._def.type}_parse(g){const{ctx:w}=this._processInputParams(g);if(w.parsedType!==Qe.promise&&w.common.async===!1)return Ye(w,{code:Ze.invalid_type,expected:Qe.promise,received:w.parsedType}),pt;const z=w.parsedType===Qe.promise?w.data:Promise.resolve(w.data);return jr(z.then(D=>this._def.type.parseAsync(D,{path:w.path,errorMap:w.common.contextualErrorMap})))}}Rl.create=(v,g)=>new Rl({type:v,typeName:ft.ZodPromise,...Mt(g)});class So extends Bt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ft.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(g){const{status:w,ctx:z}=this._processInputParams(g),D=this._def.effect||null,F={addIssue:P=>{Ye(z,P),P.fatal?w.abort():w.dirty()},get path(){return z.path}};if(F.addIssue=F.addIssue.bind(F),D.type==="preprocess"){const P=D.transform(z.data,F);if(z.common.async)return Promise.resolve(P).then(async o=>{if(w.value==="aborted")return pt;const fe=await this._def.schema._parseAsync({data:o,path:z.path,parent:z});return fe.status==="aborted"?pt:fe.status==="dirty"||w.value==="dirty"?El(fe.value):fe});{if(w.value==="aborted")return pt;const o=this._def.schema._parseSync({data:P,path:z.path,parent:z});return o.status==="aborted"?pt:o.status==="dirty"||w.value==="dirty"?El(o.value):o}}if(D.type==="refinement"){const P=o=>{const fe=D.refinement(o,F);if(z.common.async)return Promise.resolve(fe);if(fe instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(z.common.async===!1){const o=this._def.schema._parseSync({data:z.data,path:z.path,parent:z});return o.status==="aborted"?pt:(o.status==="dirty"&&w.dirty(),P(o.value),{status:w.value,value:o.value})}else return this._def.schema._parseAsync({data:z.data,path:z.path,parent:z}).then(o=>o.status==="aborted"?pt:(o.status==="dirty"&&w.dirty(),P(o.value).then(()=>({status:w.value,value:o.value}))))}if(D.type==="transform")if(z.common.async===!1){const P=this._def.schema._parseSync({data:z.data,path:z.path,parent:z});if(!xo(P))return pt;const o=D.transform(P.value,F);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:w.value,value:o}}else return this._def.schema._parseAsync({data:z.data,path:z.path,parent:z}).then(P=>xo(P)?Promise.resolve(D.transform(P.value,F)).then(o=>({status:w.value,value:o})):pt);Nt.assertNever(D)}}So.create=(v,g,w)=>new So({schema:v,typeName:ft.ZodEffects,effect:g,...Mt(w)}),So.createWithPreprocess=(v,g,w)=>new So({schema:g,effect:{type:"preprocess",transform:v},typeName:ft.ZodEffects,...Mt(w)});class Fa extends Bt{_parse(g){return this._getType(g)===Qe.undefined?jr(void 0):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Fa.create=(v,g)=>new Fa({innerType:v,typeName:ft.ZodOptional,...Mt(g)});class Po extends Bt{_parse(g){return this._getType(g)===Qe.null?jr(null):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Po.create=(v,g)=>new Po({innerType:v,typeName:ft.ZodNullable,...Mt(g)});class _d extends Bt{_parse(g){const{ctx:w}=this._processInputParams(g);let z=w.data;return w.parsedType===Qe.undefined&&(z=this._def.defaultValue()),this._def.innerType._parse({data:z,path:w.path,parent:w})}removeDefault(){return this._def.innerType}}_d.create=(v,g)=>new _d({innerType:v,typeName:ft.ZodDefault,defaultValue:typeof g.default=="function"?g.default:()=>g.default,...Mt(g)});class yd extends Bt{_parse(g){const{ctx:w}=this._processInputParams(g),z={...w,common:{...w.common,issues:[]}},D=this._def.innerType._parse({data:z.data,path:z.path,parent:{...z}});return xu(D)?D.then(F=>({status:"valid",value:F.status==="valid"?F.value:this._def.catchValue({get error(){return new mn(z.common.issues)},input:z.data})})):{status:"valid",value:D.status==="valid"?D.value:this._def.catchValue({get error(){return new mn(z.common.issues)},input:z.data})}}removeCatch(){return this._def.innerType}}yd.create=(v,g)=>new yd({innerType:v,typeName:ft.ZodCatch,catchValue:typeof g.catch=="function"?g.catch:()=>g.catch,...Mt(g)});class Hf extends Bt{_parse(g){if(this._getType(g)!==Qe.nan){const z=this._getOrReturnCtx(g);return Ye(z,{code:Ze.invalid_type,expected:Qe.nan,received:z.parsedType}),pt}return{status:"valid",value:g.data}}}Hf.create=v=>new Hf({typeName:ft.ZodNaN,...Mt(v)});class Fy extends Bt{_parse(g){const{ctx:w}=this._processInputParams(g),z=w.data;return this._def.type._parse({data:z,path:w.path,parent:w})}unwrap(){return this._def.type}}class xd extends Bt{_parse(g){const{status:w,ctx:z}=this._processInputParams(g);if(z.common.async)return(async()=>{const F=await this._def.in._parseAsync({data:z.data,path:z.path,parent:z});return F.status==="aborted"?pt:F.status==="dirty"?(w.dirty(),El(F.value)):this._def.out._parseAsync({data:F.value,path:z.path,parent:z})})();{const D=this._def.in._parseSync({data:z.data,path:z.path,parent:z});return D.status==="aborted"?pt:D.status==="dirty"?(w.dirty(),{status:"dirty",value:D.value}):this._def.out._parseSync({data:D.value,path:z.path,parent:z})}}static create(g,w){return new xd({in:g,out:w,typeName:ft.ZodPipeline})}}class vd extends Bt{_parse(g){const w=this._def.innerType._parse(g),z=D=>(xo(D)&&(D.value=Object.freeze(D.value)),D);return xu(w)?w.then(D=>z(D)):z(w)}unwrap(){return this._def.innerType}}vd.create=(v,g)=>new vd({innerType:v,typeName:ft.ZodReadonly,...Mt(g)});var ft;(function(v){v.ZodString="ZodString",v.ZodNumber="ZodNumber",v.ZodNaN="ZodNaN",v.ZodBigInt="ZodBigInt",v.ZodBoolean="ZodBoolean",v.ZodDate="ZodDate",v.ZodSymbol="ZodSymbol",v.ZodUndefined="ZodUndefined",v.ZodNull="ZodNull",v.ZodAny="ZodAny",v.ZodUnknown="ZodUnknown",v.ZodNever="ZodNever",v.ZodVoid="ZodVoid",v.ZodArray="ZodArray",v.ZodObject="ZodObject",v.ZodUnion="ZodUnion",v.ZodDiscriminatedUnion="ZodDiscriminatedUnion",v.ZodIntersection="ZodIntersection",v.ZodTuple="ZodTuple",v.ZodRecord="ZodRecord",v.ZodMap="ZodMap",v.ZodSet="ZodSet",v.ZodFunction="ZodFunction",v.ZodLazy="ZodLazy",v.ZodLiteral="ZodLiteral",v.ZodEnum="ZodEnum",v.ZodEffects="ZodEffects",v.ZodNativeEnum="ZodNativeEnum",v.ZodOptional="ZodOptional",v.ZodNullable="ZodNullable",v.ZodDefault="ZodDefault",v.ZodCatch="ZodCatch",v.ZodPromise="ZodPromise",v.ZodBranded="ZodBranded",v.ZodPipeline="ZodPipeline",v.ZodReadonly="ZodReadonly"})(ft||(ft={}));const Oa=La.create,Ni=vo.create,Oy=dd.create,jy=pd.create;bo.create,Ba.create;const Tu=fd.create,bd=$n.create,er=zi.create;bu.create,wu.create;const Xf=la.create,Dl=kl.create,wd=gd.create,Ny=To.create,Vy=Rl.create;Fa.create,Po.create;const Su=er({lat:Ni(),lng:Ni()}),Zy=er({center:Su,zoom:Ni()}),Uy=er({sw:Su,ne:Su}),Yf=er({primary:Oa().max(64),background:Oa().max(64),text:Oa().max(64)}),$y=er({name:wd("dark").or(wd("light")),colors:Yf}),Gy=er({name:wd("custom"),url:Oa().max(256),colors:Yf}),qy=$y.or(Gy),Wy=er({pin:er({fade:Oy().optional(),maxCount:Ni().optional(),maxZoom:Ni().optional()}).optional(),animation:er({queue:er({limit:Ni().optional()}).optional()}).optional()}),Hy=er({container:Oa(),position:er({center:er({lat:Ni(),lng:Ni()}),zoom:Ni()}),style:qy,restriction:er({minZoom:Ni().min(sd).max(Cl).optional(),maxZoom:Ni().min(sd).max(Cl).optional(),maxBounds:Uy.optional()}).optional(),configuration:Wy.optional()});Ny(["idle","move","click","popup_click"]);const Xy=Dl().returns(Tu()),Yy=Dl().returns(Tu()),Ky=Dl().args(Zy).returns(Tu()),Jy=Dl().args(Su).returns(Tu()),Qy={load:Xy,idle:Yy,move:Ky,click:Jy},Kf=er({id:Oa().min(1),rank:Ni(),lat:Ni().min(-90).max(90),lng:Ni().min(-180).max(180),width:Ni().min(56),height:Ni().min(56)}),ex=Xf([Ni(),bd(Xf([Ni(),Ni()]))]),Jf=Dl().args(Oa()).returns(Vy(jy())),tx=er({data:Kf,state:ex,callbacks:er({body:Jf,pin:Jf.optional()})}),ix=bd(tx);er({key:Oa(),data:bd(Kf)});var rx=Hh('<div class="container svelte-1xg3z1s"><div class="map svelte-1xg3z1s"></div> <div class="logo svelte-1xg3z1s"><a href="https://arenarium.dev" target="_blank" class="svelte-1xg3z1s"><span class="text">@arenarium/maps</span></a></div></div>');function Qf(v,g){ru(g,!0);let w,z,D,F,P,o=Qi(0),fe=Qi(0),xe=Qi(!1),ke=Qi(void 0);Ef(()=>{Hy.parse(g.options),Ve(),ue()});function Ve(){var Ae,Oe,Le;D=((Ae=g.options.restriction)==null?void 0:Ae.minZoom)??sd,F=((Oe=g.options.restriction)==null?void 0:Oe.maxZoom)??Cl,P=(Le=g.options.restriction)==null?void 0:Le.maxBounds,w=new ld.Map({style:cr(g.options.style),center:{lat:g.options.position.center.lat,lng:g.options.position.center.lng},zoom:g.options.position.zoom,minZoom:Ft(D),maxZoom:F,maxBounds:P?[P.sw.lng,P.sw.lat,P.ne.lng,P.ne.lat]:void 0,container:z,pitchWithRotate:!1,attributionControl:{compact:!1}})}const Ce=()=>w;function ue(){w.on("load",Ue),w.on("move",Vt),w.on("idle",wt),w.on("click",Pi),w.dragRotate.disable(),w.keyboard.disable(),w.touchZoomRotate.disableRotation(),w.touchPitch.disable()}function Ue(){mi(xe,!0),Et("load",null)}function Vt(){const Ae=w.getCenter(),Oe=w.getZoom();Et("move",{center:Ae,zoom:Oe});const Le=w.getBounds();mi(ke,{sw:{lat:Le.getSouthWest().lat,lng:Le.getSouthWest().lng},ne:{lat:Le.getNorthEast().lat,lng:Le.getNorthEast().lng}},!0)}function wt(){Et("idle",null);const Ae=w.getBounds();mi(ke,{sw:{lat:Ae.getSouthWest().lat,lng:Ae.getSouthWest().lng},ne:{lat:Ae.getNorthEast().lat,lng:Ae.getNorthEast().lng}},!0)}function Pi(Ae){Et("click",{lat:Ae.lngLat.lat,lng:Ae.lngLat.lng})}const pi=new Map;function Vi(Ae,Oe){var ei;const Le=Qy[Ae];if(!Le)throw new Error(`No schema defined for event ${Ae}`);if(!Le.safeParse(Oe).success)throw new Error(`Invalid handler for event ${Ae}`);pi.has(Ae)||pi.set(Ae,new Set),(ei=pi.get(Ae))==null||ei.add(Oe)}function li(Ae,Oe){const Le=pi.get(Ae);Le&&Le.delete(Oe)&&Le.size===0&&pi.delete(Ae)}function Et(Ae,Oe){const Le=pi.get(Ae);Le&&Le.size>0&&[...Le].forEach(Je=>{try{Je(Oe)}catch(ei){console.error(ei)}})}function Ft(Ae){const Oe=kf,Le=Math.ceil(Math.log2(dt(o)/Oe));return Math.max(Ae,Le)}function or(){const Ae=w.getCenter();return Ae?{lat:Ae.lat,lng:Ae.lng}:{lat:g.options.position.center.lat,lng:g.options.position.center.lng}}function Pn(){return w.getZoom()??g.options.position.zoom}function Qr(){if(!w)throw new Error("Map not loaded!");const Ae=w.getBounds();return{sw:{lat:Ae.getSouthWest().lat,lng:Ae.getSouthWest().lng},ne:{lat:Ae.getNorthEast().lat,lng:Ae.getNorthEast().lng}}}function Nr(Ae){if(!w)throw new Error("Map not loaded! Consider using the position option");w.setCenter(Ae)}function en(Ae){if(!w)throw new Error("Map not loaded! Consider using the position option");w.setZoom(Ae)}function yr(){if(!w)throw new Error("Map not loaded! Consider using the position option");w.zoomIn()}function Zi(){if(!w)throw new Error("Map not loaded! Consider using the position option.");w.zoomOut()}function Vr(Ae){if(!w)throw new Error("Map not loaded! Consider using the restriction option.");D=Ae,w.setMinZoom(Ft(Ae))}function lr(Ae){if(!w)throw new Error("Map not loaded! Consider using the restriction option.");F=Ae,w.setMaxZoom(Ae)}function It(Ae){if(!w)throw new Error("Map not loaded! Consider using the restriction option.");P=Ae,w.setMaxBounds([Ae.sw.lng,Ae.sw.lat,Ae.ne.lng,Ae.ne.lat])}let Jt=Qi(za(g.options.style));pn(()=>{dt(xe)&&w.setStyle(cr(dt(Jt)),{diff:!0})});function cr(Ae){if(Ae.name=="custom")return Ae.url;switch(Ae.name){case"light":return py;case"dark":return dy}}function tr(){return Wp(dt(Jt))}function Ir(Ae){try{w.setStyle(cr(dt(Jt)),{diff:!0}),mi(Jt,Ae,!0)}catch(Oe){throw console.error(Oe),yo("[Error] Failed to set style",Oe),Oe}}let gi=Qi(za(g.options.configuration));pn(()=>{var Ae,Oe,Le;(Le=(Oe=(Ae=dt(gi))==null?void 0:Ae.animation)==null?void 0:Oe.queue)!=null&&Le.limit?oa.setLimit(dt(gi).animation.queue.limit):oa.setLimit(8*navigator.hardwareConcurrency)});function Rt(){return Wp(dt(gi))}function ur(Ae){mi(gi,Ae,!0)}class Ui{constructor(Oe){kt(this,"id");kt(this,"lat");kt(this,"lng");kt(this,"zoom");kt(this,"element");kt(this,"component");kt(this,"libreMarker");this.id=Oe.data.id,this.lat=Oe.data.lat,this.lng=Oe.data.lng,this.zoom=Oe.state[0]}create(){this.createElement(),this.createLibreMarker(),this.updateZIndex()}createElement(){throw new Error("Create element not implemented")}createLibreMarker(){const Oe=this.element;if(!Oe)throw new Error("Failed to create libre marker");const Le=new ld.Marker({element:Oe});Le.setLngLat([this.lng,this.lat]),this.libreMarker=Le}update(Oe){this.zoom=Oe.state[0],this.updateZIndex()}updateZIndex(){throw new Error("Update z-index not implemented")}updateMap(Oe){const Le=this.libreMarker,Je=this.component;if(Le==null||Je==null)throw new Error("Failed to update popup map");Oe?Le._map!=Oe&&Le.addTo(Oe):Le._map!=null&&Le.remove()}isInBlock(Oe,Le){return this.zoom<=Oe&&Le.contains(this.lat,this.lng)}remove(){var Oe,Le;(Oe=this.libreMarker)==null||Oe.remove(),(Le=this.element)==null||Le.remove()}}class Zr extends Ui{constructor(Le){super(Le);kt(this,"pinLoading",!1);kt(this,"pinLoaded",!1);kt(this,"pinCallback");this.pinCallback=Le.callbacks.pin}createElement(){this.element=document.createElement("div"),this.element.classList.add("circle"),this.component=Yh(oy,{target:this.element,props:{id:this.id+"_circle",priority:this.zoom*gu}})}updateZIndex(){const Le=this.element;if(!Le)return;const Je=Math.round((Cl-this.zoom)*gu);Le.style.zIndex=Je.toString()}updateMap(Le){var Je;super.updateMap(Le),(Je=this.component)==null||Je.setDisplayed(Le!=null)}updateState(Le){const Je=this.component;if(!Je)throw new Error("Failed to update circle state");Je.setScale(this.getScale(Le))}updatePin(){var Je;if(this.pinCallback==null||this.pinLoaded||this.pinLoading)return;const Le=(Je=this.component)==null?void 0:Je.getBody();Le!=null&&(this.pinLoading=!0,this.pinCallback(this.id).then(ei=>{Le.appendChild(ei),this.pinLoaded=!0,this.pinLoading=!1}))}setExpanded(){if(this.component==null)throw new Error("Failed to set circle expanded");this.component.setScale(1)}setCollapsed(){if(this.component==null)throw new Error("Failed to set circle collapsed");this.component.setScale(0)}getScale(Le){return this.zoom<Le?1:Math.max(0,1-(this.zoom-Le)*.125)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isPinLoaded(){return this.pinCallback==null||this.pinLoaded}}class Er extends Ui{constructor(Le){super(Le);kt(this,"width");kt(this,"height");kt(this,"states");kt(this,"bodyLoading",!1);kt(this,"bodyLoaded",!1);kt(this,"bodyCallback");this.id=Le.data.id,this.width=Le.data.width,this.height=Le.data.height,this.states=Le.state[1].map(Je=>[Je[0],_u.DEGREES[Je[1]]]),this.bodyCallback=Le.callbacks.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("marker"),this.component=Yh(ay,{target:this.element,props:{id:this.id+"_marker",priority:this.zoom*gu,width:this.width,height:this.height}})}update(Le){super.update(Le),this.states=Le.state[1].map(Je=>[Je[0],_u.DEGREES[Je[1]]])}updateZIndex(){const Le=this.element;if(!Le)return;const Je=Math.round((Cl-this.zoom)*gu)+ey;Le.style.zIndex=Je.toString()}updateMap(Le){var Je;super.updateMap(Le),(Je=this.component)==null||Je.setDisplayed(Le!=null)}updateState(Le){const Je=this.component;if(!Je)throw new Error("Failed to update marker state");Je.setAngle(this.getAngle(Le))}updateBody(){var Je;if(this.bodyLoaded||this.bodyLoading)return;const Le=(Je=this.component)==null?void 0:Je.getBody();Le!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(ei=>{Le.appendChild(ei),this.bodyLoading=!1,this.bodyLoaded=!0}))}getAngle(Le){const Je=this.states.findLast(ei=>ei[0]<=Le);if(!Je)throw new Error("Angle not found");return Je[1]}setCollapsed(Le){if(this.component==null)throw new Error("Failed to set marker collapsed");this.component.setCollapsed(Le)}isExpanded(){return this.component?this.component.getExpanded():!1}isCollapsed(){return this.component?this.component.getCollapsed():!1}isBodyLoaded(){return this.bodyLoaded}}class xr{constructor(Oe){kt(this,"id");kt(this,"rank");kt(this,"lat");kt(this,"lng");kt(this,"zoom");kt(this,"supressed");kt(this,"circle");kt(this,"marker");this.id=Oe.data.id,this.rank=Oe.data.rank,this.lat=Oe.data.lat,this.lng=Oe.data.lng,this.zoom=Oe.state[0],this.supressed=!1,this.circle=new Zr(Oe),this.marker=new Er(Oe)}create(){this.circle.create(),this.marker.create()}update(Oe){this.circle.update(Oe),this.marker.update(Oe)}remove(){this.circle.remove(),this.marker.remove()}}let Mn,zt=new Array,$i=new Map,_i=!1,Gn=kf,Wt=Kp(()=>dt(ke)?new Df(w,-512,dt(fe)+Gn,dt(o)+Gn,-512):void 0),zr=Kp(()=>dt(ke)?new Df(w,0,dt(fe),dt(o),0):void 0);Ef(()=>{const Ae=()=>{try{vr(),Mn=window.setTimeout(Ae,25)}catch(Oe){console.error(Oe),yo("[Error] Failed to process popups",Oe)}};return Ae(),()=>clearInterval(Mn)});function vr(){var ei,rn,Ur,he,N,V;if(dt(xe)==!1||dt(zr)==null||dt(Wt)==null||zt.length==0||_i)return;const Ae=w.getZoom();if(!Ae)return;let Oe=0,Le=((rn=(ei=g.options.configuration)==null?void 0:ei.pin)==null?void 0:rn.maxCount)??Math.max(iy,8*navigator.hardwareConcurrency),Je=((he=(Ur=g.options.configuration)==null?void 0:Ur.pin)==null?void 0:he.maxZoom)??ty;for(const $ of zt){const J=$.supressed?-1:Ae,re=$.circle;dt(zr).contains(re.lat,re.lng)?J<=re.zoom&&re.zoom<=Ae+Je?(Oe<Le&&(((V=(N=dt(gi))==null?void 0:N.pin)==null?void 0:V.fade)==!0?re.updateState(Ae):re.setExpanded(),re.updateMap(w),re.isPinLoaded()==!1&&re.updatePin()),Oe++):(re.setCollapsed(),re.isCollapsed()&&re.updateMap(null)):re.updateMap(null);const oe=$.marker;dt(Wt).contains(oe.lat,oe.lng)?oe.zoom<=J?(oe.updateState(Ae),oe.setCollapsed(!1),oe.updateMap(w),oe.isExpanded()&&oe.isBodyLoaded()==!1&&oe.updateBody()):(oe.setCollapsed(!0),oe.isCollapsed()&&oe.updateMap(null)):oe.updateMap(null)}}async function qn(Ae){try{_i=!0;const Oe=new Map(Ae.map(Je=>[Je.data.id,new xr(Je)])),Le=Array.from(zt);for(const Je of Le)Oe.has(Je.id)==!1&&(Je.remove(),$i.delete(Je.id),zt.splice(zt.indexOf(Je),1));for(const Je of Ae){const ei=$i.get(Je.data.id);if(ei)ei.update(Je);else{const rn=new xr(Je);rn.create(),$i.set(Je.data.id,rn),zt.push(rn)}}zt.sort((Je,ei)=>Je.zoom-ei.zoom)}catch(Oe){throw console.error(Oe),zt.length=0,$i.clear(),Oe}finally{_i=!1}}function Mi(){try{_i=!0,zt.forEach(Ae=>Ae.remove()),zt.length=0,$i.clear()}catch(Ae){throw console.error(Ae),zt.forEach(Oe=>Oe.remove()),zt.length=0,$i.clear(),Ae}finally{_i=!1}}function hr(Ae){Ae.forEach(Oe=>{const Le=$i.get(Oe.id);Le&&(Le.supressed=!Oe.toggled)})}async function ir(Ae){try{await ix.parseAsync(Ae),await qn(Ae)}catch(Oe){throw console.error(Oe),yo("[Error] Failed to update popups",Oe),Oe}}function Cn(){try{Mi()}catch(Ae){throw console.error(Ae),yo("[Error] Failed to remove popups",Ae),Ae}}function gn(Ae){try{const Oe=$i.get(Ae);if(Oe==null)return;w.flyTo({center:{lat:Oe.lat,lng:Oe.lng},zoom:Oe.zoom})}catch(Oe){throw console.error(Oe),yo("[Error] Failed to reveal popup",Oe),Oe}}function ua(Ae){try{hr(Ae)}catch(Oe){throw console.error(Oe),yo("[Error] Failed to toggle popups",Oe),Oe}}var tn=rx();B_("resize",Zh,()=>w.setMinZoom(Ft(D)));var Ar=au(tn);return bs(Ar,Ae=>z=Ae,()=>z),Uh(()=>ed(tn,`--map-style-primary: ${dt(Jt).colors.primary??""}; --map-style-background: ${dt(Jt).colors.background??""}; --map-style-text: ${dt(Jt).colors.text??""};`)),Cf(Ar,"clientWidth",Ae=>mi(o,Ae)),Cf(Ar,"clientHeight",Ae=>mi(fe,Ae)),Xh(v,tn),nu({maplibre:Ce,on:Vi,off:li,emit:Et,getCenter:or,getZoom:Pn,getBounds:Qr,setCenter:Nr,setZoom:en,zoomIn:yr,zoomOut:Zi,setMinZoom:Vr,setMaxZoom:lr,setMaxBounds:It,getStyle:tr,setStyle:Ir,getConfiguration:Rt,setConfiguration:ur,updatePopups:ir,removePopups:Cn,revealPopup:gn,togglePopups:ua})}function nx(v){const g=document.getElementById(v.container);if(!g)throw new Error(`Container not found: ${v.container}`);return Yh(Qf,{target:g,props:{options:v}})}function ax(v){N_(v)}jt.Map=Qf,jt.mountMap=nx,jt.unmountMap=ax,Object.defineProperty(jt,Symbol.toStringTag,{value:"Module"})});
1
+ (function(S,M){typeof exports=="object"&&typeof module<"u"?M(exports):typeof define=="function"&&define.amd?define(["exports"],M):(S=typeof globalThis<"u"?globalThis:S||self,M(S.arenarium={}))})(this,function(S){"use strict";var Di=Object.defineProperty;var Sn=S=>{throw TypeError(S)};var Zi=(S,M,C)=>M in S?Di(S,M,{enumerable:!0,configurable:!0,writable:!0,value:C}):S[M]=C;var v=(S,M,C)=>Zi(S,typeof M!="symbol"?M+"":M,C),Cn=(S,M,C)=>M.has(S)||Sn("Cannot "+C);var V=(S,M,C)=>(Cn(S,M,"read from private field"),C?C.call(S):M.get(S)),Ke=(S,M,C)=>M.has(S)?Sn("Cannot add the same private member more than once"):M instanceof WeakSet?M.add(S):M.set(S,C),sa=(S,M,C,$e)=>(Cn(S,M,"write to private field"),$e?$e.call(S,C):M.set(S,C),C);var yn,se,Ze,Ge,we;const M="5";typeof window<"u"&&((yn=window.__svelte??(window.__svelte={})).v??(yn.v=new Set)).add(M);const C=Symbol(),$e=!1;var la=Array.isArray,An=Array.prototype.indexOf,En=Array.from,Mn=Object.defineProperty,Ve=Object.getOwnPropertyDescriptor,Nn=Object.prototype,Tn=Array.prototype,Rn=Object.getPrototypeOf,ca=Object.isExtensible;function Pn(a){for(var e=0;e<a.length;e++)a[e]()}const J=2,ua=4,Qe=8,St=16,ce=32,ze=64,Ct=128,B=256,et=512,W=1024,ne=2048,ve=4096,tt=8192,At=16384,da=32768,Ln=65536,On=1<<19,pa=1<<20,Et=1<<21,at=Symbol("$state");function fa(a){return a===this.v}function jn(a){throw new Error("https://svelte.dev/e/effect_in_teardown")}function In(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Dn(a){throw new Error("https://svelte.dev/e/effect_orphan")}function Zn(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Fn(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function $n(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Vn(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let Mt=!1,Bn=!1;function Un(){Mt=!0}let D=null;function ma(a){D=a}function Nt(a,e=!1,t){var n=D={p:D,c:null,d:!1,e:null,m:!1,s:a,x:null,l:null};Mt&&!e&&(D.l={s:null,u:null,r1:[],r2:rt(!1)}),Qn(()=>{n.d=!0})}function Tt(a){const e=D;if(e!==null){a!==void 0&&(e.x=a);const o=e.e;if(o!==null){var t=T,n=N;e.e=null;try{for(var r=0;r<o.length;r++){var i=o[r];Ee(i.effect),ue(i.reaction),Lt(i.fn)}}finally{Ee(t),ue(n)}}D=e.p,e.m=!0}return a||{}}function nt(){return!Mt||D!==null&&D.l===null}function Se(a){if(typeof a!="object"||a===null||at in a)return a;const e=Rn(a);if(e!==Nn&&e!==Tn)return a;var t=new Map,n=la(a),r=Y(0),i=N,o=s=>{var l=N;ue(i);var c=s();return ue(l),c};return n&&t.set("length",Y(a.length)),new Proxy(a,{defineProperty(s,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&Fn();var d=t.get(l);return d===void 0?(d=o(()=>Y(c.value)),t.set(l,d)):I(d,o(()=>Se(c.value))),!0},deleteProperty(s,l){var c=t.get(l);if(c===void 0)l in s&&(t.set(l,o(()=>Y(C))),Rt(r));else{if(n&&typeof l=="string"){var d=t.get("length"),p=Number(l);Number.isInteger(p)&&p<d.v&&I(d,p)}I(c,C),Rt(r)}return!0},get(s,l,c){var x;if(l===at)return a;var d=t.get(l),p=l in s;if(d===void 0&&(!p||(x=Ve(s,l))!=null&&x.writable)&&(d=o(()=>Y(Se(p?s[l]:C))),t.set(l,d)),d!==void 0){var h=P(d);return h===C?void 0:h}return Reflect.get(s,l,c)},getOwnPropertyDescriptor(s,l){var c=Reflect.getOwnPropertyDescriptor(s,l);if(c&&"value"in c){var d=t.get(l);d&&(c.value=P(d))}else if(c===void 0){var p=t.get(l),h=p==null?void 0:p.v;if(p!==void 0&&h!==C)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(s,l){var h;if(l===at)return!0;var c=t.get(l),d=c!==void 0&&c.v!==C||Reflect.has(s,l);if(c!==void 0||T!==null&&(!d||(h=Ve(s,l))!=null&&h.writable)){c===void 0&&(c=o(()=>Y(d?Se(s[l]):C)),t.set(l,c));var p=P(c);if(p===C)return!1}return d},set(s,l,c,d){var L;var p=t.get(l),h=l in s;if(n&&l==="length")for(var x=c;x<p.v;x+=1){var A=t.get(x+"");A!==void 0?I(A,C):x in s&&(A=o(()=>Y(C)),t.set(x+"",A))}p===void 0?(!h||(L=Ve(s,l))!=null&&L.writable)&&(p=o(()=>Y(void 0)),I(p,o(()=>Se(c))),t.set(l,p)):(h=p.v!==C,I(p,o(()=>Se(c))));var j=Reflect.getOwnPropertyDescriptor(s,l);if(j!=null&&j.set&&j.set.call(d,c),!h){if(n&&typeof l=="string"){var z=t.get("length"),G=Number(l);Number.isInteger(G)&&G>=z.v&&I(z,G+1)}Rt(r)}return!0},ownKeys(s){P(r);var l=Reflect.ownKeys(s).filter(p=>{var h=t.get(p);return h===void 0||h.v!==C});for(var[c,d]of t)d.v!==C&&!(c in s)&&l.push(c);return l},setPrototypeOf(){$n()}})}function Rt(a,e=1){I(a,a.v+e)}function qn(a){var e=J|ne,t=N!==null&&(N.f&J)!==0?N:null;return T===null||t!==null&&(t.f&B)!==0?e|=B:T.f|=pa,{ctx:D,deps:null,effects:null,equals:fa,f:e,fn:a,reactions:null,rv:0,v:null,wv:0,parent:t??T}}function ha(a){var e=a.effects;if(e!==null){a.effects=null;for(var t=0;t<e.length;t+=1)xe(e[t])}}function Wn(a){for(var e=a.parent;e!==null;){if((e.f&J)===0)return e;e=e.parent}return null}function ya(a){var e,t=T;Ee(Wn(a));try{ha(a),e=ja(a)}finally{Ee(t)}return e}function ga(a){var e=ya(a);if(a.equals(e)||(a.v=e,a.wv=La()),!Ae){var t=(de||(a.f&B)!==0)&&a.deps!==null?ve:W;ee(a,t)}}const Be=new Map;function rt(a,e){var t={f:0,v:a,reactions:null,equals:fa,rv:0,wv:0};return t}function Y(a,e){const t=rt(a);return ur(t),t}function I(a,e,t=!1){N!==null&&!Q&&nt()&&(N.f&(J|St))!==0&&!(Z!=null&&Z.includes(a))&&Vn();let n=t?Se(e):e;return Yn(a,n)}function Yn(a,e){if(!a.equals(e)){var t=a.v;Ae?Be.set(a,e):Be.set(a,t),a.v=e,(a.f&J)!==0&&((a.f&ne)!==0&&ya(a),ee(a,(a.f&B)===0?W:ve)),a.wv=La(),_a(a,ne),nt()&&T!==null&&(T.f&W)!==0&&(T.f&(ce|ze))===0&&(X===null?dr([a]):X.push(a))}return e}function _a(a,e){var t=a.reactions;if(t!==null)for(var n=nt(),r=t.length,i=0;i<r;i++){var o=t[i],s=o.f;(s&ne)===0&&(!n&&o===T||(ee(o,e),(s&(W|B))!==0&&((s&J)!==0?_a(o,ve):It(o))))}}var va,xa,ba,wa;function Xn(){if(va===void 0){va=window,xa=/Firefox/.test(navigator.userAgent);var a=Element.prototype,e=Node.prototype,t=Text.prototype;ba=Ve(e,"firstChild").get,wa=Ve(e,"nextSibling").get,ca(a)&&(a.__click=void 0,a.__className=void 0,a.__attributes=null,a.__style=void 0,a.__e=void 0),ca(t)&&(t.__t=void 0)}}function Hn(a=""){return document.createTextNode(a)}function ka(a){return ba.call(a)}function za(a){return wa.call(a)}function Pt(a,e){return ka(a)}function Gn(a,e=1,t=!1){let n=a;for(;e--;)n=za(n);return n}function Jn(a){T===null&&N===null&&Dn(),N!==null&&(N.f&B)!==0&&T===null&&In(),Ae&&jn()}function Kn(a,e){var t=e.last;t===null?e.last=e.first=a:(t.next=a,a.prev=t,e.last=a)}function Ce(a,e,t,n=!0){var r=T,i={ctx:D,deps:null,nodes_start:null,nodes_end:null,f:a|ne,first:null,fn:e,last:null,next:null,parent:r,prev:null,teardown:null,transitions:null,wv:0};if(t)try{jt(i),i.f|=da}catch(l){throw xe(i),l}else e!==null&&It(i);var o=t&&i.deps===null&&i.first===null&&i.nodes_start===null&&i.teardown===null&&(i.f&(pa|Ct))===0;if(!o&&n&&(r!==null&&Kn(i,r),N!==null&&(N.f&J)!==0)){var s=N;(s.effects??(s.effects=[])).push(i)}return i}function Qn(a){const e=Ce(Qe,null,!1);return ee(e,W),e.teardown=a,e}function re(a){Jn();var e=T!==null&&(T.f&ce)!==0&&D!==null&&!D.m;if(e){var t=D;(t.e??(t.e=[])).push({fn:a,effect:T,reaction:N})}else{var n=Lt(a);return n}}function er(a){const e=Ce(ze,a,!0);return(t={})=>new Promise(n=>{t.outro?ir(e,()=>{xe(e),n(void 0)}):(xe(e),n(void 0))})}function Lt(a){return Ce(ua,a,!1)}function Sa(a){return Ce(Qe,a,!0)}function Ca(a,e=[],t=qn){const n=e.map(t);return tr(()=>a(...n.map(P)))}function tr(a,e=0){return Ce(Qe|St|e,a,!0)}function ar(a,e=!0){return Ce(Qe|ce,a,!0,e)}function Aa(a){var e=a.teardown;if(e!==null){const t=Ae,n=N;Ra(!0),ue(null);try{e.call(null)}finally{Ra(t),ue(n)}}}function Ea(a,e=!1){var t=a.first;for(a.first=a.last=null;t!==null;){var n=t.next;(t.f&ze)!==0?t.parent=null:xe(t,e),t=n}}function nr(a){for(var e=a.first;e!==null;){var t=e.next;(e.f&ce)===0&&xe(e),e=t}}function xe(a,e=!0){var t=!1;(e||(a.f&On)!==0)&&a.nodes_start!==null&&a.nodes_end!==null&&(rr(a.nodes_start,a.nodes_end),t=!0),Ea(a,e&&!t),ut(a,0),ee(a,At);var n=a.transitions;if(n!==null)for(const i of n)i.stop();Aa(a);var r=a.parent;r!==null&&r.first!==null&&Ma(a),a.next=a.prev=a.teardown=a.ctx=a.deps=a.fn=a.nodes_start=a.nodes_end=null}function rr(a,e){for(;a!==null;){var t=a===e?null:za(a);a.remove(),a=t}}function Ma(a){var e=a.parent,t=a.prev,n=a.next;t!==null&&(t.next=n),n!==null&&(n.prev=t),e!==null&&(e.first===a&&(e.first=n),e.last===a&&(e.last=t))}function ir(a,e){var t=[];Na(a,t,!0),or(t,()=>{xe(a),e&&e()})}function or(a,e){var t=a.length;if(t>0){var n=()=>--t||e();for(var r of a)r.out(n)}else e()}function Na(a,e,t){if((a.f&tt)===0){if(a.f^=tt,a.transitions!==null)for(const o of a.transitions)(o.is_global||t)&&e.push(o);for(var n=a.first;n!==null;){var r=n.next,i=(n.f&Ln)!==0||(n.f&ce)!==0;Na(n,e,i?t:!1),n=r}}}let it=[];function sr(){var a=it;it=[],Pn(a)}function lr(a){it.length===0&&queueMicrotask(sr),it.push(a)}function cr(a){var e=T;if((e.f&da)===0){if((e.f&Ct)===0)throw a;e.fn(a)}else Ta(a,e)}function Ta(a,e){for(;e!==null;){if((e.f&Ct)!==0)try{e.fn(a);return}catch{}e=e.parent}throw a}let Ot=!1,ot=null,be=!1,Ae=!1;function Ra(a){Ae=a}let st=[],Fi=[],N=null,Q=!1;function ue(a){N=a}let T=null;function Ee(a){T=a}let Z=null;function ur(a){N!==null&&N.f&Et&&(Z===null?Z=[a]:Z.push(a))}let F=null,U=0,X=null;function dr(a){X=a}let Pa=1,lt=0,de=!1;function La(){return++Pa}function ct(a){var p;var e=a.f;if((e&ne)!==0)return!0;if((e&ve)!==0){var t=a.deps,n=(e&B)!==0;if(t!==null){var r,i,o=(e&et)!==0,s=n&&T!==null&&!de,l=t.length;if(o||s){var c=a,d=c.parent;for(r=0;r<l;r++)i=t[r],(o||!((p=i==null?void 0:i.reactions)!=null&&p.includes(c)))&&(i.reactions??(i.reactions=[])).push(c);o&&(c.f^=et),s&&d!==null&&(d.f&B)===0&&(c.f^=B)}for(r=0;r<l;r++)if(i=t[r],ct(i)&&ga(i),i.wv>a.wv)return!0}(!n||T!==null&&!de)&&ee(a,W)}return!1}function Oa(a,e,t=!0){var n=a.reactions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];Z!=null&&Z.includes(a)||((i.f&J)!==0?Oa(i,e,!1):e===i&&(t?ee(i,ne):(i.f&W)!==0&&ee(i,ve),It(i)))}}function ja(a){var x;var e=F,t=U,n=X,r=N,i=de,o=Z,s=D,l=Q,c=a.f;F=null,U=0,X=null,de=(c&B)!==0&&(Q||!be||N===null),N=(c&(ce|ze))===0?a:null,Z=null,ma(a.ctx),Q=!1,lt++,a.f|=Et;try{var d=(0,a.fn)(),p=a.deps;if(F!==null){var h;if(ut(a,U),p!==null&&U>0)for(p.length=U+F.length,h=0;h<F.length;h++)p[U+h]=F[h];else a.deps=p=F;if(!de)for(h=U;h<p.length;h++)((x=p[h]).reactions??(x.reactions=[])).push(a)}else p!==null&&U<p.length&&(ut(a,U),p.length=U);if(nt()&&X!==null&&!Q&&p!==null&&(a.f&(J|ve|ne))===0)for(h=0;h<X.length;h++)Oa(X[h],a);return r!==null&&r!==a&&(lt++,X!==null&&(n===null?n=X:n.push(...X))),d}catch(A){cr(A)}finally{F=e,U=t,X=n,N=r,de=i,Z=o,ma(s),Q=l,a.f^=Et}}function pr(a,e){let t=e.reactions;if(t!==null){var n=An.call(t,a);if(n!==-1){var r=t.length-1;r===0?t=e.reactions=null:(t[n]=t[r],t.pop())}}t===null&&(e.f&J)!==0&&(F===null||!F.includes(e))&&(ee(e,ve),(e.f&(B|et))===0&&(e.f^=et),ha(e),ut(e,0))}function ut(a,e){var t=a.deps;if(t!==null)for(var n=e;n<t.length;n++)pr(a,t[n])}function jt(a){var e=a.f;if((e&At)===0){ee(a,W);var t=T,n=be;T=a,be=!0;try{(e&St)!==0?nr(a):Ea(a),Aa(a);var r=ja(a);a.teardown=typeof r=="function"?r:null,a.wv=Pa;var i=a.deps,o;$e&&Bn&&a.f&ne}finally{be=n,T=t}}}function fr(){try{Zn()}catch(a){if(ot!==null)Ta(a,ot);else throw a}}function mr(){var a=be;try{var e=0;for(be=!0;st.length>0;){e++>1e3&&fr();var t=st,n=t.length;st=[];for(var r=0;r<n;r++){var i=yr(t[r]);hr(i)}Be.clear()}}finally{Ot=!1,be=a,ot=null}}function hr(a){var e=a.length;if(e!==0)for(var t=0;t<e;t++){var n=a[t];(n.f&(At|tt))===0&&ct(n)&&(jt(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?Ma(n):n.fn=null))}}function It(a){Ot||(Ot=!0,queueMicrotask(mr));for(var e=ot=a;e.parent!==null;){e=e.parent;var t=e.f;if((t&(ze|ce))!==0){if((t&W)===0)return;e.f^=W}}st.push(e)}function yr(a){for(var e=[],t=a;t!==null;){var n=t.f,r=(n&(ce|ze))!==0,i=r&&(n&W)!==0;if(!i&&(n&tt)===0){(n&ua)!==0?e.push(t):r?t.f^=W:ct(t)&&jt(t);var o=t.first;if(o!==null){t=o;continue}}var s=t.parent;for(t=t.next;t===null&&s!==null;)t=s.next,s=s.parent}return e}function P(a){var e=a.f,t=(e&J)!==0;if(N!==null&&!Q){if(!(Z!=null&&Z.includes(a))){var n=N.deps;a.rv<lt&&(a.rv=lt,F===null&&n!==null&&n[U]===a?U++:F===null?F=[a]:(!de||!F.includes(a))&&F.push(a))}}else if(t&&a.deps===null&&a.effects===null){var r=a,i=r.parent;i!==null&&(i.f&B)===0&&(r.f^=B)}return t&&(r=a,ct(r)&&ga(r)),Ae&&Be.has(a)?Be.get(a):a.v}function gr(a){var e=Q;try{return Q=!0,a()}finally{Q=e}}const _r=-7169;function ee(a,e){a.f=a.f&_r|e}const vr=new Set,Ia=new Set;function dt(a){var L;var e=this,t=e.ownerDocument,n=a.type,r=((L=a.composedPath)==null?void 0:L.call(a))||[],i=r[0]||a.target,o=0,s=a.__root;if(s){var l=r.indexOf(s);if(l!==-1&&(e===document||e===window)){a.__root=e;return}var c=r.indexOf(e);if(c===-1)return;l<=c&&(o=l)}if(i=r[o]||a.target,i!==e){Mn(a,"currentTarget",{configurable:!0,get(){return i||t}});var d=N,p=T;ue(null),Ee(null);try{for(var h,x=[];i!==null;){var A=i.assignedSlot||i.parentNode||i.host||null;try{var j=i["__"+n];if(j!=null&&(!i.disabled||a.target===i))if(la(j)){var[z,...G]=j;z.apply(i,[a,...G])}else j.call(i,a)}catch(R){h?x.push(R):h=R}if(a.cancelBubble||A===e||A===null)break;i=A}if(h){for(let R of x)queueMicrotask(()=>{throw R});throw h}}finally{a.__root=e,delete a.currentTarget,ue(d),Ee(p)}}}function xr(a){var e=document.createElement("template");return e.innerHTML=a.replaceAll("<!>","<!---->"),e.content}function br(a,e){var t=T;t.nodes_start===null&&(t.nodes_start=a,t.nodes_end=e)}function Dt(a,e){var t,n=!a.startsWith("<!>");return()=>{t===void 0&&(t=xr(n?a:"<!>"+a),t=ka(t));var r=xa?document.importNode(t,!0):t.cloneNode(!0);return br(r,r),r}}function Zt(a,e){a!==null&&a.before(e)}const wr=["touchstart","touchmove"];function kr(a){return wr.includes(a)}function pt(a,e){return zr(a,e)}const Me=new Map;function zr(a,{target:e,anchor:t,props:n={},events:r,context:i,intro:o=!0}){Xn();var s=new Set,l=p=>{for(var h=0;h<p.length;h++){var x=p[h];if(!s.has(x)){s.add(x);var A=kr(x);e.addEventListener(x,dt,{passive:A});var j=Me.get(x);j===void 0?(document.addEventListener(x,dt,{passive:A}),Me.set(x,1)):Me.set(x,j+1)}}};l(En(vr)),Ia.add(l);var c=void 0,d=er(()=>{var p=t??e.appendChild(Hn());return ar(()=>{if(i){Nt({});var h=D;h.c=i}r&&(n.$$events=r),c=a(p,n)||{},i&&Tt()}),()=>{var A;for(var h of s){e.removeEventListener(h,dt);var x=Me.get(h);--x===0?(document.removeEventListener(h,dt),Me.delete(h)):Me.set(h,x)}Ia.delete(l),p!==t&&((A=p.parentNode)==null||A.removeChild(p))}});return Sr.set(c,d),c}let Sr=new WeakMap;const Da=[...`
2
+ \r\f \v\uFEFF`];function Cr(a,e,t){var n=a==null?"":""+a;if(t){for(var r in t)if(t[r])n=n?n+" "+r:r;else if(n.length)for(var i=r.length,o=0;(o=n.indexOf(r,o))>=0;){var s=o+i;(o===0||Da.includes(n[o-1]))&&(s===n.length||Da.includes(n[s]))?n=(o===0?"":n.substring(0,o))+n.substring(s+1):o=s}}return n===""?null:n}function Za(a,e=!1){var t=e?" !important;":";",n="";for(var r in a){var i=a[r];i!=null&&i!==""&&(n+=" "+r+": "+i+t)}return n}function Ar(a,e){if(e){var t="",n,r;return Array.isArray(e)?(n=e[0],r=e[1]):n=e,n&&(t+=Za(n)),r&&(t+=Za(r,!0)),t=t.trim(),t===""?null:t}return String(a)}function Fa(a,e,t,n,r,i){var o=a.__className;if(o!==t||o===void 0){var s=Cr(t,n,i);s==null?a.removeAttribute("class"):a.className=s,a.__className=t}else if(i&&r!==i)for(var l in i){var c=!!i[l];(r==null||c!==!!r[l])&&a.classList.toggle(l,c)}return i}function Ft(a,e={},t,n){for(var r in t){var i=t[r];e[r]!==i&&(t[r]==null?a.style.removeProperty(r):a.style.setProperty(r,i,n))}}function $a(a,e,t,n){var r=a.__style;if(r!==e){var i=Ar(e,n);i==null?a.removeAttribute("style"):a.style.cssText=i,a.__style=e}else n&&(Array.isArray(n)?(Ft(a,t==null?void 0:t[0],n[0]),Ft(a,t==null?void 0:t[1],n[1],"important")):Ft(a,t,n));return n}const Er=()=>performance.now(),te={tick:a=>requestAnimationFrame(a),now:()=>Er(),tasks:new Set};function Va(){const a=te.now();te.tasks.forEach(e=>{e.c(a)||(te.tasks.delete(e),e.f())}),te.tasks.size!==0&&te.tick(Va)}function Mr(a){let e;return te.tasks.size===0&&te.tick(Va),{promise:new Promise(t=>{te.tasks.add(e={c:a,f:t})}),abort(){te.tasks.delete(e)}}}function Ba(a,e){return a===e||(a==null?void 0:a[at])===e}function Ne(a={},e,t,n){return Lt(()=>{var r,i;return Sa(()=>{r=i,i=[],gr(()=>{a!==t(...i)&&(e(a,...i),r&&Ba(t(...r),a)&&e(null,...r))})}),()=>{lr(()=>{i&&Ba(t(...i),a)&&e(null,...i)})}}),a}function Nr(a){return a}function $t(a){return-.5*(Math.cos(Math.PI*a)-1)}function Tr(a){const e=Math.cos(a*Math.PI*.5);return Math.abs(e)<1e-14?1:1-e}function Rr(a){return Math.sin(a*Math.PI/2)}const Pr=128,Lr=0,Vt=1,Or=2;class jr{constructor(){v(this,"animationsStarted",!1);v(this,"animationsCount",0);v(this,"animationsLimit",Pr);v(this,"layers",new Array)}start(){window.requestAnimationFrame(this.tick.bind(this))}tick(){try{this.animationsCount=0;for(let e=0;e<this.layers.length;e++){const t=this.layers[e];if(t==null)continue;const n=t.animations;if(n!=null)for(let r=0;r<n.length;r++){const i=n[r];if(i!=null){for(const o of i.values())if(!o.executed&&(o.executed=!0,o.function(),this.animationsCount++,this.animationsCount==this.animationsLimit))return}}}}finally{window.requestAnimationFrame(this.tick.bind(this))}}equeue(e,t,n,r){let i=this.layers[e];i==null&&(i=this.layers[e]={animations:new Array});let o=i.animations[t];o==null&&(o=i.animations[t]=new Map);let s={id:n,priority:t,executed:!1,function:r};o.set(n,s),this.animationsStarted==!1&&(this.animationsStarted=!0,this.start())}clear(e,t){for(let n=0;n<this.layers.length;n++){let r=this.layers[n];if(r==null)continue;let i=r.animations[e];if(i==null)return;let o=i.get(t);if(o==null||o.executed==!1)return;i.delete(t)}}speed(){return Math.pow(2,2*this.animationsCount/this.animationsLimit)}stacked(){return this.animationsCount==this.animationsLimit}setLimit(e){this.animationsLimit=e}}const ie=new jr;function Ua(a){return Object.prototype.toString.call(a)==="[object Date]"}function Bt(a,e){if(a===e||a!==a)return()=>a;const t=typeof a;if(t!==typeof e||Array.isArray(a)!==Array.isArray(e))throw new Error("Cannot interpolate values of different type");if(Array.isArray(a)){const n=e.map((r,i)=>Bt(a[i],r));return r=>n.map(i=>i(r))}if(t==="object"){if(!a||!e)throw new Error("Object cannot be null");if(Ua(a)&&Ua(e)){const i=a.getTime(),s=e.getTime()-i;return l=>new Date(i+l*s)}const n=Object.keys(e),r={};return n.forEach(i=>{r[i]=Bt(a[i],e[i])}),i=>{const o={};return n.forEach(s=>{o[s]=r[s](i)}),o}}if(t==="number"){const n=e-a;return r=>a+r*n}return()=>e}const ra=class ra{constructor(e,t={}){Ke(this,se,rt(void 0));Ke(this,Ze,rt(void 0));Ke(this,Ge);Ke(this,we,null);V(this,se).v=V(this,Ze).v=e,sa(this,Ge,t)}static of(e,t){const n=new ra(e(),t);return Sa(()=>{n.set(e())}),n}set(e,t){var p;I(V(this,Ze),e);let{delay:n=0,duration:r=400,easing:i=Nr,interpolate:o=Bt}={...V(this,Ge),...t};if(r===0)return(p=V(this,we))==null||p.abort(),I(V(this,se),e),Promise.resolve();const s=te.now()+n;let l,c=!1,d=V(this,we);return sa(this,we,Mr(h=>{if(h<s)return!0;if(!c){c=!0;const A=V(this,se).v;l=o(A,e),typeof r=="function"&&(r=r(A,e)),d==null||d.abort()}const x=h-s;return x>r?(I(V(this,se),e),!1):(I(V(this,se),l(i(x/r))),!0)})),V(this,we).promise}get current(){return P(V(this,se))}get target(){return P(V(this,Ze))}set target(e){this.set(e)}};se=new WeakMap,Ze=new WeakMap,Ge=new WeakMap,we=new WeakMap;let Ut=ra;class ft{constructor(e,t){v(this,"value");v(this,"motion");this.value=e,this.motion=new Ut(e,t)}set(e,t){this.value=e,this.motion.set(e,t)}update(e){this.motion.set(this.value,e)}snap(){this.motion.set(this.value,{duration:0})}}function qa(a,e,t){const n=t*(Math.PI/180),r=a/2,i=e/2,o=Math.sqrt(r*r+i*i),s=Math.atan(i/r)*(180/Math.PI),l=s,c=180-s,d=180+s,p=360-s;switch(!0){case(l<=t&&t<=c):return{offsetX:o*Math.cos(n)-r,offsetY:0};case(c<=t&&t<=d):return{offsetX:-a,offsetY:o*Math.sin(n)-i};case(d<=t&&t<=p):return{offsetX:o*Math.cos(n)-r,offsetY:-e};default:return{offsetX:0,offsetY:o*Math.sin(n)-i}}}const Ir=512,Wa=24,mt=10,Dr=1e6,Zr=2,Fr=128,$r=270,qt=8;var ht;(a=>{a.COUNT=12,a.DEFAULT=$r,a.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330]})(ht||(ht={}));var Vr=Dt('<div><div class="pin svelte-1q5zkd1"></div> <div class="marker svelte-1q5zkd1"><div class="body svelte-1q5zkd1"></div></div></div>');function Br(a,e){Nt(e,!0);let t,n,r,i;const o=e.width+2*qt,s=e.height+2*qt,l=()=>i;re(()=>{r.style.width=`${Math.min(o,s)/4}px`,r.style.height=`${Math.min(o,s)/4}px`});let c=Y(!0);function d(E){I(c,E,!0)}function p(){return P(c)}let h=Y(!0);function x(E){I(h,E,!0)}function A(){return z.motion.current==0}function j(){return P(h)==!1}let z=new ft(0),G=Vt;re(()=>{L(z.motion.current)}),re(()=>{P(c)==!1&&(z.snap(),ie.clear(e.priority,e.id+"_scale"))}),re(()=>{P(h)==!0&&z.value!=0&&(G=Lr,ie.stacked()?z.set(0,{duration:0}):z.set(0,{duration:150,easing:Tr})),P(h)==!1&&z.value!=1&&(G=Vt,z.set(1,{duration:150,easing:Rr}))});function L(E){!t||!n||!r||ie.equeue(G,e.priority,e.id+"_scale",()=>{t.style.opacity=`${E}`,n.style.scale=`${E}`,r.style.scale=`${E}`})}let R=NaN,Je=Y(!1),_e=new ft(-o/2,{easing:$t}),bt=new ft(-s/2,{easing:$t});re(()=>{gn(_e.motion.current,bt.motion.current)}),re(()=>{P(c)==!1&&(_e.snap(),_e.snap(),ie.clear(e.priority,e.id+"_angle"))}),re(()=>{P(h)==!0&&P(Je)&&(_e.update({duration:75}),_e.update({duration:75}))});function gn(E,le){if(!t||!n||!r)return;const Fe=E+o/2,ke=le+s/2,kt=s<o?Fe*s/o:Fe,Ri=s>o?ke*o/s:ke,Pi=Math.atan2(Ri,kt)/Math.PI*180-45,kn=0,Li=30,oa=Math.sqrt(Fe*Fe+ke*ke),zt=Math.min(o,s)/2,Oi=Math.sqrt(o*o+s*s)/2,ji=(oa-zt)/(Oi-zt),zn=kn+ji*(Li-kn),Ii=oa<zt?oa/zt:1;ie.equeue(Vt,e.priority,e.id+"_angle",()=>{n.style.transform=`translate(${Math.round(E)}px, ${Math.round(le)}px)`,r.style.transform=`scale(${Ii}) rotate(${Pi}deg) skew(${zn}deg, ${zn}deg)`})}function Ti(E){if(P(Je)==!1){let le=qa(o,s,E);_e.set(Math.round(le.offsetX),{duration:0}),bt.set(Math.round(le.offsetY),{duration:0}),gn(_e.value,bt.value),R=E,I(Je,!0)}else if(E!=R){let le=Math.abs(E-R),Fe=le<180?le:360-le,ke=Math.log(Fe)*75,kt=qa(o,s,E);_e.set(Math.round(kt.offsetX),{duration:P(Je)?ke:0}),bt.set(Math.round(kt.offsetY),{duration:P(Je)?ke:0}),R=E}}var wt=Vr();let _n;var vn=Pt(wt);Ne(vn,E=>r=E,()=>r);var ia=Gn(vn,2);let xn;var bn=Pt(ia);let wn;return Ne(bn,E=>i=E,()=>i),Ne(ia,E=>n=E,()=>n),Ne(wt,E=>t=E,()=>t),Ca(E=>{_n=Fa(wt,1,"anchor svelte-1q5zkd1",null,_n,E),xn=$a(ia,"",xn,{padding:qt+"px"}),wn=$a(bn,"",wn,{width:`${e.width}px`,height:`${e.height}px`})},[()=>({displayed:P(c)})]),Zt(a,wt),Tt({getBody:l,setDisplayed:d,getDisplayed:p,setCollapsed:x,getCollapsed:A,getExpanded:j,setAngle:Ti})}var Ur=Dt('<div><div class="body svelte-piqgmq"></div></div>');function qr(a,e){Nt(e,!0);let t,n;function r(){return n}let i=Y(!1);function o(z){I(i,z,!0)}function s(){return P(i)}let l=new ft(0,{easing:$t});re(()=>{c(l.motion.current)}),re(()=>{P(i)==!1&&(l.snap(),ie.clear(e.priority,e.id))});function c(z){t&&ie.equeue(Or,e.priority,e.id,()=>{t.style.scale=z.toString(),t.style.filter=`brightness(${.25+.75*z})`,n.style.opacity=z.toString()})}function d(z){z!=l.value&&l.set(z,{duration:75})}function p(){return l.motion.current==0}function h(){return l.value}var x=Ur();let A;var j=Pt(x);return Ne(j,z=>n=z,()=>n),Ne(x,z=>t=z,()=>t),Ca(z=>A=Fa(x,1,"circle svelte-piqgmq",null,A,z),[()=>({displayed:P(i)})]),Zt(a,x),Tt({getBody:r,setDisplayed:o,getDisplayed:s,setScale:d,getCollapsed:p,getScale:h})}Un();var Wr=Dt('<div class="logo svelte-1eakbm4"><a href="https://arenarium.dev" target="_blank" class="svelte-1eakbm4"><span class="text">@arenarium/maps</span></a></div>');function Yr(a){var e=Wr();Zt(a,e)}function Xr(a){}async function yt(a,e){try{await fetch("https://arenarium.dev/api/public/v1/log?log="+encodeURIComponent(JSON.stringify({title:a,content:e})))}catch(t){console.error(t)}}class Te{constructor(e,t,n,r){v(this,"swLat");v(this,"swLng");v(this,"neLat");v(this,"neLng");v(this,"contains",(e,t)=>this.swLat<=e&&e<=this.neLat&&this.swLng<=t&&t<=this.neLng);this.swLat=t,this.swLng=e,this.neLat=r,this.neLng=n}}class Ya{constructor(e,t,n,r,i){v(this,"bounds1");v(this,"bounds2");v(this,"contains",(e,t)=>this.bounds1.contains(e,t)||this.bounds2.contains(e,t));const o=e.unproject([t,n]),s=e.unproject([r,i]);if(o.lng<-180){this.bounds1=new Te(-180,o.lat,s.lng,s.lat),this.bounds2=new Te(o.wrap().lng,o.lat,180,s.lat);return}if(s.lng>180){this.bounds1=new Te(o.lng,o.lat,180,s.lat),this.bounds2=new Te(-180,o.lat,s.wrap().lng,s.lat);return}this.bounds1=new Te(o.lng,o.lat,s.lng,s.lat),this.bounds2=new Te(0,0,0,0)}}var k;(function(a){a.assertEqual=r=>{};function e(r){}a.assertIs=e;function t(r){throw new Error}a.assertNever=t,a.arrayToEnum=r=>{const i={};for(const o of r)i[o]=o;return i},a.getValidEnumValues=r=>{const i=a.objectKeys(r).filter(s=>typeof r[r[s]]!="number"),o={};for(const s of i)o[s]=r[s];return a.objectValues(o)},a.objectValues=r=>a.objectKeys(r).map(function(i){return r[i]}),a.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const i=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&i.push(o);return i},a.find=(r,i)=>{for(const o of r)if(i(o))return o},a.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function n(r,i=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}a.joinValues=n,a.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(k||(k={}));var Xa;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(Xa||(Xa={}));const m=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),pe=a=>{switch(typeof a){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(a)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(a)?m.array:a===null?m.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?m.promise:typeof Map<"u"&&a instanceof Map?m.map:typeof Set<"u"&&a instanceof Set?m.set:typeof Date<"u"&&a instanceof Date?m.date:m.object;default:return m.unknown}},u=k.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"]);class H extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(i){return i.message},n={_errors:[]},r=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let s=n,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(o))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return r(this),n}static assert(e){if(!(e instanceof H))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,k.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}H.create=a=>new H(a);const Ue=(a,e)=>{let t;switch(a.code){case u.invalid_type:a.received===m.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case u.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,k.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:t=`Unrecognized key(s) in object: ${k.joinValues(a.keys,", ")}`;break;case u.invalid_union:t="Invalid input";break;case u.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${k.joinValues(a.options)}`;break;case u.invalid_enum_value:t=`Invalid enum value. Expected ${k.joinValues(a.options)}, received '${a.received}'`;break;case u.invalid_arguments:t="Invalid function arguments";break;case u.invalid_return_type:t="Invalid function return type";break;case u.invalid_date:t="Invalid date";break;case u.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:k.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case u.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case u.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case u.custom:t="Invalid input";break;case u.invalid_intersection_types:t="Intersection results could not be merged";break;case u.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case u.not_finite:t="Number must be finite";break;default:t=e.defaultError,k.assertNever(a)}return{message:t}};let Hr=Ue;function Wt(){return Hr}const Yt=a=>{const{data:e,path:t,errorMaps:n,issueData:r}=a,i=[...t,...r.path||[]],o={...r,path:i};if(r.message!==void 0)return{...r,path:i,message:r.message};let s="";const l=n.filter(c=>!!c).slice().reverse();for(const c of l)s=c(o,{data:e,defaultError:s}).message;return{...r,path:i,message:s}};function f(a,e){const t=Wt(),n=Yt({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===Ue?void 0:Ue].filter(r=>!!r)});a.common.issues.push(n)}class q{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if(r.status==="aborted")return g;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const i=await r.key,o=await r.value;n.push({key:i,value:o})}return q.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:i,value:o}=r;if(i.status==="aborted"||o.status==="aborted")return g;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(n[i.value]=o.value)}return{status:e.value,value:n}}}const g=Object.freeze({status:"aborted"}),qe=a=>({status:"dirty",value:a}),$=a=>({status:"valid",value:a}),Ha=a=>a.status==="aborted",Ga=a=>a.status==="dirty",Re=a=>a.status==="valid",gt=a=>typeof Promise<"u"&&a instanceof Promise;var y;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(y||(y={}));class fe{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ja=(a,e)=>{if(Re(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new H(a.common.issues);return this._error=t,this._error}}};function b(a){if(!a)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:r}=a;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,s)=>{const{message:l}=a;return o.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??n??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:l??t??s.defaultError}},description:r}}class w{get description(){return this._def.description}_getType(e){return pe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:pe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new q,ctx:{common:e.parent.common,data:e.data,parsedType:pe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(gt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:pe(e)},r=this._parseSync({data:e,path:n.path,parent:n});return Ja(n,r)}"~validate"(e){var n,r;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:pe(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:t});return Re(i)?{value:i.value}:{issues:t.common.issues}}catch(i){(r=(n=i==null?void 0:i.message)==null?void 0:n.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(i=>Re(i)?{value:i.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:pe(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(gt(r)?r:Promise.resolve(r));return Ja(n,i)}refine(e,t){const n=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,i)=>{const o=e(r),s=()=>i.addIssue({code:u.custom,...n(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t=="function"?t(n,r):t),!1))}_refinement(e){return new Ie({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,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:t=>this["~validate"](t)}}optional(){return ye.create(this,this._def)}nullable(){return De.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ae.create(this)}promise(){return He.create(this,this._def)}or(e){return vt.create([this,e],this._def)}and(e){return xt.create(this,e,this._def)}transform(e){return new Ie({...b(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Kt({...b(this._def),innerType:this,defaultValue:t,typeName:_.ZodDefault})}brand(){return new _i({typeName:_.ZodBranded,type:this,...b(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Qt({...b(this._def),innerType:this,catchValue:t,typeName:_.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ea.create(this,e)}readonly(){return ta.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Gr=/^c[^\s-]{8,}$/i,Jr=/^[0-9a-z]+$/,Kr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Qr=/^[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,ei=/^[a-z0-9_-]{21}$/i,ti=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ai=/^[-+]?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)?)??$/,ni=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ri="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Xt;const ii=/^(?:(?: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])$/,oi=/^(?:(?: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])$/,si=/^(([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]))$/,li=/^(([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])$/,ci=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ui=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ka="((\\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])))",di=new RegExp(`^${Ka}$`);function Qa(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);const t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function pi(a){return new RegExp(`^${Qa(a)}$`)}function fi(a){let e=`${Ka}T${Qa(a)}`;const t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function mi(a,e){return!!((e==="v4"||!e)&&ii.test(a)||(e==="v6"||!e)&&si.test(a))}function hi(a,e){if(!ti.test(a))return!1;try{const[t]=a.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(n));return!(typeof r!="object"||r===null||"typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function yi(a,e){return!!((e==="v4"||!e)&&oi.test(a)||(e==="v6"||!e)&&li.test(a))}class me extends w{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const i=this._getOrReturnCtx(e);return f(i,{code:u.invalid_type,expected:m.string,received:i.parsedType}),g}const n=new q;let r;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,s=e.data.length<i.value;(o||s)&&(r=this._getOrReturnCtx(e,r),o?f(r,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&f(r,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")ni.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"email",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Xt||(Xt=new RegExp(ri,"u")),Xt.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"emoji",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Qr.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"uuid",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")ei.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"nanoid",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Gr.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"cuid",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Jr.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"cuid2",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Kr.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"ulid",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),f(r,{validation:"url",code:u.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"regex",code:u.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),f(r,{code:u.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),f(r,{code:u.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),f(r,{code:u.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?fi(i).test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:u.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?di.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:u.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?pi(i).test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:u.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?ai.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"duration",code:u.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?mi(e.data,i.version)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"ip",code:u.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?hi(e.data,i.alg)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"jwt",code:u.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?yi(e.data,i.version)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"cidr",code:u.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?ci.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"base64",code:u.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?ui.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"base64url",code:u.invalid_string,message:i.message}),n.dirty()):k.assertNever(i);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(r=>e.test(r),{validation:t,code:u.invalid_string,...y.errToObj(n)})}_addCheck(e){return new me({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...y.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...y.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...y.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...y.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...y.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...y.errToObj(t)})}nonempty(e){return this.min(1,y.errToObj(e))}trim(){return new me({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new me({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new me({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}me.create=a=>new me({checks:[],typeName:_.ZodString,coerce:(a==null?void 0:a.coerce)??!1,...b(a)});function gi(a,e){const t=(a.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=t>n?t:n,i=Number.parseInt(a.toFixed(r).replace(".","")),o=Number.parseInt(e.toFixed(r).replace(".",""));return i%o/10**r}class Pe extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){const i=this._getOrReturnCtx(e);return f(i,{code:u.invalid_type,expected:m.number,received:i.parsedType}),g}let n;const r=new q;for(const i of this._def.checks)i.kind==="int"?k.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:u.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?gi(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:u.not_finite,message:i.message}),r.dirty()):k.assertNever(i);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,t,n,r){return new Pe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new Pe({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&k.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Pe.create=a=>new Pe({checks:[],typeName:_.ZodNumber,coerce:(a==null?void 0:a.coerce)||!1,...b(a)});class We extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let n;const r=new q;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):k.assertNever(i);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return f(t,{code:u.invalid_type,expected:m.bigint,received:t.parsedType}),g}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,t,n,r){return new We({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new We({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}We.create=a=>new We({checks:[],typeName:_.ZodBigInt,coerce:(a==null?void 0:a.coerce)??!1,...b(a)});class Ht extends w{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:m.boolean,received:n.parsedType}),g}return $(e.data)}}Ht.create=a=>new Ht({typeName:_.ZodBoolean,coerce:(a==null?void 0:a.coerce)||!1,...b(a)});class _t extends w{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const i=this._getOrReturnCtx(e);return f(i,{code:u.invalid_type,expected:m.date,received:i.parsedType}),g}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return f(i,{code:u.invalid_date}),g}const n=new q;let r;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:u.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:u.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):k.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new _t({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:y.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}_t.create=a=>new _t({checks:[],coerce:(a==null?void 0:a.coerce)||!1,typeName:_.ZodDate,...b(a)});class en extends w{_parse(e){if(this._getType(e)!==m.symbol){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:m.symbol,received:n.parsedType}),g}return $(e.data)}}en.create=a=>new en({typeName:_.ZodSymbol,...b(a)});class tn extends w{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:m.undefined,received:n.parsedType}),g}return $(e.data)}}tn.create=a=>new tn({typeName:_.ZodUndefined,...b(a)});class an extends w{_parse(e){if(this._getType(e)!==m.null){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:m.null,received:n.parsedType}),g}return $(e.data)}}an.create=a=>new an({typeName:_.ZodNull,...b(a)});class Gt extends w{constructor(){super(...arguments),this._any=!0}_parse(e){return $(e.data)}}Gt.create=a=>new Gt({typeName:_.ZodAny,...b(a)});class Le extends w{constructor(){super(...arguments),this._unknown=!0}_parse(e){return $(e.data)}}Le.create=a=>new Le({typeName:_.ZodUnknown,...b(a)});class he extends w{_parse(e){const t=this._getOrReturnCtx(e);return f(t,{code:u.invalid_type,expected:m.never,received:t.parsedType}),g}}he.create=a=>new he({typeName:_.ZodNever,...b(a)});class nn extends w{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:m.void,received:n.parsedType}),g}return $(e.data)}}nn.create=a=>new nn({typeName:_.ZodVoid,...b(a)});class ae extends w{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==m.array)return f(t,{code:u.invalid_type,expected:m.array,received:t.parsedType}),g;if(r.exactLength!==null){const o=t.data.length>r.exactLength.value,s=t.data.length<r.exactLength.value;(o||s)&&(f(t,{code:o?u.too_big:u.too_small,minimum:s?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(f(t,{code:u.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(f(t,{code:u.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,s)=>r.type._parseAsync(new fe(t,o,t.path,s)))).then(o=>q.mergeArray(n,o));const i=[...t.data].map((o,s)=>r.type._parseSync(new fe(t,o,t.path,s)));return q.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new ae({...this._def,minLength:{value:e,message:y.toString(t)}})}max(e,t){return new ae({...this._def,maxLength:{value:e,message:y.toString(t)}})}length(e,t){return new ae({...this._def,exactLength:{value:e,message:y.toString(t)}})}nonempty(e){return this.min(1,e)}}ae.create=(a,e)=>new ae({type:a,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...b(e)});function Oe(a){if(a instanceof O){const e={};for(const t in a.shape){const n=a.shape[t];e[t]=ye.create(Oe(n))}return new O({...a._def,shape:()=>e})}else return a instanceof ae?new ae({...a._def,type:Oe(a.element)}):a instanceof ye?ye.create(Oe(a.unwrap())):a instanceof De?De.create(Oe(a.unwrap())):a instanceof oe?oe.create(a.items.map(e=>Oe(e))):a}class O extends w{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=k.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==m.object){const c=this._getOrReturnCtx(e);return f(c,{code:u.invalid_type,expected:m.object,received:c.parsedType}),g}const{status:n,ctx:r}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof he&&this._def.unknownKeys==="strip"))for(const c in r.data)o.includes(c)||s.push(c);const l=[];for(const c of o){const d=i[c],p=r.data[c];l.push({key:{status:"valid",value:c},value:d._parse(new fe(r,p,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof he){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of s)l.push({key:{status:"valid",value:d},value:{status:"valid",value:r.data[d]}});else if(c==="strict")s.length>0&&(f(r,{code:u.unrecognized_keys,keys:s}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of s){const p=r.data[d];l.push({key:{status:"valid",value:d},value:c._parse(new fe(r,p,r.path,d)),alwaysSet:d in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of l){const p=await d.key,h=await d.value;c.push({key:p,value:h,alwaysSet:d.alwaysSet})}return c}).then(c=>q.mergeObjectSync(n,c)):q.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new O({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var i,o;const r=((o=(i=this._def).errorMap)==null?void 0:o.call(i,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:y.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new O({...this._def,unknownKeys:"strip"})}passthrough(){return new O({...this._def,unknownKeys:"passthrough"})}extend(e){return new O({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new O({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new O({...this._def,catchall:e})}pick(e){const t={};for(const n of k.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new O({...this._def,shape:()=>t})}omit(e){const t={};for(const n of k.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new O({...this._def,shape:()=>t})}deepPartial(){return Oe(this)}partial(e){const t={};for(const n of k.objectKeys(this.shape)){const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}return new O({...this._def,shape:()=>t})}required(e){const t={};for(const n of k.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof ye;)i=i._def.innerType;t[n]=i}return new O({...this._def,shape:()=>t})}keyof(){return ln(k.objectKeys(this.shape))}}O.create=(a,e)=>new O({shape:()=>a,unknownKeys:"strip",catchall:he.create(),typeName:_.ZodObject,...b(e)}),O.strictCreate=(a,e)=>new O({shape:()=>a,unknownKeys:"strict",catchall:he.create(),typeName:_.ZodObject,...b(e)}),O.lazycreate=(a,e)=>new O({shape:a,unknownKeys:"strip",catchall:he.create(),typeName:_.ZodObject,...b(e)});class vt extends w{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function r(i){for(const s of i)if(s.result.status==="valid")return s.result;for(const s of i)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;const o=i.map(s=>new H(s.ctx.common.issues));return f(t,{code:u.invalid_union,unionErrors:o}),g}if(t.common.async)return Promise.all(n.map(async i=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(r);{let i;const o=[];for(const l of n){const c={...t,common:{...t.common,issues:[]},parent:null},d=l._parseSync({data:t.data,path:t.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;const s=o.map(l=>new H(l));return f(t,{code:u.invalid_union,unionErrors:s}),g}}get options(){return this._def.options}}vt.create=(a,e)=>new vt({options:a,typeName:_.ZodUnion,...b(e)});function Jt(a,e){const t=pe(a),n=pe(e);if(a===e)return{valid:!0,data:a};if(t===m.object&&n===m.object){const r=k.objectKeys(e),i=k.objectKeys(a).filter(s=>r.indexOf(s)!==-1),o={...a,...e};for(const s of i){const l=Jt(a[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(t===m.array&&n===m.array){if(a.length!==e.length)return{valid:!1};const r=[];for(let i=0;i<a.length;i++){const o=a[i],s=e[i],l=Jt(o,s);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return t===m.date&&n===m.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}class xt extends w{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(i,o)=>{if(Ha(i)||Ha(o))return g;const s=Jt(i.value,o.value);return s.valid?((Ga(i)||Ga(o))&&t.dirty(),{status:t.value,value:s.data}):(f(n,{code:u.invalid_intersection_types}),g)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,o])=>r(i,o)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}xt.create=(a,e,t)=>new xt({left:a,right:e,typeName:_.ZodIntersection,...b(t)});class oe extends w{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return f(n,{code:u.invalid_type,expected:m.array,received:n.parsedType}),g;if(n.data.length<this._def.items.length)return f(n,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&n.data.length>this._def.items.length&&(f(n,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...n.data].map((o,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new fe(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(i).then(o=>q.mergeArray(t,o)):q.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new oe({...this._def,rest:e})}}oe.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new oe({items:a,typeName:_.ZodTuple,rest:null,...b(e)})};class rn extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return f(n,{code:u.invalid_type,expected:m.map,received:n.parsedType}),g;const r=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map(([s,l],c)=>({key:r._parse(new fe(n,s,n.path,[c,"key"])),value:i._parse(new fe(n,l,n.path,[c,"value"]))}));if(n.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,d=await l.value;if(c.status==="aborted"||d.status==="aborted")return g;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),s.set(c.value,d.value)}return{status:t.value,value:s}})}else{const s=new Map;for(const l of o){const c=l.key,d=l.value;if(c.status==="aborted"||d.status==="aborted")return g;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),s.set(c.value,d.value)}return{status:t.value,value:s}}}}rn.create=(a,e,t)=>new rn({valueType:e,keyType:a,typeName:_.ZodMap,...b(t)});class Ye extends w{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return f(n,{code:u.invalid_type,expected:m.set,received:n.parsedType}),g;const r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(f(n,{code:u.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(f(n,{code:u.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const d of l){if(d.status==="aborted")return g;d.status==="dirty"&&t.dirty(),c.add(d.value)}return{status:t.value,value:c}}const s=[...n.data.values()].map((l,c)=>i._parse(new fe(n,l,n.path,c)));return n.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,t){return new Ye({...this._def,minSize:{value:e,message:y.toString(t)}})}max(e,t){return new Ye({...this._def,maxSize:{value:e,message:y.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ye.create=(a,e)=>new Ye({valueType:a,minSize:null,maxSize:null,typeName:_.ZodSet,...b(e)});class Xe extends w{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return f(t,{code:u.invalid_type,expected:m.function,received:t.parsedType}),g;function n(s,l){return Yt({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Wt(),Ue].filter(c=>!!c),issueData:{code:u.invalid_arguments,argumentsError:l}})}function r(s,l){return Yt({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Wt(),Ue].filter(c=>!!c),issueData:{code:u.invalid_return_type,returnTypeError:l}})}const i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof He){const s=this;return $(async function(...l){const c=new H([]),d=await s._def.args.parseAsync(l,i).catch(x=>{throw c.addIssue(n(l,x)),c}),p=await Reflect.apply(o,this,d);return await s._def.returns._def.type.parseAsync(p,i).catch(x=>{throw c.addIssue(r(p,x)),c})})}else{const s=this;return $(function(...l){const c=s._def.args.safeParse(l,i);if(!c.success)throw new H([n(l,c.error)]);const d=Reflect.apply(o,this,c.data),p=s._def.returns.safeParse(d,i);if(!p.success)throw new H([r(d,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Xe({...this._def,args:oe.create(e).rest(Le.create())})}returns(e){return new Xe({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Xe({args:e||oe.create([]).rest(Le.create()),returns:t||Le.create(),typeName:_.ZodFunction,...b(n)})}}class on extends w{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}on.create=(a,e)=>new on({getter:a,typeName:_.ZodLazy,...b(e)});class sn extends w{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:u.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:e.data}}get value(){return this._def.value}}sn.create=(a,e)=>new sn({value:a,typeName:_.ZodLiteral,...b(e)});function ln(a,e){return new je({values:a,typeName:_.ZodEnum,...b(e)})}class je extends w{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return f(t,{expected:k.joinValues(n),received:t.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return f(t,{received:t.data,code:u.invalid_enum_value,options:n}),g}return $(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return je.create(e,{...this._def,...t})}exclude(e,t=this._def){return je.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}je.create=ln;class cn extends w{_parse(e){const t=k.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const r=k.objectValues(t);return f(n,{expected:k.joinValues(r),received:n.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(k.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=k.objectValues(t);return f(n,{received:n.data,code:u.invalid_enum_value,options:r}),g}return $(e.data)}get enum(){return this._def.values}}cn.create=(a,e)=>new cn({values:a,typeName:_.ZodNativeEnum,...b(e)});class He extends w{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return f(t,{code:u.invalid_type,expected:m.promise,received:t.parsedType}),g;const n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return $(n.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}He.create=(a,e)=>new He({type:a,typeName:_.ZodPromise,...b(e)});class Ie extends w{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:o=>{f(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="preprocess"){const o=r.transform(n.data,i);if(n.common.async)return Promise.resolve(o).then(async s=>{if(t.value==="aborted")return g;const l=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?g:l.status==="dirty"||t.value==="dirty"?qe(l.value):l});{if(t.value==="aborted")return g;const s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?g:s.status==="dirty"||t.value==="dirty"?qe(s.value):s}}if(r.type==="refinement"){const o=s=>{const l=r.refinement(s,i);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?g:(s.status==="dirty"&&t.dirty(),o(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?g:(s.status==="dirty"&&t.dirty(),o(s.value).then(()=>({status:t.value,value:s.value}))))}if(r.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Re(o))return g;const s=r.transform(o.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Re(o)?Promise.resolve(r.transform(o.value,i)).then(s=>({status:t.value,value:s})):g);k.assertNever(r)}}Ie.create=(a,e,t)=>new Ie({schema:a,typeName:_.ZodEffects,effect:e,...b(t)}),Ie.createWithPreprocess=(a,e,t)=>new Ie({schema:e,effect:{type:"preprocess",transform:a},typeName:_.ZodEffects,...b(t)});class ye extends w{_parse(e){return this._getType(e)===m.undefined?$(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ye.create=(a,e)=>new ye({innerType:a,typeName:_.ZodOptional,...b(e)});class De extends w{_parse(e){return this._getType(e)===m.null?$(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}De.create=(a,e)=>new De({innerType:a,typeName:_.ZodNullable,...b(e)});class Kt extends w{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Kt.create=(a,e)=>new Kt({innerType:a,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});class Qt extends w{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return gt(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new H(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new H(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Qt.create=(a,e)=>new Qt({innerType:a,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});class un extends w{_parse(e){if(this._getType(e)!==m.nan){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:m.nan,received:n.parsedType}),g}return{status:"valid",value:e.data}}}un.create=a=>new un({typeName:_.ZodNaN,...b(a)});class _i extends w{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class ea extends w{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?g:i.status==="dirty"?(t.dirty(),qe(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?g:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new ea({in:e,out:t,typeName:_.ZodPipeline})}}class ta extends w{_parse(e){const t=this._def.innerType._parse(e),n=r=>(Re(r)&&(r.value=Object.freeze(r.value)),r);return gt(t)?t.then(r=>n(r)):n(t)}unwrap(){return this._def.innerType}}ta.create=(a,e)=>new ta({innerType:a,typeName:_.ZodReadonly,...b(e)});var _;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(_||(_={}));const aa=me.create,K=Pe.create,vi=Ht.create,xi=Gt.create;Le.create,he.create;const na=ae.create,ge=O.create;vt.create,xt.create;const dn=oe.create,bi=Xe.create;je.create;const wi=He.create;ye.create,De.create,ge({pin:ge({fade:vi().optional(),maxCount:K().optional(),maxZoom:K().optional()}).optional(),animation:ge({queue:ge({limit:K().optional()}).optional()}).optional()});const pn=ge({id:aa().min(1),rank:K(),lat:K().min(-90).max(90),lng:K().min(-180).max(180),width:K().min(56),height:K().min(56)}),ki=dn([K(),na(dn([K(),K()]))]),fn=bi().args(aa()).returns(wi(xi())),zi=ge({data:pn,state:ki,callbacks:ge({body:fn,pin:fn.optional()})}),Si=na(zi);ge({key:aa(),data:na(pn)});class Ci{constructor(e,t){v(this,"mapMarkerCallback");v(this,"map");v(this,"mapConfiguration",null);v(this,"mapPopupDataArray",new Array);v(this,"mapPopupDataMap",new Map);v(this,"mapPopupDataUpdating",!1);this.mapMarkerCallback=t,this.map=e,this.map.on("load",this.onMapLoad.bind(this)),pt(Yr,{target:this.map.getContainer()}),pt(Xr,{target:this.map.getContainer()}),this.setRestrictions(),this.setConfiguration(null)}setRestrictions(){console.warn("Disabling map rotation, pitch and keyboard to ensure popups are shown correctly"),this.map.dragRotate.disable(),this.map.keyboard.disable(),this.map.touchZoomRotate.disableRotation(),this.map.touchPitch.disable()}setConfiguration(e){var t,n;this.mapConfiguration=e,(n=(t=e==null?void 0:e.animation)==null?void 0:t.queue)!=null&&n.limit?ie.setLimit(e.animation.queue.limit):ie.setLimit(8*navigator.hardwareConcurrency)}setColors(e,t,n){const r=this.map.getContainer();r.style.setProperty("--map-style-primary",e),r.style.setProperty("--map-style-background",t),r.style.setProperty("--map-style-text",n)}async updatePopups(e){try{await Si.parseAsync(e),await this.updatePopupData(e)}catch(t){throw console.error(t),yt("[Error] Failed to update popups",{message:t.message,stack:t.stack}),t}}removePopups(){try{this.removePopupData()}catch(e){throw console.error(e),yt("[Error] Failed to remove popups",{message:e.message,stack:e.stack}),e}}togglePopups(e){try{this.togglePopupData(e)}catch(t){throw console.error(t),yt("[Error] Failed to toggle popups",{message:t.message,stack:t.stack}),t}}onMapLoad(){this.processPopupDataCallback()}processPopupDataCallback(){if(!this.map._removed)try{this.processPopupData(),window.setTimeout(this.processPopupDataCallback.bind(this),25)}catch(e){console.error(e),yt("[Error] Failed to process popups",{message:e.message,stack:e.stack})}}processPopupData(){var d,p,h,x,A,j;if(this.mapPopupDataArray.length==0||this.mapPopupDataUpdating)return;const e=this.map.getZoom();if(!e)return;const t=this.map.getCanvas().width,n=this.map.getCanvas().height,r=Ir,i=new Ya(this.map,-r,n+r,t+r,-r),o=new Ya(this.map,0,n,t,0);let s=0,l=((p=(d=this.mapConfiguration)==null?void 0:d.pin)==null?void 0:p.maxCount)??Math.max(Fr,8*navigator.hardwareConcurrency),c=((x=(h=this.mapConfiguration)==null?void 0:h.pin)==null?void 0:x.maxZoom)??Zr;for(const z of this.mapPopupDataArray){const G=z.supressed?-1:e,L=z.circle;o.contains(L.lat,L.lng)?G<=L.zoom&&L.zoom<=e+c?(s<l&&(((j=(A=this.mapConfiguration)==null?void 0:A.pin)==null?void 0:j.fade)==!0?L.updateState(e):L.setExpanded(),L.updateMap(this.map),L.isPinLoaded()==!1&&L.updatePin()),s++):(L.setCollapsed(),L.isCollapsed()&&L.updateMap(null)):L.updateMap(null);const R=z.marker;i.contains(R.lat,R.lng)?R.zoom<=G?(R.updateState(e),R.setCollapsed(!1),R.updateMap(this.map),R.isExpanded()&&R.isBodyLoaded()==!1&&R.updateBody()):(R.setCollapsed(!0),R.isCollapsed()&&R.updateMap(null)):R.updateMap(null)}}async updatePopupData(e){try{this.mapPopupDataUpdating=!0;const t=new Map(e.map(r=>[r.data.id,new hn(r)])),n=Array.from(this.mapPopupDataArray);for(const r of n)t.has(r.id)==!1&&(r.remove(),this.mapPopupDataMap.delete(r.id),this.mapPopupDataArray.splice(this.mapPopupDataArray.indexOf(r),1));for(const r of e){const i=this.mapPopupDataMap.get(r.data.id);if(i)i.update(r);else{const o=new hn(r);o.create(this.mapMarkerCallback),this.mapPopupDataMap.set(r.data.id,o),this.mapPopupDataArray.push(o)}}this.mapPopupDataArray.sort((r,i)=>r.zoom-i.zoom)}catch(t){throw console.error(t),this.mapPopupDataArray.length=0,this.mapPopupDataMap.clear(),t}finally{this.mapPopupDataUpdating=!1}}removePopupData(){try{this.mapPopupDataUpdating=!0,this.mapPopupDataArray.forEach(e=>e.remove()),this.mapPopupDataArray.length=0,this.mapPopupDataMap.clear()}catch(e){throw console.error(e),this.mapPopupDataArray.forEach(t=>t.remove()),this.mapPopupDataArray.length=0,this.mapPopupDataMap.clear(),e}finally{this.mapPopupDataUpdating=!1}}togglePopupData(e){e.forEach(t=>{const n=this.mapPopupDataMap.get(t.id);n&&(n.supressed=!t.toggled)})}}class mn{constructor(e){v(this,"id");v(this,"lat");v(this,"lng");v(this,"zoom");v(this,"element");v(this,"component");v(this,"libreMarker");this.id=e.data.id,this.lat=e.data.lat,this.lng=e.data.lng,this.zoom=e.state[0]}create(e){this.createElement(),this.createLibreMarker(e),this.updateZIndex()}createElement(){throw new Error("Create element not implemented")}createLibreMarker(e){const t=this.element;if(!t)throw new Error("Failed to create libre marker");const n=e({element:t});n.setLngLat([this.lng,this.lat]),this.libreMarker=n}update(e){this.zoom=e.state[0],this.updateZIndex()}updateZIndex(){throw new Error("Update z-index not implemented")}updateMap(e){const t=this.libreMarker,n=this.component;if(t==null||n==null)throw new Error("Failed to update popup map");e?t._map!=e&&t.addTo(e):t._map!=null&&t.remove()}isInBlock(e,t){return this.zoom<=e&&t.contains(this.lat,this.lng)}remove(){var e,t;(e=this.libreMarker)==null||e.remove(),(t=this.element)==null||t.remove()}}class Ai extends mn{constructor(t){super(t);v(this,"pinLoading",!1);v(this,"pinLoaded",!1);v(this,"pinCallback");this.pinCallback=t.callbacks.pin}createElement(){this.element=document.createElement("div"),this.element.classList.add("circle"),this.component=pt(qr,{target:this.element,props:{id:this.id+"_circle",priority:this.zoom*mt}})}updateZIndex(){const t=this.element;if(!t)return;const n=Math.round((Wa-this.zoom)*mt);t.style.zIndex=n.toString()}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t!=null)}updateState(t){const n=this.component;if(!n)throw new Error("Failed to update circle state");n.setScale(this.getScale(t))}updatePin(){var n;if(this.pinCallback==null||this.pinLoaded||this.pinLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.pinLoading=!0,this.pinCallback(this.id).then(r=>{t.appendChild(r),this.pinLoaded=!0,this.pinLoading=!1}))}setExpanded(){if(this.component==null)throw new Error("Failed to set circle expanded");this.component.setScale(1)}setCollapsed(){if(this.component==null)throw new Error("Failed to set circle collapsed");this.component.setScale(0)}getScale(t){return this.zoom<t?1:Math.max(0,1-(this.zoom-t)*.125)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isPinLoaded(){return this.pinCallback==null||this.pinLoaded}}class Ei extends mn{constructor(t){super(t);v(this,"width");v(this,"height");v(this,"states");v(this,"bodyLoading",!1);v(this,"bodyLoaded",!1);v(this,"bodyCallback");this.id=t.data.id,this.width=t.data.width,this.height=t.data.height,this.states=t.state[1].map(n=>[n[0],ht.DEGREES[n[1]]]),this.bodyCallback=t.callbacks.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("marker"),this.component=pt(Br,{target:this.element,props:{id:this.id+"_marker",priority:this.zoom*mt,width:this.width,height:this.height}})}update(t){super.update(t),this.states=t.state[1].map(n=>[n[0],ht.DEGREES[n[1]]])}updateZIndex(){const t=this.element;if(!t)return;const n=Math.round((Wa-this.zoom)*mt)+Dr;t.style.zIndex=n.toString()}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t!=null)}updateState(t){const n=this.component;if(!n)throw new Error("Failed to update marker state");n.setAngle(this.getAngle(t))}updateBody(){var n;if(this.bodyLoaded||this.bodyLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(r=>{t.appendChild(r),this.bodyLoading=!1,this.bodyLoaded=!0}))}getAngle(t){const n=this.states.findLast(r=>r[0]<=t);if(!n)throw new Error("Angle not found");return n[1]}setCollapsed(t){if(this.component==null)throw new Error("Failed to set marker collapsed");this.component.setCollapsed(t)}isExpanded(){return this.component?this.component.getExpanded():!1}isCollapsed(){return this.component?this.component.getCollapsed():!1}isBodyLoaded(){return this.bodyLoaded}}class hn{constructor(e){v(this,"id");v(this,"rank");v(this,"lat");v(this,"lng");v(this,"zoom");v(this,"supressed");v(this,"circle");v(this,"marker");this.id=e.data.id,this.rank=e.data.rank,this.lat=e.data.lat,this.lng=e.data.lng,this.zoom=e.state[0],this.supressed=!1,this.circle=new Ai(e),this.marker=new Ei(e)}create(e){this.circle.create(e),this.marker.create(e)}update(e){this.circle.update(e),this.marker.update(e)}remove(){this.circle.remove(),this.marker.remove()}}const Mi={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}}]},Ni={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}}]};S.MapDarkStyle=Mi,S.MapPopupManager=Ci,S.MapStyleLight=Ni,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});