From fdb8a456c2bfbf393a5ba30a4574474ed32ddd5c Mon Sep 17 00:00:00 2001 From: dabreegster Date: Tue, 24 Dec 2024 10:45:54 +0000 Subject: [PATCH] deploy: ba789f3345564436312a5d09b56ebebad499763e --- assets/{main-16a58422.js => main-a8e3cff7.js} | 62 +++++++++---------- index.html | 2 +- 2 files changed, 32 insertions(+), 32 deletions(-) rename assets/{main-16a58422.js => main-a8e3cff7.js} (88%) diff --git a/assets/main-16a58422.js b/assets/main-a8e3cff7.js similarity index 88% rename from assets/main-16a58422.js rename to assets/main-a8e3cff7.js index 15fc7e4..9f6f159 100644 --- a/assets/main-16a58422.js +++ b/assets/main-a8e3cff7.js @@ -1,9 +1,9 @@ -var zS=Object.defineProperty;var DS=(r,e,t)=>e in r?zS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Wn=(r,e,t)=>(DS(r,typeof e!="symbol"?e+"":e,t),t);function RS(r,e){for(var t=0;tn[l]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))n(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&n(d)}).observe(document,{childList:!0,subtree:!0});function t(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function n(l){if(l.ep)return;l.ep=!0;const u=t(l);fetch(l.href,u)}})();function Mt(){}function Rn(r,e){for(const t in e)r[t]=e[t];return r}function Sb(r){return r()}function Ry(){return Object.create(null)}function _n(r){r.forEach(Sb)}function wc(r){return typeof r=="function"}function Ut(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}let Df;function En(r,e){return r===e?!0:(Df||(Df=document.createElement("a")),Df.href=e,r===Df.href)}function BS(r){return Object.keys(r).length===0}function kb(r,...e){if(r==null){for(const n of e)n(void 0);return Mt}const t=r.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function Hi(r){let e;return kb(r,t=>e=t)(),e}function wt(r,e,t){r.$$.on_destroy.push(kb(e,t))}function Vr(r,e,t,n){if(r){const l=Tb(r,e,t,n);return r[0](l)}}function Tb(r,e,t,n){return r[1]&&n?Rn(t.ctx.slice(),r[1](n(e))):t.ctx}function qr(r,e,t,n){if(r[2]&&n){const l=r[2](n(t));if(e.dirty===void 0)return l;if(typeof l=="object"){const u=[],d=Math.max(e.dirty.length,l.length);for(let a=0;a32){const e=[],t=r.ctx.length/32;for(let n=0;nr.removeEventListener(e,t,n)}function vg(r){return function(e){return e.preventDefault(),r.call(this,e)}}function Kp(r){return function(e){return e.stopPropagation(),r.call(this,e)}}function Ee(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function Eb(r){let e;return{p(...t){e=t,e.forEach(n=>r.push(n))},r(){e.forEach(t=>r.splice(r.indexOf(t),1))}}}function bg(r){return r===""?null:+r}function OS(r){return Array.from(r.childNodes)}function Ar(r,e){e=""+e,r.data!==e&&(r.data=e)}function ei(r,e){r.value=e??""}function fn(r,e,t,n){t==null?r.style.removeProperty(e):r.style.setProperty(e,t,n?"important":"")}function sd(r,e,t){for(let n=0;n{const l=r.$$.callbacks[e];if(l){const u=NS(e,t,{cancelable:n});return l.slice().forEach(d=>{d.call(r,u)}),!u.defaultPrevented}return!0}}function wg(r,e){return wh().$$.context.set(r,e),e}function Cb(r){return wh().$$.context.get(r)}function ur(r,e){const t=r.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}const hc=[],pn=[];let _c=[];const Cm=[],Ib=Promise.resolve();let Im=!1;function Ab(){Im||(Im=!0,Ib.then(Pb))}function Lb(){return Ab(),Ib}function uh(r){_c.push(r)}function Po(r){Cm.push(r)}const Jp=new Set;let nc=0;function Pb(){if(nc!==0)return;const r=ch;do{try{for(;ncr.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),_c=e}const Vf=new Set;let Ja;function yr(){Ja={r:0,c:[],p:Ja}}function vr(){Ja.r||_n(Ja.c),Ja=Ja.p}function oe(r,e){r&&r.i&&(Vf.delete(r),r.i(e))}function de(r,e,t,n){if(r&&r.o){if(Vf.has(r))return;Vf.add(r),Ja.c.push(()=>{Vf.delete(r),n&&(t&&r.d(1),n())}),r.o(e)}else n&&n()}function Jn(r){return(r==null?void 0:r.length)!==void 0?r:Array.from(r)}function VS(r,e){de(r,1,1,()=>{e.delete(r.key)})}function qS(r,e,t,n,l,u,d,a,_,x,S,k){let C=r.length,P=u.length,D=C;const N={};for(;D--;)N[r[D].key]=D;const z=[],B=new Map,O=new Map,G=[];for(D=P;D--;){const X=k(l,u,D),Y=t(X);let _e=d.get(Y);_e?n&&G.push(()=>_e.p(X,e)):(_e=x(Y,X),_e.c()),B.set(Y,z[D]=_e),Y in N&&O.set(Y,Math.abs(D-N[Y]))}const U=new Set,K=new Set;function me(X){oe(X,1),X.m(a,S),d.set(X.key,X),S=X.first,P--}for(;C&&P;){const X=z[P-1],Y=r[C-1],_e=X.key,ze=Y.key;X===Y?(S=X.first,C--,P--):B.has(ze)?!d.has(_e)||U.has(_e)?me(X):K.has(ze)?C--:O.get(_e)>O.get(ze)?(K.add(_e),me(X)):(U.add(ze),C--):(_(Y,d),C--)}for(;C--;){const X=r[C];B.has(X.key)||_(X,d)}for(;P;)me(z[P-1]);return _n(G),z}function Am(r,e){const t={},n={},l={$$scope:1};let u=r.length;for(;u--;){const d=r[u],a=e[u];if(a){for(const _ in d)_ in a||(n[_]=1);for(const _ in a)l[_]||(t[_]=a[_],l[_]=1);r[u]=a}else for(const _ in d)l[_]=1}for(const d in n)d in t||(t[d]=void 0);return t}function zo(r,e,t){const n=r.$$.props[e];n!==void 0&&(r.$$.bound[n]=t,t(r.$$.ctx[n]))}function je(r){r&&r.c()}function Oe(r,e,t){const{fragment:n,after_update:l}=r.$$;n&&n.m(e,t),uh(()=>{const u=r.$$.on_mount.map(Sb).filter(wc);r.$$.on_destroy?r.$$.on_destroy.push(...u):_n(u),r.$$.on_mount=[]}),l.forEach(uh)}function Ne(r,e){const t=r.$$;t.fragment!==null&&(US(t.after_update),_n(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function GS(r,e){r.$$.dirty[0]===-1&&(hc.push(r),Ab(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<{const D=P.length?P[0]:C;return x.ctx&&l(x.ctx[k],x.ctx[k]=D)&&(!x.skip_bound&&x.bound[k]&&x.bound[k](D),S&&GS(r,k)),C}):[],x.update(),S=!0,_n(x.before_update),x.fragment=n?n(x.ctx):!1,e.target){if(e.hydrate){const k=OS(e.target);x.fragment&&x.fragment.l(k),k.forEach(ve)}else x.fragment&&x.fragment.c();e.intro&&oe(r.$$.fragment),Oe(r,e.target,e.anchor),Pb()}th(_)}class Ht{constructor(){Wn(this,"$$");Wn(this,"$$set")}$destroy(){Ne(this,1),this.$destroy=Mt}$on(e,t){if(!wc(t))return Mt;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const l=n.indexOf(t);l!==-1&&n.splice(l,1)}}$set(e){this.$$set&&!BS(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const WS="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(WS);function By(r){let e,t;return{c(){e=fe("div"),t=rt(r[0]),Ee(e,"class","svelte-1uuov7f")},m(n,l){be(n,e,l),ie(e,t)},p(n,l){l&1&&Ar(t,n[0])},d(n){n&&ve(e)}}}function ZS(r){let e,t=r[0]&&By(r);return{c(){t&&t.c(),e=$n()},m(n,l){t&&t.m(n,l),be(n,e,l)},p(n,[l]){n[0]?t?t.p(n,l):(t=By(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:Mt,o:Mt,d(n){n&&ve(e),t&&t.d(n)}}}function HS(r,e,t){let{loading:n}=e;return r.$$set=l=>{"loading"in l&&t(0,n=l.loading)},[n]}class zb extends Ht{constructor(e){super(),Zt(this,e,HS,ZS,Ut,{loading:0})}}const $S=r=>({dialog:r&1}),Fy=r=>({dialog:r[0]});function XS(r){let e,t,n,l,u;const d=r[4].default,a=Vr(d,r,r[3],Fy);return{c(){e=fe("dialog"),t=fe("article"),a&&a.c(),e.open=!0},m(_,x){be(_,e,x),ie(e,t),a&&a.m(t,null),r[6](e),n=!0,l||(u=[Tt(window,"click",r[1]),Tt(window,"keydown",r[2]),Tt(e,"close",r[5])],l=!0)},p(_,[x]){a&&a.p&&(!n||x&9)&&Gr(a,d,_,_[3],n?qr(d,_[3],x,$S):Wr(_[3]),Fy)},i(_){n||(oe(a,_),n=!0)},o(_){de(a,_),n=!1},d(_){_&&ve(e),a&&a.d(_),r[6](null),l=!1,_n(u)}}}function KS(r,e,t){let{$$slots:n={},$$scope:l}=e,u;function d(S){u.open&&S.target==u&&u.close()}function a(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),u.close())}function _(S){ur.call(this,r,S)}function x(S){pn[S?"unshift":"push"](()=>{u=S,t(0,u)})}return r.$$set=S=>{"$$scope"in S&&t(3,l=S.$$scope)},[u,d,a,l,n,_,x]}class Pd extends Ht{constructor(e){super(),Zt(this,e,KS,XS,Ut,{})}}function Oy(r,e,t){const n=r.slice();return n[1]=e[t][0],n[2]=e[t][1],n}function Ny(r){let e,t,n=r[1]+"",l,u,d,a=r[2]+"",_,x;return{c(){e=fe("tr"),t=fe("td"),l=rt(n),u=Ve(),d=fe("td"),_=rt(a),x=Ve()},m(S,k){be(S,e,k),ie(e,t),ie(t,l),ie(e,u),ie(e,d),ie(d,_),ie(e,x)},p(S,k){k&1&&n!==(n=S[1]+"")&&Ar(l,n),k&1&&a!==(a=S[2]+"")&&Ar(_,a)},d(S){S&&ve(e)}}}function JS(r){let e,t,n=Jn(Object.entries(r[0])),l=[];for(let u=0;u{"properties"in l&&t(0,n=l.properties)},[n]}class zd extends Ht{constructor(e){super(),Zt(this,e,YS,JS,Ut,{properties:0})}}function ad(r,e){let t=document.createElement("a");t.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e)),t.setAttribute("download",r),document.body.appendChild(t),t.click(),document.body.removeChild(t)}function dn(r){if(r==null||r==null)throw new Error("Oops, notNull given something null");return r}let ht;const Db=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Db.decode();let Hu=null;function yc(){return(Hu===null||Hu.byteLength===0)&&(Hu=new Uint8Array(ht.memory.buffer)),Hu}function Qi(r,e){return r=r>>>0,Db.decode(yc().subarray(r,r+e))}const Is=new Array(128).fill(void 0);Is.push(void 0,null,!0,!1);let rh=Is.length;function Ur(r){rh===Is.length&&Is.push(Is.length+1);const e=rh;return rh=Is[e],Is[e]=r,e}function hr(r){return Is[r]}function QS(r){r<132||(Is[r]=rh,rh=r)}function Ai(r){const e=hr(r);return QS(r),e}let Wi=0;const qf=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},e4=typeof qf.encodeInto=="function"?function(r,e){return qf.encodeInto(r,e)}:function(r,e){const t=qf.encode(r);return e.set(t),{read:r.length,written:t.length}};function Go(r,e,t){if(t===void 0){const a=qf.encode(r),_=e(a.length,1)>>>0;return yc().subarray(_,_+a.length).set(a),Wi=a.length,_}let n=r.length,l=e(n,1)>>>0;const u=yc();let d=0;for(;d127)break;u[l+d]=a}if(d!==n){d!==0&&(r=r.slice(d)),l=t(l,n,n=d+r.length*3,1)>>>0;const a=yc().subarray(l+d,l+n),_=e4(r,a);d+=_.written}return Wi=d,l}function fc(r){return r==null}let $u=null;function Wt(){return($u===null||$u.byteLength===0)&&($u=new Int32Array(ht.memory.buffer)),$u}let Xu=null;function Rb(){return(Xu===null||Xu.byteLength===0)&&(Xu=new Float64Array(ht.memory.buffer)),Xu}let Ku=null;function t4(){return(Ku===null||Ku.byteLength===0)&&(Ku=new BigInt64Array(ht.memory.buffer)),Ku}function Lm(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const l=r.description;return l==null?"Symbol":`Symbol(${l})`}if(e=="function"){const l=r.name;return typeof l=="string"&&l.length>0?`Function(${l})`:"Function"}if(Array.isArray(r)){const l=r.length;let u="[";l>0&&(u+=Lm(r[0]));for(let d=1;d1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message} -${r.stack}`:n}function r4(r,e){const t=e(r.length*1,1)>>>0;return yc().set(r,t/1),Wi=r.length,t}function n4(r,e){return r=r>>>0,Rb().subarray(r/8,r/8+e)}function i4(r,e){return r=r>>>0,yc().subarray(r/1,r/1+e)}function Ka(r,e){try{return r.apply(this,e)}catch(t){ht.__wbindgen_exn_store(Ur(t))}}class Bb{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();ht.__wbg_ltn_free(e)}constructor(e,t,n){try{const x=ht.__wbindgen_add_to_stack_pointer(-16),S=r4(e,ht.__wbindgen_malloc),k=Wi;var l=fc(n)?0:Go(n,ht.__wbindgen_malloc,ht.__wbindgen_realloc),u=Wi;ht.ltn_new(x,S,k,Ur(t),l,u);var d=Wt()[x/4+0],a=Wt()[x/4+1],_=Wt()[x/4+2];if(_)throw Ai(a);return this.__wbg_ptr=d>>>0,this}finally{ht.__wbindgen_add_to_stack_pointer(16)}}getInvertedBoundary(){let e,t;try{const x=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_getInvertedBoundary(x,this.__wbg_ptr);var n=Wt()[x/4+0],l=Wt()[x/4+1],u=Wt()[x/4+2],d=Wt()[x/4+3],a=n,_=l;if(d)throw a=0,_=0,Ai(u);return e=a,t=_,Qi(a,_)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(e,t,1)}}getBounds(){try{const l=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_getBounds(l,this.__wbg_ptr);var e=Wt()[l/4+0],t=Wt()[l/4+1],n=n4(e,t).slice();return ht.__wbindgen_free(e,t*8,8),n}finally{ht.__wbindgen_add_to_stack_pointer(16)}}toRouteSnapper(){try{const l=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_toRouteSnapper(l,this.__wbg_ptr);var e=Wt()[l/4+0],t=Wt()[l/4+1],n=i4(e,t).slice();return ht.__wbindgen_free(e,t*1,1),n}finally{ht.__wbindgen_add_to_stack_pointer(16)}}toRouteSnapperGj(){let e,t;try{const x=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_toRouteSnapperGj(x,this.__wbg_ptr);var n=Wt()[x/4+0],l=Wt()[x/4+1],u=Wt()[x/4+2],d=Wt()[x/4+3],a=n,_=l;if(d)throw a=0,_=0,Ai(u);return e=a,t=_,Qi(a,_)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(e,t,1)}}renderModalFilters(){let e,t;try{const x=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_renderModalFilters(x,this.__wbg_ptr);var n=Wt()[x/4+0],l=Wt()[x/4+1],u=Wt()[x/4+2],d=Wt()[x/4+3],a=n,_=l;if(d)throw a=0,_=0,Ai(u);return e=a,t=_,Qi(a,_)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(e,t,1)}}renderNeighbourhood(){let e,t;try{const x=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_renderNeighbourhood(x,this.__wbg_ptr);var n=Wt()[x/4+0],l=Wt()[x/4+1],u=Wt()[x/4+2],d=Wt()[x/4+3],a=n,_=l;if(d)throw a=0,_=0,Ai(u);return e=a,t=_,Qi(a,_)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(e,t,1)}}renderAutoBoundaries(){let e,t;try{const x=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_renderAutoBoundaries(x,this.__wbg_ptr);var n=Wt()[x/4+0],l=Wt()[x/4+1],u=Wt()[x/4+2],d=Wt()[x/4+3],a=n,_=l;if(d)throw a=0,_=0,Ai(u);return e=a,t=_,Qi(a,_)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(e,t,1)}}setNeighbourhoodBoundary(e,t){try{const u=ht.__wbindgen_add_to_stack_pointer(-16),d=Go(e,ht.__wbindgen_malloc,ht.__wbindgen_realloc),a=Wi;ht.ltn_setNeighbourhoodBoundary(u,this.__wbg_ptr,d,a,Ur(t));var n=Wt()[u/4+0],l=Wt()[u/4+1];if(l)throw Ai(n)}finally{ht.__wbindgen_add_to_stack_pointer(16)}}deleteNeighbourhoodBoundary(e){const t=Go(e,ht.__wbindgen_malloc,ht.__wbindgen_realloc),n=Wi;ht.ltn_deleteNeighbourhoodBoundary(this.__wbg_ptr,t,n)}renameNeighbourhoodBoundary(e,t){const n=Go(e,ht.__wbindgen_malloc,ht.__wbindgen_realloc),l=Wi,u=Go(t,ht.__wbindgen_malloc,ht.__wbindgen_realloc),d=Wi;ht.ltn_renameNeighbourhoodBoundary(this.__wbg_ptr,n,l,u,d)}setCurrentNeighbourhood(e){try{const l=ht.__wbindgen_add_to_stack_pointer(-16),u=Go(e,ht.__wbindgen_malloc,ht.__wbindgen_realloc),d=Wi;ht.ltn_setCurrentNeighbourhood(l,this.__wbg_ptr,u,d);var t=Wt()[l/4+0],n=Wt()[l/4+1];if(n)throw Ai(t)}finally{ht.__wbindgen_add_to_stack_pointer(16)}}addModalFilter(e,t){try{const u=ht.__wbindgen_add_to_stack_pointer(-16),d=Go(t,ht.__wbindgen_malloc,ht.__wbindgen_realloc),a=Wi;ht.ltn_addModalFilter(u,this.__wbg_ptr,Ur(e),d,a);var n=Wt()[u/4+0],l=Wt()[u/4+1];if(l)throw Ai(n)}finally{ht.__wbindgen_add_to_stack_pointer(16)}}addManyModalFilters(e,t){try{const u=ht.__wbindgen_add_to_stack_pointer(-16),d=Go(t,ht.__wbindgen_malloc,ht.__wbindgen_realloc),a=Wi;ht.ltn_addManyModalFilters(u,this.__wbg_ptr,Ur(e),d,a);var n=Wt()[u/4+0],l=Wt()[u/4+1];if(l)throw Ai(n)}finally{ht.__wbindgen_add_to_stack_pointer(16)}}deleteModalFilter(e){ht.ltn_deleteModalFilter(this.__wbg_ptr,e)}toggleDirection(e){ht.ltn_toggleDirection(this.__wbg_ptr,e)}undo(){ht.ltn_undo(this.__wbg_ptr)}redo(){ht.ltn_redo(this.__wbg_ptr)}getShortcutsCrossingRoad(e){let t,n;try{const S=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_getShortcutsCrossingRoad(S,this.__wbg_ptr,e);var l=Wt()[S/4+0],u=Wt()[S/4+1],d=Wt()[S/4+2],a=Wt()[S/4+3],_=l,x=u;if(a)throw _=0,x=0,Ai(d);return t=_,n=x,Qi(_,x)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(t,n,1)}}getAllShortcuts(){let e,t;try{const x=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_getAllShortcuts(x,this.__wbg_ptr);var n=Wt()[x/4+0],l=Wt()[x/4+1],u=Wt()[x/4+2],d=Wt()[x/4+3],a=n,_=l;if(d)throw a=0,_=0,Ai(u);return e=a,t=_,Qi(a,_)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(e,t,1)}}toSavefile(){let e,t;try{const x=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_toSavefile(x,this.__wbg_ptr);var n=Wt()[x/4+0],l=Wt()[x/4+1],u=Wt()[x/4+2],d=Wt()[x/4+3],a=n,_=l;if(d)throw a=0,_=0,Ai(u);return e=a,t=_,Qi(a,_)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(e,t,1)}}loadSavefile(e){try{const l=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_loadSavefile(l,this.__wbg_ptr,Ur(e));var t=Wt()[l/4+0],n=Wt()[l/4+1];if(n)throw Ai(t)}finally{ht.__wbindgen_add_to_stack_pointer(16)}}compareRoute(e,t,n,l,u){let d,a;try{const D=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_compareRoute(D,this.__wbg_ptr,e,t,n,l,u);var _=Wt()[D/4+0],x=Wt()[D/4+1],S=Wt()[D/4+2],k=Wt()[D/4+3],C=_,P=x;if(k)throw C=0,P=0,Ai(S);return d=C,a=P,Qi(C,P)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(d,a,1)}}}async function o4(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(n){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}const t=await r.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{const t=await WebAssembly.instantiate(r,e);return t instanceof WebAssembly.Instance?{instance:t,module:r}:t}}function s4(){const r={};return r.wbg={},r.wbg.__wbindgen_error_new=function(e,t){const n=new Error(Qi(e,t));return Ur(n)},r.wbg.__wbindgen_string_new=function(e,t){const n=Qi(e,t);return Ur(n)},r.wbg.__wbindgen_object_drop_ref=function(e){Ai(e)},r.wbg.__wbindgen_string_get=function(e,t){const n=hr(t),l=typeof n=="string"?n:void 0;var u=fc(l)?0:Go(l,ht.__wbindgen_malloc,ht.__wbindgen_realloc),d=Wi;Wt()[e/4+1]=d,Wt()[e/4+0]=u},r.wbg.__wbindgen_boolean_get=function(e){const t=hr(e);return typeof t=="boolean"?t?1:0:2},r.wbg.__wbindgen_is_bigint=function(e){return typeof hr(e)=="bigint"},r.wbg.__wbindgen_number_get=function(e,t){const n=hr(t),l=typeof n=="number"?n:void 0;Rb()[e/8+1]=fc(l)?0:l,Wt()[e/4+0]=!fc(l)},r.wbg.__wbindgen_is_object=function(e){const t=hr(e);return typeof t=="object"&&t!==null},r.wbg.__wbindgen_in=function(e,t){return hr(e)in hr(t)},r.wbg.__wbindgen_bigint_from_i64=function(e){return Ur(e)},r.wbg.__wbindgen_jsval_eq=function(e,t){return hr(e)===hr(t)},r.wbg.__wbindgen_bigint_from_u64=function(e){const t=BigInt.asUintN(64,e);return Ur(t)},r.wbg.__wbindgen_is_undefined=function(e){return hr(e)===void 0},r.wbg.__wbindgen_jsval_loose_eq=function(e,t){return hr(e)==hr(t)},r.wbg.__wbindgen_object_clone_ref=function(e){const t=hr(e);return Ur(t)},r.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(e,t){const n=hr(e)[hr(t)];return Ur(n)},r.wbg.__wbg_debug_34c9290896ec9856=function(e){console.debug(hr(e))},r.wbg.__wbg_error_e60eff06f24ab7a4=function(e){console.error(hr(e))},r.wbg.__wbg_info_d7d58472d0bab115=function(e){console.info(hr(e))},r.wbg.__wbg_log_a4530b4fe289336f=function(e){console.log(hr(e))},r.wbg.__wbg_warn_f260f49434e45e62=function(e){console.warn(hr(e))},r.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return Ur(e)},r.wbg.__wbg_stack_658279fe44541cf6=function(e,t){const n=hr(t).stack,l=Go(n,ht.__wbindgen_malloc,ht.__wbindgen_realloc),u=Wi;Wt()[e/4+1]=u,Wt()[e/4+0]=l},r.wbg.__wbg_error_f851667af71bcfc6=function(e,t){let n,l;try{n=e,l=t,console.error(Qi(e,t))}finally{ht.__wbindgen_free(n,l,1)}},r.wbg.__wbg_performance_3f3012faa4463882=function(e){const t=hr(e).performance;return Ur(t)},r.wbg.__wbg_now_2fd65358804c9485=function(e){return hr(e).now()},r.wbg.__wbg_get_f01601b5a68d10e3=function(e,t){const n=hr(e)[t>>>0];return Ur(n)},r.wbg.__wbg_length_1009b1af0c481d7b=function(e){return hr(e).length},r.wbg.__wbindgen_is_function=function(e){return typeof hr(e)=="function"},r.wbg.__wbg_newnoargs_c62ea9419c21fbac=function(e,t){const n=new Function(Qi(e,t));return Ur(n)},r.wbg.__wbg_next_9b877f231f476d01=function(e){const t=hr(e).next;return Ur(t)},r.wbg.__wbg_next_6529ee0cca8d57ed=function(){return Ka(function(e){const t=hr(e).next();return Ur(t)},arguments)},r.wbg.__wbg_done_5fe336b092d60cf2=function(e){return hr(e).done},r.wbg.__wbg_value_0c248a78fdc8e19f=function(e){const t=hr(e).value;return Ur(t)},r.wbg.__wbg_iterator_db7ca081358d4fb2=function(){return Ur(Symbol.iterator)},r.wbg.__wbg_get_7b48513de5dc5ea4=function(){return Ka(function(e,t){const n=Reflect.get(hr(e),hr(t));return Ur(n)},arguments)},r.wbg.__wbg_call_90c26b09837aba1c=function(){return Ka(function(e,t){const n=hr(e).call(hr(t));return Ur(n)},arguments)},r.wbg.__wbg_self_f0e34d89f33b99fd=function(){return Ka(function(){const e=self.self;return Ur(e)},arguments)},r.wbg.__wbg_window_d3b084224f4774d7=function(){return Ka(function(){const e=window.window;return Ur(e)},arguments)},r.wbg.__wbg_globalThis_9caa27ff917c6860=function(){return Ka(function(){const e=globalThis.globalThis;return Ur(e)},arguments)},r.wbg.__wbg_global_35dfdd59a4da3e74=function(){return Ka(function(){const e=global.global;return Ur(e)},arguments)},r.wbg.__wbg_isArray_74fb723e24f76012=function(e){return Array.isArray(hr(e))},r.wbg.__wbg_instanceof_ArrayBuffer_e7d53d51371448e2=function(e){let t;try{t=hr(e)instanceof ArrayBuffer}catch{t=!1}return t},r.wbg.__wbg_isSafeInteger_f93fde0dca9820f8=function(e){return Number.isSafeInteger(hr(e))},r.wbg.__wbg_entries_9e2e2aa45aa5094a=function(e){const t=Object.entries(hr(e));return Ur(t)},r.wbg.__wbg_buffer_a448f833075b71ba=function(e){const t=hr(e).buffer;return Ur(t)},r.wbg.__wbg_new_8f67e318f15d7254=function(e){const t=new Uint8Array(hr(e));return Ur(t)},r.wbg.__wbg_set_2357bf09366ee480=function(e,t,n){hr(e).set(hr(t),n>>>0)},r.wbg.__wbg_length_1d25fa9e4ac21ce7=function(e){return hr(e).length},r.wbg.__wbg_instanceof_Uint8Array_bced6f43aed8c1aa=function(e){let t;try{t=hr(e)instanceof Uint8Array}catch{t=!1}return t},r.wbg.__wbindgen_bigint_get_as_i64=function(e,t){const n=hr(t),l=typeof n=="bigint"?n:void 0;t4()[e/8+1]=fc(l)?BigInt(0):l,Wt()[e/4+0]=!fc(l)},r.wbg.__wbindgen_debug_string=function(e,t){const n=Lm(hr(t)),l=Go(n,ht.__wbindgen_malloc,ht.__wbindgen_realloc),u=Wi;Wt()[e/4+1]=u,Wt()[e/4+0]=l},r.wbg.__wbindgen_throw=function(e,t){throw new Error(Qi(e,t))},r.wbg.__wbindgen_memory=function(){const e=ht.memory;return Ur(e)},r}function a4(r,e){return ht=r.exports,Fb.__wbindgen_wasm_module=e,Ku=null,Xu=null,$u=null,Hu=null,ht}async function Fb(r){if(ht!==void 0)return ht;typeof r>"u"&&(r="/ltn/assets/backend_bg.wasm");const e=s4();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:t,module:n}=await o4(await r,e);return a4(t,n)}var xh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xg(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Dd(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var l=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,l.get?l:{enumerable:!0,get:function(){return r[n]}})}),t}var Ob={exports:{}};/** +var DS=Object.defineProperty;var RS=(r,e,t)=>e in r?DS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Wn=(r,e,t)=>(RS(r,typeof e!="symbol"?e+"":e,t),t);function BS(r,e){for(var t=0;tn[l]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))n(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&n(d)}).observe(document,{childList:!0,subtree:!0});function t(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function n(l){if(l.ep)return;l.ep=!0;const u=t(l);fetch(l.href,u)}})();function Mt(){}function Rn(r,e){for(const t in e)r[t]=e[t];return r}function kb(r){return r()}function By(){return Object.create(null)}function _n(r){r.forEach(kb)}function wc(r){return typeof r=="function"}function Ut(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}let Df;function En(r,e){return r===e?!0:(Df||(Df=document.createElement("a")),Df.href=e,r===Df.href)}function FS(r){return Object.keys(r).length===0}function Tb(r,...e){if(r==null){for(const n of e)n(void 0);return Mt}const t=r.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function Hi(r){let e;return Tb(r,t=>e=t)(),e}function wt(r,e,t){r.$$.on_destroy.push(Tb(e,t))}function Vr(r,e,t,n){if(r){const l=Eb(r,e,t,n);return r[0](l)}}function Eb(r,e,t,n){return r[1]&&n?Rn(t.ctx.slice(),r[1](n(e))):t.ctx}function qr(r,e,t,n){if(r[2]&&n){const l=r[2](n(t));if(e.dirty===void 0)return l;if(typeof l=="object"){const u=[],d=Math.max(e.dirty.length,l.length);for(let a=0;a32){const e=[],t=r.ctx.length/32;for(let n=0;nr.removeEventListener(e,t,n)}function bg(r){return function(e){return e.preventDefault(),r.call(this,e)}}function Kp(r){return function(e){return e.stopPropagation(),r.call(this,e)}}function Ee(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function Mb(r){let e;return{p(...t){e=t,e.forEach(n=>r.push(n))},r(){e.forEach(t=>r.splice(r.indexOf(t),1))}}}function wg(r){return r===""?null:+r}function NS(r){return Array.from(r.childNodes)}function Ar(r,e){e=""+e,r.data!==e&&(r.data=e)}function ei(r,e){r.value=e??""}function fn(r,e,t,n){t==null?r.style.removeProperty(e):r.style.setProperty(e,t,n?"important":"")}function sd(r,e,t){for(let n=0;n{const l=r.$$.callbacks[e];if(l){const u=jS(e,t,{cancelable:n});return l.slice().forEach(d=>{d.call(r,u)}),!u.defaultPrevented}return!0}}function xg(r,e){return wh().$$.context.set(r,e),e}function Ib(r){return wh().$$.context.get(r)}function ur(r,e){const t=r.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}const hc=[],pn=[];let _c=[];const Cm=[],Ab=Promise.resolve();let Im=!1;function Lb(){Im||(Im=!0,Ab.then(zb))}function Pb(){return Lb(),Ab}function uh(r){_c.push(r)}function Po(r){Cm.push(r)}const Jp=new Set;let nc=0;function zb(){if(nc!==0)return;const r=ch;do{try{for(;ncr.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),_c=e}const Vf=new Set;let Ja;function yr(){Ja={r:0,c:[],p:Ja}}function vr(){Ja.r||_n(Ja.c),Ja=Ja.p}function oe(r,e){r&&r.i&&(Vf.delete(r),r.i(e))}function de(r,e,t,n){if(r&&r.o){if(Vf.has(r))return;Vf.add(r),Ja.c.push(()=>{Vf.delete(r),n&&(t&&r.d(1),n())}),r.o(e)}else n&&n()}function Jn(r){return(r==null?void 0:r.length)!==void 0?r:Array.from(r)}function qS(r,e){de(r,1,1,()=>{e.delete(r.key)})}function GS(r,e,t,n,l,u,d,a,_,x,S,k){let C=r.length,P=u.length,D=C;const N={};for(;D--;)N[r[D].key]=D;const z=[],B=new Map,O=new Map,G=[];for(D=P;D--;){const X=k(l,u,D),Y=t(X);let _e=d.get(Y);_e?n&&G.push(()=>_e.p(X,e)):(_e=x(Y,X),_e.c()),B.set(Y,z[D]=_e),Y in N&&O.set(Y,Math.abs(D-N[Y]))}const U=new Set,K=new Set;function me(X){oe(X,1),X.m(a,S),d.set(X.key,X),S=X.first,P--}for(;C&&P;){const X=z[P-1],Y=r[C-1],_e=X.key,ze=Y.key;X===Y?(S=X.first,C--,P--):B.has(ze)?!d.has(_e)||U.has(_e)?me(X):K.has(ze)?C--:O.get(_e)>O.get(ze)?(K.add(_e),me(X)):(U.add(ze),C--):(_(Y,d),C--)}for(;C--;){const X=r[C];B.has(X.key)||_(X,d)}for(;P;)me(z[P-1]);return _n(G),z}function Am(r,e){const t={},n={},l={$$scope:1};let u=r.length;for(;u--;){const d=r[u],a=e[u];if(a){for(const _ in d)_ in a||(n[_]=1);for(const _ in a)l[_]||(t[_]=a[_],l[_]=1);r[u]=a}else for(const _ in d)l[_]=1}for(const d in n)d in t||(t[d]=void 0);return t}function zo(r,e,t){const n=r.$$.props[e];n!==void 0&&(r.$$.bound[n]=t,t(r.$$.ctx[n]))}function je(r){r&&r.c()}function Oe(r,e,t){const{fragment:n,after_update:l}=r.$$;n&&n.m(e,t),uh(()=>{const u=r.$$.on_mount.map(kb).filter(wc);r.$$.on_destroy?r.$$.on_destroy.push(...u):_n(u),r.$$.on_mount=[]}),l.forEach(uh)}function Ne(r,e){const t=r.$$;t.fragment!==null&&(VS(t.after_update),_n(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function WS(r,e){r.$$.dirty[0]===-1&&(hc.push(r),Lb(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<{const D=P.length?P[0]:C;return x.ctx&&l(x.ctx[k],x.ctx[k]=D)&&(!x.skip_bound&&x.bound[k]&&x.bound[k](D),S&&WS(r,k)),C}):[],x.update(),S=!0,_n(x.before_update),x.fragment=n?n(x.ctx):!1,e.target){if(e.hydrate){const k=NS(e.target);x.fragment&&x.fragment.l(k),k.forEach(ve)}else x.fragment&&x.fragment.c();e.intro&&oe(r.$$.fragment),Oe(r,e.target,e.anchor),zb()}th(_)}class Ht{constructor(){Wn(this,"$$");Wn(this,"$$set")}$destroy(){Ne(this,1),this.$destroy=Mt}$on(e,t){if(!wc(t))return Mt;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const l=n.indexOf(t);l!==-1&&n.splice(l,1)}}$set(e){this.$$set&&!FS(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const ZS="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(ZS);function Fy(r){let e,t;return{c(){e=fe("div"),t=rt(r[0]),Ee(e,"class","svelte-1uuov7f")},m(n,l){be(n,e,l),ie(e,t)},p(n,l){l&1&&Ar(t,n[0])},d(n){n&&ve(e)}}}function HS(r){let e,t=r[0]&&Fy(r);return{c(){t&&t.c(),e=$n()},m(n,l){t&&t.m(n,l),be(n,e,l)},p(n,[l]){n[0]?t?t.p(n,l):(t=Fy(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:Mt,o:Mt,d(n){n&&ve(e),t&&t.d(n)}}}function $S(r,e,t){let{loading:n}=e;return r.$$set=l=>{"loading"in l&&t(0,n=l.loading)},[n]}class Db extends Ht{constructor(e){super(),Zt(this,e,$S,HS,Ut,{loading:0})}}const XS=r=>({dialog:r&1}),Oy=r=>({dialog:r[0]});function KS(r){let e,t,n,l,u;const d=r[4].default,a=Vr(d,r,r[3],Oy);return{c(){e=fe("dialog"),t=fe("article"),a&&a.c(),e.open=!0},m(_,x){be(_,e,x),ie(e,t),a&&a.m(t,null),r[6](e),n=!0,l||(u=[Tt(window,"click",r[1]),Tt(window,"keydown",r[2]),Tt(e,"close",r[5])],l=!0)},p(_,[x]){a&&a.p&&(!n||x&9)&&Gr(a,d,_,_[3],n?qr(d,_[3],x,XS):Wr(_[3]),Oy)},i(_){n||(oe(a,_),n=!0)},o(_){de(a,_),n=!1},d(_){_&&ve(e),a&&a.d(_),r[6](null),l=!1,_n(u)}}}function JS(r,e,t){let{$$slots:n={},$$scope:l}=e,u;function d(S){u.open&&S.target==u&&u.close()}function a(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),u.close())}function _(S){ur.call(this,r,S)}function x(S){pn[S?"unshift":"push"](()=>{u=S,t(0,u)})}return r.$$set=S=>{"$$scope"in S&&t(3,l=S.$$scope)},[u,d,a,l,n,_,x]}class Pd extends Ht{constructor(e){super(),Zt(this,e,JS,KS,Ut,{})}}function Ny(r,e,t){const n=r.slice();return n[1]=e[t][0],n[2]=e[t][1],n}function jy(r){let e,t,n=r[1]+"",l,u,d,a=r[2]+"",_,x;return{c(){e=fe("tr"),t=fe("td"),l=rt(n),u=Ve(),d=fe("td"),_=rt(a),x=Ve()},m(S,k){be(S,e,k),ie(e,t),ie(t,l),ie(e,u),ie(e,d),ie(d,_),ie(e,x)},p(S,k){k&1&&n!==(n=S[1]+"")&&Ar(l,n),k&1&&a!==(a=S[2]+"")&&Ar(_,a)},d(S){S&&ve(e)}}}function YS(r){let e,t,n=Jn(Object.entries(r[0])),l=[];for(let u=0;u{"properties"in l&&t(0,n=l.properties)},[n]}class zd extends Ht{constructor(e){super(),Zt(this,e,QS,YS,Ut,{properties:0})}}function ad(r,e){let t=document.createElement("a");t.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e)),t.setAttribute("download",r),document.body.appendChild(t),t.click(),document.body.removeChild(t)}function dn(r){if(r==null||r==null)throw new Error("Oops, notNull given something null");return r}let ht;const Rb=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Rb.decode();let Hu=null;function yc(){return(Hu===null||Hu.byteLength===0)&&(Hu=new Uint8Array(ht.memory.buffer)),Hu}function Qi(r,e){return r=r>>>0,Rb.decode(yc().subarray(r,r+e))}const Is=new Array(128).fill(void 0);Is.push(void 0,null,!0,!1);let rh=Is.length;function Ur(r){rh===Is.length&&Is.push(Is.length+1);const e=rh;return rh=Is[e],Is[e]=r,e}function hr(r){return Is[r]}function e4(r){r<132||(Is[r]=rh,rh=r)}function Ai(r){const e=hr(r);return e4(r),e}let Wi=0;const qf=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},t4=typeof qf.encodeInto=="function"?function(r,e){return qf.encodeInto(r,e)}:function(r,e){const t=qf.encode(r);return e.set(t),{read:r.length,written:t.length}};function Go(r,e,t){if(t===void 0){const a=qf.encode(r),_=e(a.length,1)>>>0;return yc().subarray(_,_+a.length).set(a),Wi=a.length,_}let n=r.length,l=e(n,1)>>>0;const u=yc();let d=0;for(;d127)break;u[l+d]=a}if(d!==n){d!==0&&(r=r.slice(d)),l=t(l,n,n=d+r.length*3,1)>>>0;const a=yc().subarray(l+d,l+n),_=t4(r,a);d+=_.written}return Wi=d,l}function fc(r){return r==null}let $u=null;function Wt(){return($u===null||$u.byteLength===0)&&($u=new Int32Array(ht.memory.buffer)),$u}let Xu=null;function Bb(){return(Xu===null||Xu.byteLength===0)&&(Xu=new Float64Array(ht.memory.buffer)),Xu}let Ku=null;function r4(){return(Ku===null||Ku.byteLength===0)&&(Ku=new BigInt64Array(ht.memory.buffer)),Ku}function Lm(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const l=r.description;return l==null?"Symbol":`Symbol(${l})`}if(e=="function"){const l=r.name;return typeof l=="string"&&l.length>0?`Function(${l})`:"Function"}if(Array.isArray(r)){const l=r.length;let u="[";l>0&&(u+=Lm(r[0]));for(let d=1;d1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message} +${r.stack}`:n}function n4(r,e){const t=e(r.length*1,1)>>>0;return yc().set(r,t/1),Wi=r.length,t}function i4(r,e){return r=r>>>0,Bb().subarray(r/8,r/8+e)}function o4(r,e){return r=r>>>0,yc().subarray(r/1,r/1+e)}function Ka(r,e){try{return r.apply(this,e)}catch(t){ht.__wbindgen_exn_store(Ur(t))}}class Fb{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();ht.__wbg_ltn_free(e)}constructor(e,t,n){try{const x=ht.__wbindgen_add_to_stack_pointer(-16),S=n4(e,ht.__wbindgen_malloc),k=Wi;var l=fc(n)?0:Go(n,ht.__wbindgen_malloc,ht.__wbindgen_realloc),u=Wi;ht.ltn_new(x,S,k,Ur(t),l,u);var d=Wt()[x/4+0],a=Wt()[x/4+1],_=Wt()[x/4+2];if(_)throw Ai(a);return this.__wbg_ptr=d>>>0,this}finally{ht.__wbindgen_add_to_stack_pointer(16)}}getInvertedBoundary(){let e,t;try{const x=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_getInvertedBoundary(x,this.__wbg_ptr);var n=Wt()[x/4+0],l=Wt()[x/4+1],u=Wt()[x/4+2],d=Wt()[x/4+3],a=n,_=l;if(d)throw a=0,_=0,Ai(u);return e=a,t=_,Qi(a,_)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(e,t,1)}}getBounds(){try{const l=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_getBounds(l,this.__wbg_ptr);var e=Wt()[l/4+0],t=Wt()[l/4+1],n=i4(e,t).slice();return ht.__wbindgen_free(e,t*8,8),n}finally{ht.__wbindgen_add_to_stack_pointer(16)}}toRouteSnapper(){try{const l=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_toRouteSnapper(l,this.__wbg_ptr);var e=Wt()[l/4+0],t=Wt()[l/4+1],n=o4(e,t).slice();return ht.__wbindgen_free(e,t*1,1),n}finally{ht.__wbindgen_add_to_stack_pointer(16)}}toRouteSnapperGj(){let e,t;try{const x=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_toRouteSnapperGj(x,this.__wbg_ptr);var n=Wt()[x/4+0],l=Wt()[x/4+1],u=Wt()[x/4+2],d=Wt()[x/4+3],a=n,_=l;if(d)throw a=0,_=0,Ai(u);return e=a,t=_,Qi(a,_)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(e,t,1)}}renderModalFilters(){let e,t;try{const x=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_renderModalFilters(x,this.__wbg_ptr);var n=Wt()[x/4+0],l=Wt()[x/4+1],u=Wt()[x/4+2],d=Wt()[x/4+3],a=n,_=l;if(d)throw a=0,_=0,Ai(u);return e=a,t=_,Qi(a,_)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(e,t,1)}}renderNeighbourhood(){let e,t;try{const x=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_renderNeighbourhood(x,this.__wbg_ptr);var n=Wt()[x/4+0],l=Wt()[x/4+1],u=Wt()[x/4+2],d=Wt()[x/4+3],a=n,_=l;if(d)throw a=0,_=0,Ai(u);return e=a,t=_,Qi(a,_)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(e,t,1)}}renderAutoBoundaries(){let e,t;try{const x=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_renderAutoBoundaries(x,this.__wbg_ptr);var n=Wt()[x/4+0],l=Wt()[x/4+1],u=Wt()[x/4+2],d=Wt()[x/4+3],a=n,_=l;if(d)throw a=0,_=0,Ai(u);return e=a,t=_,Qi(a,_)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(e,t,1)}}setNeighbourhoodBoundary(e,t){try{const u=ht.__wbindgen_add_to_stack_pointer(-16),d=Go(e,ht.__wbindgen_malloc,ht.__wbindgen_realloc),a=Wi;ht.ltn_setNeighbourhoodBoundary(u,this.__wbg_ptr,d,a,Ur(t));var n=Wt()[u/4+0],l=Wt()[u/4+1];if(l)throw Ai(n)}finally{ht.__wbindgen_add_to_stack_pointer(16)}}deleteNeighbourhoodBoundary(e){const t=Go(e,ht.__wbindgen_malloc,ht.__wbindgen_realloc),n=Wi;ht.ltn_deleteNeighbourhoodBoundary(this.__wbg_ptr,t,n)}renameNeighbourhoodBoundary(e,t){const n=Go(e,ht.__wbindgen_malloc,ht.__wbindgen_realloc),l=Wi,u=Go(t,ht.__wbindgen_malloc,ht.__wbindgen_realloc),d=Wi;ht.ltn_renameNeighbourhoodBoundary(this.__wbg_ptr,n,l,u,d)}setCurrentNeighbourhood(e){try{const l=ht.__wbindgen_add_to_stack_pointer(-16),u=Go(e,ht.__wbindgen_malloc,ht.__wbindgen_realloc),d=Wi;ht.ltn_setCurrentNeighbourhood(l,this.__wbg_ptr,u,d);var t=Wt()[l/4+0],n=Wt()[l/4+1];if(n)throw Ai(t)}finally{ht.__wbindgen_add_to_stack_pointer(16)}}addModalFilter(e,t){try{const u=ht.__wbindgen_add_to_stack_pointer(-16),d=Go(t,ht.__wbindgen_malloc,ht.__wbindgen_realloc),a=Wi;ht.ltn_addModalFilter(u,this.__wbg_ptr,Ur(e),d,a);var n=Wt()[u/4+0],l=Wt()[u/4+1];if(l)throw Ai(n)}finally{ht.__wbindgen_add_to_stack_pointer(16)}}addManyModalFilters(e,t){try{const u=ht.__wbindgen_add_to_stack_pointer(-16),d=Go(t,ht.__wbindgen_malloc,ht.__wbindgen_realloc),a=Wi;ht.ltn_addManyModalFilters(u,this.__wbg_ptr,Ur(e),d,a);var n=Wt()[u/4+0],l=Wt()[u/4+1];if(l)throw Ai(n)}finally{ht.__wbindgen_add_to_stack_pointer(16)}}deleteModalFilter(e){ht.ltn_deleteModalFilter(this.__wbg_ptr,e)}toggleDirection(e){ht.ltn_toggleDirection(this.__wbg_ptr,e)}undo(){ht.ltn_undo(this.__wbg_ptr)}redo(){ht.ltn_redo(this.__wbg_ptr)}getShortcutsCrossingRoad(e){let t,n;try{const S=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_getShortcutsCrossingRoad(S,this.__wbg_ptr,e);var l=Wt()[S/4+0],u=Wt()[S/4+1],d=Wt()[S/4+2],a=Wt()[S/4+3],_=l,x=u;if(a)throw _=0,x=0,Ai(d);return t=_,n=x,Qi(_,x)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(t,n,1)}}getAllShortcuts(){let e,t;try{const x=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_getAllShortcuts(x,this.__wbg_ptr);var n=Wt()[x/4+0],l=Wt()[x/4+1],u=Wt()[x/4+2],d=Wt()[x/4+3],a=n,_=l;if(d)throw a=0,_=0,Ai(u);return e=a,t=_,Qi(a,_)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(e,t,1)}}toSavefile(){let e,t;try{const x=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_toSavefile(x,this.__wbg_ptr);var n=Wt()[x/4+0],l=Wt()[x/4+1],u=Wt()[x/4+2],d=Wt()[x/4+3],a=n,_=l;if(d)throw a=0,_=0,Ai(u);return e=a,t=_,Qi(a,_)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(e,t,1)}}loadSavefile(e){try{const l=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_loadSavefile(l,this.__wbg_ptr,Ur(e));var t=Wt()[l/4+0],n=Wt()[l/4+1];if(n)throw Ai(t)}finally{ht.__wbindgen_add_to_stack_pointer(16)}}compareRoute(e,t,n,l,u){let d,a;try{const D=ht.__wbindgen_add_to_stack_pointer(-16);ht.ltn_compareRoute(D,this.__wbg_ptr,e,t,n,l,u);var _=Wt()[D/4+0],x=Wt()[D/4+1],S=Wt()[D/4+2],k=Wt()[D/4+3],C=_,P=x;if(k)throw C=0,P=0,Ai(S);return d=C,a=P,Qi(C,P)}finally{ht.__wbindgen_add_to_stack_pointer(16),ht.__wbindgen_free(d,a,1)}}}async function s4(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(n){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}const t=await r.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{const t=await WebAssembly.instantiate(r,e);return t instanceof WebAssembly.Instance?{instance:t,module:r}:t}}function a4(){const r={};return r.wbg={},r.wbg.__wbindgen_error_new=function(e,t){const n=new Error(Qi(e,t));return Ur(n)},r.wbg.__wbindgen_string_new=function(e,t){const n=Qi(e,t);return Ur(n)},r.wbg.__wbindgen_object_drop_ref=function(e){Ai(e)},r.wbg.__wbindgen_string_get=function(e,t){const n=hr(t),l=typeof n=="string"?n:void 0;var u=fc(l)?0:Go(l,ht.__wbindgen_malloc,ht.__wbindgen_realloc),d=Wi;Wt()[e/4+1]=d,Wt()[e/4+0]=u},r.wbg.__wbindgen_boolean_get=function(e){const t=hr(e);return typeof t=="boolean"?t?1:0:2},r.wbg.__wbindgen_is_bigint=function(e){return typeof hr(e)=="bigint"},r.wbg.__wbindgen_number_get=function(e,t){const n=hr(t),l=typeof n=="number"?n:void 0;Bb()[e/8+1]=fc(l)?0:l,Wt()[e/4+0]=!fc(l)},r.wbg.__wbindgen_is_object=function(e){const t=hr(e);return typeof t=="object"&&t!==null},r.wbg.__wbindgen_in=function(e,t){return hr(e)in hr(t)},r.wbg.__wbindgen_bigint_from_i64=function(e){return Ur(e)},r.wbg.__wbindgen_jsval_eq=function(e,t){return hr(e)===hr(t)},r.wbg.__wbindgen_bigint_from_u64=function(e){const t=BigInt.asUintN(64,e);return Ur(t)},r.wbg.__wbindgen_is_undefined=function(e){return hr(e)===void 0},r.wbg.__wbindgen_jsval_loose_eq=function(e,t){return hr(e)==hr(t)},r.wbg.__wbindgen_object_clone_ref=function(e){const t=hr(e);return Ur(t)},r.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(e,t){const n=hr(e)[hr(t)];return Ur(n)},r.wbg.__wbg_debug_34c9290896ec9856=function(e){console.debug(hr(e))},r.wbg.__wbg_error_e60eff06f24ab7a4=function(e){console.error(hr(e))},r.wbg.__wbg_info_d7d58472d0bab115=function(e){console.info(hr(e))},r.wbg.__wbg_log_a4530b4fe289336f=function(e){console.log(hr(e))},r.wbg.__wbg_warn_f260f49434e45e62=function(e){console.warn(hr(e))},r.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return Ur(e)},r.wbg.__wbg_stack_658279fe44541cf6=function(e,t){const n=hr(t).stack,l=Go(n,ht.__wbindgen_malloc,ht.__wbindgen_realloc),u=Wi;Wt()[e/4+1]=u,Wt()[e/4+0]=l},r.wbg.__wbg_error_f851667af71bcfc6=function(e,t){let n,l;try{n=e,l=t,console.error(Qi(e,t))}finally{ht.__wbindgen_free(n,l,1)}},r.wbg.__wbg_performance_3f3012faa4463882=function(e){const t=hr(e).performance;return Ur(t)},r.wbg.__wbg_now_2fd65358804c9485=function(e){return hr(e).now()},r.wbg.__wbg_get_f01601b5a68d10e3=function(e,t){const n=hr(e)[t>>>0];return Ur(n)},r.wbg.__wbg_length_1009b1af0c481d7b=function(e){return hr(e).length},r.wbg.__wbindgen_is_function=function(e){return typeof hr(e)=="function"},r.wbg.__wbg_newnoargs_c62ea9419c21fbac=function(e,t){const n=new Function(Qi(e,t));return Ur(n)},r.wbg.__wbg_next_9b877f231f476d01=function(e){const t=hr(e).next;return Ur(t)},r.wbg.__wbg_next_6529ee0cca8d57ed=function(){return Ka(function(e){const t=hr(e).next();return Ur(t)},arguments)},r.wbg.__wbg_done_5fe336b092d60cf2=function(e){return hr(e).done},r.wbg.__wbg_value_0c248a78fdc8e19f=function(e){const t=hr(e).value;return Ur(t)},r.wbg.__wbg_iterator_db7ca081358d4fb2=function(){return Ur(Symbol.iterator)},r.wbg.__wbg_get_7b48513de5dc5ea4=function(){return Ka(function(e,t){const n=Reflect.get(hr(e),hr(t));return Ur(n)},arguments)},r.wbg.__wbg_call_90c26b09837aba1c=function(){return Ka(function(e,t){const n=hr(e).call(hr(t));return Ur(n)},arguments)},r.wbg.__wbg_self_f0e34d89f33b99fd=function(){return Ka(function(){const e=self.self;return Ur(e)},arguments)},r.wbg.__wbg_window_d3b084224f4774d7=function(){return Ka(function(){const e=window.window;return Ur(e)},arguments)},r.wbg.__wbg_globalThis_9caa27ff917c6860=function(){return Ka(function(){const e=globalThis.globalThis;return Ur(e)},arguments)},r.wbg.__wbg_global_35dfdd59a4da3e74=function(){return Ka(function(){const e=global.global;return Ur(e)},arguments)},r.wbg.__wbg_isArray_74fb723e24f76012=function(e){return Array.isArray(hr(e))},r.wbg.__wbg_instanceof_ArrayBuffer_e7d53d51371448e2=function(e){let t;try{t=hr(e)instanceof ArrayBuffer}catch{t=!1}return t},r.wbg.__wbg_isSafeInteger_f93fde0dca9820f8=function(e){return Number.isSafeInteger(hr(e))},r.wbg.__wbg_entries_9e2e2aa45aa5094a=function(e){const t=Object.entries(hr(e));return Ur(t)},r.wbg.__wbg_buffer_a448f833075b71ba=function(e){const t=hr(e).buffer;return Ur(t)},r.wbg.__wbg_new_8f67e318f15d7254=function(e){const t=new Uint8Array(hr(e));return Ur(t)},r.wbg.__wbg_set_2357bf09366ee480=function(e,t,n){hr(e).set(hr(t),n>>>0)},r.wbg.__wbg_length_1d25fa9e4ac21ce7=function(e){return hr(e).length},r.wbg.__wbg_instanceof_Uint8Array_bced6f43aed8c1aa=function(e){let t;try{t=hr(e)instanceof Uint8Array}catch{t=!1}return t},r.wbg.__wbindgen_bigint_get_as_i64=function(e,t){const n=hr(t),l=typeof n=="bigint"?n:void 0;r4()[e/8+1]=fc(l)?BigInt(0):l,Wt()[e/4+0]=!fc(l)},r.wbg.__wbindgen_debug_string=function(e,t){const n=Lm(hr(t)),l=Go(n,ht.__wbindgen_malloc,ht.__wbindgen_realloc),u=Wi;Wt()[e/4+1]=u,Wt()[e/4+0]=l},r.wbg.__wbindgen_throw=function(e,t){throw new Error(Qi(e,t))},r.wbg.__wbindgen_memory=function(){const e=ht.memory;return Ur(e)},r}function l4(r,e){return ht=r.exports,Ob.__wbindgen_wasm_module=e,Ku=null,Xu=null,$u=null,Hu=null,ht}async function Ob(r){if(ht!==void 0)return ht;typeof r>"u"&&(r="/ltn/assets/backend_bg.wasm");const e=a4();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:t,module:n}=await s4(await r,e);return l4(t,n)}var xh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sg(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Dd(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var l=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,l.get?l:{enumerable:!0,get:function(){return r[n]}})}),t}var Nb={exports:{}};/** * MapLibre GL JS * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.1.3/LICENSE.txt - */(function(r,e){(function(t,n){r.exports=n()})(xh,function(){var t={},n={};function l(d,a,_){if(n[d]=_,d==="index"){var x="var sharedModule = {}; ("+n.shared+")(sharedModule); ("+n.worker+")(sharedModule);",S={};return n.shared(S),n.index(t,S),typeof window<"u"&&t.setWorkerUrl(window.URL.createObjectURL(new Blob([x],{type:"text/javascript"}))),t}}l("shared",["exports"],function(d){function a(s,i,c,f){return new(c||(c=Promise))(function(g,b){function w(L){try{I(f.next(L))}catch(F){b(F)}}function T(L){try{I(f.throw(L))}catch(F){b(F)}}function I(L){var F;L.done?g(L.value):(F=L.value,F instanceof c?F:new c(function(j){j(F)})).then(w,T)}I((f=f.apply(s,i||[])).next())})}function _(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}typeof SuppressedError=="function"&&SuppressedError;var x=S;function S(s,i){this.x=s,this.y=i}S.prototype={clone:function(){return new S(this.x,this.y)},add:function(s){return this.clone()._add(s)},sub:function(s){return this.clone()._sub(s)},multByPoint:function(s){return this.clone()._multByPoint(s)},divByPoint:function(s){return this.clone()._divByPoint(s)},mult:function(s){return this.clone()._mult(s)},div:function(s){return this.clone()._div(s)},rotate:function(s){return this.clone()._rotate(s)},rotateAround:function(s,i){return this.clone()._rotateAround(s,i)},matMult:function(s){return this.clone()._matMult(s)},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(s){return this.x===s.x&&this.y===s.y},dist:function(s){return Math.sqrt(this.distSqr(s))},distSqr:function(s){var i=s.x-this.x,c=s.y-this.y;return i*i+c*c},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(s){return Math.atan2(this.y-s.y,this.x-s.x)},angleWith:function(s){return this.angleWithSep(s.x,s.y)},angleWithSep:function(s,i){return Math.atan2(this.x*i-this.y*s,this.x*s+this.y*i)},_matMult:function(s){var i=s[2]*this.x+s[3]*this.y;return this.x=s[0]*this.x+s[1]*this.y,this.y=i,this},_add:function(s){return this.x+=s.x,this.y+=s.y,this},_sub:function(s){return this.x-=s.x,this.y-=s.y,this},_mult:function(s){return this.x*=s,this.y*=s,this},_div:function(s){return this.x/=s,this.y/=s,this},_multByPoint:function(s){return this.x*=s.x,this.y*=s.y,this},_divByPoint:function(s){return this.x/=s.x,this.y/=s.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var s=this.y;return this.y=this.x,this.x=-s,this},_rotate:function(s){var i=Math.cos(s),c=Math.sin(s),f=c*this.x+i*this.y;return this.x=i*this.x-c*this.y,this.y=f,this},_rotateAround:function(s,i){var c=Math.cos(s),f=Math.sin(s),g=i.y+f*(this.x-i.x)+c*(this.y-i.y);return this.x=i.x+c*(this.x-i.x)-f*(this.y-i.y),this.y=g,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},S.convert=function(s){return s instanceof S?s:Array.isArray(s)?new S(s[0],s[1]):s};var k=_(x),C=P;function P(s,i,c,f){this.cx=3*s,this.bx=3*(c-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(f-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=i,this.p2x=c,this.p2y=f}P.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,i){if(i===void 0&&(i=1e-6),s<0)return 0;if(s>1)return 1;for(var c=s,f=0;f<8;f++){var g=this.sampleCurveX(c)-s;if(Math.abs(g)g?w=c:T=c,c=.5*(T-w)+w;return c},solve:function(s,i){return this.sampleCurveY(this.solveCurveX(s,i))}};var D=_(C);let N,z;function B(){return N==null&&(N=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),N}function O(){if(z==null&&(z=!1,B())){const i=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(i){for(let f=0;f<5*5;f++){const g=4*f;i.fillStyle=`rgb(${g},${g+1},${g+2})`,i.fillRect(f%5,Math.floor(f/5),1,1)}const c=i.getImageData(0,0,5,5).data;for(let f=0;f<5*5*4;f++)if(f%4!=3&&c[f]!==f){z=!0;break}}}return z||!1}function G(s,i,c,f){const g=new D(s,i,c,f);return function(b){return g.solve(b)}}const U=G(.25,.1,.25,1);function K(s,i,c){return Math.min(c,Math.max(i,s))}function me(s,i,c){const f=c-i,g=((s-i)%f+f)%f+i;return g===i?c:g}function X(s,...i){for(const c of i)for(const f in c)s[f]=c[f];return s}let Y=1;function _e(s,i,c){const f={};for(const g in s)f[g]=i.call(c||this,s[g],g,s);return f}function ze(s,i,c){const f={};for(const g in s)i.call(c||this,s[g],g,s)&&(f[g]=s[g]);return f}function re(s){return Array.isArray(s)?s.map(re):typeof s=="object"&&s?_e(s,re):s}const ce={};function Ze(s){ce[s]||(typeof console<"u"&&console.warn(s),ce[s]=!0)}function Me(s,i,c){return(c.y-s.y)*(i.x-s.x)>(i.y-s.y)*(c.x-s.x)}function ft(s){let i=0;for(let c,f,g=0,b=s.length,w=b-1;g"u")throw new Error("VideoFrame not supported");const b=new VideoFrame(s,{timestamp:0});try{const w=b==null?void 0:b.format;if(!w||!w.startsWith("BGR")&&!w.startsWith("RGB"))throw new Error(`Unrecognized format ${w}`);const T=w.startsWith("BGR"),I=new Uint8ClampedArray(f*g*4);if(yield b.copyTo(I,function(L,F,j,H,J){const ee=4*Math.max(-F,0),ae=(Math.max(0,j)-j)*H*4+ee,ge=4*H,xe=Math.max(0,F),Re=Math.max(0,j);return{rect:{x:xe,y:Re,width:Math.min(L.width,F+H)-xe,height:Math.min(L.height,j+J)-Re},layout:[{offset:ae,stride:ge}]}}(s,i,c,f,g)),T)for(let L=0;LCt(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Pr=function(s,i){if(/:\/\//.test(s.url)&&!/^https?:|^file:/.test(s.url)){const f=Nt(s.url);if(f)return f(s,i);if(Ct(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:s,targetMapId:nr},i)}if(!(/^file:/.test(c=s.url)||/^file:/.test(Lr())&&!/^\w+:/.test(c))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(f,g){return a(this,void 0,void 0,function*(){const b=new Request(f.url,{method:f.method||"GET",body:f.body,credentials:f.credentials,headers:f.headers,cache:f.cache,referrer:Lr(),signal:g.signal});f.type==="json"&&b.headers.set("Accept","application/json");const w=yield fetch(b);if(!w.ok){const L=yield w.blob();throw new tr(w.status,w.statusText,f.url,L)}let T;T=f.type==="arrayBuffer"||f.type==="image"?w.arrayBuffer():f.type==="json"?w.json():w.text();const I=yield T;if(g.signal.aborted)throw fr();return{data:I,cacheControl:w.headers.get("Cache-Control"),expires:w.headers.get("Expires")}})}(s,i);if(Ct(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:s,mustQueue:!0,targetMapId:nr},i)}var c;return function(f,g){return new Promise((b,w)=>{const T=new XMLHttpRequest;T.open(f.method||"GET",f.url,!0),f.type!=="arrayBuffer"&&f.type!=="image"||(T.responseType="arraybuffer");for(const I in f.headers)T.setRequestHeader(I,f.headers[I]);f.type==="json"&&(T.responseType="text",T.setRequestHeader("Accept","application/json")),T.withCredentials=f.credentials==="include",T.onerror=()=>{w(new Error(T.statusText))},T.onload=()=>{if(!g.signal.aborted)if((T.status>=200&&T.status<300||T.status===0)&&T.response!==null){let I=T.response;if(f.type==="json")try{I=JSON.parse(T.response)}catch(L){return void w(L)}b({data:I,cacheControl:T.getResponseHeader("Cache-Control"),expires:T.getResponseHeader("Expires")})}else{const I=new Blob([T.response],{type:T.getResponseHeader("Content-Type")});w(new tr(T.status,T.statusText,f.url,I))}},g.signal.addEventListener("abort",()=>{T.abort(),w(fr())}),T.send(f.body)})}(s,i)};function st(s){if(!s||s.indexOf("://")<=0||s.indexOf("data:image/")===0||s.indexOf("blob:")===0)return!0;const i=new URL(s),c=window.location;return i.protocol===c.protocol&&i.host===c.host}function Lt(s,i,c){c[s]&&c[s].indexOf(i)!==-1||(c[s]=c[s]||[],c[s].push(i))}function De(s,i,c){if(c&&c[s]){const f=c[s].indexOf(i);f!==-1&&c[s].splice(f,1)}}class at{constructor(i,c={}){X(this,c),this.type=i}}class tt extends at{constructor(i,c={}){super("error",X({error:i},c))}}class it{on(i,c){return this._listeners=this._listeners||{},Lt(i,c,this._listeners),this}off(i,c){return De(i,c,this._listeners),De(i,c,this._oneTimeListeners),this}once(i,c){return c?(this._oneTimeListeners=this._oneTimeListeners||{},Lt(i,c,this._oneTimeListeners),this):new Promise(f=>this.once(i,f))}fire(i,c){typeof i=="string"&&(i=new at(i,c||{}));const f=i.type;if(this.listens(f)){i.target=this;const g=this._listeners&&this._listeners[f]?this._listeners[f].slice():[];for(const T of g)T.call(this,i);const b=this._oneTimeListeners&&this._oneTimeListeners[f]?this._oneTimeListeners[f].slice():[];for(const T of b)De(f,T,this._oneTimeListeners),T.call(this,i);const w=this._eventedParent;w&&(X(i,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),w.fire(i))}else i instanceof tt&&console.error(i.error);return this}listens(i){return this._listeners&&this._listeners[i]&&this._listeners[i].length>0||this._oneTimeListeners&&this._oneTimeListeners[i]&&this._oneTimeListeners[i].length>0||this._eventedParent&&this._eventedParent.listens(i)}setEventedParent(i,c){return this._eventedParent=i,this._eventedParentData=c,this}}var ne={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},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},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-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}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const br=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function We(s,i){const c={};for(const f in s)f!=="ref"&&(c[f]=s[f]);return br.forEach(f=>{f in i&&(c[f]=i[f])}),c}function Ye(s,i){if(Array.isArray(s)){if(!Array.isArray(i)||s.length!==i.length)return!1;for(let c=0;c`:s.itemType.kind==="value"?"array":`array<${i}>`}return s.kind}const Ce=[Or,mt,rr,Jt,Nr,an,vi,te(Qt),pe,Z,$];function Ie(s,i){if(i.kind==="error")return null;if(s.kind==="array"){if(i.kind==="array"&&(i.N===0&&i.itemType.kind==="value"||!Ie(s.itemType,i.itemType))&&(typeof s.N!="number"||s.N===i.N))return null}else{if(s.kind===i.kind)return null;if(s.kind==="value"){for(const c of Ce)if(!Ie(c,i))return null}}return`Expected ${le(s)} but found ${le(i)} instead.`}function Pe(s,i){return i.some(c=>c.kind===s.kind)}function Se(s,i){return i.some(c=>c==="null"?s===null:c==="array"?Array.isArray(s):c==="object"?s&&!Array.isArray(s)&&typeof s=="object":c===typeof s)}function W(s,i){return s.kind==="array"&&i.kind==="array"?s.itemType.kind===i.itemType.kind&&typeof s.N=="number":s.kind===i.kind}const Be=.96422,Fe=.82521,qe=4/29,Xe=6/29,ut=3*Xe*Xe,Pt=Xe*Xe*Xe,$t=Math.PI/180,ar=180/Math.PI;function gr(s){return(s%=360)<0&&(s+=360),s}function Yr([s,i,c,f]){let g,b;const w=lr((.2225045*(s=Cn(s))+.7168786*(i=Cn(i))+.0606169*(c=Cn(c)))/1);s===i&&i===c?g=b=w:(g=lr((.4360747*s+.3850649*i+.1430804*c)/Be),b=lr((.0139322*s+.0971045*i+.7141733*c)/Fe));const T=116*w-16;return[T<0?0:T,500*(g-w),200*(w-b),f]}function Cn(s){return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}function lr(s){return s>Pt?Math.pow(s,1/3):s/ut+qe}function ln([s,i,c,f]){let g=(s+16)/116,b=isNaN(i)?g:g+i/500,w=isNaN(c)?g:g-c/200;return g=1*fi(g),b=Be*fi(b),w=Fe*fi(w),[Bn(3.1338561*b-1.6168667*g-.4906146*w),Bn(-.9787684*b+1.9161415*g+.033454*w),Bn(.0719453*b-.2289914*g+1.4052427*w),f]}function Bn(s){return(s=s<=.00304?12.92*s:1.055*Math.pow(s,1/2.4)-.055)<0?0:s>1?1:s}function fi(s){return s>Xe?s*s*s:ut*(s-qe)}function bi(s){return parseInt(s.padEnd(2,s),16)/255}function Kn(s,i){return mo(i?s/100:s,0,1)}function mo(s,i,c){return Math.min(Math.max(i,s),c)}function Ch(s){return!s.some(Number.isNaN)}const Wd={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]};class zr{constructor(i,c,f,g=1,b=!0){this.r=i,this.g=c,this.b=f,this.a=g,b||(this.r*=g,this.g*=g,this.b*=g,g||this.overwriteGetter("rgb",[i,c,f,g]))}static parse(i){if(i instanceof zr)return i;if(typeof i!="string")return;const c=function(f){if((f=f.toLowerCase().trim())==="transparent")return[0,0,0,0];const g=Wd[f];if(g){const[w,T,I]=g;return[w/255,T/255,I/255,1]}if(f.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(f)){const w=f.length<6?1:2;let T=1;return[bi(f.slice(T,T+=w)),bi(f.slice(T,T+=w)),bi(f.slice(T,T+=w)),bi(f.slice(T,T+w)||"ff")]}if(f.startsWith("rgb")){const w=f.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(w){const[T,I,L,F,j,H,J,ee,ae,ge,xe,Re]=w,ke=[F||" ",J||" ",ge].join("");if(ke===" "||ke===" /"||ke===",,"||ke===",,,"){const Ae=[L,H,ae].join(""),Je=Ae==="%%%"?100:Ae===""?255:0;if(Je){const Qe=[mo(+I/Je,0,1),mo(+j/Je,0,1),mo(+ee/Je,0,1),xe?Kn(+xe,Re):1];if(Ch(Qe))return Qe}}return}}const b=f.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(b){const[w,T,I,L,F,j,H,J,ee]=b,ae=[I||" ",F||" ",H].join("");if(ae===" "||ae===" /"||ae===",,"||ae===",,,"){const ge=[+T,mo(+L,0,100),mo(+j,0,100),J?Kn(+J,ee):1];if(Ch(ge))return function([xe,Re,ke,Ae]){function Je(Qe){const kt=(Qe+xe/30)%12,zt=Re*Math.min(ke,1-ke);return ke-zt*Math.max(-1,Math.min(kt-3,9-kt,1))}return xe=gr(xe),Re/=100,ke/=100,[Je(0),Je(8),Je(4),Ae]}(ge)}}}(i);return c?new zr(...c,!1):void 0}get rgb(){const{r:i,g:c,b:f,a:g}=this,b=g||1/0;return this.overwriteGetter("rgb",[i/b,c/b,f/b,g])}get hcl(){return this.overwriteGetter("hcl",function(i){const[c,f,g,b]=Yr(i),w=Math.sqrt(f*f+g*g);return[Math.round(1e4*w)?gr(Math.atan2(g,f)*ar):NaN,w,c,b]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Yr(this.rgb))}overwriteGetter(i,c){return Object.defineProperty(this,i,{value:c}),c}toString(){const[i,c,f,g]=this.rgb;return`rgba(${[i,c,f].map(b=>Math.round(255*b)).join(",")},${g})`}}zr.black=new zr(0,0,0,1),zr.white=new zr(1,1,1,1),zr.transparent=new zr(0,0,0,0),zr.red=new zr(1,0,0,1);class Fc{constructor(i,c,f){this.sensitivity=i?c?"variant":"case":c?"accent":"base",this.locale=f,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,c){return this.collator.compare(i,c)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Oc{constructor(i,c,f,g,b){this.text=i,this.image=c,this.scale=f,this.fontStack=g,this.textColor=b}}class Ri{constructor(i){this.sections=i}static fromString(i){return new Ri([new Oc(i,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(i=>i.text.length!==0||i.image&&i.image.name.length!==0)}static factory(i){return i instanceof Ri?i:Ri.fromString(i)}toString(){return this.sections.length===0?"":this.sections.map(i=>i.text).join("")}}class wi{constructor(i){this.values=i.slice()}static parse(i){if(i instanceof wi)return i;if(typeof i=="number")return new wi([i,i,i,i]);if(Array.isArray(i)&&!(i.length<1||i.length>4)){for(const c of i)if(typeof c!="number")return;switch(i.length){case 1:i=[i[0],i[0],i[0],i[0]];break;case 2:i=[i[0],i[1],i[0],i[1]];break;case 3:i=[i[0],i[1],i[2],i[1]]}return new wi(i)}}toString(){return JSON.stringify(this.values)}}const ka=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class $i{constructor(i){this.values=i.slice()}static parse(i){if(i instanceof $i)return i;if(Array.isArray(i)&&!(i.length<1)&&i.length%2==0){for(let c=0;c=0&&s<=255&&typeof i=="number"&&i>=0&&i<=255&&typeof c=="number"&&c>=0&&c<=255?f===void 0||typeof f=="number"&&f>=0&&f<=1?null:`Invalid rgba value [${[s,i,c,f].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof f=="number"?[s,i,c,f]:[s,i,c]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function sl(s){if(s===null||typeof s=="string"||typeof s=="boolean"||typeof s=="number"||s instanceof zr||s instanceof Fc||s instanceof Ri||s instanceof wi||s instanceof $i||s instanceof Xi)return!0;if(Array.isArray(s)){for(const i of s)if(!sl(i))return!1;return!0}if(typeof s=="object"){for(const i in s)if(!sl(s[i]))return!1;return!0}return!1}function In(s){if(s===null)return Or;if(typeof s=="string")return rr;if(typeof s=="boolean")return Jt;if(typeof s=="number")return mt;if(s instanceof zr)return Nr;if(s instanceof Fc)return ro;if(s instanceof Ri)return an;if(s instanceof wi)return pe;if(s instanceof $i)return $;if(s instanceof Xi)return Z;if(Array.isArray(s)){const i=s.length;let c;for(const f of s){const g=In(f);if(c){if(c===g)continue;c=Qt;break}c=g}return te(c||Qt,i)}return vi}function Ta(s){const i=typeof s;return s===null?"":i==="string"||i==="number"||i==="boolean"?String(s):s instanceof zr||s instanceof Ri||s instanceof wi||s instanceof $i||s instanceof Xi?s.toString():JSON.stringify(s)}class Xo{constructor(i,c){this.type=i,this.value=c}static parse(i,c){if(i.length!==2)return c.error(`'literal' expression requires exactly one argument, but found ${i.length-1} instead.`);if(!sl(i[1]))return c.error("invalid value");const f=i[1];let g=In(f);const b=c.expectedType;return g.kind!=="array"||g.N!==0||!b||b.kind!=="array"||typeof b.N=="number"&&b.N!==0||(g=b),new Xo(g,f)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class rn{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}}const al={string:rr,number:mt,boolean:Jt,object:vi};class Bi{constructor(i,c){this.type=i,this.args=c}static parse(i,c){if(i.length<2)return c.error("Expected at least one argument.");let f,g=1;const b=i[0];if(b==="array"){let T,I;if(i.length>2){const L=i[1];if(typeof L!="string"||!(L in al)||L==="object")return c.error('The item type argument of "array" must be one of string, number, boolean',1);T=al[L],g++}else T=Qt;if(i.length>3){if(i[2]!==null&&(typeof i[2]!="number"||i[2]<0||i[2]!==Math.floor(i[2])))return c.error('The length argument to "array" must be a positive integer literal',2);I=i[2],g++}f=te(T,I)}else{if(!al[b])throw new Error(`Types doesn't contain name = ${b}`);f=al[b]}const w=[];for(;gi.outputDefined())}}const ll={"to-boolean":Jt,"to-color":Nr,"to-number":mt,"to-string":rr};class go{constructor(i,c){this.type=i,this.args=c}static parse(i,c){if(i.length<2)return c.error("Expected at least one argument.");const f=i[0];if(!ll[f])throw new Error(`Can't parse ${f} as it is not part of the known types`);if((f==="to-boolean"||f==="to-string")&&i.length!==2)return c.error("Expected one argument.");const g=ll[f],b=[];for(let w=1;w4?`Invalid rbga value ${JSON.stringify(c)}: expected an array containing either three or four numeric values.`:Ns(c[0],c[1],c[2],c[3]),!f))return new zr(c[0]/255,c[1]/255,c[2]/255,c[3])}throw new rn(f||`Could not parse color from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"padding":{let c;for(const f of this.args){c=f.evaluate(i);const g=wi.parse(c);if(g)return g}throw new rn(`Could not parse padding from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"variableAnchorOffsetCollection":{let c;for(const f of this.args){c=f.evaluate(i);const g=$i.parse(c);if(g)return g}throw new rn(`Could not parse variableAnchorOffsetCollection from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"number":{let c=null;for(const f of this.args){if(c=f.evaluate(i),c===null)return 0;const g=Number(c);if(!isNaN(g))return g}throw new rn(`Could not convert ${JSON.stringify(c)} to number.`)}case"formatted":return Ri.fromString(Ta(this.args[0].evaluate(i)));case"resolvedImage":return Xi.fromString(Ta(this.args[0].evaluate(i)));default:return Ta(this.args[0].evaluate(i))}}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}}const Ea=["Unknown","Point","LineString","Polygon"];class Dr{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Ea[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(i){let c=this._parseColorCache[i];return c||(c=this._parseColorCache[i]=zr.parse(i)),c}}class cl{constructor(i,c,f=[],g,b=new Bo,w=[]){this.registry=i,this.path=f,this.key=f.map(T=>`[${T}]`).join(""),this.scope=b,this.errors=w,this.expectedType=g,this._isConstant=c}parse(i,c,f,g,b={}){return c?this.concat(c,f,g)._parse(i,b):this._parse(i,b)}_parse(i,c){function f(g,b,w){return w==="assert"?new Bi(b,[g]):w==="coerce"?new go(b,[g]):g}if(i!==null&&typeof i!="string"&&typeof i!="boolean"&&typeof i!="number"||(i=["literal",i]),Array.isArray(i)){if(i.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const g=i[0];if(typeof g!="string")return this.error(`Expression name must be a string, but found ${typeof g} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const b=this.registry[g];if(b){let w=b.parse(i,this);if(!w)return null;if(this.expectedType){const T=this.expectedType,I=w.type;if(T.kind!=="string"&&T.kind!=="number"&&T.kind!=="boolean"&&T.kind!=="object"&&T.kind!=="array"||I.kind!=="value")if(T.kind!=="color"&&T.kind!=="formatted"&&T.kind!=="resolvedImage"||I.kind!=="value"&&I.kind!=="string")if(T.kind!=="padding"||I.kind!=="value"&&I.kind!=="number"&&I.kind!=="array")if(T.kind!=="variableAnchorOffsetCollection"||I.kind!=="value"&&I.kind!=="array"){if(this.checkSubtype(T,I))return null}else w=f(w,T,c.typeAnnotation||"coerce");else w=f(w,T,c.typeAnnotation||"coerce");else w=f(w,T,c.typeAnnotation||"coerce");else w=f(w,T,c.typeAnnotation||"assert")}if(!(w instanceof Xo)&&w.type.kind!=="resolvedImage"&&this._isConstant(w)){const T=new Dr;try{w=new Xo(w.type,w.evaluate(T))}catch(I){return this.error(I.message),null}}return w}return this.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(i===void 0?"'undefined' value invalid. Use null instead.":typeof i=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof i} instead.`)}concat(i,c,f){const g=typeof i=="number"?this.path.concat(i):this.path,b=f?this.scope.concat(f):this.scope;return new cl(this.registry,this._isConstant,g,c||null,b,this.errors)}error(i,...c){const f=`${this.key}${c.map(g=>`[${g}]`).join("")}`;this.errors.push(new xn(f,i))}checkSubtype(i,c){const f=Ie(i,c);return f&&this.error(f),f}}class js{constructor(i,c,f){this.type=ro,this.locale=f,this.caseSensitive=i,this.diacriticSensitive=c}static parse(i,c){if(i.length!==2)return c.error("Expected one argument.");const f=i[1];if(typeof f!="object"||Array.isArray(f))return c.error("Collator options argument must be an object.");const g=c.parse(f["case-sensitive"]!==void 0&&f["case-sensitive"],1,Jt);if(!g)return null;const b=c.parse(f["diacritic-sensitive"]!==void 0&&f["diacritic-sensitive"],1,Jt);if(!b)return null;let w=null;return f.locale&&(w=c.parse(f.locale,1,rr),!w)?null:new js(g,b,w)}evaluate(i){return new Fc(this.caseSensitive.evaluate(i),this.diacriticSensitive.evaluate(i),this.locale?this.locale.evaluate(i):null)}eachChild(i){i(this.caseSensitive),i(this.diacriticSensitive),this.locale&&i(this.locale)}outputDefined(){return!1}}const Ko=8192;function ul(s,i){s[0]=Math.min(s[0],i[0]),s[1]=Math.min(s[1],i[1]),s[2]=Math.max(s[2],i[0]),s[3]=Math.max(s[3],i[1])}function Ma(s,i){return!(s[0]<=i[0]||s[2]>=i[2]||s[1]<=i[1]||s[3]>=i[3])}function Zd(s,i){const c=(180+s[0])/360,f=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s[1]*Math.PI/360)))/360,g=Math.pow(2,i.z);return[Math.round(c*g*Ko),Math.round(f*g*Ko)]}function Ih(s,i,c){const f=s[0]-i[0],g=s[1]-i[1],b=s[0]-c[0],w=s[1]-c[1];return f*w-b*g==0&&f*b<=0&&g*w<=0}function hl(s,i){let c=!1;for(let w=0,T=i.length;w(f=s)[1]!=(b=I[L+1])[1]>f[1]&&f[0]<(b[0]-g[0])*(f[1]-g[1])/(b[1]-g[1])+g[0]&&(c=!c)}}var f,g,b;return c}function Hd(s,i){for(let c=0;c0&&T<0||w<0&&T>0}function $d(s,i,c){for(const L of c)for(let F=0;Fc[2]){const g=.5*f;let b=s[0]-c[0]>g?-f:c[0]-s[0]>g?f:0;b===0&&(b=s[0]-c[2]>g?-f:c[2]-s[0]>g?f:0),s[0]+=b}ul(i,s)}function dl(s,i,c,f){const g=Math.pow(2,f.z)*Ko,b=[f.x*Ko,f.y*Ko],w=[];for(const T of s)for(const I of T){const L=[I.x+b[0],I.y+b[1]];Dh(L,i,c,g),w.push(L)}return w}function Rh(s,i,c,f){const g=Math.pow(2,f.z)*Ko,b=[f.x*Ko,f.y*Ko],w=[];for(const I of s){const L=[];for(const F of I){const j=[F.x+b[0],F.y+b[1]];ul(i,j),L.push(j)}w.push(L)}if(i[2]-i[0]<=g/2){(T=i)[0]=T[1]=1/0,T[2]=T[3]=-1/0;for(const I of w)for(const L of I)Dh(L,i,c,g)}var T;return w}class ds{constructor(i,c){this.type=Jt,this.geojson=i,this.geometries=c}static parse(i,c){if(i.length!==2)return c.error(`'within' expression requires exactly one argument, but found ${i.length-1} instead.`);if(sl(i[1])){const f=i[1];if(f.type==="FeatureCollection"){const g=[];for(const b of f.features){const{type:w,coordinates:T}=b.geometry;w==="Polygon"&&g.push(T),w==="MultiPolygon"&&g.push(...T)}if(g.length)return new ds(f,{type:"MultiPolygon",coordinates:g})}else if(f.type==="Feature"){const g=f.geometry.type;if(g==="Polygon"||g==="MultiPolygon")return new ds(f,f.geometry)}else if(f.type==="Polygon"||f.type==="MultiPolygon")return new ds(f,f)}return c.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(i){if(i.geometry()!=null&&i.canonicalID()!=null){if(i.geometryType()==="Point")return function(c,f){const g=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],w=c.canonicalID();if(f.type==="Polygon"){const T=fl(f.coordinates,b,w),I=dl(c.geometry(),g,b,w);if(!Ma(g,b))return!1;for(const L of I)if(!hl(L,T))return!1}if(f.type==="MultiPolygon"){const T=zh(f.coordinates,b,w),I=dl(c.geometry(),g,b,w);if(!Ma(g,b))return!1;for(const L of I)if(!Hd(L,T))return!1}return!0}(i,this.geometries);if(i.geometryType()==="LineString")return function(c,f){const g=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],w=c.canonicalID();if(f.type==="Polygon"){const T=fl(f.coordinates,b,w),I=Rh(c.geometry(),g,b,w);if(!Ma(g,b))return!1;for(const L of I)if(!Lh(L,T))return!1}if(f.type==="MultiPolygon"){const T=zh(f.coordinates,b,w),I=Rh(c.geometry(),g,b,w);if(!Ma(g,b))return!1;for(const L of I)if(!Ph(L,T))return!1}return!0}(i,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class pl{constructor(i,c){this.type=c.type,this.name=i,this.boundExpression=c}static parse(i,c){if(i.length!==2||typeof i[1]!="string")return c.error("'var' expression requires exactly one string literal argument.");const f=i[1];return c.scope.has(f)?new pl(f,c.scope.get(f)):c.error(`Unknown variable "${f}". Make sure "${f}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(i){return this.boundExpression.evaluate(i)}eachChild(){}outputDefined(){return!1}}class Fi{constructor(i,c,f,g){this.name=i,this.type=c,this._evaluate=f,this.args=g}evaluate(i){return this._evaluate(i,this.args)}eachChild(i){this.args.forEach(i)}outputDefined(){return!1}static parse(i,c){const f=i[0],g=Fi.definitions[f];if(!g)return c.error(`Unknown expression "${f}". If you wanted a literal array, use ["literal", [...]].`,0);const b=Array.isArray(g)?g[0]:g.type,w=Array.isArray(g)?[[g[1],g[2]]]:g.overloads,T=w.filter(([L])=>!Array.isArray(L)||L.length===i.length-1);let I=null;for(const[L,F]of T){I=new cl(c.registry,Ca,c.path,null,c.scope);const j=[];let H=!1;for(let J=1;J{return H=j,Array.isArray(H)?`(${H.map(le).join(", ")})`:`(${le(H.type)}...)`;var H}).join(" | "),F=[];for(let j=1;j{c=i?c&&Ca(f):c&&f instanceof Xo}),!!c&&ml(s)&&Aa(s,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ml(s){if(s instanceof Fi&&(s.name==="get"&&s.args.length===1||s.name==="feature-state"||s.name==="has"&&s.args.length===1||s.name==="properties"||s.name==="geometry-type"||s.name==="id"||/^filter-/.test(s.name))||s instanceof ds)return!1;let i=!0;return s.eachChild(c=>{i&&!ml(c)&&(i=!1)}),i}function Ia(s){if(s instanceof Fi&&s.name==="feature-state")return!1;let i=!0;return s.eachChild(c=>{i&&!Ia(c)&&(i=!1)}),i}function Aa(s,i){if(s instanceof Fi&&i.indexOf(s.name)>=0)return!1;let c=!0;return s.eachChild(f=>{c&&!Aa(f,i)&&(c=!1)}),c}function La(s,i){const c=s.length-1;let f,g,b=0,w=c,T=0;for(;b<=w;)if(T=Math.floor((b+w)/2),f=s[T],g=s[T+1],f<=i){if(T===c||ii))throw new rn("Input is not a number.");w=T-1}return 0}class Pa{constructor(i,c,f){this.type=i,this.input=c,this.labels=[],this.outputs=[];for(const[g,b]of f)this.labels.push(g),this.outputs.push(b)}static parse(i,c){if(i.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return c.error("Expected an even number of arguments.");const f=c.parse(i[1],1,mt);if(!f)return null;const g=[];let b=null;c.expectedType&&c.expectedType.kind!=="value"&&(b=c.expectedType);for(let w=1;w=T)return c.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',L);const j=c.parse(I,F,b);if(!j)return null;b=b||j.type,g.push([T,j])}return new Pa(b,f,g)}evaluate(i){const c=this.labels,f=this.outputs;if(c.length===1)return f[0].evaluate(i);const g=this.input.evaluate(i);if(g<=c[0])return f[0].evaluate(i);const b=c.length;return g>=c[b-1]?f[b-1].evaluate(i):f[La(c,g)].evaluate(i)}eachChild(i){i(this.input);for(const c of this.outputs)i(c)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}}function Xd(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Kd=Bh;function Bh(s,i,c,f){this.cx=3*s,this.bx=3*(c-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(f-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=i,this.p2x=c,this.p2y=f}Bh.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,i){if(i===void 0&&(i=1e-6),s<0)return 0;if(s>1)return 1;for(var c=s,f=0;f<8;f++){var g=this.sampleCurveX(c)-s;if(Math.abs(g)g?w=c:T=c,c=.5*(T-w)+w;return c},solve:function(s,i){return this.sampleCurveY(this.solveCurveX(s,i))}};var Jd=Xd(Kd);function ps(s,i,c){return s+c*(i-s)}function gl(s,i,c){return s.map((f,g)=>ps(f,i[g],c))}const di={number:ps,color:function(s,i,c,f="rgb"){switch(f){case"rgb":{const[g,b,w,T]=gl(s.rgb,i.rgb,c);return new zr(g,b,w,T,!1)}case"hcl":{const[g,b,w,T]=s.hcl,[I,L,F,j]=i.hcl;let H,J;if(isNaN(g)||isNaN(I))isNaN(g)?isNaN(I)?H=NaN:(H=I,w!==1&&w!==0||(J=L)):(H=g,F!==1&&F!==0||(J=b));else{let Re=I-g;I>g&&Re>180?Re-=360:I180&&(Re+=360),H=g+c*Re}const[ee,ae,ge,xe]=function([Re,ke,Ae,Je]){return Re=isNaN(Re)?0:Re*$t,ln([Ae,Math.cos(Re)*ke,Math.sin(Re)*ke,Je])}([H,J??ps(b,L,c),ps(w,F,c),ps(T,j,c)]);return new zr(ee,ae,ge,xe,!1)}case"lab":{const[g,b,w,T]=ln(gl(s.lab,i.lab,c));return new zr(g,b,w,T,!1)}}},array:gl,padding:function(s,i,c){return new wi(gl(s.values,i.values,c))},variableAnchorOffsetCollection:function(s,i,c){const f=s.values,g=i.values;if(f.length!==g.length)throw new rn(`Cannot interpolate values of different length. from: ${s.toString()}, to: ${i.toString()}`);const b=[];for(let w=0;wtypeof F!="number"||F<0||F>1))return c.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);g={name:"cubic-bezier",controlPoints:L}}}if(i.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return c.error("Expected an even number of arguments.");if(b=c.parse(b,2,mt),!b)return null;const T=[];let I=null;f==="interpolate-hcl"||f==="interpolate-lab"?I=Nr:c.expectedType&&c.expectedType.kind!=="value"&&(I=c.expectedType);for(let L=0;L=F)return c.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',H);const ee=c.parse(j,J,I);if(!ee)return null;I=I||ee.type,T.push([F,ee])}return W(I,mt)||W(I,Nr)||W(I,pe)||W(I,$)||W(I,te(mt))?new oi(I,f,g,b,T):c.error(`Type ${le(I)} is not interpolatable.`)}evaluate(i){const c=this.labels,f=this.outputs;if(c.length===1)return f[0].evaluate(i);const g=this.input.evaluate(i);if(g<=c[0])return f[0].evaluate(i);const b=c.length;if(g>=c[b-1])return f[b-1].evaluate(i);const w=La(c,g),T=oi.interpolationFactor(this.interpolation,g,c[w],c[w+1]),I=f[w].evaluate(i),L=f[w+1].evaluate(i);switch(this.operator){case"interpolate":return di[this.type.kind](I,L,T);case"interpolate-hcl":return di.color(I,L,T,"hcl");case"interpolate-lab":return di.color(I,L,T,"lab")}}eachChild(i){i(this.input);for(const c of this.outputs)i(c)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}}function Er(s,i,c,f){const g=f-c,b=s-c;return g===0?0:i===1?b/g:(Math.pow(i,b)-1)/(Math.pow(i,g)-1)}class _l{constructor(i,c){this.type=i,this.args=c}static parse(i,c){if(i.length<2)return c.error("Expectected at least one argument.");let f=null;const g=c.expectedType;g&&g.kind!=="value"&&(f=g);const b=[];for(const T of i.slice(1)){const I=c.parse(T,1+b.length,f,void 0,{typeAnnotation:"omit"});if(!I)return null;f=f||I.type,b.push(I)}if(!f)throw new Error("No output type");const w=g&&b.some(T=>Ie(g,T.type));return new _l(w?Qt:f,b)}evaluate(i){let c,f=null,g=0;for(const b of this.args)if(g++,f=b.evaluate(i),f&&f instanceof Xi&&!f.available&&(c||(c=f.name),f=null,g===this.args.length&&(f=c)),f!==null)break;return f}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}}class yl{constructor(i,c){this.type=c.type,this.bindings=[].concat(i),this.result=c}evaluate(i){return this.result.evaluate(i)}eachChild(i){for(const c of this.bindings)i(c[1]);i(this.result)}static parse(i,c){if(i.length<4)return c.error(`Expected at least 3 arguments, but found ${i.length-1} instead.`);const f=[];for(let b=1;b=f.length)throw new rn(`Array index out of bounds: ${c} > ${f.length-1}.`);if(c!==Math.floor(c))throw new rn(`Array index must be an integer, but found ${c} instead.`);return f[c]}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}}class jc{constructor(i,c){this.type=Jt,this.needle=i,this.haystack=c}static parse(i,c){if(i.length!==3)return c.error(`Expected 2 arguments, but found ${i.length-1} instead.`);const f=c.parse(i[1],1,Qt),g=c.parse(i[2],2,Qt);return f&&g?Pe(f.type,[Jt,rr,mt,Or,Qt])?new jc(f,g):c.error(`Expected first argument to be of type boolean, string, number or null, but found ${le(f.type)} instead`):null}evaluate(i){const c=this.needle.evaluate(i),f=this.haystack.evaluate(i);if(!f)return!1;if(!Se(c,["boolean","string","number","null"]))throw new rn(`Expected first argument to be of type boolean, string, number or null, but found ${le(In(c))} instead.`);if(!Se(f,["string","array"]))throw new rn(`Expected second argument to be of type array or string, but found ${le(In(f))} instead.`);return f.indexOf(c)>=0}eachChild(i){i(this.needle),i(this.haystack)}outputDefined(){return!0}}class vl{constructor(i,c,f){this.type=mt,this.needle=i,this.haystack=c,this.fromIndex=f}static parse(i,c){if(i.length<=2||i.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);const f=c.parse(i[1],1,Qt),g=c.parse(i[2],2,Qt);if(!f||!g)return null;if(!Pe(f.type,[Jt,rr,mt,Or,Qt]))return c.error(`Expected first argument to be of type boolean, string, number or null, but found ${le(f.type)} instead`);if(i.length===4){const b=c.parse(i[3],3,mt);return b?new vl(f,g,b):null}return new vl(f,g)}evaluate(i){const c=this.needle.evaluate(i),f=this.haystack.evaluate(i);if(!Se(c,["boolean","string","number","null"]))throw new rn(`Expected first argument to be of type boolean, string, number or null, but found ${le(In(c))} instead.`);if(!Se(f,["string","array"]))throw new rn(`Expected second argument to be of type array or string, but found ${le(In(f))} instead.`);if(this.fromIndex){const g=this.fromIndex.evaluate(i);return f.indexOf(c,g)}return f.indexOf(c)}eachChild(i){i(this.needle),i(this.haystack),this.fromIndex&&i(this.fromIndex)}outputDefined(){return!1}}class Uc{constructor(i,c,f,g,b,w){this.inputType=i,this.type=c,this.input=f,this.cases=g,this.outputs=b,this.otherwise=w}static parse(i,c){if(i.length<5)return c.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if(i.length%2!=1)return c.error("Expected an even number of arguments.");let f,g;c.expectedType&&c.expectedType.kind!=="value"&&(g=c.expectedType);const b={},w=[];for(let L=2;LNumber.MAX_SAFE_INTEGER)return H.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ee=="number"&&Math.floor(ee)!==ee)return H.error("Numeric branch labels must be integer values.");if(f){if(H.checkSubtype(f,In(ee)))return null}else f=In(ee);if(b[String(ee)]!==void 0)return H.error("Branch labels must be unique.");b[String(ee)]=w.length}const J=c.parse(j,L,g);if(!J)return null;g=g||J.type,w.push(J)}const T=c.parse(i[1],1,Qt);if(!T)return null;const I=c.parse(i[i.length-1],i.length-1,g);return I?T.type.kind!=="value"&&c.concat(1).checkSubtype(f,T.type)?null:new Uc(f,g,T,b,w,I):null}evaluate(i){const c=this.input.evaluate(i);return(In(c)===this.inputType&&this.outputs[this.cases[c]]||this.otherwise).evaluate(i)}eachChild(i){i(this.input),this.outputs.forEach(i),i(this.otherwise)}outputDefined(){return this.outputs.every(i=>i.outputDefined())&&this.otherwise.outputDefined()}}class Vc{constructor(i,c,f){this.type=i,this.branches=c,this.otherwise=f}static parse(i,c){if(i.length<4)return c.error(`Expected at least 3 arguments, but found only ${i.length-1}.`);if(i.length%2!=0)return c.error("Expected an odd number of arguments.");let f;c.expectedType&&c.expectedType.kind!=="value"&&(f=c.expectedType);const g=[];for(let w=1;wc.outputDefined())&&this.otherwise.outputDefined()}}class bl{constructor(i,c,f,g){this.type=i,this.input=c,this.beginIndex=f,this.endIndex=g}static parse(i,c){if(i.length<=2||i.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);const f=c.parse(i[1],1,Qt),g=c.parse(i[2],2,mt);if(!f||!g)return null;if(!Pe(f.type,[te(Qt),rr,Qt]))return c.error(`Expected first argument to be of type array or string, but found ${le(f.type)} instead`);if(i.length===4){const b=c.parse(i[3],3,mt);return b?new bl(f.type,f,g,b):null}return new bl(f.type,f,g)}evaluate(i){const c=this.input.evaluate(i),f=this.beginIndex.evaluate(i);if(!Se(c,["string","array"]))throw new rn(`Expected first argument to be of type array or string, but found ${le(In(c))} instead.`);if(this.endIndex){const g=this.endIndex.evaluate(i);return c.slice(f,g)}return c.slice(f)}eachChild(i){i(this.input),i(this.beginIndex),this.endIndex&&i(this.endIndex)}outputDefined(){return!1}}function Fh(s,i){return s==="=="||s==="!="?i.kind==="boolean"||i.kind==="string"||i.kind==="number"||i.kind==="null"||i.kind==="value":i.kind==="string"||i.kind==="number"||i.kind==="value"}function Oh(s,i,c,f){return f.compare(i,c)===0}function Us(s,i,c){const f=s!=="=="&&s!=="!=";return class Nb{constructor(b,w,T){this.type=Jt,this.lhs=b,this.rhs=w,this.collator=T,this.hasUntypedArgument=b.type.kind==="value"||w.type.kind==="value"}static parse(b,w){if(b.length!==3&&b.length!==4)return w.error("Expected two or three arguments.");const T=b[0];let I=w.parse(b[1],1,Qt);if(!I)return null;if(!Fh(T,I.type))return w.concat(1).error(`"${T}" comparisons are not supported for type '${le(I.type)}'.`);let L=w.parse(b[2],2,Qt);if(!L)return null;if(!Fh(T,L.type))return w.concat(2).error(`"${T}" comparisons are not supported for type '${le(L.type)}'.`);if(I.type.kind!==L.type.kind&&I.type.kind!=="value"&&L.type.kind!=="value")return w.error(`Cannot compare types '${le(I.type)}' and '${le(L.type)}'.`);f&&(I.type.kind==="value"&&L.type.kind!=="value"?I=new Bi(L.type,[I]):I.type.kind!=="value"&&L.type.kind==="value"&&(L=new Bi(I.type,[L])));let F=null;if(b.length===4){if(I.type.kind!=="string"&&L.type.kind!=="string"&&I.type.kind!=="value"&&L.type.kind!=="value")return w.error("Cannot use collator to compare non-string types.");if(F=w.parse(b[3],3,ro),!F)return null}return new Nb(I,L,F)}evaluate(b){const w=this.lhs.evaluate(b),T=this.rhs.evaluate(b);if(f&&this.hasUntypedArgument){const I=In(w),L=In(T);if(I.kind!==L.kind||I.kind!=="string"&&I.kind!=="number")throw new rn(`Expected arguments for "${s}" to be (string, string) or (number, number), but found (${I.kind}, ${L.kind}) instead.`)}if(this.collator&&!f&&this.hasUntypedArgument){const I=In(w),L=In(T);if(I.kind!=="string"||L.kind!=="string")return i(b,w,T)}return this.collator?c(b,w,T,this.collator.evaluate(b)):i(b,w,T)}eachChild(b){b(this.lhs),b(this.rhs),this.collator&&b(this.collator)}outputDefined(){return!0}}}const Yd=Us("==",function(s,i,c){return i===c},Oh),Qd=Us("!=",function(s,i,c){return i!==c},function(s,i,c,f){return!Oh(0,i,c,f)}),ep=Us("<",function(s,i,c){return i",function(s,i,c){return i>c},function(s,i,c,f){return f.compare(i,c)>0}),rp=Us("<=",function(s,i,c){return i<=c},function(s,i,c,f){return f.compare(i,c)<=0}),np=Us(">=",function(s,i,c){return i>=c},function(s,i,c,f){return f.compare(i,c)>=0});class qc{constructor(i,c,f,g,b){this.type=rr,this.number=i,this.locale=c,this.currency=f,this.minFractionDigits=g,this.maxFractionDigits=b}static parse(i,c){if(i.length!==3)return c.error("Expected two arguments.");const f=c.parse(i[1],1,mt);if(!f)return null;const g=i[2];if(typeof g!="object"||Array.isArray(g))return c.error("NumberFormat options argument must be an object.");let b=null;if(g.locale&&(b=c.parse(g.locale,1,rr),!b))return null;let w=null;if(g.currency&&(w=c.parse(g.currency,1,rr),!w))return null;let T=null;if(g["min-fraction-digits"]&&(T=c.parse(g["min-fraction-digits"],1,mt),!T))return null;let I=null;return g["max-fraction-digits"]&&(I=c.parse(g["max-fraction-digits"],1,mt),!I)?null:new qc(f,b,w,T,I)}evaluate(i){return new Intl.NumberFormat(this.locale?this.locale.evaluate(i):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(i):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(i):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(i):void 0}).format(this.number.evaluate(i))}eachChild(i){i(this.number),this.locale&&i(this.locale),this.currency&&i(this.currency),this.minFractionDigits&&i(this.minFractionDigits),this.maxFractionDigits&&i(this.maxFractionDigits)}outputDefined(){return!1}}class wl{constructor(i){this.type=an,this.sections=i}static parse(i,c){if(i.length<2)return c.error("Expected at least one argument.");const f=i[1];if(!Array.isArray(f)&&typeof f=="object")return c.error("First argument must be an image or text section.");const g=[];let b=!1;for(let w=1;w<=i.length-1;++w){const T=i[w];if(b&&typeof T=="object"&&!Array.isArray(T)){b=!1;let I=null;if(T["font-scale"]&&(I=c.parse(T["font-scale"],1,mt),!I))return null;let L=null;if(T["text-font"]&&(L=c.parse(T["text-font"],1,te(rr)),!L))return null;let F=null;if(T["text-color"]&&(F=c.parse(T["text-color"],1,Nr),!F))return null;const j=g[g.length-1];j.scale=I,j.font=L,j.textColor=F}else{const I=c.parse(i[w],1,Qt);if(!I)return null;const L=I.type.kind;if(L!=="string"&&L!=="value"&&L!=="null"&&L!=="resolvedImage")return c.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");b=!0,g.push({content:I,scale:null,font:null,textColor:null})}}return new wl(g)}evaluate(i){return new Ri(this.sections.map(c=>{const f=c.content.evaluate(i);return In(f)===Z?new Oc("",f,null,null,null):new Oc(Ta(f),null,c.scale?c.scale.evaluate(i):null,c.font?c.font.evaluate(i).join(","):null,c.textColor?c.textColor.evaluate(i):null)}))}eachChild(i){for(const c of this.sections)i(c.content),c.scale&&i(c.scale),c.font&&i(c.font),c.textColor&&i(c.textColor)}outputDefined(){return!1}}class Gc{constructor(i){this.type=Z,this.input=i}static parse(i,c){if(i.length!==2)return c.error("Expected two arguments.");const f=c.parse(i[1],1,rr);return f?new Gc(f):c.error("No image name provided.")}evaluate(i){const c=this.input.evaluate(i),f=Xi.fromString(c);return f&&i.availableImages&&(f.available=i.availableImages.indexOf(c)>-1),f}eachChild(i){i(this.input)}outputDefined(){return!1}}class Wc{constructor(i){this.type=mt,this.input=i}static parse(i,c){if(i.length!==2)return c.error(`Expected 1 argument, but found ${i.length-1} instead.`);const f=c.parse(i[1],1);return f?f.type.kind!=="array"&&f.type.kind!=="string"&&f.type.kind!=="value"?c.error(`Expected argument of type string or array, but found ${le(f.type)} instead.`):new Wc(f):null}evaluate(i){const c=this.input.evaluate(i);if(typeof c=="string"||Array.isArray(c))return c.length;throw new rn(`Expected value to be of type string or array, but found ${le(In(c))} instead.`)}eachChild(i){i(this.input)}outputDefined(){return!1}}const Vs={"==":Yd,"!=":Qd,">":tp,"<":ep,">=":np,"<=":rp,array:Bi,at:Nc,boolean:Bi,case:Vc,coalesce:_l,collator:js,format:wl,image:Gc,in:jc,"index-of":vl,interpolate:oi,"interpolate-hcl":oi,"interpolate-lab":oi,length:Wc,let:yl,literal:Xo,match:Uc,number:Bi,"number-format":qc,object:Bi,slice:bl,step:Pa,string:Bi,"to-boolean":go,"to-color":go,"to-number":go,"to-string":go,var:pl,within:ds};function Nh(s,[i,c,f,g]){i=i.evaluate(s),c=c.evaluate(s),f=f.evaluate(s);const b=g?g.evaluate(s):1,w=Ns(i,c,f,b);if(w)throw new rn(w);return new zr(i/255,c/255,f/255,b,!1)}function jh(s,i){return s in i}function Zc(s,i){const c=i[s];return c===void 0?null:c}function ms(s){return{type:s}}function Uh(s){return{result:"success",value:s}}function qs(s){return{result:"error",value:s}}function Gs(s){return s["property-type"]==="data-driven"||s["property-type"]==="cross-faded-data-driven"}function Vh(s){return!!s.expression&&s.expression.parameters.indexOf("zoom")>-1}function Hc(s){return!!s.expression&&s.expression.interpolated}function kr(s){return s instanceof Number?"number":s instanceof String?"string":s instanceof Boolean?"boolean":Array.isArray(s)?"array":s===null?"null":typeof s}function xl(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function ip(s){return s}function qh(s,i){const c=i.type==="color",f=s.stops&&typeof s.stops[0][0]=="object",g=f||!(f||s.property!==void 0),b=s.type||(Hc(i)?"exponential":"interval");if(c||i.type==="padding"){const F=c?zr.parse:wi.parse;(s=Xn({},s)).stops&&(s.stops=s.stops.map(j=>[j[0],F(j[1])])),s.default=F(s.default?s.default:i.default)}if(s.colorSpace&&(w=s.colorSpace)!=="rgb"&&w!=="hcl"&&w!=="lab")throw new Error(`Unknown color space: "${s.colorSpace}"`);var w;let T,I,L;if(b==="exponential")T=wr;else if(b==="interval")T=op;else if(b==="categorical"){T=Sn,I=Object.create(null);for(const F of s.stops)I[F[0]]=F[1];L=typeof s.stops[0][0]}else{if(b!=="identity")throw new Error(`Unknown function type "${b}"`);T=$c}if(f){const F={},j=[];for(let ee=0;eeee[0]),evaluate:({zoom:ee},ae)=>wr({stops:H,base:s.base},i,ee).evaluate(ee,ae)}}if(g){const F=b==="exponential"?{name:"exponential",base:s.base!==void 0?s.base:1}:null;return{kind:"camera",interpolationType:F,interpolationFactor:oi.interpolationFactor.bind(void 0,F),zoomStops:s.stops.map(j=>j[0]),evaluate:({zoom:j})=>T(s,i,j,I,L)}}return{kind:"source",evaluate(F,j){const H=j&&j.properties?j.properties[s.property]:void 0;return H===void 0?za(s.default,i.default):T(s,i,H,I,L)}}}function za(s,i,c){return s!==void 0?s:i!==void 0?i:c!==void 0?c:void 0}function Sn(s,i,c,f,g){return za(typeof c===g?f[c]:void 0,s.default,i.default)}function op(s,i,c){if(kr(c)!=="number")return za(s.default,i.default);const f=s.stops.length;if(f===1||c<=s.stops[0][0])return s.stops[0][1];if(c>=s.stops[f-1][0])return s.stops[f-1][1];const g=La(s.stops.map(b=>b[0]),c);return s.stops[g][1]}function wr(s,i,c){const f=s.base!==void 0?s.base:1;if(kr(c)!=="number")return za(s.default,i.default);const g=s.stops.length;if(g===1||c<=s.stops[0][0])return s.stops[0][1];if(c>=s.stops[g-1][0])return s.stops[g-1][1];const b=La(s.stops.map(F=>F[0]),c),w=function(F,j,H,J){const ee=J-H,ae=F-H;return ee===0?0:j===1?ae/ee:(Math.pow(j,ae)-1)/(Math.pow(j,ee)-1)}(c,f,s.stops[b][0],s.stops[b+1][0]),T=s.stops[b][1],I=s.stops[b+1][1],L=di[i.type]||ip;return typeof T.evaluate=="function"?{evaluate(...F){const j=T.evaluate.apply(void 0,F),H=I.evaluate.apply(void 0,F);if(j!==void 0&&H!==void 0)return L(j,H,w,s.colorSpace)}}:L(T,I,w,s.colorSpace)}function $c(s,i,c){switch(i.type){case"color":c=zr.parse(c);break;case"formatted":c=Ri.fromString(c.toString());break;case"resolvedImage":c=Xi.fromString(c.toString());break;case"padding":c=wi.parse(c);break;default:kr(c)===i.type||i.type==="enum"&&i.values[c]||(c=void 0)}return za(c,s.default,i.default)}Fi.register(Vs,{error:[{kind:"error"},[rr],(s,[i])=>{throw new rn(i.evaluate(s))}],typeof:[rr,[Qt],(s,[i])=>le(In(i.evaluate(s)))],"to-rgba":[te(mt,4),[Nr],(s,[i])=>{const[c,f,g,b]=i.evaluate(s).rgb;return[255*c,255*f,255*g,b]}],rgb:[Nr,[mt,mt,mt],Nh],rgba:[Nr,[mt,mt,mt,mt],Nh],has:{type:Jt,overloads:[[[rr],(s,[i])=>jh(i.evaluate(s),s.properties())],[[rr,vi],(s,[i,c])=>jh(i.evaluate(s),c.evaluate(s))]]},get:{type:Qt,overloads:[[[rr],(s,[i])=>Zc(i.evaluate(s),s.properties())],[[rr,vi],(s,[i,c])=>Zc(i.evaluate(s),c.evaluate(s))]]},"feature-state":[Qt,[rr],(s,[i])=>Zc(i.evaluate(s),s.featureState||{})],properties:[vi,[],s=>s.properties()],"geometry-type":[rr,[],s=>s.geometryType()],id:[Qt,[],s=>s.id()],zoom:[mt,[],s=>s.globals.zoom],"heatmap-density":[mt,[],s=>s.globals.heatmapDensity||0],"line-progress":[mt,[],s=>s.globals.lineProgress||0],accumulated:[Qt,[],s=>s.globals.accumulated===void 0?null:s.globals.accumulated],"+":[mt,ms(mt),(s,i)=>{let c=0;for(const f of i)c+=f.evaluate(s);return c}],"*":[mt,ms(mt),(s,i)=>{let c=1;for(const f of i)c*=f.evaluate(s);return c}],"-":{type:mt,overloads:[[[mt,mt],(s,[i,c])=>i.evaluate(s)-c.evaluate(s)],[[mt],(s,[i])=>-i.evaluate(s)]]},"/":[mt,[mt,mt],(s,[i,c])=>i.evaluate(s)/c.evaluate(s)],"%":[mt,[mt,mt],(s,[i,c])=>i.evaluate(s)%c.evaluate(s)],ln2:[mt,[],()=>Math.LN2],pi:[mt,[],()=>Math.PI],e:[mt,[],()=>Math.E],"^":[mt,[mt,mt],(s,[i,c])=>Math.pow(i.evaluate(s),c.evaluate(s))],sqrt:[mt,[mt],(s,[i])=>Math.sqrt(i.evaluate(s))],log10:[mt,[mt],(s,[i])=>Math.log(i.evaluate(s))/Math.LN10],ln:[mt,[mt],(s,[i])=>Math.log(i.evaluate(s))],log2:[mt,[mt],(s,[i])=>Math.log(i.evaluate(s))/Math.LN2],sin:[mt,[mt],(s,[i])=>Math.sin(i.evaluate(s))],cos:[mt,[mt],(s,[i])=>Math.cos(i.evaluate(s))],tan:[mt,[mt],(s,[i])=>Math.tan(i.evaluate(s))],asin:[mt,[mt],(s,[i])=>Math.asin(i.evaluate(s))],acos:[mt,[mt],(s,[i])=>Math.acos(i.evaluate(s))],atan:[mt,[mt],(s,[i])=>Math.atan(i.evaluate(s))],min:[mt,ms(mt),(s,i)=>Math.min(...i.map(c=>c.evaluate(s)))],max:[mt,ms(mt),(s,i)=>Math.max(...i.map(c=>c.evaluate(s)))],abs:[mt,[mt],(s,[i])=>Math.abs(i.evaluate(s))],round:[mt,[mt],(s,[i])=>{const c=i.evaluate(s);return c<0?-Math.round(-c):Math.round(c)}],floor:[mt,[mt],(s,[i])=>Math.floor(i.evaluate(s))],ceil:[mt,[mt],(s,[i])=>Math.ceil(i.evaluate(s))],"filter-==":[Jt,[rr,Qt],(s,[i,c])=>s.properties()[i.value]===c.value],"filter-id-==":[Jt,[Qt],(s,[i])=>s.id()===i.value],"filter-type-==":[Jt,[rr],(s,[i])=>s.geometryType()===i.value],"filter-<":[Jt,[rr,Qt],(s,[i,c])=>{const f=s.properties()[i.value],g=c.value;return typeof f==typeof g&&f{const c=s.id(),f=i.value;return typeof c==typeof f&&c":[Jt,[rr,Qt],(s,[i,c])=>{const f=s.properties()[i.value],g=c.value;return typeof f==typeof g&&f>g}],"filter-id->":[Jt,[Qt],(s,[i])=>{const c=s.id(),f=i.value;return typeof c==typeof f&&c>f}],"filter-<=":[Jt,[rr,Qt],(s,[i,c])=>{const f=s.properties()[i.value],g=c.value;return typeof f==typeof g&&f<=g}],"filter-id-<=":[Jt,[Qt],(s,[i])=>{const c=s.id(),f=i.value;return typeof c==typeof f&&c<=f}],"filter->=":[Jt,[rr,Qt],(s,[i,c])=>{const f=s.properties()[i.value],g=c.value;return typeof f==typeof g&&f>=g}],"filter-id->=":[Jt,[Qt],(s,[i])=>{const c=s.id(),f=i.value;return typeof c==typeof f&&c>=f}],"filter-has":[Jt,[Qt],(s,[i])=>i.value in s.properties()],"filter-has-id":[Jt,[],s=>s.id()!==null&&s.id()!==void 0],"filter-type-in":[Jt,[te(rr)],(s,[i])=>i.value.indexOf(s.geometryType())>=0],"filter-id-in":[Jt,[te(Qt)],(s,[i])=>i.value.indexOf(s.id())>=0],"filter-in-small":[Jt,[rr,te(Qt)],(s,[i,c])=>c.value.indexOf(s.properties()[i.value])>=0],"filter-in-large":[Jt,[rr,te(Qt)],(s,[i,c])=>function(f,g,b,w){for(;b<=w;){const T=b+w>>1;if(g[T]===f)return!0;g[T]>f?w=T-1:b=T+1}return!1}(s.properties()[i.value],c.value,0,c.value.length-1)],all:{type:Jt,overloads:[[[Jt,Jt],(s,[i,c])=>i.evaluate(s)&&c.evaluate(s)],[ms(Jt),(s,i)=>{for(const c of i)if(!c.evaluate(s))return!1;return!0}]]},any:{type:Jt,overloads:[[[Jt,Jt],(s,[i,c])=>i.evaluate(s)||c.evaluate(s)],[ms(Jt),(s,i)=>{for(const c of i)if(c.evaluate(s))return!0;return!1}]]},"!":[Jt,[Jt],(s,[i])=>!i.evaluate(s)],"is-supported-script":[Jt,[rr],(s,[i])=>{const c=s.globals&&s.globals.isSupportedScript;return!c||c(i.evaluate(s))}],upcase:[rr,[rr],(s,[i])=>i.evaluate(s).toUpperCase()],downcase:[rr,[rr],(s,[i])=>i.evaluate(s).toLowerCase()],concat:[rr,ms(Qt),(s,i)=>i.map(c=>Ta(c.evaluate(s))).join("")],"resolved-locale":[rr,[ro],(s,[i])=>i.evaluate(s).resolvedLocale()]});class $r{constructor(i,c){var f;this.expression=i,this._warningHistory={},this._evaluator=new Dr,this._defaultValue=c?(f=c).type==="color"&&xl(f.default)?new zr(0,0,0,0):f.type==="color"?zr.parse(f.default)||null:f.type==="padding"?wi.parse(f.default)||null:f.type==="variableAnchorOffsetCollection"?$i.parse(f.default)||null:f.default===void 0?null:f.default:null,this._enumValues=c&&c.type==="enum"?c.values:null}evaluateWithoutErrorHandling(i,c,f,g,b,w){return this._evaluator.globals=i,this._evaluator.feature=c,this._evaluator.featureState=f,this._evaluator.canonical=g,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=w,this.expression.evaluate(this._evaluator)}evaluate(i,c,f,g,b,w){this._evaluator.globals=i,this._evaluator.feature=c||null,this._evaluator.featureState=f||null,this._evaluator.canonical=g,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=w||null;try{const T=this.expression.evaluate(this._evaluator);if(T==null||typeof T=="number"&&T!=T)return this._defaultValue;if(this._enumValues&&!(T in this._enumValues))throw new rn(`Expected value to be one of ${Object.keys(this._enumValues).map(I=>JSON.stringify(I)).join(", ")}, but found ${JSON.stringify(T)} instead.`);return T}catch(T){return this._warningHistory[T.message]||(this._warningHistory[T.message]=!0,typeof console<"u"&&console.warn(T.message)),this._defaultValue}}}function jr(s){return Array.isArray(s)&&s.length>0&&typeof s[0]=="string"&&s[0]in Vs}function gs(s,i){const c=new cl(Vs,Ca,[],i?function(g){const b={color:Nr,string:rr,number:mt,enum:rr,boolean:Jt,formatted:an,padding:pe,resolvedImage:Z,variableAnchorOffsetCollection:$};return g.type==="array"?te(b[g.value]||Qt,g.length):b[g.type]}(i):void 0),f=c.parse(s,void 0,void 0,void 0,i&&i.type==="string"?{typeAnnotation:"coerce"}:void 0);return f?Uh(new $r(f,i)):qs(c.errors)}class Sl{constructor(i,c){this.kind=i,this._styleExpression=c,this.isStateDependent=i!=="constant"&&!Ia(c.expression)}evaluateWithoutErrorHandling(i,c,f,g,b,w){return this._styleExpression.evaluateWithoutErrorHandling(i,c,f,g,b,w)}evaluate(i,c,f,g,b,w){return this._styleExpression.evaluate(i,c,f,g,b,w)}}class Xc{constructor(i,c,f,g){this.kind=i,this.zoomStops=f,this._styleExpression=c,this.isStateDependent=i!=="camera"&&!Ia(c.expression),this.interpolationType=g}evaluateWithoutErrorHandling(i,c,f,g,b,w){return this._styleExpression.evaluateWithoutErrorHandling(i,c,f,g,b,w)}evaluate(i,c,f,g,b,w){return this._styleExpression.evaluate(i,c,f,g,b,w)}interpolationFactor(i,c,f){return this.interpolationType?oi.interpolationFactor(this.interpolationType,i,c,f):0}}function Gh(s,i){const c=gs(s,i);if(c.result==="error")return c;const f=c.value.expression,g=ml(f);if(!g&&!Gs(i))return qs([new xn("","data expressions not supported")]);const b=Aa(f,["zoom"]);if(!b&&!Vh(i))return qs([new xn("","zoom expressions not supported")]);const w=Tl(f);return w||b?w instanceof xn?qs([w]):w instanceof oi&&!Hc(i)?qs([new xn("",'"interpolate" expressions cannot be used with this property')]):Uh(w?new Xc(g?"camera":"composite",c.value,w.labels,w instanceof oi?w.interpolation:void 0):new Sl(g?"constant":"source",c.value)):qs([new xn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class kl{constructor(i,c){this._parameters=i,this._specification=c,Xn(this,qh(this._parameters,this._specification))}static deserialize(i){return new kl(i._parameters,i._specification)}static serialize(i){return{_parameters:i._parameters,_specification:i._specification}}}function Tl(s){let i=null;if(s instanceof yl)i=Tl(s.result);else if(s instanceof _l){for(const c of s.args)if(i=Tl(c),i)break}else(s instanceof Pa||s instanceof oi)&&s.input instanceof Fi&&s.input.name==="zoom"&&(i=s);return i instanceof xn||s.eachChild(c=>{const f=Tl(c);f instanceof xn?i=f:!i&&f?i=new xn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):i&&f&&i!==f&&(i=new xn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),i}function El(s){if(s===!0||s===!1)return!0;if(!Array.isArray(s)||s.length===0)return!1;switch(s[0]){case"has":return s.length>=2&&s[1]!=="$id"&&s[1]!=="$type";case"in":return s.length>=3&&(typeof s[1]!="string"||Array.isArray(s[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return s.length!==3||Array.isArray(s[1])||Array.isArray(s[2]);case"any":case"all":for(const i of s.slice(1))if(!El(i)&&typeof i!="boolean")return!1;return!0;default:return!0}}const Wh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ml(s){if(s==null)return{filter:()=>!0,needGeometry:!1};El(s)||(s=Il(s));const i=gs(s,Wh);if(i.result==="error")throw new Error(i.value.map(c=>`${c.key}: ${c.message}`).join(", "));return{filter:(c,f,g)=>i.value.evaluate(c,f,{},g),needGeometry:Cl(s)}}function Zh(s,i){return si?1:0}function Cl(s){if(!Array.isArray(s))return!1;if(s[0]==="within")return!0;for(let i=1;i"||i==="<="||i===">="?Kc(s[1],s[2],i):i==="any"?(c=s.slice(1),["any"].concat(c.map(Il))):i==="all"?["all"].concat(s.slice(1).map(Il)):i==="none"?["all"].concat(s.slice(1).map(Il).map(Al)):i==="in"?Hh(s[1],s.slice(2)):i==="!in"?Al(Hh(s[1],s.slice(2))):i==="has"?$h(s[1]):i==="!has"?Al($h(s[1])):i!=="within"||s;var c}function Kc(s,i,c){switch(s){case"$type":return[`filter-type-${c}`,i];case"$id":return[`filter-id-${c}`,i];default:return[`filter-${c}`,s,i]}}function Hh(s,i){if(i.length===0)return!1;switch(s){case"$type":return["filter-type-in",["literal",i]];case"$id":return["filter-id-in",["literal",i]];default:return i.length>200&&!i.some(c=>typeof c!=typeof i[0])?["filter-in-large",s,["literal",i.sort(Zh)]]:["filter-in-small",s,["literal",i]]}}function $h(s){switch(s){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",s]}}function Al(s){return["!",s]}function Jc(s){const i=typeof s;if(i==="number"||i==="boolean"||i==="string"||s==null)return JSON.stringify(s);if(Array.isArray(s)){let g="[";for(const b of s)g+=`${Jc(b)},`;return`${g}]`}const c=Object.keys(s).sort();let f="{";for(let g=0;gf.maximum?[new ct(i,c,`${c} is greater than the maximum value ${f.maximum}`)]:[]}function Kh(s){const i=s.valueSpec,c=cn(s.value.type);let f,g,b,w={};const T=c!=="categorical"&&s.value.property===void 0,I=!T,L=kr(s.value.stops)==="array"&&kr(s.value.stops[0])==="array"&&kr(s.value.stops[0][0])==="object",F=pi({key:s.key,value:s.value,valueSpec:s.styleSpec.function,validateSpec:s.validateSpec,style:s.style,styleSpec:s.styleSpec,objectElementValidators:{stops:function(J){if(c==="identity")return[new ct(J.key,J.value,'identity function may not have a "stops" property')];let ee=[];const ae=J.value;return ee=ee.concat(Yc({key:J.key,value:ae,valueSpec:J.valueSpec,validateSpec:J.validateSpec,style:J.style,styleSpec:J.styleSpec,arrayElementValidator:j})),kr(ae)==="array"&&ae.length===0&&ee.push(new ct(J.key,ae,"array must have at least one stop")),ee},default:function(J){return J.validateSpec({key:J.key,value:J.value,valueSpec:i,validateSpec:J.validateSpec,style:J.style,styleSpec:J.styleSpec})}}});return c==="identity"&&T&&F.push(new ct(s.key,s.value,'missing required property "property"')),c==="identity"||s.value.stops||F.push(new ct(s.key,s.value,'missing required property "stops"')),c==="exponential"&&s.valueSpec.expression&&!Hc(s.valueSpec)&&F.push(new ct(s.key,s.value,"exponential functions not supported")),s.styleSpec.$version>=8&&(I&&!Gs(s.valueSpec)?F.push(new ct(s.key,s.value,"property functions not supported")):T&&!Vh(s.valueSpec)&&F.push(new ct(s.key,s.value,"zoom functions not supported"))),c!=="categorical"&&!L||s.value.property!==void 0||F.push(new ct(s.key,s.value,'"property" property is required')),F;function j(J){let ee=[];const ae=J.value,ge=J.key;if(kr(ae)!=="array")return[new ct(ge,ae,`array expected, ${kr(ae)} found`)];if(ae.length!==2)return[new ct(ge,ae,`array length 2 expected, length ${ae.length} found`)];if(L){if(kr(ae[0])!=="object")return[new ct(ge,ae,`object expected, ${kr(ae[0])} found`)];if(ae[0].zoom===void 0)return[new ct(ge,ae,"object stop key must have zoom")];if(ae[0].value===void 0)return[new ct(ge,ae,"object stop key must have value")];if(b&&b>cn(ae[0].zoom))return[new ct(ge,ae[0].zoom,"stop zoom values must appear in ascending order")];cn(ae[0].zoom)!==b&&(b=cn(ae[0].zoom),g=void 0,w={}),ee=ee.concat(pi({key:`${ge}[0]`,value:ae[0],valueSpec:{zoom:{}},validateSpec:J.validateSpec,style:J.style,styleSpec:J.styleSpec,objectElementValidators:{zoom:Ll,value:H}}))}else ee=ee.concat(H({key:`${ge}[0]`,value:ae[0],valueSpec:{},validateSpec:J.validateSpec,style:J.style,styleSpec:J.styleSpec},ae));return jr(Jo(ae[1]))?ee.concat([new ct(`${ge}[1]`,ae[1],"expressions are not allowed in function stops.")]):ee.concat(J.validateSpec({key:`${ge}[1]`,value:ae[1],valueSpec:i,validateSpec:J.validateSpec,style:J.style,styleSpec:J.styleSpec}))}function H(J,ee){const ae=kr(J.value),ge=cn(J.value),xe=J.value!==null?J.value:ee;if(f){if(ae!==f)return[new ct(J.key,xe,`${ae} stop domain type must match previous stop domain type ${f}`)]}else f=ae;if(ae!=="number"&&ae!=="string"&&ae!=="boolean")return[new ct(J.key,xe,"stop domain value must be a number, string, or boolean")];if(ae!=="number"&&c!=="categorical"){let Re=`number expected, ${ae} found`;return Gs(i)&&c===void 0&&(Re+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ct(J.key,xe,Re)]}return c!=="categorical"||ae!=="number"||isFinite(ge)&&Math.floor(ge)===ge?c!=="categorical"&&ae==="number"&&g!==void 0&&genew ct(`${s.key}${f.key}`,s.value,f.message));const c=i.value.expression||i.value._styleExpression.expression;if(s.expressionContext==="property"&&s.propertyKey==="text-font"&&!c.outputDefined())return[new ct(s.key,s.value,`Invalid data expression for "${s.propertyKey}". Output values must be contained as literals within the expression.`)];if(s.expressionContext==="property"&&s.propertyType==="layout"&&!Ia(c))return[new ct(s.key,s.value,'"feature-state" data expressions are not supported with layout properties.')];if(s.expressionContext==="filter"&&!Ia(c))return[new ct(s.key,s.value,'"feature-state" data expressions are not supported with filters.')];if(s.expressionContext&&s.expressionContext.indexOf("cluster")===0){if(!Aa(c,["zoom","feature-state"]))return[new ct(s.key,s.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(s.expressionContext==="cluster-initial"&&!ml(c))return[new ct(s.key,s.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Qo(s){const i=s.key,c=s.value,f=s.valueSpec,g=[];return Array.isArray(f.values)?f.values.indexOf(cn(c))===-1&&g.push(new ct(i,c,`expected one of [${f.values.join(", ")}], ${JSON.stringify(c)} found`)):Object.keys(f.values).indexOf(cn(c))===-1&&g.push(new ct(i,c,`expected one of [${Object.keys(f.values).join(", ")}], ${JSON.stringify(c)} found`)),g}function Ws(s){return El(Jo(s.value))?Yo(Xn({},s,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Qc(s)}function Qc(s){const i=s.value,c=s.key;if(kr(i)!=="array")return[new ct(c,i,`array expected, ${kr(i)} found`)];const f=s.styleSpec;let g,b=[];if(i.length<1)return[new ct(c,i,"filter array must have at least 1 element")];switch(b=b.concat(Qo({key:`${c}[0]`,value:i[0],valueSpec:f.filter_operator,style:s.style,styleSpec:s.styleSpec})),cn(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&cn(i[1])==="$type"&&b.push(new ct(c,i,`"$type" cannot be use with operator "${i[0]}"`));case"==":case"!=":i.length!==3&&b.push(new ct(c,i,`filter array for operator "${i[0]}" must have 3 elements`));case"in":case"!in":i.length>=2&&(g=kr(i[1]),g!=="string"&&b.push(new ct(`${c}[1]`,i[1],`string expected, ${g} found`)));for(let w=2;w{L in c&&i.push(new ct(f,c[L],`"${L}" is prohibited for ref layers`))}),g.layers.forEach(L=>{cn(L.id)===T&&(I=L)}),I?I.ref?i.push(new ct(f,c.ref,"ref cannot reference another ref layer")):w=cn(I.type):i.push(new ct(f,c.ref,`ref layer "${T}" not found`))}else if(w!=="background")if(c.source){const I=g.sources&&g.sources[c.source],L=I&&cn(I.type);I?L==="vector"&&w==="raster"?i.push(new ct(f,c.source,`layer "${c.id}" requires a raster source`)):L!=="raster-dem"&&w==="hillshade"?i.push(new ct(f,c.source,`layer "${c.id}" requires a raster-dem source`)):L==="raster"&&w!=="raster"?i.push(new ct(f,c.source,`layer "${c.id}" requires a vector source`)):L!=="vector"||c["source-layer"]?L==="raster-dem"&&w!=="hillshade"?i.push(new ct(f,c.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!c.paint||!c.paint["line-gradient"]||L==="geojson"&&I.lineMetrics||i.push(new ct(f,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):i.push(new ct(f,c,`layer "${c.id}" must specify a "source-layer"`)):i.push(new ct(f,c.source,`source "${c.source}" not found`))}else i.push(new ct(f,c,'missing required property "source"'));return i=i.concat(pi({key:f,value:c,valueSpec:b.layer,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,objectElementValidators:{"*":()=>[],type:()=>s.validateSpec({key:`${f}.type`,value:c.type,valueSpec:b.layer.type,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,object:c,objectKey:"type"}),filter:Ws,layout:I=>pi({layer:c,key:I.key,value:I.value,style:I.style,styleSpec:I.styleSpec,validateSpec:I.validateSpec,objectElementValidators:{"*":L=>tu(Xn({layerType:w},L))}}),paint:I=>pi({layer:c,key:I.key,value:I.value,style:I.style,styleSpec:I.styleSpec,validateSpec:I.validateSpec,objectElementValidators:{"*":L=>eu(Xn({layerType:w},L))}})}})),i}function _s(s){const i=s.value,c=s.key,f=kr(i);return f!=="string"?[new ct(c,i,`string expected, ${f} found`)]:[]}const Jh={promoteId:function({key:s,value:i}){if(kr(i)==="string")return _s({key:s,value:i});{const c=[];for(const f in i)c.push(..._s({key:`${s}.${f}`,value:i[f]}));return c}}};function Yh(s){const i=s.value,c=s.key,f=s.styleSpec,g=s.style,b=s.validateSpec;if(!i.type)return[new ct(c,i,'"type" is required')];const w=cn(i.type);let T;switch(w){case"vector":case"raster":return T=pi({key:c,value:i,valueSpec:f[`source_${w.replace("-","_")}`],style:s.style,styleSpec:f,objectElementValidators:Jh,validateSpec:b}),T;case"raster-dem":return T=function(I){var L;const F=(L=I.sourceName)!==null&&L!==void 0?L:"",j=I.value,H=I.styleSpec,J=H.source_raster_dem,ee=I.style;let ae=[];const ge=kr(j);if(j===void 0)return ae;if(ge!=="object")return ae.push(new ct("source_raster_dem",j,`object expected, ${ge} found`)),ae;const xe=cn(j.encoding)==="custom",Re=["redFactor","greenFactor","blueFactor","baseShift"],ke=I.value.encoding?`"${I.value.encoding}"`:"Default";for(const Ae in j)!xe&&Re.includes(Ae)?ae.push(new ct(Ae,j[Ae],`In "${F}": "${Ae}" is only valid when "encoding" is set to "custom". ${ke} encoding found`)):J[Ae]?ae=ae.concat(I.validateSpec({key:Ae,value:j[Ae],valueSpec:J[Ae],validateSpec:I.validateSpec,style:ee,styleSpec:H})):ae.push(new ct(Ae,j[Ae],`unknown property "${Ae}"`));return ae}({sourceName:c,value:i,style:s.style,styleSpec:f,validateSpec:b}),T;case"geojson":if(T=pi({key:c,value:i,valueSpec:f.source_geojson,style:g,styleSpec:f,validateSpec:b,objectElementValidators:Jh}),i.cluster)for(const I in i.clusterProperties){const[L,F]=i.clusterProperties[I],j=typeof L=="string"?[L,["accumulated"],["get",I]]:L;T.push(...Yo({key:`${c}.${I}.map`,value:F,validateSpec:b,expressionContext:"cluster-map"})),T.push(...Yo({key:`${c}.${I}.reduce`,value:j,validateSpec:b,expressionContext:"cluster-reduce"}))}return T;case"video":return pi({key:c,value:i,valueSpec:f.source_video,style:g,validateSpec:b,styleSpec:f});case"image":return pi({key:c,value:i,valueSpec:f.source_image,style:g,validateSpec:b,styleSpec:f});case"canvas":return[new ct(c,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Qo({key:`${c}.type`,value:i.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:g,validateSpec:b,styleSpec:f})}}function Qh(s){const i=s.value,c=s.styleSpec,f=c.light,g=s.style;let b=[];const w=kr(i);if(i===void 0)return b;if(w!=="object")return b=b.concat([new ct("light",i,`object expected, ${w} found`)]),b;for(const T in i){const I=T.match(/^(.*)-transition$/);b=b.concat(I&&f[I[1]]&&f[I[1]].transition?s.validateSpec({key:T,value:i[T],valueSpec:c.transition,validateSpec:s.validateSpec,style:g,styleSpec:c}):f[T]?s.validateSpec({key:T,value:i[T],valueSpec:f[T],validateSpec:s.validateSpec,style:g,styleSpec:c}):[new ct(T,i[T],`unknown property "${T}"`)])}return b}function ef(s){const i=s.value,c=s.styleSpec,f=c.sky,g=s.style,b=kr(i);if(i===void 0)return[];if(b!=="object")return[new ct("sky",i,`object expected, ${b} found`)];let w=[];for(const T in i)w=w.concat(f[T]?_o({key:T,value:i[T],valueSpec:f[T],style:g,styleSpec:c}):[new ct(T,i[T],`unknown property "${T}"`)]);return w}function Ra(s){const i=s.value,c=s.styleSpec,f=c.terrain,g=s.style;let b=[];const w=kr(i);if(i===void 0)return b;if(w!=="object")return b=b.concat([new ct("terrain",i,`object expected, ${w} found`)]),b;for(const T in i)b=b.concat(f[T]?s.validateSpec({key:T,value:i[T],valueSpec:f[T],validateSpec:s.validateSpec,style:g,styleSpec:c}):[new ct(T,i[T],`unknown property "${T}"`)]);return b}function Ba(s){let i=[];const c=s.value,f=s.key;if(Array.isArray(c)){const g=[],b=[];for(const w in c)c[w].id&&g.includes(c[w].id)&&i.push(new ct(f,c,`all the sprites' ids must be unique, but ${c[w].id} is duplicated`)),g.push(c[w].id),c[w].url&&b.includes(c[w].url)&&i.push(new ct(f,c,`all the sprites' URLs must be unique, but ${c[w].url} is duplicated`)),b.push(c[w].url),i=i.concat(pi({key:`${f}[${w}]`,value:c[w],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:s.validateSpec}));return i}return _s({key:f,value:c})}const xi={"*":()=>[],array:Yc,boolean:function(s){const i=s.value,c=s.key,f=kr(i);return f!=="boolean"?[new ct(c,i,`boolean expected, ${f} found`)]:[]},number:Ll,color:function(s){const i=s.key,c=s.value,f=kr(c);return f!=="string"?[new ct(i,c,`color expected, ${f} found`)]:zr.parse(String(c))?[]:[new ct(i,c,`color expected, "${c}" found`)]},constants:Xh,enum:Qo,filter:Ws,function:Kh,layer:Da,object:pi,source:Yh,light:Qh,sky:ef,terrain:Ra,string:_s,formatted:function(s){return _s(s).length===0?[]:Yo(s)},resolvedImage:function(s){return _s(s).length===0?[]:Yo(s)},padding:function(s){const i=s.key,c=s.value;if(kr(c)==="array"){if(c.length<1||c.length>4)return[new ct(i,c,`padding requires 1 to 4 values; ${c.length} values found`)];const f={type:"number"};let g=[];for(let b=0;b[]}})),s.constants&&(c=c.concat(Xh({key:"constants",value:s.constants,style:s,styleSpec:i,validateSpec:_o}))),Zs(c)}function yo(s){return function(i){return s({...i,validateSpec:_o})}}function Zs(s){return[].concat(s).sort((i,c)=>i.line-c.line)}function io(s){return function(...i){return Zs(s.apply(this,i))}}no.source=io(yo(Yh)),no.sprite=io(yo(Ba)),no.glyphs=io(yo(ru)),no.light=io(yo(Qh)),no.sky=io(yo(ef)),no.terrain=io(yo(Ra)),no.layer=io(yo(Da)),no.filter=io(yo(Ws)),no.paintProperty=io(yo(eu)),no.layoutProperty=io(yo(tu));const ys=no,ap=ys.light,nu=ys.paintProperty,lp=ys.layoutProperty;function Hs(s,i){let c=!1;if(i&&i.length)for(const f of i)s.fire(new tt(new Error(f.message))),c=!0;return c}class Fa{constructor(i,c,f){const g=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;const w=new Int32Array(this.arrayBuffer);i=w[0],this.d=(c=w[1])+2*(f=w[2]);for(let I=0;I=j[ee+0]&&g>=j[ee+1])?(T[J]=!0,w.push(F[J])):T[J]=!1}}}}_forEachCell(i,c,f,g,b,w,T,I){const L=this._convertToCellCoord(i),F=this._convertToCellCoord(c),j=this._convertToCellCoord(f),H=this._convertToCellCoord(g);for(let J=L;J<=j;J++)for(let ee=F;ee<=H;ee++){const ae=this.d*ee+J;if((!I||I(this._convertFromCellCoord(J),this._convertFromCellCoord(ee),this._convertFromCellCoord(J+1),this._convertFromCellCoord(ee+1)))&&b.call(this,i,c,f,g,ae,w,T,I))return}}_convertFromCellCoord(i){return(i-this.padding)/this.scale}_convertToCellCoord(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const i=this.cells,c=3+this.cells.length+1+1;let f=0;for(let w=0;w=0)continue;const w=s[b];g[b]=vo[f].shallow.indexOf(b)>=0?w:$s(w,i)}s instanceof Error&&(g.message=s.message)}if(g.$name)throw new Error("$name property is reserved for worker serialization logic.");return f!=="Object"&&(g.$name=f),g}throw new Error("can't serialize object of type "+typeof s)}function Xs(s){if(s==null||typeof s=="boolean"||typeof s=="number"||typeof s=="string"||s instanceof Boolean||s instanceof Number||s instanceof String||s instanceof Date||s instanceof RegExp||s instanceof Blob||s instanceof Error||zl(s)||Ke(s)||ArrayBuffer.isView(s)||s instanceof ImageData)return s;if(Array.isArray(s))return s.map(Xs);if(typeof s=="object"){const i=s.$name||"Object";if(!vo[i])throw new Error(`can't deserialize unregistered class ${i}`);const{klass:c}=vo[i];if(!c)throw new Error(`can't deserialize unregistered class ${i}`);if(c.deserialize)return c.deserialize(s);const f=Object.create(c.prototype);for(const g of Object.keys(s)){if(g==="$name")continue;const b=s[g];f[g]=vo[i].shallow.indexOf(g)>=0?b:Xs(b)}return f}throw new Error("can't deserialize object of type "+typeof s)}class tf{constructor(){this.first=!0}update(i,c){const f=Math.floor(i);return this.first?(this.first=!1,this.lastIntegerZoom=f,this.lastIntegerZoomTime=0,this.lastZoom=i,this.lastFloorZoom=f,!0):(this.lastFloorZoom>f?(this.lastIntegerZoom=f+1,this.lastIntegerZoomTime=c):this.lastFloorZooms>=128&&s<=255,Arabic:s=>s>=1536&&s<=1791,"Arabic Supplement":s=>s>=1872&&s<=1919,"Arabic Extended-A":s=>s>=2208&&s<=2303,"Hangul Jamo":s=>s>=4352&&s<=4607,"Unified Canadian Aboriginal Syllabics":s=>s>=5120&&s<=5759,Khmer:s=>s>=6016&&s<=6143,"Unified Canadian Aboriginal Syllabics Extended":s=>s>=6320&&s<=6399,"General Punctuation":s=>s>=8192&&s<=8303,"Letterlike Symbols":s=>s>=8448&&s<=8527,"Number Forms":s=>s>=8528&&s<=8591,"Miscellaneous Technical":s=>s>=8960&&s<=9215,"Control Pictures":s=>s>=9216&&s<=9279,"Optical Character Recognition":s=>s>=9280&&s<=9311,"Enclosed Alphanumerics":s=>s>=9312&&s<=9471,"Geometric Shapes":s=>s>=9632&&s<=9727,"Miscellaneous Symbols":s=>s>=9728&&s<=9983,"Miscellaneous Symbols and Arrows":s=>s>=11008&&s<=11263,"CJK Radicals Supplement":s=>s>=11904&&s<=12031,"Kangxi Radicals":s=>s>=12032&&s<=12255,"Ideographic Description Characters":s=>s>=12272&&s<=12287,"CJK Symbols and Punctuation":s=>s>=12288&&s<=12351,Hiragana:s=>s>=12352&&s<=12447,Katakana:s=>s>=12448&&s<=12543,Bopomofo:s=>s>=12544&&s<=12591,"Hangul Compatibility Jamo":s=>s>=12592&&s<=12687,Kanbun:s=>s>=12688&&s<=12703,"Bopomofo Extended":s=>s>=12704&&s<=12735,"CJK Strokes":s=>s>=12736&&s<=12783,"Katakana Phonetic Extensions":s=>s>=12784&&s<=12799,"Enclosed CJK Letters and Months":s=>s>=12800&&s<=13055,"CJK Compatibility":s=>s>=13056&&s<=13311,"CJK Unified Ideographs Extension A":s=>s>=13312&&s<=19903,"Yijing Hexagram Symbols":s=>s>=19904&&s<=19967,"CJK Unified Ideographs":s=>s>=19968&&s<=40959,"Yi Syllables":s=>s>=40960&&s<=42127,"Yi Radicals":s=>s>=42128&&s<=42191,"Hangul Jamo Extended-A":s=>s>=43360&&s<=43391,"Hangul Syllables":s=>s>=44032&&s<=55215,"Hangul Jamo Extended-B":s=>s>=55216&&s<=55295,"Private Use Area":s=>s>=57344&&s<=63743,"CJK Compatibility Ideographs":s=>s>=63744&&s<=64255,"Arabic Presentation Forms-A":s=>s>=64336&&s<=65023,"Vertical Forms":s=>s>=65040&&s<=65055,"CJK Compatibility Forms":s=>s>=65072&&s<=65103,"Small Form Variants":s=>s>=65104&&s<=65135,"Arabic Presentation Forms-B":s=>s>=65136&&s<=65279,"Halfwidth and Fullwidth Forms":s=>s>=65280&&s<=65519};function Ks(s){for(const i of s)if(Dl(i.charCodeAt(0)))return!0;return!1}function rf(s){for(const i of s)if(!nf(i.charCodeAt(0)))return!1;return!0}function nf(s){return!(xt.Arabic(s)||xt["Arabic Supplement"](s)||xt["Arabic Extended-A"](s)||xt["Arabic Presentation Forms-A"](s)||xt["Arabic Presentation Forms-B"](s))}function Dl(s){return!(s!==746&&s!==747&&(s<4352||!(xt["Bopomofo Extended"](s)||xt.Bopomofo(s)||xt["CJK Compatibility Forms"](s)&&!(s>=65097&&s<=65103)||xt["CJK Compatibility Ideographs"](s)||xt["CJK Compatibility"](s)||xt["CJK Radicals Supplement"](s)||xt["CJK Strokes"](s)||!(!xt["CJK Symbols and Punctuation"](s)||s>=12296&&s<=12305||s>=12308&&s<=12319||s===12336)||xt["CJK Unified Ideographs Extension A"](s)||xt["CJK Unified Ideographs"](s)||xt["Enclosed CJK Letters and Months"](s)||xt["Hangul Compatibility Jamo"](s)||xt["Hangul Jamo Extended-A"](s)||xt["Hangul Jamo Extended-B"](s)||xt["Hangul Jamo"](s)||xt["Hangul Syllables"](s)||xt.Hiragana(s)||xt["Ideographic Description Characters"](s)||xt.Kanbun(s)||xt["Kangxi Radicals"](s)||xt["Katakana Phonetic Extensions"](s)||xt.Katakana(s)&&s!==12540||!(!xt["Halfwidth and Fullwidth Forms"](s)||s===65288||s===65289||s===65293||s>=65306&&s<=65310||s===65339||s===65341||s===65343||s>=65371&&s<=65503||s===65507||s>=65512&&s<=65519)||!(!xt["Small Form Variants"](s)||s>=65112&&s<=65118||s>=65123&&s<=65126)||xt["Unified Canadian Aboriginal Syllabics"](s)||xt["Unified Canadian Aboriginal Syllabics Extended"](s)||xt["Vertical Forms"](s)||xt["Yijing Hexagram Symbols"](s)||xt["Yi Syllables"](s)||xt["Yi Radicals"](s))))}function iu(s){return!(Dl(s)||function(i){return!!(xt["Latin-1 Supplement"](i)&&(i===167||i===169||i===174||i===177||i===188||i===189||i===190||i===215||i===247)||xt["General Punctuation"](i)&&(i===8214||i===8224||i===8225||i===8240||i===8241||i===8251||i===8252||i===8258||i===8263||i===8264||i===8265||i===8273)||xt["Letterlike Symbols"](i)||xt["Number Forms"](i)||xt["Miscellaneous Technical"](i)&&(i>=8960&&i<=8967||i>=8972&&i<=8991||i>=8996&&i<=9e3||i===9003||i>=9085&&i<=9114||i>=9150&&i<=9165||i===9167||i>=9169&&i<=9179||i>=9186&&i<=9215)||xt["Control Pictures"](i)&&i!==9251||xt["Optical Character Recognition"](i)||xt["Enclosed Alphanumerics"](i)||xt["Geometric Shapes"](i)||xt["Miscellaneous Symbols"](i)&&!(i>=9754&&i<=9759)||xt["Miscellaneous Symbols and Arrows"](i)&&(i>=11026&&i<=11055||i>=11088&&i<=11097||i>=11192&&i<=11243)||xt["CJK Symbols and Punctuation"](i)||xt.Katakana(i)||xt["Private Use Area"](i)||xt["CJK Compatibility Forms"](i)||xt["Small Form Variants"](i)||xt["Halfwidth and Fullwidth Forms"](i)||i===8734||i===8756||i===8757||i>=9984&&i<=10087||i>=10102&&i<=10131||i===65532||i===65533)}(s))}function Rl(s){return s>=1424&&s<=2303||xt["Arabic Presentation Forms-A"](s)||xt["Arabic Presentation Forms-B"](s)}function of(s,i){return!(!i&&Rl(s)||s>=2304&&s<=3583||s>=3840&&s<=4255||xt.Khmer(s))}function cp(s){for(const i of s)if(Rl(i.charCodeAt(0)))return!0;return!1}const es=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(s){this.pluginStatus=s.pluginStatus,this.pluginURL=s.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(s){this.applyArabicShaping=s.applyArabicShaping,this.processBidirectionalText=s.processBidirectionalText,this.processStyledBidirectionalText=s.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Qr{constructor(i,c){this.zoom=i,c?(this.now=c.now,this.fadeDuration=c.fadeDuration,this.zoomHistory=c.zoomHistory,this.transition=c.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new tf,this.transition={})}isSupportedScript(i){return function(c,f){for(const g of c)if(!of(g.charCodeAt(0),f))return!1;return!0}(i,es.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const i=this.zoom,c=i-Math.floor(i),f=this.crossFadingFactor();return i>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:c+(1-c)*f}:{fromScale:.5,toScale:1,t:1-(1-f)*c}}}class Oa{constructor(i,c){this.property=i,this.value=c,this.expression=function(f,g){if(xl(f))return new kl(f,g);if(jr(f)){const b=Gh(f,g);if(b.result==="error")throw new Error(b.value.map(w=>`${w.key}: ${w.message}`).join(", "));return b.value}{let b=f;return g.type==="color"&&typeof f=="string"?b=zr.parse(f):g.type!=="padding"||typeof f!="number"&&!Array.isArray(f)?g.type==="variableAnchorOffsetCollection"&&Array.isArray(f)&&(b=$i.parse(f)):b=wi.parse(f),{kind:"constant",evaluate:()=>b}}}(c===void 0?i.specification.default:c,i.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(i,c,f){return this.property.possiblyEvaluate(this,i,c,f)}}class Bl{constructor(i){this.property=i,this.value=new Oa(i,void 0)}transitioned(i,c){return new sf(this.property,this.value,c,X({},i.transition,this.transition),i.now)}untransitioned(){return new sf(this.property,this.value,null,{},0)}}class ou{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitionablePropertyValues)}getValue(i){return re(this._values[i].value.value)}setValue(i,c){Object.prototype.hasOwnProperty.call(this._values,i)||(this._values[i]=new Bl(this._values[i].property)),this._values[i].value=new Oa(this._values[i].property,c===null?void 0:re(c))}getTransition(i){return re(this._values[i].transition)}setTransition(i,c){Object.prototype.hasOwnProperty.call(this._values,i)||(this._values[i]=new Bl(this._values[i].property)),this._values[i].transition=re(c)||void 0}serialize(){const i={};for(const c of Object.keys(this._values)){const f=this.getValue(c);f!==void 0&&(i[c]=f);const g=this.getTransition(c);g!==void 0&&(i[`${c}-transition`]=g)}return i}transitioned(i,c){const f=new af(this._properties);for(const g of Object.keys(this._values))f._values[g]=this._values[g].transitioned(i,c._values[g]);return f}untransitioned(){const i=new af(this._properties);for(const c of Object.keys(this._values))i._values[c]=this._values[c].untransitioned();return i}}class sf{constructor(i,c,f,g,b){this.property=i,this.value=c,this.begin=b+g.delay||0,this.end=this.begin+g.duration||0,i.specification.transition&&(g.delay||g.duration)&&(this.prior=f)}possiblyEvaluate(i,c,f){const g=i.now||0,b=this.value.possiblyEvaluate(i,c,f),w=this.prior;if(w){if(g>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(g=1)return 1;const L=I*I,F=L*I;return 4*(I<.5?F:3*(I-L)+F-.75)}(T))}}return b}}class af{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitioningPropertyValues)}possiblyEvaluate(i,c,f){const g=new Na(this._properties);for(const b of Object.keys(this._values))g._values[b]=this._values[b].possiblyEvaluate(i,c,f);return g}hasTransition(){for(const i of Object.keys(this._values))if(this._values[i].prior)return!0;return!1}}class lf{constructor(i){this._properties=i,this._values=Object.create(i.defaultPropertyValues)}hasValue(i){return this._values[i].value!==void 0}getValue(i){return re(this._values[i].value)}setValue(i,c){this._values[i]=new Oa(this._values[i].property,c===null?void 0:re(c))}serialize(){const i={};for(const c of Object.keys(this._values)){const f=this.getValue(c);f!==void 0&&(i[c]=f)}return i}possiblyEvaluate(i,c,f){const g=new Na(this._properties);for(const b of Object.keys(this._values))g._values[b]=this._values[b].possiblyEvaluate(i,c,f);return g}}class oo{constructor(i,c,f){this.property=i,this.value=c,this.parameters=f}isConstant(){return this.value.kind==="constant"}constantOr(i){return this.value.kind==="constant"?this.value.value:i}evaluate(i,c,f,g){return this.property.evaluate(this.value,this.parameters,i,c,f,g)}}class Na{constructor(i){this._properties=i,this._values=Object.create(i.defaultPossiblyEvaluatedValues)}get(i){return this._values[i]}}class Bt{constructor(i){this.specification=i}possiblyEvaluate(i,c){if(i.isDataDriven())throw new Error("Value should not be data driven");return i.expression.evaluate(c)}interpolate(i,c,f){const g=di[this.specification.type];return g?g(i,c,f):i}}class Gt{constructor(i,c){this.specification=i,this.overrides=c}possiblyEvaluate(i,c,f,g){return new oo(this,i.expression.kind==="constant"||i.expression.kind==="camera"?{kind:"constant",value:i.expression.evaluate(c,null,{},f,g)}:i.expression,c)}interpolate(i,c,f){if(i.value.kind!=="constant"||c.value.kind!=="constant")return i;if(i.value.value===void 0||c.value.value===void 0)return new oo(this,{kind:"constant",value:void 0},i.parameters);const g=di[this.specification.type];if(g){const b=g(i.value.value,c.value.value,f);return new oo(this,{kind:"constant",value:b},i.parameters)}return i}evaluate(i,c,f,g,b,w){return i.kind==="constant"?i.value:i.evaluate(c,f,g,b,w)}}class Fl extends Gt{possiblyEvaluate(i,c,f,g){if(i.value===void 0)return new oo(this,{kind:"constant",value:void 0},c);if(i.expression.kind==="constant"){const b=i.expression.evaluate(c,null,{},f,g),w=i.property.specification.type==="resolvedImage"&&typeof b!="string"?b.name:b,T=this._calculate(w,w,w,c);return new oo(this,{kind:"constant",value:T},c)}if(i.expression.kind==="camera"){const b=this._calculate(i.expression.evaluate({zoom:c.zoom-1}),i.expression.evaluate({zoom:c.zoom}),i.expression.evaluate({zoom:c.zoom+1}),c);return new oo(this,{kind:"constant",value:b},c)}return new oo(this,i.expression,c)}evaluate(i,c,f,g,b,w){if(i.kind==="source"){const T=i.evaluate(c,f,g,b,w);return this._calculate(T,T,T,c)}return i.kind==="composite"?this._calculate(i.evaluate({zoom:Math.floor(c.zoom)-1},f,g),i.evaluate({zoom:Math.floor(c.zoom)},f,g),i.evaluate({zoom:Math.floor(c.zoom)+1},f,g),c):i.value}_calculate(i,c,f,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:i,to:c}:{from:f,to:c}}interpolate(i){return i}}class ja{constructor(i){this.specification=i}possiblyEvaluate(i,c,f,g){if(i.value!==void 0){if(i.expression.kind==="constant"){const b=i.expression.evaluate(c,null,{},f,g);return this._calculate(b,b,b,c)}return this._calculate(i.expression.evaluate(new Qr(Math.floor(c.zoom-1),c)),i.expression.evaluate(new Qr(Math.floor(c.zoom),c)),i.expression.evaluate(new Qr(Math.floor(c.zoom+1),c)),c)}}_calculate(i,c,f,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:i,to:c}:{from:f,to:c}}interpolate(i){return i}}class su{constructor(i){this.specification=i}possiblyEvaluate(i,c,f,g){return!!i.expression.evaluate(c,null,{},f,g)}interpolate(){return!1}}class Si{constructor(i){this.properties=i,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const c in i){const f=i[c];f.specification.overridable&&this.overridableProperties.push(c);const g=this.defaultPropertyValues[c]=new Oa(f,void 0),b=this.defaultTransitionablePropertyValues[c]=new Bl(f);this.defaultTransitioningPropertyValues[c]=b.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=g.possiblyEvaluate({})}}}Et("DataDrivenProperty",Gt),Et("DataConstantProperty",Bt),Et("CrossFadedDataDrivenProperty",Fl),Et("CrossFadedProperty",ja),Et("ColorRampProperty",su);const au="-transition";class so extends it{constructor(i,c){if(super(),this.id=i.id,this.type=i.type,this._featureFilter={filter:()=>!0,needGeometry:!1},i.type!=="custom"&&(this.metadata=i.metadata,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,i.type!=="background"&&(this.source=i.source,this.sourceLayer=i["source-layer"],this.filter=i.filter),c.layout&&(this._unevaluatedLayout=new lf(c.layout)),c.paint)){this._transitionablePaint=new ou(c.paint);for(const f in i.paint)this.setPaintProperty(f,i.paint[f],{validate:!1});for(const f in i.layout)this.setLayoutProperty(f,i.layout[f],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Na(c.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(i){return i==="visibility"?this.visibility:this._unevaluatedLayout.getValue(i)}setLayoutProperty(i,c,f={}){c!=null&&this._validate(lp,`layers.${this.id}.layout.${i}`,i,c,f)||(i!=="visibility"?this._unevaluatedLayout.setValue(i,c):this.visibility=c)}getPaintProperty(i){return i.endsWith(au)?this._transitionablePaint.getTransition(i.slice(0,-11)):this._transitionablePaint.getValue(i)}setPaintProperty(i,c,f={}){if(c!=null&&this._validate(nu,`layers.${this.id}.paint.${i}`,i,c,f))return!1;if(i.endsWith(au))return this._transitionablePaint.setTransition(i.slice(0,-11),c||void 0),!1;{const g=this._transitionablePaint._values[i],b=g.property.specification["property-type"]==="cross-faded-data-driven",w=g.value.isDataDriven(),T=g.value;this._transitionablePaint.setValue(i,c),this._handleSpecialPaintPropertyUpdate(i);const I=this._transitionablePaint._values[i].value;return I.isDataDriven()||w||b||this._handleOverridablePaintPropertyUpdate(i,T,I)}}_handleSpecialPaintPropertyUpdate(i){}_handleOverridablePaintPropertyUpdate(i,c,f){return!1}isHidden(i){return!!(this.minzoom&&i=this.maxzoom)||this.visibility==="none"}updateTransitions(i){this._transitioningPaint=this._transitionablePaint.transitioned(i,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(i,c){i.getCrossfadeParameters&&(this._crossfadeParameters=i.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(i,void 0,c)),this.paint=this._transitioningPaint.possiblyEvaluate(i,void 0,c)}serialize(){const i={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&&(i.layout=i.layout||{},i.layout.visibility=this.visibility),ze(i,(c,f)=>!(c===void 0||f==="layout"&&!Object.keys(c).length||f==="paint"&&!Object.keys(c).length))}_validate(i,c,f,g,b={}){return(!b||b.validate!==!1)&&Hs(this,i.call(ys,{key:c,layerType:this.type,objectKey:f,value:g,styleSpec:ne,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const i in this.paint._values){const c=this.paint.get(i);if(c instanceof oo&&Gs(c.property.specification)&&(c.value.kind==="source"||c.value.kind==="composite")&&c.value.isStateDependent)return!0}return!1}}const cf={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ua{constructor(i,c){this._structArray=i,this._pos1=c*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class un{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(i,c){return i._trim(),c&&(i.isTransferred=!0,c.push(i.arrayBuffer)),{length:i.length,arrayBuffer:i.arrayBuffer}}static deserialize(i){const c=Object.create(this.prototype);return c.arrayBuffer=i.arrayBuffer,c.length=i.length,c.capacity=i.arrayBuffer.byteLength/c.bytesPerElement,c._refreshViews(),c}_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(i){this.reserve(i),this.length=i}reserve(i){if(i>this.capacity){this.capacity=Math.max(i,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const c=this.uint8;this._refreshViews(),c&&this.uint8.set(c)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function kn(s,i=1){let c=0,f=0;return{members:s.map(g=>{const b=cf[g.type].BYTES_PER_ELEMENT,w=c=uf(c,Math.max(i,b)),T=g.components||1;return f=Math.max(f,b),c+=b*T,{name:g.name,type:g.type,components:T,offset:w}}),size:uf(c,Math.max(f,i)),alignment:i}}function uf(s,i){return Math.ceil(s/i)*i}class Va extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c){const f=this.length;return this.resize(f+1),this.emplace(f,i,c)}emplace(i,c,f){const g=2*i;return this.int16[g+0]=c,this.int16[g+1]=f,i}}Va.prototype.bytesPerElement=4,Et("StructArrayLayout2i4",Va);class Fo extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,f){const g=this.length;return this.resize(g+1),this.emplace(g,i,c,f)}emplace(i,c,f,g){const b=3*i;return this.int16[b+0]=c,this.int16[b+1]=f,this.int16[b+2]=g,i}}Fo.prototype.bytesPerElement=6,Et("StructArrayLayout3i6",Fo);class lu extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,f,g){const b=this.length;return this.resize(b+1),this.emplace(b,i,c,f,g)}emplace(i,c,f,g,b){const w=4*i;return this.int16[w+0]=c,this.int16[w+1]=f,this.int16[w+2]=g,this.int16[w+3]=b,i}}lu.prototype.bytesPerElement=8,Et("StructArrayLayout4i8",lu);class cu extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,f,g,b,w){const T=this.length;return this.resize(T+1),this.emplace(T,i,c,f,g,b,w)}emplace(i,c,f,g,b,w,T){const I=6*i;return this.int16[I+0]=c,this.int16[I+1]=f,this.int16[I+2]=g,this.int16[I+3]=b,this.int16[I+4]=w,this.int16[I+5]=T,i}}cu.prototype.bytesPerElement=12,Et("StructArrayLayout2i4i12",cu);class uu extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,f,g,b,w){const T=this.length;return this.resize(T+1),this.emplace(T,i,c,f,g,b,w)}emplace(i,c,f,g,b,w,T){const I=4*i,L=8*i;return this.int16[I+0]=c,this.int16[I+1]=f,this.uint8[L+4]=g,this.uint8[L+5]=b,this.uint8[L+6]=w,this.uint8[L+7]=T,i}}uu.prototype.bytesPerElement=8,Et("StructArrayLayout2i4ub8",uu);class qa extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,c){const f=this.length;return this.resize(f+1),this.emplace(f,i,c)}emplace(i,c,f){const g=2*i;return this.float32[g+0]=c,this.float32[g+1]=f,i}}qa.prototype.bytesPerElement=8,Et("StructArrayLayout2f8",qa);class Ol extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,c,f,g,b,w,T,I,L,F){const j=this.length;return this.resize(j+1),this.emplace(j,i,c,f,g,b,w,T,I,L,F)}emplace(i,c,f,g,b,w,T,I,L,F,j){const H=10*i;return this.uint16[H+0]=c,this.uint16[H+1]=f,this.uint16[H+2]=g,this.uint16[H+3]=b,this.uint16[H+4]=w,this.uint16[H+5]=T,this.uint16[H+6]=I,this.uint16[H+7]=L,this.uint16[H+8]=F,this.uint16[H+9]=j,i}}Ol.prototype.bytesPerElement=20,Et("StructArrayLayout10ui20",Ol);class hu extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,c,f,g,b,w,T,I,L,F,j,H){const J=this.length;return this.resize(J+1),this.emplace(J,i,c,f,g,b,w,T,I,L,F,j,H)}emplace(i,c,f,g,b,w,T,I,L,F,j,H,J){const ee=12*i;return this.int16[ee+0]=c,this.int16[ee+1]=f,this.int16[ee+2]=g,this.int16[ee+3]=b,this.uint16[ee+4]=w,this.uint16[ee+5]=T,this.uint16[ee+6]=I,this.uint16[ee+7]=L,this.int16[ee+8]=F,this.int16[ee+9]=j,this.int16[ee+10]=H,this.int16[ee+11]=J,i}}hu.prototype.bytesPerElement=24,Et("StructArrayLayout4i4ui4i24",hu);class fu extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,c,f){const g=this.length;return this.resize(g+1),this.emplace(g,i,c,f)}emplace(i,c,f,g){const b=3*i;return this.float32[b+0]=c,this.float32[b+1]=f,this.float32[b+2]=g,i}}fu.prototype.bytesPerElement=12,Et("StructArrayLayout3f12",fu);class Oo extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i){const c=this.length;return this.resize(c+1),this.emplace(c,i)}emplace(i,c){return this.uint32[1*i+0]=c,i}}Oo.prototype.bytesPerElement=4,Et("StructArrayLayout1ul4",Oo);class Nl extends un{_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(i,c,f,g,b,w,T,I,L){const F=this.length;return this.resize(F+1),this.emplace(F,i,c,f,g,b,w,T,I,L)}emplace(i,c,f,g,b,w,T,I,L,F){const j=10*i,H=5*i;return this.int16[j+0]=c,this.int16[j+1]=f,this.int16[j+2]=g,this.int16[j+3]=b,this.int16[j+4]=w,this.int16[j+5]=T,this.uint32[H+3]=I,this.uint16[j+8]=L,this.uint16[j+9]=F,i}}Nl.prototype.bytesPerElement=20,Et("StructArrayLayout6i1ul2ui20",Nl);class Ga extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,f,g,b,w){const T=this.length;return this.resize(T+1),this.emplace(T,i,c,f,g,b,w)}emplace(i,c,f,g,b,w,T){const I=6*i;return this.int16[I+0]=c,this.int16[I+1]=f,this.int16[I+2]=g,this.int16[I+3]=b,this.int16[I+4]=w,this.int16[I+5]=T,i}}Ga.prototype.bytesPerElement=12,Et("StructArrayLayout2i2i2i12",Ga);class jl extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,f,g,b){const w=this.length;return this.resize(w+1),this.emplace(w,i,c,f,g,b)}emplace(i,c,f,g,b,w){const T=4*i,I=8*i;return this.float32[T+0]=c,this.float32[T+1]=f,this.float32[T+2]=g,this.int16[I+6]=b,this.int16[I+7]=w,i}}jl.prototype.bytesPerElement=16,Et("StructArrayLayout2f1f2i16",jl);class Wa extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,c,f,g){const b=this.length;return this.resize(b+1),this.emplace(b,i,c,f,g)}emplace(i,c,f,g,b){const w=12*i,T=3*i;return this.uint8[w+0]=c,this.uint8[w+1]=f,this.float32[T+1]=g,this.float32[T+2]=b,i}}Wa.prototype.bytesPerElement=12,Et("StructArrayLayout2ub2f12",Wa);class Ul extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,c,f){const g=this.length;return this.resize(g+1),this.emplace(g,i,c,f)}emplace(i,c,f,g){const b=3*i;return this.uint16[b+0]=c,this.uint16[b+1]=f,this.uint16[b+2]=g,i}}Ul.prototype.bytesPerElement=6,Et("StructArrayLayout3ui6",Ul);class Js extends un{_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(i,c,f,g,b,w,T,I,L,F,j,H,J,ee,ae,ge,xe){const Re=this.length;return this.resize(Re+1),this.emplace(Re,i,c,f,g,b,w,T,I,L,F,j,H,J,ee,ae,ge,xe)}emplace(i,c,f,g,b,w,T,I,L,F,j,H,J,ee,ae,ge,xe,Re){const ke=24*i,Ae=12*i,Je=48*i;return this.int16[ke+0]=c,this.int16[ke+1]=f,this.uint16[ke+2]=g,this.uint16[ke+3]=b,this.uint32[Ae+2]=w,this.uint32[Ae+3]=T,this.uint32[Ae+4]=I,this.uint16[ke+10]=L,this.uint16[ke+11]=F,this.uint16[ke+12]=j,this.float32[Ae+7]=H,this.float32[Ae+8]=J,this.uint8[Je+36]=ee,this.uint8[Je+37]=ae,this.uint8[Je+38]=ge,this.uint32[Ae+10]=xe,this.int16[ke+22]=Re,i}}Js.prototype.bytesPerElement=48,Et("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Js);class vs extends un{_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(i,c,f,g,b,w,T,I,L,F,j,H,J,ee,ae,ge,xe,Re,ke,Ae,Je,Qe,kt,zt,St,bt,pt,It){const yt=this.length;return this.resize(yt+1),this.emplace(yt,i,c,f,g,b,w,T,I,L,F,j,H,J,ee,ae,ge,xe,Re,ke,Ae,Je,Qe,kt,zt,St,bt,pt,It)}emplace(i,c,f,g,b,w,T,I,L,F,j,H,J,ee,ae,ge,xe,Re,ke,Ae,Je,Qe,kt,zt,St,bt,pt,It,yt){const lt=32*i,qt=16*i;return this.int16[lt+0]=c,this.int16[lt+1]=f,this.int16[lt+2]=g,this.int16[lt+3]=b,this.int16[lt+4]=w,this.int16[lt+5]=T,this.int16[lt+6]=I,this.int16[lt+7]=L,this.uint16[lt+8]=F,this.uint16[lt+9]=j,this.uint16[lt+10]=H,this.uint16[lt+11]=J,this.uint16[lt+12]=ee,this.uint16[lt+13]=ae,this.uint16[lt+14]=ge,this.uint16[lt+15]=xe,this.uint16[lt+16]=Re,this.uint16[lt+17]=ke,this.uint16[lt+18]=Ae,this.uint16[lt+19]=Je,this.uint16[lt+20]=Qe,this.uint16[lt+21]=kt,this.uint16[lt+22]=zt,this.uint32[qt+12]=St,this.float32[qt+13]=bt,this.float32[qt+14]=pt,this.uint16[lt+30]=It,this.uint16[lt+31]=yt,i}}vs.prototype.bytesPerElement=64,Et("StructArrayLayout8i15ui1ul2f2ui64",vs);class Vl extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i){const c=this.length;return this.resize(c+1),this.emplace(c,i)}emplace(i,c){return this.float32[1*i+0]=c,i}}Vl.prototype.bytesPerElement=4,Et("StructArrayLayout1f4",Vl);class ql extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,c,f){const g=this.length;return this.resize(g+1),this.emplace(g,i,c,f)}emplace(i,c,f,g){const b=3*i;return this.uint16[6*i+0]=c,this.float32[b+1]=f,this.float32[b+2]=g,i}}ql.prototype.bytesPerElement=12,Et("StructArrayLayout1ui2f12",ql);class bs extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,c,f){const g=this.length;return this.resize(g+1),this.emplace(g,i,c,f)}emplace(i,c,f,g){const b=4*i;return this.uint32[2*i+0]=c,this.uint16[b+2]=f,this.uint16[b+3]=g,i}}bs.prototype.bytesPerElement=8,Et("StructArrayLayout1ul2ui8",bs);class du extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,c){const f=this.length;return this.resize(f+1),this.emplace(f,i,c)}emplace(i,c,f){const g=2*i;return this.uint16[g+0]=c,this.uint16[g+1]=f,i}}du.prototype.bytesPerElement=4,Et("StructArrayLayout2ui4",du);class pu extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i){const c=this.length;return this.resize(c+1),this.emplace(c,i)}emplace(i,c){return this.uint16[1*i+0]=c,i}}pu.prototype.bytesPerElement=2,Et("StructArrayLayout1ui2",pu);class Gl extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,c,f,g){const b=this.length;return this.resize(b+1),this.emplace(b,i,c,f,g)}emplace(i,c,f,g,b){const w=4*i;return this.float32[w+0]=c,this.float32[w+1]=f,this.float32[w+2]=g,this.float32[w+3]=b,i}}Gl.prototype.bytesPerElement=16,Et("StructArrayLayout4f16",Gl);class hf extends Ua{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 k(this.anchorPointX,this.anchorPointY)}}hf.prototype.size=20;class y extends Nl{get(i){return new hf(this,i)}}Et("CollisionBoxArray",y);class o extends Ua{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(i){this._structArray.uint8[this._pos1+37]=i}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(i){this._structArray.uint8[this._pos1+38]=i}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(i){this._structArray.uint32[this._pos4+10]=i}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}o.prototype.size=48;class h extends Js{get(i){return new o(this,i)}}Et("PlacedSymbolArray",h);class p extends Ua{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(i){this._structArray.uint32[this._pos4+12]=i}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]}}p.prototype.size=64;class m extends vs{get(i){return new p(this,i)}}Et("SymbolInstanceArray",m);class v extends Vl{getoffsetX(i){return this.float32[1*i+0]}}Et("GlyphOffsetArray",v);class E extends Fo{getx(i){return this.int16[3*i+0]}gety(i){return this.int16[3*i+1]}gettileUnitDistanceFromAnchor(i){return this.int16[3*i+2]}}Et("SymbolLineVertexArray",E);class M extends Ua{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]}}M.prototype.size=12;class A extends ql{get(i){return new M(this,i)}}Et("TextAnchorOffsetArray",A);class R extends Ua{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]}}R.prototype.size=8;class V extends bs{get(i){return new R(this,i)}}Et("FeatureIndexArray",V);class q extends Va{}class Q extends Va{}class he extends Va{}class ue extends cu{}class ye extends uu{}class se extends qa{}class Te extends Ol{}class Ue extends hu{}class we extends fu{}class Le extends Oo{}class Ge extends Ga{}class He extends Wa{}class $e extends Ul{}class nt extends du{}const et=kn([{name:"a_pos",components:2,type:"Int16"}],4),{members:dt}=et;class gt{constructor(i=[]){this.segments=i}prepareSegment(i,c,f,g){let b=this.segments[this.segments.length-1];return i>gt.MAX_VERTEX_ARRAY_LENGTH&&Ze(`Max vertices per segment is ${gt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${i}`),(!b||b.vertexLength+i>gt.MAX_VERTEX_ARRAY_LENGTH||b.sortKey!==g)&&(b={vertexOffset:c.length,primitiveOffset:f.length,vertexLength:0,primitiveLength:0},g!==void 0&&(b.sortKey=g),this.segments.push(b)),b}get(){return this.segments}destroy(){for(const i of this.segments)for(const c in i.vaos)i.vaos[c].destroy()}static simpleSegment(i,c,f,g){return new gt([{vertexOffset:i,primitiveOffset:c,vertexLength:f,primitiveLength:g,vaos:{},sortKey:0}])}}function ir(s,i){return 256*(s=K(Math.floor(s),0,255))+K(Math.floor(i),0,255)}gt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Et("SegmentVector",gt);const _t=kn([{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 Xt={exports:{}},or={exports:{}};or.exports=function(s,i){var c,f,g,b,w,T,I,L;for(f=s.length-(c=3&s.length),g=i,w=3432918353,T=461845907,L=0;L>>16)*w&65535)<<16)&4294967295)<<15|I>>>17))*T+(((I>>>16)*T&65535)<<16)&4294967295)<<13|g>>>19))+((5*(g>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(I=0,c){case 3:I^=(255&s.charCodeAt(L+2))<<16;case 2:I^=(255&s.charCodeAt(L+1))<<8;case 1:g^=I=(65535&(I=(I=(65535&(I^=255&s.charCodeAt(L)))*w+(((I>>>16)*w&65535)<<16)&4294967295)<<15|I>>>17))*T+(((I>>>16)*T&65535)<<16)&4294967295}return g^=s.length,g=2246822507*(65535&(g^=g>>>16))+((2246822507*(g>>>16)&65535)<<16)&4294967295,g=3266489909*(65535&(g^=g>>>13))+((3266489909*(g>>>16)&65535)<<16)&4294967295,(g^=g>>>16)>>>0};var xr=or.exports,Yt={exports:{}};Yt.exports=function(s,i){for(var c,f=s.length,g=i^f,b=0;f>=4;)c=1540483477*(65535&(c=255&s.charCodeAt(b)|(255&s.charCodeAt(++b))<<8|(255&s.charCodeAt(++b))<<16|(255&s.charCodeAt(++b))<<24))+((1540483477*(c>>>16)&65535)<<16),g=1540483477*(65535&g)+((1540483477*(g>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),f-=4,++b;switch(f){case 3:g^=(255&s.charCodeAt(b+2))<<16;case 2:g^=(255&s.charCodeAt(b+1))<<8;case 1:g=1540483477*(65535&(g^=255&s.charCodeAt(b)))+((1540483477*(g>>>16)&65535)<<16)}return g=1540483477*(65535&(g^=g>>>13))+((1540483477*(g>>>16)&65535)<<16),(g^=g>>>15)>>>0};var cr=xr,dr=Yt.exports;Xt.exports=cr,Xt.exports.murmur3=cr,Xt.exports.murmur2=dr;var hn=_(Xt.exports);class Rr{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(i,c,f,g){this.ids.push(Oi(i)),this.positions.push(c,f,g)}getPositions(i){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const c=Oi(i);let f=0,g=this.ids.length-1;for(;f>1;this.ids[w]>=c?g=w:f=w+1}const b=[];for(;this.ids[f]===c;)b.push({index:this.positions[3*f],start:this.positions[3*f+1],end:this.positions[3*f+2]}),f++;return b}static serialize(i,c){const f=new Float64Array(i.ids),g=new Uint32Array(i.positions);return Fn(f,g,0,f.length-1),c&&c.push(f.buffer,g.buffer),{ids:f,positions:g}}static deserialize(i){const c=new Rr;return c.ids=i.ids,c.positions=i.positions,c.indexed=!0,c}}function Oi(s){const i=+s;return!isNaN(i)&&i<=Number.MAX_SAFE_INTEGER?i:hn(String(s))}function Fn(s,i,c,f){for(;c>1];let b=c-1,w=f+1;for(;;){do b++;while(s[b]g);if(b>=w)break;nn(s,b,w),nn(i,3*b,3*w),nn(i,3*b+1,3*w+1),nn(i,3*b+2,3*w+2)}w-c`u_${g}`),this.type=f}setUniform(i,c,f){i.set(f.constantOr(this.value))}getBinding(i,c,f){return this.type==="color"?new ts(i,c):new Ni(i,c)}}class An{constructor(i,c){this.uniformNames=c.map(f=>`u_${f}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(i,c){this.pixelRatioFrom=c.pixelRatio,this.pixelRatioTo=i.pixelRatio,this.patternFrom=c.tlbr,this.patternTo=i.tlbr}setUniform(i,c,f,g){const b=g==="u_pattern_to"?this.patternTo:g==="u_pattern_from"?this.patternFrom:g==="u_pixel_ratio_to"?this.pixelRatioTo:g==="u_pixel_ratio_from"?this.pixelRatioFrom:null;b&&i.set(b)}getBinding(i,c,f){return f.substr(0,9)==="u_pattern"?new bo(i,c):new Ni(i,c)}}class on{constructor(i,c,f,g){this.expression=i,this.type=f,this.maxValue=0,this.paintVertexAttributes=c.map(b=>({name:`a_${b}`,type:"Float32",components:f==="color"?2:1,offset:0})),this.paintVertexArray=new g}populatePaintArray(i,c,f,g,b){const w=this.paintVertexArray.length,T=this.expression.evaluate(new Qr(0),c,{},g,[],b);this.paintVertexArray.resize(i),this._setPaintValue(w,i,T)}updatePaintArray(i,c,f,g){const b=this.expression.evaluate({zoom:0},f,g);this._setPaintValue(i,c,b)}_setPaintValue(i,c,f){if(this.type==="color"){const g=rs(f);for(let b=i;b`u_${T}_t`),this.type=f,this.useIntegerZoom=g,this.zoom=b,this.maxValue=0,this.paintVertexAttributes=c.map(T=>({name:`a_${T}`,type:"Float32",components:f==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(i,c,f,g,b){const w=this.expression.evaluate(new Qr(this.zoom),c,{},g,[],b),T=this.expression.evaluate(new Qr(this.zoom+1),c,{},g,[],b),I=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValue(I,i,w,T)}updatePaintArray(i,c,f,g){const b=this.expression.evaluate({zoom:this.zoom},f,g),w=this.expression.evaluate({zoom:this.zoom+1},f,g);this._setPaintValue(i,c,b,w)}_setPaintValue(i,c,f,g){if(this.type==="color"){const b=rs(f),w=rs(g);for(let T=i;T`#define HAS_UNIFORM_${g}`))}return i}getBinderAttributes(){const i=[];for(const c in this.binders){const f=this.binders[c];if(f instanceof on||f instanceof en)for(let g=0;g!0){this.programConfigurations={};for(const g of i)this.programConfigurations[g.id]=new Ln(g,c,f);this.needsUpload=!1,this._featureMap=new Rr,this._bufferOffset=0}populatePaintArrays(i,c,f,g,b,w){for(const T in this.programConfigurations)this.programConfigurations[T].populatePaintArrays(i,c,g,b,w);c.id!==void 0&&this._featureMap.add(c.id,f,this._bufferOffset,i),this._bufferOffset=i,this.needsUpload=!0}updatePaintArrays(i,c,f,g){for(const b of f)this.needsUpload=this.programConfigurations[b.id].updatePaintArrays(i,this._featureMap,c,b,g)||this.needsUpload}get(i){return this.programConfigurations[i]}upload(i){if(this.needsUpload){for(const c in this.programConfigurations)this.programConfigurations[c].upload(i);this.needsUpload=!1}}destroy(){for(const i in this.programConfigurations)this.programConfigurations[i].destroy()}}function Ji(s,i){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"]}[s]||[s.replace(`${i}-`,"").replace(/-/g,"_")]}function Pn(s,i,c){const f={color:{source:qa,composite:Gl},number:{source:Vl,composite:qa}},g=function(b){return{"line-pattern":{source:Te,composite:Te},"fill-pattern":{source:Te,composite:Te},"fill-extrusion-pattern":{source:Te,composite:Te}}[b]}(s);return g&&g[c]||f[i][c]}Et("ConstantBinder",wo),Et("CrossFadedConstantBinder",An),Et("SourceExpressionBinder",on),Et("CrossFadedCompositeBinder",Ki),Et("CompositeExpressionBinder",en),Et("ProgramConfiguration",Ln,{omit:["_buffers"]}),Et("ProgramConfigurationSet",sn);const yn=8192,mu=Math.pow(2,14)-1,ff=-mu-1;function ws(s){const i=yn/s.extent,c=s.loadGeometry();for(let f=0;fw.x+1||Iw.y+1)&&Ze("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return c}function xs(s,i){return{type:s.type,id:s.id,properties:s.properties,geometry:i?ws(s):[]}}function Wl(s,i,c,f,g){s.emplaceBack(2*i+(f+1)/2,2*c+(g+1)/2)}class ns{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(c=>c.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new Q,this.indexArray=new $e,this.segments=new gt,this.programConfigurations=new sn(i.layers,i.zoom),this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(i,c,f){const g=this.layers[0],b=[];let w=null,T=!1;g.type==="circle"&&(w=g.layout.get("circle-sort-key"),T=!w.isConstant());for(const{feature:I,id:L,index:F,sourceLayerIndex:j}of i){const H=this.layers[0]._featureFilter.needGeometry,J=xs(I,H);if(!this.layers[0]._featureFilter.filter(new Qr(this.zoom),J,f))continue;const ee=T?w.evaluate(J,{},f):void 0,ae={id:L,properties:I.properties,type:I.type,sourceLayerIndex:j,index:F,geometry:H?J.geometry:ws(I),patterns:{},sortKey:ee};b.push(ae)}T&&b.sort((I,L)=>I.sortKey-L.sortKey);for(const I of b){const{geometry:L,index:F,sourceLayerIndex:j}=I,H=i[F].feature;this.addFeature(I,L,F,f),c.featureIndex.insert(H,L,F,j,this.index)}}update(i,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,c,this.stateDependentLayers,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,dt),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(i,c,f,g){for(const b of c)for(const w of b){const T=w.x,I=w.y;if(T<0||T>=yn||I<0||I>=yn)continue;const L=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,i.sortKey),F=L.vertexLength;Wl(this.layoutVertexArray,T,I,-1,-1),Wl(this.layoutVertexArray,T,I,1,-1),Wl(this.layoutVertexArray,T,I,1,1),Wl(this.layoutVertexArray,T,I,-1,1),this.indexArray.emplaceBack(F,F+1,F+2),this.indexArray.emplaceBack(F,F+3,F+2),L.vertexLength+=4,L.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,f,{},g)}}function gu(s,i){for(let c=0;c1){if(Zl(s,i))return!0;for(let f=0;f1?c:c.sub(i)._mult(g)._add(i))}function a_(s,i){let c,f,g,b=!1;for(let w=0;wi.y!=g.y>i.y&&i.x<(g.x-f.x)*(i.y-f.y)/(g.y-f.y)+f.x&&(b=!b)}return b}function Hl(s,i){let c=!1;for(let f=0,g=s.length-1;fi.y!=w.y>i.y&&i.x<(w.x-b.x)*(i.y-b.y)/(w.y-b.y)+b.x&&(c=!c)}return c}function qx(s,i,c){const f=c[0],g=c[2];if(s.xg.x&&i.x>g.x||s.yg.y&&i.y>g.y)return!1;const b=Me(s,i,c[0]);return b!==Me(s,i,c[1])||b!==Me(s,i,c[2])||b!==Me(s,i,c[3])}function bu(s,i,c){const f=i.paint.get(s).value;return f.kind==="constant"?f.value:c.programConfigurations.get(i.id).getMaxValue(s)}function pf(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}function mf(s,i,c,f,g){if(!i[0]&&!i[1])return s;const b=k.convert(i)._mult(g);c==="viewport"&&b._rotate(-f);const w=[];for(let T=0;Th_(ge,ae))}(L,I),J=j?F*T:F;for(const ee of g)for(const ae of ee){const ge=j?ae:h_(ae,I);let xe=J;const Re=gf([],[ae.x,ae.y,0,1],I);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?xe*=Re[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(xe*=w.cameraToCenterDistance/Re[3]),df(H,ge,xe))return!0}return!1}}function h_(s,i){const c=gf([],[s.x,s.y,0,1],i);return new k(c[0]/c[3],c[1]/c[3])}class f_ extends ns{}let d_;Et("HeatmapBucket",f_,{omit:["layers"]});var Hx={get paint(){return d_=d_||new Si({"heatmap-radius":new Gt(ne.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Gt(ne.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Bt(ne.paint_heatmap["heatmap-intensity"]),"heatmap-color":new su(ne.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Bt(ne.paint_heatmap["heatmap-opacity"])})}};function fp(s,{width:i,height:c},f,g){if(g){if(g instanceof Uint8ClampedArray)g=new Uint8Array(g.buffer);else if(g.length!==i*c*f)throw new RangeError(`mismatched image size. expected: ${g.length} but got: ${i*c*f}`)}else g=new Uint8Array(i*c*f);return s.width=i,s.height=c,s.data=g,s}function p_(s,{width:i,height:c},f){if(i===s.width&&c===s.height)return;const g=fp({},{width:i,height:c},f);dp(s,g,{x:0,y:0},{x:0,y:0},{width:Math.min(s.width,i),height:Math.min(s.height,c)},f),s.width=i,s.height=c,s.data=g.data}function dp(s,i,c,f,g,b){if(g.width===0||g.height===0)return i;if(g.width>s.width||g.height>s.height||c.x>s.width-g.width||c.y>s.height-g.height)throw new RangeError("out of range source coordinates for image copy");if(g.width>i.width||g.height>i.height||f.x>i.width-g.width||f.y>i.height-g.height)throw new RangeError("out of range destination coordinates for image copy");const w=s.data,T=i.data;if(w===T)throw new Error("srcData equals dstData, so image is already copied");for(let I=0;I{i[s.evaluationKey]=I;const L=s.expression.evaluate(i);g.data[w+T+0]=Math.floor(255*L.r/L.a),g.data[w+T+1]=Math.floor(255*L.g/L.a),g.data[w+T+2]=Math.floor(255*L.b/L.a),g.data[w+T+3]=Math.floor(255*L.a)};if(s.clips)for(let w=0,T=0;w80*c){f=b=s[0],g=w=s[1];for(var ee=c;eeb&&(b=T),I>w&&(w=I);L=(L=Math.max(b-f,w-g))!==0?32767/L:0}return Su(H,J,c,f,g,L,0),J}function __(s,i,c,f,g){var b,w;if(g===_p(s,i,c,f)>0)for(b=i;b=i;b-=f)w=b_(b,s[b],s[b+1],w);return w&&yf(w,w.next)&&(Tu(w),w=w.next),w}function Ha(s,i){if(!s)return s;i||(i=s);var c,f=s;do if(c=!1,f.steiner||!yf(f,f.next)&&Tn(f.prev,f,f.next)!==0)f=f.next;else{if(Tu(f),(f=i=f.prev)===f.next)break;c=!0}while(c||f!==i);return i}function Su(s,i,c,f,g,b,w){if(s){!w&&b&&function(F,j,H,J){var ee=F;do ee.z===0&&(ee.z=mp(ee.x,ee.y,j,H,J)),ee.prevZ=ee.prev,ee.nextZ=ee.next,ee=ee.next;while(ee!==F);ee.prevZ.nextZ=null,ee.prevZ=null,function(ae){var ge,xe,Re,ke,Ae,Je,Qe,kt,zt=1;do{for(xe=ae,ae=null,Ae=null,Je=0;xe;){for(Je++,Re=xe,Qe=0,ge=0;ge0||kt>0&ℜ)Qe!==0&&(kt===0||!Re||xe.z<=Re.z)?(ke=xe,xe=xe.nextZ,Qe--):(ke=Re,Re=Re.nextZ,kt--),Ae?Ae.nextZ=ke:ae=ke,ke.prevZ=Ae,Ae=ke;xe=Re}Ae.nextZ=null,zt*=2}while(Je>1)}(ee)}(s,f,g,b);for(var T,I,L=s;s.prev!==s.next;)if(T=s.prev,I=s.next,b?e2(s,f,g,b):Qx(s))i.push(T.i/c|0),i.push(s.i/c|0),i.push(I.i/c|0),Tu(s),s=I.next,L=I.next;else if((s=I)===L){w?w===1?Su(s=t2(Ha(s),i,c),i,c,f,g,b,2):w===2&&r2(s,i,c,f,g,b):Su(Ha(s),i,c,f,g,b,1);break}}}function Qx(s){var i=s.prev,c=s,f=s.next;if(Tn(i,c,f)>=0)return!1;for(var g=i.x,b=c.x,w=f.x,T=i.y,I=c.y,L=f.y,F=gb?g>w?g:w:b>w?b:w,J=T>I?T>L?T:L:I>L?I:L,ee=f.next;ee!==i;){if(ee.x>=F&&ee.x<=H&&ee.y>=j&&ee.y<=J&&Xl(g,T,b,I,w,L,ee.x,ee.y)&&Tn(ee.prev,ee,ee.next)>=0)return!1;ee=ee.next}return!0}function e2(s,i,c,f){var g=s.prev,b=s,w=s.next;if(Tn(g,b,w)>=0)return!1;for(var T=g.x,I=b.x,L=w.x,F=g.y,j=b.y,H=w.y,J=TI?T>L?T:L:I>L?I:L,ge=F>j?F>H?F:H:j>H?j:H,xe=mp(J,ee,i,c,f),Re=mp(ae,ge,i,c,f),ke=s.prevZ,Ae=s.nextZ;ke&&ke.z>=xe&&Ae&&Ae.z<=Re;){if(ke.x>=J&&ke.x<=ae&&ke.y>=ee&&ke.y<=ge&&ke!==g&&ke!==w&&Xl(T,F,I,j,L,H,ke.x,ke.y)&&Tn(ke.prev,ke,ke.next)>=0||(ke=ke.prevZ,Ae.x>=J&&Ae.x<=ae&&Ae.y>=ee&&Ae.y<=ge&&Ae!==g&&Ae!==w&&Xl(T,F,I,j,L,H,Ae.x,Ae.y)&&Tn(Ae.prev,Ae,Ae.next)>=0))return!1;Ae=Ae.nextZ}for(;ke&&ke.z>=xe;){if(ke.x>=J&&ke.x<=ae&&ke.y>=ee&&ke.y<=ge&&ke!==g&&ke!==w&&Xl(T,F,I,j,L,H,ke.x,ke.y)&&Tn(ke.prev,ke,ke.next)>=0)return!1;ke=ke.prevZ}for(;Ae&&Ae.z<=Re;){if(Ae.x>=J&&Ae.x<=ae&&Ae.y>=ee&&Ae.y<=ge&&Ae!==g&&Ae!==w&&Xl(T,F,I,j,L,H,Ae.x,Ae.y)&&Tn(Ae.prev,Ae,Ae.next)>=0)return!1;Ae=Ae.nextZ}return!0}function t2(s,i,c){var f=s;do{var g=f.prev,b=f.next.next;!yf(g,b)&&y_(g,f,f.next,b)&&ku(g,b)&&ku(b,g)&&(i.push(g.i/c|0),i.push(f.i/c|0),i.push(b.i/c|0),Tu(f),Tu(f.next),f=s=b),f=f.next}while(f!==s);return Ha(f)}function r2(s,i,c,f,g,b){var w=s;do{for(var T=w.next.next;T!==w.prev;){if(w.i!==T.i&&a2(w,T)){var I=v_(w,T);return w=Ha(w,w.next),I=Ha(I,I.next),Su(w,i,c,f,g,b,0),void Su(I,i,c,f,g,b,0)}T=T.next}w=w.next}while(w!==s)}function n2(s,i){return s.x-i.x}function i2(s,i){var c=function(g,b){var w,T=b,I=g.x,L=g.y,F=-1/0;do{if(L<=T.y&&L>=T.next.y&&T.next.y!==T.y){var j=T.x+(L-T.y)*(T.next.x-T.x)/(T.next.y-T.y);if(j<=I&&j>F&&(F=j,w=T.x=T.x&&T.x>=ee&&I!==T.x&&Xl(Lw.x||T.x===w.x&&o2(w,T)))&&(w=T,ge=H)),T=T.next;while(T!==J);return w}(s,i);if(!c)return i;var f=v_(c,s);return Ha(f,f.next),Ha(c,c.next)}function o2(s,i){return Tn(s.prev,s,i.prev)<0&&Tn(i.next,s,s.next)<0}function mp(s,i,c,f,g){return(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-c)*g|0)|s<<8))|s<<4))|s<<2))|s<<1))|(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-f)*g|0)|i<<8))|i<<4))|i<<2))|i<<1))<<1}function s2(s){var i=s,c=s;do(i.x=(s-w)*(b-T)&&(s-w)*(f-T)>=(c-w)*(i-T)&&(c-w)*(b-T)>=(g-w)*(f-T)}function a2(s,i){return s.next.i!==i.i&&s.prev.i!==i.i&&!function(c,f){var g=c;do{if(g.i!==c.i&&g.next.i!==c.i&&g.i!==f.i&&g.next.i!==f.i&&y_(g,g.next,c,f))return!0;g=g.next}while(g!==c);return!1}(s,i)&&(ku(s,i)&&ku(i,s)&&function(c,f){var g=c,b=!1,w=(c.x+f.x)/2,T=(c.y+f.y)/2;do g.y>T!=g.next.y>T&&g.next.y!==g.y&&w<(g.next.x-g.x)*(T-g.y)/(g.next.y-g.y)+g.x&&(b=!b),g=g.next;while(g!==c);return b}(s,i)&&(Tn(s.prev,s,i.prev)||Tn(s,i.prev,i))||yf(s,i)&&Tn(s.prev,s,s.next)>0&&Tn(i.prev,i,i.next)>0)}function Tn(s,i,c){return(i.y-s.y)*(c.x-i.x)-(i.x-s.x)*(c.y-i.y)}function yf(s,i){return s.x===i.x&&s.y===i.y}function y_(s,i,c,f){var g=bf(Tn(s,i,c)),b=bf(Tn(s,i,f)),w=bf(Tn(c,f,s)),T=bf(Tn(c,f,i));return g!==b&&w!==T||!(g!==0||!vf(s,c,i))||!(b!==0||!vf(s,f,i))||!(w!==0||!vf(c,s,f))||!(T!==0||!vf(c,i,f))}function vf(s,i,c){return i.x<=Math.max(s.x,c.x)&&i.x>=Math.min(s.x,c.x)&&i.y<=Math.max(s.y,c.y)&&i.y>=Math.min(s.y,c.y)}function bf(s){return s>0?1:s<0?-1:0}function ku(s,i){return Tn(s.prev,s,s.next)<0?Tn(s,i,s.next)>=0&&Tn(s,s.prev,i)>=0:Tn(s,i,s.prev)<0||Tn(s,s.next,i)<0}function v_(s,i){var c=new gp(s.i,s.x,s.y),f=new gp(i.i,i.x,i.y),g=s.next,b=i.prev;return s.next=i,i.prev=s,c.next=g,g.prev=c,f.next=c,c.prev=f,b.next=f,f.prev=b,f}function b_(s,i,c,f){var g=new gp(s,i,c);return f?(g.next=f.next,g.prev=f,f.next.prev=g,f.next=g):(g.prev=g,g.next=g),g}function Tu(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function gp(s,i,c){this.i=s,this.x=i,this.y=c,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function _p(s,i,c,f){for(var g=0,b=i,w=c-f;b0&&c.holes.push(f+=s[g-1].length)}return c};var w_=_(pp.exports);function l2(s,i,c,f,g){x_(s,i,c||0,f||s.length-1,g||c2)}function x_(s,i,c,f,g){for(;f>c;){if(f-c>600){var b=f-c+1,w=i-c+1,T=Math.log(b),I=.5*Math.exp(2*T/3),L=.5*Math.sqrt(T*I*(b-I)/b)*(w-b/2<0?-1:1);x_(s,i,Math.max(c,Math.floor(i-w*I/b+L)),Math.min(f,Math.floor(i+(b-w)*I/b+L)),g)}var F=s[i],j=c,H=f;for(Eu(s,c,i),g(s[f],F)>0&&Eu(s,c,f);j0;)H--}g(s[c],F)===0?Eu(s,c,H):Eu(s,++H,f),H<=i&&(c=H+1),i<=H&&(f=H-1)}}function Eu(s,i,c){var f=s[i];s[i]=s[c],s[c]=f}function c2(s,i){return si?1:0}function yp(s,i){const c=s.length;if(c<=1)return[s];const f=[];let g,b;for(let w=0;w1)for(let w=0;wc.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new he,this.indexArray=new $e,this.indexArray2=new nt,this.programConfigurations=new sn(i.layers,i.zoom),this.segments=new gt,this.segments2=new gt,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(i,c,f){this.hasPattern=vp("fill",this.layers,c);const g=this.layers[0].layout.get("fill-sort-key"),b=!g.isConstant(),w=[];for(const{feature:T,id:I,index:L,sourceLayerIndex:F}of i){const j=this.layers[0]._featureFilter.needGeometry,H=xs(T,j);if(!this.layers[0]._featureFilter.filter(new Qr(this.zoom),H,f))continue;const J=b?g.evaluate(H,{},f,c.availableImages):void 0,ee={id:I,properties:T.properties,type:T.type,sourceLayerIndex:F,index:L,geometry:j?H.geometry:ws(T),patterns:{},sortKey:J};w.push(ee)}b&&w.sort((T,I)=>T.sortKey-I.sortKey);for(const T of w){const{geometry:I,index:L,sourceLayerIndex:F}=T;if(this.hasPattern){const j=bp("fill",this.layers,T,this.zoom,c);this.patternFeatures.push(j)}else this.addFeature(T,I,L,f,{});c.featureIndex.insert(i[L].feature,I,L,F,this.index)}}update(i,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,c,this.stateDependentLayers,f)}addFeatures(i,c,f){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,c,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,Yx),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.indexBuffer2=i.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(i),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(i,c,f,g,b){for(const w of yp(c,500)){let T=0;for(const J of w)T+=J.length;const I=this.segments.prepareSegment(T,this.layoutVertexArray,this.indexArray),L=I.vertexLength,F=[],j=[];for(const J of w){if(J.length===0)continue;J!==w[0]&&j.push(F.length/2);const ee=this.segments2.prepareSegment(J.length,this.layoutVertexArray,this.indexArray2),ae=ee.vertexLength;this.layoutVertexArray.emplaceBack(J[0].x,J[0].y),this.indexArray2.emplaceBack(ae+J.length-1,ae),F.push(J[0].x),F.push(J[0].y);for(let ge=1;ge>3}if(g--,f===1||f===2)b+=s.readSVarint(),w+=s.readSVarint(),f===1&&(i&&T.push(i),i=[]),i.push(new g2(b,w));else{if(f!==7)throw new Error("unknown command "+f);i&&i.push(i[0].clone())}}return i&&T.push(i),T},Kl.prototype.bbox=function(){var s=this._pbf;s.pos=this._geometry;for(var i=s.readVarint()+s.pos,c=1,f=0,g=0,b=0,w=1/0,T=-1/0,I=1/0,L=-1/0;s.pos>3}if(f--,c===1||c===2)(g+=s.readSVarint())T&&(T=g),(b+=s.readSVarint())L&&(L=b);else if(c!==7)throw new Error("unknown command "+c)}return[w,I,T,L]},Kl.prototype.toGeoJSON=function(s,i,c){var f,g,b=this.extent*Math.pow(2,c),w=this.extent*s,T=this.extent*i,I=this.loadGeometry(),L=Kl.types[this.type];function F(J){for(var ee=0;ee>3;g=w===1?f.readString():w===2?f.readFloat():w===3?f.readDouble():w===4?f.readVarint64():w===5?f.readVarint():w===6?f.readSVarint():w===7?f.readBoolean():null}return g}(c))}M_.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var i=this._pbf.readVarint()+this._pbf.pos;return new v2(this._pbf,i,this.extent,this._keys,this._values)};var w2=E_;function x2(s,i,c){if(s===3){var f=new w2(c,c.readVarint()+c.pos);f.length&&(i[f.name]=f)}}Ys.VectorTile=function(s,i){this.layers=s.readFields(x2,{},i)},Ys.VectorTileFeature=T_,Ys.VectorTileLayer=E_;const S2=Ys.VectorTileFeature.types,xp=Math.pow(2,13);function Mu(s,i,c,f,g,b,w,T){s.emplaceBack(i,c,2*Math.floor(f*xp)+w,g*xp*2,b*xp*2,Math.round(T))}class Sp{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(c=>c.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new ue,this.centroidVertexArray=new q,this.indexArray=new $e,this.programConfigurations=new sn(i.layers,i.zoom),this.segments=new gt,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(i,c,f){this.features=[],this.hasPattern=vp("fill-extrusion",this.layers,c);for(const{feature:g,id:b,index:w,sourceLayerIndex:T}of i){const I=this.layers[0]._featureFilter.needGeometry,L=xs(g,I);if(!this.layers[0]._featureFilter.filter(new Qr(this.zoom),L,f))continue;const F={id:b,sourceLayerIndex:T,index:w,geometry:I?L.geometry:ws(g),properties:g.properties,type:g.type,patterns:{}};this.hasPattern?this.features.push(bp("fill-extrusion",this.layers,F,this.zoom,c)):this.addFeature(F,F.geometry,w,f,{}),c.featureIndex.insert(g,F.geometry,w,T,this.index,!0)}}addFeatures(i,c,f){for(const g of this.features){const{geometry:b}=g;this.addFeature(g,b,g.index,c,f)}}update(i,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,c,this.stateDependentLayers,f)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,m2),this.centroidVertexBuffer=i.createVertexBuffer(this.centroidVertexArray,p2.members,!0),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(i,c,f,g,b){const w={x:0,y:0,vertexCount:0};for(const T of yp(c,500)){let I=0;for(const ee of T)I+=ee.length;let L=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const ee of T){if(ee.length===0||T2(ee))continue;let ae=0;for(let ge=0;ge=1){const Re=ee[ge-1];if(!k2(xe,Re)){L.vertexLength+4>gt.MAX_VERTEX_ARRAY_LENGTH&&(L=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ke=xe.sub(Re)._perp()._unit(),Ae=Re.dist(xe);ae+Ae>32768&&(ae=0),Mu(this.layoutVertexArray,xe.x,xe.y,ke.x,ke.y,0,0,ae),Mu(this.layoutVertexArray,xe.x,xe.y,ke.x,ke.y,0,1,ae),w.x+=2*xe.x,w.y+=2*xe.y,w.vertexCount+=2,ae+=Ae,Mu(this.layoutVertexArray,Re.x,Re.y,ke.x,ke.y,0,0,ae),Mu(this.layoutVertexArray,Re.x,Re.y,ke.x,ke.y,0,1,ae),w.x+=2*Re.x,w.y+=2*Re.y,w.vertexCount+=2;const Je=L.vertexLength;this.indexArray.emplaceBack(Je,Je+2,Je+1),this.indexArray.emplaceBack(Je+1,Je+2,Je+3),L.vertexLength+=4,L.primitiveLength+=2}}}}if(L.vertexLength+I>gt.MAX_VERTEX_ARRAY_LENGTH&&(L=this.segments.prepareSegment(I,this.layoutVertexArray,this.indexArray)),S2[i.type]!=="Polygon")continue;const F=[],j=[],H=L.vertexLength;for(const ee of T)if(ee.length!==0){ee!==T[0]&&j.push(F.length/2);for(let ae=0;aeyn)||s.y===i.y&&(s.y<0||s.y>yn)}function T2(s){return s.every(i=>i.x<0)||s.every(i=>i.x>yn)||s.every(i=>i.y<0)||s.every(i=>i.y>yn)}let C_;Et("FillExtrusionBucket",Sp,{omit:["layers","features"]});var E2={get paint(){return C_=C_||new Si({"fill-extrusion-opacity":new Bt(ne["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Gt(ne["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Bt(ne["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Bt(ne["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Fl(ne["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Gt(ne["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Gt(ne["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Bt(ne["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class M2 extends so{constructor(i){super(i,E2)}createBucket(i){return new Sp(i)}queryRadius(){return pf(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,c,f,g,b,w,T,I){const L=mf(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,T),F=this.paint.get("fill-extrusion-height").evaluate(c,f),j=this.paint.get("fill-extrusion-base").evaluate(c,f),H=function(ee,ae,ge,xe){const Re=[];for(const ke of ee){const Ae=[ke.x,ke.y,0,1];gf(Ae,Ae,ae),Re.push(new k(Ae[0]/Ae[3],Ae[1]/Ae[3]))}return Re}(L,I),J=function(ee,ae,ge,xe){const Re=[],ke=[],Ae=xe[8]*ae,Je=xe[9]*ae,Qe=xe[10]*ae,kt=xe[11]*ae,zt=xe[8]*ge,St=xe[9]*ge,bt=xe[10]*ge,pt=xe[11]*ge;for(const It of ee){const yt=[],lt=[];for(const qt of It){const Dt=qt.x,mr=qt.y,Xr=xe[0]*Dt+xe[4]*mr+xe[12],tn=xe[1]*Dt+xe[5]*mr+xe[13],jn=xe[2]*Dt+xe[6]*mr+xe[14],Yi=xe[3]*Dt+xe[7]*mr+xe[15],Ti=jn+Qe,zn=Yi+kt,Yn=Xr+zt,ai=tn+St,Ei=jn+bt,Mi=Yi+pt,Un=new k((Xr+Ae)/zn,(tn+Je)/zn);Un.z=Ti/zn,yt.push(Un);const Vn=new k(Yn/Mi,ai/Mi);Vn.z=Ei/Mi,lt.push(Vn)}Re.push(yt),ke.push(lt)}return[Re,ke]}(g,j,F,I);return function(ee,ae,ge){let xe=1/0;_u(ge,ae)&&(xe=I_(ge,ae[0]));for(let Re=0;Rec.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(c=>{this.gradients[c.id]={}}),this.layoutVertexArray=new ye,this.layoutVertexArray2=new se,this.indexArray=new $e,this.programConfigurations=new sn(i.layers,i.zoom),this.segments=new gt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(i,c,f){this.hasPattern=vp("line",this.layers,c);const g=this.layers[0].layout.get("line-sort-key"),b=!g.isConstant(),w=[];for(const{feature:T,id:I,index:L,sourceLayerIndex:F}of i){const j=this.layers[0]._featureFilter.needGeometry,H=xs(T,j);if(!this.layers[0]._featureFilter.filter(new Qr(this.zoom),H,f))continue;const J=b?g.evaluate(H,{},f):void 0,ee={id:I,properties:T.properties,type:T.type,sourceLayerIndex:F,index:L,geometry:j?H.geometry:ws(T),patterns:{},sortKey:J};w.push(ee)}b&&w.sort((T,I)=>T.sortKey-I.sortKey);for(const T of w){const{geometry:I,index:L,sourceLayerIndex:F}=T;if(this.hasPattern){const j=bp("line",this.layers,T,this.zoom,c);this.patternFeatures.push(j)}else this.addFeature(T,I,L,f,{});c.featureIndex.insert(i[L].feature,I,L,F,this.index)}}update(i,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,c,this.stateDependentLayers,f)}addFeatures(i,c,f){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,c,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=i.createVertexBuffer(this.layoutVertexArray2,L2)),this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,I2),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(i){if(i.properties&&Object.prototype.hasOwnProperty.call(i.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(i.properties,"mapbox_clip_end"))return{start:+i.properties.mapbox_clip_start,end:+i.properties.mapbox_clip_end}}addFeature(i,c,f,g,b){const w=this.layers[0].layout,T=w.get("line-join").evaluate(i,{}),I=w.get("line-cap"),L=w.get("line-miter-limit"),F=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(i);for(const j of c)this.addLine(j,i,T,I,L,F);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,f,b,g)}addLine(i,c,f,g,b,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let xe=0;xe=2&&i[I-1].equals(i[I-2]);)I--;let L=0;for(;L0;if(kt&&xe>L){const pt=H.dist(J);if(pt>2*F){const It=H.sub(H.sub(J)._mult(F/pt)._round());this.updateDistance(J,It),this.addCurrentVertex(It,ae,0,0,j),J=It}}const St=J&ⅇlet bt=St?f:T?"butt":g;if(St&&bt==="round"&&(Jeb&&(bt="bevel"),bt==="bevel"&&(Je>2&&(bt="flipbevel"),Je100)Re=ge.mult(-1);else{const pt=Je*ae.add(ge).mag()/ae.sub(ge).mag();Re._perp()._mult(pt*(zt?-1:1))}this.addCurrentVertex(H,Re,0,0,j),this.addCurrentVertex(H,Re.mult(-1),0,0,j)}else if(bt==="bevel"||bt==="fakeround"){const pt=-Math.sqrt(Je*Je-1),It=zt?pt:0,yt=zt?0:pt;if(J&&this.addCurrentVertex(H,ae,It,yt,j),bt==="fakeround"){const lt=Math.round(180*Qe/Math.PI/20);for(let qt=1;qt2*F){const It=H.add(ee.sub(H)._mult(F/pt)._round());this.updateDistance(H,It),this.addCurrentVertex(It,ge,0,0,j),H=It}}}}addCurrentVertex(i,c,f,g,b,w=!1){const T=c.y*g-c.x,I=-c.y-c.x*g;this.addHalfVertex(i,c.x+c.y*f,c.y-c.x*f,w,!1,f,b),this.addHalfVertex(i,T,I,w,!0,-g,b),this.distance>A_/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(i,c,f,g,b,w))}addHalfVertex({x:i,y:c},f,g,b,w,T,I){const L=.5*(this.lineClips?this.scaledDistance*(A_-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((i<<1)+(b?1:0),(c<<1)+(w?1:0),Math.round(63*f)+128,Math.round(63*g)+128,1+(T===0?0:T<0?-1:1)|(63&L)<<2,L>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const F=I.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,F),I.primitiveLength++),w?this.e2=F:this.e1=F}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(i,c){this.distance+=i.dist(c),this.updateScaledDistance()}}let L_,P_;Et("LineBucket",kp,{omit:["layers","patternFeatures"]});var z_={get paint(){return P_=P_||new Si({"line-opacity":new Gt(ne.paint_line["line-opacity"]),"line-color":new Gt(ne.paint_line["line-color"]),"line-translate":new Bt(ne.paint_line["line-translate"]),"line-translate-anchor":new Bt(ne.paint_line["line-translate-anchor"]),"line-width":new Gt(ne.paint_line["line-width"]),"line-gap-width":new Gt(ne.paint_line["line-gap-width"]),"line-offset":new Gt(ne.paint_line["line-offset"]),"line-blur":new Gt(ne.paint_line["line-blur"]),"line-dasharray":new ja(ne.paint_line["line-dasharray"]),"line-pattern":new Fl(ne.paint_line["line-pattern"]),"line-gradient":new su(ne.paint_line["line-gradient"])})},get layout(){return L_=L_||new Si({"line-cap":new Bt(ne.layout_line["line-cap"]),"line-join":new Gt(ne.layout_line["line-join"]),"line-miter-limit":new Bt(ne.layout_line["line-miter-limit"]),"line-round-limit":new Bt(ne.layout_line["line-round-limit"]),"line-sort-key":new Gt(ne.layout_line["line-sort-key"])})}};class D2 extends Gt{possiblyEvaluate(i,c){return c=new Qr(Math.floor(c.zoom),{now:c.now,fadeDuration:c.fadeDuration,zoomHistory:c.zoomHistory,transition:c.transition}),super.possiblyEvaluate(i,c)}evaluate(i,c,f,g){return c=X({},c,{zoom:Math.floor(c.zoom)}),super.evaluate(i,c,f,g)}}let wf;class R2 extends so{constructor(i){super(i,z_),this.gradientVersion=0,wf||(wf=new D2(z_.paint.properties["line-width"].specification),wf.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(i){if(i==="line-gradient"){const c=this.gradientExpression();this.stepInterpolant=!!function(f){return f._styleExpression!==void 0}(c)&&c._styleExpression.expression instanceof Pa,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,c){super.recalculate(i,c),this.paint._values["line-floorwidth"]=wf.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new kp(i)}queryRadius(i){const c=i,f=D_(bu("line-width",this,c),bu("line-gap-width",this,c)),g=bu("line-offset",this,c);return f/2+Math.abs(g)+pf(this.paint.get("line-translate"))}queryIntersectsFeature(i,c,f,g,b,w,T){const I=mf(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,T),L=T/2*D_(this.paint.get("line-width").evaluate(c,f),this.paint.get("line-gap-width").evaluate(c,f)),F=this.paint.get("line-offset").evaluate(c,f);return F&&(g=function(j,H){const J=[];for(let ee=0;ee=3){for(let ge=0;ge0?i+2*s:s}const B2=kn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),F2=kn([{name:"a_projected_pos",components:3,type:"Float32"}],4);kn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const O2=kn([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);kn([{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 R_=kn([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),N2=kn([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function j2(s,i,c){return s.sections.forEach(f=>{f.text=function(g,b,w){const T=b.layout.get("text-transform").evaluate(w,{});return T==="uppercase"?g=g.toLocaleUpperCase():T==="lowercase"&&(g=g.toLocaleLowerCase()),es.applyArabicShaping&&(g=es.applyArabicShaping(g)),g}(f.text,i,c)}),s}kn([{name:"triangle",components:3,type:"Uint16"}]),kn([{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"}]),kn([{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"}]),kn([{type:"Float32",name:"offsetX"}]),kn([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),kn([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Iu={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Nn=24,B_=Br,F_=function(s,i,c,f,g){var b,w,T=8*g-f-1,I=(1<>1,F=-7,j=c?g-1:0,H=c?-1:1,J=s[i+j];for(j+=H,b=J&(1<<-F)-1,J>>=-F,F+=T;F>0;b=256*b+s[i+j],j+=H,F-=8);for(w=b&(1<<-F)-1,b>>=-F,F+=f;F>0;w=256*w+s[i+j],j+=H,F-=8);if(b===0)b=1-L;else{if(b===I)return w?NaN:1/0*(J?-1:1);w+=Math.pow(2,f),b-=L}return(J?-1:1)*w*Math.pow(2,b-f)},O_=function(s,i,c,f,g,b){var w,T,I,L=8*b-g-1,F=(1<>1,H=g===23?Math.pow(2,-24)-Math.pow(2,-77):0,J=f?0:b-1,ee=f?1:-1,ae=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(T=isNaN(i)?1:0,w=F):(w=Math.floor(Math.log(i)/Math.LN2),i*(I=Math.pow(2,-w))<1&&(w--,I*=2),(i+=w+j>=1?H/I:H*Math.pow(2,1-j))*I>=2&&(w++,I/=2),w+j>=F?(T=0,w=F):w+j>=1?(T=(i*I-1)*Math.pow(2,g),w+=j):(T=i*Math.pow(2,j-1)*Math.pow(2,g),w=0));g>=8;s[c+J]=255&T,J+=ee,T/=256,g-=8);for(w=w<0;s[c+J]=255&w,J+=ee,w/=256,L-=8);s[c+J-ee]|=128*ae};function Br(s){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(s)?s:new Uint8Array(s||0),this.pos=0,this.type=0,this.length=this.buf.length}Br.Varint=0,Br.Fixed64=1,Br.Bytes=2,Br.Fixed32=5;var Tp=4294967296,N_=1/Tp,j_=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Ss(s){return s.type===Br.Bytes?s.readVarint()+s.pos:s.pos+1}function Jl(s,i,c){return c?4294967296*i+(s>>>0):4294967296*(i>>>0)+(s>>>0)}function U_(s,i,c){var f=i<=16383?1:i<=2097151?2:i<=268435455?3:Math.floor(Math.log(i)/(7*Math.LN2));c.realloc(f);for(var g=c.pos-1;g>=s;g--)c.buf[g+f]=c.buf[g]}function U2(s,i){for(var c=0;c>>8,s[c+2]=i>>>16,s[c+3]=i>>>24}function V_(s,i){return(s[i]|s[i+1]<<8|s[i+2]<<16)+(s[i+3]<<24)}Br.prototype={destroy:function(){this.buf=null},readFields:function(s,i,c){for(c=c||this.length;this.pos>3,b=this.pos;this.type=7&f,s(g,i,this),this.pos===b&&this.skip(f)}return i},readMessage:function(s,i){return this.readFields(s,i,this.readVarint()+this.pos)},readFixed32:function(){var s=xf(this.buf,this.pos);return this.pos+=4,s},readSFixed32:function(){var s=V_(this.buf,this.pos);return this.pos+=4,s},readFixed64:function(){var s=xf(this.buf,this.pos)+xf(this.buf,this.pos+4)*Tp;return this.pos+=8,s},readSFixed64:function(){var s=xf(this.buf,this.pos)+V_(this.buf,this.pos+4)*Tp;return this.pos+=8,s},readFloat:function(){var s=F_(this.buf,this.pos,!0,23,4);return this.pos+=4,s},readDouble:function(){var s=F_(this.buf,this.pos,!0,52,8);return this.pos+=8,s},readVarint:function(s){var i,c,f=this.buf;return i=127&(c=f[this.pos++]),c<128?i:(i|=(127&(c=f[this.pos++]))<<7,c<128?i:(i|=(127&(c=f[this.pos++]))<<14,c<128?i:(i|=(127&(c=f[this.pos++]))<<21,c<128?i:function(g,b,w){var T,I,L=w.buf;if(T=(112&(I=L[w.pos++]))>>4,I<128||(T|=(127&(I=L[w.pos++]))<<3,I<128)||(T|=(127&(I=L[w.pos++]))<<10,I<128)||(T|=(127&(I=L[w.pos++]))<<17,I<128)||(T|=(127&(I=L[w.pos++]))<<24,I<128)||(T|=(1&(I=L[w.pos++]))<<31,I<128))return Jl(g,T,b);throw new Error("Expected varint not more than 10 bytes")}(i|=(15&(c=f[this.pos]))<<28,s,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var s=this.readVarint();return s%2==1?(s+1)/-2:s/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var s=this.readVarint()+this.pos,i=this.pos;return this.pos=s,s-i>=12&&j_?function(c,f,g){return j_.decode(c.subarray(f,g))}(this.buf,i,s):function(c,f,g){for(var b="",w=f;w239?4:F>223?3:F>191?2:1;if(w+H>g)break;H===1?F<128&&(j=F):H===2?(192&(T=c[w+1]))==128&&(j=(31&F)<<6|63&T)<=127&&(j=null):H===3?(I=c[w+2],(192&(T=c[w+1]))==128&&(192&I)==128&&((j=(15&F)<<12|(63&T)<<6|63&I)<=2047||j>=55296&&j<=57343)&&(j=null)):H===4&&(I=c[w+2],L=c[w+3],(192&(T=c[w+1]))==128&&(192&I)==128&&(192&L)==128&&((j=(15&F)<<18|(63&T)<<12|(63&I)<<6|63&L)<=65535||j>=1114112)&&(j=null)),j===null?(j=65533,H=1):j>65535&&(j-=65536,b+=String.fromCharCode(j>>>10&1023|55296),j=56320|1023&j),b+=String.fromCharCode(j),w+=H}return b}(this.buf,i,s)},readBytes:function(){var s=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,s);return this.pos=s,i},readPackedVarint:function(s,i){if(this.type!==Br.Bytes)return s.push(this.readVarint(i));var c=Ss(this);for(s=s||[];this.pos127;);else if(i===Br.Bytes)this.pos=this.readVarint()+this.pos;else if(i===Br.Fixed32)this.pos+=4;else{if(i!==Br.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(s,i){this.writeVarint(s<<3|i)},realloc:function(s){for(var i=this.length||16;i268435455||s<0?function(i,c){var f,g;if(i>=0?(f=i%4294967296|0,g=i/4294967296|0):(g=~(-i/4294967296),4294967295^(f=~(-i%4294967296))?f=f+1|0:(f=0,g=g+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");c.realloc(10),function(b,w,T){T.buf[T.pos++]=127&b|128,b>>>=7,T.buf[T.pos++]=127&b|128,b>>>=7,T.buf[T.pos++]=127&b|128,b>>>=7,T.buf[T.pos++]=127&b|128,T.buf[T.pos]=127&(b>>>=7)}(f,0,c),function(b,w){var T=(7&b)<<4;w.buf[w.pos++]|=T|((b>>>=3)?128:0),b&&(w.buf[w.pos++]=127&b|((b>>>=7)?128:0),b&&(w.buf[w.pos++]=127&b|((b>>>=7)?128:0),b&&(w.buf[w.pos++]=127&b|((b>>>=7)?128:0),b&&(w.buf[w.pos++]=127&b|((b>>>=7)?128:0),b&&(w.buf[w.pos++]=127&b)))))}(g,c)}(s,this):(this.realloc(4),this.buf[this.pos++]=127&s|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=s>>>7&127))))},writeSVarint:function(s){this.writeVarint(s<0?2*-s-1:2*s)},writeBoolean:function(s){this.writeVarint(!!s)},writeString:function(s){s=String(s),this.realloc(4*s.length),this.pos++;var i=this.pos;this.pos=function(f,g,b){for(var w,T,I=0;I55295&&w<57344){if(!T){w>56319||I+1===g.length?(f[b++]=239,f[b++]=191,f[b++]=189):T=w;continue}if(w<56320){f[b++]=239,f[b++]=191,f[b++]=189,T=w;continue}w=T-55296<<10|w-56320|65536,T=null}else T&&(f[b++]=239,f[b++]=191,f[b++]=189,T=null);w<128?f[b++]=w:(w<2048?f[b++]=w>>6|192:(w<65536?f[b++]=w>>12|224:(f[b++]=w>>18|240,f[b++]=w>>12&63|128),f[b++]=w>>6&63|128),f[b++]=63&w|128)}return b}(this.buf,s,this.pos);var c=this.pos-i;c>=128&&U_(i,c,this),this.pos=i-1,this.writeVarint(c),this.pos+=c},writeFloat:function(s){this.realloc(4),O_(this.buf,s,this.pos,!0,23,4),this.pos+=4},writeDouble:function(s){this.realloc(8),O_(this.buf,s,this.pos,!0,52,8),this.pos+=8},writeBytes:function(s){var i=s.length;this.writeVarint(i),this.realloc(i);for(var c=0;c=128&&U_(c,f,this),this.pos=c-1,this.writeVarint(f),this.pos+=f},writeMessage:function(s,i,c){this.writeTag(s,Br.Bytes),this.writeRawMessage(i,c)},writePackedVarint:function(s,i){i.length&&this.writeMessage(s,U2,i)},writePackedSVarint:function(s,i){i.length&&this.writeMessage(s,V2,i)},writePackedBoolean:function(s,i){i.length&&this.writeMessage(s,W2,i)},writePackedFloat:function(s,i){i.length&&this.writeMessage(s,q2,i)},writePackedDouble:function(s,i){i.length&&this.writeMessage(s,G2,i)},writePackedFixed32:function(s,i){i.length&&this.writeMessage(s,Z2,i)},writePackedSFixed32:function(s,i){i.length&&this.writeMessage(s,H2,i)},writePackedFixed64:function(s,i){i.length&&this.writeMessage(s,$2,i)},writePackedSFixed64:function(s,i){i.length&&this.writeMessage(s,X2,i)},writeBytesField:function(s,i){this.writeTag(s,Br.Bytes),this.writeBytes(i)},writeFixed32Field:function(s,i){this.writeTag(s,Br.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(s,i){this.writeTag(s,Br.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(s,i){this.writeTag(s,Br.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(s,i){this.writeTag(s,Br.Fixed64),this.writeSFixed64(i)},writeVarintField:function(s,i){this.writeTag(s,Br.Varint),this.writeVarint(i)},writeSVarintField:function(s,i){this.writeTag(s,Br.Varint),this.writeSVarint(i)},writeStringField:function(s,i){this.writeTag(s,Br.Bytes),this.writeString(i)},writeFloatField:function(s,i){this.writeTag(s,Br.Fixed32),this.writeFloat(i)},writeDoubleField:function(s,i){this.writeTag(s,Br.Fixed64),this.writeDouble(i)},writeBooleanField:function(s,i){this.writeVarintField(s,!!i)}};var Ep=_(B_);const Mp=3;function K2(s,i,c){s===1&&c.readMessage(J2,i)}function J2(s,i,c){if(s===3){const{id:f,bitmap:g,width:b,height:w,left:T,top:I,advance:L}=c.readMessage(Y2,{});i.push({id:f,bitmap:new xu({width:b+2*Mp,height:w+2*Mp},g),metrics:{width:b,height:w,left:T,top:I,advance:L}})}}function Y2(s,i,c){s===1?i.id=c.readVarint():s===2?i.bitmap=c.readBytes():s===3?i.width=c.readVarint():s===4?i.height=c.readVarint():s===5?i.left=c.readSVarint():s===6?i.top=c.readSVarint():s===7&&(i.advance=c.readVarint())}const q_=Mp;function G_(s){let i=0,c=0;for(const w of s)i+=w.w*w.h,c=Math.max(c,w.w);s.sort((w,T)=>T.h-w.h);const f=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(i/.95)),c),h:1/0}];let g=0,b=0;for(const w of s)for(let T=f.length-1;T>=0;T--){const I=f[T];if(!(w.w>I.w||w.h>I.h)){if(w.x=I.x,w.y=I.y,b=Math.max(b,w.y+w.h),g=Math.max(g,w.x+w.w),w.w===I.w&&w.h===I.h){const L=f.pop();T=0&&f>=i&&kf[this.text.charCodeAt(f)];f--)c--;this.text=this.text.substring(i,c),this.sectionIndex=this.sectionIndex.slice(i,c)}substring(i,c){const f=new Ql;return f.text=this.text.substring(i,c),f.sectionIndex=this.sectionIndex.slice(i,c),f.sections=this.sections,f}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((i,c)=>Math.max(i,this.sections[c].scale),0)}addTextSection(i,c){this.text+=i.text,this.sections.push(Lu.forText(i.scale,i.fontStack||c));const f=this.sections.length-1;for(let g=0;g=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Sf(s,i,c,f,g,b,w,T,I,L,F,j,H,J,ee,ae){const ge=Ql.fromFeature(s,g);let xe;j===d.ah.vertical&&ge.verticalizePunctuation();const{processBidirectionalText:Re,processStyledBidirectionalText:ke}=es;if(Re&&ge.sections.length===1){xe=[];const Qe=Re(ge.toString(),Ip(ge,L,b,i,f,J,ee));for(const kt of Qe){const zt=new Ql;zt.text=kt,zt.sections=ge.sections;for(let St=0;St0&&Ts>Ui&&(Ui=Ts)}else{const co=zt[_r.fontStack],qi=co&&co[li];if(qi&&qi.rect)No=qi.rect,xo=qi.metrics;else{const Ts=kt[_r.fontStack],Bu=Ts&&Ts[li];if(!Bu)continue;xo=Bu.metrics}Gn=(Vn-_r.scale)*Nn}So?(Qe.verticalizable=!0,gi.push({glyph:li,imageName:jo,x:Xr,y:tn+Gn,vertical:So,scale:_r.scale,fontStack:_r.fontStack,sectionIndex:_i,metrics:xo,rect:No}),Xr+=ks*_r.scale+qt):(gi.push({glyph:li,imageName:jo,x:Xr,y:tn+Gn,vertical:So,scale:_r.scale,fontStack:_r.fontStack,sectionIndex:_i,metrics:xo,rect:No}),Xr+=xo.advance*_r.scale+qt)}gi.length!==0&&(jn=Math.max(Xr-qt,jn),tS(gi,0,gi.length-1,Ti,Ui)),Xr=0;const Vi=pt*Vn+Ui;Ci.lineOffset=Math.max(Ui,mi),tn+=Vi,Yi=Math.max(Vi,Yi),++zn}var Yn;const ai=tn-Au,{horizontalAlign:Ei,verticalAlign:Mi}=Ap(It);(function(Un,Vn,mi,Ci,gi,Ui,Vi,qn,_r){const _i=(Vn-mi)*gi;let li=0;li=Ui!==Vi?-qn*Ci-Au:(-Ci*_r+.5)*Vi;for(const Gn of Un)for(const xo of Gn.positionedGlyphs)xo.x+=_i,xo.y+=li})(Qe.positionedLines,Ti,Ei,Mi,jn,Yi,pt,ai,bt.length),Qe.top+=-Mi*ai,Qe.bottom=Qe.top+ai,Qe.left+=-Ei*jn,Qe.right=Qe.left+jn}(Je,i,c,f,xe,w,T,I,j,L,H,ae),!function(Qe){for(const kt of Qe)if(kt.positionedGlyphs.length!==0)return!1;return!0}(Ae)&&Je}const kf={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Q2={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Z_(s,i,c,f,g,b){if(i.imageName){const w=f[i.imageName];return w?w.displaySize[0]*i.scale*Nn/b+g:0}{const w=c[i.fontStack],T=w&&w[s];return T?T.metrics.advance*i.scale+g:0}}function H_(s,i,c,f){const g=Math.pow(s-i,2);return f?s=0;let F=0;for(let H=0;Hw.id),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=hp([]),this.placementViewportMatrix=hp([]);const c=this.layers[0]._unevaluatedLayout._values;this.textSizeData=J_(this.zoom,c["text-size"]),this.iconSizeData=J_(this.zoom,c["icon-size"]);const f=this.layers[0].layout,g=f.get("symbol-sort-key"),b=f.get("symbol-z-order");this.canOverlap=Lp(f,"text-overlap","text-allow-overlap")!=="never"||Lp(f,"icon-overlap","icon-allow-overlap")!=="never"||f.get("text-ignore-placement")||f.get("icon-ignore-placement"),this.sortFeaturesByKey=b!=="viewport-y"&&!g.isConstant(),this.sortFeaturesByY=(b==="viewport-y"||b==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,f.get("symbol-placement")==="point"&&(this.writingModes=f.get("text-writing-mode").map(w=>d.ah[w])),this.stateDependentLayerIds=this.layers.filter(w=>w.isStateDependent()).map(w=>w.id),this.sourceID=i.sourceID}createArrays(){this.text=new zp(new sn(this.layers,this.zoom,i=>/^text/.test(i))),this.icon=new zp(new sn(this.layers,this.zoom,i=>/^icon/.test(i))),this.glyphOffsetArray=new v,this.lineVertexArray=new E,this.symbolInstances=new m,this.textAnchorOffsets=new A}calculateGlyphDependencies(i,c,f,g,b){for(let w=0;w0)&&(w.value.kind!=="constant"||w.value.value.length>0),F=I.value.kind!=="constant"||!!I.value.value||Object.keys(I.parameters).length>0,j=b.get("symbol-sort-key");if(this.features=[],!L&&!F)return;const H=c.iconDependencies,J=c.glyphDependencies,ee=c.availableImages,ae=new Qr(this.zoom);for(const{feature:ge,id:xe,index:Re,sourceLayerIndex:ke}of i){const Ae=g._featureFilter.needGeometry,Je=xs(ge,Ae);if(!g._featureFilter.filter(ae,Je,f))continue;let Qe,kt;if(Ae||(Je.geometry=ws(ge)),L){const St=g.getValueAndResolveTokens("text-field",Je,f,ee),bt=Ri.factory(St),pt=this.hasRTLText=this.hasRTLText||oS(bt);(!pt||es.getRTLTextPluginStatus()==="unavailable"||pt&&es.isParsed())&&(Qe=j2(bt,g,Je))}if(F){const St=g.getValueAndResolveTokens("icon-image",Je,f,ee);kt=St instanceof Xi?St:Xi.fromString(St)}if(!Qe&&!kt)continue;const zt=this.sortFeaturesByKey?j.evaluate(Je,{},f):void 0;if(this.features.push({id:xe,text:Qe,icon:kt,index:Re,sourceLayerIndex:ke,geometry:Je.geometry,properties:ge.properties,type:nS[ge.type],sortKey:zt}),kt&&(H[kt.name]=!0),Qe){const St=w.evaluate(Je,{},f).join(","),bt=b.get("text-rotation-alignment")!=="viewport"&&b.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(d.ah.vertical)>=0;for(const pt of Qe.sections)if(pt.image)H[pt.image.name]=!0;else{const It=Ks(Qe.toString()),yt=pt.fontStack||St,lt=J[yt]=J[yt]||{};this.calculateGlyphDependencies(pt.text,lt,bt,this.allowVerticalPlacement,It)}}}b.get("symbol-placement")==="line"&&(this.features=function(ge){const xe={},Re={},ke=[];let Ae=0;function Je(St){ke.push(ge[St]),Ae++}function Qe(St,bt,pt){const It=Re[St];return delete Re[St],Re[bt]=It,ke[It].geometry[0].pop(),ke[It].geometry[0]=ke[It].geometry[0].concat(pt[0]),It}function kt(St,bt,pt){const It=xe[bt];return delete xe[bt],xe[St]=It,ke[It].geometry[0].shift(),ke[It].geometry[0]=pt[0].concat(ke[It].geometry[0]),It}function zt(St,bt,pt){const It=pt?bt[0][bt[0].length-1]:bt[0][0];return`${St}:${It.x}:${It.y}`}for(let St=0;StSt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ge,xe)=>ge.sortKey-xe.sortKey)}update(i,c,f){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(i,c,this.layers,f),this.icon.programConfigurations.updatePaintArrays(i,c,this.layers,f))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(i){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(i),this.iconCollisionBox.upload(i)),this.text.upload(i,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(i,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(i,c){const f=this.lineVertexArray.length;if(i.segment!==void 0){let g=i.dist(c[i.segment+1]),b=i.dist(c[i.segment]);const w={};for(let T=i.segment+1;T=0;T--)w[T]={x:c[T].x,y:c[T].y,tileUnitDistanceFromAnchor:b},T>0&&(b+=c[T-1].dist(c[T]));for(let T=0;T0}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(i,c){const f=i.placedSymbolArray.get(c),g=f.vertexStartIndex+4*f.numGlyphs;for(let b=f.vertexStartIndex;bg[T]-g[I]||b[I]-b[T]),w}addToSortKeyRanges(i,c){const f=this.sortKeyRanges[this.sortKeyRanges.length-1];f&&f.sortKey===c?f.symbolInstanceEnd=i+1:this.sortKeyRanges.push({sortKey:c,symbolInstanceStart:i,symbolInstanceEnd:i+1})}sortFeatures(i){if(this.sortFeaturesByY&&this.sortedAngle!==i&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(i),this.sortedAngle=i,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const c of this.symbolInstanceIndexes){const f=this.symbolInstances.get(c);this.featureSortOrder.push(f.featureIndex),[f.rightJustifiedTextSymbolIndex,f.centerJustifiedTextSymbolIndex,f.leftJustifiedTextSymbolIndex].forEach((g,b,w)=>{g>=0&&w.indexOf(g)===b&&this.addIndicesForPlacedSymbol(this.text,g)}),f.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,f.verticalPlacedTextSymbolIndex),f.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,f.placedIconSymbolIndex),f.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,f.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Y_,Q_;Et("SymbolBucket",ec,{omit:["layers","collisionBoxArray","features","compareText"]}),ec.MAX_GLYPHS=65535,ec.addDynamicAttributes=Pp;var Rp={get paint(){return Q_=Q_||new Si({"icon-opacity":new Gt(ne.paint_symbol["icon-opacity"]),"icon-color":new Gt(ne.paint_symbol["icon-color"]),"icon-halo-color":new Gt(ne.paint_symbol["icon-halo-color"]),"icon-halo-width":new Gt(ne.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Gt(ne.paint_symbol["icon-halo-blur"]),"icon-translate":new Bt(ne.paint_symbol["icon-translate"]),"icon-translate-anchor":new Bt(ne.paint_symbol["icon-translate-anchor"]),"text-opacity":new Gt(ne.paint_symbol["text-opacity"]),"text-color":new Gt(ne.paint_symbol["text-color"],{runtimeType:Nr,getOverride:s=>s.textColor,hasOverride:s=>!!s.textColor}),"text-halo-color":new Gt(ne.paint_symbol["text-halo-color"]),"text-halo-width":new Gt(ne.paint_symbol["text-halo-width"]),"text-halo-blur":new Gt(ne.paint_symbol["text-halo-blur"]),"text-translate":new Bt(ne.paint_symbol["text-translate"]),"text-translate-anchor":new Bt(ne.paint_symbol["text-translate-anchor"])})},get layout(){return Y_=Y_||new Si({"symbol-placement":new Bt(ne.layout_symbol["symbol-placement"]),"symbol-spacing":new Bt(ne.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Bt(ne.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Gt(ne.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Bt(ne.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Bt(ne.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Bt(ne.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Bt(ne.layout_symbol["icon-ignore-placement"]),"icon-optional":new Bt(ne.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Bt(ne.layout_symbol["icon-rotation-alignment"]),"icon-size":new Gt(ne.layout_symbol["icon-size"]),"icon-text-fit":new Bt(ne.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Bt(ne.layout_symbol["icon-text-fit-padding"]),"icon-image":new Gt(ne.layout_symbol["icon-image"]),"icon-rotate":new Gt(ne.layout_symbol["icon-rotate"]),"icon-padding":new Gt(ne.layout_symbol["icon-padding"]),"icon-keep-upright":new Bt(ne.layout_symbol["icon-keep-upright"]),"icon-offset":new Gt(ne.layout_symbol["icon-offset"]),"icon-anchor":new Gt(ne.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Bt(ne.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Bt(ne.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Bt(ne.layout_symbol["text-rotation-alignment"]),"text-field":new Gt(ne.layout_symbol["text-field"]),"text-font":new Gt(ne.layout_symbol["text-font"]),"text-size":new Gt(ne.layout_symbol["text-size"]),"text-max-width":new Gt(ne.layout_symbol["text-max-width"]),"text-line-height":new Bt(ne.layout_symbol["text-line-height"]),"text-letter-spacing":new Gt(ne.layout_symbol["text-letter-spacing"]),"text-justify":new Gt(ne.layout_symbol["text-justify"]),"text-radial-offset":new Gt(ne.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Bt(ne.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Gt(ne.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Gt(ne.layout_symbol["text-anchor"]),"text-max-angle":new Bt(ne.layout_symbol["text-max-angle"]),"text-writing-mode":new Bt(ne.layout_symbol["text-writing-mode"]),"text-rotate":new Gt(ne.layout_symbol["text-rotate"]),"text-padding":new Bt(ne.layout_symbol["text-padding"]),"text-keep-upright":new Bt(ne.layout_symbol["text-keep-upright"]),"text-transform":new Gt(ne.layout_symbol["text-transform"]),"text-offset":new Gt(ne.layout_symbol["text-offset"]),"text-allow-overlap":new Bt(ne.layout_symbol["text-allow-overlap"]),"text-overlap":new Bt(ne.layout_symbol["text-overlap"]),"text-ignore-placement":new Bt(ne.layout_symbol["text-ignore-placement"]),"text-optional":new Bt(ne.layout_symbol["text-optional"])})}};class ey{constructor(i){if(i.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=i.property.overrides?i.property.overrides.runtimeType:Or,this.defaultValue=i}evaluate(i){if(i.formattedSection){const c=this.defaultValue.property.overrides;if(c&&c.hasOverride(i.formattedSection))return c.getOverride(i.formattedSection)}return i.feature&&i.featureState?this.defaultValue.evaluate(i.feature,i.featureState):this.defaultValue.property.specification.default}eachChild(i){this.defaultValue.isConstant()||i(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Et("FormatSectionOverride",ey,{omit:["defaultValue"]});class Ef extends so{constructor(i){super(i,Rp)}recalculate(i,c){if(super.recalculate(i,c),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 f=this.layout.get("text-writing-mode");if(f){const g=[];for(const b of f)g.indexOf(b)<0&&g.push(b);this.layout._values["text-writing-mode"]=g}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(i,c,f,g){const b=this.layout.get(i).evaluate(c,{},f,g),w=this._unevaluatedLayout._values[i];return w.isDataDriven()||jr(w.value)||!b?b:function(T,I){return I.replace(/{([^{}]+)}/g,(L,F)=>T&&F in T?String(T[F]):"")}(c.properties,b)}createBucket(i){return new ec(i)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const i of Rp.paint.overridableProperties){if(!Ef.hasPaintOverride(this.layout,i))continue;const c=this.paint.get(i),f=new ey(c),g=new $r(f,c.property.specification);let b=null;b=c.value.kind==="constant"||c.value.kind==="source"?new Sl("source",g):new Xc("composite",g,c.value.zoomStops),this.paint._values[i]=new oo(c.property,b,c.parameters)}}_handleOverridablePaintPropertyUpdate(i,c,f){return!(!this.layout||c.isDataDriven()||f.isDataDriven())&&Ef.hasPaintOverride(this.layout,i)}static hasPaintOverride(i,c){const f=i.get("text-field"),g=Rp.paint.properties[c];let b=!1;const w=T=>{for(const I of T)if(g.overrides&&g.overrides.hasOverride(I))return void(b=!0)};if(f.value.kind==="constant"&&f.value.value instanceof Ri)w(f.value.value.sections);else if(f.value.kind==="source"){const T=L=>{b||(L instanceof Xo&&In(L.value)===an?w(L.value.sections):L instanceof wl?w(L.sections):L.eachChild(T))},I=f.value;I._styleExpression&&T(I._styleExpression.expression)}return b}}let ty;var sS={get paint(){return ty=ty||new Si({"background-color":new Bt(ne.paint_background["background-color"]),"background-pattern":new ja(ne.paint_background["background-pattern"]),"background-opacity":new Bt(ne.paint_background["background-opacity"])})}};class aS extends so{constructor(i){super(i,sS)}}let ry;var lS={get paint(){return ry=ry||new Si({"raster-opacity":new Bt(ne.paint_raster["raster-opacity"]),"raster-hue-rotate":new Bt(ne.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Bt(ne.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Bt(ne.paint_raster["raster-brightness-max"]),"raster-saturation":new Bt(ne.paint_raster["raster-saturation"]),"raster-contrast":new Bt(ne.paint_raster["raster-contrast"]),"raster-resampling":new Bt(ne.paint_raster["raster-resampling"]),"raster-fade-duration":new Bt(ne.paint_raster["raster-fade-duration"])})}};class cS extends so{constructor(i){super(i,lS)}}class uS extends so{constructor(i){super(i,{}),this.onAdd=c=>{this.implementation.onAdd&&this.implementation.onAdd(c,c.painter.context.gl)},this.onRemove=c=>{this.implementation.onRemove&&this.implementation.onRemove(c,c.painter.context.gl)},this.implementation=i}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 hS{constructor(i){this._methodToThrottle=i,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 Bp=63710088e-1;class ta{constructor(i,c){if(isNaN(i)||isNaN(c))throw new Error(`Invalid LngLat object: (${i}, ${c})`);if(this.lng=+i,this.lat=+c,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new ta(me(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(i){const c=Math.PI/180,f=this.lat*c,g=i.lat*c,b=Math.sin(f)*Math.sin(g)+Math.cos(f)*Math.cos(g)*Math.cos((i.lng-this.lng)*c);return Bp*Math.acos(Math.min(b,1))}static convert(i){if(i instanceof ta)return i;if(Array.isArray(i)&&(i.length===2||i.length===3))return new ta(Number(i[0]),Number(i[1]));if(!Array.isArray(i)&&typeof i=="object"&&i!==null)return new ta(Number("lng"in i?i.lng:i.lon),Number(i.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const ny=2*Math.PI*Bp;function iy(s){return ny*Math.cos(s*Math.PI/180)}function oy(s){return(180+s)/360}function sy(s){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s*Math.PI/360)))/360}function ay(s,i){return s/iy(i)}function Fp(s){return 360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90}class Mf{constructor(i,c,f=0){this.x=+i,this.y=+c,this.z=+f}static fromLngLat(i,c=0){const f=ta.convert(i);return new Mf(oy(f.lng),sy(f.lat),ay(c,f.lat))}toLngLat(){return new ta(360*this.x-180,Fp(this.y))}toAltitude(){return this.z*iy(Fp(this.y))}meterInMercatorCoordinateUnits(){return 1/ny*(i=Fp(this.y),1/Math.cos(i*Math.PI/180));var i}}function ly(s,i,c){var f=2*Math.PI*6378137/256/Math.pow(2,c);return[s*f-2*Math.PI*6378137/2,i*f-2*Math.PI*6378137/2]}class Op{constructor(i,c,f){if(i<0||i>25||f<0||f>=Math.pow(2,i)||c<0||c>=Math.pow(2,i))throw new Error(`x=${c}, y=${f}, z=${i} outside of bounds. 0<=x<${Math.pow(2,i)}, 0<=y<${Math.pow(2,i)} 0<=z<=25 `);this.z=i,this.x=c,this.y=f,this.key=zu(0,i,i,c,f)}equals(i){return this.z===i.z&&this.x===i.x&&this.y===i.y}url(i,c,f){const g=(w=this.y,T=this.z,I=ly(256*(b=this.x),256*(w=Math.pow(2,T)-w-1),T),L=ly(256*(b+1),256*(w+1),T),I[0]+","+I[1]+","+L[0]+","+L[1]);var b,w,T,I,L;const F=function(j,H,J){let ee,ae="";for(let ge=j;ge>0;ge--)ee=1<1?"@2x":"").replace(/{quadkey}/g,F).replace(/{bbox-epsg-3857}/g,g)}isChildOf(i){const c=this.z-i.z;return c>0&&i.x===this.x>>c&&i.y===this.y>>c}getTilePoint(i){const c=Math.pow(2,this.z);return new k((i.x*c-this.x)*yn,(i.y*c-this.y)*yn)}toString(){return`${this.z}/${this.x}/${this.y}`}}class cy{constructor(i,c){this.wrap=i,this.canonical=c,this.key=zu(i,c.z,c.z,c.x,c.y)}}class lo{constructor(i,c,f,g,b){if(i= z; overscaledZ = ${i}; z = ${f}`);this.overscaledZ=i,this.wrap=c,this.canonical=new Op(f,+g,+b),this.key=zu(c,i,f,g,b)}clone(){return new lo(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(i){return this.overscaledZ===i.overscaledZ&&this.wrap===i.wrap&&this.canonical.equals(i.canonical)}scaledTo(i){if(i>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${i}; overscaledZ = ${this.overscaledZ}`);const c=this.canonical.z-i;return i>this.canonical.z?new lo(i,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new lo(i,this.wrap,i,this.canonical.x>>c,this.canonical.y>>c)}calculateScaledKey(i,c){if(i>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${i}; overscaledZ = ${this.overscaledZ}`);const f=this.canonical.z-i;return i>this.canonical.z?zu(this.wrap*+c,i,this.canonical.z,this.canonical.x,this.canonical.y):zu(this.wrap*+c,i,i,this.canonical.x>>f,this.canonical.y>>f)}isChildOf(i){if(i.wrap!==this.wrap)return!1;const c=this.canonical.z-i.canonical.z;return i.overscaledZ===0||i.overscaledZ>c&&i.canonical.y===this.canonical.y>>c}children(i){if(this.overscaledZ>=i)return[new lo(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const c=this.canonical.z+1,f=2*this.canonical.x,g=2*this.canonical.y;return[new lo(c,this.wrap,c,f,g),new lo(c,this.wrap,c,f+1,g),new lo(c,this.wrap,c,f,g+1),new lo(c,this.wrap,c,f+1,g+1)]}isLessThan(i){return this.wrapi.wrap)&&(this.overscaledZi.overscaledZ)&&(this.canonical.xi.canonical.x)&&this.canonical.ythis.max&&(this.max=j),j=this.dim+1||c<-1||c>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(c+1)*this.stride+(i+1)}unpack(i,c,f){return i*this.redFactor+c*this.greenFactor+f*this.blueFactor-this.baseShift}getPixels(){return new ao({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(i,c,f){if(this.dim!==i.dim)throw new Error("dem dimension mismatch");let g=c*this.dim,b=c*this.dim+this.dim,w=f*this.dim,T=f*this.dim+this.dim;switch(c){case-1:g=b-1;break;case 1:b=g+1}switch(f){case-1:w=T-1;break;case 1:T=w+1}const I=-c*this.dim,L=-f*this.dim;for(let F=w;F=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${i} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[i]}}class fy{constructor(i,c,f,g,b){this.type="Feature",this._vectorTileFeature=i,i._z=c,i._x=f,i._y=g,this.properties=i.properties,this.id=b}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(i){this._geometry=i}toJSON(){const i={geometry:this.geometry};for(const c in this)c!=="_geometry"&&c!=="_vectorTileFeature"&&(i[c]=this[c]);return i}}class dy{constructor(i,c){this.tileID=i,this.x=i.canonical.x,this.y=i.canonical.y,this.z=i.canonical.z,this.grid=new Fa(yn,16,0),this.grid3D=new Fa(yn,16,0),this.featureIndexArray=new V,this.promoteId=c}insert(i,c,f,g,b,w){const T=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(f,g,b);const I=w?this.grid3D:this.grid;for(let L=0;L=0&&j[3]>=0&&I.insert(T,j[0],j[1],j[2],j[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ys.VectorTile(new Ep(this.rawTileData)).layers,this.sourceLayerCoder=new hy(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(i,c,f,g){this.loadVTLayers();const b=i.params||{},w=yn/i.tileSize/i.scale,T=Ml(b.filter),I=i.queryGeometry,L=i.queryPadding*w,F=my(I),j=this.grid.query(F.minX-L,F.minY-L,F.maxX+L,F.maxY+L),H=my(i.cameraQueryGeometry),J=this.grid3D.query(H.minX-L,H.minY-L,H.maxX+L,H.maxY+L,(ge,xe,Re,ke)=>function(Ae,Je,Qe,kt,zt){for(const bt of Ae)if(Je<=bt.x&&Qe<=bt.y&&kt>=bt.x&&zt>=bt.y)return!0;const St=[new k(Je,Qe),new k(Je,zt),new k(kt,zt),new k(kt,Qe)];if(Ae.length>2){for(const bt of St)if(Hl(Ae,bt))return!0}for(let bt=0;bt(ke||(ke=ws(Ae)),Je.queryIntersectsFeature(I,Ae,Qe,ke,this.z,i.transform,w,i.pixelPosMatrix)))}return ee}loadMatchingFeature(i,c,f,g,b,w,T,I,L,F,j){const H=this.bucketLayerIDs[c];if(w&&!function(ge,xe){for(let Re=0;Re=0)return!0;return!1}(w,H))return;const J=this.sourceLayerCoder.decode(f),ee=this.vtLayers[J].feature(g);if(b.needGeometry){const ge=xs(ee,!0);if(!b.filter(new Qr(this.tileID.overscaledZ),ge,this.tileID.canonical))return}else if(!b.filter(new Qr(this.tileID.overscaledZ),ee))return;const ae=this.getId(ee,J);for(let ge=0;ge{const T=i instanceof Na?i.get(w):null;return T&&T.evaluate?T.evaluate(c,f,g):T})}function my(s){let i=1/0,c=1/0,f=-1/0,g=-1/0;for(const b of s)i=Math.min(i,b.x),c=Math.min(c,b.y),f=Math.max(f,b.x),g=Math.max(g,b.y);return{minX:i,minY:c,maxX:f,maxY:g}}function fS(s,i){return i-s}function gy(s,i,c,f,g){const b=[];for(let w=0;w=f&&j.x>=f||(F.x>=f?F=new k(f,F.y+(f-F.x)/(j.x-F.x)*(j.y-F.y))._round():j.x>=f&&(j=new k(f,F.y+(f-F.x)/(j.x-F.x)*(j.y-F.y))._round()),F.y>=g&&j.y>=g||(F.y>=g?F=new k(F.x+(g-F.y)/(j.y-F.y)*(j.x-F.x),g)._round():j.y>=g&&(j=new k(F.x+(g-F.y)/(j.y-F.y)*(j.x-F.x),g)._round()),I&&F.equals(I[I.length-1])||(I=[F],b.push(I)),I.push(j)))))}}return b}Et("FeatureIndex",dy,{omit:["rawTileData","sourceLayerCoder"]});class ra extends k{constructor(i,c,f,g){super(i,c),this.angle=f,g!==void 0&&(this.segment=g)}clone(){return new ra(this.x,this.y,this.angle,this.segment)}}function _y(s,i,c,f,g){if(i.segment===void 0||c===0)return!0;let b=i,w=i.segment+1,T=0;for(;T>-c/2;){if(w--,w<0)return!1;T-=s[w].dist(b),b=s[w]}T+=s[w].dist(s[w+1]),w++;const I=[];let L=0;for(;Tf;)L-=I.shift().angleDelta;if(L>g)return!1;w++,T+=F.dist(j)}return!0}function yy(s){let i=0;for(let c=0;cL){const ee=(L-I)/J,ae=di.number(j.x,H.x,ee),ge=di.number(j.y,H.y,ee),xe=new ra(ae,ge,H.angleTo(j),F);return xe._round(),!w||_y(s,xe,T,w,i)?xe:void 0}I+=J}}function pS(s,i,c,f,g,b,w,T,I){const L=vy(f,b,w),F=by(f,g),j=F*w,H=s[0].x===0||s[0].x===I||s[0].y===0||s[0].y===I;return i-j=0&&Ae=0&&Je=0&&H+L<=F){const Qe=new ra(Ae,Je,Re,ee);Qe._round(),f&&!_y(s,Qe,b,f,g)||J.push(Qe)}}j+=xe}return T||J.length||w||(J=wy(s,j/2,c,f,g,b,w,!0,I)),J}Et("Anchor",ra);const tc=ji;function xy(s,i,c,f){const g=[],b=s.image,w=b.pixelRatio,T=b.paddedRect.w-2*tc,I=b.paddedRect.h-2*tc,L=s.right-s.left,F=s.bottom-s.top,j=b.stretchX||[[0,T]],H=b.stretchY||[[0,I]],J=(pt,It)=>pt+It[1]-It[0],ee=j.reduce(J,0),ae=H.reduce(J,0),ge=T-ee,xe=I-ae;let Re=0,ke=ee,Ae=0,Je=ae,Qe=0,kt=ge,zt=0,St=xe;if(b.content&&f){const pt=b.content;Re=Cf(j,0,pt[0]),Ae=Cf(H,0,pt[1]),ke=Cf(j,pt[0],pt[2]),Je=Cf(H,pt[1],pt[3]),Qe=pt[0]-Re,zt=pt[1]-Ae,kt=pt[2]-pt[0]-ke,St=pt[3]-pt[1]-Je}const bt=(pt,It,yt,lt)=>{const qt=If(pt.stretch-Re,ke,L,s.left),Dt=Af(pt.fixed-Qe,kt,pt.stretch,ee),mr=If(It.stretch-Ae,Je,F,s.top),Xr=Af(It.fixed-zt,St,It.stretch,ae),tn=If(yt.stretch-Re,ke,L,s.left),jn=Af(yt.fixed-Qe,kt,yt.stretch,ee),Yi=If(lt.stretch-Ae,Je,F,s.top),Ti=Af(lt.fixed-zt,St,lt.stretch,ae),zn=new k(qt,mr),Yn=new k(tn,mr),ai=new k(tn,Yi),Ei=new k(qt,Yi),Mi=new k(Dt/w,Xr/w),Un=new k(jn/w,Ti/w),Vn=i*Math.PI/180;if(Vn){const gi=Math.sin(Vn),Ui=Math.cos(Vn),Vi=[Ui,-gi,gi,Ui];zn._matMult(Vi),Yn._matMult(Vi),Ei._matMult(Vi),ai._matMult(Vi)}const mi=pt.stretch+pt.fixed,Ci=It.stretch+It.fixed;return{tl:zn,tr:Yn,bl:Ei,br:ai,tex:{x:b.paddedRect.x+tc+mi,y:b.paddedRect.y+tc+Ci,w:yt.stretch+yt.fixed-mi,h:lt.stretch+lt.fixed-Ci},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Mi,pixelOffsetBR:Un,minFontScaleX:kt/w/L,minFontScaleY:St/w/F,isSDF:c}};if(f&&(b.stretchX||b.stretchY)){const pt=Sy(j,ge,ee),It=Sy(H,xe,ae);for(let yt=0;yt0&&(ee=Math.max(10,ee),this.circleDiameter=ee)}else{let j=w.top*T-I[0],H=w.bottom*T+I[2],J=w.left*T-I[3],ee=w.right*T+I[1];const ae=w.collisionPadding;if(ae&&(J-=ae[0]*T,j-=ae[1]*T,ee+=ae[2]*T,H+=ae[3]*T),F){const ge=new k(J,j),xe=new k(ee,j),Re=new k(J,H),ke=new k(ee,H),Ae=F*Math.PI/180;ge._rotate(Ae),xe._rotate(Ae),Re._rotate(Ae),ke._rotate(Ae),J=Math.min(ge.x,xe.x,Re.x,ke.x),ee=Math.max(ge.x,xe.x,Re.x,ke.x),j=Math.min(ge.y,xe.y,Re.y,ke.y),H=Math.max(ge.y,xe.y,Re.y,ke.y)}i.emplaceBack(c.x,c.y,J,j,ee,H,f,g,b)}this.boxEndIndex=i.length}}class mS{constructor(i=[],c=gS){if(this.data=i,this.length=this.data.length,this.compare=c,this.length>0)for(let f=(this.length>>1)-1;f>=0;f--)this._down(f)}push(i){this.data.push(i),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const i=this.data[0],c=this.data.pop();return this.length--,this.length>0&&(this.data[0]=c,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:c,compare:f}=this,g=c[i];for(;i>0;){const b=i-1>>1,w=c[b];if(f(g,w)>=0)break;c[i]=w,i=b}c[i]=g}_down(i){const{data:c,compare:f}=this,g=this.length>>1,b=c[i];for(;i=0)break;c[i]=T,i=w}c[i]=b}}function gS(s,i){return si?1:0}function _S(s,i=1,c=!1){let f=1/0,g=1/0,b=-1/0,w=-1/0;const T=s[0];for(let J=0;Jb)&&(b=ee.x),(!J||ee.y>w)&&(w=ee.y)}const I=Math.min(b-f,w-g);let L=I/2;const F=new mS([],yS);if(I===0)return new k(f,g);for(let J=f;Jj.d||!j.d)&&(j=J,c&&console.log("found best %d after %d probes",Math.round(1e4*J.d)/1e4,H)),J.max-j.d<=i||(L=J.h/2,F.push(new rc(J.p.x-L,J.p.y-L,L,s)),F.push(new rc(J.p.x+L,J.p.y-L,L,s)),F.push(new rc(J.p.x-L,J.p.y+L,L,s)),F.push(new rc(J.p.x+L,J.p.y+L,L,s)),H+=4)}return c&&(console.log(`num probes: ${H}`),console.log(`best distance: ${j.d}`)),j.p}function yS(s,i){return i.max-s.max}function rc(s,i,c,f){this.p=new k(s,i),this.h=c,this.d=function(g,b){let w=!1,T=1/0;for(let I=0;Ig.y!=ee.y>g.y&&g.x<(ee.x-J.x)*(g.y-J.y)/(ee.y-J.y)+J.x&&(w=!w),T=Math.min(T,s_(g,J,ee))}}return(w?1:-1)*Math.sqrt(T)}(this.p,f),this.max=this.d+this.h*Math.SQRT2}var si;d.ap=void 0,(si=d.ap||(d.ap={}))[si.center=1]="center",si[si.left=2]="left",si[si.right=3]="right",si[si.top=4]="top",si[si.bottom=5]="bottom",si[si["top-left"]=6]="top-left",si[si["top-right"]=7]="top-right",si[si["bottom-left"]=8]="bottom-left",si[si["bottom-right"]=9]="bottom-right";const na=7,Np=Number.POSITIVE_INFINITY;function ky(s,i){return i[1]!==Np?function(c,f,g){let b=0,w=0;switch(f=Math.abs(f),g=Math.abs(g),c){case"top-right":case"top-left":case"top":w=g-na;break;case"bottom-right":case"bottom-left":case"bottom":w=-g+na}switch(c){case"top-right":case"bottom-right":case"right":b=-f;break;case"top-left":case"bottom-left":case"left":b=f}return[b,w]}(s,i[0],i[1]):function(c,f){let g=0,b=0;f<0&&(f=0);const w=f/Math.SQRT2;switch(c){case"top-right":case"top-left":b=w-na;break;case"bottom-right":case"bottom-left":b=-w+na;break;case"bottom":b=-f+na;break;case"top":b=f-na}switch(c){case"top-right":case"bottom-right":g=-w;break;case"top-left":case"bottom-left":g=w;break;case"left":g=f;break;case"right":g=-f}return[g,b]}(s,i[0])}function Ty(s,i,c){var f;const g=s.layout,b=(f=g.get("text-variable-anchor-offset"))===null||f===void 0?void 0:f.evaluate(i,{},c);if(b){const T=b.values,I=[];for(let L=0;LH*Nn);F.startsWith("top")?j[1]-=na:F.startsWith("bottom")&&(j[1]+=na),I[L+1]=j}return new $i(I)}const w=g.get("text-variable-anchor");if(w){let T;T=s._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[g.get("text-radial-offset").evaluate(i,{},c)*Nn,Np]:g.get("text-offset").evaluate(i,{},c).map(L=>L*Nn);const I=[];for(const L of w)I.push(L,ky(L,T));return new $i(I)}return null}function jp(s){switch(s){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function vS(s,i,c,f,g,b,w,T,I,L,F){let j=b.textMaxSize.evaluate(i,{});j===void 0&&(j=w);const H=s.layers[0].layout,J=H.get("icon-offset").evaluate(i,{},F),ee=My(c.horizontal),ae=w/24,ge=s.tilePixelRatio*ae,xe=s.tilePixelRatio*j/24,Re=s.tilePixelRatio*T,ke=s.tilePixelRatio*H.get("symbol-spacing"),Ae=H.get("text-padding")*s.tilePixelRatio,Je=function(lt,qt,Dt,mr=1){const Xr=lt.get("icon-padding").evaluate(qt,{},Dt),tn=Xr&&Xr.values;return[tn[0]*mr,tn[1]*mr,tn[2]*mr,tn[3]*mr]}(H,i,F,s.tilePixelRatio),Qe=H.get("text-max-angle")/180*Math.PI,kt=H.get("text-rotation-alignment")!=="viewport"&&H.get("symbol-placement")!=="point",zt=H.get("icon-rotation-alignment")==="map"&&H.get("symbol-placement")!=="point",St=H.get("symbol-placement"),bt=ke/2,pt=H.get("icon-text-fit");let It;f&&pt!=="none"&&(s.allowVerticalPlacement&&c.vertical&&(It=K_(f,c.vertical,pt,H.get("icon-text-fit-padding"),J,ae)),ee&&(f=K_(f,ee,pt,H.get("icon-text-fit-padding"),J,ae)));const yt=(lt,qt)=>{qt.x<0||qt.x>=yn||qt.y<0||qt.y>=yn||function(Dt,mr,Xr,tn,jn,Yi,Ti,zn,Yn,ai,Ei,Mi,Un,Vn,mi,Ci,gi,Ui,Vi,qn,_r,_i,li,Gn,xo){const No=Dt.addToLineVertexArray(mr,Xr);let jo,ks,So,co,qi=0,Ts=0,Bu=0,Ly=0,$p=-1,Xp=-1;const Es={};let Py=hn("");if(Dt.allowVerticalPlacement&&tn.vertical){const yi=zn.layout.get("text-rotate").evaluate(_r,{},Gn)+90;So=new Lf(Yn,mr,ai,Ei,Mi,tn.vertical,Un,Vn,mi,yi),Ti&&(co=new Lf(Yn,mr,ai,Ei,Mi,Ti,gi,Ui,mi,yi))}if(jn){const yi=zn.layout.get("icon-rotate").evaluate(_r,{}),uo=zn.layout.get("icon-text-fit")!=="none",$a=xy(jn,yi,li,uo),Vo=Ti?xy(Ti,yi,li,uo):void 0;ks=new Lf(Yn,mr,ai,Ei,Mi,jn,gi,Ui,!1,yi),qi=4*$a.length;const Xa=Dt.iconSizeData;let os=null;Xa.kind==="source"?(os=[is*zn.layout.get("icon-size").evaluate(_r,{})],os[0]>ea&&Ze(`${Dt.layerIds[0]}: Value for "icon-size" is >= ${Pu}. Reduce your "icon-size".`)):Xa.kind==="composite"&&(os=[is*_i.compositeIconSizes[0].evaluate(_r,{},Gn),is*_i.compositeIconSizes[1].evaluate(_r,{},Gn)],(os[0]>ea||os[1]>ea)&&Ze(`${Dt.layerIds[0]}: Value for "icon-size" is >= ${Pu}. Reduce your "icon-size".`)),Dt.addSymbols(Dt.icon,$a,os,qn,Vi,_r,d.ah.none,mr,No.lineStartIndex,No.lineLength,-1,Gn),$p=Dt.icon.placedSymbolArray.length-1,Vo&&(Ts=4*Vo.length,Dt.addSymbols(Dt.icon,Vo,os,qn,Vi,_r,d.ah.vertical,mr,No.lineStartIndex,No.lineLength,-1,Gn),Xp=Dt.icon.placedSymbolArray.length-1)}const zy=Object.keys(tn.horizontal);for(const yi of zy){const uo=tn.horizontal[yi];if(!jo){Py=hn(uo.text);const Vo=zn.layout.get("text-rotate").evaluate(_r,{},Gn);jo=new Lf(Yn,mr,ai,Ei,Mi,uo,Un,Vn,mi,Vo)}const $a=uo.positionedLines.length===1;if(Bu+=Ey(Dt,mr,uo,Yi,zn,mi,_r,Ci,No,tn.vertical?d.ah.horizontal:d.ah.horizontalOnly,$a?zy:[yi],Es,$p,_i,Gn),$a)break}tn.vertical&&(Ly+=Ey(Dt,mr,tn.vertical,Yi,zn,mi,_r,Ci,No,d.ah.vertical,["vertical"],Es,Xp,_i,Gn));const xS=jo?jo.boxStartIndex:Dt.collisionBoxArray.length,SS=jo?jo.boxEndIndex:Dt.collisionBoxArray.length,kS=So?So.boxStartIndex:Dt.collisionBoxArray.length,TS=So?So.boxEndIndex:Dt.collisionBoxArray.length,ES=ks?ks.boxStartIndex:Dt.collisionBoxArray.length,MS=ks?ks.boxEndIndex:Dt.collisionBoxArray.length,CS=co?co.boxStartIndex:Dt.collisionBoxArray.length,IS=co?co.boxEndIndex:Dt.collisionBoxArray.length;let Uo=-1;const zf=(yi,uo)=>yi&&yi.circleDiameter?Math.max(yi.circleDiameter,uo):uo;Uo=zf(jo,Uo),Uo=zf(So,Uo),Uo=zf(ks,Uo),Uo=zf(co,Uo);const Dy=Uo>-1?1:0;Dy&&(Uo*=xo/Nn),Dt.glyphOffsetArray.length>=ec.MAX_GLYPHS&&Ze("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),_r.sortKey!==void 0&&Dt.addToSortKeyRanges(Dt.symbolInstances.length,_r.sortKey);const AS=Ty(zn,_r,Gn),[LS,PS]=function(yi,uo){const $a=yi.length,Vo=uo==null?void 0:uo.values;if((Vo==null?void 0:Vo.length)>0)for(let Xa=0;Xa=0?Es.right:-1,Es.center>=0?Es.center:-1,Es.left>=0?Es.left:-1,Es.vertical||-1,$p,Xp,Py,xS,SS,kS,TS,ES,MS,CS,IS,ai,Bu,Ly,qi,Ts,Dy,0,Un,Uo,LS,PS)}(s,qt,lt,c,f,g,It,s.layers[0],s.collisionBoxArray,i.index,i.sourceLayerIndex,s.index,ge,[Ae,Ae,Ae,Ae],kt,I,Re,Je,zt,J,i,b,L,F,w)};if(St==="line")for(const lt of gy(i.geometry,0,0,yn,yn)){const qt=pS(lt,ke,Qe,c.vertical||ee,f,24,xe,s.overscaling,yn);for(const Dt of qt)ee&&bS(s,ee.text,bt,Dt)||yt(lt,Dt)}else if(St==="line-center"){for(const lt of i.geometry)if(lt.length>1){const qt=dS(lt,Qe,c.vertical||ee,f,24,xe);qt&&yt(lt,qt)}}else if(i.type==="Polygon")for(const lt of yp(i.geometry,0)){const qt=_S(lt,16);yt(lt[0],new ra(qt.x,qt.y,0))}else if(i.type==="LineString")for(const lt of i.geometry)yt(lt,new ra(lt[0].x,lt[0].y,0));else if(i.type==="Point")for(const lt of i.geometry)for(const qt of lt)yt([qt],new ra(qt.x,qt.y,0))}function Ey(s,i,c,f,g,b,w,T,I,L,F,j,H,J,ee){const ae=function(Re,ke,Ae,Je,Qe,kt,zt,St){const bt=Je.layout.get("text-rotate").evaluate(kt,{})*Math.PI/180,pt=[];for(const It of ke.positionedLines)for(const yt of It.positionedGlyphs){if(!yt.rect)continue;const lt=yt.rect||{};let qt=q_+1,Dt=!0,mr=1,Xr=0;const tn=(Qe||St)&&yt.vertical,jn=yt.metrics.advance*yt.scale/2;if(St&&ke.verticalizable&&(Xr=It.lineOffset/2-(yt.imageName?-(Nn-yt.metrics.width*yt.scale)/2:(yt.scale-1)*Nn)),yt.imageName){const qn=zt[yt.imageName];Dt=qn.sdf,mr=qn.pixelRatio,qt=ji/mr}const Yi=Qe?[yt.x+jn,yt.y]:[0,0];let Ti=Qe?[0,0]:[yt.x+jn+Ae[0],yt.y+Ae[1]-Xr],zn=[0,0];tn&&(zn=Ti,Ti=[0,0]);const Yn=yt.metrics.isDoubleResolution?2:1,ai=(yt.metrics.left-qt)*yt.scale-jn+Ti[0],Ei=(-yt.metrics.top-qt)*yt.scale+Ti[1],Mi=ai+lt.w/Yn*yt.scale/mr,Un=Ei+lt.h/Yn*yt.scale/mr,Vn=new k(ai,Ei),mi=new k(Mi,Ei),Ci=new k(ai,Un),gi=new k(Mi,Un);if(tn){const qn=new k(-jn,jn-Au),_r=-Math.PI/2,_i=Nn/2-jn,li=new k(5-Au-_i,-(yt.imageName?_i:0)),Gn=new k(...zn);Vn._rotateAround(_r,qn)._add(li)._add(Gn),mi._rotateAround(_r,qn)._add(li)._add(Gn),Ci._rotateAround(_r,qn)._add(li)._add(Gn),gi._rotateAround(_r,qn)._add(li)._add(Gn)}if(bt){const qn=Math.sin(bt),_r=Math.cos(bt),_i=[_r,-qn,qn,_r];Vn._matMult(_i),mi._matMult(_i),Ci._matMult(_i),gi._matMult(_i)}const Ui=new k(0,0),Vi=new k(0,0);pt.push({tl:Vn,tr:mi,bl:Ci,br:gi,tex:lt,writingMode:ke.writingMode,glyphOffset:Yi,sectionIndex:yt.sectionIndex,isSDF:Dt,pixelOffsetTL:Ui,pixelOffsetBR:Vi,minFontScaleX:0,minFontScaleY:0})}return pt}(0,c,T,g,b,w,f,s.allowVerticalPlacement),ge=s.textSizeData;let xe=null;ge.kind==="source"?(xe=[is*g.layout.get("text-size").evaluate(w,{})],xe[0]>ea&&Ze(`${s.layerIds[0]}: Value for "text-size" is >= ${Pu}. Reduce your "text-size".`)):ge.kind==="composite"&&(xe=[is*J.compositeTextSizes[0].evaluate(w,{},ee),is*J.compositeTextSizes[1].evaluate(w,{},ee)],(xe[0]>ea||xe[1]>ea)&&Ze(`${s.layerIds[0]}: Value for "text-size" is >= ${Pu}. Reduce your "text-size".`)),s.addSymbols(s.text,ae,xe,T,b,w,L,i,I.lineStartIndex,I.lineLength,H,ee);for(const Re of F)j[Re]=s.text.placedSymbolArray.length-1;return 4*ae.length}function My(s){for(const i in s)return s[i];return null}function bS(s,i,c,f){const g=s.compareText;if(i in g){const b=g[i];for(let w=b.length-1;w>=0;w--)if(f.dist(b[w])>4;if(g!==1)throw new Error(`Got v${g} data when expected v1.`);const b=Cy[15&f];if(!b)throw new Error("Unrecognized array type.");const[w]=new Uint16Array(i,2,1),[T]=new Uint32Array(i,4,1);return new Up(T,w,b,i)}constructor(i,c=64,f=Float64Array,g){if(isNaN(i)||i<0)throw new Error(`Unpexpected numItems value: ${i}.`);this.numItems=+i,this.nodeSize=Math.min(Math.max(+c,2),65535),this.ArrayType=f,this.IndexArrayType=i<65536?Uint16Array:Uint32Array;const b=Cy.indexOf(this.ArrayType),w=2*i*this.ArrayType.BYTES_PER_ELEMENT,T=i*this.IndexArrayType.BYTES_PER_ELEMENT,I=(8-T%8)%8;if(b<0)throw new Error(`Unexpected typed array class: ${f}.`);g&&g instanceof ArrayBuffer?(this.data=g,this.ids=new this.IndexArrayType(this.data,8,i),this.coords=new this.ArrayType(this.data,8+T+I,2*i),this._pos=2*i,this._finished=!0):(this.data=new ArrayBuffer(8+w+T+I),this.ids=new this.IndexArrayType(this.data,8,i),this.coords=new this.ArrayType(this.data,8+T+I,2*i),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+b]),new Uint16Array(this.data,2,1)[0]=c,new Uint32Array(this.data,4,1)[0]=i)}add(i,c){const f=this._pos>>1;return this.ids[f]=f,this.coords[this._pos++]=i,this.coords[this._pos++]=c,f}finish(){const i=this._pos>>1;if(i!==this.numItems)throw new Error(`Added ${i} items when expected ${this.numItems}.`);return Vp(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(i,c,f,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:b,coords:w,nodeSize:T}=this,I=[0,b.length-1,0],L=[];for(;I.length;){const F=I.pop()||0,j=I.pop()||0,H=I.pop()||0;if(j-H<=T){for(let ge=H;ge<=j;ge++){const xe=w[2*ge],Re=w[2*ge+1];xe>=i&&xe<=f&&Re>=c&&Re<=g&&L.push(b[ge])}continue}const J=H+j>>1,ee=w[2*J],ae=w[2*J+1];ee>=i&&ee<=f&&ae>=c&&ae<=g&&L.push(b[J]),(F===0?i<=ee:c<=ae)&&(I.push(H),I.push(J-1),I.push(1-F)),(F===0?f>=ee:g>=ae)&&(I.push(J+1),I.push(j),I.push(1-F))}return L}within(i,c,f){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:g,coords:b,nodeSize:w}=this,T=[0,g.length-1,0],I=[],L=f*f;for(;T.length;){const F=T.pop()||0,j=T.pop()||0,H=T.pop()||0;if(j-H<=w){for(let ge=H;ge<=j;ge++)Ay(b[2*ge],b[2*ge+1],i,c)<=L&&I.push(g[ge]);continue}const J=H+j>>1,ee=b[2*J],ae=b[2*J+1];Ay(ee,ae,i,c)<=L&&I.push(g[J]),(F===0?i-f<=ee:c-f<=ae)&&(T.push(H),T.push(J-1),T.push(1-F)),(F===0?i+f>=ee:c+f>=ae)&&(T.push(J+1),T.push(j),T.push(1-F))}return I}}function Vp(s,i,c,f,g,b){if(g-f<=c)return;const w=f+g>>1;Iy(s,i,w,f,g,b),Vp(s,i,c,f,w-1,1-b),Vp(s,i,c,w+1,g,1-b)}function Iy(s,i,c,f,g,b){for(;g>f;){if(g-f>600){const L=g-f+1,F=c-f+1,j=Math.log(L),H=.5*Math.exp(2*j/3),J=.5*Math.sqrt(j*H*(L-H)/L)*(F-L/2<0?-1:1);Iy(s,i,c,Math.max(f,Math.floor(c-F*H/L+J)),Math.min(g,Math.floor(c+(L-F)*H/L+J)),b)}const w=i[2*c+b];let T=f,I=g;for(Du(s,i,f,c),i[2*g+b]>w&&Du(s,i,f,g);Tw;)I--}i[2*f+b]===w?Du(s,i,f,I):(I++,Du(s,i,I,g)),I<=c&&(f=I+1),c<=I&&(g=I-1)}}function Du(s,i,c,f){qp(s,c,f),qp(i,2*c,2*f),qp(i,2*c+1,2*f+1)}function qp(s,i,c){const f=s[i];s[i]=s[c],s[c]=f}function Ay(s,i,c,f){const g=s-c,b=i-f;return g*g+b*b}var Gp;d.bd=void 0,(Gp=d.bd||(d.bd={})).create="create",Gp.load="load",Gp.fullLoad="fullLoad";let Pf=null,Ru=[];const Wp=1e3/60,Zp="loadTime",Hp="fullLoadTime",wS={mark(s){performance.mark(s)},frame(s){const i=s;Pf!=null&&Ru.push(i-Pf),Pf=i},clearMetrics(){Pf=null,Ru=[],performance.clearMeasures(Zp),performance.clearMeasures(Hp);for(const s in d.bd)performance.clearMarks(d.bd[s])},getPerformanceMetrics(){performance.measure(Zp,d.bd.create,d.bd.load),performance.measure(Hp,d.bd.create,d.bd.fullLoad);const s=performance.getEntriesByName(Zp)[0].duration,i=performance.getEntriesByName(Hp)[0].duration,c=Ru.length,f=1/(Ru.reduce((b,w)=>b+w,0)/c/1e3),g=Ru.filter(b=>b>Wp).reduce((b,w)=>b+(w-Wp)/Wp,0);return{loadTime:s,fullLoadTime:i,fps:f,percentDroppedFrames:g/(c+g)*100,totalFrames:c}}};d.$=gt,d.A=$l,d.B=function(s){if(Ot==null){const i=s.navigator?s.navigator.userAgent:null;Ot=!!s.safari||!(!i||!(/\b(iPad|iPhone|iPod)\b/.test(i)||i.match("Safari")&&!i.match("Chrome")))}return Ot},d.C=class{constructor(s,i){this.target=s,this.mapId=i,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new hS(()=>this.process()),this.subscription=function(c,f,g,b){return c.addEventListener(f,g,!1),{unsubscribe:()=>{c.removeEventListener(f,g,!1)}}}(this.target,"message",c=>this.receive(c)),this.globalScope=Ct(self)?s:window}registerMessageHandler(s,i){this.messageHandlers[s]=i}sendAsync(s,i){return new Promise((c,f)=>{const g=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[g]={resolve:c,reject:f},i&&i.signal.addEventListener("abort",()=>{delete this.resolveRejects[g];const T={id:g,type:"",origin:location.origin,targetMapId:s.targetMapId,sourceMapId:this.mapId};this.target.postMessage(T)},{once:!0});const b=[],w=Object.assign(Object.assign({},s),{id:g,sourceMapId:this.mapId,origin:location.origin,data:$s(s.data,b)});this.target.postMessage(w,{transfer:b})})}receive(s){const i=s.data,c=i.id;if(!(i.origin!=="file://"&&location.origin!=="file://"&&i.origin!==location.origin||i.targetMapId&&this.mapId!==i.targetMapId)){if(i.type===""){delete this.tasks[c];const f=this.abortControllers[c];return delete this.abortControllers[c],void(f&&f.abort())}if(Ct(self)||i.mustQueue)return this.tasks[c]=i,this.taskQueue.push(c),void this.invoker.trigger();this.processTask(c,i)}}process(){if(this.taskQueue.length===0)return;const s=this.taskQueue.shift(),i=this.tasks[s];delete this.tasks[s],this.taskQueue.length>0&&this.invoker.trigger(),i&&this.processTask(s,i)}processTask(s,i){return a(this,void 0,void 0,function*(){if(i.type===""){const g=this.resolveRejects[s];return delete this.resolveRejects[s],g?void(i.error?g.reject(Xs(i.error)):g.resolve(Xs(i.data))):void 0}if(!this.messageHandlers[i.type])return void this.completeTask(s,new Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const c=Xs(i.data),f=new AbortController;this.abortControllers[s]=f;try{const g=yield this.messageHandlers[i.type](i.sourceMapId,c,f);this.completeTask(s,null,g)}catch(g){this.completeTask(s,g)}})}completeTask(s,i,c){const f=[];delete this.abortControllers[s];const g={id:s,type:"",sourceMapId:this.mapId,origin:location.origin,error:i?$s(i):null,data:$s(c,f)};this.target.postMessage(g,{transfer:f})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},d.D=Bt,d.E=it,d.F=function(){var s=new $l(16);return $l!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s},d.G=nr,d.H=function(s,i,c){var f,g,b,w,T,I,L,F,j,H,J,ee,ae=c[0],ge=c[1],xe=c[2];return i===s?(s[12]=i[0]*ae+i[4]*ge+i[8]*xe+i[12],s[13]=i[1]*ae+i[5]*ge+i[9]*xe+i[13],s[14]=i[2]*ae+i[6]*ge+i[10]*xe+i[14],s[15]=i[3]*ae+i[7]*ge+i[11]*xe+i[15]):(g=i[1],b=i[2],w=i[3],T=i[4],I=i[5],L=i[6],F=i[7],j=i[8],H=i[9],J=i[10],ee=i[11],s[0]=f=i[0],s[1]=g,s[2]=b,s[3]=w,s[4]=T,s[5]=I,s[6]=L,s[7]=F,s[8]=j,s[9]=H,s[10]=J,s[11]=ee,s[12]=f*ae+T*ge+j*xe+i[12],s[13]=g*ae+I*ge+H*xe+i[13],s[14]=b*ae+L*ge+J*xe+i[14],s[15]=w*ae+F*ge+ee*xe+i[15]),s},d.I=Cp,d.J=function(s,i,c){var f=c[0],g=c[1],b=c[2];return s[0]=i[0]*f,s[1]=i[1]*f,s[2]=i[2]*f,s[3]=i[3]*f,s[4]=i[4]*g,s[5]=i[5]*g,s[6]=i[6]*g,s[7]=i[7]*g,s[8]=i[8]*b,s[9]=i[9]*b,s[10]=i[10]*b,s[11]=i[11]*b,s[12]=i[12],s[13]=i[13],s[14]=i[14],s[15]=i[15],s},d.K=u_,d.L=function(s,i){const c={};for(let f=0;f{const i=window.document.createElement("video");return i.muted=!0,new Promise(c=>{i.onloadstart=()=>{c(i)};for(const f of s){const g=window.document.createElement("source");st(f)||(i.crossOrigin="Anonymous"),g.src=f,i.appendChild(g)}})},d.a3=function(){return Y++},d.a4=y,d.a5=ec,d.a6=Ml,d.a7=xs,d.a8=Qr,d.a9=fy,d.aA=re,d.aB=function(s,i){if(!s)return[{command:"setStyle",args:[i]}];let c=[];try{if(!Ye(s.version,i.version))return[{command:"setStyle",args:[i]}];Ye(s.center,i.center)||c.push({command:"setCenter",args:[i.center]}),Ye(s.zoom,i.zoom)||c.push({command:"setZoom",args:[i.zoom]}),Ye(s.bearing,i.bearing)||c.push({command:"setBearing",args:[i.bearing]}),Ye(s.pitch,i.pitch)||c.push({command:"setPitch",args:[i.pitch]}),Ye(s.sprite,i.sprite)||c.push({command:"setSprite",args:[i.sprite]}),Ye(s.glyphs,i.glyphs)||c.push({command:"setGlyphs",args:[i.glyphs]}),Ye(s.transition,i.transition)||c.push({command:"setTransition",args:[i.transition]}),Ye(s.light,i.light)||c.push({command:"setLight",args:[i.light]}),Ye(s.terrain,i.terrain)||c.push({command:"setTerrain",args:[i.terrain]}),Ye(s.sky,i.sky)||c.push({command:"setSky",args:[i.sky]});const f={},g=[];(function(w,T,I,L){let F;for(F in T=T||{},w=w||{})Object.prototype.hasOwnProperty.call(w,F)&&(Object.prototype.hasOwnProperty.call(T,F)||wn(F,I,L));for(F in T)Object.prototype.hasOwnProperty.call(T,F)&&(Object.prototype.hasOwnProperty.call(w,F)?Ye(w[F],T[F])||(w[F].type==="geojson"&&T[F].type==="geojson"&&ni(w,T,F)?jt(I,{command:"setGeoJSONSourceData",args:[F,T[F].data]}):Mn(F,T,I,L)):bn(F,T,I))})(s.sources,i.sources,g,f);const b=[];s.layers&&s.layers.forEach(w=>{"source"in w&&f[w.source]?c.push({command:"removeLayer",args:[w.id]}):b.push(w)}),c=c.concat(g),function(w,T,I){T=T||[];const L=(w=w||[]).map($o),F=T.map($o),j=w.reduce(Jr,{}),H=T.reduce(Jr,{}),J=L.slice(),ee=Object.create(null);let ae,ge,xe,Re,ke;for(let Ae=0,Je=0;Ae@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(c,f,g,b)=>{const w=g||b;return i[f]=!w||w.toLowerCase(),""}),i["max-age"]){const c=parseInt(i["max-age"],10);isNaN(c)?delete i["max-age"]:i["max-age"]=c}return i},d.ab=function(s,i){const c=[];for(const f in s)f in i||c.push(f);return c},d.ac=K,d.ad=function(s,i,c){var f=Math.sin(c),g=Math.cos(c),b=i[0],w=i[1],T=i[2],I=i[3],L=i[4],F=i[5],j=i[6],H=i[7];return i!==s&&(s[8]=i[8],s[9]=i[9],s[10]=i[10],s[11]=i[11],s[12]=i[12],s[13]=i[13],s[14]=i[14],s[15]=i[15]),s[0]=b*g+L*f,s[1]=w*g+F*f,s[2]=T*g+j*f,s[3]=I*g+H*f,s[4]=L*g-b*f,s[5]=F*g-w*f,s[6]=j*g-T*f,s[7]=H*g-I*f,s},d.ae=function(s){var i=new $l(16);return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i[4]=s[4],i[5]=s[5],i[6]=s[6],i[7]=s[7],i[8]=s[8],i[9]=s[9],i[10]=s[10],i[11]=s[11],i[12]=s[12],i[13]=s[13],i[14]=s[14],i[15]=s[15],i},d.af=gf,d.ag=function(s,i){let c=0,f=0;if(s.kind==="constant")f=s.layoutSize;else if(s.kind!=="source"){const{interpolationType:g,minZoom:b,maxZoom:w}=s,T=g?K(oi.interpolationFactor(g,i,b,w),0,1):0;s.kind==="camera"?f=di.number(s.minSize,s.maxSize,T):c=T}return{uSizeT:c,uSize:f}},d.ai=function(s,{uSize:i,uSizeT:c},{lowerSize:f,upperSize:g}){return s.kind==="source"?f/is:s.kind==="composite"?di.number(f/is,g/is,c):i},d.aj=Pp,d.ak=function(s,i,c,f){const g=i.y-s.y,b=i.x-s.x,w=f.y-c.y,T=f.x-c.x,I=w*b-T*g;if(I===0)return null;const L=(T*(s.y-c.y)-w*(s.x-c.x))/I;return new k(s.x+L*b,s.y+L*g)},d.al=gy,d.am=gu,d.an=hp,d.ao=Nn,d.aq=Lp,d.ar=function(s,i){var c=i[0],f=i[1],g=i[2],b=i[3],w=i[4],T=i[5],I=i[6],L=i[7],F=i[8],j=i[9],H=i[10],J=i[11],ee=i[12],ae=i[13],ge=i[14],xe=i[15],Re=c*T-f*w,ke=c*I-g*w,Ae=c*L-b*w,Je=f*I-g*T,Qe=f*L-b*T,kt=g*L-b*I,zt=F*ae-j*ee,St=F*ge-H*ee,bt=F*xe-J*ee,pt=j*ge-H*ae,It=j*xe-J*ae,yt=H*xe-J*ge,lt=Re*yt-ke*It+Ae*pt+Je*bt-Qe*St+kt*zt;return lt?(s[0]=(T*yt-I*It+L*pt)*(lt=1/lt),s[1]=(g*It-f*yt-b*pt)*lt,s[2]=(ae*kt-ge*Qe+xe*Je)*lt,s[3]=(H*Qe-j*kt-J*Je)*lt,s[4]=(I*bt-w*yt-L*St)*lt,s[5]=(c*yt-g*bt+b*St)*lt,s[6]=(ge*Ae-ee*kt-xe*ke)*lt,s[7]=(F*kt-H*Ae+J*ke)*lt,s[8]=(w*It-T*bt+L*zt)*lt,s[9]=(f*bt-c*It-b*zt)*lt,s[10]=(ee*Qe-ae*Ae+xe*Re)*lt,s[11]=(j*Ae-F*Qe-J*Re)*lt,s[12]=(T*St-w*pt-I*zt)*lt,s[13]=(c*pt-f*St+g*zt)*lt,s[14]=(ae*ke-ee*Je-ge*Re)*lt,s[15]=(F*Je-j*ke+H*Re)*lt,s):null},d.as=jp,d.at=Ap,d.au=Up,d.av=function(){const s={},i=ne.$version;for(const c in ne.$root){const f=ne.$root[c];if(f.required){let g=null;g=c==="version"?i:f.type==="array"?[]:{},g!=null&&(s[c]=g)}}return s},d.aw=tf,d.ax=Lr,d.ay=function(s){s=s.slice();const i=Object.create(null);for(let c=0;clt*Nn)}let St=w?"center":c.get("text-justify").evaluate(L,{},s.canonical);const bt=c.get("symbol-placement"),pt=bt==="point"?c.get("text-max-width").evaluate(L,{},s.canonical)*Nn:0,It=()=>{s.bucket.allowVerticalPlacement&&Ks(Ae)&&(ee.vertical=Sf(ae,s.glyphMap,s.glyphPositions,s.imagePositions,F,pt,b,kt,"left",Qe,xe,d.ah.vertical,!0,bt,H,j))};if(!w&&zt){const yt=new Set;if(St==="auto")for(let qt=0;qta(void 0,void 0,void 0,function*(){if(s.byteLength===0)return createImageBitmap(new ImageData(1,1));const i=new Blob([new Uint8Array(s)],{type:"image/png"});try{return createImageBitmap(i)}catch(c){throw new Error(`Could not load image because of ${c.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),d.e=X,d.f=s=>new Promise((i,c)=>{const f=new Image;f.onload=()=>{i(f),URL.revokeObjectURL(f.src),f.onload=null,window.requestAnimationFrame(()=>{f.src=Kt})},f.onerror=()=>c(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 g=new Blob([new Uint8Array(s)],{type:"image/png"});f.src=s.byteLength?URL.createObjectURL(g):Kt}),d.g=Nt,d.h=(s,i)=>Pr(X(s,{type:"json"}),i),d.i=Ct,d.j=tt,d.k=at,d.l=(s,i)=>Pr(X(s,{type:"arrayBuffer"}),i),d.m=Pr,d.n=function(s){return new Ep(s).readFields(K2,[])},d.o=xu,d.p=G_,d.q=Si,d.r=ap,d.s=st,d.t=Hs,d.u=xt,d.v=ne,d.w=Ze,d.x=ys,d.y=function([s,i,c]){return i+=90,i*=Math.PI/180,c*=Math.PI/180,{x:s*Math.cos(i)*Math.sin(c),y:s*Math.sin(i)*Math.sin(c),z:s*Math.cos(c)}},d.z=di}),l("worker",["./shared"],function(d){class a{constructor(Z){this.keyCache={},Z&&this.replace(Z)}replace(Z){this._layerConfigs={},this._layers={},this.update(Z,[])}update(Z,$){for(const le of Z){this._layerConfigs[le.id]=le;const Ce=this._layers[le.id]=d.az(le);Ce._featureFilter=d.a6(Ce.filter),this.keyCache[le.id]&&delete this.keyCache[le.id]}for(const le of $)delete this.keyCache[le],delete this._layerConfigs[le],delete this._layers[le];this.familiesBySource={};const te=d.bh(Object.values(this._layerConfigs),this.keyCache);for(const le of te){const Ce=le.map(Fe=>this._layers[Fe.id]),Ie=Ce[0];if(Ie.visibility==="none")continue;const Pe=Ie.source||"";let Se=this.familiesBySource[Pe];Se||(Se=this.familiesBySource[Pe]={});const W=Ie.sourceLayer||"_geojsonTileLayer";let Be=Se[W];Be||(Be=Se[W]=[]),Be.push(Ce)}}}class _{constructor(Z){const $={},te=[];for(const Pe in Z){const Se=Z[Pe],W=$[Pe]={};for(const Be in Se){const Fe=Se[+Be];if(!Fe||Fe.bitmap.width===0||Fe.bitmap.height===0)continue;const qe={x:0,y:0,w:Fe.bitmap.width+2,h:Fe.bitmap.height+2};te.push(qe),W[Be]={rect:qe,metrics:Fe.metrics}}}const{w:le,h:Ce}=d.p(te),Ie=new d.o({width:le||1,height:Ce||1});for(const Pe in Z){const Se=Z[Pe];for(const W in Se){const Be=Se[+W];if(!Be||Be.bitmap.width===0||Be.bitmap.height===0)continue;const Fe=$[Pe][W].rect;d.o.copy(Be.bitmap,Ie,{x:0,y:0},{x:Fe.x+1,y:Fe.y+1},Be.bitmap)}}this.image=Ie,this.positions=$}}d.bi("GlyphAtlas",_);class x{constructor(Z){this.tileID=new d.Q(Z.tileID.overscaledZ,Z.tileID.wrap,Z.tileID.canonical.z,Z.tileID.canonical.x,Z.tileID.canonical.y),this.uid=Z.uid,this.zoom=Z.zoom,this.pixelRatio=Z.pixelRatio,this.tileSize=Z.tileSize,this.source=Z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=Z.showCollisionBoxes,this.collectResourceTiming=!!Z.collectResourceTiming,this.returnDependencies=!!Z.returnDependencies,this.promoteId=Z.promoteId,this.inFlightDependencies=[]}parse(Z,$,te,le){return d._(this,void 0,void 0,function*(){this.status="parsing",this.data=Z,this.collisionBoxArray=new d.a4;const Ce=new d.bj(Object.keys(Z.layers).sort()),Ie=new d.bk(this.tileID,this.promoteId);Ie.bucketLayerIDs=[];const Pe={},Se={featureIndex:Ie,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:te},W=$.familiesBySource[this.source];for(const lr in W){const ln=Z.layers[lr];if(!ln)continue;ln.version===1&&d.w(`Vector tile source "${this.source}" layer "${lr}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Bn=Ce.encode(lr),fi=[];for(let bi=0;bi=Kn.maxzoom||Kn.visibility!=="none"&&(S(bi,this.zoom,te),(Pe[Kn.id]=Kn.createBucket({index:Ie.bucketLayerIDs.length,layers:bi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Bn,sourceID:this.source})).populate(fi,Se,this.tileID.canonical),Ie.bucketLayerIDs.push(bi.map(mo=>mo.id)))}}const Be=d.aE(Se.glyphDependencies,lr=>Object.keys(lr).map(Number));this.inFlightDependencies.forEach(lr=>lr==null?void 0:lr.abort()),this.inFlightDependencies=[];let Fe=Promise.resolve({});if(Object.keys(Be).length){const lr=new AbortController;this.inFlightDependencies.push(lr),Fe=le.sendAsync({type:"GG",data:{stacks:Be,source:this.source,tileID:this.tileID,type:"glyphs"}},lr)}const qe=Object.keys(Se.iconDependencies);let Xe=Promise.resolve({});if(qe.length){const lr=new AbortController;this.inFlightDependencies.push(lr),Xe=le.sendAsync({type:"GI",data:{icons:qe,source:this.source,tileID:this.tileID,type:"icons"}},lr)}const ut=Object.keys(Se.patternDependencies);let Pt=Promise.resolve({});if(ut.length){const lr=new AbortController;this.inFlightDependencies.push(lr),Pt=le.sendAsync({type:"GI",data:{icons:ut,source:this.source,tileID:this.tileID,type:"patterns"}},lr)}const[$t,ar,gr]=yield Promise.all([Fe,Xe,Pt]),Yr=new _($t),Cn=new d.bl(ar,gr);for(const lr in Pe){const ln=Pe[lr];ln instanceof d.a5?(S(ln.layers,this.zoom,te),d.bm({bucket:ln,glyphMap:$t,glyphPositions:Yr.positions,imageMap:ar,imagePositions:Cn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):ln.hasPattern&&(ln instanceof d.bn||ln instanceof d.bo||ln instanceof d.bp)&&(S(ln.layers,this.zoom,te),ln.addFeatures(Se,this.tileID.canonical,Cn.patternPositions))}return this.status="done",{buckets:Object.values(Pe).filter(lr=>!lr.isEmpty()),featureIndex:Ie,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Yr.image,imageAtlas:Cn,glyphMap:this.returnDependencies?$t:null,iconMap:this.returnDependencies?ar:null,glyphPositions:this.returnDependencies?Yr.positions:null}})}}function S(pe,Z,$){const te=new d.a8(Z);for(const le of pe)le.recalculate(te,$)}class k{constructor(Z,$,te){this.actor=Z,this.layerIndex=$,this.availableImages=te,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(Z,$){return d._(this,void 0,void 0,function*(){const te=yield d.l(Z.request,$);try{return{vectorTile:new d.bq.VectorTile(new d.br(te.data)),rawData:te.data,cacheControl:te.cacheControl,expires:te.expires}}catch(le){const Ce=new Uint8Array(te.data);let Ie=`Unable to parse the tile at ${Z.request.url}, `;throw Ie+=Ce[0]===31&&Ce[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${le.messge}`,new Error(Ie)}})}loadTile(Z){return d._(this,void 0,void 0,function*(){const $=Z.uid,te=!!(Z&&Z.request&&Z.request.collectResourceTiming)&&new d.bs(Z.request),le=new x(Z);this.loading[$]=le;const Ce=new AbortController;le.abort=Ce;try{const Ie=yield this.loadVectorTile(Z,Ce);if(delete this.loading[$],!Ie)return null;const Pe=Ie.rawData,Se={};Ie.expires&&(Se.expires=Ie.expires),Ie.cacheControl&&(Se.cacheControl=Ie.cacheControl);const W={};if(te){const Fe=te.finish();Fe&&(W.resourceTiming=JSON.parse(JSON.stringify(Fe)))}le.vectorTile=Ie.vectorTile;const Be=le.parse(Ie.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[$]=le,this.fetching[$]={rawTileData:Pe,cacheControl:Se,resourceTiming:W};try{const Fe=yield Be;return d.e({rawTileData:Pe.slice(0)},Fe,Se,W)}finally{delete this.fetching[$]}}catch(Ie){throw delete this.loading[$],le.status="done",this.loaded[$]=le,Ie}})}reloadTile(Z){return d._(this,void 0,void 0,function*(){const $=Z.uid;if(!this.loaded||!this.loaded[$])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const te=this.loaded[$];if(te.showCollisionBoxes=Z.showCollisionBoxes,te.status==="parsing"){const le=yield te.parse(te.vectorTile,this.layerIndex,this.availableImages,this.actor);let Ce;if(this.fetching[$]){const{rawTileData:Ie,cacheControl:Pe,resourceTiming:Se}=this.fetching[$];delete this.fetching[$],Ce=d.e({rawTileData:Ie.slice(0)},le,Pe,Se)}else Ce=le;return Ce}if(te.status==="done"&&te.vectorTile)return te.parse(te.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(Z){return d._(this,void 0,void 0,function*(){const $=this.loading,te=Z.uid;$&&$[te]&&$[te].abort&&($[te].abort.abort(),delete $[te])})}removeTile(Z){return d._(this,void 0,void 0,function*(){this.loaded&&this.loaded[Z.uid]&&delete this.loaded[Z.uid]})}}class C{constructor(){this.loaded={}}loadTile(Z){return d._(this,void 0,void 0,function*(){const{uid:$,encoding:te,rawImageData:le,redFactor:Ce,greenFactor:Ie,blueFactor:Pe,baseShift:Se}=Z,W=le.width+2,Be=le.height+2,Fe=d.b(le)?new d.R({width:W,height:Be},yield d.bt(le,-1,-1,W,Be)):le,qe=new d.bu($,Fe,te,Ce,Ie,Pe,Se);return this.loaded=this.loaded||{},this.loaded[$]=qe,qe})}removeTile(Z){const $=this.loaded,te=Z.uid;$&&$[te]&&delete $[te]}}function P(pe,Z){if(pe.length!==0){D(pe[0],Z);for(var $=1;$=Math.abs(Pe)?$-Se+Pe:Pe-Se+$,$=Se}$+te>=0!=!!Z&&pe.reverse()}var N=d.bv(function pe(Z,$){var te,le=Z&&Z.type;if(le==="FeatureCollection")for(te=0;te>31}function ft(pe,Z){for(var $=pe.loadGeometry(),te=pe.type,le=0,Ce=0,Ie=$.length,Pe=0;Pepe},Kt=Math.fround||(vt=new Float32Array(1),pe=>(vt[0]=+pe,vt[0]));var vt;const At=3,Vt=5,sr=6;class fr{constructor(Z){this.options=Object.assign(Object.create(Ke),Z),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(Z){const{log:$,minZoom:te,maxZoom:le}=this.options;$&&console.time("total time");const Ce=`prepare ${Z.length} points`;$&&console.time(Ce),this.points=Z;const Ie=[];for(let Se=0;Se=te;Se--){const W=+Date.now();Pe=this.trees[Se]=this._createTree(this._cluster(Pe,Se)),$&&console.log("z%d: %d clusters in %dms",Se,Pe.numItems,+Date.now()-W)}return $&&console.timeEnd("total time"),this}getClusters(Z,$){let te=((Z[0]+180)%360+360)%360-180;const le=Math.max(-90,Math.min(90,Z[1]));let Ce=Z[2]===180?180:((Z[2]+180)%360+360)%360-180;const Ie=Math.max(-90,Math.min(90,Z[3]));if(Z[2]-Z[0]>=360)te=-180,Ce=180;else if(te>Ce){const Fe=this.getClusters([te,le,180,Ie],$),qe=this.getClusters([-180,le,Ce,Ie],$);return Fe.concat(qe)}const Pe=this.trees[this._limitZoom($)],Se=Pe.range(nr(te),tr(Ie),nr(Ce),tr(le)),W=Pe.data,Be=[];for(const Fe of Se){const qe=this.stride*Fe;Be.push(W[qe+Vt]>1?er(W,qe,this.clusterProps):this.points[W[qe+At]])}return Be}getChildren(Z){const $=this._getOriginId(Z),te=this._getOriginZoom(Z),le="No cluster with the specified id.",Ce=this.trees[te];if(!Ce)throw new Error(le);const Ie=Ce.data;if($*this.stride>=Ie.length)throw new Error(le);const Pe=this.options.radius/(this.options.extent*Math.pow(2,te-1)),Se=Ce.within(Ie[$*this.stride],Ie[$*this.stride+1],Pe),W=[];for(const Be of Se){const Fe=Be*this.stride;Ie[Fe+4]===Z&&W.push(Ie[Fe+Vt]>1?er(Ie,Fe,this.clusterProps):this.points[Ie[Fe+At]])}if(W.length===0)throw new Error(le);return W}getLeaves(Z,$,te){const le=[];return this._appendLeaves(le,Z,$=$||10,te=te||0,0),le}getTile(Z,$,te){const le=this.trees[this._limitZoom(Z)],Ce=Math.pow(2,Z),{extent:Ie,radius:Pe}=this.options,Se=Pe/Ie,W=(te-Se)/Ce,Be=(te+1+Se)/Ce,Fe={features:[]};return this._addTileFeatures(le.range(($-Se)/Ce,W,($+1+Se)/Ce,Be),le.data,$,te,Ce,Fe),$===0&&this._addTileFeatures(le.range(1-Se/Ce,W,1,Be),le.data,Ce,te,Ce,Fe),$===Ce-1&&this._addTileFeatures(le.range(0,W,Se/Ce,Be),le.data,-1,te,Ce,Fe),Fe.features.length?Fe:null}getClusterExpansionZoom(Z){let $=this._getOriginZoom(Z)-1;for(;$<=this.options.maxZoom;){const te=this.getChildren(Z);if($++,te.length!==1)break;Z=te[0].properties.cluster_id}return $}_appendLeaves(Z,$,te,le,Ce){const Ie=this.getChildren($);for(const Pe of Ie){const Se=Pe.properties;if(Se&&Se.cluster?Ce+Se.point_count<=le?Ce+=Se.point_count:Ce=this._appendLeaves(Z,Se.cluster_id,te,le,Ce):Ce1;let Be,Fe,qe;if(W)Be=Nt($,Se,this.clusterProps),Fe=$[Se],qe=$[Se+1];else{const Pt=this.points[$[Se+At]];Be=Pt.properties;const[$t,ar]=Pt.geometry.coordinates;Fe=nr($t),qe=tr(ar)}const Xe={type:1,geometry:[[Math.round(this.options.extent*(Fe*Ce-te)),Math.round(this.options.extent*(qe*Ce-le))]],tags:Be};let ut;ut=W||this.options.generateId?$[Se+At]:this.points[$[Se+At]].id,ut!==void 0&&(Xe.id=ut),Ie.features.push(Xe)}}_limitZoom(Z){return Math.max(this.options.minZoom,Math.min(Math.floor(+Z),this.options.maxZoom+1))}_cluster(Z,$){const{radius:te,extent:le,reduce:Ce,minPoints:Ie}=this.options,Pe=te/(le*Math.pow(2,$)),Se=Z.data,W=[],Be=this.stride;for(let Fe=0;Fe$&&($t+=Se[gr+Vt])}if($t>Pt&&$t>=Ie){let ar,gr=qe*Pt,Yr=Xe*Pt,Cn=-1;const lr=((Fe/Be|0)<<5)+($+1)+this.points.length;for(const ln of ut){const Bn=ln*Be;if(Se[Bn+2]<=$)continue;Se[Bn+2]=$;const fi=Se[Bn+Vt];gr+=Se[Bn]*fi,Yr+=Se[Bn+1]*fi,Se[Bn+4]=lr,Ce&&(ar||(ar=this._map(Se,Fe,!0),Cn=this.clusterProps.length,this.clusterProps.push(ar)),Ce(ar,this._map(Se,Bn)))}Se[Fe+4]=lr,W.push(gr/$t,Yr/$t,1/0,lr,-1,$t),Ce&&W.push(Cn)}else{for(let ar=0;ar1)for(const ar of ut){const gr=ar*Be;if(!(Se[gr+2]<=$)){Se[gr+2]=$;for(let Yr=0;Yr>5}_getOriginZoom(Z){return(Z-this.points.length)%32}_map(Z,$,te){if(Z[$+Vt]>1){const Ie=this.clusterProps[Z[$+sr]];return te?Object.assign({},Ie):Ie}const le=this.points[Z[$+At]].properties,Ce=this.options.map(le);return te&&Ce===le?Object.assign({},Ce):Ce}}function er(pe,Z,$){return{type:"Feature",id:pe[Z+At],properties:Nt(pe,Z,$),geometry:{type:"Point",coordinates:[(te=pe[Z],360*(te-.5)),Lr(pe[Z+1])]}};var te}function Nt(pe,Z,$){const te=pe[Z+Vt],le=te>=1e4?`${Math.round(te/1e3)}k`:te>=1e3?Math.round(te/100)/10+"k":te,Ce=pe[Z+sr],Ie=Ce===-1?{}:Object.assign({},$[Ce]);return Object.assign(Ie,{cluster:!0,cluster_id:pe[Z+At],point_count:te,point_count_abbreviated:le})}function nr(pe){return pe/360+.5}function tr(pe){const Z=Math.sin(pe*Math.PI/180),$=.5-.25*Math.log((1+Z)/(1-Z))/Math.PI;return $<0?0:$>1?1:$}function Lr(pe){const Z=(180-360*pe)*Math.PI/180;return 360*Math.atan(Math.exp(Z))/Math.PI-90}function Pr(pe,Z,$,te){for(var le,Ce=te,Ie=$-Z>>1,Pe=$-Z,Se=pe[Z],W=pe[Z+1],Be=pe[$],Fe=pe[$+1],qe=Z+3;qe<$;qe+=3){var Xe=st(pe[qe],pe[qe+1],Se,W,Be,Fe);if(Xe>Ce)le=qe,Ce=Xe;else if(Xe===Ce){var ut=Math.abs(qe-Ie);utte&&(le-Z>3&&Pr(pe,Z,le,te),pe[le+2]=Ce,$-le>3&&Pr(pe,le,$,te))}function st(pe,Z,$,te,le,Ce){var Ie=le-$,Pe=Ce-te;if(Ie!==0||Pe!==0){var Se=((pe-$)*Ie+(Z-te)*Pe)/(Ie*Ie+Pe*Pe);Se>1?($=le,te=Ce):Se>0&&($+=Ie*Se,te+=Pe*Se)}return(Ie=pe-$)*Ie+(Pe=Z-te)*Pe}function Lt(pe,Z,$,te){var le={id:pe===void 0?null:pe,type:Z,geometry:$,tags:te,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Ce){var Ie=Ce.geometry,Pe=Ce.type;if(Pe==="Point"||Pe==="MultiPoint"||Pe==="LineString")De(Ce,Ie);else if(Pe==="Polygon"||Pe==="MultiLineString")for(var Se=0;Se0&&(Ie+=te?(le*W-Se*Ce)/2:Math.sqrt(Math.pow(Se-le,2)+Math.pow(W-Ce,2))),le=Se,Ce=W}var Be=Z.length-3;Z[2]=1,Pr(Z,0,Be,$),Z[Be+2]=1,Z.size=Math.abs(Ie),Z.start=0,Z.end=Z.size}function ne(pe,Z,$,te){for(var le=0;le1?1:$}function Ye(pe,Z,$,te,le,Ce,Ie,Pe){if(te/=Z,Ce>=($/=Z)&&Ie=te)return null;for(var Se=[],W=0;W=$&&ut=te)){var Pt=[];if(qe==="Point"||qe==="MultiPoint")jt(Fe,Pt,$,te,le);else if(qe==="LineString")bn(Fe,Pt,$,te,le,!1,Pe.lineMetrics);else if(qe==="MultiLineString")Mn(Fe,Pt,$,te,le,!1);else if(qe==="Polygon")Mn(Fe,Pt,$,te,le,!0);else if(qe==="MultiPolygon")for(var $t=0;$t=$&&Ie<=te&&(Z.push(pe[Ce]),Z.push(pe[Ce+1]),Z.push(pe[Ce+2]))}}function bn(pe,Z,$,te,le,Ce,Ie){for(var Pe,Se,W=wn(pe),Be=le===0?ii:$o,Fe=pe.start,qe=0;qe$&&(Se=Be(W,Xe,ut,$t,ar,$),Ie&&(W.start=Fe+Pe*Se)):gr>te?Yr=$&&(Se=Be(W,Xe,ut,$t,ar,$),Cn=!0),Yr>te&&gr<=te&&(Se=Be(W,Xe,ut,$t,ar,te),Cn=!0),!Ce&&Cn&&(Ie&&(W.end=Fe+Pe*Se),Z.push(W),W=wn(pe)),Ie&&(Fe+=Pe)}var lr=pe.length-3;Xe=pe[lr],ut=pe[lr+1],Pt=pe[lr+2],(gr=le===0?Xe:ut)>=$&&gr<=te&&ni(W,Xe,ut,Pt),lr=W.length-3,Ce&&lr>=3&&(W[lr]!==W[0]||W[lr+1]!==W[1])&&ni(W,W[0],W[1],W[2]),W.length&&Z.push(W)}function wn(pe){var Z=[];return Z.size=pe.size,Z.start=pe.start,Z.end=pe.end,Z}function Mn(pe,Z,$,te,le,Ce){for(var Ie=0;IeIe.maxX&&(Ie.maxX=Be),Fe>Ie.maxY&&(Ie.maxY=Fe)}return Ie}function Or(pe,Z,$,te){var le=Z.geometry,Ce=Z.type,Ie=[];if(Ce==="Point"||Ce==="MultiPoint")for(var Pe=0;Pe0&&Z.size<(le?Ie:te))$.numPoints+=Z.length/3;else{for(var Pe=[],Se=0;SeIe)&&($.numSimplified++,Pe.push(Z[Se]),Pe.push(Z[Se+1])),$.numPoints++;le&&function(W,Be){for(var Fe=0,qe=0,Xe=W.length,ut=Xe-2;qe0===Be)for(qe=0,Xe=W.length;qe24)throw new Error("maxZoom should be in the 0-24 range");if(Z.promoteId&&Z.generateId)throw new Error("promoteId and generateId cannot be used together.");var te=function(le,Ce){var Ie=[];if(le.type==="FeatureCollection")for(var Pe=0;Pe1&&console.time("creation"),qe=this.tiles[Fe]=Bo(pe,Z,$,te,Se),this.tileCoords.push({z:Z,x:$,y:te}),W)){W>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Z,$,te,qe.numFeatures,qe.numPoints,qe.numSimplified),console.timeEnd("creation"));var Xe="z"+Z;this.stats[Xe]=(this.stats[Xe]||0)+1,this.total++}if(qe.source=pe,le){if(Z===Se.maxZoom||Z===le)continue;var ut=1<1&&console.time("clipping");var Pt,$t,ar,gr,Yr,Cn,lr=.5*Se.buffer/Se.extent,ln=.5-lr,Bn=.5+lr,fi=1+lr;Pt=$t=ar=gr=null,Yr=Ye(pe,Be,$-lr,$+Bn,0,qe.minX,qe.maxX,Se),Cn=Ye(pe,Be,$+ln,$+fi,0,qe.minX,qe.maxX,Se),pe=null,Yr&&(Pt=Ye(Yr,Be,te-lr,te+Bn,1,qe.minY,qe.maxY,Se),$t=Ye(Yr,Be,te+ln,te+fi,1,qe.minY,qe.maxY,Se),Yr=null),Cn&&(ar=Ye(Cn,Be,te-lr,te+Bn,1,qe.minY,qe.maxY,Se),gr=Ye(Cn,Be,te+ln,te+fi,1,qe.minY,qe.maxY,Se),Cn=null),W>1&&console.timeEnd("clipping"),Pe.push(Pt||[],Z+1,2*$,2*te),Pe.push($t||[],Z+1,2*$,2*te+1),Pe.push(ar||[],Z+1,2*$+1,2*te),Pe.push(gr||[],Z+1,2*$+1,2*te+1)}}},rr.prototype.getTile=function(pe,Z,$){var te=this.options,le=te.extent,Ce=te.debug;if(pe<0||pe>24)return null;var Ie=1<1&&console.log("drilling down to z%d-%d-%d",pe,Z,$);for(var Se,W=pe,Be=Z,Fe=$;!Se&&W>0;)W--,Be=Math.floor(Be/2),Fe=Math.floor(Fe/2),Se=this.tiles[Jt(W,Be,Fe)];return Se&&Se.source?(Ce>1&&console.log("found parent tile z%d-%d-%d",W,Be,Fe),Ce>1&&console.time("drilling down"),this.splitTile(Se.source,W,Be,Fe,pe,Z,$),Ce>1&&console.timeEnd("drilling down"),this.tiles[Pe]?Xn(this.tiles[Pe],le):null):null};class ro extends k{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(Z,$){return d._(this,void 0,void 0,function*(){const te=Z.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const le=this._geoJSONIndex.getTile(te.z,te.x,te.y);if(!le)return null;const Ce=new class{constructor(Pe){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=d.W,this.length=Pe.length,this._features=Pe}feature(Pe){return new class{constructor(Se){this._feature=Se,this.extent=d.W,this.type=Se.type,this.properties=Se.tags,"id"in Se&&!isNaN(Se.id)&&(this.id=parseInt(Se.id,10))}loadGeometry(){if(this._feature.type===1){const Se=[];for(const W of this._feature.geometry)Se.push([new d.P(W[0],W[1])]);return Se}{const Se=[];for(const W of this._feature.geometry){const Be=[];for(const Fe of W)Be.push(new d.P(Fe[0],Fe[1]));Se.push(Be)}return Se}}toGeoJSON(Se,W,Be){return z.call(this,Se,W,Be)}}(this._features[Pe])}}(le.features);let Ie=Ot(Ce);return Ie.byteOffset===0&&Ie.byteLength===Ie.buffer.byteLength||(Ie=new Uint8Array(Ie)),{vectorTile:Ce,rawData:Ie.buffer}})}loadData(Z){return d._(this,void 0,void 0,function*(){var $;($=this._pendingRequest)===null||$===void 0||$.abort();const te=!!(Z&&Z.request&&Z.request.collectResourceTiming)&&new d.bs(Z.request);this._pendingRequest=new AbortController;try{let le=yield this.loadGeoJSON(Z,this._pendingRequest);if(delete this._pendingRequest,typeof le!="object")throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`);if(N(le,!0),Z.filter){const Ie=d.by(Z.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Ie.result==="error")throw new Error(Ie.value.map(Se=>`${Se.key}: ${Se.message}`).join(", "));le={type:"FeatureCollection",features:le.features.filter(Se=>Ie.value.evaluate({zoom:0},Se))}}this._geoJSONIndex=Z.cluster?new fr(function({superclusterOptions:Ie,clusterProperties:Pe}){if(!Pe||!Ie)return Ie;const Se={},W={},Be={accumulated:null,zoom:0},Fe={properties:null},qe=Object.keys(Pe);for(const Xe of qe){const[ut,Pt]=Pe[Xe],$t=d.by(Pt),ar=d.by(typeof ut=="string"?[ut,["accumulated"],["get",Xe]]:ut);Se[Xe]=$t.value,W[Xe]=ar.value}return Ie.map=Xe=>{Fe.properties=Xe;const ut={};for(const Pt of qe)ut[Pt]=Se[Pt].evaluate(Be,Fe);return ut},Ie.reduce=(Xe,ut)=>{Fe.properties=ut;for(const Pt of qe)Be.accumulated=Xe[Pt],Xe[Pt]=W[Pt].evaluate(Be,Fe)},Ie}(Z)).load(le.features):function(Ie,Pe){return new rr(Ie,Pe)}(le,Z.geojsonVtOptions),this.loaded={};const Ce={};if(te){const Ie=te.finish();Ie&&(Ce.resourceTiming={},Ce.resourceTiming[Z.source]=JSON.parse(JSON.stringify(Ie)))}return Ce}catch(le){if(delete this._pendingRequest,d.bz(le))return{abandoned:!0};throw le}})}reloadTile(Z){const $=this.loaded;return $&&$[Z.uid]?super.reloadTile(Z):this.loadTile(Z)}loadGeoJSON(Z,$){return d._(this,void 0,void 0,function*(){const{promoteId:te}=Z;if(Z.request){const le=yield d.h(Z.request,$);return this._dataUpdateable=vi(le.data,te)?Qt(le.data,te):void 0,le.data}if(typeof Z.data=="string")try{const le=JSON.parse(Z.data);return this._dataUpdateable=vi(le,te)?Qt(le,te):void 0,le}catch{throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`)}if(!Z.dataDiff)throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${Z.source}`);return function(le,Ce,Ie){var Pe,Se,W,Be;if(Ce.removeAll&&le.clear(),Ce.remove)for(const Fe of Ce.remove)le.delete(Fe);if(Ce.add)for(const Fe of Ce.add){const qe=Nr(Fe,Ie);qe!=null&&le.set(qe,Fe)}if(Ce.update)for(const Fe of Ce.update){let qe=le.get(Fe.id);if(qe==null)continue;const Xe=!Fe.removeAllProperties&&(((Pe=Fe.removeProperties)===null||Pe===void 0?void 0:Pe.length)>0||((Se=Fe.addOrUpdateProperties)===null||Se===void 0?void 0:Se.length)>0);if((Fe.newGeometry||Fe.removeAllProperties||Xe)&&(qe=Object.assign({},qe),le.set(Fe.id,qe),Xe&&(qe.properties=Object.assign({},qe.properties))),Fe.newGeometry&&(qe.geometry=Fe.newGeometry),Fe.removeAllProperties)qe.properties={};else if(((W=Fe.removeProperties)===null||W===void 0?void 0:W.length)>0)for(const ut of Fe.removeProperties)Object.prototype.hasOwnProperty.call(qe.properties,ut)&&delete qe.properties[ut];if(((Be=Fe.addOrUpdateProperties)===null||Be===void 0?void 0:Be.length)>0)for(const{key:ut,value:Pt}of Fe.addOrUpdateProperties)qe.properties[ut]=Pt}}(this._dataUpdateable,Z.dataDiff,te),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(Z){return d._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(Z){return this._geoJSONIndex.getClusterExpansionZoom(Z.clusterId)}getClusterChildren(Z){return this._geoJSONIndex.getChildren(Z.clusterId)}getClusterLeaves(Z){return this._geoJSONIndex.getLeaves(Z.clusterId,Z.limit,Z.offset)}}class an{constructor(Z){this.self=Z,this.actor=new d.C(Z),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=($,te)=>{if(this.externalWorkerSourceTypes[$])throw new Error(`Worker source with name "${$}" already registered.`);this.externalWorkerSourceTypes[$]=te},this.self.addProtocol=d.bf,this.self.removeProtocol=d.bg,this.self.registerRTLTextPlugin=$=>{if(d.bA.isParsed())throw new Error("RTL text plugin already registered.");d.bA.setMethods($)},this.actor.registerMessageHandler("LDT",($,te)=>this._getDEMWorkerSource($,te.source).loadTile(te)),this.actor.registerMessageHandler("RDT",($,te)=>d._(this,void 0,void 0,function*(){this._getDEMWorkerSource($,te.source).removeTile(te)})),this.actor.registerMessageHandler("GCEZ",($,te)=>d._(this,void 0,void 0,function*(){return this._getWorkerSource($,te.type,te.source).getClusterExpansionZoom(te)})),this.actor.registerMessageHandler("GCC",($,te)=>d._(this,void 0,void 0,function*(){return this._getWorkerSource($,te.type,te.source).getClusterChildren(te)})),this.actor.registerMessageHandler("GCL",($,te)=>d._(this,void 0,void 0,function*(){return this._getWorkerSource($,te.type,te.source).getClusterLeaves(te)})),this.actor.registerMessageHandler("LD",($,te)=>this._getWorkerSource($,te.type,te.source).loadData(te)),this.actor.registerMessageHandler("LT",($,te)=>this._getWorkerSource($,te.type,te.source).loadTile(te)),this.actor.registerMessageHandler("RT",($,te)=>this._getWorkerSource($,te.type,te.source).reloadTile(te)),this.actor.registerMessageHandler("AT",($,te)=>this._getWorkerSource($,te.type,te.source).abortTile(te)),this.actor.registerMessageHandler("RMT",($,te)=>this._getWorkerSource($,te.type,te.source).removeTile(te)),this.actor.registerMessageHandler("RS",($,te)=>d._(this,void 0,void 0,function*(){if(!this.workerSources[$]||!this.workerSources[$][te.type]||!this.workerSources[$][te.type][te.source])return;const le=this.workerSources[$][te.type][te.source];delete this.workerSources[$][te.type][te.source],le.removeSource!==void 0&&le.removeSource(te)})),this.actor.registerMessageHandler("RM",$=>d._(this,void 0,void 0,function*(){delete this.layerIndexes[$],delete this.availableImages[$],delete this.workerSources[$],delete this.demWorkerSources[$]})),this.actor.registerMessageHandler("SR",($,te)=>d._(this,void 0,void 0,function*(){this.referrer=te})),this.actor.registerMessageHandler("SRPS",($,te)=>this._syncRTLPluginState($,te)),this.actor.registerMessageHandler("IS",($,te)=>d._(this,void 0,void 0,function*(){this.self.importScripts(te)})),this.actor.registerMessageHandler("SI",($,te)=>this._setImages($,te)),this.actor.registerMessageHandler("UL",($,te)=>d._(this,void 0,void 0,function*(){this._getLayerIndex($).update(te.layers,te.removedIds)})),this.actor.registerMessageHandler("SL",($,te)=>d._(this,void 0,void 0,function*(){this._getLayerIndex($).replace(te)}))}_setImages(Z,$){return d._(this,void 0,void 0,function*(){this.availableImages[Z]=$;for(const te in this.workerSources[Z]){const le=this.workerSources[Z][te];for(const Ce in le)le[Ce].availableImages=$}})}_syncRTLPluginState(Z,$){return d._(this,void 0,void 0,function*(){if(d.bA.isParsed())return d.bA.getState();if($.pluginStatus!=="loading")return d.bA.setState($),$;const te=$.pluginURL;if(this.self.importScripts(te),d.bA.isParsed()){const le={pluginStatus:"loaded",pluginURL:te};return d.bA.setState(le),le}throw d.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${te}`)})}_getAvailableImages(Z){let $=this.availableImages[Z];return $||($=[]),$}_getLayerIndex(Z){let $=this.layerIndexes[Z];return $||($=this.layerIndexes[Z]=new a),$}_getWorkerSource(Z,$,te){if(this.workerSources[Z]||(this.workerSources[Z]={}),this.workerSources[Z][$]||(this.workerSources[Z][$]={}),!this.workerSources[Z][$][te]){const le={sendAsync:(Ce,Ie)=>(Ce.targetMapId=Z,this.actor.sendAsync(Ce,Ie))};switch($){case"vector":this.workerSources[Z][$][te]=new k(le,this._getLayerIndex(Z),this._getAvailableImages(Z));break;case"geojson":this.workerSources[Z][$][te]=new ro(le,this._getLayerIndex(Z),this._getAvailableImages(Z));break;default:this.workerSources[Z][$][te]=new this.externalWorkerSourceTypes[$](le,this._getLayerIndex(Z),this._getAvailableImages(Z))}}return this.workerSources[Z][$][te]}_getDEMWorkerSource(Z,$){return this.demWorkerSources[Z]||(this.demWorkerSources[Z]={}),this.demWorkerSources[Z][$]||(this.demWorkerSources[Z][$]=new C),this.demWorkerSources[Z][$]}}return d.i(self)&&(self.worker=new an(self)),an}),l("index",["exports","./shared"],function(d,a){var _="4.1.3";let x,S;const k={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:y=>new Promise((o,h)=>{const p=requestAnimationFrame(o);y.signal.addEventListener("abort",()=>{cancelAnimationFrame(p),h(a.c())})}),getImageData(y,o=0){return this.getImageCanvasContext(y).getImageData(-o,-o,y.width+2*o,y.height+2*o)},getImageCanvasContext(y){const o=window.document.createElement("canvas"),h=o.getContext("2d",{willReadFrequently:!0});if(!h)throw new Error("failed to create canvas 2d context");return o.width=y.width,o.height=y.height,h.drawImage(y,0,0,y.width,y.height),h},resolveURL:y=>(x||(x=document.createElement("a")),x.href=y,x.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(S==null&&(S=matchMedia("(prefers-reduced-motion: reduce)")),S.matches)}};class C{static testProp(o){if(!C.docStyle)return o[0];for(let h=0;h{window.removeEventListener("click",C.suppressClickInternal,!0)},0)}static getScale(o){const h=o.getBoundingClientRect();return{x:h.width/o.offsetWidth||1,y:h.height/o.offsetHeight||1,boundingClientRect:h}}static getPoint(o,h,p){const m=h.boundingClientRect;return new a.P((p.clientX-m.left)/h.x-o.clientLeft,(p.clientY-m.top)/h.y-o.clientTop)}static mousePos(o,h){const p=C.getScale(o);return C.getPoint(o,p,h)}static touchPos(o,h){const p=[],m=C.getScale(o);for(let v=0;v{o=[],h=0,p=0,m={}},y.addThrottleControl=A=>{const R=p++;return m[R]=A,R},y.removeThrottleControl=A=>{delete m[A],E()},y.getImage=(A,R,V=!0)=>new Promise((q,Q)=>{P.supported&&(A.headers||(A.headers={}),A.headers.accept="image/webp,*/*"),a.e(A,{type:"image"}),o.push({abortController:R,requestParameters:A,supportImageRefresh:V,state:"queued",onError:he=>{Q(he)},onSuccess:he=>{q(he)}}),E()});const v=A=>a._(this,void 0,void 0,function*(){A.state="running";const{requestParameters:R,supportImageRefresh:V,onError:q,onSuccess:Q,abortController:he}=A,ue=V===!1&&!a.i(self)&&!a.g(R.url)&&(!R.headers||Object.keys(R.headers).reduce((Te,Ue)=>Te&&Ue==="accept",!0));h++;const ye=ue?M(R,he):a.m(R,he);try{const Te=yield ye;delete A.abortController,A.state="completed",Te.data instanceof HTMLImageElement||a.b(Te.data)?Q(Te):Te.data&&Q({data:yield(se=Te.data,typeof createImageBitmap=="function"?a.d(se):a.f(se)),cacheControl:Te.cacheControl,expires:Te.expires})}catch(Te){delete A.abortController,q(Te)}finally{h--,E()}var se}),E=()=>{const A=(()=>{for(const R of Object.keys(m))if(m[R]())return!0;return!1})()?a.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:a.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let R=h;R0;R++){const V=o.shift();V.abortController.signal.aborted?R--:v(V)}},M=(A,R)=>new Promise((V,q)=>{const Q=new Image,he=A.url,ue=A.credentials;ue&&ue==="include"?Q.crossOrigin="use-credentials":(ue&&ue==="same-origin"||!a.s(he))&&(Q.crossOrigin="anonymous"),R.signal.addEventListener("abort",()=>{Q.src="",q(a.c())}),Q.fetchPriority="high",Q.onload=()=>{Q.onerror=Q.onload=null,V({data:Q})},Q.onerror=()=>{Q.onerror=Q.onload=null,R.signal.aborted||q(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."))},Q.src=he})}(G||(G={})),G.resetRequestQueue();class U{constructor(o){this._transformRequestFn=o}transformRequest(o,h){return this._transformRequestFn&&this._transformRequestFn(o,h)||{url:o}}normalizeSpriteURL(o,h,p){const m=function(v){const E=v.match(K);if(!E)throw new Error(`Unable to parse URL "${v}"`);return{protocol:E[1],authority:E[2],path:E[3]||"/",params:E[4]?E[4].split("&"):[]}}(o);return m.path+=`${h}${p}`,function(v){const E=v.params.length?`?${v.params.join("&")}`:"";return`${v.protocol}://${v.authority}${v.path}${E}`}(m)}setTransformRequest(o){this._transformRequestFn=o}}const K=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function me(y){var o=new a.A(3);return o[0]=y[0],o[1]=y[1],o[2]=y[2],o}var X,Y=function(y,o,h){return y[0]=o[0]-h[0],y[1]=o[1]-h[1],y[2]=o[2]-h[2],y};X=new a.A(3),a.A!=Float32Array&&(X[0]=0,X[1]=0,X[2]=0);var _e=function(y){var o=y[0],h=y[1];return o*o+h*h};function ze(y){const o=[];if(typeof y=="string")o.push({id:"default",url:y});else if(y&&y.length>0){const h=[];for(const{id:p,url:m}of y){const v=`${p}${m}`;h.indexOf(v)===-1&&(h.push(v),o.push({id:p,url:m}))}}return o}(function(){var y=new a.A(2);a.A!=Float32Array&&(y[0]=0,y[1]=0)})();class re{constructor(o,h,p,m){this.context=o,this.format=p,this.texture=o.gl.createTexture(),this.update(h,m)}update(o,h,p){const{width:m,height:v}=o,E=!(this.size&&this.size[0]===m&&this.size[1]===v||p),{context:M}=this,{gl:A}=M;if(this.useMipmap=!!(h&&h.useMipmap),A.bindTexture(A.TEXTURE_2D,this.texture),M.pixelStoreUnpackFlipY.set(!1),M.pixelStoreUnpack.set(1),M.pixelStoreUnpackPremultiplyAlpha.set(this.format===A.RGBA&&(!h||h.premultiply!==!1)),E)this.size=[m,v],o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement||o instanceof ImageData||a.b(o)?A.texImage2D(A.TEXTURE_2D,0,this.format,this.format,A.UNSIGNED_BYTE,o):A.texImage2D(A.TEXTURE_2D,0,this.format,m,v,0,this.format,A.UNSIGNED_BYTE,o.data);else{const{x:R,y:V}=p||{x:0,y:0};o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement||o instanceof ImageData||a.b(o)?A.texSubImage2D(A.TEXTURE_2D,0,R,V,A.RGBA,A.UNSIGNED_BYTE,o):A.texSubImage2D(A.TEXTURE_2D,0,R,V,m,v,A.RGBA,A.UNSIGNED_BYTE,o.data)}this.useMipmap&&this.isSizePowerOfTwo()&&A.generateMipmap(A.TEXTURE_2D)}bind(o,h,p){const{context:m}=this,{gl:v}=m;v.bindTexture(v.TEXTURE_2D,this.texture),p!==v.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(p=v.LINEAR),o!==this.filter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,o),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,p||o),this.filter=o),h!==this.wrap&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,h),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,h),this.wrap=h)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:o}=this.context;o.deleteTexture(this.texture),this.texture=null}}function ce(y){const{userImage:o}=y;return!!(o&&o.render&&o.render())&&(y.data.replace(new Uint8Array(o.data.buffer)),!0)}class Ze extends a.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(o){if(this.loaded!==o&&(this.loaded=o,o)){for(const{ids:h,promiseResolve:p}of this.requestors)p(this._getImagesForIds(h));this.requestors=[]}}getImage(o){const h=this.images[o];if(h&&!h.data&&h.spriteData){const p=h.spriteData;h.data=new a.R({width:p.width,height:p.height},p.context.getImageData(p.x,p.y,p.width,p.height).data),h.spriteData=null}return h}addImage(o,h){if(this.images[o])throw new Error(`Image id ${o} already exist, use updateImage instead`);this._validate(o,h)&&(this.images[o]=h)}_validate(o,h){let p=!0;const m=h.data||h.spriteData;return this._validateStretch(h.stretchX,m&&m.width)||(this.fire(new a.j(new Error(`Image "${o}" has invalid "stretchX" value`))),p=!1),this._validateStretch(h.stretchY,m&&m.height)||(this.fire(new a.j(new Error(`Image "${o}" has invalid "stretchY" value`))),p=!1),this._validateContent(h.content,h)||(this.fire(new a.j(new Error(`Image "${o}" has invalid "content" value`))),p=!1),p}_validateStretch(o,h){if(!o)return!0;let p=0;for(const m of o){if(m[0]{let m=!0;if(!this.isLoaded())for(const v of o)this.images[v]||(m=!1);this.isLoaded()||m?h(this._getImagesForIds(o)):this.requestors.push({ids:o,promiseResolve:h})})}_getImagesForIds(o){const h={};for(const p of o){let m=this.getImage(p);m||(this.fire(new a.k("styleimagemissing",{id:p})),m=this.getImage(p)),m?h[p]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,hasRenderCallback:!!(m.userImage&&m.userImage.render)}:a.w(`Image "${p}" 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 h}getPixelSize(){const{width:o,height:h}=this.atlasImage;return{width:o,height:h}}getPattern(o){const h=this.patterns[o],p=this.getImage(o);if(!p)return null;if(h&&h.position.version===p.version)return h.position;if(h)h.position.version=p.version;else{const m={w:p.data.width+2,h:p.data.height+2,x:0,y:0},v=new a.I(m,p);this.patterns[o]={bin:m,position:v}}return this._updatePatternAtlas(),this.patterns[o].position}bind(o){const h=o.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new re(o,this.atlasImage,h.RGBA),this.atlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE)}_updatePatternAtlas(){const o=[];for(const v in this.patterns)o.push(this.patterns[v].bin);const{w:h,h:p}=a.p(o),m=this.atlasImage;m.resize({width:h||1,height:p||1});for(const v in this.patterns){const{bin:E}=this.patterns[v],M=E.x+1,A=E.y+1,R=this.getImage(v).data,V=R.width,q=R.height;a.R.copy(R,m,{x:0,y:0},{x:M,y:A},{width:V,height:q}),a.R.copy(R,m,{x:0,y:q-1},{x:M,y:A-1},{width:V,height:1}),a.R.copy(R,m,{x:0,y:0},{x:M,y:A+q},{width:V,height:1}),a.R.copy(R,m,{x:V-1,y:0},{x:M-1,y:A},{width:1,height:q}),a.R.copy(R,m,{x:0,y:0},{x:M+V,y:A},{width:1,height:q})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(o){for(const h of o){if(this.callbackDispatchedThisFrame[h])continue;this.callbackDispatchedThisFrame[h]=!0;const p=this.getImage(h);p||a.w(`Image with ID: "${h}" was not found`),ce(p)&&this.updateImage(h,p)}}}const Me=1e20;function ft(y,o,h,p,m,v,E,M,A){for(let R=o;R-1);A++,v[A]=M,E[A]=R,E[A+1]=Me}for(let M=0,A=0;M65535)throw new Error("glyphs > 65535 not supported");if(p.ranges[v])return{stack:o,id:h,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!p.requests[v]){const M=Ot.loadGlyphRange(o,v,this.url,this.requestManager);p.requests[v]=M}const E=yield p.requests[v];for(const M in E)this._doesCharSupportLocalGlyph(+M)||(p.glyphs[+M]=E[+M]);return p.ranges[v]=!0,{stack:o,id:h,glyph:E[h]||null}})}_doesCharSupportLocalGlyph(o){return!!this.localIdeographFontFamily&&(a.u["CJK Unified Ideographs"](o)||a.u["Hangul Syllables"](o)||a.u.Hiragana(o)||a.u.Katakana(o))}_tinySDF(o,h,p){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(p))return;let v=o.tinySDF;if(!v){let M="400";/bold/i.test(h)?M="900":/medium/i.test(h)?M="500":/light/i.test(h)&&(M="200"),v=o.tinySDF=new Ot.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:M})}const E=v.draw(String.fromCharCode(p));return{id:p,bitmap:new a.o({width:E.width||60,height:E.height||60},E.data),metrics:{width:E.glyphWidth/2||24,height:E.glyphHeight/2||24,left:E.glyphLeft/2+.5||0,top:E.glyphTop/2-27.5||-8,advance:E.glyphAdvance/2||24,isDoubleResolution:!0}}}}Ot.loadGlyphRange=function(y,o,h,p){return a._(this,void 0,void 0,function*(){const m=256*o,v=m+255,E=p.transformRequest(h.replace("{fontstack}",y).replace("{range}",`${m}-${v}`),"Glyphs"),M=yield a.l(E,new AbortController);if(!M||!M.data)throw new Error(`Could not load glyph range. range: ${o}, ${m}-${v}`);const A={};for(const R of a.n(M.data))A[R.id]=R;return A})},Ot.TinySDF=class{constructor({fontSize:y=24,buffer:o=3,radius:h=8,cutoff:p=.25,fontFamily:m="sans-serif",fontWeight:v="normal",fontStyle:E="normal"}={}){this.buffer=o,this.cutoff=p,this.radius=h;const M=this.size=y+4*o,A=this._createCanvas(M),R=this.ctx=A.getContext("2d",{willReadFrequently:!0});R.font=`${E} ${v} ${y}px ${m}`,R.textBaseline="alphabetic",R.textAlign="left",R.fillStyle="black",this.gridOuter=new Float64Array(M*M),this.gridInner=new Float64Array(M*M),this.f=new Float64Array(M),this.z=new Float64Array(M+1),this.v=new Uint16Array(M)}_createCanvas(y){const o=document.createElement("canvas");return o.width=o.height=y,o}draw(y){const{width:o,actualBoundingBoxAscent:h,actualBoundingBoxDescent:p,actualBoundingBoxLeft:m,actualBoundingBoxRight:v}=this.ctx.measureText(y),E=Math.ceil(h),M=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(v-m))),A=Math.min(this.size-this.buffer,E+Math.ceil(p)),R=M+2*this.buffer,V=A+2*this.buffer,q=Math.max(R*V,0),Q=new Uint8ClampedArray(q),he={data:Q,width:R,height:V,glyphWidth:M,glyphHeight:A,glyphTop:E,glyphLeft:0,glyphAdvance:o};if(M===0||A===0)return he;const{ctx:ue,buffer:ye,gridInner:se,gridOuter:Te}=this;ue.clearRect(ye,ye,M,A),ue.fillText(y,ye,ye+E);const Ue=ue.getImageData(ye,ye,M,A);Te.fill(Me,0,q),se.fill(0,0,q);for(let we=0;we0?$e*$e:0,se[He]=$e<0?$e*$e:0}}ft(Te,0,0,R,V,R,this.f,this.v,this.z),ft(se,ye,ye,M,A,R,this.f,this.v,this.z);for(let we=0;we1&&(A=o[++M]);const V=Math.abs(R-A.left),q=Math.abs(R-A.right),Q=Math.min(V,q);let he;const ue=v/p*(m+1);if(A.isDash){const ye=m-Math.abs(ue);he=Math.sqrt(Q*Q+ye*ye)}else he=m-Math.sqrt(Q*Q+ue*ue);this.data[E+R]=Math.max(0,Math.min(255,he+128))}}}addRegularDash(o){for(let M=o.length-1;M>=0;--M){const A=o[M],R=o[M+1];A.zeroLength?o.splice(M,1):R&&R.isDash===A.isDash&&(R.left=A.left,o.splice(M,1))}const h=o[0],p=o[o.length-1];h.isDash===p.isDash&&(h.left=p.left-this.width,p.right=h.right+this.width);const m=this.width*this.nextRow;let v=0,E=o[v];for(let M=0;M1&&(E=o[++v]);const A=Math.abs(M-E.left),R=Math.abs(M-E.right),V=Math.min(A,R);this.data[m+M]=Math.max(0,Math.min(255,(E.isDash?V:-V)+128))}}addDash(o,h){const p=h?7:0,m=2*p+1;if(this.nextRow+m>this.height)return a.w("LineAtlas out of space"),null;let v=0;for(let M=0;M{h.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Vt]}numActive(){return Object.keys(this.active).length}}const fr=Math.floor(k.hardwareConcurrency/2);let er,Nt;function nr(){return er||(er=new sr),er}sr.workerCount=a.B(globalThis)?Math.max(Math.min(fr,3),1):1;class tr{constructor(o,h){this.workerPool=o,this.actors=[],this.currentActor=0,this.id=h;const p=this.workerPool.acquire(h);for(let m=0;m{h.remove()}),this.actors=[],o&&this.workerPool.release(this.id)}registerMessageHandler(o,h){for(const p of this.actors)p.registerMessageHandler(o,h)}}function Lr(){return Nt||(Nt=new tr(nr(),a.G),Nt.registerMessageHandler("GR",(y,o,h)=>a.m(o,h))),Nt}function Pr(y,o){const h=a.F();return a.H(h,h,[1,1,0]),a.J(h,h,[.5*y.width,.5*y.height,1]),a.K(h,h,y.calculatePosMatrix(o.toUnwrapped()))}function st(y,o,h,p,m,v){const E=function(q,Q,he){if(q)for(const ue of q){const ye=Q[ue];if(ye&&ye.source===he&&ye.type==="fill-extrusion")return!0}else for(const ue in Q){const ye=Q[ue];if(ye.source===he&&ye.type==="fill-extrusion")return!0}return!1}(m&&m.layers,o,y.id),M=v.maxPitchScaleFactor(),A=y.tilesIn(p,M,E);A.sort(Lt);const R=[];for(const q of A)R.push({wrappedTileID:q.tileID.wrapped().key,queryResults:q.tile.queryRenderedFeatures(o,h,y._state,q.queryGeometry,q.cameraQueryGeometry,q.scale,m,v,M,Pr(y.transform,q.tileID))});const V=function(q){const Q={},he={};for(const ue of q){const ye=ue.queryResults,se=ue.wrappedTileID,Te=he[se]=he[se]||{};for(const Ue in ye){const we=ye[Ue],Le=Te[Ue]=Te[Ue]||{},Ge=Q[Ue]=Q[Ue]||[];for(const He of we)Le[He.featureIndex]||(Le[He.featureIndex]=!0,Ge.push(He))}}return Q}(R);for(const q in V)V[q].forEach(Q=>{const he=Q.feature,ue=y.getFeatureState(he.layer["source-layer"],he.id);he.source=he.layer.source,he.layer["source-layer"]&&(he.sourceLayer=he.layer["source-layer"]),he.state=ue});return V}function Lt(y,o){const h=y.tileID,p=o.tileID;return h.overscaledZ-p.overscaledZ||h.canonical.y-p.canonical.y||h.wrap-p.wrap||h.canonical.x-p.canonical.x}function De(y,o,h){return a._(this,void 0,void 0,function*(){let p=y;if(y.url?p=(yield a.h(o.transformRequest(y.url,"Source"),h)).data:yield k.frameAsync(h),!p)return null;const m=a.L(a.e(p,y),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in p&&p.vector_layers&&(m.vectorLayerIds=p.vector_layers.map(v=>v.id)),m})}class at{constructor(o,h){o&&(h?this.setSouthWest(o).setNorthEast(h):Array.isArray(o)&&(o.length===4?this.setSouthWest([o[0],o[1]]).setNorthEast([o[2],o[3]]):this.setSouthWest(o[0]).setNorthEast(o[1])))}setNorthEast(o){return this._ne=o instanceof a.M?new a.M(o.lng,o.lat):a.M.convert(o),this}setSouthWest(o){return this._sw=o instanceof a.M?new a.M(o.lng,o.lat):a.M.convert(o),this}extend(o){const h=this._sw,p=this._ne;let m,v;if(o instanceof a.M)m=o,v=o;else{if(!(o instanceof at))return Array.isArray(o)?o.length===4||o.every(Array.isArray)?this.extend(at.convert(o)):this.extend(a.M.convert(o)):o&&("lng"in o||"lon"in o)&&"lat"in o?this.extend(a.M.convert(o)):this;if(m=o._sw,v=o._ne,!m||!v)return this}return h||p?(h.lng=Math.min(m.lng,h.lng),h.lat=Math.min(m.lat,h.lat),p.lng=Math.max(v.lng,p.lng),p.lat=Math.max(v.lat,p.lat)):(this._sw=new a.M(m.lng,m.lat),this._ne=new a.M(v.lng,v.lat)),this}getCenter(){return new a.M((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 a.M(this.getWest(),this.getNorth())}getSouthEast(){return new a.M(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(o){const{lng:h,lat:p}=a.M.convert(o);let m=this._sw.lng<=h&&h<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=h&&h>=this._ne.lng),this._sw.lat<=p&&p<=this._ne.lat&&m}static convert(o){return o instanceof at?o:o&&new at(o)}static fromLngLat(o,h=0){const p=360*h/40075017,m=p/Math.cos(Math.PI/180*o.lat);return new at(new a.M(o.lng-m,o.lat-p),new a.M(o.lng+m,o.lat+p))}}class tt{constructor(o,h,p){this.bounds=at.convert(this.validateBounds(o)),this.minzoom=h||0,this.maxzoom=p||24}validateBounds(o){return Array.isArray(o)&&o.length===4?[Math.max(-180,o[0]),Math.max(-90,o[1]),Math.min(180,o[2]),Math.min(90,o[3])]:[-180,-90,180,90]}contains(o){const h=Math.pow(2,o.z),p=Math.floor(a.N(this.bounds.getWest())*h),m=Math.floor(a.O(this.bounds.getNorth())*h),v=Math.ceil(a.N(this.bounds.getEast())*h),E=Math.ceil(a.O(this.bounds.getSouth())*h);return o.x>=p&&o.x=m&&o.y{this._options.tiles=o}),this}setUrl(o){return this.setSourceProperty(()=>{this.url=o,this._options.url=o}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return a.e({},this._options)}loadTile(o){return a._(this,void 0,void 0,function*(){const h=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p={request:this.map._requestManager.transformRequest(h,"Tile"),uid:o.uid,tileID:o.tileID,zoom:o.tileID.overscaledZ,tileSize:this.tileSize*o.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};p.request.collectResourceTiming=this._collectResourceTiming;let m="RT";if(o.actor&&o.state!=="expired"){if(o.state==="loading")return new Promise((v,E)=>{o.reloadPromise={resolve:v,reject:E}})}else o.actor=this.dispatcher.getActor(),m="LT";o.abortController=new AbortController;try{const v=yield o.actor.sendAsync({type:m,data:p},o.abortController);if(delete o.abortController,o.aborted)return;this._afterTileLoadWorkerResponse(o,v)}catch(v){if(delete o.abortController,o.aborted)return;if(v&&v.status!==404)throw v;this._afterTileLoadWorkerResponse(o,null)}})}_afterTileLoadWorkerResponse(o,h){if(h&&h.resourceTiming&&(o.resourceTiming=h.resourceTiming),h&&this.map._refreshExpiredTiles&&o.setExpiryData(h),o.loadVectorData(h,this.map.painter),o.reloadPromise){const p=o.reloadPromise;o.reloadPromise=null,this.loadTile(o).then(p.resolve).catch(p.reject)}}abortTile(o){return a._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController),o.actor&&(yield o.actor.sendAsync({type:"AT",data:{uid:o.uid,type:this.type,source:this.id}}))})}unloadTile(o){return a._(this,void 0,void 0,function*(){o.unloadVectorData(),o.actor&&(yield o.actor.sendAsync({type:"RMT",data:{uid:o.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class ne extends a.E{constructor(o,h,p,m){super(),this.id=o,this.dispatcher=p,this.setEventedParent(m),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=a.e({type:"raster"},h),a.e(this,a.L(h,["url","scheme","tileSize"]))}load(){return a._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const o=yield De(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,o&&(a.e(this,o),o.bounds&&(this.tileBounds=new tt(o.bounds,this.minzoom,this.maxzoom)),this.fire(new a.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.k("data",{dataType:"source",sourceDataType:"content"})))}catch(o){this._tileJSONRequest=null,this.fire(new a.j(o))}})}loaded(){return this._loaded}onAdd(o){this.map=o,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(o){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),o(),this.load()}setTiles(o){return this.setSourceProperty(()=>{this._options.tiles=o}),this}setUrl(o){return this.setSourceProperty(()=>{this.url=o,this._options.url=o}),this}serialize(){return a.e({},this._options)}hasTile(o){return!this.tileBounds||this.tileBounds.contains(o.canonical)}loadTile(o){return a._(this,void 0,void 0,function*(){const h=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);o.abortController=new AbortController;try{const p=yield G.getImage(this.map._requestManager.transformRequest(h,"Tile"),o.abortController,this.map._refreshExpiredTiles);if(delete o.abortController,o.aborted)return void(o.state="unloaded");if(p&&p.data){this.map._refreshExpiredTiles&&p.cacheControl&&p.expires&&o.setExpiryData({cacheControl:p.cacheControl,expires:p.expires});const m=this.map.painter.context,v=m.gl,E=p.data;o.texture=this.map.painter.getTileTexture(E.width),o.texture?o.texture.update(E,{useMipmap:!0}):(o.texture=new re(m,E,v.RGBA,{useMipmap:!0}),o.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE,v.LINEAR_MIPMAP_NEAREST),m.extTextureFilterAnisotropic&&v.texParameterf(v.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax)),o.state="loaded"}}catch(p){if(delete o.abortController,o.aborted)o.state="unloaded";else if(p)throw o.state="errored",p}})}abortTile(o){return a._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController)})}unloadTile(o){return a._(this,void 0,void 0,function*(){o.texture&&this.map.painter.saveTileTexture(o.texture)})}hasTransition(){return!1}}class br extends ne{constructor(o,h,p,m){super(o,h,p,m),this.type="raster-dem",this.maxzoom=22,this._options=a.e({type:"raster-dem"},h),this.encoding=h.encoding||"mapbox",this.redFactor=h.redFactor,this.greenFactor=h.greenFactor,this.blueFactor=h.blueFactor,this.baseShift=h.baseShift}loadTile(o){return a._(this,void 0,void 0,function*(){const h=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p=this.map._requestManager.transformRequest(h,"Tile");o.neighboringTiles=this._getNeighboringTiles(o.tileID),o.abortController=new AbortController;try{const m=yield G.getImage(p,o.abortController,this.map._refreshExpiredTiles);if(delete o.abortController,o.aborted)return void(o.state="unloaded");if(m&&m.data){const v=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&o.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const E=a.b(v)&&a.S()?v:yield this.readImageNow(v),M={type:this.type,uid:o.uid,source:this.id,rawImageData:E,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!o.actor||o.state==="expired"){o.actor=this.dispatcher.getActor();const A=yield o.actor.sendAsync({type:"LDT",data:M});o.dem=A,o.needsHillshadePrepare=!0,o.needsTerrainPrepare=!0,o.state="loaded"}}}catch(m){if(delete o.abortController,o.aborted)o.state="unloaded";else if(m)throw o.state="errored",m}})}readImageNow(o){return a._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&a.U()){const h=o.width+2,p=o.height+2;try{return new a.R({width:h,height:p},yield a.V(o,-1,-1,h,p))}catch{}}return k.getImageData(o,1)})}_getNeighboringTiles(o){const h=o.canonical,p=Math.pow(2,h.z),m=(h.x-1+p)%p,v=h.x===0?o.wrap-1:o.wrap,E=(h.x+1+p)%p,M=h.x+1===p?o.wrap+1:o.wrap,A={};return A[new a.Q(o.overscaledZ,v,h.z,m,h.y).key]={backfilled:!1},A[new a.Q(o.overscaledZ,M,h.z,E,h.y).key]={backfilled:!1},h.y>0&&(A[new a.Q(o.overscaledZ,v,h.z,m,h.y-1).key]={backfilled:!1},A[new a.Q(o.overscaledZ,o.wrap,h.z,h.x,h.y-1).key]={backfilled:!1},A[new a.Q(o.overscaledZ,M,h.z,E,h.y-1).key]={backfilled:!1}),h.y+10&&a.e(v,{resourceTiming:m}),this.fire(new a.k("data",Object.assign(Object.assign({},v),{sourceDataType:"metadata"}))),this.fire(new a.k("data",Object.assign(Object.assign({},v),{sourceDataType:"content"})))}catch(p){if(this._pendingLoads--,this._removed)return void this.fire(new a.k("dataabort",{dataType:"source"}));this.fire(new a.j(p))}})}loaded(){return this._pendingLoads===0}loadTile(o){return a._(this,void 0,void 0,function*(){const h=o.actor?"RT":"LT";o.actor=this.actor;const p={type:this.type,uid:o.uid,tileID:o.tileID,zoom:o.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};o.abortController=new AbortController;const m=yield this.actor.sendAsync({type:h,data:p},o.abortController);delete o.abortController,o.unloadVectorData(),o.aborted||o.loadVectorData(m,this.map.painter,h==="RT")})}abortTile(o){return a._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController),o.aborted=!0})}unloadTile(o){return a._(this,void 0,void 0,function*(){o.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:o.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 a.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Ye=a.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class jt extends a.E{constructor(o,h,p,m){super(),this.id=o,this.dispatcher=p,this.coordinates=h.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=h}load(o){return a._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const h=yield G.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,h&&h.data&&(this.image=h.data,o&&(this.coordinates=o),this._finishLoading())}catch(h){this._request=null,this._loaded=!0,this.fire(new a.j(h))}})}loaded(){return this._loaded}updateImage(o){return o.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=o.url,this.load(o.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(o){this.map=o,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(o){this.coordinates=o;const h=o.map(a.Y.fromLngLat);this.tileID=function(m){let v=1/0,E=1/0,M=-1/0,A=-1/0;for(const Q of m)v=Math.min(v,Q.x),E=Math.min(E,Q.y),M=Math.max(M,Q.x),A=Math.max(A,Q.y);const R=Math.max(M-v,A-E),V=Math.max(0,Math.floor(-Math.log(R)/Math.LN2)),q=Math.pow(2,V);return new a.a0(V,Math.floor((v+M)/2*q),Math.floor((E+A)/2*q))}(h),this.minzoom=this.maxzoom=this.tileID.z;const p=h.map(m=>this.tileID.getTilePoint(m)._round());return this._boundsArray=new a.Z,this._boundsArray.emplaceBack(p[0].x,p[0].y,0,0),this._boundsArray.emplaceBack(p[1].x,p[1].y,a.W,0),this._boundsArray.emplaceBack(p[3].x,p[3].y,0,a.W),this._boundsArray.emplaceBack(p[2].x,p[2].y,a.W,a.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new a.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const o=this.map.painter.context,h=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,Ye.members)),this.boundsSegments||(this.boundsSegments=a.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new re(o,this.image,h.RGBA),this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const v=this.tiles[m];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,p=!0)}p&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(o){return a._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(o.tileID.canonical)?(this.tiles[String(o.tileID.wrap)]=o,o.buckets={}):o.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class bn extends jt{constructor(o,h,p,m){super(o,h,p,m),this.roundZoom=!0,this.type="video",this.options=h}load(){return a._(this,void 0,void 0,function*(){this._loaded=!1;const o=this.options;this.urls=[];for(const h of o.urls)this.urls.push(this.map._requestManager.transformRequest(h,"Source").url);try{const h=yield a.a2(this.urls);if(this._loaded=!0,!h)return;this.video=h,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(h){this.fire(new a.j(h))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(o){if(this.video){const h=this.video.seekable;oh.end(0)?this.fire(new a.j(new a.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${h.start(0)} and ${h.end(0)}-second mark.`))):this.video.currentTime=o}}getVideo(){return this.video}onAdd(o){this.map||(this.map=o,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 o=this.map.painter.context,h=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,Ye.members)),this.boundsSegments||(this.boundsSegments=a.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE),h.texSubImage2D(h.TEXTURE_2D,0,0,0,h.RGBA,h.UNSIGNED_BYTE,this.video)):(this.texture=new re(o,this.video,h.RGBA),this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const v=this.tiles[m];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,p=!0)}p&&this.fire(new a.k("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 wn extends jt{constructor(o,h,p,m){super(o,h,p,m),h.coordinates?Array.isArray(h.coordinates)&&h.coordinates.length===4&&!h.coordinates.some(v=>!Array.isArray(v)||v.length!==2||v.some(E=>typeof E!="number"))||this.fire(new a.j(new a.a1(`sources.${o}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.j(new a.a1(`sources.${o}`,null,'missing required property "coordinates"'))),h.animate&&typeof h.animate!="boolean"&&this.fire(new a.j(new a.a1(`sources.${o}`,null,'optional "animate" property must be a boolean value'))),h.canvas?typeof h.canvas=="string"||h.canvas instanceof HTMLCanvasElement||this.fire(new a.j(new a.a1(`sources.${o}`,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 a.j(new a.a1(`sources.${o}`,null,'missing required property "canvas"'))),this.options=h,this.animate=h.animate===void 0||h.animate}load(){return a._(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 a.j(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(o){this.map=o,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let o=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,o=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,o=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const h=this.map.painter.context,p=h.gl;this.boundsBuffer||(this.boundsBuffer=h.createVertexBuffer(this._boundsArray,Ye.members)),this.boundsSegments||(this.boundsSegments=a.$.simpleSegment(0,0,4,2)),this.texture?(o||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new re(h,this.canvas,p.RGBA,{premultiply:!0});let m=!1;for(const v in this.tiles){const E=this.tiles[v];E.state!=="loaded"&&(E.state="loaded",E.texture=this.texture,m=!0)}m&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const o of[this.canvas.width,this.canvas.height])if(isNaN(o)||o<=0)return!0;return!1}}const Mn={},ni=y=>{switch(y){case"geojson":return We;case"image":return jt;case"raster":return ne;case"raster-dem":return br;case"vector":return it;case"video":return bn;case"canvas":return wn}return Mn[y]},ii="RTLPluginLoaded";class $o extends a.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Lr()}_syncState(o){return this.status=o,this.dispatcher.broadcast("SRPS",{pluginStatus:o,pluginURL:this.url}).catch(h=>{throw this.status="error",h})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(o){return a._(this,arguments,void 0,function*(h,p=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=k.resolveURL(h),!this.url)throw new Error(`requested url ${h} is invalid`);if(this.status==="unavailable"){if(!p)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return a._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new a.k(ii))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Jr=null;function ct(){return Jr||(Jr=new $o),Jr}class Xn{constructor(o,h){this.timeAdded=0,this.fadeEndTime=0,this.tileID=o,this.uid=a.a3(),this.uses=0,this.tileSize=h,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(o){const h=o+this.timeAdded;hv.getLayer(R)).filter(Boolean);if(A.length!==0){M.layers=A,M.stateDependentLayerIds&&(M.stateDependentLayers=M.stateDependentLayerIds.map(R=>A.filter(V=>V.id===R)[0]));for(const R of A)E[R.id]=M}}return E}(o.buckets,h.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const v=this.buckets[m];if(v instanceof a.a5){if(this.hasSymbolBuckets=!0,!p)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const v=this.buckets[m];if(v instanceof a.a5&&v.hasRTLText){this.hasRTLText=!0,ct().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const v=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,h.style.getLayer(m).queryRadius(v))}o.imageAtlas&&(this.imageAtlas=o.imageAtlas),o.glyphAtlasImage&&(this.glyphAtlasImage=o.glyphAtlasImage)}else this.collisionBoxArray=new a.a4}unloadVectorData(){for(const o in this.buckets)this.buckets[o].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(o){return this.buckets[o.id]}upload(o){for(const p in this.buckets){const m=this.buckets[p];m.uploadPending()&&m.upload(o)}const h=o.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new re(o,this.imageAtlas.image,h.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new re(o,this.glyphAtlasImage,h.ALPHA),this.glyphAtlasImage=null)}prepare(o){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(o,this.imageAtlasTexture)}queryRenderedFeatures(o,h,p,m,v,E,M,A,R,V){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:v,scale:E,tileSize:this.tileSize,pixelPosMatrix:V,transform:A,params:M,queryPadding:this.queryPadding*R},o,h,p):{}}querySourceFeatures(o,h){const p=this.latestFeatureIndex;if(!p||!p.rawTileData)return;const m=p.loadVTLayers(),v=h&&h.sourceLayer?h.sourceLayer:"",E=m._geojsonTileLayer||m[v];if(!E)return;const M=a.a6(h&&h.filter),{z:A,x:R,y:V}=this.tileID.canonical,q={z:A,x:R,y:V};for(let Q=0;Qp)m=!1;else if(h)if(this.expirationTime{this.remove(o,v)},p)),this.data[m].push(v),this.order.push(m),this.order.length>this.max){const E=this._getAndRemoveByKey(this.order[0]);E&&this.onRemove(E)}return this}has(o){return o.wrapped().key in this.data}getAndRemove(o){return this.has(o)?this._getAndRemoveByKey(o.wrapped().key):null}_getAndRemoveByKey(o){const h=this.data[o].shift();return h.timeout&&clearTimeout(h.timeout),this.data[o].length===0&&delete this.data[o],this.order.splice(this.order.indexOf(o),1),h.value}getByKey(o){const h=this.data[o];return h?h[0].value:null}get(o){return this.has(o)?this.data[o.wrapped().key][0].value:null}remove(o,h){if(!this.has(o))return this;const p=o.wrapped().key,m=h===void 0?0:this.data[p].indexOf(h),v=this.data[p][m];return this.data[p].splice(m,1),v.timeout&&clearTimeout(v.timeout),this.data[p].length===0&&delete this.data[p],this.onRemove(v.value),this.order.splice(this.order.indexOf(p),1),this}setMaxSize(o){for(this.max=o;this.order.length>this.max;){const h=this._getAndRemoveByKey(this.order[0]);h&&this.onRemove(h)}return this}filter(o){const h=[];for(const p in this.data)for(const m of this.data[p])o(m.value)||h.push(m);for(const p of h)this.remove(p.value.tileID,p)}}class Bo{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(o,h,p){const m=String(h);if(this.stateChanges[o]=this.stateChanges[o]||{},this.stateChanges[o][m]=this.stateChanges[o][m]||{},a.e(this.stateChanges[o][m],p),this.deletedStates[o]===null){this.deletedStates[o]={};for(const v in this.state[o])v!==m&&(this.deletedStates[o][v]=null)}else if(this.deletedStates[o]&&this.deletedStates[o][m]===null){this.deletedStates[o][m]={};for(const v in this.state[o][m])p[v]||(this.deletedStates[o][m][v]=null)}else for(const v in p)this.deletedStates[o]&&this.deletedStates[o][m]&&this.deletedStates[o][m][v]===null&&delete this.deletedStates[o][m][v]}removeFeatureState(o,h,p){if(this.deletedStates[o]===null)return;const m=String(h);if(this.deletedStates[o]=this.deletedStates[o]||{},p&&h!==void 0)this.deletedStates[o][m]!==null&&(this.deletedStates[o][m]=this.deletedStates[o][m]||{},this.deletedStates[o][m][p]=null);else if(h!==void 0)if(this.stateChanges[o]&&this.stateChanges[o][m])for(p in this.deletedStates[o][m]={},this.stateChanges[o][m])this.deletedStates[o][m][p]=null;else this.deletedStates[o][m]=null;else this.deletedStates[o]=null}getState(o,h){const p=String(h),m=a.e({},(this.state[o]||{})[p],(this.stateChanges[o]||{})[p]);if(this.deletedStates[o]===null)return{};if(this.deletedStates[o]){const v=this.deletedStates[o][h];if(v===null)return{};for(const E in v)delete m[E]}return m}initializeTileState(o,h){o.setFeatureState(this.state,h)}coalesceChanges(o,h){const p={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const v={};for(const E in this.stateChanges[m])this.state[m][E]||(this.state[m][E]={}),a.e(this.state[m][E],this.stateChanges[m][E]),v[E]=this.state[m][E];p[m]=v}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const v={};if(this.deletedStates[m]===null)for(const E in this.state[m])v[E]={},this.state[m][E]={};else for(const E in this.deletedStates[m]){if(this.deletedStates[m][E]===null)this.state[m][E]={};else for(const M of Object.keys(this.deletedStates[m][E]))delete this.state[m][E][M];v[E]=this.state[m][E]}p[m]=p[m]||{},a.e(p[m],v)}if(this.stateChanges={},this.deletedStates={},Object.keys(p).length!==0)for(const m in o)o[m].setFeatureState(p,h)}}class Or extends a.E{constructor(o,h,p){super(),this.id=o,this.dispatcher=p,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,v,E,M)=>{const A=new(ni(v.type))(m,v,E,M);if(A.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${A.id}`);return A})(o,h,p,this),this._tiles={},this._cache=new xn(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Bo,this._didEmitContent=!1,this._updated=!1}onAdd(o){this.map=o,this._maxTileCacheSize=o?o._maxTileCacheSize:null,this._maxTileCacheZoomLevels=o?o._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(o)}onRemove(o){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(o)}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 o in this._tiles){const h=this._tiles[o];if(h.state!=="loaded"&&h.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const o=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,o&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(o,h,p){return a._(this,void 0,void 0,function*(){try{yield this._source.loadTile(o),this._tileLoaded(o,h,p)}catch(m){o.state="errored",m.status!==404?this._source.fire(new a.j(m,{tile:o})):this.update(this.transform,this.terrain)}})}_unloadTile(o){this._source.unloadTile&&this._source.unloadTile(o)}_abortTile(o){this._source.abortTile&&this._source.abortTile(o),this._source.fire(new a.k("dataabort",{tile:o,coord:o.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(o){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const h in this._tiles){const p=this._tiles[h];p.upload(o),p.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(o=>o.tileID).sort(mt).map(o=>o.key)}getRenderableIds(o){const h=[];for(const p in this._tiles)this._isIdRenderable(p,o)&&h.push(this._tiles[p]);return o?h.sort((p,m)=>{const v=p.tileID,E=m.tileID,M=new a.P(v.canonical.x,v.canonical.y)._rotate(this.transform.angle),A=new a.P(E.canonical.x,E.canonical.y)._rotate(this.transform.angle);return v.overscaledZ-E.overscaledZ||A.y-M.y||A.x-M.x}).map(p=>p.tileID.key):h.map(p=>p.tileID).sort(mt).map(p=>p.key)}hasRenderableParent(o){const h=this.findLoadedParent(o,0);return!!h&&this._isIdRenderable(h.tileID.key)}_isIdRenderable(o,h){return this._tiles[o]&&this._tiles[o].hasData()&&!this._coveredTiles[o]&&(h||!this._tiles[o].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const o in this._tiles)this._tiles[o].state!=="errored"&&this._reloadTile(o,"reloading")}}_reloadTile(o,h){return a._(this,void 0,void 0,function*(){const p=this._tiles[o];p&&(p.state!=="loading"&&(p.state=h),yield this._loadTile(p,o,h))})}_tileLoaded(o,h,p){o.timeAdded=k.now(),p==="expired"&&(o.refreshedUponExpiration=!0),this._setTileReloadTimer(h,o),this.getSource().type==="raster-dem"&&o.dem&&this._backfillDEM(o),this._state.initializeTileState(o,this.map?this.map.painter:null),o.aborted||this._source.fire(new a.k("data",{dataType:"source",tile:o,coord:o.tileID}))}_backfillDEM(o){const h=this.getRenderableIds();for(let m=0;m1||(Math.abs(E)>1&&(Math.abs(E+A)===1?E+=A:Math.abs(E-A)===1&&(E-=A)),v.dem&&m.dem&&(m.dem.backfillBorder(v.dem,E,M),m.neighboringTiles&&m.neighboringTiles[R]&&(m.neighboringTiles[R].backfilled=!0)))}}getTile(o){return this.getTileByID(o.key)}getTileByID(o){return this._tiles[o]}_retainLoadedChildren(o,h,p,m){for(const v in this._tiles){let E=this._tiles[v];if(m[v]||!E.hasData()||E.tileID.overscaledZ<=h||E.tileID.overscaledZ>p)continue;let M=E.tileID;for(;E&&E.tileID.overscaledZ>h+1;){const R=E.tileID.scaledTo(E.tileID.overscaledZ-1);E=this._tiles[R.key],E&&E.hasData()&&(M=R)}let A=M;for(;A.overscaledZ>h;)if(A=A.scaledTo(A.overscaledZ-1),o[A.key]){m[M.key]=M;break}}}findLoadedParent(o,h){if(o.key in this._loadedParentTiles){const p=this._loadedParentTiles[o.key];return p&&p.tileID.overscaledZ>=h?p:null}for(let p=o.overscaledZ-1;p>=h;p--){const m=o.scaledTo(p),v=this._getLoadedTile(m);if(v)return v}}_getLoadedTile(o){const h=this._tiles[o.key];return h&&h.hasData()?h:this._cache.getByKey(o.wrapped().key)}updateCacheSize(o){const h=Math.ceil(o.width/this._source.tileSize)+1,p=Math.ceil(o.height/this._source.tileSize)+1,m=Math.floor(h*p*(this._maxTileCacheZoomLevels===null?a.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),v=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(v)}handleWrapJump(o){const h=Math.round((o-(this._prevLng===void 0?o:this._prevLng))/360);if(this._prevLng=o,h){const p={};for(const m in this._tiles){const v=this._tiles[m];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+h),p[v.tileID.key]=v}this._tiles=p;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}update(o,h){if(!this._sourceLoaded||this._paused)return;let p;this.transform=o,this.terrain=h,this.updateCacheSize(o),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?p=o.getVisibleUnwrappedCoordinates(this._source.tileID).map(V=>new a.Q(V.canonical.z,V.wrap,V.canonical.z,V.canonical.x,V.canonical.y)):(p=o.coveringTiles({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:h}),this._source.hasTile&&(p=p.filter(V=>this._source.hasTile(V)))):p=[];const m=o.coveringZoomLevel(this._source),v=Math.max(m-Or.maxOverzooming,this._source.minzoom),E=Math.max(m+Or.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const V={};for(const q of p)if(q.canonical.z>this._source.minzoom){const Q=q.scaledTo(q.canonical.z-1);V[Q.key]=Q;const he=q.scaledTo(Math.max(this._source.minzoom,Math.min(q.canonical.z,5)));V[he.key]=he}p=p.concat(Object.values(V))}const M=p.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,M&&this.fire(new a.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const A=this._updateRetainedTiles(p,m);if(rr(this._source.type)){const V={},q={},Q=Object.keys(A),he=k.now();for(const ue of Q){const ye=A[ue],se=this._tiles[ue];if(!se||se.fadeEndTime!==0&&se.fadeEndTime<=he)continue;const Te=this.findLoadedParent(ye,v);Te&&(this._addTile(Te.tileID),V[Te.tileID.key]=Te.tileID),q[ue]=ye}this._retainLoadedChildren(q,m,E,A);for(const ue in V)A[ue]||(this._coveredTiles[ue]=!0,A[ue]=V[ue]);if(h){const ue={},ye={};for(const se of p)this._tiles[se.key].hasData()?ue[se.key]=se:ye[se.key]=se;for(const se in ye){const Te=ye[se].children(this._source.maxzoom);this._tiles[Te[0].key]&&this._tiles[Te[1].key]&&this._tiles[Te[2].key]&&this._tiles[Te[3].key]&&(ue[Te[0].key]=A[Te[0].key]=Te[0],ue[Te[1].key]=A[Te[1].key]=Te[1],ue[Te[2].key]=A[Te[2].key]=Te[2],ue[Te[3].key]=A[Te[3].key]=Te[3],delete ye[se])}for(const se in ye){const Te=this.findLoadedParent(ye[se],this._source.minzoom);if(Te){ue[Te.tileID.key]=A[Te.tileID.key]=Te.tileID;for(const Ue in ue)ue[Ue].isChildOf(Te.tileID)&&delete ue[Ue]}}for(const se in this._tiles)ue[se]||(this._coveredTiles[se]=!0)}}for(const V in A)this._tiles[V].clearFadeHold();const R=a.ab(this._tiles,A);for(const V of R){const q=this._tiles[V];q.hasSymbolBuckets&&!q.holdingForFade()?q.setHoldDuration(this.map._fadeDuration):q.hasSymbolBuckets&&!q.symbolFadeFinished()||this._removeTile(V)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const o in this._tiles)this._tiles[o].holdingForFade()&&this._removeTile(o)}_updateRetainedTiles(o,h){const p={},m={},v=Math.max(h-Or.maxOverzooming,this._source.minzoom),E=Math.max(h+Or.maxUnderzooming,this._source.minzoom),M={};for(const A of o){const R=this._addTile(A);p[A.key]=A,R.hasData()||hthis._source.maxzoom){const q=A.children(this._source.maxzoom)[0],Q=this.getTile(q);if(Q&&Q.hasData()){p[q.key]=q;continue}}else{const q=A.children(this._source.maxzoom);if(p[q[0].key]&&p[q[1].key]&&p[q[2].key]&&p[q[3].key])continue}let V=R.wasRequested();for(let q=A.overscaledZ-1;q>=v;--q){const Q=A.scaledTo(q);if(m[Q.key])break;if(m[Q.key]=!0,R=this.getTile(Q),!R&&V&&(R=this._addTile(Q)),R){const he=R.hasData();if((V||he)&&(p[Q.key]=Q),V=R.wasRequested(),he)break}}}return p}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const o in this._tiles){const h=[];let p,m=this._tiles[o].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){p=this._loadedParentTiles[m.key];break}h.push(m.key);const v=m.scaledTo(m.overscaledZ-1);if(p=this._getLoadedTile(v),p)break;m=v}for(const v of h)this._loadedParentTiles[v]=p}}_addTile(o){let h=this._tiles[o.key];if(h)return h;h=this._cache.getAndRemove(o),h&&(this._setTileReloadTimer(o.key,h),h.tileID=o,this._state.initializeTileState(h,this.map?this.map.painter:null),this._cacheTimers[o.key]&&(clearTimeout(this._cacheTimers[o.key]),delete this._cacheTimers[o.key],this._setTileReloadTimer(o.key,h)));const p=h;return h||(h=new Xn(o,this._source.tileSize*o.overscaleFactor()),this._loadTile(h,o.key,h.state)),h.uses++,this._tiles[o.key]=h,p||this._source.fire(new a.k("dataloading",{tile:h,coord:h.tileID,dataType:"source"})),h}_setTileReloadTimer(o,h){o in this._timers&&(clearTimeout(this._timers[o]),delete this._timers[o]);const p=h.getExpiryTimeout();p&&(this._timers[o]=setTimeout(()=>{this._reloadTile(o,"expired"),delete this._timers[o]},p))}_removeTile(o){const h=this._tiles[o];h&&(h.uses--,delete this._tiles[o],this._timers[o]&&(clearTimeout(this._timers[o]),delete this._timers[o]),h.uses>0||(h.hasData()&&h.state!=="reloading"?this._cache.add(h.tileID,h,h.getExpiryTimeout()):(h.aborted=!0,this._abortTile(h),this._unloadTile(h))))}_dataHandler(o){const h=o.sourceDataType;o.dataType==="source"&&h==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&o.dataType==="source"&&h==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const o in this._tiles)this._removeTile(o);this._cache.reset()}tilesIn(o,h,p){const m=[],v=this.transform;if(!v)return m;const E=p?v.getCameraQueryGeometry(o):o,M=o.map(ue=>v.pointCoordinate(ue,this.terrain)),A=E.map(ue=>v.pointCoordinate(ue,this.terrain)),R=this.getIds();let V=1/0,q=1/0,Q=-1/0,he=-1/0;for(const ue of A)V=Math.min(V,ue.x),q=Math.min(q,ue.y),Q=Math.max(Q,ue.x),he=Math.max(he,ue.y);for(let ue=0;ue=0&&we[1].y+Ue>=0){const Le=M.map(He=>se.getTilePoint(He)),Ge=A.map(He=>se.getTilePoint(He));m.push({tile:ye,tileID:se,queryGeometry:Le,cameraQueryGeometry:Ge,scale:Te})}}return m}getVisibleCoordinates(o){const h=this.getRenderableIds(o).map(p=>this._tiles[p].tileID);for(const p of h)p.posMatrix=this.transform.calculatePosMatrix(p.toUnwrapped());return h}hasTransition(){if(this._source.hasTransition())return!0;if(rr(this._source.type)){const o=k.now();for(const h in this._tiles)if(this._tiles[h].fadeEndTime>=o)return!0}return!1}setFeatureState(o,h,p){this._state.updateState(o=o||"_geojsonTileLayer",h,p)}removeFeatureState(o,h,p){this._state.removeFeatureState(o=o||"_geojsonTileLayer",h,p)}getFeatureState(o,h){return this._state.getState(o=o||"_geojsonTileLayer",h)}setDependencies(o,h,p){const m=this._tiles[o];m&&m.setDependencies(h,p)}reloadTilesForDependencies(o,h){for(const p in this._tiles)this._tiles[p].hasDependency(o,h)&&this._reloadTile(p,"reloading");this._cache.filter(p=>!p.hasDependency(o,h))}}function mt(y,o){const h=Math.abs(2*y.wrap)-+(y.wrap<0),p=Math.abs(2*o.wrap)-+(o.wrap<0);return y.overscaledZ-o.overscaledZ||p-h||o.canonical.y-y.canonical.y||o.canonical.x-y.canonical.x}function rr(y){return y==="raster"||y==="image"||y==="video"}Or.maxOverzooming=10,Or.maxUnderzooming=3;class Jt{constructor(o,h){this.reset(o,h)}reset(o,h){this.points=o||[],this._distances=[0];for(let p=1;p0?(m-E)/M:0;return this.points[v].mult(1-A).add(this.points[h].mult(A))}}function Nr(y,o){let h=!0;return y==="always"||y!=="never"&&o!=="never"||(h=!1),h}class vi{constructor(o,h,p){const m=this.boxCells=[],v=this.circleCells=[];this.xCellCount=Math.ceil(o/p),this.yCellCount=Math.ceil(h/p);for(let E=0;Ethis.width||m<0||h>this.height)return[];const A=[];if(o<=0&&h<=0&&this.width<=p&&this.height<=m){if(v)return[{key:null,x1:o,y1:h,x2:p,y2:m}];for(let R=0;R0}hitTestCircle(o,h,p,m,v){const E=o-p,M=o+p,A=h-p,R=h+p;if(M<0||E>this.width||R<0||A>this.height)return!1;const V=[];return this._forEachCell(E,A,M,R,this._queryCellCircle,V,{hitTest:!0,overlapMode:m,circle:{x:o,y:h,radius:p},seenUids:{box:{},circle:{}}},v),V.length>0}_queryCell(o,h,p,m,v,E,M,A){const{seenUids:R,hitTest:V,overlapMode:q}=M,Q=this.boxCells[v];if(Q!==null){const ue=this.bboxes;for(const ye of Q)if(!R.box[ye]){R.box[ye]=!0;const se=4*ye,Te=this.boxKeys[ye];if(o<=ue[se+2]&&h<=ue[se+3]&&p>=ue[se+0]&&m>=ue[se+1]&&(!A||A(Te))&&(!V||!Nr(q,Te.overlapMode))&&(E.push({key:Te,x1:ue[se],y1:ue[se+1],x2:ue[se+2],y2:ue[se+3]}),V))return!0}}const he=this.circleCells[v];if(he!==null){const ue=this.circles;for(const ye of he)if(!R.circle[ye]){R.circle[ye]=!0;const se=3*ye,Te=this.circleKeys[ye];if(this._circleAndRectCollide(ue[se],ue[se+1],ue[se+2],o,h,p,m)&&(!A||A(Te))&&(!V||!Nr(q,Te.overlapMode))){const Ue=ue[se],we=ue[se+1],Le=ue[se+2];if(E.push({key:Te,x1:Ue-Le,y1:we-Le,x2:Ue+Le,y2:we+Le}),V)return!0}}}return!1}_queryCellCircle(o,h,p,m,v,E,M,A){const{circle:R,seenUids:V,overlapMode:q}=M,Q=this.boxCells[v];if(Q!==null){const ue=this.bboxes;for(const ye of Q)if(!V.box[ye]){V.box[ye]=!0;const se=4*ye,Te=this.boxKeys[ye];if(this._circleAndRectCollide(R.x,R.y,R.radius,ue[se+0],ue[se+1],ue[se+2],ue[se+3])&&(!A||A(Te))&&!Nr(q,Te.overlapMode))return E.push(!0),!0}}const he=this.circleCells[v];if(he!==null){const ue=this.circles;for(const ye of he)if(!V.circle[ye]){V.circle[ye]=!0;const se=3*ye,Te=this.circleKeys[ye];if(this._circlesCollide(ue[se],ue[se+1],ue[se+2],R.x,R.y,R.radius)&&(!A||A(Te))&&!Nr(q,Te.overlapMode))return E.push(!0),!0}}}_forEachCell(o,h,p,m,v,E,M,A){const R=this._convertToXCellCoord(o),V=this._convertToYCellCoord(h),q=this._convertToXCellCoord(p),Q=this._convertToYCellCoord(m);for(let he=R;he<=q;he++)for(let ue=V;ue<=Q;ue++)if(v.call(this,o,h,p,m,this.xCellCount*ue+he,E,M,A))return}_convertToXCellCoord(o){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(o*this.xScale)))}_convertToYCellCoord(o){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(o*this.yScale)))}_circlesCollide(o,h,p,m,v,E){const M=m-o,A=v-h,R=p+E;return R*R>M*M+A*A}_circleAndRectCollide(o,h,p,m,v,E,M){const A=(E-m)/2,R=Math.abs(o-(m+A));if(R>A+p)return!1;const V=(M-v)/2,q=Math.abs(h-(v+V));if(q>V+p)return!1;if(R<=A||q<=V)return!0;const Q=R-A,he=q-V;return Q*Q+he*he<=p*p}}function Qt(y,o,h,p,m){const v=a.F();return o?(a.J(v,v,[1/m,1/m,1]),h||a.ad(v,v,p.angle)):a.K(v,p.labelPlaneMatrix,y),v}function ro(y,o,h,p,m){if(o){const v=a.ae(y);return a.J(v,v,[m,m,1]),h||a.ad(v,v,-p.angle),v}return p.glCoordMatrix}function an(y,o,h){let p;h?(p=[y.x,y.y,h(y.x,y.y),1],a.af(p,p,o)):(p=[y.x,y.y,0,1],Xe(p,p,o));const m=p[3];return{point:new a.P(p[0]/m,p[1]/m),signedDistanceFromCamera:m}}function pe(y,o){return .5+y/o*.5}function Z(y,o){const h=y[0]/y[3],p=y[1]/y[3];return h>=-o[0]&&h<=o[0]&&p>=-o[1]&&p<=o[1]}function $(y,o,h,p,m,v,E,M,A,R){const V=p?y.textSizeData:y.iconSizeData,q=a.ag(V,h.transform.zoom),Q=[256/h.width*2+1,256/h.height*2+1],he=p?y.text.dynamicLayoutVertexArray:y.icon.dynamicLayoutVertexArray;he.clear();const ue=y.lineVertexArray,ye=p?y.text.placedSymbolArray:y.icon.placedSymbolArray,se=h.transform.width/h.transform.height;let Te=!1;for(let Ue=0;UeMath.abs(h.x-o.x)*p?{useVertical:!0}:(y===a.ah.vertical?o.yh.x)?{needsFlipping:!0}:null}function Ce(y,o,h,p,m,v,E,M,A,R,V,q,Q,he,ue,ye){const se=o/24,Te=y.lineOffsetX*se,Ue=y.lineOffsetY*se;let we;if(y.numGlyphs>1){const Le=y.glyphStartIndex+y.numGlyphs,Ge=y.lineStartIndex,He=y.lineStartIndex+y.lineLength,$e=te(se,M,Te,Ue,h,V,q,y,A,v,Q,ue,ye);if(!$e)return{notEnoughRoom:!0};const nt=an($e.first.point,E,ye).point,et=an($e.last.point,E,ye).point;if(p&&!h){const dt=le(y.writingMode,nt,et,he);if(dt)return dt}we=[$e.first];for(let dt=y.glyphStartIndex+1;dt0?nt.point:Ie(q,$e,Ge,1,m,ye),dt=le(y.writingMode,Ge,et,he);if(dt)return dt}const Le=Be(se*M.getoffsetX(y.glyphStartIndex),Te,Ue,h,V,q,y.segment,y.lineStartIndex,y.lineStartIndex+y.lineLength,A,v,Q,ue,ye);if(!Le)return{notEnoughRoom:!0};we=[Le]}for(const Le of we)a.aj(R,Le.point,Le.angle);return{}}function Ie(y,o,h,p,m,v){const E=an(y.add(y.sub(o)._unit()),m,v).point,M=h.sub(E);return h.add(M._mult(p/M.mag()))}function Pe(y,o){const{projectionCache:h,lineVertexArray:p,labelPlaneMatrix:m,tileAnchorPoint:v,distanceFromAnchor:E,getElevation:M,previousVertex:A,direction:R,absOffsetX:V}=o;if(h.projections[y])return h.projections[y];const q=new a.P(p.getx(y),p.gety(y)),Q=an(q,m,M);if(Q.signedDistanceFromCamera>0)return h.projections[y]=Q.point,Q.point;const he=y-R;return Ie(E===0?v:new a.P(p.getx(he),p.gety(he)),q,A,V-E+1,m,M)}function Se(y,o,h){return y._unit()._perp()._mult(o*h)}function W(y,o,h,p,m,v,E,M){const{projectionCache:A,direction:R}=M;if(A.offsets[y])return A.offsets[y];const V=h.add(o);if(y+R=m)return A.offsets[y]=V,V;const q=Pe(y+R,M),Q=Se(q.sub(h),E,R),he=h.add(Q),ue=q.add(Q);return A.offsets[y]=a.ak(v,V,he,ue)||V,A.offsets[y]}function Be(y,o,h,p,m,v,E,M,A,R,V,q,Q,he){const ue=p?y-o:y+o;let ye=ue>0?1:-1,se=0;p&&(ye*=-1,se=Math.PI),ye<0&&(se+=Math.PI);let Te,Ue,we=ye>0?M+E:M+E+1,Le=m,Ge=m,He=0,$e=0;const nt=Math.abs(ue),et=[];let dt;for(;He+$e<=nt;){if(we+=ye,we=A)return null;He+=$e,Ge=Le,Ue=Te;const _t={projectionCache:q,lineVertexArray:R,labelPlaneMatrix:V,tileAnchorPoint:v,distanceFromAnchor:He,getElevation:he,previousVertex:Ge,direction:ye,absOffsetX:nt};if(Le=Pe(we,_t),h===0)et.push(Ge),dt=Le.sub(Ge);else{let Xt;const or=Le.sub(Ge);Xt=or.mag()===0?Se(Pe(we+ye,_t).sub(Le),h,ye):Se(or,h,ye),Ue||(Ue=Ge.add(Xt)),Te=W(we,Xt,Le,M,A,Ue,h,_t),et.push(Ue),dt=Te.sub(Ue)}$e=dt.mag()}const gt=dt._mult((nt-He)/$e)._add(Ue||Ge),ir=se+Math.atan2(Le.y-Ge.y,Le.x-Ge.x);return et.push(gt),{point:gt,angle:Q?ir:0,path:et}}const Fe=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function qe(y,o){for(let h=0;h=1;cr--)or.push(_t.path[cr]);for(let cr=1;cran(dr,A,ue));or=cr.some(dr=>dr.signedDistanceFromCamera<=0)?[]:cr.map(dr=>dr.point)}let Yt=[];if(or.length>0){const cr=or[0].clone(),dr=or[0].clone();for(let hn=1;hn=dt.x&&dr.x<=gt.x&&cr.y>=dt.y&&dr.y<=gt.y?[or]:dr.xgt.x||dr.ygt.y?[]:a.al([or],dt.x,dt.y,gt.x,gt.y)}for(const cr of Yt){ir.reset(cr,.25*et);let dr=0;dr=ir.length<=.5*et?1:Math.ceil(ir.paddedLength/xr)+1;for(let hn=0;hn=this.screenRightBoundary||mthis.screenBottomBoundary}isInsideGrid(o,h,p,m){return p>=0&&o=0&&hp.collisionGroupID===h}}return this.collisionGroups[o]}}function Bn(y,o,h,p,m){const{horizontalAlign:v,verticalAlign:E}=a.at(y);return new a.P(-(v-.5)*o+p[0]*m,-(E-.5)*h+p[1]*m)}function fi(y,o,h,p,m,v){const{x1:E,x2:M,y1:A,y2:R,anchorPointX:V,anchorPointY:q}=y,Q=new a.P(o,h);return p&&Q._rotate(m?v:-v),{x1:E+Q.x,y1:A+Q.y,x2:M+Q.x,y2:R+Q.y,anchorPointX:V,anchorPointY:q}}class bi{constructor(o,h,p,m,v){this.transform=o.clone(),this.terrain=h,this.collisionIndex=new Pt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=p,this.retainedQueryData={},this.collisionGroups=new ln(m),this.collisionCircleArrays={},this.prevPlacement=v,v&&(v.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(o,h,p,m){const v=p.getBucket(h),E=p.latestFeatureIndex;if(!v||!E||h.id!==v.layerIds[0])return;const M=p.collisionBoxArray,A=v.layers[0].layout,R=Math.pow(2,this.transform.zoom-p.tileID.overscaledZ),V=p.tileSize/a.W,q=this.transform.calculatePosMatrix(p.tileID.toUnwrapped()),Q=A.get("text-pitch-alignment")==="map",he=A.get("text-rotation-alignment")==="map",ue=$t(p,1,this.transform.zoom),ye=Qt(q,Q,he,this.transform,ue);let se=null;if(Q){const Ue=ro(q,Q,he,this.transform,ue);se=a.K([],this.transform.labelPlaneMatrix,Ue)}this.retainedQueryData[v.bucketInstanceId]=new lr(v.bucketInstanceId,E,v.sourceLayerIndex,v.index,p.tileID);const Te={bucket:v,layout:A,posMatrix:q,textLabelPlaneMatrix:ye,labelToScreenMatrix:se,scale:R,textPixelRatio:V,holdingForFade:p.holdingForFade(),collisionBoxArray:M,partiallyEvaluatedTextSize:a.ag(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(m)for(const Ue of v.sortKeyRanges){const{sortKey:we,symbolInstanceStart:Le,symbolInstanceEnd:Ge}=Ue;o.push({sortKey:we,symbolInstanceStart:Le,symbolInstanceEnd:Ge,parameters:Te})}else o.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:Te})}attemptAnchorPlacement(o,h,p,m,v,E,M,A,R,V,q,Q,he,ue,ye,se){const Te=a.ap[o.textAnchor],Ue=[o.textOffset0,o.textOffset1],we=Bn(Te,p,m,Ue,v),Le=this.collisionIndex.placeCollisionBox(fi(h,we.x,we.y,E,M,this.transform.angle),q,A,R,V.predicate,se);if((!ye||this.collisionIndex.placeCollisionBox(fi(ye,we.x,we.y,E,M,this.transform.angle),q,A,R,V.predicate,se).box.length!==0)&&Le.box.length>0){let Ge;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID].text&&(Ge=this.prevPlacement.variableOffsets[Q.crossTileID].anchor),Q.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Q.crossTileID]={textOffset:Ue,width:p,height:m,anchor:Te,textBoxScale:v,prevAnchor:Ge},this.markUsedJustification(he,Te,Q,ue),he.allowVerticalPlacement&&(this.markUsedOrientation(he,ue,Q),this.placedOrientations[Q.crossTileID]=ue),{shift:we,placedGlyphBoxes:Le}}}placeLayerBucketPart(o,h,p){const{bucket:m,layout:v,posMatrix:E,textLabelPlaneMatrix:M,labelToScreenMatrix:A,textPixelRatio:R,holdingForFade:V,collisionBoxArray:q,partiallyEvaluatedTextSize:Q,collisionGroup:he}=o.parameters,ue=v.get("text-optional"),ye=v.get("icon-optional"),se=a.aq(v,"text-overlap","text-allow-overlap"),Te=se==="always",Ue=a.aq(v,"icon-overlap","icon-allow-overlap"),we=Ue==="always",Le=v.get("text-rotation-alignment")==="map",Ge=v.get("text-pitch-alignment")==="map",He=v.get("icon-text-fit")!=="none",$e=v.get("symbol-z-order")==="viewport-y",nt=Te&&(we||!m.hasIconData()||ye),et=we&&(Te||!m.hasTextData()||ue);!m.collisionArrays&&q&&m.deserializeCollisionBoxes(q);const dt=this.retainedQueryData[m.bucketInstanceId].tileID,gt=this.terrain?(_t,Xt)=>this.terrain.getElevation(dt,_t,Xt):null,ir=(_t,Xt)=>{var or,xr;if(h[_t.crossTileID])return;if(V)return void(this.placements[_t.crossTileID]=new Yr(!1,!1,!1));let Yt=!1,cr=!1,dr=!0,hn=null,Rr={box:null,offscreen:null},Oi={box:null,offscreen:null},Fn=null,nn=null,On=null,Ni=0,bo=0,ts=0;Xt.textFeatureIndex?Ni=Xt.textFeatureIndex:_t.useRuntimeCollisionCircles&&(Ni=_t.featureIndex),Xt.verticalTextFeatureIndex&&(bo=Xt.verticalTextFeatureIndex);const Za=Xt.textBox;if(Za){const An=Ln=>{let sn=a.ah.horizontal;if(m.allowVerticalPlacement&&!Ln&&this.prevPlacement){const Ji=this.prevPlacement.placedOrientations[_t.crossTileID];Ji&&(this.placedOrientations[_t.crossTileID]=Ji,sn=Ji,this.markUsedOrientation(m,sn,_t))}return sn},on=(Ln,sn)=>{if(m.allowVerticalPlacement&&_t.numVerticalGlyphVertices>0&&Xt.verticalTextBox){for(const Ji of m.writingModes)if(Ji===a.ah.vertical?(Rr=sn(),Oi=Rr):Rr=Ln(),Rr&&Rr.box&&Rr.box.length)break}else Rr=Ln()},en=_t.textAnchorOffsetStartIndex,Ki=_t.textAnchorOffsetEndIndex;if(Ki===en){const Ln=(sn,Ji)=>{const Pn=this.collisionIndex.placeCollisionBox(sn,se,R,E,he.predicate,gt);return Pn&&Pn.box&&Pn.box.length&&(this.markUsedOrientation(m,Ji,_t),this.placedOrientations[_t.crossTileID]=Ji),Pn};on(()=>Ln(Za,a.ah.horizontal),()=>{const sn=Xt.verticalTextBox;return m.allowVerticalPlacement&&_t.numVerticalGlyphVertices>0&&sn?Ln(sn,a.ah.vertical):{box:null,offscreen:null}}),An(Rr&&Rr.box&&Rr.box.length)}else{let Ln=a.ap[(xr=(or=this.prevPlacement)===null||or===void 0?void 0:or.variableOffsets[_t.crossTileID])===null||xr===void 0?void 0:xr.anchor];const sn=(Pn,yn,mu)=>{const ff=Pn.x2-Pn.x1,ws=Pn.y2-Pn.y1,xs=_t.textBoxScale,Wl=He&&Ue==="never"?yn:null;let ns={box:[],offscreen:!1},gu=se==="never"?1:2,df="never";Ln&&gu++;for(let _u=0;_usn(Za,Xt.iconBox,a.ah.horizontal),()=>{const Pn=Xt.verticalTextBox;return m.allowVerticalPlacement&&!(Rr&&Rr.box&&Rr.box.length)&&_t.numVerticalGlyphVertices>0&&Pn?sn(Pn,Xt.verticalIconBox,a.ah.vertical):{box:null,offscreen:null}}),Rr&&(Yt=Rr.box,dr=Rr.offscreen);const Ji=An(Rr&&Rr.box);if(!Yt&&this.prevPlacement){const Pn=this.prevPlacement.variableOffsets[_t.crossTileID];Pn&&(this.variableOffsets[_t.crossTileID]=Pn,this.markUsedJustification(m,Pn.anchor,_t,Ji))}}}if(Fn=Rr,Yt=Fn&&Fn.box&&Fn.box.length>0,dr=Fn&&Fn.offscreen,_t.useRuntimeCollisionCircles){const An=m.text.placedSymbolArray.get(_t.centerJustifiedTextSymbolIndex),on=a.ai(m.textSizeData,Q,An),en=v.get("text-padding");nn=this.collisionIndex.placeCollisionCircles(se,An,m.lineVertexArray,m.glyphOffsetArray,on,E,M,A,p,Ge,he.predicate,_t.collisionCircleDiameter,en,gt),nn.circles.length&&nn.collisionDetected&&!p&&a.w("Collisions detected, but collision boxes are not shown"),Yt=Te||nn.circles.length>0&&!nn.collisionDetected,dr=dr&&nn.offscreen}if(Xt.iconFeatureIndex&&(ts=Xt.iconFeatureIndex),Xt.iconBox){const An=on=>{const en=He&&hn?fi(on,hn.x,hn.y,Le,Ge,this.transform.angle):on;return this.collisionIndex.placeCollisionBox(en,Ue,R,E,he.predicate,gt)};Oi&&Oi.box&&Oi.box.length&&Xt.verticalIconBox?(On=An(Xt.verticalIconBox),cr=On.box.length>0):(On=An(Xt.iconBox),cr=On.box.length>0),dr=dr&&On.offscreen}const rs=ue||_t.numHorizontalGlyphVertices===0&&_t.numVerticalGlyphVertices===0,wo=ye||_t.numIconVertices===0;if(rs||wo?wo?rs||(cr=cr&&Yt):Yt=cr&&Yt:cr=Yt=cr&&Yt,Yt&&Fn&&Fn.box&&this.collisionIndex.insertCollisionBox(Fn.box,se,v.get("text-ignore-placement"),m.bucketInstanceId,Oi&&Oi.box&&bo?bo:Ni,he.ID),cr&&On&&this.collisionIndex.insertCollisionBox(On.box,Ue,v.get("icon-ignore-placement"),m.bucketInstanceId,ts,he.ID),nn&&(Yt&&this.collisionIndex.insertCollisionCircles(nn.circles,se,v.get("text-ignore-placement"),m.bucketInstanceId,Ni,he.ID),p)){const An=m.bucketInstanceId;let on=this.collisionCircleArrays[An];on===void 0&&(on=this.collisionCircleArrays[An]=new Cn);for(let en=0;en=0;--Xt){const or=_t[Xt];ir(m.symbolInstances.get(or),m.collisionArrays[or])}}else for(let _t=o.symbolInstanceStart;_t=0&&(o.text.placedSymbolArray.get(M).crossTileID=v>=0&&M!==v?0:p.crossTileID)}markUsedOrientation(o,h,p){const m=h===a.ah.horizontal||h===a.ah.horizontalOnly?h:0,v=h===a.ah.vertical?h:0,E=[p.leftJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.rightJustifiedTextSymbolIndex];for(const M of E)o.text.placedSymbolArray.get(M).placedOrientation=m;p.verticalPlacedTextSymbolIndex&&(o.text.placedSymbolArray.get(p.verticalPlacedTextSymbolIndex).placedOrientation=v)}commit(o){this.commitTime=o,this.zoomAtLastRecencyCheck=this.transform.zoom;const h=this.prevPlacement;let p=!1;this.prevZoomAdjustment=h?h.zoomAdjustment(this.transform.zoom):0;const m=h?h.symbolFadeChange(o):1,v=h?h.opacities:{},E=h?h.variableOffsets:{},M=h?h.placedOrientations:{};for(const A in this.placements){const R=this.placements[A],V=v[A];V?(this.opacities[A]=new gr(V,m,R.text,R.icon),p=p||R.text!==V.text.placed||R.icon!==V.icon.placed):(this.opacities[A]=new gr(null,m,R.text,R.icon,R.skipFade),p=p||R.text||R.icon)}for(const A in v){const R=v[A];if(!this.opacities[A]){const V=new gr(R,m,!1,!1);V.isHidden()||(this.opacities[A]=V,p=p||R.text.placed||R.icon.placed)}}for(const A in E)this.variableOffsets[A]||!this.opacities[A]||this.opacities[A].isHidden()||(this.variableOffsets[A]=E[A]);for(const A in M)this.placedOrientations[A]||!this.opacities[A]||this.opacities[A].isHidden()||(this.placedOrientations[A]=M[A]);if(h&&h.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");p?this.lastPlacementChangeTime=o:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=h?h.lastPlacementChangeTime:o)}updateLayerOpacities(o,h){const p={};for(const m of h){const v=m.getBucket(o);v&&m.latestFeatureIndex&&o.id===v.layerIds[0]&&this.updateBucketOpacities(v,p,m.collisionBoxArray)}}updateBucketOpacities(o,h,p){o.hasTextData()&&(o.text.opacityVertexArray.clear(),o.text.hasVisibleVertices=!1),o.hasIconData()&&(o.icon.opacityVertexArray.clear(),o.icon.hasVisibleVertices=!1),o.hasIconCollisionBoxData()&&o.iconCollisionBox.collisionVertexArray.clear(),o.hasTextCollisionBoxData()&&o.textCollisionBox.collisionVertexArray.clear();const m=o.layers[0],v=m.layout,E=new gr(null,0,!1,!1,!0),M=v.get("text-allow-overlap"),A=v.get("icon-allow-overlap"),R=m._unevaluatedLayout.hasValue("text-variable-anchor")||m._unevaluatedLayout.hasValue("text-variable-anchor-offset"),V=v.get("text-rotation-alignment")==="map",q=v.get("text-pitch-alignment")==="map",Q=v.get("icon-text-fit")!=="none",he=new gr(null,0,M&&(A||!o.hasIconData()||v.get("icon-optional")),A&&(M||!o.hasTextData()||v.get("text-optional")),!0);!o.collisionArrays&&p&&(o.hasIconCollisionBoxData()||o.hasTextCollisionBoxData())&&o.deserializeCollisionBoxes(p);const ue=(ye,se,Te)=>{for(let Ue=0;Ue0,He=this.placedOrientations[se.crossTileID],$e=He===a.ah.vertical,nt=He===a.ah.horizontal||He===a.ah.horizontalOnly;if(Te>0||Ue>0){const et=wi(Le.text);ue(o.text,Te,$e?ka:et),ue(o.text,Ue,nt?ka:et);const dt=Le.text.isHidden();[se.rightJustifiedTextSymbolIndex,se.centerJustifiedTextSymbolIndex,se.leftJustifiedTextSymbolIndex].forEach(_t=>{_t>=0&&(o.text.placedSymbolArray.get(_t).hidden=dt||$e?1:0)}),se.verticalPlacedTextSymbolIndex>=0&&(o.text.placedSymbolArray.get(se.verticalPlacedTextSymbolIndex).hidden=dt||nt?1:0);const gt=this.variableOffsets[se.crossTileID];gt&&this.markUsedJustification(o,gt.anchor,se,He);const ir=this.placedOrientations[se.crossTileID];ir&&(this.markUsedJustification(o,"left",se,ir),this.markUsedOrientation(o,ir,se))}if(Ge){const et=wi(Le.icon),dt=!(Q&&se.verticalPlacedIconSymbolIndex&&$e);se.placedIconSymbolIndex>=0&&(ue(o.icon,se.numIconVertices,dt?et:ka),o.icon.placedSymbolArray.get(se.placedIconSymbolIndex).hidden=Le.icon.isHidden()),se.verticalPlacedIconSymbolIndex>=0&&(ue(o.icon,se.numVerticalIconVertices,dt?ka:et),o.icon.placedSymbolArray.get(se.verticalPlacedIconSymbolIndex).hidden=Le.icon.isHidden())}if(o.hasIconCollisionBoxData()||o.hasTextCollisionBoxData()){const et=o.collisionArrays[ye];if(et){let dt=new a.P(0,0);if(et.textBox||et.verticalTextBox){let ir=!0;if(R){const _t=this.variableOffsets[we];_t?(dt=Bn(_t.anchor,_t.width,_t.height,_t.textOffset,_t.textBoxScale),V&&dt._rotate(q?this.transform.angle:-this.transform.angle)):ir=!1}et.textBox&&Kn(o.textCollisionBox.collisionVertexArray,Le.text.placed,!ir||$e,dt.x,dt.y),et.verticalTextBox&&Kn(o.textCollisionBox.collisionVertexArray,Le.text.placed,!ir||nt,dt.x,dt.y)}const gt=!!(!nt&&et.verticalIconBox);et.iconBox&&Kn(o.iconCollisionBox.collisionVertexArray,Le.icon.placed,gt,Q?dt.x:0,Q?dt.y:0),et.verticalIconBox&&Kn(o.iconCollisionBox.collisionVertexArray,Le.icon.placed,!gt,Q?dt.x:0,Q?dt.y:0)}}}if(o.sortFeatures(this.transform.angle),this.retainedQueryData[o.bucketInstanceId]&&(this.retainedQueryData[o.bucketInstanceId].featureSortOrder=o.featureSortOrder),o.hasTextData()&&o.text.opacityVertexBuffer&&o.text.opacityVertexBuffer.updateData(o.text.opacityVertexArray),o.hasIconData()&&o.icon.opacityVertexBuffer&&o.icon.opacityVertexBuffer.updateData(o.icon.opacityVertexArray),o.hasIconCollisionBoxData()&&o.iconCollisionBox.collisionVertexBuffer&&o.iconCollisionBox.collisionVertexBuffer.updateData(o.iconCollisionBox.collisionVertexArray),o.hasTextCollisionBoxData()&&o.textCollisionBox.collisionVertexBuffer&&o.textCollisionBox.collisionVertexBuffer.updateData(o.textCollisionBox.collisionVertexArray),o.text.opacityVertexArray.length!==o.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${o.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${o.text.layoutVertexArray.length}) / 4`);if(o.icon.opacityVertexArray.length!==o.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${o.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${o.icon.layoutVertexArray.length}) / 4`);if(o.bucketInstanceId in this.collisionCircleArrays){const ye=this.collisionCircleArrays[o.bucketInstanceId];o.placementInvProjMatrix=ye.invProjMatrix,o.placementViewportMatrix=ye.viewportMatrix,o.collisionCircleArray=ye.circles,delete this.collisionCircleArrays[o.bucketInstanceId]}}symbolFadeChange(o){return this.fadeDuration===0?1:(o-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(o){return Math.max(0,(this.transform.zoom-o)/1.5)}hasTransitions(o){return this.stale||o-this.lastPlacementChangeTimeo}setStale(){this.stale=!0}}function Kn(y,o,h,p,m){y.emplaceBack(o?1:0,h?1:0,p||0,m||0),y.emplaceBack(o?1:0,h?1:0,p||0,m||0),y.emplaceBack(o?1:0,h?1:0,p||0,m||0),y.emplaceBack(o?1:0,h?1:0,p||0,m||0)}const mo=Math.pow(2,25),Ch=Math.pow(2,24),Wd=Math.pow(2,17),zr=Math.pow(2,16),Fc=Math.pow(2,9),Oc=Math.pow(2,8),Ri=Math.pow(2,1);function wi(y){if(y.opacity===0&&!y.placed)return 0;if(y.opacity===1&&y.placed)return 4294967295;const o=y.placed?1:0,h=Math.floor(127*y.opacity);return h*mo+o*Ch+h*Wd+o*zr+h*Fc+o*Oc+h*Ri+o}const ka=0;class $i{constructor(o){this._sortAcrossTiles=o.layout.get("symbol-z-order")!=="viewport-y"&&!o.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(o,h,p,m,v){const E=this._bucketParts;for(;this._currentTileIndexM.sortKey-A.sortKey));this._currentPartIndex!this._forceFullPlacement&&k.now()-m>2;for(;this._currentPlacementIndex>=0;){const E=h[o[this._currentPlacementIndex]],M=this.placement.collisionIndex.transform.zoom;if(E.type==="symbol"&&(!E.minzoom||E.minzoom<=M)&&(!E.maxzoom||E.maxzoom>M)){if(this._inProgressLayer||(this._inProgressLayer=new $i(E)),this._inProgressLayer.continuePlacement(p[E.source],this.placement,this._showCollisionBoxes,E,v))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(o){return this.placement.commit(o),this.placement}}const Ns=512/a.W/2;class sl{constructor(o,h,p){this.tileID=o,this.bucketInstanceId=p,this._symbolsByKey={};const m=new Map;for(let v=0;v({x:Math.floor(A.anchorX*Ns),y:Math.floor(A.anchorY*Ns)})),crossTileIDs:E.map(A=>A.crossTileID)};if(M.positions.length>128){const A=new a.au(M.positions.length,16,Uint16Array);for(const{x:R,y:V}of M.positions)A.add(R,V);A.finish(),delete M.positions,M.index=A}this._symbolsByKey[v]=M}}getScaledCoordinates(o,h){const{x:p,y:m,z:v}=this.tileID.canonical,{x:E,y:M,z:A}=h.canonical,R=Ns/Math.pow(2,A-v),V=(M*a.W+o.anchorY)*R,q=m*a.W*Ns;return{x:Math.floor((E*a.W+o.anchorX)*R-p*a.W*Ns),y:Math.floor(V-q)}}findMatches(o,h,p){const m=this.tileID.canonical.zo)}}class In{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ta{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(o){const h=Math.round((o-this.lng)/360);if(h!==0)for(const p in this.indexes){const m=this.indexes[p],v={};for(const E in m){const M=m[E];M.tileID=M.tileID.unwrapTo(M.tileID.wrap+h),v[M.tileID.key]=M}this.indexes[p]=v}this.lng=o}addBucket(o,h,p){if(this.indexes[o.overscaledZ]&&this.indexes[o.overscaledZ][o.key]){if(this.indexes[o.overscaledZ][o.key].bucketInstanceId===h.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(o.overscaledZ,this.indexes[o.overscaledZ][o.key])}for(let v=0;vo.overscaledZ)for(const M in E){const A=E[M];A.tileID.isChildOf(o)&&A.findMatches(h.symbolInstances,o,m)}else{const M=E[o.scaledTo(Number(v)).key];M&&M.findMatches(h.symbolInstances,o,m)}}for(let v=0;v{h[p]=!0});for(const p in this.layerIndexes)h[p]||delete this.layerIndexes[p]}}const rn=(y,o)=>a.t(y,o&&o.filter(h=>h.identifier!=="source.canvas")),al=a.av();class Bi extends a.E{constructor(o,h={}){super(),this._rtlPluginLoaded=()=>{for(const p in this.sourceCaches){const m=this.sourceCaches[p].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[p].reload()}},this.map=o,this.dispatcher=new tr(nr(),o._getMapId()),this.dispatcher.registerMessageHandler("GG",(p,m)=>this.getGlyphs(p,m)),this.dispatcher.registerMessageHandler("GI",(p,m)=>this.getImages(p,m)),this.imageManager=new Ze,this.imageManager.setEventedParent(this),this.glyphManager=new Ot(o._requestManager,h.localIdeographFontFamily),this.lineAtlas=new At(256,512),this.crossTileSymbolIndex=new Xo,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",a.ax()),ct().on(ii,this._rtlPluginLoaded),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const m=this.sourceCaches[p.sourceId];if(!m)return;const v=m.getSource();if(v&&v.vectorLayerIds)for(const E in this._layers){const M=this._layers[E];M.source===v.id&&this._validateLayer(M)}})}loadURL(o,h={},p){this.fire(new a.k("dataloading",{dataType:"style"})),h.validate=typeof h.validate!="boolean"||h.validate;const m=this.map._requestManager.transformRequest(o,"Style");this._loadStyleRequest=new AbortController,a.h(m,this._loadStyleRequest).then(v=>{this._loadStyleRequest=null,this._load(v.data,h,p)}).catch(v=>{this._loadStyleRequest=null,v&&this.fire(new a.j(v))})}loadJSON(o,h={},p){this.fire(new a.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,k.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,h.validate=h.validate!==!1,this._load(o,h,p)}).catch(()=>{})}loadEmpty(){this.fire(new a.k("dataloading",{dataType:"style"})),this._load(al,{validate:!1})}_load(o,h,p){var m;const v=h.transformStyle?h.transformStyle(p,o):o;if(!h.validate||!rn(this,a.x(v))){this._loaded=!0,this.stylesheet=v;for(const E in v.sources)this.addSource(E,v.sources[E],{validate:!1});v.sprite?this._loadSprite(v.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(v.glyphs),this._createLayers(),this.light=new vt(this.stylesheet.light),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new a.k("data",{dataType:"style"})),this.fire(new a.k("style.load"))}}_createLayers(){const o=a.ay(this.stylesheet.layers);this.dispatcher.broadcast("SL",o),this._order=o.map(h=>h.id),this._layers={},this._serializedLayers=null;for(const h of o){const p=a.az(h);p.setEventedParent(this,{layer:{id:h.id}}),this._layers[h.id]=p}}_loadSprite(o,h=!1,p=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(v,E,M,A){return a._(this,void 0,void 0,function*(){const R=ze(v),V=M>1?"@2x":"",q={},Q={};for(const{id:he,url:ue}of R){const ye=E.transformRequest(E.normalizeSpriteURL(ue,V,".json"),"SpriteJSON");q[he]=a.h(ye,A);const se=E.transformRequest(E.normalizeSpriteURL(ue,V,".png"),"SpriteImage");Q[he]=G.getImage(se,A)}return yield Promise.all([...Object.values(q),...Object.values(Q)]),function(he,ue){return a._(this,void 0,void 0,function*(){const ye={};for(const se in he){ye[se]={};const Te=k.getImageCanvasContext((yield ue[se]).data),Ue=(yield he[se]).data;for(const we in Ue){const{width:Le,height:Ge,x:He,y:$e,sdf:nt,pixelRatio:et,stretchX:dt,stretchY:gt,content:ir}=Ue[we];ye[se][we]={data:null,pixelRatio:et,sdf:nt,stretchX:dt,stretchY:gt,content:ir,spriteData:{width:Le,height:Ge,x:He,y:$e,context:Te}}}}return ye})}(q,Q)})}(o,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(v=>{if(this._spriteRequest=null,v)for(const E in v){this._spritesImagesIds[E]=[];const M=this._spritesImagesIds[E]?this._spritesImagesIds[E].filter(A=>!(A in v)):[];for(const A of M)this.imageManager.removeImage(A),this._changedImages[A]=!0;for(const A in v[E]){const R=E==="default"?A:`${E}:${A}`;this._spritesImagesIds[E].push(R),R in this.imageManager.images?this.imageManager.updateImage(R,v[E][A],!1):this.imageManager.addImage(R,v[E][A]),h&&(this._changedImages[R]=!0)}}}).catch(v=>{this._spriteRequest=null,m=v,this.fire(new a.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),h&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.k("data",{dataType:"style"})),p&&p(m)})}_unloadSprite(){for(const o of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(o),this._changedImages[o]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}_validateLayer(o){const h=this.sourceCaches[o.source];if(!h)return;const p=o.sourceLayer;if(!p)return;const m=h.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(p)===-1)&&this.fire(new a.j(new Error(`Source layer "${p}" does not exist on source "${m.id}" as specified by style layer "${o.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const o in this.sourceCaches)if(!this.sourceCaches[o].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(o){const h=this._serializedAllLayers();if(!o||o.length===0)return Object.values(h);const p=[];for(const m of o)h[m]&&p.push(h[m]);return p}_serializedAllLayers(){let o=this._serializedLayers;if(o)return o;o=this._serializedLayers={};const h=Object.keys(this._layers);for(const p of h){const m=this._layers[p];m.type!=="custom"&&(o[p]=m.serialize())}return o}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const o in this.sourceCaches)if(this.sourceCaches[o].hasTransition())return!0;for(const o in this._layers)if(this._layers[o].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(o){if(!this._loaded)return;const h=this._changed;if(h){const m=Object.keys(this._updatedLayers),v=Object.keys(this._removedLayers);(m.length||v.length)&&this._updateWorkerLayers(m,v);for(const E in this._updatedSources){const M=this._updatedSources[E];if(M==="reload")this._reloadSource(E);else{if(M!=="clear")throw new Error(`Invalid action ${M}`);this._clearSource(E)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const E in this._updatedPaintProps)this._layers[E].updateTransitions(o);this.light.updateTransitions(o),this._resetUpdates()}const p={};for(const m in this.sourceCaches){const v=this.sourceCaches[m];p[m]=v.used,v.used=!1}for(const m of this._order){const v=this._layers[m];v.recalculate(o,this._availableImages),!v.isHidden(o.zoom)&&v.source&&(this.sourceCaches[v.source].used=!0)}for(const m in p){const v=this.sourceCaches[m];!!p[m]!=!!v.used&&v.fire(new a.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(o),this.z=o.zoom,h&&this.fire(new a.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const o=Object.keys(this._changedImages);if(o.length){for(const h in this.sourceCaches)this.sourceCaches[h].reloadTilesForDependencies(["icons","patterns"],o);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const o in this.sourceCaches)this.sourceCaches[o].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(o,h){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(o),removedIds:h})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(o,h={}){var p;this._checkLoaded();const m=this.serialize();if(o=h.transformStyle?h.transformStyle(m,o):o,((p=h.validate)===null||p===void 0||p)&&rn(this,a.x(o)))return!1;(o=a.aA(o)).layers=a.ay(o.layers);const v=a.aB(m,o),E=this._getOperationsToPerform(v);if(E.unimplemented.length>0)throw new Error(`Unimplemented: ${E.unimplemented.join(", ")}.`);if(E.operations.length===0)return!1;for(const M of E.operations)M();return this.stylesheet=o,this._serializedLayers=null,!0}_getOperationsToPerform(o){const h=[],p=[];for(const m of o)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":h.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":h.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":h.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":h.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":h.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":h.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":h.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":h.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":h.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":h.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":h.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":h.push(()=>this.setSprite.apply(this,m.args));break;case"setTerrain":h.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":h.push(()=>{});break;default:p.push(m.command)}return{operations:h,unimplemented:p}}addImage(o,h){if(this.getImage(o))return this.fire(new a.j(new Error(`An image named "${o}" already exists.`)));this.imageManager.addImage(o,h),this._afterImageUpdated(o)}updateImage(o,h){this.imageManager.updateImage(o,h)}getImage(o){return this.imageManager.getImage(o)}removeImage(o){if(!this.getImage(o))return this.fire(new a.j(new Error(`An image named "${o}" does not exist.`)));this.imageManager.removeImage(o),this._afterImageUpdated(o)}_afterImageUpdated(o){this._availableImages=this.imageManager.listImages(),this._changedImages[o]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(o,h,p={}){if(this._checkLoaded(),this.sourceCaches[o]!==void 0)throw new Error(`Source "${o}" already exists.`);if(!h.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(h).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(h.type)>=0&&this._validate(a.x.source,`sources.${o}`,h,null,p))return;this.map&&this.map._collectResourceTiming&&(h.collectResourceTiming=!0);const m=this.sourceCaches[o]=new Or(o,h,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:o})),m.onAdd(this.map),this._changed=!0}removeSource(o){if(this._checkLoaded(),this.sourceCaches[o]===void 0)throw new Error("There is no source with this ID");for(const p in this._layers)if(this._layers[p].source===o)return this.fire(new a.j(new Error(`Source "${o}" cannot be removed while layer "${p}" is using it.`)));const h=this.sourceCaches[o];delete this.sourceCaches[o],delete this._updatedSources[o],h.fire(new a.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:o})),h.setEventedParent(null),h.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(o,h){if(this._checkLoaded(),this.sourceCaches[o]===void 0)throw new Error(`There is no source with this ID=${o}`);const p=this.sourceCaches[o].getSource();if(p.type!=="geojson")throw new Error(`geojsonSource.type is ${p.type}, which is !== 'geojson`);p.setData(h),this._changed=!0}getSource(o){return this.sourceCaches[o]&&this.sourceCaches[o].getSource()}addLayer(o,h,p={}){this._checkLoaded();const m=o.id;if(this.getLayer(m))return void this.fire(new a.j(new Error(`Layer "${m}" already exists on this map.`)));let v;if(o.type==="custom"){if(rn(this,a.aC(o)))return;v=a.az(o)}else{if("source"in o&&typeof o.source=="object"&&(this.addSource(m,o.source),o=a.aA(o),o=a.e(o,{source:m})),this._validate(a.x.layer,`layers.${m}`,o,{arrayIndex:-1},p))return;v=a.az(o),this._validateLayer(v),v.setEventedParent(this,{layer:{id:m}})}const E=h?this._order.indexOf(h):this._order.length;if(h&&E===-1)this.fire(new a.j(new Error(`Cannot add layer "${m}" before non-existing layer "${h}".`)));else{if(this._order.splice(E,0,m),this._layerOrderChanged=!0,this._layers[m]=v,this._removedLayers[m]&&v.source&&v.type!=="custom"){const M=this._removedLayers[m];delete this._removedLayers[m],M.type!==v.type?this._updatedSources[v.source]="clear":(this._updatedSources[v.source]="reload",this.sourceCaches[v.source].pause())}this._updateLayer(v),v.onAdd&&v.onAdd(this.map)}}moveLayer(o,h){if(this._checkLoaded(),this._changed=!0,!this._layers[o])return void this.fire(new a.j(new Error(`The layer '${o}' does not exist in the map's style and cannot be moved.`)));if(o===h)return;const p=this._order.indexOf(o);this._order.splice(p,1);const m=h?this._order.indexOf(h):this._order.length;h&&m===-1?this.fire(new a.j(new Error(`Cannot move layer "${o}" before non-existing layer "${h}".`))):(this._order.splice(m,0,o),this._layerOrderChanged=!0)}removeLayer(o){this._checkLoaded();const h=this._layers[o];if(!h)return void this.fire(new a.j(new Error(`Cannot remove non-existing layer "${o}".`)));h.setEventedParent(null);const p=this._order.indexOf(o);this._order.splice(p,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[o]=h,delete this._layers[o],this._serializedLayers&&delete this._serializedLayers[o],delete this._updatedLayers[o],delete this._updatedPaintProps[o],h.onRemove&&h.onRemove(this.map)}getLayer(o){return this._layers[o]}getLayersOrder(){return[...this._order]}hasLayer(o){return o in this._layers}setLayerZoomRange(o,h,p){this._checkLoaded();const m=this.getLayer(o);m?m.minzoom===h&&m.maxzoom===p||(h!=null&&(m.minzoom=h),p!=null&&(m.maxzoom=p),this._updateLayer(m)):this.fire(new a.j(new Error(`Cannot set the zoom range of non-existing layer "${o}".`)))}setFilter(o,h,p={}){this._checkLoaded();const m=this.getLayer(o);if(m){if(!a.aD(m.filter,h))return h==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(a.x.filter,`layers.${m.id}.filter`,h,null,p)||(m.filter=a.aA(h),this._updateLayer(m)))}else this.fire(new a.j(new Error(`Cannot filter non-existing layer "${o}".`)))}getFilter(o){return a.aA(this.getLayer(o).filter)}setLayoutProperty(o,h,p,m={}){this._checkLoaded();const v=this.getLayer(o);v?a.aD(v.getLayoutProperty(h),p)||(v.setLayoutProperty(h,p,m),this._updateLayer(v)):this.fire(new a.j(new Error(`Cannot style non-existing layer "${o}".`)))}getLayoutProperty(o,h){const p=this.getLayer(o);if(p)return p.getLayoutProperty(h);this.fire(new a.j(new Error(`Cannot get style of non-existing layer "${o}".`)))}setPaintProperty(o,h,p,m={}){this._checkLoaded();const v=this.getLayer(o);v?a.aD(v.getPaintProperty(h),p)||(v.setPaintProperty(h,p,m)&&this._updateLayer(v),this._changed=!0,this._updatedPaintProps[o]=!0,this._serializedLayers=null):this.fire(new a.j(new Error(`Cannot style non-existing layer "${o}".`)))}getPaintProperty(o,h){return this.getLayer(o).getPaintProperty(h)}setFeatureState(o,h){this._checkLoaded();const p=o.source,m=o.sourceLayer,v=this.sourceCaches[p];if(v===void 0)return void this.fire(new a.j(new Error(`The source '${p}' does not exist in the map's style.`)));const E=v.getSource().type;E==="geojson"&&m?this.fire(new a.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):E!=="vector"||m?(o.id===void 0&&this.fire(new a.j(new Error("The feature id parameter must be provided."))),v.setFeatureState(m,o.id,h)):this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(o,h){this._checkLoaded();const p=o.source,m=this.sourceCaches[p];if(m===void 0)return void this.fire(new a.j(new Error(`The source '${p}' does not exist in the map's style.`)));const v=m.getSource().type,E=v==="vector"?o.sourceLayer:void 0;v!=="vector"||E?h&&typeof o.id!="string"&&typeof o.id!="number"?this.fire(new a.j(new Error("A feature id is required to remove its specific state property."))):m.removeFeatureState(E,o.id,h):this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(o){this._checkLoaded();const h=o.source,p=o.sourceLayer,m=this.sourceCaches[h];if(m!==void 0)return m.getSource().type!=="vector"||p?(o.id===void 0&&this.fire(new a.j(new Error("The feature id parameter must be provided."))),m.getFeatureState(p,o.id)):void this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new a.j(new Error(`The source '${h}' does not exist in the map's style.`)))}getTransition(){return a.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const o=a.aE(this.sourceCaches,v=>v.serialize()),h=this._serializeByIds(this._order),p=this.map.getTerrain()||void 0,m=this.stylesheet;return a.aF({version:m.version,name:m.name,metadata:m.metadata,light:m.light,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:o,layers:h,terrain:p},v=>v!==void 0)}_updateLayer(o){this._updatedLayers[o.id]=!0,o.source&&!this._updatedSources[o.source]&&this.sourceCaches[o.source].getSource().type!=="raster"&&(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(o){const h=E=>this._layers[E].type==="fill-extrusion",p={},m=[];for(let E=this._order.length-1;E>=0;E--){const M=this._order[E];if(h(M)){p[M]=E;for(const A of o){const R=A[M];if(R)for(const V of R)m.push(V)}}}m.sort((E,M)=>M.intersectionZ-E.intersectionZ);const v=[];for(let E=this._order.length-1;E>=0;E--){const M=this._order[E];if(h(M))for(let A=m.length-1;A>=0;A--){const R=m[A].feature;if(p[R.layer.id]{const nt=Te.featureSortOrder;if(nt){const et=nt.indexOf(He.featureIndex);return nt.indexOf($e.featureIndex)-et}return $e.featureIndex-He.featureIndex});for(const He of Ge)Le.push(He)}}for(const Te in ue)ue[Te].forEach(Ue=>{const we=Ue.feature,Le=R[M[Te].source].getFeatureState(we.layer["source-layer"],we.id);we.source=we.layer.source,we.layer["source-layer"]&&(we.sourceLayer=we.layer["source-layer"]),we.state=Le});return ue}(this._layers,E,this.sourceCaches,o,h,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(v)}querySourceFeatures(o,h){h&&h.filter&&this._validate(a.x.filter,"querySourceFeatures.filter",h.filter,null,h);const p=this.sourceCaches[o];return p?function(m,v){const E=m.getRenderableIds().map(R=>m.getTileByID(R)),M=[],A={};for(let R=0;RQ.getTileByID(he)).sort((he,ue)=>ue.tileID.overscaledZ-he.tileID.overscaledZ||(he.tileID.isLessThan(ue.tileID)?-1:1))}const q=this.crossTileSymbolIndex.addLayer(V,A[V.source],o.center.lng);E=E||q}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((v=v||this._layerOrderChanged||p===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(k.now(),o.zoom))&&(this.pauseablePlacement=new Xi(o,this.map.terrain,this._order,v,h,p,m,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,A),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(k.now()),M=!0),E&&this.pauseablePlacement.placement.setStale()),M||E)for(const R of this._order){const V=this._layers[R];V.type==="symbol"&&this.placement.updateLayerOpacities(V,A[V.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(k.now())}_releaseSymbolFadeTiles(){for(const o in this.sourceCaches)this.sourceCaches[o].releaseSymbolFadeTiles()}getImages(o,h){return a._(this,void 0,void 0,function*(){const p=yield this.imageManager.getImages(h.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[h.source];return m&&m.setDependencies(h.tileID.key,h.type,h.icons),p})}getGlyphs(o,h){return a._(this,void 0,void 0,function*(){const p=yield this.glyphManager.getGlyphs(h.stacks),m=this.sourceCaches[h.source];return m&&m.setDependencies(h.tileID.key,h.type,[""]),p})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(o,h={}){this._checkLoaded(),o&&this._validate(a.x.glyphs,"glyphs",o,null,h)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=o,this.glyphManager.entries={},this.glyphManager.setURL(o))}addSprite(o,h,p={},m){this._checkLoaded();const v=[{id:o,url:h}],E=[...ze(this.stylesheet.sprite),...v];this._validate(a.x.sprite,"sprite",E,null,p)||(this.stylesheet.sprite=E,this._loadSprite(v,!0,m))}removeSprite(o){this._checkLoaded();const h=ze(this.stylesheet.sprite);if(h.find(p=>p.id===o)){if(this._spritesImagesIds[o])for(const p of this._spritesImagesIds[o])this.imageManager.removeImage(p),this._changedImages[p]=!0;h.splice(h.findIndex(p=>p.id===o),1),this.stylesheet.sprite=h.length>0?h:void 0,delete this._spritesImagesIds[o],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}else this.fire(new a.j(new Error(`Sprite "${o}" doesn't exists on this map.`)))}getSprite(){return ze(this.stylesheet.sprite)}setSprite(o,h={},p){this._checkLoaded(),o&&this._validate(a.x.sprite,"sprite",o,null,h)||(this.stylesheet.sprite=o,o?this._loadSprite(o,!0,p):(this._unloadSprite(),p&&p(null)))}}var ll=a.X([{name:"a_pos",type:"Int16",components:2}]),go="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const Ea={prelude:Dr(`#ifdef GL_ES + */(function(r,e){(function(t,n){r.exports=n()})(xh,function(){var t={},n={};function l(d,a,_){if(n[d]=_,d==="index"){var x="var sharedModule = {}; ("+n.shared+")(sharedModule); ("+n.worker+")(sharedModule);",S={};return n.shared(S),n.index(t,S),typeof window<"u"&&t.setWorkerUrl(window.URL.createObjectURL(new Blob([x],{type:"text/javascript"}))),t}}l("shared",["exports"],function(d){function a(s,i,c,f){return new(c||(c=Promise))(function(g,b){function w(L){try{I(f.next(L))}catch(F){b(F)}}function T(L){try{I(f.throw(L))}catch(F){b(F)}}function I(L){var F;L.done?g(L.value):(F=L.value,F instanceof c?F:new c(function(j){j(F)})).then(w,T)}I((f=f.apply(s,i||[])).next())})}function _(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}typeof SuppressedError=="function"&&SuppressedError;var x=S;function S(s,i){this.x=s,this.y=i}S.prototype={clone:function(){return new S(this.x,this.y)},add:function(s){return this.clone()._add(s)},sub:function(s){return this.clone()._sub(s)},multByPoint:function(s){return this.clone()._multByPoint(s)},divByPoint:function(s){return this.clone()._divByPoint(s)},mult:function(s){return this.clone()._mult(s)},div:function(s){return this.clone()._div(s)},rotate:function(s){return this.clone()._rotate(s)},rotateAround:function(s,i){return this.clone()._rotateAround(s,i)},matMult:function(s){return this.clone()._matMult(s)},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(s){return this.x===s.x&&this.y===s.y},dist:function(s){return Math.sqrt(this.distSqr(s))},distSqr:function(s){var i=s.x-this.x,c=s.y-this.y;return i*i+c*c},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(s){return Math.atan2(this.y-s.y,this.x-s.x)},angleWith:function(s){return this.angleWithSep(s.x,s.y)},angleWithSep:function(s,i){return Math.atan2(this.x*i-this.y*s,this.x*s+this.y*i)},_matMult:function(s){var i=s[2]*this.x+s[3]*this.y;return this.x=s[0]*this.x+s[1]*this.y,this.y=i,this},_add:function(s){return this.x+=s.x,this.y+=s.y,this},_sub:function(s){return this.x-=s.x,this.y-=s.y,this},_mult:function(s){return this.x*=s,this.y*=s,this},_div:function(s){return this.x/=s,this.y/=s,this},_multByPoint:function(s){return this.x*=s.x,this.y*=s.y,this},_divByPoint:function(s){return this.x/=s.x,this.y/=s.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var s=this.y;return this.y=this.x,this.x=-s,this},_rotate:function(s){var i=Math.cos(s),c=Math.sin(s),f=c*this.x+i*this.y;return this.x=i*this.x-c*this.y,this.y=f,this},_rotateAround:function(s,i){var c=Math.cos(s),f=Math.sin(s),g=i.y+f*(this.x-i.x)+c*(this.y-i.y);return this.x=i.x+c*(this.x-i.x)-f*(this.y-i.y),this.y=g,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},S.convert=function(s){return s instanceof S?s:Array.isArray(s)?new S(s[0],s[1]):s};var k=_(x),C=P;function P(s,i,c,f){this.cx=3*s,this.bx=3*(c-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(f-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=i,this.p2x=c,this.p2y=f}P.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,i){if(i===void 0&&(i=1e-6),s<0)return 0;if(s>1)return 1;for(var c=s,f=0;f<8;f++){var g=this.sampleCurveX(c)-s;if(Math.abs(g)g?w=c:T=c,c=.5*(T-w)+w;return c},solve:function(s,i){return this.sampleCurveY(this.solveCurveX(s,i))}};var D=_(C);let N,z;function B(){return N==null&&(N=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),N}function O(){if(z==null&&(z=!1,B())){const i=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(i){for(let f=0;f<5*5;f++){const g=4*f;i.fillStyle=`rgb(${g},${g+1},${g+2})`,i.fillRect(f%5,Math.floor(f/5),1,1)}const c=i.getImageData(0,0,5,5).data;for(let f=0;f<5*5*4;f++)if(f%4!=3&&c[f]!==f){z=!0;break}}}return z||!1}function G(s,i,c,f){const g=new D(s,i,c,f);return function(b){return g.solve(b)}}const U=G(.25,.1,.25,1);function K(s,i,c){return Math.min(c,Math.max(i,s))}function me(s,i,c){const f=c-i,g=((s-i)%f+f)%f+i;return g===i?c:g}function X(s,...i){for(const c of i)for(const f in c)s[f]=c[f];return s}let Y=1;function _e(s,i,c){const f={};for(const g in s)f[g]=i.call(c||this,s[g],g,s);return f}function ze(s,i,c){const f={};for(const g in s)i.call(c||this,s[g],g,s)&&(f[g]=s[g]);return f}function re(s){return Array.isArray(s)?s.map(re):typeof s=="object"&&s?_e(s,re):s}const ce={};function Ze(s){ce[s]||(typeof console<"u"&&console.warn(s),ce[s]=!0)}function Me(s,i,c){return(c.y-s.y)*(i.x-s.x)>(i.y-s.y)*(c.x-s.x)}function ft(s){let i=0;for(let c,f,g=0,b=s.length,w=b-1;g"u")throw new Error("VideoFrame not supported");const b=new VideoFrame(s,{timestamp:0});try{const w=b==null?void 0:b.format;if(!w||!w.startsWith("BGR")&&!w.startsWith("RGB"))throw new Error(`Unrecognized format ${w}`);const T=w.startsWith("BGR"),I=new Uint8ClampedArray(f*g*4);if(yield b.copyTo(I,function(L,F,j,H,J){const ee=4*Math.max(-F,0),ae=(Math.max(0,j)-j)*H*4+ee,ge=4*H,xe=Math.max(0,F),Re=Math.max(0,j);return{rect:{x:xe,y:Re,width:Math.min(L.width,F+H)-xe,height:Math.min(L.height,j+J)-Re},layout:[{offset:ae,stride:ge}]}}(s,i,c,f,g)),T)for(let L=0;LCt(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Pr=function(s,i){if(/:\/\//.test(s.url)&&!/^https?:|^file:/.test(s.url)){const f=Nt(s.url);if(f)return f(s,i);if(Ct(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:s,targetMapId:nr},i)}if(!(/^file:/.test(c=s.url)||/^file:/.test(Lr())&&!/^\w+:/.test(c))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(f,g){return a(this,void 0,void 0,function*(){const b=new Request(f.url,{method:f.method||"GET",body:f.body,credentials:f.credentials,headers:f.headers,cache:f.cache,referrer:Lr(),signal:g.signal});f.type==="json"&&b.headers.set("Accept","application/json");const w=yield fetch(b);if(!w.ok){const L=yield w.blob();throw new tr(w.status,w.statusText,f.url,L)}let T;T=f.type==="arrayBuffer"||f.type==="image"?w.arrayBuffer():f.type==="json"?w.json():w.text();const I=yield T;if(g.signal.aborted)throw fr();return{data:I,cacheControl:w.headers.get("Cache-Control"),expires:w.headers.get("Expires")}})}(s,i);if(Ct(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:s,mustQueue:!0,targetMapId:nr},i)}var c;return function(f,g){return new Promise((b,w)=>{const T=new XMLHttpRequest;T.open(f.method||"GET",f.url,!0),f.type!=="arrayBuffer"&&f.type!=="image"||(T.responseType="arraybuffer");for(const I in f.headers)T.setRequestHeader(I,f.headers[I]);f.type==="json"&&(T.responseType="text",T.setRequestHeader("Accept","application/json")),T.withCredentials=f.credentials==="include",T.onerror=()=>{w(new Error(T.statusText))},T.onload=()=>{if(!g.signal.aborted)if((T.status>=200&&T.status<300||T.status===0)&&T.response!==null){let I=T.response;if(f.type==="json")try{I=JSON.parse(T.response)}catch(L){return void w(L)}b({data:I,cacheControl:T.getResponseHeader("Cache-Control"),expires:T.getResponseHeader("Expires")})}else{const I=new Blob([T.response],{type:T.getResponseHeader("Content-Type")});w(new tr(T.status,T.statusText,f.url,I))}},g.signal.addEventListener("abort",()=>{T.abort(),w(fr())}),T.send(f.body)})}(s,i)};function st(s){if(!s||s.indexOf("://")<=0||s.indexOf("data:image/")===0||s.indexOf("blob:")===0)return!0;const i=new URL(s),c=window.location;return i.protocol===c.protocol&&i.host===c.host}function Lt(s,i,c){c[s]&&c[s].indexOf(i)!==-1||(c[s]=c[s]||[],c[s].push(i))}function De(s,i,c){if(c&&c[s]){const f=c[s].indexOf(i);f!==-1&&c[s].splice(f,1)}}class at{constructor(i,c={}){X(this,c),this.type=i}}class tt extends at{constructor(i,c={}){super("error",X({error:i},c))}}class it{on(i,c){return this._listeners=this._listeners||{},Lt(i,c,this._listeners),this}off(i,c){return De(i,c,this._listeners),De(i,c,this._oneTimeListeners),this}once(i,c){return c?(this._oneTimeListeners=this._oneTimeListeners||{},Lt(i,c,this._oneTimeListeners),this):new Promise(f=>this.once(i,f))}fire(i,c){typeof i=="string"&&(i=new at(i,c||{}));const f=i.type;if(this.listens(f)){i.target=this;const g=this._listeners&&this._listeners[f]?this._listeners[f].slice():[];for(const T of g)T.call(this,i);const b=this._oneTimeListeners&&this._oneTimeListeners[f]?this._oneTimeListeners[f].slice():[];for(const T of b)De(f,T,this._oneTimeListeners),T.call(this,i);const w=this._eventedParent;w&&(X(i,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),w.fire(i))}else i instanceof tt&&console.error(i.error);return this}listens(i){return this._listeners&&this._listeners[i]&&this._listeners[i].length>0||this._oneTimeListeners&&this._oneTimeListeners[i]&&this._oneTimeListeners[i].length>0||this._eventedParent&&this._eventedParent.listens(i)}setEventedParent(i,c){return this._eventedParent=i,this._eventedParentData=c,this}}var ne={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},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},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-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}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const br=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function We(s,i){const c={};for(const f in s)f!=="ref"&&(c[f]=s[f]);return br.forEach(f=>{f in i&&(c[f]=i[f])}),c}function Ye(s,i){if(Array.isArray(s)){if(!Array.isArray(i)||s.length!==i.length)return!1;for(let c=0;c`:s.itemType.kind==="value"?"array":`array<${i}>`}return s.kind}const Ce=[Or,mt,rr,Jt,Nr,an,vi,te(Qt),pe,Z,$];function Ie(s,i){if(i.kind==="error")return null;if(s.kind==="array"){if(i.kind==="array"&&(i.N===0&&i.itemType.kind==="value"||!Ie(s.itemType,i.itemType))&&(typeof s.N!="number"||s.N===i.N))return null}else{if(s.kind===i.kind)return null;if(s.kind==="value"){for(const c of Ce)if(!Ie(c,i))return null}}return`Expected ${le(s)} but found ${le(i)} instead.`}function Pe(s,i){return i.some(c=>c.kind===s.kind)}function Se(s,i){return i.some(c=>c==="null"?s===null:c==="array"?Array.isArray(s):c==="object"?s&&!Array.isArray(s)&&typeof s=="object":c===typeof s)}function W(s,i){return s.kind==="array"&&i.kind==="array"?s.itemType.kind===i.itemType.kind&&typeof s.N=="number":s.kind===i.kind}const Be=.96422,Fe=.82521,qe=4/29,Xe=6/29,ut=3*Xe*Xe,Pt=Xe*Xe*Xe,$t=Math.PI/180,ar=180/Math.PI;function gr(s){return(s%=360)<0&&(s+=360),s}function Yr([s,i,c,f]){let g,b;const w=lr((.2225045*(s=Cn(s))+.7168786*(i=Cn(i))+.0606169*(c=Cn(c)))/1);s===i&&i===c?g=b=w:(g=lr((.4360747*s+.3850649*i+.1430804*c)/Be),b=lr((.0139322*s+.0971045*i+.7141733*c)/Fe));const T=116*w-16;return[T<0?0:T,500*(g-w),200*(w-b),f]}function Cn(s){return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}function lr(s){return s>Pt?Math.pow(s,1/3):s/ut+qe}function ln([s,i,c,f]){let g=(s+16)/116,b=isNaN(i)?g:g+i/500,w=isNaN(c)?g:g-c/200;return g=1*fi(g),b=Be*fi(b),w=Fe*fi(w),[Bn(3.1338561*b-1.6168667*g-.4906146*w),Bn(-.9787684*b+1.9161415*g+.033454*w),Bn(.0719453*b-.2289914*g+1.4052427*w),f]}function Bn(s){return(s=s<=.00304?12.92*s:1.055*Math.pow(s,1/2.4)-.055)<0?0:s>1?1:s}function fi(s){return s>Xe?s*s*s:ut*(s-qe)}function bi(s){return parseInt(s.padEnd(2,s),16)/255}function Kn(s,i){return mo(i?s/100:s,0,1)}function mo(s,i,c){return Math.min(Math.max(i,s),c)}function Ch(s){return!s.some(Number.isNaN)}const Wd={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]};class zr{constructor(i,c,f,g=1,b=!0){this.r=i,this.g=c,this.b=f,this.a=g,b||(this.r*=g,this.g*=g,this.b*=g,g||this.overwriteGetter("rgb",[i,c,f,g]))}static parse(i){if(i instanceof zr)return i;if(typeof i!="string")return;const c=function(f){if((f=f.toLowerCase().trim())==="transparent")return[0,0,0,0];const g=Wd[f];if(g){const[w,T,I]=g;return[w/255,T/255,I/255,1]}if(f.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(f)){const w=f.length<6?1:2;let T=1;return[bi(f.slice(T,T+=w)),bi(f.slice(T,T+=w)),bi(f.slice(T,T+=w)),bi(f.slice(T,T+w)||"ff")]}if(f.startsWith("rgb")){const w=f.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(w){const[T,I,L,F,j,H,J,ee,ae,ge,xe,Re]=w,ke=[F||" ",J||" ",ge].join("");if(ke===" "||ke===" /"||ke===",,"||ke===",,,"){const Ae=[L,H,ae].join(""),Je=Ae==="%%%"?100:Ae===""?255:0;if(Je){const Qe=[mo(+I/Je,0,1),mo(+j/Je,0,1),mo(+ee/Je,0,1),xe?Kn(+xe,Re):1];if(Ch(Qe))return Qe}}return}}const b=f.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(b){const[w,T,I,L,F,j,H,J,ee]=b,ae=[I||" ",F||" ",H].join("");if(ae===" "||ae===" /"||ae===",,"||ae===",,,"){const ge=[+T,mo(+L,0,100),mo(+j,0,100),J?Kn(+J,ee):1];if(Ch(ge))return function([xe,Re,ke,Ae]){function Je(Qe){const kt=(Qe+xe/30)%12,zt=Re*Math.min(ke,1-ke);return ke-zt*Math.max(-1,Math.min(kt-3,9-kt,1))}return xe=gr(xe),Re/=100,ke/=100,[Je(0),Je(8),Je(4),Ae]}(ge)}}}(i);return c?new zr(...c,!1):void 0}get rgb(){const{r:i,g:c,b:f,a:g}=this,b=g||1/0;return this.overwriteGetter("rgb",[i/b,c/b,f/b,g])}get hcl(){return this.overwriteGetter("hcl",function(i){const[c,f,g,b]=Yr(i),w=Math.sqrt(f*f+g*g);return[Math.round(1e4*w)?gr(Math.atan2(g,f)*ar):NaN,w,c,b]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Yr(this.rgb))}overwriteGetter(i,c){return Object.defineProperty(this,i,{value:c}),c}toString(){const[i,c,f,g]=this.rgb;return`rgba(${[i,c,f].map(b=>Math.round(255*b)).join(",")},${g})`}}zr.black=new zr(0,0,0,1),zr.white=new zr(1,1,1,1),zr.transparent=new zr(0,0,0,0),zr.red=new zr(1,0,0,1);class Fc{constructor(i,c,f){this.sensitivity=i?c?"variant":"case":c?"accent":"base",this.locale=f,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,c){return this.collator.compare(i,c)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Oc{constructor(i,c,f,g,b){this.text=i,this.image=c,this.scale=f,this.fontStack=g,this.textColor=b}}class Ri{constructor(i){this.sections=i}static fromString(i){return new Ri([new Oc(i,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(i=>i.text.length!==0||i.image&&i.image.name.length!==0)}static factory(i){return i instanceof Ri?i:Ri.fromString(i)}toString(){return this.sections.length===0?"":this.sections.map(i=>i.text).join("")}}class wi{constructor(i){this.values=i.slice()}static parse(i){if(i instanceof wi)return i;if(typeof i=="number")return new wi([i,i,i,i]);if(Array.isArray(i)&&!(i.length<1||i.length>4)){for(const c of i)if(typeof c!="number")return;switch(i.length){case 1:i=[i[0],i[0],i[0],i[0]];break;case 2:i=[i[0],i[1],i[0],i[1]];break;case 3:i=[i[0],i[1],i[2],i[1]]}return new wi(i)}}toString(){return JSON.stringify(this.values)}}const ka=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class $i{constructor(i){this.values=i.slice()}static parse(i){if(i instanceof $i)return i;if(Array.isArray(i)&&!(i.length<1)&&i.length%2==0){for(let c=0;c=0&&s<=255&&typeof i=="number"&&i>=0&&i<=255&&typeof c=="number"&&c>=0&&c<=255?f===void 0||typeof f=="number"&&f>=0&&f<=1?null:`Invalid rgba value [${[s,i,c,f].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof f=="number"?[s,i,c,f]:[s,i,c]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function sl(s){if(s===null||typeof s=="string"||typeof s=="boolean"||typeof s=="number"||s instanceof zr||s instanceof Fc||s instanceof Ri||s instanceof wi||s instanceof $i||s instanceof Xi)return!0;if(Array.isArray(s)){for(const i of s)if(!sl(i))return!1;return!0}if(typeof s=="object"){for(const i in s)if(!sl(s[i]))return!1;return!0}return!1}function In(s){if(s===null)return Or;if(typeof s=="string")return rr;if(typeof s=="boolean")return Jt;if(typeof s=="number")return mt;if(s instanceof zr)return Nr;if(s instanceof Fc)return ro;if(s instanceof Ri)return an;if(s instanceof wi)return pe;if(s instanceof $i)return $;if(s instanceof Xi)return Z;if(Array.isArray(s)){const i=s.length;let c;for(const f of s){const g=In(f);if(c){if(c===g)continue;c=Qt;break}c=g}return te(c||Qt,i)}return vi}function Ta(s){const i=typeof s;return s===null?"":i==="string"||i==="number"||i==="boolean"?String(s):s instanceof zr||s instanceof Ri||s instanceof wi||s instanceof $i||s instanceof Xi?s.toString():JSON.stringify(s)}class Xo{constructor(i,c){this.type=i,this.value=c}static parse(i,c){if(i.length!==2)return c.error(`'literal' expression requires exactly one argument, but found ${i.length-1} instead.`);if(!sl(i[1]))return c.error("invalid value");const f=i[1];let g=In(f);const b=c.expectedType;return g.kind!=="array"||g.N!==0||!b||b.kind!=="array"||typeof b.N=="number"&&b.N!==0||(g=b),new Xo(g,f)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class rn{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}}const al={string:rr,number:mt,boolean:Jt,object:vi};class Bi{constructor(i,c){this.type=i,this.args=c}static parse(i,c){if(i.length<2)return c.error("Expected at least one argument.");let f,g=1;const b=i[0];if(b==="array"){let T,I;if(i.length>2){const L=i[1];if(typeof L!="string"||!(L in al)||L==="object")return c.error('The item type argument of "array" must be one of string, number, boolean',1);T=al[L],g++}else T=Qt;if(i.length>3){if(i[2]!==null&&(typeof i[2]!="number"||i[2]<0||i[2]!==Math.floor(i[2])))return c.error('The length argument to "array" must be a positive integer literal',2);I=i[2],g++}f=te(T,I)}else{if(!al[b])throw new Error(`Types doesn't contain name = ${b}`);f=al[b]}const w=[];for(;gi.outputDefined())}}const ll={"to-boolean":Jt,"to-color":Nr,"to-number":mt,"to-string":rr};class go{constructor(i,c){this.type=i,this.args=c}static parse(i,c){if(i.length<2)return c.error("Expected at least one argument.");const f=i[0];if(!ll[f])throw new Error(`Can't parse ${f} as it is not part of the known types`);if((f==="to-boolean"||f==="to-string")&&i.length!==2)return c.error("Expected one argument.");const g=ll[f],b=[];for(let w=1;w4?`Invalid rbga value ${JSON.stringify(c)}: expected an array containing either three or four numeric values.`:Ns(c[0],c[1],c[2],c[3]),!f))return new zr(c[0]/255,c[1]/255,c[2]/255,c[3])}throw new rn(f||`Could not parse color from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"padding":{let c;for(const f of this.args){c=f.evaluate(i);const g=wi.parse(c);if(g)return g}throw new rn(`Could not parse padding from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"variableAnchorOffsetCollection":{let c;for(const f of this.args){c=f.evaluate(i);const g=$i.parse(c);if(g)return g}throw new rn(`Could not parse variableAnchorOffsetCollection from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"number":{let c=null;for(const f of this.args){if(c=f.evaluate(i),c===null)return 0;const g=Number(c);if(!isNaN(g))return g}throw new rn(`Could not convert ${JSON.stringify(c)} to number.`)}case"formatted":return Ri.fromString(Ta(this.args[0].evaluate(i)));case"resolvedImage":return Xi.fromString(Ta(this.args[0].evaluate(i)));default:return Ta(this.args[0].evaluate(i))}}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}}const Ea=["Unknown","Point","LineString","Polygon"];class Dr{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Ea[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(i){let c=this._parseColorCache[i];return c||(c=this._parseColorCache[i]=zr.parse(i)),c}}class cl{constructor(i,c,f=[],g,b=new Bo,w=[]){this.registry=i,this.path=f,this.key=f.map(T=>`[${T}]`).join(""),this.scope=b,this.errors=w,this.expectedType=g,this._isConstant=c}parse(i,c,f,g,b={}){return c?this.concat(c,f,g)._parse(i,b):this._parse(i,b)}_parse(i,c){function f(g,b,w){return w==="assert"?new Bi(b,[g]):w==="coerce"?new go(b,[g]):g}if(i!==null&&typeof i!="string"&&typeof i!="boolean"&&typeof i!="number"||(i=["literal",i]),Array.isArray(i)){if(i.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const g=i[0];if(typeof g!="string")return this.error(`Expression name must be a string, but found ${typeof g} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const b=this.registry[g];if(b){let w=b.parse(i,this);if(!w)return null;if(this.expectedType){const T=this.expectedType,I=w.type;if(T.kind!=="string"&&T.kind!=="number"&&T.kind!=="boolean"&&T.kind!=="object"&&T.kind!=="array"||I.kind!=="value")if(T.kind!=="color"&&T.kind!=="formatted"&&T.kind!=="resolvedImage"||I.kind!=="value"&&I.kind!=="string")if(T.kind!=="padding"||I.kind!=="value"&&I.kind!=="number"&&I.kind!=="array")if(T.kind!=="variableAnchorOffsetCollection"||I.kind!=="value"&&I.kind!=="array"){if(this.checkSubtype(T,I))return null}else w=f(w,T,c.typeAnnotation||"coerce");else w=f(w,T,c.typeAnnotation||"coerce");else w=f(w,T,c.typeAnnotation||"coerce");else w=f(w,T,c.typeAnnotation||"assert")}if(!(w instanceof Xo)&&w.type.kind!=="resolvedImage"&&this._isConstant(w)){const T=new Dr;try{w=new Xo(w.type,w.evaluate(T))}catch(I){return this.error(I.message),null}}return w}return this.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(i===void 0?"'undefined' value invalid. Use null instead.":typeof i=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof i} instead.`)}concat(i,c,f){const g=typeof i=="number"?this.path.concat(i):this.path,b=f?this.scope.concat(f):this.scope;return new cl(this.registry,this._isConstant,g,c||null,b,this.errors)}error(i,...c){const f=`${this.key}${c.map(g=>`[${g}]`).join("")}`;this.errors.push(new xn(f,i))}checkSubtype(i,c){const f=Ie(i,c);return f&&this.error(f),f}}class js{constructor(i,c,f){this.type=ro,this.locale=f,this.caseSensitive=i,this.diacriticSensitive=c}static parse(i,c){if(i.length!==2)return c.error("Expected one argument.");const f=i[1];if(typeof f!="object"||Array.isArray(f))return c.error("Collator options argument must be an object.");const g=c.parse(f["case-sensitive"]!==void 0&&f["case-sensitive"],1,Jt);if(!g)return null;const b=c.parse(f["diacritic-sensitive"]!==void 0&&f["diacritic-sensitive"],1,Jt);if(!b)return null;let w=null;return f.locale&&(w=c.parse(f.locale,1,rr),!w)?null:new js(g,b,w)}evaluate(i){return new Fc(this.caseSensitive.evaluate(i),this.diacriticSensitive.evaluate(i),this.locale?this.locale.evaluate(i):null)}eachChild(i){i(this.caseSensitive),i(this.diacriticSensitive),this.locale&&i(this.locale)}outputDefined(){return!1}}const Ko=8192;function ul(s,i){s[0]=Math.min(s[0],i[0]),s[1]=Math.min(s[1],i[1]),s[2]=Math.max(s[2],i[0]),s[3]=Math.max(s[3],i[1])}function Ma(s,i){return!(s[0]<=i[0]||s[2]>=i[2]||s[1]<=i[1]||s[3]>=i[3])}function Zd(s,i){const c=(180+s[0])/360,f=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s[1]*Math.PI/360)))/360,g=Math.pow(2,i.z);return[Math.round(c*g*Ko),Math.round(f*g*Ko)]}function Ih(s,i,c){const f=s[0]-i[0],g=s[1]-i[1],b=s[0]-c[0],w=s[1]-c[1];return f*w-b*g==0&&f*b<=0&&g*w<=0}function hl(s,i){let c=!1;for(let w=0,T=i.length;w(f=s)[1]!=(b=I[L+1])[1]>f[1]&&f[0]<(b[0]-g[0])*(f[1]-g[1])/(b[1]-g[1])+g[0]&&(c=!c)}}var f,g,b;return c}function Hd(s,i){for(let c=0;c0&&T<0||w<0&&T>0}function $d(s,i,c){for(const L of c)for(let F=0;Fc[2]){const g=.5*f;let b=s[0]-c[0]>g?-f:c[0]-s[0]>g?f:0;b===0&&(b=s[0]-c[2]>g?-f:c[2]-s[0]>g?f:0),s[0]+=b}ul(i,s)}function dl(s,i,c,f){const g=Math.pow(2,f.z)*Ko,b=[f.x*Ko,f.y*Ko],w=[];for(const T of s)for(const I of T){const L=[I.x+b[0],I.y+b[1]];Dh(L,i,c,g),w.push(L)}return w}function Rh(s,i,c,f){const g=Math.pow(2,f.z)*Ko,b=[f.x*Ko,f.y*Ko],w=[];for(const I of s){const L=[];for(const F of I){const j=[F.x+b[0],F.y+b[1]];ul(i,j),L.push(j)}w.push(L)}if(i[2]-i[0]<=g/2){(T=i)[0]=T[1]=1/0,T[2]=T[3]=-1/0;for(const I of w)for(const L of I)Dh(L,i,c,g)}var T;return w}class ds{constructor(i,c){this.type=Jt,this.geojson=i,this.geometries=c}static parse(i,c){if(i.length!==2)return c.error(`'within' expression requires exactly one argument, but found ${i.length-1} instead.`);if(sl(i[1])){const f=i[1];if(f.type==="FeatureCollection"){const g=[];for(const b of f.features){const{type:w,coordinates:T}=b.geometry;w==="Polygon"&&g.push(T),w==="MultiPolygon"&&g.push(...T)}if(g.length)return new ds(f,{type:"MultiPolygon",coordinates:g})}else if(f.type==="Feature"){const g=f.geometry.type;if(g==="Polygon"||g==="MultiPolygon")return new ds(f,f.geometry)}else if(f.type==="Polygon"||f.type==="MultiPolygon")return new ds(f,f)}return c.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(i){if(i.geometry()!=null&&i.canonicalID()!=null){if(i.geometryType()==="Point")return function(c,f){const g=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],w=c.canonicalID();if(f.type==="Polygon"){const T=fl(f.coordinates,b,w),I=dl(c.geometry(),g,b,w);if(!Ma(g,b))return!1;for(const L of I)if(!hl(L,T))return!1}if(f.type==="MultiPolygon"){const T=zh(f.coordinates,b,w),I=dl(c.geometry(),g,b,w);if(!Ma(g,b))return!1;for(const L of I)if(!Hd(L,T))return!1}return!0}(i,this.geometries);if(i.geometryType()==="LineString")return function(c,f){const g=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],w=c.canonicalID();if(f.type==="Polygon"){const T=fl(f.coordinates,b,w),I=Rh(c.geometry(),g,b,w);if(!Ma(g,b))return!1;for(const L of I)if(!Lh(L,T))return!1}if(f.type==="MultiPolygon"){const T=zh(f.coordinates,b,w),I=Rh(c.geometry(),g,b,w);if(!Ma(g,b))return!1;for(const L of I)if(!Ph(L,T))return!1}return!0}(i,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class pl{constructor(i,c){this.type=c.type,this.name=i,this.boundExpression=c}static parse(i,c){if(i.length!==2||typeof i[1]!="string")return c.error("'var' expression requires exactly one string literal argument.");const f=i[1];return c.scope.has(f)?new pl(f,c.scope.get(f)):c.error(`Unknown variable "${f}". Make sure "${f}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(i){return this.boundExpression.evaluate(i)}eachChild(){}outputDefined(){return!1}}class Fi{constructor(i,c,f,g){this.name=i,this.type=c,this._evaluate=f,this.args=g}evaluate(i){return this._evaluate(i,this.args)}eachChild(i){this.args.forEach(i)}outputDefined(){return!1}static parse(i,c){const f=i[0],g=Fi.definitions[f];if(!g)return c.error(`Unknown expression "${f}". If you wanted a literal array, use ["literal", [...]].`,0);const b=Array.isArray(g)?g[0]:g.type,w=Array.isArray(g)?[[g[1],g[2]]]:g.overloads,T=w.filter(([L])=>!Array.isArray(L)||L.length===i.length-1);let I=null;for(const[L,F]of T){I=new cl(c.registry,Ca,c.path,null,c.scope);const j=[];let H=!1;for(let J=1;J{return H=j,Array.isArray(H)?`(${H.map(le).join(", ")})`:`(${le(H.type)}...)`;var H}).join(" | "),F=[];for(let j=1;j{c=i?c&&Ca(f):c&&f instanceof Xo}),!!c&&ml(s)&&Aa(s,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ml(s){if(s instanceof Fi&&(s.name==="get"&&s.args.length===1||s.name==="feature-state"||s.name==="has"&&s.args.length===1||s.name==="properties"||s.name==="geometry-type"||s.name==="id"||/^filter-/.test(s.name))||s instanceof ds)return!1;let i=!0;return s.eachChild(c=>{i&&!ml(c)&&(i=!1)}),i}function Ia(s){if(s instanceof Fi&&s.name==="feature-state")return!1;let i=!0;return s.eachChild(c=>{i&&!Ia(c)&&(i=!1)}),i}function Aa(s,i){if(s instanceof Fi&&i.indexOf(s.name)>=0)return!1;let c=!0;return s.eachChild(f=>{c&&!Aa(f,i)&&(c=!1)}),c}function La(s,i){const c=s.length-1;let f,g,b=0,w=c,T=0;for(;b<=w;)if(T=Math.floor((b+w)/2),f=s[T],g=s[T+1],f<=i){if(T===c||ii))throw new rn("Input is not a number.");w=T-1}return 0}class Pa{constructor(i,c,f){this.type=i,this.input=c,this.labels=[],this.outputs=[];for(const[g,b]of f)this.labels.push(g),this.outputs.push(b)}static parse(i,c){if(i.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return c.error("Expected an even number of arguments.");const f=c.parse(i[1],1,mt);if(!f)return null;const g=[];let b=null;c.expectedType&&c.expectedType.kind!=="value"&&(b=c.expectedType);for(let w=1;w=T)return c.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',L);const j=c.parse(I,F,b);if(!j)return null;b=b||j.type,g.push([T,j])}return new Pa(b,f,g)}evaluate(i){const c=this.labels,f=this.outputs;if(c.length===1)return f[0].evaluate(i);const g=this.input.evaluate(i);if(g<=c[0])return f[0].evaluate(i);const b=c.length;return g>=c[b-1]?f[b-1].evaluate(i):f[La(c,g)].evaluate(i)}eachChild(i){i(this.input);for(const c of this.outputs)i(c)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}}function Xd(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Kd=Bh;function Bh(s,i,c,f){this.cx=3*s,this.bx=3*(c-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(f-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=i,this.p2x=c,this.p2y=f}Bh.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,i){if(i===void 0&&(i=1e-6),s<0)return 0;if(s>1)return 1;for(var c=s,f=0;f<8;f++){var g=this.sampleCurveX(c)-s;if(Math.abs(g)g?w=c:T=c,c=.5*(T-w)+w;return c},solve:function(s,i){return this.sampleCurveY(this.solveCurveX(s,i))}};var Jd=Xd(Kd);function ps(s,i,c){return s+c*(i-s)}function gl(s,i,c){return s.map((f,g)=>ps(f,i[g],c))}const di={number:ps,color:function(s,i,c,f="rgb"){switch(f){case"rgb":{const[g,b,w,T]=gl(s.rgb,i.rgb,c);return new zr(g,b,w,T,!1)}case"hcl":{const[g,b,w,T]=s.hcl,[I,L,F,j]=i.hcl;let H,J;if(isNaN(g)||isNaN(I))isNaN(g)?isNaN(I)?H=NaN:(H=I,w!==1&&w!==0||(J=L)):(H=g,F!==1&&F!==0||(J=b));else{let Re=I-g;I>g&&Re>180?Re-=360:I180&&(Re+=360),H=g+c*Re}const[ee,ae,ge,xe]=function([Re,ke,Ae,Je]){return Re=isNaN(Re)?0:Re*$t,ln([Ae,Math.cos(Re)*ke,Math.sin(Re)*ke,Je])}([H,J??ps(b,L,c),ps(w,F,c),ps(T,j,c)]);return new zr(ee,ae,ge,xe,!1)}case"lab":{const[g,b,w,T]=ln(gl(s.lab,i.lab,c));return new zr(g,b,w,T,!1)}}},array:gl,padding:function(s,i,c){return new wi(gl(s.values,i.values,c))},variableAnchorOffsetCollection:function(s,i,c){const f=s.values,g=i.values;if(f.length!==g.length)throw new rn(`Cannot interpolate values of different length. from: ${s.toString()}, to: ${i.toString()}`);const b=[];for(let w=0;wtypeof F!="number"||F<0||F>1))return c.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);g={name:"cubic-bezier",controlPoints:L}}}if(i.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return c.error("Expected an even number of arguments.");if(b=c.parse(b,2,mt),!b)return null;const T=[];let I=null;f==="interpolate-hcl"||f==="interpolate-lab"?I=Nr:c.expectedType&&c.expectedType.kind!=="value"&&(I=c.expectedType);for(let L=0;L=F)return c.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',H);const ee=c.parse(j,J,I);if(!ee)return null;I=I||ee.type,T.push([F,ee])}return W(I,mt)||W(I,Nr)||W(I,pe)||W(I,$)||W(I,te(mt))?new oi(I,f,g,b,T):c.error(`Type ${le(I)} is not interpolatable.`)}evaluate(i){const c=this.labels,f=this.outputs;if(c.length===1)return f[0].evaluate(i);const g=this.input.evaluate(i);if(g<=c[0])return f[0].evaluate(i);const b=c.length;if(g>=c[b-1])return f[b-1].evaluate(i);const w=La(c,g),T=oi.interpolationFactor(this.interpolation,g,c[w],c[w+1]),I=f[w].evaluate(i),L=f[w+1].evaluate(i);switch(this.operator){case"interpolate":return di[this.type.kind](I,L,T);case"interpolate-hcl":return di.color(I,L,T,"hcl");case"interpolate-lab":return di.color(I,L,T,"lab")}}eachChild(i){i(this.input);for(const c of this.outputs)i(c)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}}function Er(s,i,c,f){const g=f-c,b=s-c;return g===0?0:i===1?b/g:(Math.pow(i,b)-1)/(Math.pow(i,g)-1)}class _l{constructor(i,c){this.type=i,this.args=c}static parse(i,c){if(i.length<2)return c.error("Expectected at least one argument.");let f=null;const g=c.expectedType;g&&g.kind!=="value"&&(f=g);const b=[];for(const T of i.slice(1)){const I=c.parse(T,1+b.length,f,void 0,{typeAnnotation:"omit"});if(!I)return null;f=f||I.type,b.push(I)}if(!f)throw new Error("No output type");const w=g&&b.some(T=>Ie(g,T.type));return new _l(w?Qt:f,b)}evaluate(i){let c,f=null,g=0;for(const b of this.args)if(g++,f=b.evaluate(i),f&&f instanceof Xi&&!f.available&&(c||(c=f.name),f=null,g===this.args.length&&(f=c)),f!==null)break;return f}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}}class yl{constructor(i,c){this.type=c.type,this.bindings=[].concat(i),this.result=c}evaluate(i){return this.result.evaluate(i)}eachChild(i){for(const c of this.bindings)i(c[1]);i(this.result)}static parse(i,c){if(i.length<4)return c.error(`Expected at least 3 arguments, but found ${i.length-1} instead.`);const f=[];for(let b=1;b=f.length)throw new rn(`Array index out of bounds: ${c} > ${f.length-1}.`);if(c!==Math.floor(c))throw new rn(`Array index must be an integer, but found ${c} instead.`);return f[c]}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}}class jc{constructor(i,c){this.type=Jt,this.needle=i,this.haystack=c}static parse(i,c){if(i.length!==3)return c.error(`Expected 2 arguments, but found ${i.length-1} instead.`);const f=c.parse(i[1],1,Qt),g=c.parse(i[2],2,Qt);return f&&g?Pe(f.type,[Jt,rr,mt,Or,Qt])?new jc(f,g):c.error(`Expected first argument to be of type boolean, string, number or null, but found ${le(f.type)} instead`):null}evaluate(i){const c=this.needle.evaluate(i),f=this.haystack.evaluate(i);if(!f)return!1;if(!Se(c,["boolean","string","number","null"]))throw new rn(`Expected first argument to be of type boolean, string, number or null, but found ${le(In(c))} instead.`);if(!Se(f,["string","array"]))throw new rn(`Expected second argument to be of type array or string, but found ${le(In(f))} instead.`);return f.indexOf(c)>=0}eachChild(i){i(this.needle),i(this.haystack)}outputDefined(){return!0}}class vl{constructor(i,c,f){this.type=mt,this.needle=i,this.haystack=c,this.fromIndex=f}static parse(i,c){if(i.length<=2||i.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);const f=c.parse(i[1],1,Qt),g=c.parse(i[2],2,Qt);if(!f||!g)return null;if(!Pe(f.type,[Jt,rr,mt,Or,Qt]))return c.error(`Expected first argument to be of type boolean, string, number or null, but found ${le(f.type)} instead`);if(i.length===4){const b=c.parse(i[3],3,mt);return b?new vl(f,g,b):null}return new vl(f,g)}evaluate(i){const c=this.needle.evaluate(i),f=this.haystack.evaluate(i);if(!Se(c,["boolean","string","number","null"]))throw new rn(`Expected first argument to be of type boolean, string, number or null, but found ${le(In(c))} instead.`);if(!Se(f,["string","array"]))throw new rn(`Expected second argument to be of type array or string, but found ${le(In(f))} instead.`);if(this.fromIndex){const g=this.fromIndex.evaluate(i);return f.indexOf(c,g)}return f.indexOf(c)}eachChild(i){i(this.needle),i(this.haystack),this.fromIndex&&i(this.fromIndex)}outputDefined(){return!1}}class Uc{constructor(i,c,f,g,b,w){this.inputType=i,this.type=c,this.input=f,this.cases=g,this.outputs=b,this.otherwise=w}static parse(i,c){if(i.length<5)return c.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if(i.length%2!=1)return c.error("Expected an even number of arguments.");let f,g;c.expectedType&&c.expectedType.kind!=="value"&&(g=c.expectedType);const b={},w=[];for(let L=2;LNumber.MAX_SAFE_INTEGER)return H.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ee=="number"&&Math.floor(ee)!==ee)return H.error("Numeric branch labels must be integer values.");if(f){if(H.checkSubtype(f,In(ee)))return null}else f=In(ee);if(b[String(ee)]!==void 0)return H.error("Branch labels must be unique.");b[String(ee)]=w.length}const J=c.parse(j,L,g);if(!J)return null;g=g||J.type,w.push(J)}const T=c.parse(i[1],1,Qt);if(!T)return null;const I=c.parse(i[i.length-1],i.length-1,g);return I?T.type.kind!=="value"&&c.concat(1).checkSubtype(f,T.type)?null:new Uc(f,g,T,b,w,I):null}evaluate(i){const c=this.input.evaluate(i);return(In(c)===this.inputType&&this.outputs[this.cases[c]]||this.otherwise).evaluate(i)}eachChild(i){i(this.input),this.outputs.forEach(i),i(this.otherwise)}outputDefined(){return this.outputs.every(i=>i.outputDefined())&&this.otherwise.outputDefined()}}class Vc{constructor(i,c,f){this.type=i,this.branches=c,this.otherwise=f}static parse(i,c){if(i.length<4)return c.error(`Expected at least 3 arguments, but found only ${i.length-1}.`);if(i.length%2!=0)return c.error("Expected an odd number of arguments.");let f;c.expectedType&&c.expectedType.kind!=="value"&&(f=c.expectedType);const g=[];for(let w=1;wc.outputDefined())&&this.otherwise.outputDefined()}}class bl{constructor(i,c,f,g){this.type=i,this.input=c,this.beginIndex=f,this.endIndex=g}static parse(i,c){if(i.length<=2||i.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);const f=c.parse(i[1],1,Qt),g=c.parse(i[2],2,mt);if(!f||!g)return null;if(!Pe(f.type,[te(Qt),rr,Qt]))return c.error(`Expected first argument to be of type array or string, but found ${le(f.type)} instead`);if(i.length===4){const b=c.parse(i[3],3,mt);return b?new bl(f.type,f,g,b):null}return new bl(f.type,f,g)}evaluate(i){const c=this.input.evaluate(i),f=this.beginIndex.evaluate(i);if(!Se(c,["string","array"]))throw new rn(`Expected first argument to be of type array or string, but found ${le(In(c))} instead.`);if(this.endIndex){const g=this.endIndex.evaluate(i);return c.slice(f,g)}return c.slice(f)}eachChild(i){i(this.input),i(this.beginIndex),this.endIndex&&i(this.endIndex)}outputDefined(){return!1}}function Fh(s,i){return s==="=="||s==="!="?i.kind==="boolean"||i.kind==="string"||i.kind==="number"||i.kind==="null"||i.kind==="value":i.kind==="string"||i.kind==="number"||i.kind==="value"}function Oh(s,i,c,f){return f.compare(i,c)===0}function Us(s,i,c){const f=s!=="=="&&s!=="!=";return class jb{constructor(b,w,T){this.type=Jt,this.lhs=b,this.rhs=w,this.collator=T,this.hasUntypedArgument=b.type.kind==="value"||w.type.kind==="value"}static parse(b,w){if(b.length!==3&&b.length!==4)return w.error("Expected two or three arguments.");const T=b[0];let I=w.parse(b[1],1,Qt);if(!I)return null;if(!Fh(T,I.type))return w.concat(1).error(`"${T}" comparisons are not supported for type '${le(I.type)}'.`);let L=w.parse(b[2],2,Qt);if(!L)return null;if(!Fh(T,L.type))return w.concat(2).error(`"${T}" comparisons are not supported for type '${le(L.type)}'.`);if(I.type.kind!==L.type.kind&&I.type.kind!=="value"&&L.type.kind!=="value")return w.error(`Cannot compare types '${le(I.type)}' and '${le(L.type)}'.`);f&&(I.type.kind==="value"&&L.type.kind!=="value"?I=new Bi(L.type,[I]):I.type.kind!=="value"&&L.type.kind==="value"&&(L=new Bi(I.type,[L])));let F=null;if(b.length===4){if(I.type.kind!=="string"&&L.type.kind!=="string"&&I.type.kind!=="value"&&L.type.kind!=="value")return w.error("Cannot use collator to compare non-string types.");if(F=w.parse(b[3],3,ro),!F)return null}return new jb(I,L,F)}evaluate(b){const w=this.lhs.evaluate(b),T=this.rhs.evaluate(b);if(f&&this.hasUntypedArgument){const I=In(w),L=In(T);if(I.kind!==L.kind||I.kind!=="string"&&I.kind!=="number")throw new rn(`Expected arguments for "${s}" to be (string, string) or (number, number), but found (${I.kind}, ${L.kind}) instead.`)}if(this.collator&&!f&&this.hasUntypedArgument){const I=In(w),L=In(T);if(I.kind!=="string"||L.kind!=="string")return i(b,w,T)}return this.collator?c(b,w,T,this.collator.evaluate(b)):i(b,w,T)}eachChild(b){b(this.lhs),b(this.rhs),this.collator&&b(this.collator)}outputDefined(){return!0}}}const Yd=Us("==",function(s,i,c){return i===c},Oh),Qd=Us("!=",function(s,i,c){return i!==c},function(s,i,c,f){return!Oh(0,i,c,f)}),ep=Us("<",function(s,i,c){return i",function(s,i,c){return i>c},function(s,i,c,f){return f.compare(i,c)>0}),rp=Us("<=",function(s,i,c){return i<=c},function(s,i,c,f){return f.compare(i,c)<=0}),np=Us(">=",function(s,i,c){return i>=c},function(s,i,c,f){return f.compare(i,c)>=0});class qc{constructor(i,c,f,g,b){this.type=rr,this.number=i,this.locale=c,this.currency=f,this.minFractionDigits=g,this.maxFractionDigits=b}static parse(i,c){if(i.length!==3)return c.error("Expected two arguments.");const f=c.parse(i[1],1,mt);if(!f)return null;const g=i[2];if(typeof g!="object"||Array.isArray(g))return c.error("NumberFormat options argument must be an object.");let b=null;if(g.locale&&(b=c.parse(g.locale,1,rr),!b))return null;let w=null;if(g.currency&&(w=c.parse(g.currency,1,rr),!w))return null;let T=null;if(g["min-fraction-digits"]&&(T=c.parse(g["min-fraction-digits"],1,mt),!T))return null;let I=null;return g["max-fraction-digits"]&&(I=c.parse(g["max-fraction-digits"],1,mt),!I)?null:new qc(f,b,w,T,I)}evaluate(i){return new Intl.NumberFormat(this.locale?this.locale.evaluate(i):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(i):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(i):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(i):void 0}).format(this.number.evaluate(i))}eachChild(i){i(this.number),this.locale&&i(this.locale),this.currency&&i(this.currency),this.minFractionDigits&&i(this.minFractionDigits),this.maxFractionDigits&&i(this.maxFractionDigits)}outputDefined(){return!1}}class wl{constructor(i){this.type=an,this.sections=i}static parse(i,c){if(i.length<2)return c.error("Expected at least one argument.");const f=i[1];if(!Array.isArray(f)&&typeof f=="object")return c.error("First argument must be an image or text section.");const g=[];let b=!1;for(let w=1;w<=i.length-1;++w){const T=i[w];if(b&&typeof T=="object"&&!Array.isArray(T)){b=!1;let I=null;if(T["font-scale"]&&(I=c.parse(T["font-scale"],1,mt),!I))return null;let L=null;if(T["text-font"]&&(L=c.parse(T["text-font"],1,te(rr)),!L))return null;let F=null;if(T["text-color"]&&(F=c.parse(T["text-color"],1,Nr),!F))return null;const j=g[g.length-1];j.scale=I,j.font=L,j.textColor=F}else{const I=c.parse(i[w],1,Qt);if(!I)return null;const L=I.type.kind;if(L!=="string"&&L!=="value"&&L!=="null"&&L!=="resolvedImage")return c.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");b=!0,g.push({content:I,scale:null,font:null,textColor:null})}}return new wl(g)}evaluate(i){return new Ri(this.sections.map(c=>{const f=c.content.evaluate(i);return In(f)===Z?new Oc("",f,null,null,null):new Oc(Ta(f),null,c.scale?c.scale.evaluate(i):null,c.font?c.font.evaluate(i).join(","):null,c.textColor?c.textColor.evaluate(i):null)}))}eachChild(i){for(const c of this.sections)i(c.content),c.scale&&i(c.scale),c.font&&i(c.font),c.textColor&&i(c.textColor)}outputDefined(){return!1}}class Gc{constructor(i){this.type=Z,this.input=i}static parse(i,c){if(i.length!==2)return c.error("Expected two arguments.");const f=c.parse(i[1],1,rr);return f?new Gc(f):c.error("No image name provided.")}evaluate(i){const c=this.input.evaluate(i),f=Xi.fromString(c);return f&&i.availableImages&&(f.available=i.availableImages.indexOf(c)>-1),f}eachChild(i){i(this.input)}outputDefined(){return!1}}class Wc{constructor(i){this.type=mt,this.input=i}static parse(i,c){if(i.length!==2)return c.error(`Expected 1 argument, but found ${i.length-1} instead.`);const f=c.parse(i[1],1);return f?f.type.kind!=="array"&&f.type.kind!=="string"&&f.type.kind!=="value"?c.error(`Expected argument of type string or array, but found ${le(f.type)} instead.`):new Wc(f):null}evaluate(i){const c=this.input.evaluate(i);if(typeof c=="string"||Array.isArray(c))return c.length;throw new rn(`Expected value to be of type string or array, but found ${le(In(c))} instead.`)}eachChild(i){i(this.input)}outputDefined(){return!1}}const Vs={"==":Yd,"!=":Qd,">":tp,"<":ep,">=":np,"<=":rp,array:Bi,at:Nc,boolean:Bi,case:Vc,coalesce:_l,collator:js,format:wl,image:Gc,in:jc,"index-of":vl,interpolate:oi,"interpolate-hcl":oi,"interpolate-lab":oi,length:Wc,let:yl,literal:Xo,match:Uc,number:Bi,"number-format":qc,object:Bi,slice:bl,step:Pa,string:Bi,"to-boolean":go,"to-color":go,"to-number":go,"to-string":go,var:pl,within:ds};function Nh(s,[i,c,f,g]){i=i.evaluate(s),c=c.evaluate(s),f=f.evaluate(s);const b=g?g.evaluate(s):1,w=Ns(i,c,f,b);if(w)throw new rn(w);return new zr(i/255,c/255,f/255,b,!1)}function jh(s,i){return s in i}function Zc(s,i){const c=i[s];return c===void 0?null:c}function ms(s){return{type:s}}function Uh(s){return{result:"success",value:s}}function qs(s){return{result:"error",value:s}}function Gs(s){return s["property-type"]==="data-driven"||s["property-type"]==="cross-faded-data-driven"}function Vh(s){return!!s.expression&&s.expression.parameters.indexOf("zoom")>-1}function Hc(s){return!!s.expression&&s.expression.interpolated}function kr(s){return s instanceof Number?"number":s instanceof String?"string":s instanceof Boolean?"boolean":Array.isArray(s)?"array":s===null?"null":typeof s}function xl(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function ip(s){return s}function qh(s,i){const c=i.type==="color",f=s.stops&&typeof s.stops[0][0]=="object",g=f||!(f||s.property!==void 0),b=s.type||(Hc(i)?"exponential":"interval");if(c||i.type==="padding"){const F=c?zr.parse:wi.parse;(s=Xn({},s)).stops&&(s.stops=s.stops.map(j=>[j[0],F(j[1])])),s.default=F(s.default?s.default:i.default)}if(s.colorSpace&&(w=s.colorSpace)!=="rgb"&&w!=="hcl"&&w!=="lab")throw new Error(`Unknown color space: "${s.colorSpace}"`);var w;let T,I,L;if(b==="exponential")T=wr;else if(b==="interval")T=op;else if(b==="categorical"){T=Sn,I=Object.create(null);for(const F of s.stops)I[F[0]]=F[1];L=typeof s.stops[0][0]}else{if(b!=="identity")throw new Error(`Unknown function type "${b}"`);T=$c}if(f){const F={},j=[];for(let ee=0;eeee[0]),evaluate:({zoom:ee},ae)=>wr({stops:H,base:s.base},i,ee).evaluate(ee,ae)}}if(g){const F=b==="exponential"?{name:"exponential",base:s.base!==void 0?s.base:1}:null;return{kind:"camera",interpolationType:F,interpolationFactor:oi.interpolationFactor.bind(void 0,F),zoomStops:s.stops.map(j=>j[0]),evaluate:({zoom:j})=>T(s,i,j,I,L)}}return{kind:"source",evaluate(F,j){const H=j&&j.properties?j.properties[s.property]:void 0;return H===void 0?za(s.default,i.default):T(s,i,H,I,L)}}}function za(s,i,c){return s!==void 0?s:i!==void 0?i:c!==void 0?c:void 0}function Sn(s,i,c,f,g){return za(typeof c===g?f[c]:void 0,s.default,i.default)}function op(s,i,c){if(kr(c)!=="number")return za(s.default,i.default);const f=s.stops.length;if(f===1||c<=s.stops[0][0])return s.stops[0][1];if(c>=s.stops[f-1][0])return s.stops[f-1][1];const g=La(s.stops.map(b=>b[0]),c);return s.stops[g][1]}function wr(s,i,c){const f=s.base!==void 0?s.base:1;if(kr(c)!=="number")return za(s.default,i.default);const g=s.stops.length;if(g===1||c<=s.stops[0][0])return s.stops[0][1];if(c>=s.stops[g-1][0])return s.stops[g-1][1];const b=La(s.stops.map(F=>F[0]),c),w=function(F,j,H,J){const ee=J-H,ae=F-H;return ee===0?0:j===1?ae/ee:(Math.pow(j,ae)-1)/(Math.pow(j,ee)-1)}(c,f,s.stops[b][0],s.stops[b+1][0]),T=s.stops[b][1],I=s.stops[b+1][1],L=di[i.type]||ip;return typeof T.evaluate=="function"?{evaluate(...F){const j=T.evaluate.apply(void 0,F),H=I.evaluate.apply(void 0,F);if(j!==void 0&&H!==void 0)return L(j,H,w,s.colorSpace)}}:L(T,I,w,s.colorSpace)}function $c(s,i,c){switch(i.type){case"color":c=zr.parse(c);break;case"formatted":c=Ri.fromString(c.toString());break;case"resolvedImage":c=Xi.fromString(c.toString());break;case"padding":c=wi.parse(c);break;default:kr(c)===i.type||i.type==="enum"&&i.values[c]||(c=void 0)}return za(c,s.default,i.default)}Fi.register(Vs,{error:[{kind:"error"},[rr],(s,[i])=>{throw new rn(i.evaluate(s))}],typeof:[rr,[Qt],(s,[i])=>le(In(i.evaluate(s)))],"to-rgba":[te(mt,4),[Nr],(s,[i])=>{const[c,f,g,b]=i.evaluate(s).rgb;return[255*c,255*f,255*g,b]}],rgb:[Nr,[mt,mt,mt],Nh],rgba:[Nr,[mt,mt,mt,mt],Nh],has:{type:Jt,overloads:[[[rr],(s,[i])=>jh(i.evaluate(s),s.properties())],[[rr,vi],(s,[i,c])=>jh(i.evaluate(s),c.evaluate(s))]]},get:{type:Qt,overloads:[[[rr],(s,[i])=>Zc(i.evaluate(s),s.properties())],[[rr,vi],(s,[i,c])=>Zc(i.evaluate(s),c.evaluate(s))]]},"feature-state":[Qt,[rr],(s,[i])=>Zc(i.evaluate(s),s.featureState||{})],properties:[vi,[],s=>s.properties()],"geometry-type":[rr,[],s=>s.geometryType()],id:[Qt,[],s=>s.id()],zoom:[mt,[],s=>s.globals.zoom],"heatmap-density":[mt,[],s=>s.globals.heatmapDensity||0],"line-progress":[mt,[],s=>s.globals.lineProgress||0],accumulated:[Qt,[],s=>s.globals.accumulated===void 0?null:s.globals.accumulated],"+":[mt,ms(mt),(s,i)=>{let c=0;for(const f of i)c+=f.evaluate(s);return c}],"*":[mt,ms(mt),(s,i)=>{let c=1;for(const f of i)c*=f.evaluate(s);return c}],"-":{type:mt,overloads:[[[mt,mt],(s,[i,c])=>i.evaluate(s)-c.evaluate(s)],[[mt],(s,[i])=>-i.evaluate(s)]]},"/":[mt,[mt,mt],(s,[i,c])=>i.evaluate(s)/c.evaluate(s)],"%":[mt,[mt,mt],(s,[i,c])=>i.evaluate(s)%c.evaluate(s)],ln2:[mt,[],()=>Math.LN2],pi:[mt,[],()=>Math.PI],e:[mt,[],()=>Math.E],"^":[mt,[mt,mt],(s,[i,c])=>Math.pow(i.evaluate(s),c.evaluate(s))],sqrt:[mt,[mt],(s,[i])=>Math.sqrt(i.evaluate(s))],log10:[mt,[mt],(s,[i])=>Math.log(i.evaluate(s))/Math.LN10],ln:[mt,[mt],(s,[i])=>Math.log(i.evaluate(s))],log2:[mt,[mt],(s,[i])=>Math.log(i.evaluate(s))/Math.LN2],sin:[mt,[mt],(s,[i])=>Math.sin(i.evaluate(s))],cos:[mt,[mt],(s,[i])=>Math.cos(i.evaluate(s))],tan:[mt,[mt],(s,[i])=>Math.tan(i.evaluate(s))],asin:[mt,[mt],(s,[i])=>Math.asin(i.evaluate(s))],acos:[mt,[mt],(s,[i])=>Math.acos(i.evaluate(s))],atan:[mt,[mt],(s,[i])=>Math.atan(i.evaluate(s))],min:[mt,ms(mt),(s,i)=>Math.min(...i.map(c=>c.evaluate(s)))],max:[mt,ms(mt),(s,i)=>Math.max(...i.map(c=>c.evaluate(s)))],abs:[mt,[mt],(s,[i])=>Math.abs(i.evaluate(s))],round:[mt,[mt],(s,[i])=>{const c=i.evaluate(s);return c<0?-Math.round(-c):Math.round(c)}],floor:[mt,[mt],(s,[i])=>Math.floor(i.evaluate(s))],ceil:[mt,[mt],(s,[i])=>Math.ceil(i.evaluate(s))],"filter-==":[Jt,[rr,Qt],(s,[i,c])=>s.properties()[i.value]===c.value],"filter-id-==":[Jt,[Qt],(s,[i])=>s.id()===i.value],"filter-type-==":[Jt,[rr],(s,[i])=>s.geometryType()===i.value],"filter-<":[Jt,[rr,Qt],(s,[i,c])=>{const f=s.properties()[i.value],g=c.value;return typeof f==typeof g&&f{const c=s.id(),f=i.value;return typeof c==typeof f&&c":[Jt,[rr,Qt],(s,[i,c])=>{const f=s.properties()[i.value],g=c.value;return typeof f==typeof g&&f>g}],"filter-id->":[Jt,[Qt],(s,[i])=>{const c=s.id(),f=i.value;return typeof c==typeof f&&c>f}],"filter-<=":[Jt,[rr,Qt],(s,[i,c])=>{const f=s.properties()[i.value],g=c.value;return typeof f==typeof g&&f<=g}],"filter-id-<=":[Jt,[Qt],(s,[i])=>{const c=s.id(),f=i.value;return typeof c==typeof f&&c<=f}],"filter->=":[Jt,[rr,Qt],(s,[i,c])=>{const f=s.properties()[i.value],g=c.value;return typeof f==typeof g&&f>=g}],"filter-id->=":[Jt,[Qt],(s,[i])=>{const c=s.id(),f=i.value;return typeof c==typeof f&&c>=f}],"filter-has":[Jt,[Qt],(s,[i])=>i.value in s.properties()],"filter-has-id":[Jt,[],s=>s.id()!==null&&s.id()!==void 0],"filter-type-in":[Jt,[te(rr)],(s,[i])=>i.value.indexOf(s.geometryType())>=0],"filter-id-in":[Jt,[te(Qt)],(s,[i])=>i.value.indexOf(s.id())>=0],"filter-in-small":[Jt,[rr,te(Qt)],(s,[i,c])=>c.value.indexOf(s.properties()[i.value])>=0],"filter-in-large":[Jt,[rr,te(Qt)],(s,[i,c])=>function(f,g,b,w){for(;b<=w;){const T=b+w>>1;if(g[T]===f)return!0;g[T]>f?w=T-1:b=T+1}return!1}(s.properties()[i.value],c.value,0,c.value.length-1)],all:{type:Jt,overloads:[[[Jt,Jt],(s,[i,c])=>i.evaluate(s)&&c.evaluate(s)],[ms(Jt),(s,i)=>{for(const c of i)if(!c.evaluate(s))return!1;return!0}]]},any:{type:Jt,overloads:[[[Jt,Jt],(s,[i,c])=>i.evaluate(s)||c.evaluate(s)],[ms(Jt),(s,i)=>{for(const c of i)if(c.evaluate(s))return!0;return!1}]]},"!":[Jt,[Jt],(s,[i])=>!i.evaluate(s)],"is-supported-script":[Jt,[rr],(s,[i])=>{const c=s.globals&&s.globals.isSupportedScript;return!c||c(i.evaluate(s))}],upcase:[rr,[rr],(s,[i])=>i.evaluate(s).toUpperCase()],downcase:[rr,[rr],(s,[i])=>i.evaluate(s).toLowerCase()],concat:[rr,ms(Qt),(s,i)=>i.map(c=>Ta(c.evaluate(s))).join("")],"resolved-locale":[rr,[ro],(s,[i])=>i.evaluate(s).resolvedLocale()]});class $r{constructor(i,c){var f;this.expression=i,this._warningHistory={},this._evaluator=new Dr,this._defaultValue=c?(f=c).type==="color"&&xl(f.default)?new zr(0,0,0,0):f.type==="color"?zr.parse(f.default)||null:f.type==="padding"?wi.parse(f.default)||null:f.type==="variableAnchorOffsetCollection"?$i.parse(f.default)||null:f.default===void 0?null:f.default:null,this._enumValues=c&&c.type==="enum"?c.values:null}evaluateWithoutErrorHandling(i,c,f,g,b,w){return this._evaluator.globals=i,this._evaluator.feature=c,this._evaluator.featureState=f,this._evaluator.canonical=g,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=w,this.expression.evaluate(this._evaluator)}evaluate(i,c,f,g,b,w){this._evaluator.globals=i,this._evaluator.feature=c||null,this._evaluator.featureState=f||null,this._evaluator.canonical=g,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=w||null;try{const T=this.expression.evaluate(this._evaluator);if(T==null||typeof T=="number"&&T!=T)return this._defaultValue;if(this._enumValues&&!(T in this._enumValues))throw new rn(`Expected value to be one of ${Object.keys(this._enumValues).map(I=>JSON.stringify(I)).join(", ")}, but found ${JSON.stringify(T)} instead.`);return T}catch(T){return this._warningHistory[T.message]||(this._warningHistory[T.message]=!0,typeof console<"u"&&console.warn(T.message)),this._defaultValue}}}function jr(s){return Array.isArray(s)&&s.length>0&&typeof s[0]=="string"&&s[0]in Vs}function gs(s,i){const c=new cl(Vs,Ca,[],i?function(g){const b={color:Nr,string:rr,number:mt,enum:rr,boolean:Jt,formatted:an,padding:pe,resolvedImage:Z,variableAnchorOffsetCollection:$};return g.type==="array"?te(b[g.value]||Qt,g.length):b[g.type]}(i):void 0),f=c.parse(s,void 0,void 0,void 0,i&&i.type==="string"?{typeAnnotation:"coerce"}:void 0);return f?Uh(new $r(f,i)):qs(c.errors)}class Sl{constructor(i,c){this.kind=i,this._styleExpression=c,this.isStateDependent=i!=="constant"&&!Ia(c.expression)}evaluateWithoutErrorHandling(i,c,f,g,b,w){return this._styleExpression.evaluateWithoutErrorHandling(i,c,f,g,b,w)}evaluate(i,c,f,g,b,w){return this._styleExpression.evaluate(i,c,f,g,b,w)}}class Xc{constructor(i,c,f,g){this.kind=i,this.zoomStops=f,this._styleExpression=c,this.isStateDependent=i!=="camera"&&!Ia(c.expression),this.interpolationType=g}evaluateWithoutErrorHandling(i,c,f,g,b,w){return this._styleExpression.evaluateWithoutErrorHandling(i,c,f,g,b,w)}evaluate(i,c,f,g,b,w){return this._styleExpression.evaluate(i,c,f,g,b,w)}interpolationFactor(i,c,f){return this.interpolationType?oi.interpolationFactor(this.interpolationType,i,c,f):0}}function Gh(s,i){const c=gs(s,i);if(c.result==="error")return c;const f=c.value.expression,g=ml(f);if(!g&&!Gs(i))return qs([new xn("","data expressions not supported")]);const b=Aa(f,["zoom"]);if(!b&&!Vh(i))return qs([new xn("","zoom expressions not supported")]);const w=Tl(f);return w||b?w instanceof xn?qs([w]):w instanceof oi&&!Hc(i)?qs([new xn("",'"interpolate" expressions cannot be used with this property')]):Uh(w?new Xc(g?"camera":"composite",c.value,w.labels,w instanceof oi?w.interpolation:void 0):new Sl(g?"constant":"source",c.value)):qs([new xn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class kl{constructor(i,c){this._parameters=i,this._specification=c,Xn(this,qh(this._parameters,this._specification))}static deserialize(i){return new kl(i._parameters,i._specification)}static serialize(i){return{_parameters:i._parameters,_specification:i._specification}}}function Tl(s){let i=null;if(s instanceof yl)i=Tl(s.result);else if(s instanceof _l){for(const c of s.args)if(i=Tl(c),i)break}else(s instanceof Pa||s instanceof oi)&&s.input instanceof Fi&&s.input.name==="zoom"&&(i=s);return i instanceof xn||s.eachChild(c=>{const f=Tl(c);f instanceof xn?i=f:!i&&f?i=new xn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):i&&f&&i!==f&&(i=new xn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),i}function El(s){if(s===!0||s===!1)return!0;if(!Array.isArray(s)||s.length===0)return!1;switch(s[0]){case"has":return s.length>=2&&s[1]!=="$id"&&s[1]!=="$type";case"in":return s.length>=3&&(typeof s[1]!="string"||Array.isArray(s[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return s.length!==3||Array.isArray(s[1])||Array.isArray(s[2]);case"any":case"all":for(const i of s.slice(1))if(!El(i)&&typeof i!="boolean")return!1;return!0;default:return!0}}const Wh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ml(s){if(s==null)return{filter:()=>!0,needGeometry:!1};El(s)||(s=Il(s));const i=gs(s,Wh);if(i.result==="error")throw new Error(i.value.map(c=>`${c.key}: ${c.message}`).join(", "));return{filter:(c,f,g)=>i.value.evaluate(c,f,{},g),needGeometry:Cl(s)}}function Zh(s,i){return si?1:0}function Cl(s){if(!Array.isArray(s))return!1;if(s[0]==="within")return!0;for(let i=1;i"||i==="<="||i===">="?Kc(s[1],s[2],i):i==="any"?(c=s.slice(1),["any"].concat(c.map(Il))):i==="all"?["all"].concat(s.slice(1).map(Il)):i==="none"?["all"].concat(s.slice(1).map(Il).map(Al)):i==="in"?Hh(s[1],s.slice(2)):i==="!in"?Al(Hh(s[1],s.slice(2))):i==="has"?$h(s[1]):i==="!has"?Al($h(s[1])):i!=="within"||s;var c}function Kc(s,i,c){switch(s){case"$type":return[`filter-type-${c}`,i];case"$id":return[`filter-id-${c}`,i];default:return[`filter-${c}`,s,i]}}function Hh(s,i){if(i.length===0)return!1;switch(s){case"$type":return["filter-type-in",["literal",i]];case"$id":return["filter-id-in",["literal",i]];default:return i.length>200&&!i.some(c=>typeof c!=typeof i[0])?["filter-in-large",s,["literal",i.sort(Zh)]]:["filter-in-small",s,["literal",i]]}}function $h(s){switch(s){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",s]}}function Al(s){return["!",s]}function Jc(s){const i=typeof s;if(i==="number"||i==="boolean"||i==="string"||s==null)return JSON.stringify(s);if(Array.isArray(s)){let g="[";for(const b of s)g+=`${Jc(b)},`;return`${g}]`}const c=Object.keys(s).sort();let f="{";for(let g=0;gf.maximum?[new ct(i,c,`${c} is greater than the maximum value ${f.maximum}`)]:[]}function Kh(s){const i=s.valueSpec,c=cn(s.value.type);let f,g,b,w={};const T=c!=="categorical"&&s.value.property===void 0,I=!T,L=kr(s.value.stops)==="array"&&kr(s.value.stops[0])==="array"&&kr(s.value.stops[0][0])==="object",F=pi({key:s.key,value:s.value,valueSpec:s.styleSpec.function,validateSpec:s.validateSpec,style:s.style,styleSpec:s.styleSpec,objectElementValidators:{stops:function(J){if(c==="identity")return[new ct(J.key,J.value,'identity function may not have a "stops" property')];let ee=[];const ae=J.value;return ee=ee.concat(Yc({key:J.key,value:ae,valueSpec:J.valueSpec,validateSpec:J.validateSpec,style:J.style,styleSpec:J.styleSpec,arrayElementValidator:j})),kr(ae)==="array"&&ae.length===0&&ee.push(new ct(J.key,ae,"array must have at least one stop")),ee},default:function(J){return J.validateSpec({key:J.key,value:J.value,valueSpec:i,validateSpec:J.validateSpec,style:J.style,styleSpec:J.styleSpec})}}});return c==="identity"&&T&&F.push(new ct(s.key,s.value,'missing required property "property"')),c==="identity"||s.value.stops||F.push(new ct(s.key,s.value,'missing required property "stops"')),c==="exponential"&&s.valueSpec.expression&&!Hc(s.valueSpec)&&F.push(new ct(s.key,s.value,"exponential functions not supported")),s.styleSpec.$version>=8&&(I&&!Gs(s.valueSpec)?F.push(new ct(s.key,s.value,"property functions not supported")):T&&!Vh(s.valueSpec)&&F.push(new ct(s.key,s.value,"zoom functions not supported"))),c!=="categorical"&&!L||s.value.property!==void 0||F.push(new ct(s.key,s.value,'"property" property is required')),F;function j(J){let ee=[];const ae=J.value,ge=J.key;if(kr(ae)!=="array")return[new ct(ge,ae,`array expected, ${kr(ae)} found`)];if(ae.length!==2)return[new ct(ge,ae,`array length 2 expected, length ${ae.length} found`)];if(L){if(kr(ae[0])!=="object")return[new ct(ge,ae,`object expected, ${kr(ae[0])} found`)];if(ae[0].zoom===void 0)return[new ct(ge,ae,"object stop key must have zoom")];if(ae[0].value===void 0)return[new ct(ge,ae,"object stop key must have value")];if(b&&b>cn(ae[0].zoom))return[new ct(ge,ae[0].zoom,"stop zoom values must appear in ascending order")];cn(ae[0].zoom)!==b&&(b=cn(ae[0].zoom),g=void 0,w={}),ee=ee.concat(pi({key:`${ge}[0]`,value:ae[0],valueSpec:{zoom:{}},validateSpec:J.validateSpec,style:J.style,styleSpec:J.styleSpec,objectElementValidators:{zoom:Ll,value:H}}))}else ee=ee.concat(H({key:`${ge}[0]`,value:ae[0],valueSpec:{},validateSpec:J.validateSpec,style:J.style,styleSpec:J.styleSpec},ae));return jr(Jo(ae[1]))?ee.concat([new ct(`${ge}[1]`,ae[1],"expressions are not allowed in function stops.")]):ee.concat(J.validateSpec({key:`${ge}[1]`,value:ae[1],valueSpec:i,validateSpec:J.validateSpec,style:J.style,styleSpec:J.styleSpec}))}function H(J,ee){const ae=kr(J.value),ge=cn(J.value),xe=J.value!==null?J.value:ee;if(f){if(ae!==f)return[new ct(J.key,xe,`${ae} stop domain type must match previous stop domain type ${f}`)]}else f=ae;if(ae!=="number"&&ae!=="string"&&ae!=="boolean")return[new ct(J.key,xe,"stop domain value must be a number, string, or boolean")];if(ae!=="number"&&c!=="categorical"){let Re=`number expected, ${ae} found`;return Gs(i)&&c===void 0&&(Re+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ct(J.key,xe,Re)]}return c!=="categorical"||ae!=="number"||isFinite(ge)&&Math.floor(ge)===ge?c!=="categorical"&&ae==="number"&&g!==void 0&&genew ct(`${s.key}${f.key}`,s.value,f.message));const c=i.value.expression||i.value._styleExpression.expression;if(s.expressionContext==="property"&&s.propertyKey==="text-font"&&!c.outputDefined())return[new ct(s.key,s.value,`Invalid data expression for "${s.propertyKey}". Output values must be contained as literals within the expression.`)];if(s.expressionContext==="property"&&s.propertyType==="layout"&&!Ia(c))return[new ct(s.key,s.value,'"feature-state" data expressions are not supported with layout properties.')];if(s.expressionContext==="filter"&&!Ia(c))return[new ct(s.key,s.value,'"feature-state" data expressions are not supported with filters.')];if(s.expressionContext&&s.expressionContext.indexOf("cluster")===0){if(!Aa(c,["zoom","feature-state"]))return[new ct(s.key,s.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(s.expressionContext==="cluster-initial"&&!ml(c))return[new ct(s.key,s.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Qo(s){const i=s.key,c=s.value,f=s.valueSpec,g=[];return Array.isArray(f.values)?f.values.indexOf(cn(c))===-1&&g.push(new ct(i,c,`expected one of [${f.values.join(", ")}], ${JSON.stringify(c)} found`)):Object.keys(f.values).indexOf(cn(c))===-1&&g.push(new ct(i,c,`expected one of [${Object.keys(f.values).join(", ")}], ${JSON.stringify(c)} found`)),g}function Ws(s){return El(Jo(s.value))?Yo(Xn({},s,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Qc(s)}function Qc(s){const i=s.value,c=s.key;if(kr(i)!=="array")return[new ct(c,i,`array expected, ${kr(i)} found`)];const f=s.styleSpec;let g,b=[];if(i.length<1)return[new ct(c,i,"filter array must have at least 1 element")];switch(b=b.concat(Qo({key:`${c}[0]`,value:i[0],valueSpec:f.filter_operator,style:s.style,styleSpec:s.styleSpec})),cn(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&cn(i[1])==="$type"&&b.push(new ct(c,i,`"$type" cannot be use with operator "${i[0]}"`));case"==":case"!=":i.length!==3&&b.push(new ct(c,i,`filter array for operator "${i[0]}" must have 3 elements`));case"in":case"!in":i.length>=2&&(g=kr(i[1]),g!=="string"&&b.push(new ct(`${c}[1]`,i[1],`string expected, ${g} found`)));for(let w=2;w{L in c&&i.push(new ct(f,c[L],`"${L}" is prohibited for ref layers`))}),g.layers.forEach(L=>{cn(L.id)===T&&(I=L)}),I?I.ref?i.push(new ct(f,c.ref,"ref cannot reference another ref layer")):w=cn(I.type):i.push(new ct(f,c.ref,`ref layer "${T}" not found`))}else if(w!=="background")if(c.source){const I=g.sources&&g.sources[c.source],L=I&&cn(I.type);I?L==="vector"&&w==="raster"?i.push(new ct(f,c.source,`layer "${c.id}" requires a raster source`)):L!=="raster-dem"&&w==="hillshade"?i.push(new ct(f,c.source,`layer "${c.id}" requires a raster-dem source`)):L==="raster"&&w!=="raster"?i.push(new ct(f,c.source,`layer "${c.id}" requires a vector source`)):L!=="vector"||c["source-layer"]?L==="raster-dem"&&w!=="hillshade"?i.push(new ct(f,c.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!c.paint||!c.paint["line-gradient"]||L==="geojson"&&I.lineMetrics||i.push(new ct(f,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):i.push(new ct(f,c,`layer "${c.id}" must specify a "source-layer"`)):i.push(new ct(f,c.source,`source "${c.source}" not found`))}else i.push(new ct(f,c,'missing required property "source"'));return i=i.concat(pi({key:f,value:c,valueSpec:b.layer,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,objectElementValidators:{"*":()=>[],type:()=>s.validateSpec({key:`${f}.type`,value:c.type,valueSpec:b.layer.type,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,object:c,objectKey:"type"}),filter:Ws,layout:I=>pi({layer:c,key:I.key,value:I.value,style:I.style,styleSpec:I.styleSpec,validateSpec:I.validateSpec,objectElementValidators:{"*":L=>tu(Xn({layerType:w},L))}}),paint:I=>pi({layer:c,key:I.key,value:I.value,style:I.style,styleSpec:I.styleSpec,validateSpec:I.validateSpec,objectElementValidators:{"*":L=>eu(Xn({layerType:w},L))}})}})),i}function _s(s){const i=s.value,c=s.key,f=kr(i);return f!=="string"?[new ct(c,i,`string expected, ${f} found`)]:[]}const Jh={promoteId:function({key:s,value:i}){if(kr(i)==="string")return _s({key:s,value:i});{const c=[];for(const f in i)c.push(..._s({key:`${s}.${f}`,value:i[f]}));return c}}};function Yh(s){const i=s.value,c=s.key,f=s.styleSpec,g=s.style,b=s.validateSpec;if(!i.type)return[new ct(c,i,'"type" is required')];const w=cn(i.type);let T;switch(w){case"vector":case"raster":return T=pi({key:c,value:i,valueSpec:f[`source_${w.replace("-","_")}`],style:s.style,styleSpec:f,objectElementValidators:Jh,validateSpec:b}),T;case"raster-dem":return T=function(I){var L;const F=(L=I.sourceName)!==null&&L!==void 0?L:"",j=I.value,H=I.styleSpec,J=H.source_raster_dem,ee=I.style;let ae=[];const ge=kr(j);if(j===void 0)return ae;if(ge!=="object")return ae.push(new ct("source_raster_dem",j,`object expected, ${ge} found`)),ae;const xe=cn(j.encoding)==="custom",Re=["redFactor","greenFactor","blueFactor","baseShift"],ke=I.value.encoding?`"${I.value.encoding}"`:"Default";for(const Ae in j)!xe&&Re.includes(Ae)?ae.push(new ct(Ae,j[Ae],`In "${F}": "${Ae}" is only valid when "encoding" is set to "custom". ${ke} encoding found`)):J[Ae]?ae=ae.concat(I.validateSpec({key:Ae,value:j[Ae],valueSpec:J[Ae],validateSpec:I.validateSpec,style:ee,styleSpec:H})):ae.push(new ct(Ae,j[Ae],`unknown property "${Ae}"`));return ae}({sourceName:c,value:i,style:s.style,styleSpec:f,validateSpec:b}),T;case"geojson":if(T=pi({key:c,value:i,valueSpec:f.source_geojson,style:g,styleSpec:f,validateSpec:b,objectElementValidators:Jh}),i.cluster)for(const I in i.clusterProperties){const[L,F]=i.clusterProperties[I],j=typeof L=="string"?[L,["accumulated"],["get",I]]:L;T.push(...Yo({key:`${c}.${I}.map`,value:F,validateSpec:b,expressionContext:"cluster-map"})),T.push(...Yo({key:`${c}.${I}.reduce`,value:j,validateSpec:b,expressionContext:"cluster-reduce"}))}return T;case"video":return pi({key:c,value:i,valueSpec:f.source_video,style:g,validateSpec:b,styleSpec:f});case"image":return pi({key:c,value:i,valueSpec:f.source_image,style:g,validateSpec:b,styleSpec:f});case"canvas":return[new ct(c,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Qo({key:`${c}.type`,value:i.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:g,validateSpec:b,styleSpec:f})}}function Qh(s){const i=s.value,c=s.styleSpec,f=c.light,g=s.style;let b=[];const w=kr(i);if(i===void 0)return b;if(w!=="object")return b=b.concat([new ct("light",i,`object expected, ${w} found`)]),b;for(const T in i){const I=T.match(/^(.*)-transition$/);b=b.concat(I&&f[I[1]]&&f[I[1]].transition?s.validateSpec({key:T,value:i[T],valueSpec:c.transition,validateSpec:s.validateSpec,style:g,styleSpec:c}):f[T]?s.validateSpec({key:T,value:i[T],valueSpec:f[T],validateSpec:s.validateSpec,style:g,styleSpec:c}):[new ct(T,i[T],`unknown property "${T}"`)])}return b}function ef(s){const i=s.value,c=s.styleSpec,f=c.sky,g=s.style,b=kr(i);if(i===void 0)return[];if(b!=="object")return[new ct("sky",i,`object expected, ${b} found`)];let w=[];for(const T in i)w=w.concat(f[T]?_o({key:T,value:i[T],valueSpec:f[T],style:g,styleSpec:c}):[new ct(T,i[T],`unknown property "${T}"`)]);return w}function Ra(s){const i=s.value,c=s.styleSpec,f=c.terrain,g=s.style;let b=[];const w=kr(i);if(i===void 0)return b;if(w!=="object")return b=b.concat([new ct("terrain",i,`object expected, ${w} found`)]),b;for(const T in i)b=b.concat(f[T]?s.validateSpec({key:T,value:i[T],valueSpec:f[T],validateSpec:s.validateSpec,style:g,styleSpec:c}):[new ct(T,i[T],`unknown property "${T}"`)]);return b}function Ba(s){let i=[];const c=s.value,f=s.key;if(Array.isArray(c)){const g=[],b=[];for(const w in c)c[w].id&&g.includes(c[w].id)&&i.push(new ct(f,c,`all the sprites' ids must be unique, but ${c[w].id} is duplicated`)),g.push(c[w].id),c[w].url&&b.includes(c[w].url)&&i.push(new ct(f,c,`all the sprites' URLs must be unique, but ${c[w].url} is duplicated`)),b.push(c[w].url),i=i.concat(pi({key:`${f}[${w}]`,value:c[w],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:s.validateSpec}));return i}return _s({key:f,value:c})}const xi={"*":()=>[],array:Yc,boolean:function(s){const i=s.value,c=s.key,f=kr(i);return f!=="boolean"?[new ct(c,i,`boolean expected, ${f} found`)]:[]},number:Ll,color:function(s){const i=s.key,c=s.value,f=kr(c);return f!=="string"?[new ct(i,c,`color expected, ${f} found`)]:zr.parse(String(c))?[]:[new ct(i,c,`color expected, "${c}" found`)]},constants:Xh,enum:Qo,filter:Ws,function:Kh,layer:Da,object:pi,source:Yh,light:Qh,sky:ef,terrain:Ra,string:_s,formatted:function(s){return _s(s).length===0?[]:Yo(s)},resolvedImage:function(s){return _s(s).length===0?[]:Yo(s)},padding:function(s){const i=s.key,c=s.value;if(kr(c)==="array"){if(c.length<1||c.length>4)return[new ct(i,c,`padding requires 1 to 4 values; ${c.length} values found`)];const f={type:"number"};let g=[];for(let b=0;b[]}})),s.constants&&(c=c.concat(Xh({key:"constants",value:s.constants,style:s,styleSpec:i,validateSpec:_o}))),Zs(c)}function yo(s){return function(i){return s({...i,validateSpec:_o})}}function Zs(s){return[].concat(s).sort((i,c)=>i.line-c.line)}function io(s){return function(...i){return Zs(s.apply(this,i))}}no.source=io(yo(Yh)),no.sprite=io(yo(Ba)),no.glyphs=io(yo(ru)),no.light=io(yo(Qh)),no.sky=io(yo(ef)),no.terrain=io(yo(Ra)),no.layer=io(yo(Da)),no.filter=io(yo(Ws)),no.paintProperty=io(yo(eu)),no.layoutProperty=io(yo(tu));const ys=no,ap=ys.light,nu=ys.paintProperty,lp=ys.layoutProperty;function Hs(s,i){let c=!1;if(i&&i.length)for(const f of i)s.fire(new tt(new Error(f.message))),c=!0;return c}class Fa{constructor(i,c,f){const g=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;const w=new Int32Array(this.arrayBuffer);i=w[0],this.d=(c=w[1])+2*(f=w[2]);for(let I=0;I=j[ee+0]&&g>=j[ee+1])?(T[J]=!0,w.push(F[J])):T[J]=!1}}}}_forEachCell(i,c,f,g,b,w,T,I){const L=this._convertToCellCoord(i),F=this._convertToCellCoord(c),j=this._convertToCellCoord(f),H=this._convertToCellCoord(g);for(let J=L;J<=j;J++)for(let ee=F;ee<=H;ee++){const ae=this.d*ee+J;if((!I||I(this._convertFromCellCoord(J),this._convertFromCellCoord(ee),this._convertFromCellCoord(J+1),this._convertFromCellCoord(ee+1)))&&b.call(this,i,c,f,g,ae,w,T,I))return}}_convertFromCellCoord(i){return(i-this.padding)/this.scale}_convertToCellCoord(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const i=this.cells,c=3+this.cells.length+1+1;let f=0;for(let w=0;w=0)continue;const w=s[b];g[b]=vo[f].shallow.indexOf(b)>=0?w:$s(w,i)}s instanceof Error&&(g.message=s.message)}if(g.$name)throw new Error("$name property is reserved for worker serialization logic.");return f!=="Object"&&(g.$name=f),g}throw new Error("can't serialize object of type "+typeof s)}function Xs(s){if(s==null||typeof s=="boolean"||typeof s=="number"||typeof s=="string"||s instanceof Boolean||s instanceof Number||s instanceof String||s instanceof Date||s instanceof RegExp||s instanceof Blob||s instanceof Error||zl(s)||Ke(s)||ArrayBuffer.isView(s)||s instanceof ImageData)return s;if(Array.isArray(s))return s.map(Xs);if(typeof s=="object"){const i=s.$name||"Object";if(!vo[i])throw new Error(`can't deserialize unregistered class ${i}`);const{klass:c}=vo[i];if(!c)throw new Error(`can't deserialize unregistered class ${i}`);if(c.deserialize)return c.deserialize(s);const f=Object.create(c.prototype);for(const g of Object.keys(s)){if(g==="$name")continue;const b=s[g];f[g]=vo[i].shallow.indexOf(g)>=0?b:Xs(b)}return f}throw new Error("can't deserialize object of type "+typeof s)}class tf{constructor(){this.first=!0}update(i,c){const f=Math.floor(i);return this.first?(this.first=!1,this.lastIntegerZoom=f,this.lastIntegerZoomTime=0,this.lastZoom=i,this.lastFloorZoom=f,!0):(this.lastFloorZoom>f?(this.lastIntegerZoom=f+1,this.lastIntegerZoomTime=c):this.lastFloorZooms>=128&&s<=255,Arabic:s=>s>=1536&&s<=1791,"Arabic Supplement":s=>s>=1872&&s<=1919,"Arabic Extended-A":s=>s>=2208&&s<=2303,"Hangul Jamo":s=>s>=4352&&s<=4607,"Unified Canadian Aboriginal Syllabics":s=>s>=5120&&s<=5759,Khmer:s=>s>=6016&&s<=6143,"Unified Canadian Aboriginal Syllabics Extended":s=>s>=6320&&s<=6399,"General Punctuation":s=>s>=8192&&s<=8303,"Letterlike Symbols":s=>s>=8448&&s<=8527,"Number Forms":s=>s>=8528&&s<=8591,"Miscellaneous Technical":s=>s>=8960&&s<=9215,"Control Pictures":s=>s>=9216&&s<=9279,"Optical Character Recognition":s=>s>=9280&&s<=9311,"Enclosed Alphanumerics":s=>s>=9312&&s<=9471,"Geometric Shapes":s=>s>=9632&&s<=9727,"Miscellaneous Symbols":s=>s>=9728&&s<=9983,"Miscellaneous Symbols and Arrows":s=>s>=11008&&s<=11263,"CJK Radicals Supplement":s=>s>=11904&&s<=12031,"Kangxi Radicals":s=>s>=12032&&s<=12255,"Ideographic Description Characters":s=>s>=12272&&s<=12287,"CJK Symbols and Punctuation":s=>s>=12288&&s<=12351,Hiragana:s=>s>=12352&&s<=12447,Katakana:s=>s>=12448&&s<=12543,Bopomofo:s=>s>=12544&&s<=12591,"Hangul Compatibility Jamo":s=>s>=12592&&s<=12687,Kanbun:s=>s>=12688&&s<=12703,"Bopomofo Extended":s=>s>=12704&&s<=12735,"CJK Strokes":s=>s>=12736&&s<=12783,"Katakana Phonetic Extensions":s=>s>=12784&&s<=12799,"Enclosed CJK Letters and Months":s=>s>=12800&&s<=13055,"CJK Compatibility":s=>s>=13056&&s<=13311,"CJK Unified Ideographs Extension A":s=>s>=13312&&s<=19903,"Yijing Hexagram Symbols":s=>s>=19904&&s<=19967,"CJK Unified Ideographs":s=>s>=19968&&s<=40959,"Yi Syllables":s=>s>=40960&&s<=42127,"Yi Radicals":s=>s>=42128&&s<=42191,"Hangul Jamo Extended-A":s=>s>=43360&&s<=43391,"Hangul Syllables":s=>s>=44032&&s<=55215,"Hangul Jamo Extended-B":s=>s>=55216&&s<=55295,"Private Use Area":s=>s>=57344&&s<=63743,"CJK Compatibility Ideographs":s=>s>=63744&&s<=64255,"Arabic Presentation Forms-A":s=>s>=64336&&s<=65023,"Vertical Forms":s=>s>=65040&&s<=65055,"CJK Compatibility Forms":s=>s>=65072&&s<=65103,"Small Form Variants":s=>s>=65104&&s<=65135,"Arabic Presentation Forms-B":s=>s>=65136&&s<=65279,"Halfwidth and Fullwidth Forms":s=>s>=65280&&s<=65519};function Ks(s){for(const i of s)if(Dl(i.charCodeAt(0)))return!0;return!1}function rf(s){for(const i of s)if(!nf(i.charCodeAt(0)))return!1;return!0}function nf(s){return!(xt.Arabic(s)||xt["Arabic Supplement"](s)||xt["Arabic Extended-A"](s)||xt["Arabic Presentation Forms-A"](s)||xt["Arabic Presentation Forms-B"](s))}function Dl(s){return!(s!==746&&s!==747&&(s<4352||!(xt["Bopomofo Extended"](s)||xt.Bopomofo(s)||xt["CJK Compatibility Forms"](s)&&!(s>=65097&&s<=65103)||xt["CJK Compatibility Ideographs"](s)||xt["CJK Compatibility"](s)||xt["CJK Radicals Supplement"](s)||xt["CJK Strokes"](s)||!(!xt["CJK Symbols and Punctuation"](s)||s>=12296&&s<=12305||s>=12308&&s<=12319||s===12336)||xt["CJK Unified Ideographs Extension A"](s)||xt["CJK Unified Ideographs"](s)||xt["Enclosed CJK Letters and Months"](s)||xt["Hangul Compatibility Jamo"](s)||xt["Hangul Jamo Extended-A"](s)||xt["Hangul Jamo Extended-B"](s)||xt["Hangul Jamo"](s)||xt["Hangul Syllables"](s)||xt.Hiragana(s)||xt["Ideographic Description Characters"](s)||xt.Kanbun(s)||xt["Kangxi Radicals"](s)||xt["Katakana Phonetic Extensions"](s)||xt.Katakana(s)&&s!==12540||!(!xt["Halfwidth and Fullwidth Forms"](s)||s===65288||s===65289||s===65293||s>=65306&&s<=65310||s===65339||s===65341||s===65343||s>=65371&&s<=65503||s===65507||s>=65512&&s<=65519)||!(!xt["Small Form Variants"](s)||s>=65112&&s<=65118||s>=65123&&s<=65126)||xt["Unified Canadian Aboriginal Syllabics"](s)||xt["Unified Canadian Aboriginal Syllabics Extended"](s)||xt["Vertical Forms"](s)||xt["Yijing Hexagram Symbols"](s)||xt["Yi Syllables"](s)||xt["Yi Radicals"](s))))}function iu(s){return!(Dl(s)||function(i){return!!(xt["Latin-1 Supplement"](i)&&(i===167||i===169||i===174||i===177||i===188||i===189||i===190||i===215||i===247)||xt["General Punctuation"](i)&&(i===8214||i===8224||i===8225||i===8240||i===8241||i===8251||i===8252||i===8258||i===8263||i===8264||i===8265||i===8273)||xt["Letterlike Symbols"](i)||xt["Number Forms"](i)||xt["Miscellaneous Technical"](i)&&(i>=8960&&i<=8967||i>=8972&&i<=8991||i>=8996&&i<=9e3||i===9003||i>=9085&&i<=9114||i>=9150&&i<=9165||i===9167||i>=9169&&i<=9179||i>=9186&&i<=9215)||xt["Control Pictures"](i)&&i!==9251||xt["Optical Character Recognition"](i)||xt["Enclosed Alphanumerics"](i)||xt["Geometric Shapes"](i)||xt["Miscellaneous Symbols"](i)&&!(i>=9754&&i<=9759)||xt["Miscellaneous Symbols and Arrows"](i)&&(i>=11026&&i<=11055||i>=11088&&i<=11097||i>=11192&&i<=11243)||xt["CJK Symbols and Punctuation"](i)||xt.Katakana(i)||xt["Private Use Area"](i)||xt["CJK Compatibility Forms"](i)||xt["Small Form Variants"](i)||xt["Halfwidth and Fullwidth Forms"](i)||i===8734||i===8756||i===8757||i>=9984&&i<=10087||i>=10102&&i<=10131||i===65532||i===65533)}(s))}function Rl(s){return s>=1424&&s<=2303||xt["Arabic Presentation Forms-A"](s)||xt["Arabic Presentation Forms-B"](s)}function of(s,i){return!(!i&&Rl(s)||s>=2304&&s<=3583||s>=3840&&s<=4255||xt.Khmer(s))}function cp(s){for(const i of s)if(Rl(i.charCodeAt(0)))return!0;return!1}const es=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(s){this.pluginStatus=s.pluginStatus,this.pluginURL=s.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(s){this.applyArabicShaping=s.applyArabicShaping,this.processBidirectionalText=s.processBidirectionalText,this.processStyledBidirectionalText=s.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Qr{constructor(i,c){this.zoom=i,c?(this.now=c.now,this.fadeDuration=c.fadeDuration,this.zoomHistory=c.zoomHistory,this.transition=c.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new tf,this.transition={})}isSupportedScript(i){return function(c,f){for(const g of c)if(!of(g.charCodeAt(0),f))return!1;return!0}(i,es.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const i=this.zoom,c=i-Math.floor(i),f=this.crossFadingFactor();return i>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:c+(1-c)*f}:{fromScale:.5,toScale:1,t:1-(1-f)*c}}}class Oa{constructor(i,c){this.property=i,this.value=c,this.expression=function(f,g){if(xl(f))return new kl(f,g);if(jr(f)){const b=Gh(f,g);if(b.result==="error")throw new Error(b.value.map(w=>`${w.key}: ${w.message}`).join(", "));return b.value}{let b=f;return g.type==="color"&&typeof f=="string"?b=zr.parse(f):g.type!=="padding"||typeof f!="number"&&!Array.isArray(f)?g.type==="variableAnchorOffsetCollection"&&Array.isArray(f)&&(b=$i.parse(f)):b=wi.parse(f),{kind:"constant",evaluate:()=>b}}}(c===void 0?i.specification.default:c,i.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(i,c,f){return this.property.possiblyEvaluate(this,i,c,f)}}class Bl{constructor(i){this.property=i,this.value=new Oa(i,void 0)}transitioned(i,c){return new sf(this.property,this.value,c,X({},i.transition,this.transition),i.now)}untransitioned(){return new sf(this.property,this.value,null,{},0)}}class ou{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitionablePropertyValues)}getValue(i){return re(this._values[i].value.value)}setValue(i,c){Object.prototype.hasOwnProperty.call(this._values,i)||(this._values[i]=new Bl(this._values[i].property)),this._values[i].value=new Oa(this._values[i].property,c===null?void 0:re(c))}getTransition(i){return re(this._values[i].transition)}setTransition(i,c){Object.prototype.hasOwnProperty.call(this._values,i)||(this._values[i]=new Bl(this._values[i].property)),this._values[i].transition=re(c)||void 0}serialize(){const i={};for(const c of Object.keys(this._values)){const f=this.getValue(c);f!==void 0&&(i[c]=f);const g=this.getTransition(c);g!==void 0&&(i[`${c}-transition`]=g)}return i}transitioned(i,c){const f=new af(this._properties);for(const g of Object.keys(this._values))f._values[g]=this._values[g].transitioned(i,c._values[g]);return f}untransitioned(){const i=new af(this._properties);for(const c of Object.keys(this._values))i._values[c]=this._values[c].untransitioned();return i}}class sf{constructor(i,c,f,g,b){this.property=i,this.value=c,this.begin=b+g.delay||0,this.end=this.begin+g.duration||0,i.specification.transition&&(g.delay||g.duration)&&(this.prior=f)}possiblyEvaluate(i,c,f){const g=i.now||0,b=this.value.possiblyEvaluate(i,c,f),w=this.prior;if(w){if(g>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(g=1)return 1;const L=I*I,F=L*I;return 4*(I<.5?F:3*(I-L)+F-.75)}(T))}}return b}}class af{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitioningPropertyValues)}possiblyEvaluate(i,c,f){const g=new Na(this._properties);for(const b of Object.keys(this._values))g._values[b]=this._values[b].possiblyEvaluate(i,c,f);return g}hasTransition(){for(const i of Object.keys(this._values))if(this._values[i].prior)return!0;return!1}}class lf{constructor(i){this._properties=i,this._values=Object.create(i.defaultPropertyValues)}hasValue(i){return this._values[i].value!==void 0}getValue(i){return re(this._values[i].value)}setValue(i,c){this._values[i]=new Oa(this._values[i].property,c===null?void 0:re(c))}serialize(){const i={};for(const c of Object.keys(this._values)){const f=this.getValue(c);f!==void 0&&(i[c]=f)}return i}possiblyEvaluate(i,c,f){const g=new Na(this._properties);for(const b of Object.keys(this._values))g._values[b]=this._values[b].possiblyEvaluate(i,c,f);return g}}class oo{constructor(i,c,f){this.property=i,this.value=c,this.parameters=f}isConstant(){return this.value.kind==="constant"}constantOr(i){return this.value.kind==="constant"?this.value.value:i}evaluate(i,c,f,g){return this.property.evaluate(this.value,this.parameters,i,c,f,g)}}class Na{constructor(i){this._properties=i,this._values=Object.create(i.defaultPossiblyEvaluatedValues)}get(i){return this._values[i]}}class Bt{constructor(i){this.specification=i}possiblyEvaluate(i,c){if(i.isDataDriven())throw new Error("Value should not be data driven");return i.expression.evaluate(c)}interpolate(i,c,f){const g=di[this.specification.type];return g?g(i,c,f):i}}class Gt{constructor(i,c){this.specification=i,this.overrides=c}possiblyEvaluate(i,c,f,g){return new oo(this,i.expression.kind==="constant"||i.expression.kind==="camera"?{kind:"constant",value:i.expression.evaluate(c,null,{},f,g)}:i.expression,c)}interpolate(i,c,f){if(i.value.kind!=="constant"||c.value.kind!=="constant")return i;if(i.value.value===void 0||c.value.value===void 0)return new oo(this,{kind:"constant",value:void 0},i.parameters);const g=di[this.specification.type];if(g){const b=g(i.value.value,c.value.value,f);return new oo(this,{kind:"constant",value:b},i.parameters)}return i}evaluate(i,c,f,g,b,w){return i.kind==="constant"?i.value:i.evaluate(c,f,g,b,w)}}class Fl extends Gt{possiblyEvaluate(i,c,f,g){if(i.value===void 0)return new oo(this,{kind:"constant",value:void 0},c);if(i.expression.kind==="constant"){const b=i.expression.evaluate(c,null,{},f,g),w=i.property.specification.type==="resolvedImage"&&typeof b!="string"?b.name:b,T=this._calculate(w,w,w,c);return new oo(this,{kind:"constant",value:T},c)}if(i.expression.kind==="camera"){const b=this._calculate(i.expression.evaluate({zoom:c.zoom-1}),i.expression.evaluate({zoom:c.zoom}),i.expression.evaluate({zoom:c.zoom+1}),c);return new oo(this,{kind:"constant",value:b},c)}return new oo(this,i.expression,c)}evaluate(i,c,f,g,b,w){if(i.kind==="source"){const T=i.evaluate(c,f,g,b,w);return this._calculate(T,T,T,c)}return i.kind==="composite"?this._calculate(i.evaluate({zoom:Math.floor(c.zoom)-1},f,g),i.evaluate({zoom:Math.floor(c.zoom)},f,g),i.evaluate({zoom:Math.floor(c.zoom)+1},f,g),c):i.value}_calculate(i,c,f,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:i,to:c}:{from:f,to:c}}interpolate(i){return i}}class ja{constructor(i){this.specification=i}possiblyEvaluate(i,c,f,g){if(i.value!==void 0){if(i.expression.kind==="constant"){const b=i.expression.evaluate(c,null,{},f,g);return this._calculate(b,b,b,c)}return this._calculate(i.expression.evaluate(new Qr(Math.floor(c.zoom-1),c)),i.expression.evaluate(new Qr(Math.floor(c.zoom),c)),i.expression.evaluate(new Qr(Math.floor(c.zoom+1),c)),c)}}_calculate(i,c,f,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:i,to:c}:{from:f,to:c}}interpolate(i){return i}}class su{constructor(i){this.specification=i}possiblyEvaluate(i,c,f,g){return!!i.expression.evaluate(c,null,{},f,g)}interpolate(){return!1}}class Si{constructor(i){this.properties=i,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const c in i){const f=i[c];f.specification.overridable&&this.overridableProperties.push(c);const g=this.defaultPropertyValues[c]=new Oa(f,void 0),b=this.defaultTransitionablePropertyValues[c]=new Bl(f);this.defaultTransitioningPropertyValues[c]=b.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=g.possiblyEvaluate({})}}}Et("DataDrivenProperty",Gt),Et("DataConstantProperty",Bt),Et("CrossFadedDataDrivenProperty",Fl),Et("CrossFadedProperty",ja),Et("ColorRampProperty",su);const au="-transition";class so extends it{constructor(i,c){if(super(),this.id=i.id,this.type=i.type,this._featureFilter={filter:()=>!0,needGeometry:!1},i.type!=="custom"&&(this.metadata=i.metadata,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,i.type!=="background"&&(this.source=i.source,this.sourceLayer=i["source-layer"],this.filter=i.filter),c.layout&&(this._unevaluatedLayout=new lf(c.layout)),c.paint)){this._transitionablePaint=new ou(c.paint);for(const f in i.paint)this.setPaintProperty(f,i.paint[f],{validate:!1});for(const f in i.layout)this.setLayoutProperty(f,i.layout[f],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Na(c.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(i){return i==="visibility"?this.visibility:this._unevaluatedLayout.getValue(i)}setLayoutProperty(i,c,f={}){c!=null&&this._validate(lp,`layers.${this.id}.layout.${i}`,i,c,f)||(i!=="visibility"?this._unevaluatedLayout.setValue(i,c):this.visibility=c)}getPaintProperty(i){return i.endsWith(au)?this._transitionablePaint.getTransition(i.slice(0,-11)):this._transitionablePaint.getValue(i)}setPaintProperty(i,c,f={}){if(c!=null&&this._validate(nu,`layers.${this.id}.paint.${i}`,i,c,f))return!1;if(i.endsWith(au))return this._transitionablePaint.setTransition(i.slice(0,-11),c||void 0),!1;{const g=this._transitionablePaint._values[i],b=g.property.specification["property-type"]==="cross-faded-data-driven",w=g.value.isDataDriven(),T=g.value;this._transitionablePaint.setValue(i,c),this._handleSpecialPaintPropertyUpdate(i);const I=this._transitionablePaint._values[i].value;return I.isDataDriven()||w||b||this._handleOverridablePaintPropertyUpdate(i,T,I)}}_handleSpecialPaintPropertyUpdate(i){}_handleOverridablePaintPropertyUpdate(i,c,f){return!1}isHidden(i){return!!(this.minzoom&&i=this.maxzoom)||this.visibility==="none"}updateTransitions(i){this._transitioningPaint=this._transitionablePaint.transitioned(i,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(i,c){i.getCrossfadeParameters&&(this._crossfadeParameters=i.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(i,void 0,c)),this.paint=this._transitioningPaint.possiblyEvaluate(i,void 0,c)}serialize(){const i={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&&(i.layout=i.layout||{},i.layout.visibility=this.visibility),ze(i,(c,f)=>!(c===void 0||f==="layout"&&!Object.keys(c).length||f==="paint"&&!Object.keys(c).length))}_validate(i,c,f,g,b={}){return(!b||b.validate!==!1)&&Hs(this,i.call(ys,{key:c,layerType:this.type,objectKey:f,value:g,styleSpec:ne,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const i in this.paint._values){const c=this.paint.get(i);if(c instanceof oo&&Gs(c.property.specification)&&(c.value.kind==="source"||c.value.kind==="composite")&&c.value.isStateDependent)return!0}return!1}}const cf={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ua{constructor(i,c){this._structArray=i,this._pos1=c*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class un{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(i,c){return i._trim(),c&&(i.isTransferred=!0,c.push(i.arrayBuffer)),{length:i.length,arrayBuffer:i.arrayBuffer}}static deserialize(i){const c=Object.create(this.prototype);return c.arrayBuffer=i.arrayBuffer,c.length=i.length,c.capacity=i.arrayBuffer.byteLength/c.bytesPerElement,c._refreshViews(),c}_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(i){this.reserve(i),this.length=i}reserve(i){if(i>this.capacity){this.capacity=Math.max(i,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const c=this.uint8;this._refreshViews(),c&&this.uint8.set(c)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function kn(s,i=1){let c=0,f=0;return{members:s.map(g=>{const b=cf[g.type].BYTES_PER_ELEMENT,w=c=uf(c,Math.max(i,b)),T=g.components||1;return f=Math.max(f,b),c+=b*T,{name:g.name,type:g.type,components:T,offset:w}}),size:uf(c,Math.max(f,i)),alignment:i}}function uf(s,i){return Math.ceil(s/i)*i}class Va extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c){const f=this.length;return this.resize(f+1),this.emplace(f,i,c)}emplace(i,c,f){const g=2*i;return this.int16[g+0]=c,this.int16[g+1]=f,i}}Va.prototype.bytesPerElement=4,Et("StructArrayLayout2i4",Va);class Fo extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,f){const g=this.length;return this.resize(g+1),this.emplace(g,i,c,f)}emplace(i,c,f,g){const b=3*i;return this.int16[b+0]=c,this.int16[b+1]=f,this.int16[b+2]=g,i}}Fo.prototype.bytesPerElement=6,Et("StructArrayLayout3i6",Fo);class lu extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,f,g){const b=this.length;return this.resize(b+1),this.emplace(b,i,c,f,g)}emplace(i,c,f,g,b){const w=4*i;return this.int16[w+0]=c,this.int16[w+1]=f,this.int16[w+2]=g,this.int16[w+3]=b,i}}lu.prototype.bytesPerElement=8,Et("StructArrayLayout4i8",lu);class cu extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,f,g,b,w){const T=this.length;return this.resize(T+1),this.emplace(T,i,c,f,g,b,w)}emplace(i,c,f,g,b,w,T){const I=6*i;return this.int16[I+0]=c,this.int16[I+1]=f,this.int16[I+2]=g,this.int16[I+3]=b,this.int16[I+4]=w,this.int16[I+5]=T,i}}cu.prototype.bytesPerElement=12,Et("StructArrayLayout2i4i12",cu);class uu extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,f,g,b,w){const T=this.length;return this.resize(T+1),this.emplace(T,i,c,f,g,b,w)}emplace(i,c,f,g,b,w,T){const I=4*i,L=8*i;return this.int16[I+0]=c,this.int16[I+1]=f,this.uint8[L+4]=g,this.uint8[L+5]=b,this.uint8[L+6]=w,this.uint8[L+7]=T,i}}uu.prototype.bytesPerElement=8,Et("StructArrayLayout2i4ub8",uu);class qa extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,c){const f=this.length;return this.resize(f+1),this.emplace(f,i,c)}emplace(i,c,f){const g=2*i;return this.float32[g+0]=c,this.float32[g+1]=f,i}}qa.prototype.bytesPerElement=8,Et("StructArrayLayout2f8",qa);class Ol extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,c,f,g,b,w,T,I,L,F){const j=this.length;return this.resize(j+1),this.emplace(j,i,c,f,g,b,w,T,I,L,F)}emplace(i,c,f,g,b,w,T,I,L,F,j){const H=10*i;return this.uint16[H+0]=c,this.uint16[H+1]=f,this.uint16[H+2]=g,this.uint16[H+3]=b,this.uint16[H+4]=w,this.uint16[H+5]=T,this.uint16[H+6]=I,this.uint16[H+7]=L,this.uint16[H+8]=F,this.uint16[H+9]=j,i}}Ol.prototype.bytesPerElement=20,Et("StructArrayLayout10ui20",Ol);class hu extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,c,f,g,b,w,T,I,L,F,j,H){const J=this.length;return this.resize(J+1),this.emplace(J,i,c,f,g,b,w,T,I,L,F,j,H)}emplace(i,c,f,g,b,w,T,I,L,F,j,H,J){const ee=12*i;return this.int16[ee+0]=c,this.int16[ee+1]=f,this.int16[ee+2]=g,this.int16[ee+3]=b,this.uint16[ee+4]=w,this.uint16[ee+5]=T,this.uint16[ee+6]=I,this.uint16[ee+7]=L,this.int16[ee+8]=F,this.int16[ee+9]=j,this.int16[ee+10]=H,this.int16[ee+11]=J,i}}hu.prototype.bytesPerElement=24,Et("StructArrayLayout4i4ui4i24",hu);class fu extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,c,f){const g=this.length;return this.resize(g+1),this.emplace(g,i,c,f)}emplace(i,c,f,g){const b=3*i;return this.float32[b+0]=c,this.float32[b+1]=f,this.float32[b+2]=g,i}}fu.prototype.bytesPerElement=12,Et("StructArrayLayout3f12",fu);class Oo extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i){const c=this.length;return this.resize(c+1),this.emplace(c,i)}emplace(i,c){return this.uint32[1*i+0]=c,i}}Oo.prototype.bytesPerElement=4,Et("StructArrayLayout1ul4",Oo);class Nl extends un{_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(i,c,f,g,b,w,T,I,L){const F=this.length;return this.resize(F+1),this.emplace(F,i,c,f,g,b,w,T,I,L)}emplace(i,c,f,g,b,w,T,I,L,F){const j=10*i,H=5*i;return this.int16[j+0]=c,this.int16[j+1]=f,this.int16[j+2]=g,this.int16[j+3]=b,this.int16[j+4]=w,this.int16[j+5]=T,this.uint32[H+3]=I,this.uint16[j+8]=L,this.uint16[j+9]=F,i}}Nl.prototype.bytesPerElement=20,Et("StructArrayLayout6i1ul2ui20",Nl);class Ga extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,f,g,b,w){const T=this.length;return this.resize(T+1),this.emplace(T,i,c,f,g,b,w)}emplace(i,c,f,g,b,w,T){const I=6*i;return this.int16[I+0]=c,this.int16[I+1]=f,this.int16[I+2]=g,this.int16[I+3]=b,this.int16[I+4]=w,this.int16[I+5]=T,i}}Ga.prototype.bytesPerElement=12,Et("StructArrayLayout2i2i2i12",Ga);class jl extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,f,g,b){const w=this.length;return this.resize(w+1),this.emplace(w,i,c,f,g,b)}emplace(i,c,f,g,b,w){const T=4*i,I=8*i;return this.float32[T+0]=c,this.float32[T+1]=f,this.float32[T+2]=g,this.int16[I+6]=b,this.int16[I+7]=w,i}}jl.prototype.bytesPerElement=16,Et("StructArrayLayout2f1f2i16",jl);class Wa extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,c,f,g){const b=this.length;return this.resize(b+1),this.emplace(b,i,c,f,g)}emplace(i,c,f,g,b){const w=12*i,T=3*i;return this.uint8[w+0]=c,this.uint8[w+1]=f,this.float32[T+1]=g,this.float32[T+2]=b,i}}Wa.prototype.bytesPerElement=12,Et("StructArrayLayout2ub2f12",Wa);class Ul extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,c,f){const g=this.length;return this.resize(g+1),this.emplace(g,i,c,f)}emplace(i,c,f,g){const b=3*i;return this.uint16[b+0]=c,this.uint16[b+1]=f,this.uint16[b+2]=g,i}}Ul.prototype.bytesPerElement=6,Et("StructArrayLayout3ui6",Ul);class Js extends un{_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(i,c,f,g,b,w,T,I,L,F,j,H,J,ee,ae,ge,xe){const Re=this.length;return this.resize(Re+1),this.emplace(Re,i,c,f,g,b,w,T,I,L,F,j,H,J,ee,ae,ge,xe)}emplace(i,c,f,g,b,w,T,I,L,F,j,H,J,ee,ae,ge,xe,Re){const ke=24*i,Ae=12*i,Je=48*i;return this.int16[ke+0]=c,this.int16[ke+1]=f,this.uint16[ke+2]=g,this.uint16[ke+3]=b,this.uint32[Ae+2]=w,this.uint32[Ae+3]=T,this.uint32[Ae+4]=I,this.uint16[ke+10]=L,this.uint16[ke+11]=F,this.uint16[ke+12]=j,this.float32[Ae+7]=H,this.float32[Ae+8]=J,this.uint8[Je+36]=ee,this.uint8[Je+37]=ae,this.uint8[Je+38]=ge,this.uint32[Ae+10]=xe,this.int16[ke+22]=Re,i}}Js.prototype.bytesPerElement=48,Et("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Js);class vs extends un{_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(i,c,f,g,b,w,T,I,L,F,j,H,J,ee,ae,ge,xe,Re,ke,Ae,Je,Qe,kt,zt,St,bt,pt,It){const yt=this.length;return this.resize(yt+1),this.emplace(yt,i,c,f,g,b,w,T,I,L,F,j,H,J,ee,ae,ge,xe,Re,ke,Ae,Je,Qe,kt,zt,St,bt,pt,It)}emplace(i,c,f,g,b,w,T,I,L,F,j,H,J,ee,ae,ge,xe,Re,ke,Ae,Je,Qe,kt,zt,St,bt,pt,It,yt){const lt=32*i,qt=16*i;return this.int16[lt+0]=c,this.int16[lt+1]=f,this.int16[lt+2]=g,this.int16[lt+3]=b,this.int16[lt+4]=w,this.int16[lt+5]=T,this.int16[lt+6]=I,this.int16[lt+7]=L,this.uint16[lt+8]=F,this.uint16[lt+9]=j,this.uint16[lt+10]=H,this.uint16[lt+11]=J,this.uint16[lt+12]=ee,this.uint16[lt+13]=ae,this.uint16[lt+14]=ge,this.uint16[lt+15]=xe,this.uint16[lt+16]=Re,this.uint16[lt+17]=ke,this.uint16[lt+18]=Ae,this.uint16[lt+19]=Je,this.uint16[lt+20]=Qe,this.uint16[lt+21]=kt,this.uint16[lt+22]=zt,this.uint32[qt+12]=St,this.float32[qt+13]=bt,this.float32[qt+14]=pt,this.uint16[lt+30]=It,this.uint16[lt+31]=yt,i}}vs.prototype.bytesPerElement=64,Et("StructArrayLayout8i15ui1ul2f2ui64",vs);class Vl extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i){const c=this.length;return this.resize(c+1),this.emplace(c,i)}emplace(i,c){return this.float32[1*i+0]=c,i}}Vl.prototype.bytesPerElement=4,Et("StructArrayLayout1f4",Vl);class ql extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,c,f){const g=this.length;return this.resize(g+1),this.emplace(g,i,c,f)}emplace(i,c,f,g){const b=3*i;return this.uint16[6*i+0]=c,this.float32[b+1]=f,this.float32[b+2]=g,i}}ql.prototype.bytesPerElement=12,Et("StructArrayLayout1ui2f12",ql);class bs extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,c,f){const g=this.length;return this.resize(g+1),this.emplace(g,i,c,f)}emplace(i,c,f,g){const b=4*i;return this.uint32[2*i+0]=c,this.uint16[b+2]=f,this.uint16[b+3]=g,i}}bs.prototype.bytesPerElement=8,Et("StructArrayLayout1ul2ui8",bs);class du extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,c){const f=this.length;return this.resize(f+1),this.emplace(f,i,c)}emplace(i,c,f){const g=2*i;return this.uint16[g+0]=c,this.uint16[g+1]=f,i}}du.prototype.bytesPerElement=4,Et("StructArrayLayout2ui4",du);class pu extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i){const c=this.length;return this.resize(c+1),this.emplace(c,i)}emplace(i,c){return this.uint16[1*i+0]=c,i}}pu.prototype.bytesPerElement=2,Et("StructArrayLayout1ui2",pu);class Gl extends un{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,c,f,g){const b=this.length;return this.resize(b+1),this.emplace(b,i,c,f,g)}emplace(i,c,f,g,b){const w=4*i;return this.float32[w+0]=c,this.float32[w+1]=f,this.float32[w+2]=g,this.float32[w+3]=b,i}}Gl.prototype.bytesPerElement=16,Et("StructArrayLayout4f16",Gl);class hf extends Ua{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 k(this.anchorPointX,this.anchorPointY)}}hf.prototype.size=20;class y extends Nl{get(i){return new hf(this,i)}}Et("CollisionBoxArray",y);class o extends Ua{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(i){this._structArray.uint8[this._pos1+37]=i}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(i){this._structArray.uint8[this._pos1+38]=i}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(i){this._structArray.uint32[this._pos4+10]=i}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}o.prototype.size=48;class h extends Js{get(i){return new o(this,i)}}Et("PlacedSymbolArray",h);class p extends Ua{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(i){this._structArray.uint32[this._pos4+12]=i}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]}}p.prototype.size=64;class m extends vs{get(i){return new p(this,i)}}Et("SymbolInstanceArray",m);class v extends Vl{getoffsetX(i){return this.float32[1*i+0]}}Et("GlyphOffsetArray",v);class E extends Fo{getx(i){return this.int16[3*i+0]}gety(i){return this.int16[3*i+1]}gettileUnitDistanceFromAnchor(i){return this.int16[3*i+2]}}Et("SymbolLineVertexArray",E);class M extends Ua{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]}}M.prototype.size=12;class A extends ql{get(i){return new M(this,i)}}Et("TextAnchorOffsetArray",A);class R extends Ua{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]}}R.prototype.size=8;class V extends bs{get(i){return new R(this,i)}}Et("FeatureIndexArray",V);class q extends Va{}class Q extends Va{}class he extends Va{}class ue extends cu{}class ye extends uu{}class se extends qa{}class Te extends Ol{}class Ue extends hu{}class we extends fu{}class Le extends Oo{}class Ge extends Ga{}class He extends Wa{}class $e extends Ul{}class nt extends du{}const et=kn([{name:"a_pos",components:2,type:"Int16"}],4),{members:dt}=et;class gt{constructor(i=[]){this.segments=i}prepareSegment(i,c,f,g){let b=this.segments[this.segments.length-1];return i>gt.MAX_VERTEX_ARRAY_LENGTH&&Ze(`Max vertices per segment is ${gt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${i}`),(!b||b.vertexLength+i>gt.MAX_VERTEX_ARRAY_LENGTH||b.sortKey!==g)&&(b={vertexOffset:c.length,primitiveOffset:f.length,vertexLength:0,primitiveLength:0},g!==void 0&&(b.sortKey=g),this.segments.push(b)),b}get(){return this.segments}destroy(){for(const i of this.segments)for(const c in i.vaos)i.vaos[c].destroy()}static simpleSegment(i,c,f,g){return new gt([{vertexOffset:i,primitiveOffset:c,vertexLength:f,primitiveLength:g,vaos:{},sortKey:0}])}}function ir(s,i){return 256*(s=K(Math.floor(s),0,255))+K(Math.floor(i),0,255)}gt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Et("SegmentVector",gt);const _t=kn([{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 Xt={exports:{}},or={exports:{}};or.exports=function(s,i){var c,f,g,b,w,T,I,L;for(f=s.length-(c=3&s.length),g=i,w=3432918353,T=461845907,L=0;L>>16)*w&65535)<<16)&4294967295)<<15|I>>>17))*T+(((I>>>16)*T&65535)<<16)&4294967295)<<13|g>>>19))+((5*(g>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(I=0,c){case 3:I^=(255&s.charCodeAt(L+2))<<16;case 2:I^=(255&s.charCodeAt(L+1))<<8;case 1:g^=I=(65535&(I=(I=(65535&(I^=255&s.charCodeAt(L)))*w+(((I>>>16)*w&65535)<<16)&4294967295)<<15|I>>>17))*T+(((I>>>16)*T&65535)<<16)&4294967295}return g^=s.length,g=2246822507*(65535&(g^=g>>>16))+((2246822507*(g>>>16)&65535)<<16)&4294967295,g=3266489909*(65535&(g^=g>>>13))+((3266489909*(g>>>16)&65535)<<16)&4294967295,(g^=g>>>16)>>>0};var xr=or.exports,Yt={exports:{}};Yt.exports=function(s,i){for(var c,f=s.length,g=i^f,b=0;f>=4;)c=1540483477*(65535&(c=255&s.charCodeAt(b)|(255&s.charCodeAt(++b))<<8|(255&s.charCodeAt(++b))<<16|(255&s.charCodeAt(++b))<<24))+((1540483477*(c>>>16)&65535)<<16),g=1540483477*(65535&g)+((1540483477*(g>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),f-=4,++b;switch(f){case 3:g^=(255&s.charCodeAt(b+2))<<16;case 2:g^=(255&s.charCodeAt(b+1))<<8;case 1:g=1540483477*(65535&(g^=255&s.charCodeAt(b)))+((1540483477*(g>>>16)&65535)<<16)}return g=1540483477*(65535&(g^=g>>>13))+((1540483477*(g>>>16)&65535)<<16),(g^=g>>>15)>>>0};var cr=xr,dr=Yt.exports;Xt.exports=cr,Xt.exports.murmur3=cr,Xt.exports.murmur2=dr;var hn=_(Xt.exports);class Rr{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(i,c,f,g){this.ids.push(Oi(i)),this.positions.push(c,f,g)}getPositions(i){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const c=Oi(i);let f=0,g=this.ids.length-1;for(;f>1;this.ids[w]>=c?g=w:f=w+1}const b=[];for(;this.ids[f]===c;)b.push({index:this.positions[3*f],start:this.positions[3*f+1],end:this.positions[3*f+2]}),f++;return b}static serialize(i,c){const f=new Float64Array(i.ids),g=new Uint32Array(i.positions);return Fn(f,g,0,f.length-1),c&&c.push(f.buffer,g.buffer),{ids:f,positions:g}}static deserialize(i){const c=new Rr;return c.ids=i.ids,c.positions=i.positions,c.indexed=!0,c}}function Oi(s){const i=+s;return!isNaN(i)&&i<=Number.MAX_SAFE_INTEGER?i:hn(String(s))}function Fn(s,i,c,f){for(;c>1];let b=c-1,w=f+1;for(;;){do b++;while(s[b]g);if(b>=w)break;nn(s,b,w),nn(i,3*b,3*w),nn(i,3*b+1,3*w+1),nn(i,3*b+2,3*w+2)}w-c`u_${g}`),this.type=f}setUniform(i,c,f){i.set(f.constantOr(this.value))}getBinding(i,c,f){return this.type==="color"?new ts(i,c):new Ni(i,c)}}class An{constructor(i,c){this.uniformNames=c.map(f=>`u_${f}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(i,c){this.pixelRatioFrom=c.pixelRatio,this.pixelRatioTo=i.pixelRatio,this.patternFrom=c.tlbr,this.patternTo=i.tlbr}setUniform(i,c,f,g){const b=g==="u_pattern_to"?this.patternTo:g==="u_pattern_from"?this.patternFrom:g==="u_pixel_ratio_to"?this.pixelRatioTo:g==="u_pixel_ratio_from"?this.pixelRatioFrom:null;b&&i.set(b)}getBinding(i,c,f){return f.substr(0,9)==="u_pattern"?new bo(i,c):new Ni(i,c)}}class on{constructor(i,c,f,g){this.expression=i,this.type=f,this.maxValue=0,this.paintVertexAttributes=c.map(b=>({name:`a_${b}`,type:"Float32",components:f==="color"?2:1,offset:0})),this.paintVertexArray=new g}populatePaintArray(i,c,f,g,b){const w=this.paintVertexArray.length,T=this.expression.evaluate(new Qr(0),c,{},g,[],b);this.paintVertexArray.resize(i),this._setPaintValue(w,i,T)}updatePaintArray(i,c,f,g){const b=this.expression.evaluate({zoom:0},f,g);this._setPaintValue(i,c,b)}_setPaintValue(i,c,f){if(this.type==="color"){const g=rs(f);for(let b=i;b`u_${T}_t`),this.type=f,this.useIntegerZoom=g,this.zoom=b,this.maxValue=0,this.paintVertexAttributes=c.map(T=>({name:`a_${T}`,type:"Float32",components:f==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(i,c,f,g,b){const w=this.expression.evaluate(new Qr(this.zoom),c,{},g,[],b),T=this.expression.evaluate(new Qr(this.zoom+1),c,{},g,[],b),I=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValue(I,i,w,T)}updatePaintArray(i,c,f,g){const b=this.expression.evaluate({zoom:this.zoom},f,g),w=this.expression.evaluate({zoom:this.zoom+1},f,g);this._setPaintValue(i,c,b,w)}_setPaintValue(i,c,f,g){if(this.type==="color"){const b=rs(f),w=rs(g);for(let T=i;T`#define HAS_UNIFORM_${g}`))}return i}getBinderAttributes(){const i=[];for(const c in this.binders){const f=this.binders[c];if(f instanceof on||f instanceof en)for(let g=0;g!0){this.programConfigurations={};for(const g of i)this.programConfigurations[g.id]=new Ln(g,c,f);this.needsUpload=!1,this._featureMap=new Rr,this._bufferOffset=0}populatePaintArrays(i,c,f,g,b,w){for(const T in this.programConfigurations)this.programConfigurations[T].populatePaintArrays(i,c,g,b,w);c.id!==void 0&&this._featureMap.add(c.id,f,this._bufferOffset,i),this._bufferOffset=i,this.needsUpload=!0}updatePaintArrays(i,c,f,g){for(const b of f)this.needsUpload=this.programConfigurations[b.id].updatePaintArrays(i,this._featureMap,c,b,g)||this.needsUpload}get(i){return this.programConfigurations[i]}upload(i){if(this.needsUpload){for(const c in this.programConfigurations)this.programConfigurations[c].upload(i);this.needsUpload=!1}}destroy(){for(const i in this.programConfigurations)this.programConfigurations[i].destroy()}}function Ji(s,i){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"]}[s]||[s.replace(`${i}-`,"").replace(/-/g,"_")]}function Pn(s,i,c){const f={color:{source:qa,composite:Gl},number:{source:Vl,composite:qa}},g=function(b){return{"line-pattern":{source:Te,composite:Te},"fill-pattern":{source:Te,composite:Te},"fill-extrusion-pattern":{source:Te,composite:Te}}[b]}(s);return g&&g[c]||f[i][c]}Et("ConstantBinder",wo),Et("CrossFadedConstantBinder",An),Et("SourceExpressionBinder",on),Et("CrossFadedCompositeBinder",Ki),Et("CompositeExpressionBinder",en),Et("ProgramConfiguration",Ln,{omit:["_buffers"]}),Et("ProgramConfigurationSet",sn);const yn=8192,mu=Math.pow(2,14)-1,ff=-mu-1;function ws(s){const i=yn/s.extent,c=s.loadGeometry();for(let f=0;fw.x+1||Iw.y+1)&&Ze("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return c}function xs(s,i){return{type:s.type,id:s.id,properties:s.properties,geometry:i?ws(s):[]}}function Wl(s,i,c,f,g){s.emplaceBack(2*i+(f+1)/2,2*c+(g+1)/2)}class ns{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(c=>c.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new Q,this.indexArray=new $e,this.segments=new gt,this.programConfigurations=new sn(i.layers,i.zoom),this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(i,c,f){const g=this.layers[0],b=[];let w=null,T=!1;g.type==="circle"&&(w=g.layout.get("circle-sort-key"),T=!w.isConstant());for(const{feature:I,id:L,index:F,sourceLayerIndex:j}of i){const H=this.layers[0]._featureFilter.needGeometry,J=xs(I,H);if(!this.layers[0]._featureFilter.filter(new Qr(this.zoom),J,f))continue;const ee=T?w.evaluate(J,{},f):void 0,ae={id:L,properties:I.properties,type:I.type,sourceLayerIndex:j,index:F,geometry:H?J.geometry:ws(I),patterns:{},sortKey:ee};b.push(ae)}T&&b.sort((I,L)=>I.sortKey-L.sortKey);for(const I of b){const{geometry:L,index:F,sourceLayerIndex:j}=I,H=i[F].feature;this.addFeature(I,L,F,f),c.featureIndex.insert(H,L,F,j,this.index)}}update(i,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,c,this.stateDependentLayers,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,dt),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(i,c,f,g){for(const b of c)for(const w of b){const T=w.x,I=w.y;if(T<0||T>=yn||I<0||I>=yn)continue;const L=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,i.sortKey),F=L.vertexLength;Wl(this.layoutVertexArray,T,I,-1,-1),Wl(this.layoutVertexArray,T,I,1,-1),Wl(this.layoutVertexArray,T,I,1,1),Wl(this.layoutVertexArray,T,I,-1,1),this.indexArray.emplaceBack(F,F+1,F+2),this.indexArray.emplaceBack(F,F+3,F+2),L.vertexLength+=4,L.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,f,{},g)}}function gu(s,i){for(let c=0;c1){if(Zl(s,i))return!0;for(let f=0;f1?c:c.sub(i)._mult(g)._add(i))}function l_(s,i){let c,f,g,b=!1;for(let w=0;wi.y!=g.y>i.y&&i.x<(g.x-f.x)*(i.y-f.y)/(g.y-f.y)+f.x&&(b=!b)}return b}function Hl(s,i){let c=!1;for(let f=0,g=s.length-1;fi.y!=w.y>i.y&&i.x<(w.x-b.x)*(i.y-b.y)/(w.y-b.y)+b.x&&(c=!c)}return c}function Gx(s,i,c){const f=c[0],g=c[2];if(s.xg.x&&i.x>g.x||s.yg.y&&i.y>g.y)return!1;const b=Me(s,i,c[0]);return b!==Me(s,i,c[1])||b!==Me(s,i,c[2])||b!==Me(s,i,c[3])}function bu(s,i,c){const f=i.paint.get(s).value;return f.kind==="constant"?f.value:c.programConfigurations.get(i.id).getMaxValue(s)}function pf(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}function mf(s,i,c,f,g){if(!i[0]&&!i[1])return s;const b=k.convert(i)._mult(g);c==="viewport"&&b._rotate(-f);const w=[];for(let T=0;Tf_(ge,ae))}(L,I),J=j?F*T:F;for(const ee of g)for(const ae of ee){const ge=j?ae:f_(ae,I);let xe=J;const Re=gf([],[ae.x,ae.y,0,1],I);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?xe*=Re[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(xe*=w.cameraToCenterDistance/Re[3]),df(H,ge,xe))return!0}return!1}}function f_(s,i){const c=gf([],[s.x,s.y,0,1],i);return new k(c[0]/c[3],c[1]/c[3])}class d_ extends ns{}let p_;Et("HeatmapBucket",d_,{omit:["layers"]});var $x={get paint(){return p_=p_||new Si({"heatmap-radius":new Gt(ne.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Gt(ne.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Bt(ne.paint_heatmap["heatmap-intensity"]),"heatmap-color":new su(ne.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Bt(ne.paint_heatmap["heatmap-opacity"])})}};function fp(s,{width:i,height:c},f,g){if(g){if(g instanceof Uint8ClampedArray)g=new Uint8Array(g.buffer);else if(g.length!==i*c*f)throw new RangeError(`mismatched image size. expected: ${g.length} but got: ${i*c*f}`)}else g=new Uint8Array(i*c*f);return s.width=i,s.height=c,s.data=g,s}function m_(s,{width:i,height:c},f){if(i===s.width&&c===s.height)return;const g=fp({},{width:i,height:c},f);dp(s,g,{x:0,y:0},{x:0,y:0},{width:Math.min(s.width,i),height:Math.min(s.height,c)},f),s.width=i,s.height=c,s.data=g.data}function dp(s,i,c,f,g,b){if(g.width===0||g.height===0)return i;if(g.width>s.width||g.height>s.height||c.x>s.width-g.width||c.y>s.height-g.height)throw new RangeError("out of range source coordinates for image copy");if(g.width>i.width||g.height>i.height||f.x>i.width-g.width||f.y>i.height-g.height)throw new RangeError("out of range destination coordinates for image copy");const w=s.data,T=i.data;if(w===T)throw new Error("srcData equals dstData, so image is already copied");for(let I=0;I{i[s.evaluationKey]=I;const L=s.expression.evaluate(i);g.data[w+T+0]=Math.floor(255*L.r/L.a),g.data[w+T+1]=Math.floor(255*L.g/L.a),g.data[w+T+2]=Math.floor(255*L.b/L.a),g.data[w+T+3]=Math.floor(255*L.a)};if(s.clips)for(let w=0,T=0;w80*c){f=b=s[0],g=w=s[1];for(var ee=c;eeb&&(b=T),I>w&&(w=I);L=(L=Math.max(b-f,w-g))!==0?32767/L:0}return Su(H,J,c,f,g,L,0),J}function y_(s,i,c,f,g){var b,w;if(g===_p(s,i,c,f)>0)for(b=i;b=i;b-=f)w=w_(b,s[b],s[b+1],w);return w&&yf(w,w.next)&&(Tu(w),w=w.next),w}function Ha(s,i){if(!s)return s;i||(i=s);var c,f=s;do if(c=!1,f.steiner||!yf(f,f.next)&&Tn(f.prev,f,f.next)!==0)f=f.next;else{if(Tu(f),(f=i=f.prev)===f.next)break;c=!0}while(c||f!==i);return i}function Su(s,i,c,f,g,b,w){if(s){!w&&b&&function(F,j,H,J){var ee=F;do ee.z===0&&(ee.z=mp(ee.x,ee.y,j,H,J)),ee.prevZ=ee.prev,ee.nextZ=ee.next,ee=ee.next;while(ee!==F);ee.prevZ.nextZ=null,ee.prevZ=null,function(ae){var ge,xe,Re,ke,Ae,Je,Qe,kt,zt=1;do{for(xe=ae,ae=null,Ae=null,Je=0;xe;){for(Je++,Re=xe,Qe=0,ge=0;ge0||kt>0&ℜ)Qe!==0&&(kt===0||!Re||xe.z<=Re.z)?(ke=xe,xe=xe.nextZ,Qe--):(ke=Re,Re=Re.nextZ,kt--),Ae?Ae.nextZ=ke:ae=ke,ke.prevZ=Ae,Ae=ke;xe=Re}Ae.nextZ=null,zt*=2}while(Je>1)}(ee)}(s,f,g,b);for(var T,I,L=s;s.prev!==s.next;)if(T=s.prev,I=s.next,b?t2(s,f,g,b):e2(s))i.push(T.i/c|0),i.push(s.i/c|0),i.push(I.i/c|0),Tu(s),s=I.next,L=I.next;else if((s=I)===L){w?w===1?Su(s=r2(Ha(s),i,c),i,c,f,g,b,2):w===2&&n2(s,i,c,f,g,b):Su(Ha(s),i,c,f,g,b,1);break}}}function e2(s){var i=s.prev,c=s,f=s.next;if(Tn(i,c,f)>=0)return!1;for(var g=i.x,b=c.x,w=f.x,T=i.y,I=c.y,L=f.y,F=gb?g>w?g:w:b>w?b:w,J=T>I?T>L?T:L:I>L?I:L,ee=f.next;ee!==i;){if(ee.x>=F&&ee.x<=H&&ee.y>=j&&ee.y<=J&&Xl(g,T,b,I,w,L,ee.x,ee.y)&&Tn(ee.prev,ee,ee.next)>=0)return!1;ee=ee.next}return!0}function t2(s,i,c,f){var g=s.prev,b=s,w=s.next;if(Tn(g,b,w)>=0)return!1;for(var T=g.x,I=b.x,L=w.x,F=g.y,j=b.y,H=w.y,J=TI?T>L?T:L:I>L?I:L,ge=F>j?F>H?F:H:j>H?j:H,xe=mp(J,ee,i,c,f),Re=mp(ae,ge,i,c,f),ke=s.prevZ,Ae=s.nextZ;ke&&ke.z>=xe&&Ae&&Ae.z<=Re;){if(ke.x>=J&&ke.x<=ae&&ke.y>=ee&&ke.y<=ge&&ke!==g&&ke!==w&&Xl(T,F,I,j,L,H,ke.x,ke.y)&&Tn(ke.prev,ke,ke.next)>=0||(ke=ke.prevZ,Ae.x>=J&&Ae.x<=ae&&Ae.y>=ee&&Ae.y<=ge&&Ae!==g&&Ae!==w&&Xl(T,F,I,j,L,H,Ae.x,Ae.y)&&Tn(Ae.prev,Ae,Ae.next)>=0))return!1;Ae=Ae.nextZ}for(;ke&&ke.z>=xe;){if(ke.x>=J&&ke.x<=ae&&ke.y>=ee&&ke.y<=ge&&ke!==g&&ke!==w&&Xl(T,F,I,j,L,H,ke.x,ke.y)&&Tn(ke.prev,ke,ke.next)>=0)return!1;ke=ke.prevZ}for(;Ae&&Ae.z<=Re;){if(Ae.x>=J&&Ae.x<=ae&&Ae.y>=ee&&Ae.y<=ge&&Ae!==g&&Ae!==w&&Xl(T,F,I,j,L,H,Ae.x,Ae.y)&&Tn(Ae.prev,Ae,Ae.next)>=0)return!1;Ae=Ae.nextZ}return!0}function r2(s,i,c){var f=s;do{var g=f.prev,b=f.next.next;!yf(g,b)&&v_(g,f,f.next,b)&&ku(g,b)&&ku(b,g)&&(i.push(g.i/c|0),i.push(f.i/c|0),i.push(b.i/c|0),Tu(f),Tu(f.next),f=s=b),f=f.next}while(f!==s);return Ha(f)}function n2(s,i,c,f,g,b){var w=s;do{for(var T=w.next.next;T!==w.prev;){if(w.i!==T.i&&l2(w,T)){var I=b_(w,T);return w=Ha(w,w.next),I=Ha(I,I.next),Su(w,i,c,f,g,b,0),void Su(I,i,c,f,g,b,0)}T=T.next}w=w.next}while(w!==s)}function i2(s,i){return s.x-i.x}function o2(s,i){var c=function(g,b){var w,T=b,I=g.x,L=g.y,F=-1/0;do{if(L<=T.y&&L>=T.next.y&&T.next.y!==T.y){var j=T.x+(L-T.y)*(T.next.x-T.x)/(T.next.y-T.y);if(j<=I&&j>F&&(F=j,w=T.x=T.x&&T.x>=ee&&I!==T.x&&Xl(Lw.x||T.x===w.x&&s2(w,T)))&&(w=T,ge=H)),T=T.next;while(T!==J);return w}(s,i);if(!c)return i;var f=b_(c,s);return Ha(f,f.next),Ha(c,c.next)}function s2(s,i){return Tn(s.prev,s,i.prev)<0&&Tn(i.next,s,s.next)<0}function mp(s,i,c,f,g){return(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-c)*g|0)|s<<8))|s<<4))|s<<2))|s<<1))|(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-f)*g|0)|i<<8))|i<<4))|i<<2))|i<<1))<<1}function a2(s){var i=s,c=s;do(i.x=(s-w)*(b-T)&&(s-w)*(f-T)>=(c-w)*(i-T)&&(c-w)*(b-T)>=(g-w)*(f-T)}function l2(s,i){return s.next.i!==i.i&&s.prev.i!==i.i&&!function(c,f){var g=c;do{if(g.i!==c.i&&g.next.i!==c.i&&g.i!==f.i&&g.next.i!==f.i&&v_(g,g.next,c,f))return!0;g=g.next}while(g!==c);return!1}(s,i)&&(ku(s,i)&&ku(i,s)&&function(c,f){var g=c,b=!1,w=(c.x+f.x)/2,T=(c.y+f.y)/2;do g.y>T!=g.next.y>T&&g.next.y!==g.y&&w<(g.next.x-g.x)*(T-g.y)/(g.next.y-g.y)+g.x&&(b=!b),g=g.next;while(g!==c);return b}(s,i)&&(Tn(s.prev,s,i.prev)||Tn(s,i.prev,i))||yf(s,i)&&Tn(s.prev,s,s.next)>0&&Tn(i.prev,i,i.next)>0)}function Tn(s,i,c){return(i.y-s.y)*(c.x-i.x)-(i.x-s.x)*(c.y-i.y)}function yf(s,i){return s.x===i.x&&s.y===i.y}function v_(s,i,c,f){var g=bf(Tn(s,i,c)),b=bf(Tn(s,i,f)),w=bf(Tn(c,f,s)),T=bf(Tn(c,f,i));return g!==b&&w!==T||!(g!==0||!vf(s,c,i))||!(b!==0||!vf(s,f,i))||!(w!==0||!vf(c,s,f))||!(T!==0||!vf(c,i,f))}function vf(s,i,c){return i.x<=Math.max(s.x,c.x)&&i.x>=Math.min(s.x,c.x)&&i.y<=Math.max(s.y,c.y)&&i.y>=Math.min(s.y,c.y)}function bf(s){return s>0?1:s<0?-1:0}function ku(s,i){return Tn(s.prev,s,s.next)<0?Tn(s,i,s.next)>=0&&Tn(s,s.prev,i)>=0:Tn(s,i,s.prev)<0||Tn(s,s.next,i)<0}function b_(s,i){var c=new gp(s.i,s.x,s.y),f=new gp(i.i,i.x,i.y),g=s.next,b=i.prev;return s.next=i,i.prev=s,c.next=g,g.prev=c,f.next=c,c.prev=f,b.next=f,f.prev=b,f}function w_(s,i,c,f){var g=new gp(s,i,c);return f?(g.next=f.next,g.prev=f,f.next.prev=g,f.next=g):(g.prev=g,g.next=g),g}function Tu(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function gp(s,i,c){this.i=s,this.x=i,this.y=c,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function _p(s,i,c,f){for(var g=0,b=i,w=c-f;b0&&c.holes.push(f+=s[g-1].length)}return c};var x_=_(pp.exports);function c2(s,i,c,f,g){S_(s,i,c||0,f||s.length-1,g||u2)}function S_(s,i,c,f,g){for(;f>c;){if(f-c>600){var b=f-c+1,w=i-c+1,T=Math.log(b),I=.5*Math.exp(2*T/3),L=.5*Math.sqrt(T*I*(b-I)/b)*(w-b/2<0?-1:1);S_(s,i,Math.max(c,Math.floor(i-w*I/b+L)),Math.min(f,Math.floor(i+(b-w)*I/b+L)),g)}var F=s[i],j=c,H=f;for(Eu(s,c,i),g(s[f],F)>0&&Eu(s,c,f);j0;)H--}g(s[c],F)===0?Eu(s,c,H):Eu(s,++H,f),H<=i&&(c=H+1),i<=H&&(f=H-1)}}function Eu(s,i,c){var f=s[i];s[i]=s[c],s[c]=f}function u2(s,i){return si?1:0}function yp(s,i){const c=s.length;if(c<=1)return[s];const f=[];let g,b;for(let w=0;w1)for(let w=0;wc.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new he,this.indexArray=new $e,this.indexArray2=new nt,this.programConfigurations=new sn(i.layers,i.zoom),this.segments=new gt,this.segments2=new gt,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(i,c,f){this.hasPattern=vp("fill",this.layers,c);const g=this.layers[0].layout.get("fill-sort-key"),b=!g.isConstant(),w=[];for(const{feature:T,id:I,index:L,sourceLayerIndex:F}of i){const j=this.layers[0]._featureFilter.needGeometry,H=xs(T,j);if(!this.layers[0]._featureFilter.filter(new Qr(this.zoom),H,f))continue;const J=b?g.evaluate(H,{},f,c.availableImages):void 0,ee={id:I,properties:T.properties,type:T.type,sourceLayerIndex:F,index:L,geometry:j?H.geometry:ws(T),patterns:{},sortKey:J};w.push(ee)}b&&w.sort((T,I)=>T.sortKey-I.sortKey);for(const T of w){const{geometry:I,index:L,sourceLayerIndex:F}=T;if(this.hasPattern){const j=bp("fill",this.layers,T,this.zoom,c);this.patternFeatures.push(j)}else this.addFeature(T,I,L,f,{});c.featureIndex.insert(i[L].feature,I,L,F,this.index)}}update(i,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,c,this.stateDependentLayers,f)}addFeatures(i,c,f){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,c,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,Qx),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.indexBuffer2=i.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(i),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(i,c,f,g,b){for(const w of yp(c,500)){let T=0;for(const J of w)T+=J.length;const I=this.segments.prepareSegment(T,this.layoutVertexArray,this.indexArray),L=I.vertexLength,F=[],j=[];for(const J of w){if(J.length===0)continue;J!==w[0]&&j.push(F.length/2);const ee=this.segments2.prepareSegment(J.length,this.layoutVertexArray,this.indexArray2),ae=ee.vertexLength;this.layoutVertexArray.emplaceBack(J[0].x,J[0].y),this.indexArray2.emplaceBack(ae+J.length-1,ae),F.push(J[0].x),F.push(J[0].y);for(let ge=1;ge>3}if(g--,f===1||f===2)b+=s.readSVarint(),w+=s.readSVarint(),f===1&&(i&&T.push(i),i=[]),i.push(new _2(b,w));else{if(f!==7)throw new Error("unknown command "+f);i&&i.push(i[0].clone())}}return i&&T.push(i),T},Kl.prototype.bbox=function(){var s=this._pbf;s.pos=this._geometry;for(var i=s.readVarint()+s.pos,c=1,f=0,g=0,b=0,w=1/0,T=-1/0,I=1/0,L=-1/0;s.pos>3}if(f--,c===1||c===2)(g+=s.readSVarint())T&&(T=g),(b+=s.readSVarint())L&&(L=b);else if(c!==7)throw new Error("unknown command "+c)}return[w,I,T,L]},Kl.prototype.toGeoJSON=function(s,i,c){var f,g,b=this.extent*Math.pow(2,c),w=this.extent*s,T=this.extent*i,I=this.loadGeometry(),L=Kl.types[this.type];function F(J){for(var ee=0;ee>3;g=w===1?f.readString():w===2?f.readFloat():w===3?f.readDouble():w===4?f.readVarint64():w===5?f.readVarint():w===6?f.readSVarint():w===7?f.readBoolean():null}return g}(c))}C_.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var i=this._pbf.readVarint()+this._pbf.pos;return new b2(this._pbf,i,this.extent,this._keys,this._values)};var x2=M_;function S2(s,i,c){if(s===3){var f=new x2(c,c.readVarint()+c.pos);f.length&&(i[f.name]=f)}}Ys.VectorTile=function(s,i){this.layers=s.readFields(S2,{},i)},Ys.VectorTileFeature=E_,Ys.VectorTileLayer=M_;const k2=Ys.VectorTileFeature.types,xp=Math.pow(2,13);function Mu(s,i,c,f,g,b,w,T){s.emplaceBack(i,c,2*Math.floor(f*xp)+w,g*xp*2,b*xp*2,Math.round(T))}class Sp{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(c=>c.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new ue,this.centroidVertexArray=new q,this.indexArray=new $e,this.programConfigurations=new sn(i.layers,i.zoom),this.segments=new gt,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(i,c,f){this.features=[],this.hasPattern=vp("fill-extrusion",this.layers,c);for(const{feature:g,id:b,index:w,sourceLayerIndex:T}of i){const I=this.layers[0]._featureFilter.needGeometry,L=xs(g,I);if(!this.layers[0]._featureFilter.filter(new Qr(this.zoom),L,f))continue;const F={id:b,sourceLayerIndex:T,index:w,geometry:I?L.geometry:ws(g),properties:g.properties,type:g.type,patterns:{}};this.hasPattern?this.features.push(bp("fill-extrusion",this.layers,F,this.zoom,c)):this.addFeature(F,F.geometry,w,f,{}),c.featureIndex.insert(g,F.geometry,w,T,this.index,!0)}}addFeatures(i,c,f){for(const g of this.features){const{geometry:b}=g;this.addFeature(g,b,g.index,c,f)}}update(i,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,c,this.stateDependentLayers,f)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,g2),this.centroidVertexBuffer=i.createVertexBuffer(this.centroidVertexArray,m2.members,!0),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(i,c,f,g,b){const w={x:0,y:0,vertexCount:0};for(const T of yp(c,500)){let I=0;for(const ee of T)I+=ee.length;let L=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const ee of T){if(ee.length===0||E2(ee))continue;let ae=0;for(let ge=0;ge=1){const Re=ee[ge-1];if(!T2(xe,Re)){L.vertexLength+4>gt.MAX_VERTEX_ARRAY_LENGTH&&(L=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ke=xe.sub(Re)._perp()._unit(),Ae=Re.dist(xe);ae+Ae>32768&&(ae=0),Mu(this.layoutVertexArray,xe.x,xe.y,ke.x,ke.y,0,0,ae),Mu(this.layoutVertexArray,xe.x,xe.y,ke.x,ke.y,0,1,ae),w.x+=2*xe.x,w.y+=2*xe.y,w.vertexCount+=2,ae+=Ae,Mu(this.layoutVertexArray,Re.x,Re.y,ke.x,ke.y,0,0,ae),Mu(this.layoutVertexArray,Re.x,Re.y,ke.x,ke.y,0,1,ae),w.x+=2*Re.x,w.y+=2*Re.y,w.vertexCount+=2;const Je=L.vertexLength;this.indexArray.emplaceBack(Je,Je+2,Je+1),this.indexArray.emplaceBack(Je+1,Je+2,Je+3),L.vertexLength+=4,L.primitiveLength+=2}}}}if(L.vertexLength+I>gt.MAX_VERTEX_ARRAY_LENGTH&&(L=this.segments.prepareSegment(I,this.layoutVertexArray,this.indexArray)),k2[i.type]!=="Polygon")continue;const F=[],j=[],H=L.vertexLength;for(const ee of T)if(ee.length!==0){ee!==T[0]&&j.push(F.length/2);for(let ae=0;aeyn)||s.y===i.y&&(s.y<0||s.y>yn)}function E2(s){return s.every(i=>i.x<0)||s.every(i=>i.x>yn)||s.every(i=>i.y<0)||s.every(i=>i.y>yn)}let I_;Et("FillExtrusionBucket",Sp,{omit:["layers","features"]});var M2={get paint(){return I_=I_||new Si({"fill-extrusion-opacity":new Bt(ne["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Gt(ne["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Bt(ne["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Bt(ne["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Fl(ne["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Gt(ne["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Gt(ne["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Bt(ne["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class C2 extends so{constructor(i){super(i,M2)}createBucket(i){return new Sp(i)}queryRadius(){return pf(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,c,f,g,b,w,T,I){const L=mf(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,T),F=this.paint.get("fill-extrusion-height").evaluate(c,f),j=this.paint.get("fill-extrusion-base").evaluate(c,f),H=function(ee,ae,ge,xe){const Re=[];for(const ke of ee){const Ae=[ke.x,ke.y,0,1];gf(Ae,Ae,ae),Re.push(new k(Ae[0]/Ae[3],Ae[1]/Ae[3]))}return Re}(L,I),J=function(ee,ae,ge,xe){const Re=[],ke=[],Ae=xe[8]*ae,Je=xe[9]*ae,Qe=xe[10]*ae,kt=xe[11]*ae,zt=xe[8]*ge,St=xe[9]*ge,bt=xe[10]*ge,pt=xe[11]*ge;for(const It of ee){const yt=[],lt=[];for(const qt of It){const Dt=qt.x,mr=qt.y,Xr=xe[0]*Dt+xe[4]*mr+xe[12],tn=xe[1]*Dt+xe[5]*mr+xe[13],jn=xe[2]*Dt+xe[6]*mr+xe[14],Yi=xe[3]*Dt+xe[7]*mr+xe[15],Ti=jn+Qe,zn=Yi+kt,Yn=Xr+zt,ai=tn+St,Ei=jn+bt,Mi=Yi+pt,Un=new k((Xr+Ae)/zn,(tn+Je)/zn);Un.z=Ti/zn,yt.push(Un);const Vn=new k(Yn/Mi,ai/Mi);Vn.z=Ei/Mi,lt.push(Vn)}Re.push(yt),ke.push(lt)}return[Re,ke]}(g,j,F,I);return function(ee,ae,ge){let xe=1/0;_u(ge,ae)&&(xe=A_(ge,ae[0]));for(let Re=0;Rec.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(c=>{this.gradients[c.id]={}}),this.layoutVertexArray=new ye,this.layoutVertexArray2=new se,this.indexArray=new $e,this.programConfigurations=new sn(i.layers,i.zoom),this.segments=new gt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(i,c,f){this.hasPattern=vp("line",this.layers,c);const g=this.layers[0].layout.get("line-sort-key"),b=!g.isConstant(),w=[];for(const{feature:T,id:I,index:L,sourceLayerIndex:F}of i){const j=this.layers[0]._featureFilter.needGeometry,H=xs(T,j);if(!this.layers[0]._featureFilter.filter(new Qr(this.zoom),H,f))continue;const J=b?g.evaluate(H,{},f):void 0,ee={id:I,properties:T.properties,type:T.type,sourceLayerIndex:F,index:L,geometry:j?H.geometry:ws(T),patterns:{},sortKey:J};w.push(ee)}b&&w.sort((T,I)=>T.sortKey-I.sortKey);for(const T of w){const{geometry:I,index:L,sourceLayerIndex:F}=T;if(this.hasPattern){const j=bp("line",this.layers,T,this.zoom,c);this.patternFeatures.push(j)}else this.addFeature(T,I,L,f,{});c.featureIndex.insert(i[L].feature,I,L,F,this.index)}}update(i,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,c,this.stateDependentLayers,f)}addFeatures(i,c,f){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,c,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=i.createVertexBuffer(this.layoutVertexArray2,P2)),this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,A2),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(i){if(i.properties&&Object.prototype.hasOwnProperty.call(i.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(i.properties,"mapbox_clip_end"))return{start:+i.properties.mapbox_clip_start,end:+i.properties.mapbox_clip_end}}addFeature(i,c,f,g,b){const w=this.layers[0].layout,T=w.get("line-join").evaluate(i,{}),I=w.get("line-cap"),L=w.get("line-miter-limit"),F=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(i);for(const j of c)this.addLine(j,i,T,I,L,F);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,f,b,g)}addLine(i,c,f,g,b,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let xe=0;xe=2&&i[I-1].equals(i[I-2]);)I--;let L=0;for(;L0;if(kt&&xe>L){const pt=H.dist(J);if(pt>2*F){const It=H.sub(H.sub(J)._mult(F/pt)._round());this.updateDistance(J,It),this.addCurrentVertex(It,ae,0,0,j),J=It}}const St=J&ⅇlet bt=St?f:T?"butt":g;if(St&&bt==="round"&&(Jeb&&(bt="bevel"),bt==="bevel"&&(Je>2&&(bt="flipbevel"),Je100)Re=ge.mult(-1);else{const pt=Je*ae.add(ge).mag()/ae.sub(ge).mag();Re._perp()._mult(pt*(zt?-1:1))}this.addCurrentVertex(H,Re,0,0,j),this.addCurrentVertex(H,Re.mult(-1),0,0,j)}else if(bt==="bevel"||bt==="fakeround"){const pt=-Math.sqrt(Je*Je-1),It=zt?pt:0,yt=zt?0:pt;if(J&&this.addCurrentVertex(H,ae,It,yt,j),bt==="fakeround"){const lt=Math.round(180*Qe/Math.PI/20);for(let qt=1;qt2*F){const It=H.add(ee.sub(H)._mult(F/pt)._round());this.updateDistance(H,It),this.addCurrentVertex(It,ge,0,0,j),H=It}}}}addCurrentVertex(i,c,f,g,b,w=!1){const T=c.y*g-c.x,I=-c.y-c.x*g;this.addHalfVertex(i,c.x+c.y*f,c.y-c.x*f,w,!1,f,b),this.addHalfVertex(i,T,I,w,!0,-g,b),this.distance>L_/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(i,c,f,g,b,w))}addHalfVertex({x:i,y:c},f,g,b,w,T,I){const L=.5*(this.lineClips?this.scaledDistance*(L_-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((i<<1)+(b?1:0),(c<<1)+(w?1:0),Math.round(63*f)+128,Math.round(63*g)+128,1+(T===0?0:T<0?-1:1)|(63&L)<<2,L>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const F=I.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,F),I.primitiveLength++),w?this.e2=F:this.e1=F}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(i,c){this.distance+=i.dist(c),this.updateScaledDistance()}}let P_,z_;Et("LineBucket",kp,{omit:["layers","patternFeatures"]});var D_={get paint(){return z_=z_||new Si({"line-opacity":new Gt(ne.paint_line["line-opacity"]),"line-color":new Gt(ne.paint_line["line-color"]),"line-translate":new Bt(ne.paint_line["line-translate"]),"line-translate-anchor":new Bt(ne.paint_line["line-translate-anchor"]),"line-width":new Gt(ne.paint_line["line-width"]),"line-gap-width":new Gt(ne.paint_line["line-gap-width"]),"line-offset":new Gt(ne.paint_line["line-offset"]),"line-blur":new Gt(ne.paint_line["line-blur"]),"line-dasharray":new ja(ne.paint_line["line-dasharray"]),"line-pattern":new Fl(ne.paint_line["line-pattern"]),"line-gradient":new su(ne.paint_line["line-gradient"])})},get layout(){return P_=P_||new Si({"line-cap":new Bt(ne.layout_line["line-cap"]),"line-join":new Gt(ne.layout_line["line-join"]),"line-miter-limit":new Bt(ne.layout_line["line-miter-limit"]),"line-round-limit":new Bt(ne.layout_line["line-round-limit"]),"line-sort-key":new Gt(ne.layout_line["line-sort-key"])})}};class R2 extends Gt{possiblyEvaluate(i,c){return c=new Qr(Math.floor(c.zoom),{now:c.now,fadeDuration:c.fadeDuration,zoomHistory:c.zoomHistory,transition:c.transition}),super.possiblyEvaluate(i,c)}evaluate(i,c,f,g){return c=X({},c,{zoom:Math.floor(c.zoom)}),super.evaluate(i,c,f,g)}}let wf;class B2 extends so{constructor(i){super(i,D_),this.gradientVersion=0,wf||(wf=new R2(D_.paint.properties["line-width"].specification),wf.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(i){if(i==="line-gradient"){const c=this.gradientExpression();this.stepInterpolant=!!function(f){return f._styleExpression!==void 0}(c)&&c._styleExpression.expression instanceof Pa,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,c){super.recalculate(i,c),this.paint._values["line-floorwidth"]=wf.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new kp(i)}queryRadius(i){const c=i,f=R_(bu("line-width",this,c),bu("line-gap-width",this,c)),g=bu("line-offset",this,c);return f/2+Math.abs(g)+pf(this.paint.get("line-translate"))}queryIntersectsFeature(i,c,f,g,b,w,T){const I=mf(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,T),L=T/2*R_(this.paint.get("line-width").evaluate(c,f),this.paint.get("line-gap-width").evaluate(c,f)),F=this.paint.get("line-offset").evaluate(c,f);return F&&(g=function(j,H){const J=[];for(let ee=0;ee=3){for(let ge=0;ge0?i+2*s:s}const F2=kn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),O2=kn([{name:"a_projected_pos",components:3,type:"Float32"}],4);kn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const N2=kn([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);kn([{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 B_=kn([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),j2=kn([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function U2(s,i,c){return s.sections.forEach(f=>{f.text=function(g,b,w){const T=b.layout.get("text-transform").evaluate(w,{});return T==="uppercase"?g=g.toLocaleUpperCase():T==="lowercase"&&(g=g.toLocaleLowerCase()),es.applyArabicShaping&&(g=es.applyArabicShaping(g)),g}(f.text,i,c)}),s}kn([{name:"triangle",components:3,type:"Uint16"}]),kn([{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"}]),kn([{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"}]),kn([{type:"Float32",name:"offsetX"}]),kn([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),kn([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Iu={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Nn=24,F_=Br,O_=function(s,i,c,f,g){var b,w,T=8*g-f-1,I=(1<>1,F=-7,j=c?g-1:0,H=c?-1:1,J=s[i+j];for(j+=H,b=J&(1<<-F)-1,J>>=-F,F+=T;F>0;b=256*b+s[i+j],j+=H,F-=8);for(w=b&(1<<-F)-1,b>>=-F,F+=f;F>0;w=256*w+s[i+j],j+=H,F-=8);if(b===0)b=1-L;else{if(b===I)return w?NaN:1/0*(J?-1:1);w+=Math.pow(2,f),b-=L}return(J?-1:1)*w*Math.pow(2,b-f)},N_=function(s,i,c,f,g,b){var w,T,I,L=8*b-g-1,F=(1<>1,H=g===23?Math.pow(2,-24)-Math.pow(2,-77):0,J=f?0:b-1,ee=f?1:-1,ae=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(T=isNaN(i)?1:0,w=F):(w=Math.floor(Math.log(i)/Math.LN2),i*(I=Math.pow(2,-w))<1&&(w--,I*=2),(i+=w+j>=1?H/I:H*Math.pow(2,1-j))*I>=2&&(w++,I/=2),w+j>=F?(T=0,w=F):w+j>=1?(T=(i*I-1)*Math.pow(2,g),w+=j):(T=i*Math.pow(2,j-1)*Math.pow(2,g),w=0));g>=8;s[c+J]=255&T,J+=ee,T/=256,g-=8);for(w=w<0;s[c+J]=255&w,J+=ee,w/=256,L-=8);s[c+J-ee]|=128*ae};function Br(s){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(s)?s:new Uint8Array(s||0),this.pos=0,this.type=0,this.length=this.buf.length}Br.Varint=0,Br.Fixed64=1,Br.Bytes=2,Br.Fixed32=5;var Tp=4294967296,j_=1/Tp,U_=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Ss(s){return s.type===Br.Bytes?s.readVarint()+s.pos:s.pos+1}function Jl(s,i,c){return c?4294967296*i+(s>>>0):4294967296*(i>>>0)+(s>>>0)}function V_(s,i,c){var f=i<=16383?1:i<=2097151?2:i<=268435455?3:Math.floor(Math.log(i)/(7*Math.LN2));c.realloc(f);for(var g=c.pos-1;g>=s;g--)c.buf[g+f]=c.buf[g]}function V2(s,i){for(var c=0;c>>8,s[c+2]=i>>>16,s[c+3]=i>>>24}function q_(s,i){return(s[i]|s[i+1]<<8|s[i+2]<<16)+(s[i+3]<<24)}Br.prototype={destroy:function(){this.buf=null},readFields:function(s,i,c){for(c=c||this.length;this.pos>3,b=this.pos;this.type=7&f,s(g,i,this),this.pos===b&&this.skip(f)}return i},readMessage:function(s,i){return this.readFields(s,i,this.readVarint()+this.pos)},readFixed32:function(){var s=xf(this.buf,this.pos);return this.pos+=4,s},readSFixed32:function(){var s=q_(this.buf,this.pos);return this.pos+=4,s},readFixed64:function(){var s=xf(this.buf,this.pos)+xf(this.buf,this.pos+4)*Tp;return this.pos+=8,s},readSFixed64:function(){var s=xf(this.buf,this.pos)+q_(this.buf,this.pos+4)*Tp;return this.pos+=8,s},readFloat:function(){var s=O_(this.buf,this.pos,!0,23,4);return this.pos+=4,s},readDouble:function(){var s=O_(this.buf,this.pos,!0,52,8);return this.pos+=8,s},readVarint:function(s){var i,c,f=this.buf;return i=127&(c=f[this.pos++]),c<128?i:(i|=(127&(c=f[this.pos++]))<<7,c<128?i:(i|=(127&(c=f[this.pos++]))<<14,c<128?i:(i|=(127&(c=f[this.pos++]))<<21,c<128?i:function(g,b,w){var T,I,L=w.buf;if(T=(112&(I=L[w.pos++]))>>4,I<128||(T|=(127&(I=L[w.pos++]))<<3,I<128)||(T|=(127&(I=L[w.pos++]))<<10,I<128)||(T|=(127&(I=L[w.pos++]))<<17,I<128)||(T|=(127&(I=L[w.pos++]))<<24,I<128)||(T|=(1&(I=L[w.pos++]))<<31,I<128))return Jl(g,T,b);throw new Error("Expected varint not more than 10 bytes")}(i|=(15&(c=f[this.pos]))<<28,s,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var s=this.readVarint();return s%2==1?(s+1)/-2:s/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var s=this.readVarint()+this.pos,i=this.pos;return this.pos=s,s-i>=12&&U_?function(c,f,g){return U_.decode(c.subarray(f,g))}(this.buf,i,s):function(c,f,g){for(var b="",w=f;w239?4:F>223?3:F>191?2:1;if(w+H>g)break;H===1?F<128&&(j=F):H===2?(192&(T=c[w+1]))==128&&(j=(31&F)<<6|63&T)<=127&&(j=null):H===3?(I=c[w+2],(192&(T=c[w+1]))==128&&(192&I)==128&&((j=(15&F)<<12|(63&T)<<6|63&I)<=2047||j>=55296&&j<=57343)&&(j=null)):H===4&&(I=c[w+2],L=c[w+3],(192&(T=c[w+1]))==128&&(192&I)==128&&(192&L)==128&&((j=(15&F)<<18|(63&T)<<12|(63&I)<<6|63&L)<=65535||j>=1114112)&&(j=null)),j===null?(j=65533,H=1):j>65535&&(j-=65536,b+=String.fromCharCode(j>>>10&1023|55296),j=56320|1023&j),b+=String.fromCharCode(j),w+=H}return b}(this.buf,i,s)},readBytes:function(){var s=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,s);return this.pos=s,i},readPackedVarint:function(s,i){if(this.type!==Br.Bytes)return s.push(this.readVarint(i));var c=Ss(this);for(s=s||[];this.pos127;);else if(i===Br.Bytes)this.pos=this.readVarint()+this.pos;else if(i===Br.Fixed32)this.pos+=4;else{if(i!==Br.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(s,i){this.writeVarint(s<<3|i)},realloc:function(s){for(var i=this.length||16;i268435455||s<0?function(i,c){var f,g;if(i>=0?(f=i%4294967296|0,g=i/4294967296|0):(g=~(-i/4294967296),4294967295^(f=~(-i%4294967296))?f=f+1|0:(f=0,g=g+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");c.realloc(10),function(b,w,T){T.buf[T.pos++]=127&b|128,b>>>=7,T.buf[T.pos++]=127&b|128,b>>>=7,T.buf[T.pos++]=127&b|128,b>>>=7,T.buf[T.pos++]=127&b|128,T.buf[T.pos]=127&(b>>>=7)}(f,0,c),function(b,w){var T=(7&b)<<4;w.buf[w.pos++]|=T|((b>>>=3)?128:0),b&&(w.buf[w.pos++]=127&b|((b>>>=7)?128:0),b&&(w.buf[w.pos++]=127&b|((b>>>=7)?128:0),b&&(w.buf[w.pos++]=127&b|((b>>>=7)?128:0),b&&(w.buf[w.pos++]=127&b|((b>>>=7)?128:0),b&&(w.buf[w.pos++]=127&b)))))}(g,c)}(s,this):(this.realloc(4),this.buf[this.pos++]=127&s|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=s>>>7&127))))},writeSVarint:function(s){this.writeVarint(s<0?2*-s-1:2*s)},writeBoolean:function(s){this.writeVarint(!!s)},writeString:function(s){s=String(s),this.realloc(4*s.length),this.pos++;var i=this.pos;this.pos=function(f,g,b){for(var w,T,I=0;I55295&&w<57344){if(!T){w>56319||I+1===g.length?(f[b++]=239,f[b++]=191,f[b++]=189):T=w;continue}if(w<56320){f[b++]=239,f[b++]=191,f[b++]=189,T=w;continue}w=T-55296<<10|w-56320|65536,T=null}else T&&(f[b++]=239,f[b++]=191,f[b++]=189,T=null);w<128?f[b++]=w:(w<2048?f[b++]=w>>6|192:(w<65536?f[b++]=w>>12|224:(f[b++]=w>>18|240,f[b++]=w>>12&63|128),f[b++]=w>>6&63|128),f[b++]=63&w|128)}return b}(this.buf,s,this.pos);var c=this.pos-i;c>=128&&V_(i,c,this),this.pos=i-1,this.writeVarint(c),this.pos+=c},writeFloat:function(s){this.realloc(4),N_(this.buf,s,this.pos,!0,23,4),this.pos+=4},writeDouble:function(s){this.realloc(8),N_(this.buf,s,this.pos,!0,52,8),this.pos+=8},writeBytes:function(s){var i=s.length;this.writeVarint(i),this.realloc(i);for(var c=0;c=128&&V_(c,f,this),this.pos=c-1,this.writeVarint(f),this.pos+=f},writeMessage:function(s,i,c){this.writeTag(s,Br.Bytes),this.writeRawMessage(i,c)},writePackedVarint:function(s,i){i.length&&this.writeMessage(s,V2,i)},writePackedSVarint:function(s,i){i.length&&this.writeMessage(s,q2,i)},writePackedBoolean:function(s,i){i.length&&this.writeMessage(s,Z2,i)},writePackedFloat:function(s,i){i.length&&this.writeMessage(s,G2,i)},writePackedDouble:function(s,i){i.length&&this.writeMessage(s,W2,i)},writePackedFixed32:function(s,i){i.length&&this.writeMessage(s,H2,i)},writePackedSFixed32:function(s,i){i.length&&this.writeMessage(s,$2,i)},writePackedFixed64:function(s,i){i.length&&this.writeMessage(s,X2,i)},writePackedSFixed64:function(s,i){i.length&&this.writeMessage(s,K2,i)},writeBytesField:function(s,i){this.writeTag(s,Br.Bytes),this.writeBytes(i)},writeFixed32Field:function(s,i){this.writeTag(s,Br.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(s,i){this.writeTag(s,Br.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(s,i){this.writeTag(s,Br.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(s,i){this.writeTag(s,Br.Fixed64),this.writeSFixed64(i)},writeVarintField:function(s,i){this.writeTag(s,Br.Varint),this.writeVarint(i)},writeSVarintField:function(s,i){this.writeTag(s,Br.Varint),this.writeSVarint(i)},writeStringField:function(s,i){this.writeTag(s,Br.Bytes),this.writeString(i)},writeFloatField:function(s,i){this.writeTag(s,Br.Fixed32),this.writeFloat(i)},writeDoubleField:function(s,i){this.writeTag(s,Br.Fixed64),this.writeDouble(i)},writeBooleanField:function(s,i){this.writeVarintField(s,!!i)}};var Ep=_(F_);const Mp=3;function J2(s,i,c){s===1&&c.readMessage(Y2,i)}function Y2(s,i,c){if(s===3){const{id:f,bitmap:g,width:b,height:w,left:T,top:I,advance:L}=c.readMessage(Q2,{});i.push({id:f,bitmap:new xu({width:b+2*Mp,height:w+2*Mp},g),metrics:{width:b,height:w,left:T,top:I,advance:L}})}}function Q2(s,i,c){s===1?i.id=c.readVarint():s===2?i.bitmap=c.readBytes():s===3?i.width=c.readVarint():s===4?i.height=c.readVarint():s===5?i.left=c.readSVarint():s===6?i.top=c.readSVarint():s===7&&(i.advance=c.readVarint())}const G_=Mp;function W_(s){let i=0,c=0;for(const w of s)i+=w.w*w.h,c=Math.max(c,w.w);s.sort((w,T)=>T.h-w.h);const f=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(i/.95)),c),h:1/0}];let g=0,b=0;for(const w of s)for(let T=f.length-1;T>=0;T--){const I=f[T];if(!(w.w>I.w||w.h>I.h)){if(w.x=I.x,w.y=I.y,b=Math.max(b,w.y+w.h),g=Math.max(g,w.x+w.w),w.w===I.w&&w.h===I.h){const L=f.pop();T=0&&f>=i&&kf[this.text.charCodeAt(f)];f--)c--;this.text=this.text.substring(i,c),this.sectionIndex=this.sectionIndex.slice(i,c)}substring(i,c){const f=new Ql;return f.text=this.text.substring(i,c),f.sectionIndex=this.sectionIndex.slice(i,c),f.sections=this.sections,f}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((i,c)=>Math.max(i,this.sections[c].scale),0)}addTextSection(i,c){this.text+=i.text,this.sections.push(Lu.forText(i.scale,i.fontStack||c));const f=this.sections.length-1;for(let g=0;g=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Sf(s,i,c,f,g,b,w,T,I,L,F,j,H,J,ee,ae){const ge=Ql.fromFeature(s,g);let xe;j===d.ah.vertical&&ge.verticalizePunctuation();const{processBidirectionalText:Re,processStyledBidirectionalText:ke}=es;if(Re&&ge.sections.length===1){xe=[];const Qe=Re(ge.toString(),Ip(ge,L,b,i,f,J,ee));for(const kt of Qe){const zt=new Ql;zt.text=kt,zt.sections=ge.sections;for(let St=0;St0&&Ts>Ui&&(Ui=Ts)}else{const co=zt[_r.fontStack],qi=co&&co[li];if(qi&&qi.rect)No=qi.rect,xo=qi.metrics;else{const Ts=kt[_r.fontStack],Bu=Ts&&Ts[li];if(!Bu)continue;xo=Bu.metrics}Gn=(Vn-_r.scale)*Nn}So?(Qe.verticalizable=!0,gi.push({glyph:li,imageName:jo,x:Xr,y:tn+Gn,vertical:So,scale:_r.scale,fontStack:_r.fontStack,sectionIndex:_i,metrics:xo,rect:No}),Xr+=ks*_r.scale+qt):(gi.push({glyph:li,imageName:jo,x:Xr,y:tn+Gn,vertical:So,scale:_r.scale,fontStack:_r.fontStack,sectionIndex:_i,metrics:xo,rect:No}),Xr+=xo.advance*_r.scale+qt)}gi.length!==0&&(jn=Math.max(Xr-qt,jn),rS(gi,0,gi.length-1,Ti,Ui)),Xr=0;const Vi=pt*Vn+Ui;Ci.lineOffset=Math.max(Ui,mi),tn+=Vi,Yi=Math.max(Vi,Yi),++zn}var Yn;const ai=tn-Au,{horizontalAlign:Ei,verticalAlign:Mi}=Ap(It);(function(Un,Vn,mi,Ci,gi,Ui,Vi,qn,_r){const _i=(Vn-mi)*gi;let li=0;li=Ui!==Vi?-qn*Ci-Au:(-Ci*_r+.5)*Vi;for(const Gn of Un)for(const xo of Gn.positionedGlyphs)xo.x+=_i,xo.y+=li})(Qe.positionedLines,Ti,Ei,Mi,jn,Yi,pt,ai,bt.length),Qe.top+=-Mi*ai,Qe.bottom=Qe.top+ai,Qe.left+=-Ei*jn,Qe.right=Qe.left+jn}(Je,i,c,f,xe,w,T,I,j,L,H,ae),!function(Qe){for(const kt of Qe)if(kt.positionedGlyphs.length!==0)return!1;return!0}(Ae)&&Je}const kf={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},eS={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function H_(s,i,c,f,g,b){if(i.imageName){const w=f[i.imageName];return w?w.displaySize[0]*i.scale*Nn/b+g:0}{const w=c[i.fontStack],T=w&&w[s];return T?T.metrics.advance*i.scale+g:0}}function $_(s,i,c,f){const g=Math.pow(s-i,2);return f?s=0;let F=0;for(let H=0;Hw.id),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=hp([]),this.placementViewportMatrix=hp([]);const c=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Y_(this.zoom,c["text-size"]),this.iconSizeData=Y_(this.zoom,c["icon-size"]);const f=this.layers[0].layout,g=f.get("symbol-sort-key"),b=f.get("symbol-z-order");this.canOverlap=Lp(f,"text-overlap","text-allow-overlap")!=="never"||Lp(f,"icon-overlap","icon-allow-overlap")!=="never"||f.get("text-ignore-placement")||f.get("icon-ignore-placement"),this.sortFeaturesByKey=b!=="viewport-y"&&!g.isConstant(),this.sortFeaturesByY=(b==="viewport-y"||b==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,f.get("symbol-placement")==="point"&&(this.writingModes=f.get("text-writing-mode").map(w=>d.ah[w])),this.stateDependentLayerIds=this.layers.filter(w=>w.isStateDependent()).map(w=>w.id),this.sourceID=i.sourceID}createArrays(){this.text=new zp(new sn(this.layers,this.zoom,i=>/^text/.test(i))),this.icon=new zp(new sn(this.layers,this.zoom,i=>/^icon/.test(i))),this.glyphOffsetArray=new v,this.lineVertexArray=new E,this.symbolInstances=new m,this.textAnchorOffsets=new A}calculateGlyphDependencies(i,c,f,g,b){for(let w=0;w0)&&(w.value.kind!=="constant"||w.value.value.length>0),F=I.value.kind!=="constant"||!!I.value.value||Object.keys(I.parameters).length>0,j=b.get("symbol-sort-key");if(this.features=[],!L&&!F)return;const H=c.iconDependencies,J=c.glyphDependencies,ee=c.availableImages,ae=new Qr(this.zoom);for(const{feature:ge,id:xe,index:Re,sourceLayerIndex:ke}of i){const Ae=g._featureFilter.needGeometry,Je=xs(ge,Ae);if(!g._featureFilter.filter(ae,Je,f))continue;let Qe,kt;if(Ae||(Je.geometry=ws(ge)),L){const St=g.getValueAndResolveTokens("text-field",Je,f,ee),bt=Ri.factory(St),pt=this.hasRTLText=this.hasRTLText||sS(bt);(!pt||es.getRTLTextPluginStatus()==="unavailable"||pt&&es.isParsed())&&(Qe=U2(bt,g,Je))}if(F){const St=g.getValueAndResolveTokens("icon-image",Je,f,ee);kt=St instanceof Xi?St:Xi.fromString(St)}if(!Qe&&!kt)continue;const zt=this.sortFeaturesByKey?j.evaluate(Je,{},f):void 0;if(this.features.push({id:xe,text:Qe,icon:kt,index:Re,sourceLayerIndex:ke,geometry:Je.geometry,properties:ge.properties,type:iS[ge.type],sortKey:zt}),kt&&(H[kt.name]=!0),Qe){const St=w.evaluate(Je,{},f).join(","),bt=b.get("text-rotation-alignment")!=="viewport"&&b.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(d.ah.vertical)>=0;for(const pt of Qe.sections)if(pt.image)H[pt.image.name]=!0;else{const It=Ks(Qe.toString()),yt=pt.fontStack||St,lt=J[yt]=J[yt]||{};this.calculateGlyphDependencies(pt.text,lt,bt,this.allowVerticalPlacement,It)}}}b.get("symbol-placement")==="line"&&(this.features=function(ge){const xe={},Re={},ke=[];let Ae=0;function Je(St){ke.push(ge[St]),Ae++}function Qe(St,bt,pt){const It=Re[St];return delete Re[St],Re[bt]=It,ke[It].geometry[0].pop(),ke[It].geometry[0]=ke[It].geometry[0].concat(pt[0]),It}function kt(St,bt,pt){const It=xe[bt];return delete xe[bt],xe[St]=It,ke[It].geometry[0].shift(),ke[It].geometry[0]=pt[0].concat(ke[It].geometry[0]),It}function zt(St,bt,pt){const It=pt?bt[0][bt[0].length-1]:bt[0][0];return`${St}:${It.x}:${It.y}`}for(let St=0;StSt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ge,xe)=>ge.sortKey-xe.sortKey)}update(i,c,f){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(i,c,this.layers,f),this.icon.programConfigurations.updatePaintArrays(i,c,this.layers,f))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(i){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(i),this.iconCollisionBox.upload(i)),this.text.upload(i,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(i,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(i,c){const f=this.lineVertexArray.length;if(i.segment!==void 0){let g=i.dist(c[i.segment+1]),b=i.dist(c[i.segment]);const w={};for(let T=i.segment+1;T=0;T--)w[T]={x:c[T].x,y:c[T].y,tileUnitDistanceFromAnchor:b},T>0&&(b+=c[T-1].dist(c[T]));for(let T=0;T0}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(i,c){const f=i.placedSymbolArray.get(c),g=f.vertexStartIndex+4*f.numGlyphs;for(let b=f.vertexStartIndex;bg[T]-g[I]||b[I]-b[T]),w}addToSortKeyRanges(i,c){const f=this.sortKeyRanges[this.sortKeyRanges.length-1];f&&f.sortKey===c?f.symbolInstanceEnd=i+1:this.sortKeyRanges.push({sortKey:c,symbolInstanceStart:i,symbolInstanceEnd:i+1})}sortFeatures(i){if(this.sortFeaturesByY&&this.sortedAngle!==i&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(i),this.sortedAngle=i,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const c of this.symbolInstanceIndexes){const f=this.symbolInstances.get(c);this.featureSortOrder.push(f.featureIndex),[f.rightJustifiedTextSymbolIndex,f.centerJustifiedTextSymbolIndex,f.leftJustifiedTextSymbolIndex].forEach((g,b,w)=>{g>=0&&w.indexOf(g)===b&&this.addIndicesForPlacedSymbol(this.text,g)}),f.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,f.verticalPlacedTextSymbolIndex),f.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,f.placedIconSymbolIndex),f.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,f.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Q_,ey;Et("SymbolBucket",ec,{omit:["layers","collisionBoxArray","features","compareText"]}),ec.MAX_GLYPHS=65535,ec.addDynamicAttributes=Pp;var Rp={get paint(){return ey=ey||new Si({"icon-opacity":new Gt(ne.paint_symbol["icon-opacity"]),"icon-color":new Gt(ne.paint_symbol["icon-color"]),"icon-halo-color":new Gt(ne.paint_symbol["icon-halo-color"]),"icon-halo-width":new Gt(ne.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Gt(ne.paint_symbol["icon-halo-blur"]),"icon-translate":new Bt(ne.paint_symbol["icon-translate"]),"icon-translate-anchor":new Bt(ne.paint_symbol["icon-translate-anchor"]),"text-opacity":new Gt(ne.paint_symbol["text-opacity"]),"text-color":new Gt(ne.paint_symbol["text-color"],{runtimeType:Nr,getOverride:s=>s.textColor,hasOverride:s=>!!s.textColor}),"text-halo-color":new Gt(ne.paint_symbol["text-halo-color"]),"text-halo-width":new Gt(ne.paint_symbol["text-halo-width"]),"text-halo-blur":new Gt(ne.paint_symbol["text-halo-blur"]),"text-translate":new Bt(ne.paint_symbol["text-translate"]),"text-translate-anchor":new Bt(ne.paint_symbol["text-translate-anchor"])})},get layout(){return Q_=Q_||new Si({"symbol-placement":new Bt(ne.layout_symbol["symbol-placement"]),"symbol-spacing":new Bt(ne.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Bt(ne.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Gt(ne.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Bt(ne.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Bt(ne.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Bt(ne.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Bt(ne.layout_symbol["icon-ignore-placement"]),"icon-optional":new Bt(ne.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Bt(ne.layout_symbol["icon-rotation-alignment"]),"icon-size":new Gt(ne.layout_symbol["icon-size"]),"icon-text-fit":new Bt(ne.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Bt(ne.layout_symbol["icon-text-fit-padding"]),"icon-image":new Gt(ne.layout_symbol["icon-image"]),"icon-rotate":new Gt(ne.layout_symbol["icon-rotate"]),"icon-padding":new Gt(ne.layout_symbol["icon-padding"]),"icon-keep-upright":new Bt(ne.layout_symbol["icon-keep-upright"]),"icon-offset":new Gt(ne.layout_symbol["icon-offset"]),"icon-anchor":new Gt(ne.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Bt(ne.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Bt(ne.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Bt(ne.layout_symbol["text-rotation-alignment"]),"text-field":new Gt(ne.layout_symbol["text-field"]),"text-font":new Gt(ne.layout_symbol["text-font"]),"text-size":new Gt(ne.layout_symbol["text-size"]),"text-max-width":new Gt(ne.layout_symbol["text-max-width"]),"text-line-height":new Bt(ne.layout_symbol["text-line-height"]),"text-letter-spacing":new Gt(ne.layout_symbol["text-letter-spacing"]),"text-justify":new Gt(ne.layout_symbol["text-justify"]),"text-radial-offset":new Gt(ne.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Bt(ne.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Gt(ne.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Gt(ne.layout_symbol["text-anchor"]),"text-max-angle":new Bt(ne.layout_symbol["text-max-angle"]),"text-writing-mode":new Bt(ne.layout_symbol["text-writing-mode"]),"text-rotate":new Gt(ne.layout_symbol["text-rotate"]),"text-padding":new Bt(ne.layout_symbol["text-padding"]),"text-keep-upright":new Bt(ne.layout_symbol["text-keep-upright"]),"text-transform":new Gt(ne.layout_symbol["text-transform"]),"text-offset":new Gt(ne.layout_symbol["text-offset"]),"text-allow-overlap":new Bt(ne.layout_symbol["text-allow-overlap"]),"text-overlap":new Bt(ne.layout_symbol["text-overlap"]),"text-ignore-placement":new Bt(ne.layout_symbol["text-ignore-placement"]),"text-optional":new Bt(ne.layout_symbol["text-optional"])})}};class ty{constructor(i){if(i.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=i.property.overrides?i.property.overrides.runtimeType:Or,this.defaultValue=i}evaluate(i){if(i.formattedSection){const c=this.defaultValue.property.overrides;if(c&&c.hasOverride(i.formattedSection))return c.getOverride(i.formattedSection)}return i.feature&&i.featureState?this.defaultValue.evaluate(i.feature,i.featureState):this.defaultValue.property.specification.default}eachChild(i){this.defaultValue.isConstant()||i(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Et("FormatSectionOverride",ty,{omit:["defaultValue"]});class Ef extends so{constructor(i){super(i,Rp)}recalculate(i,c){if(super.recalculate(i,c),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 f=this.layout.get("text-writing-mode");if(f){const g=[];for(const b of f)g.indexOf(b)<0&&g.push(b);this.layout._values["text-writing-mode"]=g}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(i,c,f,g){const b=this.layout.get(i).evaluate(c,{},f,g),w=this._unevaluatedLayout._values[i];return w.isDataDriven()||jr(w.value)||!b?b:function(T,I){return I.replace(/{([^{}]+)}/g,(L,F)=>T&&F in T?String(T[F]):"")}(c.properties,b)}createBucket(i){return new ec(i)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const i of Rp.paint.overridableProperties){if(!Ef.hasPaintOverride(this.layout,i))continue;const c=this.paint.get(i),f=new ty(c),g=new $r(f,c.property.specification);let b=null;b=c.value.kind==="constant"||c.value.kind==="source"?new Sl("source",g):new Xc("composite",g,c.value.zoomStops),this.paint._values[i]=new oo(c.property,b,c.parameters)}}_handleOverridablePaintPropertyUpdate(i,c,f){return!(!this.layout||c.isDataDriven()||f.isDataDriven())&&Ef.hasPaintOverride(this.layout,i)}static hasPaintOverride(i,c){const f=i.get("text-field"),g=Rp.paint.properties[c];let b=!1;const w=T=>{for(const I of T)if(g.overrides&&g.overrides.hasOverride(I))return void(b=!0)};if(f.value.kind==="constant"&&f.value.value instanceof Ri)w(f.value.value.sections);else if(f.value.kind==="source"){const T=L=>{b||(L instanceof Xo&&In(L.value)===an?w(L.value.sections):L instanceof wl?w(L.sections):L.eachChild(T))},I=f.value;I._styleExpression&&T(I._styleExpression.expression)}return b}}let ry;var aS={get paint(){return ry=ry||new Si({"background-color":new Bt(ne.paint_background["background-color"]),"background-pattern":new ja(ne.paint_background["background-pattern"]),"background-opacity":new Bt(ne.paint_background["background-opacity"])})}};class lS extends so{constructor(i){super(i,aS)}}let ny;var cS={get paint(){return ny=ny||new Si({"raster-opacity":new Bt(ne.paint_raster["raster-opacity"]),"raster-hue-rotate":new Bt(ne.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Bt(ne.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Bt(ne.paint_raster["raster-brightness-max"]),"raster-saturation":new Bt(ne.paint_raster["raster-saturation"]),"raster-contrast":new Bt(ne.paint_raster["raster-contrast"]),"raster-resampling":new Bt(ne.paint_raster["raster-resampling"]),"raster-fade-duration":new Bt(ne.paint_raster["raster-fade-duration"])})}};class uS extends so{constructor(i){super(i,cS)}}class hS extends so{constructor(i){super(i,{}),this.onAdd=c=>{this.implementation.onAdd&&this.implementation.onAdd(c,c.painter.context.gl)},this.onRemove=c=>{this.implementation.onRemove&&this.implementation.onRemove(c,c.painter.context.gl)},this.implementation=i}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 fS{constructor(i){this._methodToThrottle=i,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 Bp=63710088e-1;class ta{constructor(i,c){if(isNaN(i)||isNaN(c))throw new Error(`Invalid LngLat object: (${i}, ${c})`);if(this.lng=+i,this.lat=+c,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new ta(me(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(i){const c=Math.PI/180,f=this.lat*c,g=i.lat*c,b=Math.sin(f)*Math.sin(g)+Math.cos(f)*Math.cos(g)*Math.cos((i.lng-this.lng)*c);return Bp*Math.acos(Math.min(b,1))}static convert(i){if(i instanceof ta)return i;if(Array.isArray(i)&&(i.length===2||i.length===3))return new ta(Number(i[0]),Number(i[1]));if(!Array.isArray(i)&&typeof i=="object"&&i!==null)return new ta(Number("lng"in i?i.lng:i.lon),Number(i.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const iy=2*Math.PI*Bp;function oy(s){return iy*Math.cos(s*Math.PI/180)}function sy(s){return(180+s)/360}function ay(s){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s*Math.PI/360)))/360}function ly(s,i){return s/oy(i)}function Fp(s){return 360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90}class Mf{constructor(i,c,f=0){this.x=+i,this.y=+c,this.z=+f}static fromLngLat(i,c=0){const f=ta.convert(i);return new Mf(sy(f.lng),ay(f.lat),ly(c,f.lat))}toLngLat(){return new ta(360*this.x-180,Fp(this.y))}toAltitude(){return this.z*oy(Fp(this.y))}meterInMercatorCoordinateUnits(){return 1/iy*(i=Fp(this.y),1/Math.cos(i*Math.PI/180));var i}}function cy(s,i,c){var f=2*Math.PI*6378137/256/Math.pow(2,c);return[s*f-2*Math.PI*6378137/2,i*f-2*Math.PI*6378137/2]}class Op{constructor(i,c,f){if(i<0||i>25||f<0||f>=Math.pow(2,i)||c<0||c>=Math.pow(2,i))throw new Error(`x=${c}, y=${f}, z=${i} outside of bounds. 0<=x<${Math.pow(2,i)}, 0<=y<${Math.pow(2,i)} 0<=z<=25 `);this.z=i,this.x=c,this.y=f,this.key=zu(0,i,i,c,f)}equals(i){return this.z===i.z&&this.x===i.x&&this.y===i.y}url(i,c,f){const g=(w=this.y,T=this.z,I=cy(256*(b=this.x),256*(w=Math.pow(2,T)-w-1),T),L=cy(256*(b+1),256*(w+1),T),I[0]+","+I[1]+","+L[0]+","+L[1]);var b,w,T,I,L;const F=function(j,H,J){let ee,ae="";for(let ge=j;ge>0;ge--)ee=1<1?"@2x":"").replace(/{quadkey}/g,F).replace(/{bbox-epsg-3857}/g,g)}isChildOf(i){const c=this.z-i.z;return c>0&&i.x===this.x>>c&&i.y===this.y>>c}getTilePoint(i){const c=Math.pow(2,this.z);return new k((i.x*c-this.x)*yn,(i.y*c-this.y)*yn)}toString(){return`${this.z}/${this.x}/${this.y}`}}class uy{constructor(i,c){this.wrap=i,this.canonical=c,this.key=zu(i,c.z,c.z,c.x,c.y)}}class lo{constructor(i,c,f,g,b){if(i= z; overscaledZ = ${i}; z = ${f}`);this.overscaledZ=i,this.wrap=c,this.canonical=new Op(f,+g,+b),this.key=zu(c,i,f,g,b)}clone(){return new lo(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(i){return this.overscaledZ===i.overscaledZ&&this.wrap===i.wrap&&this.canonical.equals(i.canonical)}scaledTo(i){if(i>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${i}; overscaledZ = ${this.overscaledZ}`);const c=this.canonical.z-i;return i>this.canonical.z?new lo(i,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new lo(i,this.wrap,i,this.canonical.x>>c,this.canonical.y>>c)}calculateScaledKey(i,c){if(i>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${i}; overscaledZ = ${this.overscaledZ}`);const f=this.canonical.z-i;return i>this.canonical.z?zu(this.wrap*+c,i,this.canonical.z,this.canonical.x,this.canonical.y):zu(this.wrap*+c,i,i,this.canonical.x>>f,this.canonical.y>>f)}isChildOf(i){if(i.wrap!==this.wrap)return!1;const c=this.canonical.z-i.canonical.z;return i.overscaledZ===0||i.overscaledZ>c&&i.canonical.y===this.canonical.y>>c}children(i){if(this.overscaledZ>=i)return[new lo(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const c=this.canonical.z+1,f=2*this.canonical.x,g=2*this.canonical.y;return[new lo(c,this.wrap,c,f,g),new lo(c,this.wrap,c,f+1,g),new lo(c,this.wrap,c,f,g+1),new lo(c,this.wrap,c,f+1,g+1)]}isLessThan(i){return this.wrapi.wrap)&&(this.overscaledZi.overscaledZ)&&(this.canonical.xi.canonical.x)&&this.canonical.ythis.max&&(this.max=j),j=this.dim+1||c<-1||c>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(c+1)*this.stride+(i+1)}unpack(i,c,f){return i*this.redFactor+c*this.greenFactor+f*this.blueFactor-this.baseShift}getPixels(){return new ao({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(i,c,f){if(this.dim!==i.dim)throw new Error("dem dimension mismatch");let g=c*this.dim,b=c*this.dim+this.dim,w=f*this.dim,T=f*this.dim+this.dim;switch(c){case-1:g=b-1;break;case 1:b=g+1}switch(f){case-1:w=T-1;break;case 1:T=w+1}const I=-c*this.dim,L=-f*this.dim;for(let F=w;F=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${i} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[i]}}class dy{constructor(i,c,f,g,b){this.type="Feature",this._vectorTileFeature=i,i._z=c,i._x=f,i._y=g,this.properties=i.properties,this.id=b}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(i){this._geometry=i}toJSON(){const i={geometry:this.geometry};for(const c in this)c!=="_geometry"&&c!=="_vectorTileFeature"&&(i[c]=this[c]);return i}}class py{constructor(i,c){this.tileID=i,this.x=i.canonical.x,this.y=i.canonical.y,this.z=i.canonical.z,this.grid=new Fa(yn,16,0),this.grid3D=new Fa(yn,16,0),this.featureIndexArray=new V,this.promoteId=c}insert(i,c,f,g,b,w){const T=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(f,g,b);const I=w?this.grid3D:this.grid;for(let L=0;L=0&&j[3]>=0&&I.insert(T,j[0],j[1],j[2],j[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ys.VectorTile(new Ep(this.rawTileData)).layers,this.sourceLayerCoder=new fy(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(i,c,f,g){this.loadVTLayers();const b=i.params||{},w=yn/i.tileSize/i.scale,T=Ml(b.filter),I=i.queryGeometry,L=i.queryPadding*w,F=gy(I),j=this.grid.query(F.minX-L,F.minY-L,F.maxX+L,F.maxY+L),H=gy(i.cameraQueryGeometry),J=this.grid3D.query(H.minX-L,H.minY-L,H.maxX+L,H.maxY+L,(ge,xe,Re,ke)=>function(Ae,Je,Qe,kt,zt){for(const bt of Ae)if(Je<=bt.x&&Qe<=bt.y&&kt>=bt.x&&zt>=bt.y)return!0;const St=[new k(Je,Qe),new k(Je,zt),new k(kt,zt),new k(kt,Qe)];if(Ae.length>2){for(const bt of St)if(Hl(Ae,bt))return!0}for(let bt=0;bt(ke||(ke=ws(Ae)),Je.queryIntersectsFeature(I,Ae,Qe,ke,this.z,i.transform,w,i.pixelPosMatrix)))}return ee}loadMatchingFeature(i,c,f,g,b,w,T,I,L,F,j){const H=this.bucketLayerIDs[c];if(w&&!function(ge,xe){for(let Re=0;Re=0)return!0;return!1}(w,H))return;const J=this.sourceLayerCoder.decode(f),ee=this.vtLayers[J].feature(g);if(b.needGeometry){const ge=xs(ee,!0);if(!b.filter(new Qr(this.tileID.overscaledZ),ge,this.tileID.canonical))return}else if(!b.filter(new Qr(this.tileID.overscaledZ),ee))return;const ae=this.getId(ee,J);for(let ge=0;ge{const T=i instanceof Na?i.get(w):null;return T&&T.evaluate?T.evaluate(c,f,g):T})}function gy(s){let i=1/0,c=1/0,f=-1/0,g=-1/0;for(const b of s)i=Math.min(i,b.x),c=Math.min(c,b.y),f=Math.max(f,b.x),g=Math.max(g,b.y);return{minX:i,minY:c,maxX:f,maxY:g}}function dS(s,i){return i-s}function _y(s,i,c,f,g){const b=[];for(let w=0;w=f&&j.x>=f||(F.x>=f?F=new k(f,F.y+(f-F.x)/(j.x-F.x)*(j.y-F.y))._round():j.x>=f&&(j=new k(f,F.y+(f-F.x)/(j.x-F.x)*(j.y-F.y))._round()),F.y>=g&&j.y>=g||(F.y>=g?F=new k(F.x+(g-F.y)/(j.y-F.y)*(j.x-F.x),g)._round():j.y>=g&&(j=new k(F.x+(g-F.y)/(j.y-F.y)*(j.x-F.x),g)._round()),I&&F.equals(I[I.length-1])||(I=[F],b.push(I)),I.push(j)))))}}return b}Et("FeatureIndex",py,{omit:["rawTileData","sourceLayerCoder"]});class ra extends k{constructor(i,c,f,g){super(i,c),this.angle=f,g!==void 0&&(this.segment=g)}clone(){return new ra(this.x,this.y,this.angle,this.segment)}}function yy(s,i,c,f,g){if(i.segment===void 0||c===0)return!0;let b=i,w=i.segment+1,T=0;for(;T>-c/2;){if(w--,w<0)return!1;T-=s[w].dist(b),b=s[w]}T+=s[w].dist(s[w+1]),w++;const I=[];let L=0;for(;Tf;)L-=I.shift().angleDelta;if(L>g)return!1;w++,T+=F.dist(j)}return!0}function vy(s){let i=0;for(let c=0;cL){const ee=(L-I)/J,ae=di.number(j.x,H.x,ee),ge=di.number(j.y,H.y,ee),xe=new ra(ae,ge,H.angleTo(j),F);return xe._round(),!w||yy(s,xe,T,w,i)?xe:void 0}I+=J}}function mS(s,i,c,f,g,b,w,T,I){const L=by(f,b,w),F=wy(f,g),j=F*w,H=s[0].x===0||s[0].x===I||s[0].y===0||s[0].y===I;return i-j=0&&Ae=0&&Je=0&&H+L<=F){const Qe=new ra(Ae,Je,Re,ee);Qe._round(),f&&!yy(s,Qe,b,f,g)||J.push(Qe)}}j+=xe}return T||J.length||w||(J=xy(s,j/2,c,f,g,b,w,!0,I)),J}Et("Anchor",ra);const tc=ji;function Sy(s,i,c,f){const g=[],b=s.image,w=b.pixelRatio,T=b.paddedRect.w-2*tc,I=b.paddedRect.h-2*tc,L=s.right-s.left,F=s.bottom-s.top,j=b.stretchX||[[0,T]],H=b.stretchY||[[0,I]],J=(pt,It)=>pt+It[1]-It[0],ee=j.reduce(J,0),ae=H.reduce(J,0),ge=T-ee,xe=I-ae;let Re=0,ke=ee,Ae=0,Je=ae,Qe=0,kt=ge,zt=0,St=xe;if(b.content&&f){const pt=b.content;Re=Cf(j,0,pt[0]),Ae=Cf(H,0,pt[1]),ke=Cf(j,pt[0],pt[2]),Je=Cf(H,pt[1],pt[3]),Qe=pt[0]-Re,zt=pt[1]-Ae,kt=pt[2]-pt[0]-ke,St=pt[3]-pt[1]-Je}const bt=(pt,It,yt,lt)=>{const qt=If(pt.stretch-Re,ke,L,s.left),Dt=Af(pt.fixed-Qe,kt,pt.stretch,ee),mr=If(It.stretch-Ae,Je,F,s.top),Xr=Af(It.fixed-zt,St,It.stretch,ae),tn=If(yt.stretch-Re,ke,L,s.left),jn=Af(yt.fixed-Qe,kt,yt.stretch,ee),Yi=If(lt.stretch-Ae,Je,F,s.top),Ti=Af(lt.fixed-zt,St,lt.stretch,ae),zn=new k(qt,mr),Yn=new k(tn,mr),ai=new k(tn,Yi),Ei=new k(qt,Yi),Mi=new k(Dt/w,Xr/w),Un=new k(jn/w,Ti/w),Vn=i*Math.PI/180;if(Vn){const gi=Math.sin(Vn),Ui=Math.cos(Vn),Vi=[Ui,-gi,gi,Ui];zn._matMult(Vi),Yn._matMult(Vi),Ei._matMult(Vi),ai._matMult(Vi)}const mi=pt.stretch+pt.fixed,Ci=It.stretch+It.fixed;return{tl:zn,tr:Yn,bl:Ei,br:ai,tex:{x:b.paddedRect.x+tc+mi,y:b.paddedRect.y+tc+Ci,w:yt.stretch+yt.fixed-mi,h:lt.stretch+lt.fixed-Ci},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Mi,pixelOffsetBR:Un,minFontScaleX:kt/w/L,minFontScaleY:St/w/F,isSDF:c}};if(f&&(b.stretchX||b.stretchY)){const pt=ky(j,ge,ee),It=ky(H,xe,ae);for(let yt=0;yt0&&(ee=Math.max(10,ee),this.circleDiameter=ee)}else{let j=w.top*T-I[0],H=w.bottom*T+I[2],J=w.left*T-I[3],ee=w.right*T+I[1];const ae=w.collisionPadding;if(ae&&(J-=ae[0]*T,j-=ae[1]*T,ee+=ae[2]*T,H+=ae[3]*T),F){const ge=new k(J,j),xe=new k(ee,j),Re=new k(J,H),ke=new k(ee,H),Ae=F*Math.PI/180;ge._rotate(Ae),xe._rotate(Ae),Re._rotate(Ae),ke._rotate(Ae),J=Math.min(ge.x,xe.x,Re.x,ke.x),ee=Math.max(ge.x,xe.x,Re.x,ke.x),j=Math.min(ge.y,xe.y,Re.y,ke.y),H=Math.max(ge.y,xe.y,Re.y,ke.y)}i.emplaceBack(c.x,c.y,J,j,ee,H,f,g,b)}this.boxEndIndex=i.length}}class gS{constructor(i=[],c=_S){if(this.data=i,this.length=this.data.length,this.compare=c,this.length>0)for(let f=(this.length>>1)-1;f>=0;f--)this._down(f)}push(i){this.data.push(i),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const i=this.data[0],c=this.data.pop();return this.length--,this.length>0&&(this.data[0]=c,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:c,compare:f}=this,g=c[i];for(;i>0;){const b=i-1>>1,w=c[b];if(f(g,w)>=0)break;c[i]=w,i=b}c[i]=g}_down(i){const{data:c,compare:f}=this,g=this.length>>1,b=c[i];for(;i=0)break;c[i]=T,i=w}c[i]=b}}function _S(s,i){return si?1:0}function yS(s,i=1,c=!1){let f=1/0,g=1/0,b=-1/0,w=-1/0;const T=s[0];for(let J=0;Jb)&&(b=ee.x),(!J||ee.y>w)&&(w=ee.y)}const I=Math.min(b-f,w-g);let L=I/2;const F=new gS([],vS);if(I===0)return new k(f,g);for(let J=f;Jj.d||!j.d)&&(j=J,c&&console.log("found best %d after %d probes",Math.round(1e4*J.d)/1e4,H)),J.max-j.d<=i||(L=J.h/2,F.push(new rc(J.p.x-L,J.p.y-L,L,s)),F.push(new rc(J.p.x+L,J.p.y-L,L,s)),F.push(new rc(J.p.x-L,J.p.y+L,L,s)),F.push(new rc(J.p.x+L,J.p.y+L,L,s)),H+=4)}return c&&(console.log(`num probes: ${H}`),console.log(`best distance: ${j.d}`)),j.p}function vS(s,i){return i.max-s.max}function rc(s,i,c,f){this.p=new k(s,i),this.h=c,this.d=function(g,b){let w=!1,T=1/0;for(let I=0;Ig.y!=ee.y>g.y&&g.x<(ee.x-J.x)*(g.y-J.y)/(ee.y-J.y)+J.x&&(w=!w),T=Math.min(T,a_(g,J,ee))}}return(w?1:-1)*Math.sqrt(T)}(this.p,f),this.max=this.d+this.h*Math.SQRT2}var si;d.ap=void 0,(si=d.ap||(d.ap={}))[si.center=1]="center",si[si.left=2]="left",si[si.right=3]="right",si[si.top=4]="top",si[si.bottom=5]="bottom",si[si["top-left"]=6]="top-left",si[si["top-right"]=7]="top-right",si[si["bottom-left"]=8]="bottom-left",si[si["bottom-right"]=9]="bottom-right";const na=7,Np=Number.POSITIVE_INFINITY;function Ty(s,i){return i[1]!==Np?function(c,f,g){let b=0,w=0;switch(f=Math.abs(f),g=Math.abs(g),c){case"top-right":case"top-left":case"top":w=g-na;break;case"bottom-right":case"bottom-left":case"bottom":w=-g+na}switch(c){case"top-right":case"bottom-right":case"right":b=-f;break;case"top-left":case"bottom-left":case"left":b=f}return[b,w]}(s,i[0],i[1]):function(c,f){let g=0,b=0;f<0&&(f=0);const w=f/Math.SQRT2;switch(c){case"top-right":case"top-left":b=w-na;break;case"bottom-right":case"bottom-left":b=-w+na;break;case"bottom":b=-f+na;break;case"top":b=f-na}switch(c){case"top-right":case"bottom-right":g=-w;break;case"top-left":case"bottom-left":g=w;break;case"left":g=f;break;case"right":g=-f}return[g,b]}(s,i[0])}function Ey(s,i,c){var f;const g=s.layout,b=(f=g.get("text-variable-anchor-offset"))===null||f===void 0?void 0:f.evaluate(i,{},c);if(b){const T=b.values,I=[];for(let L=0;LH*Nn);F.startsWith("top")?j[1]-=na:F.startsWith("bottom")&&(j[1]+=na),I[L+1]=j}return new $i(I)}const w=g.get("text-variable-anchor");if(w){let T;T=s._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[g.get("text-radial-offset").evaluate(i,{},c)*Nn,Np]:g.get("text-offset").evaluate(i,{},c).map(L=>L*Nn);const I=[];for(const L of w)I.push(L,Ty(L,T));return new $i(I)}return null}function jp(s){switch(s){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function bS(s,i,c,f,g,b,w,T,I,L,F){let j=b.textMaxSize.evaluate(i,{});j===void 0&&(j=w);const H=s.layers[0].layout,J=H.get("icon-offset").evaluate(i,{},F),ee=Cy(c.horizontal),ae=w/24,ge=s.tilePixelRatio*ae,xe=s.tilePixelRatio*j/24,Re=s.tilePixelRatio*T,ke=s.tilePixelRatio*H.get("symbol-spacing"),Ae=H.get("text-padding")*s.tilePixelRatio,Je=function(lt,qt,Dt,mr=1){const Xr=lt.get("icon-padding").evaluate(qt,{},Dt),tn=Xr&&Xr.values;return[tn[0]*mr,tn[1]*mr,tn[2]*mr,tn[3]*mr]}(H,i,F,s.tilePixelRatio),Qe=H.get("text-max-angle")/180*Math.PI,kt=H.get("text-rotation-alignment")!=="viewport"&&H.get("symbol-placement")!=="point",zt=H.get("icon-rotation-alignment")==="map"&&H.get("symbol-placement")!=="point",St=H.get("symbol-placement"),bt=ke/2,pt=H.get("icon-text-fit");let It;f&&pt!=="none"&&(s.allowVerticalPlacement&&c.vertical&&(It=J_(f,c.vertical,pt,H.get("icon-text-fit-padding"),J,ae)),ee&&(f=J_(f,ee,pt,H.get("icon-text-fit-padding"),J,ae)));const yt=(lt,qt)=>{qt.x<0||qt.x>=yn||qt.y<0||qt.y>=yn||function(Dt,mr,Xr,tn,jn,Yi,Ti,zn,Yn,ai,Ei,Mi,Un,Vn,mi,Ci,gi,Ui,Vi,qn,_r,_i,li,Gn,xo){const No=Dt.addToLineVertexArray(mr,Xr);let jo,ks,So,co,qi=0,Ts=0,Bu=0,Py=0,$p=-1,Xp=-1;const Es={};let zy=hn("");if(Dt.allowVerticalPlacement&&tn.vertical){const yi=zn.layout.get("text-rotate").evaluate(_r,{},Gn)+90;So=new Lf(Yn,mr,ai,Ei,Mi,tn.vertical,Un,Vn,mi,yi),Ti&&(co=new Lf(Yn,mr,ai,Ei,Mi,Ti,gi,Ui,mi,yi))}if(jn){const yi=zn.layout.get("icon-rotate").evaluate(_r,{}),uo=zn.layout.get("icon-text-fit")!=="none",$a=Sy(jn,yi,li,uo),Vo=Ti?Sy(Ti,yi,li,uo):void 0;ks=new Lf(Yn,mr,ai,Ei,Mi,jn,gi,Ui,!1,yi),qi=4*$a.length;const Xa=Dt.iconSizeData;let os=null;Xa.kind==="source"?(os=[is*zn.layout.get("icon-size").evaluate(_r,{})],os[0]>ea&&Ze(`${Dt.layerIds[0]}: Value for "icon-size" is >= ${Pu}. Reduce your "icon-size".`)):Xa.kind==="composite"&&(os=[is*_i.compositeIconSizes[0].evaluate(_r,{},Gn),is*_i.compositeIconSizes[1].evaluate(_r,{},Gn)],(os[0]>ea||os[1]>ea)&&Ze(`${Dt.layerIds[0]}: Value for "icon-size" is >= ${Pu}. Reduce your "icon-size".`)),Dt.addSymbols(Dt.icon,$a,os,qn,Vi,_r,d.ah.none,mr,No.lineStartIndex,No.lineLength,-1,Gn),$p=Dt.icon.placedSymbolArray.length-1,Vo&&(Ts=4*Vo.length,Dt.addSymbols(Dt.icon,Vo,os,qn,Vi,_r,d.ah.vertical,mr,No.lineStartIndex,No.lineLength,-1,Gn),Xp=Dt.icon.placedSymbolArray.length-1)}const Dy=Object.keys(tn.horizontal);for(const yi of Dy){const uo=tn.horizontal[yi];if(!jo){zy=hn(uo.text);const Vo=zn.layout.get("text-rotate").evaluate(_r,{},Gn);jo=new Lf(Yn,mr,ai,Ei,Mi,uo,Un,Vn,mi,Vo)}const $a=uo.positionedLines.length===1;if(Bu+=My(Dt,mr,uo,Yi,zn,mi,_r,Ci,No,tn.vertical?d.ah.horizontal:d.ah.horizontalOnly,$a?Dy:[yi],Es,$p,_i,Gn),$a)break}tn.vertical&&(Py+=My(Dt,mr,tn.vertical,Yi,zn,mi,_r,Ci,No,d.ah.vertical,["vertical"],Es,Xp,_i,Gn));const SS=jo?jo.boxStartIndex:Dt.collisionBoxArray.length,kS=jo?jo.boxEndIndex:Dt.collisionBoxArray.length,TS=So?So.boxStartIndex:Dt.collisionBoxArray.length,ES=So?So.boxEndIndex:Dt.collisionBoxArray.length,MS=ks?ks.boxStartIndex:Dt.collisionBoxArray.length,CS=ks?ks.boxEndIndex:Dt.collisionBoxArray.length,IS=co?co.boxStartIndex:Dt.collisionBoxArray.length,AS=co?co.boxEndIndex:Dt.collisionBoxArray.length;let Uo=-1;const zf=(yi,uo)=>yi&&yi.circleDiameter?Math.max(yi.circleDiameter,uo):uo;Uo=zf(jo,Uo),Uo=zf(So,Uo),Uo=zf(ks,Uo),Uo=zf(co,Uo);const Ry=Uo>-1?1:0;Ry&&(Uo*=xo/Nn),Dt.glyphOffsetArray.length>=ec.MAX_GLYPHS&&Ze("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),_r.sortKey!==void 0&&Dt.addToSortKeyRanges(Dt.symbolInstances.length,_r.sortKey);const LS=Ey(zn,_r,Gn),[PS,zS]=function(yi,uo){const $a=yi.length,Vo=uo==null?void 0:uo.values;if((Vo==null?void 0:Vo.length)>0)for(let Xa=0;Xa=0?Es.right:-1,Es.center>=0?Es.center:-1,Es.left>=0?Es.left:-1,Es.vertical||-1,$p,Xp,zy,SS,kS,TS,ES,MS,CS,IS,AS,ai,Bu,Py,qi,Ts,Ry,0,Un,Uo,PS,zS)}(s,qt,lt,c,f,g,It,s.layers[0],s.collisionBoxArray,i.index,i.sourceLayerIndex,s.index,ge,[Ae,Ae,Ae,Ae],kt,I,Re,Je,zt,J,i,b,L,F,w)};if(St==="line")for(const lt of _y(i.geometry,0,0,yn,yn)){const qt=mS(lt,ke,Qe,c.vertical||ee,f,24,xe,s.overscaling,yn);for(const Dt of qt)ee&&wS(s,ee.text,bt,Dt)||yt(lt,Dt)}else if(St==="line-center"){for(const lt of i.geometry)if(lt.length>1){const qt=pS(lt,Qe,c.vertical||ee,f,24,xe);qt&&yt(lt,qt)}}else if(i.type==="Polygon")for(const lt of yp(i.geometry,0)){const qt=yS(lt,16);yt(lt[0],new ra(qt.x,qt.y,0))}else if(i.type==="LineString")for(const lt of i.geometry)yt(lt,new ra(lt[0].x,lt[0].y,0));else if(i.type==="Point")for(const lt of i.geometry)for(const qt of lt)yt([qt],new ra(qt.x,qt.y,0))}function My(s,i,c,f,g,b,w,T,I,L,F,j,H,J,ee){const ae=function(Re,ke,Ae,Je,Qe,kt,zt,St){const bt=Je.layout.get("text-rotate").evaluate(kt,{})*Math.PI/180,pt=[];for(const It of ke.positionedLines)for(const yt of It.positionedGlyphs){if(!yt.rect)continue;const lt=yt.rect||{};let qt=G_+1,Dt=!0,mr=1,Xr=0;const tn=(Qe||St)&&yt.vertical,jn=yt.metrics.advance*yt.scale/2;if(St&&ke.verticalizable&&(Xr=It.lineOffset/2-(yt.imageName?-(Nn-yt.metrics.width*yt.scale)/2:(yt.scale-1)*Nn)),yt.imageName){const qn=zt[yt.imageName];Dt=qn.sdf,mr=qn.pixelRatio,qt=ji/mr}const Yi=Qe?[yt.x+jn,yt.y]:[0,0];let Ti=Qe?[0,0]:[yt.x+jn+Ae[0],yt.y+Ae[1]-Xr],zn=[0,0];tn&&(zn=Ti,Ti=[0,0]);const Yn=yt.metrics.isDoubleResolution?2:1,ai=(yt.metrics.left-qt)*yt.scale-jn+Ti[0],Ei=(-yt.metrics.top-qt)*yt.scale+Ti[1],Mi=ai+lt.w/Yn*yt.scale/mr,Un=Ei+lt.h/Yn*yt.scale/mr,Vn=new k(ai,Ei),mi=new k(Mi,Ei),Ci=new k(ai,Un),gi=new k(Mi,Un);if(tn){const qn=new k(-jn,jn-Au),_r=-Math.PI/2,_i=Nn/2-jn,li=new k(5-Au-_i,-(yt.imageName?_i:0)),Gn=new k(...zn);Vn._rotateAround(_r,qn)._add(li)._add(Gn),mi._rotateAround(_r,qn)._add(li)._add(Gn),Ci._rotateAround(_r,qn)._add(li)._add(Gn),gi._rotateAround(_r,qn)._add(li)._add(Gn)}if(bt){const qn=Math.sin(bt),_r=Math.cos(bt),_i=[_r,-qn,qn,_r];Vn._matMult(_i),mi._matMult(_i),Ci._matMult(_i),gi._matMult(_i)}const Ui=new k(0,0),Vi=new k(0,0);pt.push({tl:Vn,tr:mi,bl:Ci,br:gi,tex:lt,writingMode:ke.writingMode,glyphOffset:Yi,sectionIndex:yt.sectionIndex,isSDF:Dt,pixelOffsetTL:Ui,pixelOffsetBR:Vi,minFontScaleX:0,minFontScaleY:0})}return pt}(0,c,T,g,b,w,f,s.allowVerticalPlacement),ge=s.textSizeData;let xe=null;ge.kind==="source"?(xe=[is*g.layout.get("text-size").evaluate(w,{})],xe[0]>ea&&Ze(`${s.layerIds[0]}: Value for "text-size" is >= ${Pu}. Reduce your "text-size".`)):ge.kind==="composite"&&(xe=[is*J.compositeTextSizes[0].evaluate(w,{},ee),is*J.compositeTextSizes[1].evaluate(w,{},ee)],(xe[0]>ea||xe[1]>ea)&&Ze(`${s.layerIds[0]}: Value for "text-size" is >= ${Pu}. Reduce your "text-size".`)),s.addSymbols(s.text,ae,xe,T,b,w,L,i,I.lineStartIndex,I.lineLength,H,ee);for(const Re of F)j[Re]=s.text.placedSymbolArray.length-1;return 4*ae.length}function Cy(s){for(const i in s)return s[i];return null}function wS(s,i,c,f){const g=s.compareText;if(i in g){const b=g[i];for(let w=b.length-1;w>=0;w--)if(f.dist(b[w])>4;if(g!==1)throw new Error(`Got v${g} data when expected v1.`);const b=Iy[15&f];if(!b)throw new Error("Unrecognized array type.");const[w]=new Uint16Array(i,2,1),[T]=new Uint32Array(i,4,1);return new Up(T,w,b,i)}constructor(i,c=64,f=Float64Array,g){if(isNaN(i)||i<0)throw new Error(`Unpexpected numItems value: ${i}.`);this.numItems=+i,this.nodeSize=Math.min(Math.max(+c,2),65535),this.ArrayType=f,this.IndexArrayType=i<65536?Uint16Array:Uint32Array;const b=Iy.indexOf(this.ArrayType),w=2*i*this.ArrayType.BYTES_PER_ELEMENT,T=i*this.IndexArrayType.BYTES_PER_ELEMENT,I=(8-T%8)%8;if(b<0)throw new Error(`Unexpected typed array class: ${f}.`);g&&g instanceof ArrayBuffer?(this.data=g,this.ids=new this.IndexArrayType(this.data,8,i),this.coords=new this.ArrayType(this.data,8+T+I,2*i),this._pos=2*i,this._finished=!0):(this.data=new ArrayBuffer(8+w+T+I),this.ids=new this.IndexArrayType(this.data,8,i),this.coords=new this.ArrayType(this.data,8+T+I,2*i),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+b]),new Uint16Array(this.data,2,1)[0]=c,new Uint32Array(this.data,4,1)[0]=i)}add(i,c){const f=this._pos>>1;return this.ids[f]=f,this.coords[this._pos++]=i,this.coords[this._pos++]=c,f}finish(){const i=this._pos>>1;if(i!==this.numItems)throw new Error(`Added ${i} items when expected ${this.numItems}.`);return Vp(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(i,c,f,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:b,coords:w,nodeSize:T}=this,I=[0,b.length-1,0],L=[];for(;I.length;){const F=I.pop()||0,j=I.pop()||0,H=I.pop()||0;if(j-H<=T){for(let ge=H;ge<=j;ge++){const xe=w[2*ge],Re=w[2*ge+1];xe>=i&&xe<=f&&Re>=c&&Re<=g&&L.push(b[ge])}continue}const J=H+j>>1,ee=w[2*J],ae=w[2*J+1];ee>=i&&ee<=f&&ae>=c&&ae<=g&&L.push(b[J]),(F===0?i<=ee:c<=ae)&&(I.push(H),I.push(J-1),I.push(1-F)),(F===0?f>=ee:g>=ae)&&(I.push(J+1),I.push(j),I.push(1-F))}return L}within(i,c,f){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:g,coords:b,nodeSize:w}=this,T=[0,g.length-1,0],I=[],L=f*f;for(;T.length;){const F=T.pop()||0,j=T.pop()||0,H=T.pop()||0;if(j-H<=w){for(let ge=H;ge<=j;ge++)Ly(b[2*ge],b[2*ge+1],i,c)<=L&&I.push(g[ge]);continue}const J=H+j>>1,ee=b[2*J],ae=b[2*J+1];Ly(ee,ae,i,c)<=L&&I.push(g[J]),(F===0?i-f<=ee:c-f<=ae)&&(T.push(H),T.push(J-1),T.push(1-F)),(F===0?i+f>=ee:c+f>=ae)&&(T.push(J+1),T.push(j),T.push(1-F))}return I}}function Vp(s,i,c,f,g,b){if(g-f<=c)return;const w=f+g>>1;Ay(s,i,w,f,g,b),Vp(s,i,c,f,w-1,1-b),Vp(s,i,c,w+1,g,1-b)}function Ay(s,i,c,f,g,b){for(;g>f;){if(g-f>600){const L=g-f+1,F=c-f+1,j=Math.log(L),H=.5*Math.exp(2*j/3),J=.5*Math.sqrt(j*H*(L-H)/L)*(F-L/2<0?-1:1);Ay(s,i,c,Math.max(f,Math.floor(c-F*H/L+J)),Math.min(g,Math.floor(c+(L-F)*H/L+J)),b)}const w=i[2*c+b];let T=f,I=g;for(Du(s,i,f,c),i[2*g+b]>w&&Du(s,i,f,g);Tw;)I--}i[2*f+b]===w?Du(s,i,f,I):(I++,Du(s,i,I,g)),I<=c&&(f=I+1),c<=I&&(g=I-1)}}function Du(s,i,c,f){qp(s,c,f),qp(i,2*c,2*f),qp(i,2*c+1,2*f+1)}function qp(s,i,c){const f=s[i];s[i]=s[c],s[c]=f}function Ly(s,i,c,f){const g=s-c,b=i-f;return g*g+b*b}var Gp;d.bd=void 0,(Gp=d.bd||(d.bd={})).create="create",Gp.load="load",Gp.fullLoad="fullLoad";let Pf=null,Ru=[];const Wp=1e3/60,Zp="loadTime",Hp="fullLoadTime",xS={mark(s){performance.mark(s)},frame(s){const i=s;Pf!=null&&Ru.push(i-Pf),Pf=i},clearMetrics(){Pf=null,Ru=[],performance.clearMeasures(Zp),performance.clearMeasures(Hp);for(const s in d.bd)performance.clearMarks(d.bd[s])},getPerformanceMetrics(){performance.measure(Zp,d.bd.create,d.bd.load),performance.measure(Hp,d.bd.create,d.bd.fullLoad);const s=performance.getEntriesByName(Zp)[0].duration,i=performance.getEntriesByName(Hp)[0].duration,c=Ru.length,f=1/(Ru.reduce((b,w)=>b+w,0)/c/1e3),g=Ru.filter(b=>b>Wp).reduce((b,w)=>b+(w-Wp)/Wp,0);return{loadTime:s,fullLoadTime:i,fps:f,percentDroppedFrames:g/(c+g)*100,totalFrames:c}}};d.$=gt,d.A=$l,d.B=function(s){if(Ot==null){const i=s.navigator?s.navigator.userAgent:null;Ot=!!s.safari||!(!i||!(/\b(iPad|iPhone|iPod)\b/.test(i)||i.match("Safari")&&!i.match("Chrome")))}return Ot},d.C=class{constructor(s,i){this.target=s,this.mapId=i,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new fS(()=>this.process()),this.subscription=function(c,f,g,b){return c.addEventListener(f,g,!1),{unsubscribe:()=>{c.removeEventListener(f,g,!1)}}}(this.target,"message",c=>this.receive(c)),this.globalScope=Ct(self)?s:window}registerMessageHandler(s,i){this.messageHandlers[s]=i}sendAsync(s,i){return new Promise((c,f)=>{const g=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[g]={resolve:c,reject:f},i&&i.signal.addEventListener("abort",()=>{delete this.resolveRejects[g];const T={id:g,type:"",origin:location.origin,targetMapId:s.targetMapId,sourceMapId:this.mapId};this.target.postMessage(T)},{once:!0});const b=[],w=Object.assign(Object.assign({},s),{id:g,sourceMapId:this.mapId,origin:location.origin,data:$s(s.data,b)});this.target.postMessage(w,{transfer:b})})}receive(s){const i=s.data,c=i.id;if(!(i.origin!=="file://"&&location.origin!=="file://"&&i.origin!==location.origin||i.targetMapId&&this.mapId!==i.targetMapId)){if(i.type===""){delete this.tasks[c];const f=this.abortControllers[c];return delete this.abortControllers[c],void(f&&f.abort())}if(Ct(self)||i.mustQueue)return this.tasks[c]=i,this.taskQueue.push(c),void this.invoker.trigger();this.processTask(c,i)}}process(){if(this.taskQueue.length===0)return;const s=this.taskQueue.shift(),i=this.tasks[s];delete this.tasks[s],this.taskQueue.length>0&&this.invoker.trigger(),i&&this.processTask(s,i)}processTask(s,i){return a(this,void 0,void 0,function*(){if(i.type===""){const g=this.resolveRejects[s];return delete this.resolveRejects[s],g?void(i.error?g.reject(Xs(i.error)):g.resolve(Xs(i.data))):void 0}if(!this.messageHandlers[i.type])return void this.completeTask(s,new Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const c=Xs(i.data),f=new AbortController;this.abortControllers[s]=f;try{const g=yield this.messageHandlers[i.type](i.sourceMapId,c,f);this.completeTask(s,null,g)}catch(g){this.completeTask(s,g)}})}completeTask(s,i,c){const f=[];delete this.abortControllers[s];const g={id:s,type:"",sourceMapId:this.mapId,origin:location.origin,error:i?$s(i):null,data:$s(c,f)};this.target.postMessage(g,{transfer:f})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},d.D=Bt,d.E=it,d.F=function(){var s=new $l(16);return $l!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s},d.G=nr,d.H=function(s,i,c){var f,g,b,w,T,I,L,F,j,H,J,ee,ae=c[0],ge=c[1],xe=c[2];return i===s?(s[12]=i[0]*ae+i[4]*ge+i[8]*xe+i[12],s[13]=i[1]*ae+i[5]*ge+i[9]*xe+i[13],s[14]=i[2]*ae+i[6]*ge+i[10]*xe+i[14],s[15]=i[3]*ae+i[7]*ge+i[11]*xe+i[15]):(g=i[1],b=i[2],w=i[3],T=i[4],I=i[5],L=i[6],F=i[7],j=i[8],H=i[9],J=i[10],ee=i[11],s[0]=f=i[0],s[1]=g,s[2]=b,s[3]=w,s[4]=T,s[5]=I,s[6]=L,s[7]=F,s[8]=j,s[9]=H,s[10]=J,s[11]=ee,s[12]=f*ae+T*ge+j*xe+i[12],s[13]=g*ae+I*ge+H*xe+i[13],s[14]=b*ae+L*ge+J*xe+i[14],s[15]=w*ae+F*ge+ee*xe+i[15]),s},d.I=Cp,d.J=function(s,i,c){var f=c[0],g=c[1],b=c[2];return s[0]=i[0]*f,s[1]=i[1]*f,s[2]=i[2]*f,s[3]=i[3]*f,s[4]=i[4]*g,s[5]=i[5]*g,s[6]=i[6]*g,s[7]=i[7]*g,s[8]=i[8]*b,s[9]=i[9]*b,s[10]=i[10]*b,s[11]=i[11]*b,s[12]=i[12],s[13]=i[13],s[14]=i[14],s[15]=i[15],s},d.K=h_,d.L=function(s,i){const c={};for(let f=0;f{const i=window.document.createElement("video");return i.muted=!0,new Promise(c=>{i.onloadstart=()=>{c(i)};for(const f of s){const g=window.document.createElement("source");st(f)||(i.crossOrigin="Anonymous"),g.src=f,i.appendChild(g)}})},d.a3=function(){return Y++},d.a4=y,d.a5=ec,d.a6=Ml,d.a7=xs,d.a8=Qr,d.a9=dy,d.aA=re,d.aB=function(s,i){if(!s)return[{command:"setStyle",args:[i]}];let c=[];try{if(!Ye(s.version,i.version))return[{command:"setStyle",args:[i]}];Ye(s.center,i.center)||c.push({command:"setCenter",args:[i.center]}),Ye(s.zoom,i.zoom)||c.push({command:"setZoom",args:[i.zoom]}),Ye(s.bearing,i.bearing)||c.push({command:"setBearing",args:[i.bearing]}),Ye(s.pitch,i.pitch)||c.push({command:"setPitch",args:[i.pitch]}),Ye(s.sprite,i.sprite)||c.push({command:"setSprite",args:[i.sprite]}),Ye(s.glyphs,i.glyphs)||c.push({command:"setGlyphs",args:[i.glyphs]}),Ye(s.transition,i.transition)||c.push({command:"setTransition",args:[i.transition]}),Ye(s.light,i.light)||c.push({command:"setLight",args:[i.light]}),Ye(s.terrain,i.terrain)||c.push({command:"setTerrain",args:[i.terrain]}),Ye(s.sky,i.sky)||c.push({command:"setSky",args:[i.sky]});const f={},g=[];(function(w,T,I,L){let F;for(F in T=T||{},w=w||{})Object.prototype.hasOwnProperty.call(w,F)&&(Object.prototype.hasOwnProperty.call(T,F)||wn(F,I,L));for(F in T)Object.prototype.hasOwnProperty.call(T,F)&&(Object.prototype.hasOwnProperty.call(w,F)?Ye(w[F],T[F])||(w[F].type==="geojson"&&T[F].type==="geojson"&&ni(w,T,F)?jt(I,{command:"setGeoJSONSourceData",args:[F,T[F].data]}):Mn(F,T,I,L)):bn(F,T,I))})(s.sources,i.sources,g,f);const b=[];s.layers&&s.layers.forEach(w=>{"source"in w&&f[w.source]?c.push({command:"removeLayer",args:[w.id]}):b.push(w)}),c=c.concat(g),function(w,T,I){T=T||[];const L=(w=w||[]).map($o),F=T.map($o),j=w.reduce(Jr,{}),H=T.reduce(Jr,{}),J=L.slice(),ee=Object.create(null);let ae,ge,xe,Re,ke;for(let Ae=0,Je=0;Ae@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(c,f,g,b)=>{const w=g||b;return i[f]=!w||w.toLowerCase(),""}),i["max-age"]){const c=parseInt(i["max-age"],10);isNaN(c)?delete i["max-age"]:i["max-age"]=c}return i},d.ab=function(s,i){const c=[];for(const f in s)f in i||c.push(f);return c},d.ac=K,d.ad=function(s,i,c){var f=Math.sin(c),g=Math.cos(c),b=i[0],w=i[1],T=i[2],I=i[3],L=i[4],F=i[5],j=i[6],H=i[7];return i!==s&&(s[8]=i[8],s[9]=i[9],s[10]=i[10],s[11]=i[11],s[12]=i[12],s[13]=i[13],s[14]=i[14],s[15]=i[15]),s[0]=b*g+L*f,s[1]=w*g+F*f,s[2]=T*g+j*f,s[3]=I*g+H*f,s[4]=L*g-b*f,s[5]=F*g-w*f,s[6]=j*g-T*f,s[7]=H*g-I*f,s},d.ae=function(s){var i=new $l(16);return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i[4]=s[4],i[5]=s[5],i[6]=s[6],i[7]=s[7],i[8]=s[8],i[9]=s[9],i[10]=s[10],i[11]=s[11],i[12]=s[12],i[13]=s[13],i[14]=s[14],i[15]=s[15],i},d.af=gf,d.ag=function(s,i){let c=0,f=0;if(s.kind==="constant")f=s.layoutSize;else if(s.kind!=="source"){const{interpolationType:g,minZoom:b,maxZoom:w}=s,T=g?K(oi.interpolationFactor(g,i,b,w),0,1):0;s.kind==="camera"?f=di.number(s.minSize,s.maxSize,T):c=T}return{uSizeT:c,uSize:f}},d.ai=function(s,{uSize:i,uSizeT:c},{lowerSize:f,upperSize:g}){return s.kind==="source"?f/is:s.kind==="composite"?di.number(f/is,g/is,c):i},d.aj=Pp,d.ak=function(s,i,c,f){const g=i.y-s.y,b=i.x-s.x,w=f.y-c.y,T=f.x-c.x,I=w*b-T*g;if(I===0)return null;const L=(T*(s.y-c.y)-w*(s.x-c.x))/I;return new k(s.x+L*b,s.y+L*g)},d.al=_y,d.am=gu,d.an=hp,d.ao=Nn,d.aq=Lp,d.ar=function(s,i){var c=i[0],f=i[1],g=i[2],b=i[3],w=i[4],T=i[5],I=i[6],L=i[7],F=i[8],j=i[9],H=i[10],J=i[11],ee=i[12],ae=i[13],ge=i[14],xe=i[15],Re=c*T-f*w,ke=c*I-g*w,Ae=c*L-b*w,Je=f*I-g*T,Qe=f*L-b*T,kt=g*L-b*I,zt=F*ae-j*ee,St=F*ge-H*ee,bt=F*xe-J*ee,pt=j*ge-H*ae,It=j*xe-J*ae,yt=H*xe-J*ge,lt=Re*yt-ke*It+Ae*pt+Je*bt-Qe*St+kt*zt;return lt?(s[0]=(T*yt-I*It+L*pt)*(lt=1/lt),s[1]=(g*It-f*yt-b*pt)*lt,s[2]=(ae*kt-ge*Qe+xe*Je)*lt,s[3]=(H*Qe-j*kt-J*Je)*lt,s[4]=(I*bt-w*yt-L*St)*lt,s[5]=(c*yt-g*bt+b*St)*lt,s[6]=(ge*Ae-ee*kt-xe*ke)*lt,s[7]=(F*kt-H*Ae+J*ke)*lt,s[8]=(w*It-T*bt+L*zt)*lt,s[9]=(f*bt-c*It-b*zt)*lt,s[10]=(ee*Qe-ae*Ae+xe*Re)*lt,s[11]=(j*Ae-F*Qe-J*Re)*lt,s[12]=(T*St-w*pt-I*zt)*lt,s[13]=(c*pt-f*St+g*zt)*lt,s[14]=(ae*ke-ee*Je-ge*Re)*lt,s[15]=(F*Je-j*ke+H*Re)*lt,s):null},d.as=jp,d.at=Ap,d.au=Up,d.av=function(){const s={},i=ne.$version;for(const c in ne.$root){const f=ne.$root[c];if(f.required){let g=null;g=c==="version"?i:f.type==="array"?[]:{},g!=null&&(s[c]=g)}}return s},d.aw=tf,d.ax=Lr,d.ay=function(s){s=s.slice();const i=Object.create(null);for(let c=0;clt*Nn)}let St=w?"center":c.get("text-justify").evaluate(L,{},s.canonical);const bt=c.get("symbol-placement"),pt=bt==="point"?c.get("text-max-width").evaluate(L,{},s.canonical)*Nn:0,It=()=>{s.bucket.allowVerticalPlacement&&Ks(Ae)&&(ee.vertical=Sf(ae,s.glyphMap,s.glyphPositions,s.imagePositions,F,pt,b,kt,"left",Qe,xe,d.ah.vertical,!0,bt,H,j))};if(!w&&zt){const yt=new Set;if(St==="auto")for(let qt=0;qta(void 0,void 0,void 0,function*(){if(s.byteLength===0)return createImageBitmap(new ImageData(1,1));const i=new Blob([new Uint8Array(s)],{type:"image/png"});try{return createImageBitmap(i)}catch(c){throw new Error(`Could not load image because of ${c.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),d.e=X,d.f=s=>new Promise((i,c)=>{const f=new Image;f.onload=()=>{i(f),URL.revokeObjectURL(f.src),f.onload=null,window.requestAnimationFrame(()=>{f.src=Kt})},f.onerror=()=>c(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 g=new Blob([new Uint8Array(s)],{type:"image/png"});f.src=s.byteLength?URL.createObjectURL(g):Kt}),d.g=Nt,d.h=(s,i)=>Pr(X(s,{type:"json"}),i),d.i=Ct,d.j=tt,d.k=at,d.l=(s,i)=>Pr(X(s,{type:"arrayBuffer"}),i),d.m=Pr,d.n=function(s){return new Ep(s).readFields(J2,[])},d.o=xu,d.p=W_,d.q=Si,d.r=ap,d.s=st,d.t=Hs,d.u=xt,d.v=ne,d.w=Ze,d.x=ys,d.y=function([s,i,c]){return i+=90,i*=Math.PI/180,c*=Math.PI/180,{x:s*Math.cos(i)*Math.sin(c),y:s*Math.sin(i)*Math.sin(c),z:s*Math.cos(c)}},d.z=di}),l("worker",["./shared"],function(d){class a{constructor(Z){this.keyCache={},Z&&this.replace(Z)}replace(Z){this._layerConfigs={},this._layers={},this.update(Z,[])}update(Z,$){for(const le of Z){this._layerConfigs[le.id]=le;const Ce=this._layers[le.id]=d.az(le);Ce._featureFilter=d.a6(Ce.filter),this.keyCache[le.id]&&delete this.keyCache[le.id]}for(const le of $)delete this.keyCache[le],delete this._layerConfigs[le],delete this._layers[le];this.familiesBySource={};const te=d.bh(Object.values(this._layerConfigs),this.keyCache);for(const le of te){const Ce=le.map(Fe=>this._layers[Fe.id]),Ie=Ce[0];if(Ie.visibility==="none")continue;const Pe=Ie.source||"";let Se=this.familiesBySource[Pe];Se||(Se=this.familiesBySource[Pe]={});const W=Ie.sourceLayer||"_geojsonTileLayer";let Be=Se[W];Be||(Be=Se[W]=[]),Be.push(Ce)}}}class _{constructor(Z){const $={},te=[];for(const Pe in Z){const Se=Z[Pe],W=$[Pe]={};for(const Be in Se){const Fe=Se[+Be];if(!Fe||Fe.bitmap.width===0||Fe.bitmap.height===0)continue;const qe={x:0,y:0,w:Fe.bitmap.width+2,h:Fe.bitmap.height+2};te.push(qe),W[Be]={rect:qe,metrics:Fe.metrics}}}const{w:le,h:Ce}=d.p(te),Ie=new d.o({width:le||1,height:Ce||1});for(const Pe in Z){const Se=Z[Pe];for(const W in Se){const Be=Se[+W];if(!Be||Be.bitmap.width===0||Be.bitmap.height===0)continue;const Fe=$[Pe][W].rect;d.o.copy(Be.bitmap,Ie,{x:0,y:0},{x:Fe.x+1,y:Fe.y+1},Be.bitmap)}}this.image=Ie,this.positions=$}}d.bi("GlyphAtlas",_);class x{constructor(Z){this.tileID=new d.Q(Z.tileID.overscaledZ,Z.tileID.wrap,Z.tileID.canonical.z,Z.tileID.canonical.x,Z.tileID.canonical.y),this.uid=Z.uid,this.zoom=Z.zoom,this.pixelRatio=Z.pixelRatio,this.tileSize=Z.tileSize,this.source=Z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=Z.showCollisionBoxes,this.collectResourceTiming=!!Z.collectResourceTiming,this.returnDependencies=!!Z.returnDependencies,this.promoteId=Z.promoteId,this.inFlightDependencies=[]}parse(Z,$,te,le){return d._(this,void 0,void 0,function*(){this.status="parsing",this.data=Z,this.collisionBoxArray=new d.a4;const Ce=new d.bj(Object.keys(Z.layers).sort()),Ie=new d.bk(this.tileID,this.promoteId);Ie.bucketLayerIDs=[];const Pe={},Se={featureIndex:Ie,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:te},W=$.familiesBySource[this.source];for(const lr in W){const ln=Z.layers[lr];if(!ln)continue;ln.version===1&&d.w(`Vector tile source "${this.source}" layer "${lr}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Bn=Ce.encode(lr),fi=[];for(let bi=0;bi=Kn.maxzoom||Kn.visibility!=="none"&&(S(bi,this.zoom,te),(Pe[Kn.id]=Kn.createBucket({index:Ie.bucketLayerIDs.length,layers:bi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Bn,sourceID:this.source})).populate(fi,Se,this.tileID.canonical),Ie.bucketLayerIDs.push(bi.map(mo=>mo.id)))}}const Be=d.aE(Se.glyphDependencies,lr=>Object.keys(lr).map(Number));this.inFlightDependencies.forEach(lr=>lr==null?void 0:lr.abort()),this.inFlightDependencies=[];let Fe=Promise.resolve({});if(Object.keys(Be).length){const lr=new AbortController;this.inFlightDependencies.push(lr),Fe=le.sendAsync({type:"GG",data:{stacks:Be,source:this.source,tileID:this.tileID,type:"glyphs"}},lr)}const qe=Object.keys(Se.iconDependencies);let Xe=Promise.resolve({});if(qe.length){const lr=new AbortController;this.inFlightDependencies.push(lr),Xe=le.sendAsync({type:"GI",data:{icons:qe,source:this.source,tileID:this.tileID,type:"icons"}},lr)}const ut=Object.keys(Se.patternDependencies);let Pt=Promise.resolve({});if(ut.length){const lr=new AbortController;this.inFlightDependencies.push(lr),Pt=le.sendAsync({type:"GI",data:{icons:ut,source:this.source,tileID:this.tileID,type:"patterns"}},lr)}const[$t,ar,gr]=yield Promise.all([Fe,Xe,Pt]),Yr=new _($t),Cn=new d.bl(ar,gr);for(const lr in Pe){const ln=Pe[lr];ln instanceof d.a5?(S(ln.layers,this.zoom,te),d.bm({bucket:ln,glyphMap:$t,glyphPositions:Yr.positions,imageMap:ar,imagePositions:Cn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):ln.hasPattern&&(ln instanceof d.bn||ln instanceof d.bo||ln instanceof d.bp)&&(S(ln.layers,this.zoom,te),ln.addFeatures(Se,this.tileID.canonical,Cn.patternPositions))}return this.status="done",{buckets:Object.values(Pe).filter(lr=>!lr.isEmpty()),featureIndex:Ie,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Yr.image,imageAtlas:Cn,glyphMap:this.returnDependencies?$t:null,iconMap:this.returnDependencies?ar:null,glyphPositions:this.returnDependencies?Yr.positions:null}})}}function S(pe,Z,$){const te=new d.a8(Z);for(const le of pe)le.recalculate(te,$)}class k{constructor(Z,$,te){this.actor=Z,this.layerIndex=$,this.availableImages=te,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(Z,$){return d._(this,void 0,void 0,function*(){const te=yield d.l(Z.request,$);try{return{vectorTile:new d.bq.VectorTile(new d.br(te.data)),rawData:te.data,cacheControl:te.cacheControl,expires:te.expires}}catch(le){const Ce=new Uint8Array(te.data);let Ie=`Unable to parse the tile at ${Z.request.url}, `;throw Ie+=Ce[0]===31&&Ce[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${le.messge}`,new Error(Ie)}})}loadTile(Z){return d._(this,void 0,void 0,function*(){const $=Z.uid,te=!!(Z&&Z.request&&Z.request.collectResourceTiming)&&new d.bs(Z.request),le=new x(Z);this.loading[$]=le;const Ce=new AbortController;le.abort=Ce;try{const Ie=yield this.loadVectorTile(Z,Ce);if(delete this.loading[$],!Ie)return null;const Pe=Ie.rawData,Se={};Ie.expires&&(Se.expires=Ie.expires),Ie.cacheControl&&(Se.cacheControl=Ie.cacheControl);const W={};if(te){const Fe=te.finish();Fe&&(W.resourceTiming=JSON.parse(JSON.stringify(Fe)))}le.vectorTile=Ie.vectorTile;const Be=le.parse(Ie.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[$]=le,this.fetching[$]={rawTileData:Pe,cacheControl:Se,resourceTiming:W};try{const Fe=yield Be;return d.e({rawTileData:Pe.slice(0)},Fe,Se,W)}finally{delete this.fetching[$]}}catch(Ie){throw delete this.loading[$],le.status="done",this.loaded[$]=le,Ie}})}reloadTile(Z){return d._(this,void 0,void 0,function*(){const $=Z.uid;if(!this.loaded||!this.loaded[$])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const te=this.loaded[$];if(te.showCollisionBoxes=Z.showCollisionBoxes,te.status==="parsing"){const le=yield te.parse(te.vectorTile,this.layerIndex,this.availableImages,this.actor);let Ce;if(this.fetching[$]){const{rawTileData:Ie,cacheControl:Pe,resourceTiming:Se}=this.fetching[$];delete this.fetching[$],Ce=d.e({rawTileData:Ie.slice(0)},le,Pe,Se)}else Ce=le;return Ce}if(te.status==="done"&&te.vectorTile)return te.parse(te.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(Z){return d._(this,void 0,void 0,function*(){const $=this.loading,te=Z.uid;$&&$[te]&&$[te].abort&&($[te].abort.abort(),delete $[te])})}removeTile(Z){return d._(this,void 0,void 0,function*(){this.loaded&&this.loaded[Z.uid]&&delete this.loaded[Z.uid]})}}class C{constructor(){this.loaded={}}loadTile(Z){return d._(this,void 0,void 0,function*(){const{uid:$,encoding:te,rawImageData:le,redFactor:Ce,greenFactor:Ie,blueFactor:Pe,baseShift:Se}=Z,W=le.width+2,Be=le.height+2,Fe=d.b(le)?new d.R({width:W,height:Be},yield d.bt(le,-1,-1,W,Be)):le,qe=new d.bu($,Fe,te,Ce,Ie,Pe,Se);return this.loaded=this.loaded||{},this.loaded[$]=qe,qe})}removeTile(Z){const $=this.loaded,te=Z.uid;$&&$[te]&&delete $[te]}}function P(pe,Z){if(pe.length!==0){D(pe[0],Z);for(var $=1;$=Math.abs(Pe)?$-Se+Pe:Pe-Se+$,$=Se}$+te>=0!=!!Z&&pe.reverse()}var N=d.bv(function pe(Z,$){var te,le=Z&&Z.type;if(le==="FeatureCollection")for(te=0;te>31}function ft(pe,Z){for(var $=pe.loadGeometry(),te=pe.type,le=0,Ce=0,Ie=$.length,Pe=0;Pepe},Kt=Math.fround||(vt=new Float32Array(1),pe=>(vt[0]=+pe,vt[0]));var vt;const At=3,Vt=5,sr=6;class fr{constructor(Z){this.options=Object.assign(Object.create(Ke),Z),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(Z){const{log:$,minZoom:te,maxZoom:le}=this.options;$&&console.time("total time");const Ce=`prepare ${Z.length} points`;$&&console.time(Ce),this.points=Z;const Ie=[];for(let Se=0;Se=te;Se--){const W=+Date.now();Pe=this.trees[Se]=this._createTree(this._cluster(Pe,Se)),$&&console.log("z%d: %d clusters in %dms",Se,Pe.numItems,+Date.now()-W)}return $&&console.timeEnd("total time"),this}getClusters(Z,$){let te=((Z[0]+180)%360+360)%360-180;const le=Math.max(-90,Math.min(90,Z[1]));let Ce=Z[2]===180?180:((Z[2]+180)%360+360)%360-180;const Ie=Math.max(-90,Math.min(90,Z[3]));if(Z[2]-Z[0]>=360)te=-180,Ce=180;else if(te>Ce){const Fe=this.getClusters([te,le,180,Ie],$),qe=this.getClusters([-180,le,Ce,Ie],$);return Fe.concat(qe)}const Pe=this.trees[this._limitZoom($)],Se=Pe.range(nr(te),tr(Ie),nr(Ce),tr(le)),W=Pe.data,Be=[];for(const Fe of Se){const qe=this.stride*Fe;Be.push(W[qe+Vt]>1?er(W,qe,this.clusterProps):this.points[W[qe+At]])}return Be}getChildren(Z){const $=this._getOriginId(Z),te=this._getOriginZoom(Z),le="No cluster with the specified id.",Ce=this.trees[te];if(!Ce)throw new Error(le);const Ie=Ce.data;if($*this.stride>=Ie.length)throw new Error(le);const Pe=this.options.radius/(this.options.extent*Math.pow(2,te-1)),Se=Ce.within(Ie[$*this.stride],Ie[$*this.stride+1],Pe),W=[];for(const Be of Se){const Fe=Be*this.stride;Ie[Fe+4]===Z&&W.push(Ie[Fe+Vt]>1?er(Ie,Fe,this.clusterProps):this.points[Ie[Fe+At]])}if(W.length===0)throw new Error(le);return W}getLeaves(Z,$,te){const le=[];return this._appendLeaves(le,Z,$=$||10,te=te||0,0),le}getTile(Z,$,te){const le=this.trees[this._limitZoom(Z)],Ce=Math.pow(2,Z),{extent:Ie,radius:Pe}=this.options,Se=Pe/Ie,W=(te-Se)/Ce,Be=(te+1+Se)/Ce,Fe={features:[]};return this._addTileFeatures(le.range(($-Se)/Ce,W,($+1+Se)/Ce,Be),le.data,$,te,Ce,Fe),$===0&&this._addTileFeatures(le.range(1-Se/Ce,W,1,Be),le.data,Ce,te,Ce,Fe),$===Ce-1&&this._addTileFeatures(le.range(0,W,Se/Ce,Be),le.data,-1,te,Ce,Fe),Fe.features.length?Fe:null}getClusterExpansionZoom(Z){let $=this._getOriginZoom(Z)-1;for(;$<=this.options.maxZoom;){const te=this.getChildren(Z);if($++,te.length!==1)break;Z=te[0].properties.cluster_id}return $}_appendLeaves(Z,$,te,le,Ce){const Ie=this.getChildren($);for(const Pe of Ie){const Se=Pe.properties;if(Se&&Se.cluster?Ce+Se.point_count<=le?Ce+=Se.point_count:Ce=this._appendLeaves(Z,Se.cluster_id,te,le,Ce):Ce1;let Be,Fe,qe;if(W)Be=Nt($,Se,this.clusterProps),Fe=$[Se],qe=$[Se+1];else{const Pt=this.points[$[Se+At]];Be=Pt.properties;const[$t,ar]=Pt.geometry.coordinates;Fe=nr($t),qe=tr(ar)}const Xe={type:1,geometry:[[Math.round(this.options.extent*(Fe*Ce-te)),Math.round(this.options.extent*(qe*Ce-le))]],tags:Be};let ut;ut=W||this.options.generateId?$[Se+At]:this.points[$[Se+At]].id,ut!==void 0&&(Xe.id=ut),Ie.features.push(Xe)}}_limitZoom(Z){return Math.max(this.options.minZoom,Math.min(Math.floor(+Z),this.options.maxZoom+1))}_cluster(Z,$){const{radius:te,extent:le,reduce:Ce,minPoints:Ie}=this.options,Pe=te/(le*Math.pow(2,$)),Se=Z.data,W=[],Be=this.stride;for(let Fe=0;Fe$&&($t+=Se[gr+Vt])}if($t>Pt&&$t>=Ie){let ar,gr=qe*Pt,Yr=Xe*Pt,Cn=-1;const lr=((Fe/Be|0)<<5)+($+1)+this.points.length;for(const ln of ut){const Bn=ln*Be;if(Se[Bn+2]<=$)continue;Se[Bn+2]=$;const fi=Se[Bn+Vt];gr+=Se[Bn]*fi,Yr+=Se[Bn+1]*fi,Se[Bn+4]=lr,Ce&&(ar||(ar=this._map(Se,Fe,!0),Cn=this.clusterProps.length,this.clusterProps.push(ar)),Ce(ar,this._map(Se,Bn)))}Se[Fe+4]=lr,W.push(gr/$t,Yr/$t,1/0,lr,-1,$t),Ce&&W.push(Cn)}else{for(let ar=0;ar1)for(const ar of ut){const gr=ar*Be;if(!(Se[gr+2]<=$)){Se[gr+2]=$;for(let Yr=0;Yr>5}_getOriginZoom(Z){return(Z-this.points.length)%32}_map(Z,$,te){if(Z[$+Vt]>1){const Ie=this.clusterProps[Z[$+sr]];return te?Object.assign({},Ie):Ie}const le=this.points[Z[$+At]].properties,Ce=this.options.map(le);return te&&Ce===le?Object.assign({},Ce):Ce}}function er(pe,Z,$){return{type:"Feature",id:pe[Z+At],properties:Nt(pe,Z,$),geometry:{type:"Point",coordinates:[(te=pe[Z],360*(te-.5)),Lr(pe[Z+1])]}};var te}function Nt(pe,Z,$){const te=pe[Z+Vt],le=te>=1e4?`${Math.round(te/1e3)}k`:te>=1e3?Math.round(te/100)/10+"k":te,Ce=pe[Z+sr],Ie=Ce===-1?{}:Object.assign({},$[Ce]);return Object.assign(Ie,{cluster:!0,cluster_id:pe[Z+At],point_count:te,point_count_abbreviated:le})}function nr(pe){return pe/360+.5}function tr(pe){const Z=Math.sin(pe*Math.PI/180),$=.5-.25*Math.log((1+Z)/(1-Z))/Math.PI;return $<0?0:$>1?1:$}function Lr(pe){const Z=(180-360*pe)*Math.PI/180;return 360*Math.atan(Math.exp(Z))/Math.PI-90}function Pr(pe,Z,$,te){for(var le,Ce=te,Ie=$-Z>>1,Pe=$-Z,Se=pe[Z],W=pe[Z+1],Be=pe[$],Fe=pe[$+1],qe=Z+3;qe<$;qe+=3){var Xe=st(pe[qe],pe[qe+1],Se,W,Be,Fe);if(Xe>Ce)le=qe,Ce=Xe;else if(Xe===Ce){var ut=Math.abs(qe-Ie);utte&&(le-Z>3&&Pr(pe,Z,le,te),pe[le+2]=Ce,$-le>3&&Pr(pe,le,$,te))}function st(pe,Z,$,te,le,Ce){var Ie=le-$,Pe=Ce-te;if(Ie!==0||Pe!==0){var Se=((pe-$)*Ie+(Z-te)*Pe)/(Ie*Ie+Pe*Pe);Se>1?($=le,te=Ce):Se>0&&($+=Ie*Se,te+=Pe*Se)}return(Ie=pe-$)*Ie+(Pe=Z-te)*Pe}function Lt(pe,Z,$,te){var le={id:pe===void 0?null:pe,type:Z,geometry:$,tags:te,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Ce){var Ie=Ce.geometry,Pe=Ce.type;if(Pe==="Point"||Pe==="MultiPoint"||Pe==="LineString")De(Ce,Ie);else if(Pe==="Polygon"||Pe==="MultiLineString")for(var Se=0;Se0&&(Ie+=te?(le*W-Se*Ce)/2:Math.sqrt(Math.pow(Se-le,2)+Math.pow(W-Ce,2))),le=Se,Ce=W}var Be=Z.length-3;Z[2]=1,Pr(Z,0,Be,$),Z[Be+2]=1,Z.size=Math.abs(Ie),Z.start=0,Z.end=Z.size}function ne(pe,Z,$,te){for(var le=0;le1?1:$}function Ye(pe,Z,$,te,le,Ce,Ie,Pe){if(te/=Z,Ce>=($/=Z)&&Ie=te)return null;for(var Se=[],W=0;W=$&&ut=te)){var Pt=[];if(qe==="Point"||qe==="MultiPoint")jt(Fe,Pt,$,te,le);else if(qe==="LineString")bn(Fe,Pt,$,te,le,!1,Pe.lineMetrics);else if(qe==="MultiLineString")Mn(Fe,Pt,$,te,le,!1);else if(qe==="Polygon")Mn(Fe,Pt,$,te,le,!0);else if(qe==="MultiPolygon")for(var $t=0;$t=$&&Ie<=te&&(Z.push(pe[Ce]),Z.push(pe[Ce+1]),Z.push(pe[Ce+2]))}}function bn(pe,Z,$,te,le,Ce,Ie){for(var Pe,Se,W=wn(pe),Be=le===0?ii:$o,Fe=pe.start,qe=0;qe$&&(Se=Be(W,Xe,ut,$t,ar,$),Ie&&(W.start=Fe+Pe*Se)):gr>te?Yr=$&&(Se=Be(W,Xe,ut,$t,ar,$),Cn=!0),Yr>te&&gr<=te&&(Se=Be(W,Xe,ut,$t,ar,te),Cn=!0),!Ce&&Cn&&(Ie&&(W.end=Fe+Pe*Se),Z.push(W),W=wn(pe)),Ie&&(Fe+=Pe)}var lr=pe.length-3;Xe=pe[lr],ut=pe[lr+1],Pt=pe[lr+2],(gr=le===0?Xe:ut)>=$&&gr<=te&&ni(W,Xe,ut,Pt),lr=W.length-3,Ce&&lr>=3&&(W[lr]!==W[0]||W[lr+1]!==W[1])&&ni(W,W[0],W[1],W[2]),W.length&&Z.push(W)}function wn(pe){var Z=[];return Z.size=pe.size,Z.start=pe.start,Z.end=pe.end,Z}function Mn(pe,Z,$,te,le,Ce){for(var Ie=0;IeIe.maxX&&(Ie.maxX=Be),Fe>Ie.maxY&&(Ie.maxY=Fe)}return Ie}function Or(pe,Z,$,te){var le=Z.geometry,Ce=Z.type,Ie=[];if(Ce==="Point"||Ce==="MultiPoint")for(var Pe=0;Pe0&&Z.size<(le?Ie:te))$.numPoints+=Z.length/3;else{for(var Pe=[],Se=0;SeIe)&&($.numSimplified++,Pe.push(Z[Se]),Pe.push(Z[Se+1])),$.numPoints++;le&&function(W,Be){for(var Fe=0,qe=0,Xe=W.length,ut=Xe-2;qe0===Be)for(qe=0,Xe=W.length;qe24)throw new Error("maxZoom should be in the 0-24 range");if(Z.promoteId&&Z.generateId)throw new Error("promoteId and generateId cannot be used together.");var te=function(le,Ce){var Ie=[];if(le.type==="FeatureCollection")for(var Pe=0;Pe1&&console.time("creation"),qe=this.tiles[Fe]=Bo(pe,Z,$,te,Se),this.tileCoords.push({z:Z,x:$,y:te}),W)){W>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Z,$,te,qe.numFeatures,qe.numPoints,qe.numSimplified),console.timeEnd("creation"));var Xe="z"+Z;this.stats[Xe]=(this.stats[Xe]||0)+1,this.total++}if(qe.source=pe,le){if(Z===Se.maxZoom||Z===le)continue;var ut=1<1&&console.time("clipping");var Pt,$t,ar,gr,Yr,Cn,lr=.5*Se.buffer/Se.extent,ln=.5-lr,Bn=.5+lr,fi=1+lr;Pt=$t=ar=gr=null,Yr=Ye(pe,Be,$-lr,$+Bn,0,qe.minX,qe.maxX,Se),Cn=Ye(pe,Be,$+ln,$+fi,0,qe.minX,qe.maxX,Se),pe=null,Yr&&(Pt=Ye(Yr,Be,te-lr,te+Bn,1,qe.minY,qe.maxY,Se),$t=Ye(Yr,Be,te+ln,te+fi,1,qe.minY,qe.maxY,Se),Yr=null),Cn&&(ar=Ye(Cn,Be,te-lr,te+Bn,1,qe.minY,qe.maxY,Se),gr=Ye(Cn,Be,te+ln,te+fi,1,qe.minY,qe.maxY,Se),Cn=null),W>1&&console.timeEnd("clipping"),Pe.push(Pt||[],Z+1,2*$,2*te),Pe.push($t||[],Z+1,2*$,2*te+1),Pe.push(ar||[],Z+1,2*$+1,2*te),Pe.push(gr||[],Z+1,2*$+1,2*te+1)}}},rr.prototype.getTile=function(pe,Z,$){var te=this.options,le=te.extent,Ce=te.debug;if(pe<0||pe>24)return null;var Ie=1<1&&console.log("drilling down to z%d-%d-%d",pe,Z,$);for(var Se,W=pe,Be=Z,Fe=$;!Se&&W>0;)W--,Be=Math.floor(Be/2),Fe=Math.floor(Fe/2),Se=this.tiles[Jt(W,Be,Fe)];return Se&&Se.source?(Ce>1&&console.log("found parent tile z%d-%d-%d",W,Be,Fe),Ce>1&&console.time("drilling down"),this.splitTile(Se.source,W,Be,Fe,pe,Z,$),Ce>1&&console.timeEnd("drilling down"),this.tiles[Pe]?Xn(this.tiles[Pe],le):null):null};class ro extends k{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(Z,$){return d._(this,void 0,void 0,function*(){const te=Z.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const le=this._geoJSONIndex.getTile(te.z,te.x,te.y);if(!le)return null;const Ce=new class{constructor(Pe){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=d.W,this.length=Pe.length,this._features=Pe}feature(Pe){return new class{constructor(Se){this._feature=Se,this.extent=d.W,this.type=Se.type,this.properties=Se.tags,"id"in Se&&!isNaN(Se.id)&&(this.id=parseInt(Se.id,10))}loadGeometry(){if(this._feature.type===1){const Se=[];for(const W of this._feature.geometry)Se.push([new d.P(W[0],W[1])]);return Se}{const Se=[];for(const W of this._feature.geometry){const Be=[];for(const Fe of W)Be.push(new d.P(Fe[0],Fe[1]));Se.push(Be)}return Se}}toGeoJSON(Se,W,Be){return z.call(this,Se,W,Be)}}(this._features[Pe])}}(le.features);let Ie=Ot(Ce);return Ie.byteOffset===0&&Ie.byteLength===Ie.buffer.byteLength||(Ie=new Uint8Array(Ie)),{vectorTile:Ce,rawData:Ie.buffer}})}loadData(Z){return d._(this,void 0,void 0,function*(){var $;($=this._pendingRequest)===null||$===void 0||$.abort();const te=!!(Z&&Z.request&&Z.request.collectResourceTiming)&&new d.bs(Z.request);this._pendingRequest=new AbortController;try{let le=yield this.loadGeoJSON(Z,this._pendingRequest);if(delete this._pendingRequest,typeof le!="object")throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`);if(N(le,!0),Z.filter){const Ie=d.by(Z.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Ie.result==="error")throw new Error(Ie.value.map(Se=>`${Se.key}: ${Se.message}`).join(", "));le={type:"FeatureCollection",features:le.features.filter(Se=>Ie.value.evaluate({zoom:0},Se))}}this._geoJSONIndex=Z.cluster?new fr(function({superclusterOptions:Ie,clusterProperties:Pe}){if(!Pe||!Ie)return Ie;const Se={},W={},Be={accumulated:null,zoom:0},Fe={properties:null},qe=Object.keys(Pe);for(const Xe of qe){const[ut,Pt]=Pe[Xe],$t=d.by(Pt),ar=d.by(typeof ut=="string"?[ut,["accumulated"],["get",Xe]]:ut);Se[Xe]=$t.value,W[Xe]=ar.value}return Ie.map=Xe=>{Fe.properties=Xe;const ut={};for(const Pt of qe)ut[Pt]=Se[Pt].evaluate(Be,Fe);return ut},Ie.reduce=(Xe,ut)=>{Fe.properties=ut;for(const Pt of qe)Be.accumulated=Xe[Pt],Xe[Pt]=W[Pt].evaluate(Be,Fe)},Ie}(Z)).load(le.features):function(Ie,Pe){return new rr(Ie,Pe)}(le,Z.geojsonVtOptions),this.loaded={};const Ce={};if(te){const Ie=te.finish();Ie&&(Ce.resourceTiming={},Ce.resourceTiming[Z.source]=JSON.parse(JSON.stringify(Ie)))}return Ce}catch(le){if(delete this._pendingRequest,d.bz(le))return{abandoned:!0};throw le}})}reloadTile(Z){const $=this.loaded;return $&&$[Z.uid]?super.reloadTile(Z):this.loadTile(Z)}loadGeoJSON(Z,$){return d._(this,void 0,void 0,function*(){const{promoteId:te}=Z;if(Z.request){const le=yield d.h(Z.request,$);return this._dataUpdateable=vi(le.data,te)?Qt(le.data,te):void 0,le.data}if(typeof Z.data=="string")try{const le=JSON.parse(Z.data);return this._dataUpdateable=vi(le,te)?Qt(le,te):void 0,le}catch{throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`)}if(!Z.dataDiff)throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${Z.source}`);return function(le,Ce,Ie){var Pe,Se,W,Be;if(Ce.removeAll&&le.clear(),Ce.remove)for(const Fe of Ce.remove)le.delete(Fe);if(Ce.add)for(const Fe of Ce.add){const qe=Nr(Fe,Ie);qe!=null&&le.set(qe,Fe)}if(Ce.update)for(const Fe of Ce.update){let qe=le.get(Fe.id);if(qe==null)continue;const Xe=!Fe.removeAllProperties&&(((Pe=Fe.removeProperties)===null||Pe===void 0?void 0:Pe.length)>0||((Se=Fe.addOrUpdateProperties)===null||Se===void 0?void 0:Se.length)>0);if((Fe.newGeometry||Fe.removeAllProperties||Xe)&&(qe=Object.assign({},qe),le.set(Fe.id,qe),Xe&&(qe.properties=Object.assign({},qe.properties))),Fe.newGeometry&&(qe.geometry=Fe.newGeometry),Fe.removeAllProperties)qe.properties={};else if(((W=Fe.removeProperties)===null||W===void 0?void 0:W.length)>0)for(const ut of Fe.removeProperties)Object.prototype.hasOwnProperty.call(qe.properties,ut)&&delete qe.properties[ut];if(((Be=Fe.addOrUpdateProperties)===null||Be===void 0?void 0:Be.length)>0)for(const{key:ut,value:Pt}of Fe.addOrUpdateProperties)qe.properties[ut]=Pt}}(this._dataUpdateable,Z.dataDiff,te),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(Z){return d._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(Z){return this._geoJSONIndex.getClusterExpansionZoom(Z.clusterId)}getClusterChildren(Z){return this._geoJSONIndex.getChildren(Z.clusterId)}getClusterLeaves(Z){return this._geoJSONIndex.getLeaves(Z.clusterId,Z.limit,Z.offset)}}class an{constructor(Z){this.self=Z,this.actor=new d.C(Z),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=($,te)=>{if(this.externalWorkerSourceTypes[$])throw new Error(`Worker source with name "${$}" already registered.`);this.externalWorkerSourceTypes[$]=te},this.self.addProtocol=d.bf,this.self.removeProtocol=d.bg,this.self.registerRTLTextPlugin=$=>{if(d.bA.isParsed())throw new Error("RTL text plugin already registered.");d.bA.setMethods($)},this.actor.registerMessageHandler("LDT",($,te)=>this._getDEMWorkerSource($,te.source).loadTile(te)),this.actor.registerMessageHandler("RDT",($,te)=>d._(this,void 0,void 0,function*(){this._getDEMWorkerSource($,te.source).removeTile(te)})),this.actor.registerMessageHandler("GCEZ",($,te)=>d._(this,void 0,void 0,function*(){return this._getWorkerSource($,te.type,te.source).getClusterExpansionZoom(te)})),this.actor.registerMessageHandler("GCC",($,te)=>d._(this,void 0,void 0,function*(){return this._getWorkerSource($,te.type,te.source).getClusterChildren(te)})),this.actor.registerMessageHandler("GCL",($,te)=>d._(this,void 0,void 0,function*(){return this._getWorkerSource($,te.type,te.source).getClusterLeaves(te)})),this.actor.registerMessageHandler("LD",($,te)=>this._getWorkerSource($,te.type,te.source).loadData(te)),this.actor.registerMessageHandler("LT",($,te)=>this._getWorkerSource($,te.type,te.source).loadTile(te)),this.actor.registerMessageHandler("RT",($,te)=>this._getWorkerSource($,te.type,te.source).reloadTile(te)),this.actor.registerMessageHandler("AT",($,te)=>this._getWorkerSource($,te.type,te.source).abortTile(te)),this.actor.registerMessageHandler("RMT",($,te)=>this._getWorkerSource($,te.type,te.source).removeTile(te)),this.actor.registerMessageHandler("RS",($,te)=>d._(this,void 0,void 0,function*(){if(!this.workerSources[$]||!this.workerSources[$][te.type]||!this.workerSources[$][te.type][te.source])return;const le=this.workerSources[$][te.type][te.source];delete this.workerSources[$][te.type][te.source],le.removeSource!==void 0&&le.removeSource(te)})),this.actor.registerMessageHandler("RM",$=>d._(this,void 0,void 0,function*(){delete this.layerIndexes[$],delete this.availableImages[$],delete this.workerSources[$],delete this.demWorkerSources[$]})),this.actor.registerMessageHandler("SR",($,te)=>d._(this,void 0,void 0,function*(){this.referrer=te})),this.actor.registerMessageHandler("SRPS",($,te)=>this._syncRTLPluginState($,te)),this.actor.registerMessageHandler("IS",($,te)=>d._(this,void 0,void 0,function*(){this.self.importScripts(te)})),this.actor.registerMessageHandler("SI",($,te)=>this._setImages($,te)),this.actor.registerMessageHandler("UL",($,te)=>d._(this,void 0,void 0,function*(){this._getLayerIndex($).update(te.layers,te.removedIds)})),this.actor.registerMessageHandler("SL",($,te)=>d._(this,void 0,void 0,function*(){this._getLayerIndex($).replace(te)}))}_setImages(Z,$){return d._(this,void 0,void 0,function*(){this.availableImages[Z]=$;for(const te in this.workerSources[Z]){const le=this.workerSources[Z][te];for(const Ce in le)le[Ce].availableImages=$}})}_syncRTLPluginState(Z,$){return d._(this,void 0,void 0,function*(){if(d.bA.isParsed())return d.bA.getState();if($.pluginStatus!=="loading")return d.bA.setState($),$;const te=$.pluginURL;if(this.self.importScripts(te),d.bA.isParsed()){const le={pluginStatus:"loaded",pluginURL:te};return d.bA.setState(le),le}throw d.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${te}`)})}_getAvailableImages(Z){let $=this.availableImages[Z];return $||($=[]),$}_getLayerIndex(Z){let $=this.layerIndexes[Z];return $||($=this.layerIndexes[Z]=new a),$}_getWorkerSource(Z,$,te){if(this.workerSources[Z]||(this.workerSources[Z]={}),this.workerSources[Z][$]||(this.workerSources[Z][$]={}),!this.workerSources[Z][$][te]){const le={sendAsync:(Ce,Ie)=>(Ce.targetMapId=Z,this.actor.sendAsync(Ce,Ie))};switch($){case"vector":this.workerSources[Z][$][te]=new k(le,this._getLayerIndex(Z),this._getAvailableImages(Z));break;case"geojson":this.workerSources[Z][$][te]=new ro(le,this._getLayerIndex(Z),this._getAvailableImages(Z));break;default:this.workerSources[Z][$][te]=new this.externalWorkerSourceTypes[$](le,this._getLayerIndex(Z),this._getAvailableImages(Z))}}return this.workerSources[Z][$][te]}_getDEMWorkerSource(Z,$){return this.demWorkerSources[Z]||(this.demWorkerSources[Z]={}),this.demWorkerSources[Z][$]||(this.demWorkerSources[Z][$]=new C),this.demWorkerSources[Z][$]}}return d.i(self)&&(self.worker=new an(self)),an}),l("index",["exports","./shared"],function(d,a){var _="4.1.3";let x,S;const k={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:y=>new Promise((o,h)=>{const p=requestAnimationFrame(o);y.signal.addEventListener("abort",()=>{cancelAnimationFrame(p),h(a.c())})}),getImageData(y,o=0){return this.getImageCanvasContext(y).getImageData(-o,-o,y.width+2*o,y.height+2*o)},getImageCanvasContext(y){const o=window.document.createElement("canvas"),h=o.getContext("2d",{willReadFrequently:!0});if(!h)throw new Error("failed to create canvas 2d context");return o.width=y.width,o.height=y.height,h.drawImage(y,0,0,y.width,y.height),h},resolveURL:y=>(x||(x=document.createElement("a")),x.href=y,x.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(S==null&&(S=matchMedia("(prefers-reduced-motion: reduce)")),S.matches)}};class C{static testProp(o){if(!C.docStyle)return o[0];for(let h=0;h{window.removeEventListener("click",C.suppressClickInternal,!0)},0)}static getScale(o){const h=o.getBoundingClientRect();return{x:h.width/o.offsetWidth||1,y:h.height/o.offsetHeight||1,boundingClientRect:h}}static getPoint(o,h,p){const m=h.boundingClientRect;return new a.P((p.clientX-m.left)/h.x-o.clientLeft,(p.clientY-m.top)/h.y-o.clientTop)}static mousePos(o,h){const p=C.getScale(o);return C.getPoint(o,p,h)}static touchPos(o,h){const p=[],m=C.getScale(o);for(let v=0;v{o=[],h=0,p=0,m={}},y.addThrottleControl=A=>{const R=p++;return m[R]=A,R},y.removeThrottleControl=A=>{delete m[A],E()},y.getImage=(A,R,V=!0)=>new Promise((q,Q)=>{P.supported&&(A.headers||(A.headers={}),A.headers.accept="image/webp,*/*"),a.e(A,{type:"image"}),o.push({abortController:R,requestParameters:A,supportImageRefresh:V,state:"queued",onError:he=>{Q(he)},onSuccess:he=>{q(he)}}),E()});const v=A=>a._(this,void 0,void 0,function*(){A.state="running";const{requestParameters:R,supportImageRefresh:V,onError:q,onSuccess:Q,abortController:he}=A,ue=V===!1&&!a.i(self)&&!a.g(R.url)&&(!R.headers||Object.keys(R.headers).reduce((Te,Ue)=>Te&&Ue==="accept",!0));h++;const ye=ue?M(R,he):a.m(R,he);try{const Te=yield ye;delete A.abortController,A.state="completed",Te.data instanceof HTMLImageElement||a.b(Te.data)?Q(Te):Te.data&&Q({data:yield(se=Te.data,typeof createImageBitmap=="function"?a.d(se):a.f(se)),cacheControl:Te.cacheControl,expires:Te.expires})}catch(Te){delete A.abortController,q(Te)}finally{h--,E()}var se}),E=()=>{const A=(()=>{for(const R of Object.keys(m))if(m[R]())return!0;return!1})()?a.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:a.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let R=h;R0;R++){const V=o.shift();V.abortController.signal.aborted?R--:v(V)}},M=(A,R)=>new Promise((V,q)=>{const Q=new Image,he=A.url,ue=A.credentials;ue&&ue==="include"?Q.crossOrigin="use-credentials":(ue&&ue==="same-origin"||!a.s(he))&&(Q.crossOrigin="anonymous"),R.signal.addEventListener("abort",()=>{Q.src="",q(a.c())}),Q.fetchPriority="high",Q.onload=()=>{Q.onerror=Q.onload=null,V({data:Q})},Q.onerror=()=>{Q.onerror=Q.onload=null,R.signal.aborted||q(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."))},Q.src=he})}(G||(G={})),G.resetRequestQueue();class U{constructor(o){this._transformRequestFn=o}transformRequest(o,h){return this._transformRequestFn&&this._transformRequestFn(o,h)||{url:o}}normalizeSpriteURL(o,h,p){const m=function(v){const E=v.match(K);if(!E)throw new Error(`Unable to parse URL "${v}"`);return{protocol:E[1],authority:E[2],path:E[3]||"/",params:E[4]?E[4].split("&"):[]}}(o);return m.path+=`${h}${p}`,function(v){const E=v.params.length?`?${v.params.join("&")}`:"";return`${v.protocol}://${v.authority}${v.path}${E}`}(m)}setTransformRequest(o){this._transformRequestFn=o}}const K=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function me(y){var o=new a.A(3);return o[0]=y[0],o[1]=y[1],o[2]=y[2],o}var X,Y=function(y,o,h){return y[0]=o[0]-h[0],y[1]=o[1]-h[1],y[2]=o[2]-h[2],y};X=new a.A(3),a.A!=Float32Array&&(X[0]=0,X[1]=0,X[2]=0);var _e=function(y){var o=y[0],h=y[1];return o*o+h*h};function ze(y){const o=[];if(typeof y=="string")o.push({id:"default",url:y});else if(y&&y.length>0){const h=[];for(const{id:p,url:m}of y){const v=`${p}${m}`;h.indexOf(v)===-1&&(h.push(v),o.push({id:p,url:m}))}}return o}(function(){var y=new a.A(2);a.A!=Float32Array&&(y[0]=0,y[1]=0)})();class re{constructor(o,h,p,m){this.context=o,this.format=p,this.texture=o.gl.createTexture(),this.update(h,m)}update(o,h,p){const{width:m,height:v}=o,E=!(this.size&&this.size[0]===m&&this.size[1]===v||p),{context:M}=this,{gl:A}=M;if(this.useMipmap=!!(h&&h.useMipmap),A.bindTexture(A.TEXTURE_2D,this.texture),M.pixelStoreUnpackFlipY.set(!1),M.pixelStoreUnpack.set(1),M.pixelStoreUnpackPremultiplyAlpha.set(this.format===A.RGBA&&(!h||h.premultiply!==!1)),E)this.size=[m,v],o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement||o instanceof ImageData||a.b(o)?A.texImage2D(A.TEXTURE_2D,0,this.format,this.format,A.UNSIGNED_BYTE,o):A.texImage2D(A.TEXTURE_2D,0,this.format,m,v,0,this.format,A.UNSIGNED_BYTE,o.data);else{const{x:R,y:V}=p||{x:0,y:0};o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement||o instanceof ImageData||a.b(o)?A.texSubImage2D(A.TEXTURE_2D,0,R,V,A.RGBA,A.UNSIGNED_BYTE,o):A.texSubImage2D(A.TEXTURE_2D,0,R,V,m,v,A.RGBA,A.UNSIGNED_BYTE,o.data)}this.useMipmap&&this.isSizePowerOfTwo()&&A.generateMipmap(A.TEXTURE_2D)}bind(o,h,p){const{context:m}=this,{gl:v}=m;v.bindTexture(v.TEXTURE_2D,this.texture),p!==v.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(p=v.LINEAR),o!==this.filter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,o),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,p||o),this.filter=o),h!==this.wrap&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,h),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,h),this.wrap=h)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:o}=this.context;o.deleteTexture(this.texture),this.texture=null}}function ce(y){const{userImage:o}=y;return!!(o&&o.render&&o.render())&&(y.data.replace(new Uint8Array(o.data.buffer)),!0)}class Ze extends a.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(o){if(this.loaded!==o&&(this.loaded=o,o)){for(const{ids:h,promiseResolve:p}of this.requestors)p(this._getImagesForIds(h));this.requestors=[]}}getImage(o){const h=this.images[o];if(h&&!h.data&&h.spriteData){const p=h.spriteData;h.data=new a.R({width:p.width,height:p.height},p.context.getImageData(p.x,p.y,p.width,p.height).data),h.spriteData=null}return h}addImage(o,h){if(this.images[o])throw new Error(`Image id ${o} already exist, use updateImage instead`);this._validate(o,h)&&(this.images[o]=h)}_validate(o,h){let p=!0;const m=h.data||h.spriteData;return this._validateStretch(h.stretchX,m&&m.width)||(this.fire(new a.j(new Error(`Image "${o}" has invalid "stretchX" value`))),p=!1),this._validateStretch(h.stretchY,m&&m.height)||(this.fire(new a.j(new Error(`Image "${o}" has invalid "stretchY" value`))),p=!1),this._validateContent(h.content,h)||(this.fire(new a.j(new Error(`Image "${o}" has invalid "content" value`))),p=!1),p}_validateStretch(o,h){if(!o)return!0;let p=0;for(const m of o){if(m[0]{let m=!0;if(!this.isLoaded())for(const v of o)this.images[v]||(m=!1);this.isLoaded()||m?h(this._getImagesForIds(o)):this.requestors.push({ids:o,promiseResolve:h})})}_getImagesForIds(o){const h={};for(const p of o){let m=this.getImage(p);m||(this.fire(new a.k("styleimagemissing",{id:p})),m=this.getImage(p)),m?h[p]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,hasRenderCallback:!!(m.userImage&&m.userImage.render)}:a.w(`Image "${p}" 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 h}getPixelSize(){const{width:o,height:h}=this.atlasImage;return{width:o,height:h}}getPattern(o){const h=this.patterns[o],p=this.getImage(o);if(!p)return null;if(h&&h.position.version===p.version)return h.position;if(h)h.position.version=p.version;else{const m={w:p.data.width+2,h:p.data.height+2,x:0,y:0},v=new a.I(m,p);this.patterns[o]={bin:m,position:v}}return this._updatePatternAtlas(),this.patterns[o].position}bind(o){const h=o.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new re(o,this.atlasImage,h.RGBA),this.atlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE)}_updatePatternAtlas(){const o=[];for(const v in this.patterns)o.push(this.patterns[v].bin);const{w:h,h:p}=a.p(o),m=this.atlasImage;m.resize({width:h||1,height:p||1});for(const v in this.patterns){const{bin:E}=this.patterns[v],M=E.x+1,A=E.y+1,R=this.getImage(v).data,V=R.width,q=R.height;a.R.copy(R,m,{x:0,y:0},{x:M,y:A},{width:V,height:q}),a.R.copy(R,m,{x:0,y:q-1},{x:M,y:A-1},{width:V,height:1}),a.R.copy(R,m,{x:0,y:0},{x:M,y:A+q},{width:V,height:1}),a.R.copy(R,m,{x:V-1,y:0},{x:M-1,y:A},{width:1,height:q}),a.R.copy(R,m,{x:0,y:0},{x:M+V,y:A},{width:1,height:q})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(o){for(const h of o){if(this.callbackDispatchedThisFrame[h])continue;this.callbackDispatchedThisFrame[h]=!0;const p=this.getImage(h);p||a.w(`Image with ID: "${h}" was not found`),ce(p)&&this.updateImage(h,p)}}}const Me=1e20;function ft(y,o,h,p,m,v,E,M,A){for(let R=o;R-1);A++,v[A]=M,E[A]=R,E[A+1]=Me}for(let M=0,A=0;M65535)throw new Error("glyphs > 65535 not supported");if(p.ranges[v])return{stack:o,id:h,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!p.requests[v]){const M=Ot.loadGlyphRange(o,v,this.url,this.requestManager);p.requests[v]=M}const E=yield p.requests[v];for(const M in E)this._doesCharSupportLocalGlyph(+M)||(p.glyphs[+M]=E[+M]);return p.ranges[v]=!0,{stack:o,id:h,glyph:E[h]||null}})}_doesCharSupportLocalGlyph(o){return!!this.localIdeographFontFamily&&(a.u["CJK Unified Ideographs"](o)||a.u["Hangul Syllables"](o)||a.u.Hiragana(o)||a.u.Katakana(o))}_tinySDF(o,h,p){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(p))return;let v=o.tinySDF;if(!v){let M="400";/bold/i.test(h)?M="900":/medium/i.test(h)?M="500":/light/i.test(h)&&(M="200"),v=o.tinySDF=new Ot.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:M})}const E=v.draw(String.fromCharCode(p));return{id:p,bitmap:new a.o({width:E.width||60,height:E.height||60},E.data),metrics:{width:E.glyphWidth/2||24,height:E.glyphHeight/2||24,left:E.glyphLeft/2+.5||0,top:E.glyphTop/2-27.5||-8,advance:E.glyphAdvance/2||24,isDoubleResolution:!0}}}}Ot.loadGlyphRange=function(y,o,h,p){return a._(this,void 0,void 0,function*(){const m=256*o,v=m+255,E=p.transformRequest(h.replace("{fontstack}",y).replace("{range}",`${m}-${v}`),"Glyphs"),M=yield a.l(E,new AbortController);if(!M||!M.data)throw new Error(`Could not load glyph range. range: ${o}, ${m}-${v}`);const A={};for(const R of a.n(M.data))A[R.id]=R;return A})},Ot.TinySDF=class{constructor({fontSize:y=24,buffer:o=3,radius:h=8,cutoff:p=.25,fontFamily:m="sans-serif",fontWeight:v="normal",fontStyle:E="normal"}={}){this.buffer=o,this.cutoff=p,this.radius=h;const M=this.size=y+4*o,A=this._createCanvas(M),R=this.ctx=A.getContext("2d",{willReadFrequently:!0});R.font=`${E} ${v} ${y}px ${m}`,R.textBaseline="alphabetic",R.textAlign="left",R.fillStyle="black",this.gridOuter=new Float64Array(M*M),this.gridInner=new Float64Array(M*M),this.f=new Float64Array(M),this.z=new Float64Array(M+1),this.v=new Uint16Array(M)}_createCanvas(y){const o=document.createElement("canvas");return o.width=o.height=y,o}draw(y){const{width:o,actualBoundingBoxAscent:h,actualBoundingBoxDescent:p,actualBoundingBoxLeft:m,actualBoundingBoxRight:v}=this.ctx.measureText(y),E=Math.ceil(h),M=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(v-m))),A=Math.min(this.size-this.buffer,E+Math.ceil(p)),R=M+2*this.buffer,V=A+2*this.buffer,q=Math.max(R*V,0),Q=new Uint8ClampedArray(q),he={data:Q,width:R,height:V,glyphWidth:M,glyphHeight:A,glyphTop:E,glyphLeft:0,glyphAdvance:o};if(M===0||A===0)return he;const{ctx:ue,buffer:ye,gridInner:se,gridOuter:Te}=this;ue.clearRect(ye,ye,M,A),ue.fillText(y,ye,ye+E);const Ue=ue.getImageData(ye,ye,M,A);Te.fill(Me,0,q),se.fill(0,0,q);for(let we=0;we0?$e*$e:0,se[He]=$e<0?$e*$e:0}}ft(Te,0,0,R,V,R,this.f,this.v,this.z),ft(se,ye,ye,M,A,R,this.f,this.v,this.z);for(let we=0;we1&&(A=o[++M]);const V=Math.abs(R-A.left),q=Math.abs(R-A.right),Q=Math.min(V,q);let he;const ue=v/p*(m+1);if(A.isDash){const ye=m-Math.abs(ue);he=Math.sqrt(Q*Q+ye*ye)}else he=m-Math.sqrt(Q*Q+ue*ue);this.data[E+R]=Math.max(0,Math.min(255,he+128))}}}addRegularDash(o){for(let M=o.length-1;M>=0;--M){const A=o[M],R=o[M+1];A.zeroLength?o.splice(M,1):R&&R.isDash===A.isDash&&(R.left=A.left,o.splice(M,1))}const h=o[0],p=o[o.length-1];h.isDash===p.isDash&&(h.left=p.left-this.width,p.right=h.right+this.width);const m=this.width*this.nextRow;let v=0,E=o[v];for(let M=0;M1&&(E=o[++v]);const A=Math.abs(M-E.left),R=Math.abs(M-E.right),V=Math.min(A,R);this.data[m+M]=Math.max(0,Math.min(255,(E.isDash?V:-V)+128))}}addDash(o,h){const p=h?7:0,m=2*p+1;if(this.nextRow+m>this.height)return a.w("LineAtlas out of space"),null;let v=0;for(let M=0;M{h.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Vt]}numActive(){return Object.keys(this.active).length}}const fr=Math.floor(k.hardwareConcurrency/2);let er,Nt;function nr(){return er||(er=new sr),er}sr.workerCount=a.B(globalThis)?Math.max(Math.min(fr,3),1):1;class tr{constructor(o,h){this.workerPool=o,this.actors=[],this.currentActor=0,this.id=h;const p=this.workerPool.acquire(h);for(let m=0;m{h.remove()}),this.actors=[],o&&this.workerPool.release(this.id)}registerMessageHandler(o,h){for(const p of this.actors)p.registerMessageHandler(o,h)}}function Lr(){return Nt||(Nt=new tr(nr(),a.G),Nt.registerMessageHandler("GR",(y,o,h)=>a.m(o,h))),Nt}function Pr(y,o){const h=a.F();return a.H(h,h,[1,1,0]),a.J(h,h,[.5*y.width,.5*y.height,1]),a.K(h,h,y.calculatePosMatrix(o.toUnwrapped()))}function st(y,o,h,p,m,v){const E=function(q,Q,he){if(q)for(const ue of q){const ye=Q[ue];if(ye&&ye.source===he&&ye.type==="fill-extrusion")return!0}else for(const ue in Q){const ye=Q[ue];if(ye.source===he&&ye.type==="fill-extrusion")return!0}return!1}(m&&m.layers,o,y.id),M=v.maxPitchScaleFactor(),A=y.tilesIn(p,M,E);A.sort(Lt);const R=[];for(const q of A)R.push({wrappedTileID:q.tileID.wrapped().key,queryResults:q.tile.queryRenderedFeatures(o,h,y._state,q.queryGeometry,q.cameraQueryGeometry,q.scale,m,v,M,Pr(y.transform,q.tileID))});const V=function(q){const Q={},he={};for(const ue of q){const ye=ue.queryResults,se=ue.wrappedTileID,Te=he[se]=he[se]||{};for(const Ue in ye){const we=ye[Ue],Le=Te[Ue]=Te[Ue]||{},Ge=Q[Ue]=Q[Ue]||[];for(const He of we)Le[He.featureIndex]||(Le[He.featureIndex]=!0,Ge.push(He))}}return Q}(R);for(const q in V)V[q].forEach(Q=>{const he=Q.feature,ue=y.getFeatureState(he.layer["source-layer"],he.id);he.source=he.layer.source,he.layer["source-layer"]&&(he.sourceLayer=he.layer["source-layer"]),he.state=ue});return V}function Lt(y,o){const h=y.tileID,p=o.tileID;return h.overscaledZ-p.overscaledZ||h.canonical.y-p.canonical.y||h.wrap-p.wrap||h.canonical.x-p.canonical.x}function De(y,o,h){return a._(this,void 0,void 0,function*(){let p=y;if(y.url?p=(yield a.h(o.transformRequest(y.url,"Source"),h)).data:yield k.frameAsync(h),!p)return null;const m=a.L(a.e(p,y),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in p&&p.vector_layers&&(m.vectorLayerIds=p.vector_layers.map(v=>v.id)),m})}class at{constructor(o,h){o&&(h?this.setSouthWest(o).setNorthEast(h):Array.isArray(o)&&(o.length===4?this.setSouthWest([o[0],o[1]]).setNorthEast([o[2],o[3]]):this.setSouthWest(o[0]).setNorthEast(o[1])))}setNorthEast(o){return this._ne=o instanceof a.M?new a.M(o.lng,o.lat):a.M.convert(o),this}setSouthWest(o){return this._sw=o instanceof a.M?new a.M(o.lng,o.lat):a.M.convert(o),this}extend(o){const h=this._sw,p=this._ne;let m,v;if(o instanceof a.M)m=o,v=o;else{if(!(o instanceof at))return Array.isArray(o)?o.length===4||o.every(Array.isArray)?this.extend(at.convert(o)):this.extend(a.M.convert(o)):o&&("lng"in o||"lon"in o)&&"lat"in o?this.extend(a.M.convert(o)):this;if(m=o._sw,v=o._ne,!m||!v)return this}return h||p?(h.lng=Math.min(m.lng,h.lng),h.lat=Math.min(m.lat,h.lat),p.lng=Math.max(v.lng,p.lng),p.lat=Math.max(v.lat,p.lat)):(this._sw=new a.M(m.lng,m.lat),this._ne=new a.M(v.lng,v.lat)),this}getCenter(){return new a.M((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 a.M(this.getWest(),this.getNorth())}getSouthEast(){return new a.M(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(o){const{lng:h,lat:p}=a.M.convert(o);let m=this._sw.lng<=h&&h<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=h&&h>=this._ne.lng),this._sw.lat<=p&&p<=this._ne.lat&&m}static convert(o){return o instanceof at?o:o&&new at(o)}static fromLngLat(o,h=0){const p=360*h/40075017,m=p/Math.cos(Math.PI/180*o.lat);return new at(new a.M(o.lng-m,o.lat-p),new a.M(o.lng+m,o.lat+p))}}class tt{constructor(o,h,p){this.bounds=at.convert(this.validateBounds(o)),this.minzoom=h||0,this.maxzoom=p||24}validateBounds(o){return Array.isArray(o)&&o.length===4?[Math.max(-180,o[0]),Math.max(-90,o[1]),Math.min(180,o[2]),Math.min(90,o[3])]:[-180,-90,180,90]}contains(o){const h=Math.pow(2,o.z),p=Math.floor(a.N(this.bounds.getWest())*h),m=Math.floor(a.O(this.bounds.getNorth())*h),v=Math.ceil(a.N(this.bounds.getEast())*h),E=Math.ceil(a.O(this.bounds.getSouth())*h);return o.x>=p&&o.x=m&&o.y{this._options.tiles=o}),this}setUrl(o){return this.setSourceProperty(()=>{this.url=o,this._options.url=o}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return a.e({},this._options)}loadTile(o){return a._(this,void 0,void 0,function*(){const h=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p={request:this.map._requestManager.transformRequest(h,"Tile"),uid:o.uid,tileID:o.tileID,zoom:o.tileID.overscaledZ,tileSize:this.tileSize*o.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};p.request.collectResourceTiming=this._collectResourceTiming;let m="RT";if(o.actor&&o.state!=="expired"){if(o.state==="loading")return new Promise((v,E)=>{o.reloadPromise={resolve:v,reject:E}})}else o.actor=this.dispatcher.getActor(),m="LT";o.abortController=new AbortController;try{const v=yield o.actor.sendAsync({type:m,data:p},o.abortController);if(delete o.abortController,o.aborted)return;this._afterTileLoadWorkerResponse(o,v)}catch(v){if(delete o.abortController,o.aborted)return;if(v&&v.status!==404)throw v;this._afterTileLoadWorkerResponse(o,null)}})}_afterTileLoadWorkerResponse(o,h){if(h&&h.resourceTiming&&(o.resourceTiming=h.resourceTiming),h&&this.map._refreshExpiredTiles&&o.setExpiryData(h),o.loadVectorData(h,this.map.painter),o.reloadPromise){const p=o.reloadPromise;o.reloadPromise=null,this.loadTile(o).then(p.resolve).catch(p.reject)}}abortTile(o){return a._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController),o.actor&&(yield o.actor.sendAsync({type:"AT",data:{uid:o.uid,type:this.type,source:this.id}}))})}unloadTile(o){return a._(this,void 0,void 0,function*(){o.unloadVectorData(),o.actor&&(yield o.actor.sendAsync({type:"RMT",data:{uid:o.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class ne extends a.E{constructor(o,h,p,m){super(),this.id=o,this.dispatcher=p,this.setEventedParent(m),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=a.e({type:"raster"},h),a.e(this,a.L(h,["url","scheme","tileSize"]))}load(){return a._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const o=yield De(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,o&&(a.e(this,o),o.bounds&&(this.tileBounds=new tt(o.bounds,this.minzoom,this.maxzoom)),this.fire(new a.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.k("data",{dataType:"source",sourceDataType:"content"})))}catch(o){this._tileJSONRequest=null,this.fire(new a.j(o))}})}loaded(){return this._loaded}onAdd(o){this.map=o,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(o){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),o(),this.load()}setTiles(o){return this.setSourceProperty(()=>{this._options.tiles=o}),this}setUrl(o){return this.setSourceProperty(()=>{this.url=o,this._options.url=o}),this}serialize(){return a.e({},this._options)}hasTile(o){return!this.tileBounds||this.tileBounds.contains(o.canonical)}loadTile(o){return a._(this,void 0,void 0,function*(){const h=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);o.abortController=new AbortController;try{const p=yield G.getImage(this.map._requestManager.transformRequest(h,"Tile"),o.abortController,this.map._refreshExpiredTiles);if(delete o.abortController,o.aborted)return void(o.state="unloaded");if(p&&p.data){this.map._refreshExpiredTiles&&p.cacheControl&&p.expires&&o.setExpiryData({cacheControl:p.cacheControl,expires:p.expires});const m=this.map.painter.context,v=m.gl,E=p.data;o.texture=this.map.painter.getTileTexture(E.width),o.texture?o.texture.update(E,{useMipmap:!0}):(o.texture=new re(m,E,v.RGBA,{useMipmap:!0}),o.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE,v.LINEAR_MIPMAP_NEAREST),m.extTextureFilterAnisotropic&&v.texParameterf(v.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax)),o.state="loaded"}}catch(p){if(delete o.abortController,o.aborted)o.state="unloaded";else if(p)throw o.state="errored",p}})}abortTile(o){return a._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController)})}unloadTile(o){return a._(this,void 0,void 0,function*(){o.texture&&this.map.painter.saveTileTexture(o.texture)})}hasTransition(){return!1}}class br extends ne{constructor(o,h,p,m){super(o,h,p,m),this.type="raster-dem",this.maxzoom=22,this._options=a.e({type:"raster-dem"},h),this.encoding=h.encoding||"mapbox",this.redFactor=h.redFactor,this.greenFactor=h.greenFactor,this.blueFactor=h.blueFactor,this.baseShift=h.baseShift}loadTile(o){return a._(this,void 0,void 0,function*(){const h=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p=this.map._requestManager.transformRequest(h,"Tile");o.neighboringTiles=this._getNeighboringTiles(o.tileID),o.abortController=new AbortController;try{const m=yield G.getImage(p,o.abortController,this.map._refreshExpiredTiles);if(delete o.abortController,o.aborted)return void(o.state="unloaded");if(m&&m.data){const v=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&o.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const E=a.b(v)&&a.S()?v:yield this.readImageNow(v),M={type:this.type,uid:o.uid,source:this.id,rawImageData:E,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!o.actor||o.state==="expired"){o.actor=this.dispatcher.getActor();const A=yield o.actor.sendAsync({type:"LDT",data:M});o.dem=A,o.needsHillshadePrepare=!0,o.needsTerrainPrepare=!0,o.state="loaded"}}}catch(m){if(delete o.abortController,o.aborted)o.state="unloaded";else if(m)throw o.state="errored",m}})}readImageNow(o){return a._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&a.U()){const h=o.width+2,p=o.height+2;try{return new a.R({width:h,height:p},yield a.V(o,-1,-1,h,p))}catch{}}return k.getImageData(o,1)})}_getNeighboringTiles(o){const h=o.canonical,p=Math.pow(2,h.z),m=(h.x-1+p)%p,v=h.x===0?o.wrap-1:o.wrap,E=(h.x+1+p)%p,M=h.x+1===p?o.wrap+1:o.wrap,A={};return A[new a.Q(o.overscaledZ,v,h.z,m,h.y).key]={backfilled:!1},A[new a.Q(o.overscaledZ,M,h.z,E,h.y).key]={backfilled:!1},h.y>0&&(A[new a.Q(o.overscaledZ,v,h.z,m,h.y-1).key]={backfilled:!1},A[new a.Q(o.overscaledZ,o.wrap,h.z,h.x,h.y-1).key]={backfilled:!1},A[new a.Q(o.overscaledZ,M,h.z,E,h.y-1).key]={backfilled:!1}),h.y+10&&a.e(v,{resourceTiming:m}),this.fire(new a.k("data",Object.assign(Object.assign({},v),{sourceDataType:"metadata"}))),this.fire(new a.k("data",Object.assign(Object.assign({},v),{sourceDataType:"content"})))}catch(p){if(this._pendingLoads--,this._removed)return void this.fire(new a.k("dataabort",{dataType:"source"}));this.fire(new a.j(p))}})}loaded(){return this._pendingLoads===0}loadTile(o){return a._(this,void 0,void 0,function*(){const h=o.actor?"RT":"LT";o.actor=this.actor;const p={type:this.type,uid:o.uid,tileID:o.tileID,zoom:o.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};o.abortController=new AbortController;const m=yield this.actor.sendAsync({type:h,data:p},o.abortController);delete o.abortController,o.unloadVectorData(),o.aborted||o.loadVectorData(m,this.map.painter,h==="RT")})}abortTile(o){return a._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController),o.aborted=!0})}unloadTile(o){return a._(this,void 0,void 0,function*(){o.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:o.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 a.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Ye=a.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class jt extends a.E{constructor(o,h,p,m){super(),this.id=o,this.dispatcher=p,this.coordinates=h.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=h}load(o){return a._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const h=yield G.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,h&&h.data&&(this.image=h.data,o&&(this.coordinates=o),this._finishLoading())}catch(h){this._request=null,this._loaded=!0,this.fire(new a.j(h))}})}loaded(){return this._loaded}updateImage(o){return o.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=o.url,this.load(o.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(o){this.map=o,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(o){this.coordinates=o;const h=o.map(a.Y.fromLngLat);this.tileID=function(m){let v=1/0,E=1/0,M=-1/0,A=-1/0;for(const Q of m)v=Math.min(v,Q.x),E=Math.min(E,Q.y),M=Math.max(M,Q.x),A=Math.max(A,Q.y);const R=Math.max(M-v,A-E),V=Math.max(0,Math.floor(-Math.log(R)/Math.LN2)),q=Math.pow(2,V);return new a.a0(V,Math.floor((v+M)/2*q),Math.floor((E+A)/2*q))}(h),this.minzoom=this.maxzoom=this.tileID.z;const p=h.map(m=>this.tileID.getTilePoint(m)._round());return this._boundsArray=new a.Z,this._boundsArray.emplaceBack(p[0].x,p[0].y,0,0),this._boundsArray.emplaceBack(p[1].x,p[1].y,a.W,0),this._boundsArray.emplaceBack(p[3].x,p[3].y,0,a.W),this._boundsArray.emplaceBack(p[2].x,p[2].y,a.W,a.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new a.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const o=this.map.painter.context,h=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,Ye.members)),this.boundsSegments||(this.boundsSegments=a.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new re(o,this.image,h.RGBA),this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const v=this.tiles[m];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,p=!0)}p&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(o){return a._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(o.tileID.canonical)?(this.tiles[String(o.tileID.wrap)]=o,o.buckets={}):o.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class bn extends jt{constructor(o,h,p,m){super(o,h,p,m),this.roundZoom=!0,this.type="video",this.options=h}load(){return a._(this,void 0,void 0,function*(){this._loaded=!1;const o=this.options;this.urls=[];for(const h of o.urls)this.urls.push(this.map._requestManager.transformRequest(h,"Source").url);try{const h=yield a.a2(this.urls);if(this._loaded=!0,!h)return;this.video=h,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(h){this.fire(new a.j(h))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(o){if(this.video){const h=this.video.seekable;oh.end(0)?this.fire(new a.j(new a.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${h.start(0)} and ${h.end(0)}-second mark.`))):this.video.currentTime=o}}getVideo(){return this.video}onAdd(o){this.map||(this.map=o,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 o=this.map.painter.context,h=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,Ye.members)),this.boundsSegments||(this.boundsSegments=a.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE),h.texSubImage2D(h.TEXTURE_2D,0,0,0,h.RGBA,h.UNSIGNED_BYTE,this.video)):(this.texture=new re(o,this.video,h.RGBA),this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const v=this.tiles[m];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,p=!0)}p&&this.fire(new a.k("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 wn extends jt{constructor(o,h,p,m){super(o,h,p,m),h.coordinates?Array.isArray(h.coordinates)&&h.coordinates.length===4&&!h.coordinates.some(v=>!Array.isArray(v)||v.length!==2||v.some(E=>typeof E!="number"))||this.fire(new a.j(new a.a1(`sources.${o}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.j(new a.a1(`sources.${o}`,null,'missing required property "coordinates"'))),h.animate&&typeof h.animate!="boolean"&&this.fire(new a.j(new a.a1(`sources.${o}`,null,'optional "animate" property must be a boolean value'))),h.canvas?typeof h.canvas=="string"||h.canvas instanceof HTMLCanvasElement||this.fire(new a.j(new a.a1(`sources.${o}`,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 a.j(new a.a1(`sources.${o}`,null,'missing required property "canvas"'))),this.options=h,this.animate=h.animate===void 0||h.animate}load(){return a._(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 a.j(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(o){this.map=o,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let o=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,o=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,o=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const h=this.map.painter.context,p=h.gl;this.boundsBuffer||(this.boundsBuffer=h.createVertexBuffer(this._boundsArray,Ye.members)),this.boundsSegments||(this.boundsSegments=a.$.simpleSegment(0,0,4,2)),this.texture?(o||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new re(h,this.canvas,p.RGBA,{premultiply:!0});let m=!1;for(const v in this.tiles){const E=this.tiles[v];E.state!=="loaded"&&(E.state="loaded",E.texture=this.texture,m=!0)}m&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const o of[this.canvas.width,this.canvas.height])if(isNaN(o)||o<=0)return!0;return!1}}const Mn={},ni=y=>{switch(y){case"geojson":return We;case"image":return jt;case"raster":return ne;case"raster-dem":return br;case"vector":return it;case"video":return bn;case"canvas":return wn}return Mn[y]},ii="RTLPluginLoaded";class $o extends a.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Lr()}_syncState(o){return this.status=o,this.dispatcher.broadcast("SRPS",{pluginStatus:o,pluginURL:this.url}).catch(h=>{throw this.status="error",h})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(o){return a._(this,arguments,void 0,function*(h,p=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=k.resolveURL(h),!this.url)throw new Error(`requested url ${h} is invalid`);if(this.status==="unavailable"){if(!p)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return a._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new a.k(ii))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Jr=null;function ct(){return Jr||(Jr=new $o),Jr}class Xn{constructor(o,h){this.timeAdded=0,this.fadeEndTime=0,this.tileID=o,this.uid=a.a3(),this.uses=0,this.tileSize=h,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(o){const h=o+this.timeAdded;hv.getLayer(R)).filter(Boolean);if(A.length!==0){M.layers=A,M.stateDependentLayerIds&&(M.stateDependentLayers=M.stateDependentLayerIds.map(R=>A.filter(V=>V.id===R)[0]));for(const R of A)E[R.id]=M}}return E}(o.buckets,h.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const v=this.buckets[m];if(v instanceof a.a5){if(this.hasSymbolBuckets=!0,!p)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const v=this.buckets[m];if(v instanceof a.a5&&v.hasRTLText){this.hasRTLText=!0,ct().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const v=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,h.style.getLayer(m).queryRadius(v))}o.imageAtlas&&(this.imageAtlas=o.imageAtlas),o.glyphAtlasImage&&(this.glyphAtlasImage=o.glyphAtlasImage)}else this.collisionBoxArray=new a.a4}unloadVectorData(){for(const o in this.buckets)this.buckets[o].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(o){return this.buckets[o.id]}upload(o){for(const p in this.buckets){const m=this.buckets[p];m.uploadPending()&&m.upload(o)}const h=o.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new re(o,this.imageAtlas.image,h.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new re(o,this.glyphAtlasImage,h.ALPHA),this.glyphAtlasImage=null)}prepare(o){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(o,this.imageAtlasTexture)}queryRenderedFeatures(o,h,p,m,v,E,M,A,R,V){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:v,scale:E,tileSize:this.tileSize,pixelPosMatrix:V,transform:A,params:M,queryPadding:this.queryPadding*R},o,h,p):{}}querySourceFeatures(o,h){const p=this.latestFeatureIndex;if(!p||!p.rawTileData)return;const m=p.loadVTLayers(),v=h&&h.sourceLayer?h.sourceLayer:"",E=m._geojsonTileLayer||m[v];if(!E)return;const M=a.a6(h&&h.filter),{z:A,x:R,y:V}=this.tileID.canonical,q={z:A,x:R,y:V};for(let Q=0;Qp)m=!1;else if(h)if(this.expirationTime{this.remove(o,v)},p)),this.data[m].push(v),this.order.push(m),this.order.length>this.max){const E=this._getAndRemoveByKey(this.order[0]);E&&this.onRemove(E)}return this}has(o){return o.wrapped().key in this.data}getAndRemove(o){return this.has(o)?this._getAndRemoveByKey(o.wrapped().key):null}_getAndRemoveByKey(o){const h=this.data[o].shift();return h.timeout&&clearTimeout(h.timeout),this.data[o].length===0&&delete this.data[o],this.order.splice(this.order.indexOf(o),1),h.value}getByKey(o){const h=this.data[o];return h?h[0].value:null}get(o){return this.has(o)?this.data[o.wrapped().key][0].value:null}remove(o,h){if(!this.has(o))return this;const p=o.wrapped().key,m=h===void 0?0:this.data[p].indexOf(h),v=this.data[p][m];return this.data[p].splice(m,1),v.timeout&&clearTimeout(v.timeout),this.data[p].length===0&&delete this.data[p],this.onRemove(v.value),this.order.splice(this.order.indexOf(p),1),this}setMaxSize(o){for(this.max=o;this.order.length>this.max;){const h=this._getAndRemoveByKey(this.order[0]);h&&this.onRemove(h)}return this}filter(o){const h=[];for(const p in this.data)for(const m of this.data[p])o(m.value)||h.push(m);for(const p of h)this.remove(p.value.tileID,p)}}class Bo{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(o,h,p){const m=String(h);if(this.stateChanges[o]=this.stateChanges[o]||{},this.stateChanges[o][m]=this.stateChanges[o][m]||{},a.e(this.stateChanges[o][m],p),this.deletedStates[o]===null){this.deletedStates[o]={};for(const v in this.state[o])v!==m&&(this.deletedStates[o][v]=null)}else if(this.deletedStates[o]&&this.deletedStates[o][m]===null){this.deletedStates[o][m]={};for(const v in this.state[o][m])p[v]||(this.deletedStates[o][m][v]=null)}else for(const v in p)this.deletedStates[o]&&this.deletedStates[o][m]&&this.deletedStates[o][m][v]===null&&delete this.deletedStates[o][m][v]}removeFeatureState(o,h,p){if(this.deletedStates[o]===null)return;const m=String(h);if(this.deletedStates[o]=this.deletedStates[o]||{},p&&h!==void 0)this.deletedStates[o][m]!==null&&(this.deletedStates[o][m]=this.deletedStates[o][m]||{},this.deletedStates[o][m][p]=null);else if(h!==void 0)if(this.stateChanges[o]&&this.stateChanges[o][m])for(p in this.deletedStates[o][m]={},this.stateChanges[o][m])this.deletedStates[o][m][p]=null;else this.deletedStates[o][m]=null;else this.deletedStates[o]=null}getState(o,h){const p=String(h),m=a.e({},(this.state[o]||{})[p],(this.stateChanges[o]||{})[p]);if(this.deletedStates[o]===null)return{};if(this.deletedStates[o]){const v=this.deletedStates[o][h];if(v===null)return{};for(const E in v)delete m[E]}return m}initializeTileState(o,h){o.setFeatureState(this.state,h)}coalesceChanges(o,h){const p={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const v={};for(const E in this.stateChanges[m])this.state[m][E]||(this.state[m][E]={}),a.e(this.state[m][E],this.stateChanges[m][E]),v[E]=this.state[m][E];p[m]=v}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const v={};if(this.deletedStates[m]===null)for(const E in this.state[m])v[E]={},this.state[m][E]={};else for(const E in this.deletedStates[m]){if(this.deletedStates[m][E]===null)this.state[m][E]={};else for(const M of Object.keys(this.deletedStates[m][E]))delete this.state[m][E][M];v[E]=this.state[m][E]}p[m]=p[m]||{},a.e(p[m],v)}if(this.stateChanges={},this.deletedStates={},Object.keys(p).length!==0)for(const m in o)o[m].setFeatureState(p,h)}}class Or extends a.E{constructor(o,h,p){super(),this.id=o,this.dispatcher=p,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,v,E,M)=>{const A=new(ni(v.type))(m,v,E,M);if(A.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${A.id}`);return A})(o,h,p,this),this._tiles={},this._cache=new xn(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Bo,this._didEmitContent=!1,this._updated=!1}onAdd(o){this.map=o,this._maxTileCacheSize=o?o._maxTileCacheSize:null,this._maxTileCacheZoomLevels=o?o._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(o)}onRemove(o){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(o)}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 o in this._tiles){const h=this._tiles[o];if(h.state!=="loaded"&&h.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const o=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,o&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(o,h,p){return a._(this,void 0,void 0,function*(){try{yield this._source.loadTile(o),this._tileLoaded(o,h,p)}catch(m){o.state="errored",m.status!==404?this._source.fire(new a.j(m,{tile:o})):this.update(this.transform,this.terrain)}})}_unloadTile(o){this._source.unloadTile&&this._source.unloadTile(o)}_abortTile(o){this._source.abortTile&&this._source.abortTile(o),this._source.fire(new a.k("dataabort",{tile:o,coord:o.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(o){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const h in this._tiles){const p=this._tiles[h];p.upload(o),p.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(o=>o.tileID).sort(mt).map(o=>o.key)}getRenderableIds(o){const h=[];for(const p in this._tiles)this._isIdRenderable(p,o)&&h.push(this._tiles[p]);return o?h.sort((p,m)=>{const v=p.tileID,E=m.tileID,M=new a.P(v.canonical.x,v.canonical.y)._rotate(this.transform.angle),A=new a.P(E.canonical.x,E.canonical.y)._rotate(this.transform.angle);return v.overscaledZ-E.overscaledZ||A.y-M.y||A.x-M.x}).map(p=>p.tileID.key):h.map(p=>p.tileID).sort(mt).map(p=>p.key)}hasRenderableParent(o){const h=this.findLoadedParent(o,0);return!!h&&this._isIdRenderable(h.tileID.key)}_isIdRenderable(o,h){return this._tiles[o]&&this._tiles[o].hasData()&&!this._coveredTiles[o]&&(h||!this._tiles[o].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const o in this._tiles)this._tiles[o].state!=="errored"&&this._reloadTile(o,"reloading")}}_reloadTile(o,h){return a._(this,void 0,void 0,function*(){const p=this._tiles[o];p&&(p.state!=="loading"&&(p.state=h),yield this._loadTile(p,o,h))})}_tileLoaded(o,h,p){o.timeAdded=k.now(),p==="expired"&&(o.refreshedUponExpiration=!0),this._setTileReloadTimer(h,o),this.getSource().type==="raster-dem"&&o.dem&&this._backfillDEM(o),this._state.initializeTileState(o,this.map?this.map.painter:null),o.aborted||this._source.fire(new a.k("data",{dataType:"source",tile:o,coord:o.tileID}))}_backfillDEM(o){const h=this.getRenderableIds();for(let m=0;m1||(Math.abs(E)>1&&(Math.abs(E+A)===1?E+=A:Math.abs(E-A)===1&&(E-=A)),v.dem&&m.dem&&(m.dem.backfillBorder(v.dem,E,M),m.neighboringTiles&&m.neighboringTiles[R]&&(m.neighboringTiles[R].backfilled=!0)))}}getTile(o){return this.getTileByID(o.key)}getTileByID(o){return this._tiles[o]}_retainLoadedChildren(o,h,p,m){for(const v in this._tiles){let E=this._tiles[v];if(m[v]||!E.hasData()||E.tileID.overscaledZ<=h||E.tileID.overscaledZ>p)continue;let M=E.tileID;for(;E&&E.tileID.overscaledZ>h+1;){const R=E.tileID.scaledTo(E.tileID.overscaledZ-1);E=this._tiles[R.key],E&&E.hasData()&&(M=R)}let A=M;for(;A.overscaledZ>h;)if(A=A.scaledTo(A.overscaledZ-1),o[A.key]){m[M.key]=M;break}}}findLoadedParent(o,h){if(o.key in this._loadedParentTiles){const p=this._loadedParentTiles[o.key];return p&&p.tileID.overscaledZ>=h?p:null}for(let p=o.overscaledZ-1;p>=h;p--){const m=o.scaledTo(p),v=this._getLoadedTile(m);if(v)return v}}_getLoadedTile(o){const h=this._tiles[o.key];return h&&h.hasData()?h:this._cache.getByKey(o.wrapped().key)}updateCacheSize(o){const h=Math.ceil(o.width/this._source.tileSize)+1,p=Math.ceil(o.height/this._source.tileSize)+1,m=Math.floor(h*p*(this._maxTileCacheZoomLevels===null?a.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),v=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(v)}handleWrapJump(o){const h=Math.round((o-(this._prevLng===void 0?o:this._prevLng))/360);if(this._prevLng=o,h){const p={};for(const m in this._tiles){const v=this._tiles[m];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+h),p[v.tileID.key]=v}this._tiles=p;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}update(o,h){if(!this._sourceLoaded||this._paused)return;let p;this.transform=o,this.terrain=h,this.updateCacheSize(o),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?p=o.getVisibleUnwrappedCoordinates(this._source.tileID).map(V=>new a.Q(V.canonical.z,V.wrap,V.canonical.z,V.canonical.x,V.canonical.y)):(p=o.coveringTiles({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:h}),this._source.hasTile&&(p=p.filter(V=>this._source.hasTile(V)))):p=[];const m=o.coveringZoomLevel(this._source),v=Math.max(m-Or.maxOverzooming,this._source.minzoom),E=Math.max(m+Or.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const V={};for(const q of p)if(q.canonical.z>this._source.minzoom){const Q=q.scaledTo(q.canonical.z-1);V[Q.key]=Q;const he=q.scaledTo(Math.max(this._source.minzoom,Math.min(q.canonical.z,5)));V[he.key]=he}p=p.concat(Object.values(V))}const M=p.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,M&&this.fire(new a.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const A=this._updateRetainedTiles(p,m);if(rr(this._source.type)){const V={},q={},Q=Object.keys(A),he=k.now();for(const ue of Q){const ye=A[ue],se=this._tiles[ue];if(!se||se.fadeEndTime!==0&&se.fadeEndTime<=he)continue;const Te=this.findLoadedParent(ye,v);Te&&(this._addTile(Te.tileID),V[Te.tileID.key]=Te.tileID),q[ue]=ye}this._retainLoadedChildren(q,m,E,A);for(const ue in V)A[ue]||(this._coveredTiles[ue]=!0,A[ue]=V[ue]);if(h){const ue={},ye={};for(const se of p)this._tiles[se.key].hasData()?ue[se.key]=se:ye[se.key]=se;for(const se in ye){const Te=ye[se].children(this._source.maxzoom);this._tiles[Te[0].key]&&this._tiles[Te[1].key]&&this._tiles[Te[2].key]&&this._tiles[Te[3].key]&&(ue[Te[0].key]=A[Te[0].key]=Te[0],ue[Te[1].key]=A[Te[1].key]=Te[1],ue[Te[2].key]=A[Te[2].key]=Te[2],ue[Te[3].key]=A[Te[3].key]=Te[3],delete ye[se])}for(const se in ye){const Te=this.findLoadedParent(ye[se],this._source.minzoom);if(Te){ue[Te.tileID.key]=A[Te.tileID.key]=Te.tileID;for(const Ue in ue)ue[Ue].isChildOf(Te.tileID)&&delete ue[Ue]}}for(const se in this._tiles)ue[se]||(this._coveredTiles[se]=!0)}}for(const V in A)this._tiles[V].clearFadeHold();const R=a.ab(this._tiles,A);for(const V of R){const q=this._tiles[V];q.hasSymbolBuckets&&!q.holdingForFade()?q.setHoldDuration(this.map._fadeDuration):q.hasSymbolBuckets&&!q.symbolFadeFinished()||this._removeTile(V)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const o in this._tiles)this._tiles[o].holdingForFade()&&this._removeTile(o)}_updateRetainedTiles(o,h){const p={},m={},v=Math.max(h-Or.maxOverzooming,this._source.minzoom),E=Math.max(h+Or.maxUnderzooming,this._source.minzoom),M={};for(const A of o){const R=this._addTile(A);p[A.key]=A,R.hasData()||hthis._source.maxzoom){const q=A.children(this._source.maxzoom)[0],Q=this.getTile(q);if(Q&&Q.hasData()){p[q.key]=q;continue}}else{const q=A.children(this._source.maxzoom);if(p[q[0].key]&&p[q[1].key]&&p[q[2].key]&&p[q[3].key])continue}let V=R.wasRequested();for(let q=A.overscaledZ-1;q>=v;--q){const Q=A.scaledTo(q);if(m[Q.key])break;if(m[Q.key]=!0,R=this.getTile(Q),!R&&V&&(R=this._addTile(Q)),R){const he=R.hasData();if((V||he)&&(p[Q.key]=Q),V=R.wasRequested(),he)break}}}return p}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const o in this._tiles){const h=[];let p,m=this._tiles[o].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){p=this._loadedParentTiles[m.key];break}h.push(m.key);const v=m.scaledTo(m.overscaledZ-1);if(p=this._getLoadedTile(v),p)break;m=v}for(const v of h)this._loadedParentTiles[v]=p}}_addTile(o){let h=this._tiles[o.key];if(h)return h;h=this._cache.getAndRemove(o),h&&(this._setTileReloadTimer(o.key,h),h.tileID=o,this._state.initializeTileState(h,this.map?this.map.painter:null),this._cacheTimers[o.key]&&(clearTimeout(this._cacheTimers[o.key]),delete this._cacheTimers[o.key],this._setTileReloadTimer(o.key,h)));const p=h;return h||(h=new Xn(o,this._source.tileSize*o.overscaleFactor()),this._loadTile(h,o.key,h.state)),h.uses++,this._tiles[o.key]=h,p||this._source.fire(new a.k("dataloading",{tile:h,coord:h.tileID,dataType:"source"})),h}_setTileReloadTimer(o,h){o in this._timers&&(clearTimeout(this._timers[o]),delete this._timers[o]);const p=h.getExpiryTimeout();p&&(this._timers[o]=setTimeout(()=>{this._reloadTile(o,"expired"),delete this._timers[o]},p))}_removeTile(o){const h=this._tiles[o];h&&(h.uses--,delete this._tiles[o],this._timers[o]&&(clearTimeout(this._timers[o]),delete this._timers[o]),h.uses>0||(h.hasData()&&h.state!=="reloading"?this._cache.add(h.tileID,h,h.getExpiryTimeout()):(h.aborted=!0,this._abortTile(h),this._unloadTile(h))))}_dataHandler(o){const h=o.sourceDataType;o.dataType==="source"&&h==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&o.dataType==="source"&&h==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const o in this._tiles)this._removeTile(o);this._cache.reset()}tilesIn(o,h,p){const m=[],v=this.transform;if(!v)return m;const E=p?v.getCameraQueryGeometry(o):o,M=o.map(ue=>v.pointCoordinate(ue,this.terrain)),A=E.map(ue=>v.pointCoordinate(ue,this.terrain)),R=this.getIds();let V=1/0,q=1/0,Q=-1/0,he=-1/0;for(const ue of A)V=Math.min(V,ue.x),q=Math.min(q,ue.y),Q=Math.max(Q,ue.x),he=Math.max(he,ue.y);for(let ue=0;ue=0&&we[1].y+Ue>=0){const Le=M.map(He=>se.getTilePoint(He)),Ge=A.map(He=>se.getTilePoint(He));m.push({tile:ye,tileID:se,queryGeometry:Le,cameraQueryGeometry:Ge,scale:Te})}}return m}getVisibleCoordinates(o){const h=this.getRenderableIds(o).map(p=>this._tiles[p].tileID);for(const p of h)p.posMatrix=this.transform.calculatePosMatrix(p.toUnwrapped());return h}hasTransition(){if(this._source.hasTransition())return!0;if(rr(this._source.type)){const o=k.now();for(const h in this._tiles)if(this._tiles[h].fadeEndTime>=o)return!0}return!1}setFeatureState(o,h,p){this._state.updateState(o=o||"_geojsonTileLayer",h,p)}removeFeatureState(o,h,p){this._state.removeFeatureState(o=o||"_geojsonTileLayer",h,p)}getFeatureState(o,h){return this._state.getState(o=o||"_geojsonTileLayer",h)}setDependencies(o,h,p){const m=this._tiles[o];m&&m.setDependencies(h,p)}reloadTilesForDependencies(o,h){for(const p in this._tiles)this._tiles[p].hasDependency(o,h)&&this._reloadTile(p,"reloading");this._cache.filter(p=>!p.hasDependency(o,h))}}function mt(y,o){const h=Math.abs(2*y.wrap)-+(y.wrap<0),p=Math.abs(2*o.wrap)-+(o.wrap<0);return y.overscaledZ-o.overscaledZ||p-h||o.canonical.y-y.canonical.y||o.canonical.x-y.canonical.x}function rr(y){return y==="raster"||y==="image"||y==="video"}Or.maxOverzooming=10,Or.maxUnderzooming=3;class Jt{constructor(o,h){this.reset(o,h)}reset(o,h){this.points=o||[],this._distances=[0];for(let p=1;p0?(m-E)/M:0;return this.points[v].mult(1-A).add(this.points[h].mult(A))}}function Nr(y,o){let h=!0;return y==="always"||y!=="never"&&o!=="never"||(h=!1),h}class vi{constructor(o,h,p){const m=this.boxCells=[],v=this.circleCells=[];this.xCellCount=Math.ceil(o/p),this.yCellCount=Math.ceil(h/p);for(let E=0;Ethis.width||m<0||h>this.height)return[];const A=[];if(o<=0&&h<=0&&this.width<=p&&this.height<=m){if(v)return[{key:null,x1:o,y1:h,x2:p,y2:m}];for(let R=0;R0}hitTestCircle(o,h,p,m,v){const E=o-p,M=o+p,A=h-p,R=h+p;if(M<0||E>this.width||R<0||A>this.height)return!1;const V=[];return this._forEachCell(E,A,M,R,this._queryCellCircle,V,{hitTest:!0,overlapMode:m,circle:{x:o,y:h,radius:p},seenUids:{box:{},circle:{}}},v),V.length>0}_queryCell(o,h,p,m,v,E,M,A){const{seenUids:R,hitTest:V,overlapMode:q}=M,Q=this.boxCells[v];if(Q!==null){const ue=this.bboxes;for(const ye of Q)if(!R.box[ye]){R.box[ye]=!0;const se=4*ye,Te=this.boxKeys[ye];if(o<=ue[se+2]&&h<=ue[se+3]&&p>=ue[se+0]&&m>=ue[se+1]&&(!A||A(Te))&&(!V||!Nr(q,Te.overlapMode))&&(E.push({key:Te,x1:ue[se],y1:ue[se+1],x2:ue[se+2],y2:ue[se+3]}),V))return!0}}const he=this.circleCells[v];if(he!==null){const ue=this.circles;for(const ye of he)if(!R.circle[ye]){R.circle[ye]=!0;const se=3*ye,Te=this.circleKeys[ye];if(this._circleAndRectCollide(ue[se],ue[se+1],ue[se+2],o,h,p,m)&&(!A||A(Te))&&(!V||!Nr(q,Te.overlapMode))){const Ue=ue[se],we=ue[se+1],Le=ue[se+2];if(E.push({key:Te,x1:Ue-Le,y1:we-Le,x2:Ue+Le,y2:we+Le}),V)return!0}}}return!1}_queryCellCircle(o,h,p,m,v,E,M,A){const{circle:R,seenUids:V,overlapMode:q}=M,Q=this.boxCells[v];if(Q!==null){const ue=this.bboxes;for(const ye of Q)if(!V.box[ye]){V.box[ye]=!0;const se=4*ye,Te=this.boxKeys[ye];if(this._circleAndRectCollide(R.x,R.y,R.radius,ue[se+0],ue[se+1],ue[se+2],ue[se+3])&&(!A||A(Te))&&!Nr(q,Te.overlapMode))return E.push(!0),!0}}const he=this.circleCells[v];if(he!==null){const ue=this.circles;for(const ye of he)if(!V.circle[ye]){V.circle[ye]=!0;const se=3*ye,Te=this.circleKeys[ye];if(this._circlesCollide(ue[se],ue[se+1],ue[se+2],R.x,R.y,R.radius)&&(!A||A(Te))&&!Nr(q,Te.overlapMode))return E.push(!0),!0}}}_forEachCell(o,h,p,m,v,E,M,A){const R=this._convertToXCellCoord(o),V=this._convertToYCellCoord(h),q=this._convertToXCellCoord(p),Q=this._convertToYCellCoord(m);for(let he=R;he<=q;he++)for(let ue=V;ue<=Q;ue++)if(v.call(this,o,h,p,m,this.xCellCount*ue+he,E,M,A))return}_convertToXCellCoord(o){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(o*this.xScale)))}_convertToYCellCoord(o){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(o*this.yScale)))}_circlesCollide(o,h,p,m,v,E){const M=m-o,A=v-h,R=p+E;return R*R>M*M+A*A}_circleAndRectCollide(o,h,p,m,v,E,M){const A=(E-m)/2,R=Math.abs(o-(m+A));if(R>A+p)return!1;const V=(M-v)/2,q=Math.abs(h-(v+V));if(q>V+p)return!1;if(R<=A||q<=V)return!0;const Q=R-A,he=q-V;return Q*Q+he*he<=p*p}}function Qt(y,o,h,p,m){const v=a.F();return o?(a.J(v,v,[1/m,1/m,1]),h||a.ad(v,v,p.angle)):a.K(v,p.labelPlaneMatrix,y),v}function ro(y,o,h,p,m){if(o){const v=a.ae(y);return a.J(v,v,[m,m,1]),h||a.ad(v,v,-p.angle),v}return p.glCoordMatrix}function an(y,o,h){let p;h?(p=[y.x,y.y,h(y.x,y.y),1],a.af(p,p,o)):(p=[y.x,y.y,0,1],Xe(p,p,o));const m=p[3];return{point:new a.P(p[0]/m,p[1]/m),signedDistanceFromCamera:m}}function pe(y,o){return .5+y/o*.5}function Z(y,o){const h=y[0]/y[3],p=y[1]/y[3];return h>=-o[0]&&h<=o[0]&&p>=-o[1]&&p<=o[1]}function $(y,o,h,p,m,v,E,M,A,R){const V=p?y.textSizeData:y.iconSizeData,q=a.ag(V,h.transform.zoom),Q=[256/h.width*2+1,256/h.height*2+1],he=p?y.text.dynamicLayoutVertexArray:y.icon.dynamicLayoutVertexArray;he.clear();const ue=y.lineVertexArray,ye=p?y.text.placedSymbolArray:y.icon.placedSymbolArray,se=h.transform.width/h.transform.height;let Te=!1;for(let Ue=0;UeMath.abs(h.x-o.x)*p?{useVertical:!0}:(y===a.ah.vertical?o.yh.x)?{needsFlipping:!0}:null}function Ce(y,o,h,p,m,v,E,M,A,R,V,q,Q,he,ue,ye){const se=o/24,Te=y.lineOffsetX*se,Ue=y.lineOffsetY*se;let we;if(y.numGlyphs>1){const Le=y.glyphStartIndex+y.numGlyphs,Ge=y.lineStartIndex,He=y.lineStartIndex+y.lineLength,$e=te(se,M,Te,Ue,h,V,q,y,A,v,Q,ue,ye);if(!$e)return{notEnoughRoom:!0};const nt=an($e.first.point,E,ye).point,et=an($e.last.point,E,ye).point;if(p&&!h){const dt=le(y.writingMode,nt,et,he);if(dt)return dt}we=[$e.first];for(let dt=y.glyphStartIndex+1;dt0?nt.point:Ie(q,$e,Ge,1,m,ye),dt=le(y.writingMode,Ge,et,he);if(dt)return dt}const Le=Be(se*M.getoffsetX(y.glyphStartIndex),Te,Ue,h,V,q,y.segment,y.lineStartIndex,y.lineStartIndex+y.lineLength,A,v,Q,ue,ye);if(!Le)return{notEnoughRoom:!0};we=[Le]}for(const Le of we)a.aj(R,Le.point,Le.angle);return{}}function Ie(y,o,h,p,m,v){const E=an(y.add(y.sub(o)._unit()),m,v).point,M=h.sub(E);return h.add(M._mult(p/M.mag()))}function Pe(y,o){const{projectionCache:h,lineVertexArray:p,labelPlaneMatrix:m,tileAnchorPoint:v,distanceFromAnchor:E,getElevation:M,previousVertex:A,direction:R,absOffsetX:V}=o;if(h.projections[y])return h.projections[y];const q=new a.P(p.getx(y),p.gety(y)),Q=an(q,m,M);if(Q.signedDistanceFromCamera>0)return h.projections[y]=Q.point,Q.point;const he=y-R;return Ie(E===0?v:new a.P(p.getx(he),p.gety(he)),q,A,V-E+1,m,M)}function Se(y,o,h){return y._unit()._perp()._mult(o*h)}function W(y,o,h,p,m,v,E,M){const{projectionCache:A,direction:R}=M;if(A.offsets[y])return A.offsets[y];const V=h.add(o);if(y+R=m)return A.offsets[y]=V,V;const q=Pe(y+R,M),Q=Se(q.sub(h),E,R),he=h.add(Q),ue=q.add(Q);return A.offsets[y]=a.ak(v,V,he,ue)||V,A.offsets[y]}function Be(y,o,h,p,m,v,E,M,A,R,V,q,Q,he){const ue=p?y-o:y+o;let ye=ue>0?1:-1,se=0;p&&(ye*=-1,se=Math.PI),ye<0&&(se+=Math.PI);let Te,Ue,we=ye>0?M+E:M+E+1,Le=m,Ge=m,He=0,$e=0;const nt=Math.abs(ue),et=[];let dt;for(;He+$e<=nt;){if(we+=ye,we=A)return null;He+=$e,Ge=Le,Ue=Te;const _t={projectionCache:q,lineVertexArray:R,labelPlaneMatrix:V,tileAnchorPoint:v,distanceFromAnchor:He,getElevation:he,previousVertex:Ge,direction:ye,absOffsetX:nt};if(Le=Pe(we,_t),h===0)et.push(Ge),dt=Le.sub(Ge);else{let Xt;const or=Le.sub(Ge);Xt=or.mag()===0?Se(Pe(we+ye,_t).sub(Le),h,ye):Se(or,h,ye),Ue||(Ue=Ge.add(Xt)),Te=W(we,Xt,Le,M,A,Ue,h,_t),et.push(Ue),dt=Te.sub(Ue)}$e=dt.mag()}const gt=dt._mult((nt-He)/$e)._add(Ue||Ge),ir=se+Math.atan2(Le.y-Ge.y,Le.x-Ge.x);return et.push(gt),{point:gt,angle:Q?ir:0,path:et}}const Fe=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function qe(y,o){for(let h=0;h=1;cr--)or.push(_t.path[cr]);for(let cr=1;cran(dr,A,ue));or=cr.some(dr=>dr.signedDistanceFromCamera<=0)?[]:cr.map(dr=>dr.point)}let Yt=[];if(or.length>0){const cr=or[0].clone(),dr=or[0].clone();for(let hn=1;hn=dt.x&&dr.x<=gt.x&&cr.y>=dt.y&&dr.y<=gt.y?[or]:dr.xgt.x||dr.ygt.y?[]:a.al([or],dt.x,dt.y,gt.x,gt.y)}for(const cr of Yt){ir.reset(cr,.25*et);let dr=0;dr=ir.length<=.5*et?1:Math.ceil(ir.paddedLength/xr)+1;for(let hn=0;hn=this.screenRightBoundary||mthis.screenBottomBoundary}isInsideGrid(o,h,p,m){return p>=0&&o=0&&hp.collisionGroupID===h}}return this.collisionGroups[o]}}function Bn(y,o,h,p,m){const{horizontalAlign:v,verticalAlign:E}=a.at(y);return new a.P(-(v-.5)*o+p[0]*m,-(E-.5)*h+p[1]*m)}function fi(y,o,h,p,m,v){const{x1:E,x2:M,y1:A,y2:R,anchorPointX:V,anchorPointY:q}=y,Q=new a.P(o,h);return p&&Q._rotate(m?v:-v),{x1:E+Q.x,y1:A+Q.y,x2:M+Q.x,y2:R+Q.y,anchorPointX:V,anchorPointY:q}}class bi{constructor(o,h,p,m,v){this.transform=o.clone(),this.terrain=h,this.collisionIndex=new Pt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=p,this.retainedQueryData={},this.collisionGroups=new ln(m),this.collisionCircleArrays={},this.prevPlacement=v,v&&(v.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(o,h,p,m){const v=p.getBucket(h),E=p.latestFeatureIndex;if(!v||!E||h.id!==v.layerIds[0])return;const M=p.collisionBoxArray,A=v.layers[0].layout,R=Math.pow(2,this.transform.zoom-p.tileID.overscaledZ),V=p.tileSize/a.W,q=this.transform.calculatePosMatrix(p.tileID.toUnwrapped()),Q=A.get("text-pitch-alignment")==="map",he=A.get("text-rotation-alignment")==="map",ue=$t(p,1,this.transform.zoom),ye=Qt(q,Q,he,this.transform,ue);let se=null;if(Q){const Ue=ro(q,Q,he,this.transform,ue);se=a.K([],this.transform.labelPlaneMatrix,Ue)}this.retainedQueryData[v.bucketInstanceId]=new lr(v.bucketInstanceId,E,v.sourceLayerIndex,v.index,p.tileID);const Te={bucket:v,layout:A,posMatrix:q,textLabelPlaneMatrix:ye,labelToScreenMatrix:se,scale:R,textPixelRatio:V,holdingForFade:p.holdingForFade(),collisionBoxArray:M,partiallyEvaluatedTextSize:a.ag(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(m)for(const Ue of v.sortKeyRanges){const{sortKey:we,symbolInstanceStart:Le,symbolInstanceEnd:Ge}=Ue;o.push({sortKey:we,symbolInstanceStart:Le,symbolInstanceEnd:Ge,parameters:Te})}else o.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:Te})}attemptAnchorPlacement(o,h,p,m,v,E,M,A,R,V,q,Q,he,ue,ye,se){const Te=a.ap[o.textAnchor],Ue=[o.textOffset0,o.textOffset1],we=Bn(Te,p,m,Ue,v),Le=this.collisionIndex.placeCollisionBox(fi(h,we.x,we.y,E,M,this.transform.angle),q,A,R,V.predicate,se);if((!ye||this.collisionIndex.placeCollisionBox(fi(ye,we.x,we.y,E,M,this.transform.angle),q,A,R,V.predicate,se).box.length!==0)&&Le.box.length>0){let Ge;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID].text&&(Ge=this.prevPlacement.variableOffsets[Q.crossTileID].anchor),Q.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Q.crossTileID]={textOffset:Ue,width:p,height:m,anchor:Te,textBoxScale:v,prevAnchor:Ge},this.markUsedJustification(he,Te,Q,ue),he.allowVerticalPlacement&&(this.markUsedOrientation(he,ue,Q),this.placedOrientations[Q.crossTileID]=ue),{shift:we,placedGlyphBoxes:Le}}}placeLayerBucketPart(o,h,p){const{bucket:m,layout:v,posMatrix:E,textLabelPlaneMatrix:M,labelToScreenMatrix:A,textPixelRatio:R,holdingForFade:V,collisionBoxArray:q,partiallyEvaluatedTextSize:Q,collisionGroup:he}=o.parameters,ue=v.get("text-optional"),ye=v.get("icon-optional"),se=a.aq(v,"text-overlap","text-allow-overlap"),Te=se==="always",Ue=a.aq(v,"icon-overlap","icon-allow-overlap"),we=Ue==="always",Le=v.get("text-rotation-alignment")==="map",Ge=v.get("text-pitch-alignment")==="map",He=v.get("icon-text-fit")!=="none",$e=v.get("symbol-z-order")==="viewport-y",nt=Te&&(we||!m.hasIconData()||ye),et=we&&(Te||!m.hasTextData()||ue);!m.collisionArrays&&q&&m.deserializeCollisionBoxes(q);const dt=this.retainedQueryData[m.bucketInstanceId].tileID,gt=this.terrain?(_t,Xt)=>this.terrain.getElevation(dt,_t,Xt):null,ir=(_t,Xt)=>{var or,xr;if(h[_t.crossTileID])return;if(V)return void(this.placements[_t.crossTileID]=new Yr(!1,!1,!1));let Yt=!1,cr=!1,dr=!0,hn=null,Rr={box:null,offscreen:null},Oi={box:null,offscreen:null},Fn=null,nn=null,On=null,Ni=0,bo=0,ts=0;Xt.textFeatureIndex?Ni=Xt.textFeatureIndex:_t.useRuntimeCollisionCircles&&(Ni=_t.featureIndex),Xt.verticalTextFeatureIndex&&(bo=Xt.verticalTextFeatureIndex);const Za=Xt.textBox;if(Za){const An=Ln=>{let sn=a.ah.horizontal;if(m.allowVerticalPlacement&&!Ln&&this.prevPlacement){const Ji=this.prevPlacement.placedOrientations[_t.crossTileID];Ji&&(this.placedOrientations[_t.crossTileID]=Ji,sn=Ji,this.markUsedOrientation(m,sn,_t))}return sn},on=(Ln,sn)=>{if(m.allowVerticalPlacement&&_t.numVerticalGlyphVertices>0&&Xt.verticalTextBox){for(const Ji of m.writingModes)if(Ji===a.ah.vertical?(Rr=sn(),Oi=Rr):Rr=Ln(),Rr&&Rr.box&&Rr.box.length)break}else Rr=Ln()},en=_t.textAnchorOffsetStartIndex,Ki=_t.textAnchorOffsetEndIndex;if(Ki===en){const Ln=(sn,Ji)=>{const Pn=this.collisionIndex.placeCollisionBox(sn,se,R,E,he.predicate,gt);return Pn&&Pn.box&&Pn.box.length&&(this.markUsedOrientation(m,Ji,_t),this.placedOrientations[_t.crossTileID]=Ji),Pn};on(()=>Ln(Za,a.ah.horizontal),()=>{const sn=Xt.verticalTextBox;return m.allowVerticalPlacement&&_t.numVerticalGlyphVertices>0&&sn?Ln(sn,a.ah.vertical):{box:null,offscreen:null}}),An(Rr&&Rr.box&&Rr.box.length)}else{let Ln=a.ap[(xr=(or=this.prevPlacement)===null||or===void 0?void 0:or.variableOffsets[_t.crossTileID])===null||xr===void 0?void 0:xr.anchor];const sn=(Pn,yn,mu)=>{const ff=Pn.x2-Pn.x1,ws=Pn.y2-Pn.y1,xs=_t.textBoxScale,Wl=He&&Ue==="never"?yn:null;let ns={box:[],offscreen:!1},gu=se==="never"?1:2,df="never";Ln&&gu++;for(let _u=0;_usn(Za,Xt.iconBox,a.ah.horizontal),()=>{const Pn=Xt.verticalTextBox;return m.allowVerticalPlacement&&!(Rr&&Rr.box&&Rr.box.length)&&_t.numVerticalGlyphVertices>0&&Pn?sn(Pn,Xt.verticalIconBox,a.ah.vertical):{box:null,offscreen:null}}),Rr&&(Yt=Rr.box,dr=Rr.offscreen);const Ji=An(Rr&&Rr.box);if(!Yt&&this.prevPlacement){const Pn=this.prevPlacement.variableOffsets[_t.crossTileID];Pn&&(this.variableOffsets[_t.crossTileID]=Pn,this.markUsedJustification(m,Pn.anchor,_t,Ji))}}}if(Fn=Rr,Yt=Fn&&Fn.box&&Fn.box.length>0,dr=Fn&&Fn.offscreen,_t.useRuntimeCollisionCircles){const An=m.text.placedSymbolArray.get(_t.centerJustifiedTextSymbolIndex),on=a.ai(m.textSizeData,Q,An),en=v.get("text-padding");nn=this.collisionIndex.placeCollisionCircles(se,An,m.lineVertexArray,m.glyphOffsetArray,on,E,M,A,p,Ge,he.predicate,_t.collisionCircleDiameter,en,gt),nn.circles.length&&nn.collisionDetected&&!p&&a.w("Collisions detected, but collision boxes are not shown"),Yt=Te||nn.circles.length>0&&!nn.collisionDetected,dr=dr&&nn.offscreen}if(Xt.iconFeatureIndex&&(ts=Xt.iconFeatureIndex),Xt.iconBox){const An=on=>{const en=He&&hn?fi(on,hn.x,hn.y,Le,Ge,this.transform.angle):on;return this.collisionIndex.placeCollisionBox(en,Ue,R,E,he.predicate,gt)};Oi&&Oi.box&&Oi.box.length&&Xt.verticalIconBox?(On=An(Xt.verticalIconBox),cr=On.box.length>0):(On=An(Xt.iconBox),cr=On.box.length>0),dr=dr&&On.offscreen}const rs=ue||_t.numHorizontalGlyphVertices===0&&_t.numVerticalGlyphVertices===0,wo=ye||_t.numIconVertices===0;if(rs||wo?wo?rs||(cr=cr&&Yt):Yt=cr&&Yt:cr=Yt=cr&&Yt,Yt&&Fn&&Fn.box&&this.collisionIndex.insertCollisionBox(Fn.box,se,v.get("text-ignore-placement"),m.bucketInstanceId,Oi&&Oi.box&&bo?bo:Ni,he.ID),cr&&On&&this.collisionIndex.insertCollisionBox(On.box,Ue,v.get("icon-ignore-placement"),m.bucketInstanceId,ts,he.ID),nn&&(Yt&&this.collisionIndex.insertCollisionCircles(nn.circles,se,v.get("text-ignore-placement"),m.bucketInstanceId,Ni,he.ID),p)){const An=m.bucketInstanceId;let on=this.collisionCircleArrays[An];on===void 0&&(on=this.collisionCircleArrays[An]=new Cn);for(let en=0;en=0;--Xt){const or=_t[Xt];ir(m.symbolInstances.get(or),m.collisionArrays[or])}}else for(let _t=o.symbolInstanceStart;_t=0&&(o.text.placedSymbolArray.get(M).crossTileID=v>=0&&M!==v?0:p.crossTileID)}markUsedOrientation(o,h,p){const m=h===a.ah.horizontal||h===a.ah.horizontalOnly?h:0,v=h===a.ah.vertical?h:0,E=[p.leftJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.rightJustifiedTextSymbolIndex];for(const M of E)o.text.placedSymbolArray.get(M).placedOrientation=m;p.verticalPlacedTextSymbolIndex&&(o.text.placedSymbolArray.get(p.verticalPlacedTextSymbolIndex).placedOrientation=v)}commit(o){this.commitTime=o,this.zoomAtLastRecencyCheck=this.transform.zoom;const h=this.prevPlacement;let p=!1;this.prevZoomAdjustment=h?h.zoomAdjustment(this.transform.zoom):0;const m=h?h.symbolFadeChange(o):1,v=h?h.opacities:{},E=h?h.variableOffsets:{},M=h?h.placedOrientations:{};for(const A in this.placements){const R=this.placements[A],V=v[A];V?(this.opacities[A]=new gr(V,m,R.text,R.icon),p=p||R.text!==V.text.placed||R.icon!==V.icon.placed):(this.opacities[A]=new gr(null,m,R.text,R.icon,R.skipFade),p=p||R.text||R.icon)}for(const A in v){const R=v[A];if(!this.opacities[A]){const V=new gr(R,m,!1,!1);V.isHidden()||(this.opacities[A]=V,p=p||R.text.placed||R.icon.placed)}}for(const A in E)this.variableOffsets[A]||!this.opacities[A]||this.opacities[A].isHidden()||(this.variableOffsets[A]=E[A]);for(const A in M)this.placedOrientations[A]||!this.opacities[A]||this.opacities[A].isHidden()||(this.placedOrientations[A]=M[A]);if(h&&h.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");p?this.lastPlacementChangeTime=o:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=h?h.lastPlacementChangeTime:o)}updateLayerOpacities(o,h){const p={};for(const m of h){const v=m.getBucket(o);v&&m.latestFeatureIndex&&o.id===v.layerIds[0]&&this.updateBucketOpacities(v,p,m.collisionBoxArray)}}updateBucketOpacities(o,h,p){o.hasTextData()&&(o.text.opacityVertexArray.clear(),o.text.hasVisibleVertices=!1),o.hasIconData()&&(o.icon.opacityVertexArray.clear(),o.icon.hasVisibleVertices=!1),o.hasIconCollisionBoxData()&&o.iconCollisionBox.collisionVertexArray.clear(),o.hasTextCollisionBoxData()&&o.textCollisionBox.collisionVertexArray.clear();const m=o.layers[0],v=m.layout,E=new gr(null,0,!1,!1,!0),M=v.get("text-allow-overlap"),A=v.get("icon-allow-overlap"),R=m._unevaluatedLayout.hasValue("text-variable-anchor")||m._unevaluatedLayout.hasValue("text-variable-anchor-offset"),V=v.get("text-rotation-alignment")==="map",q=v.get("text-pitch-alignment")==="map",Q=v.get("icon-text-fit")!=="none",he=new gr(null,0,M&&(A||!o.hasIconData()||v.get("icon-optional")),A&&(M||!o.hasTextData()||v.get("text-optional")),!0);!o.collisionArrays&&p&&(o.hasIconCollisionBoxData()||o.hasTextCollisionBoxData())&&o.deserializeCollisionBoxes(p);const ue=(ye,se,Te)=>{for(let Ue=0;Ue0,He=this.placedOrientations[se.crossTileID],$e=He===a.ah.vertical,nt=He===a.ah.horizontal||He===a.ah.horizontalOnly;if(Te>0||Ue>0){const et=wi(Le.text);ue(o.text,Te,$e?ka:et),ue(o.text,Ue,nt?ka:et);const dt=Le.text.isHidden();[se.rightJustifiedTextSymbolIndex,se.centerJustifiedTextSymbolIndex,se.leftJustifiedTextSymbolIndex].forEach(_t=>{_t>=0&&(o.text.placedSymbolArray.get(_t).hidden=dt||$e?1:0)}),se.verticalPlacedTextSymbolIndex>=0&&(o.text.placedSymbolArray.get(se.verticalPlacedTextSymbolIndex).hidden=dt||nt?1:0);const gt=this.variableOffsets[se.crossTileID];gt&&this.markUsedJustification(o,gt.anchor,se,He);const ir=this.placedOrientations[se.crossTileID];ir&&(this.markUsedJustification(o,"left",se,ir),this.markUsedOrientation(o,ir,se))}if(Ge){const et=wi(Le.icon),dt=!(Q&&se.verticalPlacedIconSymbolIndex&&$e);se.placedIconSymbolIndex>=0&&(ue(o.icon,se.numIconVertices,dt?et:ka),o.icon.placedSymbolArray.get(se.placedIconSymbolIndex).hidden=Le.icon.isHidden()),se.verticalPlacedIconSymbolIndex>=0&&(ue(o.icon,se.numVerticalIconVertices,dt?ka:et),o.icon.placedSymbolArray.get(se.verticalPlacedIconSymbolIndex).hidden=Le.icon.isHidden())}if(o.hasIconCollisionBoxData()||o.hasTextCollisionBoxData()){const et=o.collisionArrays[ye];if(et){let dt=new a.P(0,0);if(et.textBox||et.verticalTextBox){let ir=!0;if(R){const _t=this.variableOffsets[we];_t?(dt=Bn(_t.anchor,_t.width,_t.height,_t.textOffset,_t.textBoxScale),V&&dt._rotate(q?this.transform.angle:-this.transform.angle)):ir=!1}et.textBox&&Kn(o.textCollisionBox.collisionVertexArray,Le.text.placed,!ir||$e,dt.x,dt.y),et.verticalTextBox&&Kn(o.textCollisionBox.collisionVertexArray,Le.text.placed,!ir||nt,dt.x,dt.y)}const gt=!!(!nt&&et.verticalIconBox);et.iconBox&&Kn(o.iconCollisionBox.collisionVertexArray,Le.icon.placed,gt,Q?dt.x:0,Q?dt.y:0),et.verticalIconBox&&Kn(o.iconCollisionBox.collisionVertexArray,Le.icon.placed,!gt,Q?dt.x:0,Q?dt.y:0)}}}if(o.sortFeatures(this.transform.angle),this.retainedQueryData[o.bucketInstanceId]&&(this.retainedQueryData[o.bucketInstanceId].featureSortOrder=o.featureSortOrder),o.hasTextData()&&o.text.opacityVertexBuffer&&o.text.opacityVertexBuffer.updateData(o.text.opacityVertexArray),o.hasIconData()&&o.icon.opacityVertexBuffer&&o.icon.opacityVertexBuffer.updateData(o.icon.opacityVertexArray),o.hasIconCollisionBoxData()&&o.iconCollisionBox.collisionVertexBuffer&&o.iconCollisionBox.collisionVertexBuffer.updateData(o.iconCollisionBox.collisionVertexArray),o.hasTextCollisionBoxData()&&o.textCollisionBox.collisionVertexBuffer&&o.textCollisionBox.collisionVertexBuffer.updateData(o.textCollisionBox.collisionVertexArray),o.text.opacityVertexArray.length!==o.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${o.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${o.text.layoutVertexArray.length}) / 4`);if(o.icon.opacityVertexArray.length!==o.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${o.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${o.icon.layoutVertexArray.length}) / 4`);if(o.bucketInstanceId in this.collisionCircleArrays){const ye=this.collisionCircleArrays[o.bucketInstanceId];o.placementInvProjMatrix=ye.invProjMatrix,o.placementViewportMatrix=ye.viewportMatrix,o.collisionCircleArray=ye.circles,delete this.collisionCircleArrays[o.bucketInstanceId]}}symbolFadeChange(o){return this.fadeDuration===0?1:(o-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(o){return Math.max(0,(this.transform.zoom-o)/1.5)}hasTransitions(o){return this.stale||o-this.lastPlacementChangeTimeo}setStale(){this.stale=!0}}function Kn(y,o,h,p,m){y.emplaceBack(o?1:0,h?1:0,p||0,m||0),y.emplaceBack(o?1:0,h?1:0,p||0,m||0),y.emplaceBack(o?1:0,h?1:0,p||0,m||0),y.emplaceBack(o?1:0,h?1:0,p||0,m||0)}const mo=Math.pow(2,25),Ch=Math.pow(2,24),Wd=Math.pow(2,17),zr=Math.pow(2,16),Fc=Math.pow(2,9),Oc=Math.pow(2,8),Ri=Math.pow(2,1);function wi(y){if(y.opacity===0&&!y.placed)return 0;if(y.opacity===1&&y.placed)return 4294967295;const o=y.placed?1:0,h=Math.floor(127*y.opacity);return h*mo+o*Ch+h*Wd+o*zr+h*Fc+o*Oc+h*Ri+o}const ka=0;class $i{constructor(o){this._sortAcrossTiles=o.layout.get("symbol-z-order")!=="viewport-y"&&!o.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(o,h,p,m,v){const E=this._bucketParts;for(;this._currentTileIndexM.sortKey-A.sortKey));this._currentPartIndex!this._forceFullPlacement&&k.now()-m>2;for(;this._currentPlacementIndex>=0;){const E=h[o[this._currentPlacementIndex]],M=this.placement.collisionIndex.transform.zoom;if(E.type==="symbol"&&(!E.minzoom||E.minzoom<=M)&&(!E.maxzoom||E.maxzoom>M)){if(this._inProgressLayer||(this._inProgressLayer=new $i(E)),this._inProgressLayer.continuePlacement(p[E.source],this.placement,this._showCollisionBoxes,E,v))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(o){return this.placement.commit(o),this.placement}}const Ns=512/a.W/2;class sl{constructor(o,h,p){this.tileID=o,this.bucketInstanceId=p,this._symbolsByKey={};const m=new Map;for(let v=0;v({x:Math.floor(A.anchorX*Ns),y:Math.floor(A.anchorY*Ns)})),crossTileIDs:E.map(A=>A.crossTileID)};if(M.positions.length>128){const A=new a.au(M.positions.length,16,Uint16Array);for(const{x:R,y:V}of M.positions)A.add(R,V);A.finish(),delete M.positions,M.index=A}this._symbolsByKey[v]=M}}getScaledCoordinates(o,h){const{x:p,y:m,z:v}=this.tileID.canonical,{x:E,y:M,z:A}=h.canonical,R=Ns/Math.pow(2,A-v),V=(M*a.W+o.anchorY)*R,q=m*a.W*Ns;return{x:Math.floor((E*a.W+o.anchorX)*R-p*a.W*Ns),y:Math.floor(V-q)}}findMatches(o,h,p){const m=this.tileID.canonical.zo)}}class In{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ta{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(o){const h=Math.round((o-this.lng)/360);if(h!==0)for(const p in this.indexes){const m=this.indexes[p],v={};for(const E in m){const M=m[E];M.tileID=M.tileID.unwrapTo(M.tileID.wrap+h),v[M.tileID.key]=M}this.indexes[p]=v}this.lng=o}addBucket(o,h,p){if(this.indexes[o.overscaledZ]&&this.indexes[o.overscaledZ][o.key]){if(this.indexes[o.overscaledZ][o.key].bucketInstanceId===h.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(o.overscaledZ,this.indexes[o.overscaledZ][o.key])}for(let v=0;vo.overscaledZ)for(const M in E){const A=E[M];A.tileID.isChildOf(o)&&A.findMatches(h.symbolInstances,o,m)}else{const M=E[o.scaledTo(Number(v)).key];M&&M.findMatches(h.symbolInstances,o,m)}}for(let v=0;v{h[p]=!0});for(const p in this.layerIndexes)h[p]||delete this.layerIndexes[p]}}const rn=(y,o)=>a.t(y,o&&o.filter(h=>h.identifier!=="source.canvas")),al=a.av();class Bi extends a.E{constructor(o,h={}){super(),this._rtlPluginLoaded=()=>{for(const p in this.sourceCaches){const m=this.sourceCaches[p].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[p].reload()}},this.map=o,this.dispatcher=new tr(nr(),o._getMapId()),this.dispatcher.registerMessageHandler("GG",(p,m)=>this.getGlyphs(p,m)),this.dispatcher.registerMessageHandler("GI",(p,m)=>this.getImages(p,m)),this.imageManager=new Ze,this.imageManager.setEventedParent(this),this.glyphManager=new Ot(o._requestManager,h.localIdeographFontFamily),this.lineAtlas=new At(256,512),this.crossTileSymbolIndex=new Xo,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",a.ax()),ct().on(ii,this._rtlPluginLoaded),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const m=this.sourceCaches[p.sourceId];if(!m)return;const v=m.getSource();if(v&&v.vectorLayerIds)for(const E in this._layers){const M=this._layers[E];M.source===v.id&&this._validateLayer(M)}})}loadURL(o,h={},p){this.fire(new a.k("dataloading",{dataType:"style"})),h.validate=typeof h.validate!="boolean"||h.validate;const m=this.map._requestManager.transformRequest(o,"Style");this._loadStyleRequest=new AbortController,a.h(m,this._loadStyleRequest).then(v=>{this._loadStyleRequest=null,this._load(v.data,h,p)}).catch(v=>{this._loadStyleRequest=null,v&&this.fire(new a.j(v))})}loadJSON(o,h={},p){this.fire(new a.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,k.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,h.validate=h.validate!==!1,this._load(o,h,p)}).catch(()=>{})}loadEmpty(){this.fire(new a.k("dataloading",{dataType:"style"})),this._load(al,{validate:!1})}_load(o,h,p){var m;const v=h.transformStyle?h.transformStyle(p,o):o;if(!h.validate||!rn(this,a.x(v))){this._loaded=!0,this.stylesheet=v;for(const E in v.sources)this.addSource(E,v.sources[E],{validate:!1});v.sprite?this._loadSprite(v.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(v.glyphs),this._createLayers(),this.light=new vt(this.stylesheet.light),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new a.k("data",{dataType:"style"})),this.fire(new a.k("style.load"))}}_createLayers(){const o=a.ay(this.stylesheet.layers);this.dispatcher.broadcast("SL",o),this._order=o.map(h=>h.id),this._layers={},this._serializedLayers=null;for(const h of o){const p=a.az(h);p.setEventedParent(this,{layer:{id:h.id}}),this._layers[h.id]=p}}_loadSprite(o,h=!1,p=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(v,E,M,A){return a._(this,void 0,void 0,function*(){const R=ze(v),V=M>1?"@2x":"",q={},Q={};for(const{id:he,url:ue}of R){const ye=E.transformRequest(E.normalizeSpriteURL(ue,V,".json"),"SpriteJSON");q[he]=a.h(ye,A);const se=E.transformRequest(E.normalizeSpriteURL(ue,V,".png"),"SpriteImage");Q[he]=G.getImage(se,A)}return yield Promise.all([...Object.values(q),...Object.values(Q)]),function(he,ue){return a._(this,void 0,void 0,function*(){const ye={};for(const se in he){ye[se]={};const Te=k.getImageCanvasContext((yield ue[se]).data),Ue=(yield he[se]).data;for(const we in Ue){const{width:Le,height:Ge,x:He,y:$e,sdf:nt,pixelRatio:et,stretchX:dt,stretchY:gt,content:ir}=Ue[we];ye[se][we]={data:null,pixelRatio:et,sdf:nt,stretchX:dt,stretchY:gt,content:ir,spriteData:{width:Le,height:Ge,x:He,y:$e,context:Te}}}}return ye})}(q,Q)})}(o,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(v=>{if(this._spriteRequest=null,v)for(const E in v){this._spritesImagesIds[E]=[];const M=this._spritesImagesIds[E]?this._spritesImagesIds[E].filter(A=>!(A in v)):[];for(const A of M)this.imageManager.removeImage(A),this._changedImages[A]=!0;for(const A in v[E]){const R=E==="default"?A:`${E}:${A}`;this._spritesImagesIds[E].push(R),R in this.imageManager.images?this.imageManager.updateImage(R,v[E][A],!1):this.imageManager.addImage(R,v[E][A]),h&&(this._changedImages[R]=!0)}}}).catch(v=>{this._spriteRequest=null,m=v,this.fire(new a.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),h&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.k("data",{dataType:"style"})),p&&p(m)})}_unloadSprite(){for(const o of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(o),this._changedImages[o]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}_validateLayer(o){const h=this.sourceCaches[o.source];if(!h)return;const p=o.sourceLayer;if(!p)return;const m=h.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(p)===-1)&&this.fire(new a.j(new Error(`Source layer "${p}" does not exist on source "${m.id}" as specified by style layer "${o.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const o in this.sourceCaches)if(!this.sourceCaches[o].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(o){const h=this._serializedAllLayers();if(!o||o.length===0)return Object.values(h);const p=[];for(const m of o)h[m]&&p.push(h[m]);return p}_serializedAllLayers(){let o=this._serializedLayers;if(o)return o;o=this._serializedLayers={};const h=Object.keys(this._layers);for(const p of h){const m=this._layers[p];m.type!=="custom"&&(o[p]=m.serialize())}return o}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const o in this.sourceCaches)if(this.sourceCaches[o].hasTransition())return!0;for(const o in this._layers)if(this._layers[o].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(o){if(!this._loaded)return;const h=this._changed;if(h){const m=Object.keys(this._updatedLayers),v=Object.keys(this._removedLayers);(m.length||v.length)&&this._updateWorkerLayers(m,v);for(const E in this._updatedSources){const M=this._updatedSources[E];if(M==="reload")this._reloadSource(E);else{if(M!=="clear")throw new Error(`Invalid action ${M}`);this._clearSource(E)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const E in this._updatedPaintProps)this._layers[E].updateTransitions(o);this.light.updateTransitions(o),this._resetUpdates()}const p={};for(const m in this.sourceCaches){const v=this.sourceCaches[m];p[m]=v.used,v.used=!1}for(const m of this._order){const v=this._layers[m];v.recalculate(o,this._availableImages),!v.isHidden(o.zoom)&&v.source&&(this.sourceCaches[v.source].used=!0)}for(const m in p){const v=this.sourceCaches[m];!!p[m]!=!!v.used&&v.fire(new a.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(o),this.z=o.zoom,h&&this.fire(new a.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const o=Object.keys(this._changedImages);if(o.length){for(const h in this.sourceCaches)this.sourceCaches[h].reloadTilesForDependencies(["icons","patterns"],o);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const o in this.sourceCaches)this.sourceCaches[o].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(o,h){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(o),removedIds:h})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(o,h={}){var p;this._checkLoaded();const m=this.serialize();if(o=h.transformStyle?h.transformStyle(m,o):o,((p=h.validate)===null||p===void 0||p)&&rn(this,a.x(o)))return!1;(o=a.aA(o)).layers=a.ay(o.layers);const v=a.aB(m,o),E=this._getOperationsToPerform(v);if(E.unimplemented.length>0)throw new Error(`Unimplemented: ${E.unimplemented.join(", ")}.`);if(E.operations.length===0)return!1;for(const M of E.operations)M();return this.stylesheet=o,this._serializedLayers=null,!0}_getOperationsToPerform(o){const h=[],p=[];for(const m of o)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":h.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":h.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":h.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":h.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":h.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":h.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":h.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":h.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":h.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":h.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":h.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":h.push(()=>this.setSprite.apply(this,m.args));break;case"setTerrain":h.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":h.push(()=>{});break;default:p.push(m.command)}return{operations:h,unimplemented:p}}addImage(o,h){if(this.getImage(o))return this.fire(new a.j(new Error(`An image named "${o}" already exists.`)));this.imageManager.addImage(o,h),this._afterImageUpdated(o)}updateImage(o,h){this.imageManager.updateImage(o,h)}getImage(o){return this.imageManager.getImage(o)}removeImage(o){if(!this.getImage(o))return this.fire(new a.j(new Error(`An image named "${o}" does not exist.`)));this.imageManager.removeImage(o),this._afterImageUpdated(o)}_afterImageUpdated(o){this._availableImages=this.imageManager.listImages(),this._changedImages[o]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(o,h,p={}){if(this._checkLoaded(),this.sourceCaches[o]!==void 0)throw new Error(`Source "${o}" already exists.`);if(!h.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(h).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(h.type)>=0&&this._validate(a.x.source,`sources.${o}`,h,null,p))return;this.map&&this.map._collectResourceTiming&&(h.collectResourceTiming=!0);const m=this.sourceCaches[o]=new Or(o,h,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:o})),m.onAdd(this.map),this._changed=!0}removeSource(o){if(this._checkLoaded(),this.sourceCaches[o]===void 0)throw new Error("There is no source with this ID");for(const p in this._layers)if(this._layers[p].source===o)return this.fire(new a.j(new Error(`Source "${o}" cannot be removed while layer "${p}" is using it.`)));const h=this.sourceCaches[o];delete this.sourceCaches[o],delete this._updatedSources[o],h.fire(new a.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:o})),h.setEventedParent(null),h.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(o,h){if(this._checkLoaded(),this.sourceCaches[o]===void 0)throw new Error(`There is no source with this ID=${o}`);const p=this.sourceCaches[o].getSource();if(p.type!=="geojson")throw new Error(`geojsonSource.type is ${p.type}, which is !== 'geojson`);p.setData(h),this._changed=!0}getSource(o){return this.sourceCaches[o]&&this.sourceCaches[o].getSource()}addLayer(o,h,p={}){this._checkLoaded();const m=o.id;if(this.getLayer(m))return void this.fire(new a.j(new Error(`Layer "${m}" already exists on this map.`)));let v;if(o.type==="custom"){if(rn(this,a.aC(o)))return;v=a.az(o)}else{if("source"in o&&typeof o.source=="object"&&(this.addSource(m,o.source),o=a.aA(o),o=a.e(o,{source:m})),this._validate(a.x.layer,`layers.${m}`,o,{arrayIndex:-1},p))return;v=a.az(o),this._validateLayer(v),v.setEventedParent(this,{layer:{id:m}})}const E=h?this._order.indexOf(h):this._order.length;if(h&&E===-1)this.fire(new a.j(new Error(`Cannot add layer "${m}" before non-existing layer "${h}".`)));else{if(this._order.splice(E,0,m),this._layerOrderChanged=!0,this._layers[m]=v,this._removedLayers[m]&&v.source&&v.type!=="custom"){const M=this._removedLayers[m];delete this._removedLayers[m],M.type!==v.type?this._updatedSources[v.source]="clear":(this._updatedSources[v.source]="reload",this.sourceCaches[v.source].pause())}this._updateLayer(v),v.onAdd&&v.onAdd(this.map)}}moveLayer(o,h){if(this._checkLoaded(),this._changed=!0,!this._layers[o])return void this.fire(new a.j(new Error(`The layer '${o}' does not exist in the map's style and cannot be moved.`)));if(o===h)return;const p=this._order.indexOf(o);this._order.splice(p,1);const m=h?this._order.indexOf(h):this._order.length;h&&m===-1?this.fire(new a.j(new Error(`Cannot move layer "${o}" before non-existing layer "${h}".`))):(this._order.splice(m,0,o),this._layerOrderChanged=!0)}removeLayer(o){this._checkLoaded();const h=this._layers[o];if(!h)return void this.fire(new a.j(new Error(`Cannot remove non-existing layer "${o}".`)));h.setEventedParent(null);const p=this._order.indexOf(o);this._order.splice(p,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[o]=h,delete this._layers[o],this._serializedLayers&&delete this._serializedLayers[o],delete this._updatedLayers[o],delete this._updatedPaintProps[o],h.onRemove&&h.onRemove(this.map)}getLayer(o){return this._layers[o]}getLayersOrder(){return[...this._order]}hasLayer(o){return o in this._layers}setLayerZoomRange(o,h,p){this._checkLoaded();const m=this.getLayer(o);m?m.minzoom===h&&m.maxzoom===p||(h!=null&&(m.minzoom=h),p!=null&&(m.maxzoom=p),this._updateLayer(m)):this.fire(new a.j(new Error(`Cannot set the zoom range of non-existing layer "${o}".`)))}setFilter(o,h,p={}){this._checkLoaded();const m=this.getLayer(o);if(m){if(!a.aD(m.filter,h))return h==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(a.x.filter,`layers.${m.id}.filter`,h,null,p)||(m.filter=a.aA(h),this._updateLayer(m)))}else this.fire(new a.j(new Error(`Cannot filter non-existing layer "${o}".`)))}getFilter(o){return a.aA(this.getLayer(o).filter)}setLayoutProperty(o,h,p,m={}){this._checkLoaded();const v=this.getLayer(o);v?a.aD(v.getLayoutProperty(h),p)||(v.setLayoutProperty(h,p,m),this._updateLayer(v)):this.fire(new a.j(new Error(`Cannot style non-existing layer "${o}".`)))}getLayoutProperty(o,h){const p=this.getLayer(o);if(p)return p.getLayoutProperty(h);this.fire(new a.j(new Error(`Cannot get style of non-existing layer "${o}".`)))}setPaintProperty(o,h,p,m={}){this._checkLoaded();const v=this.getLayer(o);v?a.aD(v.getPaintProperty(h),p)||(v.setPaintProperty(h,p,m)&&this._updateLayer(v),this._changed=!0,this._updatedPaintProps[o]=!0,this._serializedLayers=null):this.fire(new a.j(new Error(`Cannot style non-existing layer "${o}".`)))}getPaintProperty(o,h){return this.getLayer(o).getPaintProperty(h)}setFeatureState(o,h){this._checkLoaded();const p=o.source,m=o.sourceLayer,v=this.sourceCaches[p];if(v===void 0)return void this.fire(new a.j(new Error(`The source '${p}' does not exist in the map's style.`)));const E=v.getSource().type;E==="geojson"&&m?this.fire(new a.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):E!=="vector"||m?(o.id===void 0&&this.fire(new a.j(new Error("The feature id parameter must be provided."))),v.setFeatureState(m,o.id,h)):this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(o,h){this._checkLoaded();const p=o.source,m=this.sourceCaches[p];if(m===void 0)return void this.fire(new a.j(new Error(`The source '${p}' does not exist in the map's style.`)));const v=m.getSource().type,E=v==="vector"?o.sourceLayer:void 0;v!=="vector"||E?h&&typeof o.id!="string"&&typeof o.id!="number"?this.fire(new a.j(new Error("A feature id is required to remove its specific state property."))):m.removeFeatureState(E,o.id,h):this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(o){this._checkLoaded();const h=o.source,p=o.sourceLayer,m=this.sourceCaches[h];if(m!==void 0)return m.getSource().type!=="vector"||p?(o.id===void 0&&this.fire(new a.j(new Error("The feature id parameter must be provided."))),m.getFeatureState(p,o.id)):void this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new a.j(new Error(`The source '${h}' does not exist in the map's style.`)))}getTransition(){return a.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const o=a.aE(this.sourceCaches,v=>v.serialize()),h=this._serializeByIds(this._order),p=this.map.getTerrain()||void 0,m=this.stylesheet;return a.aF({version:m.version,name:m.name,metadata:m.metadata,light:m.light,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:o,layers:h,terrain:p},v=>v!==void 0)}_updateLayer(o){this._updatedLayers[o.id]=!0,o.source&&!this._updatedSources[o.source]&&this.sourceCaches[o.source].getSource().type!=="raster"&&(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(o){const h=E=>this._layers[E].type==="fill-extrusion",p={},m=[];for(let E=this._order.length-1;E>=0;E--){const M=this._order[E];if(h(M)){p[M]=E;for(const A of o){const R=A[M];if(R)for(const V of R)m.push(V)}}}m.sort((E,M)=>M.intersectionZ-E.intersectionZ);const v=[];for(let E=this._order.length-1;E>=0;E--){const M=this._order[E];if(h(M))for(let A=m.length-1;A>=0;A--){const R=m[A].feature;if(p[R.layer.id]{const nt=Te.featureSortOrder;if(nt){const et=nt.indexOf(He.featureIndex);return nt.indexOf($e.featureIndex)-et}return $e.featureIndex-He.featureIndex});for(const He of Ge)Le.push(He)}}for(const Te in ue)ue[Te].forEach(Ue=>{const we=Ue.feature,Le=R[M[Te].source].getFeatureState(we.layer["source-layer"],we.id);we.source=we.layer.source,we.layer["source-layer"]&&(we.sourceLayer=we.layer["source-layer"]),we.state=Le});return ue}(this._layers,E,this.sourceCaches,o,h,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(v)}querySourceFeatures(o,h){h&&h.filter&&this._validate(a.x.filter,"querySourceFeatures.filter",h.filter,null,h);const p=this.sourceCaches[o];return p?function(m,v){const E=m.getRenderableIds().map(R=>m.getTileByID(R)),M=[],A={};for(let R=0;RQ.getTileByID(he)).sort((he,ue)=>ue.tileID.overscaledZ-he.tileID.overscaledZ||(he.tileID.isLessThan(ue.tileID)?-1:1))}const q=this.crossTileSymbolIndex.addLayer(V,A[V.source],o.center.lng);E=E||q}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((v=v||this._layerOrderChanged||p===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(k.now(),o.zoom))&&(this.pauseablePlacement=new Xi(o,this.map.terrain,this._order,v,h,p,m,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,A),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(k.now()),M=!0),E&&this.pauseablePlacement.placement.setStale()),M||E)for(const R of this._order){const V=this._layers[R];V.type==="symbol"&&this.placement.updateLayerOpacities(V,A[V.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(k.now())}_releaseSymbolFadeTiles(){for(const o in this.sourceCaches)this.sourceCaches[o].releaseSymbolFadeTiles()}getImages(o,h){return a._(this,void 0,void 0,function*(){const p=yield this.imageManager.getImages(h.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[h.source];return m&&m.setDependencies(h.tileID.key,h.type,h.icons),p})}getGlyphs(o,h){return a._(this,void 0,void 0,function*(){const p=yield this.glyphManager.getGlyphs(h.stacks),m=this.sourceCaches[h.source];return m&&m.setDependencies(h.tileID.key,h.type,[""]),p})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(o,h={}){this._checkLoaded(),o&&this._validate(a.x.glyphs,"glyphs",o,null,h)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=o,this.glyphManager.entries={},this.glyphManager.setURL(o))}addSprite(o,h,p={},m){this._checkLoaded();const v=[{id:o,url:h}],E=[...ze(this.stylesheet.sprite),...v];this._validate(a.x.sprite,"sprite",E,null,p)||(this.stylesheet.sprite=E,this._loadSprite(v,!0,m))}removeSprite(o){this._checkLoaded();const h=ze(this.stylesheet.sprite);if(h.find(p=>p.id===o)){if(this._spritesImagesIds[o])for(const p of this._spritesImagesIds[o])this.imageManager.removeImage(p),this._changedImages[p]=!0;h.splice(h.findIndex(p=>p.id===o),1),this.stylesheet.sprite=h.length>0?h:void 0,delete this._spritesImagesIds[o],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}else this.fire(new a.j(new Error(`Sprite "${o}" doesn't exists on this map.`)))}getSprite(){return ze(this.stylesheet.sprite)}setSprite(o,h={},p){this._checkLoaded(),o&&this._validate(a.x.sprite,"sprite",o,null,h)||(this.stylesheet.sprite=o,o?this._loadSprite(o,!0,p):(this._unloadSprite(),p&&p(null)))}}var ll=a.X([{name:"a_pos",type:"Int16",components:2}]),go="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const Ea={prelude:Dr(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -578,8 +578,8 @@ uniform ${V} ${q} u_${Q}; #endif `}),staticAttributes:p,staticUniforms:E}}class cl{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(o,h,p,m,v,E,M,A,R){this.context=o;let V=this.boundPaintVertexBuffers.length!==m.length;for(let q=0;!V&&q({u_depth:new a.aG(He,$e.u_depth),u_terrain:new a.aG(He,$e.u_terrain),u_terrain_dim:new a.aH(He,$e.u_terrain_dim),u_terrain_matrix:new a.aI(He,$e.u_terrain_matrix),u_terrain_unpack:new a.aJ(He,$e.u_terrain_unpack),u_terrain_exaggeration:new a.aH(He,$e.u_terrain_exaggeration)}))(o,Ge),this.binderUniforms=p?p.getUniforms(o,Ge):[]}draw(o,h,p,m,v,E,M,A,R,V,q,Q,he,ue,ye,se,Te,Ue){const we=o.gl;if(this.failedToCreate)return;if(o.program.set(this.program),o.setDepthMode(p),o.setStencilMode(m),o.setColorMode(v),o.setCullFace(E),A){o.activeTexture.set(we.TEXTURE2),we.bindTexture(we.TEXTURE_2D,A.depthTexture),o.activeTexture.set(we.TEXTURE3),we.bindTexture(we.TEXTURE_2D,A.texture);for(const Ge in this.terrainUniforms)this.terrainUniforms[Ge].set(A[Ge])}for(const Ge in this.fixedUniforms)this.fixedUniforms[Ge].set(M[Ge]);ye&&ye.setUniforms(o,this.binderUniforms,he,{zoom:ue});let Le=0;switch(h){case we.LINES:Le=2;break;case we.TRIANGLES:Le=3;break;case we.LINE_STRIP:Le=1}for(const Ge of Q.get()){const He=Ge.vaos||(Ge.vaos={});(He[R]||(He[R]=new cl)).bind(o,this,V,ye?ye.getPaintVertexBuffers():[],q,Ge.vertexOffset,se,Te,Ue),we.drawElements(h,Ge.primitiveLength*Le,we.UNSIGNED_SHORT,Ge.primitiveOffset*Le*2)}}}function ul(y,o,h){const p=1/$t(h,1,o.transform.tileZoom),m=Math.pow(2,h.tileID.overscaledZ),v=h.tileSize*Math.pow(2,o.transform.tileZoom)/m,E=v*(h.tileID.canonical.x+h.tileID.wrap*m),M=v*h.tileID.canonical.y;return{u_image:0,u_texsize:h.imageAtlasTexture.size,u_scale:[p,y.fromScale,y.toScale],u_fade:y.t,u_pixel_coord_upper:[E>>16,M>>16],u_pixel_coord_lower:[65535&E,65535&M]}}const Ma=(y,o,h,p)=>{const m=o.style.light,v=m.properties.get("position"),E=[v.x,v.y,v.z],M=function(){var R=new a.A(9);return a.A!=Float32Array&&(R[1]=0,R[2]=0,R[3]=0,R[5]=0,R[6]=0,R[7]=0),R[0]=1,R[4]=1,R[8]=1,R}();m.properties.get("anchor")==="viewport"&&function(R,V){var q=Math.sin(V),Q=Math.cos(V);R[0]=Q,R[1]=q,R[2]=0,R[3]=-q,R[4]=Q,R[5]=0,R[6]=0,R[7]=0,R[8]=1}(M,-o.transform.angle),function(R,V,q){var Q=V[0],he=V[1],ue=V[2];R[0]=Q*q[0]+he*q[3]+ue*q[6],R[1]=Q*q[1]+he*q[4]+ue*q[7],R[2]=Q*q[2]+he*q[5]+ue*q[8]}(E,E,M);const A=m.properties.get("color");return{u_matrix:y,u_lightpos:E,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[A.r,A.g,A.b],u_vertical_gradient:+h,u_opacity:p}},Zd=(y,o,h,p,m,v,E)=>a.e(Ma(y,o,h,p),ul(v,o,E),{u_height_factor:-Math.pow(2,m.overscaledZ)/E.tileSize/8}),Ih=y=>({u_matrix:y}),hl=(y,o,h,p)=>a.e(Ih(y),ul(h,o,p)),Hd=(y,o)=>({u_matrix:y,u_world:o}),Ah=(y,o,h,p,m)=>a.e(hl(y,o,h,p),{u_world:m}),$d=(y,o,h,p)=>{const m=y.transform;let v,E;if(p.paint.get("circle-pitch-alignment")==="map"){const M=$t(h,1,m.zoom);v=!0,E=[M,M]}else v=!1,E=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(p.paint.get("circle-pitch-scale")==="map"),u_matrix:y.translatePosMatrix(o.posMatrix,h,p.paint.get("circle-translate"),p.paint.get("circle-translate-anchor")),u_pitch_with_map:+v,u_device_pixel_ratio:y.pixelRatio,u_extrude_scale:E}},Lh=(y,o,h)=>{const p=$t(h,1,o.zoom),m=Math.pow(2,o.zoom-h.tileID.overscaledZ),v=h.tileID.overscaleFactor();return{u_matrix:y,u_camera_to_center_distance:o.cameraToCenterDistance,u_pixels_to_tile_units:p,u_extrude_scale:[o.pixelsToGLUnits[0]/(p*m),o.pixelsToGLUnits[1]/(p*m)],u_overscale_factor:v}},Ph=(y,o,h=1)=>({u_matrix:y,u_color:o,u_overlay:0,u_overlay_scale:h}),fl=y=>({u_matrix:y}),zh=(y,o,h,p)=>({u_matrix:y,u_extrude_scale:$t(o,1,h),u_intensity:p});function Dh(y,o){const h=Math.pow(2,o.canonical.z),p=o.canonical.y;return[new a.Y(0,p/h).toLngLat().lat,new a.Y(0,(p+1)/h).toLngLat().lat]}const dl=(y,o,h,p)=>{const m=y.transform;return{u_matrix:Ca(y,o,h,p),u_ratio:1/$t(o,1,m.zoom),u_device_pixel_ratio:y.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},Rh=(y,o,h,p,m)=>a.e(dl(y,o,h,m),{u_image:0,u_image_height:p}),ds=(y,o,h,p,m)=>{const v=y.transform,E=Fi(o,v);return{u_matrix:Ca(y,o,h,m),u_texsize:o.imageAtlasTexture.size,u_ratio:1/$t(o,1,v.zoom),u_device_pixel_ratio:y.pixelRatio,u_image:0,u_scale:[E,p.fromScale,p.toScale],u_fade:p.t,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]]}},pl=(y,o,h,p,m,v)=>{const E=y.lineAtlas,M=Fi(o,y.transform),A=h.layout.get("line-cap")==="round",R=E.getDash(p.from,A),V=E.getDash(p.to,A),q=R.width*m.fromScale,Q=V.width*m.toScale;return a.e(dl(y,o,h,v),{u_patternscale_a:[M/q,-R.height/2],u_patternscale_b:[M/Q,-V.height/2],u_sdfgamma:E.width/(256*Math.min(q,Q)*y.pixelRatio)/2,u_image:0,u_tex_y_a:R.y,u_tex_y_b:V.y,u_mix:m.t})};function Fi(y,o){return 1/$t(y,1,o.tileZoom)}function Ca(y,o,h,p){return y.translatePosMatrix(p?p.posMatrix:o.tileID.posMatrix,o,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}const ml=(y,o,h,p,m)=>{return{u_matrix:y,u_tl_parent:o,u_scale_parent:h,u_buffer_scale:1,u_fade_t:p.mix,u_opacity:p.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(E=m.paint.get("raster-saturation"),E>0?1-1/(1.001-E):-E),u_contrast_factor:(v=m.paint.get("raster-contrast"),v>0?1/(1-v):1+v),u_spin_weights:Ia(m.paint.get("raster-hue-rotate"))};var v,E};function Ia(y){y*=Math.PI/180;const o=Math.sin(y),h=Math.cos(y);return[(2*h+1)/3,(-Math.sqrt(3)*o-h+1)/3,(Math.sqrt(3)*o-h+1)/3]}const Aa=(y,o,h,p,m,v,E,M,A,R)=>{const V=m.transform;return{u_is_size_zoom_constant:+(y==="constant"||y==="source"),u_is_size_feature_constant:+(y==="constant"||y==="camera"),u_size_t:o?o.uSizeT:0,u_size:o?o.uSize:0,u_camera_to_center_distance:V.cameraToCenterDistance,u_pitch:V.pitch/360*2*Math.PI,u_rotate_symbol:+h,u_aspect_ratio:V.width/V.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:v,u_label_plane_matrix:E,u_coord_matrix:M,u_is_text:+A,u_pitch_with_map:+p,u_texsize:R,u_texture:0}},La=(y,o,h,p,m,v,E,M,A,R,V)=>{const q=m.transform;return a.e(Aa(y,o,h,p,m,v,E,M,A,R),{u_gamma_scale:p?Math.cos(q._pitch)*q.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+V})},Pa=(y,o,h,p,m,v,E,M,A,R)=>a.e(La(y,o,h,p,m,v,E,M,!0,A,!0),{u_texsize_icon:R,u_texture_icon:1}),Xd=(y,o,h)=>({u_matrix:y,u_opacity:o,u_color:h}),Kd=(y,o,h,p,m,v)=>a.e(function(E,M,A,R){const V=A.imageManager.getPattern(E.from.toString()),q=A.imageManager.getPattern(E.to.toString()),{width:Q,height:he}=A.imageManager.getPixelSize(),ue=Math.pow(2,R.tileID.overscaledZ),ye=R.tileSize*Math.pow(2,A.transform.tileZoom)/ue,se=ye*(R.tileID.canonical.x+R.tileID.wrap*ue),Te=ye*R.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:V.tl,u_pattern_br_a:V.br,u_pattern_tl_b:q.tl,u_pattern_br_b:q.br,u_texsize:[Q,he],u_mix:M.t,u_pattern_size_a:V.displaySize,u_pattern_size_b:q.displaySize,u_scale_a:M.fromScale,u_scale_b:M.toScale,u_tile_units_to_pixels:1/$t(R,1,A.transform.tileZoom),u_pixel_coord_upper:[se>>16,Te>>16],u_pixel_coord_lower:[65535&se,65535&Te]}}(p,v,h,m),{u_matrix:y,u_opacity:o}),Bh={fillExtrusion:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_lightpos:new a.aK(y,o.u_lightpos),u_lightintensity:new a.aH(y,o.u_lightintensity),u_lightcolor:new a.aK(y,o.u_lightcolor),u_vertical_gradient:new a.aH(y,o.u_vertical_gradient),u_opacity:new a.aH(y,o.u_opacity)}),fillExtrusionPattern:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_lightpos:new a.aK(y,o.u_lightpos),u_lightintensity:new a.aH(y,o.u_lightintensity),u_lightcolor:new a.aK(y,o.u_lightcolor),u_vertical_gradient:new a.aH(y,o.u_vertical_gradient),u_height_factor:new a.aH(y,o.u_height_factor),u_image:new a.aG(y,o.u_image),u_texsize:new a.aL(y,o.u_texsize),u_pixel_coord_upper:new a.aL(y,o.u_pixel_coord_upper),u_pixel_coord_lower:new a.aL(y,o.u_pixel_coord_lower),u_scale:new a.aK(y,o.u_scale),u_fade:new a.aH(y,o.u_fade),u_opacity:new a.aH(y,o.u_opacity)}),fill:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix)}),fillPattern:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_image:new a.aG(y,o.u_image),u_texsize:new a.aL(y,o.u_texsize),u_pixel_coord_upper:new a.aL(y,o.u_pixel_coord_upper),u_pixel_coord_lower:new a.aL(y,o.u_pixel_coord_lower),u_scale:new a.aK(y,o.u_scale),u_fade:new a.aH(y,o.u_fade)}),fillOutline:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_world:new a.aL(y,o.u_world)}),fillOutlinePattern:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_world:new a.aL(y,o.u_world),u_image:new a.aG(y,o.u_image),u_texsize:new a.aL(y,o.u_texsize),u_pixel_coord_upper:new a.aL(y,o.u_pixel_coord_upper),u_pixel_coord_lower:new a.aL(y,o.u_pixel_coord_lower),u_scale:new a.aK(y,o.u_scale),u_fade:new a.aH(y,o.u_fade)}),circle:(y,o)=>({u_camera_to_center_distance:new a.aH(y,o.u_camera_to_center_distance),u_scale_with_map:new a.aG(y,o.u_scale_with_map),u_pitch_with_map:new a.aG(y,o.u_pitch_with_map),u_extrude_scale:new a.aL(y,o.u_extrude_scale),u_device_pixel_ratio:new a.aH(y,o.u_device_pixel_ratio),u_matrix:new a.aI(y,o.u_matrix)}),collisionBox:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_camera_to_center_distance:new a.aH(y,o.u_camera_to_center_distance),u_pixels_to_tile_units:new a.aH(y,o.u_pixels_to_tile_units),u_extrude_scale:new a.aL(y,o.u_extrude_scale),u_overscale_factor:new a.aH(y,o.u_overscale_factor)}),collisionCircle:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_inv_matrix:new a.aI(y,o.u_inv_matrix),u_camera_to_center_distance:new a.aH(y,o.u_camera_to_center_distance),u_viewport_size:new a.aL(y,o.u_viewport_size)}),debug:(y,o)=>({u_color:new a.aM(y,o.u_color),u_matrix:new a.aI(y,o.u_matrix),u_overlay:new a.aG(y,o.u_overlay),u_overlay_scale:new a.aH(y,o.u_overlay_scale)}),clippingMask:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix)}),heatmap:(y,o)=>({u_extrude_scale:new a.aH(y,o.u_extrude_scale),u_intensity:new a.aH(y,o.u_intensity),u_matrix:new a.aI(y,o.u_matrix)}),heatmapTexture:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_world:new a.aL(y,o.u_world),u_image:new a.aG(y,o.u_image),u_color_ramp:new a.aG(y,o.u_color_ramp),u_opacity:new a.aH(y,o.u_opacity)}),hillshade:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_image:new a.aG(y,o.u_image),u_latrange:new a.aL(y,o.u_latrange),u_light:new a.aL(y,o.u_light),u_shadow:new a.aM(y,o.u_shadow),u_highlight:new a.aM(y,o.u_highlight),u_accent:new a.aM(y,o.u_accent)}),hillshadePrepare:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_image:new a.aG(y,o.u_image),u_dimension:new a.aL(y,o.u_dimension),u_zoom:new a.aH(y,o.u_zoom),u_unpack:new a.aJ(y,o.u_unpack)}),line:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_ratio:new a.aH(y,o.u_ratio),u_device_pixel_ratio:new a.aH(y,o.u_device_pixel_ratio),u_units_to_pixels:new a.aL(y,o.u_units_to_pixels)}),lineGradient:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_ratio:new a.aH(y,o.u_ratio),u_device_pixel_ratio:new a.aH(y,o.u_device_pixel_ratio),u_units_to_pixels:new a.aL(y,o.u_units_to_pixels),u_image:new a.aG(y,o.u_image),u_image_height:new a.aH(y,o.u_image_height)}),linePattern:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_texsize:new a.aL(y,o.u_texsize),u_ratio:new a.aH(y,o.u_ratio),u_device_pixel_ratio:new a.aH(y,o.u_device_pixel_ratio),u_image:new a.aG(y,o.u_image),u_units_to_pixels:new a.aL(y,o.u_units_to_pixels),u_scale:new a.aK(y,o.u_scale),u_fade:new a.aH(y,o.u_fade)}),lineSDF:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_ratio:new a.aH(y,o.u_ratio),u_device_pixel_ratio:new a.aH(y,o.u_device_pixel_ratio),u_units_to_pixels:new a.aL(y,o.u_units_to_pixels),u_patternscale_a:new a.aL(y,o.u_patternscale_a),u_patternscale_b:new a.aL(y,o.u_patternscale_b),u_sdfgamma:new a.aH(y,o.u_sdfgamma),u_image:new a.aG(y,o.u_image),u_tex_y_a:new a.aH(y,o.u_tex_y_a),u_tex_y_b:new a.aH(y,o.u_tex_y_b),u_mix:new a.aH(y,o.u_mix)}),raster:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_tl_parent:new a.aL(y,o.u_tl_parent),u_scale_parent:new a.aH(y,o.u_scale_parent),u_buffer_scale:new a.aH(y,o.u_buffer_scale),u_fade_t:new a.aH(y,o.u_fade_t),u_opacity:new a.aH(y,o.u_opacity),u_image0:new a.aG(y,o.u_image0),u_image1:new a.aG(y,o.u_image1),u_brightness_low:new a.aH(y,o.u_brightness_low),u_brightness_high:new a.aH(y,o.u_brightness_high),u_saturation_factor:new a.aH(y,o.u_saturation_factor),u_contrast_factor:new a.aH(y,o.u_contrast_factor),u_spin_weights:new a.aK(y,o.u_spin_weights)}),symbolIcon:(y,o)=>({u_is_size_zoom_constant:new a.aG(y,o.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aG(y,o.u_is_size_feature_constant),u_size_t:new a.aH(y,o.u_size_t),u_size:new a.aH(y,o.u_size),u_camera_to_center_distance:new a.aH(y,o.u_camera_to_center_distance),u_pitch:new a.aH(y,o.u_pitch),u_rotate_symbol:new a.aG(y,o.u_rotate_symbol),u_aspect_ratio:new a.aH(y,o.u_aspect_ratio),u_fade_change:new a.aH(y,o.u_fade_change),u_matrix:new a.aI(y,o.u_matrix),u_label_plane_matrix:new a.aI(y,o.u_label_plane_matrix),u_coord_matrix:new a.aI(y,o.u_coord_matrix),u_is_text:new a.aG(y,o.u_is_text),u_pitch_with_map:new a.aG(y,o.u_pitch_with_map),u_texsize:new a.aL(y,o.u_texsize),u_texture:new a.aG(y,o.u_texture)}),symbolSDF:(y,o)=>({u_is_size_zoom_constant:new a.aG(y,o.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aG(y,o.u_is_size_feature_constant),u_size_t:new a.aH(y,o.u_size_t),u_size:new a.aH(y,o.u_size),u_camera_to_center_distance:new a.aH(y,o.u_camera_to_center_distance),u_pitch:new a.aH(y,o.u_pitch),u_rotate_symbol:new a.aG(y,o.u_rotate_symbol),u_aspect_ratio:new a.aH(y,o.u_aspect_ratio),u_fade_change:new a.aH(y,o.u_fade_change),u_matrix:new a.aI(y,o.u_matrix),u_label_plane_matrix:new a.aI(y,o.u_label_plane_matrix),u_coord_matrix:new a.aI(y,o.u_coord_matrix),u_is_text:new a.aG(y,o.u_is_text),u_pitch_with_map:new a.aG(y,o.u_pitch_with_map),u_texsize:new a.aL(y,o.u_texsize),u_texture:new a.aG(y,o.u_texture),u_gamma_scale:new a.aH(y,o.u_gamma_scale),u_device_pixel_ratio:new a.aH(y,o.u_device_pixel_ratio),u_is_halo:new a.aG(y,o.u_is_halo)}),symbolTextAndIcon:(y,o)=>({u_is_size_zoom_constant:new a.aG(y,o.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aG(y,o.u_is_size_feature_constant),u_size_t:new a.aH(y,o.u_size_t),u_size:new a.aH(y,o.u_size),u_camera_to_center_distance:new a.aH(y,o.u_camera_to_center_distance),u_pitch:new a.aH(y,o.u_pitch),u_rotate_symbol:new a.aG(y,o.u_rotate_symbol),u_aspect_ratio:new a.aH(y,o.u_aspect_ratio),u_fade_change:new a.aH(y,o.u_fade_change),u_matrix:new a.aI(y,o.u_matrix),u_label_plane_matrix:new a.aI(y,o.u_label_plane_matrix),u_coord_matrix:new a.aI(y,o.u_coord_matrix),u_is_text:new a.aG(y,o.u_is_text),u_pitch_with_map:new a.aG(y,o.u_pitch_with_map),u_texsize:new a.aL(y,o.u_texsize),u_texsize_icon:new a.aL(y,o.u_texsize_icon),u_texture:new a.aG(y,o.u_texture),u_texture_icon:new a.aG(y,o.u_texture_icon),u_gamma_scale:new a.aH(y,o.u_gamma_scale),u_device_pixel_ratio:new a.aH(y,o.u_device_pixel_ratio),u_is_halo:new a.aG(y,o.u_is_halo)}),background:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_opacity:new a.aH(y,o.u_opacity),u_color:new a.aM(y,o.u_color)}),backgroundPattern:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_opacity:new a.aH(y,o.u_opacity),u_image:new a.aG(y,o.u_image),u_pattern_tl_a:new a.aL(y,o.u_pattern_tl_a),u_pattern_br_a:new a.aL(y,o.u_pattern_br_a),u_pattern_tl_b:new a.aL(y,o.u_pattern_tl_b),u_pattern_br_b:new a.aL(y,o.u_pattern_br_b),u_texsize:new a.aL(y,o.u_texsize),u_mix:new a.aH(y,o.u_mix),u_pattern_size_a:new a.aL(y,o.u_pattern_size_a),u_pattern_size_b:new a.aL(y,o.u_pattern_size_b),u_scale_a:new a.aH(y,o.u_scale_a),u_scale_b:new a.aH(y,o.u_scale_b),u_pixel_coord_upper:new a.aL(y,o.u_pixel_coord_upper),u_pixel_coord_lower:new a.aL(y,o.u_pixel_coord_lower),u_tile_units_to_pixels:new a.aH(y,o.u_tile_units_to_pixels)}),terrain:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_texture:new a.aG(y,o.u_texture),u_ele_delta:new a.aH(y,o.u_ele_delta)}),terrainDepth:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_ele_delta:new a.aH(y,o.u_ele_delta)}),terrainCoords:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_texture:new a.aG(y,o.u_texture),u_terrain_coords_id:new a.aH(y,o.u_terrain_coords_id),u_ele_delta:new a.aH(y,o.u_ele_delta)})};class Jd{constructor(o,h,p){this.context=o;const m=o.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!p,this.context.unbindVAO(),o.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(o){const h=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),h.bufferSubData(h.ELEMENT_ARRAY_BUFFER,0,o.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const ps={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class gl{constructor(o,h,p,m){this.length=h.length,this.attributes=p,this.itemSize=h.bytesPerElement,this.dynamicDraw=m,this.context=o;const v=o.gl;this.buffer=v.createBuffer(),o.bindVertexBuffer.set(this.buffer),v.bufferData(v.ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?v.DYNAMIC_DRAW:v.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(o){if(o.length!==this.length)throw new Error(`Length of new data is ${o.length}, which doesn't match current length of ${this.length}`);const h=this.context.gl;this.bind(),h.bufferSubData(h.ARRAY_BUFFER,0,o.arrayBuffer)}enableAttributes(o,h){for(let p=0;p0){const dt=a.F(),gt=$e;a.aP(dt,He.placementInvProjMatrix,y.transform.glCoordMatrix),a.aP(dt,dt,He.placementViewportMatrix),V.push({circleArray:et,circleOffset:Q,transform:gt,invTransform:dt,coord:Le}),q+=et.length/4,Q=q}nt&&R.draw(M,A.LINES,wr.disabled,$r.disabled,y.colorModeForRenderPass(),jr.disabled,Lh($e,y.transform,Ge),y.style.map.terrain&&y.style.map.terrain.getTerrainData(Le),h.id,nt.layoutVertexBuffer,nt.indexBuffer,nt.segments,null,y.transform.zoom,null,null,nt.collisionVertexBuffer)}if(!E||!V.length)return;const he=y.useProgram("collisionCircle"),ue=new a.aQ;ue.resize(4*q),ue._trim();let ye=0;for(const we of V)for(let Le=0;Le=0&&(ue[se.associatedIconIndex]={shiftedAnchor:ir,angle:_t})}else qe(se.numGlyphs,Q)}if(R){he.clear();const ye=y.icon.placedSymbolArray;for(let se=0;sey.style.map.terrain.getElevation(nt,Ji,Pn):null,sn=h.layout.get("text-rotation-alignment")==="map";$(dt,nt.posMatrix,y,m,Ni,bo,se,R,sn,Ln)}const rs=y.translatePosMatrix(nt.posMatrix,et,v,E),wo=Te||m&&He||Za?Xc:Ni,An=y.translatePosMatrix(bo,et,v,E,!0),on=_t&&h.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let en;en=_t?dt.iconsInText?Pa(Xt.kind,Yt,Ue,se,y,rs,wo,An,dr,Fn):La(Xt.kind,Yt,Ue,se,y,rs,wo,An,m,dr,!0):Aa(Xt.kind,Yt,Ue,se,y,rs,wo,An,m,dr);const Ki={program:xr,buffers:gt,uniformValues:en,atlasTexture:hn,atlasTextureIcon:nn,atlasInterpolation:Rr,atlasInterpolationIcon:Oi,isSDF:_t,hasHalo:on};if(we&&dt.canOverlap){Le=!0;const Ln=gt.segments.get();for(const sn of Ln)$e.push({segments:new a.$([sn]),sortKey:sn.sortKey,state:Ki,terrainData:cr})}else $e.push({segments:gt.segments,sortKey:0,state:Ki,terrainData:cr})}Le&&$e.sort((nt,et)=>nt.sortKey-et.sortKey);for(const nt of $e){const et=nt.state;if(Q.activeTexture.set(he.TEXTURE0),et.atlasTexture.bind(et.atlasInterpolation,he.CLAMP_TO_EDGE),et.atlasTextureIcon&&(Q.activeTexture.set(he.TEXTURE1),et.atlasTextureIcon&&et.atlasTextureIcon.bind(et.atlasInterpolationIcon,he.CLAMP_TO_EDGE)),et.isSDF){const dt=et.uniformValues;et.hasHalo&&(dt.u_is_halo=1,Wh(et.buffers,nt.segments,h,y,et.program,Ge,V,q,dt,nt.terrainData)),dt.u_is_halo=0}Wh(et.buffers,nt.segments,h,y,et.program,Ge,V,q,et.uniformValues,nt.terrainData)}}function Wh(y,o,h,p,m,v,E,M,A,R){const V=p.context;m.draw(V,V.gl.TRIANGLES,v,E,M,jr.disabled,A,R,h.id,y.layoutVertexBuffer,y.indexBuffer,o,h.paint,p.transform.zoom,y.programConfigurations.get(h.id),y.dynamicLayoutVertexBuffer,y.opacityVertexBuffer)}function Ml(y,o,h,p,m){if(!h||!p||!p.imageAtlas)return;const v=p.imageAtlas.patternPositions;let E=v[h.to.toString()],M=v[h.from.toString()];if(!E&&M&&(E=M),!M&&E&&(M=E),!E||!M){const A=m.getPaintProperty(o);E=v[A],M=v[A]}E&&M&&y.setConstantPatternPositions(E,M)}function Zh(y,o,h,p,m,v,E){const M=y.context.gl,A="fill-pattern",R=h.paint.get(A),V=R&&R.constantOr(1),q=h.getCrossfadeParameters();let Q,he,ue,ye,se;E?(he=V&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Q=M.LINES):(he=V?"fillPattern":"fill",Q=M.TRIANGLES);const Te=R.constantOr(null);for(const Ue of p){const we=o.getTile(Ue);if(V&&!we.patternsLoaded())continue;const Le=we.getBucket(h);if(!Le)continue;const Ge=Le.programConfigurations.get(h.id),He=y.useProgram(he,Ge),$e=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Ue);V&&(y.context.activeTexture.set(M.TEXTURE0),we.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),Ge.updatePaintBuffers(q)),Ml(Ge,A,Te,we,h);const nt=$e?Ue:null,et=y.translatePosMatrix(nt?nt.posMatrix:Ue.posMatrix,we,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));if(E){ye=Le.indexBuffer2,se=Le.segments2;const dt=[M.drawingBufferWidth,M.drawingBufferHeight];ue=he==="fillOutlinePattern"&&V?Ah(et,y,q,we,dt):Hd(et,dt)}else ye=Le.indexBuffer,se=Le.segments,ue=V?hl(et,y,q,we):Ih(et);He.draw(y.context,Q,m,y.stencilModeForClipping(Ue),v,jr.disabled,ue,$e,h.id,Le.layoutVertexBuffer,ye,se,h.paint,y.transform.zoom,Ge)}}function Cl(y,o,h,p,m,v,E){const M=y.context,A=M.gl,R="fill-extrusion-pattern",V=h.paint.get(R),q=V.constantOr(1),Q=h.getCrossfadeParameters(),he=h.paint.get("fill-extrusion-opacity"),ue=V.constantOr(null);for(const ye of p){const se=o.getTile(ye),Te=se.getBucket(h);if(!Te)continue;const Ue=y.style.map.terrain&&y.style.map.terrain.getTerrainData(ye),we=Te.programConfigurations.get(h.id),Le=y.useProgram(q?"fillExtrusionPattern":"fillExtrusion",we);q&&(y.context.activeTexture.set(A.TEXTURE0),se.imageAtlasTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE),we.updatePaintBuffers(Q)),Ml(we,R,ue,se,h);const Ge=y.translatePosMatrix(ye.posMatrix,se,h.paint.get("fill-extrusion-translate"),h.paint.get("fill-extrusion-translate-anchor")),He=h.paint.get("fill-extrusion-vertical-gradient"),$e=q?Zd(Ge,y,He,he,ye,Q,se):Ma(Ge,y,He,he);Le.draw(M,M.gl.TRIANGLES,m,v,E,jr.backCCW,$e,Ue,h.id,Te.layoutVertexBuffer,Te.indexBuffer,Te.segments,h.paint,y.transform.zoom,we,y.style.map.terrain&&Te.centroidVertexBuffer)}}function Il(y,o,h,p,m,v,E){const M=y.context,A=M.gl,R=h.fbo;if(!R)return;const V=y.useProgram("hillshade"),q=y.style.map.terrain&&y.style.map.terrain.getTerrainData(o);M.activeTexture.set(A.TEXTURE0),A.bindTexture(A.TEXTURE_2D,R.colorAttachment.get()),V.draw(M,A.TRIANGLES,m,v,E,jr.disabled,((Q,he,ue,ye)=>{const se=ue.paint.get("hillshade-shadow-color"),Te=ue.paint.get("hillshade-highlight-color"),Ue=ue.paint.get("hillshade-accent-color");let we=ue.paint.get("hillshade-illumination-direction")*(Math.PI/180);ue.paint.get("hillshade-illumination-anchor")==="viewport"&&(we-=Q.transform.angle);const Le=!Q.options.moving;return{u_matrix:ye?ye.posMatrix:Q.transform.calculatePosMatrix(he.tileID.toUnwrapped(),Le),u_image:0,u_latrange:Dh(0,he.tileID),u_light:[ue.paint.get("hillshade-exaggeration"),we],u_shadow:se,u_highlight:Te,u_accent:Ue}})(y,h,p,q?o:null),q,p.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments)}function Kc(y,o,h,p,m,v){const E=y.context,M=E.gl,A=o.dem;if(A&&A.data){const R=A.dim,V=A.stride,q=A.getPixels();if(E.activeTexture.set(M.TEXTURE1),E.pixelStoreUnpackPremultiplyAlpha.set(!1),o.demTexture=o.demTexture||y.getTileTexture(V),o.demTexture){const he=o.demTexture;he.update(q,{premultiply:!1}),he.bind(M.NEAREST,M.CLAMP_TO_EDGE)}else o.demTexture=new re(E,q,M.RGBA,{premultiply:!1}),o.demTexture.bind(M.NEAREST,M.CLAMP_TO_EDGE);E.activeTexture.set(M.TEXTURE0);let Q=o.fbo;if(!Q){const he=new re(E,{width:R,height:R,data:null},M.RGBA);he.bind(M.LINEAR,M.CLAMP_TO_EDGE),Q=o.fbo=E.createFramebuffer(R,R,!0,!1),Q.colorAttachment.set(he.texture)}E.bindFramebuffer.set(Q.framebuffer),E.viewport.set([0,0,R,R]),y.useProgram("hillshadePrepare").draw(E,M.TRIANGLES,p,m,v,jr.disabled,((he,ue)=>{const ye=ue.stride,se=a.F();return a.aN(se,0,a.W,-a.W,0,0,1),a.H(se,se,[0,-a.W,0]),{u_matrix:se,u_image:1,u_dimension:[ye,ye],u_zoom:he.overscaledZ,u_unpack:ue.getUnpackVector()}})(o.tileID,A),null,h.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments),o.needsHillshadePrepare=!1}}function Hh(y,o,h,p,m,v){const E=p.paint.get("raster-fade-duration");if(!v&&E>0){const M=k.now(),A=(M-y.timeAdded)/E,R=o?(M-o.timeAdded)/E:-1,V=h.getSource(),q=m.coveringZoomLevel({tileSize:V.tileSize,roundZoom:V.roundZoom}),Q=!o||Math.abs(o.tileID.overscaledZ-q)>Math.abs(y.tileID.overscaledZ-q),he=Q&&y.refreshedUponExpiration?1:a.ac(Q?A:1-R,0,1);return y.refreshedUponExpiration&&A>=1&&(y.refreshedUponExpiration=!1),o?{opacity:1,mix:1-he}:{opacity:he,mix:0}}return{opacity:1,mix:0}}const $h=new a.aO(1,0,0,1),Al=new a.aO(0,1,0,1),Jc=new a.aO(0,0,1,1),sp=new a.aO(1,0,1,1),Xh=new a.aO(0,1,1,1);function cn(y,o,h,p){pi(y,0,o+h/2,y.transform.width,h,p)}function Jo(y,o,h,p){pi(y,o-h/2,0,h,y.transform.height,p)}function pi(y,o,h,p,m,v){const E=y.context,M=E.gl;M.enable(M.SCISSOR_TEST),M.scissor(o*y.pixelRatio,h*y.pixelRatio,p*y.pixelRatio,m*y.pixelRatio),E.clear({color:v}),M.disable(M.SCISSOR_TEST)}function Yc(y,o,h){const p=y.context,m=p.gl,v=h.posMatrix,E=y.useProgram("debug"),M=wr.disabled,A=$r.disabled,R=y.colorModeForRenderPass(),V="$debug",q=y.style.map.terrain&&y.style.map.terrain.getTerrainData(h);p.activeTexture.set(m.TEXTURE0);const Q=o.getTileByID(h.key).latestRawTileData,he=Math.floor((Q&&Q.byteLength||0)/1024),ue=o.getTile(h).tileSize,ye=512/Math.min(ue,512)*(h.overscaledZ/y.transform.zoom)*.5;let se=h.canonical.toString();h.overscaledZ!==h.canonical.z&&(se+=` => ${h.overscaledZ}`),function(Te,Ue){Te.initDebugOverlayCanvas();const we=Te.debugOverlayCanvas,Le=Te.context.gl,Ge=Te.debugOverlayCanvas.getContext("2d");Ge.clearRect(0,0,we.width,we.height),Ge.shadowColor="white",Ge.shadowBlur=2,Ge.lineWidth=1.5,Ge.strokeStyle="white",Ge.textBaseline="top",Ge.font="bold 36px Open Sans, sans-serif",Ge.fillText(Ue,5,5),Ge.strokeText(Ue,5,5),Te.debugOverlayTexture.update(we),Te.debugOverlayTexture.bind(Le.LINEAR,Le.CLAMP_TO_EDGE)}(y,`${se} ${he}kB`),E.draw(p,m.TRIANGLES,M,A,Sn.alphaBlended,jr.disabled,Ph(v,a.aO.transparent,ye),null,V,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),E.draw(p,m.LINE_STRIP,M,A,R,jr.disabled,Ph(v,a.aO.red),q,V,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Ll(y,o,h){const p=y.context,m=p.gl,v=y.colorModeForRenderPass(),E=new wr(m.LEQUAL,wr.ReadWrite,y.depthRangeFor3D),M=y.useProgram("terrain"),A=o.getTerrainMesh();p.bindFramebuffer.set(null),p.viewport.set([0,0,y.width,y.height]);for(const R of h){const V=y.renderToTexture.getTexture(R),q=o.getTerrainData(R.tileID);p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,V.texture);const Q={u_matrix:y.transform.calculatePosMatrix(R.tileID.toUnwrapped()),u_texture:0,u_ele_delta:o.getMeshFrameDelta(y.transform.zoom)};M.draw(p,m.TRIANGLES,E,$r.disabled,v,jr.backCCW,Q,q,"terrain",A.vertexBuffer,A.indexBuffer,A.segments)}}class Kh{constructor(o,h){this.context=new op(o),this.transform=h,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:a.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Or.maxUnderzooming+Or.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xo}resize(o,h,p){if(this.width=Math.floor(o*p),this.height=Math.floor(h*p),this.pixelRatio=p,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const o=this.context,h=new a.aV;h.emplaceBack(0,0),h.emplaceBack(a.W,0),h.emplaceBack(0,a.W),h.emplaceBack(a.W,a.W),this.tileExtentBuffer=o.createVertexBuffer(h,ll.members),this.tileExtentSegments=a.$.simpleSegment(0,0,4,2);const p=new a.aV;p.emplaceBack(0,0),p.emplaceBack(a.W,0),p.emplaceBack(0,a.W),p.emplaceBack(a.W,a.W),this.debugBuffer=o.createVertexBuffer(p,ll.members),this.debugSegments=a.$.simpleSegment(0,0,4,5);const m=new a.Z;m.emplaceBack(0,0,0,0),m.emplaceBack(a.W,0,a.W,0),m.emplaceBack(0,a.W,0,a.W),m.emplaceBack(a.W,a.W,a.W,a.W),this.rasterBoundsBuffer=o.createVertexBuffer(m,Ye.members),this.rasterBoundsSegments=a.$.simpleSegment(0,0,4,2);const v=new a.aV;v.emplaceBack(0,0),v.emplaceBack(1,0),v.emplaceBack(0,1),v.emplaceBack(1,1),this.viewportBuffer=o.createVertexBuffer(v,ll.members),this.viewportSegments=a.$.simpleSegment(0,0,4,2);const E=new a.aW;E.emplaceBack(0),E.emplaceBack(1),E.emplaceBack(3),E.emplaceBack(2),E.emplaceBack(0),this.tileBorderIndexBuffer=o.createIndexBuffer(E);const M=new a.aX;M.emplaceBack(0,1,2),M.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=o.createIndexBuffer(M);const A=this.context.gl;this.stencilClearMode=new $r({func:A.ALWAYS,mask:0},0,255,A.ZERO,A.ZERO,A.ZERO)}clearStencil(){const o=this.context,h=o.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const p=a.F();a.aN(p,0,this.width,this.height,0,0,1),a.J(p,p,[h.drawingBufferWidth,h.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(o,h.TRIANGLES,wr.disabled,this.stencilClearMode,Sn.disabled,jr.disabled,fl(p),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(o,h){if(this.currentStencilSource===o.source||!o.isTileClipped()||!h||!h.length)return;this.currentStencilSource=o.source;const p=this.context,m=p.gl;this.nextStencilID+h.length>256&&this.clearStencil(),p.setColorMode(Sn.disabled),p.setDepthMode(wr.disabled);const v=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const E of h){const M=this._tileClippingMaskIDs[E.key]=this.nextStencilID++,A=this.style.map.terrain&&this.style.map.terrain.getTerrainData(E);v.draw(p,m.TRIANGLES,wr.disabled,new $r({func:m.ALWAYS,mask:0},M,255,m.KEEP,m.KEEP,m.REPLACE),Sn.disabled,jr.disabled,fl(E.posMatrix),A,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const o=this.nextStencilID++,h=this.context.gl;return new $r({func:h.NOTEQUAL,mask:255},o,255,h.KEEP,h.KEEP,h.REPLACE)}stencilModeForClipping(o){const h=this.context.gl;return new $r({func:h.EQUAL,mask:255},this._tileClippingMaskIDs[o.key],0,h.KEEP,h.KEEP,h.REPLACE)}stencilConfigForOverlap(o){const h=this.context.gl,p=o.sort((E,M)=>M.overscaledZ-E.overscaledZ),m=p[p.length-1].overscaledZ,v=p[0].overscaledZ-m+1;if(v>1){this.currentStencilSource=void 0,this.nextStencilID+v>256&&this.clearStencil();const E={};for(let M=0;M=0;this.currentLayer--){const A=this.style._layers[p[this.currentLayer]],R=m[A.source],V=v[A.source];this._renderTileClippingMasks(A,V),this.renderLayer(this,R,A,V)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerse.source&&!se.isHidden(V)?[R.sourceCaches[se.source]]:[]),he=Q.filter(se=>se.getSource().type==="vector"),ue=Q.filter(se=>se.getSource().type!=="vector"),ye=se=>{(!q||q.getSource().maxzoomye(se)),q||ue.forEach(se=>ye(se)),q}(this.style,this.transform.zoom);A&&function(R,V,q){for(let Q=0;Q0),m&&(a.a_(h,p),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,E){const M=v.context,A=M.gl,R=Sn.unblended,V=new wr(A.LEQUAL,wr.ReadWrite,[0,1]),q=E.getTerrainMesh(),Q=E.sourceCache.getRenderableTiles(),he=v.useProgram("terrainDepth");M.bindFramebuffer.set(E.getFramebuffer("depth").framebuffer),M.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),M.clear({color:a.aO.transparent,depth:1});for(const ue of Q){const ye=E.getTerrainData(ue.tileID),se={u_matrix:v.transform.calculatePosMatrix(ue.tileID.toUnwrapped()),u_ele_delta:E.getMeshFrameDelta(v.transform.zoom)};he.draw(M,A.TRIANGLES,V,$r.disabled,R,jr.backCCW,se,ye,"terrain",q.vertexBuffer,q.indexBuffer,q.segments)}M.bindFramebuffer.set(null),M.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,E){const M=v.context,A=M.gl,R=Sn.unblended,V=new wr(A.LEQUAL,wr.ReadWrite,[0,1]),q=E.getTerrainMesh(),Q=E.getCoordsTexture(),he=E.sourceCache.getRenderableTiles(),ue=v.useProgram("terrainCoords");M.bindFramebuffer.set(E.getFramebuffer("coords").framebuffer),M.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),M.clear({color:a.aO.transparent,depth:1}),E.coordsIndex=[];for(const ye of he){const se=E.getTerrainData(ye.tileID);M.activeTexture.set(A.TEXTURE0),A.bindTexture(A.TEXTURE_2D,Q.texture);const Te={u_matrix:v.transform.calculatePosMatrix(ye.tileID.toUnwrapped()),u_terrain_coords_id:(255-E.coordsIndex.length)/255,u_texture:0,u_ele_delta:E.getMeshFrameDelta(v.transform.zoom)};ue.draw(M,A.TRIANGLES,V,$r.disabled,R,jr.backCCW,Te,se,"terrain",q.vertexBuffer,q.indexBuffer,q.segments),E.coordsIndex.push(ye.tileID.key)}M.bindFramebuffer.set(null),M.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}renderLayer(o,h,p,m){if(!p.isHidden(this.transform.zoom)&&(p.type==="background"||p.type==="custom"||(m||[]).length))switch(this.id=p.id,p.type){case"symbol":(function(v,E,M,A,R){if(v.renderPass!=="translucent")return;const V=$r.disabled,q=v.colorModeForRenderPass();(M._unevaluatedLayout.hasValue("text-variable-anchor")||M._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(Q,he,ue,ye,se,Te,Ue){const we=he.transform,Le=se==="map",Ge=Te==="map";for(const He of Q){const $e=ye.getTile(He),nt=$e.getBucket(ue);if(!nt||!nt.text||!nt.text.segments.get().length)continue;const et=a.ag(nt.textSizeData,we.zoom),dt=$t($e,1,he.transform.zoom),gt=Qt(He.posMatrix,Ge,Le,he.transform,dt),ir=ue.layout.get("icon-text-fit")!=="none"&&nt.hasIconData();if(et){const _t=Math.pow(2,we.zoom-$e.tileID.overscaledZ);kl(nt,Le,Ge,Ue,we,gt,He.posMatrix,_t,et,ir,he.style.map.terrain?(Xt,or)=>he.style.map.terrain.getElevation(He,Xt,or):null)}}}(A,v,M,E,M.layout.get("text-rotation-alignment"),M.layout.get("text-pitch-alignment"),R),M.paint.get("icon-opacity").constantOr(1)!==0&&El(v,E,M,A,!1,M.paint.get("icon-translate"),M.paint.get("icon-translate-anchor"),M.layout.get("icon-rotation-alignment"),M.layout.get("icon-pitch-alignment"),M.layout.get("icon-keep-upright"),V,q),M.paint.get("text-opacity").constantOr(1)!==0&&El(v,E,M,A,!0,M.paint.get("text-translate"),M.paint.get("text-translate-anchor"),M.layout.get("text-rotation-alignment"),M.layout.get("text-pitch-alignment"),M.layout.get("text-keep-upright"),V,q),E.map.showCollisionBoxes&&(Sl(v,E,M,A,M.paint.get("text-translate"),M.paint.get("text-translate-anchor"),!0),Sl(v,E,M,A,M.paint.get("icon-translate"),M.paint.get("icon-translate-anchor"),!1))})(o,h,p,m,this.style.placement.variableOffsets);break;case"circle":(function(v,E,M,A){if(v.renderPass!=="translucent")return;const R=M.paint.get("circle-opacity"),V=M.paint.get("circle-stroke-width"),q=M.paint.get("circle-stroke-opacity"),Q=!M.layout.get("circle-sort-key").isConstant();if(R.constantOr(1)===0&&(V.constantOr(1)===0||q.constantOr(1)===0))return;const he=v.context,ue=he.gl,ye=v.depthModeForSublayer(0,wr.ReadOnly),se=$r.disabled,Te=v.colorModeForRenderPass(),Ue=[];for(let we=0;wewe.sortKey-Le.sortKey);for(const we of Ue){const{programConfiguration:Le,program:Ge,layoutVertexBuffer:He,indexBuffer:$e,uniformValues:nt,terrainData:et}=we.state;Ge.draw(he,ue.TRIANGLES,ye,se,Te,jr.disabled,nt,et,M.id,He,$e,we.segments,M.paint,v.transform.zoom,Le)}})(o,h,p,m);break;case"heatmap":(function(v,E,M,A){if(M.paint.get("heatmap-opacity")!==0)if(v.renderPass==="offscreen"){const R=v.context,V=R.gl,q=$r.disabled,Q=new Sn([V.ONE,V.ONE],a.aO.transparent,[!0,!0,!0,!0]);(function(he,ue,ye){const se=he.gl;he.activeTexture.set(se.TEXTURE1),he.viewport.set([0,0,ue.width/4,ue.height/4]);let Te=ye.heatmapFbo;if(Te)se.bindTexture(se.TEXTURE_2D,Te.colorAttachment.get()),he.bindFramebuffer.set(Te.framebuffer);else{const Ue=se.createTexture();se.bindTexture(se.TEXTURE_2D,Ue),se.texParameteri(se.TEXTURE_2D,se.TEXTURE_WRAP_S,se.CLAMP_TO_EDGE),se.texParameteri(se.TEXTURE_2D,se.TEXTURE_WRAP_T,se.CLAMP_TO_EDGE),se.texParameteri(se.TEXTURE_2D,se.TEXTURE_MIN_FILTER,se.LINEAR),se.texParameteri(se.TEXTURE_2D,se.TEXTURE_MAG_FILTER,se.LINEAR),Te=ye.heatmapFbo=he.createFramebuffer(ue.width/4,ue.height/4,!1,!1),function(we,Le,Ge,He){var $e,nt;const et=we.gl,dt=($e=we.HALF_FLOAT)!==null&&$e!==void 0?$e:et.UNSIGNED_BYTE,gt=(nt=we.RGBA16F)!==null&&nt!==void 0?nt:et.RGBA;et.texImage2D(et.TEXTURE_2D,0,gt,Le.width/4,Le.height/4,0,et.RGBA,dt,null),He.colorAttachment.set(Ge)}(he,ue,Ue,Te)}})(R,v,M),R.clear({color:a.aO.transparent});for(let he=0;he{const we=a.F();a.aN(we,0,ye.width,ye.height,0,0,1);const Le=ye.context.gl;return{u_matrix:we,u_world:[Le.drawingBufferWidth,Le.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:se.paint.get("heatmap-opacity")}})(R,V),null,V.id,R.viewportBuffer,R.quadTriangleIndexBuffer,R.viewportSegments,V.paint,R.transform.zoom)}(v,M))})(o,h,p,m);break;case"line":(function(v,E,M,A){if(v.renderPass!=="translucent")return;const R=M.paint.get("line-opacity"),V=M.paint.get("line-width");if(R.constantOr(1)===0||V.constantOr(1)===0)return;const q=v.depthModeForSublayer(0,wr.ReadOnly),Q=v.colorModeForRenderPass(),he=M.paint.get("line-dasharray"),ue=M.paint.get("line-pattern"),ye=ue.constantOr(1),se=M.paint.get("line-gradient"),Te=M.getCrossfadeParameters(),Ue=ye?"linePattern":he?"lineSDF":se?"lineGradient":"line",we=v.context,Le=we.gl;let Ge=!0;for(const He of A){const $e=E.getTile(He);if(ye&&!$e.patternsLoaded())continue;const nt=$e.getBucket(M);if(!nt)continue;const et=nt.programConfigurations.get(M.id),dt=v.context.program.get(),gt=v.useProgram(Ue,et),ir=Ge||gt.program!==dt,_t=v.style.map.terrain&&v.style.map.terrain.getTerrainData(He),Xt=ue.constantOr(null);if(Xt&&$e.imageAtlas){const Yt=$e.imageAtlas,cr=Yt.patternPositions[Xt.to.toString()],dr=Yt.patternPositions[Xt.from.toString()];cr&&dr&&et.setConstantPatternPositions(cr,dr)}const or=_t?He:null,xr=ye?ds(v,$e,M,Te,or):he?pl(v,$e,M,he,Te,or):se?Rh(v,$e,M,nt.lineClipsArray.length,or):dl(v,$e,M,or);if(ye)we.activeTexture.set(Le.TEXTURE0),$e.imageAtlasTexture.bind(Le.LINEAR,Le.CLAMP_TO_EDGE),et.updatePaintBuffers(Te);else if(he&&(ir||v.lineAtlas.dirty))we.activeTexture.set(Le.TEXTURE0),v.lineAtlas.bind(we);else if(se){const Yt=nt.gradients[M.id];let cr=Yt.texture;if(M.gradientVersion!==Yt.version){let dr=256;if(M.stepInterpolant){const hn=E.getSource().maxzoom,Rr=He.canonical.z===hn?Math.ceil(1<0?h.pop():null}isPatternMissing(o){if(!o)return!1;if(!o.from||!o.to)return!0;const h=this.imageManager.getPattern(o.from.toString()),p=this.imageManager.getPattern(o.to.toString());return!h||!p}useProgram(o,h){this.cache=this.cache||{};const p=o+(h?h.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[p]||(this.cache[p]=new Ko(this.context,Ea[o],h,Bh[o],this._showOverdrawInspector,this.style.map.terrain)),this.cache[p]}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 o=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(o.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new re(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:o,drawingBufferHeight:h}=this.context.gl;return this.width!==o||this.height!==h}}class Yo{constructor(o,h){this.points=o,this.planes=h}static fromInvProjectionMatrix(o,h,p){const m=Math.pow(2,p),v=[[-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(M=>{const A=1/(M=a.af([],M,o))[3]/h*m;return a.a$(M,M,[A,A,1/M[3],A])}),E=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(M=>{const A=function(Q,he){var ue=he[0],ye=he[1],se=he[2],Te=ue*ue+ye*ye+se*se;return Te>0&&(Te=1/Math.sqrt(Te)),Q[0]=he[0]*Te,Q[1]=he[1]*Te,Q[2]=he[2]*Te,Q}([],function(Q,he,ue){var ye=he[0],se=he[1],Te=he[2],Ue=ue[0],we=ue[1],Le=ue[2];return Q[0]=se*Le-Te*we,Q[1]=Te*Ue-ye*Le,Q[2]=ye*we-se*Ue,Q}([],Y([],v[M[0]],v[M[1]]),Y([],v[M[2]],v[M[1]]))),R=-((V=A)[0]*(q=v[M[1]])[0]+V[1]*q[1]+V[2]*q[2]);var V,q;return A.concat(R)});return new Yo(v,E)}}class Qo{constructor(o,h){this.min=o,this.max=h,this.center=function(p,m,v){return p[0]=.5*m[0],p[1]=.5*m[1],p[2]=.5*m[2],p}([],function(p,m,v){return p[0]=m[0]+v[0],p[1]=m[1]+v[1],p[2]=m[2]+v[2],p}([],this.min,this.max))}quadrant(o){const h=[o%2==0,o<2],p=me(this.min),m=me(this.max);for(let v=0;v=0&&E++;if(E===0)return 0;E!==h.length&&(p=!1)}if(p)return 2;for(let m=0;m<3;m++){let v=Number.MAX_VALUE,E=-Number.MAX_VALUE;for(let M=0;Mthis.max[m]-this.min[m])return 0}return 1}}class Ws{constructor(o=0,h=0,p=0,m=0){if(isNaN(o)||o<0||isNaN(h)||h<0||isNaN(p)||p<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=o,this.bottom=h,this.left=p,this.right=m}interpolate(o,h,p){return h.top!=null&&o.top!=null&&(this.top=a.z.number(o.top,h.top,p)),h.bottom!=null&&o.bottom!=null&&(this.bottom=a.z.number(o.bottom,h.bottom,p)),h.left!=null&&o.left!=null&&(this.left=a.z.number(o.left,h.left,p)),h.right!=null&&o.right!=null&&(this.right=a.z.number(o.right,h.right,p)),this}getCenter(o,h){const p=a.ac((this.left+o-this.right)/2,0,o),m=a.ac((this.top+h-this.bottom)/2,0,h);return new a.P(p,m)}equals(o){return this.top===o.top&&this.bottom===o.bottom&&this.left===o.left&&this.right===o.right}clone(){return new Ws(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Qc=85.051129;class Pl{constructor(o,h,p,m,v){this.tileSize=512,this._renderWorldCopies=v===void 0||!!v,this._minZoom=o||0,this._maxZoom=h||22,this._minPitch=p??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Ws,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const o=new Pl(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return o.apply(this),o}apply(o){this.tileSize=o.tileSize,this.latRange=o.latRange,this.width=o.width,this.height=o.height,this._center=o._center,this._elevation=o._elevation,this.minElevationForCurrentTile=o.minElevationForCurrentTile,this.zoom=o.zoom,this.angle=o.angle,this._fov=o._fov,this._pitch=o._pitch,this._unmodified=o._unmodified,this._edgeInsets=o._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(o){this._minZoom!==o&&(this._minZoom=o,this.zoom=Math.max(this.zoom,o))}get maxZoom(){return this._maxZoom}set maxZoom(o){this._maxZoom!==o&&(this._maxZoom=o,this.zoom=Math.min(this.zoom,o))}get minPitch(){return this._minPitch}set minPitch(o){this._minPitch!==o&&(this._minPitch=o,this.pitch=Math.max(this.pitch,o))}get maxPitch(){return this._maxPitch}set maxPitch(o){this._maxPitch!==o&&(this._maxPitch=o,this.pitch=Math.min(this.pitch,o))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(o){o===void 0?o=!0:o===null&&(o=!1),this._renderWorldCopies=o}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(o){const h=-a.b1(o,-180,180)*Math.PI/180;this.angle!==h&&(this._unmodified=!1,this.angle=h,this._calcMatrices(),this.rotationMatrix=function(){var p=new a.A(4);return a.A!=Float32Array&&(p[1]=0,p[2]=0),p[0]=1,p[3]=1,p}(),function(p,m,v){var E=m[0],M=m[1],A=m[2],R=m[3],V=Math.sin(v),q=Math.cos(v);p[0]=E*q+A*V,p[1]=M*q+R*V,p[2]=E*-V+A*q,p[3]=M*-V+R*q}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(o){const h=a.ac(o,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==h&&(this._unmodified=!1,this._pitch=h,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(o){o=Math.max(.01,Math.min(60,o)),this._fov!==o&&(this._unmodified=!1,this._fov=o/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(o){const h=Math.min(Math.max(o,this.minZoom),this.maxZoom);this._zoom!==h&&(this._unmodified=!1,this._zoom=h,this.tileZoom=Math.max(0,Math.floor(h)),this.scale=this.zoomScale(h),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(o){o.lat===this._center.lat&&o.lng===this._center.lng||(this._unmodified=!1,this._center=o,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(o){o!==this._elevation&&(this._elevation=o,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(o){this._edgeInsets.equals(o)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,o,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(o){return this._edgeInsets.equals(o)}interpolatePadding(o,h,p){this._unmodified=!1,this._edgeInsets.interpolate(o,h,p),this._constrain(),this._calcMatrices()}coveringZoomLevel(o){const h=(o.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/o.tileSize));return Math.max(0,h)}getVisibleUnwrappedCoordinates(o){const h=[new a.b2(0,o)];if(this._renderWorldCopies){const p=this.pointCoordinate(new a.P(0,0)),m=this.pointCoordinate(new a.P(this.width,0)),v=this.pointCoordinate(new a.P(this.width,this.height)),E=this.pointCoordinate(new a.P(0,this.height)),M=Math.floor(Math.min(p.x,m.x,v.x,E.x)),A=Math.floor(Math.max(p.x,m.x,v.x,E.x)),R=1;for(let V=M-R;V<=A+R;V++)V!==0&&h.push(new a.b2(V,o))}return h}coveringTiles(o){var h,p;let m=this.coveringZoomLevel(o);const v=m;if(o.minzoom!==void 0&&mo.maxzoom&&(m=o.maxzoom);const E=this.pointCoordinate(this.getCameraPoint()),M=a.Y.fromLngLat(this.center),A=Math.pow(2,m),R=[A*E.x,A*E.y,0],V=[A*M.x,A*M.y,0],q=Yo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,m);let Q=o.minzoom||0;!o.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(Q=m);const he=o.terrain?2/Math.min(this.tileSize,o.tileSize)*this.tileSize:3,ue=we=>({aabb:new Qo([we*A,0,0],[(we+1)*A,A,0]),zoom:0,x:0,y:0,wrap:we,fullyVisible:!1}),ye=[],se=[],Te=m,Ue=o.reparseOverscaled?v:m;if(this._renderWorldCopies)for(let we=1;we<=3;we++)ye.push(ue(-we)),ye.push(ue(we));for(ye.push(ue(0));ye.length>0;){const we=ye.pop(),Le=we.x,Ge=we.y;let He=we.fullyVisible;if(!He){const gt=we.aabb.intersects(q);if(gt===0)continue;He=gt===2}const $e=o.terrain?R:V,nt=we.aabb.distanceX($e),et=we.aabb.distanceY($e),dt=Math.max(Math.abs(nt),Math.abs(et));if(we.zoom===Te||dt>he+(1<=Q){const gt=Te-we.zoom,ir=R[0]-.5-(Le<>1),Xt=we.zoom+1;let or=we.aabb.quadrant(gt);if(o.terrain){const xr=new a.Q(Xt,we.wrap,Xt,ir,_t),Yt=o.terrain.getMinMaxElevation(xr),cr=(h=Yt.minElevation)!==null&&h!==void 0?h:this.elevation,dr=(p=Yt.maxElevation)!==null&&p!==void 0?p:this.elevation;or=new Qo([or.min[0],or.min[1],cr],[or.max[0],or.max[1],dr])}ye.push({aabb:or,zoom:Xt,x:ir,y:_t,wrap:we.wrap,fullyVisible:He})}}return se.sort((we,Le)=>we.distanceSq-Le.distanceSq).map(we=>we.tileID)}resize(o,h){this.width=o,this.height=h,this.pixelsToGLUnits=[2/o,-2/h],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(o){return Math.pow(2,o)}scaleZoom(o){return Math.log(o)/Math.LN2}project(o){const h=a.ac(o.lat,-85.051129,Qc);return new a.P(a.N(o.lng)*this.worldSize,a.O(h)*this.worldSize)}unproject(o){return new a.Y(o.x/this.worldSize,o.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(o){const h=this.elevation,p=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,o),v=o.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-v))return;const E=p+h-v,M=Math.cos(this._pitch)*this.cameraToCenterDistance/E/a.b3(1,m.lat),A=this.scaleZoom(M/this.tileSize);this._elevation=v,this._center=m,this.zoom=A}setLocationAtPoint(o,h){const p=this.pointCoordinate(h),m=this.pointCoordinate(this.centerPoint),v=this.locationCoordinate(o),E=new a.Y(v.x-(p.x-m.x),v.y-(p.y-m.y));this.center=this.coordinateLocation(E),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(o,h){return h?this.coordinatePoint(this.locationCoordinate(o),h.getElevationForLngLatZoom(o,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(o))}pointLocation(o,h){return this.coordinateLocation(this.pointCoordinate(o,h))}locationCoordinate(o){return a.Y.fromLngLat(o)}coordinateLocation(o){return o&&o.toLngLat()}pointCoordinate(o,h){if(h){const Q=h.pointCoordinate(o);if(Q!=null)return Q}const p=[o.x,o.y,0,1],m=[o.x,o.y,1,1];a.af(p,p,this.pixelMatrixInverse),a.af(m,m,this.pixelMatrixInverse);const v=p[3],E=m[3],M=p[1]/v,A=m[1]/E,R=p[2]/v,V=m[2]/E,q=R===V?0:(0-R)/(V-R);return new a.Y(a.z.number(p[0]/v,m[0]/E,q)/this.worldSize,a.z.number(M,A,q)/this.worldSize)}coordinatePoint(o,h=0,p=this.pixelMatrix){const m=[o.x*this.worldSize,o.y*this.worldSize,h,1];return a.af(m,m,p),new a.P(m[0]/m[3],m[1]/m[3])}getBounds(){const o=Math.max(0,this.height/2-this.getHorizon());return new at().extend(this.pointLocation(new a.P(0,o))).extend(this.pointLocation(new a.P(this.width,o))).extend(this.pointLocation(new a.P(this.width,this.height))).extend(this.pointLocation(new a.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new at([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(o){o?(this.lngRange=[o.getWest(),o.getEast()],this.latRange=[o.getSouth(),o.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Qc])}calculatePosMatrix(o,h=!1){const p=o.key,m=h?this._alignedPosMatrixCache:this._posMatrixCache;if(m[p])return m[p];const v=o.canonical,E=this.worldSize/this.zoomScale(v.z),M=v.x+Math.pow(2,v.z)*o.wrap,A=a.an(new Float64Array(16));return a.H(A,A,[M*E,v.y*E,0]),a.J(A,A,[E/a.W,E/a.W,1]),a.K(A,h?this.alignedProjMatrix:this.projMatrix,A),m[p]=new Float32Array(A),m[p]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(o,h){h=a.ac(+h,this.minZoom,this.maxZoom);const p={center:new a.M(o.lng,o.lat),zoom:h};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const we=179.9999999999;m=[-we,we]}const v=this.tileSize*this.zoomScale(p.zoom);let E=0,M=v,A=0,R=v,V=0,q=0;const{x:Q,y:he}=this.size;if(this.latRange){const we=this.latRange;E=a.O(we[1])*v,M=a.O(we[0])*v,M-EM&&(Te=M-we)}if(m){const we=(A+R)/2;let Le=ue;this._renderWorldCopies&&(Le=a.b1(ue,we-v/2,we+v/2));const Ge=Q/2;Le-GeR&&(se=R-Ge)}if(se!==void 0||Te!==void 0){const we=new a.P(se??ue,Te??ye);p.center=this.unproject.call({worldSize:v},we).wrap()}return p}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const o=this._unmodified,{center:h,zoom:p}=this.getConstrained(this.center,this.zoom);this.center=h,this.zoom=p,this._unmodified=o,this._constraining=!1}_calcMatrices(){if(!this.height)return;const o=this.centerOffset,h=this.point.x,p=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=a.b3(1,this.center.lat)*this.worldSize;let m=a.an(new Float64Array(16));a.J(m,m,[this.width/2,-this.height/2,1]),a.H(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=a.an(new Float64Array(16)),a.J(m,m,[1,-1,1]),a.H(m,m,[-1,-1,0]),a.J(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;const v=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),E=Math.min(this.elevation,this.minElevationForCurrentTile),M=v-E*this._pixelPerMeter/Math.cos(this._pitch),A=E<0?M:v,R=Math.PI/2+this._pitch,V=this._fov*(.5+o.y/this.height),q=Math.sin(V)*A/Math.sin(a.ac(Math.PI-R-V,.01,Math.PI-.01)),Q=this.getHorizon(),he=2*Math.atan(Q/this.cameraToCenterDistance)*(.5+o.y/(2*Q)),ue=Math.sin(he)*A/Math.sin(a.ac(Math.PI-R-he,.01,Math.PI-.01)),ye=Math.min(q,ue),se=1.01*(Math.cos(Math.PI/2-this._pitch)*ye+A),Te=this.height/50;m=new Float64Array(16),a.b4(m,this._fov,this.width/this.height,Te,se),m[8]=2*-o.x/this.width,m[9]=2*o.y/this.height,a.J(m,m,[1,-1,1]),a.H(m,m,[0,0,-this.cameraToCenterDistance]),a.b5(m,m,this._pitch),a.ad(m,m,this.angle),a.H(m,m,[-h,-p,0]),this.mercatorMatrix=a.J([],m,[this.worldSize,this.worldSize,this.worldSize]),a.J(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=a.K(new Float64Array(16),this.labelPlaneMatrix,m),a.H(m,m,[0,0,-this.elevation]),this.projMatrix=m,this.invProjMatrix=a.ar([],m),this.pixelMatrix3D=a.K(new Float64Array(16),this.labelPlaneMatrix,m);const Ue=this.width%2/2,we=this.height%2/2,Le=Math.cos(this.angle),Ge=Math.sin(this.angle),He=h-Math.round(h)+Le*Ue+Ge*we,$e=p-Math.round(p)+Le*we+Ge*Ue,nt=new Float64Array(m);if(a.H(nt,nt,[He>.5?He-1:He,$e>.5?$e-1:$e,0]),this.alignedProjMatrix=nt,m=a.ar(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const o=this.pointCoordinate(new a.P(0,0)),h=[o.x*this.worldSize,o.y*this.worldSize,0,1];return a.af(h,h,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const o=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.P(0,o))}getCameraQueryGeometry(o){const h=this.getCameraPoint();if(o.length===1)return[o[0],h];{let p=h.x,m=h.y,v=h.x,E=h.y;for(const M of o)p=Math.min(p,M.x),m=Math.min(m,M.y),v=Math.max(v,M.x),E=Math.max(E,M.y);return[new a.P(p,m),new a.P(v,m),new a.P(v,E),new a.P(p,E),new a.P(p,m)]}}lngLatToCameraDepth(o,h){const p=this.locationCoordinate(o),m=[p.x*this.worldSize,p.y*this.worldSize,h,1];return a.af(m,m,this.projMatrix),m[2]/m[3]}}function eu(y,o){let h,p=!1,m=null,v=null;const E=()=>{m=null,p&&(y.apply(v,h),m=setTimeout(E,o),p=!1)};return(...M)=>(p=!0,v=this,h=M,m||E(),m)}class tu{constructor(o){this._getCurrentHash=()=>{const h=window.location.hash.replace("#","");if(this._hashName){let p;return h.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(p=m)}),(p&&p[1]||"").split("/")}return h.split("/")},this._onHashChange=()=>{const h=this._getCurrentHash();if(h.length>=3&&!h.some(p=>isNaN(p))){const p=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(h[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+h[2],+h[1]],zoom:+h[0],bearing:p,pitch:+(h[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const h=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,h)}catch{}},this._updateHash=eu(this._updateHashUnthrottled,300),this._hashName=o&&encodeURIComponent(o)}addTo(o){return this._map=o,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()),delete this._map,this}getHashString(o){const h=this._map.getCenter(),p=Math.round(100*this._map.getZoom())/100,m=Math.ceil((p*Math.LN2+Math.log(512/360/.5))/Math.LN10),v=Math.pow(10,m),E=Math.round(h.lng*v)/v,M=Math.round(h.lat*v)/v,A=this._map.getBearing(),R=this._map.getPitch();let V="";if(V+=o?`/${E}/${M}/${p}`:`${p}/${M}/${E}`,(A||R)&&(V+="/"+Math.round(10*A)/10),R&&(V+=`/${Math.round(R)}`),this._hashName){const q=this._hashName;let Q=!1;const he=window.location.hash.slice(1).split("&").map(ue=>{const ye=ue.split("=")[0];return ye===q?(Q=!0,`${ye}=${V}`):ue}).filter(ue=>ue);return Q||he.push(`${q}=${V}`),`#${he.join("&")}`}return`#${V}`}}const Da={linearity:.3,easing:a.b6(0,0,.3,1)},_s=a.e({deceleration:2500,maxSpeed:1400},Da),Jh=a.e({deceleration:20,maxSpeed:1400},Da),Yh=a.e({deceleration:1e3,maxSpeed:360},Da),Qh=a.e({deceleration:1e3,maxSpeed:90},Da);class ef{constructor(o){this._map=o,this.clear()}clear(){this._inertiaBuffer=[]}record(o){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:k.now(),settings:o})}_drainInertiaBuffer(){const o=this._inertiaBuffer,h=k.now();for(;o.length>0&&h-o[0].time>160;)o.shift()}_onMoveEnd(o){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const h={zoom:0,bearing:0,pitch:0,pan:new a.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:v}of this._inertiaBuffer)h.zoom+=v.zoomDelta||0,h.bearing+=v.bearingDelta||0,h.pitch+=v.pitchDelta||0,v.panDelta&&h.pan._add(v.panDelta),v.around&&(h.around=v.around),v.pinchAround&&(h.pinchAround=v.pinchAround);const p=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(h.pan.mag()){const v=Ba(h.pan.mag(),p,a.e({},_s,o||{}));m.offset=h.pan.mult(v.amount/h.pan.mag()),m.center=this._map.transform.center,Ra(m,v)}if(h.zoom){const v=Ba(h.zoom,p,Jh);m.zoom=this._map.transform.zoom+v.amount,Ra(m,v)}if(h.bearing){const v=Ba(h.bearing,p,Yh);m.bearing=this._map.transform.bearing+a.ac(v.amount,-179,179),Ra(m,v)}if(h.pitch){const v=Ba(h.pitch,p,Qh);m.pitch=this._map.transform.pitch+v.amount,Ra(m,v)}if(m.zoom||m.bearing){const v=h.pinchAround===void 0?h.around:h.pinchAround;m.around=v?this._map.unproject(v):this._map.getCenter()}return this.clear(),a.e(m,{noMoveStart:!0})}}function Ra(y,o){(!y.duration||y.durationh.unproject(A)),M=v.reduce((A,R,V,q)=>A.add(R.div(q.length)),new a.P(0,0));super(o,{points:v,point:M,lngLats:E,lngLat:h.unproject(M),originalEvent:p}),this._defaultPrevented=!1}}class ru extends a.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(o,h,p){super(o,{originalEvent:p}),this._defaultPrevented=!1}}class no{constructor(o,h){this._map=o,this._clickTolerance=h.clickTolerance}reset(){delete this._mousedownPos}wheel(o){return this._firePreventable(new ru(o.type,this._map,o))}mousedown(o,h){return this._mousedownPos=h,this._firePreventable(new xi(o.type,this._map,o))}mouseup(o){this._map.fire(new xi(o.type,this._map,o))}click(o,h){this._mousedownPos&&this._mousedownPos.dist(h)>=this._clickTolerance||this._map.fire(new xi(o.type,this._map,o))}dblclick(o){return this._firePreventable(new xi(o.type,this._map,o))}mouseover(o){this._map.fire(new xi(o.type,this._map,o))}mouseout(o){this._map.fire(new xi(o.type,this._map,o))}touchstart(o){return this._firePreventable(new _o(o.type,this._map,o))}touchmove(o){this._map.fire(new _o(o.type,this._map,o))}touchend(o){this._map.fire(new _o(o.type,this._map,o))}touchcancel(o){this._map.fire(new _o(o.type,this._map,o))}_firePreventable(o){if(this._map.fire(o),o.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class yo{constructor(o){this._map=o}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(o){this._map.fire(new xi(o.type,this._map,o))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new xi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(o){this._delayContextMenu?this._contextMenuEvent=o:this._ignoreContextMenu||this._map.fire(new xi(o.type,this._map,o)),this._map.listens("contextmenu")&&o.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Zs{constructor(o){this._map=o}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(o){return this.transform.pointLocation(a.P.convert(o),this._map.terrain)}}class io{constructor(o,h){this._map=o,this._tr=new Zs(o),this._el=o.getCanvasContainer(),this._container=o.getContainer(),this._clickTolerance=h.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(o,h){this.isEnabled()&&o.shiftKey&&o.button===0&&(C.disableDrag(),this._startPos=this._lastPos=h,this._active=!0)}mousemoveWindow(o,h){if(!this._active)return;const p=h;if(this._lastPos.equals(p)||!this._box&&p.dist(this._startPos)v.fitScreenCoordinates(p,m,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",o)}keydown(o){this._active&&o.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",o))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(C.remove(this._box),this._box=null),C.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(o,h){return this._map.fire(new a.k(o,{originalEvent:h}))}}function ys(y,o){if(y.length!==o.length)throw new Error(`The number of touches and points are not equal - touches ${y.length}, points ${o.length}`);const h={};for(let p=0;pthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=o.timeStamp),p.length===this.numTouches&&(this.centroid=function(m){const v=new a.P(0,0);for(const E of m)v._add(E);return v.div(m.length)}(h),this.touches=ys(p,h)))}touchmove(o,h,p){if(this.aborted||!this.centroid)return;const m=ys(p,h);for(const v in this.touches){const E=m[v];(!E||E.dist(this.touches[v])>30)&&(this.aborted=!0)}}touchend(o,h,p){if((!this.centroid||o.timeStamp-this.startTime>500)&&(this.aborted=!0),p.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class nu{constructor(o){this.singleTap=new ap(o),this.numTaps=o.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(o,h,p){this.singleTap.touchstart(o,h,p)}touchmove(o,h,p){this.singleTap.touchmove(o,h,p)}touchend(o,h,p){const m=this.singleTap.touchend(o,h,p);if(m){const v=o.timeStamp-this.lastTime<500,E=!this.lastTap||this.lastTap.dist(m)<30;if(v&&E||this.reset(),this.count++,this.lastTime=o.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class lp{constructor(o){this._tr=new Zs(o),this._zoomIn=new nu({numTouches:1,numTaps:2}),this._zoomOut=new nu({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(o,h,p){this._zoomIn.touchstart(o,h,p),this._zoomOut.touchstart(o,h,p)}touchmove(o,h,p){this._zoomIn.touchmove(o,h,p),this._zoomOut.touchmove(o,h,p)}touchend(o,h,p){const m=this._zoomIn.touchend(o,h,p),v=this._zoomOut.touchend(o,h,p),E=this._tr;return m?(this._active=!0,o.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:M=>M.easeTo({duration:300,zoom:E.zoom+1,around:E.unproject(m)},{originalEvent:o})}):v?(this._active=!0,o.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:M=>M.easeTo({duration:300,zoom:E.zoom-1,around:E.unproject(v)},{originalEvent:o})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Hs{constructor(o){this._enabled=!!o.enable,this._moveStateManager=o.moveStateManager,this._clickTolerance=o.clickTolerance||1,this._moveFunction=o.move,this._activateOnStart=!!o.activateOnStart,o.assignEvents(this),this.reset()}reset(o){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(o)}_move(...o){const h=this._moveFunction(...o);if(h.bearingDelta||h.pitchDelta||h.around||h.panDelta)return this._active=!0,h}dragStart(o,h){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(o)&&(this._moveStateManager.startMove(o),this._lastPoint=h.length?h[0]:h,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(o,h){if(!this.isEnabled())return;const p=this._lastPoint;if(!p)return;if(o.preventDefault(),!this._moveStateManager.isValidMoveEvent(o))return void this.reset(o);const m=h.length?h[0]:h;return!this._moved&&m.dist(p){y.mousedown=y.dragStart,y.mousemoveWindow=y.dragMove,y.mouseup=y.dragEnd,y.contextmenu=function(o){o.preventDefault()}},$s=({enable:y,clickTolerance:o,bearingDegreesPerPixelMoved:h=.8})=>{const p=new vo({checkCorrectEvent:m=>C.mouseButton(m)===0&&m.ctrlKey||C.mouseButton(m)===2});return new Hs({clickTolerance:o,move:(m,v)=>({bearingDelta:(v.x-m.x)*h}),moveStateManager:p,enable:y,assignEvents:zl})},Xs=({enable:y,clickTolerance:o,pitchDegreesPerPixelMoved:h=-.5})=>{const p=new vo({checkCorrectEvent:m=>C.mouseButton(m)===0&&m.ctrlKey||C.mouseButton(m)===2});return new Hs({clickTolerance:o,move:(m,v)=>({pitchDelta:(v.y-m.y)*h}),moveStateManager:p,enable:y,assignEvents:zl})};class tf{constructor(o,h){this._clickTolerance=o.clickTolerance||1,this._map=h,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new a.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(o,h,p){return this._calculateTransform(o,h,p)}touchmove(o,h,p){if(this._active&&!(p.length0&&(this._active=!0);const m=ys(p,h),v=new a.P(0,0),E=new a.P(0,0);let M=0;for(const R in m){const V=m[R],q=this._touches[R];q&&(v._add(V),E._add(V.sub(q)),M++,m[R]=V)}if(this._touches=m,MMath.abs(y.x)}class of extends xt{constructor(o){super(),this._currentTouchCount=0,this._map=o}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(o,h,p){super.touchstart(o,h,p),this._currentTouchCount=p.length}_start(o){this._lastPoints=o,Rl(o[0].sub(o[1]))&&(this._valid=!1)}_move(o,h,p){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=o[0].sub(this._lastPoints[0]),v=o[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,v,p.timeStamp),this._valid?(this._lastPoints=o,this._active=!0,{pitchDelta:(m.y+v.y)/2*-.5}):void 0}gestureBeginsVertically(o,h,p){if(this._valid!==void 0)return this._valid;const m=o.mag()>=2,v=h.mag()>=2;if(!m&&!v)return;if(!m||!v)return this._firstMove===void 0&&(this._firstMove=p),p-this._firstMove<100&&void 0;const E=o.y>0==h.y>0;return Rl(o)&&Rl(h)&&E}}const cp={panStep:100,bearingStep:15,pitchStep:10};class es{constructor(o){this._tr=new Zs(o);const h=cp;this._panStep=h.panStep,this._bearingStep=h.bearingStep,this._pitchStep=h.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(o){if(o.altKey||o.ctrlKey||o.metaKey)return;let h=0,p=0,m=0,v=0,E=0;switch(o.keyCode){case 61:case 107:case 171:case 187:h=1;break;case 189:case 109:case 173:h=-1;break;case 37:o.shiftKey?p=-1:(o.preventDefault(),v=-1);break;case 39:o.shiftKey?p=1:(o.preventDefault(),v=1);break;case 38:o.shiftKey?m=1:(o.preventDefault(),E=-1);break;case 40:o.shiftKey?m=-1:(o.preventDefault(),E=1);break;default:return}return this._rotationDisabled&&(p=0,m=0),{cameraAnimation:M=>{const A=this._tr;M.easeTo({duration:300,easeId:"keyboardHandler",easing:Qr,zoom:h?Math.round(A.zoom)+h*(o.shiftKey?2:1):A.zoom,bearing:A.bearing+p*this._bearingStep,pitch:A.pitch+m*this._pitchStep,offset:[-v*this._panStep,-E*this._panStep],center:A.center},{originalEvent:o})}}}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 Qr(y){return y*(2-y)}const Oa=4.000244140625;class Bl{constructor(o,h){this._onTimeout=p=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(p)},this._map=o,this._tr=new Zs(o),this._triggerRenderFrame=h,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(o){this._defaultZoomRate=o}setWheelZoomRate(o){this._wheelZoomRate=o}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(o){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!o&&o.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(o){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!o[this._map.cooperativeGestures._bypassKey])return;let h=o.deltaMode===WheelEvent.DOM_DELTA_LINE?40*o.deltaY:o.deltaY;const p=k.now(),m=p-(this._lastWheelEventTime||0);this._lastWheelEventTime=p,h!==0&&h%Oa==0?this._type="wheel":h!==0&&Math.abs(h)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=h,this._timeout=setTimeout(this._onTimeout,40,o)):this._type||(this._type=Math.abs(m*h)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,h+=this._lastValue)),o.shiftKey&&h&&(h/=4),this._type&&(this._lastWheelEvent=o,this._delta-=h,this._active||this._start(o)),o.preventDefault()}_start(o){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 h=C.mousePos(this._map.getCanvas(),o),p=this._tr;this._around=h.y>p.transform.height/2-p.transform.getHorizon()?a.M.convert(this._aroundCenter?p.center:p.unproject(h)):a.M.convert(p.center),this._aroundPoint=p.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const o=this._tr.transform;if(this._delta!==0){const M=this._type==="wheel"&&Math.abs(this._delta)>Oa?this._wheelZoomRate:this._defaultZoomRate;let A=2/(1+Math.exp(-Math.abs(this._delta*M)));this._delta<0&&A!==0&&(A=1/A);const R=typeof this._targetZoom=="number"?o.zoomScale(this._targetZoom):o.scale;this._targetZoom=Math.min(o.maxZoom,Math.max(o.minZoom,o.scaleZoom(R*A))),this._type==="wheel"&&(this._startZoom=o.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const h=typeof this._targetZoom=="number"?this._targetZoom:o.zoom,p=this._startZoom,m=this._easing;let v,E=!1;if(this._type==="wheel"&&p&&m){const M=Math.min((k.now()-this._lastWheelEventTime)/200,1),A=m(M);v=a.z.number(p,h,A),M<1?this._frameId||(this._frameId=!0):E=!0}else v=h,E=!0;return this._active=!0,E&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!E,zoomDelta:v-o.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(o){let h=a.b7;if(this._prevEase){const p=this._prevEase,m=(k.now()-p.start)/p.duration,v=p.easing(m+.01)-p.easing(m),E=.27/Math.sqrt(v*v+1e-4)*.01,M=Math.sqrt(.0729-E*E);h=a.b6(E,M,.25,1)}return this._prevEase={start:k.now(),duration:o,easing:h},h}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ou{constructor(o,h){this._clickZoom=o,this._tapZoom=h}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 sf{constructor(o){this._tr=new Zs(o),this.reset()}reset(){this._active=!1}dblclick(o,h){return o.preventDefault(),{cameraAnimation:p=>{p.easeTo({duration:300,zoom:this._tr.zoom+(o.shiftKey?-1:1),around:this._tr.unproject(h)},{originalEvent:o})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class af{constructor(){this._tap=new nu({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(o,h,p){if(!this._swipePoint)if(this._tapTime){const m=h[0],v=o.timeStamp-this._tapTime<500,E=this._tapPoint.dist(m)<30;v&&E?p.length>0&&(this._swipePoint=m,this._swipeTouch=p[0].identifier):this.reset()}else this._tap.touchstart(o,h,p)}touchmove(o,h,p){if(this._tapTime){if(this._swipePoint){if(p[0].identifier!==this._swipeTouch)return;const m=h[0],v=m.y-this._swipePoint.y;return this._swipePoint=m,o.preventDefault(),this._active=!0,{zoomDelta:v/128}}}else this._tap.touchmove(o,h,p)}touchend(o,h,p){if(this._tapTime)this._swipePoint&&p.length===0&&this.reset();else{const m=this._tap.touchend(o,h,p);m&&(this._tapTime=o.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class lf{constructor(o,h,p){this._el=o,this._mousePan=h,this._touchPan=p}enable(o){this._inertiaOptions=o||{},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 oo{constructor(o,h,p){this._pitchWithRotate=o.pitchWithRotate,this._mouseRotate=h,this._mousePitch=p}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Na{constructor(o,h,p,m){this._el=o,this._touchZoom=h,this._touchRotate=p,this._tapDragZoom=m,this._rotationDisabled=!1,this._enabled=!0}enable(o){this._touchZoom.enable(o),this._rotationDisabled||this._touchRotate.enable(o),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 Bt{constructor(o,h){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=o,this._options=h,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const o=this._map.getCanvasContainer();o.classList.add("maplibregl-cooperative-gestures"),this._container=C.create("div","maplibregl-cooperative-gesture-screen",o);let h=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(h=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const p=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=h,this._container.appendChild(m);const v=document.createElement("div");v.className="maplibregl-mobile-message",v.textContent=p,this._container.appendChild(v),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(C.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._destoryUI()}isEnabled(){return this._enabled}touchmove(o){this._onCooperativeGesture(o.touches.length===1)}wheel(o){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!o[this._bypassKey])}_onCooperativeGesture(o){this._enabled&&o&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Gt=y=>y.zoom||y.drag||y.pitch||y.rotate;class Fl extends a.k{}function ja(y){return y.panDelta&&y.panDelta.mag()||y.zoomDelta||y.bearingDelta||y.pitchDelta}class su{constructor(o,h){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,v)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const E=m.type==="renderFrame"?void 0:m,M={needsRenderFrame:!1},A={},R={},V=m.touches,q=V?this._getMapTouches(V):void 0,Q=q?C.touchPos(this._map.getCanvas(),q):C.mousePos(this._map.getCanvas(),m);for(const{handlerName:ye,handler:se,allowed:Te}of this._handlers){if(!se.isEnabled())continue;let Ue;this._blockedByActive(R,Te,ye)?se.reset():se[v||m.type]&&(Ue=se[v||m.type](m,Q,q),this.mergeHandlerResult(M,A,Ue,ye,E),Ue&&Ue.needsRenderFrame&&this._triggerRenderFrame()),(Ue||se.isActive())&&(R[ye]=se)}const he={};for(const ye in this._previousActiveHandlers)R[ye]||(he[ye]=E);this._previousActiveHandlers=R,(Object.keys(he).length||ja(M))&&(this._changes.push([M,A,he]),this._triggerRenderFrame()),(Object.keys(R).length||ja(M))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ue}=M;ue&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ue(this._map))},this._map=o,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ef(o),this._bearingSnap=h.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(h);const p=this._el;this._listeners=[[p,"touchstart",{passive:!0}],[p,"touchmove",{passive:!1}],[p,"touchend",void 0],[p,"touchcancel",void 0],[p,"mousedown",void 0],[p,"mousemove",void 0],[p,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[p,"mouseover",void 0],[p,"mouseout",void 0],[p,"dblclick",void 0],[p,"click",void 0],[p,"keydown",{capture:!1}],[p,"keyup",void 0],[p,"wheel",{passive:!1}],[p,"contextmenu",void 0],[window,"blur",void 0]];for(const[m,v,E]of this._listeners)C.addEventListener(m,v,m===document?this.handleWindowEvent:this.handleEvent,E)}destroy(){for(const[o,h,p]of this._listeners)C.removeEventListener(o,h,o===document?this.handleWindowEvent:this.handleEvent,p)}_addDefaultHandlers(o){const h=this._map,p=h.getCanvasContainer();this._add("mapEvent",new no(h,o));const m=h.boxZoom=new io(h,o);this._add("boxZoom",m),o.interactive&&o.boxZoom&&m.enable();const v=h.cooperativeGestures=new Bt(h,o.cooperativeGestures);this._add("cooperativeGestures",v),o.cooperativeGestures&&v.enable();const E=new lp(h),M=new sf(h);h.doubleClickZoom=new ou(M,E),this._add("tapZoom",E),this._add("clickZoom",M),o.interactive&&o.doubleClickZoom&&h.doubleClickZoom.enable();const A=new af;this._add("tapDragZoom",A);const R=h.touchPitch=new of(h);this._add("touchPitch",R),o.interactive&&o.touchPitch&&h.touchPitch.enable(o.touchPitch);const V=$s(o),q=Xs(o);h.dragRotate=new oo(o,V,q),this._add("mouseRotate",V,["mousePitch"]),this._add("mousePitch",q,["mouseRotate"]),o.interactive&&o.dragRotate&&h.dragRotate.enable();const Q=(({enable:Ue,clickTolerance:we})=>{const Le=new vo({checkCorrectEvent:Ge=>C.mouseButton(Ge)===0&&!Ge.ctrlKey});return new Hs({clickTolerance:we,move:(Ge,He)=>({around:He,panDelta:He.sub(Ge)}),activateOnStart:!0,moveStateManager:Le,enable:Ue,assignEvents:zl})})(o),he=new tf(o,h);h.dragPan=new lf(p,Q,he),this._add("mousePan",Q),this._add("touchPan",he,["touchZoom","touchRotate"]),o.interactive&&o.dragPan&&h.dragPan.enable(o.dragPan);const ue=new iu,ye=new nf;h.touchZoomRotate=new Na(p,ye,ue,A),this._add("touchRotate",ue,["touchPan","touchZoom"]),this._add("touchZoom",ye,["touchPan","touchRotate"]),o.interactive&&o.touchZoomRotate&&h.touchZoomRotate.enable(o.touchZoomRotate);const se=h.scrollZoom=new Bl(h,()=>this._triggerRenderFrame());this._add("scrollZoom",se,["mousePan"]),o.interactive&&o.scrollZoom&&h.scrollZoom.enable(o.scrollZoom);const Te=h.keyboard=new es(h);this._add("keyboard",Te),o.interactive&&o.keyboard&&h.keyboard.enable(),this._add("blockableMapEvent",new yo(h))}_add(o,h,p){this._handlers.push({handlerName:o,handler:h,allowed:p}),this._handlersById[o]=h}stop(o){if(!this._updatingCamera){for(const{handler:h}of this._handlers)h.reset();this._inertia.clear(),this._fireEvents({},{},o),this._changes=[]}}isActive(){for(const{handler:o}of this._handlers)if(o.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Gt(this._eventsInProgress)||this.isZooming()}_blockedByActive(o,h,p){for(const m in o)if(m!==p&&(!h||h.indexOf(m)<0))return!0;return!1}_getMapTouches(o){const h=[];for(const p of o)this._el.contains(p.target)&&h.push(p);return h}mergeHandlerResult(o,h,p,m,v){if(!p)return;a.e(o,p);const E={handlerName:m,originalEvent:p.originalEvent||v};p.zoomDelta!==void 0&&(h.zoom=E),p.panDelta!==void 0&&(h.drag=E),p.pitchDelta!==void 0&&(h.pitch=E),p.bearingDelta!==void 0&&(h.rotate=E)}_applyChanges(){const o={},h={},p={};for(const[m,v,E]of this._changes)m.panDelta&&(o.panDelta=(o.panDelta||new a.P(0,0))._add(m.panDelta)),m.zoomDelta&&(o.zoomDelta=(o.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(o.bearingDelta=(o.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(o.pitchDelta=(o.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(o.around=m.around),m.pinchAround!==void 0&&(o.pinchAround=m.pinchAround),m.noInertia&&(o.noInertia=m.noInertia),a.e(h,v),a.e(p,E);this._updateMapTransform(o,h,p),this._changes=[]}_updateMapTransform(o,h,p){const m=this._map,v=m._getTransformForUpdate(),E=m.terrain;if(!(ja(o)||E&&this._terrainMovement))return this._fireEvents(h,p,!0);let{panDelta:M,zoomDelta:A,bearingDelta:R,pitchDelta:V,around:q,pinchAround:Q}=o;Q!==void 0&&(q=Q),m._stop(!0),q=q||m.transform.centerPoint;const he=v.pointLocation(M?q.sub(M):q);R&&(v.bearing+=R),V&&(v.pitch+=V),A&&(v.zoom+=A),E?this._terrainMovement||!h.drag&&!h.zoom?h.drag&&this._terrainMovement?v.center=v.pointLocation(v.centerPoint.sub(M)):v.setLocationAtPoint(he,q):(this._terrainMovement=!0,this._map._elevationFreeze=!0,v.setLocationAtPoint(he,q),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,v.recalculateZoom(m.terrain)})):v.setLocationAtPoint(he,q),m._applyUpdatedTransform(v),this._map._update(),o.noInertia||this._inertia.record(o),this._fireEvents(h,p,!0)}_fireEvents(o,h,p){const m=Gt(this._eventsInProgress),v=Gt(o),E={};for(const V in o){const{originalEvent:q}=o[V];this._eventsInProgress[V]||(E[`${V}start`]=q),this._eventsInProgress[V]=o[V]}!m&&v&&this._fireEvent("movestart",v.originalEvent);for(const V in E)this._fireEvent(V,E[V]);v&&this._fireEvent("move",v.originalEvent);for(const V in o){const{originalEvent:q}=o[V];this._fireEvent(V,q)}const M={};let A;for(const V in this._eventsInProgress){const{handlerName:q,originalEvent:Q}=this._eventsInProgress[V];this._handlersById[q].isActive()||(delete this._eventsInProgress[V],A=h[q]||Q,M[`${V}end`]=A)}for(const V in M)this._fireEvent(V,M[V]);const R=Gt(this._eventsInProgress);if(p&&(m||v)&&!R){this._updatingCamera=!0;const V=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),q=Q=>Q!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Fl("renderFrame",{timeStamp:o})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Si extends a.E{constructor(o,h){super(),this._renderFrameCallback=()=>{const p=Math.min((k.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(p)),p<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=o,this._bearingSnap=h.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new a.M(this.transform.center.lng,this.transform.center.lat)}setCenter(o,h){return this.jumpTo({center:o},h)}panBy(o,h,p){return o=a.P.convert(o).mult(-1),this.panTo(this.transform.center,a.e({offset:o},h),p)}panTo(o,h,p){return this.easeTo(a.e({center:o},h),p)}getZoom(){return this.transform.zoom}setZoom(o,h){return this.jumpTo({zoom:o},h),this}zoomTo(o,h,p){return this.easeTo(a.e({zoom:o},h),p)}zoomIn(o,h){return this.zoomTo(this.getZoom()+1,o,h),this}zoomOut(o,h){return this.zoomTo(this.getZoom()-1,o,h),this}getBearing(){return this.transform.bearing}setBearing(o,h){return this.jumpTo({bearing:o},h),this}getPadding(){return this.transform.padding}setPadding(o,h){return this.jumpTo({padding:o},h),this}rotateTo(o,h,p){return this.easeTo(a.e({bearing:o},h),p)}resetNorth(o,h){return this.rotateTo(0,a.e({duration:1e3},o),h),this}resetNorthPitch(o,h){return this.easeTo(a.e({bearing:0,pitch:0,duration:1e3},o),h),this}snapToNorth(o,h){return Math.abs(this.getBearing()){if(this._zooming&&(m.zoom=a.z.number(v,se,$e)),this._rotating&&(m.bearing=a.z.number(E,R,$e)),this._pitching&&(m.pitch=a.z.number(M,V,$e)),this._padding&&(m.interpolatePadding(A,q,$e),he=m.centerPoint.add(Q)),this.terrain&&!o.freezeElevation&&this._updateElevation($e),Le)m.setLocationAtPoint(Le,Ge);else{const nt=m.zoomScale(m.zoom-v),et=se>v?Math.min(2,we):Math.max(.5,we),dt=Math.pow(et,1-$e),gt=m.unproject(Te.add(Ue.mult($e*dt)).mult(nt));m.setLocationAtPoint(m.renderWorldCopies?gt.wrap():gt,he)}this._applyUpdatedTransform(m),this._fireMoveEvents(h)},$e=>{this.terrain&&this._finalizeElevation(),this._afterEase(h,$e)},o),this}_prepareEase(o,h,p={}){this._moving=!0,h||p.moving||this.fire(new a.k("movestart",o)),this._zooming&&!p.zooming&&this.fire(new a.k("zoomstart",o)),this._rotating&&!p.rotating&&this.fire(new a.k("rotatestart",o)),this._pitching&&!p.pitching&&this.fire(new a.k("pitchstart",o))}_prepareElevation(o){this._elevationCenter=o,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(o,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(o){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const h=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(o<1&&h!==this._elevationTarget){const p=this._elevationTarget-this._elevationStart;this._elevationStart+=o*(p-(h-(p*o+this._elevationStart))/(1-o)),this._elevationTarget=h}this.transform.elevation=a.z.number(this._elevationStart,this._elevationTarget,o)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(o){if(!this.transformCameraUpdate)return;const h=o.clone(),{center:p,zoom:m,pitch:v,bearing:E,elevation:M}=this.transformCameraUpdate(h);p&&(h.center=p),m!==void 0&&(h.zoom=m),v!==void 0&&(h.pitch=v),E!==void 0&&(h.bearing=E),M!==void 0&&(h.elevation=M),this.transform.apply(h)}_fireMoveEvents(o){this.fire(new a.k("move",o)),this._zooming&&this.fire(new a.k("zoom",o)),this._rotating&&this.fire(new a.k("rotate",o)),this._pitching&&this.fire(new a.k("pitch",o))}_afterEase(o,h){if(this._easeId&&h&&this._easeId===h)return;delete this._easeId;const p=this._zooming,m=this._rotating,v=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,p&&this.fire(new a.k("zoomend",o)),m&&this.fire(new a.k("rotateend",o)),v&&this.fire(new a.k("pitchend",o)),this.fire(new a.k("moveend",o))}flyTo(o,h){var p;if(!o.essential&&k.prefersReducedMotion){const xr=a.L(o,["center","zoom","bearing","pitch","around"]);return this.jumpTo(xr,h)}this.stop(),o=a.e({offset:[0,0],speed:1.2,curve:1.42,easing:a.b7},o);const m=this._getTransformForUpdate(),v=this.getZoom(),E=this.getBearing(),M=this.getPitch(),A=this.getPadding(),R="bearing"in o?this._normalizeBearing(o.bearing,E):E,V="pitch"in o?+o.pitch:M,q="padding"in o?o.padding:m.padding,Q=a.P.convert(o.offset);let he=m.centerPoint.add(Q);const ue=m.pointLocation(he),{center:ye,zoom:se}=m.getConstrained(a.M.convert(o.center||ue),(p=o.zoom)!==null&&p!==void 0?p:v);this._normalizeCenter(ye);const Te=m.zoomScale(se-v),Ue=m.project(ue),we=m.project(ye).sub(Ue);let Le=o.curve;const Ge=Math.max(m.width,m.height),He=Ge/Te,$e=we.mag();if("minZoom"in o){const xr=a.ac(Math.min(o.minZoom,v,se),m.minZoom,m.maxZoom),Yt=Ge/m.zoomScale(xr-v);Le=Math.sqrt(Yt/$e*2)}const nt=Le*Le;function et(xr){const Yt=(He*He-Ge*Ge+(xr?-1:1)*nt*nt*$e*$e)/(2*(xr?He:Ge)*nt*$e);return Math.log(Math.sqrt(Yt*Yt+1)-Yt)}function dt(xr){return(Math.exp(xr)-Math.exp(-xr))/2}function gt(xr){return(Math.exp(xr)+Math.exp(-xr))/2}const ir=et(!1);let _t=function(xr){return gt(ir)/gt(ir+Le*xr)},Xt=function(xr){return Ge*((gt(ir)*(dt(Yt=ir+Le*xr)/gt(Yt))-dt(ir))/nt)/$e;var Yt},or=(et(!0)-ir)/Le;if(Math.abs($e)<1e-6||!isFinite(or)){if(Math.abs(Ge-He)<1e-6)return this.easeTo(o,h);const xr=Heo.maxDuration&&(o.duration=0),this._zooming=!0,this._rotating=E!==R,this._pitching=V!==M,this._padding=!m.isPaddingEqual(q),this._prepareEase(h,!1),this.terrain&&this._prepareElevation(ye),this._ease(xr=>{const Yt=xr*or,cr=1/_t(Yt);m.zoom=xr===1?se:v+m.scaleZoom(cr),this._rotating&&(m.bearing=a.z.number(E,R,xr)),this._pitching&&(m.pitch=a.z.number(M,V,xr)),this._padding&&(m.interpolatePadding(A,q,xr),he=m.centerPoint.add(Q)),this.terrain&&!o.freezeElevation&&this._updateElevation(xr);const dr=xr===1?ye:m.unproject(Ue.add(we.mult(Xt(Yt))).mult(cr));m.setLocationAtPoint(m.renderWorldCopies?dr.wrap():dr,he),this._applyUpdatedTransform(m),this._fireMoveEvents(h)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(h)},o),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(o,h){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const p=this._onEaseEnd;delete this._onEaseEnd,p.call(this,h)}if(!o){const p=this.handlers;p&&p.stop(!1)}return this}_ease(o,h,p){p.animate===!1||p.duration===0?(o(1),h()):(this._easeStart=k.now(),this._easeOptions=p,this._onEaseFrame=o,this._onEaseEnd=h,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(o,h){o=a.b1(o,-180,180);const p=Math.abs(o-h);return Math.abs(o-360-h)180?-360:p<-180?360:0}queryTerrainElevation(o){return this.terrain?this.terrain.getElevationForLngLatZoom(a.M.convert(o),this.transform.tileZoom)-this.transform.elevation:null}}const au={compact:!0,customAttribution:'MapLibre'};class so{constructor(o=au){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=h=>{!h||h.sourceDataType!=="metadata"&&h.sourceDataType!=="visibility"&&h.dataType!=="style"&&h.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=o}getDefaultPosition(){return"bottom-right"}onAdd(o){return this._map=o,this._compact=this.options.compact,this._container=C.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=C.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=C.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(){C.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(o,h){const p=this._map._getUIString(`AttributionControl.${h}`);o.title=p,o.setAttribute("aria-label",p)}_updateAttributions(){if(!this._map.style)return;let o=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?o=o.concat(this.options.customAttribution.map(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&o.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const h=this._map.style.sourceCaches;for(const m in h){const v=h[m];if(v.used||v.usedForTerrain){const E=v.getSource();E.attribution&&o.indexOf(E.attribution)<0&&o.push(E.attribution)}}o=o.filter(m=>String(m).trim()),o.sort((m,v)=>m.length-v.length),o=o.filter((m,v)=>{for(let E=v+1;E=0)return!1;return!0});const p=o.join(" | ");p!==this._attribHTML&&(this._attribHTML=p,o.length?(this._innerContainer.innerHTML=p,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class cf{constructor(o={}){this._updateCompact=()=>{const h=this._container.children;if(h.length){const p=h[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&p.classList.add("maplibregl-compact"):p.classList.remove("maplibregl-compact")}},this.options=o}getDefaultPosition(){return"bottom-left"}onAdd(o){this._map=o,this._compact=this.options&&this.options.compact,this._container=C.create("div","maplibregl-ctrl");const h=C.create("a","maplibregl-ctrl-logo");return h.target="_blank",h.rel="noopener nofollow",h.href="https://maplibre.org/",h.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),h.setAttribute("rel","noopener nofollow"),this._container.appendChild(h),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){C.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Ua{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(o){const h=++this._id;return this._queue.push({callback:o,id:h,cancelled:!1}),h}remove(o){const h=this._currentlyRunning,p=h?this._queue.concat(h):this._queue;for(const m of p)if(m.id===o)return void(m.cancelled=!0)}run(o=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const h=this._currentlyRunning=this._queue;this._queue=[];for(const p of h)if(!p.cancelled&&(p.callback(o),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var un=a.X([{name:"a_pos3d",type:"Int16",components:3}]);class kn extends a.E{constructor(o){super(),this.sourceCache=o,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,o.usedForTerrain=!0,o.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(o,h){this.sourceCache.update(o,h),this._renderableTilesKeys=[];const p={};for(const m of o.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:h}))p[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),a.aN(m.posMatrix,0,a.W,0,a.W,0,1),this._tiles[m.key]=new Xn(m,this.tileSize));for(const m in this._tiles)p[m]||delete this._tiles[m]}freeRtt(o){for(const h in this._tiles){const p=this._tiles[h];(!o||p.tileID.equals(o)||p.tileID.isChildOf(o)||o.isChildOf(p.tileID))&&(p.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(o=>this.getTileByID(o))}getTileByID(o){return this._tiles[o]}getTerrainCoords(o){const h={};for(const p of this._renderableTilesKeys){const m=this._tiles[p].tileID;if(m.canonical.equals(o.canonical)){const v=o.clone();v.posMatrix=new Float64Array(16),a.aN(v.posMatrix,0,a.W,0,a.W,0,1),h[p]=v}else if(m.canonical.isChildOf(o.canonical)){const v=o.clone();v.posMatrix=new Float64Array(16);const E=m.canonical.z-o.canonical.z,M=m.canonical.x-(m.canonical.x>>E<>E<>E;a.aN(v.posMatrix,0,R,0,R,0,1),a.H(v.posMatrix,v.posMatrix,[-M*R,-A*R,0]),h[p]=v}else if(o.canonical.isChildOf(m.canonical)){const v=o.clone();v.posMatrix=new Float64Array(16);const E=o.canonical.z-m.canonical.z,M=o.canonical.x-(o.canonical.x>>E<>E<>E;a.aN(v.posMatrix,0,a.W,0,a.W,0,1),a.H(v.posMatrix,v.posMatrix,[M*R,A*R,0]),a.J(v.posMatrix,v.posMatrix,[1/2**E,1/2**E,0]),h[p]=v}}return h}getSourceTile(o,h){const p=this.sourceCache._source;let m=o.overscaledZ-this.deltaZoom;if(m>p.maxzoom&&(m=p.maxzoom),m=p.minzoom&&(!v||!v.dem);)v=this.sourceCache.getTileByID(o.scaledTo(m--).key);return v}tilesAfterTime(o=Date.now()){return Object.values(this._tiles).filter(h=>h.timeAdded>=o)}}class uf{constructor(o,h,p){this.painter=o,this.sourceCache=new kn(h),this.options=p,this.exaggeration=typeof p.exaggeration=="number"?p.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(o,h,p,m=a.W){var v;if(!(h>=0&&h=0&&po.canonical.z&&(o.canonical.z>=m?v=o.canonical.z-m:a.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const E=o.canonical.x-(o.canonical.x>>v<>v<>8<<4|v>>8,h[E+3]=0;const p=new a.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(h.buffer)),m=new re(o,p,o.gl.RGBA,{premultiply:!1});return m.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(o){this.painter.maybeDrawDepthAndCoords(!0);const h=new Uint8Array(4),p=this.painter.context,m=p.gl,v=Math.round(o.x*this.painter.pixelRatio/devicePixelRatio),E=Math.round(o.y*this.painter.pixelRatio/devicePixelRatio),M=Math.round(this.painter.height/devicePixelRatio);p.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(v,M-E-1,1,1,m.RGBA,m.UNSIGNED_BYTE,h),p.bindFramebuffer.set(null);const A=h[0]+(h[2]>>4<<8),R=h[1]+((15&h[2])<<8),V=this.coordsIndex[255-h[3]],q=V&&this.sourceCache.getTileByID(V);if(!q)return null;const Q=this._coordsTextureSize,he=(1<o.id!==h),this._recentlyUsed.push(o.id)}stampObject(o){o.stamp=++this._stamp}getOrCreateFreeObject(){for(const h of this._recentlyUsed)if(!this._objects[h].inUse)return this._objects[h];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const o=this._createObject(this._objects.length);return this._objects.push(o),o}freeObject(o){o.inUse=!1}freeAllObjects(){for(const o of this._objects)this.freeObject(o)}isFull(){return!(this._objects.length!o.inUse)===!1}}const Fo={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class lu{constructor(o,h){this.painter=o,this.terrain=h,this.pool=new Va(o.context,30,h.sourceCache.tileSize*h.qualityFactor)}destruct(){this.pool.destruct()}getTexture(o){return this.pool.getObjectForId(o.rtt[this._stacks.length-1].id).texture}prepareForRender(o,h){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=o._order.filter(p=>!o._layers[p].isHidden(h)),this._coordsDescendingInv={};for(const p in o.sourceCaches){this._coordsDescendingInv[p]={};const m=o.sourceCaches[p].getVisibleCoordinates();for(const v of m){const E=this.terrain.sourceCache.getTerrainCoords(v);for(const M in E)this._coordsDescendingInv[p][M]||(this._coordsDescendingInv[p][M]=[]),this._coordsDescendingInv[p][M].push(E[M])}}this._coordsDescendingInvStr={};for(const p of o._order){const m=o._layers[p],v=m.source;if(Fo[m.type]&&!this._coordsDescendingInvStr[v]){this._coordsDescendingInvStr[v]={};for(const E in this._coordsDescendingInv[v])this._coordsDescendingInvStr[v][E]=this._coordsDescendingInv[v][E].map(M=>M.key).sort().join()}}for(const p of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const v=this._coordsDescendingInvStr[m][p.tileID.key];v&&v!==p.rttCoords[m]&&(p.rtt=[])}}renderLayer(o){if(o.isHidden(this.painter.transform.zoom))return!1;const h=o.type,p=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===o.id;if(Fo[h]&&(this._prevType&&Fo[this._prevType]||this._stacks.push([]),this._prevType=h,this._stacks[this._stacks.length-1].push(o.id),!m))return!0;if(Fo[this._prevType]||Fo[h]&&m){this._prevType=h;const v=this._stacks.length-1,E=this._stacks[v]||[];for(const M of this._renderableTiles){if(this.pool.isFull()&&(Ll(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(M),M.rtt[v]){const R=this.pool.getObjectForId(M.rtt[v].id);if(R.stamp===M.rtt[v].stamp){this.pool.useObject(R);continue}}const A=this.pool.getOrCreateFreeObject();this.pool.useObject(A),this.pool.stampObject(A),M.rtt[v]={id:A.id,stamp:A.stamp},p.context.bindFramebuffer.set(A.fbo.framebuffer),p.context.clear({color:a.aO.transparent,stencil:0}),p.currentStencilSource=void 0;for(let R=0;R{y.touchstart=y.dragStart,y.touchmoveWindow=y.dragMove,y.touchend=y.dragEnd},hu={showCompass:!0,showZoom:!0,visualizePitch:!1};class fu{constructor(o,h,p=!1){this.mousedown=E=>{this.startMouse(a.e({},E,{ctrlKey:!0,preventDefault:()=>E.preventDefault()}),C.mousePos(this.element,E)),C.addEventListener(window,"mousemove",this.mousemove),C.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=E=>{this.moveMouse(E,C.mousePos(this.element,E))},this.mouseup=E=>{this.mouseRotate.dragEnd(E),this.mousePitch&&this.mousePitch.dragEnd(E),this.offTemp()},this.touchstart=E=>{E.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=C.touchPos(this.element,E.targetTouches)[0],this.startTouch(E,this._startPos),C.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.addEventListener(window,"touchend",this.touchend))},this.touchmove=E=>{E.targetTouches.length!==1?this.reset():(this._lastPos=C.touchPos(this.element,E.targetTouches)[0],this.moveTouch(E,this._lastPos))},this.touchend=E=>{E.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const m=o.dragRotate._mouseRotate.getClickTolerance(),v=o.dragRotate._mousePitch.getClickTolerance();this.element=h,this.mouseRotate=$s({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:E,clickTolerance:M,bearingDegreesPerPixelMoved:A=.8})=>{const R=new Et;return new Hs({clickTolerance:M,move:(V,q)=>({bearingDelta:(q.x-V.x)*A}),moveStateManager:R,enable:E,assignEvents:Ol})})({clickTolerance:m,enable:!0}),this.map=o,p&&(this.mousePitch=Xs({clickTolerance:v,enable:!0}),this.touchPitch=(({enable:E,clickTolerance:M,pitchDegreesPerPixelMoved:A=-.5})=>{const R=new Et;return new Hs({clickTolerance:M,move:(V,q)=>({pitchDelta:(q.y-V.y)*A}),moveStateManager:R,enable:E,assignEvents:Ol})})({clickTolerance:v,enable:!0})),C.addEventListener(h,"mousedown",this.mousedown),C.addEventListener(h,"touchstart",this.touchstart,{passive:!1}),C.addEventListener(h,"touchcancel",this.reset)}startMouse(o,h){this.mouseRotate.dragStart(o,h),this.mousePitch&&this.mousePitch.dragStart(o,h),C.disableDrag()}startTouch(o,h){this.touchRotate.dragStart(o,h),this.touchPitch&&this.touchPitch.dragStart(o,h),C.disableDrag()}moveMouse(o,h){const p=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(o,h)||{};if(m&&p.setBearing(p.getBearing()+m),this.mousePitch){const{pitchDelta:v}=this.mousePitch.dragMove(o,h)||{};v&&p.setPitch(p.getPitch()+v)}}moveTouch(o,h){const p=this.map,{bearingDelta:m}=this.touchRotate.dragMove(o,h)||{};if(m&&p.setBearing(p.getBearing()+m),this.touchPitch){const{pitchDelta:v}=this.touchPitch.dragMove(o,h)||{};v&&p.setPitch(p.getPitch()+v)}}off(){const o=this.element;C.removeEventListener(o,"mousedown",this.mousedown),C.removeEventListener(o,"touchstart",this.touchstart,{passive:!1}),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend),C.removeEventListener(o,"touchcancel",this.reset),this.offTemp()}offTemp(){C.enableDrag(),C.removeEventListener(window,"mousemove",this.mousemove),C.removeEventListener(window,"mouseup",this.mouseup),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend)}}let Oo;function Nl(y,o,h){const p=new a.M(y.lng,y.lat);if(y=new a.M(y.lng,y.lat),o){const m=new a.M(y.lng-360,y.lat),v=new a.M(y.lng+360,y.lat),E=h.locationPoint(y).distSqr(o);h.locationPoint(m).distSqr(o)180;){const m=h.locationPoint(y);if(m.x>=0&&m.y>=0&&m.x<=h.width&&m.y<=h.height)break;y.lng>h.center.lng?y.lng-=360:y.lng+=360}return y.lng!==p.lng&&h.locationPoint(y).y>h.height/2-h.getHorizon()?y:p}const Ga={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 jl(y,o,h){const p=y.classList;for(const m in Ga)p.remove(`maplibregl-${h}-anchor-${m}`);p.add(`maplibregl-${h}-anchor-${o}`)}class Wa extends a.E{constructor(o){if(super(),this._onKeyPress=h=>{const p=h.code,m=h.charCode||h.keyCode;p!=="Space"&&p!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=h=>{const p=h.originalEvent.target,m=this._element;this._popup&&(p===m||m.contains(p))&&this.togglePopup()},this._update=h=>{var p;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((h==null?void 0:h.type)==="terrain"||(h==null?void 0:h.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Nl(this._lngLat,this._flatPos,this._map.transform):(p=this._lngLat)===null||p===void 0?void 0:p.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let v="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?v=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(v=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let E="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?E="rotateX(0deg)":this._pitchAlignment==="map"&&(E=`rotateX(${this._map.getPitch()}deg)`),h&&h.type!=="moveend"||(this._pos=this._pos.round()),C.setTransform(this._element,`${Ga[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${E} ${v}`),k.frameAsync(new AbortController).then(()=>{this._updateOpacity(h&&h.type==="moveend")}).catch(()=>{})},this._onMove=h=>{if(!this._isDragging){const p=this._clickTolerance||this._map._clickTolerance;this._isDragging=h.point.dist(this._pointerdownPos)>=p}this._isDragging&&(this._pos=h.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 a.k("dragstart"))),this.fire(new a.k("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 a.k("dragend")),this._state="inactive"},this._addDragHandler=h=>{this._element.contains(h.originalEvent.target)&&(h.preventDefault(),this._positionDelta=h.point.sub(this._pos).add(this._offset),this._pointerdownPos=h.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=o&&o.anchor||"center",this._color=o&&o.color||"#3FB1CE",this._scale=o&&o.scale||1,this._draggable=o&&o.draggable||!1,this._clickTolerance=o&&o.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=o&&o.rotation||0,this._rotationAlignment=o&&o.rotationAlignment||"auto",this._pitchAlignment=o&&o.pitchAlignment&&o.pitchAlignment!=="auto"?o.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(o==null?void 0:o.opacity,o==null?void 0:o.opacityWhenCovered),o&&o.element)this._element=o.element,this._offset=a.P.convert(o&&o.offset||[0,0]);else{this._defaultMarker=!0,this._element=C.create("div"),this._element.setAttribute("aria-label","Map marker");const h=C.createNS("http://www.w3.org/2000/svg","svg"),p=41,m=27;h.setAttributeNS(null,"display","block"),h.setAttributeNS(null,"height",`${p}px`),h.setAttributeNS(null,"width",`${m}px`),h.setAttributeNS(null,"viewBox",`0 0 ${m} ${p}`);const v=C.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");const E=C.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"fill-rule","nonzero");const M=C.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"transform","translate(3.0, 29.0)"),M.setAttributeNS(null,"fill","#000000");const A=[{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 Te of A){const Ue=C.createNS("http://www.w3.org/2000/svg","ellipse");Ue.setAttributeNS(null,"opacity","0.04"),Ue.setAttributeNS(null,"cx","10.5"),Ue.setAttributeNS(null,"cy","5.80029008"),Ue.setAttributeNS(null,"rx",Te.rx),Ue.setAttributeNS(null,"ry",Te.ry),M.appendChild(Ue)}const R=C.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"fill",this._color);const V=C.createNS("http://www.w3.org/2000/svg","path");V.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"),R.appendChild(V);const q=C.createNS("http://www.w3.org/2000/svg","g");q.setAttributeNS(null,"opacity","0.25"),q.setAttributeNS(null,"fill","#000000");const Q=C.createNS("http://www.w3.org/2000/svg","path");Q.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"),q.appendChild(Q);const he=C.createNS("http://www.w3.org/2000/svg","g");he.setAttributeNS(null,"transform","translate(6.0, 7.0)"),he.setAttributeNS(null,"fill","#FFFFFF");const ue=C.createNS("http://www.w3.org/2000/svg","g");ue.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ye=C.createNS("http://www.w3.org/2000/svg","circle");ye.setAttributeNS(null,"fill","#000000"),ye.setAttributeNS(null,"opacity","0.25"),ye.setAttributeNS(null,"cx","5.5"),ye.setAttributeNS(null,"cy","5.5"),ye.setAttributeNS(null,"r","5.4999962");const se=C.createNS("http://www.w3.org/2000/svg","circle");se.setAttributeNS(null,"fill","#FFFFFF"),se.setAttributeNS(null,"cx","5.5"),se.setAttributeNS(null,"cy","5.5"),se.setAttributeNS(null,"r","5.4999962"),ue.appendChild(ye),ue.appendChild(se),E.appendChild(M),E.appendChild(R),E.appendChild(q),E.appendChild(he),E.appendChild(ue),h.appendChild(E),h.setAttributeNS(null,"height",p*this._scale+"px"),h.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(h),this._offset=a.P.convert(o&&o.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",h=>{h.preventDefault()}),this._element.addEventListener("mousedown",h=>{h.preventDefault()}),jl(this._element,this._anchor,"marker"),o&&o.className)for(const h of o.className.split(" "))this._element.classList.add(h);this._popup=null}addTo(o){return this.remove(),this._map=o,o.getCanvasContainer().appendChild(this._element),o.on("move",this._update),o.on("moveend",this._update),o.on("terrain",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("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),C.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(o){return this._lngLat=a.M.convert(o),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(o){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),o){if(!("offset"in o.options)){const m=Math.abs(13.5)/Math.SQRT2;o.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=o,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const o=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:o?(o.isOpen()?o.remove():(o.setLngLat(this._lngLat),o.addTo(this._map)),this):this}_updateOpacity(o=!1){var h,p;if(!(!((h=this._map)===null||h===void 0)&&h.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(o)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,v=m.terrain.depthAtPoint(this._pos),E=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,E)-v<.006)return void(this._element.style.opacity=this._opacity);const M=-this._offset.y/m.transform._pixelPerMeter,A=Math.sin(m.getPitch()*Math.PI/180)*M,R=m.terrain.depthAtPoint(new a.P(this._pos.x,this._pos.y-this._offset.y)),V=m.transform.lngLatToCameraDepth(this._lngLat,E+A)-R>.006;!((p=this._popup)===null||p===void 0)&&p.isOpen()&&V&&this._popup.remove(),this._element.style.opacity=V?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(o){return this._offset=a.P.convert(o),this._update(),this}addClassName(o){this._element.classList.add(o)}removeClassName(o){this._element.classList.remove(o)}toggleClassName(o){return this._element.classList.toggle(o)}setDraggable(o){return this._draggable=!!o,this._map&&(o?(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(o){return this._rotation=o||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(o){return this._rotationAlignment=o||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(o){return this._pitchAlignment=o&&o!=="auto"?o:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(o,h){return o===void 0&&h===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),o!==void 0&&(this._opacity=o),h!==void 0&&(this._opacityWhenCovered=h),this._map&&this._updateOpacity(!0),this}}const Ul={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Js=0,vs=!1;const Vl={maxWidth:100,unit:"metric"};function ql(y,o,h){const p=h&&h.maxWidth||100,m=y._container.clientHeight/2,v=y.unproject([0,m]),E=y.unproject([p,m]),M=v.distanceTo(E);if(h&&h.unit==="imperial"){const A=3.2808*M;A>5280?bs(o,p,A/5280,y._getUIString("ScaleControl.Miles")):bs(o,p,A,y._getUIString("ScaleControl.Feet"))}else h&&h.unit==="nautical"?bs(o,p,M/1852,y._getUIString("ScaleControl.NauticalMiles")):M>=1e3?bs(o,p,M/1e3,y._getUIString("ScaleControl.Kilometers")):bs(o,p,M,y._getUIString("ScaleControl.Meters"))}function bs(y,o,h,p){const m=function(v){const E=Math.pow(10,`${Math.floor(v)}`.length-1);let M=v/E;return M=M>=10?10:M>=5?5:M>=3?3:M>=2?2:M>=1?1:function(A){const R=Math.pow(10,Math.ceil(-Math.log(A)/Math.LN10));return Math.round(A*R)/R}(M),E*M}(h);y.style.width=o*(m/h)+"px",y.innerHTML=`${m} ${p}`}const du={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},pu=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Gl(y){if(y){if(typeof y=="number"){const o=Math.round(Math.abs(y)/Math.SQRT2);return{center:new a.P(0,0),top:new a.P(0,y),"top-left":new a.P(o,o),"top-right":new a.P(-o,o),bottom:new a.P(0,-y),"bottom-left":new a.P(o,-o),"bottom-right":new a.P(-o,-o),left:new a.P(y,0),right:new a.P(-y,0)}}if(y instanceof a.P||Array.isArray(y)){const o=a.P.convert(y);return{center:o,top:o,"top-left":o,"top-right":o,bottom:o,"bottom-left":o,"bottom-right":o,left:o,right:o}}return{center:a.P.convert(y.center||[0,0]),top:a.P.convert(y.top||[0,0]),"top-left":a.P.convert(y["top-left"]||[0,0]),"top-right":a.P.convert(y["top-right"]||[0,0]),bottom:a.P.convert(y.bottom||[0,0]),"bottom-left":a.P.convert(y["bottom-left"]||[0,0]),"bottom-right":a.P.convert(y["bottom-right"]||[0,0]),left:a.P.convert(y.left||[0,0]),right:a.P.convert(y.right||[0,0])}}return Gl(new a.P(0,0))}const hf=_;d.AJAXError=a.be,d.Evented=a.E,d.LngLat=a.M,d.MercatorCoordinate=a.Y,d.Point=a.P,d.addProtocol=a.bf,d.config=a.a,d.removeProtocol=a.bg,d.AttributionControl=so,d.BoxZoomHandler=io,d.CanvasSource=wn,d.CooperativeGesturesHandler=Bt,d.DoubleClickZoomHandler=ou,d.DragPanHandler=lf,d.DragRotateHandler=oo,d.EdgeInsets=Ws,d.FullscreenControl=class extends a.E{constructor(y={}){super(),this._onFullscreenChange=()=>{var o;let h=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((o=h==null?void 0:h.shadowRoot)===null||o===void 0)&&o.fullscreenElement;)h=h.shadowRoot.fullscreenElement;h===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,y&&y.container&&(y.container instanceof HTMLElement?this._container=y.container:a.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(y){return this._map=y,this._container||(this._container=this._map.getContainer()),this._controlContainer=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){C.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const y=this._fullscreenButton=C.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);C.create("span","maplibregl-ctrl-icon",y).setAttribute("aria-hidden","true"),y.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const y=this._getTitle();this._fullscreenButton.setAttribute("aria-label",y),this._fullscreenButton.title=y}_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 a.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new a.k("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()}},d.GeoJSONSource=We,d.GeolocateControl=class extends a.E{constructor(y){super(),this._onSuccess=o=>{if(this._map){if(this._isOutOfMapMaxBounds(o))return this._setErrorState(),this.fire(new a.k("outofmaxbounds",o)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=o,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(o),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(o),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new a.k("geolocate",o)),this._finish()}},this._updateCamera=o=>{const h=new a.M(o.coords.longitude,o.coords.latitude),p=o.coords.accuracy,m=this._map.getBearing(),v=a.e({bearing:m},this.options.fitBoundsOptions),E=at.fromLngLat(h,p);this._map.fitBounds(E,v,{geolocateSource:!0})},this._updateMarker=o=>{if(o){const h=new a.M(o.coords.longitude,o.coords.latitude);this._accuracyCircleMarker.setLngLat(h).addTo(this._map),this._userLocationDotMarker.setLngLat(h).addTo(this._map),this._accuracy=o.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=o=>{if(this._map){if(this.options.trackUserLocation)if(o.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 h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(o.code===3&&vs)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new a.k("error",o)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=o=>{if(this._map){if(this._container.addEventListener("contextmenu",h=>h.preventDefault()),this._geolocateButton=C.create("button","maplibregl-ctrl-geolocate",this._container),C.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",o===!1){a.w("Geolocation support is not available so the GeolocateControl will be disabled.");const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}else{const h=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=C.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Wa({element:this._dotElement}),this._circleElement=C.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Wa({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",h=>{h.geolocateSource||this._watchState!=="ACTIVE_LOCK"||h.originalEvent&&h.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 a.k("trackuserlocationend")))})}},this.options=a.e({},Ul,y)}onAdd(y){return this._map=y,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return a._(this,arguments,void 0,function*(o=!1){if(Oo!==void 0&&!o)return Oo;if(window.navigator.permissions===void 0)return Oo=!!window.navigator.geolocation,Oo;try{Oo=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Oo=!!window.navigator.geolocation}return Oo})}().then(o=>this._setupUI(o)),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(),C.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Js=0,vs=!1}_isOutOfMapMaxBounds(y){const o=this._map.getMaxBounds(),h=y.coords;return o&&(h.longitudeo.getEast()||h.latitudeo.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 y=this._map.getBounds(),o=y.getSouthEast(),h=y.getNorthEast(),p=o.distanceTo(h),m=Math.ceil(this._accuracy/(p/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}trigger(){if(!this._setup)return a.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 a.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Js--,vs=!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 a.k("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 a.k("trackuserlocationstart"));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 y;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Js++,Js>1?(y={maximumAge:6e5,timeout:0},vs=!0):(y=this.options.positionOptions,vs=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,y)}}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)}},d.Hash=tu,d.ImageSource=jt,d.KeyboardHandler=es,d.LngLatBounds=at,d.LogoControl=cf,d.Map=class extends Si{constructor(y){if(a.bc.mark(a.bd.create),(y=a.e({},qa,y)).minZoom!=null&&y.maxZoom!=null&&y.minZoom>y.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(y.minPitch!=null&&y.maxPitch!=null&&y.minPitch>y.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(y.minPitch!=null&&y.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(y.maxPitch!=null&&y.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Pl(y.minZoom,y.maxZoom,y.minPitch,y.maxPitch,y.renderWorldCopies),{bearingSnap:y.bearingSnap}),this._contextLost=o=>{o.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new a.k("webglcontextlost",{originalEvent:o}))},this._contextRestored=o=>{this._setupPainter(),this.resize(),this._update(),this.fire(new a.k("webglcontextrestored",{originalEvent:o}))},this._onMapScroll=o=>{if(o.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=y.interactive,this._maxTileCacheSize=y.maxTileCacheSize,this._maxTileCacheZoomLevels=y.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=y.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=y.preserveDrawingBuffer,this._antialias=y.antialias,this._trackResize=y.trackResize,this._bearingSnap=y.bearingSnap,this._refreshExpiredTiles=y.refreshExpiredTiles,this._fadeDuration=y.fadeDuration,this._crossSourceCollisions=y.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=y.collectResourceTiming,this._renderTaskQueue=new Ua,this._controls=[],this._mapId=a.a3(),this._locale=a.e({},cu,y.locale),this._clickTolerance=y.clickTolerance,this._overridePixelRatio=y.pixelRatio,this._maxCanvasSize=y.maxCanvasSize,this.transformCameraUpdate=y.transformCameraUpdate,this._imageQueueHandle=G.addThrottleControl(()=>this.isMoving()),this._requestManager=new U(y.transformRequest),typeof y.container=="string"){if(this._container=document.getElementById(y.container),!this._container)throw new Error(`Container '${y.container}' not found.`)}else{if(!(y.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=y.container}if(y.maxBounds&&this.setMaxBounds(y.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 o=!1;const h=eu(p=>{this._trackResize&&!this._removed&&this.resize(p)._update()},50);this._resizeObserver=new ResizeObserver(p=>{o?h(p):o=!0}),this._resizeObserver.observe(this._container)}this.handlers=new su(this,y),this._hash=y.hash&&new tu(typeof y.hash=="string"&&y.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:y.center,zoom:y.zoom,bearing:y.bearing,pitch:y.pitch}),y.bounds&&(this.resize(),this.fitBounds(y.bounds,a.e({},y.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=y.localIdeographFontFamily,this._validateStyle=y.validateStyle,y.style&&this.setStyle(y.style,{localIdeographFontFamily:y.localIdeographFontFamily}),y.attributionControl&&this.addControl(new so(typeof y.attributionControl=="boolean"?void 0:y.attributionControl)),y.maplibreLogo&&this.addControl(new cf,y.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new a.k(`${o.dataType}data`,o))}),this.on("dataloading",o=>{this.fire(new a.k(`${o.dataType}dataloading`,o))}),this.on("dataabort",o=>{this.fire(new a.k("sourcedataabort",o))})}_getMapId(){return this._mapId}addControl(y,o){if(o===void 0&&(o=y.getDefaultPosition?y.getDefaultPosition():"top-right"),!y||!y.onAdd)return this.fire(new a.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const h=y.onAdd(this);this._controls.push(y);const p=this._controlPositions[o];return o.indexOf("bottom")!==-1?p.insertBefore(h,p.firstChild):p.appendChild(h),this}removeControl(y){if(!y||!y.onRemove)return this.fire(new a.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const o=this._controls.indexOf(y);return o>-1&&this._controls.splice(o,1),y.onRemove(this),this}hasControl(y){return this._controls.indexOf(y)>-1}calculateCameraOptionsFromTo(y,o,h,p){return p==null&&this.terrain&&(p=this.terrain.getElevationForLngLatZoom(h,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(y,o,h,p)}resize(y){var o;const h=this._containerDimensions(),p=h[0],m=h[1],v=this._getClampedPixelRatio(p,m);if(this._resizeCanvas(p,m,v),this.painter.resize(p,m,v),this.painter.overLimit()){const M=this.painter.context.gl;this._maxCanvasSize=[M.drawingBufferWidth,M.drawingBufferHeight];const A=this._getClampedPixelRatio(p,m);this._resizeCanvas(p,m,A),this.painter.resize(p,m,A)}this.transform.resize(p,m),(o=this._requestedCameraState)===null||o===void 0||o.resize(p,m);const E=!this._moving;return E&&(this.stop(),this.fire(new a.k("movestart",y)).fire(new a.k("move",y))),this.fire(new a.k("resize",y)),E&&this.fire(new a.k("moveend",y)),this}_getClampedPixelRatio(y,o){const{0:h,1:p}=this._maxCanvasSize,m=this.getPixelRatio(),v=y*m,E=o*m;return Math.min(v>h?h/v:1,E>p?p/E:1)*m}getPixelRatio(){var y;return(y=this._overridePixelRatio)!==null&&y!==void 0?y:devicePixelRatio}setPixelRatio(y){this._overridePixelRatio=y,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(y){return this.transform.setMaxBounds(at.convert(y)),this._update()}setMinZoom(y){if((y=y??-2)>=-2&&y<=this.transform.maxZoom)return this.transform.minZoom=y,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=y,this._update(),this.getZoom()>y&&this.setZoom(y),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(y){if((y=y??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(y>=0&&y<=this.transform.maxPitch)return this.transform.minPitch=y,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(y>=this.transform.minPitch)return this.transform.maxPitch=y,this._update(),this.getPitch()>y&&this.setPitch(y),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(y){return this.transform.renderWorldCopies=y,this._update()}project(y){return this.transform.locationPoint(a.M.convert(y),this.style&&this.terrain)}unproject(y){return this.transform.pointLocation(a.P.convert(y),this.terrain)}isMoving(){var y;return this._moving||((y=this.handlers)===null||y===void 0?void 0:y.isMoving())}isZooming(){var y;return this._zooming||((y=this.handlers)===null||y===void 0?void 0:y.isZooming())}isRotating(){var y;return this._rotating||((y=this.handlers)===null||y===void 0?void 0:y.isRotating())}_createDelegatedListener(y,o,h){if(y==="mouseenter"||y==="mouseover"){let p=!1;return{layer:o,listener:h,delegates:{mousemove:v=>{const E=this.getLayer(o)?this.queryRenderedFeatures(v.point,{layers:[o]}):[];E.length?p||(p=!0,h.call(this,new xi(y,this,v.originalEvent,{features:E}))):p=!1},mouseout:()=>{p=!1}}}}if(y==="mouseleave"||y==="mouseout"){let p=!1;return{layer:o,listener:h,delegates:{mousemove:E=>{(this.getLayer(o)?this.queryRenderedFeatures(E.point,{layers:[o]}):[]).length?p=!0:p&&(p=!1,h.call(this,new xi(y,this,E.originalEvent)))},mouseout:E=>{p&&(p=!1,h.call(this,new xi(y,this,E.originalEvent)))}}}}{const p=m=>{const v=this.getLayer(o)?this.queryRenderedFeatures(m.point,{layers:[o]}):[];v.length&&(m.features=v,h.call(this,m),delete m.features)};return{layer:o,listener:h,delegates:{[y]:p}}}}on(y,o,h){if(h===void 0)return super.on(y,o);const p=this._createDelegatedListener(y,o,h);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[y]=this._delegatedListeners[y]||[],this._delegatedListeners[y].push(p);for(const m in p.delegates)this.on(m,p.delegates[m]);return this}once(y,o,h){if(h===void 0)return super.once(y,o);const p=this._createDelegatedListener(y,o,h);for(const m in p.delegates)this.once(m,p.delegates[m]);return this}off(y,o,h){return h===void 0?super.off(y,o):(this._delegatedListeners&&this._delegatedListeners[y]&&(p=>{const m=this._delegatedListeners[y];for(let v=0;vthis._updateStyle(y,o));const h=this.style&&o.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!y)),y?(this.style=new Bi(this,o||{}),this.style.setEventedParent(this,{style:this.style}),typeof y=="string"?this.style.loadURL(y,o,h):this.style.loadJSON(y,o,h),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Bi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(y,o){if(typeof y=="string"){const h=this._requestManager.transformRequest(y,"Style");a.h(h,new AbortController).then(p=>{this._updateDiff(p.data,o)}).catch(p=>{p&&this.fire(new a.j(p))})}else typeof y=="object"&&this._updateDiff(y,o)}_updateDiff(y,o){try{this.style.setState(y,o)&&this._update(!0)}catch(h){a.w(`Unable to perform style diff: ${h.message||h.error||h}. Rebuilding the style from scratch.`),this._updateStyle(y,o)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.w("There is no style added to the map.")}addSource(y,o){return this._lazyInitEmptyStyle(),this.style.addSource(y,o),this._update(!0)}isSourceLoaded(y){const o=this.style&&this.style.sourceCaches[y];if(o!==void 0)return o.loaded();this.fire(new a.j(new Error(`There is no source with ID '${y}'`)))}setTerrain(y){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),y){const o=this.style.sourceCaches[y.source];if(!o)throw new Error(`cannot load terrain, because there exists no source with ID: ${y.source}`);this.terrain===null&&o.reload();for(const h in this.style._layers){const p=this.style._layers[h];p.type==="hillshade"&&p.source===y.source&&a.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new uf(this.painter,o,y),this.painter.renderToTexture=new lu(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=h=>{h.dataType==="style"?this.terrain.sourceCache.freeRtt():h.dataType==="source"&&h.tile&&(h.sourceId!==y.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(h.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.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new a.k("terrain",{terrain:y})),this}getTerrain(){var y,o;return(o=(y=this.terrain)===null||y===void 0?void 0:y.options)!==null&&o!==void 0?o:null}areTilesLoaded(){const y=this.style&&this.style.sourceCaches;for(const o in y){const h=y[o]._tiles;for(const p in h){const m=h[p];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}removeSource(y){return this.style.removeSource(y),this._update(!0)}getSource(y){return this.style.getSource(y)}addImage(y,o,h={}){const{pixelRatio:p=1,sdf:m=!1,stretchX:v,stretchY:E,content:M}=h;if(this._lazyInitEmptyStyle(),!(o instanceof HTMLImageElement||a.b(o))){if(o.width===void 0||o.height===void 0)return this.fire(new a.j(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:A,height:R,data:V}=o,q=o;return this.style.addImage(y,{data:new a.R({width:A,height:R},new Uint8Array(V)),pixelRatio:p,stretchX:v,stretchY:E,content:M,sdf:m,version:0,userImage:q}),q.onAdd&&q.onAdd(this,y),this}}{const{width:A,height:R,data:V}=k.getImageData(o);this.style.addImage(y,{data:new a.R({width:A,height:R},V),pixelRatio:p,stretchX:v,stretchY:E,content:M,sdf:m,version:0})}}updateImage(y,o){const h=this.style.getImage(y);if(!h)return this.fire(new a.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const p=o instanceof HTMLImageElement||a.b(o)?k.getImageData(o):o,{width:m,height:v,data:E}=p;if(m===void 0||v===void 0)return this.fire(new a.j(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(m!==h.data.width||v!==h.data.height)return this.fire(new a.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const M=!(o instanceof HTMLImageElement||a.b(o));return h.data.replace(E,M),this.style.updateImage(y,h),this}getImage(y){return this.style.getImage(y)}hasImage(y){return y?!!this.style.getImage(y):(this.fire(new a.j(new Error("Missing required image id"))),!1)}removeImage(y){this.style.removeImage(y)}loadImage(y){return G.getImage(this._requestManager.transformRequest(y,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(y,o){return this._lazyInitEmptyStyle(),this.style.addLayer(y,o),this._update(!0)}moveLayer(y,o){return this.style.moveLayer(y,o),this._update(!0)}removeLayer(y){return this.style.removeLayer(y),this._update(!0)}getLayer(y){return this.style.getLayer(y)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(y,o,h){return this.style.setLayerZoomRange(y,o,h),this._update(!0)}setFilter(y,o,h={}){return this.style.setFilter(y,o,h),this._update(!0)}getFilter(y){return this.style.getFilter(y)}setPaintProperty(y,o,h,p={}){return this.style.setPaintProperty(y,o,h,p),this._update(!0)}getPaintProperty(y,o){return this.style.getPaintProperty(y,o)}setLayoutProperty(y,o,h,p={}){return this.style.setLayoutProperty(y,o,h,p),this._update(!0)}getLayoutProperty(y,o){return this.style.getLayoutProperty(y,o)}setGlyphs(y,o={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(y,o),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(y,o,h={}){return this._lazyInitEmptyStyle(),this.style.addSprite(y,o,h,p=>{p||this._update(!0)}),this}removeSprite(y){return this._lazyInitEmptyStyle(),this.style.removeSprite(y),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(y,o={}){return this._lazyInitEmptyStyle(),this.style.setSprite(y,o,h=>{h||this._update(!0)}),this}setLight(y,o={}){return this._lazyInitEmptyStyle(),this.style.setLight(y,o),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(y,o){return this.style.setFeatureState(y,o),this._update()}removeFeatureState(y,o){return this.style.removeFeatureState(y,o),this._update()}getFeatureState(y){return this.style.getFeatureState(y)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let y=0,o=0;return this._container&&(y=this._container.clientWidth||400,o=this._container.clientHeight||300),[y,o]}_setupContainer(){const y=this._container;y.classList.add("maplibregl-map");const o=this._canvasContainer=C.create("div","maplibregl-canvas-container",y);this._interactive&&o.classList.add("maplibregl-interactive"),this._canvas=C.create("canvas","maplibregl-canvas",o),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const h=this._containerDimensions(),p=this._getClampedPixelRatio(h[0],h[1]);this._resizeCanvas(h[0],h[1],p);const m=this._controlContainer=C.create("div","maplibregl-control-container",y),v=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(E=>{v[E]=C.create("div",`maplibregl-ctrl-${E} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(y,o,h){this._canvas.width=Math.floor(h*y),this._canvas.height=Math.floor(h*o),this._canvas.style.width=`${y}px`,this._canvas.style.height=`${o}px`}_setupPainter(){const y={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let o=null;this._canvas.addEventListener("webglcontextcreationerror",p=>{o={requestedAttributes:y},p&&(o.statusMessage=p.statusMessage,o.type=p.type)},{once:!0});const h=this._canvas.getContext("webgl2",y)||this._canvas.getContext("webgl",y);if(!h){const p="Failed to initialize WebGL";throw o?(o.message=p,new Error(JSON.stringify(o))):new Error(p)}this.painter=new Kh(h,this.transform),P.testSupport(h)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(y){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||y,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(y){return this._update(),this._renderTaskQueue.add(y)}_cancelRenderFrame(y){this._renderTaskQueue.remove(y)}_render(y){const o=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(y),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,v=k.now();this.style.zoomHistory.update(m,v);const E=new a.a8(m,{now:v,fadeDuration:o,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),M=E.crossFadingFactor();M===1&&M===this._crossFadingFactor||(h=!0,this._crossFadingFactor=M),this.style.update(E)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,o,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:o,showPadding:this.showPadding}),this.fire(new a.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.bc.mark(a.bd.load),this.fire(new a.k("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.k("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,a.bc.mark(a.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var y;this._hash&&this._hash.remove();for(const h of this._controls)h.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),G.removeThrottleControl(this._imageQueueHandle),(y=this._resizeObserver)===null||y===void 0||y.disconnect();const o=this.painter.context.gl.getExtension("WEBGL_lose_context");o&&o.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),C.remove(this._canvasContainer),C.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),a.bc.clearMetrics(),this._removed=!0,this.fire(new a.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,k.frameAsync(this._frameRequest).then(y=>{a.bc.frame(y),this._frameRequest=null,this._render(y)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(y){this._showTileBoundaries!==y&&(this._showTileBoundaries=y,this._update())}get showPadding(){return!!this._showPadding}set showPadding(y){this._showPadding!==y&&(this._showPadding=y,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(y){this._showCollisionBoxes!==y&&(this._showCollisionBoxes=y,y?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(y){this._showOverdrawInspector!==y&&(this._showOverdrawInspector=y,this._update())}get repaint(){return!!this._repaint}set repaint(y){this._repaint!==y&&(this._repaint=y,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(y){this._vertices=y,this._update()}get version(){return uu}getCameraTargetElevation(){return this.transform.elevation}},d.MapMouseEvent=xi,d.MapTouchEvent=_o,d.MapWheelEvent=ru,d.Marker=Wa,d.NavigationControl=class{constructor(y){this._updateZoomButtons=()=>{const o=this._map.getZoom(),h=o===this._map.getMaxZoom(),p=o===this._map.getMinZoom();this._zoomInButton.disabled=h,this._zoomOutButton.disabled=p,this._zoomInButton.setAttribute("aria-disabled",h.toString()),this._zoomOutButton.setAttribute("aria-disabled",p.toString())},this._rotateCompassArrow=()=>{const o=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=o},this._setButtonTitle=(o,h)=>{const p=this._map._getUIString(`NavigationControl.${h}`);o.title=p,o.setAttribute("aria-label",p)},this.options=a.e({},hu,y),this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",o=>o.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",o=>this._map.zoomIn({},{originalEvent:o})),C.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",o=>this._map.zoomOut({},{originalEvent:o})),C.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",o=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:o}):this._map.resetNorth({},{originalEvent:o})}),this._compassIcon=C.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(y){return this._map=y,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._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new fu(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){C.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._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(y,o){const h=C.create("button",y,this._container);return h.type="button",h.addEventListener("click",o),h}},d.Popup=class extends a.E{constructor(y){super(),this.remove=()=>(this._content&&C.remove(this._content),this._container&&(C.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 a.k("close"))),this),this._onMouseUp=o=>{this._update(o.point)},this._onMouseMove=o=>{this._update(o.point)},this._onDrag=o=>{this._update(o.point)},this._update=o=>{var h;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=C.create("div","maplibregl-popup",this._map.getContainer()),this._tip=C.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const M of this.options.className.split(" "))this._container.classList.add(M);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Nl(this._lngLat,this._flatPos,this._map.transform):(h=this._lngLat)===null||h===void 0?void 0:h.wrap(),this._trackPointer&&!o)return;const p=this._flatPos=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&o?o:this._map.transform.locationPoint(this._lngLat));let m=this.options.anchor;const v=Gl(this.options.offset);if(!m){const M=this._container.offsetWidth,A=this._container.offsetHeight;let R;R=p.y+v.bottom.ythis._map.transform.height-A?["bottom"]:[],p.xthis._map.transform.width-M/2&&R.push("right"),m=R.length===0?"bottom":R.join("-")}let E=p.add(v[m]);this.options.subpixelPositioning||(E=E.round()),C.setTransform(this._container,`${Ga[m]} translate(${E.x}px,${E.y}px)`),jl(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=a.e(Object.create(du),y)}addTo(y){return this._map&&this.remove(),this._map=y,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 a.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(y){return this._lngLat=a.M.convert(y),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(y){return this.setDOMContent(document.createTextNode(y))}setHTML(y){const o=document.createDocumentFragment(),h=document.createElement("body");let p;for(h.innerHTML=y;p=h.firstChild,p;)o.appendChild(p);return this.setDOMContent(o)}getMaxWidth(){var y;return(y=this._container)===null||y===void 0?void 0:y.style.maxWidth}setMaxWidth(y){return this.options.maxWidth=y,this._update(),this}setDOMContent(y){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=C.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(y),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(y){this._container&&this._container.classList.add(y)}removeClassName(y){this._container&&this._container.classList.remove(y)}setOffset(y){return this.options.offset=y,this._update(),this}toggleClassName(y){if(this._container)return this._container.classList.toggle(y)}setSubpixelPositioning(y){this.options.subpixelPositioning=y}_createCloseButton(){this.options.closeButton&&(this._closeButton=C.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const y=this._container.querySelector(pu);y&&y.focus()}},d.RasterDEMTileSource=br,d.RasterTileSource=ne,d.ScaleControl=class{constructor(y){this._onMove=()=>{ql(this._map,this._container,this.options)},this.setUnit=o=>{this.options.unit=o,ql(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Vl),y)}getDefaultPosition(){return"bottom-left"}onAdd(y){return this._map=y,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-scale",y.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){C.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},d.ScrollZoomHandler=Bl,d.Style=Bi,d.TerrainControl=class{constructor(y){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=y}onAdd(y){return this._map=y,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=C.create("button","maplibregl-ctrl-terrain",this._container),C.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(){C.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},d.TwoFingersTouchPitchHandler=of,d.TwoFingersTouchRotateHandler=iu,d.TwoFingersTouchZoomHandler=nf,d.TwoFingersTouchZoomRotateHandler=Na,d.VectorTileSource=it,d.VideoSource=bn,d.addSourceType=(y,o)=>a._(void 0,void 0,void 0,function*(){if(ni(y))throw new Error(`A source type called "${y}" already exists.`);((h,p)=>{Mn[h]=p})(y,o)}),d.clearPrewarmedResources=function(){const y=er;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(Vt),er=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()"))},d.getMaxParallelImageRequests=function(){return a.a.MAX_PARALLEL_IMAGE_REQUESTS},d.getRTLTextPluginStatus=function(){return ct().getRTLTextPluginStatus()},d.getVersion=function(){return hf},d.getWorkerCount=function(){return sr.workerCount},d.getWorkerUrl=function(){return a.a.WORKER_URL},d.importScriptInWorkers=function(y){return Lr().broadcast("IS",y)},d.prewarm=function(){nr().acquire(Vt)},d.setMaxParallelImageRequests=function(y){a.a.MAX_PARALLEL_IMAGE_REQUESTS=y},d.setRTLTextPlugin=function(y,o){return ct().setRTLTextPlugin(y,o)},d.setWorkerCount=function(y){sr.workerCount=y},d.setWorkerUrl=function(y){a.a.WORKER_URL=y}});var u=t;return u})})(Ob);var Pc=Ob.exports;const to=xg(Pc),l4=RS({__proto__:null,default:to},[Pc]),ic=[];function Yp(r,e){return{subscribe:Tr(r,e).subscribe}}function Tr(r,e=Mt){let t;const n=new Set;function l(a){if(Ut(r,a)&&(r=a,t)){const _=!ic.length;for(const x of n)x[1](),ic.push(x,r);if(_){for(let x=0;x{n.delete(x),n.size===0&&t&&(t(),t=null)}}return{set:l,update:u,subscribe:d}}let Ft;const jb=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&jb.decode();let Ju=null;function nh(){return(Ju===null||Ju.byteLength===0)&&(Ju=new Uint8Array(Ft.memory.buffer)),Ju}function Eo(r,e){return r=r>>>0,jb.decode(nh().subarray(r,r+e))}const As=new Array(128).fill(void 0);As.push(void 0,null,!0,!1);let ih=As.length;function Dn(r){ih===As.length&&As.push(As.length+1);const e=ih;return ih=As[e],As[e]=r,e}function Sr(r){return As[r]}function c4(r){r<132||(As[r]=ih,ih=r)}function dc(r){const e=Sr(r);return c4(r),e}function Qp(r){return r==null}let Yu=null;function u4(){return(Yu===null||Yu.byteLength===0)&&(Yu=new Float64Array(Ft.memory.buffer)),Yu}let Qu=null;function Cr(){return(Qu===null||Qu.byteLength===0)&&(Qu=new Int32Array(Ft.memory.buffer)),Qu}let aa=0;const Gf=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},h4=typeof Gf.encodeInto=="function"?function(r,e){return Gf.encodeInto(r,e)}:function(r,e){const t=Gf.encode(r);return e.set(t),{read:r.length,written:t.length}};function Rf(r,e,t){if(t===void 0){const a=Gf.encode(r),_=e(a.length,1)>>>0;return nh().subarray(_,_+a.length).set(a),aa=a.length,_}let n=r.length,l=e(n,1)>>>0;const u=nh();let d=0;for(;d127)break;u[l+d]=a}if(d!==n){d!==0&&(r=r.slice(d)),l=t(l,n,n=d+r.length*3,1)>>>0;const a=nh().subarray(l+d,l+n),_=h4(r,a);d+=_.written}return aa=d,l}function Pm(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const l=r.description;return l==null?"Symbol":`Symbol(${l})`}if(e=="function"){const l=r.name;return typeof l=="string"&&l.length>0?`Function(${l})`:"Function"}if(Array.isArray(r)){const l=r.length;let u="[";l>0&&(u+=Pm(r[0]));for(let d=1;d1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message} -${r.stack}`:n}function f4(r,e){const t=e(r.length*1,1)>>>0;return nh().set(r,t/1),aa=r.length,t}function em(r,e){try{return r.apply(this,e)}catch(t){Ft.__wbindgen_exn_store(Dn(t))}}class ld{static __wrap(e){e=e>>>0;const t=Object.create(ld.prototype);return t.__wbg_ptr=e,t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();Ft.__wbg_jsroutesnapper_free(e)}constructor(e){try{const u=Ft.__wbindgen_add_to_stack_pointer(-16),d=f4(e,Ft.__wbindgen_malloc),a=aa;Ft.jsroutesnapper_new(u,d,a);var t=Cr()[u/4+0],n=Cr()[u/4+1],l=Cr()[u/4+2];if(l)throw dc(n);return ld.__wrap(t)}finally{Ft.__wbindgen_add_to_stack_pointer(16)}}setRouteConfig(e){Ft.jsroutesnapper_setRouteConfig(this.__wbg_ptr,Dn(e))}setAreaMode(){Ft.jsroutesnapper_setAreaMode(this.__wbg_ptr)}getConfig(){let e,t;try{const u=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_getConfig(u,this.__wbg_ptr);var n=Cr()[u/4+0],l=Cr()[u/4+1];return e=n,t=l,Eo(n,l)}finally{Ft.__wbindgen_add_to_stack_pointer(16),Ft.__wbindgen_free(e,t,1)}}toFinalFeature(){try{const n=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_toFinalFeature(n,this.__wbg_ptr);var e=Cr()[n/4+0],t=Cr()[n/4+1];let l;return e!==0&&(l=Eo(e,t).slice(),Ft.__wbindgen_free(e,t*1)),l}finally{Ft.__wbindgen_add_to_stack_pointer(16)}}renderGeojson(){let e,t;try{const u=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_renderGeojson(u,this.__wbg_ptr);var n=Cr()[u/4+0],l=Cr()[u/4+1];return e=n,t=l,Eo(n,l)}finally{Ft.__wbindgen_add_to_stack_pointer(16),Ft.__wbindgen_free(e,t,1)}}toggleSnapMode(){Ft.jsroutesnapper_toggleSnapMode(this.__wbg_ptr)}onMouseMove(e,t,n){return Ft.jsroutesnapper_onMouseMove(this.__wbg_ptr,e,t,n)!==0}onClick(){Ft.jsroutesnapper_onClick(this.__wbg_ptr)}onDragStart(){return Ft.jsroutesnapper_onDragStart(this.__wbg_ptr)!==0}onMouseUp(){return Ft.jsroutesnapper_onMouseUp(this.__wbg_ptr)!==0}clearState(){Ft.jsroutesnapper_clearState(this.__wbg_ptr)}editExisting(e){try{const l=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_editExisting(l,this.__wbg_ptr,Dn(e));var t=Cr()[l/4+0],n=Cr()[l/4+1];if(n)throw dc(t)}finally{Ft.__wbindgen_add_to_stack_pointer(16)}}debugRenderGraph(){let e,t;try{const u=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_debugRenderGraph(u,this.__wbg_ptr);var n=Cr()[u/4+0],l=Cr()[u/4+1];return e=n,t=l,Eo(n,l)}finally{Ft.__wbindgen_add_to_stack_pointer(16),Ft.__wbindgen_free(e,t,1)}}debugSnappableNodes(){let e,t;try{const u=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_debugSnappableNodes(u,this.__wbg_ptr);var n=Cr()[u/4+0],l=Cr()[u/4+1];return e=n,t=l,Eo(n,l)}finally{Ft.__wbindgen_add_to_stack_pointer(16),Ft.__wbindgen_free(e,t,1)}}routeNameForWaypoints(e){let t,n;try{const S=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_routeNameForWaypoints(S,this.__wbg_ptr,Dn(e));var l=Cr()[S/4+0],u=Cr()[S/4+1],d=Cr()[S/4+2],a=Cr()[S/4+3],_=l,x=u;if(a)throw _=0,x=0,dc(d);return t=_,n=x,Eo(_,x)}finally{Ft.__wbindgen_add_to_stack_pointer(16),Ft.__wbindgen_free(t,n,1)}}addSnappedWaypoint(e,t){Ft.jsroutesnapper_addSnappedWaypoint(this.__wbg_ptr,e,t)}undo(){Ft.jsroutesnapper_undo(this.__wbg_ptr)}calculateRoute(e){let t,n;try{const S=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_calculateRoute(S,this.__wbg_ptr,Dn(e));var l=Cr()[S/4+0],u=Cr()[S/4+1],d=Cr()[S/4+2],a=Cr()[S/4+3],_=l,x=u;if(a)throw _=0,x=0,dc(d);return t=_,n=x,Eo(_,x)}finally{Ft.__wbindgen_add_to_stack_pointer(16),Ft.__wbindgen_free(t,n,1)}}getExtraNodes(e,t){let n,l;try{const k=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_getExtraNodes(k,this.__wbg_ptr,Dn(e),Dn(t));var u=Cr()[k/4+0],d=Cr()[k/4+1],a=Cr()[k/4+2],_=Cr()[k/4+3],x=u,S=d;if(_)throw x=0,S=0,dc(a);return n=x,l=S,Eo(x,S)}finally{Ft.__wbindgen_add_to_stack_pointer(16),Ft.__wbindgen_free(n,l,1)}}}async function d4(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(n){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}const t=await r.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{const t=await WebAssembly.instantiate(r,e);return t instanceof WebAssembly.Instance?{instance:t,module:r}:t}}function p4(){const r={};return r.wbg={},r.wbg.__wbindgen_string_new=function(e,t){const n=Eo(e,t);return Dn(n)},r.wbg.__wbindgen_object_drop_ref=function(e){dc(e)},r.wbg.__wbindgen_error_new=function(e,t){const n=new Error(Eo(e,t));return Dn(n)},r.wbg.__wbindgen_number_get=function(e,t){const n=Sr(t),l=typeof n=="number"?n:void 0;u4()[e/8+1]=Qp(l)?0:l,Cr()[e/4+0]=!Qp(l)},r.wbg.__wbindgen_is_object=function(e){const t=Sr(e);return typeof t=="object"&&t!==null},r.wbg.__wbindgen_is_undefined=function(e){return Sr(e)===void 0},r.wbg.__wbindgen_in=function(e,t){return Sr(e)in Sr(t)},r.wbg.__wbindgen_boolean_get=function(e){const t=Sr(e);return typeof t=="boolean"?t?1:0:2},r.wbg.__wbindgen_jsval_loose_eq=function(e,t){return Sr(e)==Sr(t)},r.wbg.__wbindgen_string_get=function(e,t){const n=Sr(t),l=typeof n=="string"?n:void 0;var u=Qp(l)?0:Rf(l,Ft.__wbindgen_malloc,Ft.__wbindgen_realloc),d=aa;Cr()[e/4+1]=d,Cr()[e/4+0]=u},r.wbg.__wbg_String_4370c5505c674d30=function(e,t){const n=String(Sr(t)),l=Rf(n,Ft.__wbindgen_malloc,Ft.__wbindgen_realloc),u=aa;Cr()[e/4+1]=u,Cr()[e/4+0]=l},r.wbg.__wbindgen_object_clone_ref=function(e){const t=Sr(e);return Dn(t)},r.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea=function(e,t){const n=Sr(e)[Sr(t)];return Dn(n)},r.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return Dn(e)},r.wbg.__wbg_stack_658279fe44541cf6=function(e,t){const n=Sr(t).stack,l=Rf(n,Ft.__wbindgen_malloc,Ft.__wbindgen_realloc),u=aa;Cr()[e/4+1]=u,Cr()[e/4+0]=l},r.wbg.__wbg_error_f851667af71bcfc6=function(e,t){let n,l;try{n=e,l=t,console.error(Eo(e,t))}finally{Ft.__wbindgen_free(n,l,1)}},r.wbg.__wbg_debug_9a6b3243fbbebb61=function(e){console.debug(Sr(e))},r.wbg.__wbg_error_788ae33f81d3b84b=function(e){console.error(Sr(e))},r.wbg.__wbg_info_2e30e8204b29d91d=function(e){console.info(Sr(e))},r.wbg.__wbg_log_1d3ae0273d8f4f8a=function(e){console.log(Sr(e))},r.wbg.__wbg_warn_d60e832f9882c1b2=function(e){console.warn(Sr(e))},r.wbg.__wbg_get_44be0491f933a435=function(e,t){const n=Sr(e)[t>>>0];return Dn(n)},r.wbg.__wbg_length_fff51ee6522a1a18=function(e){return Sr(e).length},r.wbg.__wbindgen_is_function=function(e){return typeof Sr(e)=="function"},r.wbg.__wbg_next_526fc47e980da008=function(e){const t=Sr(e).next;return Dn(t)},r.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return em(function(e){const t=Sr(e).next();return Dn(t)},arguments)},r.wbg.__wbg_done_5c1f01fb660d73b5=function(e){return Sr(e).done},r.wbg.__wbg_value_1695675138684bd5=function(e){const t=Sr(e).value;return Dn(t)},r.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return Dn(Symbol.iterator)},r.wbg.__wbg_get_97b561fb56f034b5=function(){return em(function(e,t){const n=Reflect.get(Sr(e),Sr(t));return Dn(n)},arguments)},r.wbg.__wbg_call_cb65541d95d71282=function(){return em(function(e,t){const n=Sr(e).call(Sr(t));return Dn(n)},arguments)},r.wbg.__wbg_isArray_4c24b343cb13cfb1=function(e){return Array.isArray(Sr(e))},r.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(e){let t;try{t=Sr(e)instanceof ArrayBuffer}catch{t=!1}return t},r.wbg.__wbg_buffer_085ec1f694018c4f=function(e){const t=Sr(e).buffer;return Dn(t)},r.wbg.__wbg_new_8125e318e6245eed=function(e){const t=new Uint8Array(Sr(e));return Dn(t)},r.wbg.__wbg_set_5cf90238115182c3=function(e,t,n){Sr(e).set(Sr(t),n>>>0)},r.wbg.__wbg_length_72e2208bbc0efc61=function(e){return Sr(e).length},r.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(e){let t;try{t=Sr(e)instanceof Uint8Array}catch{t=!1}return t},r.wbg.__wbindgen_debug_string=function(e,t){const n=Pm(Sr(t)),l=Rf(n,Ft.__wbindgen_malloc,Ft.__wbindgen_realloc),u=aa;Cr()[e/4+1]=u,Cr()[e/4+0]=l},r.wbg.__wbindgen_throw=function(e,t){throw new Error(Eo(e,t))},r.wbg.__wbindgen_memory=function(){const e=Ft.memory;return Dn(e)},r}function m4(r,e){return Ft=r.exports,Ub.__wbindgen_wasm_module=e,Yu=null,Qu=null,Ju=null,Ft}async function Ub(r){if(Ft!==void 0)return Ft;typeof r>"u"&&(r="/ltn/assets/route_snapper_bg.wasm");const e=p4();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:t,module:n}=await d4(await r,e);return m4(t,n)}var Li=63710088e-1,Sg={centimeters:Li*100,centimetres:Li*100,degrees:Li/111325,feet:Li*3.28084,inches:Li*39.37,kilometers:Li/1e3,kilometres:Li/1e3,meters:Li,metres:Li,miles:Li/1609.344,millimeters:Li*1e3,millimetres:Li*1e3,nauticalmiles:Li/1852,radians:1,yards:Li*1.0936},g4={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Li,yards:1.0936133},zm={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Do(r,e,t){t===void 0&&(t={});var n={type:"Feature"};return(t.id===0||t.id)&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.properties=e||{},n.geometry=r,n}function _4(r,e,t){switch(r){case"Point":return eo(e).geometry;case"LineString":return Co(e).geometry;case"Polygon":return kg(e).geometry;case"MultiPoint":return qb(e).geometry;case"MultiLineString":return Vb(e).geometry;case"MultiPolygon":return Gb(e).geometry;default:throw new Error(r+" is invalid")}}function eo(r,e,t){if(t===void 0&&(t={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!cd(r[0])||!cd(r[1]))throw new Error("coordinates must contain numbers");var n={type:"Point",coordinates:r};return Do(n,e,t)}function y4(r,e,t){return t===void 0&&(t={}),tl(r.map(function(n){return eo(n,e)}),t)}function kg(r,e,t){t===void 0&&(t={});for(var n=0,l=r;n=0))throw new Error("precision must be a positive number");var t=Math.pow(10,e||0);return Math.round(r*t)/t}function Tg(r,e){e===void 0&&(e="kilometers");var t=Sg[e];if(!t)throw new Error(e+" units is invalid");return r*t}function Rd(r,e){e===void 0&&(e="kilometers");var t=Sg[e];if(!t)throw new Error(e+" units is invalid");return r/t}function S4(r,e){return hh(Rd(r,e))}function k4(r){var e=r%360;return e<0&&(e+=360),e}function hh(r){var e=r%(2*Math.PI);return e*180/Math.PI}function Io(r){var e=r%360;return e*Math.PI/180}function T4(r,e,t){if(e===void 0&&(e="kilometers"),t===void 0&&(t="kilometers"),!(r>=0))throw new Error("length must be a positive number");return Tg(Rd(r,e),t)}function E4(r,e,t){if(e===void 0&&(e="meters"),t===void 0&&(t="kilometers"),!(r>=0))throw new Error("area must be a positive number");var n=zm[e];if(!n)throw new Error("invalid original units");var l=zm[t];if(!l)throw new Error("invalid final units");return r/n*l}function cd(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function Eg(r){return!!r&&r.constructor===Object}function M4(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(e){if(!cd(e))throw new Error("bbox must only contain numbers")})}function C4(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}const I4=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:zm,bearingToAzimuth:k4,convertArea:E4,convertLength:T4,degreesToRadians:Io,earthRadius:Li,factors:Sg,feature:Do,featureCollection:tl,geometry:_4,geometryCollection:w4,isNumber:cd,isObject:Eg,lengthToDegrees:S4,lengthToRadians:Rd,lineString:Co,lineStrings:b4,multiLineString:Vb,multiPoint:qb,multiPolygon:Gb,point:eo,points:y4,polygon:kg,polygons:v4,radiansToDegrees:hh,radiansToLength:Tg,round:x4,unitsFactors:g4,validateBBox:M4,validateId:C4},Symbol.toStringTag,{value:"Module"}));function fh(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function xc(r){if(Array.isArray(r))return r;if(r.type==="Feature"){if(r.geometry!==null)return r.geometry.coordinates}else if(r.coordinates)return r.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Fu(r,e,t){t===void 0&&(t={});var n=fh(r),l=fh(e),u=Io(l[1]-n[1]),d=Io(l[0]-n[0]),a=Io(n[1]),_=Io(l[1]),x=Math.pow(Math.sin(u/2),2)+Math.pow(Math.sin(d/2),2)*Math.cos(a)*Math.cos(_);return Tg(2*Math.atan2(Math.sqrt(x),Math.sqrt(1-x)),t.units)}function Sh(r,e,t){if(r!==null)for(var n,l,u,d,a,_,x,S=0,k=0,C,P=r.type,D=P==="FeatureCollection",N=P==="Feature",z=D?r.features.length:1,B=0;B_||D>x||N>S){a=k,_=n,x=D,S=N,u=0;return}var z=Co([a,k],t.properties);if(e(z,n,l,N,u)===!1)return!1;u++,a=k})===!1)return!1}}})}function B4(r,e,t){var n=t,l=!1;return Zb(r,function(u,d,a,_,x){l===!1&&t===void 0?n=u:n=e(n,u,d,a,_,x),l=!0}),n}function Hb(r,e){if(!r)throw new Error("geojson is required");zc(r,function(t,n,l){if(t.geometry!==null){var u=t.geometry.type,d=t.geometry.coordinates;switch(u){case"LineString":if(e(t,n,l,0,0)===!1)return!1;break;case"Polygon":for(var a=0;al?t:l,x=n>u?n:u;return[d,a,_,x]}var Cg={exports:{}},Xb={exports:{}};(function(r,e){(function(t,n){r.exports=n()})(xh,function(){function t(O,G,U,K,me){(function X(Y,_e,ze,re,ce){for(;re>ze;){if(re-ze>600){var Ze=re-ze+1,Me=_e-ze+1,ft=Math.log(Ze),Ct=.5*Math.exp(2*ft/3),Ot=.5*Math.sqrt(ft*Ct*(Ze-Ct)/Ze)*(Me-Ze/2<0?-1:1),Ke=Math.max(ze,Math.floor(_e-Me*Ct/Ze+Ot)),Kt=Math.min(re,Math.floor(_e+(Ze-Me)*Ct/Ze+Ot));X(Y,_e,Ke,Kt,ce)}var vt=Y[_e],At=ze,Vt=re;for(n(Y,ze,_e),ce(Y[re],vt)>0&&n(Y,ze,re);At0;)Vt--}ce(Y[ze],vt)===0?n(Y,ze,Vt):n(Y,++Vt,re),Vt<=_e&&(ze=Vt+1),_e<=Vt&&(re=Vt-1)}})(O,G,U||0,K||O.length-1,me||l)}function n(O,G,U){var K=O[G];O[G]=O[U],O[U]=K}function l(O,G){return OG?1:0}var u=function(O){O===void 0&&(O=9),this._maxEntries=Math.max(4,O),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function d(O,G,U){if(!U)return G.indexOf(O);for(var K=0;K=O.minX&&G.maxY>=O.minY}function z(O){return{children:O,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function B(O,G,U,K,me){for(var X=[G,U];X.length;)if(!((U=X.pop())-(G=X.pop())<=K)){var Y=G+Math.ceil((U-G)/K/2)*K;t(O,Y,G,U,me),X.push(G,Y,Y,U)}}return u.prototype.all=function(){return this._all(this.data,[])},u.prototype.search=function(O){var G=this.data,U=[];if(!N(O,G))return U;for(var K=this.toBBox,me=[];G;){for(var X=0;X=0&&me[G].children.length>this._maxEntries;)this._split(me,G),G--;this._adjustParentBBoxes(K,me,G)},u.prototype._split=function(O,G){var U=O[G],K=U.children.length,me=this._minEntries;this._chooseSplitAxis(U,me,K);var X=this._chooseSplitIndex(U,me,K),Y=z(U.children.splice(X,U.children.length-X));Y.height=U.height,Y.leaf=U.leaf,a(U,this.toBBox),a(Y,this.toBBox),G?O[G-1].children.push(Y):this._splitRoot(U,Y)},u.prototype._splitRoot=function(O,G){this.data=z([O,G]),this.data.height=O.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},u.prototype._chooseSplitIndex=function(O,G,U){for(var K,me,X,Y,_e,ze,re,ce=1/0,Ze=1/0,Me=G;Me<=U-G;Me++){var ft=_(O,0,Me,this.toBBox),Ct=_(O,Me,U,this.toBBox),Ot=(me=ft,X=Ct,Y=void 0,_e=void 0,ze=void 0,re=void 0,Y=Math.max(me.minX,X.minX),_e=Math.max(me.minY,X.minY),ze=Math.min(me.maxX,X.maxX),re=Math.min(me.maxY,X.maxY),Math.max(0,ze-Y)*Math.max(0,re-_e)),Ke=C(ft)+C(Ct);Ot=G;ce--){var Ze=O.children[ce];x(Y,O.leaf?me(Ze):Ze),_e+=P(Y)}return _e},u.prototype._adjustParentBBoxes=function(O,G,U){for(var K=U;K>=0;K--)x(G[K],O)},u.prototype._condense=function(O){for(var G=O.length-1,U=void 0;G>=0;G--)O[G].children.length===0?G>0?(U=O[G-1].children).splice(U.indexOf(O[G]),1):this.clear():a(O[G],this.toBBox)},u})})(Xb);var W4=Xb.exports;const Z4=Dd(I4),H4=Dd(j4);function Kb(r,e,t){if(r!==null)for(var n,l,u,d,a,_,x,S=0,k=0,C,P=r.type,D=P==="FeatureCollection",N=P==="Feature",z=D?r.features.length:1,B=0;B{t[0]>n[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2] line1 must only contain 2 coordinates");if(n.length!==2)throw new Error(" line2 must only contain 2 coordinates");var l=t[0][0],u=t[0][1],d=t[1][0],a=t[1][1],_=n[0][0],x=n[0][1],S=n[1][0],k=n[1][1],C=(k-x)*(d-l)-(S-_)*(a-u),P=(S-_)*(u-x)-(k-x)*(l-_),D=(d-l)*(u-x)-(a-u)*(l-_);if(C===0)return null;var N=P/C,z=D/C;if(N>=0&&N<=1&&z>=0&&z<=1){var B=l+N*(d-l),O=u+N*(a-u);return eo([B,O])}return null}function tk(r,e,t){t===void 0&&(t={});var n=eo([1/0,1/0],{dist:1/0}),l=0;return zc(r,function(u){for(var d=xc(u),a=0;a0&&(z=N.features[0],z.properties.dist=Fu(e,z,t),z.properties.location=l+Fu(_,z,t)),_.properties.dist{if(!this.active)return;const a=[d.point.x-rk,d.point.y],_=this.map.unproject(d.point).distanceTo(this.map.unproject(a));this.inner.onMouseMove(d.lngLat.lng,d.lngLat.lat,_)&&(this.redraw(),this.dataUpdated())},this.onClick=()=>{this.active&&(this.inner.onClick(),this.redraw(),this.dataUpdated())},this.onDoubleClick=d=>{this.active&&(d.preventDefault(),this.inner.onClick(),this.finish())},this.onDragStart=()=>{this.active&&this.inner.onDragStart()&&this.map.dragPan.disable()},this.onMouseUp=()=>{this.active&&this.inner.onMouseUp()&&this.map.dragPan.enable()},this.onKeyDown=d=>{if(!this.active)return;let a=d.target.tagName;a=="INPUT"||a=="TEXTAREA"||d.key=="Escape"&&(d.stopPropagation(),this.cancel())},this.onKeyPress=d=>{if(!this.active)return;let a=d.target.tagName;a=="INPUT"||a=="TEXTAREA"||(d.key=="Enter"?(d.stopPropagation(),this.finish()):d.key=="s"||d.key=="S"?(d.stopPropagation(),this.inner.toggleSnapMode(),this.redraw()):d.key=="z"&&d.ctrlKey&&this.undo())},this.map=e,console.time("Deserialize and setup JsRouteSnapper"),this.inner=new ld(t),console.timeEnd("Deserialize and setup JsRouteSnapper"),this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.routeToolGj=n,this.snapMode=l,this.undoLength=u,this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("dragstart",this.onDragStart),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keypress",this.onKeyPress)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("dragstart",this.onDragStart),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keypress",this.onKeyPress)}startRoute(){this.active||(this.active=!0,this.map.boxZoom.disable(),this.map.doubleClickZoom.disable())}startArea(){this.active||(this.inner.setAreaMode(),this.active=!0,this.map.boxZoom.disable(),this.map.doubleClickZoom.disable())}stop(){this.active=!1,this.inner.clearState(),this.redraw(),this.map.boxZoom.enable(),this.map.doubleClickZoom.enable()}editExistingRoute(e){this.active&&window.alert("Bug: editExistingRoute called when tool is already active"),e.properties.waypoints||(e.properties.waypoints=[{lon:e.geometry.coordinates[0][0],lat:e.geometry.coordinates[0][1],snapped:!0},{lon:e.geometry.coordinates[e.geometry.coordinates.length-1][0],lat:e.geometry.coordinates[e.geometry.coordinates.length-1][1],snapped:!0}]),this.startRoute(),this.inner.editExisting(e.properties.waypoints),this.redraw()}editExistingArea(e){this.active&&window.alert("Bug: editExistingArea called when tool is already active"),e.properties.waypoints||window.alert("Bug: editExistingArea called for a polygon not produced by the route-snapper"),this.startArea(),this.inner.editExisting(e.properties.waypoints),this.redraw()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}isActive(){return this.active}finish(){let e=this.inner.toFinalFeature();if(e)for(let t of this.eventListenersSuccess)t(JSON.parse(e));else for(let t of this.eventListenersFailure)t();this.stop()}cancel(){this.inner.clearState(),this.finish()}setRouteConfig(e){this.inner.setRouteConfig(e),this.redraw()}addSnappedWaypoint(e){this.inner.addSnappedWaypoint(e[0],e[1]),this.redraw()}undo(){this.inner.undo(),this.redraw()}toggleSnapMode(){this.inner.toggleSnapMode(),this.redraw()}redraw(){let e=JSON.parse(this.inner.renderGeojson());this.routeToolGj.set(e),this.map.getCanvas().style.cursor=e.cursor,this.snapMode.set(e.snap_mode),this.undoLength.set(e.undo_length)}dataUpdated(){let e=this.inner.toFinalFeature();if(e)for(let t of this.eventListenersUpdated)t(JSON.parse(e))}}const Dm="MZEJTanw3WpxRvt7qDfo";let ls=Tr(null),Rm=Tr("streets-v2"),dh=Tr(!1),ha=Tr(""),hd=Tr(!0),ri=Tr(null),Bm=Tr(new Pc.LngLat(0,0)),Fm=Tr(new Pc.LngLat(0,0)),Gy=Tr(1),ia=Tr(1),pr=Tr({mode:"title"}),Om=Tr("walk_cycle_only"),Wy=Tr(!1);function Sc(){let r=Hi(ha);r||window.alert("Autosave failed; no projectName set?!"),window.localStorage.setItem(r,Hi(ri).toSavefile())}function Zy(r){let e,t;return e=new Pd({props:{$$slots:{default:[ik,({dialog:n})=>({3:n}),({dialog:n})=>n?8:0]},$$scope:{ctx:r}}}),e.$on("close",r[2]),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&24&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function ik(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D;function N(){return r[1](r[3])}return{c(){e=fe("h1"),e.textContent="The low-traffic neighbourhood (LTN) tool, v2",t=Ve(),n=fe("p"),n.innerHTML=`This is an experimental +`),we=M.createShader(M.FRAGMENT_SHADER);if(M.isContextLost())return void(this.failedToCreate=!0);if(M.shaderSource(we,Te),M.compileShader(we),!M.getShaderParameter(we,M.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${M.getShaderInfoLog(we)}`);M.attachShader(this.program,we);const Le=M.createShader(M.VERTEX_SHADER);if(M.isContextLost())return void(this.failedToCreate=!0);if(M.shaderSource(Le,Ue),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 Ge={};this.numAttributes=V.length;for(let He=0;He({u_depth:new a.aG(He,$e.u_depth),u_terrain:new a.aG(He,$e.u_terrain),u_terrain_dim:new a.aH(He,$e.u_terrain_dim),u_terrain_matrix:new a.aI(He,$e.u_terrain_matrix),u_terrain_unpack:new a.aJ(He,$e.u_terrain_unpack),u_terrain_exaggeration:new a.aH(He,$e.u_terrain_exaggeration)}))(o,Ge),this.binderUniforms=p?p.getUniforms(o,Ge):[]}draw(o,h,p,m,v,E,M,A,R,V,q,Q,he,ue,ye,se,Te,Ue){const we=o.gl;if(this.failedToCreate)return;if(o.program.set(this.program),o.setDepthMode(p),o.setStencilMode(m),o.setColorMode(v),o.setCullFace(E),A){o.activeTexture.set(we.TEXTURE2),we.bindTexture(we.TEXTURE_2D,A.depthTexture),o.activeTexture.set(we.TEXTURE3),we.bindTexture(we.TEXTURE_2D,A.texture);for(const Ge in this.terrainUniforms)this.terrainUniforms[Ge].set(A[Ge])}for(const Ge in this.fixedUniforms)this.fixedUniforms[Ge].set(M[Ge]);ye&&ye.setUniforms(o,this.binderUniforms,he,{zoom:ue});let Le=0;switch(h){case we.LINES:Le=2;break;case we.TRIANGLES:Le=3;break;case we.LINE_STRIP:Le=1}for(const Ge of Q.get()){const He=Ge.vaos||(Ge.vaos={});(He[R]||(He[R]=new cl)).bind(o,this,V,ye?ye.getPaintVertexBuffers():[],q,Ge.vertexOffset,se,Te,Ue),we.drawElements(h,Ge.primitiveLength*Le,we.UNSIGNED_SHORT,Ge.primitiveOffset*Le*2)}}}function ul(y,o,h){const p=1/$t(h,1,o.transform.tileZoom),m=Math.pow(2,h.tileID.overscaledZ),v=h.tileSize*Math.pow(2,o.transform.tileZoom)/m,E=v*(h.tileID.canonical.x+h.tileID.wrap*m),M=v*h.tileID.canonical.y;return{u_image:0,u_texsize:h.imageAtlasTexture.size,u_scale:[p,y.fromScale,y.toScale],u_fade:y.t,u_pixel_coord_upper:[E>>16,M>>16],u_pixel_coord_lower:[65535&E,65535&M]}}const Ma=(y,o,h,p)=>{const m=o.style.light,v=m.properties.get("position"),E=[v.x,v.y,v.z],M=function(){var R=new a.A(9);return a.A!=Float32Array&&(R[1]=0,R[2]=0,R[3]=0,R[5]=0,R[6]=0,R[7]=0),R[0]=1,R[4]=1,R[8]=1,R}();m.properties.get("anchor")==="viewport"&&function(R,V){var q=Math.sin(V),Q=Math.cos(V);R[0]=Q,R[1]=q,R[2]=0,R[3]=-q,R[4]=Q,R[5]=0,R[6]=0,R[7]=0,R[8]=1}(M,-o.transform.angle),function(R,V,q){var Q=V[0],he=V[1],ue=V[2];R[0]=Q*q[0]+he*q[3]+ue*q[6],R[1]=Q*q[1]+he*q[4]+ue*q[7],R[2]=Q*q[2]+he*q[5]+ue*q[8]}(E,E,M);const A=m.properties.get("color");return{u_matrix:y,u_lightpos:E,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[A.r,A.g,A.b],u_vertical_gradient:+h,u_opacity:p}},Zd=(y,o,h,p,m,v,E)=>a.e(Ma(y,o,h,p),ul(v,o,E),{u_height_factor:-Math.pow(2,m.overscaledZ)/E.tileSize/8}),Ih=y=>({u_matrix:y}),hl=(y,o,h,p)=>a.e(Ih(y),ul(h,o,p)),Hd=(y,o)=>({u_matrix:y,u_world:o}),Ah=(y,o,h,p,m)=>a.e(hl(y,o,h,p),{u_world:m}),$d=(y,o,h,p)=>{const m=y.transform;let v,E;if(p.paint.get("circle-pitch-alignment")==="map"){const M=$t(h,1,m.zoom);v=!0,E=[M,M]}else v=!1,E=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(p.paint.get("circle-pitch-scale")==="map"),u_matrix:y.translatePosMatrix(o.posMatrix,h,p.paint.get("circle-translate"),p.paint.get("circle-translate-anchor")),u_pitch_with_map:+v,u_device_pixel_ratio:y.pixelRatio,u_extrude_scale:E}},Lh=(y,o,h)=>{const p=$t(h,1,o.zoom),m=Math.pow(2,o.zoom-h.tileID.overscaledZ),v=h.tileID.overscaleFactor();return{u_matrix:y,u_camera_to_center_distance:o.cameraToCenterDistance,u_pixels_to_tile_units:p,u_extrude_scale:[o.pixelsToGLUnits[0]/(p*m),o.pixelsToGLUnits[1]/(p*m)],u_overscale_factor:v}},Ph=(y,o,h=1)=>({u_matrix:y,u_color:o,u_overlay:0,u_overlay_scale:h}),fl=y=>({u_matrix:y}),zh=(y,o,h,p)=>({u_matrix:y,u_extrude_scale:$t(o,1,h),u_intensity:p});function Dh(y,o){const h=Math.pow(2,o.canonical.z),p=o.canonical.y;return[new a.Y(0,p/h).toLngLat().lat,new a.Y(0,(p+1)/h).toLngLat().lat]}const dl=(y,o,h,p)=>{const m=y.transform;return{u_matrix:Ca(y,o,h,p),u_ratio:1/$t(o,1,m.zoom),u_device_pixel_ratio:y.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},Rh=(y,o,h,p,m)=>a.e(dl(y,o,h,m),{u_image:0,u_image_height:p}),ds=(y,o,h,p,m)=>{const v=y.transform,E=Fi(o,v);return{u_matrix:Ca(y,o,h,m),u_texsize:o.imageAtlasTexture.size,u_ratio:1/$t(o,1,v.zoom),u_device_pixel_ratio:y.pixelRatio,u_image:0,u_scale:[E,p.fromScale,p.toScale],u_fade:p.t,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]]}},pl=(y,o,h,p,m,v)=>{const E=y.lineAtlas,M=Fi(o,y.transform),A=h.layout.get("line-cap")==="round",R=E.getDash(p.from,A),V=E.getDash(p.to,A),q=R.width*m.fromScale,Q=V.width*m.toScale;return a.e(dl(y,o,h,v),{u_patternscale_a:[M/q,-R.height/2],u_patternscale_b:[M/Q,-V.height/2],u_sdfgamma:E.width/(256*Math.min(q,Q)*y.pixelRatio)/2,u_image:0,u_tex_y_a:R.y,u_tex_y_b:V.y,u_mix:m.t})};function Fi(y,o){return 1/$t(y,1,o.tileZoom)}function Ca(y,o,h,p){return y.translatePosMatrix(p?p.posMatrix:o.tileID.posMatrix,o,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}const ml=(y,o,h,p,m)=>{return{u_matrix:y,u_tl_parent:o,u_scale_parent:h,u_buffer_scale:1,u_fade_t:p.mix,u_opacity:p.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(E=m.paint.get("raster-saturation"),E>0?1-1/(1.001-E):-E),u_contrast_factor:(v=m.paint.get("raster-contrast"),v>0?1/(1-v):1+v),u_spin_weights:Ia(m.paint.get("raster-hue-rotate"))};var v,E};function Ia(y){y*=Math.PI/180;const o=Math.sin(y),h=Math.cos(y);return[(2*h+1)/3,(-Math.sqrt(3)*o-h+1)/3,(Math.sqrt(3)*o-h+1)/3]}const Aa=(y,o,h,p,m,v,E,M,A,R)=>{const V=m.transform;return{u_is_size_zoom_constant:+(y==="constant"||y==="source"),u_is_size_feature_constant:+(y==="constant"||y==="camera"),u_size_t:o?o.uSizeT:0,u_size:o?o.uSize:0,u_camera_to_center_distance:V.cameraToCenterDistance,u_pitch:V.pitch/360*2*Math.PI,u_rotate_symbol:+h,u_aspect_ratio:V.width/V.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:v,u_label_plane_matrix:E,u_coord_matrix:M,u_is_text:+A,u_pitch_with_map:+p,u_texsize:R,u_texture:0}},La=(y,o,h,p,m,v,E,M,A,R,V)=>{const q=m.transform;return a.e(Aa(y,o,h,p,m,v,E,M,A,R),{u_gamma_scale:p?Math.cos(q._pitch)*q.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+V})},Pa=(y,o,h,p,m,v,E,M,A,R)=>a.e(La(y,o,h,p,m,v,E,M,!0,A,!0),{u_texsize_icon:R,u_texture_icon:1}),Xd=(y,o,h)=>({u_matrix:y,u_opacity:o,u_color:h}),Kd=(y,o,h,p,m,v)=>a.e(function(E,M,A,R){const V=A.imageManager.getPattern(E.from.toString()),q=A.imageManager.getPattern(E.to.toString()),{width:Q,height:he}=A.imageManager.getPixelSize(),ue=Math.pow(2,R.tileID.overscaledZ),ye=R.tileSize*Math.pow(2,A.transform.tileZoom)/ue,se=ye*(R.tileID.canonical.x+R.tileID.wrap*ue),Te=ye*R.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:V.tl,u_pattern_br_a:V.br,u_pattern_tl_b:q.tl,u_pattern_br_b:q.br,u_texsize:[Q,he],u_mix:M.t,u_pattern_size_a:V.displaySize,u_pattern_size_b:q.displaySize,u_scale_a:M.fromScale,u_scale_b:M.toScale,u_tile_units_to_pixels:1/$t(R,1,A.transform.tileZoom),u_pixel_coord_upper:[se>>16,Te>>16],u_pixel_coord_lower:[65535&se,65535&Te]}}(p,v,h,m),{u_matrix:y,u_opacity:o}),Bh={fillExtrusion:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_lightpos:new a.aK(y,o.u_lightpos),u_lightintensity:new a.aH(y,o.u_lightintensity),u_lightcolor:new a.aK(y,o.u_lightcolor),u_vertical_gradient:new a.aH(y,o.u_vertical_gradient),u_opacity:new a.aH(y,o.u_opacity)}),fillExtrusionPattern:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_lightpos:new a.aK(y,o.u_lightpos),u_lightintensity:new a.aH(y,o.u_lightintensity),u_lightcolor:new a.aK(y,o.u_lightcolor),u_vertical_gradient:new a.aH(y,o.u_vertical_gradient),u_height_factor:new a.aH(y,o.u_height_factor),u_image:new a.aG(y,o.u_image),u_texsize:new a.aL(y,o.u_texsize),u_pixel_coord_upper:new a.aL(y,o.u_pixel_coord_upper),u_pixel_coord_lower:new a.aL(y,o.u_pixel_coord_lower),u_scale:new a.aK(y,o.u_scale),u_fade:new a.aH(y,o.u_fade),u_opacity:new a.aH(y,o.u_opacity)}),fill:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix)}),fillPattern:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_image:new a.aG(y,o.u_image),u_texsize:new a.aL(y,o.u_texsize),u_pixel_coord_upper:new a.aL(y,o.u_pixel_coord_upper),u_pixel_coord_lower:new a.aL(y,o.u_pixel_coord_lower),u_scale:new a.aK(y,o.u_scale),u_fade:new a.aH(y,o.u_fade)}),fillOutline:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_world:new a.aL(y,o.u_world)}),fillOutlinePattern:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_world:new a.aL(y,o.u_world),u_image:new a.aG(y,o.u_image),u_texsize:new a.aL(y,o.u_texsize),u_pixel_coord_upper:new a.aL(y,o.u_pixel_coord_upper),u_pixel_coord_lower:new a.aL(y,o.u_pixel_coord_lower),u_scale:new a.aK(y,o.u_scale),u_fade:new a.aH(y,o.u_fade)}),circle:(y,o)=>({u_camera_to_center_distance:new a.aH(y,o.u_camera_to_center_distance),u_scale_with_map:new a.aG(y,o.u_scale_with_map),u_pitch_with_map:new a.aG(y,o.u_pitch_with_map),u_extrude_scale:new a.aL(y,o.u_extrude_scale),u_device_pixel_ratio:new a.aH(y,o.u_device_pixel_ratio),u_matrix:new a.aI(y,o.u_matrix)}),collisionBox:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_camera_to_center_distance:new a.aH(y,o.u_camera_to_center_distance),u_pixels_to_tile_units:new a.aH(y,o.u_pixels_to_tile_units),u_extrude_scale:new a.aL(y,o.u_extrude_scale),u_overscale_factor:new a.aH(y,o.u_overscale_factor)}),collisionCircle:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_inv_matrix:new a.aI(y,o.u_inv_matrix),u_camera_to_center_distance:new a.aH(y,o.u_camera_to_center_distance),u_viewport_size:new a.aL(y,o.u_viewport_size)}),debug:(y,o)=>({u_color:new a.aM(y,o.u_color),u_matrix:new a.aI(y,o.u_matrix),u_overlay:new a.aG(y,o.u_overlay),u_overlay_scale:new a.aH(y,o.u_overlay_scale)}),clippingMask:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix)}),heatmap:(y,o)=>({u_extrude_scale:new a.aH(y,o.u_extrude_scale),u_intensity:new a.aH(y,o.u_intensity),u_matrix:new a.aI(y,o.u_matrix)}),heatmapTexture:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_world:new a.aL(y,o.u_world),u_image:new a.aG(y,o.u_image),u_color_ramp:new a.aG(y,o.u_color_ramp),u_opacity:new a.aH(y,o.u_opacity)}),hillshade:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_image:new a.aG(y,o.u_image),u_latrange:new a.aL(y,o.u_latrange),u_light:new a.aL(y,o.u_light),u_shadow:new a.aM(y,o.u_shadow),u_highlight:new a.aM(y,o.u_highlight),u_accent:new a.aM(y,o.u_accent)}),hillshadePrepare:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_image:new a.aG(y,o.u_image),u_dimension:new a.aL(y,o.u_dimension),u_zoom:new a.aH(y,o.u_zoom),u_unpack:new a.aJ(y,o.u_unpack)}),line:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_ratio:new a.aH(y,o.u_ratio),u_device_pixel_ratio:new a.aH(y,o.u_device_pixel_ratio),u_units_to_pixels:new a.aL(y,o.u_units_to_pixels)}),lineGradient:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_ratio:new a.aH(y,o.u_ratio),u_device_pixel_ratio:new a.aH(y,o.u_device_pixel_ratio),u_units_to_pixels:new a.aL(y,o.u_units_to_pixels),u_image:new a.aG(y,o.u_image),u_image_height:new a.aH(y,o.u_image_height)}),linePattern:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_texsize:new a.aL(y,o.u_texsize),u_ratio:new a.aH(y,o.u_ratio),u_device_pixel_ratio:new a.aH(y,o.u_device_pixel_ratio),u_image:new a.aG(y,o.u_image),u_units_to_pixels:new a.aL(y,o.u_units_to_pixels),u_scale:new a.aK(y,o.u_scale),u_fade:new a.aH(y,o.u_fade)}),lineSDF:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_ratio:new a.aH(y,o.u_ratio),u_device_pixel_ratio:new a.aH(y,o.u_device_pixel_ratio),u_units_to_pixels:new a.aL(y,o.u_units_to_pixels),u_patternscale_a:new a.aL(y,o.u_patternscale_a),u_patternscale_b:new a.aL(y,o.u_patternscale_b),u_sdfgamma:new a.aH(y,o.u_sdfgamma),u_image:new a.aG(y,o.u_image),u_tex_y_a:new a.aH(y,o.u_tex_y_a),u_tex_y_b:new a.aH(y,o.u_tex_y_b),u_mix:new a.aH(y,o.u_mix)}),raster:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_tl_parent:new a.aL(y,o.u_tl_parent),u_scale_parent:new a.aH(y,o.u_scale_parent),u_buffer_scale:new a.aH(y,o.u_buffer_scale),u_fade_t:new a.aH(y,o.u_fade_t),u_opacity:new a.aH(y,o.u_opacity),u_image0:new a.aG(y,o.u_image0),u_image1:new a.aG(y,o.u_image1),u_brightness_low:new a.aH(y,o.u_brightness_low),u_brightness_high:new a.aH(y,o.u_brightness_high),u_saturation_factor:new a.aH(y,o.u_saturation_factor),u_contrast_factor:new a.aH(y,o.u_contrast_factor),u_spin_weights:new a.aK(y,o.u_spin_weights)}),symbolIcon:(y,o)=>({u_is_size_zoom_constant:new a.aG(y,o.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aG(y,o.u_is_size_feature_constant),u_size_t:new a.aH(y,o.u_size_t),u_size:new a.aH(y,o.u_size),u_camera_to_center_distance:new a.aH(y,o.u_camera_to_center_distance),u_pitch:new a.aH(y,o.u_pitch),u_rotate_symbol:new a.aG(y,o.u_rotate_symbol),u_aspect_ratio:new a.aH(y,o.u_aspect_ratio),u_fade_change:new a.aH(y,o.u_fade_change),u_matrix:new a.aI(y,o.u_matrix),u_label_plane_matrix:new a.aI(y,o.u_label_plane_matrix),u_coord_matrix:new a.aI(y,o.u_coord_matrix),u_is_text:new a.aG(y,o.u_is_text),u_pitch_with_map:new a.aG(y,o.u_pitch_with_map),u_texsize:new a.aL(y,o.u_texsize),u_texture:new a.aG(y,o.u_texture)}),symbolSDF:(y,o)=>({u_is_size_zoom_constant:new a.aG(y,o.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aG(y,o.u_is_size_feature_constant),u_size_t:new a.aH(y,o.u_size_t),u_size:new a.aH(y,o.u_size),u_camera_to_center_distance:new a.aH(y,o.u_camera_to_center_distance),u_pitch:new a.aH(y,o.u_pitch),u_rotate_symbol:new a.aG(y,o.u_rotate_symbol),u_aspect_ratio:new a.aH(y,o.u_aspect_ratio),u_fade_change:new a.aH(y,o.u_fade_change),u_matrix:new a.aI(y,o.u_matrix),u_label_plane_matrix:new a.aI(y,o.u_label_plane_matrix),u_coord_matrix:new a.aI(y,o.u_coord_matrix),u_is_text:new a.aG(y,o.u_is_text),u_pitch_with_map:new a.aG(y,o.u_pitch_with_map),u_texsize:new a.aL(y,o.u_texsize),u_texture:new a.aG(y,o.u_texture),u_gamma_scale:new a.aH(y,o.u_gamma_scale),u_device_pixel_ratio:new a.aH(y,o.u_device_pixel_ratio),u_is_halo:new a.aG(y,o.u_is_halo)}),symbolTextAndIcon:(y,o)=>({u_is_size_zoom_constant:new a.aG(y,o.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aG(y,o.u_is_size_feature_constant),u_size_t:new a.aH(y,o.u_size_t),u_size:new a.aH(y,o.u_size),u_camera_to_center_distance:new a.aH(y,o.u_camera_to_center_distance),u_pitch:new a.aH(y,o.u_pitch),u_rotate_symbol:new a.aG(y,o.u_rotate_symbol),u_aspect_ratio:new a.aH(y,o.u_aspect_ratio),u_fade_change:new a.aH(y,o.u_fade_change),u_matrix:new a.aI(y,o.u_matrix),u_label_plane_matrix:new a.aI(y,o.u_label_plane_matrix),u_coord_matrix:new a.aI(y,o.u_coord_matrix),u_is_text:new a.aG(y,o.u_is_text),u_pitch_with_map:new a.aG(y,o.u_pitch_with_map),u_texsize:new a.aL(y,o.u_texsize),u_texsize_icon:new a.aL(y,o.u_texsize_icon),u_texture:new a.aG(y,o.u_texture),u_texture_icon:new a.aG(y,o.u_texture_icon),u_gamma_scale:new a.aH(y,o.u_gamma_scale),u_device_pixel_ratio:new a.aH(y,o.u_device_pixel_ratio),u_is_halo:new a.aG(y,o.u_is_halo)}),background:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_opacity:new a.aH(y,o.u_opacity),u_color:new a.aM(y,o.u_color)}),backgroundPattern:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_opacity:new a.aH(y,o.u_opacity),u_image:new a.aG(y,o.u_image),u_pattern_tl_a:new a.aL(y,o.u_pattern_tl_a),u_pattern_br_a:new a.aL(y,o.u_pattern_br_a),u_pattern_tl_b:new a.aL(y,o.u_pattern_tl_b),u_pattern_br_b:new a.aL(y,o.u_pattern_br_b),u_texsize:new a.aL(y,o.u_texsize),u_mix:new a.aH(y,o.u_mix),u_pattern_size_a:new a.aL(y,o.u_pattern_size_a),u_pattern_size_b:new a.aL(y,o.u_pattern_size_b),u_scale_a:new a.aH(y,o.u_scale_a),u_scale_b:new a.aH(y,o.u_scale_b),u_pixel_coord_upper:new a.aL(y,o.u_pixel_coord_upper),u_pixel_coord_lower:new a.aL(y,o.u_pixel_coord_lower),u_tile_units_to_pixels:new a.aH(y,o.u_tile_units_to_pixels)}),terrain:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_texture:new a.aG(y,o.u_texture),u_ele_delta:new a.aH(y,o.u_ele_delta)}),terrainDepth:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_ele_delta:new a.aH(y,o.u_ele_delta)}),terrainCoords:(y,o)=>({u_matrix:new a.aI(y,o.u_matrix),u_texture:new a.aG(y,o.u_texture),u_terrain_coords_id:new a.aH(y,o.u_terrain_coords_id),u_ele_delta:new a.aH(y,o.u_ele_delta)})};class Jd{constructor(o,h,p){this.context=o;const m=o.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!p,this.context.unbindVAO(),o.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(o){const h=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),h.bufferSubData(h.ELEMENT_ARRAY_BUFFER,0,o.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const ps={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class gl{constructor(o,h,p,m){this.length=h.length,this.attributes=p,this.itemSize=h.bytesPerElement,this.dynamicDraw=m,this.context=o;const v=o.gl;this.buffer=v.createBuffer(),o.bindVertexBuffer.set(this.buffer),v.bufferData(v.ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?v.DYNAMIC_DRAW:v.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(o){if(o.length!==this.length)throw new Error(`Length of new data is ${o.length}, which doesn't match current length of ${this.length}`);const h=this.context.gl;this.bind(),h.bufferSubData(h.ARRAY_BUFFER,0,o.arrayBuffer)}enableAttributes(o,h){for(let p=0;p0){const dt=a.F(),gt=$e;a.aP(dt,He.placementInvProjMatrix,y.transform.glCoordMatrix),a.aP(dt,dt,He.placementViewportMatrix),V.push({circleArray:et,circleOffset:Q,transform:gt,invTransform:dt,coord:Le}),q+=et.length/4,Q=q}nt&&R.draw(M,A.LINES,wr.disabled,$r.disabled,y.colorModeForRenderPass(),jr.disabled,Lh($e,y.transform,Ge),y.style.map.terrain&&y.style.map.terrain.getTerrainData(Le),h.id,nt.layoutVertexBuffer,nt.indexBuffer,nt.segments,null,y.transform.zoom,null,null,nt.collisionVertexBuffer)}if(!E||!V.length)return;const he=y.useProgram("collisionCircle"),ue=new a.aQ;ue.resize(4*q),ue._trim();let ye=0;for(const we of V)for(let Le=0;Le=0&&(ue[se.associatedIconIndex]={shiftedAnchor:ir,angle:_t})}else qe(se.numGlyphs,Q)}if(R){he.clear();const ye=y.icon.placedSymbolArray;for(let se=0;sey.style.map.terrain.getElevation(nt,Ji,Pn):null,sn=h.layout.get("text-rotation-alignment")==="map";$(dt,nt.posMatrix,y,m,Ni,bo,se,R,sn,Ln)}const rs=y.translatePosMatrix(nt.posMatrix,et,v,E),wo=Te||m&&He||Za?Xc:Ni,An=y.translatePosMatrix(bo,et,v,E,!0),on=_t&&h.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let en;en=_t?dt.iconsInText?Pa(Xt.kind,Yt,Ue,se,y,rs,wo,An,dr,Fn):La(Xt.kind,Yt,Ue,se,y,rs,wo,An,m,dr,!0):Aa(Xt.kind,Yt,Ue,se,y,rs,wo,An,m,dr);const Ki={program:xr,buffers:gt,uniformValues:en,atlasTexture:hn,atlasTextureIcon:nn,atlasInterpolation:Rr,atlasInterpolationIcon:Oi,isSDF:_t,hasHalo:on};if(we&&dt.canOverlap){Le=!0;const Ln=gt.segments.get();for(const sn of Ln)$e.push({segments:new a.$([sn]),sortKey:sn.sortKey,state:Ki,terrainData:cr})}else $e.push({segments:gt.segments,sortKey:0,state:Ki,terrainData:cr})}Le&&$e.sort((nt,et)=>nt.sortKey-et.sortKey);for(const nt of $e){const et=nt.state;if(Q.activeTexture.set(he.TEXTURE0),et.atlasTexture.bind(et.atlasInterpolation,he.CLAMP_TO_EDGE),et.atlasTextureIcon&&(Q.activeTexture.set(he.TEXTURE1),et.atlasTextureIcon&&et.atlasTextureIcon.bind(et.atlasInterpolationIcon,he.CLAMP_TO_EDGE)),et.isSDF){const dt=et.uniformValues;et.hasHalo&&(dt.u_is_halo=1,Wh(et.buffers,nt.segments,h,y,et.program,Ge,V,q,dt,nt.terrainData)),dt.u_is_halo=0}Wh(et.buffers,nt.segments,h,y,et.program,Ge,V,q,et.uniformValues,nt.terrainData)}}function Wh(y,o,h,p,m,v,E,M,A,R){const V=p.context;m.draw(V,V.gl.TRIANGLES,v,E,M,jr.disabled,A,R,h.id,y.layoutVertexBuffer,y.indexBuffer,o,h.paint,p.transform.zoom,y.programConfigurations.get(h.id),y.dynamicLayoutVertexBuffer,y.opacityVertexBuffer)}function Ml(y,o,h,p,m){if(!h||!p||!p.imageAtlas)return;const v=p.imageAtlas.patternPositions;let E=v[h.to.toString()],M=v[h.from.toString()];if(!E&&M&&(E=M),!M&&E&&(M=E),!E||!M){const A=m.getPaintProperty(o);E=v[A],M=v[A]}E&&M&&y.setConstantPatternPositions(E,M)}function Zh(y,o,h,p,m,v,E){const M=y.context.gl,A="fill-pattern",R=h.paint.get(A),V=R&&R.constantOr(1),q=h.getCrossfadeParameters();let Q,he,ue,ye,se;E?(he=V&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Q=M.LINES):(he=V?"fillPattern":"fill",Q=M.TRIANGLES);const Te=R.constantOr(null);for(const Ue of p){const we=o.getTile(Ue);if(V&&!we.patternsLoaded())continue;const Le=we.getBucket(h);if(!Le)continue;const Ge=Le.programConfigurations.get(h.id),He=y.useProgram(he,Ge),$e=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Ue);V&&(y.context.activeTexture.set(M.TEXTURE0),we.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),Ge.updatePaintBuffers(q)),Ml(Ge,A,Te,we,h);const nt=$e?Ue:null,et=y.translatePosMatrix(nt?nt.posMatrix:Ue.posMatrix,we,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));if(E){ye=Le.indexBuffer2,se=Le.segments2;const dt=[M.drawingBufferWidth,M.drawingBufferHeight];ue=he==="fillOutlinePattern"&&V?Ah(et,y,q,we,dt):Hd(et,dt)}else ye=Le.indexBuffer,se=Le.segments,ue=V?hl(et,y,q,we):Ih(et);He.draw(y.context,Q,m,y.stencilModeForClipping(Ue),v,jr.disabled,ue,$e,h.id,Le.layoutVertexBuffer,ye,se,h.paint,y.transform.zoom,Ge)}}function Cl(y,o,h,p,m,v,E){const M=y.context,A=M.gl,R="fill-extrusion-pattern",V=h.paint.get(R),q=V.constantOr(1),Q=h.getCrossfadeParameters(),he=h.paint.get("fill-extrusion-opacity"),ue=V.constantOr(null);for(const ye of p){const se=o.getTile(ye),Te=se.getBucket(h);if(!Te)continue;const Ue=y.style.map.terrain&&y.style.map.terrain.getTerrainData(ye),we=Te.programConfigurations.get(h.id),Le=y.useProgram(q?"fillExtrusionPattern":"fillExtrusion",we);q&&(y.context.activeTexture.set(A.TEXTURE0),se.imageAtlasTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE),we.updatePaintBuffers(Q)),Ml(we,R,ue,se,h);const Ge=y.translatePosMatrix(ye.posMatrix,se,h.paint.get("fill-extrusion-translate"),h.paint.get("fill-extrusion-translate-anchor")),He=h.paint.get("fill-extrusion-vertical-gradient"),$e=q?Zd(Ge,y,He,he,ye,Q,se):Ma(Ge,y,He,he);Le.draw(M,M.gl.TRIANGLES,m,v,E,jr.backCCW,$e,Ue,h.id,Te.layoutVertexBuffer,Te.indexBuffer,Te.segments,h.paint,y.transform.zoom,we,y.style.map.terrain&&Te.centroidVertexBuffer)}}function Il(y,o,h,p,m,v,E){const M=y.context,A=M.gl,R=h.fbo;if(!R)return;const V=y.useProgram("hillshade"),q=y.style.map.terrain&&y.style.map.terrain.getTerrainData(o);M.activeTexture.set(A.TEXTURE0),A.bindTexture(A.TEXTURE_2D,R.colorAttachment.get()),V.draw(M,A.TRIANGLES,m,v,E,jr.disabled,((Q,he,ue,ye)=>{const se=ue.paint.get("hillshade-shadow-color"),Te=ue.paint.get("hillshade-highlight-color"),Ue=ue.paint.get("hillshade-accent-color");let we=ue.paint.get("hillshade-illumination-direction")*(Math.PI/180);ue.paint.get("hillshade-illumination-anchor")==="viewport"&&(we-=Q.transform.angle);const Le=!Q.options.moving;return{u_matrix:ye?ye.posMatrix:Q.transform.calculatePosMatrix(he.tileID.toUnwrapped(),Le),u_image:0,u_latrange:Dh(0,he.tileID),u_light:[ue.paint.get("hillshade-exaggeration"),we],u_shadow:se,u_highlight:Te,u_accent:Ue}})(y,h,p,q?o:null),q,p.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments)}function Kc(y,o,h,p,m,v){const E=y.context,M=E.gl,A=o.dem;if(A&&A.data){const R=A.dim,V=A.stride,q=A.getPixels();if(E.activeTexture.set(M.TEXTURE1),E.pixelStoreUnpackPremultiplyAlpha.set(!1),o.demTexture=o.demTexture||y.getTileTexture(V),o.demTexture){const he=o.demTexture;he.update(q,{premultiply:!1}),he.bind(M.NEAREST,M.CLAMP_TO_EDGE)}else o.demTexture=new re(E,q,M.RGBA,{premultiply:!1}),o.demTexture.bind(M.NEAREST,M.CLAMP_TO_EDGE);E.activeTexture.set(M.TEXTURE0);let Q=o.fbo;if(!Q){const he=new re(E,{width:R,height:R,data:null},M.RGBA);he.bind(M.LINEAR,M.CLAMP_TO_EDGE),Q=o.fbo=E.createFramebuffer(R,R,!0,!1),Q.colorAttachment.set(he.texture)}E.bindFramebuffer.set(Q.framebuffer),E.viewport.set([0,0,R,R]),y.useProgram("hillshadePrepare").draw(E,M.TRIANGLES,p,m,v,jr.disabled,((he,ue)=>{const ye=ue.stride,se=a.F();return a.aN(se,0,a.W,-a.W,0,0,1),a.H(se,se,[0,-a.W,0]),{u_matrix:se,u_image:1,u_dimension:[ye,ye],u_zoom:he.overscaledZ,u_unpack:ue.getUnpackVector()}})(o.tileID,A),null,h.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments),o.needsHillshadePrepare=!1}}function Hh(y,o,h,p,m,v){const E=p.paint.get("raster-fade-duration");if(!v&&E>0){const M=k.now(),A=(M-y.timeAdded)/E,R=o?(M-o.timeAdded)/E:-1,V=h.getSource(),q=m.coveringZoomLevel({tileSize:V.tileSize,roundZoom:V.roundZoom}),Q=!o||Math.abs(o.tileID.overscaledZ-q)>Math.abs(y.tileID.overscaledZ-q),he=Q&&y.refreshedUponExpiration?1:a.ac(Q?A:1-R,0,1);return y.refreshedUponExpiration&&A>=1&&(y.refreshedUponExpiration=!1),o?{opacity:1,mix:1-he}:{opacity:he,mix:0}}return{opacity:1,mix:0}}const $h=new a.aO(1,0,0,1),Al=new a.aO(0,1,0,1),Jc=new a.aO(0,0,1,1),sp=new a.aO(1,0,1,1),Xh=new a.aO(0,1,1,1);function cn(y,o,h,p){pi(y,0,o+h/2,y.transform.width,h,p)}function Jo(y,o,h,p){pi(y,o-h/2,0,h,y.transform.height,p)}function pi(y,o,h,p,m,v){const E=y.context,M=E.gl;M.enable(M.SCISSOR_TEST),M.scissor(o*y.pixelRatio,h*y.pixelRatio,p*y.pixelRatio,m*y.pixelRatio),E.clear({color:v}),M.disable(M.SCISSOR_TEST)}function Yc(y,o,h){const p=y.context,m=p.gl,v=h.posMatrix,E=y.useProgram("debug"),M=wr.disabled,A=$r.disabled,R=y.colorModeForRenderPass(),V="$debug",q=y.style.map.terrain&&y.style.map.terrain.getTerrainData(h);p.activeTexture.set(m.TEXTURE0);const Q=o.getTileByID(h.key).latestRawTileData,he=Math.floor((Q&&Q.byteLength||0)/1024),ue=o.getTile(h).tileSize,ye=512/Math.min(ue,512)*(h.overscaledZ/y.transform.zoom)*.5;let se=h.canonical.toString();h.overscaledZ!==h.canonical.z&&(se+=` => ${h.overscaledZ}`),function(Te,Ue){Te.initDebugOverlayCanvas();const we=Te.debugOverlayCanvas,Le=Te.context.gl,Ge=Te.debugOverlayCanvas.getContext("2d");Ge.clearRect(0,0,we.width,we.height),Ge.shadowColor="white",Ge.shadowBlur=2,Ge.lineWidth=1.5,Ge.strokeStyle="white",Ge.textBaseline="top",Ge.font="bold 36px Open Sans, sans-serif",Ge.fillText(Ue,5,5),Ge.strokeText(Ue,5,5),Te.debugOverlayTexture.update(we),Te.debugOverlayTexture.bind(Le.LINEAR,Le.CLAMP_TO_EDGE)}(y,`${se} ${he}kB`),E.draw(p,m.TRIANGLES,M,A,Sn.alphaBlended,jr.disabled,Ph(v,a.aO.transparent,ye),null,V,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),E.draw(p,m.LINE_STRIP,M,A,R,jr.disabled,Ph(v,a.aO.red),q,V,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Ll(y,o,h){const p=y.context,m=p.gl,v=y.colorModeForRenderPass(),E=new wr(m.LEQUAL,wr.ReadWrite,y.depthRangeFor3D),M=y.useProgram("terrain"),A=o.getTerrainMesh();p.bindFramebuffer.set(null),p.viewport.set([0,0,y.width,y.height]);for(const R of h){const V=y.renderToTexture.getTexture(R),q=o.getTerrainData(R.tileID);p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,V.texture);const Q={u_matrix:y.transform.calculatePosMatrix(R.tileID.toUnwrapped()),u_texture:0,u_ele_delta:o.getMeshFrameDelta(y.transform.zoom)};M.draw(p,m.TRIANGLES,E,$r.disabled,v,jr.backCCW,Q,q,"terrain",A.vertexBuffer,A.indexBuffer,A.segments)}}class Kh{constructor(o,h){this.context=new op(o),this.transform=h,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:a.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Or.maxUnderzooming+Or.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xo}resize(o,h,p){if(this.width=Math.floor(o*p),this.height=Math.floor(h*p),this.pixelRatio=p,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const o=this.context,h=new a.aV;h.emplaceBack(0,0),h.emplaceBack(a.W,0),h.emplaceBack(0,a.W),h.emplaceBack(a.W,a.W),this.tileExtentBuffer=o.createVertexBuffer(h,ll.members),this.tileExtentSegments=a.$.simpleSegment(0,0,4,2);const p=new a.aV;p.emplaceBack(0,0),p.emplaceBack(a.W,0),p.emplaceBack(0,a.W),p.emplaceBack(a.W,a.W),this.debugBuffer=o.createVertexBuffer(p,ll.members),this.debugSegments=a.$.simpleSegment(0,0,4,5);const m=new a.Z;m.emplaceBack(0,0,0,0),m.emplaceBack(a.W,0,a.W,0),m.emplaceBack(0,a.W,0,a.W),m.emplaceBack(a.W,a.W,a.W,a.W),this.rasterBoundsBuffer=o.createVertexBuffer(m,Ye.members),this.rasterBoundsSegments=a.$.simpleSegment(0,0,4,2);const v=new a.aV;v.emplaceBack(0,0),v.emplaceBack(1,0),v.emplaceBack(0,1),v.emplaceBack(1,1),this.viewportBuffer=o.createVertexBuffer(v,ll.members),this.viewportSegments=a.$.simpleSegment(0,0,4,2);const E=new a.aW;E.emplaceBack(0),E.emplaceBack(1),E.emplaceBack(3),E.emplaceBack(2),E.emplaceBack(0),this.tileBorderIndexBuffer=o.createIndexBuffer(E);const M=new a.aX;M.emplaceBack(0,1,2),M.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=o.createIndexBuffer(M);const A=this.context.gl;this.stencilClearMode=new $r({func:A.ALWAYS,mask:0},0,255,A.ZERO,A.ZERO,A.ZERO)}clearStencil(){const o=this.context,h=o.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const p=a.F();a.aN(p,0,this.width,this.height,0,0,1),a.J(p,p,[h.drawingBufferWidth,h.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(o,h.TRIANGLES,wr.disabled,this.stencilClearMode,Sn.disabled,jr.disabled,fl(p),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(o,h){if(this.currentStencilSource===o.source||!o.isTileClipped()||!h||!h.length)return;this.currentStencilSource=o.source;const p=this.context,m=p.gl;this.nextStencilID+h.length>256&&this.clearStencil(),p.setColorMode(Sn.disabled),p.setDepthMode(wr.disabled);const v=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const E of h){const M=this._tileClippingMaskIDs[E.key]=this.nextStencilID++,A=this.style.map.terrain&&this.style.map.terrain.getTerrainData(E);v.draw(p,m.TRIANGLES,wr.disabled,new $r({func:m.ALWAYS,mask:0},M,255,m.KEEP,m.KEEP,m.REPLACE),Sn.disabled,jr.disabled,fl(E.posMatrix),A,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const o=this.nextStencilID++,h=this.context.gl;return new $r({func:h.NOTEQUAL,mask:255},o,255,h.KEEP,h.KEEP,h.REPLACE)}stencilModeForClipping(o){const h=this.context.gl;return new $r({func:h.EQUAL,mask:255},this._tileClippingMaskIDs[o.key],0,h.KEEP,h.KEEP,h.REPLACE)}stencilConfigForOverlap(o){const h=this.context.gl,p=o.sort((E,M)=>M.overscaledZ-E.overscaledZ),m=p[p.length-1].overscaledZ,v=p[0].overscaledZ-m+1;if(v>1){this.currentStencilSource=void 0,this.nextStencilID+v>256&&this.clearStencil();const E={};for(let M=0;M=0;this.currentLayer--){const A=this.style._layers[p[this.currentLayer]],R=m[A.source],V=v[A.source];this._renderTileClippingMasks(A,V),this.renderLayer(this,R,A,V)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerse.source&&!se.isHidden(V)?[R.sourceCaches[se.source]]:[]),he=Q.filter(se=>se.getSource().type==="vector"),ue=Q.filter(se=>se.getSource().type!=="vector"),ye=se=>{(!q||q.getSource().maxzoomye(se)),q||ue.forEach(se=>ye(se)),q}(this.style,this.transform.zoom);A&&function(R,V,q){for(let Q=0;Q0),m&&(a.a_(h,p),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,E){const M=v.context,A=M.gl,R=Sn.unblended,V=new wr(A.LEQUAL,wr.ReadWrite,[0,1]),q=E.getTerrainMesh(),Q=E.sourceCache.getRenderableTiles(),he=v.useProgram("terrainDepth");M.bindFramebuffer.set(E.getFramebuffer("depth").framebuffer),M.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),M.clear({color:a.aO.transparent,depth:1});for(const ue of Q){const ye=E.getTerrainData(ue.tileID),se={u_matrix:v.transform.calculatePosMatrix(ue.tileID.toUnwrapped()),u_ele_delta:E.getMeshFrameDelta(v.transform.zoom)};he.draw(M,A.TRIANGLES,V,$r.disabled,R,jr.backCCW,se,ye,"terrain",q.vertexBuffer,q.indexBuffer,q.segments)}M.bindFramebuffer.set(null),M.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,E){const M=v.context,A=M.gl,R=Sn.unblended,V=new wr(A.LEQUAL,wr.ReadWrite,[0,1]),q=E.getTerrainMesh(),Q=E.getCoordsTexture(),he=E.sourceCache.getRenderableTiles(),ue=v.useProgram("terrainCoords");M.bindFramebuffer.set(E.getFramebuffer("coords").framebuffer),M.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),M.clear({color:a.aO.transparent,depth:1}),E.coordsIndex=[];for(const ye of he){const se=E.getTerrainData(ye.tileID);M.activeTexture.set(A.TEXTURE0),A.bindTexture(A.TEXTURE_2D,Q.texture);const Te={u_matrix:v.transform.calculatePosMatrix(ye.tileID.toUnwrapped()),u_terrain_coords_id:(255-E.coordsIndex.length)/255,u_texture:0,u_ele_delta:E.getMeshFrameDelta(v.transform.zoom)};ue.draw(M,A.TRIANGLES,V,$r.disabled,R,jr.backCCW,Te,se,"terrain",q.vertexBuffer,q.indexBuffer,q.segments),E.coordsIndex.push(ye.tileID.key)}M.bindFramebuffer.set(null),M.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}renderLayer(o,h,p,m){if(!p.isHidden(this.transform.zoom)&&(p.type==="background"||p.type==="custom"||(m||[]).length))switch(this.id=p.id,p.type){case"symbol":(function(v,E,M,A,R){if(v.renderPass!=="translucent")return;const V=$r.disabled,q=v.colorModeForRenderPass();(M._unevaluatedLayout.hasValue("text-variable-anchor")||M._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(Q,he,ue,ye,se,Te,Ue){const we=he.transform,Le=se==="map",Ge=Te==="map";for(const He of Q){const $e=ye.getTile(He),nt=$e.getBucket(ue);if(!nt||!nt.text||!nt.text.segments.get().length)continue;const et=a.ag(nt.textSizeData,we.zoom),dt=$t($e,1,he.transform.zoom),gt=Qt(He.posMatrix,Ge,Le,he.transform,dt),ir=ue.layout.get("icon-text-fit")!=="none"&&nt.hasIconData();if(et){const _t=Math.pow(2,we.zoom-$e.tileID.overscaledZ);kl(nt,Le,Ge,Ue,we,gt,He.posMatrix,_t,et,ir,he.style.map.terrain?(Xt,or)=>he.style.map.terrain.getElevation(He,Xt,or):null)}}}(A,v,M,E,M.layout.get("text-rotation-alignment"),M.layout.get("text-pitch-alignment"),R),M.paint.get("icon-opacity").constantOr(1)!==0&&El(v,E,M,A,!1,M.paint.get("icon-translate"),M.paint.get("icon-translate-anchor"),M.layout.get("icon-rotation-alignment"),M.layout.get("icon-pitch-alignment"),M.layout.get("icon-keep-upright"),V,q),M.paint.get("text-opacity").constantOr(1)!==0&&El(v,E,M,A,!0,M.paint.get("text-translate"),M.paint.get("text-translate-anchor"),M.layout.get("text-rotation-alignment"),M.layout.get("text-pitch-alignment"),M.layout.get("text-keep-upright"),V,q),E.map.showCollisionBoxes&&(Sl(v,E,M,A,M.paint.get("text-translate"),M.paint.get("text-translate-anchor"),!0),Sl(v,E,M,A,M.paint.get("icon-translate"),M.paint.get("icon-translate-anchor"),!1))})(o,h,p,m,this.style.placement.variableOffsets);break;case"circle":(function(v,E,M,A){if(v.renderPass!=="translucent")return;const R=M.paint.get("circle-opacity"),V=M.paint.get("circle-stroke-width"),q=M.paint.get("circle-stroke-opacity"),Q=!M.layout.get("circle-sort-key").isConstant();if(R.constantOr(1)===0&&(V.constantOr(1)===0||q.constantOr(1)===0))return;const he=v.context,ue=he.gl,ye=v.depthModeForSublayer(0,wr.ReadOnly),se=$r.disabled,Te=v.colorModeForRenderPass(),Ue=[];for(let we=0;wewe.sortKey-Le.sortKey);for(const we of Ue){const{programConfiguration:Le,program:Ge,layoutVertexBuffer:He,indexBuffer:$e,uniformValues:nt,terrainData:et}=we.state;Ge.draw(he,ue.TRIANGLES,ye,se,Te,jr.disabled,nt,et,M.id,He,$e,we.segments,M.paint,v.transform.zoom,Le)}})(o,h,p,m);break;case"heatmap":(function(v,E,M,A){if(M.paint.get("heatmap-opacity")!==0)if(v.renderPass==="offscreen"){const R=v.context,V=R.gl,q=$r.disabled,Q=new Sn([V.ONE,V.ONE],a.aO.transparent,[!0,!0,!0,!0]);(function(he,ue,ye){const se=he.gl;he.activeTexture.set(se.TEXTURE1),he.viewport.set([0,0,ue.width/4,ue.height/4]);let Te=ye.heatmapFbo;if(Te)se.bindTexture(se.TEXTURE_2D,Te.colorAttachment.get()),he.bindFramebuffer.set(Te.framebuffer);else{const Ue=se.createTexture();se.bindTexture(se.TEXTURE_2D,Ue),se.texParameteri(se.TEXTURE_2D,se.TEXTURE_WRAP_S,se.CLAMP_TO_EDGE),se.texParameteri(se.TEXTURE_2D,se.TEXTURE_WRAP_T,se.CLAMP_TO_EDGE),se.texParameteri(se.TEXTURE_2D,se.TEXTURE_MIN_FILTER,se.LINEAR),se.texParameteri(se.TEXTURE_2D,se.TEXTURE_MAG_FILTER,se.LINEAR),Te=ye.heatmapFbo=he.createFramebuffer(ue.width/4,ue.height/4,!1,!1),function(we,Le,Ge,He){var $e,nt;const et=we.gl,dt=($e=we.HALF_FLOAT)!==null&&$e!==void 0?$e:et.UNSIGNED_BYTE,gt=(nt=we.RGBA16F)!==null&&nt!==void 0?nt:et.RGBA;et.texImage2D(et.TEXTURE_2D,0,gt,Le.width/4,Le.height/4,0,et.RGBA,dt,null),He.colorAttachment.set(Ge)}(he,ue,Ue,Te)}})(R,v,M),R.clear({color:a.aO.transparent});for(let he=0;he{const we=a.F();a.aN(we,0,ye.width,ye.height,0,0,1);const Le=ye.context.gl;return{u_matrix:we,u_world:[Le.drawingBufferWidth,Le.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:se.paint.get("heatmap-opacity")}})(R,V),null,V.id,R.viewportBuffer,R.quadTriangleIndexBuffer,R.viewportSegments,V.paint,R.transform.zoom)}(v,M))})(o,h,p,m);break;case"line":(function(v,E,M,A){if(v.renderPass!=="translucent")return;const R=M.paint.get("line-opacity"),V=M.paint.get("line-width");if(R.constantOr(1)===0||V.constantOr(1)===0)return;const q=v.depthModeForSublayer(0,wr.ReadOnly),Q=v.colorModeForRenderPass(),he=M.paint.get("line-dasharray"),ue=M.paint.get("line-pattern"),ye=ue.constantOr(1),se=M.paint.get("line-gradient"),Te=M.getCrossfadeParameters(),Ue=ye?"linePattern":he?"lineSDF":se?"lineGradient":"line",we=v.context,Le=we.gl;let Ge=!0;for(const He of A){const $e=E.getTile(He);if(ye&&!$e.patternsLoaded())continue;const nt=$e.getBucket(M);if(!nt)continue;const et=nt.programConfigurations.get(M.id),dt=v.context.program.get(),gt=v.useProgram(Ue,et),ir=Ge||gt.program!==dt,_t=v.style.map.terrain&&v.style.map.terrain.getTerrainData(He),Xt=ue.constantOr(null);if(Xt&&$e.imageAtlas){const Yt=$e.imageAtlas,cr=Yt.patternPositions[Xt.to.toString()],dr=Yt.patternPositions[Xt.from.toString()];cr&&dr&&et.setConstantPatternPositions(cr,dr)}const or=_t?He:null,xr=ye?ds(v,$e,M,Te,or):he?pl(v,$e,M,he,Te,or):se?Rh(v,$e,M,nt.lineClipsArray.length,or):dl(v,$e,M,or);if(ye)we.activeTexture.set(Le.TEXTURE0),$e.imageAtlasTexture.bind(Le.LINEAR,Le.CLAMP_TO_EDGE),et.updatePaintBuffers(Te);else if(he&&(ir||v.lineAtlas.dirty))we.activeTexture.set(Le.TEXTURE0),v.lineAtlas.bind(we);else if(se){const Yt=nt.gradients[M.id];let cr=Yt.texture;if(M.gradientVersion!==Yt.version){let dr=256;if(M.stepInterpolant){const hn=E.getSource().maxzoom,Rr=He.canonical.z===hn?Math.ceil(1<0?h.pop():null}isPatternMissing(o){if(!o)return!1;if(!o.from||!o.to)return!0;const h=this.imageManager.getPattern(o.from.toString()),p=this.imageManager.getPattern(o.to.toString());return!h||!p}useProgram(o,h){this.cache=this.cache||{};const p=o+(h?h.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[p]||(this.cache[p]=new Ko(this.context,Ea[o],h,Bh[o],this._showOverdrawInspector,this.style.map.terrain)),this.cache[p]}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 o=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(o.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new re(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:o,drawingBufferHeight:h}=this.context.gl;return this.width!==o||this.height!==h}}class Yo{constructor(o,h){this.points=o,this.planes=h}static fromInvProjectionMatrix(o,h,p){const m=Math.pow(2,p),v=[[-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(M=>{const A=1/(M=a.af([],M,o))[3]/h*m;return a.a$(M,M,[A,A,1/M[3],A])}),E=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(M=>{const A=function(Q,he){var ue=he[0],ye=he[1],se=he[2],Te=ue*ue+ye*ye+se*se;return Te>0&&(Te=1/Math.sqrt(Te)),Q[0]=he[0]*Te,Q[1]=he[1]*Te,Q[2]=he[2]*Te,Q}([],function(Q,he,ue){var ye=he[0],se=he[1],Te=he[2],Ue=ue[0],we=ue[1],Le=ue[2];return Q[0]=se*Le-Te*we,Q[1]=Te*Ue-ye*Le,Q[2]=ye*we-se*Ue,Q}([],Y([],v[M[0]],v[M[1]]),Y([],v[M[2]],v[M[1]]))),R=-((V=A)[0]*(q=v[M[1]])[0]+V[1]*q[1]+V[2]*q[2]);var V,q;return A.concat(R)});return new Yo(v,E)}}class Qo{constructor(o,h){this.min=o,this.max=h,this.center=function(p,m,v){return p[0]=.5*m[0],p[1]=.5*m[1],p[2]=.5*m[2],p}([],function(p,m,v){return p[0]=m[0]+v[0],p[1]=m[1]+v[1],p[2]=m[2]+v[2],p}([],this.min,this.max))}quadrant(o){const h=[o%2==0,o<2],p=me(this.min),m=me(this.max);for(let v=0;v=0&&E++;if(E===0)return 0;E!==h.length&&(p=!1)}if(p)return 2;for(let m=0;m<3;m++){let v=Number.MAX_VALUE,E=-Number.MAX_VALUE;for(let M=0;Mthis.max[m]-this.min[m])return 0}return 1}}class Ws{constructor(o=0,h=0,p=0,m=0){if(isNaN(o)||o<0||isNaN(h)||h<0||isNaN(p)||p<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=o,this.bottom=h,this.left=p,this.right=m}interpolate(o,h,p){return h.top!=null&&o.top!=null&&(this.top=a.z.number(o.top,h.top,p)),h.bottom!=null&&o.bottom!=null&&(this.bottom=a.z.number(o.bottom,h.bottom,p)),h.left!=null&&o.left!=null&&(this.left=a.z.number(o.left,h.left,p)),h.right!=null&&o.right!=null&&(this.right=a.z.number(o.right,h.right,p)),this}getCenter(o,h){const p=a.ac((this.left+o-this.right)/2,0,o),m=a.ac((this.top+h-this.bottom)/2,0,h);return new a.P(p,m)}equals(o){return this.top===o.top&&this.bottom===o.bottom&&this.left===o.left&&this.right===o.right}clone(){return new Ws(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Qc=85.051129;class Pl{constructor(o,h,p,m,v){this.tileSize=512,this._renderWorldCopies=v===void 0||!!v,this._minZoom=o||0,this._maxZoom=h||22,this._minPitch=p??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Ws,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const o=new Pl(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return o.apply(this),o}apply(o){this.tileSize=o.tileSize,this.latRange=o.latRange,this.width=o.width,this.height=o.height,this._center=o._center,this._elevation=o._elevation,this.minElevationForCurrentTile=o.minElevationForCurrentTile,this.zoom=o.zoom,this.angle=o.angle,this._fov=o._fov,this._pitch=o._pitch,this._unmodified=o._unmodified,this._edgeInsets=o._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(o){this._minZoom!==o&&(this._minZoom=o,this.zoom=Math.max(this.zoom,o))}get maxZoom(){return this._maxZoom}set maxZoom(o){this._maxZoom!==o&&(this._maxZoom=o,this.zoom=Math.min(this.zoom,o))}get minPitch(){return this._minPitch}set minPitch(o){this._minPitch!==o&&(this._minPitch=o,this.pitch=Math.max(this.pitch,o))}get maxPitch(){return this._maxPitch}set maxPitch(o){this._maxPitch!==o&&(this._maxPitch=o,this.pitch=Math.min(this.pitch,o))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(o){o===void 0?o=!0:o===null&&(o=!1),this._renderWorldCopies=o}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(o){const h=-a.b1(o,-180,180)*Math.PI/180;this.angle!==h&&(this._unmodified=!1,this.angle=h,this._calcMatrices(),this.rotationMatrix=function(){var p=new a.A(4);return a.A!=Float32Array&&(p[1]=0,p[2]=0),p[0]=1,p[3]=1,p}(),function(p,m,v){var E=m[0],M=m[1],A=m[2],R=m[3],V=Math.sin(v),q=Math.cos(v);p[0]=E*q+A*V,p[1]=M*q+R*V,p[2]=E*-V+A*q,p[3]=M*-V+R*q}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(o){const h=a.ac(o,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==h&&(this._unmodified=!1,this._pitch=h,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(o){o=Math.max(.01,Math.min(60,o)),this._fov!==o&&(this._unmodified=!1,this._fov=o/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(o){const h=Math.min(Math.max(o,this.minZoom),this.maxZoom);this._zoom!==h&&(this._unmodified=!1,this._zoom=h,this.tileZoom=Math.max(0,Math.floor(h)),this.scale=this.zoomScale(h),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(o){o.lat===this._center.lat&&o.lng===this._center.lng||(this._unmodified=!1,this._center=o,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(o){o!==this._elevation&&(this._elevation=o,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(o){this._edgeInsets.equals(o)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,o,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(o){return this._edgeInsets.equals(o)}interpolatePadding(o,h,p){this._unmodified=!1,this._edgeInsets.interpolate(o,h,p),this._constrain(),this._calcMatrices()}coveringZoomLevel(o){const h=(o.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/o.tileSize));return Math.max(0,h)}getVisibleUnwrappedCoordinates(o){const h=[new a.b2(0,o)];if(this._renderWorldCopies){const p=this.pointCoordinate(new a.P(0,0)),m=this.pointCoordinate(new a.P(this.width,0)),v=this.pointCoordinate(new a.P(this.width,this.height)),E=this.pointCoordinate(new a.P(0,this.height)),M=Math.floor(Math.min(p.x,m.x,v.x,E.x)),A=Math.floor(Math.max(p.x,m.x,v.x,E.x)),R=1;for(let V=M-R;V<=A+R;V++)V!==0&&h.push(new a.b2(V,o))}return h}coveringTiles(o){var h,p;let m=this.coveringZoomLevel(o);const v=m;if(o.minzoom!==void 0&&mo.maxzoom&&(m=o.maxzoom);const E=this.pointCoordinate(this.getCameraPoint()),M=a.Y.fromLngLat(this.center),A=Math.pow(2,m),R=[A*E.x,A*E.y,0],V=[A*M.x,A*M.y,0],q=Yo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,m);let Q=o.minzoom||0;!o.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(Q=m);const he=o.terrain?2/Math.min(this.tileSize,o.tileSize)*this.tileSize:3,ue=we=>({aabb:new Qo([we*A,0,0],[(we+1)*A,A,0]),zoom:0,x:0,y:0,wrap:we,fullyVisible:!1}),ye=[],se=[],Te=m,Ue=o.reparseOverscaled?v:m;if(this._renderWorldCopies)for(let we=1;we<=3;we++)ye.push(ue(-we)),ye.push(ue(we));for(ye.push(ue(0));ye.length>0;){const we=ye.pop(),Le=we.x,Ge=we.y;let He=we.fullyVisible;if(!He){const gt=we.aabb.intersects(q);if(gt===0)continue;He=gt===2}const $e=o.terrain?R:V,nt=we.aabb.distanceX($e),et=we.aabb.distanceY($e),dt=Math.max(Math.abs(nt),Math.abs(et));if(we.zoom===Te||dt>he+(1<=Q){const gt=Te-we.zoom,ir=R[0]-.5-(Le<>1),Xt=we.zoom+1;let or=we.aabb.quadrant(gt);if(o.terrain){const xr=new a.Q(Xt,we.wrap,Xt,ir,_t),Yt=o.terrain.getMinMaxElevation(xr),cr=(h=Yt.minElevation)!==null&&h!==void 0?h:this.elevation,dr=(p=Yt.maxElevation)!==null&&p!==void 0?p:this.elevation;or=new Qo([or.min[0],or.min[1],cr],[or.max[0],or.max[1],dr])}ye.push({aabb:or,zoom:Xt,x:ir,y:_t,wrap:we.wrap,fullyVisible:He})}}return se.sort((we,Le)=>we.distanceSq-Le.distanceSq).map(we=>we.tileID)}resize(o,h){this.width=o,this.height=h,this.pixelsToGLUnits=[2/o,-2/h],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(o){return Math.pow(2,o)}scaleZoom(o){return Math.log(o)/Math.LN2}project(o){const h=a.ac(o.lat,-85.051129,Qc);return new a.P(a.N(o.lng)*this.worldSize,a.O(h)*this.worldSize)}unproject(o){return new a.Y(o.x/this.worldSize,o.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(o){const h=this.elevation,p=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,o),v=o.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-v))return;const E=p+h-v,M=Math.cos(this._pitch)*this.cameraToCenterDistance/E/a.b3(1,m.lat),A=this.scaleZoom(M/this.tileSize);this._elevation=v,this._center=m,this.zoom=A}setLocationAtPoint(o,h){const p=this.pointCoordinate(h),m=this.pointCoordinate(this.centerPoint),v=this.locationCoordinate(o),E=new a.Y(v.x-(p.x-m.x),v.y-(p.y-m.y));this.center=this.coordinateLocation(E),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(o,h){return h?this.coordinatePoint(this.locationCoordinate(o),h.getElevationForLngLatZoom(o,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(o))}pointLocation(o,h){return this.coordinateLocation(this.pointCoordinate(o,h))}locationCoordinate(o){return a.Y.fromLngLat(o)}coordinateLocation(o){return o&&o.toLngLat()}pointCoordinate(o,h){if(h){const Q=h.pointCoordinate(o);if(Q!=null)return Q}const p=[o.x,o.y,0,1],m=[o.x,o.y,1,1];a.af(p,p,this.pixelMatrixInverse),a.af(m,m,this.pixelMatrixInverse);const v=p[3],E=m[3],M=p[1]/v,A=m[1]/E,R=p[2]/v,V=m[2]/E,q=R===V?0:(0-R)/(V-R);return new a.Y(a.z.number(p[0]/v,m[0]/E,q)/this.worldSize,a.z.number(M,A,q)/this.worldSize)}coordinatePoint(o,h=0,p=this.pixelMatrix){const m=[o.x*this.worldSize,o.y*this.worldSize,h,1];return a.af(m,m,p),new a.P(m[0]/m[3],m[1]/m[3])}getBounds(){const o=Math.max(0,this.height/2-this.getHorizon());return new at().extend(this.pointLocation(new a.P(0,o))).extend(this.pointLocation(new a.P(this.width,o))).extend(this.pointLocation(new a.P(this.width,this.height))).extend(this.pointLocation(new a.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new at([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(o){o?(this.lngRange=[o.getWest(),o.getEast()],this.latRange=[o.getSouth(),o.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Qc])}calculatePosMatrix(o,h=!1){const p=o.key,m=h?this._alignedPosMatrixCache:this._posMatrixCache;if(m[p])return m[p];const v=o.canonical,E=this.worldSize/this.zoomScale(v.z),M=v.x+Math.pow(2,v.z)*o.wrap,A=a.an(new Float64Array(16));return a.H(A,A,[M*E,v.y*E,0]),a.J(A,A,[E/a.W,E/a.W,1]),a.K(A,h?this.alignedProjMatrix:this.projMatrix,A),m[p]=new Float32Array(A),m[p]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(o,h){h=a.ac(+h,this.minZoom,this.maxZoom);const p={center:new a.M(o.lng,o.lat),zoom:h};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const we=179.9999999999;m=[-we,we]}const v=this.tileSize*this.zoomScale(p.zoom);let E=0,M=v,A=0,R=v,V=0,q=0;const{x:Q,y:he}=this.size;if(this.latRange){const we=this.latRange;E=a.O(we[1])*v,M=a.O(we[0])*v,M-EM&&(Te=M-we)}if(m){const we=(A+R)/2;let Le=ue;this._renderWorldCopies&&(Le=a.b1(ue,we-v/2,we+v/2));const Ge=Q/2;Le-GeR&&(se=R-Ge)}if(se!==void 0||Te!==void 0){const we=new a.P(se??ue,Te??ye);p.center=this.unproject.call({worldSize:v},we).wrap()}return p}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const o=this._unmodified,{center:h,zoom:p}=this.getConstrained(this.center,this.zoom);this.center=h,this.zoom=p,this._unmodified=o,this._constraining=!1}_calcMatrices(){if(!this.height)return;const o=this.centerOffset,h=this.point.x,p=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=a.b3(1,this.center.lat)*this.worldSize;let m=a.an(new Float64Array(16));a.J(m,m,[this.width/2,-this.height/2,1]),a.H(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=a.an(new Float64Array(16)),a.J(m,m,[1,-1,1]),a.H(m,m,[-1,-1,0]),a.J(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;const v=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),E=Math.min(this.elevation,this.minElevationForCurrentTile),M=v-E*this._pixelPerMeter/Math.cos(this._pitch),A=E<0?M:v,R=Math.PI/2+this._pitch,V=this._fov*(.5+o.y/this.height),q=Math.sin(V)*A/Math.sin(a.ac(Math.PI-R-V,.01,Math.PI-.01)),Q=this.getHorizon(),he=2*Math.atan(Q/this.cameraToCenterDistance)*(.5+o.y/(2*Q)),ue=Math.sin(he)*A/Math.sin(a.ac(Math.PI-R-he,.01,Math.PI-.01)),ye=Math.min(q,ue),se=1.01*(Math.cos(Math.PI/2-this._pitch)*ye+A),Te=this.height/50;m=new Float64Array(16),a.b4(m,this._fov,this.width/this.height,Te,se),m[8]=2*-o.x/this.width,m[9]=2*o.y/this.height,a.J(m,m,[1,-1,1]),a.H(m,m,[0,0,-this.cameraToCenterDistance]),a.b5(m,m,this._pitch),a.ad(m,m,this.angle),a.H(m,m,[-h,-p,0]),this.mercatorMatrix=a.J([],m,[this.worldSize,this.worldSize,this.worldSize]),a.J(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=a.K(new Float64Array(16),this.labelPlaneMatrix,m),a.H(m,m,[0,0,-this.elevation]),this.projMatrix=m,this.invProjMatrix=a.ar([],m),this.pixelMatrix3D=a.K(new Float64Array(16),this.labelPlaneMatrix,m);const Ue=this.width%2/2,we=this.height%2/2,Le=Math.cos(this.angle),Ge=Math.sin(this.angle),He=h-Math.round(h)+Le*Ue+Ge*we,$e=p-Math.round(p)+Le*we+Ge*Ue,nt=new Float64Array(m);if(a.H(nt,nt,[He>.5?He-1:He,$e>.5?$e-1:$e,0]),this.alignedProjMatrix=nt,m=a.ar(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const o=this.pointCoordinate(new a.P(0,0)),h=[o.x*this.worldSize,o.y*this.worldSize,0,1];return a.af(h,h,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const o=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.P(0,o))}getCameraQueryGeometry(o){const h=this.getCameraPoint();if(o.length===1)return[o[0],h];{let p=h.x,m=h.y,v=h.x,E=h.y;for(const M of o)p=Math.min(p,M.x),m=Math.min(m,M.y),v=Math.max(v,M.x),E=Math.max(E,M.y);return[new a.P(p,m),new a.P(v,m),new a.P(v,E),new a.P(p,E),new a.P(p,m)]}}lngLatToCameraDepth(o,h){const p=this.locationCoordinate(o),m=[p.x*this.worldSize,p.y*this.worldSize,h,1];return a.af(m,m,this.projMatrix),m[2]/m[3]}}function eu(y,o){let h,p=!1,m=null,v=null;const E=()=>{m=null,p&&(y.apply(v,h),m=setTimeout(E,o),p=!1)};return(...M)=>(p=!0,v=this,h=M,m||E(),m)}class tu{constructor(o){this._getCurrentHash=()=>{const h=window.location.hash.replace("#","");if(this._hashName){let p;return h.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(p=m)}),(p&&p[1]||"").split("/")}return h.split("/")},this._onHashChange=()=>{const h=this._getCurrentHash();if(h.length>=3&&!h.some(p=>isNaN(p))){const p=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(h[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+h[2],+h[1]],zoom:+h[0],bearing:p,pitch:+(h[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const h=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,h)}catch{}},this._updateHash=eu(this._updateHashUnthrottled,300),this._hashName=o&&encodeURIComponent(o)}addTo(o){return this._map=o,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()),delete this._map,this}getHashString(o){const h=this._map.getCenter(),p=Math.round(100*this._map.getZoom())/100,m=Math.ceil((p*Math.LN2+Math.log(512/360/.5))/Math.LN10),v=Math.pow(10,m),E=Math.round(h.lng*v)/v,M=Math.round(h.lat*v)/v,A=this._map.getBearing(),R=this._map.getPitch();let V="";if(V+=o?`/${E}/${M}/${p}`:`${p}/${M}/${E}`,(A||R)&&(V+="/"+Math.round(10*A)/10),R&&(V+=`/${Math.round(R)}`),this._hashName){const q=this._hashName;let Q=!1;const he=window.location.hash.slice(1).split("&").map(ue=>{const ye=ue.split("=")[0];return ye===q?(Q=!0,`${ye}=${V}`):ue}).filter(ue=>ue);return Q||he.push(`${q}=${V}`),`#${he.join("&")}`}return`#${V}`}}const Da={linearity:.3,easing:a.b6(0,0,.3,1)},_s=a.e({deceleration:2500,maxSpeed:1400},Da),Jh=a.e({deceleration:20,maxSpeed:1400},Da),Yh=a.e({deceleration:1e3,maxSpeed:360},Da),Qh=a.e({deceleration:1e3,maxSpeed:90},Da);class ef{constructor(o){this._map=o,this.clear()}clear(){this._inertiaBuffer=[]}record(o){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:k.now(),settings:o})}_drainInertiaBuffer(){const o=this._inertiaBuffer,h=k.now();for(;o.length>0&&h-o[0].time>160;)o.shift()}_onMoveEnd(o){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const h={zoom:0,bearing:0,pitch:0,pan:new a.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:v}of this._inertiaBuffer)h.zoom+=v.zoomDelta||0,h.bearing+=v.bearingDelta||0,h.pitch+=v.pitchDelta||0,v.panDelta&&h.pan._add(v.panDelta),v.around&&(h.around=v.around),v.pinchAround&&(h.pinchAround=v.pinchAround);const p=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(h.pan.mag()){const v=Ba(h.pan.mag(),p,a.e({},_s,o||{}));m.offset=h.pan.mult(v.amount/h.pan.mag()),m.center=this._map.transform.center,Ra(m,v)}if(h.zoom){const v=Ba(h.zoom,p,Jh);m.zoom=this._map.transform.zoom+v.amount,Ra(m,v)}if(h.bearing){const v=Ba(h.bearing,p,Yh);m.bearing=this._map.transform.bearing+a.ac(v.amount,-179,179),Ra(m,v)}if(h.pitch){const v=Ba(h.pitch,p,Qh);m.pitch=this._map.transform.pitch+v.amount,Ra(m,v)}if(m.zoom||m.bearing){const v=h.pinchAround===void 0?h.around:h.pinchAround;m.around=v?this._map.unproject(v):this._map.getCenter()}return this.clear(),a.e(m,{noMoveStart:!0})}}function Ra(y,o){(!y.duration||y.durationh.unproject(A)),M=v.reduce((A,R,V,q)=>A.add(R.div(q.length)),new a.P(0,0));super(o,{points:v,point:M,lngLats:E,lngLat:h.unproject(M),originalEvent:p}),this._defaultPrevented=!1}}class ru extends a.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(o,h,p){super(o,{originalEvent:p}),this._defaultPrevented=!1}}class no{constructor(o,h){this._map=o,this._clickTolerance=h.clickTolerance}reset(){delete this._mousedownPos}wheel(o){return this._firePreventable(new ru(o.type,this._map,o))}mousedown(o,h){return this._mousedownPos=h,this._firePreventable(new xi(o.type,this._map,o))}mouseup(o){this._map.fire(new xi(o.type,this._map,o))}click(o,h){this._mousedownPos&&this._mousedownPos.dist(h)>=this._clickTolerance||this._map.fire(new xi(o.type,this._map,o))}dblclick(o){return this._firePreventable(new xi(o.type,this._map,o))}mouseover(o){this._map.fire(new xi(o.type,this._map,o))}mouseout(o){this._map.fire(new xi(o.type,this._map,o))}touchstart(o){return this._firePreventable(new _o(o.type,this._map,o))}touchmove(o){this._map.fire(new _o(o.type,this._map,o))}touchend(o){this._map.fire(new _o(o.type,this._map,o))}touchcancel(o){this._map.fire(new _o(o.type,this._map,o))}_firePreventable(o){if(this._map.fire(o),o.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class yo{constructor(o){this._map=o}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(o){this._map.fire(new xi(o.type,this._map,o))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new xi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(o){this._delayContextMenu?this._contextMenuEvent=o:this._ignoreContextMenu||this._map.fire(new xi(o.type,this._map,o)),this._map.listens("contextmenu")&&o.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Zs{constructor(o){this._map=o}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(o){return this.transform.pointLocation(a.P.convert(o),this._map.terrain)}}class io{constructor(o,h){this._map=o,this._tr=new Zs(o),this._el=o.getCanvasContainer(),this._container=o.getContainer(),this._clickTolerance=h.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(o,h){this.isEnabled()&&o.shiftKey&&o.button===0&&(C.disableDrag(),this._startPos=this._lastPos=h,this._active=!0)}mousemoveWindow(o,h){if(!this._active)return;const p=h;if(this._lastPos.equals(p)||!this._box&&p.dist(this._startPos)v.fitScreenCoordinates(p,m,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",o)}keydown(o){this._active&&o.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",o))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(C.remove(this._box),this._box=null),C.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(o,h){return this._map.fire(new a.k(o,{originalEvent:h}))}}function ys(y,o){if(y.length!==o.length)throw new Error(`The number of touches and points are not equal - touches ${y.length}, points ${o.length}`);const h={};for(let p=0;pthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=o.timeStamp),p.length===this.numTouches&&(this.centroid=function(m){const v=new a.P(0,0);for(const E of m)v._add(E);return v.div(m.length)}(h),this.touches=ys(p,h)))}touchmove(o,h,p){if(this.aborted||!this.centroid)return;const m=ys(p,h);for(const v in this.touches){const E=m[v];(!E||E.dist(this.touches[v])>30)&&(this.aborted=!0)}}touchend(o,h,p){if((!this.centroid||o.timeStamp-this.startTime>500)&&(this.aborted=!0),p.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class nu{constructor(o){this.singleTap=new ap(o),this.numTaps=o.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(o,h,p){this.singleTap.touchstart(o,h,p)}touchmove(o,h,p){this.singleTap.touchmove(o,h,p)}touchend(o,h,p){const m=this.singleTap.touchend(o,h,p);if(m){const v=o.timeStamp-this.lastTime<500,E=!this.lastTap||this.lastTap.dist(m)<30;if(v&&E||this.reset(),this.count++,this.lastTime=o.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class lp{constructor(o){this._tr=new Zs(o),this._zoomIn=new nu({numTouches:1,numTaps:2}),this._zoomOut=new nu({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(o,h,p){this._zoomIn.touchstart(o,h,p),this._zoomOut.touchstart(o,h,p)}touchmove(o,h,p){this._zoomIn.touchmove(o,h,p),this._zoomOut.touchmove(o,h,p)}touchend(o,h,p){const m=this._zoomIn.touchend(o,h,p),v=this._zoomOut.touchend(o,h,p),E=this._tr;return m?(this._active=!0,o.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:M=>M.easeTo({duration:300,zoom:E.zoom+1,around:E.unproject(m)},{originalEvent:o})}):v?(this._active=!0,o.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:M=>M.easeTo({duration:300,zoom:E.zoom-1,around:E.unproject(v)},{originalEvent:o})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Hs{constructor(o){this._enabled=!!o.enable,this._moveStateManager=o.moveStateManager,this._clickTolerance=o.clickTolerance||1,this._moveFunction=o.move,this._activateOnStart=!!o.activateOnStart,o.assignEvents(this),this.reset()}reset(o){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(o)}_move(...o){const h=this._moveFunction(...o);if(h.bearingDelta||h.pitchDelta||h.around||h.panDelta)return this._active=!0,h}dragStart(o,h){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(o)&&(this._moveStateManager.startMove(o),this._lastPoint=h.length?h[0]:h,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(o,h){if(!this.isEnabled())return;const p=this._lastPoint;if(!p)return;if(o.preventDefault(),!this._moveStateManager.isValidMoveEvent(o))return void this.reset(o);const m=h.length?h[0]:h;return!this._moved&&m.dist(p){y.mousedown=y.dragStart,y.mousemoveWindow=y.dragMove,y.mouseup=y.dragEnd,y.contextmenu=function(o){o.preventDefault()}},$s=({enable:y,clickTolerance:o,bearingDegreesPerPixelMoved:h=.8})=>{const p=new vo({checkCorrectEvent:m=>C.mouseButton(m)===0&&m.ctrlKey||C.mouseButton(m)===2});return new Hs({clickTolerance:o,move:(m,v)=>({bearingDelta:(v.x-m.x)*h}),moveStateManager:p,enable:y,assignEvents:zl})},Xs=({enable:y,clickTolerance:o,pitchDegreesPerPixelMoved:h=-.5})=>{const p=new vo({checkCorrectEvent:m=>C.mouseButton(m)===0&&m.ctrlKey||C.mouseButton(m)===2});return new Hs({clickTolerance:o,move:(m,v)=>({pitchDelta:(v.y-m.y)*h}),moveStateManager:p,enable:y,assignEvents:zl})};class tf{constructor(o,h){this._clickTolerance=o.clickTolerance||1,this._map=h,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new a.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(o,h,p){return this._calculateTransform(o,h,p)}touchmove(o,h,p){if(this._active&&!(p.length0&&(this._active=!0);const m=ys(p,h),v=new a.P(0,0),E=new a.P(0,0);let M=0;for(const R in m){const V=m[R],q=this._touches[R];q&&(v._add(V),E._add(V.sub(q)),M++,m[R]=V)}if(this._touches=m,MMath.abs(y.x)}class of extends xt{constructor(o){super(),this._currentTouchCount=0,this._map=o}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(o,h,p){super.touchstart(o,h,p),this._currentTouchCount=p.length}_start(o){this._lastPoints=o,Rl(o[0].sub(o[1]))&&(this._valid=!1)}_move(o,h,p){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=o[0].sub(this._lastPoints[0]),v=o[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,v,p.timeStamp),this._valid?(this._lastPoints=o,this._active=!0,{pitchDelta:(m.y+v.y)/2*-.5}):void 0}gestureBeginsVertically(o,h,p){if(this._valid!==void 0)return this._valid;const m=o.mag()>=2,v=h.mag()>=2;if(!m&&!v)return;if(!m||!v)return this._firstMove===void 0&&(this._firstMove=p),p-this._firstMove<100&&void 0;const E=o.y>0==h.y>0;return Rl(o)&&Rl(h)&&E}}const cp={panStep:100,bearingStep:15,pitchStep:10};class es{constructor(o){this._tr=new Zs(o);const h=cp;this._panStep=h.panStep,this._bearingStep=h.bearingStep,this._pitchStep=h.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(o){if(o.altKey||o.ctrlKey||o.metaKey)return;let h=0,p=0,m=0,v=0,E=0;switch(o.keyCode){case 61:case 107:case 171:case 187:h=1;break;case 189:case 109:case 173:h=-1;break;case 37:o.shiftKey?p=-1:(o.preventDefault(),v=-1);break;case 39:o.shiftKey?p=1:(o.preventDefault(),v=1);break;case 38:o.shiftKey?m=1:(o.preventDefault(),E=-1);break;case 40:o.shiftKey?m=-1:(o.preventDefault(),E=1);break;default:return}return this._rotationDisabled&&(p=0,m=0),{cameraAnimation:M=>{const A=this._tr;M.easeTo({duration:300,easeId:"keyboardHandler",easing:Qr,zoom:h?Math.round(A.zoom)+h*(o.shiftKey?2:1):A.zoom,bearing:A.bearing+p*this._bearingStep,pitch:A.pitch+m*this._pitchStep,offset:[-v*this._panStep,-E*this._panStep],center:A.center},{originalEvent:o})}}}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 Qr(y){return y*(2-y)}const Oa=4.000244140625;class Bl{constructor(o,h){this._onTimeout=p=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(p)},this._map=o,this._tr=new Zs(o),this._triggerRenderFrame=h,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(o){this._defaultZoomRate=o}setWheelZoomRate(o){this._wheelZoomRate=o}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(o){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!o&&o.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(o){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!o[this._map.cooperativeGestures._bypassKey])return;let h=o.deltaMode===WheelEvent.DOM_DELTA_LINE?40*o.deltaY:o.deltaY;const p=k.now(),m=p-(this._lastWheelEventTime||0);this._lastWheelEventTime=p,h!==0&&h%Oa==0?this._type="wheel":h!==0&&Math.abs(h)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=h,this._timeout=setTimeout(this._onTimeout,40,o)):this._type||(this._type=Math.abs(m*h)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,h+=this._lastValue)),o.shiftKey&&h&&(h/=4),this._type&&(this._lastWheelEvent=o,this._delta-=h,this._active||this._start(o)),o.preventDefault()}_start(o){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 h=C.mousePos(this._map.getCanvas(),o),p=this._tr;this._around=h.y>p.transform.height/2-p.transform.getHorizon()?a.M.convert(this._aroundCenter?p.center:p.unproject(h)):a.M.convert(p.center),this._aroundPoint=p.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const o=this._tr.transform;if(this._delta!==0){const M=this._type==="wheel"&&Math.abs(this._delta)>Oa?this._wheelZoomRate:this._defaultZoomRate;let A=2/(1+Math.exp(-Math.abs(this._delta*M)));this._delta<0&&A!==0&&(A=1/A);const R=typeof this._targetZoom=="number"?o.zoomScale(this._targetZoom):o.scale;this._targetZoom=Math.min(o.maxZoom,Math.max(o.minZoom,o.scaleZoom(R*A))),this._type==="wheel"&&(this._startZoom=o.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const h=typeof this._targetZoom=="number"?this._targetZoom:o.zoom,p=this._startZoom,m=this._easing;let v,E=!1;if(this._type==="wheel"&&p&&m){const M=Math.min((k.now()-this._lastWheelEventTime)/200,1),A=m(M);v=a.z.number(p,h,A),M<1?this._frameId||(this._frameId=!0):E=!0}else v=h,E=!0;return this._active=!0,E&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!E,zoomDelta:v-o.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(o){let h=a.b7;if(this._prevEase){const p=this._prevEase,m=(k.now()-p.start)/p.duration,v=p.easing(m+.01)-p.easing(m),E=.27/Math.sqrt(v*v+1e-4)*.01,M=Math.sqrt(.0729-E*E);h=a.b6(E,M,.25,1)}return this._prevEase={start:k.now(),duration:o,easing:h},h}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ou{constructor(o,h){this._clickZoom=o,this._tapZoom=h}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 sf{constructor(o){this._tr=new Zs(o),this.reset()}reset(){this._active=!1}dblclick(o,h){return o.preventDefault(),{cameraAnimation:p=>{p.easeTo({duration:300,zoom:this._tr.zoom+(o.shiftKey?-1:1),around:this._tr.unproject(h)},{originalEvent:o})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class af{constructor(){this._tap=new nu({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(o,h,p){if(!this._swipePoint)if(this._tapTime){const m=h[0],v=o.timeStamp-this._tapTime<500,E=this._tapPoint.dist(m)<30;v&&E?p.length>0&&(this._swipePoint=m,this._swipeTouch=p[0].identifier):this.reset()}else this._tap.touchstart(o,h,p)}touchmove(o,h,p){if(this._tapTime){if(this._swipePoint){if(p[0].identifier!==this._swipeTouch)return;const m=h[0],v=m.y-this._swipePoint.y;return this._swipePoint=m,o.preventDefault(),this._active=!0,{zoomDelta:v/128}}}else this._tap.touchmove(o,h,p)}touchend(o,h,p){if(this._tapTime)this._swipePoint&&p.length===0&&this.reset();else{const m=this._tap.touchend(o,h,p);m&&(this._tapTime=o.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class lf{constructor(o,h,p){this._el=o,this._mousePan=h,this._touchPan=p}enable(o){this._inertiaOptions=o||{},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 oo{constructor(o,h,p){this._pitchWithRotate=o.pitchWithRotate,this._mouseRotate=h,this._mousePitch=p}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Na{constructor(o,h,p,m){this._el=o,this._touchZoom=h,this._touchRotate=p,this._tapDragZoom=m,this._rotationDisabled=!1,this._enabled=!0}enable(o){this._touchZoom.enable(o),this._rotationDisabled||this._touchRotate.enable(o),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 Bt{constructor(o,h){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=o,this._options=h,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const o=this._map.getCanvasContainer();o.classList.add("maplibregl-cooperative-gestures"),this._container=C.create("div","maplibregl-cooperative-gesture-screen",o);let h=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(h=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const p=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=h,this._container.appendChild(m);const v=document.createElement("div");v.className="maplibregl-mobile-message",v.textContent=p,this._container.appendChild(v),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(C.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._destoryUI()}isEnabled(){return this._enabled}touchmove(o){this._onCooperativeGesture(o.touches.length===1)}wheel(o){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!o[this._bypassKey])}_onCooperativeGesture(o){this._enabled&&o&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Gt=y=>y.zoom||y.drag||y.pitch||y.rotate;class Fl extends a.k{}function ja(y){return y.panDelta&&y.panDelta.mag()||y.zoomDelta||y.bearingDelta||y.pitchDelta}class su{constructor(o,h){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,v)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const E=m.type==="renderFrame"?void 0:m,M={needsRenderFrame:!1},A={},R={},V=m.touches,q=V?this._getMapTouches(V):void 0,Q=q?C.touchPos(this._map.getCanvas(),q):C.mousePos(this._map.getCanvas(),m);for(const{handlerName:ye,handler:se,allowed:Te}of this._handlers){if(!se.isEnabled())continue;let Ue;this._blockedByActive(R,Te,ye)?se.reset():se[v||m.type]&&(Ue=se[v||m.type](m,Q,q),this.mergeHandlerResult(M,A,Ue,ye,E),Ue&&Ue.needsRenderFrame&&this._triggerRenderFrame()),(Ue||se.isActive())&&(R[ye]=se)}const he={};for(const ye in this._previousActiveHandlers)R[ye]||(he[ye]=E);this._previousActiveHandlers=R,(Object.keys(he).length||ja(M))&&(this._changes.push([M,A,he]),this._triggerRenderFrame()),(Object.keys(R).length||ja(M))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ue}=M;ue&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ue(this._map))},this._map=o,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ef(o),this._bearingSnap=h.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(h);const p=this._el;this._listeners=[[p,"touchstart",{passive:!0}],[p,"touchmove",{passive:!1}],[p,"touchend",void 0],[p,"touchcancel",void 0],[p,"mousedown",void 0],[p,"mousemove",void 0],[p,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[p,"mouseover",void 0],[p,"mouseout",void 0],[p,"dblclick",void 0],[p,"click",void 0],[p,"keydown",{capture:!1}],[p,"keyup",void 0],[p,"wheel",{passive:!1}],[p,"contextmenu",void 0],[window,"blur",void 0]];for(const[m,v,E]of this._listeners)C.addEventListener(m,v,m===document?this.handleWindowEvent:this.handleEvent,E)}destroy(){for(const[o,h,p]of this._listeners)C.removeEventListener(o,h,o===document?this.handleWindowEvent:this.handleEvent,p)}_addDefaultHandlers(o){const h=this._map,p=h.getCanvasContainer();this._add("mapEvent",new no(h,o));const m=h.boxZoom=new io(h,o);this._add("boxZoom",m),o.interactive&&o.boxZoom&&m.enable();const v=h.cooperativeGestures=new Bt(h,o.cooperativeGestures);this._add("cooperativeGestures",v),o.cooperativeGestures&&v.enable();const E=new lp(h),M=new sf(h);h.doubleClickZoom=new ou(M,E),this._add("tapZoom",E),this._add("clickZoom",M),o.interactive&&o.doubleClickZoom&&h.doubleClickZoom.enable();const A=new af;this._add("tapDragZoom",A);const R=h.touchPitch=new of(h);this._add("touchPitch",R),o.interactive&&o.touchPitch&&h.touchPitch.enable(o.touchPitch);const V=$s(o),q=Xs(o);h.dragRotate=new oo(o,V,q),this._add("mouseRotate",V,["mousePitch"]),this._add("mousePitch",q,["mouseRotate"]),o.interactive&&o.dragRotate&&h.dragRotate.enable();const Q=(({enable:Ue,clickTolerance:we})=>{const Le=new vo({checkCorrectEvent:Ge=>C.mouseButton(Ge)===0&&!Ge.ctrlKey});return new Hs({clickTolerance:we,move:(Ge,He)=>({around:He,panDelta:He.sub(Ge)}),activateOnStart:!0,moveStateManager:Le,enable:Ue,assignEvents:zl})})(o),he=new tf(o,h);h.dragPan=new lf(p,Q,he),this._add("mousePan",Q),this._add("touchPan",he,["touchZoom","touchRotate"]),o.interactive&&o.dragPan&&h.dragPan.enable(o.dragPan);const ue=new iu,ye=new nf;h.touchZoomRotate=new Na(p,ye,ue,A),this._add("touchRotate",ue,["touchPan","touchZoom"]),this._add("touchZoom",ye,["touchPan","touchRotate"]),o.interactive&&o.touchZoomRotate&&h.touchZoomRotate.enable(o.touchZoomRotate);const se=h.scrollZoom=new Bl(h,()=>this._triggerRenderFrame());this._add("scrollZoom",se,["mousePan"]),o.interactive&&o.scrollZoom&&h.scrollZoom.enable(o.scrollZoom);const Te=h.keyboard=new es(h);this._add("keyboard",Te),o.interactive&&o.keyboard&&h.keyboard.enable(),this._add("blockableMapEvent",new yo(h))}_add(o,h,p){this._handlers.push({handlerName:o,handler:h,allowed:p}),this._handlersById[o]=h}stop(o){if(!this._updatingCamera){for(const{handler:h}of this._handlers)h.reset();this._inertia.clear(),this._fireEvents({},{},o),this._changes=[]}}isActive(){for(const{handler:o}of this._handlers)if(o.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Gt(this._eventsInProgress)||this.isZooming()}_blockedByActive(o,h,p){for(const m in o)if(m!==p&&(!h||h.indexOf(m)<0))return!0;return!1}_getMapTouches(o){const h=[];for(const p of o)this._el.contains(p.target)&&h.push(p);return h}mergeHandlerResult(o,h,p,m,v){if(!p)return;a.e(o,p);const E={handlerName:m,originalEvent:p.originalEvent||v};p.zoomDelta!==void 0&&(h.zoom=E),p.panDelta!==void 0&&(h.drag=E),p.pitchDelta!==void 0&&(h.pitch=E),p.bearingDelta!==void 0&&(h.rotate=E)}_applyChanges(){const o={},h={},p={};for(const[m,v,E]of this._changes)m.panDelta&&(o.panDelta=(o.panDelta||new a.P(0,0))._add(m.panDelta)),m.zoomDelta&&(o.zoomDelta=(o.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(o.bearingDelta=(o.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(o.pitchDelta=(o.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(o.around=m.around),m.pinchAround!==void 0&&(o.pinchAround=m.pinchAround),m.noInertia&&(o.noInertia=m.noInertia),a.e(h,v),a.e(p,E);this._updateMapTransform(o,h,p),this._changes=[]}_updateMapTransform(o,h,p){const m=this._map,v=m._getTransformForUpdate(),E=m.terrain;if(!(ja(o)||E&&this._terrainMovement))return this._fireEvents(h,p,!0);let{panDelta:M,zoomDelta:A,bearingDelta:R,pitchDelta:V,around:q,pinchAround:Q}=o;Q!==void 0&&(q=Q),m._stop(!0),q=q||m.transform.centerPoint;const he=v.pointLocation(M?q.sub(M):q);R&&(v.bearing+=R),V&&(v.pitch+=V),A&&(v.zoom+=A),E?this._terrainMovement||!h.drag&&!h.zoom?h.drag&&this._terrainMovement?v.center=v.pointLocation(v.centerPoint.sub(M)):v.setLocationAtPoint(he,q):(this._terrainMovement=!0,this._map._elevationFreeze=!0,v.setLocationAtPoint(he,q),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,v.recalculateZoom(m.terrain)})):v.setLocationAtPoint(he,q),m._applyUpdatedTransform(v),this._map._update(),o.noInertia||this._inertia.record(o),this._fireEvents(h,p,!0)}_fireEvents(o,h,p){const m=Gt(this._eventsInProgress),v=Gt(o),E={};for(const V in o){const{originalEvent:q}=o[V];this._eventsInProgress[V]||(E[`${V}start`]=q),this._eventsInProgress[V]=o[V]}!m&&v&&this._fireEvent("movestart",v.originalEvent);for(const V in E)this._fireEvent(V,E[V]);v&&this._fireEvent("move",v.originalEvent);for(const V in o){const{originalEvent:q}=o[V];this._fireEvent(V,q)}const M={};let A;for(const V in this._eventsInProgress){const{handlerName:q,originalEvent:Q}=this._eventsInProgress[V];this._handlersById[q].isActive()||(delete this._eventsInProgress[V],A=h[q]||Q,M[`${V}end`]=A)}for(const V in M)this._fireEvent(V,M[V]);const R=Gt(this._eventsInProgress);if(p&&(m||v)&&!R){this._updatingCamera=!0;const V=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),q=Q=>Q!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Fl("renderFrame",{timeStamp:o})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Si extends a.E{constructor(o,h){super(),this._renderFrameCallback=()=>{const p=Math.min((k.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(p)),p<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=o,this._bearingSnap=h.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new a.M(this.transform.center.lng,this.transform.center.lat)}setCenter(o,h){return this.jumpTo({center:o},h)}panBy(o,h,p){return o=a.P.convert(o).mult(-1),this.panTo(this.transform.center,a.e({offset:o},h),p)}panTo(o,h,p){return this.easeTo(a.e({center:o},h),p)}getZoom(){return this.transform.zoom}setZoom(o,h){return this.jumpTo({zoom:o},h),this}zoomTo(o,h,p){return this.easeTo(a.e({zoom:o},h),p)}zoomIn(o,h){return this.zoomTo(this.getZoom()+1,o,h),this}zoomOut(o,h){return this.zoomTo(this.getZoom()-1,o,h),this}getBearing(){return this.transform.bearing}setBearing(o,h){return this.jumpTo({bearing:o},h),this}getPadding(){return this.transform.padding}setPadding(o,h){return this.jumpTo({padding:o},h),this}rotateTo(o,h,p){return this.easeTo(a.e({bearing:o},h),p)}resetNorth(o,h){return this.rotateTo(0,a.e({duration:1e3},o),h),this}resetNorthPitch(o,h){return this.easeTo(a.e({bearing:0,pitch:0,duration:1e3},o),h),this}snapToNorth(o,h){return Math.abs(this.getBearing()){if(this._zooming&&(m.zoom=a.z.number(v,se,$e)),this._rotating&&(m.bearing=a.z.number(E,R,$e)),this._pitching&&(m.pitch=a.z.number(M,V,$e)),this._padding&&(m.interpolatePadding(A,q,$e),he=m.centerPoint.add(Q)),this.terrain&&!o.freezeElevation&&this._updateElevation($e),Le)m.setLocationAtPoint(Le,Ge);else{const nt=m.zoomScale(m.zoom-v),et=se>v?Math.min(2,we):Math.max(.5,we),dt=Math.pow(et,1-$e),gt=m.unproject(Te.add(Ue.mult($e*dt)).mult(nt));m.setLocationAtPoint(m.renderWorldCopies?gt.wrap():gt,he)}this._applyUpdatedTransform(m),this._fireMoveEvents(h)},$e=>{this.terrain&&this._finalizeElevation(),this._afterEase(h,$e)},o),this}_prepareEase(o,h,p={}){this._moving=!0,h||p.moving||this.fire(new a.k("movestart",o)),this._zooming&&!p.zooming&&this.fire(new a.k("zoomstart",o)),this._rotating&&!p.rotating&&this.fire(new a.k("rotatestart",o)),this._pitching&&!p.pitching&&this.fire(new a.k("pitchstart",o))}_prepareElevation(o){this._elevationCenter=o,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(o,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(o){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const h=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(o<1&&h!==this._elevationTarget){const p=this._elevationTarget-this._elevationStart;this._elevationStart+=o*(p-(h-(p*o+this._elevationStart))/(1-o)),this._elevationTarget=h}this.transform.elevation=a.z.number(this._elevationStart,this._elevationTarget,o)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(o){if(!this.transformCameraUpdate)return;const h=o.clone(),{center:p,zoom:m,pitch:v,bearing:E,elevation:M}=this.transformCameraUpdate(h);p&&(h.center=p),m!==void 0&&(h.zoom=m),v!==void 0&&(h.pitch=v),E!==void 0&&(h.bearing=E),M!==void 0&&(h.elevation=M),this.transform.apply(h)}_fireMoveEvents(o){this.fire(new a.k("move",o)),this._zooming&&this.fire(new a.k("zoom",o)),this._rotating&&this.fire(new a.k("rotate",o)),this._pitching&&this.fire(new a.k("pitch",o))}_afterEase(o,h){if(this._easeId&&h&&this._easeId===h)return;delete this._easeId;const p=this._zooming,m=this._rotating,v=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,p&&this.fire(new a.k("zoomend",o)),m&&this.fire(new a.k("rotateend",o)),v&&this.fire(new a.k("pitchend",o)),this.fire(new a.k("moveend",o))}flyTo(o,h){var p;if(!o.essential&&k.prefersReducedMotion){const xr=a.L(o,["center","zoom","bearing","pitch","around"]);return this.jumpTo(xr,h)}this.stop(),o=a.e({offset:[0,0],speed:1.2,curve:1.42,easing:a.b7},o);const m=this._getTransformForUpdate(),v=this.getZoom(),E=this.getBearing(),M=this.getPitch(),A=this.getPadding(),R="bearing"in o?this._normalizeBearing(o.bearing,E):E,V="pitch"in o?+o.pitch:M,q="padding"in o?o.padding:m.padding,Q=a.P.convert(o.offset);let he=m.centerPoint.add(Q);const ue=m.pointLocation(he),{center:ye,zoom:se}=m.getConstrained(a.M.convert(o.center||ue),(p=o.zoom)!==null&&p!==void 0?p:v);this._normalizeCenter(ye);const Te=m.zoomScale(se-v),Ue=m.project(ue),we=m.project(ye).sub(Ue);let Le=o.curve;const Ge=Math.max(m.width,m.height),He=Ge/Te,$e=we.mag();if("minZoom"in o){const xr=a.ac(Math.min(o.minZoom,v,se),m.minZoom,m.maxZoom),Yt=Ge/m.zoomScale(xr-v);Le=Math.sqrt(Yt/$e*2)}const nt=Le*Le;function et(xr){const Yt=(He*He-Ge*Ge+(xr?-1:1)*nt*nt*$e*$e)/(2*(xr?He:Ge)*nt*$e);return Math.log(Math.sqrt(Yt*Yt+1)-Yt)}function dt(xr){return(Math.exp(xr)-Math.exp(-xr))/2}function gt(xr){return(Math.exp(xr)+Math.exp(-xr))/2}const ir=et(!1);let _t=function(xr){return gt(ir)/gt(ir+Le*xr)},Xt=function(xr){return Ge*((gt(ir)*(dt(Yt=ir+Le*xr)/gt(Yt))-dt(ir))/nt)/$e;var Yt},or=(et(!0)-ir)/Le;if(Math.abs($e)<1e-6||!isFinite(or)){if(Math.abs(Ge-He)<1e-6)return this.easeTo(o,h);const xr=Heo.maxDuration&&(o.duration=0),this._zooming=!0,this._rotating=E!==R,this._pitching=V!==M,this._padding=!m.isPaddingEqual(q),this._prepareEase(h,!1),this.terrain&&this._prepareElevation(ye),this._ease(xr=>{const Yt=xr*or,cr=1/_t(Yt);m.zoom=xr===1?se:v+m.scaleZoom(cr),this._rotating&&(m.bearing=a.z.number(E,R,xr)),this._pitching&&(m.pitch=a.z.number(M,V,xr)),this._padding&&(m.interpolatePadding(A,q,xr),he=m.centerPoint.add(Q)),this.terrain&&!o.freezeElevation&&this._updateElevation(xr);const dr=xr===1?ye:m.unproject(Ue.add(we.mult(Xt(Yt))).mult(cr));m.setLocationAtPoint(m.renderWorldCopies?dr.wrap():dr,he),this._applyUpdatedTransform(m),this._fireMoveEvents(h)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(h)},o),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(o,h){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const p=this._onEaseEnd;delete this._onEaseEnd,p.call(this,h)}if(!o){const p=this.handlers;p&&p.stop(!1)}return this}_ease(o,h,p){p.animate===!1||p.duration===0?(o(1),h()):(this._easeStart=k.now(),this._easeOptions=p,this._onEaseFrame=o,this._onEaseEnd=h,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(o,h){o=a.b1(o,-180,180);const p=Math.abs(o-h);return Math.abs(o-360-h)180?-360:p<-180?360:0}queryTerrainElevation(o){return this.terrain?this.terrain.getElevationForLngLatZoom(a.M.convert(o),this.transform.tileZoom)-this.transform.elevation:null}}const au={compact:!0,customAttribution:'MapLibre'};class so{constructor(o=au){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=h=>{!h||h.sourceDataType!=="metadata"&&h.sourceDataType!=="visibility"&&h.dataType!=="style"&&h.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=o}getDefaultPosition(){return"bottom-right"}onAdd(o){return this._map=o,this._compact=this.options.compact,this._container=C.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=C.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=C.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(){C.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(o,h){const p=this._map._getUIString(`AttributionControl.${h}`);o.title=p,o.setAttribute("aria-label",p)}_updateAttributions(){if(!this._map.style)return;let o=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?o=o.concat(this.options.customAttribution.map(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&o.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const h=this._map.style.sourceCaches;for(const m in h){const v=h[m];if(v.used||v.usedForTerrain){const E=v.getSource();E.attribution&&o.indexOf(E.attribution)<0&&o.push(E.attribution)}}o=o.filter(m=>String(m).trim()),o.sort((m,v)=>m.length-v.length),o=o.filter((m,v)=>{for(let E=v+1;E=0)return!1;return!0});const p=o.join(" | ");p!==this._attribHTML&&(this._attribHTML=p,o.length?(this._innerContainer.innerHTML=p,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class cf{constructor(o={}){this._updateCompact=()=>{const h=this._container.children;if(h.length){const p=h[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&p.classList.add("maplibregl-compact"):p.classList.remove("maplibregl-compact")}},this.options=o}getDefaultPosition(){return"bottom-left"}onAdd(o){this._map=o,this._compact=this.options&&this.options.compact,this._container=C.create("div","maplibregl-ctrl");const h=C.create("a","maplibregl-ctrl-logo");return h.target="_blank",h.rel="noopener nofollow",h.href="https://maplibre.org/",h.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),h.setAttribute("rel","noopener nofollow"),this._container.appendChild(h),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){C.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Ua{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(o){const h=++this._id;return this._queue.push({callback:o,id:h,cancelled:!1}),h}remove(o){const h=this._currentlyRunning,p=h?this._queue.concat(h):this._queue;for(const m of p)if(m.id===o)return void(m.cancelled=!0)}run(o=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const h=this._currentlyRunning=this._queue;this._queue=[];for(const p of h)if(!p.cancelled&&(p.callback(o),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var un=a.X([{name:"a_pos3d",type:"Int16",components:3}]);class kn extends a.E{constructor(o){super(),this.sourceCache=o,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,o.usedForTerrain=!0,o.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(o,h){this.sourceCache.update(o,h),this._renderableTilesKeys=[];const p={};for(const m of o.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:h}))p[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),a.aN(m.posMatrix,0,a.W,0,a.W,0,1),this._tiles[m.key]=new Xn(m,this.tileSize));for(const m in this._tiles)p[m]||delete this._tiles[m]}freeRtt(o){for(const h in this._tiles){const p=this._tiles[h];(!o||p.tileID.equals(o)||p.tileID.isChildOf(o)||o.isChildOf(p.tileID))&&(p.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(o=>this.getTileByID(o))}getTileByID(o){return this._tiles[o]}getTerrainCoords(o){const h={};for(const p of this._renderableTilesKeys){const m=this._tiles[p].tileID;if(m.canonical.equals(o.canonical)){const v=o.clone();v.posMatrix=new Float64Array(16),a.aN(v.posMatrix,0,a.W,0,a.W,0,1),h[p]=v}else if(m.canonical.isChildOf(o.canonical)){const v=o.clone();v.posMatrix=new Float64Array(16);const E=m.canonical.z-o.canonical.z,M=m.canonical.x-(m.canonical.x>>E<>E<>E;a.aN(v.posMatrix,0,R,0,R,0,1),a.H(v.posMatrix,v.posMatrix,[-M*R,-A*R,0]),h[p]=v}else if(o.canonical.isChildOf(m.canonical)){const v=o.clone();v.posMatrix=new Float64Array(16);const E=o.canonical.z-m.canonical.z,M=o.canonical.x-(o.canonical.x>>E<>E<>E;a.aN(v.posMatrix,0,a.W,0,a.W,0,1),a.H(v.posMatrix,v.posMatrix,[M*R,A*R,0]),a.J(v.posMatrix,v.posMatrix,[1/2**E,1/2**E,0]),h[p]=v}}return h}getSourceTile(o,h){const p=this.sourceCache._source;let m=o.overscaledZ-this.deltaZoom;if(m>p.maxzoom&&(m=p.maxzoom),m=p.minzoom&&(!v||!v.dem);)v=this.sourceCache.getTileByID(o.scaledTo(m--).key);return v}tilesAfterTime(o=Date.now()){return Object.values(this._tiles).filter(h=>h.timeAdded>=o)}}class uf{constructor(o,h,p){this.painter=o,this.sourceCache=new kn(h),this.options=p,this.exaggeration=typeof p.exaggeration=="number"?p.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(o,h,p,m=a.W){var v;if(!(h>=0&&h=0&&po.canonical.z&&(o.canonical.z>=m?v=o.canonical.z-m:a.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const E=o.canonical.x-(o.canonical.x>>v<>v<>8<<4|v>>8,h[E+3]=0;const p=new a.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(h.buffer)),m=new re(o,p,o.gl.RGBA,{premultiply:!1});return m.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(o){this.painter.maybeDrawDepthAndCoords(!0);const h=new Uint8Array(4),p=this.painter.context,m=p.gl,v=Math.round(o.x*this.painter.pixelRatio/devicePixelRatio),E=Math.round(o.y*this.painter.pixelRatio/devicePixelRatio),M=Math.round(this.painter.height/devicePixelRatio);p.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(v,M-E-1,1,1,m.RGBA,m.UNSIGNED_BYTE,h),p.bindFramebuffer.set(null);const A=h[0]+(h[2]>>4<<8),R=h[1]+((15&h[2])<<8),V=this.coordsIndex[255-h[3]],q=V&&this.sourceCache.getTileByID(V);if(!q)return null;const Q=this._coordsTextureSize,he=(1<o.id!==h),this._recentlyUsed.push(o.id)}stampObject(o){o.stamp=++this._stamp}getOrCreateFreeObject(){for(const h of this._recentlyUsed)if(!this._objects[h].inUse)return this._objects[h];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const o=this._createObject(this._objects.length);return this._objects.push(o),o}freeObject(o){o.inUse=!1}freeAllObjects(){for(const o of this._objects)this.freeObject(o)}isFull(){return!(this._objects.length!o.inUse)===!1}}const Fo={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class lu{constructor(o,h){this.painter=o,this.terrain=h,this.pool=new Va(o.context,30,h.sourceCache.tileSize*h.qualityFactor)}destruct(){this.pool.destruct()}getTexture(o){return this.pool.getObjectForId(o.rtt[this._stacks.length-1].id).texture}prepareForRender(o,h){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=o._order.filter(p=>!o._layers[p].isHidden(h)),this._coordsDescendingInv={};for(const p in o.sourceCaches){this._coordsDescendingInv[p]={};const m=o.sourceCaches[p].getVisibleCoordinates();for(const v of m){const E=this.terrain.sourceCache.getTerrainCoords(v);for(const M in E)this._coordsDescendingInv[p][M]||(this._coordsDescendingInv[p][M]=[]),this._coordsDescendingInv[p][M].push(E[M])}}this._coordsDescendingInvStr={};for(const p of o._order){const m=o._layers[p],v=m.source;if(Fo[m.type]&&!this._coordsDescendingInvStr[v]){this._coordsDescendingInvStr[v]={};for(const E in this._coordsDescendingInv[v])this._coordsDescendingInvStr[v][E]=this._coordsDescendingInv[v][E].map(M=>M.key).sort().join()}}for(const p of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const v=this._coordsDescendingInvStr[m][p.tileID.key];v&&v!==p.rttCoords[m]&&(p.rtt=[])}}renderLayer(o){if(o.isHidden(this.painter.transform.zoom))return!1;const h=o.type,p=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===o.id;if(Fo[h]&&(this._prevType&&Fo[this._prevType]||this._stacks.push([]),this._prevType=h,this._stacks[this._stacks.length-1].push(o.id),!m))return!0;if(Fo[this._prevType]||Fo[h]&&m){this._prevType=h;const v=this._stacks.length-1,E=this._stacks[v]||[];for(const M of this._renderableTiles){if(this.pool.isFull()&&(Ll(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(M),M.rtt[v]){const R=this.pool.getObjectForId(M.rtt[v].id);if(R.stamp===M.rtt[v].stamp){this.pool.useObject(R);continue}}const A=this.pool.getOrCreateFreeObject();this.pool.useObject(A),this.pool.stampObject(A),M.rtt[v]={id:A.id,stamp:A.stamp},p.context.bindFramebuffer.set(A.fbo.framebuffer),p.context.clear({color:a.aO.transparent,stencil:0}),p.currentStencilSource=void 0;for(let R=0;R{y.touchstart=y.dragStart,y.touchmoveWindow=y.dragMove,y.touchend=y.dragEnd},hu={showCompass:!0,showZoom:!0,visualizePitch:!1};class fu{constructor(o,h,p=!1){this.mousedown=E=>{this.startMouse(a.e({},E,{ctrlKey:!0,preventDefault:()=>E.preventDefault()}),C.mousePos(this.element,E)),C.addEventListener(window,"mousemove",this.mousemove),C.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=E=>{this.moveMouse(E,C.mousePos(this.element,E))},this.mouseup=E=>{this.mouseRotate.dragEnd(E),this.mousePitch&&this.mousePitch.dragEnd(E),this.offTemp()},this.touchstart=E=>{E.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=C.touchPos(this.element,E.targetTouches)[0],this.startTouch(E,this._startPos),C.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.addEventListener(window,"touchend",this.touchend))},this.touchmove=E=>{E.targetTouches.length!==1?this.reset():(this._lastPos=C.touchPos(this.element,E.targetTouches)[0],this.moveTouch(E,this._lastPos))},this.touchend=E=>{E.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const m=o.dragRotate._mouseRotate.getClickTolerance(),v=o.dragRotate._mousePitch.getClickTolerance();this.element=h,this.mouseRotate=$s({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:E,clickTolerance:M,bearingDegreesPerPixelMoved:A=.8})=>{const R=new Et;return new Hs({clickTolerance:M,move:(V,q)=>({bearingDelta:(q.x-V.x)*A}),moveStateManager:R,enable:E,assignEvents:Ol})})({clickTolerance:m,enable:!0}),this.map=o,p&&(this.mousePitch=Xs({clickTolerance:v,enable:!0}),this.touchPitch=(({enable:E,clickTolerance:M,pitchDegreesPerPixelMoved:A=-.5})=>{const R=new Et;return new Hs({clickTolerance:M,move:(V,q)=>({pitchDelta:(q.y-V.y)*A}),moveStateManager:R,enable:E,assignEvents:Ol})})({clickTolerance:v,enable:!0})),C.addEventListener(h,"mousedown",this.mousedown),C.addEventListener(h,"touchstart",this.touchstart,{passive:!1}),C.addEventListener(h,"touchcancel",this.reset)}startMouse(o,h){this.mouseRotate.dragStart(o,h),this.mousePitch&&this.mousePitch.dragStart(o,h),C.disableDrag()}startTouch(o,h){this.touchRotate.dragStart(o,h),this.touchPitch&&this.touchPitch.dragStart(o,h),C.disableDrag()}moveMouse(o,h){const p=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(o,h)||{};if(m&&p.setBearing(p.getBearing()+m),this.mousePitch){const{pitchDelta:v}=this.mousePitch.dragMove(o,h)||{};v&&p.setPitch(p.getPitch()+v)}}moveTouch(o,h){const p=this.map,{bearingDelta:m}=this.touchRotate.dragMove(o,h)||{};if(m&&p.setBearing(p.getBearing()+m),this.touchPitch){const{pitchDelta:v}=this.touchPitch.dragMove(o,h)||{};v&&p.setPitch(p.getPitch()+v)}}off(){const o=this.element;C.removeEventListener(o,"mousedown",this.mousedown),C.removeEventListener(o,"touchstart",this.touchstart,{passive:!1}),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend),C.removeEventListener(o,"touchcancel",this.reset),this.offTemp()}offTemp(){C.enableDrag(),C.removeEventListener(window,"mousemove",this.mousemove),C.removeEventListener(window,"mouseup",this.mouseup),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend)}}let Oo;function Nl(y,o,h){const p=new a.M(y.lng,y.lat);if(y=new a.M(y.lng,y.lat),o){const m=new a.M(y.lng-360,y.lat),v=new a.M(y.lng+360,y.lat),E=h.locationPoint(y).distSqr(o);h.locationPoint(m).distSqr(o)180;){const m=h.locationPoint(y);if(m.x>=0&&m.y>=0&&m.x<=h.width&&m.y<=h.height)break;y.lng>h.center.lng?y.lng-=360:y.lng+=360}return y.lng!==p.lng&&h.locationPoint(y).y>h.height/2-h.getHorizon()?y:p}const Ga={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 jl(y,o,h){const p=y.classList;for(const m in Ga)p.remove(`maplibregl-${h}-anchor-${m}`);p.add(`maplibregl-${h}-anchor-${o}`)}class Wa extends a.E{constructor(o){if(super(),this._onKeyPress=h=>{const p=h.code,m=h.charCode||h.keyCode;p!=="Space"&&p!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=h=>{const p=h.originalEvent.target,m=this._element;this._popup&&(p===m||m.contains(p))&&this.togglePopup()},this._update=h=>{var p;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((h==null?void 0:h.type)==="terrain"||(h==null?void 0:h.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Nl(this._lngLat,this._flatPos,this._map.transform):(p=this._lngLat)===null||p===void 0?void 0:p.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let v="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?v=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(v=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let E="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?E="rotateX(0deg)":this._pitchAlignment==="map"&&(E=`rotateX(${this._map.getPitch()}deg)`),h&&h.type!=="moveend"||(this._pos=this._pos.round()),C.setTransform(this._element,`${Ga[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${E} ${v}`),k.frameAsync(new AbortController).then(()=>{this._updateOpacity(h&&h.type==="moveend")}).catch(()=>{})},this._onMove=h=>{if(!this._isDragging){const p=this._clickTolerance||this._map._clickTolerance;this._isDragging=h.point.dist(this._pointerdownPos)>=p}this._isDragging&&(this._pos=h.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 a.k("dragstart"))),this.fire(new a.k("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 a.k("dragend")),this._state="inactive"},this._addDragHandler=h=>{this._element.contains(h.originalEvent.target)&&(h.preventDefault(),this._positionDelta=h.point.sub(this._pos).add(this._offset),this._pointerdownPos=h.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=o&&o.anchor||"center",this._color=o&&o.color||"#3FB1CE",this._scale=o&&o.scale||1,this._draggable=o&&o.draggable||!1,this._clickTolerance=o&&o.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=o&&o.rotation||0,this._rotationAlignment=o&&o.rotationAlignment||"auto",this._pitchAlignment=o&&o.pitchAlignment&&o.pitchAlignment!=="auto"?o.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(o==null?void 0:o.opacity,o==null?void 0:o.opacityWhenCovered),o&&o.element)this._element=o.element,this._offset=a.P.convert(o&&o.offset||[0,0]);else{this._defaultMarker=!0,this._element=C.create("div"),this._element.setAttribute("aria-label","Map marker");const h=C.createNS("http://www.w3.org/2000/svg","svg"),p=41,m=27;h.setAttributeNS(null,"display","block"),h.setAttributeNS(null,"height",`${p}px`),h.setAttributeNS(null,"width",`${m}px`),h.setAttributeNS(null,"viewBox",`0 0 ${m} ${p}`);const v=C.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");const E=C.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"fill-rule","nonzero");const M=C.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"transform","translate(3.0, 29.0)"),M.setAttributeNS(null,"fill","#000000");const A=[{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 Te of A){const Ue=C.createNS("http://www.w3.org/2000/svg","ellipse");Ue.setAttributeNS(null,"opacity","0.04"),Ue.setAttributeNS(null,"cx","10.5"),Ue.setAttributeNS(null,"cy","5.80029008"),Ue.setAttributeNS(null,"rx",Te.rx),Ue.setAttributeNS(null,"ry",Te.ry),M.appendChild(Ue)}const R=C.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"fill",this._color);const V=C.createNS("http://www.w3.org/2000/svg","path");V.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"),R.appendChild(V);const q=C.createNS("http://www.w3.org/2000/svg","g");q.setAttributeNS(null,"opacity","0.25"),q.setAttributeNS(null,"fill","#000000");const Q=C.createNS("http://www.w3.org/2000/svg","path");Q.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"),q.appendChild(Q);const he=C.createNS("http://www.w3.org/2000/svg","g");he.setAttributeNS(null,"transform","translate(6.0, 7.0)"),he.setAttributeNS(null,"fill","#FFFFFF");const ue=C.createNS("http://www.w3.org/2000/svg","g");ue.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ye=C.createNS("http://www.w3.org/2000/svg","circle");ye.setAttributeNS(null,"fill","#000000"),ye.setAttributeNS(null,"opacity","0.25"),ye.setAttributeNS(null,"cx","5.5"),ye.setAttributeNS(null,"cy","5.5"),ye.setAttributeNS(null,"r","5.4999962");const se=C.createNS("http://www.w3.org/2000/svg","circle");se.setAttributeNS(null,"fill","#FFFFFF"),se.setAttributeNS(null,"cx","5.5"),se.setAttributeNS(null,"cy","5.5"),se.setAttributeNS(null,"r","5.4999962"),ue.appendChild(ye),ue.appendChild(se),E.appendChild(M),E.appendChild(R),E.appendChild(q),E.appendChild(he),E.appendChild(ue),h.appendChild(E),h.setAttributeNS(null,"height",p*this._scale+"px"),h.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(h),this._offset=a.P.convert(o&&o.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",h=>{h.preventDefault()}),this._element.addEventListener("mousedown",h=>{h.preventDefault()}),jl(this._element,this._anchor,"marker"),o&&o.className)for(const h of o.className.split(" "))this._element.classList.add(h);this._popup=null}addTo(o){return this.remove(),this._map=o,o.getCanvasContainer().appendChild(this._element),o.on("move",this._update),o.on("moveend",this._update),o.on("terrain",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("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),C.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(o){return this._lngLat=a.M.convert(o),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(o){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),o){if(!("offset"in o.options)){const m=Math.abs(13.5)/Math.SQRT2;o.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=o,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const o=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:o?(o.isOpen()?o.remove():(o.setLngLat(this._lngLat),o.addTo(this._map)),this):this}_updateOpacity(o=!1){var h,p;if(!(!((h=this._map)===null||h===void 0)&&h.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(o)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,v=m.terrain.depthAtPoint(this._pos),E=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,E)-v<.006)return void(this._element.style.opacity=this._opacity);const M=-this._offset.y/m.transform._pixelPerMeter,A=Math.sin(m.getPitch()*Math.PI/180)*M,R=m.terrain.depthAtPoint(new a.P(this._pos.x,this._pos.y-this._offset.y)),V=m.transform.lngLatToCameraDepth(this._lngLat,E+A)-R>.006;!((p=this._popup)===null||p===void 0)&&p.isOpen()&&V&&this._popup.remove(),this._element.style.opacity=V?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(o){return this._offset=a.P.convert(o),this._update(),this}addClassName(o){this._element.classList.add(o)}removeClassName(o){this._element.classList.remove(o)}toggleClassName(o){return this._element.classList.toggle(o)}setDraggable(o){return this._draggable=!!o,this._map&&(o?(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(o){return this._rotation=o||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(o){return this._rotationAlignment=o||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(o){return this._pitchAlignment=o&&o!=="auto"?o:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(o,h){return o===void 0&&h===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),o!==void 0&&(this._opacity=o),h!==void 0&&(this._opacityWhenCovered=h),this._map&&this._updateOpacity(!0),this}}const Ul={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Js=0,vs=!1;const Vl={maxWidth:100,unit:"metric"};function ql(y,o,h){const p=h&&h.maxWidth||100,m=y._container.clientHeight/2,v=y.unproject([0,m]),E=y.unproject([p,m]),M=v.distanceTo(E);if(h&&h.unit==="imperial"){const A=3.2808*M;A>5280?bs(o,p,A/5280,y._getUIString("ScaleControl.Miles")):bs(o,p,A,y._getUIString("ScaleControl.Feet"))}else h&&h.unit==="nautical"?bs(o,p,M/1852,y._getUIString("ScaleControl.NauticalMiles")):M>=1e3?bs(o,p,M/1e3,y._getUIString("ScaleControl.Kilometers")):bs(o,p,M,y._getUIString("ScaleControl.Meters"))}function bs(y,o,h,p){const m=function(v){const E=Math.pow(10,`${Math.floor(v)}`.length-1);let M=v/E;return M=M>=10?10:M>=5?5:M>=3?3:M>=2?2:M>=1?1:function(A){const R=Math.pow(10,Math.ceil(-Math.log(A)/Math.LN10));return Math.round(A*R)/R}(M),E*M}(h);y.style.width=o*(m/h)+"px",y.innerHTML=`${m} ${p}`}const du={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},pu=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Gl(y){if(y){if(typeof y=="number"){const o=Math.round(Math.abs(y)/Math.SQRT2);return{center:new a.P(0,0),top:new a.P(0,y),"top-left":new a.P(o,o),"top-right":new a.P(-o,o),bottom:new a.P(0,-y),"bottom-left":new a.P(o,-o),"bottom-right":new a.P(-o,-o),left:new a.P(y,0),right:new a.P(-y,0)}}if(y instanceof a.P||Array.isArray(y)){const o=a.P.convert(y);return{center:o,top:o,"top-left":o,"top-right":o,bottom:o,"bottom-left":o,"bottom-right":o,left:o,right:o}}return{center:a.P.convert(y.center||[0,0]),top:a.P.convert(y.top||[0,0]),"top-left":a.P.convert(y["top-left"]||[0,0]),"top-right":a.P.convert(y["top-right"]||[0,0]),bottom:a.P.convert(y.bottom||[0,0]),"bottom-left":a.P.convert(y["bottom-left"]||[0,0]),"bottom-right":a.P.convert(y["bottom-right"]||[0,0]),left:a.P.convert(y.left||[0,0]),right:a.P.convert(y.right||[0,0])}}return Gl(new a.P(0,0))}const hf=_;d.AJAXError=a.be,d.Evented=a.E,d.LngLat=a.M,d.MercatorCoordinate=a.Y,d.Point=a.P,d.addProtocol=a.bf,d.config=a.a,d.removeProtocol=a.bg,d.AttributionControl=so,d.BoxZoomHandler=io,d.CanvasSource=wn,d.CooperativeGesturesHandler=Bt,d.DoubleClickZoomHandler=ou,d.DragPanHandler=lf,d.DragRotateHandler=oo,d.EdgeInsets=Ws,d.FullscreenControl=class extends a.E{constructor(y={}){super(),this._onFullscreenChange=()=>{var o;let h=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((o=h==null?void 0:h.shadowRoot)===null||o===void 0)&&o.fullscreenElement;)h=h.shadowRoot.fullscreenElement;h===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,y&&y.container&&(y.container instanceof HTMLElement?this._container=y.container:a.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(y){return this._map=y,this._container||(this._container=this._map.getContainer()),this._controlContainer=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){C.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const y=this._fullscreenButton=C.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);C.create("span","maplibregl-ctrl-icon",y).setAttribute("aria-hidden","true"),y.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const y=this._getTitle();this._fullscreenButton.setAttribute("aria-label",y),this._fullscreenButton.title=y}_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 a.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new a.k("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()}},d.GeoJSONSource=We,d.GeolocateControl=class extends a.E{constructor(y){super(),this._onSuccess=o=>{if(this._map){if(this._isOutOfMapMaxBounds(o))return this._setErrorState(),this.fire(new a.k("outofmaxbounds",o)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=o,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(o),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(o),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new a.k("geolocate",o)),this._finish()}},this._updateCamera=o=>{const h=new a.M(o.coords.longitude,o.coords.latitude),p=o.coords.accuracy,m=this._map.getBearing(),v=a.e({bearing:m},this.options.fitBoundsOptions),E=at.fromLngLat(h,p);this._map.fitBounds(E,v,{geolocateSource:!0})},this._updateMarker=o=>{if(o){const h=new a.M(o.coords.longitude,o.coords.latitude);this._accuracyCircleMarker.setLngLat(h).addTo(this._map),this._userLocationDotMarker.setLngLat(h).addTo(this._map),this._accuracy=o.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=o=>{if(this._map){if(this.options.trackUserLocation)if(o.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 h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(o.code===3&&vs)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new a.k("error",o)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=o=>{if(this._map){if(this._container.addEventListener("contextmenu",h=>h.preventDefault()),this._geolocateButton=C.create("button","maplibregl-ctrl-geolocate",this._container),C.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",o===!1){a.w("Geolocation support is not available so the GeolocateControl will be disabled.");const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}else{const h=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=C.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Wa({element:this._dotElement}),this._circleElement=C.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Wa({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",h=>{h.geolocateSource||this._watchState!=="ACTIVE_LOCK"||h.originalEvent&&h.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 a.k("trackuserlocationend")))})}},this.options=a.e({},Ul,y)}onAdd(y){return this._map=y,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return a._(this,arguments,void 0,function*(o=!1){if(Oo!==void 0&&!o)return Oo;if(window.navigator.permissions===void 0)return Oo=!!window.navigator.geolocation,Oo;try{Oo=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Oo=!!window.navigator.geolocation}return Oo})}().then(o=>this._setupUI(o)),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(),C.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Js=0,vs=!1}_isOutOfMapMaxBounds(y){const o=this._map.getMaxBounds(),h=y.coords;return o&&(h.longitudeo.getEast()||h.latitudeo.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 y=this._map.getBounds(),o=y.getSouthEast(),h=y.getNorthEast(),p=o.distanceTo(h),m=Math.ceil(this._accuracy/(p/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}trigger(){if(!this._setup)return a.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 a.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Js--,vs=!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 a.k("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 a.k("trackuserlocationstart"));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 y;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Js++,Js>1?(y={maximumAge:6e5,timeout:0},vs=!0):(y=this.options.positionOptions,vs=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,y)}}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)}},d.Hash=tu,d.ImageSource=jt,d.KeyboardHandler=es,d.LngLatBounds=at,d.LogoControl=cf,d.Map=class extends Si{constructor(y){if(a.bc.mark(a.bd.create),(y=a.e({},qa,y)).minZoom!=null&&y.maxZoom!=null&&y.minZoom>y.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(y.minPitch!=null&&y.maxPitch!=null&&y.minPitch>y.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(y.minPitch!=null&&y.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(y.maxPitch!=null&&y.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Pl(y.minZoom,y.maxZoom,y.minPitch,y.maxPitch,y.renderWorldCopies),{bearingSnap:y.bearingSnap}),this._contextLost=o=>{o.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new a.k("webglcontextlost",{originalEvent:o}))},this._contextRestored=o=>{this._setupPainter(),this.resize(),this._update(),this.fire(new a.k("webglcontextrestored",{originalEvent:o}))},this._onMapScroll=o=>{if(o.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=y.interactive,this._maxTileCacheSize=y.maxTileCacheSize,this._maxTileCacheZoomLevels=y.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=y.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=y.preserveDrawingBuffer,this._antialias=y.antialias,this._trackResize=y.trackResize,this._bearingSnap=y.bearingSnap,this._refreshExpiredTiles=y.refreshExpiredTiles,this._fadeDuration=y.fadeDuration,this._crossSourceCollisions=y.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=y.collectResourceTiming,this._renderTaskQueue=new Ua,this._controls=[],this._mapId=a.a3(),this._locale=a.e({},cu,y.locale),this._clickTolerance=y.clickTolerance,this._overridePixelRatio=y.pixelRatio,this._maxCanvasSize=y.maxCanvasSize,this.transformCameraUpdate=y.transformCameraUpdate,this._imageQueueHandle=G.addThrottleControl(()=>this.isMoving()),this._requestManager=new U(y.transformRequest),typeof y.container=="string"){if(this._container=document.getElementById(y.container),!this._container)throw new Error(`Container '${y.container}' not found.`)}else{if(!(y.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=y.container}if(y.maxBounds&&this.setMaxBounds(y.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 o=!1;const h=eu(p=>{this._trackResize&&!this._removed&&this.resize(p)._update()},50);this._resizeObserver=new ResizeObserver(p=>{o?h(p):o=!0}),this._resizeObserver.observe(this._container)}this.handlers=new su(this,y),this._hash=y.hash&&new tu(typeof y.hash=="string"&&y.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:y.center,zoom:y.zoom,bearing:y.bearing,pitch:y.pitch}),y.bounds&&(this.resize(),this.fitBounds(y.bounds,a.e({},y.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=y.localIdeographFontFamily,this._validateStyle=y.validateStyle,y.style&&this.setStyle(y.style,{localIdeographFontFamily:y.localIdeographFontFamily}),y.attributionControl&&this.addControl(new so(typeof y.attributionControl=="boolean"?void 0:y.attributionControl)),y.maplibreLogo&&this.addControl(new cf,y.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new a.k(`${o.dataType}data`,o))}),this.on("dataloading",o=>{this.fire(new a.k(`${o.dataType}dataloading`,o))}),this.on("dataabort",o=>{this.fire(new a.k("sourcedataabort",o))})}_getMapId(){return this._mapId}addControl(y,o){if(o===void 0&&(o=y.getDefaultPosition?y.getDefaultPosition():"top-right"),!y||!y.onAdd)return this.fire(new a.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const h=y.onAdd(this);this._controls.push(y);const p=this._controlPositions[o];return o.indexOf("bottom")!==-1?p.insertBefore(h,p.firstChild):p.appendChild(h),this}removeControl(y){if(!y||!y.onRemove)return this.fire(new a.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const o=this._controls.indexOf(y);return o>-1&&this._controls.splice(o,1),y.onRemove(this),this}hasControl(y){return this._controls.indexOf(y)>-1}calculateCameraOptionsFromTo(y,o,h,p){return p==null&&this.terrain&&(p=this.terrain.getElevationForLngLatZoom(h,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(y,o,h,p)}resize(y){var o;const h=this._containerDimensions(),p=h[0],m=h[1],v=this._getClampedPixelRatio(p,m);if(this._resizeCanvas(p,m,v),this.painter.resize(p,m,v),this.painter.overLimit()){const M=this.painter.context.gl;this._maxCanvasSize=[M.drawingBufferWidth,M.drawingBufferHeight];const A=this._getClampedPixelRatio(p,m);this._resizeCanvas(p,m,A),this.painter.resize(p,m,A)}this.transform.resize(p,m),(o=this._requestedCameraState)===null||o===void 0||o.resize(p,m);const E=!this._moving;return E&&(this.stop(),this.fire(new a.k("movestart",y)).fire(new a.k("move",y))),this.fire(new a.k("resize",y)),E&&this.fire(new a.k("moveend",y)),this}_getClampedPixelRatio(y,o){const{0:h,1:p}=this._maxCanvasSize,m=this.getPixelRatio(),v=y*m,E=o*m;return Math.min(v>h?h/v:1,E>p?p/E:1)*m}getPixelRatio(){var y;return(y=this._overridePixelRatio)!==null&&y!==void 0?y:devicePixelRatio}setPixelRatio(y){this._overridePixelRatio=y,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(y){return this.transform.setMaxBounds(at.convert(y)),this._update()}setMinZoom(y){if((y=y??-2)>=-2&&y<=this.transform.maxZoom)return this.transform.minZoom=y,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=y,this._update(),this.getZoom()>y&&this.setZoom(y),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(y){if((y=y??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(y>=0&&y<=this.transform.maxPitch)return this.transform.minPitch=y,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(y>=this.transform.minPitch)return this.transform.maxPitch=y,this._update(),this.getPitch()>y&&this.setPitch(y),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(y){return this.transform.renderWorldCopies=y,this._update()}project(y){return this.transform.locationPoint(a.M.convert(y),this.style&&this.terrain)}unproject(y){return this.transform.pointLocation(a.P.convert(y),this.terrain)}isMoving(){var y;return this._moving||((y=this.handlers)===null||y===void 0?void 0:y.isMoving())}isZooming(){var y;return this._zooming||((y=this.handlers)===null||y===void 0?void 0:y.isZooming())}isRotating(){var y;return this._rotating||((y=this.handlers)===null||y===void 0?void 0:y.isRotating())}_createDelegatedListener(y,o,h){if(y==="mouseenter"||y==="mouseover"){let p=!1;return{layer:o,listener:h,delegates:{mousemove:v=>{const E=this.getLayer(o)?this.queryRenderedFeatures(v.point,{layers:[o]}):[];E.length?p||(p=!0,h.call(this,new xi(y,this,v.originalEvent,{features:E}))):p=!1},mouseout:()=>{p=!1}}}}if(y==="mouseleave"||y==="mouseout"){let p=!1;return{layer:o,listener:h,delegates:{mousemove:E=>{(this.getLayer(o)?this.queryRenderedFeatures(E.point,{layers:[o]}):[]).length?p=!0:p&&(p=!1,h.call(this,new xi(y,this,E.originalEvent)))},mouseout:E=>{p&&(p=!1,h.call(this,new xi(y,this,E.originalEvent)))}}}}{const p=m=>{const v=this.getLayer(o)?this.queryRenderedFeatures(m.point,{layers:[o]}):[];v.length&&(m.features=v,h.call(this,m),delete m.features)};return{layer:o,listener:h,delegates:{[y]:p}}}}on(y,o,h){if(h===void 0)return super.on(y,o);const p=this._createDelegatedListener(y,o,h);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[y]=this._delegatedListeners[y]||[],this._delegatedListeners[y].push(p);for(const m in p.delegates)this.on(m,p.delegates[m]);return this}once(y,o,h){if(h===void 0)return super.once(y,o);const p=this._createDelegatedListener(y,o,h);for(const m in p.delegates)this.once(m,p.delegates[m]);return this}off(y,o,h){return h===void 0?super.off(y,o):(this._delegatedListeners&&this._delegatedListeners[y]&&(p=>{const m=this._delegatedListeners[y];for(let v=0;vthis._updateStyle(y,o));const h=this.style&&o.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!y)),y?(this.style=new Bi(this,o||{}),this.style.setEventedParent(this,{style:this.style}),typeof y=="string"?this.style.loadURL(y,o,h):this.style.loadJSON(y,o,h),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Bi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(y,o){if(typeof y=="string"){const h=this._requestManager.transformRequest(y,"Style");a.h(h,new AbortController).then(p=>{this._updateDiff(p.data,o)}).catch(p=>{p&&this.fire(new a.j(p))})}else typeof y=="object"&&this._updateDiff(y,o)}_updateDiff(y,o){try{this.style.setState(y,o)&&this._update(!0)}catch(h){a.w(`Unable to perform style diff: ${h.message||h.error||h}. Rebuilding the style from scratch.`),this._updateStyle(y,o)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.w("There is no style added to the map.")}addSource(y,o){return this._lazyInitEmptyStyle(),this.style.addSource(y,o),this._update(!0)}isSourceLoaded(y){const o=this.style&&this.style.sourceCaches[y];if(o!==void 0)return o.loaded();this.fire(new a.j(new Error(`There is no source with ID '${y}'`)))}setTerrain(y){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),y){const o=this.style.sourceCaches[y.source];if(!o)throw new Error(`cannot load terrain, because there exists no source with ID: ${y.source}`);this.terrain===null&&o.reload();for(const h in this.style._layers){const p=this.style._layers[h];p.type==="hillshade"&&p.source===y.source&&a.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new uf(this.painter,o,y),this.painter.renderToTexture=new lu(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=h=>{h.dataType==="style"?this.terrain.sourceCache.freeRtt():h.dataType==="source"&&h.tile&&(h.sourceId!==y.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(h.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.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new a.k("terrain",{terrain:y})),this}getTerrain(){var y,o;return(o=(y=this.terrain)===null||y===void 0?void 0:y.options)!==null&&o!==void 0?o:null}areTilesLoaded(){const y=this.style&&this.style.sourceCaches;for(const o in y){const h=y[o]._tiles;for(const p in h){const m=h[p];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}removeSource(y){return this.style.removeSource(y),this._update(!0)}getSource(y){return this.style.getSource(y)}addImage(y,o,h={}){const{pixelRatio:p=1,sdf:m=!1,stretchX:v,stretchY:E,content:M}=h;if(this._lazyInitEmptyStyle(),!(o instanceof HTMLImageElement||a.b(o))){if(o.width===void 0||o.height===void 0)return this.fire(new a.j(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:A,height:R,data:V}=o,q=o;return this.style.addImage(y,{data:new a.R({width:A,height:R},new Uint8Array(V)),pixelRatio:p,stretchX:v,stretchY:E,content:M,sdf:m,version:0,userImage:q}),q.onAdd&&q.onAdd(this,y),this}}{const{width:A,height:R,data:V}=k.getImageData(o);this.style.addImage(y,{data:new a.R({width:A,height:R},V),pixelRatio:p,stretchX:v,stretchY:E,content:M,sdf:m,version:0})}}updateImage(y,o){const h=this.style.getImage(y);if(!h)return this.fire(new a.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const p=o instanceof HTMLImageElement||a.b(o)?k.getImageData(o):o,{width:m,height:v,data:E}=p;if(m===void 0||v===void 0)return this.fire(new a.j(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(m!==h.data.width||v!==h.data.height)return this.fire(new a.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const M=!(o instanceof HTMLImageElement||a.b(o));return h.data.replace(E,M),this.style.updateImage(y,h),this}getImage(y){return this.style.getImage(y)}hasImage(y){return y?!!this.style.getImage(y):(this.fire(new a.j(new Error("Missing required image id"))),!1)}removeImage(y){this.style.removeImage(y)}loadImage(y){return G.getImage(this._requestManager.transformRequest(y,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(y,o){return this._lazyInitEmptyStyle(),this.style.addLayer(y,o),this._update(!0)}moveLayer(y,o){return this.style.moveLayer(y,o),this._update(!0)}removeLayer(y){return this.style.removeLayer(y),this._update(!0)}getLayer(y){return this.style.getLayer(y)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(y,o,h){return this.style.setLayerZoomRange(y,o,h),this._update(!0)}setFilter(y,o,h={}){return this.style.setFilter(y,o,h),this._update(!0)}getFilter(y){return this.style.getFilter(y)}setPaintProperty(y,o,h,p={}){return this.style.setPaintProperty(y,o,h,p),this._update(!0)}getPaintProperty(y,o){return this.style.getPaintProperty(y,o)}setLayoutProperty(y,o,h,p={}){return this.style.setLayoutProperty(y,o,h,p),this._update(!0)}getLayoutProperty(y,o){return this.style.getLayoutProperty(y,o)}setGlyphs(y,o={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(y,o),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(y,o,h={}){return this._lazyInitEmptyStyle(),this.style.addSprite(y,o,h,p=>{p||this._update(!0)}),this}removeSprite(y){return this._lazyInitEmptyStyle(),this.style.removeSprite(y),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(y,o={}){return this._lazyInitEmptyStyle(),this.style.setSprite(y,o,h=>{h||this._update(!0)}),this}setLight(y,o={}){return this._lazyInitEmptyStyle(),this.style.setLight(y,o),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(y,o){return this.style.setFeatureState(y,o),this._update()}removeFeatureState(y,o){return this.style.removeFeatureState(y,o),this._update()}getFeatureState(y){return this.style.getFeatureState(y)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let y=0,o=0;return this._container&&(y=this._container.clientWidth||400,o=this._container.clientHeight||300),[y,o]}_setupContainer(){const y=this._container;y.classList.add("maplibregl-map");const o=this._canvasContainer=C.create("div","maplibregl-canvas-container",y);this._interactive&&o.classList.add("maplibregl-interactive"),this._canvas=C.create("canvas","maplibregl-canvas",o),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const h=this._containerDimensions(),p=this._getClampedPixelRatio(h[0],h[1]);this._resizeCanvas(h[0],h[1],p);const m=this._controlContainer=C.create("div","maplibregl-control-container",y),v=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(E=>{v[E]=C.create("div",`maplibregl-ctrl-${E} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(y,o,h){this._canvas.width=Math.floor(h*y),this._canvas.height=Math.floor(h*o),this._canvas.style.width=`${y}px`,this._canvas.style.height=`${o}px`}_setupPainter(){const y={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let o=null;this._canvas.addEventListener("webglcontextcreationerror",p=>{o={requestedAttributes:y},p&&(o.statusMessage=p.statusMessage,o.type=p.type)},{once:!0});const h=this._canvas.getContext("webgl2",y)||this._canvas.getContext("webgl",y);if(!h){const p="Failed to initialize WebGL";throw o?(o.message=p,new Error(JSON.stringify(o))):new Error(p)}this.painter=new Kh(h,this.transform),P.testSupport(h)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(y){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||y,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(y){return this._update(),this._renderTaskQueue.add(y)}_cancelRenderFrame(y){this._renderTaskQueue.remove(y)}_render(y){const o=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(y),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,v=k.now();this.style.zoomHistory.update(m,v);const E=new a.a8(m,{now:v,fadeDuration:o,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),M=E.crossFadingFactor();M===1&&M===this._crossFadingFactor||(h=!0,this._crossFadingFactor=M),this.style.update(E)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,o,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:o,showPadding:this.showPadding}),this.fire(new a.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.bc.mark(a.bd.load),this.fire(new a.k("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.k("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,a.bc.mark(a.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var y;this._hash&&this._hash.remove();for(const h of this._controls)h.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),G.removeThrottleControl(this._imageQueueHandle),(y=this._resizeObserver)===null||y===void 0||y.disconnect();const o=this.painter.context.gl.getExtension("WEBGL_lose_context");o&&o.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),C.remove(this._canvasContainer),C.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),a.bc.clearMetrics(),this._removed=!0,this.fire(new a.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,k.frameAsync(this._frameRequest).then(y=>{a.bc.frame(y),this._frameRequest=null,this._render(y)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(y){this._showTileBoundaries!==y&&(this._showTileBoundaries=y,this._update())}get showPadding(){return!!this._showPadding}set showPadding(y){this._showPadding!==y&&(this._showPadding=y,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(y){this._showCollisionBoxes!==y&&(this._showCollisionBoxes=y,y?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(y){this._showOverdrawInspector!==y&&(this._showOverdrawInspector=y,this._update())}get repaint(){return!!this._repaint}set repaint(y){this._repaint!==y&&(this._repaint=y,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(y){this._vertices=y,this._update()}get version(){return uu}getCameraTargetElevation(){return this.transform.elevation}},d.MapMouseEvent=xi,d.MapTouchEvent=_o,d.MapWheelEvent=ru,d.Marker=Wa,d.NavigationControl=class{constructor(y){this._updateZoomButtons=()=>{const o=this._map.getZoom(),h=o===this._map.getMaxZoom(),p=o===this._map.getMinZoom();this._zoomInButton.disabled=h,this._zoomOutButton.disabled=p,this._zoomInButton.setAttribute("aria-disabled",h.toString()),this._zoomOutButton.setAttribute("aria-disabled",p.toString())},this._rotateCompassArrow=()=>{const o=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=o},this._setButtonTitle=(o,h)=>{const p=this._map._getUIString(`NavigationControl.${h}`);o.title=p,o.setAttribute("aria-label",p)},this.options=a.e({},hu,y),this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",o=>o.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",o=>this._map.zoomIn({},{originalEvent:o})),C.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",o=>this._map.zoomOut({},{originalEvent:o})),C.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",o=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:o}):this._map.resetNorth({},{originalEvent:o})}),this._compassIcon=C.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(y){return this._map=y,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._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new fu(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){C.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._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(y,o){const h=C.create("button",y,this._container);return h.type="button",h.addEventListener("click",o),h}},d.Popup=class extends a.E{constructor(y){super(),this.remove=()=>(this._content&&C.remove(this._content),this._container&&(C.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 a.k("close"))),this),this._onMouseUp=o=>{this._update(o.point)},this._onMouseMove=o=>{this._update(o.point)},this._onDrag=o=>{this._update(o.point)},this._update=o=>{var h;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=C.create("div","maplibregl-popup",this._map.getContainer()),this._tip=C.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const M of this.options.className.split(" "))this._container.classList.add(M);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Nl(this._lngLat,this._flatPos,this._map.transform):(h=this._lngLat)===null||h===void 0?void 0:h.wrap(),this._trackPointer&&!o)return;const p=this._flatPos=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&o?o:this._map.transform.locationPoint(this._lngLat));let m=this.options.anchor;const v=Gl(this.options.offset);if(!m){const M=this._container.offsetWidth,A=this._container.offsetHeight;let R;R=p.y+v.bottom.ythis._map.transform.height-A?["bottom"]:[],p.xthis._map.transform.width-M/2&&R.push("right"),m=R.length===0?"bottom":R.join("-")}let E=p.add(v[m]);this.options.subpixelPositioning||(E=E.round()),C.setTransform(this._container,`${Ga[m]} translate(${E.x}px,${E.y}px)`),jl(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=a.e(Object.create(du),y)}addTo(y){return this._map&&this.remove(),this._map=y,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 a.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(y){return this._lngLat=a.M.convert(y),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(y){return this.setDOMContent(document.createTextNode(y))}setHTML(y){const o=document.createDocumentFragment(),h=document.createElement("body");let p;for(h.innerHTML=y;p=h.firstChild,p;)o.appendChild(p);return this.setDOMContent(o)}getMaxWidth(){var y;return(y=this._container)===null||y===void 0?void 0:y.style.maxWidth}setMaxWidth(y){return this.options.maxWidth=y,this._update(),this}setDOMContent(y){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=C.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(y),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(y){this._container&&this._container.classList.add(y)}removeClassName(y){this._container&&this._container.classList.remove(y)}setOffset(y){return this.options.offset=y,this._update(),this}toggleClassName(y){if(this._container)return this._container.classList.toggle(y)}setSubpixelPositioning(y){this.options.subpixelPositioning=y}_createCloseButton(){this.options.closeButton&&(this._closeButton=C.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const y=this._container.querySelector(pu);y&&y.focus()}},d.RasterDEMTileSource=br,d.RasterTileSource=ne,d.ScaleControl=class{constructor(y){this._onMove=()=>{ql(this._map,this._container,this.options)},this.setUnit=o=>{this.options.unit=o,ql(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Vl),y)}getDefaultPosition(){return"bottom-left"}onAdd(y){return this._map=y,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-scale",y.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){C.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},d.ScrollZoomHandler=Bl,d.Style=Bi,d.TerrainControl=class{constructor(y){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=y}onAdd(y){return this._map=y,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=C.create("button","maplibregl-ctrl-terrain",this._container),C.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(){C.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},d.TwoFingersTouchPitchHandler=of,d.TwoFingersTouchRotateHandler=iu,d.TwoFingersTouchZoomHandler=nf,d.TwoFingersTouchZoomRotateHandler=Na,d.VectorTileSource=it,d.VideoSource=bn,d.addSourceType=(y,o)=>a._(void 0,void 0,void 0,function*(){if(ni(y))throw new Error(`A source type called "${y}" already exists.`);((h,p)=>{Mn[h]=p})(y,o)}),d.clearPrewarmedResources=function(){const y=er;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(Vt),er=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()"))},d.getMaxParallelImageRequests=function(){return a.a.MAX_PARALLEL_IMAGE_REQUESTS},d.getRTLTextPluginStatus=function(){return ct().getRTLTextPluginStatus()},d.getVersion=function(){return hf},d.getWorkerCount=function(){return sr.workerCount},d.getWorkerUrl=function(){return a.a.WORKER_URL},d.importScriptInWorkers=function(y){return Lr().broadcast("IS",y)},d.prewarm=function(){nr().acquire(Vt)},d.setMaxParallelImageRequests=function(y){a.a.MAX_PARALLEL_IMAGE_REQUESTS=y},d.setRTLTextPlugin=function(y,o){return ct().setRTLTextPlugin(y,o)},d.setWorkerCount=function(y){sr.workerCount=y},d.setWorkerUrl=function(y){a.a.WORKER_URL=y}});var u=t;return u})})(Nb);var Pc=Nb.exports;const to=Sg(Pc),c4=BS({__proto__:null,default:to},[Pc]),ic=[];function Yp(r,e){return{subscribe:Tr(r,e).subscribe}}function Tr(r,e=Mt){let t;const n=new Set;function l(a){if(Ut(r,a)&&(r=a,t)){const _=!ic.length;for(const x of n)x[1](),ic.push(x,r);if(_){for(let x=0;x{n.delete(x),n.size===0&&t&&(t(),t=null)}}return{set:l,update:u,subscribe:d}}let Ft;const Ub=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Ub.decode();let Ju=null;function nh(){return(Ju===null||Ju.byteLength===0)&&(Ju=new Uint8Array(Ft.memory.buffer)),Ju}function Eo(r,e){return r=r>>>0,Ub.decode(nh().subarray(r,r+e))}const As=new Array(128).fill(void 0);As.push(void 0,null,!0,!1);let ih=As.length;function Dn(r){ih===As.length&&As.push(As.length+1);const e=ih;return ih=As[e],As[e]=r,e}function Sr(r){return As[r]}function u4(r){r<132||(As[r]=ih,ih=r)}function dc(r){const e=Sr(r);return u4(r),e}function Qp(r){return r==null}let Yu=null;function h4(){return(Yu===null||Yu.byteLength===0)&&(Yu=new Float64Array(Ft.memory.buffer)),Yu}let Qu=null;function Cr(){return(Qu===null||Qu.byteLength===0)&&(Qu=new Int32Array(Ft.memory.buffer)),Qu}let aa=0;const Gf=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},f4=typeof Gf.encodeInto=="function"?function(r,e){return Gf.encodeInto(r,e)}:function(r,e){const t=Gf.encode(r);return e.set(t),{read:r.length,written:t.length}};function Rf(r,e,t){if(t===void 0){const a=Gf.encode(r),_=e(a.length,1)>>>0;return nh().subarray(_,_+a.length).set(a),aa=a.length,_}let n=r.length,l=e(n,1)>>>0;const u=nh();let d=0;for(;d127)break;u[l+d]=a}if(d!==n){d!==0&&(r=r.slice(d)),l=t(l,n,n=d+r.length*3,1)>>>0;const a=nh().subarray(l+d,l+n),_=f4(r,a);d+=_.written}return aa=d,l}function Pm(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const l=r.description;return l==null?"Symbol":`Symbol(${l})`}if(e=="function"){const l=r.name;return typeof l=="string"&&l.length>0?`Function(${l})`:"Function"}if(Array.isArray(r)){const l=r.length;let u="[";l>0&&(u+=Pm(r[0]));for(let d=1;d1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message} +${r.stack}`:n}function d4(r,e){const t=e(r.length*1,1)>>>0;return nh().set(r,t/1),aa=r.length,t}function em(r,e){try{return r.apply(this,e)}catch(t){Ft.__wbindgen_exn_store(Dn(t))}}class ld{static __wrap(e){e=e>>>0;const t=Object.create(ld.prototype);return t.__wbg_ptr=e,t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();Ft.__wbg_jsroutesnapper_free(e)}constructor(e){try{const u=Ft.__wbindgen_add_to_stack_pointer(-16),d=d4(e,Ft.__wbindgen_malloc),a=aa;Ft.jsroutesnapper_new(u,d,a);var t=Cr()[u/4+0],n=Cr()[u/4+1],l=Cr()[u/4+2];if(l)throw dc(n);return ld.__wrap(t)}finally{Ft.__wbindgen_add_to_stack_pointer(16)}}setRouteConfig(e){Ft.jsroutesnapper_setRouteConfig(this.__wbg_ptr,Dn(e))}setAreaMode(){Ft.jsroutesnapper_setAreaMode(this.__wbg_ptr)}getConfig(){let e,t;try{const u=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_getConfig(u,this.__wbg_ptr);var n=Cr()[u/4+0],l=Cr()[u/4+1];return e=n,t=l,Eo(n,l)}finally{Ft.__wbindgen_add_to_stack_pointer(16),Ft.__wbindgen_free(e,t,1)}}toFinalFeature(){try{const n=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_toFinalFeature(n,this.__wbg_ptr);var e=Cr()[n/4+0],t=Cr()[n/4+1];let l;return e!==0&&(l=Eo(e,t).slice(),Ft.__wbindgen_free(e,t*1)),l}finally{Ft.__wbindgen_add_to_stack_pointer(16)}}renderGeojson(){let e,t;try{const u=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_renderGeojson(u,this.__wbg_ptr);var n=Cr()[u/4+0],l=Cr()[u/4+1];return e=n,t=l,Eo(n,l)}finally{Ft.__wbindgen_add_to_stack_pointer(16),Ft.__wbindgen_free(e,t,1)}}toggleSnapMode(){Ft.jsroutesnapper_toggleSnapMode(this.__wbg_ptr)}onMouseMove(e,t,n){return Ft.jsroutesnapper_onMouseMove(this.__wbg_ptr,e,t,n)!==0}onClick(){Ft.jsroutesnapper_onClick(this.__wbg_ptr)}onDragStart(){return Ft.jsroutesnapper_onDragStart(this.__wbg_ptr)!==0}onMouseUp(){return Ft.jsroutesnapper_onMouseUp(this.__wbg_ptr)!==0}clearState(){Ft.jsroutesnapper_clearState(this.__wbg_ptr)}editExisting(e){try{const l=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_editExisting(l,this.__wbg_ptr,Dn(e));var t=Cr()[l/4+0],n=Cr()[l/4+1];if(n)throw dc(t)}finally{Ft.__wbindgen_add_to_stack_pointer(16)}}debugRenderGraph(){let e,t;try{const u=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_debugRenderGraph(u,this.__wbg_ptr);var n=Cr()[u/4+0],l=Cr()[u/4+1];return e=n,t=l,Eo(n,l)}finally{Ft.__wbindgen_add_to_stack_pointer(16),Ft.__wbindgen_free(e,t,1)}}debugSnappableNodes(){let e,t;try{const u=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_debugSnappableNodes(u,this.__wbg_ptr);var n=Cr()[u/4+0],l=Cr()[u/4+1];return e=n,t=l,Eo(n,l)}finally{Ft.__wbindgen_add_to_stack_pointer(16),Ft.__wbindgen_free(e,t,1)}}routeNameForWaypoints(e){let t,n;try{const S=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_routeNameForWaypoints(S,this.__wbg_ptr,Dn(e));var l=Cr()[S/4+0],u=Cr()[S/4+1],d=Cr()[S/4+2],a=Cr()[S/4+3],_=l,x=u;if(a)throw _=0,x=0,dc(d);return t=_,n=x,Eo(_,x)}finally{Ft.__wbindgen_add_to_stack_pointer(16),Ft.__wbindgen_free(t,n,1)}}addSnappedWaypoint(e,t){Ft.jsroutesnapper_addSnappedWaypoint(this.__wbg_ptr,e,t)}undo(){Ft.jsroutesnapper_undo(this.__wbg_ptr)}calculateRoute(e){let t,n;try{const S=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_calculateRoute(S,this.__wbg_ptr,Dn(e));var l=Cr()[S/4+0],u=Cr()[S/4+1],d=Cr()[S/4+2],a=Cr()[S/4+3],_=l,x=u;if(a)throw _=0,x=0,dc(d);return t=_,n=x,Eo(_,x)}finally{Ft.__wbindgen_add_to_stack_pointer(16),Ft.__wbindgen_free(t,n,1)}}getExtraNodes(e,t){let n,l;try{const k=Ft.__wbindgen_add_to_stack_pointer(-16);Ft.jsroutesnapper_getExtraNodes(k,this.__wbg_ptr,Dn(e),Dn(t));var u=Cr()[k/4+0],d=Cr()[k/4+1],a=Cr()[k/4+2],_=Cr()[k/4+3],x=u,S=d;if(_)throw x=0,S=0,dc(a);return n=x,l=S,Eo(x,S)}finally{Ft.__wbindgen_add_to_stack_pointer(16),Ft.__wbindgen_free(n,l,1)}}}async function p4(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(n){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}const t=await r.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{const t=await WebAssembly.instantiate(r,e);return t instanceof WebAssembly.Instance?{instance:t,module:r}:t}}function m4(){const r={};return r.wbg={},r.wbg.__wbindgen_string_new=function(e,t){const n=Eo(e,t);return Dn(n)},r.wbg.__wbindgen_object_drop_ref=function(e){dc(e)},r.wbg.__wbindgen_error_new=function(e,t){const n=new Error(Eo(e,t));return Dn(n)},r.wbg.__wbindgen_number_get=function(e,t){const n=Sr(t),l=typeof n=="number"?n:void 0;h4()[e/8+1]=Qp(l)?0:l,Cr()[e/4+0]=!Qp(l)},r.wbg.__wbindgen_is_object=function(e){const t=Sr(e);return typeof t=="object"&&t!==null},r.wbg.__wbindgen_is_undefined=function(e){return Sr(e)===void 0},r.wbg.__wbindgen_in=function(e,t){return Sr(e)in Sr(t)},r.wbg.__wbindgen_boolean_get=function(e){const t=Sr(e);return typeof t=="boolean"?t?1:0:2},r.wbg.__wbindgen_jsval_loose_eq=function(e,t){return Sr(e)==Sr(t)},r.wbg.__wbindgen_string_get=function(e,t){const n=Sr(t),l=typeof n=="string"?n:void 0;var u=Qp(l)?0:Rf(l,Ft.__wbindgen_malloc,Ft.__wbindgen_realloc),d=aa;Cr()[e/4+1]=d,Cr()[e/4+0]=u},r.wbg.__wbg_String_4370c5505c674d30=function(e,t){const n=String(Sr(t)),l=Rf(n,Ft.__wbindgen_malloc,Ft.__wbindgen_realloc),u=aa;Cr()[e/4+1]=u,Cr()[e/4+0]=l},r.wbg.__wbindgen_object_clone_ref=function(e){const t=Sr(e);return Dn(t)},r.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea=function(e,t){const n=Sr(e)[Sr(t)];return Dn(n)},r.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return Dn(e)},r.wbg.__wbg_stack_658279fe44541cf6=function(e,t){const n=Sr(t).stack,l=Rf(n,Ft.__wbindgen_malloc,Ft.__wbindgen_realloc),u=aa;Cr()[e/4+1]=u,Cr()[e/4+0]=l},r.wbg.__wbg_error_f851667af71bcfc6=function(e,t){let n,l;try{n=e,l=t,console.error(Eo(e,t))}finally{Ft.__wbindgen_free(n,l,1)}},r.wbg.__wbg_debug_9a6b3243fbbebb61=function(e){console.debug(Sr(e))},r.wbg.__wbg_error_788ae33f81d3b84b=function(e){console.error(Sr(e))},r.wbg.__wbg_info_2e30e8204b29d91d=function(e){console.info(Sr(e))},r.wbg.__wbg_log_1d3ae0273d8f4f8a=function(e){console.log(Sr(e))},r.wbg.__wbg_warn_d60e832f9882c1b2=function(e){console.warn(Sr(e))},r.wbg.__wbg_get_44be0491f933a435=function(e,t){const n=Sr(e)[t>>>0];return Dn(n)},r.wbg.__wbg_length_fff51ee6522a1a18=function(e){return Sr(e).length},r.wbg.__wbindgen_is_function=function(e){return typeof Sr(e)=="function"},r.wbg.__wbg_next_526fc47e980da008=function(e){const t=Sr(e).next;return Dn(t)},r.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return em(function(e){const t=Sr(e).next();return Dn(t)},arguments)},r.wbg.__wbg_done_5c1f01fb660d73b5=function(e){return Sr(e).done},r.wbg.__wbg_value_1695675138684bd5=function(e){const t=Sr(e).value;return Dn(t)},r.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return Dn(Symbol.iterator)},r.wbg.__wbg_get_97b561fb56f034b5=function(){return em(function(e,t){const n=Reflect.get(Sr(e),Sr(t));return Dn(n)},arguments)},r.wbg.__wbg_call_cb65541d95d71282=function(){return em(function(e,t){const n=Sr(e).call(Sr(t));return Dn(n)},arguments)},r.wbg.__wbg_isArray_4c24b343cb13cfb1=function(e){return Array.isArray(Sr(e))},r.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(e){let t;try{t=Sr(e)instanceof ArrayBuffer}catch{t=!1}return t},r.wbg.__wbg_buffer_085ec1f694018c4f=function(e){const t=Sr(e).buffer;return Dn(t)},r.wbg.__wbg_new_8125e318e6245eed=function(e){const t=new Uint8Array(Sr(e));return Dn(t)},r.wbg.__wbg_set_5cf90238115182c3=function(e,t,n){Sr(e).set(Sr(t),n>>>0)},r.wbg.__wbg_length_72e2208bbc0efc61=function(e){return Sr(e).length},r.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(e){let t;try{t=Sr(e)instanceof Uint8Array}catch{t=!1}return t},r.wbg.__wbindgen_debug_string=function(e,t){const n=Pm(Sr(t)),l=Rf(n,Ft.__wbindgen_malloc,Ft.__wbindgen_realloc),u=aa;Cr()[e/4+1]=u,Cr()[e/4+0]=l},r.wbg.__wbindgen_throw=function(e,t){throw new Error(Eo(e,t))},r.wbg.__wbindgen_memory=function(){const e=Ft.memory;return Dn(e)},r}function g4(r,e){return Ft=r.exports,Vb.__wbindgen_wasm_module=e,Yu=null,Qu=null,Ju=null,Ft}async function Vb(r){if(Ft!==void 0)return Ft;typeof r>"u"&&(r="/ltn/assets/route_snapper_bg.wasm");const e=m4();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:t,module:n}=await p4(await r,e);return g4(t,n)}var Li=63710088e-1,kg={centimeters:Li*100,centimetres:Li*100,degrees:Li/111325,feet:Li*3.28084,inches:Li*39.37,kilometers:Li/1e3,kilometres:Li/1e3,meters:Li,metres:Li,miles:Li/1609.344,millimeters:Li*1e3,millimetres:Li*1e3,nauticalmiles:Li/1852,radians:1,yards:Li*1.0936},_4={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Li,yards:1.0936133},zm={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Do(r,e,t){t===void 0&&(t={});var n={type:"Feature"};return(t.id===0||t.id)&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.properties=e||{},n.geometry=r,n}function y4(r,e,t){switch(r){case"Point":return eo(e).geometry;case"LineString":return Co(e).geometry;case"Polygon":return Tg(e).geometry;case"MultiPoint":return Gb(e).geometry;case"MultiLineString":return qb(e).geometry;case"MultiPolygon":return Wb(e).geometry;default:throw new Error(r+" is invalid")}}function eo(r,e,t){if(t===void 0&&(t={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!cd(r[0])||!cd(r[1]))throw new Error("coordinates must contain numbers");var n={type:"Point",coordinates:r};return Do(n,e,t)}function v4(r,e,t){return t===void 0&&(t={}),tl(r.map(function(n){return eo(n,e)}),t)}function Tg(r,e,t){t===void 0&&(t={});for(var n=0,l=r;n=0))throw new Error("precision must be a positive number");var t=Math.pow(10,e||0);return Math.round(r*t)/t}function Eg(r,e){e===void 0&&(e="kilometers");var t=kg[e];if(!t)throw new Error(e+" units is invalid");return r*t}function Rd(r,e){e===void 0&&(e="kilometers");var t=kg[e];if(!t)throw new Error(e+" units is invalid");return r/t}function k4(r,e){return hh(Rd(r,e))}function T4(r){var e=r%360;return e<0&&(e+=360),e}function hh(r){var e=r%(2*Math.PI);return e*180/Math.PI}function Io(r){var e=r%360;return e*Math.PI/180}function E4(r,e,t){if(e===void 0&&(e="kilometers"),t===void 0&&(t="kilometers"),!(r>=0))throw new Error("length must be a positive number");return Eg(Rd(r,e),t)}function M4(r,e,t){if(e===void 0&&(e="meters"),t===void 0&&(t="kilometers"),!(r>=0))throw new Error("area must be a positive number");var n=zm[e];if(!n)throw new Error("invalid original units");var l=zm[t];if(!l)throw new Error("invalid final units");return r/n*l}function cd(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function Mg(r){return!!r&&r.constructor===Object}function C4(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(e){if(!cd(e))throw new Error("bbox must only contain numbers")})}function I4(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}const A4=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:zm,bearingToAzimuth:T4,convertArea:M4,convertLength:E4,degreesToRadians:Io,earthRadius:Li,factors:kg,feature:Do,featureCollection:tl,geometry:y4,geometryCollection:x4,isNumber:cd,isObject:Mg,lengthToDegrees:k4,lengthToRadians:Rd,lineString:Co,lineStrings:w4,multiLineString:qb,multiPoint:Gb,multiPolygon:Wb,point:eo,points:v4,polygon:Tg,polygons:b4,radiansToDegrees:hh,radiansToLength:Eg,round:S4,unitsFactors:_4,validateBBox:C4,validateId:I4},Symbol.toStringTag,{value:"Module"}));function fh(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function xc(r){if(Array.isArray(r))return r;if(r.type==="Feature"){if(r.geometry!==null)return r.geometry.coordinates}else if(r.coordinates)return r.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Fu(r,e,t){t===void 0&&(t={});var n=fh(r),l=fh(e),u=Io(l[1]-n[1]),d=Io(l[0]-n[0]),a=Io(n[1]),_=Io(l[1]),x=Math.pow(Math.sin(u/2),2)+Math.pow(Math.sin(d/2),2)*Math.cos(a)*Math.cos(_);return Eg(2*Math.atan2(Math.sqrt(x),Math.sqrt(1-x)),t.units)}function Sh(r,e,t){if(r!==null)for(var n,l,u,d,a,_,x,S=0,k=0,C,P=r.type,D=P==="FeatureCollection",N=P==="Feature",z=D?r.features.length:1,B=0;B_||D>x||N>S){a=k,_=n,x=D,S=N,u=0;return}var z=Co([a,k],t.properties);if(e(z,n,l,N,u)===!1)return!1;u++,a=k})===!1)return!1}}})}function F4(r,e,t){var n=t,l=!1;return Hb(r,function(u,d,a,_,x){l===!1&&t===void 0?n=u:n=e(n,u,d,a,_,x),l=!0}),n}function $b(r,e){if(!r)throw new Error("geojson is required");zc(r,function(t,n,l){if(t.geometry!==null){var u=t.geometry.type,d=t.geometry.coordinates;switch(u){case"LineString":if(e(t,n,l,0,0)===!1)return!1;break;case"Polygon":for(var a=0;al?t:l,x=n>u?n:u;return[d,a,_,x]}var Ig={exports:{}},Kb={exports:{}};(function(r,e){(function(t,n){r.exports=n()})(xh,function(){function t(O,G,U,K,me){(function X(Y,_e,ze,re,ce){for(;re>ze;){if(re-ze>600){var Ze=re-ze+1,Me=_e-ze+1,ft=Math.log(Ze),Ct=.5*Math.exp(2*ft/3),Ot=.5*Math.sqrt(ft*Ct*(Ze-Ct)/Ze)*(Me-Ze/2<0?-1:1),Ke=Math.max(ze,Math.floor(_e-Me*Ct/Ze+Ot)),Kt=Math.min(re,Math.floor(_e+(Ze-Me)*Ct/Ze+Ot));X(Y,_e,Ke,Kt,ce)}var vt=Y[_e],At=ze,Vt=re;for(n(Y,ze,_e),ce(Y[re],vt)>0&&n(Y,ze,re);At0;)Vt--}ce(Y[ze],vt)===0?n(Y,ze,Vt):n(Y,++Vt,re),Vt<=_e&&(ze=Vt+1),_e<=Vt&&(re=Vt-1)}})(O,G,U||0,K||O.length-1,me||l)}function n(O,G,U){var K=O[G];O[G]=O[U],O[U]=K}function l(O,G){return OG?1:0}var u=function(O){O===void 0&&(O=9),this._maxEntries=Math.max(4,O),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function d(O,G,U){if(!U)return G.indexOf(O);for(var K=0;K=O.minX&&G.maxY>=O.minY}function z(O){return{children:O,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function B(O,G,U,K,me){for(var X=[G,U];X.length;)if(!((U=X.pop())-(G=X.pop())<=K)){var Y=G+Math.ceil((U-G)/K/2)*K;t(O,Y,G,U,me),X.push(G,Y,Y,U)}}return u.prototype.all=function(){return this._all(this.data,[])},u.prototype.search=function(O){var G=this.data,U=[];if(!N(O,G))return U;for(var K=this.toBBox,me=[];G;){for(var X=0;X=0&&me[G].children.length>this._maxEntries;)this._split(me,G),G--;this._adjustParentBBoxes(K,me,G)},u.prototype._split=function(O,G){var U=O[G],K=U.children.length,me=this._minEntries;this._chooseSplitAxis(U,me,K);var X=this._chooseSplitIndex(U,me,K),Y=z(U.children.splice(X,U.children.length-X));Y.height=U.height,Y.leaf=U.leaf,a(U,this.toBBox),a(Y,this.toBBox),G?O[G-1].children.push(Y):this._splitRoot(U,Y)},u.prototype._splitRoot=function(O,G){this.data=z([O,G]),this.data.height=O.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},u.prototype._chooseSplitIndex=function(O,G,U){for(var K,me,X,Y,_e,ze,re,ce=1/0,Ze=1/0,Me=G;Me<=U-G;Me++){var ft=_(O,0,Me,this.toBBox),Ct=_(O,Me,U,this.toBBox),Ot=(me=ft,X=Ct,Y=void 0,_e=void 0,ze=void 0,re=void 0,Y=Math.max(me.minX,X.minX),_e=Math.max(me.minY,X.minY),ze=Math.min(me.maxX,X.maxX),re=Math.min(me.maxY,X.maxY),Math.max(0,ze-Y)*Math.max(0,re-_e)),Ke=C(ft)+C(Ct);Ot=G;ce--){var Ze=O.children[ce];x(Y,O.leaf?me(Ze):Ze),_e+=P(Y)}return _e},u.prototype._adjustParentBBoxes=function(O,G,U){for(var K=U;K>=0;K--)x(G[K],O)},u.prototype._condense=function(O){for(var G=O.length-1,U=void 0;G>=0;G--)O[G].children.length===0?G>0?(U=O[G-1].children).splice(U.indexOf(O[G]),1):this.clear():a(O[G],this.toBBox)},u})})(Kb);var Z4=Kb.exports;const H4=Dd(A4),$4=Dd(U4);function Jb(r,e,t){if(r!==null)for(var n,l,u,d,a,_,x,S=0,k=0,C,P=r.type,D=P==="FeatureCollection",N=P==="Feature",z=D?r.features.length:1,B=0;B{t[0]>n[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2] line1 must only contain 2 coordinates");if(n.length!==2)throw new Error(" line2 must only contain 2 coordinates");var l=t[0][0],u=t[0][1],d=t[1][0],a=t[1][1],_=n[0][0],x=n[0][1],S=n[1][0],k=n[1][1],C=(k-x)*(d-l)-(S-_)*(a-u),P=(S-_)*(u-x)-(k-x)*(l-_),D=(d-l)*(u-x)-(a-u)*(l-_);if(C===0)return null;var N=P/C,z=D/C;if(N>=0&&N<=1&&z>=0&&z<=1){var B=l+N*(d-l),O=u+N*(a-u);return eo([B,O])}return null}function rk(r,e,t){t===void 0&&(t={});var n=eo([1/0,1/0],{dist:1/0}),l=0;return zc(r,function(u){for(var d=xc(u),a=0;a0&&(z=N.features[0],z.properties.dist=Fu(e,z,t),z.properties.location=l+Fu(_,z,t)),_.properties.dist{if(!this.active)return;const a=[d.point.x-nk,d.point.y],_=this.map.unproject(d.point).distanceTo(this.map.unproject(a));this.inner.onMouseMove(d.lngLat.lng,d.lngLat.lat,_)&&(this.redraw(),this.dataUpdated())},this.onClick=()=>{this.active&&(this.inner.onClick(),this.redraw(),this.dataUpdated())},this.onDoubleClick=d=>{this.active&&(d.preventDefault(),this.inner.onClick(),this.finish())},this.onDragStart=()=>{this.active&&this.inner.onDragStart()&&this.map.dragPan.disable()},this.onMouseUp=()=>{this.active&&this.inner.onMouseUp()&&this.map.dragPan.enable()},this.onKeyDown=d=>{if(!this.active)return;let a=d.target.tagName;a=="INPUT"||a=="TEXTAREA"||d.key=="Escape"&&(d.stopPropagation(),this.cancel())},this.onKeyPress=d=>{if(!this.active)return;let a=d.target.tagName;a=="INPUT"||a=="TEXTAREA"||(d.key=="Enter"?(d.stopPropagation(),this.finish()):d.key=="s"||d.key=="S"?(d.stopPropagation(),this.inner.toggleSnapMode(),this.redraw()):d.key=="z"&&d.ctrlKey&&this.undo())},this.map=e,console.time("Deserialize and setup JsRouteSnapper"),this.inner=new ld(t),console.timeEnd("Deserialize and setup JsRouteSnapper"),this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.routeToolGj=n,this.snapMode=l,this.undoLength=u,this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("dragstart",this.onDragStart),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keypress",this.onKeyPress)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("dragstart",this.onDragStart),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keypress",this.onKeyPress)}startRoute(){this.active||(this.active=!0,this.map.boxZoom.disable(),this.map.doubleClickZoom.disable())}startArea(){this.active||(this.inner.setAreaMode(),this.active=!0,this.map.boxZoom.disable(),this.map.doubleClickZoom.disable())}stop(){this.active=!1,this.inner.clearState(),this.redraw(),this.map.boxZoom.enable(),this.map.doubleClickZoom.enable()}editExistingRoute(e){this.active&&window.alert("Bug: editExistingRoute called when tool is already active"),e.properties.waypoints||(e.properties.waypoints=[{lon:e.geometry.coordinates[0][0],lat:e.geometry.coordinates[0][1],snapped:!0},{lon:e.geometry.coordinates[e.geometry.coordinates.length-1][0],lat:e.geometry.coordinates[e.geometry.coordinates.length-1][1],snapped:!0}]),this.startRoute(),this.inner.editExisting(e.properties.waypoints),this.redraw()}editExistingArea(e){this.active&&window.alert("Bug: editExistingArea called when tool is already active"),e.properties.waypoints||window.alert("Bug: editExistingArea called for a polygon not produced by the route-snapper"),this.startArea(),this.inner.editExisting(e.properties.waypoints),this.redraw()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}isActive(){return this.active}finish(){let e=this.inner.toFinalFeature();if(e)for(let t of this.eventListenersSuccess)t(JSON.parse(e));else for(let t of this.eventListenersFailure)t();this.stop()}cancel(){this.inner.clearState(),this.finish()}setRouteConfig(e){this.inner.setRouteConfig(e),this.redraw()}addSnappedWaypoint(e){this.inner.addSnappedWaypoint(e[0],e[1]),this.redraw()}undo(){this.inner.undo(),this.redraw()}toggleSnapMode(){this.inner.toggleSnapMode(),this.redraw()}redraw(){let e=JSON.parse(this.inner.renderGeojson());this.routeToolGj.set(e),this.map.getCanvas().style.cursor=e.cursor,this.snapMode.set(e.snap_mode),this.undoLength.set(e.undo_length)}dataUpdated(){let e=this.inner.toFinalFeature();if(e)for(let t of this.eventListenersUpdated)t(JSON.parse(e))}}const Dm="MZEJTanw3WpxRvt7qDfo";let ls=Tr(null),Rm=Tr("streets-v2"),dh=Tr(!1),ha=Tr(""),hd=Tr(!0),ri=Tr(null),Bm=Tr(new Pc.LngLat(0,0)),Fm=Tr(new Pc.LngLat(0,0)),Wy=Tr(1),ia=Tr(1),pr=Tr({mode:"title"}),Om=Tr("walk_cycle_only"),Zy=Tr(!1);function Sc(){let r=Hi(ha);r||window.alert("Autosave failed; no projectName set?!"),window.localStorage.setItem(r,Hi(ri).toSavefile())}function Hy(r){let e,t;return e=new Pd({props:{$$slots:{default:[ok,({dialog:n})=>({3:n}),({dialog:n})=>n?8:0]},$$scope:{ctx:r}}}),e.$on("close",r[2]),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&24&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function ok(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D;function N(){return r[1](r[3])}return{c(){e=fe("h1"),e.textContent="The low-traffic neighbourhood (LTN) tool, v2",t=Ve(),n=fe("p"),n.innerHTML=`This is an experimental version of the A/B Street LTN tool . Most parts of it do not work yet, and you should probably use the other version @@ -588,7 +588,7 @@ ${r.stack}`:n}function f4(r,e){const t=e(r.length*1,1)>>>0;return nh().set(r,t/1 effects`,_=Ve(),x=fe("p"),x.innerHTML=`This tool is created by Dustin Carlino and relies heavily on OpenStreetMap - data.`,S=Ve(),k=fe("center"),C=fe("button"),C.textContent="Start!"},m(z,B){be(z,e,B),be(z,t,B),be(z,n,B),be(z,l,B),be(z,u,B),be(z,d,B),be(z,a,B),be(z,_,B),be(z,x,B),be(z,S,B),be(z,k,B),ie(k,C),P||(D=Tt(C,"click",N),P=!0)},p(z,B){r=z},d(z){z&&(ve(e),ve(t),ve(n),ve(l),ve(u),ve(d),ve(a),ve(_),ve(x),ve(S),ve(k)),P=!1,D()}}}function ok(r){let e,t,n=r[0]&&Zy(r);return{c(){n&&n.c(),e=$n()},m(l,u){n&&n.m(l,u),be(l,e,u),t=!0},p(l,[u]){l[0]?n?(n.p(l,u),u&1&&oe(n,1)):(n=Zy(l),n.c(),oe(n,1),n.m(e.parentNode,e)):n&&(yr(),de(n,1,1,()=>{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function sk(r,e,t){let n;return wt(r,hd,d=>t(0,n=d)),[n,d=>dn(d).close(),()=>Rt(hd,n=!1,n)]}class ak extends Ht{constructor(e){super(),Zt(this,e,sk,ok,Ut,{})}}const lk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAk0lEQVRIS+3U0Q2AIAwEUNjMUXQydRJH0zZB0wjGuwJfSsKfuWfO1hg6n9g5P3wPWKTSXe6EVstUNEjoloIVghAG0OxR7swgLEAjHoBCvACM1AAQUgJ0DL0nm67WwJom7XrBlhVl4arUAHYniuE1ABTuBeBwD0CFs4D92T12fp9v9iPrnJ8LBu0KC0Ch9qEfeK3sAPceHxk8hJ17AAAAAElFTkSuQmCC",ck="/ltn/assets/logo-97f2d067.svg";let uk=Date.now();function Dc(r){return`${r}-${uk++}`}const Ig=Symbol.for("svelte-maplibre");function nl(){return Cb(Ig)}function hk(r){let e=new WeakMap;return t=>{var d;let n=e.get(t.originalEvent);if(n!==void 0)return n;let u=(d=t.target.queryRenderedFeatures(t.point).find(a=>{var _;return(_=r.get(a.layer.id))==null?void 0:_.interactive}))==null?void 0:d.layer.id;return e.set(t.originalEvent,u),u}}function fk(){let r=new Map;return wg(Ig,{map:Tr(null),source:Yp(null),layer:Yp(null),popupTarget:Yp(null),cluster:Tr(),loadedImages:Tr(new Set),minzoom:Tr(0),maxzoom:Tr(24),layerEvent:Tr(null),layerInfo:r,eventTopMost:hk(r),markerClickManager:new _k})}function Hy(r){return{subscribe:r.subscribe}}function Ag({key:r,setPopupTarget:e=!1,setCluster:t=!1,setMouseEvent:n=!1}){let l=nl(),u=Tr(null),d=Hy(u),a={...l,[r]:Hy(u)};if(e&&(a.popupTarget=d),n){let _=Tr(null);a.layerEvent=_,l.layerEvent=_}return t&&(a.cluster=Tr()),wg(Ig,a),{...l,self:u}}function dk(){return Ag({key:"source",setCluster:!0})}function pk(r=!0){return Ag({key:"layer",setPopupTarget:r,setMouseEvent:r})}function mk(){return Ag({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function gk(r){return"layerType"in r&&r.layerType==="deckgl"}class _k{constructor(){Wn(this,"_handlers",new Set)}add(e){this._handlers.add(e)}remove(e){this._handlers.delete(e)}handleClick(e){for(const t of this._handlers)t(e)}}function $y(r){let e;return t=>{if(t)for(let n in t){let l=e==null?void 0:e[n],u=t[n];l!==u&&r(n,u,l)}else if(e)for(let n in e)r(n,void 0,e[n]);e=t}}function yk(r,...e){let t=[r];for(let n of e)if(n)Array.isArray(n)&&n[0]===r?t.push(...n.slice(1)):t.push(n);else continue;if(t.length!==1)return t.length===2?t[1]:t}function vk(r){return r===!0?["has","point_count"]:r===!1?["!",["has","point_count"]]:void 0}function kc(r,e){return["case",["boolean",["feature-state","hover"],!1],e,r]}var rl=bk;function bk(r){var e,t,n;if(r){if(Array.isArray(r)){for(e=[],t=r.length,n=0;n{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function xk(r,e,t){let n,l,u,d,a,_,x,S,k,C,P,D,{$$slots:N={},$$scope:z}=e,{id:B=Dc("layer")}=e,{source:O=void 0}=e,{sourceLayer:G=void 0}=e,{beforeId:U=void 0}=e,{beforeLayerType:K=void 0}=e,{type:me}=e,{paint:X=void 0}=e,{layout:Y=void 0}=e,{filter:_e=void 0}=e,{applyToClusters:ze=void 0}=e,{minzoom:re=void 0}=e,{maxzoom:ce=void 0}=e,{manageHoverState:Ze=!1}=e,{hovered:Me=null}=e,{interactive:ft=!0}=e,{hoverCursor:Ct=void 0}=e,{eventsIfTopMost:Ot=!1}=e;const Ke=us(),{map:Kt,source:vt,self:At,minzoom:Vt,maxzoom:sr,eventTopMost:fr,layerInfo:er}=pk();wt(r,Kt,De=>t(31,k=De)),wt(r,vt,De=>t(32,C=De)),wt(r,At,De=>t(0,S=De)),wt(r,Vt,De=>t(34,D=De)),wt(r,sr,De=>t(33,P=De)),ti(()=>{S&&k&&(er.delete(S),k==null||k.removeLayer(S))});let Nt;function nr(De){var ne,br;if(!ft||!S||!k||Ot&&fr(De)!==S)return;let at=De.features??[],tt=(br=(ne=at[0])==null?void 0:ne.properties)==null?void 0:br.cluster_id,it={event:De,map:k,clusterId:tt,layer:S,source:a,features:at};Ke(De.type,it)}function tr(De){var ne,br;if(!ft||!S||!k||Ot&&fr(De)!==S)return;Ct&&(k.getCanvas().style.cursor=Ct);let at=De.features??[];t(6,Me=at[0]??null);let tt=(br=(ne=at[0])==null?void 0:ne.properties)==null?void 0:br.cluster_id;Ke("mouseenter",{event:De,map:k,clusterId:tt,layer:S,source:a,features:at})}function Lr(De){var ne,br,We;if(!ft||!k)return;if(Ot&&fr(De)!==S){t(6,Me=null),Ze&&Nt!==void 0&&(k==null||k.setFeatureState({source:a,sourceLayer:G,id:Nt},{hover:!1}),Nt=void 0);return}k.getCanvas().style.cursor=Ct;let at=De.features??[],tt=(br=(ne=at[0])==null?void 0:ne.properties)==null?void 0:br.cluster_id,it=(We=at[0])==null?void 0:We.id;it!==Nt&&(Ze&&(Nt!==void 0&&(k==null||k.setFeatureState({source:a,id:Nt,sourceLayer:G},{hover:!1})),k==null||k.setFeatureState({source:a,id:it,sourceLayer:G},{hover:!0})),Nt=it,t(6,Me=at[0]??null)),Ke("mousemove",{event:De,map:k,clusterId:tt,layer:S,source:a,features:at})}function Pr(De){if(!(!ft||!S||!k)){if(Ct&&(k.getCanvas().style.cursor=""),t(6,Me=null),Ze&&Nt!==void 0){const at={source:a,id:Nt,sourceLayer:G};k==null||k.setFeatureState(at,{hover:!1}),Nt=void 0}Ke("mouseleave",{map:k,layer:S,source:a})}}let st=!0;function Lt(De){k&&(k.off("click",De,nr),k.off("dblclick",De,nr),k.off("contextmenu",De,nr),k.off("mouseenter",De,tr),k.off("mousemove",De,Lr),k.off("mouseleave",De,Pr))}return ti(()=>{k&&S&&Lt(S)}),r.$$set=De=>{"id"in De&&t(7,B=De.id),"source"in De&&t(8,O=De.source),"sourceLayer"in De&&t(9,G=De.sourceLayer),"beforeId"in De&&t(10,U=De.beforeId),"beforeLayerType"in De&&t(11,K=De.beforeLayerType),"type"in De&&t(12,me=De.type),"paint"in De&&t(13,X=De.paint),"layout"in De&&t(14,Y=De.layout),"filter"in De&&t(15,_e=De.filter),"applyToClusters"in De&&t(16,ze=De.applyToClusters),"minzoom"in De&&t(17,re=De.minzoom),"maxzoom"in De&&t(18,ce=De.maxzoom),"manageHoverState"in De&&t(19,Ze=De.manageHoverState),"hovered"in De&&t(6,Me=De.hovered),"interactive"in De&&t(20,ft=De.interactive),"hoverCursor"in De&&t(21,Ct=De.hoverCursor),"eventsIfTopMost"in De&&t(22,Ot=De.eventsIfTopMost),"$$scope"in De&&t(35,z=De.$$scope)},r.$$.update=()=>{if(r.$$.dirty[0]&65536&&t(30,n=vk(ze)),r.$$.dirty[0]&1073774592&&t(24,l=yk("all",n,_e)),r.$$.dirty[0]&131072|r.$$.dirty[1]&8&&t(26,u=re??D),r.$$.dirty[0]&262144|r.$$.dirty[1]&4&&t(25,d=ce??P),r.$$.dirty[0]&256|r.$$.dirty[1]&2&&t(29,a=O||C),r.$$.dirty[0]&654343809|r.$$.dirty[1]&1&&k&&S!==B&&a){S&&(Lt(S),er.delete(S));let De=U;if(!U&&K){let at=k.getStyle().layers,tt=typeof K=="function"?K:ne=>ne.type===K,it=at==null?void 0:at.find(tt);it&&(De=it.id)}Rt(At,S=B,S),k.addLayer(rl({id:S,type:me,source:a,"source-layer":G,filter:l,paint:X,layout:Y,minzoom:u,maxzoom:d}),De),t(23,st=!0),k.on("click",S,nr),k.on("dblclick",S,nr),k.on("contextmenu",S,nr),k.on("mouseenter",S,tr),k.on("mousemove",S,Lr),k.on("mouseleave",S,Pr)}r.$$.dirty[0]&1048577&&S&&er.set(S,{interactive:ft}),r.$$.dirty[0]&1|r.$$.dirty[1]&1&&t(28,_=S?$y((De,at)=>{k!=null&&k.style._loaded?k.setPaintProperty(S,De,at):k==null||k.once("styledata",()=>k==null?void 0:k.setPaintProperty(S,De,at))}):void 0),r.$$.dirty[0]&1|r.$$.dirty[1]&1&&t(27,x=S?$y((De,at)=>{k!=null&&k.style._loaded?k.setLayoutProperty(S,De,at):k==null||k.once("styledata",()=>k==null?void 0:k.setLayoutProperty(S,De,at))}):void 0),r.$$.dirty[0]&268443648&&(_==null||_(X)),r.$$.dirty[0]&134234112&&(x==null||x(Y)),r.$$.dirty[0]&100663297|r.$$.dirty[1]&1&&S&&(k==null||k.setLayerZoomRange(S,u,d)),r.$$.dirty[0]&25165825|r.$$.dirty[1]&1&&S&&(st?t(23,st=!1):k==null||k.setFilter(S,l))},[S,Kt,vt,At,Vt,sr,Me,B,O,G,U,K,me,X,Y,_e,ze,re,ce,Ze,ft,Ct,Ot,st,l,d,u,x,_,a,n,k,C,P,D,z,N]}let Bd=class extends Ht{constructor(e){super(),Zt(this,e,xk,wk,Ut,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}};function Sk(r){let e;const t=r[16].default,n=Vr(t,r,r[24],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&16777216)&&Gr(n,t,l,l[24],e?qr(t,l[24],u,null):Wr(l[24]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function kk(r){let e,t,n;function l(d){r[17](d)}let u={id:r[1],type:"circle",source:r[2],sourceLayer:r[3],beforeId:r[4],beforeLayerType:r[5],paint:r[6],layout:r[7],filter:r[8],applyToClusters:r[9],minzoom:r[10],maxzoom:r[11],hoverCursor:r[12],manageHoverState:r[13],eventsIfTopMost:r[14],interactive:r[15],$$slots:{default:[Sk]},$$scope:{ctx:r}};return r[0]!==void 0&&(u.hovered=r[0]),e=new Bd({props:u}),pn.push(()=>zo(e,"hovered",l)),e.$on("click",r[18]),e.$on("dblclick",r[19]),e.$on("contextmenu",r[20]),e.$on("mouseenter",r[21]),e.$on("mousemove",r[22]),e.$on("mouseleave",r[23]),{c(){je(e.$$.fragment)},m(d,a){Oe(e,d,a),n=!0},p(d,[a]){const _={};a&2&&(_.id=d[1]),a&4&&(_.source=d[2]),a&8&&(_.sourceLayer=d[3]),a&16&&(_.beforeId=d[4]),a&32&&(_.beforeLayerType=d[5]),a&64&&(_.paint=d[6]),a&128&&(_.layout=d[7]),a&256&&(_.filter=d[8]),a&512&&(_.applyToClusters=d[9]),a&1024&&(_.minzoom=d[10]),a&2048&&(_.maxzoom=d[11]),a&4096&&(_.hoverCursor=d[12]),a&8192&&(_.manageHoverState=d[13]),a&16384&&(_.eventsIfTopMost=d[14]),a&32768&&(_.interactive=d[15]),a&16777216&&(_.$$scope={dirty:a,ctx:d}),!t&&a&1&&(t=!0,_.hovered=d[0],Po(()=>t=!1)),e.$set(_)},i(d){n||(oe(e.$$.fragment,d),n=!0)},o(d){de(e.$$.fragment,d),n=!1},d(d){Ne(e,d)}}}function Tk(r,e,t){let{$$slots:n={},$$scope:l}=e,{id:u=Dc("circle")}=e,{source:d=void 0}=e,{sourceLayer:a=void 0}=e,{beforeId:_=void 0}=e,{beforeLayerType:x=void 0}=e,{paint:S}=e,{layout:k=void 0}=e,{filter:C=void 0}=e,{applyToClusters:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:N=void 0}=e,{hoverCursor:z=void 0}=e,{manageHoverState:B=!1}=e,{hovered:O=null}=e,{eventsIfTopMost:G=!1}=e,{interactive:U=!0}=e;function K(ce){O=ce,t(0,O)}function me(ce){ur.call(this,r,ce)}function X(ce){ur.call(this,r,ce)}function Y(ce){ur.call(this,r,ce)}function _e(ce){ur.call(this,r,ce)}function ze(ce){ur.call(this,r,ce)}function re(ce){ur.call(this,r,ce)}return r.$$set=ce=>{"id"in ce&&t(1,u=ce.id),"source"in ce&&t(2,d=ce.source),"sourceLayer"in ce&&t(3,a=ce.sourceLayer),"beforeId"in ce&&t(4,_=ce.beforeId),"beforeLayerType"in ce&&t(5,x=ce.beforeLayerType),"paint"in ce&&t(6,S=ce.paint),"layout"in ce&&t(7,k=ce.layout),"filter"in ce&&t(8,C=ce.filter),"applyToClusters"in ce&&t(9,P=ce.applyToClusters),"minzoom"in ce&&t(10,D=ce.minzoom),"maxzoom"in ce&&t(11,N=ce.maxzoom),"hoverCursor"in ce&&t(12,z=ce.hoverCursor),"manageHoverState"in ce&&t(13,B=ce.manageHoverState),"hovered"in ce&&t(0,O=ce.hovered),"eventsIfTopMost"in ce&&t(14,G=ce.eventsIfTopMost),"interactive"in ce&&t(15,U=ce.interactive),"$$scope"in ce&&t(24,l=ce.$$scope)},[O,u,d,a,_,x,S,k,C,P,D,N,z,B,G,U,n,K,me,X,Y,_e,ze,re,l]}let Lg=class extends Ht{constructor(e){super(),Zt(this,e,Tk,kk,Ut,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}};function Ek(r){let e;const t=r[15].default,n=Vr(t,r,r[23],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&8388608)&&Gr(n,t,l,l[23],e?qr(t,l[23],u,null):Wr(l[23]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function Mk(r){let e,t,n;function l(d){r[16](d)}let u={id:r[1],type:"fill",source:r[2],sourceLayer:r[3],beforeId:r[4],beforeLayerType:r[5],paint:r[6],layout:r[7],filter:r[8],minzoom:r[9],maxzoom:r[10],hoverCursor:r[11],manageHoverState:r[12],eventsIfTopMost:r[13],interactive:r[14],$$slots:{default:[Ek]},$$scope:{ctx:r}};return r[0]!==void 0&&(u.hovered=r[0]),e=new Bd({props:u}),pn.push(()=>zo(e,"hovered",l)),e.$on("click",r[17]),e.$on("dblclick",r[18]),e.$on("contextmenu",r[19]),e.$on("mouseenter",r[20]),e.$on("mousemove",r[21]),e.$on("mouseleave",r[22]),{c(){je(e.$$.fragment)},m(d,a){Oe(e,d,a),n=!0},p(d,[a]){const _={};a&2&&(_.id=d[1]),a&4&&(_.source=d[2]),a&8&&(_.sourceLayer=d[3]),a&16&&(_.beforeId=d[4]),a&32&&(_.beforeLayerType=d[5]),a&64&&(_.paint=d[6]),a&128&&(_.layout=d[7]),a&256&&(_.filter=d[8]),a&512&&(_.minzoom=d[9]),a&1024&&(_.maxzoom=d[10]),a&2048&&(_.hoverCursor=d[11]),a&4096&&(_.manageHoverState=d[12]),a&8192&&(_.eventsIfTopMost=d[13]),a&16384&&(_.interactive=d[14]),a&8388608&&(_.$$scope={dirty:a,ctx:d}),!t&&a&1&&(t=!0,_.hovered=d[0],Po(()=>t=!1)),e.$set(_)},i(d){n||(oe(e.$$.fragment,d),n=!0)},o(d){de(e.$$.fragment,d),n=!1},d(d){Ne(e,d)}}}function Ck(r,e,t){let{$$slots:n={},$$scope:l}=e,{id:u=Dc("fill")}=e,{source:d=void 0}=e,{sourceLayer:a=void 0}=e,{beforeId:_=void 0}=e,{beforeLayerType:x=void 0}=e,{paint:S}=e,{layout:k=void 0}=e,{filter:C=void 0}=e,{minzoom:P=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:N=void 0}=e,{manageHoverState:z=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:O=!1}=e,{interactive:G=!0}=e;function U(re){B=re,t(0,B)}function K(re){ur.call(this,r,re)}function me(re){ur.call(this,r,re)}function X(re){ur.call(this,r,re)}function Y(re){ur.call(this,r,re)}function _e(re){ur.call(this,r,re)}function ze(re){ur.call(this,r,re)}return r.$$set=re=>{"id"in re&&t(1,u=re.id),"source"in re&&t(2,d=re.source),"sourceLayer"in re&&t(3,a=re.sourceLayer),"beforeId"in re&&t(4,_=re.beforeId),"beforeLayerType"in re&&t(5,x=re.beforeLayerType),"paint"in re&&t(6,S=re.paint),"layout"in re&&t(7,k=re.layout),"filter"in re&&t(8,C=re.filter),"minzoom"in re&&t(9,P=re.minzoom),"maxzoom"in re&&t(10,D=re.maxzoom),"hoverCursor"in re&&t(11,N=re.hoverCursor),"manageHoverState"in re&&t(12,z=re.manageHoverState),"hovered"in re&&t(0,B=re.hovered),"eventsIfTopMost"in re&&t(13,O=re.eventsIfTopMost),"interactive"in re&&t(14,G=re.interactive),"$$scope"in re&&t(23,l=re.$$scope)},[B,u,d,a,_,x,S,k,C,P,D,N,z,O,G,n,U,K,me,X,Y,_e,ze,l]}let ma=class extends Ht{constructor(e){super(),Zt(this,e,Ck,Mk,Ut,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}};function Ik(r,e,t){let n;const{map:l}=nl();wt(r,l,_=>t(4,n=_));let{position:u="top-left"}=e,{container:d=void 0}=e,a=null;return ti(()=>{n!=null&&n.loaded()&&a&&n.removeControl(a)}),r.$$set=_=>{"position"in _&&t(1,u=_.position),"container"in _&&t(2,d=_.container)},r.$$.update=()=>{if(r.$$.dirty&30&&n&&!a){let _;typeof d=="string"?_=document.querySelector(d)??void 0:_=d,t(3,a=new to.FullscreenControl({container:_})),n.addControl(a,u)}},[l,u,d,a,n]}class Ak extends Ht{constructor(e){super(),Zt(this,e,Ik,null,Ut,{position:1,container:2})}}function Lk(r,e,t,n,l){let u=!1;r.getSource(e)&&(u=!0,r.removeSource(e));const d=()=>{n(e)&&(r.addSource(e,t),l())};if(u){const a=()=>{e&&(r.getSource(e)?setTimeout(a,1):d())};a()}else d()}function Pk(r,e,t){Lb().then(()=>{let n=Hi(r);if(!n)return;n.getSource(e)===t&&n.removeSource(e)})}function Jy(r){let e=r[0],t,n,l=Yy(r);return{c(){l.c(),t=$n()},m(u,d){l.m(u,d),be(u,t,d),n=!0},p(u,d){d&1&&Ut(e,e=u[0])?(yr(),de(l,1,1,Mt),vr(),l=Yy(u),l.c(),oe(l,1),l.m(t.parentNode,t)):l.p(u,d)},i(u){n||(oe(l),n=!0)},o(u){de(l),n=!1},d(u){u&&ve(t),l.d(u)}}}function Yy(r){let e;const t=r[19].default,n=Vr(t,r,r[18],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&262144)&&Gr(n,t,l,l[18],e?qr(t,l[18],u,null):Wr(l[18]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function zk(r){let e,t,n=r[0]&&Jy(r);return{c(){n&&n.c(),e=$n()},m(l,u){n&&n.m(l,u),be(l,e,u),t=!0},p(l,[u]){l[0]?n?(n.p(l,u),u&1&&oe(n,1)):(n=Jy(l),n.c(),oe(n,1),n.m(e.parentNode,e)):n&&(yr(),de(n,1,1,()=>{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function Dk(r,e,t){let n,l,u,{$$slots:d={},$$scope:a}=e,{id:_=Dc("geojson")}=e,{data:x}=e,{generateId:S=!1}=e,{promoteId:k=void 0}=e,{filter:C=void 0}=e,{lineMetrics:P=void 0}=e,{cluster:D=void 0}=e,{maxzoom:N=void 0}=e,{attribution:z=void 0}=e,{buffer:B=void 0}=e,{tolerance:O=void 0}=e;const{map:G,cluster:U,self:K}=dk();wt(r,G,Y=>t(17,l=Y)),wt(r,U,Y=>t(20,u=Y)),wt(r,K,Y=>t(0,n=Y));let me,X=!0;return ti(()=>{n&&me&&l&&(Pk(G,n,me),Rt(K,n=null,n),t(15,me=void 0))}),r.$$set=Y=>{"id"in Y&&t(4,_=Y.id),"data"in Y&&t(5,x=Y.data),"generateId"in Y&&t(6,S=Y.generateId),"promoteId"in Y&&t(7,k=Y.promoteId),"filter"in Y&&t(8,C=Y.filter),"lineMetrics"in Y&&t(9,P=Y.lineMetrics),"cluster"in Y&&t(10,D=Y.cluster),"maxzoom"in Y&&t(11,N=Y.maxzoom),"attribution"in Y&&t(12,z=Y.attribution),"buffer"in Y&&t(13,B=Y.buffer),"tolerance"in Y&&t(14,O=Y.tolerance),"$$scope"in Y&&t(18,a=Y.$$scope)},r.$$.update=()=>{r.$$.dirty&1024&&Rt(U,u=D,u),r.$$.dirty&196593&&l&&n!==_&&(Rt(K,n=_,n),Lk(l,n,rl({type:"geojson",data:x,filter:C,lineMetrics:P,generateId:S,promoteId:k,cluster:!!D,clusterMinPoints:D==null?void 0:D.minPoints,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius,clusterProperties:D==null?void 0:D.properties,maxzoom:N,attribution:z,buffer:B,tolerance:O}),Y=>l&&Y===n,()=>{n&&(t(15,me=l==null?void 0:l.getSource(n)),t(16,X=!0))})),r.$$.dirty&131088&&(l==null||l.on("style.load",()=>{t(15,me=l==null?void 0:l.getSource(_))})),r.$$.dirty&98336&&me&&(X?t(16,X=!1):me.setData(x)),r.$$.dirty&33792&&(me==null||me.setClusterOptions(rl({cluster:!!D,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius})))},[n,G,U,K,_,x,S,k,C,P,D,N,z,B,O,me,X,l,a,d]}let Pi=class extends Ht{constructor(e){super(),Zt(this,e,Dk,zk,Ut,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}};function Rk(r,e,t){let n;const{map:l}=nl();wt(r,l,C=>t(8,n=C));let{position:u="top-left"}=e,{positionOptions:d=void 0}=e,{fitBoundsOptions:a=void 0}=e,{trackUserLocation:_=!1}=e,{showAccuracyCircle:x=!0}=e,{showUserLocation:S=!0}=e,{control:k=null}=e;return ti(()=>{n!=null&&n.loaded()&&k&&n.removeControl(k)}),r.$$set=C=>{"position"in C&&t(2,u=C.position),"positionOptions"in C&&t(3,d=C.positionOptions),"fitBoundsOptions"in C&&t(4,a=C.fitBoundsOptions),"trackUserLocation"in C&&t(5,_=C.trackUserLocation),"showAccuracyCircle"in C&&t(6,x=C.showAccuracyCircle),"showUserLocation"in C&&t(7,S=C.showUserLocation),"control"in C&&t(1,k=C.control)},r.$$.update=()=>{r.$$.dirty&510&&n&&!k&&(t(1,k=new to.GeolocateControl({positionOptions:d,fitBoundsOptions:a,trackUserLocation:_,showAccuracyCircle:x,showUserLocation:S})),n.addControl(k,u))},[l,k,u,d,a,_,x,S,n]}class Bk extends Ht{constructor(e){super(),Zt(this,e,Rk,null,Ut,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function Fk(r){let e;const t=r[15].default,n=Vr(t,r,r[23],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&8388608)&&Gr(n,t,l,l[23],e?qr(t,l[23],u,null):Wr(l[23]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function Ok(r){let e,t,n;function l(d){r[16](d)}let u={id:r[1],type:"line",source:r[2],sourceLayer:r[3],beforeId:r[4],beforeLayerType:r[5],paint:r[6],layout:r[7],filter:r[8],minzoom:r[9],maxzoom:r[10],hoverCursor:r[11],manageHoverState:r[12],eventsIfTopMost:r[13],interactive:r[14],$$slots:{default:[Fk]},$$scope:{ctx:r}};return r[0]!==void 0&&(u.hovered=r[0]),e=new Bd({props:u}),pn.push(()=>zo(e,"hovered",l)),e.$on("click",r[17]),e.$on("dblclick",r[18]),e.$on("contextmenu",r[19]),e.$on("mouseenter",r[20]),e.$on("mousemove",r[21]),e.$on("mouseleave",r[22]),{c(){je(e.$$.fragment)},m(d,a){Oe(e,d,a),n=!0},p(d,[a]){const _={};a&2&&(_.id=d[1]),a&4&&(_.source=d[2]),a&8&&(_.sourceLayer=d[3]),a&16&&(_.beforeId=d[4]),a&32&&(_.beforeLayerType=d[5]),a&64&&(_.paint=d[6]),a&128&&(_.layout=d[7]),a&256&&(_.filter=d[8]),a&512&&(_.minzoom=d[9]),a&1024&&(_.maxzoom=d[10]),a&2048&&(_.hoverCursor=d[11]),a&4096&&(_.manageHoverState=d[12]),a&8192&&(_.eventsIfTopMost=d[13]),a&16384&&(_.interactive=d[14]),a&8388608&&(_.$$scope={dirty:a,ctx:d}),!t&&a&1&&(t=!0,_.hovered=d[0],Po(()=>t=!1)),e.$set(_)},i(d){n||(oe(e.$$.fragment,d),n=!0)},o(d){de(e.$$.fragment,d),n=!1},d(d){Ne(e,d)}}}function Nk(r,e,t){let{$$slots:n={},$$scope:l}=e,{id:u=Dc("line")}=e,{source:d=void 0}=e,{sourceLayer:a=void 0}=e,{beforeId:_=void 0}=e,{beforeLayerType:x=void 0}=e,{paint:S}=e,{layout:k=void 0}=e,{filter:C=void 0}=e,{minzoom:P=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:N=void 0}=e,{manageHoverState:z=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:O=!1}=e,{interactive:G=!0}=e;function U(re){B=re,t(0,B)}function K(re){ur.call(this,r,re)}function me(re){ur.call(this,r,re)}function X(re){ur.call(this,r,re)}function Y(re){ur.call(this,r,re)}function _e(re){ur.call(this,r,re)}function ze(re){ur.call(this,r,re)}return r.$$set=re=>{"id"in re&&t(1,u=re.id),"source"in re&&t(2,d=re.source),"sourceLayer"in re&&t(3,a=re.sourceLayer),"beforeId"in re&&t(4,_=re.beforeId),"beforeLayerType"in re&&t(5,x=re.beforeLayerType),"paint"in re&&t(6,S=re.paint),"layout"in re&&t(7,k=re.layout),"filter"in re&&t(8,C=re.filter),"minzoom"in re&&t(9,P=re.minzoom),"maxzoom"in re&&t(10,D=re.maxzoom),"hoverCursor"in re&&t(11,N=re.hoverCursor),"manageHoverState"in re&&t(12,z=re.manageHoverState),"hovered"in re&&t(0,B=re.hovered),"eventsIfTopMost"in re&&t(13,O=re.eventsIfTopMost),"interactive"in re&&t(14,G=re.interactive),"$$scope"in re&&t(23,l=re.$$scope)},[B,u,d,a,_,x,S,k,C,P,D,N,z,O,G,n,U,K,me,X,Y,_e,ze,l]}let cs=class extends Ht{constructor(e){super(),Zt(this,e,Nk,Ok,Ut,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}};function jk(r,e,t){let n;const l=us();let{layer:u=void 0}=e;const{map:d}=nl();wt(r,d,S=>t(2,n=S));function a(S){l(S.type,{...S,map:d})}const _=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],x=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return ti(()=>{if(n)if(u)for(const S of _)n.off(S,u,a);else for(const S of x)n.off(S,a)}),r.$$set=S=>{"layer"in S&&t(1,u=S.layer)},r.$$.update=()=>{if(r.$$.dirty&6&&n)if(u)for(const S of _)n.on(S,u,a);else for(const S of x)n.on(S,a)},[d,u,n]}class Uk extends Ht{constructor(e){super(),Zt(this,e,jk,null,Ut,{layer:1})}}function Vk(r){let e=r.getCenter(),t=Math.round(r.getZoom()*100)/100,n=Math.ceil((t*Math.LN2+Math.log(512/360/.5))/Math.LN10),l=Math.pow(10,n),u=Math.round(e.lat*l)/l,d=Math.round(e.lng*l)/l,a=`${t}/${u}/${d}`,_=r.getBearing(),x=r.getPitch();return(_||x)&&(a+=`/${Math.round(_*10)/10}`),x&&(a+=`/${Math.round(x)}`),`#${a}`}function qk(r){return r.replace("#","").split("/").map(parseFloat)}var sc=Pg;function Pg(r,e){return r===e||r!==r&&e!==e?!0:typeof r!=typeof e||{}.toString.call(r)!={}.toString.call(e)||r!==Object(r)||!r?!1:Array.isArray(r)?Qy(r,e):{}.toString.call(r)=="[object Set]"?Qy(Array.from(r),Array.from(e)):{}.toString.call(r)=="[object Object]"?Wk(r,e):Gk(r,e)}function Gk(r,e){return r.toString()===e.toString()}function Qy(r,e){var t=r.length;if(t!=e.length)return!1;for(var n=0;nt(6,n=S));let{position:u="top-left"}=e,{showCompass:d=!0}=e,{showZoom:a=!0}=e,{visualizePitch:_=!1}=e,x=null;return ti(()=>{n!=null&&n.loaded()&&x&&n.removeControl(x)}),r.$$set=S=>{"position"in S&&t(1,u=S.position),"showCompass"in S&&t(2,d=S.showCompass),"showZoom"in S&&t(3,a=S.showZoom),"visualizePitch"in S&&t(4,_=S.visualizePitch)},r.$$.update=()=>{r.$$.dirty&126&&n&&!x&&(t(5,x=new to.NavigationControl({showCompass:d,showZoom:a,visualizePitch:_})),n.addControl(x,u))},[l,u,d,a,_,x,n]}class Hk extends Ht{constructor(e){super(),Zt(this,e,Zk,null,Ut,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function $k(r,e,t){let n;const{map:l}=nl();wt(r,l,x=>t(5,n=x));let{position:u="bottom-left"}=e,{maxWidth:d=void 0}=e,{unit:a="metric"}=e,_=null;return ti(()=>{n!=null&&n.loaded()&&_&&n.removeControl(_)}),r.$$set=x=>{"position"in x&&t(1,u=x.position),"maxWidth"in x&&t(2,d=x.maxWidth),"unit"in x&&t(3,a=x.unit)},r.$$.update=()=>{r.$$.dirty&62&&n&&!_&&(t(4,_=new to.ScaleControl({maxWidth:d,unit:a})),n.addControl(_,u))},[l,u,d,a,_,n]}class Xk extends Ht{constructor(e){super(),Zt(this,e,$k,null,Ut,{position:1,maxWidth:2,unit:3})}}const{window:Kk}=Ad,Jk=r=>({map:r[0]&16,loadedImages:r[0]&32,allImagesLoaded:r[0]&64}),e0=r=>({map:r[4],loadedImages:r[5],allImagesLoaded:r[6]});function t0(r){let e,t,n=r[3]&&r0(r);const l=r[46].default,u=Vr(l,r,r[45],e0);return{c(){n&&n.c(),e=Ve(),u&&u.c()},m(d,a){n&&n.m(d,a),be(d,e,a),u&&u.m(d,a),t=!0},p(d,a){d[3]?n?(n.p(d,a),a[0]&8&&oe(n,1)):(n=r0(d),n.c(),oe(n,1),n.m(e.parentNode,e)):n&&(yr(),de(n,1,1,()=>{n=null}),vr()),u&&u.p&&(!t||a[0]&112|a[1]&16384)&&Gr(u,l,d,d[45],t?qr(l,d[45],a,Jk):Wr(d[45]),e0)},i(d){t||(oe(n),oe(u,d),t=!0)},o(d){de(n),de(u,d),t=!1},d(d){d&&ve(e),n&&n.d(d),u&&u.d(d)}}}function r0(r){let e,t,n,l,u,d,a,_;return e=new Hk({props:{position:r[7]}}),n=new Bk({props:{position:r[7],fitBoundsOptions:{maxZoom:12}}}),u=new Ak({props:{position:r[7]}}),a=new Xk({props:{position:r[7]}}),{c(){je(e.$$.fragment),t=Ve(),je(n.$$.fragment),l=Ve(),je(u.$$.fragment),d=Ve(),je(a.$$.fragment)},m(x,S){Oe(e,x,S),be(x,t,S),Oe(n,x,S),be(x,l,S),Oe(u,x,S),be(x,d,S),Oe(a,x,S),_=!0},p(x,S){const k={};S[0]&128&&(k.position=x[7]),e.$set(k);const C={};S[0]&128&&(C.position=x[7]),n.$set(C);const P={};S[0]&128&&(P.position=x[7]),u.$set(P);const D={};S[0]&128&&(D.position=x[7]),a.$set(D)},i(x){_||(oe(e.$$.fragment,x),oe(n.$$.fragment,x),oe(u.$$.fragment,x),oe(a.$$.fragment,x),_=!0)},o(x){de(e.$$.fragment,x),de(n.$$.fragment,x),de(u.$$.fragment,x),de(a.$$.fragment,x),_=!1},d(x){x&&(ve(t),ve(l),ve(d)),Ne(e,x),Ne(n,x),Ne(u,x),Ne(a,x)}}}function Yk(r){let e,t,n,l,u,d=r[4]&&r[0]&&t0(r);return{c(){e=fe("div"),d&&d.c(),Ee(e,"class",t=od(r[2])+" svelte-p00lfq"),Ee(e,"data-testid","map-container"),hi(e,"expand-map",!r[2])},m(a,_){be(a,e,_),d&&d.m(e,null),r[47](e),n=!0,l||(u=[Tt(Kk,"hashchange",r[11]),Mm(r[10].call(null,e))],l=!0)},p(a,_){a[4]&&a[0]?d?(d.p(a,_),_[0]&17&&oe(d,1)):(d=t0(a),d.c(),oe(d,1),d.m(e,null)):d&&(yr(),de(d,1,1,()=>{d=null}),vr()),(!n||_[0]&4&&t!==(t=od(a[2])+" svelte-p00lfq"))&&Ee(e,"class",t),(!n||_[0]&4)&&hi(e,"expand-map",!a[2])},i(a){n||(oe(d),n=!0)},o(a){de(d),n=!1},d(a){a&&ve(e),d&&d.d(),r[47](null),l=!1,_n(u)}}}function Qk(r,e,t){let n,l,u,d,{$$slots:a={},$$scope:_}=e,{map:x=null}=e,{mapContainer:S=void 0}=e,{class:k=void 0}=e,{style:C}=e,{diffStyleUpdates:P=!1}=e,{center:D=void 0}=e,{zoom:N=void 0}=e,{pitch:z=0}=e,{bearing:B=0}=e,{bounds:O=void 0}=e,{hash:G=!1}=e,{updateHash:U=We=>{window.history.replaceState(window.history.state,"",We)}}=e,{loaded:K=!1}=e,{minZoom:me=0}=e,{maxZoom:X=22}=e,{minPitch:Y=0}=e,{maxPitch:_e=60}=e,{renderWorldCopies:ze=void 0}=e,{dragPan:re=void 0}=e,{dragRotate:ce=void 0}=e,{pitchWithRotate:Ze=void 0}=e,{antialias:Me=void 0}=e,{zoomOnDoubleClick:ft=!0}=e,{locale:Ct=void 0}=e,{interactive:Ot=!0}=e,{attributionControl:Ke=!0}=e,{cooperativeGestures:Kt=!1}=e,{preserveDrawingBuffer:vt=!1}=e,{maxBounds:At=void 0}=e,{images:Vt=[]}=e,{standardControls:sr=!1}=e,{filterLayers:fr=void 0}=e,{transformRequest:er=void 0}=e;const Nt=us(),{map:nr,loadedImages:tr}=fk();wt(r,nr,We=>t(4,u=We)),wt(r,tr,We=>t(5,d=We));let Lr=new Set;async function Pr(We,Ye=!1){if(u&&!(!u.loaded()&&!Ye))if("url"in We){Lr.add(We.id);try{let jt=await u.loadImage(We.url);u==null||u.addImage(We.id,jt.data,We.options),d.add(We.id),tr.set(d)}catch(jt){Nt("error",jt)}finally{Lr.delete(We.id)}}else u.addImage(We.id,We.data,We.options),d.add(We.id),tr.set(d)}let st,Lt,De,at;function tt(We){return ne(),Rt(nr,u=new to.Map(rl({container:We,style:C,locale:Ct,center:D,zoom:N,pitch:z,bearing:B,minZoom:me,maxZoom:X,minPitch:Y,maxPitch:_e,renderWorldCopies:ze,dragPan:re,dragRotate:ce,pitchWithRotate:Ze,antialias:Me,interactive:Ot,preserveDrawingBuffer:vt,maxBounds:At,bounds:O,attributionControl:Ke,transformRequest:er,cooperativeGestures:Kt})),u),u.on("load",Ye=>{Ye.target.getContainer().setAttribute("data-testid","map"),Ye.target.getCanvas().setAttribute("data-testid","map-canvas"),t(0,K=!0),Nt("load",u)}),u.on("error",Ye=>Nt("error",{...Ye,map:u})),u.on("movestart",Ye=>Nt("movestart",{...Ye,map:u})),u.on("moveend",Ye=>{if(t(12,D=Ye.target.getCenter()),t(13,N=Ye.target.getZoom()),t(14,z=Ye.target.getPitch()),t(15,B=Ye.target.getBearing()),t(16,O=Ye.target.getBounds()),Nt("moveend",{...Ye,map:u}),G){let jt=new URL(window.location.href.replace(/(#.+)?$/,Vk(u)));U(jt)}}),u.on("click",Ye=>Nt("click",{...Ye,map:u})),u.on("dblclick",Ye=>Nt("dblclick",{...Ye,map:u})),u.on("contextmenu",Ye=>Nt("contextmenu",{...Ye,map:u})),u.on("zoomstart",Ye=>Nt("zoomstart",{...Ye,map:u})),u.on("zoom",Ye=>{Nt("zoom",{...Ye,map:u})}),u.on("zoomend",Ye=>{Nt("zoomend",{...Ye,map:u})}),u.on("style.load",()=>{if(u){const Ye=u.getStyle();if(t(42,st=Ye.layers.map(jt=>jt.id)),t(43,Lt=Object.keys(Ye.sources)),at)for(const[jt,bn]of Object.entries(at))u.addSource(jt,bn);if(De)for(const jt of De)u.addLayer(jt);for(const jt of Vt)Pr(jt,!0)}}),u.on("styledata",Ye=>{if(u&&fr){const jt=u.getStyle().layers;if(jt)for(let bn of jt)fr(bn)||u.setLayoutProperty(bn.id,"visibility","none")}Nt("styledata",{...Ye,map:u})}),{destroy(){t(0,K=!1),u==null||u.remove(),Rt(nr,u=null,u)}}}let it=C;function ne(){if(G){let We=qk(window.location.hash);We.length>=3&&(t(13,N=We[0]),t(12,D=[We[2],We[1]])),We.length==5&&(t(15,B=We[3]),t(14,z=We[4]))}}function br(We){pn[We?"unshift":"push"](()=>{S=We,t(1,S)})}return r.$$set=We=>{"map"in We&&t(17,x=We.map),"mapContainer"in We&&t(1,S=We.mapContainer),"class"in We&&t(2,k=We.class),"style"in We&&t(18,C=We.style),"diffStyleUpdates"in We&&t(19,P=We.diffStyleUpdates),"center"in We&&t(12,D=We.center),"zoom"in We&&t(13,N=We.zoom),"pitch"in We&&t(14,z=We.pitch),"bearing"in We&&t(15,B=We.bearing),"bounds"in We&&t(16,O=We.bounds),"hash"in We&&t(20,G=We.hash),"updateHash"in We&&t(21,U=We.updateHash),"loaded"in We&&t(0,K=We.loaded),"minZoom"in We&&t(22,me=We.minZoom),"maxZoom"in We&&t(23,X=We.maxZoom),"minPitch"in We&&t(24,Y=We.minPitch),"maxPitch"in We&&t(25,_e=We.maxPitch),"renderWorldCopies"in We&&t(26,ze=We.renderWorldCopies),"dragPan"in We&&t(27,re=We.dragPan),"dragRotate"in We&&t(28,ce=We.dragRotate),"pitchWithRotate"in We&&t(29,Ze=We.pitchWithRotate),"antialias"in We&&t(30,Me=We.antialias),"zoomOnDoubleClick"in We&&t(31,ft=We.zoomOnDoubleClick),"locale"in We&&t(32,Ct=We.locale),"interactive"in We&&t(33,Ot=We.interactive),"attributionControl"in We&&t(34,Ke=We.attributionControl),"cooperativeGestures"in We&&t(35,Kt=We.cooperativeGestures),"preserveDrawingBuffer"in We&&t(36,vt=We.preserveDrawingBuffer),"maxBounds"in We&&t(37,At=We.maxBounds),"images"in We&&t(38,Vt=We.images),"standardControls"in We&&t(3,sr=We.standardControls),"filterLayers"in We&&t(39,fr=We.filterLayers),"transformRequest"in We&&t(40,er=We.transformRequest),"$$scope"in We&&t(45,_=We.$$scope)},r.$$.update=()=>{if(r.$$.dirty[0]&8&&t(7,n=typeof sr=="boolean"?void 0:sr),r.$$.dirty[0]&16&&t(17,x=u),r.$$.dirty[0]&786448|r.$$.dirty[1]&14336&&u&&!sc(C,it)){const We=u.getStyle();if(st&&(De=We.layers.filter(Ye=>!st.includes(Ye.id))),Lt){const Ye=Object.keys(We.sources).filter(jt=>!Lt.includes(jt));at={};for(const jt of Ye)at[jt]=We.sources[jt]}t(44,it=C),u.setStyle(C,{diff:P}),Rt(tr,d=new Set,d),t(41,Lr=new Set)}if(r.$$.dirty[0]&49|r.$$.dirty[1]&1152&&K&&u!=null&&u.loaded())for(let We of Vt)!d.has(We.id)&&!Lr.has(We.id)&&!u.hasImage(We.id)&&Pr(We);if(r.$$.dirty[0]&32|r.$$.dirty[1]&128&&t(6,l=Vt.every(We=>d.has(We.id))),r.$$.dirty[0]&61456&&u){let We={};D!=null&&!sc(D,u==null?void 0:u.getCenter())&&(We.center=D),N!=null&&!sc(N,u==null?void 0:u.getZoom())&&(We.zoom=N),B!=null&&!sc(B,u==null?void 0:u.getBearing())&&(We.bearing=B),z!=null&&!sc(z,u==null?void 0:u.getPitch())&&(We.pitch=z),Object.keys(We).length&&u.easeTo(We)}r.$$.dirty[0]&65552&&O&&!sc(O,u==null?void 0:u.getBounds())&&(u==null||u.fitBounds(O)),r.$$.dirty[0]&16|r.$$.dirty[1]&1&&(ft?u==null||u.doubleClickZoom.enable():u==null||u.doubleClickZoom.disable())},[K,S,k,sr,u,d,l,n,nr,tr,tt,ne,D,N,z,B,O,x,C,P,G,U,me,X,Y,_e,ze,re,ce,Ze,Me,ft,Ct,Ot,Ke,Kt,vt,At,Vt,fr,er,Lr,st,Lt,it,_,a,br]}class e3 extends Ht{constructor(e){super(),Zt(this,e,Qk,Yk,Ut,{map:17,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:14,bearing:15,bounds:16,hash:20,updateHash:21,loaded:0,minZoom:22,maxZoom:23,minPitch:24,maxPitch:25,renderWorldCopies:26,dragPan:27,dragRotate:28,pitchWithRotate:29,antialias:30,zoomOnDoubleClick:31,locale:32,interactive:33,attributionControl:34,cooperativeGestures:35,preserveDrawingBuffer:36,maxBounds:37,images:38,standardControls:3,filterLayers:39,transformRequest:40},null,[-1,-1])}}const t3=r=>({marker:r&8}),n0=r=>({marker:r[3]});function r3(r){let e,t,n,l,u,d,a;const _=r[19].default,x=Vr(_,r,r[18],n0);return{c(){e=fe("div"),x&&x.c(),Ee(e,"tabindex",t=r[1]?0:void 0),Ee(e,"role",n=r[1]?"button":void 0),fn(e,"z-index",r[2])},m(S,k){be(S,e,k),x&&x.m(e,null),u=!0,d||(a=[Mm(r[7].call(null,e)),Mm(l=n3.call(null,e,r[0])),Tt(e,"click",Kp(r[20])),Tt(e,"dblclick",Kp(r[21])),Tt(e,"contextmenu",Kp(vg(r[22]))),Tt(e,"mouseenter",r[23]),Tt(e,"mouseleave",r[24]),Tt(e,"mousemove",r[25]),Tt(e,"keydown",r[8])],d=!0)},p(S,[k]){x&&x.p&&(!u||k&262152)&&Gr(x,_,S,S[18],u?qr(_,S[18],k,t3):Wr(S[18]),n0),(!u||k&2&&t!==(t=S[1]?0:void 0))&&Ee(e,"tabindex",t),(!u||k&2&&n!==(n=S[1]?"button":void 0))&&Ee(e,"role",n),l&&wc(l.update)&&k&1&&l.update.call(null,S[0]),k&4&&fn(e,"z-index",S[2])},i(S){u||(oe(x,S),u=!0)},o(S){de(x,S),u=!1},d(S){S&&ve(e),x&&x.d(S),d=!1,_n(a)}}}function n3(r,e){const t=r.className;function n(l){l?r.className=`${t} ${l}`:r.className=t}return n(e),{update:n}}function i3(r,e,t){let n,l,u,{$$slots:d={},$$scope:a}=e,{marker:_=void 0}=e,{lngLat:x}=e,{class:S=void 0}=e,{interactive:k=!0}=e,{asButton:C=!1}=e,{draggable:P=!1}=e,{feature:D=null}=e,{offset:N=void 0}=e,{zIndex:z=void 0}=e,{rotation:B=0}=e,{opacity:O=1}=e;const G=us(),{map:U,layerEvent:K,self:me,markerClickManager:X}=mk();wt(r,U,Ke=>t(27,u=Ke)),wt(r,K,Ke=>t(26,n=Ke)),wt(r,me,Ke=>t(3,l=Ke));function Y(Ke){Rt(me,l=new to.Marker({element:Ke,rotation:B,draggable:P,offset:N,opacity:O.toString()}).setLngLat(x).addTo(u),l),t(11,_=l);const Kt=()=>re("dragstart"),vt=()=>{_e(),re("drag")},At=()=>{_e(),re("dragend")};return P&&(l.on("dragstart",Kt),l.on("drag",vt),l.on("dragend",At)),{destroy(){P&&(l==null||l.off("dragstart",Kt),l==null||l.off("drag",vt),l==null||l.off("dragend",At)),t(11,_=void 0),l==null||l.remove()}}}function _e(){let Ke=l==null?void 0:l.getLngLat();Ke&&(Array.isArray(x)?t(10,x=[Ke.lng,Ke.lat]):x&&"lon"in x?t(10,x={lon:Ke.lng,lat:Ke.lat}):t(10,x=Ke))}function ze(Ke){Ke.key===" "&&(Ke.preventDefault(),Ke.stopPropagation(),re("click"))}function re(Ke){if(!k)return;let Kt=l==null?void 0:l.getLngLat();if(!Kt)return;const vt=[Kt.lng,Kt.lat];let At={map:u,marker:l,lngLat:vt,features:[{type:"Feature",properties:(D==null?void 0:D.properties)??{},geometry:{type:"Point",coordinates:vt}}]};(Ke==="click"||Ke==="contextmenu")&&X.handleClick(At),Rt(K,n={...At,layerType:"marker",type:Ke},n),G(Ke,At)}const ce=()=>re("click"),Ze=()=>re("dblclick"),Me=()=>{re("contextmenu")},ft=()=>{re("mouseenter")},Ct=()=>{re("mouseleave")},Ot=()=>re("mousemove");return r.$$set=Ke=>{"marker"in Ke&&t(11,_=Ke.marker),"lngLat"in Ke&&t(10,x=Ke.lngLat),"class"in Ke&&t(0,S=Ke.class),"interactive"in Ke&&t(12,k=Ke.interactive),"asButton"in Ke&&t(1,C=Ke.asButton),"draggable"in Ke&&t(13,P=Ke.draggable),"feature"in Ke&&t(14,D=Ke.feature),"offset"in Ke&&t(15,N=Ke.offset),"zIndex"in Ke&&t(2,z=Ke.zIndex),"rotation"in Ke&&t(16,B=Ke.rotation),"opacity"in Ke&&t(17,O=Ke.opacity),"$$scope"in Ke&&t(18,a=Ke.$$scope)},r.$$.update=()=>{r.$$.dirty&1032&&(l==null||l.setLngLat(x)),r.$$.dirty&32776&&(l==null||l.setOffset(N??[0,0])),r.$$.dirty&65544&&(l==null||l.setRotation(B)),r.$$.dirty&131080&&(l==null||l.setOpacity(O.toString()))},[S,C,z,l,U,K,me,Y,ze,re,x,_,k,P,D,N,B,O,a,d,ce,Ze,Me,ft,Ct,Ot]}class fd extends Ht{constructor(e){super(),Zt(this,e,i3,r3,Ut,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}const o3=r=>({features:r[0]&16,data:r[0]&16,map:r[0]&4,close:r[0]&1}),i0=r=>{var e;return{features:r[4],data:((e=r[4])==null?void 0:e[0])??null,map:r[2],close:r[31]}};function o0(r){var l;let e,t,n=(((l=r[4])==null?void 0:l.length)||r[3]instanceof to.Marker)&&s0(r);return{c(){e=fe("div"),n&&n.c()},m(u,d){be(u,e,d),n&&n.m(e,null),r[32](e),t=!0},p(u,d){var a;(a=u[4])!=null&&a.length||u[3]instanceof to.Marker?n?(n.p(u,d),d[0]&24&&oe(n,1)):(n=s0(u),n.c(),oe(n,1),n.m(e,null)):n&&(yr(),de(n,1,1,()=>{n=null}),vr())},i(u){t||(oe(n),t=!0)},o(u){de(n),t=!1},d(u){u&&ve(e),n&&n.d(),r[32](null)}}}function s0(r){let e;const t=r[30].default,n=Vr(t,r,r[29],i0);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u[0]&536870933)&&Gr(n,t,l,l[29],e?qr(t,l[29],u,o3):Wr(l[29]),i0)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function s3(r){let e,t,n=r[9].default&&o0(r);return{c(){n&&n.c(),e=$n()},m(l,u){n&&n.m(l,u),be(l,e,u),t=!0},p(l,u){l[9].default?n?(n.p(l,u),u[0]&512&&oe(n,1)):(n=o0(l),n.c(),oe(n,1),n.m(e.parentNode,e)):n&&(yr(),de(n,1,1,()=>{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function a3(r,e,t){let n,l,u,d,a,_,{$$slots:x={},$$scope:S}=e;const k=FS(x);let{closeButton:C=void 0}=e,{closeOnClickOutside:P=!0}=e,{closeOnClickInside:D=!1}=e,{closeOnMove:N=!1}=e,{openOn:z="click"}=e,{openIfTopMost:B=!0}=e,{focusAfterOpen:O=!0}=e,{anchor:G=void 0}=e,{offset:U=void 0}=e,{popupClass:K=void 0}=e,{maxWidth:me=void 0}=e,{lngLat:X=void 0}=e,{html:Y=void 0}=e,{open:_e=!1}=e;const ze=us(),{map:re,popupTarget:ce,layerEvent:Ze,layer:Me,eventTopMost:ft,markerClickManager:Ct}=nl();wt(r,re,ne=>t(2,u=ne)),wt(r,ce,ne=>t(3,a=ne)),wt(r,Ze,ne=>t(28,d=ne)),wt(r,Me,ne=>t(35,_=ne));const Ot=["click","dblclick","contextmenu"];let Ke,Kt=!1,vt;function At(){if(!Ke)return;let ne=Ke.getElement();!ne||ne===vt||(vt=ne,z==="hover"&&(vt.style.pointerEvents="none"),vt.addEventListener("mouseenter",()=>{t(24,Kt=!0)},{passive:!0}),vt.addEventListener("mouseleave",()=>{t(24,Kt=!1)},{passive:!0}),vt.addEventListener("click",()=>{D&&t(0,_e=!1)},{passive:!0}))}Ld(()=>{if(u)return u.on("click",Lt),u.on("contextmenu",Lt),Ct.add(De),typeof a=="string"&&(u.on("click",a,Nt),u.on("dblclick",a,Nt),u.on("contextmenu",a,Nt),u.on("mousemove",a,st),u.on("mouseleave",a,Pr),u.on("touchstart",a,tr),u.on("touchend",a,Lr)),()=>{u!=null&&u.loaded()&&(Ke==null||Ke.remove(),u.off("click",Lt),u.off("contextmenu",Lt),Ct.remove(De),a instanceof to.Marker?a.getPopup()===Ke&&a.setPopup(void 0):typeof a=="string"&&(u.off("click",a,Nt),u.off("dblclick",a,Nt),u.off("contextmenu",a,Nt),u.off("mousemove",a,st),u.off("mouseleave",a,Pr),u.off("touchstart",a,tr),u.off("touchend",a,Lr)))}});function Vt(ne){return B?!("marker"in ne)&&!gk(ne)&&ft(ne)!==_:!1}let sr=null,fr="normal";function er(ne){"layerType"in ne&&ne.layerType==="deckgl"?(t(10,X=ne.coordinate),t(4,sr=ne.object?[ne.object]:null)):(t(10,X=ne.lngLat),t(4,sr=ne.features??[]))}function Nt(ne){ne.type!==z||Vt(ne)||(er(ne),setTimeout(()=>t(0,_e=!0)))}let nr=null;function tr(ne){nr=ne.point}function Lr(ne){if(!nr||z!=="hover")return;let br=nr.dist(ne.point);nr=null,br<3&&(t(10,X=ne.lngLat),t(4,sr=ne.features??[]),Ke.isOpen()?t(25,fr="justOpened"):(t(25,fr="opening"),t(0,_e=!0)))}function Pr(ne){z!=="hover"||nr||fr!=="normal"||(t(0,_e=!1),t(4,sr=null))}function st(ne){if(!(z!=="hover"||nr||fr!=="normal")){if(Vt(ne)){t(0,_e=!1),t(4,sr=null);return}t(0,_e=!0),t(4,sr=ne.features??[]),t(10,X=ne.lngLat)}}function Lt(ne){if(fr==="justOpened"){t(25,fr="normal");return}if(!P)return;let br=[vt,a instanceof to.Marker?a==null?void 0:a.getElement():null];_e&&Ke.isOpen()&&!br.some(We=>We==null?void 0:We.contains(ne.originalEvent.target))&&(ne.type==="contextmenu"&&z==="contextmenu"||ne.type!=="contextmenu")&&t(0,_e=!1)}function De(ne){P&&_e&&Ke.isOpen()&&ne.marker!==a&&t(0,_e=!1)}ti(()=>{u&&(Ke!=null&&Ke.isOpen())&&Ke.remove()});let at;const tt=()=>t(0,_e=!1);function it(ne){pn[ne?"unshift":"push"](()=>{at=ne,t(1,at)})}return r.$$set=ne=>{"closeButton"in ne&&t(11,C=ne.closeButton),"closeOnClickOutside"in ne&&t(12,P=ne.closeOnClickOutside),"closeOnClickInside"in ne&&t(13,D=ne.closeOnClickInside),"closeOnMove"in ne&&t(14,N=ne.closeOnMove),"openOn"in ne&&t(15,z=ne.openOn),"openIfTopMost"in ne&&t(16,B=ne.openIfTopMost),"focusAfterOpen"in ne&&t(17,O=ne.focusAfterOpen),"anchor"in ne&&t(18,G=ne.anchor),"offset"in ne&&t(19,U=ne.offset),"popupClass"in ne&&t(20,K=ne.popupClass),"maxWidth"in ne&&t(21,me=ne.maxWidth),"lngLat"in ne&&t(10,X=ne.lngLat),"html"in ne&&t(22,Y=ne.html),"open"in ne&&t(0,_e=ne.open),"$$scope"in ne&&t(29,S=ne.$$scope)},r.$$.update=()=>{if(r.$$.dirty[0]&14336&&t(27,n=C??(!P&&!D)),r.$$.dirty[0]&146685952&&(Ke||(t(23,Ke=new to.Popup({closeButton:n,closeOnClick:!1,closeOnMove:N,focusAfterOpen:O,maxWidth:me,className:K,anchor:G,offset:U})),vt=Ke.getElement(),Ke.on("open",()=>{t(0,_e=!0),At(),ze("open",Ke)}),Ke.on("close",()=>{t(0,_e=!1),ze("close",Ke)}),Ke.on("hover",()=>{ze("hover",Ke)}))),r.$$.dirty[0]&8421384&&Ke&&a instanceof to.Marker&&(z==="click"?a.setPopup(Ke):a.getPopup()===Ke&&a.setPopup(void 0)),r.$$.dirty[0]&268468224&&Ot.includes(z)&&(d==null?void 0:d.type)===z&&(Nt(d),Rt(Ze,d=null,d)),r.$$.dirty[0]&268468224&&t(26,l=z==="hover"&&((d==null?void 0:d.type)==="mousemove"||(d==null?void 0:d.type)==="mouseenter")),r.$$.dirty[0]&352354304&&z==="hover"&&Ze&&(l&&d&&er(d),t(0,_e=(l||Kt)??!1)),r.$$.dirty[0]&12582914&&(at?Ke.setDOMContent(at):Y&&Ke.setHTML(Y)),r.$$.dirty[0]&8389632&&X&&Ke.setLngLat(X),r.$$.dirty[0]&41943045&&u){let ne=Ke.isOpen();_e&&!ne?(Ke.addTo(u),fr==="opening"&&t(25,fr="justOpened")):!_e&&ne&&Ke.remove()}},[_e,at,u,a,sr,re,ce,Ze,Me,k,X,C,P,D,N,z,B,O,G,U,K,me,Y,Ke,Kt,fr,l,n,d,S,x,tt,it]}class l3 extends Ht{constructor(e){super(),Zt(this,e,a3,s3,Ut,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}var kh=Uint8Array,tw=Uint16Array,c3=Int32Array,u3=new kh([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),h3=new kh([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),rw=function(r,e){for(var t=new tw(31),n=0;n<31;++n)t[n]=e+=1<>1|(Fr&21845)<<1,Ms=(Ms&52428)>>2|(Ms&13107)<<2,Ms=(Ms&61680)>>4|(Ms&3855)<<4,p3[Fr]=((Ms&65280)>>8|(Ms&255)<<8)>>1;var Ms,Fr,Fd=new kh(288);for(Fr=0;Fr<144;++Fr)Fd[Fr]=8;var Fr;for(Fr=144;Fr<256;++Fr)Fd[Fr]=9;var Fr;for(Fr=256;Fr<280;++Fr)Fd[Fr]=7;var Fr;for(Fr=280;Fr<288;++Fr)Fd[Fr]=8;var Fr,m3=new kh(32);for(Fr=0;Fr<32;++Fr)m3[Fr]=5;var Fr,g3=new kh(0),_3=typeof TextDecoder<"u"&&new TextDecoder,y3=0;try{_3.decode(g3,{stream:!0}),y3=1}catch{}function v3(r){let e;const t=r[16].default,n=Vr(t,r,r[24],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&16777216)&&Gr(n,t,l,l[24],e?qr(t,l[24],u,null):Wr(l[24]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function b3(r){let e,t,n;function l(d){r[17](d)}let u={id:r[1],type:"symbol",source:r[2],sourceLayer:r[3],beforeId:r[4],beforeLayerType:r[5],paint:r[6],layout:r[7],filter:r[8],applyToClusters:r[9],minzoom:r[10],maxzoom:r[11],hoverCursor:r[12],manageHoverState:r[13],eventsIfTopMost:r[14],interactive:r[15],$$slots:{default:[v3]},$$scope:{ctx:r}};return r[0]!==void 0&&(u.hovered=r[0]),e=new Bd({props:u}),pn.push(()=>zo(e,"hovered",l)),e.$on("click",r[18]),e.$on("dblclick",r[19]),e.$on("contextmenu",r[20]),e.$on("mouseenter",r[21]),e.$on("mousemove",r[22]),e.$on("mouseleave",r[23]),{c(){je(e.$$.fragment)},m(d,a){Oe(e,d,a),n=!0},p(d,[a]){const _={};a&2&&(_.id=d[1]),a&4&&(_.source=d[2]),a&8&&(_.sourceLayer=d[3]),a&16&&(_.beforeId=d[4]),a&32&&(_.beforeLayerType=d[5]),a&64&&(_.paint=d[6]),a&128&&(_.layout=d[7]),a&256&&(_.filter=d[8]),a&512&&(_.applyToClusters=d[9]),a&1024&&(_.minzoom=d[10]),a&2048&&(_.maxzoom=d[11]),a&4096&&(_.hoverCursor=d[12]),a&8192&&(_.manageHoverState=d[13]),a&16384&&(_.eventsIfTopMost=d[14]),a&32768&&(_.interactive=d[15]),a&16777216&&(_.$$scope={dirty:a,ctx:d}),!t&&a&1&&(t=!0,_.hovered=d[0],Po(()=>t=!1)),e.$set(_)},i(d){n||(oe(e.$$.fragment,d),n=!0)},o(d){de(e.$$.fragment,d),n=!1},d(d){Ne(e,d)}}}function w3(r,e,t){let{$$slots:n={},$$scope:l}=e,{id:u=Dc("symbol")}=e,{source:d=void 0}=e,{sourceLayer:a=void 0}=e,{beforeId:_=void 0}=e,{beforeLayerType:x=void 0}=e,{paint:S=void 0}=e,{layout:k=void 0}=e,{filter:C=void 0}=e,{applyToClusters:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:N=void 0}=e,{hoverCursor:z=void 0}=e,{manageHoverState:B=!1}=e,{hovered:O=null}=e,{eventsIfTopMost:G=!1}=e,{interactive:U=!0}=e;function K(ce){O=ce,t(0,O)}function me(ce){ur.call(this,r,ce)}function X(ce){ur.call(this,r,ce)}function Y(ce){ur.call(this,r,ce)}function _e(ce){ur.call(this,r,ce)}function ze(ce){ur.call(this,r,ce)}function re(ce){ur.call(this,r,ce)}return r.$$set=ce=>{"id"in ce&&t(1,u=ce.id),"source"in ce&&t(2,d=ce.source),"sourceLayer"in ce&&t(3,a=ce.sourceLayer),"beforeId"in ce&&t(4,_=ce.beforeId),"beforeLayerType"in ce&&t(5,x=ce.beforeLayerType),"paint"in ce&&t(6,S=ce.paint),"layout"in ce&&t(7,k=ce.layout),"filter"in ce&&t(8,C=ce.filter),"applyToClusters"in ce&&t(9,P=ce.applyToClusters),"minzoom"in ce&&t(10,D=ce.minzoom),"maxzoom"in ce&&t(11,N=ce.maxzoom),"hoverCursor"in ce&&t(12,z=ce.hoverCursor),"manageHoverState"in ce&&t(13,B=ce.manageHoverState),"hovered"in ce&&t(0,O=ce.hovered),"eventsIfTopMost"in ce&&t(14,G=ce.eventsIfTopMost),"interactive"in ce&&t(15,U=ce.interactive),"$$scope"in ce&&t(24,l=ce.$$scope)},[O,u,d,a,_,x,S,k,C,P,D,N,z,B,G,U,n,K,me,X,Y,_e,ze,re,l]}class iw extends Ht{constructor(e){super(),Zt(this,e,w3,b3,Ut,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}var x3=Object.defineProperty,ow=r=>{throw TypeError(r)},S3=(r,e,t)=>e in r?x3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,fo=(r,e,t)=>S3(r,typeof e!="symbol"?e+"":e,t),sw=(r,e,t)=>e.has(r)||ow("Cannot "+t),Qn=(r,e,t)=>(sw(r,e,"read from private field"),t?t.call(r):e.get(r)),a0=(r,e,t)=>e.has(r)?ow("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),l0=(r,e,t,n)=>(sw(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);function mn(){}function k3(r,e){for(const t in e)r[t]=e[t];return r}function aw(r){return r()}function c0(){return Object.create(null)}function Bs(r){r.forEach(aw)}function lw(r){return typeof r=="function"}function ga(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}let Bf;function zi(r,e){return r===e?!0:(Bf||(Bf=document.createElement("a")),Bf.href=e,r===Bf.href)}function T3(r){return Object.keys(r).length===0}function E3(r,e,t,n){if(r){const l=cw(r,e,t,n);return r[0](l)}}function cw(r,e,t,n){return r[1]&&n?k3(t.ctx.slice(),r[1](n(e))):t.ctx}function M3(r,e,t,n){if(r[2]&&n){const l=r[2](n(t));if(e.dirty===void 0)return l;if(typeof l=="object"){const u=[],d=Math.max(e.dirty.length,l.length);for(let a=0;a32){const e=[],t=r.ctx.length/32;for(let n=0;nr.removeEventListener(e,t,n)}function L3(r){return function(e){return e.preventDefault(),r.call(this,e)}}function ot(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function P3(r){return Array.from(r.childNodes)}function ph(r,e){e=""+e,r.data!==e&&(r.data=e)}function h0(r,e){r.value=e??""}function Ao(r,e,t){r.classList.toggle(e,!!t)}function z3(r,e,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(r,{detail:e,bubbles:t,cancelable:n})}let mh;function oh(r){mh=r}function uw(){if(!mh)throw new Error("Function called outside component initialization");return mh}function D3(r){uw().$$.on_destroy.push(r)}function R3(){const r=uw();return(e,t,{cancelable:n=!1}={})=>{const l=r.$$.callbacks[e];if(l){const u=z3(e,t,{cancelable:n});return l.slice().forEach(d=>{d.call(r,u)}),!u.defaultPrevented}return!0}}function f0(r,e){const t=r.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}const pc=[],Nm=[];let vc=[];const d0=[],B3=Promise.resolve();let jm=!1;function F3(){jm||(jm=!0,B3.then(hw))}function Um(r){vc.push(r)}const tm=new Set;let ac=0;function hw(){if(ac!==0)return;const r=mh;do{try{for(;acr.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),vc=e}const Wf=new Set;let Ya;function Zf(){Ya={r:0,c:[],p:Ya}}function Hf(){Ya.r||Bs(Ya.c),Ya=Ya.p}function Zn(r,e){r&&r.i&&(Wf.delete(r),r.i(e))}function ui(r,e,t,n){if(r&&r.o){if(Wf.has(r))return;Wf.add(r),Ya.c.push(()=>{Wf.delete(r),n&&(t&&r.d(1),n())}),r.o(e)}else n&&n()}function p0(r){return(r==null?void 0:r.length)!==void 0?r:Array.from(r)}function j3(r,e){ui(r,1,1,()=>{e.delete(r.key)})}function U3(r,e,t,n,l,u,d,a,_,x,S,k){let C=r.length,P=u.length,D=C;const N={};for(;D--;)N[r[D].key]=D;const z=[],B=new Map,O=new Map,G=[];for(D=P;D--;){const X=k(l,u,D),Y=t(X);let _e=d.get(Y);_e?G.push(()=>_e.p(X,e)):(_e=x(Y,X),_e.c()),B.set(Y,z[D]=_e),Y in N&&O.set(Y,Math.abs(D-N[Y]))}const U=new Set,K=new Set;function me(X){Zn(X,1),X.m(a,S),d.set(X.key,X),S=X.first,P--}for(;C&&P;){const X=z[P-1],Y=r[C-1],_e=X.key,ze=Y.key;X===Y?(S=X.first,C--,P--):B.has(ze)?!d.has(_e)||U.has(_e)?me(X):K.has(ze)?C--:O.get(_e)>O.get(ze)?(K.add(_e),me(X)):(U.add(ze),C--):(_(Y,d),C--)}for(;C--;){const X=r[C];B.has(X.key)||_(X,d)}for(;P;)me(z[P-1]);return Bs(G),z}function da(r){r&&r.c()}function Ds(r,e,t){const{fragment:n,after_update:l}=r.$$;n&&n.m(e,t),Um(()=>{const u=r.$$.on_mount.map(aw).filter(lw);r.$$.on_destroy?r.$$.on_destroy.push(...u):Bs(u),r.$$.on_mount=[]}),l.forEach(Um)}function Rs(r,e){const t=r.$$;t.fragment!==null&&(N3(t.after_update),Bs(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function V3(r,e){r.$$.dirty[0]===-1&&(pc.push(r),F3(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<{const D=P.length?P[0]:C;return x.ctx&&l(x.ctx[k],x.ctx[k]=D)&&(!x.skip_bound&&x.bound[k]&&x.bound[k](D),S&&V3(r,k)),C}):[],x.update(),S=!0,Bs(x.before_update),x.fragment=n?n(x.ctx):!1,e.target){if(e.hydrate){const k=P3(e.target);x.fragment&&x.fragment.l(k),k.forEach(gn)}else x.fragment&&x.fragment.c();e.intro&&Zn(r.$$.fragment),Ds(r,e.target,e.anchor),hw()}oh(_)}class ya{constructor(){fo(this,"$$"),fo(this,"$$set")}$destroy(){Rs(this,1),this.$destroy=mn}$on(e,t){if(!lw(t))return mn;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const l=n.indexOf(t);l!==-1&&n.splice(l,1)}}$set(e){this.$$set&&!T3(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const q3="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(q3);function G3(r){let e,t;return{c(){e=Zo("svg"),t=Zo("path"),ot(t,"d","M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"),ot(e,"viewBox","0 0 14 14"),ot(e,"width","13"),ot(e,"height","13"),ot(e,"class","svelte-en2qvf")},m(n,l){vn(n,e,l),Ir(e,t)},p:mn,i:mn,o:mn,d(n){n&&gn(e)}}}class fw extends ya{constructor(e){super(),_a(this,e,null,G3,ga,{})}}function W3(r){let e,t;return{c(){e=Zo("svg"),t=Zo("path"),ot(t,"d","M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"),ot(e,"viewBox","0 0 30 30"),ot(e,"fill","none"),ot(e,"xmlns","http://www.w3.org/2000/svg"),ot(e,"class","svelte-d2loi5")},m(n,l){vn(n,e,l),Ir(e,t)},p:mn,i:mn,o:mn,d(n){n&&gn(e)}}}class dw extends ya{constructor(e){super(),_a(this,e,null,W3,ga,{})}}function Z3(r){let e,t;return{c(){e=Kr("img"),zi(e.src,t=r[3]+"area.svg")||ot(e,"src",t),ot(e,"alt",r[6]),ot(e,"class","svelte-ltkwvy")},m(n,l){vn(n,e,l)},p(n,l){l&8&&!zi(e.src,t=n[3]+"area.svg")&&ot(e,"src",t),l&64&&ot(e,"alt",n[6])},d(n){n&&gn(e)}}}function H3(r){let e,t;return{c(){e=Kr("img"),zi(e.src,t=r[3]+"reverse.svg")||ot(e,"src",t),ot(e,"alt",r[6]),ot(e,"class","svelte-ltkwvy")},m(n,l){vn(n,e,l)},p(n,l){l&8&&!zi(e.src,t=n[3]+"reverse.svg")&&ot(e,"src",t),l&64&&ot(e,"alt",n[6])},d(n){n&&gn(e)}}}function $3(r){let e,t;return{c(){e=Kr("img"),zi(e.src,t=r[3]+"poi.svg")||ot(e,"src",t),ot(e,"alt",r[6]),ot(e,"class","svelte-ltkwvy")},m(n,l){vn(n,e,l)},p(n,l){l&8&&!zi(e.src,t=n[3]+"poi.svg")&&ot(e,"src",t),l&64&&ot(e,"alt",n[6])},d(n){n&&gn(e)}}}function X3(r){let e,t;return{c(){e=Kr("img"),zi(e.src,t=r[3]+"postal_code.svg")||ot(e,"src",t),ot(e,"alt",r[6]),ot(e,"class","svelte-ltkwvy")},m(n,l){vn(n,e,l)},p(n,l){l&8&&!zi(e.src,t=n[3]+"postal_code.svg")&&ot(e,"src",t),l&64&&ot(e,"alt",n[6])},d(n){n&&gn(e)}}}function K3(r){let e,t;return{c(){e=Kr("img"),zi(e.src,t=r[3]+"street.svg")||ot(e,"src",t),ot(e,"alt",r[6]),ot(e,"class","svelte-ltkwvy")},m(n,l){vn(n,e,l)},p(n,l){l&8&&!zi(e.src,t=n[3]+"street.svg")&&ot(e,"src",t),l&64&&ot(e,"alt",n[6])},d(n){n&&gn(e)}}}function J3(r){let e,t;return{c(){e=Kr("img"),zi(e.src,t=r[3]+"road.svg")||ot(e,"src",t),ot(e,"alt",r[6]),ot(e,"class","svelte-ltkwvy")},m(n,l){vn(n,e,l)},p(n,l){l&8&&!zi(e.src,t=n[3]+"road.svg")&&ot(e,"src",t),l&64&&ot(e,"alt",n[6])},d(n){n&&gn(e)}}}function Y3(r){let e,t;return{c(){e=Kr("img"),zi(e.src,t=r[3]+"housenumber.svg")||ot(e,"src",t),ot(e,"alt",r[6]),ot(e,"class","svelte-ltkwvy")},m(n,l){vn(n,e,l)},p(n,l){l&8&&!zi(e.src,t=n[3]+"housenumber.svg")&&ot(e,"src",t),l&64&&ot(e,"alt",n[6])},d(n){n&&gn(e)}}}function Q3(r){let e,t,n,l;return{c(){e=Kr("img"),zi(e.src,t=r[5])||ot(e,"src",t),ot(e,"alt",r[4]),ot(e,"class","svelte-ltkwvy")},m(u,d){vn(u,e,d),n||(l=Zi(e,"error",r[14]),n=!0)},p(u,d){d&32&&!zi(e.src,t=u[5])&&ot(e,"src",t),d&16&&ot(e,"alt",u[4])},d(u){u&&gn(e),n=!1,l()}}}function m0(r){let e,t;return{c(){e=Kr("span"),t=fa(r[6]),ot(e,"class","secondary svelte-ltkwvy")},m(n,l){vn(n,e,l),Ir(e,t)},p(n,l){l&64&&ph(t,n[6])},d(n){n&&gn(e)}}}function eT(r){let e,t,n,l,u,d,a,_,x,S=(r[7]?r[0].place_name:r[0].place_name.replace(/,.*/,""))+"",k,C,P=r[2]==="always"||r[2]!=="never"&&!r[0].address&&!r[0].id.startsWith("road.")&&!r[0].id.startsWith("address.")&&!r[0].id.startsWith("postal_code.")&&(!r[0].id.startsWith("poi.")||!r[5])&&!r[7],D,N,z=(r[7]?"":r[0].place_name.replace(/[^,]*,?\s*/,""))+"",B,O,G;function U(Y,_e){return _e&1&&(t=null),_e&1&&(n=null),_e&1&&(l=null),_e&1&&(u=null),Y[5]?Q3:Y[0].address?Y3:(t==null&&(t=!!Y[0].id.startsWith("road.")),t?J3:(n==null&&(n=!!Y[0].id.startsWith("address.")),n?K3:(l==null&&(l=!!Y[0].id.startsWith("postal_code.")),l?X3:(u==null&&(u=!!Y[0].id.startsWith("poi.")),u?$3:Y[7]?H3:Z3))))}let K=U(r,-1),me=K(r),X=P&&m0(r);return{c(){e=Kr("li"),me.c(),d=po(),a=Kr("span"),_=Kr("span"),x=Kr("span"),k=fa(S),C=po(),X&&X.c(),D=po(),N=Kr("span"),B=fa(z),ot(x,"class","primary svelte-ltkwvy"),ot(_,"class","svelte-ltkwvy"),ot(N,"class","line2 svelte-ltkwvy"),ot(a,"class","texts svelte-ltkwvy"),ot(e,"tabindex","0"),ot(e,"data-selected",r[1]),ot(e,"class","svelte-ltkwvy"),Ao(e,"selected",r[1])},m(Y,_e){vn(Y,e,_e),me.m(e,null),Ir(e,d),Ir(e,a),Ir(a,_),Ir(_,x),Ir(x,k),Ir(_,C),X&&X.m(_,null),Ir(a,D),Ir(a,N),Ir(N,B),O||(G=[Zi(e,"mouseenter",r[12]),Zi(e,"focus",r[13])],O=!0)},p(Y,[_e]){K===(K=U(Y,_e))&&me?me.p(Y,_e):(me.d(1),me=K(Y),me&&(me.c(),me.m(e,d))),_e&1&&S!==(S=(Y[7]?Y[0].place_name:Y[0].place_name.replace(/,.*/,""))+"")&&ph(k,S),_e&37&&(P=Y[2]==="always"||Y[2]!=="never"&&!Y[0].address&&!Y[0].id.startsWith("road.")&&!Y[0].id.startsWith("address.")&&!Y[0].id.startsWith("postal_code.")&&(!Y[0].id.startsWith("poi.")||!Y[5])&&!Y[7]),P?X?X.p(Y,_e):(X=m0(Y),X.c(),X.m(_,null)):X&&(X.d(1),X=null),_e&1&&z!==(z=(Y[7]?"":Y[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&ph(B,z),_e&2&&ot(e,"data-selected",Y[1]),_e&2&&Ao(e,"selected",Y[1])},i:mn,o:mn,d(Y){Y&&gn(e),me.d(),X&&X.d(),O=!1,Bs(G)}}}function tT(r,e,t){var n;let l,u,{feature:d}=e,{selected:a=!1}=e,{showPlaceType:_}=e,{missingIconsCache:x}=e,{iconsBaseUrl:S}=e;const k=(n=d.properties)==null?void 0:n.categories;let C,P,D=0,N=d.place_type[0]==="reverse";function z(){P&&x.add(P),t(10,D++,D)}function B(U){f0.call(this,r,U)}function O(U){f0.call(this,r,U)}const G=()=>z();return r.$$set=U=>{"feature"in U&&t(0,d=U.feature),"selected"in U&&t(1,a=U.selected),"showPlaceType"in U&&t(2,_=U.showPlaceType),"missingIconsCache"in U&&t(9,x=U.missingIconsCache),"iconsBaseUrl"in U&&t(3,S=U.iconsBaseUrl)},r.$$.update=()=>{var U,K,me,X;if(r.$$.dirty&3640)do t(11,l--,l),t(4,C=k==null?void 0:k[l]),t(5,P=C?S+C.replace(/ /g,"_")+".svg":void 0);while(l>-1&&(!P||x.has(P)));r.$$.dirty&1&&t(6,u=((K=(U=d.properties)==null?void 0:U.categories)==null?void 0:K.join(", "))??((X=(me=d.properties)==null?void 0:me.place_type_name)==null?void 0:X[0])??d.place_type[0])},t(11,l=(k==null?void 0:k.length)??0),[d,a,_,S,C,P,u,N,z,x,D,l,B,O,G]}class rT extends ya{constructor(e){super(),_a(this,e,tT,eT,ga,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function nT(r){let e;return{c(){e=Kr("div"),e.innerHTML='',ot(e,"class","svelte-7cmwmc")},m(t,n){vn(t,e,n)},p:mn,i:mn,o:mn,d(t){t&&gn(e)}}}class iT extends ya{constructor(e){super(),_a(this,e,null,nT,ga,{})}}function oT(r){let e,t,n;return{c(){e=Zo("svg"),t=Zo("path"),ot(t,"stroke-width","4"),ot(t,"d","M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"),ot(t,"class","svelte-gzo3ar"),ot(e,"width",n=r[0]==="list"?20:void 0),ot(e,"viewBox","0 0 70 85"),ot(e,"fill","none"),ot(e,"class","svelte-gzo3ar"),Ao(e,"in-map",r[0]!=="list"),Ao(e,"list-icon",r[0]==="list")},m(l,u){vn(l,e,u),Ir(e,t)},p(l,[u]){u&1&&n!==(n=l[0]==="list"?20:void 0)&&ot(e,"width",n),u&1&&Ao(e,"in-map",l[0]!=="list"),u&1&&Ao(e,"list-icon",l[0]==="list")},i:mn,o:mn,d(l){l&&gn(e)}}}function sT(r,e,t){let{displayIn:n}=e;return r.$$set=l=>{"displayIn"in l&&t(0,n=l.displayIn)},[n]}class aT extends ya{constructor(e){super(),_a(this,e,sT,oT,ga,{displayIn:0})}}function lT(r){let e,t;return{c(){e=Zo("svg"),t=Zo("path"),ot(t,"d","M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"),ot(e,"viewBox","0 0 60.006 21.412"),ot(e,"width","14"),ot(e,"height","20"),ot(e,"class","svelte-en2qvf")},m(n,l){vn(n,e,l),Ir(e,t)},p:mn,i:mn,o:mn,d(n){n&&gn(e)}}}class cT extends ya{constructor(e){super(),_a(this,e,null,lT,ga,{})}}function uT(r){let e,t,n;return{c(){e=Zo("svg"),t=Zo("circle"),n=Zo("path"),ot(t,"cx","4.789"),ot(t,"cy","4.787"),ot(t,"r","3.85"),ot(t,"class","svelte-1aq105l"),ot(n,"d","M12.063 12.063 7.635 7.635"),ot(n,"class","svelte-1aq105l"),ot(e,"xmlns","http://www.w3.org/2000/svg"),ot(e,"width","13"),ot(e,"height","13"),ot(e,"viewBox","0 0 13 13"),ot(e,"class","svelte-1aq105l")},m(l,u){vn(l,e,u),Ir(e,t),Ir(e,n)},p:mn,i:mn,o:mn,d(l){l&&gn(e)}}}class hT extends ya{constructor(e){super(),_a(this,e,null,uT,ga,{})}}function fT(r,e,t){const n=e[1],l=e[0],u=n-l;return r===n&&t?r:((r-l)%u+u)%u+l}function dd(r){const e=[...r];return e[2]Math.abs((e[0]-360+e[2])/2)?e[0]-=360:e[2]+=360),e}let Ou;async function dT(r,e,t){const n=r==null?void 0:r.getCenterAndZoom();for(const l of e??[])if(!(n&&(l.minZoom!=null&&l.minZoom>n[0]||l.maxZoom!=null&&l.maxZoomDate.now()){if(!Ou.coords)break e;return Ou.coords}let u;try{return u=await new Promise((d,a)=>{t.signal.addEventListener("abort",()=>{a(Error("aborted"))}),navigator.geolocation.getCurrentPosition(_=>{d([_.coords.longitude,_.coords.latitude].map(x=>x.toFixed(6)).join(","))},_=>{a(_)},l)}),u}catch{}finally{l.cachedLocationExpiry&&(Ou={time:Date.now(),coords:u})}if(t.signal.aborted)return}if(l.type==="server-geolocation")return"ip";if(n&&l.type==="map-center")return n[1].toFixed(6)+","+n[2].toFixed(6)}}const pT=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(EAST|WEST|[EW])?$/i,g0=/^([+-]?[0-8]?[0-9])\s+([0-5]?[0-9]\.\d{3,})[\s,]{1,}([+-]?[0-1]?[0-9]?[0-9])\s+([0-5]?[0-9]\.\d{3,})$/,_0=/^(NORTH|SOUTH|[NS])?[\s]*([+-]?[0-8]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(NORTH|SOUTH|[NS])?[\s]*[,/;]?[\s]*(EAST|WEST|[EW])?[\s]*([+-]?[0-1]?[0-9]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(EAST|WEST|[EW])?$/i,y0=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(EAST|WEST|[EW])?$/i,v0=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)\s*(EAST|WEST|[EW])?$/i,b0=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|’’|´´|["″”\.])?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|´´|’’|["″”\.])?\s*(EAST|WEST|[EW])?$/i;function mT(r){if(!["DMS","DM","DD"].includes(r))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){const e=this.decimalCoordinates.split(",").map(P=>Number(P.trim())),t=Number(e[0]),n=Number(e[1]),l=Math.abs(t),u=Math.abs(n),d=t>0?"N":"S",a=n>0?"E":"W";let _;r=="DD"&&(_=`${l}° ${d}, ${u}° ${a}`);const x=Math.floor(l),S=Math.floor(u),k=(l-x)*60,C=(u-S)*60;if(r=="DM"){let P=w0(k,3).toFixed(3).padStart(6,"0"),D=w0(C,3).toFixed(3).padStart(6,"0");P.endsWith(".000")&&D.endsWith(".000")&&(P=P.replace(/\.000$/,""),D=D.replace(/\.000$/,"")),_=`${x}° ${P}' ${d}, ${S}° ${D}' ${a}`}if(r=="DMS"){const P=Math.floor(k),D=Math.floor(C);let N=((k-P)*60).toFixed(1).padStart(4,"0"),z=((C-D)*60).toFixed(1).padStart(4,"0");const B=P.toString().padStart(2,"0"),O=D.toString().padStart(2,"0");N.endsWith(".0")&&z.endsWith(".0")&&(N=N.replace(/\.0$/,""),z=z.replace(/\.0$/,"")),_=`${x}° ${B}' ${N}" ${d}, ${S}° ${O}' ${z}" ${a}`}return _}else throw new Error("no decimal coordinates to convert")}function w0(r,e){const t=Math.pow(10,e);return Math.round((r+Number.EPSILON)*t)/t}function zg(r,e){e||(e=5),r=r.replace(/\s+/g," ").trim();let t=null,n=null,l="",u="",d=null,a=[],_=!1;if(pT.test(r))throw new Error("invalid coordinate value");if(g0.test(r))if(a=g0.exec(r),_=Nu(a),_)t=Math.abs(a[1])+a[2]/60,Number(a[1])<0&&(t*=-1),n=Math.abs(a[3])+a[4]/60,Number(a[3])<0&&(n*=-1),d="DM";else throw new Error("invalid coordinate format");else if(_0.test(r))if(a=_0.exec(r),_=Nu(a),_){if(t=a[2],n=a[6],t.includes(",")&&(t=t.replace(",",".")),n.includes(",")&&(n=n.replace(",",".")),d="DD",Number(Math.round(t))==Number(t))throw new Error("integer only coordinate provided");if(Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");a[1]?(l=a[1],u=a[5]):a[4]&&(l=a[4],u=a[8])}else throw new Error("invalid decimal coordinate format");else if(y0.test(r))if(a=y0.exec(r),_=Nu(a),_)t=Math.abs(parseInt(a[2])),a[4]&&(t+=a[4]/60,d="DM"),a[6]&&(t+=a[6].replace(",",".")/3600,d="DMS"),parseInt(a[2])<0&&(t=-1*t),n=Math.abs(parseInt(a[9])),a[11]&&(n+=a[11]/60),a[13]&&(n+=a[13].replace(",",".")/3600),parseInt(a[9])<0&&(n=-1*n),a[1]?(l=a[1],u=a[8]):a[7]&&(l=a[7],u=a[14]);else throw new Error("invalid DMS coordinates format");else if(v0.test(r))if(a=v0.exec(r),_=Nu(a),_)t=Math.abs(parseInt(a[2])),a[4]&&(t+=a[4]/60,d="DM"),a[6]&&(t+=a[6]/3600,d="DMS"),parseInt(a[2])<0&&(t=-1*t),n=Math.abs(parseInt(a[10])),a[12]&&(n+=a[12]/60),a[14]&&(n+=a[14]/3600),parseInt(a[10])<0&&(n=-1*n),a[1]?(l=a[1],u=a[9]):a[8]&&(l=a[8],u=a[16]);else throw new Error("invalid DMS coordinates format");else if(b0.test(r)){if(a=b0.exec(r),_=Nu(a),a.filter(x=>x).length<=5)throw new Error("invalid coordinates format");if(_)t=Math.abs(parseInt(a[2])),a[4]&&(t+=a[4].replace(",",".")/60,d="DM"),a[6]&&(t+=a[6].replace(",",".")/3600,d="DMS"),parseInt(a[2])<0&&(t=-1*t),n=Math.abs(parseInt(a[10])),a[12]&&(n+=a[12].replace(",",".")/60),a[14]&&(n+=a[14].replace(",",".")/3600),parseInt(a[10])<0&&(n=-1*n),a[1]?(l=a[1],u=a[9]):a[8]&&(l=a[8],u=a[16]);else throw new Error("invalid coordinates format")}if(_){if(Math.abs(n)>=180)throw new Error("invalid longitude value");if(Math.abs(t)>=90)throw new Error("invalid latitude value");if(l&&!u||!l&&u)throw new Error("invalid coordinates value");if(l&&l==u)throw new Error("invalid coordinates format");t.toString().includes(",")&&(t=t.replace(",",".")),n.toString().includes(",")&&(n=n.replace(",","."));let x=/S|SOUTH/i;x.test(l)&&t>0&&(t=-1*t),x=/W|WEST/i,x.test(u)&&n>0&&(n=-1*n);const S=a[0].trim();let k,C;const P=/[,/;\u0020]/g,D=S.match(P);if(D==null){const B=Math.floor(r.length/2);k=S.substring(0,B).trim(),C=S.substring(B).trim()}else{let B;D.length%2==1?B=Math.floor(D.length/2):B=D.length/2-1;let O=0;if(B==0)O=S.indexOf(D[0]),k=S.substring(0,O).trim(),C=S.substring(O+1).trim();else{let G=0,U=0;for(;G<=B;)O=S.indexOf(D[G],U),U=O+1,G++;k=S.substring(0,O).trim(),C=S.substring(O+1).trim()}}const N=k.split(".");if(N.length==2&&N[1]==0&&N[1].length!=2)throw new Error("invalid coordinates format");const z=C.split(".");if(z.length==2&&z[1]==0&&z[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(k)||/^\d+$/.test(C))throw new Error("degree only coordinate/s provided");return t=Number(Number(t).toFixed(e)),n=Number(Number(n).toFixed(e)),Object.freeze({verbatimCoordinates:S,verbatimLatitude:k,verbatimLongitude:C,decimalLatitude:t,decimalLongitude:n,decimalCoordinates:`${t},${n}`,originalFormat:d,closeEnough:gT,toCoordinateFormat:mT})}else throw new Error("coordinates pattern match failed")}function Nu(r){if(!isNaN(r[0]))return!1;const e=[...r];if(e.shift(),e.length%2>0)return!1;const t=/^[-+]?\d+([\.,]\d+)?$/,n=/[eastsouthnorthwest]+/i,l=e.length/2;for(let u=0;u{e.decimalLatitude?r.push(e):r.push({...e,...vT})}),[...r,...bT,...wT]}const ST=xT();zg.formats=ST.map(r=>r.verbatimCoordinates);const kT=zg;function S0(r,e,t){const n=r.slice();return n[84]=e[t],n[86]=t,n}function k0(r){let e,t;return e=new iT({}),{c(){da(e.$$.fragment)},m(n,l){Ds(e,n,l),t=!0},i(n){t||(Zn(e.$$.fragment,n),t=!0)},o(n){ui(e.$$.fragment,n),t=!1},d(n){Rs(e,n)}}}function T0(r){let e,t,n,l,u;return t=new cT({}),{c(){e=Kr("button"),da(t.$$.fragment),ot(e,"type","button"),ot(e,"title",r[9]),ot(e,"class","svelte-bz0zu3"),Ao(e,"active",r[0])},m(d,a){vn(d,e,a),Ds(t,e,null),n=!0,l||(u=Zi(e,"click",r[69]),l=!0)},p(d,a){(!n||a[0]&512)&&ot(e,"title",d[9]),(!n||a[0]&1)&&Ao(e,"active",d[0])},i(d){n||(Zn(t.$$.fragment,d),n=!0)},o(d){ui(t.$$.fragment,d),n=!1},d(d){d&&gn(e),Rs(t),l=!1,u()}}}function TT(r){let e,t=[],n=new Map,l,u,d,a=p0(r[14]);const _=x=>x[84].id+(x[84].address?","+x[84].address:"");for(let x=0;x{X=null}),Hf()),(!G||ft[0]&2)&&Ao(x,"displayable",Me[1]!==""),Me[5]==="button"?Y?(Y.p(Me,ft),ft[0]&32&&Zn(Y,1)):(Y=T0(Me),Y.c(),Zn(Y,1),Y.m(n,D)):Y&&(Zf(),ui(Y,1,1,()=>{Y=null}),Hf()),ze&&ze.p&&(!G||ft[1]&536870912)&&C3(ze,_e,Me,Me[60],G?M3(_e,Me[60],ft,null):I3(Me[60]),null);let Ct=z;z=Ze(Me),z===Ct?~z&&ce[z].p(Me,ft):(B&&(Zf(),ui(ce[Ct],1,1,()=>{ce[Ct]=null}),Hf()),~z?(B=ce[z],B?B.p(Me,ft):(B=ce[z]=re[z](Me),B.c()),Zn(B,1),B.m(t,null)):B=null),(!G||ft[0]&4&&O!==(O=u0(Me[2])+" svelte-bz0zu3"))&&ot(t,"class",O),(!G||ft[0]&22)&&Ao(t,"can-collapse",Me[4]&&Me[1]==="")},i(Me){G||(Zn(me),Zn(u.$$.fragment,Me),Zn(k.$$.fragment,Me),Zn(X),Zn(Y),Zn(ze,Me),Zn(B),G=!0)},o(Me){ui(me),ui(u.$$.fragment,Me),ui(k.$$.fragment,Me),ui(X),ui(Y),ui(ze,Me),ui(B),G=!1},d(Me){Me&&(gn(e),gn(t)),Rs(u),r[63](null),Rs(k),X&&X.d(),Y&&Y.d(),ze&&ze.d(Me),~z&&ce[z].d(),U=!1,Bs(K)}}}function AT(r,e,t){let n,l,{$$slots:u={},$$scope:d}=e;const a={continental_marine:4,country:4,major_landform:8,region:5,subregion:6,county:7,joint_municipality:8,joint_submunicipality:9,municipality:10,municipal_district:11,locality:12,neighbourhood:13,place:14,postal_code:14,road:16,poi:17,address:18,"poi.peak":15,"poi.shop":18,"poi.cafe":18,"poi.restaurant":18,"poi.aerodrome":13};let{class:_=void 0}=e,{apiKey:x}=e,{bbox:S=void 0}=e,{clearButtonTitle:k="clear"}=e,{clearOnBlur:C=!1}=e,{collapsed:P=!1}=e,{country:D=void 0}=e,{debounceSearch:N=200}=e,{enableReverse:z="never"}=e,{errorMessage:B="Something went wrong…"}=e,{filter:O=()=>!0}=e,{flyTo:G=!0}=e,{fuzzyMatch:U=!0}=e,{language:K=void 0}=e,{limit:me=void 0}=e,{mapController:X=void 0}=e,{minLength:Y=2}=e,{noResultsMessage:_e="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=e,{placeholder:ze="Search"}=e,{proximity:re=[{type:"server-geolocation"}]}=e,{reverseActive:ce=z==="always"}=e,{reverseButtonTitle:Ze="toggle reverse geocoding"}=e,{searchValue:Me=""}=e,{pickedResultStyle:ft="full-geometry"}=e,{showPlaceType:Ct="if-needed"}=e,{showResultsWhileTyping:Ot=!0}=e,{selectFirst:Ke=!0}=e,{flyToSelected:Kt=!1}=e,{markerOnSelected:vt=!0}=e,{types:At=void 0}=e,{exhaustiveReverseGeocoding:Vt=!1}=e,{excludeTypes:sr=!1}=e,{zoom:fr=a}=e,{apiUrl:er="https://api.maptiler.com/geocoding"}=e,{fetchParameters:Nt={}}=e,{iconsBaseUrl:nr="https://cdn.maptiler.com/maptiler-geocoding-control/v2.0.1/icons/"}=e,{adjustUrlQuery:tr=()=>{}}=e;function Lr(){We.focus()}function Pr(){We.blur()}function st(W,Be=!0,Fe=!1){t(1,Me=W),Be?(t(15,Ye=-1),ct()):(Jt(!Fe,Fe),setTimeout(()=>{We.focus(),We.select()}))}function Lt(){t(14,tt=void 0),t(56,ne=void 0),t(15,Ye=-1)}function De(){t(55,it=[]),t(56,ne=void 0)}let at=!1,tt,it,ne,br="",We,Ye=-1,jt,bn=[],wn,Mn,ni,ii;const $o=new Set,Jr=R3();D3(()=>{X&&(X.setEventHandler(void 0),X.indicateReverse(!1),X.setSelectedMarker(-1),X.setFeatures(void 0,void 0,!1))});function ct(W){if(Mn&&(clearTimeout(Mn),Mn=void 0),Ye>-1&&tt)t(56,ne=tt[Ye]),t(1,Me=ne.place_type[0]==="reverse"?ne.place_name:ne.place_name.replace(/,.*/,"")),t(18,jt=void 0),t(55,it=void 0),t(15,Ye=-1);else if(Me){const Be=W||!Xn(Me);xn(Me,{exact:!0}).then(()=>{t(55,it=tt),t(56,ne=void 0),Be&&Bo()}).catch(Fe=>t(18,jt=Fe))}}function Xn(W){try{return kT(W,6)}catch{return!1}}async function xn(W,{byId:Be=!1,exact:Fe=!1}={}){t(18,jt=void 0),wn==null||wn.abort();const qe=new AbortController;t(19,wn=qe);try{const Xe=Xn(W),ut=new URLSearchParams;if(K!==void 0&&ut.set("language",Array.isArray(K)?K.join(","):K??""),At&&ut.set("types",At.join(",")),sr&&ut.set("excludeTypes",String(sr)),S&&ut.set("bbox",S.map(gr=>gr.toFixed(6)).join(",")),D&&ut.set("country",Array.isArray(D)?D.join(","):D),!Be&&!Xe){const gr=await dT(X,re,qe);gr&&ut.set("proximity",gr),(Fe||!Ot)&&ut.set("autocomplete","false"),ut.set("fuzzyMatch",String(U))}me!==void 0&&(Vt||!Xe||(At==null?void 0:At.length)===1)&&ut.set("limit",String(me)),ut.set("key",x),tr(ut);const Pt=er+"/"+encodeURIComponent(Xe?Xe.decimalLongitude+","+Xe.decimalLatitude:W)+".json?"+ut.toString();if(Pt===br){Be?(t(14,tt=void 0),t(56,ne=bn[0])):t(14,tt=bn);return}br=Pt;const $t=await fetch(Pt,{signal:qe.signal,...Nt});if(!$t.ok)throw new Error(await $t.text());const ar=await $t.json();Jr("response",{url:Pt,featureCollection:ar}),Be?(t(14,tt=void 0),t(56,ne=ar.features[0]),bn=[ne]):(t(14,tt=ar.features.filter(O)),Xe&&tt.unshift({type:"Feature",properties:{},id:"reverse_"+Xe.decimalLongitude+"_"+Xe.decimalLatitude,text:Xe.decimalLatitude+", "+Xe.decimalLongitude,place_name:Xe.decimalLatitude+", "+Xe.decimalLongitude,place_type:["reverse"],center:[Xe.decimalLongitude,Xe.decimalLatitude],bbox:[Xe.decimalLongitude,Xe.decimalLatitude,Xe.decimalLongitude,Xe.decimalLatitude],geometry:{type:"Point",coordinates:[Xe.decimalLongitude,Xe.decimalLatitude]}}),bn=tt,Xe&&We.focus())}catch(Xe){if(Xe&&typeof Xe=="object"&&"name"in Xe&&Xe.name==="AbortError")return;throw Xe}finally{qe===wn&&t(19,wn=void 0)}}function Bo(){var W;if(!(it!=null&&it.length)||!G)return;const Be=[180,90,-180,-90],Fe=!it.some(Xe=>!Xe.matching_text);let qe;for(const Xe of it){const ut=Or(Xe);if(qe=qe===void 0?ut:ut===void 0?qe:Math.max(qe,ut),Fe||!Xe.matching_text)for(const Pt of[0,1,2,3])Be[Pt]=Math[Pt<2?"min":"max"](Be[Pt],((W=Xe.bbox)==null?void 0:W[Pt])??Xe.center[Pt%2])}X&&it.length>0&&(ne&&Be[0]===Be[2]&&Be[1]===Be[3]?X.flyTo(ne.center,Or(ne)):X.fitBounds(dd(Be),50,qe))}function Or(W){var Be;if(!W.bbox||W.bbox[0]!==W.bbox[2]&&W.bbox[1]!==W.bbox[3])return;const Fe=W.id.replace(/\..*/,"");return(Array.isArray((Be=W.properties)==null?void 0:Be.categories)?W.properties.categories.reduce((qe,Xe)=>{const ut=fr[Fe+"."+Xe];return qe===void 0?ut:ut===void 0?qe:Math.max(qe,ut)},void 0):void 0)??fr[Fe]}function mt(W){t(0,ce=z==="always"),t(14,tt=void 0),t(56,ne=void 0),t(15,Ye=-1),st(W[1].toFixed(6)+", "+fT(W[0],[-180,180],!0).toFixed(6),!1,!0)}function rr(W){if(!tt)return;let Be=W.key==="ArrowDown"?1:W.key==="ArrowUp"?-1:0;Be&&(Ye===(Ke?0:-1)&&Be===-1&&t(15,Ye=tt.length),t(15,Ye+=Be),Ye>=tt.length&&t(15,Ye=-1),Ye<0&&Ke&&t(15,Ye=0),W.preventDefault())}function Jt(W=!0,Be=!1){if(t(18,jt=void 0),Ot||Be){if(Mn&&clearTimeout(Mn),Me.length{xn(Fe).catch(qe=>t(18,jt=qe))},W?N:0)}else t(14,tt=void 0),t(18,jt=void 0)}function Nr(W){t(56,ne=W),t(1,Me=W.place_name),t(15,Ye=-1)}const vi=()=>We.focus();function Qt(W){Nm[W?"unshift":"push"](()=>{We=W,t(17,We)})}function ro(){Me=this.value,t(1,Me),t(13,at),t(28,C)}const an=()=>t(13,at=!0),pe=()=>t(13,at=!1),Z=()=>Jt(),$=()=>{t(1,Me=""),We.focus()},te=()=>t(0,ce=!ce),le=()=>t(18,jt=void 0),Ce=W=>t(15,Ye=W),Ie=W=>Nr(W),Pe=()=>{Ke||t(15,Ye=-1)},Se=()=>{};return r.$$set=W=>{"class"in W&&t(2,_=W.class),"apiKey"in W&&t(26,x=W.apiKey),"bbox"in W&&t(27,S=W.bbox),"clearButtonTitle"in W&&t(3,k=W.clearButtonTitle),"clearOnBlur"in W&&t(28,C=W.clearOnBlur),"collapsed"in W&&t(4,P=W.collapsed),"country"in W&&t(29,D=W.country),"debounceSearch"in W&&t(30,N=W.debounceSearch),"enableReverse"in W&&t(5,z=W.enableReverse),"errorMessage"in W&&t(6,B=W.errorMessage),"filter"in W&&t(31,O=W.filter),"flyTo"in W&&t(32,G=W.flyTo),"fuzzyMatch"in W&&t(33,U=W.fuzzyMatch),"language"in W&&t(34,K=W.language),"limit"in W&&t(35,me=W.limit),"mapController"in W&&t(36,X=W.mapController),"minLength"in W&&t(37,Y=W.minLength),"noResultsMessage"in W&&t(7,_e=W.noResultsMessage),"placeholder"in W&&t(8,ze=W.placeholder),"proximity"in W&&t(38,re=W.proximity),"reverseActive"in W&&t(0,ce=W.reverseActive),"reverseButtonTitle"in W&&t(9,Ze=W.reverseButtonTitle),"searchValue"in W&&t(1,Me=W.searchValue),"pickedResultStyle"in W&&t(39,ft=W.pickedResultStyle),"showPlaceType"in W&&t(10,Ct=W.showPlaceType),"showResultsWhileTyping"in W&&t(40,Ot=W.showResultsWhileTyping),"selectFirst"in W&&t(11,Ke=W.selectFirst),"flyToSelected"in W&&t(41,Kt=W.flyToSelected),"markerOnSelected"in W&&t(42,vt=W.markerOnSelected),"types"in W&&t(43,At=W.types),"exhaustiveReverseGeocoding"in W&&t(44,Vt=W.exhaustiveReverseGeocoding),"excludeTypes"in W&&t(45,sr=W.excludeTypes),"zoom"in W&&t(46,fr=W.zoom),"apiUrl"in W&&t(47,er=W.apiUrl),"fetchParameters"in W&&t(48,Nt=W.fetchParameters),"iconsBaseUrl"in W&&t(12,nr=W.iconsBaseUrl),"adjustUrlQuery"in W&&t(49,tr=W.adjustUrlQuery),"$$scope"in W&&t(60,d=W.$$scope)},r.$$.update=()=>{if(r.$$.dirty[0]&32&&t(0,ce=z==="always"),r.$$.dirty[0]&268443648&&setTimeout(()=>{t(16,ni=at),C&&!at&&t(1,Me="")}),r.$$.dirty[0]&16386|r.$$.dirty[1]&64&&Me.lengtht(18,jt=W)),r.$$.dirty[1]&100663330&&(X&&ne&&ne.id!==ii&&G&&(!ne.bbox||ne.bbox[0]===ne.bbox[2]&&ne.bbox[1]===ne.bbox[3]?X.flyTo(ne.center,Or(ne)):X.fitBounds(dd(ne.bbox),50,Or(ne)),t(14,tt=void 0),t(55,it=void 0),t(15,Ye=-1)),t(57,ii=ne==null?void 0:ne.id)),r.$$.dirty[0]&18432&&Ke&&tt!=null&&tt.length&&t(15,Ye=0),r.$$.dirty[0]&2&&t(15,Ye=-1),r.$$.dirty[0]&16384|r.$$.dirty[1]&16777216&&it!==tt&&t(55,it=void 0),r.$$.dirty[0]&81921|r.$$.dirty[1]&16777248&&X&&X.setEventHandler(W=>{switch(W.type){case"mapClick":ce&&mt(W.coordinates);break;case"markerClick":{const Be=tt==null?void 0:tt.find(Fe=>Fe.id===W.id);Be&&Nr(Be)}break;case"markerMouseEnter":it&&t(15,Ye=ni?(tt==null?void 0:tt.findIndex(Be=>Be.id===W.id))??-1:-1);break;case"markerMouseLeave":it&&t(15,Ye=-1);break}}),r.$$.dirty[0]&49152&&t(58,l=tt==null?void 0:tt[Ye]),r.$$.dirty[1]&134218786&&X&&l&&G&&Kt&&X.flyTo(l.center,Or(l)),r.$$.dirty[1]&256&&t(59,n=ft==="full-geometry-including-polygon-center-marker"),r.$$.dirty[1]&268437536&&(vt||X==null||X.setFeatures(void 0,void 0,n)),r.$$.dirty[1]&419432480&&X&&vt&&!it&&(X.setFeatures(l?[l]:void 0,void 0,n),X.setSelectedMarker(l?0:-1)),r.$$.dirty[1]&318767136&&X&&X.setFeatures(it,ne,n),r.$$.dirty[0]&32768|r.$$.dirty[1]&16777248&&it&&X&&X.setSelectedMarker(Ye),r.$$.dirty[0]&2|r.$$.dirty[1]&32&&X){const W=Xn(Me);X.setReverseMarker(W?[W.decimalLongitude,W.decimalLatitude]:void 0)}r.$$.dirty[1]&134217728&&Jr("select",{feature:l}),r.$$.dirty[1]&33554432&&Jr("pick",{feature:ne}),r.$$.dirty[0]&81920&&Jr("optionsvisibilitychange",{optionsVisible:ni&&!!tt}),r.$$.dirty[0]&16384&&Jr("featureslisted",{features:tt}),r.$$.dirty[1]&16777216&&Jr("featuresmarked",{features:it}),r.$$.dirty[0]&1&&Jr("reversetoggle",{reverse:ce}),r.$$.dirty[0]&2&&Jr("querychange",{query:Me}),r.$$.dirty[0]&1|r.$$.dirty[1]&32&&X&&X.indicateReverse(ce)},[ce,Me,_,k,P,z,B,_e,ze,Ze,Ct,Ke,nr,at,tt,Ye,ni,We,jt,wn,$o,ct,rr,Jt,Nr,a,x,S,C,D,N,O,G,U,K,me,X,Y,re,ft,Ot,Kt,vt,At,Vt,sr,fr,er,Nt,tr,Lr,Pr,st,Lt,De,it,ne,ii,l,n,d,u,vi,Qt,ro,an,pe,Z,$,te,le,Ce,Ie,Pe,Se]}let LT=class extends ya{constructor(r){super(),_a(this,r,AT,IT,ga,{ZOOM_DEFAULTS:25,class:2,apiKey:26,bbox:27,clearButtonTitle:3,clearOnBlur:28,collapsed:4,country:29,debounceSearch:30,enableReverse:5,errorMessage:6,filter:31,flyTo:32,fuzzyMatch:33,language:34,limit:35,mapController:36,minLength:37,noResultsMessage:7,placeholder:8,proximity:38,reverseActive:0,reverseButtonTitle:9,searchValue:1,pickedResultStyle:39,showPlaceType:10,showResultsWhileTyping:40,selectFirst:11,flyToSelected:41,markerOnSelected:42,types:43,exhaustiveReverseGeocoding:44,excludeTypes:45,zoom:46,apiUrl:47,fetchParameters:48,iconsBaseUrl:12,adjustUrlQuery:49,focus:50,blur:51,setQuery:52,clearList:53,clearMap:54},null,[-1,-1,-1])}get ZOOM_DEFAULTS(){return this.$$.ctx[25]}get focus(){return this.$$.ctx[50]}get blur(){return this.$$.ctx[51]}get setQuery(){return this.$$.ctx[52]}get clearList(){return this.$$.ctx[53]}get clearMap(){return this.$$.ctx[54]}};function gh(r,e,t={}){const n={type:"Feature"};return(t.id===0||t.id)&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.properties=e||{},n.geometry=r,n}function Dg(r,e,t={}){for(const n of r){if(n.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(n[n.length-1].length!==n[0].length)throw new Error("First and last Position are not equivalent.");for(let l=0;l{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function ak(r,e,t){let n;return wt(r,hd,d=>t(0,n=d)),[n,d=>dn(d).close(),()=>Rt(hd,n=!1,n)]}class lk extends Ht{constructor(e){super(),Zt(this,e,ak,sk,Ut,{})}}const ck="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAk0lEQVRIS+3U0Q2AIAwEUNjMUXQydRJH0zZB0wjGuwJfSsKfuWfO1hg6n9g5P3wPWKTSXe6EVstUNEjoloIVghAG0OxR7swgLEAjHoBCvACM1AAQUgJ0DL0nm67WwJom7XrBlhVl4arUAHYniuE1ABTuBeBwD0CFs4D92T12fp9v9iPrnJ8LBu0KC0Ch9qEfeK3sAPceHxk8hJ17AAAAAElFTkSuQmCC",uk="/ltn/assets/logo-97f2d067.svg";let hk=Date.now();function Dc(r){return`${r}-${hk++}`}const Ag=Symbol.for("svelte-maplibre");function nl(){return Ib(Ag)}function fk(r){let e=new WeakMap;return t=>{var d;let n=e.get(t.originalEvent);if(n!==void 0)return n;let u=(d=t.target.queryRenderedFeatures(t.point).find(a=>{var _;return(_=r.get(a.layer.id))==null?void 0:_.interactive}))==null?void 0:d.layer.id;return e.set(t.originalEvent,u),u}}function dk(){let r=new Map;return xg(Ag,{map:Tr(null),source:Yp(null),layer:Yp(null),popupTarget:Yp(null),cluster:Tr(),loadedImages:Tr(new Set),minzoom:Tr(0),maxzoom:Tr(24),layerEvent:Tr(null),layerInfo:r,eventTopMost:fk(r),markerClickManager:new yk})}function $y(r){return{subscribe:r.subscribe}}function Lg({key:r,setPopupTarget:e=!1,setCluster:t=!1,setMouseEvent:n=!1}){let l=nl(),u=Tr(null),d=$y(u),a={...l,[r]:$y(u)};if(e&&(a.popupTarget=d),n){let _=Tr(null);a.layerEvent=_,l.layerEvent=_}return t&&(a.cluster=Tr()),xg(Ag,a),{...l,self:u}}function pk(){return Lg({key:"source",setCluster:!0})}function mk(r=!0){return Lg({key:"layer",setPopupTarget:r,setMouseEvent:r})}function gk(){return Lg({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function _k(r){return"layerType"in r&&r.layerType==="deckgl"}class yk{constructor(){Wn(this,"_handlers",new Set)}add(e){this._handlers.add(e)}remove(e){this._handlers.delete(e)}handleClick(e){for(const t of this._handlers)t(e)}}function Xy(r){let e;return t=>{if(t)for(let n in t){let l=e==null?void 0:e[n],u=t[n];l!==u&&r(n,u,l)}else if(e)for(let n in e)r(n,void 0,e[n]);e=t}}function vk(r,...e){let t=[r];for(let n of e)if(n)Array.isArray(n)&&n[0]===r?t.push(...n.slice(1)):t.push(n);else continue;if(t.length!==1)return t.length===2?t[1]:t}function bk(r){return r===!0?["has","point_count"]:r===!1?["!",["has","point_count"]]:void 0}function kc(r,e){return["case",["boolean",["feature-state","hover"],!1],e,r]}var rl=wk;function wk(r){var e,t,n;if(r){if(Array.isArray(r)){for(e=[],t=r.length,n=0;n{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function Sk(r,e,t){let n,l,u,d,a,_,x,S,k,C,P,D,{$$slots:N={},$$scope:z}=e,{id:B=Dc("layer")}=e,{source:O=void 0}=e,{sourceLayer:G=void 0}=e,{beforeId:U=void 0}=e,{beforeLayerType:K=void 0}=e,{type:me}=e,{paint:X=void 0}=e,{layout:Y=void 0}=e,{filter:_e=void 0}=e,{applyToClusters:ze=void 0}=e,{minzoom:re=void 0}=e,{maxzoom:ce=void 0}=e,{manageHoverState:Ze=!1}=e,{hovered:Me=null}=e,{interactive:ft=!0}=e,{hoverCursor:Ct=void 0}=e,{eventsIfTopMost:Ot=!1}=e;const Ke=us(),{map:Kt,source:vt,self:At,minzoom:Vt,maxzoom:sr,eventTopMost:fr,layerInfo:er}=mk();wt(r,Kt,De=>t(31,k=De)),wt(r,vt,De=>t(32,C=De)),wt(r,At,De=>t(0,S=De)),wt(r,Vt,De=>t(34,D=De)),wt(r,sr,De=>t(33,P=De)),ti(()=>{S&&k&&(er.delete(S),k==null||k.removeLayer(S))});let Nt;function nr(De){var ne,br;if(!ft||!S||!k||Ot&&fr(De)!==S)return;let at=De.features??[],tt=(br=(ne=at[0])==null?void 0:ne.properties)==null?void 0:br.cluster_id,it={event:De,map:k,clusterId:tt,layer:S,source:a,features:at};Ke(De.type,it)}function tr(De){var ne,br;if(!ft||!S||!k||Ot&&fr(De)!==S)return;Ct&&(k.getCanvas().style.cursor=Ct);let at=De.features??[];t(6,Me=at[0]??null);let tt=(br=(ne=at[0])==null?void 0:ne.properties)==null?void 0:br.cluster_id;Ke("mouseenter",{event:De,map:k,clusterId:tt,layer:S,source:a,features:at})}function Lr(De){var ne,br,We;if(!ft||!k)return;if(Ot&&fr(De)!==S){t(6,Me=null),Ze&&Nt!==void 0&&(k==null||k.setFeatureState({source:a,sourceLayer:G,id:Nt},{hover:!1}),Nt=void 0);return}k.getCanvas().style.cursor=Ct;let at=De.features??[],tt=(br=(ne=at[0])==null?void 0:ne.properties)==null?void 0:br.cluster_id,it=(We=at[0])==null?void 0:We.id;it!==Nt&&(Ze&&(Nt!==void 0&&(k==null||k.setFeatureState({source:a,id:Nt,sourceLayer:G},{hover:!1})),k==null||k.setFeatureState({source:a,id:it,sourceLayer:G},{hover:!0})),Nt=it,t(6,Me=at[0]??null)),Ke("mousemove",{event:De,map:k,clusterId:tt,layer:S,source:a,features:at})}function Pr(De){if(!(!ft||!S||!k)){if(Ct&&(k.getCanvas().style.cursor=""),t(6,Me=null),Ze&&Nt!==void 0){const at={source:a,id:Nt,sourceLayer:G};k==null||k.setFeatureState(at,{hover:!1}),Nt=void 0}Ke("mouseleave",{map:k,layer:S,source:a})}}let st=!0;function Lt(De){k&&(k.off("click",De,nr),k.off("dblclick",De,nr),k.off("contextmenu",De,nr),k.off("mouseenter",De,tr),k.off("mousemove",De,Lr),k.off("mouseleave",De,Pr))}return ti(()=>{k&&S&&Lt(S)}),r.$$set=De=>{"id"in De&&t(7,B=De.id),"source"in De&&t(8,O=De.source),"sourceLayer"in De&&t(9,G=De.sourceLayer),"beforeId"in De&&t(10,U=De.beforeId),"beforeLayerType"in De&&t(11,K=De.beforeLayerType),"type"in De&&t(12,me=De.type),"paint"in De&&t(13,X=De.paint),"layout"in De&&t(14,Y=De.layout),"filter"in De&&t(15,_e=De.filter),"applyToClusters"in De&&t(16,ze=De.applyToClusters),"minzoom"in De&&t(17,re=De.minzoom),"maxzoom"in De&&t(18,ce=De.maxzoom),"manageHoverState"in De&&t(19,Ze=De.manageHoverState),"hovered"in De&&t(6,Me=De.hovered),"interactive"in De&&t(20,ft=De.interactive),"hoverCursor"in De&&t(21,Ct=De.hoverCursor),"eventsIfTopMost"in De&&t(22,Ot=De.eventsIfTopMost),"$$scope"in De&&t(35,z=De.$$scope)},r.$$.update=()=>{if(r.$$.dirty[0]&65536&&t(30,n=bk(ze)),r.$$.dirty[0]&1073774592&&t(24,l=vk("all",n,_e)),r.$$.dirty[0]&131072|r.$$.dirty[1]&8&&t(26,u=re??D),r.$$.dirty[0]&262144|r.$$.dirty[1]&4&&t(25,d=ce??P),r.$$.dirty[0]&256|r.$$.dirty[1]&2&&t(29,a=O||C),r.$$.dirty[0]&654343809|r.$$.dirty[1]&1&&k&&S!==B&&a){S&&(Lt(S),er.delete(S));let De=U;if(!U&&K){let at=k.getStyle().layers,tt=typeof K=="function"?K:ne=>ne.type===K,it=at==null?void 0:at.find(tt);it&&(De=it.id)}Rt(At,S=B,S),k.addLayer(rl({id:S,type:me,source:a,"source-layer":G,filter:l,paint:X,layout:Y,minzoom:u,maxzoom:d}),De),t(23,st=!0),k.on("click",S,nr),k.on("dblclick",S,nr),k.on("contextmenu",S,nr),k.on("mouseenter",S,tr),k.on("mousemove",S,Lr),k.on("mouseleave",S,Pr)}r.$$.dirty[0]&1048577&&S&&er.set(S,{interactive:ft}),r.$$.dirty[0]&1|r.$$.dirty[1]&1&&t(28,_=S?Xy((De,at)=>{k!=null&&k.style._loaded?k.setPaintProperty(S,De,at):k==null||k.once("styledata",()=>k==null?void 0:k.setPaintProperty(S,De,at))}):void 0),r.$$.dirty[0]&1|r.$$.dirty[1]&1&&t(27,x=S?Xy((De,at)=>{k!=null&&k.style._loaded?k.setLayoutProperty(S,De,at):k==null||k.once("styledata",()=>k==null?void 0:k.setLayoutProperty(S,De,at))}):void 0),r.$$.dirty[0]&268443648&&(_==null||_(X)),r.$$.dirty[0]&134234112&&(x==null||x(Y)),r.$$.dirty[0]&100663297|r.$$.dirty[1]&1&&S&&(k==null||k.setLayerZoomRange(S,u,d)),r.$$.dirty[0]&25165825|r.$$.dirty[1]&1&&S&&(st?t(23,st=!1):k==null||k.setFilter(S,l))},[S,Kt,vt,At,Vt,sr,Me,B,O,G,U,K,me,X,Y,_e,ze,re,ce,Ze,ft,Ct,Ot,st,l,d,u,x,_,a,n,k,C,P,D,z,N]}let Bd=class extends Ht{constructor(e){super(),Zt(this,e,Sk,xk,Ut,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}};function kk(r){let e;const t=r[16].default,n=Vr(t,r,r[24],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&16777216)&&Gr(n,t,l,l[24],e?qr(t,l[24],u,null):Wr(l[24]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function Tk(r){let e,t,n;function l(d){r[17](d)}let u={id:r[1],type:"circle",source:r[2],sourceLayer:r[3],beforeId:r[4],beforeLayerType:r[5],paint:r[6],layout:r[7],filter:r[8],applyToClusters:r[9],minzoom:r[10],maxzoom:r[11],hoverCursor:r[12],manageHoverState:r[13],eventsIfTopMost:r[14],interactive:r[15],$$slots:{default:[kk]},$$scope:{ctx:r}};return r[0]!==void 0&&(u.hovered=r[0]),e=new Bd({props:u}),pn.push(()=>zo(e,"hovered",l)),e.$on("click",r[18]),e.$on("dblclick",r[19]),e.$on("contextmenu",r[20]),e.$on("mouseenter",r[21]),e.$on("mousemove",r[22]),e.$on("mouseleave",r[23]),{c(){je(e.$$.fragment)},m(d,a){Oe(e,d,a),n=!0},p(d,[a]){const _={};a&2&&(_.id=d[1]),a&4&&(_.source=d[2]),a&8&&(_.sourceLayer=d[3]),a&16&&(_.beforeId=d[4]),a&32&&(_.beforeLayerType=d[5]),a&64&&(_.paint=d[6]),a&128&&(_.layout=d[7]),a&256&&(_.filter=d[8]),a&512&&(_.applyToClusters=d[9]),a&1024&&(_.minzoom=d[10]),a&2048&&(_.maxzoom=d[11]),a&4096&&(_.hoverCursor=d[12]),a&8192&&(_.manageHoverState=d[13]),a&16384&&(_.eventsIfTopMost=d[14]),a&32768&&(_.interactive=d[15]),a&16777216&&(_.$$scope={dirty:a,ctx:d}),!t&&a&1&&(t=!0,_.hovered=d[0],Po(()=>t=!1)),e.$set(_)},i(d){n||(oe(e.$$.fragment,d),n=!0)},o(d){de(e.$$.fragment,d),n=!1},d(d){Ne(e,d)}}}function Ek(r,e,t){let{$$slots:n={},$$scope:l}=e,{id:u=Dc("circle")}=e,{source:d=void 0}=e,{sourceLayer:a=void 0}=e,{beforeId:_=void 0}=e,{beforeLayerType:x=void 0}=e,{paint:S}=e,{layout:k=void 0}=e,{filter:C=void 0}=e,{applyToClusters:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:N=void 0}=e,{hoverCursor:z=void 0}=e,{manageHoverState:B=!1}=e,{hovered:O=null}=e,{eventsIfTopMost:G=!1}=e,{interactive:U=!0}=e;function K(ce){O=ce,t(0,O)}function me(ce){ur.call(this,r,ce)}function X(ce){ur.call(this,r,ce)}function Y(ce){ur.call(this,r,ce)}function _e(ce){ur.call(this,r,ce)}function ze(ce){ur.call(this,r,ce)}function re(ce){ur.call(this,r,ce)}return r.$$set=ce=>{"id"in ce&&t(1,u=ce.id),"source"in ce&&t(2,d=ce.source),"sourceLayer"in ce&&t(3,a=ce.sourceLayer),"beforeId"in ce&&t(4,_=ce.beforeId),"beforeLayerType"in ce&&t(5,x=ce.beforeLayerType),"paint"in ce&&t(6,S=ce.paint),"layout"in ce&&t(7,k=ce.layout),"filter"in ce&&t(8,C=ce.filter),"applyToClusters"in ce&&t(9,P=ce.applyToClusters),"minzoom"in ce&&t(10,D=ce.minzoom),"maxzoom"in ce&&t(11,N=ce.maxzoom),"hoverCursor"in ce&&t(12,z=ce.hoverCursor),"manageHoverState"in ce&&t(13,B=ce.manageHoverState),"hovered"in ce&&t(0,O=ce.hovered),"eventsIfTopMost"in ce&&t(14,G=ce.eventsIfTopMost),"interactive"in ce&&t(15,U=ce.interactive),"$$scope"in ce&&t(24,l=ce.$$scope)},[O,u,d,a,_,x,S,k,C,P,D,N,z,B,G,U,n,K,me,X,Y,_e,ze,re,l]}let Pg=class extends Ht{constructor(e){super(),Zt(this,e,Ek,Tk,Ut,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}};function Mk(r){let e;const t=r[15].default,n=Vr(t,r,r[23],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&8388608)&&Gr(n,t,l,l[23],e?qr(t,l[23],u,null):Wr(l[23]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function Ck(r){let e,t,n;function l(d){r[16](d)}let u={id:r[1],type:"fill",source:r[2],sourceLayer:r[3],beforeId:r[4],beforeLayerType:r[5],paint:r[6],layout:r[7],filter:r[8],minzoom:r[9],maxzoom:r[10],hoverCursor:r[11],manageHoverState:r[12],eventsIfTopMost:r[13],interactive:r[14],$$slots:{default:[Mk]},$$scope:{ctx:r}};return r[0]!==void 0&&(u.hovered=r[0]),e=new Bd({props:u}),pn.push(()=>zo(e,"hovered",l)),e.$on("click",r[17]),e.$on("dblclick",r[18]),e.$on("contextmenu",r[19]),e.$on("mouseenter",r[20]),e.$on("mousemove",r[21]),e.$on("mouseleave",r[22]),{c(){je(e.$$.fragment)},m(d,a){Oe(e,d,a),n=!0},p(d,[a]){const _={};a&2&&(_.id=d[1]),a&4&&(_.source=d[2]),a&8&&(_.sourceLayer=d[3]),a&16&&(_.beforeId=d[4]),a&32&&(_.beforeLayerType=d[5]),a&64&&(_.paint=d[6]),a&128&&(_.layout=d[7]),a&256&&(_.filter=d[8]),a&512&&(_.minzoom=d[9]),a&1024&&(_.maxzoom=d[10]),a&2048&&(_.hoverCursor=d[11]),a&4096&&(_.manageHoverState=d[12]),a&8192&&(_.eventsIfTopMost=d[13]),a&16384&&(_.interactive=d[14]),a&8388608&&(_.$$scope={dirty:a,ctx:d}),!t&&a&1&&(t=!0,_.hovered=d[0],Po(()=>t=!1)),e.$set(_)},i(d){n||(oe(e.$$.fragment,d),n=!0)},o(d){de(e.$$.fragment,d),n=!1},d(d){Ne(e,d)}}}function Ik(r,e,t){let{$$slots:n={},$$scope:l}=e,{id:u=Dc("fill")}=e,{source:d=void 0}=e,{sourceLayer:a=void 0}=e,{beforeId:_=void 0}=e,{beforeLayerType:x=void 0}=e,{paint:S}=e,{layout:k=void 0}=e,{filter:C=void 0}=e,{minzoom:P=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:N=void 0}=e,{manageHoverState:z=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:O=!1}=e,{interactive:G=!0}=e;function U(re){B=re,t(0,B)}function K(re){ur.call(this,r,re)}function me(re){ur.call(this,r,re)}function X(re){ur.call(this,r,re)}function Y(re){ur.call(this,r,re)}function _e(re){ur.call(this,r,re)}function ze(re){ur.call(this,r,re)}return r.$$set=re=>{"id"in re&&t(1,u=re.id),"source"in re&&t(2,d=re.source),"sourceLayer"in re&&t(3,a=re.sourceLayer),"beforeId"in re&&t(4,_=re.beforeId),"beforeLayerType"in re&&t(5,x=re.beforeLayerType),"paint"in re&&t(6,S=re.paint),"layout"in re&&t(7,k=re.layout),"filter"in re&&t(8,C=re.filter),"minzoom"in re&&t(9,P=re.minzoom),"maxzoom"in re&&t(10,D=re.maxzoom),"hoverCursor"in re&&t(11,N=re.hoverCursor),"manageHoverState"in re&&t(12,z=re.manageHoverState),"hovered"in re&&t(0,B=re.hovered),"eventsIfTopMost"in re&&t(13,O=re.eventsIfTopMost),"interactive"in re&&t(14,G=re.interactive),"$$scope"in re&&t(23,l=re.$$scope)},[B,u,d,a,_,x,S,k,C,P,D,N,z,O,G,n,U,K,me,X,Y,_e,ze,l]}let ma=class extends Ht{constructor(e){super(),Zt(this,e,Ik,Ck,Ut,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}};function Ak(r,e,t){let n;const{map:l}=nl();wt(r,l,_=>t(4,n=_));let{position:u="top-left"}=e,{container:d=void 0}=e,a=null;return ti(()=>{n!=null&&n.loaded()&&a&&n.removeControl(a)}),r.$$set=_=>{"position"in _&&t(1,u=_.position),"container"in _&&t(2,d=_.container)},r.$$.update=()=>{if(r.$$.dirty&30&&n&&!a){let _;typeof d=="string"?_=document.querySelector(d)??void 0:_=d,t(3,a=new to.FullscreenControl({container:_})),n.addControl(a,u)}},[l,u,d,a,n]}class Lk extends Ht{constructor(e){super(),Zt(this,e,Ak,null,Ut,{position:1,container:2})}}function Pk(r,e,t,n,l){let u=!1;r.getSource(e)&&(u=!0,r.removeSource(e));const d=()=>{n(e)&&(r.addSource(e,t),l())};if(u){const a=()=>{e&&(r.getSource(e)?setTimeout(a,1):d())};a()}else d()}function zk(r,e,t){Pb().then(()=>{let n=Hi(r);if(!n)return;n.getSource(e)===t&&n.removeSource(e)})}function Yy(r){let e=r[0],t,n,l=Qy(r);return{c(){l.c(),t=$n()},m(u,d){l.m(u,d),be(u,t,d),n=!0},p(u,d){d&1&&Ut(e,e=u[0])?(yr(),de(l,1,1,Mt),vr(),l=Qy(u),l.c(),oe(l,1),l.m(t.parentNode,t)):l.p(u,d)},i(u){n||(oe(l),n=!0)},o(u){de(l),n=!1},d(u){u&&ve(t),l.d(u)}}}function Qy(r){let e;const t=r[19].default,n=Vr(t,r,r[18],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&262144)&&Gr(n,t,l,l[18],e?qr(t,l[18],u,null):Wr(l[18]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function Dk(r){let e,t,n=r[0]&&Yy(r);return{c(){n&&n.c(),e=$n()},m(l,u){n&&n.m(l,u),be(l,e,u),t=!0},p(l,[u]){l[0]?n?(n.p(l,u),u&1&&oe(n,1)):(n=Yy(l),n.c(),oe(n,1),n.m(e.parentNode,e)):n&&(yr(),de(n,1,1,()=>{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function Rk(r,e,t){let n,l,u,{$$slots:d={},$$scope:a}=e,{id:_=Dc("geojson")}=e,{data:x}=e,{generateId:S=!1}=e,{promoteId:k=void 0}=e,{filter:C=void 0}=e,{lineMetrics:P=void 0}=e,{cluster:D=void 0}=e,{maxzoom:N=void 0}=e,{attribution:z=void 0}=e,{buffer:B=void 0}=e,{tolerance:O=void 0}=e;const{map:G,cluster:U,self:K}=pk();wt(r,G,Y=>t(17,l=Y)),wt(r,U,Y=>t(20,u=Y)),wt(r,K,Y=>t(0,n=Y));let me,X=!0;return ti(()=>{n&&me&&l&&(zk(G,n,me),Rt(K,n=null,n),t(15,me=void 0))}),r.$$set=Y=>{"id"in Y&&t(4,_=Y.id),"data"in Y&&t(5,x=Y.data),"generateId"in Y&&t(6,S=Y.generateId),"promoteId"in Y&&t(7,k=Y.promoteId),"filter"in Y&&t(8,C=Y.filter),"lineMetrics"in Y&&t(9,P=Y.lineMetrics),"cluster"in Y&&t(10,D=Y.cluster),"maxzoom"in Y&&t(11,N=Y.maxzoom),"attribution"in Y&&t(12,z=Y.attribution),"buffer"in Y&&t(13,B=Y.buffer),"tolerance"in Y&&t(14,O=Y.tolerance),"$$scope"in Y&&t(18,a=Y.$$scope)},r.$$.update=()=>{r.$$.dirty&1024&&Rt(U,u=D,u),r.$$.dirty&196593&&l&&n!==_&&(Rt(K,n=_,n),Pk(l,n,rl({type:"geojson",data:x,filter:C,lineMetrics:P,generateId:S,promoteId:k,cluster:!!D,clusterMinPoints:D==null?void 0:D.minPoints,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius,clusterProperties:D==null?void 0:D.properties,maxzoom:N,attribution:z,buffer:B,tolerance:O}),Y=>l&&Y===n,()=>{n&&(t(15,me=l==null?void 0:l.getSource(n)),t(16,X=!0))})),r.$$.dirty&131088&&(l==null||l.on("style.load",()=>{t(15,me=l==null?void 0:l.getSource(_))})),r.$$.dirty&98336&&me&&(X?t(16,X=!1):me.setData(x)),r.$$.dirty&33792&&(me==null||me.setClusterOptions(rl({cluster:!!D,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius})))},[n,G,U,K,_,x,S,k,C,P,D,N,z,B,O,me,X,l,a,d]}let Pi=class extends Ht{constructor(e){super(),Zt(this,e,Rk,Dk,Ut,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}};function Bk(r,e,t){let n;const{map:l}=nl();wt(r,l,C=>t(8,n=C));let{position:u="top-left"}=e,{positionOptions:d=void 0}=e,{fitBoundsOptions:a=void 0}=e,{trackUserLocation:_=!1}=e,{showAccuracyCircle:x=!0}=e,{showUserLocation:S=!0}=e,{control:k=null}=e;return ti(()=>{n!=null&&n.loaded()&&k&&n.removeControl(k)}),r.$$set=C=>{"position"in C&&t(2,u=C.position),"positionOptions"in C&&t(3,d=C.positionOptions),"fitBoundsOptions"in C&&t(4,a=C.fitBoundsOptions),"trackUserLocation"in C&&t(5,_=C.trackUserLocation),"showAccuracyCircle"in C&&t(6,x=C.showAccuracyCircle),"showUserLocation"in C&&t(7,S=C.showUserLocation),"control"in C&&t(1,k=C.control)},r.$$.update=()=>{r.$$.dirty&510&&n&&!k&&(t(1,k=new to.GeolocateControl({positionOptions:d,fitBoundsOptions:a,trackUserLocation:_,showAccuracyCircle:x,showUserLocation:S})),n.addControl(k,u))},[l,k,u,d,a,_,x,S,n]}class Fk extends Ht{constructor(e){super(),Zt(this,e,Bk,null,Ut,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function Ok(r){let e;const t=r[15].default,n=Vr(t,r,r[23],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&8388608)&&Gr(n,t,l,l[23],e?qr(t,l[23],u,null):Wr(l[23]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function Nk(r){let e,t,n;function l(d){r[16](d)}let u={id:r[1],type:"line",source:r[2],sourceLayer:r[3],beforeId:r[4],beforeLayerType:r[5],paint:r[6],layout:r[7],filter:r[8],minzoom:r[9],maxzoom:r[10],hoverCursor:r[11],manageHoverState:r[12],eventsIfTopMost:r[13],interactive:r[14],$$slots:{default:[Ok]},$$scope:{ctx:r}};return r[0]!==void 0&&(u.hovered=r[0]),e=new Bd({props:u}),pn.push(()=>zo(e,"hovered",l)),e.$on("click",r[17]),e.$on("dblclick",r[18]),e.$on("contextmenu",r[19]),e.$on("mouseenter",r[20]),e.$on("mousemove",r[21]),e.$on("mouseleave",r[22]),{c(){je(e.$$.fragment)},m(d,a){Oe(e,d,a),n=!0},p(d,[a]){const _={};a&2&&(_.id=d[1]),a&4&&(_.source=d[2]),a&8&&(_.sourceLayer=d[3]),a&16&&(_.beforeId=d[4]),a&32&&(_.beforeLayerType=d[5]),a&64&&(_.paint=d[6]),a&128&&(_.layout=d[7]),a&256&&(_.filter=d[8]),a&512&&(_.minzoom=d[9]),a&1024&&(_.maxzoom=d[10]),a&2048&&(_.hoverCursor=d[11]),a&4096&&(_.manageHoverState=d[12]),a&8192&&(_.eventsIfTopMost=d[13]),a&16384&&(_.interactive=d[14]),a&8388608&&(_.$$scope={dirty:a,ctx:d}),!t&&a&1&&(t=!0,_.hovered=d[0],Po(()=>t=!1)),e.$set(_)},i(d){n||(oe(e.$$.fragment,d),n=!0)},o(d){de(e.$$.fragment,d),n=!1},d(d){Ne(e,d)}}}function jk(r,e,t){let{$$slots:n={},$$scope:l}=e,{id:u=Dc("line")}=e,{source:d=void 0}=e,{sourceLayer:a=void 0}=e,{beforeId:_=void 0}=e,{beforeLayerType:x=void 0}=e,{paint:S}=e,{layout:k=void 0}=e,{filter:C=void 0}=e,{minzoom:P=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:N=void 0}=e,{manageHoverState:z=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:O=!1}=e,{interactive:G=!0}=e;function U(re){B=re,t(0,B)}function K(re){ur.call(this,r,re)}function me(re){ur.call(this,r,re)}function X(re){ur.call(this,r,re)}function Y(re){ur.call(this,r,re)}function _e(re){ur.call(this,r,re)}function ze(re){ur.call(this,r,re)}return r.$$set=re=>{"id"in re&&t(1,u=re.id),"source"in re&&t(2,d=re.source),"sourceLayer"in re&&t(3,a=re.sourceLayer),"beforeId"in re&&t(4,_=re.beforeId),"beforeLayerType"in re&&t(5,x=re.beforeLayerType),"paint"in re&&t(6,S=re.paint),"layout"in re&&t(7,k=re.layout),"filter"in re&&t(8,C=re.filter),"minzoom"in re&&t(9,P=re.minzoom),"maxzoom"in re&&t(10,D=re.maxzoom),"hoverCursor"in re&&t(11,N=re.hoverCursor),"manageHoverState"in re&&t(12,z=re.manageHoverState),"hovered"in re&&t(0,B=re.hovered),"eventsIfTopMost"in re&&t(13,O=re.eventsIfTopMost),"interactive"in re&&t(14,G=re.interactive),"$$scope"in re&&t(23,l=re.$$scope)},[B,u,d,a,_,x,S,k,C,P,D,N,z,O,G,n,U,K,me,X,Y,_e,ze,l]}let cs=class extends Ht{constructor(e){super(),Zt(this,e,jk,Nk,Ut,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}};function Uk(r,e,t){let n;const l=us();let{layer:u=void 0}=e;const{map:d}=nl();wt(r,d,S=>t(2,n=S));function a(S){l(S.type,{...S,map:d})}const _=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],x=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return ti(()=>{if(n)if(u)for(const S of _)n.off(S,u,a);else for(const S of x)n.off(S,a)}),r.$$set=S=>{"layer"in S&&t(1,u=S.layer)},r.$$.update=()=>{if(r.$$.dirty&6&&n)if(u)for(const S of _)n.on(S,u,a);else for(const S of x)n.on(S,a)},[d,u,n]}class Vk extends Ht{constructor(e){super(),Zt(this,e,Uk,null,Ut,{layer:1})}}function qk(r){let e=r.getCenter(),t=Math.round(r.getZoom()*100)/100,n=Math.ceil((t*Math.LN2+Math.log(512/360/.5))/Math.LN10),l=Math.pow(10,n),u=Math.round(e.lat*l)/l,d=Math.round(e.lng*l)/l,a=`${t}/${u}/${d}`,_=r.getBearing(),x=r.getPitch();return(_||x)&&(a+=`/${Math.round(_*10)/10}`),x&&(a+=`/${Math.round(x)}`),`#${a}`}function Gk(r){return r.replace("#","").split("/").map(parseFloat)}var sc=zg;function zg(r,e){return r===e||r!==r&&e!==e?!0:typeof r!=typeof e||{}.toString.call(r)!={}.toString.call(e)||r!==Object(r)||!r?!1:Array.isArray(r)?e0(r,e):{}.toString.call(r)=="[object Set]"?e0(Array.from(r),Array.from(e)):{}.toString.call(r)=="[object Object]"?Zk(r,e):Wk(r,e)}function Wk(r,e){return r.toString()===e.toString()}function e0(r,e){var t=r.length;if(t!=e.length)return!1;for(var n=0;nt(6,n=S));let{position:u="top-left"}=e,{showCompass:d=!0}=e,{showZoom:a=!0}=e,{visualizePitch:_=!1}=e,x=null;return ti(()=>{n!=null&&n.loaded()&&x&&n.removeControl(x)}),r.$$set=S=>{"position"in S&&t(1,u=S.position),"showCompass"in S&&t(2,d=S.showCompass),"showZoom"in S&&t(3,a=S.showZoom),"visualizePitch"in S&&t(4,_=S.visualizePitch)},r.$$.update=()=>{r.$$.dirty&126&&n&&!x&&(t(5,x=new to.NavigationControl({showCompass:d,showZoom:a,visualizePitch:_})),n.addControl(x,u))},[l,u,d,a,_,x,n]}class $k extends Ht{constructor(e){super(),Zt(this,e,Hk,null,Ut,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function Xk(r,e,t){let n;const{map:l}=nl();wt(r,l,x=>t(5,n=x));let{position:u="bottom-left"}=e,{maxWidth:d=void 0}=e,{unit:a="metric"}=e,_=null;return ti(()=>{n!=null&&n.loaded()&&_&&n.removeControl(_)}),r.$$set=x=>{"position"in x&&t(1,u=x.position),"maxWidth"in x&&t(2,d=x.maxWidth),"unit"in x&&t(3,a=x.unit)},r.$$.update=()=>{r.$$.dirty&62&&n&&!_&&(t(4,_=new to.ScaleControl({maxWidth:d,unit:a})),n.addControl(_,u))},[l,u,d,a,_,n]}class Kk extends Ht{constructor(e){super(),Zt(this,e,Xk,null,Ut,{position:1,maxWidth:2,unit:3})}}const{window:Jk}=Ad,Yk=r=>({map:r[0]&16,loadedImages:r[0]&32,allImagesLoaded:r[0]&64}),t0=r=>({map:r[4],loadedImages:r[5],allImagesLoaded:r[6]});function r0(r){let e,t,n=r[3]&&n0(r);const l=r[46].default,u=Vr(l,r,r[45],t0);return{c(){n&&n.c(),e=Ve(),u&&u.c()},m(d,a){n&&n.m(d,a),be(d,e,a),u&&u.m(d,a),t=!0},p(d,a){d[3]?n?(n.p(d,a),a[0]&8&&oe(n,1)):(n=n0(d),n.c(),oe(n,1),n.m(e.parentNode,e)):n&&(yr(),de(n,1,1,()=>{n=null}),vr()),u&&u.p&&(!t||a[0]&112|a[1]&16384)&&Gr(u,l,d,d[45],t?qr(l,d[45],a,Yk):Wr(d[45]),t0)},i(d){t||(oe(n),oe(u,d),t=!0)},o(d){de(n),de(u,d),t=!1},d(d){d&&ve(e),n&&n.d(d),u&&u.d(d)}}}function n0(r){let e,t,n,l,u,d,a,_;return e=new $k({props:{position:r[7]}}),n=new Fk({props:{position:r[7],fitBoundsOptions:{maxZoom:12}}}),u=new Lk({props:{position:r[7]}}),a=new Kk({props:{position:r[7]}}),{c(){je(e.$$.fragment),t=Ve(),je(n.$$.fragment),l=Ve(),je(u.$$.fragment),d=Ve(),je(a.$$.fragment)},m(x,S){Oe(e,x,S),be(x,t,S),Oe(n,x,S),be(x,l,S),Oe(u,x,S),be(x,d,S),Oe(a,x,S),_=!0},p(x,S){const k={};S[0]&128&&(k.position=x[7]),e.$set(k);const C={};S[0]&128&&(C.position=x[7]),n.$set(C);const P={};S[0]&128&&(P.position=x[7]),u.$set(P);const D={};S[0]&128&&(D.position=x[7]),a.$set(D)},i(x){_||(oe(e.$$.fragment,x),oe(n.$$.fragment,x),oe(u.$$.fragment,x),oe(a.$$.fragment,x),_=!0)},o(x){de(e.$$.fragment,x),de(n.$$.fragment,x),de(u.$$.fragment,x),de(a.$$.fragment,x),_=!1},d(x){x&&(ve(t),ve(l),ve(d)),Ne(e,x),Ne(n,x),Ne(u,x),Ne(a,x)}}}function Qk(r){let e,t,n,l,u,d=r[4]&&r[0]&&r0(r);return{c(){e=fe("div"),d&&d.c(),Ee(e,"class",t=od(r[2])+" svelte-p00lfq"),Ee(e,"data-testid","map-container"),hi(e,"expand-map",!r[2])},m(a,_){be(a,e,_),d&&d.m(e,null),r[47](e),n=!0,l||(u=[Tt(Jk,"hashchange",r[11]),Mm(r[10].call(null,e))],l=!0)},p(a,_){a[4]&&a[0]?d?(d.p(a,_),_[0]&17&&oe(d,1)):(d=r0(a),d.c(),oe(d,1),d.m(e,null)):d&&(yr(),de(d,1,1,()=>{d=null}),vr()),(!n||_[0]&4&&t!==(t=od(a[2])+" svelte-p00lfq"))&&Ee(e,"class",t),(!n||_[0]&4)&&hi(e,"expand-map",!a[2])},i(a){n||(oe(d),n=!0)},o(a){de(d),n=!1},d(a){a&&ve(e),d&&d.d(),r[47](null),l=!1,_n(u)}}}function e3(r,e,t){let n,l,u,d,{$$slots:a={},$$scope:_}=e,{map:x=null}=e,{mapContainer:S=void 0}=e,{class:k=void 0}=e,{style:C}=e,{diffStyleUpdates:P=!1}=e,{center:D=void 0}=e,{zoom:N=void 0}=e,{pitch:z=0}=e,{bearing:B=0}=e,{bounds:O=void 0}=e,{hash:G=!1}=e,{updateHash:U=We=>{window.history.replaceState(window.history.state,"",We)}}=e,{loaded:K=!1}=e,{minZoom:me=0}=e,{maxZoom:X=22}=e,{minPitch:Y=0}=e,{maxPitch:_e=60}=e,{renderWorldCopies:ze=void 0}=e,{dragPan:re=void 0}=e,{dragRotate:ce=void 0}=e,{pitchWithRotate:Ze=void 0}=e,{antialias:Me=void 0}=e,{zoomOnDoubleClick:ft=!0}=e,{locale:Ct=void 0}=e,{interactive:Ot=!0}=e,{attributionControl:Ke=!0}=e,{cooperativeGestures:Kt=!1}=e,{preserveDrawingBuffer:vt=!1}=e,{maxBounds:At=void 0}=e,{images:Vt=[]}=e,{standardControls:sr=!1}=e,{filterLayers:fr=void 0}=e,{transformRequest:er=void 0}=e;const Nt=us(),{map:nr,loadedImages:tr}=dk();wt(r,nr,We=>t(4,u=We)),wt(r,tr,We=>t(5,d=We));let Lr=new Set;async function Pr(We,Ye=!1){if(u&&!(!u.loaded()&&!Ye))if("url"in We){Lr.add(We.id);try{let jt=await u.loadImage(We.url);u==null||u.addImage(We.id,jt.data,We.options),d.add(We.id),tr.set(d)}catch(jt){Nt("error",jt)}finally{Lr.delete(We.id)}}else u.addImage(We.id,We.data,We.options),d.add(We.id),tr.set(d)}let st,Lt,De,at;function tt(We){return ne(),Rt(nr,u=new to.Map(rl({container:We,style:C,locale:Ct,center:D,zoom:N,pitch:z,bearing:B,minZoom:me,maxZoom:X,minPitch:Y,maxPitch:_e,renderWorldCopies:ze,dragPan:re,dragRotate:ce,pitchWithRotate:Ze,antialias:Me,interactive:Ot,preserveDrawingBuffer:vt,maxBounds:At,bounds:O,attributionControl:Ke,transformRequest:er,cooperativeGestures:Kt})),u),u.on("load",Ye=>{Ye.target.getContainer().setAttribute("data-testid","map"),Ye.target.getCanvas().setAttribute("data-testid","map-canvas"),t(0,K=!0),Nt("load",u)}),u.on("error",Ye=>Nt("error",{...Ye,map:u})),u.on("movestart",Ye=>Nt("movestart",{...Ye,map:u})),u.on("moveend",Ye=>{if(t(12,D=Ye.target.getCenter()),t(13,N=Ye.target.getZoom()),t(14,z=Ye.target.getPitch()),t(15,B=Ye.target.getBearing()),t(16,O=Ye.target.getBounds()),Nt("moveend",{...Ye,map:u}),G){let jt=new URL(window.location.href.replace(/(#.+)?$/,qk(u)));U(jt)}}),u.on("click",Ye=>Nt("click",{...Ye,map:u})),u.on("dblclick",Ye=>Nt("dblclick",{...Ye,map:u})),u.on("contextmenu",Ye=>Nt("contextmenu",{...Ye,map:u})),u.on("zoomstart",Ye=>Nt("zoomstart",{...Ye,map:u})),u.on("zoom",Ye=>{Nt("zoom",{...Ye,map:u})}),u.on("zoomend",Ye=>{Nt("zoomend",{...Ye,map:u})}),u.on("style.load",()=>{if(u){const Ye=u.getStyle();if(t(42,st=Ye.layers.map(jt=>jt.id)),t(43,Lt=Object.keys(Ye.sources)),at)for(const[jt,bn]of Object.entries(at))u.addSource(jt,bn);if(De)for(const jt of De)u.addLayer(jt);for(const jt of Vt)Pr(jt,!0)}}),u.on("styledata",Ye=>{if(u&&fr){const jt=u.getStyle().layers;if(jt)for(let bn of jt)fr(bn)||u.setLayoutProperty(bn.id,"visibility","none")}Nt("styledata",{...Ye,map:u})}),{destroy(){t(0,K=!1),u==null||u.remove(),Rt(nr,u=null,u)}}}let it=C;function ne(){if(G){let We=Gk(window.location.hash);We.length>=3&&(t(13,N=We[0]),t(12,D=[We[2],We[1]])),We.length==5&&(t(15,B=We[3]),t(14,z=We[4]))}}function br(We){pn[We?"unshift":"push"](()=>{S=We,t(1,S)})}return r.$$set=We=>{"map"in We&&t(17,x=We.map),"mapContainer"in We&&t(1,S=We.mapContainer),"class"in We&&t(2,k=We.class),"style"in We&&t(18,C=We.style),"diffStyleUpdates"in We&&t(19,P=We.diffStyleUpdates),"center"in We&&t(12,D=We.center),"zoom"in We&&t(13,N=We.zoom),"pitch"in We&&t(14,z=We.pitch),"bearing"in We&&t(15,B=We.bearing),"bounds"in We&&t(16,O=We.bounds),"hash"in We&&t(20,G=We.hash),"updateHash"in We&&t(21,U=We.updateHash),"loaded"in We&&t(0,K=We.loaded),"minZoom"in We&&t(22,me=We.minZoom),"maxZoom"in We&&t(23,X=We.maxZoom),"minPitch"in We&&t(24,Y=We.minPitch),"maxPitch"in We&&t(25,_e=We.maxPitch),"renderWorldCopies"in We&&t(26,ze=We.renderWorldCopies),"dragPan"in We&&t(27,re=We.dragPan),"dragRotate"in We&&t(28,ce=We.dragRotate),"pitchWithRotate"in We&&t(29,Ze=We.pitchWithRotate),"antialias"in We&&t(30,Me=We.antialias),"zoomOnDoubleClick"in We&&t(31,ft=We.zoomOnDoubleClick),"locale"in We&&t(32,Ct=We.locale),"interactive"in We&&t(33,Ot=We.interactive),"attributionControl"in We&&t(34,Ke=We.attributionControl),"cooperativeGestures"in We&&t(35,Kt=We.cooperativeGestures),"preserveDrawingBuffer"in We&&t(36,vt=We.preserveDrawingBuffer),"maxBounds"in We&&t(37,At=We.maxBounds),"images"in We&&t(38,Vt=We.images),"standardControls"in We&&t(3,sr=We.standardControls),"filterLayers"in We&&t(39,fr=We.filterLayers),"transformRequest"in We&&t(40,er=We.transformRequest),"$$scope"in We&&t(45,_=We.$$scope)},r.$$.update=()=>{if(r.$$.dirty[0]&8&&t(7,n=typeof sr=="boolean"?void 0:sr),r.$$.dirty[0]&16&&t(17,x=u),r.$$.dirty[0]&786448|r.$$.dirty[1]&14336&&u&&!sc(C,it)){const We=u.getStyle();if(st&&(De=We.layers.filter(Ye=>!st.includes(Ye.id))),Lt){const Ye=Object.keys(We.sources).filter(jt=>!Lt.includes(jt));at={};for(const jt of Ye)at[jt]=We.sources[jt]}t(44,it=C),u.setStyle(C,{diff:P}),Rt(tr,d=new Set,d),t(41,Lr=new Set)}if(r.$$.dirty[0]&49|r.$$.dirty[1]&1152&&K&&u!=null&&u.loaded())for(let We of Vt)!d.has(We.id)&&!Lr.has(We.id)&&!u.hasImage(We.id)&&Pr(We);if(r.$$.dirty[0]&32|r.$$.dirty[1]&128&&t(6,l=Vt.every(We=>d.has(We.id))),r.$$.dirty[0]&61456&&u){let We={};D!=null&&!sc(D,u==null?void 0:u.getCenter())&&(We.center=D),N!=null&&!sc(N,u==null?void 0:u.getZoom())&&(We.zoom=N),B!=null&&!sc(B,u==null?void 0:u.getBearing())&&(We.bearing=B),z!=null&&!sc(z,u==null?void 0:u.getPitch())&&(We.pitch=z),Object.keys(We).length&&u.easeTo(We)}r.$$.dirty[0]&65552&&O&&!sc(O,u==null?void 0:u.getBounds())&&(u==null||u.fitBounds(O)),r.$$.dirty[0]&16|r.$$.dirty[1]&1&&(ft?u==null||u.doubleClickZoom.enable():u==null||u.doubleClickZoom.disable())},[K,S,k,sr,u,d,l,n,nr,tr,tt,ne,D,N,z,B,O,x,C,P,G,U,me,X,Y,_e,ze,re,ce,Ze,Me,ft,Ct,Ot,Ke,Kt,vt,At,Vt,fr,er,Lr,st,Lt,it,_,a,br]}class t3 extends Ht{constructor(e){super(),Zt(this,e,e3,Qk,Ut,{map:17,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:14,bearing:15,bounds:16,hash:20,updateHash:21,loaded:0,minZoom:22,maxZoom:23,minPitch:24,maxPitch:25,renderWorldCopies:26,dragPan:27,dragRotate:28,pitchWithRotate:29,antialias:30,zoomOnDoubleClick:31,locale:32,interactive:33,attributionControl:34,cooperativeGestures:35,preserveDrawingBuffer:36,maxBounds:37,images:38,standardControls:3,filterLayers:39,transformRequest:40},null,[-1,-1])}}const r3=r=>({marker:r&8}),i0=r=>({marker:r[3]});function n3(r){let e,t,n,l,u,d,a;const _=r[19].default,x=Vr(_,r,r[18],i0);return{c(){e=fe("div"),x&&x.c(),Ee(e,"tabindex",t=r[1]?0:void 0),Ee(e,"role",n=r[1]?"button":void 0),fn(e,"z-index",r[2])},m(S,k){be(S,e,k),x&&x.m(e,null),u=!0,d||(a=[Mm(r[7].call(null,e)),Mm(l=i3.call(null,e,r[0])),Tt(e,"click",Kp(r[20])),Tt(e,"dblclick",Kp(r[21])),Tt(e,"contextmenu",Kp(bg(r[22]))),Tt(e,"mouseenter",r[23]),Tt(e,"mouseleave",r[24]),Tt(e,"mousemove",r[25]),Tt(e,"keydown",r[8])],d=!0)},p(S,[k]){x&&x.p&&(!u||k&262152)&&Gr(x,_,S,S[18],u?qr(_,S[18],k,r3):Wr(S[18]),i0),(!u||k&2&&t!==(t=S[1]?0:void 0))&&Ee(e,"tabindex",t),(!u||k&2&&n!==(n=S[1]?"button":void 0))&&Ee(e,"role",n),l&&wc(l.update)&&k&1&&l.update.call(null,S[0]),k&4&&fn(e,"z-index",S[2])},i(S){u||(oe(x,S),u=!0)},o(S){de(x,S),u=!1},d(S){S&&ve(e),x&&x.d(S),d=!1,_n(a)}}}function i3(r,e){const t=r.className;function n(l){l?r.className=`${t} ${l}`:r.className=t}return n(e),{update:n}}function o3(r,e,t){let n,l,u,{$$slots:d={},$$scope:a}=e,{marker:_=void 0}=e,{lngLat:x}=e,{class:S=void 0}=e,{interactive:k=!0}=e,{asButton:C=!1}=e,{draggable:P=!1}=e,{feature:D=null}=e,{offset:N=void 0}=e,{zIndex:z=void 0}=e,{rotation:B=0}=e,{opacity:O=1}=e;const G=us(),{map:U,layerEvent:K,self:me,markerClickManager:X}=gk();wt(r,U,Ke=>t(27,u=Ke)),wt(r,K,Ke=>t(26,n=Ke)),wt(r,me,Ke=>t(3,l=Ke));function Y(Ke){Rt(me,l=new to.Marker({element:Ke,rotation:B,draggable:P,offset:N,opacity:O.toString()}).setLngLat(x).addTo(u),l),t(11,_=l);const Kt=()=>re("dragstart"),vt=()=>{_e(),re("drag")},At=()=>{_e(),re("dragend")};return P&&(l.on("dragstart",Kt),l.on("drag",vt),l.on("dragend",At)),{destroy(){P&&(l==null||l.off("dragstart",Kt),l==null||l.off("drag",vt),l==null||l.off("dragend",At)),t(11,_=void 0),l==null||l.remove()}}}function _e(){let Ke=l==null?void 0:l.getLngLat();Ke&&(Array.isArray(x)?t(10,x=[Ke.lng,Ke.lat]):x&&"lon"in x?t(10,x={lon:Ke.lng,lat:Ke.lat}):t(10,x=Ke))}function ze(Ke){Ke.key===" "&&(Ke.preventDefault(),Ke.stopPropagation(),re("click"))}function re(Ke){if(!k)return;let Kt=l==null?void 0:l.getLngLat();if(!Kt)return;const vt=[Kt.lng,Kt.lat];let At={map:u,marker:l,lngLat:vt,features:[{type:"Feature",properties:(D==null?void 0:D.properties)??{},geometry:{type:"Point",coordinates:vt}}]};(Ke==="click"||Ke==="contextmenu")&&X.handleClick(At),Rt(K,n={...At,layerType:"marker",type:Ke},n),G(Ke,At)}const ce=()=>re("click"),Ze=()=>re("dblclick"),Me=()=>{re("contextmenu")},ft=()=>{re("mouseenter")},Ct=()=>{re("mouseleave")},Ot=()=>re("mousemove");return r.$$set=Ke=>{"marker"in Ke&&t(11,_=Ke.marker),"lngLat"in Ke&&t(10,x=Ke.lngLat),"class"in Ke&&t(0,S=Ke.class),"interactive"in Ke&&t(12,k=Ke.interactive),"asButton"in Ke&&t(1,C=Ke.asButton),"draggable"in Ke&&t(13,P=Ke.draggable),"feature"in Ke&&t(14,D=Ke.feature),"offset"in Ke&&t(15,N=Ke.offset),"zIndex"in Ke&&t(2,z=Ke.zIndex),"rotation"in Ke&&t(16,B=Ke.rotation),"opacity"in Ke&&t(17,O=Ke.opacity),"$$scope"in Ke&&t(18,a=Ke.$$scope)},r.$$.update=()=>{r.$$.dirty&1032&&(l==null||l.setLngLat(x)),r.$$.dirty&32776&&(l==null||l.setOffset(N??[0,0])),r.$$.dirty&65544&&(l==null||l.setRotation(B)),r.$$.dirty&131080&&(l==null||l.setOpacity(O.toString()))},[S,C,z,l,U,K,me,Y,ze,re,x,_,k,P,D,N,B,O,a,d,ce,Ze,Me,ft,Ct,Ot]}class fd extends Ht{constructor(e){super(),Zt(this,e,o3,n3,Ut,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}const s3=r=>({features:r[0]&16,data:r[0]&16,map:r[0]&4,close:r[0]&1}),o0=r=>{var e;return{features:r[4],data:((e=r[4])==null?void 0:e[0])??null,map:r[2],close:r[31]}};function s0(r){var l;let e,t,n=(((l=r[4])==null?void 0:l.length)||r[3]instanceof to.Marker)&&a0(r);return{c(){e=fe("div"),n&&n.c()},m(u,d){be(u,e,d),n&&n.m(e,null),r[32](e),t=!0},p(u,d){var a;(a=u[4])!=null&&a.length||u[3]instanceof to.Marker?n?(n.p(u,d),d[0]&24&&oe(n,1)):(n=a0(u),n.c(),oe(n,1),n.m(e,null)):n&&(yr(),de(n,1,1,()=>{n=null}),vr())},i(u){t||(oe(n),t=!0)},o(u){de(n),t=!1},d(u){u&&ve(e),n&&n.d(),r[32](null)}}}function a0(r){let e;const t=r[30].default,n=Vr(t,r,r[29],o0);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u[0]&536870933)&&Gr(n,t,l,l[29],e?qr(t,l[29],u,s3):Wr(l[29]),o0)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function a3(r){let e,t,n=r[9].default&&s0(r);return{c(){n&&n.c(),e=$n()},m(l,u){n&&n.m(l,u),be(l,e,u),t=!0},p(l,u){l[9].default?n?(n.p(l,u),u[0]&512&&oe(n,1)):(n=s0(l),n.c(),oe(n,1),n.m(e.parentNode,e)):n&&(yr(),de(n,1,1,()=>{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function l3(r,e,t){let n,l,u,d,a,_,{$$slots:x={},$$scope:S}=e;const k=OS(x);let{closeButton:C=void 0}=e,{closeOnClickOutside:P=!0}=e,{closeOnClickInside:D=!1}=e,{closeOnMove:N=!1}=e,{openOn:z="click"}=e,{openIfTopMost:B=!0}=e,{focusAfterOpen:O=!0}=e,{anchor:G=void 0}=e,{offset:U=void 0}=e,{popupClass:K=void 0}=e,{maxWidth:me=void 0}=e,{lngLat:X=void 0}=e,{html:Y=void 0}=e,{open:_e=!1}=e;const ze=us(),{map:re,popupTarget:ce,layerEvent:Ze,layer:Me,eventTopMost:ft,markerClickManager:Ct}=nl();wt(r,re,ne=>t(2,u=ne)),wt(r,ce,ne=>t(3,a=ne)),wt(r,Ze,ne=>t(28,d=ne)),wt(r,Me,ne=>t(35,_=ne));const Ot=["click","dblclick","contextmenu"];let Ke,Kt=!1,vt;function At(){if(!Ke)return;let ne=Ke.getElement();!ne||ne===vt||(vt=ne,z==="hover"&&(vt.style.pointerEvents="none"),vt.addEventListener("mouseenter",()=>{t(24,Kt=!0)},{passive:!0}),vt.addEventListener("mouseleave",()=>{t(24,Kt=!1)},{passive:!0}),vt.addEventListener("click",()=>{D&&t(0,_e=!1)},{passive:!0}))}Ld(()=>{if(u)return u.on("click",Lt),u.on("contextmenu",Lt),Ct.add(De),typeof a=="string"&&(u.on("click",a,Nt),u.on("dblclick",a,Nt),u.on("contextmenu",a,Nt),u.on("mousemove",a,st),u.on("mouseleave",a,Pr),u.on("touchstart",a,tr),u.on("touchend",a,Lr)),()=>{u!=null&&u.loaded()&&(Ke==null||Ke.remove(),u.off("click",Lt),u.off("contextmenu",Lt),Ct.remove(De),a instanceof to.Marker?a.getPopup()===Ke&&a.setPopup(void 0):typeof a=="string"&&(u.off("click",a,Nt),u.off("dblclick",a,Nt),u.off("contextmenu",a,Nt),u.off("mousemove",a,st),u.off("mouseleave",a,Pr),u.off("touchstart",a,tr),u.off("touchend",a,Lr)))}});function Vt(ne){return B?!("marker"in ne)&&!_k(ne)&&ft(ne)!==_:!1}let sr=null,fr="normal";function er(ne){"layerType"in ne&&ne.layerType==="deckgl"?(t(10,X=ne.coordinate),t(4,sr=ne.object?[ne.object]:null)):(t(10,X=ne.lngLat),t(4,sr=ne.features??[]))}function Nt(ne){ne.type!==z||Vt(ne)||(er(ne),setTimeout(()=>t(0,_e=!0)))}let nr=null;function tr(ne){nr=ne.point}function Lr(ne){if(!nr||z!=="hover")return;let br=nr.dist(ne.point);nr=null,br<3&&(t(10,X=ne.lngLat),t(4,sr=ne.features??[]),Ke.isOpen()?t(25,fr="justOpened"):(t(25,fr="opening"),t(0,_e=!0)))}function Pr(ne){z!=="hover"||nr||fr!=="normal"||(t(0,_e=!1),t(4,sr=null))}function st(ne){if(!(z!=="hover"||nr||fr!=="normal")){if(Vt(ne)){t(0,_e=!1),t(4,sr=null);return}t(0,_e=!0),t(4,sr=ne.features??[]),t(10,X=ne.lngLat)}}function Lt(ne){if(fr==="justOpened"){t(25,fr="normal");return}if(!P)return;let br=[vt,a instanceof to.Marker?a==null?void 0:a.getElement():null];_e&&Ke.isOpen()&&!br.some(We=>We==null?void 0:We.contains(ne.originalEvent.target))&&(ne.type==="contextmenu"&&z==="contextmenu"||ne.type!=="contextmenu")&&t(0,_e=!1)}function De(ne){P&&_e&&Ke.isOpen()&&ne.marker!==a&&t(0,_e=!1)}ti(()=>{u&&(Ke!=null&&Ke.isOpen())&&Ke.remove()});let at;const tt=()=>t(0,_e=!1);function it(ne){pn[ne?"unshift":"push"](()=>{at=ne,t(1,at)})}return r.$$set=ne=>{"closeButton"in ne&&t(11,C=ne.closeButton),"closeOnClickOutside"in ne&&t(12,P=ne.closeOnClickOutside),"closeOnClickInside"in ne&&t(13,D=ne.closeOnClickInside),"closeOnMove"in ne&&t(14,N=ne.closeOnMove),"openOn"in ne&&t(15,z=ne.openOn),"openIfTopMost"in ne&&t(16,B=ne.openIfTopMost),"focusAfterOpen"in ne&&t(17,O=ne.focusAfterOpen),"anchor"in ne&&t(18,G=ne.anchor),"offset"in ne&&t(19,U=ne.offset),"popupClass"in ne&&t(20,K=ne.popupClass),"maxWidth"in ne&&t(21,me=ne.maxWidth),"lngLat"in ne&&t(10,X=ne.lngLat),"html"in ne&&t(22,Y=ne.html),"open"in ne&&t(0,_e=ne.open),"$$scope"in ne&&t(29,S=ne.$$scope)},r.$$.update=()=>{if(r.$$.dirty[0]&14336&&t(27,n=C??(!P&&!D)),r.$$.dirty[0]&146685952&&(Ke||(t(23,Ke=new to.Popup({closeButton:n,closeOnClick:!1,closeOnMove:N,focusAfterOpen:O,maxWidth:me,className:K,anchor:G,offset:U})),vt=Ke.getElement(),Ke.on("open",()=>{t(0,_e=!0),At(),ze("open",Ke)}),Ke.on("close",()=>{t(0,_e=!1),ze("close",Ke)}),Ke.on("hover",()=>{ze("hover",Ke)}))),r.$$.dirty[0]&8421384&&Ke&&a instanceof to.Marker&&(z==="click"?a.setPopup(Ke):a.getPopup()===Ke&&a.setPopup(void 0)),r.$$.dirty[0]&268468224&&Ot.includes(z)&&(d==null?void 0:d.type)===z&&(Nt(d),Rt(Ze,d=null,d)),r.$$.dirty[0]&268468224&&t(26,l=z==="hover"&&((d==null?void 0:d.type)==="mousemove"||(d==null?void 0:d.type)==="mouseenter")),r.$$.dirty[0]&352354304&&z==="hover"&&Ze&&(l&&d&&er(d),t(0,_e=(l||Kt)??!1)),r.$$.dirty[0]&12582914&&(at?Ke.setDOMContent(at):Y&&Ke.setHTML(Y)),r.$$.dirty[0]&8389632&&X&&Ke.setLngLat(X),r.$$.dirty[0]&41943045&&u){let ne=Ke.isOpen();_e&&!ne?(Ke.addTo(u),fr==="opening"&&t(25,fr="justOpened")):!_e&&ne&&Ke.remove()}},[_e,at,u,a,sr,re,ce,Ze,Me,k,X,C,P,D,N,z,B,O,G,U,K,me,Y,Ke,Kt,fr,l,n,d,S,x,tt,it]}class c3 extends Ht{constructor(e){super(),Zt(this,e,l3,a3,Ut,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}var kh=Uint8Array,rw=Uint16Array,u3=Int32Array,h3=new kh([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),f3=new kh([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),nw=function(r,e){for(var t=new rw(31),n=0;n<31;++n)t[n]=e+=1<>1|(Fr&21845)<<1,Ms=(Ms&52428)>>2|(Ms&13107)<<2,Ms=(Ms&61680)>>4|(Ms&3855)<<4,m3[Fr]=((Ms&65280)>>8|(Ms&255)<<8)>>1;var Ms,Fr,Fd=new kh(288);for(Fr=0;Fr<144;++Fr)Fd[Fr]=8;var Fr;for(Fr=144;Fr<256;++Fr)Fd[Fr]=9;var Fr;for(Fr=256;Fr<280;++Fr)Fd[Fr]=7;var Fr;for(Fr=280;Fr<288;++Fr)Fd[Fr]=8;var Fr,g3=new kh(32);for(Fr=0;Fr<32;++Fr)g3[Fr]=5;var Fr,_3=new kh(0),y3=typeof TextDecoder<"u"&&new TextDecoder,v3=0;try{y3.decode(_3,{stream:!0}),v3=1}catch{}function b3(r){let e;const t=r[16].default,n=Vr(t,r,r[24],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&16777216)&&Gr(n,t,l,l[24],e?qr(t,l[24],u,null):Wr(l[24]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function w3(r){let e,t,n;function l(d){r[17](d)}let u={id:r[1],type:"symbol",source:r[2],sourceLayer:r[3],beforeId:r[4],beforeLayerType:r[5],paint:r[6],layout:r[7],filter:r[8],applyToClusters:r[9],minzoom:r[10],maxzoom:r[11],hoverCursor:r[12],manageHoverState:r[13],eventsIfTopMost:r[14],interactive:r[15],$$slots:{default:[b3]},$$scope:{ctx:r}};return r[0]!==void 0&&(u.hovered=r[0]),e=new Bd({props:u}),pn.push(()=>zo(e,"hovered",l)),e.$on("click",r[18]),e.$on("dblclick",r[19]),e.$on("contextmenu",r[20]),e.$on("mouseenter",r[21]),e.$on("mousemove",r[22]),e.$on("mouseleave",r[23]),{c(){je(e.$$.fragment)},m(d,a){Oe(e,d,a),n=!0},p(d,[a]){const _={};a&2&&(_.id=d[1]),a&4&&(_.source=d[2]),a&8&&(_.sourceLayer=d[3]),a&16&&(_.beforeId=d[4]),a&32&&(_.beforeLayerType=d[5]),a&64&&(_.paint=d[6]),a&128&&(_.layout=d[7]),a&256&&(_.filter=d[8]),a&512&&(_.applyToClusters=d[9]),a&1024&&(_.minzoom=d[10]),a&2048&&(_.maxzoom=d[11]),a&4096&&(_.hoverCursor=d[12]),a&8192&&(_.manageHoverState=d[13]),a&16384&&(_.eventsIfTopMost=d[14]),a&32768&&(_.interactive=d[15]),a&16777216&&(_.$$scope={dirty:a,ctx:d}),!t&&a&1&&(t=!0,_.hovered=d[0],Po(()=>t=!1)),e.$set(_)},i(d){n||(oe(e.$$.fragment,d),n=!0)},o(d){de(e.$$.fragment,d),n=!1},d(d){Ne(e,d)}}}function x3(r,e,t){let{$$slots:n={},$$scope:l}=e,{id:u=Dc("symbol")}=e,{source:d=void 0}=e,{sourceLayer:a=void 0}=e,{beforeId:_=void 0}=e,{beforeLayerType:x=void 0}=e,{paint:S=void 0}=e,{layout:k=void 0}=e,{filter:C=void 0}=e,{applyToClusters:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:N=void 0}=e,{hoverCursor:z=void 0}=e,{manageHoverState:B=!1}=e,{hovered:O=null}=e,{eventsIfTopMost:G=!1}=e,{interactive:U=!0}=e;function K(ce){O=ce,t(0,O)}function me(ce){ur.call(this,r,ce)}function X(ce){ur.call(this,r,ce)}function Y(ce){ur.call(this,r,ce)}function _e(ce){ur.call(this,r,ce)}function ze(ce){ur.call(this,r,ce)}function re(ce){ur.call(this,r,ce)}return r.$$set=ce=>{"id"in ce&&t(1,u=ce.id),"source"in ce&&t(2,d=ce.source),"sourceLayer"in ce&&t(3,a=ce.sourceLayer),"beforeId"in ce&&t(4,_=ce.beforeId),"beforeLayerType"in ce&&t(5,x=ce.beforeLayerType),"paint"in ce&&t(6,S=ce.paint),"layout"in ce&&t(7,k=ce.layout),"filter"in ce&&t(8,C=ce.filter),"applyToClusters"in ce&&t(9,P=ce.applyToClusters),"minzoom"in ce&&t(10,D=ce.minzoom),"maxzoom"in ce&&t(11,N=ce.maxzoom),"hoverCursor"in ce&&t(12,z=ce.hoverCursor),"manageHoverState"in ce&&t(13,B=ce.manageHoverState),"hovered"in ce&&t(0,O=ce.hovered),"eventsIfTopMost"in ce&&t(14,G=ce.eventsIfTopMost),"interactive"in ce&&t(15,U=ce.interactive),"$$scope"in ce&&t(24,l=ce.$$scope)},[O,u,d,a,_,x,S,k,C,P,D,N,z,B,G,U,n,K,me,X,Y,_e,ze,re,l]}class ow extends Ht{constructor(e){super(),Zt(this,e,x3,w3,Ut,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}var S3=Object.defineProperty,sw=r=>{throw TypeError(r)},k3=(r,e,t)=>e in r?S3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,fo=(r,e,t)=>k3(r,typeof e!="symbol"?e+"":e,t),aw=(r,e,t)=>e.has(r)||sw("Cannot "+t),Qn=(r,e,t)=>(aw(r,e,"read from private field"),t?t.call(r):e.get(r)),l0=(r,e,t)=>e.has(r)?sw("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),c0=(r,e,t,n)=>(aw(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);function mn(){}function T3(r,e){for(const t in e)r[t]=e[t];return r}function lw(r){return r()}function u0(){return Object.create(null)}function Bs(r){r.forEach(lw)}function cw(r){return typeof r=="function"}function ga(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}let Bf;function zi(r,e){return r===e?!0:(Bf||(Bf=document.createElement("a")),Bf.href=e,r===Bf.href)}function E3(r){return Object.keys(r).length===0}function M3(r,e,t,n){if(r){const l=uw(r,e,t,n);return r[0](l)}}function uw(r,e,t,n){return r[1]&&n?T3(t.ctx.slice(),r[1](n(e))):t.ctx}function C3(r,e,t,n){if(r[2]&&n){const l=r[2](n(t));if(e.dirty===void 0)return l;if(typeof l=="object"){const u=[],d=Math.max(e.dirty.length,l.length);for(let a=0;a32){const e=[],t=r.ctx.length/32;for(let n=0;nr.removeEventListener(e,t,n)}function P3(r){return function(e){return e.preventDefault(),r.call(this,e)}}function ot(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function z3(r){return Array.from(r.childNodes)}function ph(r,e){e=""+e,r.data!==e&&(r.data=e)}function f0(r,e){r.value=e??""}function Ao(r,e,t){r.classList.toggle(e,!!t)}function D3(r,e,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(r,{detail:e,bubbles:t,cancelable:n})}let mh;function oh(r){mh=r}function hw(){if(!mh)throw new Error("Function called outside component initialization");return mh}function R3(r){hw().$$.on_destroy.push(r)}function B3(){const r=hw();return(e,t,{cancelable:n=!1}={})=>{const l=r.$$.callbacks[e];if(l){const u=D3(e,t,{cancelable:n});return l.slice().forEach(d=>{d.call(r,u)}),!u.defaultPrevented}return!0}}function d0(r,e){const t=r.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}const pc=[],Nm=[];let vc=[];const p0=[],F3=Promise.resolve();let jm=!1;function O3(){jm||(jm=!0,F3.then(fw))}function Um(r){vc.push(r)}const tm=new Set;let ac=0;function fw(){if(ac!==0)return;const r=mh;do{try{for(;acr.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),vc=e}const Wf=new Set;let Ya;function Zf(){Ya={r:0,c:[],p:Ya}}function Hf(){Ya.r||Bs(Ya.c),Ya=Ya.p}function Zn(r,e){r&&r.i&&(Wf.delete(r),r.i(e))}function ui(r,e,t,n){if(r&&r.o){if(Wf.has(r))return;Wf.add(r),Ya.c.push(()=>{Wf.delete(r),n&&(t&&r.d(1),n())}),r.o(e)}else n&&n()}function m0(r){return(r==null?void 0:r.length)!==void 0?r:Array.from(r)}function U3(r,e){ui(r,1,1,()=>{e.delete(r.key)})}function V3(r,e,t,n,l,u,d,a,_,x,S,k){let C=r.length,P=u.length,D=C;const N={};for(;D--;)N[r[D].key]=D;const z=[],B=new Map,O=new Map,G=[];for(D=P;D--;){const X=k(l,u,D),Y=t(X);let _e=d.get(Y);_e?G.push(()=>_e.p(X,e)):(_e=x(Y,X),_e.c()),B.set(Y,z[D]=_e),Y in N&&O.set(Y,Math.abs(D-N[Y]))}const U=new Set,K=new Set;function me(X){Zn(X,1),X.m(a,S),d.set(X.key,X),S=X.first,P--}for(;C&&P;){const X=z[P-1],Y=r[C-1],_e=X.key,ze=Y.key;X===Y?(S=X.first,C--,P--):B.has(ze)?!d.has(_e)||U.has(_e)?me(X):K.has(ze)?C--:O.get(_e)>O.get(ze)?(K.add(_e),me(X)):(U.add(ze),C--):(_(Y,d),C--)}for(;C--;){const X=r[C];B.has(X.key)||_(X,d)}for(;P;)me(z[P-1]);return Bs(G),z}function da(r){r&&r.c()}function Ds(r,e,t){const{fragment:n,after_update:l}=r.$$;n&&n.m(e,t),Um(()=>{const u=r.$$.on_mount.map(lw).filter(cw);r.$$.on_destroy?r.$$.on_destroy.push(...u):Bs(u),r.$$.on_mount=[]}),l.forEach(Um)}function Rs(r,e){const t=r.$$;t.fragment!==null&&(j3(t.after_update),Bs(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function q3(r,e){r.$$.dirty[0]===-1&&(pc.push(r),O3(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<{const D=P.length?P[0]:C;return x.ctx&&l(x.ctx[k],x.ctx[k]=D)&&(!x.skip_bound&&x.bound[k]&&x.bound[k](D),S&&q3(r,k)),C}):[],x.update(),S=!0,Bs(x.before_update),x.fragment=n?n(x.ctx):!1,e.target){if(e.hydrate){const k=z3(e.target);x.fragment&&x.fragment.l(k),k.forEach(gn)}else x.fragment&&x.fragment.c();e.intro&&Zn(r.$$.fragment),Ds(r,e.target,e.anchor),fw()}oh(_)}class ya{constructor(){fo(this,"$$"),fo(this,"$$set")}$destroy(){Rs(this,1),this.$destroy=mn}$on(e,t){if(!cw(t))return mn;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const l=n.indexOf(t);l!==-1&&n.splice(l,1)}}$set(e){this.$$set&&!E3(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const G3="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(G3);function W3(r){let e,t;return{c(){e=Zo("svg"),t=Zo("path"),ot(t,"d","M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"),ot(e,"viewBox","0 0 14 14"),ot(e,"width","13"),ot(e,"height","13"),ot(e,"class","svelte-en2qvf")},m(n,l){vn(n,e,l),Ir(e,t)},p:mn,i:mn,o:mn,d(n){n&&gn(e)}}}class dw extends ya{constructor(e){super(),_a(this,e,null,W3,ga,{})}}function Z3(r){let e,t;return{c(){e=Zo("svg"),t=Zo("path"),ot(t,"d","M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"),ot(e,"viewBox","0 0 30 30"),ot(e,"fill","none"),ot(e,"xmlns","http://www.w3.org/2000/svg"),ot(e,"class","svelte-d2loi5")},m(n,l){vn(n,e,l),Ir(e,t)},p:mn,i:mn,o:mn,d(n){n&&gn(e)}}}class pw extends ya{constructor(e){super(),_a(this,e,null,Z3,ga,{})}}function H3(r){let e,t;return{c(){e=Kr("img"),zi(e.src,t=r[3]+"area.svg")||ot(e,"src",t),ot(e,"alt",r[6]),ot(e,"class","svelte-ltkwvy")},m(n,l){vn(n,e,l)},p(n,l){l&8&&!zi(e.src,t=n[3]+"area.svg")&&ot(e,"src",t),l&64&&ot(e,"alt",n[6])},d(n){n&&gn(e)}}}function $3(r){let e,t;return{c(){e=Kr("img"),zi(e.src,t=r[3]+"reverse.svg")||ot(e,"src",t),ot(e,"alt",r[6]),ot(e,"class","svelte-ltkwvy")},m(n,l){vn(n,e,l)},p(n,l){l&8&&!zi(e.src,t=n[3]+"reverse.svg")&&ot(e,"src",t),l&64&&ot(e,"alt",n[6])},d(n){n&&gn(e)}}}function X3(r){let e,t;return{c(){e=Kr("img"),zi(e.src,t=r[3]+"poi.svg")||ot(e,"src",t),ot(e,"alt",r[6]),ot(e,"class","svelte-ltkwvy")},m(n,l){vn(n,e,l)},p(n,l){l&8&&!zi(e.src,t=n[3]+"poi.svg")&&ot(e,"src",t),l&64&&ot(e,"alt",n[6])},d(n){n&&gn(e)}}}function K3(r){let e,t;return{c(){e=Kr("img"),zi(e.src,t=r[3]+"postal_code.svg")||ot(e,"src",t),ot(e,"alt",r[6]),ot(e,"class","svelte-ltkwvy")},m(n,l){vn(n,e,l)},p(n,l){l&8&&!zi(e.src,t=n[3]+"postal_code.svg")&&ot(e,"src",t),l&64&&ot(e,"alt",n[6])},d(n){n&&gn(e)}}}function J3(r){let e,t;return{c(){e=Kr("img"),zi(e.src,t=r[3]+"street.svg")||ot(e,"src",t),ot(e,"alt",r[6]),ot(e,"class","svelte-ltkwvy")},m(n,l){vn(n,e,l)},p(n,l){l&8&&!zi(e.src,t=n[3]+"street.svg")&&ot(e,"src",t),l&64&&ot(e,"alt",n[6])},d(n){n&&gn(e)}}}function Y3(r){let e,t;return{c(){e=Kr("img"),zi(e.src,t=r[3]+"road.svg")||ot(e,"src",t),ot(e,"alt",r[6]),ot(e,"class","svelte-ltkwvy")},m(n,l){vn(n,e,l)},p(n,l){l&8&&!zi(e.src,t=n[3]+"road.svg")&&ot(e,"src",t),l&64&&ot(e,"alt",n[6])},d(n){n&&gn(e)}}}function Q3(r){let e,t;return{c(){e=Kr("img"),zi(e.src,t=r[3]+"housenumber.svg")||ot(e,"src",t),ot(e,"alt",r[6]),ot(e,"class","svelte-ltkwvy")},m(n,l){vn(n,e,l)},p(n,l){l&8&&!zi(e.src,t=n[3]+"housenumber.svg")&&ot(e,"src",t),l&64&&ot(e,"alt",n[6])},d(n){n&&gn(e)}}}function eT(r){let e,t,n,l;return{c(){e=Kr("img"),zi(e.src,t=r[5])||ot(e,"src",t),ot(e,"alt",r[4]),ot(e,"class","svelte-ltkwvy")},m(u,d){vn(u,e,d),n||(l=Zi(e,"error",r[14]),n=!0)},p(u,d){d&32&&!zi(e.src,t=u[5])&&ot(e,"src",t),d&16&&ot(e,"alt",u[4])},d(u){u&&gn(e),n=!1,l()}}}function g0(r){let e,t;return{c(){e=Kr("span"),t=fa(r[6]),ot(e,"class","secondary svelte-ltkwvy")},m(n,l){vn(n,e,l),Ir(e,t)},p(n,l){l&64&&ph(t,n[6])},d(n){n&&gn(e)}}}function tT(r){let e,t,n,l,u,d,a,_,x,S=(r[7]?r[0].place_name:r[0].place_name.replace(/,.*/,""))+"",k,C,P=r[2]==="always"||r[2]!=="never"&&!r[0].address&&!r[0].id.startsWith("road.")&&!r[0].id.startsWith("address.")&&!r[0].id.startsWith("postal_code.")&&(!r[0].id.startsWith("poi.")||!r[5])&&!r[7],D,N,z=(r[7]?"":r[0].place_name.replace(/[^,]*,?\s*/,""))+"",B,O,G;function U(Y,_e){return _e&1&&(t=null),_e&1&&(n=null),_e&1&&(l=null),_e&1&&(u=null),Y[5]?eT:Y[0].address?Q3:(t==null&&(t=!!Y[0].id.startsWith("road.")),t?Y3:(n==null&&(n=!!Y[0].id.startsWith("address.")),n?J3:(l==null&&(l=!!Y[0].id.startsWith("postal_code.")),l?K3:(u==null&&(u=!!Y[0].id.startsWith("poi.")),u?X3:Y[7]?$3:H3))))}let K=U(r,-1),me=K(r),X=P&&g0(r);return{c(){e=Kr("li"),me.c(),d=po(),a=Kr("span"),_=Kr("span"),x=Kr("span"),k=fa(S),C=po(),X&&X.c(),D=po(),N=Kr("span"),B=fa(z),ot(x,"class","primary svelte-ltkwvy"),ot(_,"class","svelte-ltkwvy"),ot(N,"class","line2 svelte-ltkwvy"),ot(a,"class","texts svelte-ltkwvy"),ot(e,"tabindex","0"),ot(e,"data-selected",r[1]),ot(e,"class","svelte-ltkwvy"),Ao(e,"selected",r[1])},m(Y,_e){vn(Y,e,_e),me.m(e,null),Ir(e,d),Ir(e,a),Ir(a,_),Ir(_,x),Ir(x,k),Ir(_,C),X&&X.m(_,null),Ir(a,D),Ir(a,N),Ir(N,B),O||(G=[Zi(e,"mouseenter",r[12]),Zi(e,"focus",r[13])],O=!0)},p(Y,[_e]){K===(K=U(Y,_e))&&me?me.p(Y,_e):(me.d(1),me=K(Y),me&&(me.c(),me.m(e,d))),_e&1&&S!==(S=(Y[7]?Y[0].place_name:Y[0].place_name.replace(/,.*/,""))+"")&&ph(k,S),_e&37&&(P=Y[2]==="always"||Y[2]!=="never"&&!Y[0].address&&!Y[0].id.startsWith("road.")&&!Y[0].id.startsWith("address.")&&!Y[0].id.startsWith("postal_code.")&&(!Y[0].id.startsWith("poi.")||!Y[5])&&!Y[7]),P?X?X.p(Y,_e):(X=g0(Y),X.c(),X.m(_,null)):X&&(X.d(1),X=null),_e&1&&z!==(z=(Y[7]?"":Y[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&ph(B,z),_e&2&&ot(e,"data-selected",Y[1]),_e&2&&Ao(e,"selected",Y[1])},i:mn,o:mn,d(Y){Y&&gn(e),me.d(),X&&X.d(),O=!1,Bs(G)}}}function rT(r,e,t){var n;let l,u,{feature:d}=e,{selected:a=!1}=e,{showPlaceType:_}=e,{missingIconsCache:x}=e,{iconsBaseUrl:S}=e;const k=(n=d.properties)==null?void 0:n.categories;let C,P,D=0,N=d.place_type[0]==="reverse";function z(){P&&x.add(P),t(10,D++,D)}function B(U){d0.call(this,r,U)}function O(U){d0.call(this,r,U)}const G=()=>z();return r.$$set=U=>{"feature"in U&&t(0,d=U.feature),"selected"in U&&t(1,a=U.selected),"showPlaceType"in U&&t(2,_=U.showPlaceType),"missingIconsCache"in U&&t(9,x=U.missingIconsCache),"iconsBaseUrl"in U&&t(3,S=U.iconsBaseUrl)},r.$$.update=()=>{var U,K,me,X;if(r.$$.dirty&3640)do t(11,l--,l),t(4,C=k==null?void 0:k[l]),t(5,P=C?S+C.replace(/ /g,"_")+".svg":void 0);while(l>-1&&(!P||x.has(P)));r.$$.dirty&1&&t(6,u=((K=(U=d.properties)==null?void 0:U.categories)==null?void 0:K.join(", "))??((X=(me=d.properties)==null?void 0:me.place_type_name)==null?void 0:X[0])??d.place_type[0])},t(11,l=(k==null?void 0:k.length)??0),[d,a,_,S,C,P,u,N,z,x,D,l,B,O,G]}class nT extends ya{constructor(e){super(),_a(this,e,rT,tT,ga,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function iT(r){let e;return{c(){e=Kr("div"),e.innerHTML='',ot(e,"class","svelte-7cmwmc")},m(t,n){vn(t,e,n)},p:mn,i:mn,o:mn,d(t){t&&gn(e)}}}class oT extends ya{constructor(e){super(),_a(this,e,null,iT,ga,{})}}function sT(r){let e,t,n;return{c(){e=Zo("svg"),t=Zo("path"),ot(t,"stroke-width","4"),ot(t,"d","M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"),ot(t,"class","svelte-gzo3ar"),ot(e,"width",n=r[0]==="list"?20:void 0),ot(e,"viewBox","0 0 70 85"),ot(e,"fill","none"),ot(e,"class","svelte-gzo3ar"),Ao(e,"in-map",r[0]!=="list"),Ao(e,"list-icon",r[0]==="list")},m(l,u){vn(l,e,u),Ir(e,t)},p(l,[u]){u&1&&n!==(n=l[0]==="list"?20:void 0)&&ot(e,"width",n),u&1&&Ao(e,"in-map",l[0]!=="list"),u&1&&Ao(e,"list-icon",l[0]==="list")},i:mn,o:mn,d(l){l&&gn(e)}}}function aT(r,e,t){let{displayIn:n}=e;return r.$$set=l=>{"displayIn"in l&&t(0,n=l.displayIn)},[n]}class lT extends ya{constructor(e){super(),_a(this,e,aT,sT,ga,{displayIn:0})}}function cT(r){let e,t;return{c(){e=Zo("svg"),t=Zo("path"),ot(t,"d","M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"),ot(e,"viewBox","0 0 60.006 21.412"),ot(e,"width","14"),ot(e,"height","20"),ot(e,"class","svelte-en2qvf")},m(n,l){vn(n,e,l),Ir(e,t)},p:mn,i:mn,o:mn,d(n){n&&gn(e)}}}class uT extends ya{constructor(e){super(),_a(this,e,null,cT,ga,{})}}function hT(r){let e,t,n;return{c(){e=Zo("svg"),t=Zo("circle"),n=Zo("path"),ot(t,"cx","4.789"),ot(t,"cy","4.787"),ot(t,"r","3.85"),ot(t,"class","svelte-1aq105l"),ot(n,"d","M12.063 12.063 7.635 7.635"),ot(n,"class","svelte-1aq105l"),ot(e,"xmlns","http://www.w3.org/2000/svg"),ot(e,"width","13"),ot(e,"height","13"),ot(e,"viewBox","0 0 13 13"),ot(e,"class","svelte-1aq105l")},m(l,u){vn(l,e,u),Ir(e,t),Ir(e,n)},p:mn,i:mn,o:mn,d(l){l&&gn(e)}}}class fT extends ya{constructor(e){super(),_a(this,e,null,hT,ga,{})}}function dT(r,e,t){const n=e[1],l=e[0],u=n-l;return r===n&&t?r:((r-l)%u+u)%u+l}function dd(r){const e=[...r];return e[2]Math.abs((e[0]-360+e[2])/2)?e[0]-=360:e[2]+=360),e}let Ou;async function pT(r,e,t){const n=r==null?void 0:r.getCenterAndZoom();for(const l of e??[])if(!(n&&(l.minZoom!=null&&l.minZoom>n[0]||l.maxZoom!=null&&l.maxZoomDate.now()){if(!Ou.coords)break e;return Ou.coords}let u;try{return u=await new Promise((d,a)=>{t.signal.addEventListener("abort",()=>{a(Error("aborted"))}),navigator.geolocation.getCurrentPosition(_=>{d([_.coords.longitude,_.coords.latitude].map(x=>x.toFixed(6)).join(","))},_=>{a(_)},l)}),u}catch{}finally{l.cachedLocationExpiry&&(Ou={time:Date.now(),coords:u})}if(t.signal.aborted)return}if(l.type==="server-geolocation")return"ip";if(n&&l.type==="map-center")return n[1].toFixed(6)+","+n[2].toFixed(6)}}const mT=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(EAST|WEST|[EW])?$/i,_0=/^([+-]?[0-8]?[0-9])\s+([0-5]?[0-9]\.\d{3,})[\s,]{1,}([+-]?[0-1]?[0-9]?[0-9])\s+([0-5]?[0-9]\.\d{3,})$/,y0=/^(NORTH|SOUTH|[NS])?[\s]*([+-]?[0-8]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(NORTH|SOUTH|[NS])?[\s]*[,/;]?[\s]*(EAST|WEST|[EW])?[\s]*([+-]?[0-1]?[0-9]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(EAST|WEST|[EW])?$/i,v0=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(EAST|WEST|[EW])?$/i,b0=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)\s*(EAST|WEST|[EW])?$/i,w0=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|’’|´´|["″”\.])?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|´´|’’|["″”\.])?\s*(EAST|WEST|[EW])?$/i;function gT(r){if(!["DMS","DM","DD"].includes(r))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){const e=this.decimalCoordinates.split(",").map(P=>Number(P.trim())),t=Number(e[0]),n=Number(e[1]),l=Math.abs(t),u=Math.abs(n),d=t>0?"N":"S",a=n>0?"E":"W";let _;r=="DD"&&(_=`${l}° ${d}, ${u}° ${a}`);const x=Math.floor(l),S=Math.floor(u),k=(l-x)*60,C=(u-S)*60;if(r=="DM"){let P=x0(k,3).toFixed(3).padStart(6,"0"),D=x0(C,3).toFixed(3).padStart(6,"0");P.endsWith(".000")&&D.endsWith(".000")&&(P=P.replace(/\.000$/,""),D=D.replace(/\.000$/,"")),_=`${x}° ${P}' ${d}, ${S}° ${D}' ${a}`}if(r=="DMS"){const P=Math.floor(k),D=Math.floor(C);let N=((k-P)*60).toFixed(1).padStart(4,"0"),z=((C-D)*60).toFixed(1).padStart(4,"0");const B=P.toString().padStart(2,"0"),O=D.toString().padStart(2,"0");N.endsWith(".0")&&z.endsWith(".0")&&(N=N.replace(/\.0$/,""),z=z.replace(/\.0$/,"")),_=`${x}° ${B}' ${N}" ${d}, ${S}° ${O}' ${z}" ${a}`}return _}else throw new Error("no decimal coordinates to convert")}function x0(r,e){const t=Math.pow(10,e);return Math.round((r+Number.EPSILON)*t)/t}function Dg(r,e){e||(e=5),r=r.replace(/\s+/g," ").trim();let t=null,n=null,l="",u="",d=null,a=[],_=!1;if(mT.test(r))throw new Error("invalid coordinate value");if(_0.test(r))if(a=_0.exec(r),_=Nu(a),_)t=Math.abs(a[1])+a[2]/60,Number(a[1])<0&&(t*=-1),n=Math.abs(a[3])+a[4]/60,Number(a[3])<0&&(n*=-1),d="DM";else throw new Error("invalid coordinate format");else if(y0.test(r))if(a=y0.exec(r),_=Nu(a),_){if(t=a[2],n=a[6],t.includes(",")&&(t=t.replace(",",".")),n.includes(",")&&(n=n.replace(",",".")),d="DD",Number(Math.round(t))==Number(t))throw new Error("integer only coordinate provided");if(Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");a[1]?(l=a[1],u=a[5]):a[4]&&(l=a[4],u=a[8])}else throw new Error("invalid decimal coordinate format");else if(v0.test(r))if(a=v0.exec(r),_=Nu(a),_)t=Math.abs(parseInt(a[2])),a[4]&&(t+=a[4]/60,d="DM"),a[6]&&(t+=a[6].replace(",",".")/3600,d="DMS"),parseInt(a[2])<0&&(t=-1*t),n=Math.abs(parseInt(a[9])),a[11]&&(n+=a[11]/60),a[13]&&(n+=a[13].replace(",",".")/3600),parseInt(a[9])<0&&(n=-1*n),a[1]?(l=a[1],u=a[8]):a[7]&&(l=a[7],u=a[14]);else throw new Error("invalid DMS coordinates format");else if(b0.test(r))if(a=b0.exec(r),_=Nu(a),_)t=Math.abs(parseInt(a[2])),a[4]&&(t+=a[4]/60,d="DM"),a[6]&&(t+=a[6]/3600,d="DMS"),parseInt(a[2])<0&&(t=-1*t),n=Math.abs(parseInt(a[10])),a[12]&&(n+=a[12]/60),a[14]&&(n+=a[14]/3600),parseInt(a[10])<0&&(n=-1*n),a[1]?(l=a[1],u=a[9]):a[8]&&(l=a[8],u=a[16]);else throw new Error("invalid DMS coordinates format");else if(w0.test(r)){if(a=w0.exec(r),_=Nu(a),a.filter(x=>x).length<=5)throw new Error("invalid coordinates format");if(_)t=Math.abs(parseInt(a[2])),a[4]&&(t+=a[4].replace(",",".")/60,d="DM"),a[6]&&(t+=a[6].replace(",",".")/3600,d="DMS"),parseInt(a[2])<0&&(t=-1*t),n=Math.abs(parseInt(a[10])),a[12]&&(n+=a[12].replace(",",".")/60),a[14]&&(n+=a[14].replace(",",".")/3600),parseInt(a[10])<0&&(n=-1*n),a[1]?(l=a[1],u=a[9]):a[8]&&(l=a[8],u=a[16]);else throw new Error("invalid coordinates format")}if(_){if(Math.abs(n)>=180)throw new Error("invalid longitude value");if(Math.abs(t)>=90)throw new Error("invalid latitude value");if(l&&!u||!l&&u)throw new Error("invalid coordinates value");if(l&&l==u)throw new Error("invalid coordinates format");t.toString().includes(",")&&(t=t.replace(",",".")),n.toString().includes(",")&&(n=n.replace(",","."));let x=/S|SOUTH/i;x.test(l)&&t>0&&(t=-1*t),x=/W|WEST/i,x.test(u)&&n>0&&(n=-1*n);const S=a[0].trim();let k,C;const P=/[,/;\u0020]/g,D=S.match(P);if(D==null){const B=Math.floor(r.length/2);k=S.substring(0,B).trim(),C=S.substring(B).trim()}else{let B;D.length%2==1?B=Math.floor(D.length/2):B=D.length/2-1;let O=0;if(B==0)O=S.indexOf(D[0]),k=S.substring(0,O).trim(),C=S.substring(O+1).trim();else{let G=0,U=0;for(;G<=B;)O=S.indexOf(D[G],U),U=O+1,G++;k=S.substring(0,O).trim(),C=S.substring(O+1).trim()}}const N=k.split(".");if(N.length==2&&N[1]==0&&N[1].length!=2)throw new Error("invalid coordinates format");const z=C.split(".");if(z.length==2&&z[1]==0&&z[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(k)||/^\d+$/.test(C))throw new Error("degree only coordinate/s provided");return t=Number(Number(t).toFixed(e)),n=Number(Number(n).toFixed(e)),Object.freeze({verbatimCoordinates:S,verbatimLatitude:k,verbatimLongitude:C,decimalLatitude:t,decimalLongitude:n,decimalCoordinates:`${t},${n}`,originalFormat:d,closeEnough:_T,toCoordinateFormat:gT})}else throw new Error("coordinates pattern match failed")}function Nu(r){if(!isNaN(r[0]))return!1;const e=[...r];if(e.shift(),e.length%2>0)return!1;const t=/^[-+]?\d+([\.,]\d+)?$/,n=/[eastsouthnorthwest]+/i,l=e.length/2;for(let u=0;u{e.decimalLatitude?r.push(e):r.push({...e,...bT})}),[...r,...wT,...xT]}const kT=ST();Dg.formats=kT.map(r=>r.verbatimCoordinates);const TT=Dg;function k0(r,e,t){const n=r.slice();return n[84]=e[t],n[86]=t,n}function T0(r){let e,t;return e=new oT({}),{c(){da(e.$$.fragment)},m(n,l){Ds(e,n,l),t=!0},i(n){t||(Zn(e.$$.fragment,n),t=!0)},o(n){ui(e.$$.fragment,n),t=!1},d(n){Rs(e,n)}}}function E0(r){let e,t,n,l,u;return t=new uT({}),{c(){e=Kr("button"),da(t.$$.fragment),ot(e,"type","button"),ot(e,"title",r[9]),ot(e,"class","svelte-bz0zu3"),Ao(e,"active",r[0])},m(d,a){vn(d,e,a),Ds(t,e,null),n=!0,l||(u=Zi(e,"click",r[69]),l=!0)},p(d,a){(!n||a[0]&512)&&ot(e,"title",d[9]),(!n||a[0]&1)&&Ao(e,"active",d[0])},i(d){n||(Zn(t.$$.fragment,d),n=!0)},o(d){ui(t.$$.fragment,d),n=!1},d(d){d&&gn(e),Rs(t),l=!1,u()}}}function ET(r){let e,t=[],n=new Map,l,u,d,a=m0(r[14]);const _=x=>x[84].id+(x[84].address?","+x[84].address:"");for(let x=0;x{X=null}),Hf()),(!G||ft[0]&2)&&Ao(x,"displayable",Me[1]!==""),Me[5]==="button"?Y?(Y.p(Me,ft),ft[0]&32&&Zn(Y,1)):(Y=E0(Me),Y.c(),Zn(Y,1),Y.m(n,D)):Y&&(Zf(),ui(Y,1,1,()=>{Y=null}),Hf()),ze&&ze.p&&(!G||ft[1]&536870912)&&I3(ze,_e,Me,Me[60],G?C3(_e,Me[60],ft,null):A3(Me[60]),null);let Ct=z;z=Ze(Me),z===Ct?~z&&ce[z].p(Me,ft):(B&&(Zf(),ui(ce[Ct],1,1,()=>{ce[Ct]=null}),Hf()),~z?(B=ce[z],B?B.p(Me,ft):(B=ce[z]=re[z](Me),B.c()),Zn(B,1),B.m(t,null)):B=null),(!G||ft[0]&4&&O!==(O=h0(Me[2])+" svelte-bz0zu3"))&&ot(t,"class",O),(!G||ft[0]&22)&&Ao(t,"can-collapse",Me[4]&&Me[1]==="")},i(Me){G||(Zn(me),Zn(u.$$.fragment,Me),Zn(k.$$.fragment,Me),Zn(X),Zn(Y),Zn(ze,Me),Zn(B),G=!0)},o(Me){ui(me),ui(u.$$.fragment,Me),ui(k.$$.fragment,Me),ui(X),ui(Y),ui(ze,Me),ui(B),G=!1},d(Me){Me&&(gn(e),gn(t)),Rs(u),r[63](null),Rs(k),X&&X.d(),Y&&Y.d(),ze&&ze.d(Me),~z&&ce[z].d(),U=!1,Bs(K)}}}function LT(r,e,t){let n,l,{$$slots:u={},$$scope:d}=e;const a={continental_marine:4,country:4,major_landform:8,region:5,subregion:6,county:7,joint_municipality:8,joint_submunicipality:9,municipality:10,municipal_district:11,locality:12,neighbourhood:13,place:14,postal_code:14,road:16,poi:17,address:18,"poi.peak":15,"poi.shop":18,"poi.cafe":18,"poi.restaurant":18,"poi.aerodrome":13};let{class:_=void 0}=e,{apiKey:x}=e,{bbox:S=void 0}=e,{clearButtonTitle:k="clear"}=e,{clearOnBlur:C=!1}=e,{collapsed:P=!1}=e,{country:D=void 0}=e,{debounceSearch:N=200}=e,{enableReverse:z="never"}=e,{errorMessage:B="Something went wrong…"}=e,{filter:O=()=>!0}=e,{flyTo:G=!0}=e,{fuzzyMatch:U=!0}=e,{language:K=void 0}=e,{limit:me=void 0}=e,{mapController:X=void 0}=e,{minLength:Y=2}=e,{noResultsMessage:_e="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=e,{placeholder:ze="Search"}=e,{proximity:re=[{type:"server-geolocation"}]}=e,{reverseActive:ce=z==="always"}=e,{reverseButtonTitle:Ze="toggle reverse geocoding"}=e,{searchValue:Me=""}=e,{pickedResultStyle:ft="full-geometry"}=e,{showPlaceType:Ct="if-needed"}=e,{showResultsWhileTyping:Ot=!0}=e,{selectFirst:Ke=!0}=e,{flyToSelected:Kt=!1}=e,{markerOnSelected:vt=!0}=e,{types:At=void 0}=e,{exhaustiveReverseGeocoding:Vt=!1}=e,{excludeTypes:sr=!1}=e,{zoom:fr=a}=e,{apiUrl:er="https://api.maptiler.com/geocoding"}=e,{fetchParameters:Nt={}}=e,{iconsBaseUrl:nr="https://cdn.maptiler.com/maptiler-geocoding-control/v2.0.1/icons/"}=e,{adjustUrlQuery:tr=()=>{}}=e;function Lr(){We.focus()}function Pr(){We.blur()}function st(W,Be=!0,Fe=!1){t(1,Me=W),Be?(t(15,Ye=-1),ct()):(Jt(!Fe,Fe),setTimeout(()=>{We.focus(),We.select()}))}function Lt(){t(14,tt=void 0),t(56,ne=void 0),t(15,Ye=-1)}function De(){t(55,it=[]),t(56,ne=void 0)}let at=!1,tt,it,ne,br="",We,Ye=-1,jt,bn=[],wn,Mn,ni,ii;const $o=new Set,Jr=B3();R3(()=>{X&&(X.setEventHandler(void 0),X.indicateReverse(!1),X.setSelectedMarker(-1),X.setFeatures(void 0,void 0,!1))});function ct(W){if(Mn&&(clearTimeout(Mn),Mn=void 0),Ye>-1&&tt)t(56,ne=tt[Ye]),t(1,Me=ne.place_type[0]==="reverse"?ne.place_name:ne.place_name.replace(/,.*/,"")),t(18,jt=void 0),t(55,it=void 0),t(15,Ye=-1);else if(Me){const Be=W||!Xn(Me);xn(Me,{exact:!0}).then(()=>{t(55,it=tt),t(56,ne=void 0),Be&&Bo()}).catch(Fe=>t(18,jt=Fe))}}function Xn(W){try{return TT(W,6)}catch{return!1}}async function xn(W,{byId:Be=!1,exact:Fe=!1}={}){t(18,jt=void 0),wn==null||wn.abort();const qe=new AbortController;t(19,wn=qe);try{const Xe=Xn(W),ut=new URLSearchParams;if(K!==void 0&&ut.set("language",Array.isArray(K)?K.join(","):K??""),At&&ut.set("types",At.join(",")),sr&&ut.set("excludeTypes",String(sr)),S&&ut.set("bbox",S.map(gr=>gr.toFixed(6)).join(",")),D&&ut.set("country",Array.isArray(D)?D.join(","):D),!Be&&!Xe){const gr=await pT(X,re,qe);gr&&ut.set("proximity",gr),(Fe||!Ot)&&ut.set("autocomplete","false"),ut.set("fuzzyMatch",String(U))}me!==void 0&&(Vt||!Xe||(At==null?void 0:At.length)===1)&&ut.set("limit",String(me)),ut.set("key",x),tr(ut);const Pt=er+"/"+encodeURIComponent(Xe?Xe.decimalLongitude+","+Xe.decimalLatitude:W)+".json?"+ut.toString();if(Pt===br){Be?(t(14,tt=void 0),t(56,ne=bn[0])):t(14,tt=bn);return}br=Pt;const $t=await fetch(Pt,{signal:qe.signal,...Nt});if(!$t.ok)throw new Error(await $t.text());const ar=await $t.json();Jr("response",{url:Pt,featureCollection:ar}),Be?(t(14,tt=void 0),t(56,ne=ar.features[0]),bn=[ne]):(t(14,tt=ar.features.filter(O)),Xe&&tt.unshift({type:"Feature",properties:{},id:"reverse_"+Xe.decimalLongitude+"_"+Xe.decimalLatitude,text:Xe.decimalLatitude+", "+Xe.decimalLongitude,place_name:Xe.decimalLatitude+", "+Xe.decimalLongitude,place_type:["reverse"],center:[Xe.decimalLongitude,Xe.decimalLatitude],bbox:[Xe.decimalLongitude,Xe.decimalLatitude,Xe.decimalLongitude,Xe.decimalLatitude],geometry:{type:"Point",coordinates:[Xe.decimalLongitude,Xe.decimalLatitude]}}),bn=tt,Xe&&We.focus())}catch(Xe){if(Xe&&typeof Xe=="object"&&"name"in Xe&&Xe.name==="AbortError")return;throw Xe}finally{qe===wn&&t(19,wn=void 0)}}function Bo(){var W;if(!(it!=null&&it.length)||!G)return;const Be=[180,90,-180,-90],Fe=!it.some(Xe=>!Xe.matching_text);let qe;for(const Xe of it){const ut=Or(Xe);if(qe=qe===void 0?ut:ut===void 0?qe:Math.max(qe,ut),Fe||!Xe.matching_text)for(const Pt of[0,1,2,3])Be[Pt]=Math[Pt<2?"min":"max"](Be[Pt],((W=Xe.bbox)==null?void 0:W[Pt])??Xe.center[Pt%2])}X&&it.length>0&&(ne&&Be[0]===Be[2]&&Be[1]===Be[3]?X.flyTo(ne.center,Or(ne)):X.fitBounds(dd(Be),50,qe))}function Or(W){var Be;if(!W.bbox||W.bbox[0]!==W.bbox[2]&&W.bbox[1]!==W.bbox[3])return;const Fe=W.id.replace(/\..*/,"");return(Array.isArray((Be=W.properties)==null?void 0:Be.categories)?W.properties.categories.reduce((qe,Xe)=>{const ut=fr[Fe+"."+Xe];return qe===void 0?ut:ut===void 0?qe:Math.max(qe,ut)},void 0):void 0)??fr[Fe]}function mt(W){t(0,ce=z==="always"),t(14,tt=void 0),t(56,ne=void 0),t(15,Ye=-1),st(W[1].toFixed(6)+", "+dT(W[0],[-180,180],!0).toFixed(6),!1,!0)}function rr(W){if(!tt)return;let Be=W.key==="ArrowDown"?1:W.key==="ArrowUp"?-1:0;Be&&(Ye===(Ke?0:-1)&&Be===-1&&t(15,Ye=tt.length),t(15,Ye+=Be),Ye>=tt.length&&t(15,Ye=-1),Ye<0&&Ke&&t(15,Ye=0),W.preventDefault())}function Jt(W=!0,Be=!1){if(t(18,jt=void 0),Ot||Be){if(Mn&&clearTimeout(Mn),Me.length{xn(Fe).catch(qe=>t(18,jt=qe))},W?N:0)}else t(14,tt=void 0),t(18,jt=void 0)}function Nr(W){t(56,ne=W),t(1,Me=W.place_name),t(15,Ye=-1)}const vi=()=>We.focus();function Qt(W){Nm[W?"unshift":"push"](()=>{We=W,t(17,We)})}function ro(){Me=this.value,t(1,Me),t(13,at),t(28,C)}const an=()=>t(13,at=!0),pe=()=>t(13,at=!1),Z=()=>Jt(),$=()=>{t(1,Me=""),We.focus()},te=()=>t(0,ce=!ce),le=()=>t(18,jt=void 0),Ce=W=>t(15,Ye=W),Ie=W=>Nr(W),Pe=()=>{Ke||t(15,Ye=-1)},Se=()=>{};return r.$$set=W=>{"class"in W&&t(2,_=W.class),"apiKey"in W&&t(26,x=W.apiKey),"bbox"in W&&t(27,S=W.bbox),"clearButtonTitle"in W&&t(3,k=W.clearButtonTitle),"clearOnBlur"in W&&t(28,C=W.clearOnBlur),"collapsed"in W&&t(4,P=W.collapsed),"country"in W&&t(29,D=W.country),"debounceSearch"in W&&t(30,N=W.debounceSearch),"enableReverse"in W&&t(5,z=W.enableReverse),"errorMessage"in W&&t(6,B=W.errorMessage),"filter"in W&&t(31,O=W.filter),"flyTo"in W&&t(32,G=W.flyTo),"fuzzyMatch"in W&&t(33,U=W.fuzzyMatch),"language"in W&&t(34,K=W.language),"limit"in W&&t(35,me=W.limit),"mapController"in W&&t(36,X=W.mapController),"minLength"in W&&t(37,Y=W.minLength),"noResultsMessage"in W&&t(7,_e=W.noResultsMessage),"placeholder"in W&&t(8,ze=W.placeholder),"proximity"in W&&t(38,re=W.proximity),"reverseActive"in W&&t(0,ce=W.reverseActive),"reverseButtonTitle"in W&&t(9,Ze=W.reverseButtonTitle),"searchValue"in W&&t(1,Me=W.searchValue),"pickedResultStyle"in W&&t(39,ft=W.pickedResultStyle),"showPlaceType"in W&&t(10,Ct=W.showPlaceType),"showResultsWhileTyping"in W&&t(40,Ot=W.showResultsWhileTyping),"selectFirst"in W&&t(11,Ke=W.selectFirst),"flyToSelected"in W&&t(41,Kt=W.flyToSelected),"markerOnSelected"in W&&t(42,vt=W.markerOnSelected),"types"in W&&t(43,At=W.types),"exhaustiveReverseGeocoding"in W&&t(44,Vt=W.exhaustiveReverseGeocoding),"excludeTypes"in W&&t(45,sr=W.excludeTypes),"zoom"in W&&t(46,fr=W.zoom),"apiUrl"in W&&t(47,er=W.apiUrl),"fetchParameters"in W&&t(48,Nt=W.fetchParameters),"iconsBaseUrl"in W&&t(12,nr=W.iconsBaseUrl),"adjustUrlQuery"in W&&t(49,tr=W.adjustUrlQuery),"$$scope"in W&&t(60,d=W.$$scope)},r.$$.update=()=>{if(r.$$.dirty[0]&32&&t(0,ce=z==="always"),r.$$.dirty[0]&268443648&&setTimeout(()=>{t(16,ni=at),C&&!at&&t(1,Me="")}),r.$$.dirty[0]&16386|r.$$.dirty[1]&64&&Me.lengtht(18,jt=W)),r.$$.dirty[1]&100663330&&(X&&ne&&ne.id!==ii&&G&&(!ne.bbox||ne.bbox[0]===ne.bbox[2]&&ne.bbox[1]===ne.bbox[3]?X.flyTo(ne.center,Or(ne)):X.fitBounds(dd(ne.bbox),50,Or(ne)),t(14,tt=void 0),t(55,it=void 0),t(15,Ye=-1)),t(57,ii=ne==null?void 0:ne.id)),r.$$.dirty[0]&18432&&Ke&&tt!=null&&tt.length&&t(15,Ye=0),r.$$.dirty[0]&2&&t(15,Ye=-1),r.$$.dirty[0]&16384|r.$$.dirty[1]&16777216&&it!==tt&&t(55,it=void 0),r.$$.dirty[0]&81921|r.$$.dirty[1]&16777248&&X&&X.setEventHandler(W=>{switch(W.type){case"mapClick":ce&&mt(W.coordinates);break;case"markerClick":{const Be=tt==null?void 0:tt.find(Fe=>Fe.id===W.id);Be&&Nr(Be)}break;case"markerMouseEnter":it&&t(15,Ye=ni?(tt==null?void 0:tt.findIndex(Be=>Be.id===W.id))??-1:-1);break;case"markerMouseLeave":it&&t(15,Ye=-1);break}}),r.$$.dirty[0]&49152&&t(58,l=tt==null?void 0:tt[Ye]),r.$$.dirty[1]&134218786&&X&&l&&G&&Kt&&X.flyTo(l.center,Or(l)),r.$$.dirty[1]&256&&t(59,n=ft==="full-geometry-including-polygon-center-marker"),r.$$.dirty[1]&268437536&&(vt||X==null||X.setFeatures(void 0,void 0,n)),r.$$.dirty[1]&419432480&&X&&vt&&!it&&(X.setFeatures(l?[l]:void 0,void 0,n),X.setSelectedMarker(l?0:-1)),r.$$.dirty[1]&318767136&&X&&X.setFeatures(it,ne,n),r.$$.dirty[0]&32768|r.$$.dirty[1]&16777248&&it&&X&&X.setSelectedMarker(Ye),r.$$.dirty[0]&2|r.$$.dirty[1]&32&&X){const W=Xn(Me);X.setReverseMarker(W?[W.decimalLongitude,W.decimalLatitude]:void 0)}r.$$.dirty[1]&134217728&&Jr("select",{feature:l}),r.$$.dirty[1]&33554432&&Jr("pick",{feature:ne}),r.$$.dirty[0]&81920&&Jr("optionsvisibilitychange",{optionsVisible:ni&&!!tt}),r.$$.dirty[0]&16384&&Jr("featureslisted",{features:tt}),r.$$.dirty[1]&16777216&&Jr("featuresmarked",{features:it}),r.$$.dirty[0]&1&&Jr("reversetoggle",{reverse:ce}),r.$$.dirty[0]&2&&Jr("querychange",{query:Me}),r.$$.dirty[0]&1|r.$$.dirty[1]&32&&X&&X.indicateReverse(ce)},[ce,Me,_,k,P,z,B,_e,ze,Ze,Ct,Ke,nr,at,tt,Ye,ni,We,jt,wn,$o,ct,rr,Jt,Nr,a,x,S,C,D,N,O,G,U,K,me,X,Y,re,ft,Ot,Kt,vt,At,Vt,sr,fr,er,Nt,tr,Lr,Pr,st,Lt,De,it,ne,ii,l,n,d,u,vi,Qt,ro,an,pe,Z,$,te,le,Ce,Ie,Pe,Se]}let PT=class extends ya{constructor(r){super(),_a(this,r,LT,AT,ga,{ZOOM_DEFAULTS:25,class:2,apiKey:26,bbox:27,clearButtonTitle:3,clearOnBlur:28,collapsed:4,country:29,debounceSearch:30,enableReverse:5,errorMessage:6,filter:31,flyTo:32,fuzzyMatch:33,language:34,limit:35,mapController:36,minLength:37,noResultsMessage:7,placeholder:8,proximity:38,reverseActive:0,reverseButtonTitle:9,searchValue:1,pickedResultStyle:39,showPlaceType:10,showResultsWhileTyping:40,selectFirst:11,flyToSelected:41,markerOnSelected:42,types:43,exhaustiveReverseGeocoding:44,excludeTypes:45,zoom:46,apiUrl:47,fetchParameters:48,iconsBaseUrl:12,adjustUrlQuery:49,focus:50,blur:51,setQuery:52,clearList:53,clearMap:54},null,[-1,-1,-1])}get ZOOM_DEFAULTS(){return this.$$.ctx[25]}get focus(){return this.$$.ctx[50]}get blur(){return this.$$.ctx[51]}get setQuery(){return this.$$.ctx[52]}get clearList(){return this.$$.ctx[53]}get clearMap(){return this.$$.ctx[54]}};function gh(r,e,t={}){const n={type:"Feature"};return(t.id===0||t.id)&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.properties=e||{},n.geometry=r,n}function Rg(r,e,t={}){for(const n of r){if(n.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(n[n.length-1].length!==n[0].length)throw new Error("First and last Position are not equivalent.");for(let l=0;l0&&u[u.length-1])&&(x[0]===6||x[0]===2)){t=0;continue}if(x[0]===3&&(!u||x[1]>u[0]&&x[1]e?1:r0){if(e.right===null)break;if(t(r,e.right.key)>0){var a=e.right;if(e.right=a.left,a.left=e,e=a,e.right===null)break}l.right=e,l=e,e=e.right}else break}return l.right=e.left,u.left=e.right,e.left=n.right,e.right=n.left,e}function rm(r,e,t,n){var l=new pa(r,e);if(t===null)return l.left=l.right=null,l;t=sa(r,t,n);var u=n(r,t.key);return u<0?(l.left=t.left,l.right=t,t.left=null):u>=0&&(l.right=t.right,l.left=t,t.right=null),l}function M0(r,e,t){var n=null,l=null;if(e){e=sa(r,e,t);var u=t(e.key,r);u===0?(n=e.left,l=e.right):u<0?(l=e.right,e.right=null,n=e):(n=e.left,e.left=null,l=e)}return{left:n,right:l}}function DT(r,e,t){return e===null?r:(r===null||(e=sa(r.key,e,t),e.left=r),e)}function Vm(r,e,t,n,l){if(r){n(""+e+(t?"└── ":"├── ")+l(r)+` -`);var u=e+(t?" ":"│ ");r.left&&Vm(r.left,u,!1,n,l),r.right&&Vm(r.right,u,!0,n,l)}}var Rg=function(){function r(e){e===void 0&&(e=zT),this._root=null,this._size=0,this._comparator=e}return r.prototype.insert=function(e,t){return this._size++,this._root=rm(e,t,this._root,this._comparator)},r.prototype.add=function(e,t){var n=new pa(e,t);this._root===null&&(n.left=n.right=null,this._size++,this._root=n);var l=this._comparator,u=sa(e,this._root,l),d=l(e,u.key);return d===0?this._root=u:(d<0?(n.left=u.left,n.right=u,u.left=null):d>0&&(n.right=u.right,n.left=u,u.right=null),this._size++,this._root=n),this._root},r.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},r.prototype._remove=function(e,t,n){var l;if(t===null)return null;t=sa(e,t,n);var u=n(e,t.key);return u===0?(t.left===null?l=t.right:(l=sa(e,t.left,n),l.right=t.right),this._size--,l):t},r.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=sa(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},r.prototype.findStatic=function(e){for(var t=this._root,n=this._comparator;t;){var l=n(e,t.key);if(l===0)return t;l<0?t=t.left:t=t.right}return null},r.prototype.find=function(e){return this._root&&(this._root=sa(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},r.prototype.contains=function(e){for(var t=this._root,n=this._comparator;t;){var l=n(e,t.key);if(l===0)return!0;l<0?t=t.left:t=t.right}return!1},r.prototype.forEach=function(e,t){for(var n=this._root,l=[],u=!1;!u;)n!==null?(l.push(n),n=n.left):l.length!==0?(n=l.pop(),e.call(t,n),n=n.right):u=!0;return this},r.prototype.range=function(e,t,n,l){for(var u=[],d=this._comparator,a=this._root,_;u.length!==0||a;)if(a)u.push(a),a=a.left;else{if(a=u.pop(),_=d(a.key,t),_>0)break;if(d(a.key,e)>=0&&n.call(l,a))return this;a=a.right}return this},r.prototype.keys=function(){var e=[];return this.forEach(function(t){var n=t.key;return e.push(n)}),e},r.prototype.values=function(){var e=[];return this.forEach(function(t){var n=t.data;return e.push(n)}),e},r.prototype.min=function(){return this._root?this.minNode(this._root).key:null},r.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},r.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},r.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},r.prototype.at=function(e){for(var t=this._root,n=!1,l=0,u=[];!n;)if(t)u.push(t),t=t.left;else if(u.length>0){if(t=u.pop(),l===e)return t;l++,t=t.right}else n=!0;return null},r.prototype.next=function(e){var t=this._root,n=null;if(e.right){for(n=e.right;n.left;)n=n.left;return n}for(var l=this._comparator;t;){var u=l(e.key,t.key);if(u===0)break;u<0?(n=t,t=t.left):t=t.right}return n},r.prototype.prev=function(e){var t=this._root,n=null;if(e.left!==null){for(n=e.left;n.right;)n=n.right;return n}for(var l=this._comparator;t;){var u=l(e.key,t.key);if(u===0)break;u<0?t=t.left:(n=t,t=t.right)}return n},r.prototype.clear=function(){return this._root=null,this._size=0,this},r.prototype.toList=function(){return BT(this._root)},r.prototype.load=function(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!1);var l=e.length,u=this._comparator;if(n&&Wm(e,t,0,l-1,u),this._root===null)this._root=qm(e,t,0,l),this._size=l;else{var d=FT(this.toList(),RT(e,t),u);l=this._size+l,this._root=Gm({head:d},0,l)}return this},r.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(r.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),r.prototype.toString=function(e){e===void 0&&(e=function(n){return String(n.key)});var t=[];return Vm(this._root,"",!0,function(n){return t.push(n)},e),t.join("")},r.prototype.update=function(e,t,n){var l=this._comparator,u=M0(e,this._root,l),d=u.left,a=u.right;l(e,t)<0?a=rm(t,n,a,l):d=rm(t,n,d,l),this._root=DT(d,a,l)},r.prototype.split=function(e){return M0(e,this._root,this._comparator)},r.prototype[Symbol.iterator]=function(){var e,t,n;return PT(this,function(l){switch(l.label){case 0:e=this._root,t=[],n=!1,l.label=1;case 1:return n?[3,6]:e===null?[3,2]:(t.push(e),e=e.left,[3,5]);case 2:return t.length===0?[3,4]:(e=t.pop(),[4,e]);case 3:return l.sent(),e=e.right,[3,5];case 4:n=!0,l.label=5;case 5:return[3,1];case 6:return[2]}})},r}();function qm(r,e,t,n){var l=n-t;if(l>0){var u=t+Math.floor(l/2),d=r[u],a=e[u],_=new pa(d,a);return _.left=qm(r,e,t,u),_.right=qm(r,e,u+1,n),_}return null}function RT(r,e){for(var t=new pa(null,null),n=t,l=0;l0?(e=u=u.next=t.pop(),e=e.right):n=!0;return u.next=null,l.next}function Gm(r,e,t){var n=t-e;if(n>0){var l=e+Math.floor(n/2),u=Gm(r,e,l),d=r.head;return d.left=u,r.head=r.head.next,d.right=Gm(r,l+1,t),d}return null}function FT(r,e,t){for(var n=new pa(null,null),l=n,u=r,d=e;u!==null&&d!==null;)t(u.key,d.key)<0?(l.next=u,u=u.next):(l.next=d,d=d.next),l=l.next;return u!==null?l.next=u:d!==null&&(l.next=d),n.next}function Wm(r,e,t,n,l){if(!(t>=n)){for(var u=r[t+n>>1],d=t-1,a=n+1;;){do d++;while(l(r[d],u)<0);do a--;while(l(r[a],u)>0);if(d>=a)break;var _=r[d];r[d]=r[a],r[a]=_,_=e[d],e[d]=e[a],e[a]=_}Wm(r,e,t,a,l),Wm(r,e,a+1,n,l)}}const Ps=11102230246251565e-32,Ii=134217729,OT=(3+8*Ps)*Ps;function nm(r,e,t,n,l){let u,d,a,_,x=e[0],S=n[0],k=0,C=0;S>x==S>-x?(u=x,x=e[++k]):(u=S,S=n[++C]);let P=0;if(kx==S>-x?(d=x+u,a=u-(d-x),x=e[++k]):(d=S+u,a=u-(d-S),S=n[++C]),u=d,a!==0&&(l[P++]=a);kx==S>-x?(d=u+x,_=d-u,a=u-(d-_)+(x-_),x=e[++k]):(d=u+S,_=d-u,a=u-(d-_)+(S-_),S=n[++C]),u=d,a!==0&&(l[P++]=a);for(;k=Me||-Ze>=Me||(k=r-_e,a=r-(_e+k)+(k-l),k=t-ze,x=t-(ze+k)+(k-l),k=e-re,_=e-(re+k)+(k-u),k=n-ce,S=n-(ce+k)+(k-u),a===0&&_===0&&x===0&&S===0)||(Me=VT*d+OT*Math.abs(Ze),Ze+=_e*S+ce*a-(re*x+ze*_),Ze>=Me||-Ze>=Me))return Ze;U=a*ce,C=Ii*a,P=C-(C-a),D=a-P,C=Ii*ce,N=C-(C-ce),z=ce-N,K=D*z-(U-P*N-D*N-P*z),me=_*ze,C=Ii*_,P=C-(C-_),D=_-P,C=Ii*ze,N=C-(C-ze),z=ze-N,X=D*z-(me-P*N-D*N-P*z),B=K-X,k=K-B,Gi[0]=K-(B+k)+(k-X),O=U+B,k=O-U,G=U-(O-k)+(B-k),B=G-me,k=G-B,Gi[1]=G-(B+k)+(k-me),Y=O+B,k=Y-O,Gi[2]=O-(Y-k)+(B-k),Gi[3]=Y;const ft=nm(4,lc,4,Gi,C0);U=_e*S,C=Ii*_e,P=C-(C-_e),D=_e-P,C=Ii*S,N=C-(C-S),z=S-N,K=D*z-(U-P*N-D*N-P*z),me=re*x,C=Ii*re,P=C-(C-re),D=re-P,C=Ii*x,N=C-(C-x),z=x-N,X=D*z-(me-P*N-D*N-P*z),B=K-X,k=K-B,Gi[0]=K-(B+k)+(k-X),O=U+B,k=O-U,G=U-(O-k)+(B-k),B=G-me,k=G-B,Gi[1]=G-(B+k)+(k-me),Y=O+B,k=Y-O,Gi[2]=O-(Y-k)+(B-k),Gi[3]=Y;const Ct=nm(ft,C0,4,Gi,I0);U=a*S,C=Ii*a,P=C-(C-a),D=a-P,C=Ii*S,N=C-(C-S),z=S-N,K=D*z-(U-P*N-D*N-P*z),me=_*x,C=Ii*_,P=C-(C-_),D=_-P,C=Ii*x,N=C-(C-x),z=x-N,X=D*z-(me-P*N-D*N-P*z),B=K-X,k=K-B,Gi[0]=K-(B+k)+(k-X),O=U+B,k=O-U,G=U-(O-k)+(B-k),B=G-me,k=G-B,Gi[1]=G-(B+k)+(k-me),Y=O+B,k=Y-O,Gi[2]=O-(Y-k)+(B-k),Gi[3]=Y;const Ot=nm(Ct,I0,4,Gi,A0);return A0[Ot-1]}function GT(r,e,t,n,l,u){const d=(e-u)*(t-l),a=(r-l)*(n-u),_=d-a,x=Math.abs(d+a);return Math.abs(_)>=jT*x?_:-qT(r,e,t,n,l,u,x)}const ju=(r,e)=>r.ll.x<=e.x&&e.x<=r.ur.x&&r.ll.y<=e.y&&e.y<=r.ur.y,Zm=(r,e)=>{if(e.ur.x{if(-lar.x*e.y-r.y*e.x,mw=(r,e)=>r.x*e.x+r.y*e.y,z0=(r,e,t)=>{const n=GT(r.x,r.y,e.x,e.y,t.x,t.y);return n>0?-1:n<0?1:0},pd=r=>Math.sqrt(mw(r,r)),HT=(r,e,t)=>{const n={x:e.x-r.x,y:e.y-r.y},l={x:t.x-r.x,y:t.y-r.y};return $f(l,n)/pd(l)/pd(n)},$T=(r,e,t)=>{const n={x:e.x-r.x,y:e.y-r.y},l={x:t.x-r.x,y:t.y-r.y};return mw(l,n)/pd(l)/pd(n)},D0=(r,e,t)=>e.y===0?null:{x:r.x+e.x/e.y*(t-r.y),y:t},R0=(r,e,t)=>e.x===0?null:{x:t,y:r.y+e.y/e.x*(t-r.x)},XT=(r,e,t,n)=>{if(e.x===0)return R0(t,n,r.x);if(n.x===0)return R0(r,e,t.x);if(e.y===0)return D0(t,n,r.y);if(n.y===0)return D0(r,e,t.y);const l=$f(e,n);if(l==0)return null;const u={x:t.x-r.x,y:t.y-r.y},d=$f(u,e)/l,a=$f(u,n)/l,_=r.x+a*e.x,x=t.x+d*n.x,S=r.y+a*e.y,k=t.y+d*n.y,C=(_+x)/2,P=(S+k)/2;return{x:C,y:P}};class Mo{static compare(e,t){const n=Mo.comparePoints(e.point,t.point);return n!==0?n:(e.point!==t.point&&e.link(t),e.isLeft!==t.isLeft?e.isLeft?1:-1:ua.compare(e.segment,t.segment))}static comparePoints(e,t){return e.xt.x?1:e.yt.y?1:0}constructor(e,t){e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=t}link(e){if(e.point===this.point)throw new Error("Tried to link already linked events");const t=e.point.events;for(let n=0,l=t.length;n{const u=l.otherSE;t.set(l,{sine:HT(this.point,e.point,u.point),cosine:$T(this.point,e.point,u.point)})};return(l,u)=>{t.has(l)||n(l),t.has(u)||n(u);const{sine:d,cosine:a}=t.get(l),{sine:_,cosine:x}=t.get(u);return d>=0&&_>=0?ax?-1:0:d<0&&_<0?ax?1:0:_d?1:0}}}let KT=0;class ua{static compare(e,t){const n=e.leftSE.point.x,l=t.leftSE.point.x,u=e.rightSE.point.x,d=t.rightSE.point.x;if(da&&_>x)return-1;const k=e.comparePoint(t.leftSE.point);if(k<0)return 1;if(k>0)return-1;const C=t.comparePoint(e.rightSE.point);return C!==0?C:-1}if(n>l){if(a<_&&a_&&a>S)return 1;const k=t.comparePoint(e.leftSE.point);if(k!==0)return k;const C=e.comparePoint(t.rightSE.point);return C<0?1:C>0?-1:1}if(a<_)return-1;if(a>_)return 1;if(ud){const k=e.comparePoint(t.rightSE.point);if(k<0)return 1;if(k>0)return-1}if(u!==d){const k=x-a,C=u-n,P=S-_,D=d-l;if(k>C&&PD)return-1}return u>d?1:uS?1:e.idt.id?1:0}constructor(e,t,n,l){this.id=++KT,this.leftSE=e,e.segment=this,e.otherSE=t,this.rightSE=t,t.segment=this,t.otherSE=e,this.rings=n,this.windings=l}static fromRing(e,t,n){let l,u,d;const a=Mo.comparePoints(e,t);if(a<0)l=e,u=t,d=1;else if(a>0)l=t,u=e,d=-1;else throw new Error(`Tried to create degenerate segment at [${e.x}, ${e.y}]`);const _=new Mo(l,!0),x=new Mo(u,!1);return new ua(_,x,[n],[d])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const e=this.leftSE.point.y,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:et?e:t}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}comparePoint(e){if(this.isAnEndpoint(e))return 0;const t=this.leftSE.point,n=this.rightSE.point,l=this.vector();if(t.x===n.x)return e.x===t.x?0:e.x0&&a.swapEvents(),Mo.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(l.checkForConsuming(),u.checkForConsuming()),t}swapEvents(){const e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let t=0,n=this.windings.length;t0){const u=t;t=n,n=u}if(t.prev===n){const u=t;t=n,n=u}for(let u=0,d=n.rings.length;ul.length===1&&l[0].isSubject;this._isInResult=n(e)!==n(t);break}default:throw new Error(`Unrecognized operation type found ${Wo.type}`)}return this._isInResult}}class B0{constructor(e,t,n){if(!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=t,this.isExterior=n,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const l=yh.round(e[0][0],e[0][1]);this.bbox={ll:{x:l.x,y:l.y},ur:{x:l.x,y:l.y}};let u=l;for(let d=1,a=e.length;dthis.bbox.ur.x&&(this.bbox.ur.x=_.x),_.y>this.bbox.ur.y&&(this.bbox.ur.y=_.y),u=_)}(l.x!==u.x||l.y!==u.y)&&this.segments.push(ua.fromRing(u,l,this))}getSweepEvents(){const e=[];for(let t=0,n=this.segments.length;tthis.bbox.ur.x&&(this.bbox.ur.x=u.bbox.ur.x),u.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=u.bbox.ur.y),this.interiorRings.push(u)}this.multiPoly=t}getSweepEvents(){const e=this.exteriorRing.getSweepEvents();for(let t=0,n=this.interiorRings.length;tthis.bbox.ur.x&&(this.bbox.ur.x=u.bbox.ur.x),u.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=u.bbox.ur.y),this.polys.push(u)}this.isSubject=t}getSweepEvents(){const e=[];for(let t=0,n=this.polys.length;t0&&(e=d)}let t=e.segment.prevInResult(),n=t?t.prevInResult():null;for(;;){if(!t)return null;if(!n)return t.ringOut;if(n.ringOut!==t.ringOut)return n.ringOut.enclosingRing()!==t.ringOut?t.ringOut:t.ringOut.enclosingRing();t=n.prevInResult(),n=t?t.prevInResult():null}}}class O0{constructor(e){this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){const e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(let t=0,n=this.interiorRings.length;t1&&arguments[1]!==void 0?arguments[1]:ua.compare;this.queue=e,this.tree=new Rg(t),this.segments=[]}process(e){const t=e.segment,n=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(t),n;const l=e.isLeft?this.tree.add(t):this.tree.find(t);if(!l)throw new Error(`Unable to find segment #${t.id} [${t.leftSE.point.x}, ${t.leftSE.point.y}] -> [${t.rightSE.point.x}, ${t.rightSE.point.y}] in SweepLine tree.`);let u=l,d=l,a,_;for(;a===void 0;)u=this.tree.prev(u),u===null?a=null:u.key.consumedBy===void 0&&(a=u.key);for(;_===void 0;)d=this.tree.next(d),d===null?_=null:d.key.consumedBy===void 0&&(_=d.key);if(e.isLeft){let x=null;if(a){const k=a.getIntersection(t);if(k!==null&&(t.isAnEndpoint(k)||(x=k),!a.isAnEndpoint(k))){const C=this._splitSafely(a,k);for(let P=0,D=C.length;P0?(this.tree.remove(t),n.push(e)):(this.segments.push(t),t.prev=a)}else{if(a&&_){const x=a.getIntersection(_);if(x!==null){if(!a.isAnEndpoint(x)){const S=this._splitSafely(a,x);for(let k=0,C=S.length;kN0)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const d=new QT(u);let a=u.size,_=u.pop();for(;_;){const S=_.key;if(u.size===a){const C=S.segment;throw new Error(`Unable to pop() ${S.isLeft?"left":"right"} SweepEvent [${S.point.x}, ${S.point.y}] from segment #${C.id} [${C.leftSE.point.x}, ${C.leftSE.point.y}] -> [${C.rightSE.point.x}, ${C.rightSE.point.y}] from queue.`)}if(u.size>N0)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(d.segments.length>eE)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const k=d.process(S);for(let C=0,P=k.length;C1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n{t.push(l.coordinates)}),t.length<2)throw new Error("Must have at least 2 geometries");const n=gw.union(t[0],...t.slice(1));return n.length===0?null:n.length===1?Dg(n[0],e.properties):pw(n,e.properties)}var yw=aE;function lE(r,e={}){if(r.bbox!=null&&e.recompute!==!0)return r.bbox;const t=[1/0,1/0,-1/0,-1/0];return _w(r,n=>{t[0]>n[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]{e.push(l.coordinates)}),e.length<2)throw new Error("Must have at least two features");const t=r.features[0].properties||{},n=gw.difference(e[0],...e.slice(1));return n.length===0?null:n.length===1?Dg(n[0],t):pw(n,t)}var uE=cE;function hE(r){if(!r)throw new Error("geojson is required");var e=[];return sE(r,function(t){e.push(t)}),_h(e)}var fE=hE;function U0(r,e){const t=uE(_h([Dg([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),r]));if(!t)return;t.properties={isMask:!0};const n=dd(j0(r)),l=(n[2]-n[0])/360/1e3,u=n[0]<-180,d=n[2]>180,a=fE(r);if(a.features.length>1&&(u||d))for(const _ of a.features){const x=dd(j0(_));if(d&&x[0]<-180+l)for(const S of _.geometry.coordinates)for(const k of S)k[0]+=360-l;if(u&&x[2]>180-l)for(const S of _.geometry.coordinates)for(const k of S)k[0]-=360-l}e(_h([a.features.length<2?r:yw(a)??r,t]))}const V0={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}},Ff="mtlr-gc-full-geom",q0="mtlr-gc-full-geom-fill",G0="mtlr-gc-full-geom-line";function vw(r,e,t=!0,n=!0,l={},u={},d=V0){let a;const _=[];let x,S,k;function C(){if(!r.loaded){r.once("load",C);return}const z=d?d===!0?V0:d:void 0;if(!(z!=null&&z.fill)&&!(z!=null&&z.line))return;const B=r.getSource(Ff);if(B)B.setData(k??_h([]));else if(k)r.addSource(Ff,{type:"geojson",data:k});else return;!r.getLayer(q0)&&z!=null&&z.fill&&r.addLayer({...z==null?void 0:z.fill,id:q0,type:"fill",source:Ff}),!r.getLayer(G0)&&z!=null&&z.line&&r.addLayer({...z==null?void 0:z.line,id:G0,type:"line",source:Ff})}function P(z){k=z,C()}r.on("styledata",()=>{setTimeout(()=>{k&&C()})});const D=z=>{a==null||a({type:"mapClick",coordinates:[z.lngLat.lng,z.lngLat.lat]})};function N(z=!1){if(!e)throw new Error;const B=document.createElement("div");return z&&B.classList.add("marker-interactive"),new aT({props:{displayIn:"maplibre"},target:B}),new e.Marker({element:B,offset:[1,-13]})}return{setEventHandler(z){z?(a=z,r.on("click",D)):(a=void 0,r.off("click",D))},flyTo(z,B){r.flyTo({center:z,...B?{zoom:B}:{},...l})},fitBounds(z,B,O){r.fitBounds([[z[0],z[1]],[z[2],z[3]]],{padding:B,...O?{maxZoom:O}:{},...u})},indicateReverse(z){r.getCanvasContainer().style.cursor=z?"crosshair":""},setReverseMarker(z){!e||!t||(S?z?S.setLngLat(z):(S.remove(),S=void 0):z&&(t instanceof Function?S=t(r)??void 0:(S=(typeof t=="object"?new e.Marker(t):N()).setLngLat(z).addTo(r),S.getElement().classList.add("marker-reverse"))))},setFeatures(z,B,O){for(const G of _)G.remove();if(_.length=0,P(void 0),!!e){if(B){let G=!1;if(B.geometry.type==="GeometryCollection"){const U=B.geometry.geometries.filter(K=>K.type==="Polygon"||K.type==="MultiPolygon");e:if(U.length>0){const K=yw(_h(U.map(me=>gh(me))));if(!K)break e;U0({...B,geometry:K.geometry},P),G=!0}else{const K=B.geometry.geometries.filter(me=>me.type==="LineString"||me.type==="MultiLineString");K.length>0&&(P({...B,geometry:{type:"GeometryCollection",geometries:K}}),G=!0)}}if(!G){if(B.geometry.type==="Polygon"||B.geometry.type==="MultiPolygon")U0(B,P);else if(B.geometry.type==="LineString"||B.geometry.type==="MultiLineString"){P(B);return}}if(!O&&B.geometry.type!=="Point")return;if(t instanceof Function){const U=t(r,B);U&&_.push(U)}else t&&_.push(typeof t=="object"?new e.Marker(t):N().setLngLat(B.center).addTo(r))}if(n)for(const G of z??[]){if(G===B)continue;let U;if(n instanceof Function){if(U=n(r,G),!U)continue}else U=(typeof n=="object"?new e.Marker(n):N(!0)).setLngLat(G.center).setPopup(new e.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(G.place_type[0]==="reverse"?G.place_name:G.place_name.replace(/,.*/,""))).addTo(r);const K=U.getElement();K.addEventListener("click",me=>{me.stopPropagation(),a==null||a({type:"markerClick",id:G.id})}),K.addEventListener("mouseenter",()=>{a==null||a({type:"markerMouseEnter",id:G.id}),U.togglePopup()}),K.addEventListener("mouseleave",()=>{a==null||a({type:"markerMouseLeave",id:G.id}),U.togglePopup()}),_.push(U)}}},setSelectedMarker(z){x&&x.getElement().classList.toggle("marker-selected",!1),x=z>-1?_[z]:void 0,x==null||x.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const z=r.getCenter();return[r.getZoom(),z.lng,z.lat]}}}function dE(r,e,t){var n,l;class u{constructor(z,B){fo(this,"type"),fo(this,"target"),this.type=B,this.target=z}}class d extends u{constructor(z,B){super(z,"select"),fo(this,"feature"),Object.assign(this,B)}}class a extends u{constructor(z,B){super(z,"featureslisted"),fo(this,"features"),this.features=B}}class _ extends u{constructor(z,B){super(z,"featuresmarked"),fo(this,"features"),this.features=B}}class x extends u{constructor(z,B){super(z,"optionsvisibilitychange"),fo(this,"optionsVisible"),this.optionsVisible=B}}class S extends u{constructor(z,B){super(z,"pick"),fo(this,"feature"),this.feature=B}}class k extends u{constructor(z,B){super(z,"querychange"),fo(this,"query"),this.query=B}}class C extends u{constructor(z,B,O){super(z,"response"),fo(this,"url"),fo(this,"featureCollection"),this.url=B,this.featureCollection=O}}class P extends u{constructor(z,B){super(z,"reversetoggle"),fo(this,"reverse"),this.reverse=B}}class D extends r{constructor(z={}){super(),a0(this,n),a0(this,l),l0(this,l,z)}onAddInt(z){const B=document.createElement("div");B.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl maplibregl-ctrl-geocoder maplibregl-ctrl mapboxgl-ctrl-group";const{marker:O,showResultMarkers:G,flyTo:U,fullGeometryStyle:K,...me}=Qn(this,l),X=typeof U=="boolean"?{}:U,Y={mapController:vw(z,e,O,G,X,X,K),flyTo:U===void 0?!0:!!U,apiKey:"",...t==null?void 0:t(z,B),...me};if(!Y.apiKey)throw new Error("no apiKey provided");return l0(this,n,new LT({target:B,props:Y})),Qn(this,n).$on("select",_e=>{this.fire(new d(this,_e.detail))}),Qn(this,n).$on("pick",_e=>{this.fire(new S(this,_e.detail.feature))}),Qn(this,n).$on("featureslisted",_e=>{this.fire(new a(this,_e.detail.features))}),Qn(this,n).$on("featuresmarked",_e=>{this.fire(new _(this,_e.detail.features))}),Qn(this,n).$on("response",_e=>{this.fire(new C(this,_e.detail.url,_e.detail.featureCollection))}),Qn(this,n).$on("optionsvisibilitychange",_e=>{this.fire(new x(this,_e.detail.optionsVisible))}),Qn(this,n).$on("reversetoggle",_e=>{this.fire(new P(this,_e.detail.reverse))}),Qn(this,n).$on("querychange",_e=>{this.fire(new k(this,_e.detail.query))}),B}on(z,B){return super.on(z,B)}once(z,B){return super.once(z,B)}off(z,B){return super.off(z,B)}listens(z){return super.listens(z)}setOptions(z){var B;Object.assign(Qn(this,l),z);const{marker:O,showResultMarkers:G,flyTo:U,fullGeometryStyle:K,...me}=Qn(this,l);(B=Qn(this,n))==null||B.$set(me)}setQuery(z,B=!0){var O;(O=Qn(this,n))==null||O.setQuery(z,B)}clearMap(){var z;(z=Qn(this,n))==null||z.clearMap()}clearList(){var z;(z=Qn(this,n))==null||z.clearList()}setReverseMode(z){var B;(B=Qn(this,n))==null||B.$set({reverseActive:z})}focus(){var z;(z=Qn(this,n))==null||z.focus()}blur(){var z;(z=Qn(this,n))==null||z.blur()}onRemove(){var z;(z=Qn(this,n))==null||z.$destroy()}}return n=new WeakMap,l=new WeakMap,{MapLibreBasedGeocodingControl:D,events:{SelectEvent:d,FeaturesListedEvent:a,FeaturesMarkedEvent:_,OptionsVisibilityChangeEvent:x,PickEvent:S,QueryChangeEvent:k,ResponseEvent:C,ReverseToggleEvent:P}}}const{MapLibreBasedGeocodingControl:FD,events:va}=dE(Pc.Evented,l4);va.SelectEvent;va.FeaturesListedEvent;va.FeaturesMarkedEvent;va.OptionsVisibilityChangeEvent;va.PickEvent;va.QueryChangeEvent;va.ResponseEvent;va.ReverseToggleEvent;function pE(r){let e,t;return{c(){e=Ls("svg"),t=Ls("path"),Ee(t,"d","M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"),Ee(e,"viewBox","0 0 14 14"),Ee(e,"width","13"),Ee(e,"height","13"),Ee(e,"class","svelte-en2qvf")},m(n,l){be(n,e,l),ie(e,t)},p:Mt,i:Mt,o:Mt,d(n){n&&ve(e)}}}class bw extends Ht{constructor(e){super(),Zt(this,e,null,pE,Ut,{})}}function mE(r){let e,t;return{c(){e=Ls("svg"),t=Ls("path"),Ee(t,"d","M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"),Ee(e,"viewBox","0 0 30 30"),Ee(e,"fill","none"),Ee(e,"xmlns","http://www.w3.org/2000/svg"),Ee(e,"class","svelte-d2loi5")},m(n,l){be(n,e,l),ie(e,t)},p:Mt,i:Mt,o:Mt,d(n){n&&ve(e)}}}class ww extends Ht{constructor(e){super(),Zt(this,e,null,mE,Ut,{})}}function gE(r){let e,t;return{c(){e=fe("img"),En(e.src,t=r[3]+"area.svg")||Ee(e,"src",t),Ee(e,"alt",r[6]),Ee(e,"class","svelte-ltkwvy")},m(n,l){be(n,e,l)},p(n,l){l&8&&!En(e.src,t=n[3]+"area.svg")&&Ee(e,"src",t),l&64&&Ee(e,"alt",n[6])},d(n){n&&ve(e)}}}function _E(r){let e,t;return{c(){e=fe("img"),En(e.src,t=r[3]+"reverse.svg")||Ee(e,"src",t),Ee(e,"alt",r[6]),Ee(e,"class","svelte-ltkwvy")},m(n,l){be(n,e,l)},p(n,l){l&8&&!En(e.src,t=n[3]+"reverse.svg")&&Ee(e,"src",t),l&64&&Ee(e,"alt",n[6])},d(n){n&&ve(e)}}}function yE(r){let e,t;return{c(){e=fe("img"),En(e.src,t=r[3]+"poi.svg")||Ee(e,"src",t),Ee(e,"alt",r[6]),Ee(e,"class","svelte-ltkwvy")},m(n,l){be(n,e,l)},p(n,l){l&8&&!En(e.src,t=n[3]+"poi.svg")&&Ee(e,"src",t),l&64&&Ee(e,"alt",n[6])},d(n){n&&ve(e)}}}function vE(r){let e,t;return{c(){e=fe("img"),En(e.src,t=r[3]+"postal_code.svg")||Ee(e,"src",t),Ee(e,"alt",r[6]),Ee(e,"class","svelte-ltkwvy")},m(n,l){be(n,e,l)},p(n,l){l&8&&!En(e.src,t=n[3]+"postal_code.svg")&&Ee(e,"src",t),l&64&&Ee(e,"alt",n[6])},d(n){n&&ve(e)}}}function bE(r){let e,t;return{c(){e=fe("img"),En(e.src,t=r[3]+"street.svg")||Ee(e,"src",t),Ee(e,"alt",r[6]),Ee(e,"class","svelte-ltkwvy")},m(n,l){be(n,e,l)},p(n,l){l&8&&!En(e.src,t=n[3]+"street.svg")&&Ee(e,"src",t),l&64&&Ee(e,"alt",n[6])},d(n){n&&ve(e)}}}function wE(r){let e,t;return{c(){e=fe("img"),En(e.src,t=r[3]+"road.svg")||Ee(e,"src",t),Ee(e,"alt",r[6]),Ee(e,"class","svelte-ltkwvy")},m(n,l){be(n,e,l)},p(n,l){l&8&&!En(e.src,t=n[3]+"road.svg")&&Ee(e,"src",t),l&64&&Ee(e,"alt",n[6])},d(n){n&&ve(e)}}}function xE(r){let e,t;return{c(){e=fe("img"),En(e.src,t=r[3]+"housenumber.svg")||Ee(e,"src",t),Ee(e,"alt",r[6]),Ee(e,"class","svelte-ltkwvy")},m(n,l){be(n,e,l)},p(n,l){l&8&&!En(e.src,t=n[3]+"housenumber.svg")&&Ee(e,"src",t),l&64&&Ee(e,"alt",n[6])},d(n){n&&ve(e)}}}function SE(r){let e,t,n,l;return{c(){e=fe("img"),En(e.src,t=r[5])||Ee(e,"src",t),Ee(e,"alt",r[4]),Ee(e,"class","svelte-ltkwvy")},m(u,d){be(u,e,d),n||(l=Tt(e,"error",r[14]),n=!0)},p(u,d){d&32&&!En(e.src,t=u[5])&&Ee(e,"src",t),d&16&&Ee(e,"alt",u[4])},d(u){u&&ve(e),n=!1,l()}}}function W0(r){let e,t;return{c(){e=fe("span"),t=rt(r[6]),Ee(e,"class","secondary svelte-ltkwvy")},m(n,l){be(n,e,l),ie(e,t)},p(n,l){l&64&&Ar(t,n[6])},d(n){n&&ve(e)}}}function kE(r){let e,t,n,l,u,d,a,_,x,S=(r[7]?r[0].place_name:r[0].place_name.replace(/,.*/,""))+"",k,C,P=r[2]==="always"||r[2]!=="never"&&!r[0].address&&!r[0].id.startsWith("road.")&&!r[0].id.startsWith("address.")&&!r[0].id.startsWith("postal_code.")&&(!r[0].id.startsWith("poi.")||!r[5])&&!r[7],D,N,z=(r[7]?"":r[0].place_name.replace(/[^,]*,?\s*/,""))+"",B,O,G;function U(Y,_e){return _e&1&&(t=null),_e&1&&(n=null),_e&1&&(l=null),_e&1&&(u=null),Y[5]?SE:Y[0].address?xE:(t==null&&(t=!!Y[0].id.startsWith("road.")),t?wE:(n==null&&(n=!!Y[0].id.startsWith("address.")),n?bE:(l==null&&(l=!!Y[0].id.startsWith("postal_code.")),l?vE:(u==null&&(u=!!Y[0].id.startsWith("poi.")),u?yE:Y[7]?_E:gE))))}let K=U(r,-1),me=K(r),X=P&&W0(r);return{c(){e=fe("li"),me.c(),d=Ve(),a=fe("span"),_=fe("span"),x=fe("span"),k=rt(S),C=Ve(),X&&X.c(),D=Ve(),N=fe("span"),B=rt(z),Ee(x,"class","primary svelte-ltkwvy"),Ee(_,"class","svelte-ltkwvy"),Ee(N,"class","line2 svelte-ltkwvy"),Ee(a,"class","texts svelte-ltkwvy"),Ee(e,"tabindex","0"),Ee(e,"data-selected",r[1]),Ee(e,"class","svelte-ltkwvy"),hi(e,"selected",r[1])},m(Y,_e){be(Y,e,_e),me.m(e,null),ie(e,d),ie(e,a),ie(a,_),ie(_,x),ie(x,k),ie(_,C),X&&X.m(_,null),ie(a,D),ie(a,N),ie(N,B),O||(G=[Tt(e,"mouseenter",r[12]),Tt(e,"focus",r[13])],O=!0)},p(Y,[_e]){K===(K=U(Y,_e))&&me?me.p(Y,_e):(me.d(1),me=K(Y),me&&(me.c(),me.m(e,d))),_e&1&&S!==(S=(Y[7]?Y[0].place_name:Y[0].place_name.replace(/,.*/,""))+"")&&Ar(k,S),_e&37&&(P=Y[2]==="always"||Y[2]!=="never"&&!Y[0].address&&!Y[0].id.startsWith("road.")&&!Y[0].id.startsWith("address.")&&!Y[0].id.startsWith("postal_code.")&&(!Y[0].id.startsWith("poi.")||!Y[5])&&!Y[7]),P?X?X.p(Y,_e):(X=W0(Y),X.c(),X.m(_,null)):X&&(X.d(1),X=null),_e&1&&z!==(z=(Y[7]?"":Y[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Ar(B,z),_e&2&&Ee(e,"data-selected",Y[1]),_e&2&&hi(e,"selected",Y[1])},i:Mt,o:Mt,d(Y){Y&&ve(e),me.d(),X&&X.d(),O=!1,_n(G)}}}function TE(r,e,t){var G;let n,l,{feature:u}=e,{selected:d=!1}=e,{showPlaceType:a}=e,{missingIconsCache:_}=e,{iconsBaseUrl:x}=e;const S=(G=u.properties)==null?void 0:G.categories;let k,C,P=0,D=u.place_type[0]==="reverse";function N(){C&&_.add(C),t(10,P++,P)}function z(U){ur.call(this,r,U)}function B(U){ur.call(this,r,U)}const O=()=>N();return r.$$set=U=>{"feature"in U&&t(0,u=U.feature),"selected"in U&&t(1,d=U.selected),"showPlaceType"in U&&t(2,a=U.showPlaceType),"missingIconsCache"in U&&t(9,_=U.missingIconsCache),"iconsBaseUrl"in U&&t(3,x=U.iconsBaseUrl)},r.$$.update=()=>{var U,K,me,X;if(r.$$.dirty&3640)do t(11,n--,n),t(4,k=S==null?void 0:S[n]),t(5,C=k?x+k.replace(/ /g,"_")+".svg":void 0);while(n>-1&&(!C||_.has(C)));r.$$.dirty&1&&t(6,l=((K=(U=u.properties)==null?void 0:U.categories)==null?void 0:K.join(", "))??((X=(me=u.properties)==null?void 0:me.place_type_name)==null?void 0:X[0])??u.place_type[0])},t(11,n=(S==null?void 0:S.length)??0),[u,d,a,x,k,C,l,D,N,_,P,n,z,B,O]}class EE extends Ht{constructor(e){super(),Zt(this,e,TE,kE,Ut,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function ME(r){let e;return{c(){e=fe("div"),e.innerHTML='',Ee(e,"class","svelte-7cmwmc")},m(t,n){be(t,e,n)},p:Mt,i:Mt,o:Mt,d(t){t&&ve(e)}}}class CE extends Ht{constructor(e){super(),Zt(this,e,null,ME,Ut,{})}}function IE(r){let e,t;return{c(){e=Ls("svg"),t=Ls("path"),Ee(t,"d","M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"),Ee(e,"viewBox","0 0 60.006 21.412"),Ee(e,"width","14"),Ee(e,"height","20"),Ee(e,"class","svelte-en2qvf")},m(n,l){be(n,e,l),ie(e,t)},p:Mt,i:Mt,o:Mt,d(n){n&&ve(e)}}}class AE extends Ht{constructor(e){super(),Zt(this,e,null,IE,Ut,{})}}function LE(r){let e,t,n;return{c(){e=Ls("svg"),t=Ls("circle"),n=Ls("path"),Ee(t,"cx","4.789"),Ee(t,"cy","4.787"),Ee(t,"r","3.85"),Ee(t,"class","svelte-1aq105l"),Ee(n,"d","M12.063 12.063 7.635 7.635"),Ee(n,"class","svelte-1aq105l"),Ee(e,"xmlns","http://www.w3.org/2000/svg"),Ee(e,"width","13"),Ee(e,"height","13"),Ee(e,"viewBox","0 0 13 13"),Ee(e,"class","svelte-1aq105l")},m(l,u){be(l,e,u),ie(e,t),ie(e,n)},p:Mt,i:Mt,o:Mt,d(l){l&&ve(e)}}}class PE extends Ht{constructor(e){super(),Zt(this,e,null,LE,Ut,{})}}function zE(r,e,t){const n=e[1],l=e[0],u=n-l;return r===n&&t?r:((r-l)%u+u)%u+l}function Z0(r){const e=[...r];return e[2]Math.abs((e[0]-360+e[2])/2)?e[0]-=360:e[2]+=360),e}let Uu;async function DE(r,e,t){const n=r==null?void 0:r.getCenterAndZoom();for(const l of e??[])if(!(n&&(l.minZoom!=null&&l.minZoom>n[0]||l.maxZoom!=null&&l.maxZoomDate.now()){if(!Uu.coords)break e;return Uu.coords}let u;try{return u=await new Promise((d,a)=>{t.signal.addEventListener("abort",()=>{a(Error("aborted"))}),navigator.geolocation.getCurrentPosition(_=>{d([_.coords.longitude,_.coords.latitude].map(x=>x.toFixed(6)).join(","))},_=>{a(_)},l)}),u}catch{}finally{l.cachedLocationExpiry&&(Uu={time:Date.now(),coords:u})}if(t.signal.aborted)return}if(l.type==="server-geolocation")return"ip";if(n&&l.type==="map-center")return n[1].toFixed(6)+","+n[2].toFixed(6)}}const RE=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(EAST|WEST|[EW])?$/i,H0=/^([+-]?[0-8]?[0-9])\s+([0-5]?[0-9]\.\d{3,})[\s,]{1,}([+-]?[0-1]?[0-9]?[0-9])\s+([0-5]?[0-9]\.\d{3,})$/,$0=/^(NORTH|SOUTH|[NS])?[\s]*([+-]?[0-8]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(NORTH|SOUTH|[NS])?[\s]*[,/;]?[\s]*(EAST|WEST|[EW])?[\s]*([+-]?[0-1]?[0-9]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(EAST|WEST|[EW])?$/i,X0=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(EAST|WEST|[EW])?$/i,K0=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)\s*(EAST|WEST|[EW])?$/i,J0=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|’’|´´|["″”\.])?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|´´|’’|["″”\.])?\s*(EAST|WEST|[EW])?$/i;function BE(r){if(!["DMS","DM","DD"].includes(r))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){const e=this.decimalCoordinates.split(",").map(P=>Number(P.trim())),t=Number(e[0]),n=Number(e[1]),l=Math.abs(t),u=Math.abs(n),d=t>0?"N":"S",a=n>0?"E":"W";let _;r=="DD"&&(_=`${l}° ${d}, ${u}° ${a}`);const x=Math.floor(l),S=Math.floor(u),k=(l-x)*60,C=(u-S)*60;if(r=="DM"){let P=Y0(k,3).toFixed(3).padStart(6,"0"),D=Y0(C,3).toFixed(3).padStart(6,"0");P.endsWith(".000")&&D.endsWith(".000")&&(P=P.replace(/\.000$/,""),D=D.replace(/\.000$/,"")),_=`${x}° ${P}' ${d}, ${S}° ${D}' ${a}`}if(r=="DMS"){const P=Math.floor(k),D=Math.floor(C);let N=((k-P)*60).toFixed(1).padStart(4,"0"),z=((C-D)*60).toFixed(1).padStart(4,"0");const B=P.toString().padStart(2,"0"),O=D.toString().padStart(2,"0");N.endsWith(".0")&&z.endsWith(".0")&&(N=N.replace(/\.0$/,""),z=z.replace(/\.0$/,"")),_=`${x}° ${B}' ${N}" ${d}, ${S}° ${O}' ${z}" ${a}`}return _}else throw new Error("no decimal coordinates to convert")}function Y0(r,e){const t=Math.pow(10,e);return Math.round((r+Number.EPSILON)*t)/t}function Fg(r,e){e||(e=5),r=r.replace(/\s+/g," ").trim();let t=null,n=null,l="",u="",d=null,a=[],_=!1;if(RE.test(r))throw new Error("invalid coordinate value");if(H0.test(r))if(a=H0.exec(r),_=Vu(a),_)t=Math.abs(a[1])+a[2]/60,Number(a[1])<0&&(t*=-1),n=Math.abs(a[3])+a[4]/60,Number(a[3])<0&&(n*=-1),d="DM";else throw new Error("invalid coordinate format");else if($0.test(r))if(a=$0.exec(r),_=Vu(a),_){if(t=a[2],n=a[6],t.includes(",")&&(t=t.replace(",",".")),n.includes(",")&&(n=n.replace(",",".")),d="DD",Number(Math.round(t))==Number(t))throw new Error("integer only coordinate provided");if(Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");a[1]?(l=a[1],u=a[5]):a[4]&&(l=a[4],u=a[8])}else throw new Error("invalid decimal coordinate format");else if(X0.test(r))if(a=X0.exec(r),_=Vu(a),_)t=Math.abs(parseInt(a[2])),a[4]&&(t+=a[4]/60,d="DM"),a[6]&&(t+=a[6].replace(",",".")/3600,d="DMS"),parseInt(a[2])<0&&(t=-1*t),n=Math.abs(parseInt(a[9])),a[11]&&(n+=a[11]/60),a[13]&&(n+=a[13].replace(",",".")/3600),parseInt(a[9])<0&&(n=-1*n),a[1]?(l=a[1],u=a[8]):a[7]&&(l=a[7],u=a[14]);else throw new Error("invalid DMS coordinates format");else if(K0.test(r))if(a=K0.exec(r),_=Vu(a),_)t=Math.abs(parseInt(a[2])),a[4]&&(t+=a[4]/60,d="DM"),a[6]&&(t+=a[6]/3600,d="DMS"),parseInt(a[2])<0&&(t=-1*t),n=Math.abs(parseInt(a[10])),a[12]&&(n+=a[12]/60),a[14]&&(n+=a[14]/3600),parseInt(a[10])<0&&(n=-1*n),a[1]?(l=a[1],u=a[9]):a[8]&&(l=a[8],u=a[16]);else throw new Error("invalid DMS coordinates format");else if(J0.test(r)){if(a=J0.exec(r),_=Vu(a),a.filter(x=>x).length<=5)throw new Error("invalid coordinates format");if(_)t=Math.abs(parseInt(a[2])),a[4]&&(t+=a[4].replace(",",".")/60,d="DM"),a[6]&&(t+=a[6].replace(",",".")/3600,d="DMS"),parseInt(a[2])<0&&(t=-1*t),n=Math.abs(parseInt(a[10])),a[12]&&(n+=a[12].replace(",",".")/60),a[14]&&(n+=a[14].replace(",",".")/3600),parseInt(a[10])<0&&(n=-1*n),a[1]?(l=a[1],u=a[9]):a[8]&&(l=a[8],u=a[16]);else throw new Error("invalid coordinates format")}if(_){if(Math.abs(n)>=180)throw new Error("invalid longitude value");if(Math.abs(t)>=90)throw new Error("invalid latitude value");if(l&&!u||!l&&u)throw new Error("invalid coordinates value");if(l&&l==u)throw new Error("invalid coordinates format");t.toString().includes(",")&&(t=t.replace(",",".")),n.toString().includes(",")&&(n=n.replace(",","."));let x=/S|SOUTH/i;x.test(l)&&t>0&&(t=-1*t),x=/W|WEST/i,x.test(u)&&n>0&&(n=-1*n);const S=a[0].trim();let k,C;const P=/[,/;\u0020]/g,D=S.match(P);if(D==null){const B=Math.floor(r.length/2);k=S.substring(0,B).trim(),C=S.substring(B).trim()}else{let B;D.length%2==1?B=Math.floor(D.length/2):B=D.length/2-1;let O=0;if(B==0)O=S.indexOf(D[0]),k=S.substring(0,O).trim(),C=S.substring(O+1).trim();else{let G=0,U=0;for(;G<=B;)O=S.indexOf(D[G],U),U=O+1,G++;k=S.substring(0,O).trim(),C=S.substring(O+1).trim()}}const N=k.split(".");if(N.length==2&&N[1]==0&&N[1].length!=2)throw new Error("invalid coordinates format");const z=C.split(".");if(z.length==2&&z[1]==0&&z[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(k)||/^\d+$/.test(C))throw new Error("degree only coordinate/s provided");return t=Number(Number(t).toFixed(e)),n=Number(Number(n).toFixed(e)),Object.freeze({verbatimCoordinates:S,verbatimLatitude:k,verbatimLongitude:C,decimalLatitude:t,decimalLongitude:n,decimalCoordinates:`${t},${n}`,originalFormat:d,closeEnough:FE,toCoordinateFormat:BE})}else throw new Error("coordinates pattern match failed")}function Vu(r){if(!isNaN(r[0]))return!1;const e=[...r];if(e.shift(),e.length%2>0)return!1;const t=/^[-+]?\d+([\.,]\d+)?$/,n=/[eastsouthnorthwest]+/i,l=e.length/2;for(let u=0;u{e.decimalLatitude?r.push(e):r.push({...e,...jE})}),[...r,...UE,...VE]}const GE=qE();Fg.formats=GE.map(r=>r.verbatimCoordinates);const WE=Fg;function e1(r,e,t){const n=r.slice();return n[84]=e[t],n[86]=t,n}function t1(r){let e,t;return e=new CE({}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function r1(r){let e,t,n,l,u;return t=new AE({}),{c(){e=fe("button"),je(t.$$.fragment),Ee(e,"type","button"),Ee(e,"title",r[9]),Ee(e,"class","svelte-bz0zu3"),hi(e,"active",r[0])},m(d,a){be(d,e,a),Oe(t,e,null),n=!0,l||(u=Tt(e,"click",r[69]),l=!0)},p(d,a){(!n||a[0]&512)&&Ee(e,"title",d[9]),(!n||a[0]&1)&&hi(e,"active",d[0])},i(d){n||(oe(t.$$.fragment,d),n=!0)},o(d){de(t.$$.fragment,d),n=!1},d(d){d&&ve(e),Ne(t),l=!1,u()}}}function ZE(r){let e,t=[],n=new Map,l,u,d,a=Jn(r[14]);const _=x=>x[84].id+(x[84].address?","+x[84].address:"");for(let x=0;x{X=null}),vr()),(!G||ft[0]&2)&&hi(x,"displayable",Me[1]!==""),Me[5]==="button"?Y?(Y.p(Me,ft),ft[0]&32&&oe(Y,1)):(Y=r1(Me),Y.c(),oe(Y,1),Y.m(n,D)):Y&&(yr(),de(Y,1,1,()=>{Y=null}),vr()),ze&&ze.p&&(!G||ft[1]&536870912)&&Gr(ze,_e,Me,Me[60],G?qr(_e,Me[60],ft,null):Wr(Me[60]),null);let Ct=z;z=Ze(Me),z===Ct?~z&&ce[z].p(Me,ft):(B&&(yr(),de(ce[Ct],1,1,()=>{ce[Ct]=null}),vr()),~z?(B=ce[z],B?B.p(Me,ft):(B=ce[z]=re[z](Me),B.c()),oe(B,1),B.m(t,null)):B=null),(!G||ft[0]&4&&O!==(O=od(Me[2])+" svelte-bz0zu3"))&&Ee(t,"class",O),(!G||ft[0]&22)&&hi(t,"can-collapse",Me[4]&&Me[1]==="")},i(Me){G||(oe(me),oe(u.$$.fragment,Me),oe(k.$$.fragment,Me),oe(X),oe(Y),oe(ze,Me),oe(B),G=!0)},o(Me){de(me),de(u.$$.fragment,Me),de(k.$$.fragment,Me),de(X),de(Y),de(ze,Me),de(B),G=!1},d(Me){Me&&(ve(e),ve(t)),Ne(u),r[63](null),Ne(k),X&&X.d(),Y&&Y.d(),ze&&ze.d(Me),~z&&ce[z].d(),U=!1,_n(K)}}}function JE(r,e,t){let n,l,{$$slots:u={},$$scope:d}=e;const a={continental_marine:4,country:4,major_landform:8,region:5,subregion:6,county:7,joint_municipality:8,joint_submunicipality:9,municipality:10,municipal_district:11,locality:12,neighbourhood:13,place:14,postal_code:14,road:16,poi:17,address:18,"poi.peak":15,"poi.shop":18,"poi.cafe":18,"poi.restaurant":18,"poi.aerodrome":13};let{class:_=void 0}=e,{apiKey:x}=e,{bbox:S=void 0}=e,{clearButtonTitle:k="clear"}=e,{clearOnBlur:C=!1}=e,{collapsed:P=!1}=e,{country:D=void 0}=e,{debounceSearch:N=200}=e,{enableReverse:z="never"}=e,{errorMessage:B="Something went wrong…"}=e,{filter:O=()=>!0}=e,{flyTo:G=!0}=e,{fuzzyMatch:U=!0}=e,{language:K=void 0}=e,{limit:me=void 0}=e,{mapController:X=void 0}=e,{minLength:Y=2}=e,{noResultsMessage:_e="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=e,{placeholder:ze="Search"}=e,{proximity:re=[{type:"server-geolocation"}]}=e,{reverseActive:ce=z==="always"}=e,{reverseButtonTitle:Ze="toggle reverse geocoding"}=e,{searchValue:Me=""}=e,{pickedResultStyle:ft="full-geometry"}=e,{showPlaceType:Ct="if-needed"}=e,{showResultsWhileTyping:Ot=!0}=e,{selectFirst:Ke=!0}=e,{flyToSelected:Kt=!1}=e,{markerOnSelected:vt=!0}=e,{types:At=void 0}=e,{exhaustiveReverseGeocoding:Vt=!1}=e,{excludeTypes:sr=!1}=e,{zoom:fr=a}=e,{apiUrl:er="https://api.maptiler.com/geocoding"}=e,{fetchParameters:Nt={}}=e,{iconsBaseUrl:nr="https://cdn.maptiler.com/maptiler-geocoding-control/v2.0.1/icons/"}=e,{adjustUrlQuery:tr=()=>{}}=e;function Lr(){We.focus()}function Pr(){We.blur()}function st(W,Be=!0,Fe=!1){t(1,Me=W),Be?(t(15,Ye=-1),ct()):(Jt(!Fe,Fe),setTimeout(()=>{We.focus(),We.select()}))}function Lt(){t(14,tt=void 0),t(56,ne=void 0),t(15,Ye=-1)}function De(){t(55,it=[]),t(56,ne=void 0)}let at=!1,tt,it,ne,br="",We,Ye=-1,jt,bn=[],wn,Mn,ni,ii;const $o=new Set,Jr=us();ti(()=>{X&&(X.setEventHandler(void 0),X.indicateReverse(!1),X.setSelectedMarker(-1),X.setFeatures(void 0,void 0,!1))});function ct(W){if(Mn&&(clearTimeout(Mn),Mn=void 0),Ye>-1&&tt)t(56,ne=tt[Ye]),t(1,Me=ne.place_type[0]==="reverse"?ne.place_name:ne.place_name.replace(/,.*/,"")),t(18,jt=void 0),t(55,it=void 0),t(15,Ye=-1);else if(Me){const Be=W||!Xn(Me);xn(Me,{exact:!0}).then(()=>{t(55,it=tt),t(56,ne=void 0),Be&&Bo()}).catch(Fe=>t(18,jt=Fe))}}function Xn(W){try{return WE(W,6)}catch{return!1}}async function xn(W,{byId:Be=!1,exact:Fe=!1}={}){t(18,jt=void 0),wn==null||wn.abort();const qe=new AbortController;t(19,wn=qe);try{const Xe=Xn(W),ut=new URLSearchParams;if(K!==void 0&&ut.set("language",Array.isArray(K)?K.join(","):K??""),At&&ut.set("types",At.join(",")),sr&&ut.set("excludeTypes",String(sr)),S&&ut.set("bbox",S.map(gr=>gr.toFixed(6)).join(",")),D&&ut.set("country",Array.isArray(D)?D.join(","):D),!Be&&!Xe){const gr=await DE(X,re,qe);gr&&ut.set("proximity",gr),(Fe||!Ot)&&ut.set("autocomplete","false"),ut.set("fuzzyMatch",String(U))}me!==void 0&&(Vt||!Xe||(At==null?void 0:At.length)===1)&&ut.set("limit",String(me)),ut.set("key",x),tr(ut);const Pt=er+"/"+encodeURIComponent(Xe?Xe.decimalLongitude+","+Xe.decimalLatitude:W)+".json?"+ut.toString();if(Pt===br){Be?(t(14,tt=void 0),t(56,ne=bn[0])):t(14,tt=bn);return}br=Pt;const $t=await fetch(Pt,{signal:qe.signal,...Nt});if(!$t.ok)throw new Error(await $t.text());const ar=await $t.json();Jr("response",{url:Pt,featureCollection:ar}),Be?(t(14,tt=void 0),t(56,ne=ar.features[0]),bn=[ne]):(t(14,tt=ar.features.filter(O)),Xe&&tt.unshift({type:"Feature",properties:{},id:"reverse_"+Xe.decimalLongitude+"_"+Xe.decimalLatitude,text:Xe.decimalLatitude+", "+Xe.decimalLongitude,place_name:Xe.decimalLatitude+", "+Xe.decimalLongitude,place_type:["reverse"],center:[Xe.decimalLongitude,Xe.decimalLatitude],bbox:[Xe.decimalLongitude,Xe.decimalLatitude,Xe.decimalLongitude,Xe.decimalLatitude],geometry:{type:"Point",coordinates:[Xe.decimalLongitude,Xe.decimalLatitude]}}),bn=tt,Xe&&We.focus())}catch(Xe){if(Xe&&typeof Xe=="object"&&"name"in Xe&&Xe.name==="AbortError")return;throw Xe}finally{qe===wn&&t(19,wn=void 0)}}function Bo(){var qe;if(!(it!=null&&it.length)||!G)return;const W=[180,90,-180,-90],Be=!it.some(Xe=>!Xe.matching_text);let Fe;for(const Xe of it){const ut=Or(Xe);if(Fe=Fe===void 0?ut:ut===void 0?Fe:Math.max(Fe,ut),Be||!Xe.matching_text)for(const Pt of[0,1,2,3])W[Pt]=Math[Pt<2?"min":"max"](W[Pt],((qe=Xe.bbox)==null?void 0:qe[Pt])??Xe.center[Pt%2])}X&&it.length>0&&(ne&&W[0]===W[2]&&W[1]===W[3]?X.flyTo(ne.center,Or(ne)):X.fitBounds(Z0(W),50,Fe))}function Or(W){var Fe;if(!W.bbox||W.bbox[0]!==W.bbox[2]&&W.bbox[1]!==W.bbox[3])return;const Be=W.id.replace(/\..*/,"");return(Array.isArray((Fe=W.properties)==null?void 0:Fe.categories)?W.properties.categories.reduce((qe,Xe)=>{const ut=fr[Be+"."+Xe];return qe===void 0?ut:ut===void 0?qe:Math.max(qe,ut)},void 0):void 0)??fr[Be]}function mt(W){t(0,ce=z==="always"),t(14,tt=void 0),t(56,ne=void 0),t(15,Ye=-1),st(W[1].toFixed(6)+", "+zE(W[0],[-180,180],!0).toFixed(6),!1,!0)}function rr(W){if(!tt)return;let Be=W.key==="ArrowDown"?1:W.key==="ArrowUp"?-1:0;Be&&(Ye===(Ke?0:-1)&&Be===-1&&t(15,Ye=tt.length),t(15,Ye+=Be),Ye>=tt.length&&t(15,Ye=-1),Ye<0&&Ke&&t(15,Ye=0),W.preventDefault())}function Jt(W=!0,Be=!1){if(t(18,jt=void 0),Ot||Be){if(Mn&&clearTimeout(Mn),Me.length{xn(Fe).catch(qe=>t(18,jt=qe))},W?N:0)}else t(14,tt=void 0),t(18,jt=void 0)}function Nr(W){t(56,ne=W),t(1,Me=W.place_name),t(15,Ye=-1)}const vi=()=>We.focus();function Qt(W){pn[W?"unshift":"push"](()=>{We=W,t(17,We)})}function ro(){Me=this.value,t(1,Me),t(13,at),t(28,C)}const an=()=>t(13,at=!0),pe=()=>t(13,at=!1),Z=()=>Jt(),$=()=>{t(1,Me=""),We.focus()},te=()=>t(0,ce=!ce),le=()=>t(18,jt=void 0),Ce=W=>t(15,Ye=W),Ie=W=>Nr(W),Pe=()=>{Ke||t(15,Ye=-1)},Se=()=>{};return r.$$set=W=>{"class"in W&&t(2,_=W.class),"apiKey"in W&&t(26,x=W.apiKey),"bbox"in W&&t(27,S=W.bbox),"clearButtonTitle"in W&&t(3,k=W.clearButtonTitle),"clearOnBlur"in W&&t(28,C=W.clearOnBlur),"collapsed"in W&&t(4,P=W.collapsed),"country"in W&&t(29,D=W.country),"debounceSearch"in W&&t(30,N=W.debounceSearch),"enableReverse"in W&&t(5,z=W.enableReverse),"errorMessage"in W&&t(6,B=W.errorMessage),"filter"in W&&t(31,O=W.filter),"flyTo"in W&&t(32,G=W.flyTo),"fuzzyMatch"in W&&t(33,U=W.fuzzyMatch),"language"in W&&t(34,K=W.language),"limit"in W&&t(35,me=W.limit),"mapController"in W&&t(36,X=W.mapController),"minLength"in W&&t(37,Y=W.minLength),"noResultsMessage"in W&&t(7,_e=W.noResultsMessage),"placeholder"in W&&t(8,ze=W.placeholder),"proximity"in W&&t(38,re=W.proximity),"reverseActive"in W&&t(0,ce=W.reverseActive),"reverseButtonTitle"in W&&t(9,Ze=W.reverseButtonTitle),"searchValue"in W&&t(1,Me=W.searchValue),"pickedResultStyle"in W&&t(39,ft=W.pickedResultStyle),"showPlaceType"in W&&t(10,Ct=W.showPlaceType),"showResultsWhileTyping"in W&&t(40,Ot=W.showResultsWhileTyping),"selectFirst"in W&&t(11,Ke=W.selectFirst),"flyToSelected"in W&&t(41,Kt=W.flyToSelected),"markerOnSelected"in W&&t(42,vt=W.markerOnSelected),"types"in W&&t(43,At=W.types),"exhaustiveReverseGeocoding"in W&&t(44,Vt=W.exhaustiveReverseGeocoding),"excludeTypes"in W&&t(45,sr=W.excludeTypes),"zoom"in W&&t(46,fr=W.zoom),"apiUrl"in W&&t(47,er=W.apiUrl),"fetchParameters"in W&&t(48,Nt=W.fetchParameters),"iconsBaseUrl"in W&&t(12,nr=W.iconsBaseUrl),"adjustUrlQuery"in W&&t(49,tr=W.adjustUrlQuery),"$$scope"in W&&t(60,d=W.$$scope)},r.$$.update=()=>{if(r.$$.dirty[0]&32&&t(0,ce=z==="always"),r.$$.dirty[0]&268443648&&setTimeout(()=>{t(16,ni=at),C&&!at&&t(1,Me="")}),r.$$.dirty[0]&16386|r.$$.dirty[1]&64&&Me.lengtht(18,jt=W)),r.$$.dirty[1]&100663330&&(X&&ne&&ne.id!==ii&&G&&(!ne.bbox||ne.bbox[0]===ne.bbox[2]&&ne.bbox[1]===ne.bbox[3]?X.flyTo(ne.center,Or(ne)):X.fitBounds(Z0(ne.bbox),50,Or(ne)),t(14,tt=void 0),t(55,it=void 0),t(15,Ye=-1)),t(57,ii=ne==null?void 0:ne.id)),r.$$.dirty[0]&18432&&Ke&&tt!=null&&tt.length&&t(15,Ye=0),r.$$.dirty[0]&2&&t(15,Ye=-1),r.$$.dirty[0]&16384|r.$$.dirty[1]&16777216&&it!==tt&&t(55,it=void 0),r.$$.dirty[0]&81921|r.$$.dirty[1]&16777248&&X&&X.setEventHandler(W=>{switch(W.type){case"mapClick":ce&&mt(W.coordinates);break;case"markerClick":{const Be=tt==null?void 0:tt.find(Fe=>Fe.id===W.id);Be&&Nr(Be)}break;case"markerMouseEnter":it&&t(15,Ye=ni?(tt==null?void 0:tt.findIndex(Be=>Be.id===W.id))??-1:-1);break;case"markerMouseLeave":it&&t(15,Ye=-1);break}}),r.$$.dirty[0]&49152&&t(58,l=tt==null?void 0:tt[Ye]),r.$$.dirty[1]&134218786&&X&&l&&G&&Kt&&X.flyTo(l.center,Or(l)),r.$$.dirty[1]&256&&t(59,n=ft==="full-geometry-including-polygon-center-marker"),r.$$.dirty[1]&268437536&&(vt||X==null||X.setFeatures(void 0,void 0,n)),r.$$.dirty[1]&419432480&&X&&vt&&!it&&(X.setFeatures(l?[l]:void 0,void 0,n),X.setSelectedMarker(l?0:-1)),r.$$.dirty[1]&318767136&&X&&X.setFeatures(it,ne,n),r.$$.dirty[0]&32768|r.$$.dirty[1]&16777248&&it&&X&&X.setSelectedMarker(Ye),r.$$.dirty[0]&2|r.$$.dirty[1]&32&&X){const W=Xn(Me);X.setReverseMarker(W?[W.decimalLongitude,W.decimalLatitude]:void 0)}r.$$.dirty[1]&134217728&&Jr("select",{feature:l}),r.$$.dirty[1]&33554432&&Jr("pick",{feature:ne}),r.$$.dirty[0]&81920&&Jr("optionsvisibilitychange",{optionsVisible:ni&&!!tt}),r.$$.dirty[0]&16384&&Jr("featureslisted",{features:tt}),r.$$.dirty[1]&16777216&&Jr("featuresmarked",{features:it}),r.$$.dirty[0]&1&&Jr("reversetoggle",{reverse:ce}),r.$$.dirty[0]&2&&Jr("querychange",{query:Me}),r.$$.dirty[0]&1|r.$$.dirty[1]&32&&X&&X.indicateReverse(ce)},[ce,Me,_,k,P,z,B,_e,ze,Ze,Ct,Ke,nr,at,tt,Ye,ni,We,jt,wn,$o,ct,rr,Jt,Nr,a,x,S,C,D,N,O,G,U,K,me,X,Y,re,ft,Ot,Kt,vt,At,Vt,sr,fr,er,Nt,tr,Lr,Pr,st,Lt,De,it,ne,ii,l,n,d,u,vi,Qt,ro,an,pe,Z,$,te,le,Ce,Ie,Pe,Se]}class YE extends Ht{constructor(e){super(),Zt(this,e,JE,KE,Ut,{ZOOM_DEFAULTS:25,class:2,apiKey:26,bbox:27,clearButtonTitle:3,clearOnBlur:28,collapsed:4,country:29,debounceSearch:30,enableReverse:5,errorMessage:6,filter:31,flyTo:32,fuzzyMatch:33,language:34,limit:35,mapController:36,minLength:37,noResultsMessage:7,placeholder:8,proximity:38,reverseActive:0,reverseButtonTitle:9,searchValue:1,pickedResultStyle:39,showPlaceType:10,showResultsWhileTyping:40,selectFirst:11,flyToSelected:41,markerOnSelected:42,types:43,exhaustiveReverseGeocoding:44,excludeTypes:45,zoom:46,apiUrl:47,fetchParameters:48,iconsBaseUrl:12,adjustUrlQuery:49,focus:50,blur:51,setQuery:52,clearList:53,clearMap:54},null,[-1,-1,-1])}get ZOOM_DEFAULTS(){return this.$$.ctx[25]}get focus(){return this.$$.ctx[50]}get blur(){return this.$$.ctx[51]}get setQuery(){return this.$$.ctx[52]}get clearList(){return this.$$.ctx[53]}get clearMap(){return this.$$.ctx[54]}}function i1(r){let e,t,n;return t=new YE({props:{mapController:r[1],apiKey:r[0],proximity:[{type:"map-center"}]}}),{c(){e=fe("div"),je(t.$$.fragment),Ee(e,"class","svelte-ixhnie")},m(l,u){be(l,e,u),Oe(t,e,null),n=!0},p(l,u){const d={};u&2&&(d.mapController=l[1]),u&1&&(d.apiKey=l[0]),t.$set(d)},i(l){n||(oe(t.$$.fragment,l),n=!0)},o(l){de(t.$$.fragment,l),n=!1},d(l){l&&ve(e),Ne(t)}}}function QE(r){let e,t,n=r[1]&&i1(r);return{c(){n&&n.c(),e=$n()},m(l,u){n&&n.m(l,u),be(l,e,u),t=!0},p(l,[u]){l[1]?n?(n.p(l,u),u&2&&oe(n,1)):(n=i1(l),n.c(),oe(n,1),n.m(e.parentNode,e)):n&&(yr(),de(n,1,1,()=>{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function e5(r,e,t){let n,{apiKey:l}=e,{map:u}=e;function d(a){return a?vw(a,to,!0,!0,{duration:1e3},{duration:1e3}):null}return r.$$set=a=>{"apiKey"in a&&t(0,l=a.apiKey),"map"in a&&t(2,u=a.map)},r.$$.update=()=>{r.$$.dirty&4&&t(1,n=d(u))},[l,n,u]}class t5 extends Ht{constructor(e){super(),Zt(this,e,e5,QE,Ut,{apiKey:0,map:2})}}const r5=["==",["geometry-type"],"Polygon"],n5=["==",["geometry-type"],"LineString"];function i5(r,e,t){let n=["match",r];for(let[l,u]of Object.entries(e))n.push(l),n.push(u);return n.push(t),n}function Xf(){return{type:"FeatureCollection",features:[]}}const o5=r=>({}),o1=r=>({}),s5=r=>({}),s1=r=>({}),a5=r=>({}),a1=r=>({});function l5(r){let e,t,n,l,u,d;const a=r[1].top,_=Vr(a,r,r[0],a1),x=r[1].left,S=Vr(x,r,r[0],s1),k=r[1].main,C=Vr(k,r,r[0],o1);return{c(){e=fe("div"),_&&_.c(),t=Ve(),n=fe("div"),S&&S.c(),l=Ve(),u=fe("div"),C&&C.c(),Ee(e,"class","top svelte-mpick2"),Ee(n,"class","left svelte-mpick2"),Ee(u,"class","main svelte-mpick2")},m(P,D){be(P,e,D),_&&_.m(e,null),be(P,t,D),be(P,n,D),S&&S.m(n,null),be(P,l,D),be(P,u,D),C&&C.m(u,null),d=!0},p(P,[D]){_&&_.p&&(!d||D&1)&&Gr(_,a,P,P[0],d?qr(a,P[0],D,a5):Wr(P[0]),a1),S&&S.p&&(!d||D&1)&&Gr(S,x,P,P[0],d?qr(x,P[0],D,s5):Wr(P[0]),s1),C&&C.p&&(!d||D&1)&&Gr(C,k,P,P[0],d?qr(k,P[0],D,o5):Wr(P[0]),o1)},i(P){d||(oe(_,P),oe(S,P),oe(C,P),d=!0)},o(P){de(_,P),de(S,P),de(C,P),d=!1},d(P){P&&(ve(e),ve(t),ve(n),ve(l),ve(u)),_&&_.d(P),S&&S.d(P),C&&C.d(P)}}}function c5(r,e,t){let{$$slots:n={},$$scope:l}=e;return r.$$set=u=>{"$$scope"in u&&t(0,l=u.$$scope)},[l,n]}class u5 extends Ht{constructor(e){super(),Zt(this,e,c5,l5,Ut,{})}}const h5=r=>({}),l1=r=>({}),f5=r=>({}),c1=r=>({}),d5=r=>({}),u1=r=>({});function p5(r){let e,t,n,l,u,d;const a=r[4].top,_=Vr(a,r,r[3],u1),x=r[4].sidebar,S=Vr(x,r,r[3],c1),k=r[4].map,C=Vr(k,r,r[3],l1);return{c(){e=fe("div"),_&&_.c(),t=Ve(),n=fe("div"),S&&S.c(),l=Ve(),u=fe("div"),C&&C.c()},m(P,D){be(P,e,D),_&&_.m(e,null),r[5](e),be(P,t,D),be(P,n,D),S&&S.m(n,null),r[6](n),be(P,l,D),be(P,u,D),C&&C.m(u,null),r[7](u),d=!0},p(P,[D]){_&&_.p&&(!d||D&8)&&Gr(_,a,P,P[3],d?qr(a,P[3],D,d5):Wr(P[3]),u1),S&&S.p&&(!d||D&8)&&Gr(S,x,P,P[3],d?qr(x,P[3],D,f5):Wr(P[3]),c1),C&&C.p&&(!d||D&8)&&Gr(C,k,P,P[3],d?qr(k,P[3],D,h5):Wr(P[3]),l1)},i(P){d||(oe(_,P),oe(S,P),oe(C,P),d=!0)},o(P){de(_,P),de(S,P),de(C,P),d=!1},d(P){P&&(ve(e),ve(t),ve(n),ve(l),ve(u)),_&&_.d(P),r[5](null),S&&S.d(P),r[6](null),C&&C.d(P),r[7](null)}}}function m5(r,e,t){let n,l,u;wt(r,Hm,k=>t(0,n=k)),wt(r,$m,k=>t(1,l=k)),wt(r,Xm,k=>t(2,u=k));let{$$slots:d={},$$scope:a}=e;function _(k){pn[k?"unshift":"push"](()=>{n=k,Hm.set(n)})}function x(k){pn[k?"unshift":"push"](()=>{l=k,$m.set(l)})}function S(k){pn[k?"unshift":"push"](()=>{u=k,Xm.set(u)})}return r.$$set=k=>{"$$scope"in k&&t(3,a=k.$$scope)},[n,l,u,a,d,_,x,S]}class Fs extends Ht{constructor(e){super(),Zt(this,e,m5,p5,Ut,{})}}let Hm=Tr(null),$m=Tr(null),Xm=Tr(null);function g5(r){let e,t,n,l,u,d,a,_,x;return{c(){e=fe("label"),t=rt(`Basemap: - `),n=fe("select"),l=fe("option"),l.textContent="MapTiler Dataviz",u=fe("option"),u.textContent="MapTiler Streets",d=fe("option"),d.textContent="MapTiler Satellite",a=fe("option"),a.textContent="OS Open Zoomstack",l.__value="dataviz",ei(l,l.__value),u.__value="streets-v2",ei(u,u.__value),d.__value="hybrid",ei(d,d.__value),a.__value="uk-openzoomstack-light",ei(a,a.__value),r[0]===void 0&&uh(()=>r[1].call(n))},m(S,k){be(S,e,k),ie(e,t),ie(e,n),ie(n,l),ie(n,u),ie(n,d),ie(n,a),sd(n,r[0],!0),_||(x=Tt(n,"change",r[1]),_=!0)},p(S,[k]){k&1&&sd(n,S[0])},i:Mt,o:Mt,d(S){S&&ve(e),_=!1,x()}}}function _5(r,e,t){let n;wt(r,Rm,u=>t(0,n=u));function l(){n=Mb(this),Rm.set(n)}return[n,l]}class y5 extends Ht{constructor(e){super(),Zt(this,e,_5,g5,Ut,{})}}let Kf=Tr(!0);function v5(r){let e,t;return e=new ma({props:{paint:{"fill-color":"black","fill-opacity":0},layout:{visibility:r[0]?"none":"visible"}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&1&&(u.layout={visibility:n[0]?"none":"visible"}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function b5(r){let e,t;return e=new Pi({props:{data:r[1],$$slots:{default:[v5]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,[l]){const u={};l&5&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function w5(r,e,t){let n;return wt(r,Kf,u=>t(0,n=u)),[n,{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]}}]}class x5 extends Ht{constructor(e){super(),Zt(this,e,w5,b5,Ut,{})}}const S5="/ltn/assets/help-d011708a.svg";function h1(r){let e,t;return e=new Pd({props:{$$slots:{default:[k5]},$$scope:{ctx:r}}}),e.$on("close",r[3]),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&16&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function k5(r){let e,t,n;const l=r[1].default,u=Vr(l,r,r[4],null);return{c(){e=fe("h2"),e.textContent="Help",t=Ve(),u&&u.c()},m(d,a){be(d,e,a),be(d,t,a),u&&u.m(d,a),n=!0},p(d,a){u&&u.p&&(!n||a&16)&&Gr(u,l,d,d[4],n?qr(l,d[4],a,null):Wr(d[4]),null)},i(d){n||(oe(u,d),n=!0)},o(d){de(u,d),n=!1},d(d){d&&(ve(e),ve(t)),u&&u.d(d)}}}function T5(r){let e,t,n,l,u,d,a=r[0]&&h1(r);return{c(){e=fe("button"),e.innerHTML=`Help`,t=Ve(),a&&a.c(),n=$n(),Ee(e,"class","svelte-gb6dzm")},m(_,x){be(_,e,x),be(_,t,x),a&&a.m(_,x),be(_,n,x),l=!0,u||(d=Tt(e,"click",r[2]),u=!0)},p(_,[x]){_[0]?a?(a.p(_,x),x&1&&oe(a,1)):(a=h1(_),a.c(),oe(a,1),a.m(n.parentNode,n)):a&&(yr(),de(a,1,1,()=>{a=null}),vr())},i(_){l||(oe(a),l=!0)},o(_){de(a),l=!1},d(_){_&&(ve(e),ve(t),ve(n)),a&&a.d(_),u=!1,d()}}}function E5(r,e,t){let{$$slots:n={},$$scope:l}=e,u=!1;const d=()=>t(0,u=!0),a=()=>t(0,u=!1);return r.$$set=_=>{"$$scope"in _&&t(4,l=_.$$scope)},[u,n,d,a,l]}class Og extends Ht{constructor(e){super(),Zt(this,e,E5,T5,Ut,{})}}function M5(r){let e,t,n,l;const u=r[1].default,d=Vr(u,r,r[0],null);return{c(){e=fe("a"),d&&d.c(),Ee(e,"href","#")},m(a,_){be(a,e,_),d&&d.m(e,null),t=!0,n||(l=Tt(e,"click",vg(r[2])),n=!0)},p(a,[_]){d&&d.p&&(!t||_&1)&&Gr(d,u,a,a[0],t?qr(u,a[0],_,null):Wr(a[0]),null)},i(a){t||(oe(d,a),t=!0)},o(a){de(d,a),t=!1},d(a){a&&ve(e),d&&d.d(a),n=!1,l()}}}function C5(r,e,t){let{$$slots:n={},$$scope:l}=e;function u(d){ur.call(this,r,d)}return r.$$set=d=>{"$$scope"in d&&t(0,l=d.$$scope)},[l,n,u]}class Zr extends Ht{constructor(e){super(),Zt(this,e,C5,M5,Ut,{})}}const I5=r=>({props:r&8}),f1=r=>({props:P5(r[3])});function A5(r){let e;const t=r[1].default,n=Vr(t,r,r[2],f1);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&12)&&Gr(n,t,l,l[2],e?qr(t,l[2],u,I5):Wr(l[2]),f1)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function L5(r){let e,t;return e=new l3({props:{openOn:r[0],popupClass:"popup",$$slots:{default:[A5,({features:n})=>({3:n}),({features:n})=>n?8:0]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,[l]){const u={};l&1&&(u.openOn=n[0]),l&12&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function P5(r){return r?r[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function z5(r,e,t){let{$$slots:n={},$$scope:l}=e,{openOn:u="hover"}=e;return r.$$set=d=>{"openOn"in d&&t(0,u=d.openOn),"$$scope"in d&&t(2,l=d.$$scope)},[u,n,l]}class Os extends Ht{constructor(e){super(),Zt(this,e,z5,L5,Ut,{openOn:0})}}function D5(r,e){let t=new Set(r.getStyle().layers.filter(n=>n.type=="line").map(n=>n.id));return e=="dataviz"?["Road network","Path"].filter(n=>t.has(n)):e=="hybrid"?["Path","Road","Tunnel"].filter(n=>t.has(n)):e=="streets-v2"?r.getStyle().layers.filter(n=>n["source-layer"]=="transportation"&&n.type=="line").map(n=>n.id):e=="uk-openzoomstack-light"?r.getStyle().layers.filter(n=>n["source-layer"]=="roads"&&n.type=="line").map(n=>n.id):[]}const{window:R5}=Ad;function B5(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D,N;return P=Eb(r[8][0]),{c(){e=fe("button"),e.textContent="Stop StreetView",t=Ve(),n=fe("fieldset"),l=fe("legend"),l.textContent="Source:",u=Ve(),d=fe("label"),a=fe("input"),_=rt(` +***************************************************************************** */function zT(r,e){var t={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},n,l,u,d;return d={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function a(x){return function(S){return _([x,S])}}function _(x){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,l&&(u=x[0]&2?l.return:x[0]?l.throw||((u=l.return)&&u.call(l),0):l.next)&&!(u=u.call(l,x[1])).done)return u;switch(l=0,u&&(x=[x[0]&2,u.value]),x[0]){case 0:case 1:u=x;break;case 4:return t.label++,{value:x[1],done:!1};case 5:t.label++,l=x[1],x=[0];continue;case 7:x=t.ops.pop(),t.trys.pop();continue;default:if(u=t.trys,!(u=u.length>0&&u[u.length-1])&&(x[0]===6||x[0]===2)){t=0;continue}if(x[0]===3&&(!u||x[1]>u[0]&&x[1]e?1:r0){if(e.right===null)break;if(t(r,e.right.key)>0){var a=e.right;if(e.right=a.left,a.left=e,e=a,e.right===null)break}l.right=e,l=e,e=e.right}else break}return l.right=e.left,u.left=e.right,e.left=n.right,e.right=n.left,e}function rm(r,e,t,n){var l=new pa(r,e);if(t===null)return l.left=l.right=null,l;t=sa(r,t,n);var u=n(r,t.key);return u<0?(l.left=t.left,l.right=t,t.left=null):u>=0&&(l.right=t.right,l.left=t,t.right=null),l}function C0(r,e,t){var n=null,l=null;if(e){e=sa(r,e,t);var u=t(e.key,r);u===0?(n=e.left,l=e.right):u<0?(l=e.right,e.right=null,n=e):(n=e.left,e.left=null,l=e)}return{left:n,right:l}}function RT(r,e,t){return e===null?r:(r===null||(e=sa(r.key,e,t),e.left=r),e)}function Vm(r,e,t,n,l){if(r){n(""+e+(t?"└── ":"├── ")+l(r)+` +`);var u=e+(t?" ":"│ ");r.left&&Vm(r.left,u,!1,n,l),r.right&&Vm(r.right,u,!0,n,l)}}var Bg=function(){function r(e){e===void 0&&(e=DT),this._root=null,this._size=0,this._comparator=e}return r.prototype.insert=function(e,t){return this._size++,this._root=rm(e,t,this._root,this._comparator)},r.prototype.add=function(e,t){var n=new pa(e,t);this._root===null&&(n.left=n.right=null,this._size++,this._root=n);var l=this._comparator,u=sa(e,this._root,l),d=l(e,u.key);return d===0?this._root=u:(d<0?(n.left=u.left,n.right=u,u.left=null):d>0&&(n.right=u.right,n.left=u,u.right=null),this._size++,this._root=n),this._root},r.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},r.prototype._remove=function(e,t,n){var l;if(t===null)return null;t=sa(e,t,n);var u=n(e,t.key);return u===0?(t.left===null?l=t.right:(l=sa(e,t.left,n),l.right=t.right),this._size--,l):t},r.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=sa(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},r.prototype.findStatic=function(e){for(var t=this._root,n=this._comparator;t;){var l=n(e,t.key);if(l===0)return t;l<0?t=t.left:t=t.right}return null},r.prototype.find=function(e){return this._root&&(this._root=sa(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},r.prototype.contains=function(e){for(var t=this._root,n=this._comparator;t;){var l=n(e,t.key);if(l===0)return!0;l<0?t=t.left:t=t.right}return!1},r.prototype.forEach=function(e,t){for(var n=this._root,l=[],u=!1;!u;)n!==null?(l.push(n),n=n.left):l.length!==0?(n=l.pop(),e.call(t,n),n=n.right):u=!0;return this},r.prototype.range=function(e,t,n,l){for(var u=[],d=this._comparator,a=this._root,_;u.length!==0||a;)if(a)u.push(a),a=a.left;else{if(a=u.pop(),_=d(a.key,t),_>0)break;if(d(a.key,e)>=0&&n.call(l,a))return this;a=a.right}return this},r.prototype.keys=function(){var e=[];return this.forEach(function(t){var n=t.key;return e.push(n)}),e},r.prototype.values=function(){var e=[];return this.forEach(function(t){var n=t.data;return e.push(n)}),e},r.prototype.min=function(){return this._root?this.minNode(this._root).key:null},r.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},r.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},r.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},r.prototype.at=function(e){for(var t=this._root,n=!1,l=0,u=[];!n;)if(t)u.push(t),t=t.left;else if(u.length>0){if(t=u.pop(),l===e)return t;l++,t=t.right}else n=!0;return null},r.prototype.next=function(e){var t=this._root,n=null;if(e.right){for(n=e.right;n.left;)n=n.left;return n}for(var l=this._comparator;t;){var u=l(e.key,t.key);if(u===0)break;u<0?(n=t,t=t.left):t=t.right}return n},r.prototype.prev=function(e){var t=this._root,n=null;if(e.left!==null){for(n=e.left;n.right;)n=n.right;return n}for(var l=this._comparator;t;){var u=l(e.key,t.key);if(u===0)break;u<0?t=t.left:(n=t,t=t.right)}return n},r.prototype.clear=function(){return this._root=null,this._size=0,this},r.prototype.toList=function(){return FT(this._root)},r.prototype.load=function(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!1);var l=e.length,u=this._comparator;if(n&&Wm(e,t,0,l-1,u),this._root===null)this._root=qm(e,t,0,l),this._size=l;else{var d=OT(this.toList(),BT(e,t),u);l=this._size+l,this._root=Gm({head:d},0,l)}return this},r.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(r.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),r.prototype.toString=function(e){e===void 0&&(e=function(n){return String(n.key)});var t=[];return Vm(this._root,"",!0,function(n){return t.push(n)},e),t.join("")},r.prototype.update=function(e,t,n){var l=this._comparator,u=C0(e,this._root,l),d=u.left,a=u.right;l(e,t)<0?a=rm(t,n,a,l):d=rm(t,n,d,l),this._root=RT(d,a,l)},r.prototype.split=function(e){return C0(e,this._root,this._comparator)},r.prototype[Symbol.iterator]=function(){var e,t,n;return zT(this,function(l){switch(l.label){case 0:e=this._root,t=[],n=!1,l.label=1;case 1:return n?[3,6]:e===null?[3,2]:(t.push(e),e=e.left,[3,5]);case 2:return t.length===0?[3,4]:(e=t.pop(),[4,e]);case 3:return l.sent(),e=e.right,[3,5];case 4:n=!0,l.label=5;case 5:return[3,1];case 6:return[2]}})},r}();function qm(r,e,t,n){var l=n-t;if(l>0){var u=t+Math.floor(l/2),d=r[u],a=e[u],_=new pa(d,a);return _.left=qm(r,e,t,u),_.right=qm(r,e,u+1,n),_}return null}function BT(r,e){for(var t=new pa(null,null),n=t,l=0;l0?(e=u=u.next=t.pop(),e=e.right):n=!0;return u.next=null,l.next}function Gm(r,e,t){var n=t-e;if(n>0){var l=e+Math.floor(n/2),u=Gm(r,e,l),d=r.head;return d.left=u,r.head=r.head.next,d.right=Gm(r,l+1,t),d}return null}function OT(r,e,t){for(var n=new pa(null,null),l=n,u=r,d=e;u!==null&&d!==null;)t(u.key,d.key)<0?(l.next=u,u=u.next):(l.next=d,d=d.next),l=l.next;return u!==null?l.next=u:d!==null&&(l.next=d),n.next}function Wm(r,e,t,n,l){if(!(t>=n)){for(var u=r[t+n>>1],d=t-1,a=n+1;;){do d++;while(l(r[d],u)<0);do a--;while(l(r[a],u)>0);if(d>=a)break;var _=r[d];r[d]=r[a],r[a]=_,_=e[d],e[d]=e[a],e[a]=_}Wm(r,e,t,a,l),Wm(r,e,a+1,n,l)}}const Ps=11102230246251565e-32,Ii=134217729,NT=(3+8*Ps)*Ps;function nm(r,e,t,n,l){let u,d,a,_,x=e[0],S=n[0],k=0,C=0;S>x==S>-x?(u=x,x=e[++k]):(u=S,S=n[++C]);let P=0;if(kx==S>-x?(d=x+u,a=u-(d-x),x=e[++k]):(d=S+u,a=u-(d-S),S=n[++C]),u=d,a!==0&&(l[P++]=a);kx==S>-x?(d=u+x,_=d-u,a=u-(d-_)+(x-_),x=e[++k]):(d=u+S,_=d-u,a=u-(d-_)+(S-_),S=n[++C]),u=d,a!==0&&(l[P++]=a);for(;k=Me||-Ze>=Me||(k=r-_e,a=r-(_e+k)+(k-l),k=t-ze,x=t-(ze+k)+(k-l),k=e-re,_=e-(re+k)+(k-u),k=n-ce,S=n-(ce+k)+(k-u),a===0&&_===0&&x===0&&S===0)||(Me=qT*d+NT*Math.abs(Ze),Ze+=_e*S+ce*a-(re*x+ze*_),Ze>=Me||-Ze>=Me))return Ze;U=a*ce,C=Ii*a,P=C-(C-a),D=a-P,C=Ii*ce,N=C-(C-ce),z=ce-N,K=D*z-(U-P*N-D*N-P*z),me=_*ze,C=Ii*_,P=C-(C-_),D=_-P,C=Ii*ze,N=C-(C-ze),z=ze-N,X=D*z-(me-P*N-D*N-P*z),B=K-X,k=K-B,Gi[0]=K-(B+k)+(k-X),O=U+B,k=O-U,G=U-(O-k)+(B-k),B=G-me,k=G-B,Gi[1]=G-(B+k)+(k-me),Y=O+B,k=Y-O,Gi[2]=O-(Y-k)+(B-k),Gi[3]=Y;const ft=nm(4,lc,4,Gi,I0);U=_e*S,C=Ii*_e,P=C-(C-_e),D=_e-P,C=Ii*S,N=C-(C-S),z=S-N,K=D*z-(U-P*N-D*N-P*z),me=re*x,C=Ii*re,P=C-(C-re),D=re-P,C=Ii*x,N=C-(C-x),z=x-N,X=D*z-(me-P*N-D*N-P*z),B=K-X,k=K-B,Gi[0]=K-(B+k)+(k-X),O=U+B,k=O-U,G=U-(O-k)+(B-k),B=G-me,k=G-B,Gi[1]=G-(B+k)+(k-me),Y=O+B,k=Y-O,Gi[2]=O-(Y-k)+(B-k),Gi[3]=Y;const Ct=nm(ft,I0,4,Gi,A0);U=a*S,C=Ii*a,P=C-(C-a),D=a-P,C=Ii*S,N=C-(C-S),z=S-N,K=D*z-(U-P*N-D*N-P*z),me=_*x,C=Ii*_,P=C-(C-_),D=_-P,C=Ii*x,N=C-(C-x),z=x-N,X=D*z-(me-P*N-D*N-P*z),B=K-X,k=K-B,Gi[0]=K-(B+k)+(k-X),O=U+B,k=O-U,G=U-(O-k)+(B-k),B=G-me,k=G-B,Gi[1]=G-(B+k)+(k-me),Y=O+B,k=Y-O,Gi[2]=O-(Y-k)+(B-k),Gi[3]=Y;const Ot=nm(Ct,A0,4,Gi,L0);return L0[Ot-1]}function WT(r,e,t,n,l,u){const d=(e-u)*(t-l),a=(r-l)*(n-u),_=d-a,x=Math.abs(d+a);return Math.abs(_)>=UT*x?_:-GT(r,e,t,n,l,u,x)}const ju=(r,e)=>r.ll.x<=e.x&&e.x<=r.ur.x&&r.ll.y<=e.y&&e.y<=r.ur.y,Zm=(r,e)=>{if(e.ur.x{if(-lar.x*e.y-r.y*e.x,gw=(r,e)=>r.x*e.x+r.y*e.y,D0=(r,e,t)=>{const n=WT(r.x,r.y,e.x,e.y,t.x,t.y);return n>0?-1:n<0?1:0},pd=r=>Math.sqrt(gw(r,r)),$T=(r,e,t)=>{const n={x:e.x-r.x,y:e.y-r.y},l={x:t.x-r.x,y:t.y-r.y};return $f(l,n)/pd(l)/pd(n)},XT=(r,e,t)=>{const n={x:e.x-r.x,y:e.y-r.y},l={x:t.x-r.x,y:t.y-r.y};return gw(l,n)/pd(l)/pd(n)},R0=(r,e,t)=>e.y===0?null:{x:r.x+e.x/e.y*(t-r.y),y:t},B0=(r,e,t)=>e.x===0?null:{x:t,y:r.y+e.y/e.x*(t-r.x)},KT=(r,e,t,n)=>{if(e.x===0)return B0(t,n,r.x);if(n.x===0)return B0(r,e,t.x);if(e.y===0)return R0(t,n,r.y);if(n.y===0)return R0(r,e,t.y);const l=$f(e,n);if(l==0)return null;const u={x:t.x-r.x,y:t.y-r.y},d=$f(u,e)/l,a=$f(u,n)/l,_=r.x+a*e.x,x=t.x+d*n.x,S=r.y+a*e.y,k=t.y+d*n.y,C=(_+x)/2,P=(S+k)/2;return{x:C,y:P}};class Mo{static compare(e,t){const n=Mo.comparePoints(e.point,t.point);return n!==0?n:(e.point!==t.point&&e.link(t),e.isLeft!==t.isLeft?e.isLeft?1:-1:ua.compare(e.segment,t.segment))}static comparePoints(e,t){return e.xt.x?1:e.yt.y?1:0}constructor(e,t){e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=t}link(e){if(e.point===this.point)throw new Error("Tried to link already linked events");const t=e.point.events;for(let n=0,l=t.length;n{const u=l.otherSE;t.set(l,{sine:$T(this.point,e.point,u.point),cosine:XT(this.point,e.point,u.point)})};return(l,u)=>{t.has(l)||n(l),t.has(u)||n(u);const{sine:d,cosine:a}=t.get(l),{sine:_,cosine:x}=t.get(u);return d>=0&&_>=0?ax?-1:0:d<0&&_<0?ax?1:0:_d?1:0}}}let JT=0;class ua{static compare(e,t){const n=e.leftSE.point.x,l=t.leftSE.point.x,u=e.rightSE.point.x,d=t.rightSE.point.x;if(da&&_>x)return-1;const k=e.comparePoint(t.leftSE.point);if(k<0)return 1;if(k>0)return-1;const C=t.comparePoint(e.rightSE.point);return C!==0?C:-1}if(n>l){if(a<_&&a_&&a>S)return 1;const k=t.comparePoint(e.leftSE.point);if(k!==0)return k;const C=e.comparePoint(t.rightSE.point);return C<0?1:C>0?-1:1}if(a<_)return-1;if(a>_)return 1;if(ud){const k=e.comparePoint(t.rightSE.point);if(k<0)return 1;if(k>0)return-1}if(u!==d){const k=x-a,C=u-n,P=S-_,D=d-l;if(k>C&&PD)return-1}return u>d?1:uS?1:e.idt.id?1:0}constructor(e,t,n,l){this.id=++JT,this.leftSE=e,e.segment=this,e.otherSE=t,this.rightSE=t,t.segment=this,t.otherSE=e,this.rings=n,this.windings=l}static fromRing(e,t,n){let l,u,d;const a=Mo.comparePoints(e,t);if(a<0)l=e,u=t,d=1;else if(a>0)l=t,u=e,d=-1;else throw new Error(`Tried to create degenerate segment at [${e.x}, ${e.y}]`);const _=new Mo(l,!0),x=new Mo(u,!1);return new ua(_,x,[n],[d])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const e=this.leftSE.point.y,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:et?e:t}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}comparePoint(e){if(this.isAnEndpoint(e))return 0;const t=this.leftSE.point,n=this.rightSE.point,l=this.vector();if(t.x===n.x)return e.x===t.x?0:e.x0&&a.swapEvents(),Mo.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(l.checkForConsuming(),u.checkForConsuming()),t}swapEvents(){const e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let t=0,n=this.windings.length;t0){const u=t;t=n,n=u}if(t.prev===n){const u=t;t=n,n=u}for(let u=0,d=n.rings.length;ul.length===1&&l[0].isSubject;this._isInResult=n(e)!==n(t);break}default:throw new Error(`Unrecognized operation type found ${Wo.type}`)}return this._isInResult}}class F0{constructor(e,t,n){if(!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=t,this.isExterior=n,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const l=yh.round(e[0][0],e[0][1]);this.bbox={ll:{x:l.x,y:l.y},ur:{x:l.x,y:l.y}};let u=l;for(let d=1,a=e.length;dthis.bbox.ur.x&&(this.bbox.ur.x=_.x),_.y>this.bbox.ur.y&&(this.bbox.ur.y=_.y),u=_)}(l.x!==u.x||l.y!==u.y)&&this.segments.push(ua.fromRing(u,l,this))}getSweepEvents(){const e=[];for(let t=0,n=this.segments.length;tthis.bbox.ur.x&&(this.bbox.ur.x=u.bbox.ur.x),u.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=u.bbox.ur.y),this.interiorRings.push(u)}this.multiPoly=t}getSweepEvents(){const e=this.exteriorRing.getSweepEvents();for(let t=0,n=this.interiorRings.length;tthis.bbox.ur.x&&(this.bbox.ur.x=u.bbox.ur.x),u.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=u.bbox.ur.y),this.polys.push(u)}this.isSubject=t}getSweepEvents(){const e=[];for(let t=0,n=this.polys.length;t0&&(e=d)}let t=e.segment.prevInResult(),n=t?t.prevInResult():null;for(;;){if(!t)return null;if(!n)return t.ringOut;if(n.ringOut!==t.ringOut)return n.ringOut.enclosingRing()!==t.ringOut?t.ringOut:t.ringOut.enclosingRing();t=n.prevInResult(),n=t?t.prevInResult():null}}}class N0{constructor(e){this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){const e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(let t=0,n=this.interiorRings.length;t1&&arguments[1]!==void 0?arguments[1]:ua.compare;this.queue=e,this.tree=new Bg(t),this.segments=[]}process(e){const t=e.segment,n=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(t),n;const l=e.isLeft?this.tree.add(t):this.tree.find(t);if(!l)throw new Error(`Unable to find segment #${t.id} [${t.leftSE.point.x}, ${t.leftSE.point.y}] -> [${t.rightSE.point.x}, ${t.rightSE.point.y}] in SweepLine tree.`);let u=l,d=l,a,_;for(;a===void 0;)u=this.tree.prev(u),u===null?a=null:u.key.consumedBy===void 0&&(a=u.key);for(;_===void 0;)d=this.tree.next(d),d===null?_=null:d.key.consumedBy===void 0&&(_=d.key);if(e.isLeft){let x=null;if(a){const k=a.getIntersection(t);if(k!==null&&(t.isAnEndpoint(k)||(x=k),!a.isAnEndpoint(k))){const C=this._splitSafely(a,k);for(let P=0,D=C.length;P0?(this.tree.remove(t),n.push(e)):(this.segments.push(t),t.prev=a)}else{if(a&&_){const x=a.getIntersection(_);if(x!==null){if(!a.isAnEndpoint(x)){const S=this._splitSafely(a,x);for(let k=0,C=S.length;kj0)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const d=new eE(u);let a=u.size,_=u.pop();for(;_;){const S=_.key;if(u.size===a){const C=S.segment;throw new Error(`Unable to pop() ${S.isLeft?"left":"right"} SweepEvent [${S.point.x}, ${S.point.y}] from segment #${C.id} [${C.leftSE.point.x}, ${C.leftSE.point.y}] -> [${C.rightSE.point.x}, ${C.rightSE.point.y}] from queue.`)}if(u.size>j0)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(d.segments.length>tE)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const k=d.process(S);for(let C=0,P=k.length;C1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n{t.push(l.coordinates)}),t.length<2)throw new Error("Must have at least 2 geometries");const n=_w.union(t[0],...t.slice(1));return n.length===0?null:n.length===1?Rg(n[0],e.properties):mw(n,e.properties)}var vw=lE;function cE(r,e={}){if(r.bbox!=null&&e.recompute!==!0)return r.bbox;const t=[1/0,1/0,-1/0,-1/0];return yw(r,n=>{t[0]>n[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]{e.push(l.coordinates)}),e.length<2)throw new Error("Must have at least two features");const t=r.features[0].properties||{},n=_w.difference(e[0],...e.slice(1));return n.length===0?null:n.length===1?Rg(n[0],t):mw(n,t)}var hE=uE;function fE(r){if(!r)throw new Error("geojson is required");var e=[];return aE(r,function(t){e.push(t)}),_h(e)}var dE=fE;function V0(r,e){const t=hE(_h([Rg([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),r]));if(!t)return;t.properties={isMask:!0};const n=dd(U0(r)),l=(n[2]-n[0])/360/1e3,u=n[0]<-180,d=n[2]>180,a=dE(r);if(a.features.length>1&&(u||d))for(const _ of a.features){const x=dd(U0(_));if(d&&x[0]<-180+l)for(const S of _.geometry.coordinates)for(const k of S)k[0]+=360-l;if(u&&x[2]>180-l)for(const S of _.geometry.coordinates)for(const k of S)k[0]-=360-l}e(_h([a.features.length<2?r:vw(a)??r,t]))}const q0={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}},Ff="mtlr-gc-full-geom",G0="mtlr-gc-full-geom-fill",W0="mtlr-gc-full-geom-line";function bw(r,e,t=!0,n=!0,l={},u={},d=q0){let a;const _=[];let x,S,k;function C(){if(!r.loaded){r.once("load",C);return}const z=d?d===!0?q0:d:void 0;if(!(z!=null&&z.fill)&&!(z!=null&&z.line))return;const B=r.getSource(Ff);if(B)B.setData(k??_h([]));else if(k)r.addSource(Ff,{type:"geojson",data:k});else return;!r.getLayer(G0)&&z!=null&&z.fill&&r.addLayer({...z==null?void 0:z.fill,id:G0,type:"fill",source:Ff}),!r.getLayer(W0)&&z!=null&&z.line&&r.addLayer({...z==null?void 0:z.line,id:W0,type:"line",source:Ff})}function P(z){k=z,C()}r.on("styledata",()=>{setTimeout(()=>{k&&C()})});const D=z=>{a==null||a({type:"mapClick",coordinates:[z.lngLat.lng,z.lngLat.lat]})};function N(z=!1){if(!e)throw new Error;const B=document.createElement("div");return z&&B.classList.add("marker-interactive"),new lT({props:{displayIn:"maplibre"},target:B}),new e.Marker({element:B,offset:[1,-13]})}return{setEventHandler(z){z?(a=z,r.on("click",D)):(a=void 0,r.off("click",D))},flyTo(z,B){r.flyTo({center:z,...B?{zoom:B}:{},...l})},fitBounds(z,B,O){r.fitBounds([[z[0],z[1]],[z[2],z[3]]],{padding:B,...O?{maxZoom:O}:{},...u})},indicateReverse(z){r.getCanvasContainer().style.cursor=z?"crosshair":""},setReverseMarker(z){!e||!t||(S?z?S.setLngLat(z):(S.remove(),S=void 0):z&&(t instanceof Function?S=t(r)??void 0:(S=(typeof t=="object"?new e.Marker(t):N()).setLngLat(z).addTo(r),S.getElement().classList.add("marker-reverse"))))},setFeatures(z,B,O){for(const G of _)G.remove();if(_.length=0,P(void 0),!!e){if(B){let G=!1;if(B.geometry.type==="GeometryCollection"){const U=B.geometry.geometries.filter(K=>K.type==="Polygon"||K.type==="MultiPolygon");e:if(U.length>0){const K=vw(_h(U.map(me=>gh(me))));if(!K)break e;V0({...B,geometry:K.geometry},P),G=!0}else{const K=B.geometry.geometries.filter(me=>me.type==="LineString"||me.type==="MultiLineString");K.length>0&&(P({...B,geometry:{type:"GeometryCollection",geometries:K}}),G=!0)}}if(!G){if(B.geometry.type==="Polygon"||B.geometry.type==="MultiPolygon")V0(B,P);else if(B.geometry.type==="LineString"||B.geometry.type==="MultiLineString"){P(B);return}}if(!O&&B.geometry.type!=="Point")return;if(t instanceof Function){const U=t(r,B);U&&_.push(U)}else t&&_.push(typeof t=="object"?new e.Marker(t):N().setLngLat(B.center).addTo(r))}if(n)for(const G of z??[]){if(G===B)continue;let U;if(n instanceof Function){if(U=n(r,G),!U)continue}else U=(typeof n=="object"?new e.Marker(n):N(!0)).setLngLat(G.center).setPopup(new e.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(G.place_type[0]==="reverse"?G.place_name:G.place_name.replace(/,.*/,""))).addTo(r);const K=U.getElement();K.addEventListener("click",me=>{me.stopPropagation(),a==null||a({type:"markerClick",id:G.id})}),K.addEventListener("mouseenter",()=>{a==null||a({type:"markerMouseEnter",id:G.id}),U.togglePopup()}),K.addEventListener("mouseleave",()=>{a==null||a({type:"markerMouseLeave",id:G.id}),U.togglePopup()}),_.push(U)}}},setSelectedMarker(z){x&&x.getElement().classList.toggle("marker-selected",!1),x=z>-1?_[z]:void 0,x==null||x.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const z=r.getCenter();return[r.getZoom(),z.lng,z.lat]}}}function pE(r,e,t){var n,l;class u{constructor(z,B){fo(this,"type"),fo(this,"target"),this.type=B,this.target=z}}class d extends u{constructor(z,B){super(z,"select"),fo(this,"feature"),Object.assign(this,B)}}class a extends u{constructor(z,B){super(z,"featureslisted"),fo(this,"features"),this.features=B}}class _ extends u{constructor(z,B){super(z,"featuresmarked"),fo(this,"features"),this.features=B}}class x extends u{constructor(z,B){super(z,"optionsvisibilitychange"),fo(this,"optionsVisible"),this.optionsVisible=B}}class S extends u{constructor(z,B){super(z,"pick"),fo(this,"feature"),this.feature=B}}class k extends u{constructor(z,B){super(z,"querychange"),fo(this,"query"),this.query=B}}class C extends u{constructor(z,B,O){super(z,"response"),fo(this,"url"),fo(this,"featureCollection"),this.url=B,this.featureCollection=O}}class P extends u{constructor(z,B){super(z,"reversetoggle"),fo(this,"reverse"),this.reverse=B}}class D extends r{constructor(z={}){super(),l0(this,n),l0(this,l),c0(this,l,z)}onAddInt(z){const B=document.createElement("div");B.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl maplibregl-ctrl-geocoder maplibregl-ctrl mapboxgl-ctrl-group";const{marker:O,showResultMarkers:G,flyTo:U,fullGeometryStyle:K,...me}=Qn(this,l),X=typeof U=="boolean"?{}:U,Y={mapController:bw(z,e,O,G,X,X,K),flyTo:U===void 0?!0:!!U,apiKey:"",...t==null?void 0:t(z,B),...me};if(!Y.apiKey)throw new Error("no apiKey provided");return c0(this,n,new PT({target:B,props:Y})),Qn(this,n).$on("select",_e=>{this.fire(new d(this,_e.detail))}),Qn(this,n).$on("pick",_e=>{this.fire(new S(this,_e.detail.feature))}),Qn(this,n).$on("featureslisted",_e=>{this.fire(new a(this,_e.detail.features))}),Qn(this,n).$on("featuresmarked",_e=>{this.fire(new _(this,_e.detail.features))}),Qn(this,n).$on("response",_e=>{this.fire(new C(this,_e.detail.url,_e.detail.featureCollection))}),Qn(this,n).$on("optionsvisibilitychange",_e=>{this.fire(new x(this,_e.detail.optionsVisible))}),Qn(this,n).$on("reversetoggle",_e=>{this.fire(new P(this,_e.detail.reverse))}),Qn(this,n).$on("querychange",_e=>{this.fire(new k(this,_e.detail.query))}),B}on(z,B){return super.on(z,B)}once(z,B){return super.once(z,B)}off(z,B){return super.off(z,B)}listens(z){return super.listens(z)}setOptions(z){var B;Object.assign(Qn(this,l),z);const{marker:O,showResultMarkers:G,flyTo:U,fullGeometryStyle:K,...me}=Qn(this,l);(B=Qn(this,n))==null||B.$set(me)}setQuery(z,B=!0){var O;(O=Qn(this,n))==null||O.setQuery(z,B)}clearMap(){var z;(z=Qn(this,n))==null||z.clearMap()}clearList(){var z;(z=Qn(this,n))==null||z.clearList()}setReverseMode(z){var B;(B=Qn(this,n))==null||B.$set({reverseActive:z})}focus(){var z;(z=Qn(this,n))==null||z.focus()}blur(){var z;(z=Qn(this,n))==null||z.blur()}onRemove(){var z;(z=Qn(this,n))==null||z.$destroy()}}return n=new WeakMap,l=new WeakMap,{MapLibreBasedGeocodingControl:D,events:{SelectEvent:d,FeaturesListedEvent:a,FeaturesMarkedEvent:_,OptionsVisibilityChangeEvent:x,PickEvent:S,QueryChangeEvent:k,ResponseEvent:C,ReverseToggleEvent:P}}}const{MapLibreBasedGeocodingControl:OD,events:va}=pE(Pc.Evented,c4);va.SelectEvent;va.FeaturesListedEvent;va.FeaturesMarkedEvent;va.OptionsVisibilityChangeEvent;va.PickEvent;va.QueryChangeEvent;va.ResponseEvent;va.ReverseToggleEvent;function mE(r){let e,t;return{c(){e=Ls("svg"),t=Ls("path"),Ee(t,"d","M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"),Ee(e,"viewBox","0 0 14 14"),Ee(e,"width","13"),Ee(e,"height","13"),Ee(e,"class","svelte-en2qvf")},m(n,l){be(n,e,l),ie(e,t)},p:Mt,i:Mt,o:Mt,d(n){n&&ve(e)}}}class ww extends Ht{constructor(e){super(),Zt(this,e,null,mE,Ut,{})}}function gE(r){let e,t;return{c(){e=Ls("svg"),t=Ls("path"),Ee(t,"d","M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"),Ee(e,"viewBox","0 0 30 30"),Ee(e,"fill","none"),Ee(e,"xmlns","http://www.w3.org/2000/svg"),Ee(e,"class","svelte-d2loi5")},m(n,l){be(n,e,l),ie(e,t)},p:Mt,i:Mt,o:Mt,d(n){n&&ve(e)}}}class xw extends Ht{constructor(e){super(),Zt(this,e,null,gE,Ut,{})}}function _E(r){let e,t;return{c(){e=fe("img"),En(e.src,t=r[3]+"area.svg")||Ee(e,"src",t),Ee(e,"alt",r[6]),Ee(e,"class","svelte-ltkwvy")},m(n,l){be(n,e,l)},p(n,l){l&8&&!En(e.src,t=n[3]+"area.svg")&&Ee(e,"src",t),l&64&&Ee(e,"alt",n[6])},d(n){n&&ve(e)}}}function yE(r){let e,t;return{c(){e=fe("img"),En(e.src,t=r[3]+"reverse.svg")||Ee(e,"src",t),Ee(e,"alt",r[6]),Ee(e,"class","svelte-ltkwvy")},m(n,l){be(n,e,l)},p(n,l){l&8&&!En(e.src,t=n[3]+"reverse.svg")&&Ee(e,"src",t),l&64&&Ee(e,"alt",n[6])},d(n){n&&ve(e)}}}function vE(r){let e,t;return{c(){e=fe("img"),En(e.src,t=r[3]+"poi.svg")||Ee(e,"src",t),Ee(e,"alt",r[6]),Ee(e,"class","svelte-ltkwvy")},m(n,l){be(n,e,l)},p(n,l){l&8&&!En(e.src,t=n[3]+"poi.svg")&&Ee(e,"src",t),l&64&&Ee(e,"alt",n[6])},d(n){n&&ve(e)}}}function bE(r){let e,t;return{c(){e=fe("img"),En(e.src,t=r[3]+"postal_code.svg")||Ee(e,"src",t),Ee(e,"alt",r[6]),Ee(e,"class","svelte-ltkwvy")},m(n,l){be(n,e,l)},p(n,l){l&8&&!En(e.src,t=n[3]+"postal_code.svg")&&Ee(e,"src",t),l&64&&Ee(e,"alt",n[6])},d(n){n&&ve(e)}}}function wE(r){let e,t;return{c(){e=fe("img"),En(e.src,t=r[3]+"street.svg")||Ee(e,"src",t),Ee(e,"alt",r[6]),Ee(e,"class","svelte-ltkwvy")},m(n,l){be(n,e,l)},p(n,l){l&8&&!En(e.src,t=n[3]+"street.svg")&&Ee(e,"src",t),l&64&&Ee(e,"alt",n[6])},d(n){n&&ve(e)}}}function xE(r){let e,t;return{c(){e=fe("img"),En(e.src,t=r[3]+"road.svg")||Ee(e,"src",t),Ee(e,"alt",r[6]),Ee(e,"class","svelte-ltkwvy")},m(n,l){be(n,e,l)},p(n,l){l&8&&!En(e.src,t=n[3]+"road.svg")&&Ee(e,"src",t),l&64&&Ee(e,"alt",n[6])},d(n){n&&ve(e)}}}function SE(r){let e,t;return{c(){e=fe("img"),En(e.src,t=r[3]+"housenumber.svg")||Ee(e,"src",t),Ee(e,"alt",r[6]),Ee(e,"class","svelte-ltkwvy")},m(n,l){be(n,e,l)},p(n,l){l&8&&!En(e.src,t=n[3]+"housenumber.svg")&&Ee(e,"src",t),l&64&&Ee(e,"alt",n[6])},d(n){n&&ve(e)}}}function kE(r){let e,t,n,l;return{c(){e=fe("img"),En(e.src,t=r[5])||Ee(e,"src",t),Ee(e,"alt",r[4]),Ee(e,"class","svelte-ltkwvy")},m(u,d){be(u,e,d),n||(l=Tt(e,"error",r[14]),n=!0)},p(u,d){d&32&&!En(e.src,t=u[5])&&Ee(e,"src",t),d&16&&Ee(e,"alt",u[4])},d(u){u&&ve(e),n=!1,l()}}}function Z0(r){let e,t;return{c(){e=fe("span"),t=rt(r[6]),Ee(e,"class","secondary svelte-ltkwvy")},m(n,l){be(n,e,l),ie(e,t)},p(n,l){l&64&&Ar(t,n[6])},d(n){n&&ve(e)}}}function TE(r){let e,t,n,l,u,d,a,_,x,S=(r[7]?r[0].place_name:r[0].place_name.replace(/,.*/,""))+"",k,C,P=r[2]==="always"||r[2]!=="never"&&!r[0].address&&!r[0].id.startsWith("road.")&&!r[0].id.startsWith("address.")&&!r[0].id.startsWith("postal_code.")&&(!r[0].id.startsWith("poi.")||!r[5])&&!r[7],D,N,z=(r[7]?"":r[0].place_name.replace(/[^,]*,?\s*/,""))+"",B,O,G;function U(Y,_e){return _e&1&&(t=null),_e&1&&(n=null),_e&1&&(l=null),_e&1&&(u=null),Y[5]?kE:Y[0].address?SE:(t==null&&(t=!!Y[0].id.startsWith("road.")),t?xE:(n==null&&(n=!!Y[0].id.startsWith("address.")),n?wE:(l==null&&(l=!!Y[0].id.startsWith("postal_code.")),l?bE:(u==null&&(u=!!Y[0].id.startsWith("poi.")),u?vE:Y[7]?yE:_E))))}let K=U(r,-1),me=K(r),X=P&&Z0(r);return{c(){e=fe("li"),me.c(),d=Ve(),a=fe("span"),_=fe("span"),x=fe("span"),k=rt(S),C=Ve(),X&&X.c(),D=Ve(),N=fe("span"),B=rt(z),Ee(x,"class","primary svelte-ltkwvy"),Ee(_,"class","svelte-ltkwvy"),Ee(N,"class","line2 svelte-ltkwvy"),Ee(a,"class","texts svelte-ltkwvy"),Ee(e,"tabindex","0"),Ee(e,"data-selected",r[1]),Ee(e,"class","svelte-ltkwvy"),hi(e,"selected",r[1])},m(Y,_e){be(Y,e,_e),me.m(e,null),ie(e,d),ie(e,a),ie(a,_),ie(_,x),ie(x,k),ie(_,C),X&&X.m(_,null),ie(a,D),ie(a,N),ie(N,B),O||(G=[Tt(e,"mouseenter",r[12]),Tt(e,"focus",r[13])],O=!0)},p(Y,[_e]){K===(K=U(Y,_e))&&me?me.p(Y,_e):(me.d(1),me=K(Y),me&&(me.c(),me.m(e,d))),_e&1&&S!==(S=(Y[7]?Y[0].place_name:Y[0].place_name.replace(/,.*/,""))+"")&&Ar(k,S),_e&37&&(P=Y[2]==="always"||Y[2]!=="never"&&!Y[0].address&&!Y[0].id.startsWith("road.")&&!Y[0].id.startsWith("address.")&&!Y[0].id.startsWith("postal_code.")&&(!Y[0].id.startsWith("poi.")||!Y[5])&&!Y[7]),P?X?X.p(Y,_e):(X=Z0(Y),X.c(),X.m(_,null)):X&&(X.d(1),X=null),_e&1&&z!==(z=(Y[7]?"":Y[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Ar(B,z),_e&2&&Ee(e,"data-selected",Y[1]),_e&2&&hi(e,"selected",Y[1])},i:Mt,o:Mt,d(Y){Y&&ve(e),me.d(),X&&X.d(),O=!1,_n(G)}}}function EE(r,e,t){var G;let n,l,{feature:u}=e,{selected:d=!1}=e,{showPlaceType:a}=e,{missingIconsCache:_}=e,{iconsBaseUrl:x}=e;const S=(G=u.properties)==null?void 0:G.categories;let k,C,P=0,D=u.place_type[0]==="reverse";function N(){C&&_.add(C),t(10,P++,P)}function z(U){ur.call(this,r,U)}function B(U){ur.call(this,r,U)}const O=()=>N();return r.$$set=U=>{"feature"in U&&t(0,u=U.feature),"selected"in U&&t(1,d=U.selected),"showPlaceType"in U&&t(2,a=U.showPlaceType),"missingIconsCache"in U&&t(9,_=U.missingIconsCache),"iconsBaseUrl"in U&&t(3,x=U.iconsBaseUrl)},r.$$.update=()=>{var U,K,me,X;if(r.$$.dirty&3640)do t(11,n--,n),t(4,k=S==null?void 0:S[n]),t(5,C=k?x+k.replace(/ /g,"_")+".svg":void 0);while(n>-1&&(!C||_.has(C)));r.$$.dirty&1&&t(6,l=((K=(U=u.properties)==null?void 0:U.categories)==null?void 0:K.join(", "))??((X=(me=u.properties)==null?void 0:me.place_type_name)==null?void 0:X[0])??u.place_type[0])},t(11,n=(S==null?void 0:S.length)??0),[u,d,a,x,k,C,l,D,N,_,P,n,z,B,O]}class ME extends Ht{constructor(e){super(),Zt(this,e,EE,TE,Ut,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function CE(r){let e;return{c(){e=fe("div"),e.innerHTML='',Ee(e,"class","svelte-7cmwmc")},m(t,n){be(t,e,n)},p:Mt,i:Mt,o:Mt,d(t){t&&ve(e)}}}class IE extends Ht{constructor(e){super(),Zt(this,e,null,CE,Ut,{})}}function AE(r){let e,t;return{c(){e=Ls("svg"),t=Ls("path"),Ee(t,"d","M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"),Ee(e,"viewBox","0 0 60.006 21.412"),Ee(e,"width","14"),Ee(e,"height","20"),Ee(e,"class","svelte-en2qvf")},m(n,l){be(n,e,l),ie(e,t)},p:Mt,i:Mt,o:Mt,d(n){n&&ve(e)}}}class LE extends Ht{constructor(e){super(),Zt(this,e,null,AE,Ut,{})}}function PE(r){let e,t,n;return{c(){e=Ls("svg"),t=Ls("circle"),n=Ls("path"),Ee(t,"cx","4.789"),Ee(t,"cy","4.787"),Ee(t,"r","3.85"),Ee(t,"class","svelte-1aq105l"),Ee(n,"d","M12.063 12.063 7.635 7.635"),Ee(n,"class","svelte-1aq105l"),Ee(e,"xmlns","http://www.w3.org/2000/svg"),Ee(e,"width","13"),Ee(e,"height","13"),Ee(e,"viewBox","0 0 13 13"),Ee(e,"class","svelte-1aq105l")},m(l,u){be(l,e,u),ie(e,t),ie(e,n)},p:Mt,i:Mt,o:Mt,d(l){l&&ve(e)}}}class zE extends Ht{constructor(e){super(),Zt(this,e,null,PE,Ut,{})}}function DE(r,e,t){const n=e[1],l=e[0],u=n-l;return r===n&&t?r:((r-l)%u+u)%u+l}function H0(r){const e=[...r];return e[2]Math.abs((e[0]-360+e[2])/2)?e[0]-=360:e[2]+=360),e}let Uu;async function RE(r,e,t){const n=r==null?void 0:r.getCenterAndZoom();for(const l of e??[])if(!(n&&(l.minZoom!=null&&l.minZoom>n[0]||l.maxZoom!=null&&l.maxZoomDate.now()){if(!Uu.coords)break e;return Uu.coords}let u;try{return u=await new Promise((d,a)=>{t.signal.addEventListener("abort",()=>{a(Error("aborted"))}),navigator.geolocation.getCurrentPosition(_=>{d([_.coords.longitude,_.coords.latitude].map(x=>x.toFixed(6)).join(","))},_=>{a(_)},l)}),u}catch{}finally{l.cachedLocationExpiry&&(Uu={time:Date.now(),coords:u})}if(t.signal.aborted)return}if(l.type==="server-geolocation")return"ip";if(n&&l.type==="map-center")return n[1].toFixed(6)+","+n[2].toFixed(6)}}const BE=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(EAST|WEST|[EW])?$/i,$0=/^([+-]?[0-8]?[0-9])\s+([0-5]?[0-9]\.\d{3,})[\s,]{1,}([+-]?[0-1]?[0-9]?[0-9])\s+([0-5]?[0-9]\.\d{3,})$/,X0=/^(NORTH|SOUTH|[NS])?[\s]*([+-]?[0-8]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(NORTH|SOUTH|[NS])?[\s]*[,/;]?[\s]*(EAST|WEST|[EW])?[\s]*([+-]?[0-1]?[0-9]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(EAST|WEST|[EW])?$/i,K0=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(EAST|WEST|[EW])?$/i,J0=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)\s*(EAST|WEST|[EW])?$/i,Y0=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|’’|´´|["″”\.])?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|´´|’’|["″”\.])?\s*(EAST|WEST|[EW])?$/i;function FE(r){if(!["DMS","DM","DD"].includes(r))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){const e=this.decimalCoordinates.split(",").map(P=>Number(P.trim())),t=Number(e[0]),n=Number(e[1]),l=Math.abs(t),u=Math.abs(n),d=t>0?"N":"S",a=n>0?"E":"W";let _;r=="DD"&&(_=`${l}° ${d}, ${u}° ${a}`);const x=Math.floor(l),S=Math.floor(u),k=(l-x)*60,C=(u-S)*60;if(r=="DM"){let P=Q0(k,3).toFixed(3).padStart(6,"0"),D=Q0(C,3).toFixed(3).padStart(6,"0");P.endsWith(".000")&&D.endsWith(".000")&&(P=P.replace(/\.000$/,""),D=D.replace(/\.000$/,"")),_=`${x}° ${P}' ${d}, ${S}° ${D}' ${a}`}if(r=="DMS"){const P=Math.floor(k),D=Math.floor(C);let N=((k-P)*60).toFixed(1).padStart(4,"0"),z=((C-D)*60).toFixed(1).padStart(4,"0");const B=P.toString().padStart(2,"0"),O=D.toString().padStart(2,"0");N.endsWith(".0")&&z.endsWith(".0")&&(N=N.replace(/\.0$/,""),z=z.replace(/\.0$/,"")),_=`${x}° ${B}' ${N}" ${d}, ${S}° ${O}' ${z}" ${a}`}return _}else throw new Error("no decimal coordinates to convert")}function Q0(r,e){const t=Math.pow(10,e);return Math.round((r+Number.EPSILON)*t)/t}function Og(r,e){e||(e=5),r=r.replace(/\s+/g," ").trim();let t=null,n=null,l="",u="",d=null,a=[],_=!1;if(BE.test(r))throw new Error("invalid coordinate value");if($0.test(r))if(a=$0.exec(r),_=Vu(a),_)t=Math.abs(a[1])+a[2]/60,Number(a[1])<0&&(t*=-1),n=Math.abs(a[3])+a[4]/60,Number(a[3])<0&&(n*=-1),d="DM";else throw new Error("invalid coordinate format");else if(X0.test(r))if(a=X0.exec(r),_=Vu(a),_){if(t=a[2],n=a[6],t.includes(",")&&(t=t.replace(",",".")),n.includes(",")&&(n=n.replace(",",".")),d="DD",Number(Math.round(t))==Number(t))throw new Error("integer only coordinate provided");if(Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");a[1]?(l=a[1],u=a[5]):a[4]&&(l=a[4],u=a[8])}else throw new Error("invalid decimal coordinate format");else if(K0.test(r))if(a=K0.exec(r),_=Vu(a),_)t=Math.abs(parseInt(a[2])),a[4]&&(t+=a[4]/60,d="DM"),a[6]&&(t+=a[6].replace(",",".")/3600,d="DMS"),parseInt(a[2])<0&&(t=-1*t),n=Math.abs(parseInt(a[9])),a[11]&&(n+=a[11]/60),a[13]&&(n+=a[13].replace(",",".")/3600),parseInt(a[9])<0&&(n=-1*n),a[1]?(l=a[1],u=a[8]):a[7]&&(l=a[7],u=a[14]);else throw new Error("invalid DMS coordinates format");else if(J0.test(r))if(a=J0.exec(r),_=Vu(a),_)t=Math.abs(parseInt(a[2])),a[4]&&(t+=a[4]/60,d="DM"),a[6]&&(t+=a[6]/3600,d="DMS"),parseInt(a[2])<0&&(t=-1*t),n=Math.abs(parseInt(a[10])),a[12]&&(n+=a[12]/60),a[14]&&(n+=a[14]/3600),parseInt(a[10])<0&&(n=-1*n),a[1]?(l=a[1],u=a[9]):a[8]&&(l=a[8],u=a[16]);else throw new Error("invalid DMS coordinates format");else if(Y0.test(r)){if(a=Y0.exec(r),_=Vu(a),a.filter(x=>x).length<=5)throw new Error("invalid coordinates format");if(_)t=Math.abs(parseInt(a[2])),a[4]&&(t+=a[4].replace(",",".")/60,d="DM"),a[6]&&(t+=a[6].replace(",",".")/3600,d="DMS"),parseInt(a[2])<0&&(t=-1*t),n=Math.abs(parseInt(a[10])),a[12]&&(n+=a[12].replace(",",".")/60),a[14]&&(n+=a[14].replace(",",".")/3600),parseInt(a[10])<0&&(n=-1*n),a[1]?(l=a[1],u=a[9]):a[8]&&(l=a[8],u=a[16]);else throw new Error("invalid coordinates format")}if(_){if(Math.abs(n)>=180)throw new Error("invalid longitude value");if(Math.abs(t)>=90)throw new Error("invalid latitude value");if(l&&!u||!l&&u)throw new Error("invalid coordinates value");if(l&&l==u)throw new Error("invalid coordinates format");t.toString().includes(",")&&(t=t.replace(",",".")),n.toString().includes(",")&&(n=n.replace(",","."));let x=/S|SOUTH/i;x.test(l)&&t>0&&(t=-1*t),x=/W|WEST/i,x.test(u)&&n>0&&(n=-1*n);const S=a[0].trim();let k,C;const P=/[,/;\u0020]/g,D=S.match(P);if(D==null){const B=Math.floor(r.length/2);k=S.substring(0,B).trim(),C=S.substring(B).trim()}else{let B;D.length%2==1?B=Math.floor(D.length/2):B=D.length/2-1;let O=0;if(B==0)O=S.indexOf(D[0]),k=S.substring(0,O).trim(),C=S.substring(O+1).trim();else{let G=0,U=0;for(;G<=B;)O=S.indexOf(D[G],U),U=O+1,G++;k=S.substring(0,O).trim(),C=S.substring(O+1).trim()}}const N=k.split(".");if(N.length==2&&N[1]==0&&N[1].length!=2)throw new Error("invalid coordinates format");const z=C.split(".");if(z.length==2&&z[1]==0&&z[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(k)||/^\d+$/.test(C))throw new Error("degree only coordinate/s provided");return t=Number(Number(t).toFixed(e)),n=Number(Number(n).toFixed(e)),Object.freeze({verbatimCoordinates:S,verbatimLatitude:k,verbatimLongitude:C,decimalLatitude:t,decimalLongitude:n,decimalCoordinates:`${t},${n}`,originalFormat:d,closeEnough:OE,toCoordinateFormat:FE})}else throw new Error("coordinates pattern match failed")}function Vu(r){if(!isNaN(r[0]))return!1;const e=[...r];if(e.shift(),e.length%2>0)return!1;const t=/^[-+]?\d+([\.,]\d+)?$/,n=/[eastsouthnorthwest]+/i,l=e.length/2;for(let u=0;u{e.decimalLatitude?r.push(e):r.push({...e,...UE})}),[...r,...VE,...qE]}const WE=GE();Og.formats=WE.map(r=>r.verbatimCoordinates);const ZE=Og;function t1(r,e,t){const n=r.slice();return n[84]=e[t],n[86]=t,n}function r1(r){let e,t;return e=new IE({}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function n1(r){let e,t,n,l,u;return t=new LE({}),{c(){e=fe("button"),je(t.$$.fragment),Ee(e,"type","button"),Ee(e,"title",r[9]),Ee(e,"class","svelte-bz0zu3"),hi(e,"active",r[0])},m(d,a){be(d,e,a),Oe(t,e,null),n=!0,l||(u=Tt(e,"click",r[69]),l=!0)},p(d,a){(!n||a[0]&512)&&Ee(e,"title",d[9]),(!n||a[0]&1)&&hi(e,"active",d[0])},i(d){n||(oe(t.$$.fragment,d),n=!0)},o(d){de(t.$$.fragment,d),n=!1},d(d){d&&ve(e),Ne(t),l=!1,u()}}}function HE(r){let e,t=[],n=new Map,l,u,d,a=Jn(r[14]);const _=x=>x[84].id+(x[84].address?","+x[84].address:"");for(let x=0;x{X=null}),vr()),(!G||ft[0]&2)&&hi(x,"displayable",Me[1]!==""),Me[5]==="button"?Y?(Y.p(Me,ft),ft[0]&32&&oe(Y,1)):(Y=n1(Me),Y.c(),oe(Y,1),Y.m(n,D)):Y&&(yr(),de(Y,1,1,()=>{Y=null}),vr()),ze&&ze.p&&(!G||ft[1]&536870912)&&Gr(ze,_e,Me,Me[60],G?qr(_e,Me[60],ft,null):Wr(Me[60]),null);let Ct=z;z=Ze(Me),z===Ct?~z&&ce[z].p(Me,ft):(B&&(yr(),de(ce[Ct],1,1,()=>{ce[Ct]=null}),vr()),~z?(B=ce[z],B?B.p(Me,ft):(B=ce[z]=re[z](Me),B.c()),oe(B,1),B.m(t,null)):B=null),(!G||ft[0]&4&&O!==(O=od(Me[2])+" svelte-bz0zu3"))&&Ee(t,"class",O),(!G||ft[0]&22)&&hi(t,"can-collapse",Me[4]&&Me[1]==="")},i(Me){G||(oe(me),oe(u.$$.fragment,Me),oe(k.$$.fragment,Me),oe(X),oe(Y),oe(ze,Me),oe(B),G=!0)},o(Me){de(me),de(u.$$.fragment,Me),de(k.$$.fragment,Me),de(X),de(Y),de(ze,Me),de(B),G=!1},d(Me){Me&&(ve(e),ve(t)),Ne(u),r[63](null),Ne(k),X&&X.d(),Y&&Y.d(),ze&&ze.d(Me),~z&&ce[z].d(),U=!1,_n(K)}}}function YE(r,e,t){let n,l,{$$slots:u={},$$scope:d}=e;const a={continental_marine:4,country:4,major_landform:8,region:5,subregion:6,county:7,joint_municipality:8,joint_submunicipality:9,municipality:10,municipal_district:11,locality:12,neighbourhood:13,place:14,postal_code:14,road:16,poi:17,address:18,"poi.peak":15,"poi.shop":18,"poi.cafe":18,"poi.restaurant":18,"poi.aerodrome":13};let{class:_=void 0}=e,{apiKey:x}=e,{bbox:S=void 0}=e,{clearButtonTitle:k="clear"}=e,{clearOnBlur:C=!1}=e,{collapsed:P=!1}=e,{country:D=void 0}=e,{debounceSearch:N=200}=e,{enableReverse:z="never"}=e,{errorMessage:B="Something went wrong…"}=e,{filter:O=()=>!0}=e,{flyTo:G=!0}=e,{fuzzyMatch:U=!0}=e,{language:K=void 0}=e,{limit:me=void 0}=e,{mapController:X=void 0}=e,{minLength:Y=2}=e,{noResultsMessage:_e="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=e,{placeholder:ze="Search"}=e,{proximity:re=[{type:"server-geolocation"}]}=e,{reverseActive:ce=z==="always"}=e,{reverseButtonTitle:Ze="toggle reverse geocoding"}=e,{searchValue:Me=""}=e,{pickedResultStyle:ft="full-geometry"}=e,{showPlaceType:Ct="if-needed"}=e,{showResultsWhileTyping:Ot=!0}=e,{selectFirst:Ke=!0}=e,{flyToSelected:Kt=!1}=e,{markerOnSelected:vt=!0}=e,{types:At=void 0}=e,{exhaustiveReverseGeocoding:Vt=!1}=e,{excludeTypes:sr=!1}=e,{zoom:fr=a}=e,{apiUrl:er="https://api.maptiler.com/geocoding"}=e,{fetchParameters:Nt={}}=e,{iconsBaseUrl:nr="https://cdn.maptiler.com/maptiler-geocoding-control/v2.0.1/icons/"}=e,{adjustUrlQuery:tr=()=>{}}=e;function Lr(){We.focus()}function Pr(){We.blur()}function st(W,Be=!0,Fe=!1){t(1,Me=W),Be?(t(15,Ye=-1),ct()):(Jt(!Fe,Fe),setTimeout(()=>{We.focus(),We.select()}))}function Lt(){t(14,tt=void 0),t(56,ne=void 0),t(15,Ye=-1)}function De(){t(55,it=[]),t(56,ne=void 0)}let at=!1,tt,it,ne,br="",We,Ye=-1,jt,bn=[],wn,Mn,ni,ii;const $o=new Set,Jr=us();ti(()=>{X&&(X.setEventHandler(void 0),X.indicateReverse(!1),X.setSelectedMarker(-1),X.setFeatures(void 0,void 0,!1))});function ct(W){if(Mn&&(clearTimeout(Mn),Mn=void 0),Ye>-1&&tt)t(56,ne=tt[Ye]),t(1,Me=ne.place_type[0]==="reverse"?ne.place_name:ne.place_name.replace(/,.*/,"")),t(18,jt=void 0),t(55,it=void 0),t(15,Ye=-1);else if(Me){const Be=W||!Xn(Me);xn(Me,{exact:!0}).then(()=>{t(55,it=tt),t(56,ne=void 0),Be&&Bo()}).catch(Fe=>t(18,jt=Fe))}}function Xn(W){try{return ZE(W,6)}catch{return!1}}async function xn(W,{byId:Be=!1,exact:Fe=!1}={}){t(18,jt=void 0),wn==null||wn.abort();const qe=new AbortController;t(19,wn=qe);try{const Xe=Xn(W),ut=new URLSearchParams;if(K!==void 0&&ut.set("language",Array.isArray(K)?K.join(","):K??""),At&&ut.set("types",At.join(",")),sr&&ut.set("excludeTypes",String(sr)),S&&ut.set("bbox",S.map(gr=>gr.toFixed(6)).join(",")),D&&ut.set("country",Array.isArray(D)?D.join(","):D),!Be&&!Xe){const gr=await RE(X,re,qe);gr&&ut.set("proximity",gr),(Fe||!Ot)&&ut.set("autocomplete","false"),ut.set("fuzzyMatch",String(U))}me!==void 0&&(Vt||!Xe||(At==null?void 0:At.length)===1)&&ut.set("limit",String(me)),ut.set("key",x),tr(ut);const Pt=er+"/"+encodeURIComponent(Xe?Xe.decimalLongitude+","+Xe.decimalLatitude:W)+".json?"+ut.toString();if(Pt===br){Be?(t(14,tt=void 0),t(56,ne=bn[0])):t(14,tt=bn);return}br=Pt;const $t=await fetch(Pt,{signal:qe.signal,...Nt});if(!$t.ok)throw new Error(await $t.text());const ar=await $t.json();Jr("response",{url:Pt,featureCollection:ar}),Be?(t(14,tt=void 0),t(56,ne=ar.features[0]),bn=[ne]):(t(14,tt=ar.features.filter(O)),Xe&&tt.unshift({type:"Feature",properties:{},id:"reverse_"+Xe.decimalLongitude+"_"+Xe.decimalLatitude,text:Xe.decimalLatitude+", "+Xe.decimalLongitude,place_name:Xe.decimalLatitude+", "+Xe.decimalLongitude,place_type:["reverse"],center:[Xe.decimalLongitude,Xe.decimalLatitude],bbox:[Xe.decimalLongitude,Xe.decimalLatitude,Xe.decimalLongitude,Xe.decimalLatitude],geometry:{type:"Point",coordinates:[Xe.decimalLongitude,Xe.decimalLatitude]}}),bn=tt,Xe&&We.focus())}catch(Xe){if(Xe&&typeof Xe=="object"&&"name"in Xe&&Xe.name==="AbortError")return;throw Xe}finally{qe===wn&&t(19,wn=void 0)}}function Bo(){var qe;if(!(it!=null&&it.length)||!G)return;const W=[180,90,-180,-90],Be=!it.some(Xe=>!Xe.matching_text);let Fe;for(const Xe of it){const ut=Or(Xe);if(Fe=Fe===void 0?ut:ut===void 0?Fe:Math.max(Fe,ut),Be||!Xe.matching_text)for(const Pt of[0,1,2,3])W[Pt]=Math[Pt<2?"min":"max"](W[Pt],((qe=Xe.bbox)==null?void 0:qe[Pt])??Xe.center[Pt%2])}X&&it.length>0&&(ne&&W[0]===W[2]&&W[1]===W[3]?X.flyTo(ne.center,Or(ne)):X.fitBounds(H0(W),50,Fe))}function Or(W){var Fe;if(!W.bbox||W.bbox[0]!==W.bbox[2]&&W.bbox[1]!==W.bbox[3])return;const Be=W.id.replace(/\..*/,"");return(Array.isArray((Fe=W.properties)==null?void 0:Fe.categories)?W.properties.categories.reduce((qe,Xe)=>{const ut=fr[Be+"."+Xe];return qe===void 0?ut:ut===void 0?qe:Math.max(qe,ut)},void 0):void 0)??fr[Be]}function mt(W){t(0,ce=z==="always"),t(14,tt=void 0),t(56,ne=void 0),t(15,Ye=-1),st(W[1].toFixed(6)+", "+DE(W[0],[-180,180],!0).toFixed(6),!1,!0)}function rr(W){if(!tt)return;let Be=W.key==="ArrowDown"?1:W.key==="ArrowUp"?-1:0;Be&&(Ye===(Ke?0:-1)&&Be===-1&&t(15,Ye=tt.length),t(15,Ye+=Be),Ye>=tt.length&&t(15,Ye=-1),Ye<0&&Ke&&t(15,Ye=0),W.preventDefault())}function Jt(W=!0,Be=!1){if(t(18,jt=void 0),Ot||Be){if(Mn&&clearTimeout(Mn),Me.length{xn(Fe).catch(qe=>t(18,jt=qe))},W?N:0)}else t(14,tt=void 0),t(18,jt=void 0)}function Nr(W){t(56,ne=W),t(1,Me=W.place_name),t(15,Ye=-1)}const vi=()=>We.focus();function Qt(W){pn[W?"unshift":"push"](()=>{We=W,t(17,We)})}function ro(){Me=this.value,t(1,Me),t(13,at),t(28,C)}const an=()=>t(13,at=!0),pe=()=>t(13,at=!1),Z=()=>Jt(),$=()=>{t(1,Me=""),We.focus()},te=()=>t(0,ce=!ce),le=()=>t(18,jt=void 0),Ce=W=>t(15,Ye=W),Ie=W=>Nr(W),Pe=()=>{Ke||t(15,Ye=-1)},Se=()=>{};return r.$$set=W=>{"class"in W&&t(2,_=W.class),"apiKey"in W&&t(26,x=W.apiKey),"bbox"in W&&t(27,S=W.bbox),"clearButtonTitle"in W&&t(3,k=W.clearButtonTitle),"clearOnBlur"in W&&t(28,C=W.clearOnBlur),"collapsed"in W&&t(4,P=W.collapsed),"country"in W&&t(29,D=W.country),"debounceSearch"in W&&t(30,N=W.debounceSearch),"enableReverse"in W&&t(5,z=W.enableReverse),"errorMessage"in W&&t(6,B=W.errorMessage),"filter"in W&&t(31,O=W.filter),"flyTo"in W&&t(32,G=W.flyTo),"fuzzyMatch"in W&&t(33,U=W.fuzzyMatch),"language"in W&&t(34,K=W.language),"limit"in W&&t(35,me=W.limit),"mapController"in W&&t(36,X=W.mapController),"minLength"in W&&t(37,Y=W.minLength),"noResultsMessage"in W&&t(7,_e=W.noResultsMessage),"placeholder"in W&&t(8,ze=W.placeholder),"proximity"in W&&t(38,re=W.proximity),"reverseActive"in W&&t(0,ce=W.reverseActive),"reverseButtonTitle"in W&&t(9,Ze=W.reverseButtonTitle),"searchValue"in W&&t(1,Me=W.searchValue),"pickedResultStyle"in W&&t(39,ft=W.pickedResultStyle),"showPlaceType"in W&&t(10,Ct=W.showPlaceType),"showResultsWhileTyping"in W&&t(40,Ot=W.showResultsWhileTyping),"selectFirst"in W&&t(11,Ke=W.selectFirst),"flyToSelected"in W&&t(41,Kt=W.flyToSelected),"markerOnSelected"in W&&t(42,vt=W.markerOnSelected),"types"in W&&t(43,At=W.types),"exhaustiveReverseGeocoding"in W&&t(44,Vt=W.exhaustiveReverseGeocoding),"excludeTypes"in W&&t(45,sr=W.excludeTypes),"zoom"in W&&t(46,fr=W.zoom),"apiUrl"in W&&t(47,er=W.apiUrl),"fetchParameters"in W&&t(48,Nt=W.fetchParameters),"iconsBaseUrl"in W&&t(12,nr=W.iconsBaseUrl),"adjustUrlQuery"in W&&t(49,tr=W.adjustUrlQuery),"$$scope"in W&&t(60,d=W.$$scope)},r.$$.update=()=>{if(r.$$.dirty[0]&32&&t(0,ce=z==="always"),r.$$.dirty[0]&268443648&&setTimeout(()=>{t(16,ni=at),C&&!at&&t(1,Me="")}),r.$$.dirty[0]&16386|r.$$.dirty[1]&64&&Me.lengtht(18,jt=W)),r.$$.dirty[1]&100663330&&(X&&ne&&ne.id!==ii&&G&&(!ne.bbox||ne.bbox[0]===ne.bbox[2]&&ne.bbox[1]===ne.bbox[3]?X.flyTo(ne.center,Or(ne)):X.fitBounds(H0(ne.bbox),50,Or(ne)),t(14,tt=void 0),t(55,it=void 0),t(15,Ye=-1)),t(57,ii=ne==null?void 0:ne.id)),r.$$.dirty[0]&18432&&Ke&&tt!=null&&tt.length&&t(15,Ye=0),r.$$.dirty[0]&2&&t(15,Ye=-1),r.$$.dirty[0]&16384|r.$$.dirty[1]&16777216&&it!==tt&&t(55,it=void 0),r.$$.dirty[0]&81921|r.$$.dirty[1]&16777248&&X&&X.setEventHandler(W=>{switch(W.type){case"mapClick":ce&&mt(W.coordinates);break;case"markerClick":{const Be=tt==null?void 0:tt.find(Fe=>Fe.id===W.id);Be&&Nr(Be)}break;case"markerMouseEnter":it&&t(15,Ye=ni?(tt==null?void 0:tt.findIndex(Be=>Be.id===W.id))??-1:-1);break;case"markerMouseLeave":it&&t(15,Ye=-1);break}}),r.$$.dirty[0]&49152&&t(58,l=tt==null?void 0:tt[Ye]),r.$$.dirty[1]&134218786&&X&&l&&G&&Kt&&X.flyTo(l.center,Or(l)),r.$$.dirty[1]&256&&t(59,n=ft==="full-geometry-including-polygon-center-marker"),r.$$.dirty[1]&268437536&&(vt||X==null||X.setFeatures(void 0,void 0,n)),r.$$.dirty[1]&419432480&&X&&vt&&!it&&(X.setFeatures(l?[l]:void 0,void 0,n),X.setSelectedMarker(l?0:-1)),r.$$.dirty[1]&318767136&&X&&X.setFeatures(it,ne,n),r.$$.dirty[0]&32768|r.$$.dirty[1]&16777248&&it&&X&&X.setSelectedMarker(Ye),r.$$.dirty[0]&2|r.$$.dirty[1]&32&&X){const W=Xn(Me);X.setReverseMarker(W?[W.decimalLongitude,W.decimalLatitude]:void 0)}r.$$.dirty[1]&134217728&&Jr("select",{feature:l}),r.$$.dirty[1]&33554432&&Jr("pick",{feature:ne}),r.$$.dirty[0]&81920&&Jr("optionsvisibilitychange",{optionsVisible:ni&&!!tt}),r.$$.dirty[0]&16384&&Jr("featureslisted",{features:tt}),r.$$.dirty[1]&16777216&&Jr("featuresmarked",{features:it}),r.$$.dirty[0]&1&&Jr("reversetoggle",{reverse:ce}),r.$$.dirty[0]&2&&Jr("querychange",{query:Me}),r.$$.dirty[0]&1|r.$$.dirty[1]&32&&X&&X.indicateReverse(ce)},[ce,Me,_,k,P,z,B,_e,ze,Ze,Ct,Ke,nr,at,tt,Ye,ni,We,jt,wn,$o,ct,rr,Jt,Nr,a,x,S,C,D,N,O,G,U,K,me,X,Y,re,ft,Ot,Kt,vt,At,Vt,sr,fr,er,Nt,tr,Lr,Pr,st,Lt,De,it,ne,ii,l,n,d,u,vi,Qt,ro,an,pe,Z,$,te,le,Ce,Ie,Pe,Se]}class QE extends Ht{constructor(e){super(),Zt(this,e,YE,JE,Ut,{ZOOM_DEFAULTS:25,class:2,apiKey:26,bbox:27,clearButtonTitle:3,clearOnBlur:28,collapsed:4,country:29,debounceSearch:30,enableReverse:5,errorMessage:6,filter:31,flyTo:32,fuzzyMatch:33,language:34,limit:35,mapController:36,minLength:37,noResultsMessage:7,placeholder:8,proximity:38,reverseActive:0,reverseButtonTitle:9,searchValue:1,pickedResultStyle:39,showPlaceType:10,showResultsWhileTyping:40,selectFirst:11,flyToSelected:41,markerOnSelected:42,types:43,exhaustiveReverseGeocoding:44,excludeTypes:45,zoom:46,apiUrl:47,fetchParameters:48,iconsBaseUrl:12,adjustUrlQuery:49,focus:50,blur:51,setQuery:52,clearList:53,clearMap:54},null,[-1,-1,-1])}get ZOOM_DEFAULTS(){return this.$$.ctx[25]}get focus(){return this.$$.ctx[50]}get blur(){return this.$$.ctx[51]}get setQuery(){return this.$$.ctx[52]}get clearList(){return this.$$.ctx[53]}get clearMap(){return this.$$.ctx[54]}}function o1(r){let e,t,n;return t=new QE({props:{mapController:r[1],apiKey:r[0],proximity:[{type:"map-center"}]}}),{c(){e=fe("div"),je(t.$$.fragment),Ee(e,"class","svelte-ixhnie")},m(l,u){be(l,e,u),Oe(t,e,null),n=!0},p(l,u){const d={};u&2&&(d.mapController=l[1]),u&1&&(d.apiKey=l[0]),t.$set(d)},i(l){n||(oe(t.$$.fragment,l),n=!0)},o(l){de(t.$$.fragment,l),n=!1},d(l){l&&ve(e),Ne(t)}}}function e5(r){let e,t,n=r[1]&&o1(r);return{c(){n&&n.c(),e=$n()},m(l,u){n&&n.m(l,u),be(l,e,u),t=!0},p(l,[u]){l[1]?n?(n.p(l,u),u&2&&oe(n,1)):(n=o1(l),n.c(),oe(n,1),n.m(e.parentNode,e)):n&&(yr(),de(n,1,1,()=>{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function t5(r,e,t){let n,{apiKey:l}=e,{map:u}=e;function d(a){return a?bw(a,to,!0,!0,{duration:1e3},{duration:1e3}):null}return r.$$set=a=>{"apiKey"in a&&t(0,l=a.apiKey),"map"in a&&t(2,u=a.map)},r.$$.update=()=>{r.$$.dirty&4&&t(1,n=d(u))},[l,n,u]}class r5 extends Ht{constructor(e){super(),Zt(this,e,t5,e5,Ut,{apiKey:0,map:2})}}const n5=["==",["geometry-type"],"Polygon"],i5=["==",["geometry-type"],"LineString"];function o5(r,e,t){let n=["match",r];for(let[l,u]of Object.entries(e))n.push(l),n.push(u);return n.push(t),n}function Xf(){return{type:"FeatureCollection",features:[]}}const s5=r=>({}),s1=r=>({}),a5=r=>({}),a1=r=>({}),l5=r=>({}),l1=r=>({});function c5(r){let e,t,n,l,u,d;const a=r[1].top,_=Vr(a,r,r[0],l1),x=r[1].left,S=Vr(x,r,r[0],a1),k=r[1].main,C=Vr(k,r,r[0],s1);return{c(){e=fe("div"),_&&_.c(),t=Ve(),n=fe("div"),S&&S.c(),l=Ve(),u=fe("div"),C&&C.c(),Ee(e,"class","top svelte-mpick2"),Ee(n,"class","left svelte-mpick2"),Ee(u,"class","main svelte-mpick2")},m(P,D){be(P,e,D),_&&_.m(e,null),be(P,t,D),be(P,n,D),S&&S.m(n,null),be(P,l,D),be(P,u,D),C&&C.m(u,null),d=!0},p(P,[D]){_&&_.p&&(!d||D&1)&&Gr(_,a,P,P[0],d?qr(a,P[0],D,l5):Wr(P[0]),l1),S&&S.p&&(!d||D&1)&&Gr(S,x,P,P[0],d?qr(x,P[0],D,a5):Wr(P[0]),a1),C&&C.p&&(!d||D&1)&&Gr(C,k,P,P[0],d?qr(k,P[0],D,s5):Wr(P[0]),s1)},i(P){d||(oe(_,P),oe(S,P),oe(C,P),d=!0)},o(P){de(_,P),de(S,P),de(C,P),d=!1},d(P){P&&(ve(e),ve(t),ve(n),ve(l),ve(u)),_&&_.d(P),S&&S.d(P),C&&C.d(P)}}}function u5(r,e,t){let{$$slots:n={},$$scope:l}=e;return r.$$set=u=>{"$$scope"in u&&t(0,l=u.$$scope)},[l,n]}class h5 extends Ht{constructor(e){super(),Zt(this,e,u5,c5,Ut,{})}}const f5=r=>({}),c1=r=>({}),d5=r=>({}),u1=r=>({}),p5=r=>({}),h1=r=>({});function m5(r){let e,t,n,l,u,d;const a=r[4].top,_=Vr(a,r,r[3],h1),x=r[4].sidebar,S=Vr(x,r,r[3],u1),k=r[4].map,C=Vr(k,r,r[3],c1);return{c(){e=fe("div"),_&&_.c(),t=Ve(),n=fe("div"),S&&S.c(),l=Ve(),u=fe("div"),C&&C.c()},m(P,D){be(P,e,D),_&&_.m(e,null),r[5](e),be(P,t,D),be(P,n,D),S&&S.m(n,null),r[6](n),be(P,l,D),be(P,u,D),C&&C.m(u,null),r[7](u),d=!0},p(P,[D]){_&&_.p&&(!d||D&8)&&Gr(_,a,P,P[3],d?qr(a,P[3],D,p5):Wr(P[3]),h1),S&&S.p&&(!d||D&8)&&Gr(S,x,P,P[3],d?qr(x,P[3],D,d5):Wr(P[3]),u1),C&&C.p&&(!d||D&8)&&Gr(C,k,P,P[3],d?qr(k,P[3],D,f5):Wr(P[3]),c1)},i(P){d||(oe(_,P),oe(S,P),oe(C,P),d=!0)},o(P){de(_,P),de(S,P),de(C,P),d=!1},d(P){P&&(ve(e),ve(t),ve(n),ve(l),ve(u)),_&&_.d(P),r[5](null),S&&S.d(P),r[6](null),C&&C.d(P),r[7](null)}}}function g5(r,e,t){let n,l,u;wt(r,Hm,k=>t(0,n=k)),wt(r,$m,k=>t(1,l=k)),wt(r,Xm,k=>t(2,u=k));let{$$slots:d={},$$scope:a}=e;function _(k){pn[k?"unshift":"push"](()=>{n=k,Hm.set(n)})}function x(k){pn[k?"unshift":"push"](()=>{l=k,$m.set(l)})}function S(k){pn[k?"unshift":"push"](()=>{u=k,Xm.set(u)})}return r.$$set=k=>{"$$scope"in k&&t(3,a=k.$$scope)},[n,l,u,a,d,_,x,S]}class Fs extends Ht{constructor(e){super(),Zt(this,e,g5,m5,Ut,{})}}let Hm=Tr(null),$m=Tr(null),Xm=Tr(null);function _5(r){let e,t,n,l,u,d,a,_,x;return{c(){e=fe("label"),t=rt(`Basemap: + `),n=fe("select"),l=fe("option"),l.textContent="MapTiler Dataviz",u=fe("option"),u.textContent="MapTiler Streets",d=fe("option"),d.textContent="MapTiler Satellite",a=fe("option"),a.textContent="OS Open Zoomstack",l.__value="dataviz",ei(l,l.__value),u.__value="streets-v2",ei(u,u.__value),d.__value="hybrid",ei(d,d.__value),a.__value="uk-openzoomstack-light",ei(a,a.__value),r[0]===void 0&&uh(()=>r[1].call(n))},m(S,k){be(S,e,k),ie(e,t),ie(e,n),ie(n,l),ie(n,u),ie(n,d),ie(n,a),sd(n,r[0],!0),_||(x=Tt(n,"change",r[1]),_=!0)},p(S,[k]){k&1&&sd(n,S[0])},i:Mt,o:Mt,d(S){S&&ve(e),_=!1,x()}}}function y5(r,e,t){let n;wt(r,Rm,u=>t(0,n=u));function l(){n=Cb(this),Rm.set(n)}return[n,l]}class v5 extends Ht{constructor(e){super(),Zt(this,e,y5,_5,Ut,{})}}let Kf=Tr(!0);function b5(r){let e,t;return e=new ma({props:{paint:{"fill-color":"black","fill-opacity":0},layout:{visibility:r[0]?"none":"visible"}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&1&&(u.layout={visibility:n[0]?"none":"visible"}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function w5(r){let e,t;return e=new Pi({props:{data:r[1],$$slots:{default:[b5]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,[l]){const u={};l&5&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function x5(r,e,t){let n;return wt(r,Kf,u=>t(0,n=u)),[n,{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]}}]}class S5 extends Ht{constructor(e){super(),Zt(this,e,x5,w5,Ut,{})}}const k5="/ltn/assets/help-d011708a.svg";function f1(r){let e,t;return e=new Pd({props:{$$slots:{default:[T5]},$$scope:{ctx:r}}}),e.$on("close",r[3]),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&16&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function T5(r){let e,t,n;const l=r[1].default,u=Vr(l,r,r[4],null);return{c(){e=fe("h2"),e.textContent="Help",t=Ve(),u&&u.c()},m(d,a){be(d,e,a),be(d,t,a),u&&u.m(d,a),n=!0},p(d,a){u&&u.p&&(!n||a&16)&&Gr(u,l,d,d[4],n?qr(l,d[4],a,null):Wr(d[4]),null)},i(d){n||(oe(u,d),n=!0)},o(d){de(u,d),n=!1},d(d){d&&(ve(e),ve(t)),u&&u.d(d)}}}function E5(r){let e,t,n,l,u,d,a=r[0]&&f1(r);return{c(){e=fe("button"),e.innerHTML=`Help`,t=Ve(),a&&a.c(),n=$n(),Ee(e,"class","svelte-gb6dzm")},m(_,x){be(_,e,x),be(_,t,x),a&&a.m(_,x),be(_,n,x),l=!0,u||(d=Tt(e,"click",r[2]),u=!0)},p(_,[x]){_[0]?a?(a.p(_,x),x&1&&oe(a,1)):(a=f1(_),a.c(),oe(a,1),a.m(n.parentNode,n)):a&&(yr(),de(a,1,1,()=>{a=null}),vr())},i(_){l||(oe(a),l=!0)},o(_){de(a),l=!1},d(_){_&&(ve(e),ve(t),ve(n)),a&&a.d(_),u=!1,d()}}}function M5(r,e,t){let{$$slots:n={},$$scope:l}=e,u=!1;const d=()=>t(0,u=!0),a=()=>t(0,u=!1);return r.$$set=_=>{"$$scope"in _&&t(4,l=_.$$scope)},[u,n,d,a,l]}class Ng extends Ht{constructor(e){super(),Zt(this,e,M5,E5,Ut,{})}}function C5(r){let e,t,n,l;const u=r[1].default,d=Vr(u,r,r[0],null);return{c(){e=fe("a"),d&&d.c(),Ee(e,"href","#")},m(a,_){be(a,e,_),d&&d.m(e,null),t=!0,n||(l=Tt(e,"click",bg(r[2])),n=!0)},p(a,[_]){d&&d.p&&(!t||_&1)&&Gr(d,u,a,a[0],t?qr(u,a[0],_,null):Wr(a[0]),null)},i(a){t||(oe(d,a),t=!0)},o(a){de(d,a),t=!1},d(a){a&&ve(e),d&&d.d(a),n=!1,l()}}}function I5(r,e,t){let{$$slots:n={},$$scope:l}=e;function u(d){ur.call(this,r,d)}return r.$$set=d=>{"$$scope"in d&&t(0,l=d.$$scope)},[l,n,u]}class Zr extends Ht{constructor(e){super(),Zt(this,e,I5,C5,Ut,{})}}const A5=r=>({props:r&8}),d1=r=>({props:z5(r[3])});function L5(r){let e;const t=r[1].default,n=Vr(t,r,r[2],d1);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&12)&&Gr(n,t,l,l[2],e?qr(t,l[2],u,A5):Wr(l[2]),d1)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function P5(r){let e,t;return e=new c3({props:{openOn:r[0],popupClass:"popup",$$slots:{default:[L5,({features:n})=>({3:n}),({features:n})=>n?8:0]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,[l]){const u={};l&1&&(u.openOn=n[0]),l&12&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function z5(r){return r?r[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function D5(r,e,t){let{$$slots:n={},$$scope:l}=e,{openOn:u="hover"}=e;return r.$$set=d=>{"openOn"in d&&t(0,u=d.openOn),"$$scope"in d&&t(2,l=d.$$scope)},[u,n,l]}class Os extends Ht{constructor(e){super(),Zt(this,e,D5,P5,Ut,{openOn:0})}}function R5(r,e){let t=new Set(r.getStyle().layers.filter(n=>n.type=="line").map(n=>n.id));return e=="dataviz"?["Road network","Path"].filter(n=>t.has(n)):e=="hybrid"?["Path","Road","Tunnel"].filter(n=>t.has(n)):e=="streets-v2"?r.getStyle().layers.filter(n=>n["source-layer"]=="transportation"&&n.type=="line").map(n=>n.id):e=="uk-openzoomstack-light"?r.getStyle().layers.filter(n=>n["source-layer"]=="roads"&&n.type=="line").map(n=>n.id):[]}const{window:B5}=Ad;function F5(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D,N;return P=Mb(r[8][0]),{c(){e=fe("button"),e.textContent="Stop StreetView",t=Ve(),n=fe("fieldset"),l=fe("legend"),l.textContent="Source:",u=Ve(),d=fe("label"),a=fe("input"),_=rt(` Google Street View`),x=Ve(),S=fe("label"),k=fe("input"),C=rt(` - Bing Streetside`),Ee(e,"class","secondary"),Ee(a,"type","radio"),a.__value="google",ei(a,a.__value),Ee(k,"type","radio"),k.__value="bing",ei(k,k.__value),P.p(a,k)},m(z,B){be(z,e,B),be(z,t,B),be(z,n,B),ie(n,l),ie(n,u),ie(n,d),ie(d,a),a.checked=a.__value===r[0],ie(d,_),ie(n,x),ie(n,S),ie(S,k),k.checked=k.__value===r[0],ie(S,C),D||(N=[Tt(e,"click",r[3]),Tt(a,"change",r[7]),Tt(k,"change",r[9])],D=!0)},p(z,B){B&1&&(a.checked=a.__value===z[0]),B&1&&(k.checked=k.__value===z[0])},d(z){z&&(ve(e),ve(t),ve(n)),P.r(),D=!1,_n(N)}}}function F5(r){let e,t,n;return{c(){e=fe("button"),e.textContent="StreetView",Ee(e,"class","secondary")},m(l,u){be(l,e,u),t||(n=Tt(e,"click",r[2]),t=!0)},p:Mt,d(l){l&&ve(e),t=!1,n()}}}function O5(r){let e,t,n;function l(a,_){return a[1]?F5:B5}let u=l(r),d=u(r);return{c(){d.c(),e=$n()},m(a,_){d.m(a,_),be(a,e,_),t||(n=Tt(R5,"keydown",r[4]),t=!0)},p(a,[_]){u===(u=l(a))&&d?d.p(a,_):(d.d(1),d=u(a),d&&(d.c(),d.m(e.parentNode,e)))},i:Mt,o:Mt,d(a){a&&ve(e),d.d(a),t=!1,n()}}}function N5(r,e,t){let n;wt(r,Kf,N=>t(1,n=N));let{map:l}=e,{maptilerBasemap:u}=e,d="google",a=[];function _(){Rt(Kf,n=!1,n),l.on("click",S),l.getCanvas().style.cursor="crosshair";for(let N of D5(l,u))a.push([N,l.getPaintProperty(N,"line-color")]),l.setPaintProperty(N,"line-color","cyan")}function x(){Rt(Kf,n=!0,n),l.off("click",S),l.getCanvas().style.cursor="inherit";for(let[N,z]of a)l.setPaintProperty(N,"line-color",z);a=[]}ti(x);function S(N){let z=N.lngLat.lng,B=N.lngLat.lat;d=="google"?window.open(`http://maps.google.com/maps?q=&layer=c&cbll=${B},${z}&cbp=11,0,0,0,0`,"_blank"):d=="bing"&&window.open(`https://www.bing.com/maps?cp=${B}~${z}&style=x`,"_blank")}function k(N){!n&&N.key=="Escape"&&(N.stopPropagation(),x())}const C=[[]];function P(){d=this.__value,t(0,d)}function D(){d=this.__value,t(0,d)}return r.$$set=N=>{"map"in N&&t(5,l=N.map),"maptilerBasemap"in N&&t(6,u=N.maptilerBasemap)},[d,n,_,x,k,l,u,P,C,D]}class j5 extends Ht{constructor(e){super(),Zt(this,e,N5,O5,Ut,{map:5,maptilerBasemap:6})}}function Hn(r){return{id:r,beforeId:U5(r)}}function U5(r){let e=Hi(ls);if(!e){console.warn(`getBeforeId(${r}) called before map is ready. Z-ordering may be incorrect.`);return}let t,n=!1;for(let l=d1.length-1;l>=0;l--){let u=d1[l];if(u==r){n=!0;break}e.getLayer(u)&&(t=u)}if(!n)throw new Error(`Layer ID ${r} not defined in layerZorder`);return t}let im=r=>r,om=r=>r;const d1=[im(om("Background")),"neighbourhood-boundaries",im("Ferry line"),"debug-borders","debug-crosses","debug-filters","cells","interior-roads-outlines","interior-roads","compare-route","shortcuts","shortcuts-focus",om("Building"),"draw-area-lines","draw-area-preview","one-ways",om("Road labels"),im("road_label"),"animate-shortcuts","modal-filters","boundary","neighbourhood-boundary","auto-boundaries-areas","auto-boundaries-severances","freehand-line","edit-polygon-fill","edit-polygon-lines","edit-polygon-vertices"];function V5(r){let e;return{c(){e=rt("Back")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function q5(r){let e,t,n,l;return e=new Zr({props:{$$slots:{default:[V5]},$$scope:{ctx:r}}}),e.$on("click",r[2]),{c(){je(e.$$.fragment)},m(u,d){Oe(e,u,d),t=!0,n||(l=Tt(window,"keydown",r[1]),n=!0)},p(u,[d]){const a={};d&8&&(a.$$scope={dirty:d,ctx:u}),e.$set(a)},i(u){t||(oe(e.$$.fragment,u),t=!0)},o(u){de(e.$$.fragment,u),t=!1},d(u){Ne(e,u),n=!1,l()}}}function G5(r){let e=us();function t(l){l.key=="Escape"&&(l.stopPropagation(),e("click"))}return[e,t,()=>e("click")]}class Od extends Ht{constructor(e){super(),Zt(this,e,G5,q5,Ut,{})}}function W5(r){let e,t;const n=[Hn("one-ways"),{filter:["all",["==",["get","kind"],"interior_road"],["!=",["get","direction"],"both"]]},{layout:{"icon-image":"oneway-arrow","icon-size":1,"symbol-placement":"line","symbol-spacing":50,"icon-allow-overlap":!0,"icon-rotate":["case",["==",["get","direction"],"forwards"],0,180]}},{paint:{"icon-opacity":["case",["get","direction_edited"],1,.5]}}];let l={};for(let u=0;u({}),p1=r=>({}),$5=r=>({}),m1=r=>({});function X5(r){let e,t;const n=[Hn("neighbourhood-boundary"),{paint:{"fill-color":"black","fill-opacity":.3}}];let l={};for(let u=0;u{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function J5(r){let e,t,n,l,u,d,a,_,x,S,k;e=new Pi({props:{data:_1(r[3]),$$slots:{default:[X5]},$$scope:{ctx:r}}});const C=[Hn("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.8}}];let P={};for(let U=0;Ut.properties.kind=="boundary");return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]],e.geometry.coordinates[0]]}}}function Q5(r,e,t){let n,l,u,{$$slots:d={},$$scope:a}=e,{gjInput:_}=e,{interactive:x=!0}=e,{onClickLine:S=(C,P)=>{}}=e;const k=C=>x&&S(C.detail.features[0],C.detail.event.lngLat);return r.$$set=C=>{"gjInput"in C&&t(4,_=C.gjInput),"interactive"in C&&t(0,x=C.interactive),"onClickLine"in C&&t(1,S=C.onClickLine),"$$scope"in C&&t(8,a=C.$$scope)},r.$$.update=()=>{r.$$.dirty&16&&t(3,n=Km(_)),r.$$.dirty&16&&t(5,l=Math.max(..._.features.map(C=>C.properties.kind=="interior_road"?C.properties.shortcuts:0))),r.$$.dirty&32&&t(2,u=kc(["interpolate-hcl",["linear"],["get","shortcuts"],0,"white",1,"#F19A93",l,"#A32015"],"blue"))},[x,S,u,n,_,l,d,k,a]}class Nd extends Ht{constructor(e){super(),Zt(this,e,Q5,Y5,Ut,{gjInput:4,interactive:0,onClickLine:1})}}function eM(r){let e;return{c(){e=rt("Choose project")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function tM(r){let e;return{c(){e=rt("Pick neighbourhood")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function rM(r){let e;return{c(){e=rt("Editing")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function nM(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D;return u=new Zr({props:{$$slots:{default:[eM]},$$scope:{ctx:r}}}),u.$on("click",r[4]),_=new Zr({props:{$$slots:{default:[tM]},$$scope:{ctx:r}}}),_.$on("click",r[5]),k=new Zr({props:{$$slots:{default:[rM]},$$scope:{ctx:r}}}),k.$on("click",r[6]),{c(){e=fe("div"),t=fe("nav"),n=fe("ul"),l=fe("li"),je(u.$$.fragment),d=Ve(),a=fe("li"),je(_.$$.fragment),x=Ve(),S=fe("li"),je(k.$$.fragment),C=Ve(),P=fe("li"),P.textContent="Debug mode",Ee(t,"aria-label","breadcrumb"),Ee(e,"slot","top")},m(N,z){be(N,e,z),ie(e,t),ie(t,n),ie(n,l),Oe(u,l,null),ie(n,d),ie(n,a),Oe(_,a,null),ie(n,x),ie(n,S),Oe(k,S,null),ie(n,C),ie(n,P),D=!0},p(N,z){const B={};z&256&&(B.$$scope={dirty:z,ctx:N}),u.$set(B);const O={};z&256&&(O.$$scope={dirty:z,ctx:N}),_.$set(O);const G={};z&256&&(G.$$scope={dirty:z,ctx:N}),k.$set(G)},i(N){D||(oe(u.$$.fragment,N),oe(_.$$.fragment,N),oe(k.$$.fragment,N),D=!0)},o(N){de(u.$$.fragment,N),de(_.$$.fragment,N),de(k.$$.fragment,N),D=!1},d(N){N&&ve(e),Ne(u),Ne(_),Ne(k)}}}function iM(r){let e,t,n;return t=new Od({}),t.$on("click",r[3]),{c(){e=fe("div"),je(t.$$.fragment),Ee(e,"slot","sidebar")},m(l,u){be(l,e,u),Oe(t,e,null),n=!0},p:Mt,i(l){n||(oe(t.$$.fragment,l),n=!0)},o(l){de(t.$$.fragment,l),n=!1},d(l){l&&ve(e),Ne(t)}}}function oM(r){let e,t;return e=new zd({props:{properties:r[7]}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&128&&(u.properties=n[7]),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function sM(r){let e,t,n;return t=new Os({props:{openOn:"hover",$$slots:{default:[oM,({props:l})=>({7:l}),({props:l})=>l?128:0]},$$scope:{ctx:r}}}),{c(){e=fe("div"),je(t.$$.fragment),Ee(e,"slot","line-popup")},m(l,u){be(l,e,u),Oe(t,e,null),n=!0},p(l,u){const d={};u&384&&(d.$$scope={dirty:u,ctx:l}),t.$set(d)},i(l){n||(oe(t.$$.fragment,l),n=!0)},o(l){de(t.$$.fragment,l),n=!1},d(l){l&&ve(e),Ne(t)}}}function aM(r){let e,t;return e=new zd({props:{properties:r[7]}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&128&&(u.properties=n[7]),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function lM(r){let e,t;return e=new Os({props:{openOn:"hover",$$slots:{default:[aM,({props:n})=>({7:n}),({props:n})=>n?128:0]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&384&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function cM(r){let e,t;return e=new zd({props:{properties:r[7]}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&128&&(u.properties=n[7]),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function uM(r){let e,t;return e=new Os({props:{openOn:"hover",$$slots:{default:[cM,({props:n})=>({7:n}),({props:n})=>n?128:0]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&384&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function hM(r){let e,t,n,l;const u=[Hn("debug-borders"),{filter:["==",["get","kind"],"border_intersection"]},{paint:{"circle-radius":15,"circle-color":"green"}}];let d={$$slots:{default:[lM]},$$scope:{ctx:r}};for(let x=0;x({7:n}),({props:n})=>n?128:0]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&384&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function pM(r){let e,t;const n=[Hn("debug-filters"),{paint:{"circle-radius":15,"circle-color":"black"}}];let l={$$slots:{default:[dM]},$$scope:{ctx:r}};for(let u=0;ut(0,n=S)),wt(r,pr,S=>t(1,l=S)),[n,l,(S,k)=>window.open(dn(S.properties).way,"_blank"),()=>Rt(pr,l={mode:"neighbourhood"},l),()=>Rt(pr,l={mode:"title"},l),()=>Rt(pr,l={mode:"network"},l),()=>Rt(pr,l={mode:"neighbourhood"},l)]}class yM extends Ht{constructor(e){super(),Zt(this,e,_M,gM,Ut,{})}}function y1(r,e,t){const n=r.slice();return n[7]=e[t][0],n[8]=e[t][1],n[9]=e[t][2],n}function v1(r){let e,t,n,l,u,d,a=r[8]+"",_,x,S,k,C;function P(){return r[3](r[7])}return{c(){e=fe("button"),t=fe("img"),l=Ve(),u=fe("br"),d=Ve(),_=rt(a),x=Ve(),En(t.src,n=`/ltn//filters/${r[7]}_icon.gif`)||Ee(t,"src",n),Ee(t,"width","80"),Ee(t,"alt",r[8]),Ee(e,"class","outline"),fn(e,"width","100%"),e.disabled=S=r[0]==r[7]},m(D,N){be(D,e,N),ie(e,t),ie(e,l),ie(e,u),ie(e,d),ie(e,_),ie(e,x),k||(C=Tt(e,"click",P),k=!0)},p(D,N){r=D,N&1&&S!==(S=r[0]==r[7])&&(e.disabled=S)},d(D){D&&ve(e),k=!1,C()}}}function vM(r){let e,t,n,l,u,d,a,_,x,S,k,C,P=r[1][2]+"",D,N,z,B,O,G,U=Jn(r[2]),K=[];for(let X=0;X({6:n}),({dialog:n})=>n?64:0]},$$scope:{ctx:r}}}),e.$on("close",r[5]),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,[l]){const u={};l&4163&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function wM(r,e,t){let n,l;wt(r,Om,x=>t(0,l=x));let u=[["walk_cycle_only","Walking/cycling only","A physical barrier that only allows people walking, cycling, and rolling to pass. Often planters or bollards. Larger vehicles cannot enter."],["no_entry","No entry","An alternative sign to indicate vehicles are not allowed to enter the street. Only people walking, cycling, and rolling may pass through."],["bus_gate","Bus gate","A bus gate sign and traffic cameras are installed to allow buses, pedestrians, and cyclists to pass. There is no physical barrier."],["school_street","School street","A closure during school hours only. The barrier usually allows teachers and staff to access the school."]];const d=x=>Rt(Om,l=x,l),a=x=>dn(x).close();function _(x){ur.call(this,r,x)}return r.$$.update=()=>{r.$$.dirty&1&&t(1,n=u.find(x=>x[0]==l))},[l,n,u,d,a,_]}class xM extends Ht{constructor(e){super(),Zt(this,e,wM,bM,Ut,{})}}function b1(r){let e,t;return e=new Pi({props:{data:r[0],$$slots:{default:[SM]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&1&&(u.data=n[0]),l&64&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function SM(r){let e,t;const n=[Hn("freehand-line"),{paint:{"line-width":5,"line-color":"red"}}];let l={};for(let u=0;u{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function TM(r,e,t){let{map:n}=e,l=null;const u=us();n.on("dragstart",d),n.on("mousemove",a),n.on("mouseup",_),ti(()=>{n.dragPan.enable(),n.off("dragstart",d),n.off("mousemove",a),n.off("mouseup",_)});function d(){n.dragPan.disable(),t(0,l={type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}})}function a(x){l&&(l.geometry.coordinates.push(x.lngLat.toArray()),t(0,l))}function _(){l&&(u("done",l),t(0,l=null))}return r.$$set=x=>{"map"in x&&t(1,n=x.map)},[l,n]}class EM extends Ht{constructor(e){super(),Zt(this,e,TM,kM,Ut,{map:1})}}function MM(r){let e;const t=r[3].default,n=Vr(t,r,r[5],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&32)&&Gr(n,t,l,l[5],e?qr(t,l[5],u,null):Wr(l[5]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function CM(r){let e,t;const n=[Hn("modal-filters"),{layout:{"icon-image":["get","filter_kind"],"icon-rotate":["get","angle"],"icon-allow-overlap":!0,"icon-size":.1}},{paint:{"icon-opacity":["case",["get","edited"],1,.5]}}];let l={$$slots:{default:[MM]},$$scope:{ctx:r}};for(let u=0;ut(1,l=x)),wt(r,ia,x=>t(2,u=x));let{$$slots:d={},$$scope:a}=e;function _(x){ur.call(this,r,x)}return r.$$set=x=>{"$$scope"in x&&t(5,a=x.$$scope)},r.$$.update=()=>{r.$$.dirty&6&&t(0,n=u>0?JSON.parse(l.renderModalFilters()):null)},[n,l,u,d,_,a]}class jd extends Ht{constructor(e){super(),Zt(this,e,AM,IM,Ut,{})}}var w1=Object.prototype.toString,xw=function(e){var t=w1.call(e),n=t==="[object Arguments]";return n||(n=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&w1.call(e.callee)==="[object Function]"),n},sm,x1;function LM(){if(x1)return sm;x1=1;var r;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=xw,l=Object.prototype.propertyIsEnumerable,u=!l.call({toString:null},"toString"),d=l.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],_=function(C){var P=C.constructor;return P&&P.prototype===C},x={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},S=function(){if(typeof window>"u")return!1;for(var C in window)try{if(!x["$"+C]&&e.call(window,C)&&window[C]!==null&&typeof window[C]=="object")try{_(window[C])}catch{return!0}}catch{return!0}return!1}(),k=function(C){if(typeof window>"u"||!S)return _(C);try{return _(C)}catch{return!1}};r=function(P){var D=P!==null&&typeof P=="object",N=t.call(P)==="[object Function]",z=n(P),B=D&&t.call(P)==="[object String]",O=[];if(!D&&!N&&!z)throw new TypeError("Object.keys called on a non-object");var G=d&&N;if(B&&P.length>0&&!e.call(P,0))for(var U=0;U0)for(var K=0;K"u"||!ci?Mr:ci(Uint8Array),el={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Mr:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Mr:ArrayBuffer,"%ArrayIteratorPrototype%":cc&&ci?ci([][Symbol.iterator]()):Mr,"%AsyncFromSyncIteratorPrototype%":Mr,"%AsyncFunction%":mc,"%AsyncGenerator%":mc,"%AsyncGeneratorFunction%":mc,"%AsyncIteratorPrototype%":mc,"%Atomics%":typeof Atomics>"u"?Mr:Atomics,"%BigInt%":typeof BigInt>"u"?Mr:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Mr:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Mr:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Mr:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":QM,"%eval%":eval,"%EvalError%":eC,"%Float32Array%":typeof Float32Array>"u"?Mr:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Mr:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Mr:FinalizationRegistry,"%Function%":Tw,"%GeneratorFunction%":mc,"%Int8Array%":typeof Int8Array>"u"?Mr:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Mr:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Mr:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":cc&&ci?ci(ci([][Symbol.iterator]())):Mr,"%JSON%":typeof JSON=="object"?JSON:Mr,"%Map%":typeof Map>"u"?Mr:Map,"%MapIteratorPrototype%":typeof Map>"u"||!cc||!ci?Mr:ci(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Mr:Promise,"%Proxy%":typeof Proxy>"u"?Mr:Proxy,"%RangeError%":tC,"%ReferenceError%":rC,"%Reflect%":typeof Reflect>"u"?Mr:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Mr:Set,"%SetIteratorPrototype%":typeof Set>"u"||!cc||!ci?Mr:ci(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Mr:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":cc&&ci?ci(""[Symbol.iterator]()):Mr,"%Symbol%":cc?Symbol:Mr,"%SyntaxError%":Tc,"%ThrowTypeError%":iC,"%TypedArray%":sC,"%TypeError%":bc,"%Uint8Array%":typeof Uint8Array>"u"?Mr:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Mr:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Mr:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Mr:Uint32Array,"%URIError%":nC,"%WeakMap%":typeof WeakMap>"u"?Mr:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Mr:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Mr:WeakSet};if(ci)try{null.error}catch(r){var aC=ci(ci(r));el["%Error.prototype%"]=aC}var lC=function r(e){var t;if(e==="%AsyncFunction%")t=lm("async function () {}");else if(e==="%GeneratorFunction%")t=lm("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=lm("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=r("%AsyncGenerator%");l&&ci&&(t=ci(l.prototype))}return el[e]=t,t},M1={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Eh=Ug,gd=kw,cC=Eh.call(Function.call,Array.prototype.concat),uC=Eh.call(Function.apply,Array.prototype.splice),C1=Eh.call(Function.call,String.prototype.replace),_d=Eh.call(Function.call,String.prototype.slice),hC=Eh.call(Function.call,RegExp.prototype.exec),fC=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,dC=/\\(\\)?/g,pC=function(e){var t=_d(e,0,1),n=_d(e,-1);if(t==="%"&&n!=="%")throw new Tc("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new Tc("invalid intrinsic syntax, expected opening `%`");var l=[];return C1(e,fC,function(u,d,a,_){l[l.length]=a?C1(_,dC,"$1"):d||u}),l},mC=function(e,t){var n=e,l;if(gd(M1,n)&&(l=M1[n],n="%"+l[0]+"%"),gd(el,n)){var u=el[n];if(u===mc&&(u=lC(n)),typeof u>"u"&&!t)throw new bc("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:n,value:u}}throw new Tc("intrinsic "+e+" does not exist!")},hs=function(e,t){if(typeof e!="string"||e.length===0)throw new bc("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new bc('"allowMissing" argument must be a boolean');if(hC(/^%?[^%]*%?$/,e)===null)throw new Tc("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=pC(e),l=n.length>0?n[0]:"",u=mC("%"+l+"%",t),d=u.name,a=u.value,_=!1,x=u.alias;x&&(l=x[0],uC(n,cC([0,1],x)));for(var S=1,k=!0;S=n.length){var N=Qa(a,C);k=!!N,k&&"get"in N&&!("originalValue"in N.get)?a=N.get:a=a[C]}else k=gd(a,C),a=a[C];k&&!_&&(el[d]=a)}}return a},um,I1;function Vg(){if(I1)return um;I1=1;var r=hs,e=r("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return um=e,um}var gC=hs,Yf=gC("%Object.getOwnPropertyDescriptor%",!0);if(Yf)try{Yf([],"length")}catch{Yf=null}var qg=Yf,A1=Vg(),_C=Sw,uc=ba,L1=qg,Gg=function(e,t,n){if(!e||typeof e!="object"&&typeof e!="function")throw new uc("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new uc("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new uc("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new uc("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new uc("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new uc("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,d=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,_=!!L1&&L1(e,t);if(A1)A1(e,t,{configurable:d===null&&_?_.configurable:!d,enumerable:l===null&&_?_.enumerable:!l,value:n,writable:u===null&&_?_.writable:!u});else if(a||!l&&!u&&!d)e[t]=n;else throw new _C("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Jm=Vg(),Ew=function(){return!!Jm};Ew.hasArrayLengthDefineBug=function(){if(!Jm)return null;try{return Jm([],"length",{value:1}).length!==1}catch{return!0}};var Wg=Ew,yC=Ng,vC=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",bC=Object.prototype.toString,wC=Array.prototype.concat,P1=Gg,xC=function(r){return typeof r=="function"&&bC.call(r)==="[object Function]"},Mw=Wg(),SC=function(r,e,t,n){if(e in r){if(n===!0){if(r[e]===t)return}else if(!xC(n)||!n())return}Mw?P1(r,e,t,!0):P1(r,e,t)},Cw=function(r,e){var t=arguments.length>2?arguments[2]:{},n=yC(e);vC&&(n=wC.call(n,Object.getOwnPropertySymbols(e)));for(var l=0;l4294967295||EC(t)!==t)throw new R1("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],l=!0,u=!0;if("length"in e&&D1){var d=D1(e,"length");d&&!d.configurable&&(l=!1),d&&!d.writable&&(u=!1)}return(l||u||!n)&&(TC?z1(e,"length",t,!0,!0):z1(e,"length",t)),e};(function(r){var e=Ug,t=hs,n=MC,l=ba,u=t("%Function.prototype.apply%"),d=t("%Function.prototype.call%"),a=t("%Reflect.apply%",!0)||e.call(d,u),_=Vg(),x=t("%Math.max%");r.exports=function(C){if(typeof C!="function")throw new l("a function is required");var P=a(e,d,arguments);return n(P,1+x(0,C.length-(arguments.length-1)),!0)};var S=function(){return a(e,u,arguments)};_?_(r.exports,"apply",{value:S}):r.exports.apply=S})(Iw);var Rc=Iw.exports,Aw=hs,Lw=Rc,CC=Lw(Aw("String.prototype.indexOf")),Ro=function(e,t){var n=Aw(e,!!t);return typeof n=="function"&&CC(e,".prototype.")>-1?Lw(n):n},IC=Ng,Pw=Ud(),zw=Ro,B1=Object,AC=zw("Array.prototype.push"),F1=zw("Object.prototype.propertyIsEnumerable"),LC=Pw?Object.getOwnPropertySymbols:null,Dw=function(e,t){if(e==null)throw new TypeError("target must be an object");var n=B1(e);if(arguments.length===1)return n;for(var l=1;l2&&!!arguments[2];return(!n||ZC)&&(WC?O1(e,"name",t,!0,!0):O1(e,"name",t)),e},XC=$C,KC=ba,JC=Object,Ow=XC(function(){if(this==null||this!==JC(this))throw new KC("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0),YC=Ow,QC=il.supportsDescriptors,eI=Object.getOwnPropertyDescriptor,Nw=function(){if(QC&&/a/mig.flags==="gim"){var e=eI(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var t="",n={};if(Object.defineProperty(n,"hasIndices",{get:function(){t+="d"}}),Object.defineProperty(n,"sticky",{get:function(){t+="y"}}),t==="dy")return e.get}}return YC},tI=il.supportsDescriptors,rI=Nw,nI=Object.getOwnPropertyDescriptor,iI=Object.defineProperty,oI=TypeError,N1=Object.getPrototypeOf,sI=/a/,aI=function(){if(!tI||!N1)throw new oI("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=rI(),t=N1(sI),n=nI(t,"flags");return(!n||n.get!==e)&&iI(t,"flags",{configurable:!0,enumerable:!1,get:e}),e},lI=il,cI=Rc,uI=Ow,jw=Nw,hI=aI,Uw=cI(jw());lI(Uw,{getPolyfill:jw,implementation:uI,shim:hI});var fI=Uw,Qf={exports:{}},dI=Ud,ol=function(){return dI()&&!!Symbol.toStringTag},pI=ol(),mI=Ro,Ym=mI("Object.prototype.toString"),Vd=function(e){return pI&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:Ym(e)==="[object Arguments]"},Vw=function(e){return Vd(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Ym(e)!=="[object Array]"&&Ym(e.callee)==="[object Function]"},gI=function(){return Vd(arguments)}();Vd.isLegacyArguments=Vw;var qw=gI?Vd:Vw;const _I={},yI=Object.freeze(Object.defineProperty({__proto__:null,default:_I},Symbol.toStringTag,{value:"Module"})),vI=Dd(yI);var Zg=typeof Map=="function"&&Map.prototype,fm=Object.getOwnPropertyDescriptor&&Zg?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,yd=Zg&&fm&&typeof fm.get=="function"?fm.get:null,j1=Zg&&Map.prototype.forEach,Hg=typeof Set=="function"&&Set.prototype,dm=Object.getOwnPropertyDescriptor&&Hg?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,vd=Hg&&dm&&typeof dm.get=="function"?dm.get:null,U1=Hg&&Set.prototype.forEach,bI=typeof WeakMap=="function"&&WeakMap.prototype,ah=bI?WeakMap.prototype.has:null,wI=typeof WeakSet=="function"&&WeakSet.prototype,lh=wI?WeakSet.prototype.has:null,xI=typeof WeakRef=="function"&&WeakRef.prototype,V1=xI?WeakRef.prototype.deref:null,SI=Boolean.prototype.valueOf,kI=Object.prototype.toString,TI=Function.prototype.toString,EI=String.prototype.match,$g=String.prototype.slice,ca=String.prototype.replace,MI=String.prototype.toUpperCase,q1=String.prototype.toLowerCase,Gw=RegExp.prototype.test,G1=Array.prototype.concat,as=Array.prototype.join,CI=Array.prototype.slice,W1=Math.floor,Qm=typeof BigInt=="function"?BigInt.prototype.valueOf:null,pm=Object.getOwnPropertySymbols,eg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ec=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Di=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ec||"symbol")?Symbol.toStringTag:null,Ww=Object.prototype.propertyIsEnumerable,Z1=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function H1(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||Gw.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var n=r<0?-W1(-r):W1(r);if(n!==r){var l=String(n),u=$g.call(e,l.length+1);return ca.call(l,t,"$&_")+"."+ca.call(ca.call(u,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ca.call(e,t,"$&_")}var tg=vI,$1=tg.custom,X1=Hw($1)?$1:null,II=function r(e,t,n,l){var u=t||{};if(oa(u,"quoteStyle")&&u.quoteStyle!=="single"&&u.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(oa(u,"maxStringLength")&&(typeof u.maxStringLength=="number"?u.maxStringLength<0&&u.maxStringLength!==1/0:u.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var d=oa(u,"customInspect")?u.customInspect:!0;if(typeof d!="boolean"&&d!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(oa(u,"indent")&&u.indent!==null&&u.indent!==" "&&!(parseInt(u.indent,10)===u.indent&&u.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(oa(u,"numericSeparator")&&typeof u.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=u.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Xw(e,u);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var _=String(e);return a?H1(e,_):_}if(typeof e=="bigint"){var x=String(e)+"n";return a?H1(e,x):x}var S=typeof u.depth>"u"?5:u.depth;if(typeof n>"u"&&(n=0),n>=S&&S>0&&typeof e=="object")return rg(e)?"[Array]":"[Object]";var k=HI(u,n);if(typeof l>"u")l=[];else if($w(l,e)>=0)return"[Circular]";function C(Ze,Me,ft){if(Me&&(l=CI.call(l),l.push(Me)),ft){var Ct={depth:u.depth};return oa(u,"quoteStyle")&&(Ct.quoteStyle=u.quoteStyle),r(Ze,Ct,n+1,l)}return r(Ze,u,n+1,l)}if(typeof e=="function"&&!K1(e)){var P=OI(e),D=Of(e,C);return"[Function"+(P?": "+P:" (anonymous)")+"]"+(D.length>0?" { "+as.call(D,", ")+" }":"")}if(Hw(e)){var N=Ec?ca.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):eg.call(e);return typeof e=="object"&&!Ec?qu(N):N}if(GI(e)){for(var z="<"+q1.call(String(e.nodeName)),B=e.attributes||[],O=0;O",z}if(rg(e)){if(e.length===0)return"[]";var G=Of(e,C);return k&&!ZI(G)?"["+ng(G,k)+"]":"[ "+as.call(G,", ")+" ]"}if(PI(e)){var U=Of(e,C);return!("cause"in Error.prototype)&&"cause"in e&&!Ww.call(e,"cause")?"{ ["+String(e)+"] "+as.call(G1.call("[cause]: "+C(e.cause),U),", ")+" }":U.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+as.call(U,", ")+" }"}if(typeof e=="object"&&d){if(X1&&typeof e[X1]=="function"&&tg)return tg(e,{depth:S-n});if(d!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(NI(e)){var K=[];return j1&&j1.call(e,function(Ze,Me){K.push(C(Me,e,!0)+" => "+C(Ze,e))}),J1("Map",yd.call(e),K,k)}if(VI(e)){var me=[];return U1&&U1.call(e,function(Ze){me.push(C(Ze,e))}),J1("Set",vd.call(e),me,k)}if(jI(e))return mm("WeakMap");if(qI(e))return mm("WeakSet");if(UI(e))return mm("WeakRef");if(DI(e))return qu(C(Number(e)));if(BI(e))return qu(C(Qm.call(e)));if(RI(e))return qu(SI.call(e));if(zI(e))return qu(C(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===xh)return"{ [object globalThis] }";if(!LI(e)&&!K1(e)){var X=Of(e,C),Y=Z1?Z1(e)===Object.prototype:e instanceof Object||e.constructor===Object,_e=e instanceof Object?"":"null prototype",ze=!Y&&Di&&Object(e)===e&&Di in e?$g.call(wa(e),8,-1):_e?"Object":"",re=Y||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",ce=re+(ze||_e?"["+as.call(G1.call([],ze||[],_e||[]),": ")+"] ":"");return X.length===0?ce+"{}":k?ce+"{"+ng(X,k)+"}":ce+"{ "+as.call(X,", ")+" }"}return String(e)};function Zw(r,e,t){var n=(t.quoteStyle||e)==="double"?'"':"'";return n+r+n}function AI(r){return ca.call(String(r),/"/g,""")}function rg(r){return wa(r)==="[object Array]"&&(!Di||!(typeof r=="object"&&Di in r))}function LI(r){return wa(r)==="[object Date]"&&(!Di||!(typeof r=="object"&&Di in r))}function K1(r){return wa(r)==="[object RegExp]"&&(!Di||!(typeof r=="object"&&Di in r))}function PI(r){return wa(r)==="[object Error]"&&(!Di||!(typeof r=="object"&&Di in r))}function zI(r){return wa(r)==="[object String]"&&(!Di||!(typeof r=="object"&&Di in r))}function DI(r){return wa(r)==="[object Number]"&&(!Di||!(typeof r=="object"&&Di in r))}function RI(r){return wa(r)==="[object Boolean]"&&(!Di||!(typeof r=="object"&&Di in r))}function Hw(r){if(Ec)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!eg)return!1;try{return eg.call(r),!0}catch{}return!1}function BI(r){if(!r||typeof r!="object"||!Qm)return!1;try{return Qm.call(r),!0}catch{}return!1}var FI=Object.prototype.hasOwnProperty||function(r){return r in this};function oa(r,e){return FI.call(r,e)}function wa(r){return kI.call(r)}function OI(r){if(r.name)return r.name;var e=EI.call(TI.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function $w(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,n=r.length;te.maxStringLength){var t=r.length-e.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return Xw($g.call(r,0,e.maxStringLength),e)+n}var l=ca.call(ca.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,WI);return Zw(l,"single",e)}function WI(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+MI.call(e.toString(16))}function qu(r){return"Object("+r+")"}function mm(r){return r+" { ? }"}function J1(r,e,t,n){var l=n?ng(t,n):as.call(t,", ");return r+" ("+e+") {"+l+"}"}function ZI(r){for(var e=0;e=0)return!1;return!0}function HI(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=as.call(Array(r.indent+1)," ");else return null;return{base:t,prev:as.call(Array(e+1),t)}}function ng(r,e){if(r.length===0)return"";var t=` + Bing Streetside`),Ee(e,"class","secondary"),Ee(a,"type","radio"),a.__value="google",ei(a,a.__value),Ee(k,"type","radio"),k.__value="bing",ei(k,k.__value),P.p(a,k)},m(z,B){be(z,e,B),be(z,t,B),be(z,n,B),ie(n,l),ie(n,u),ie(n,d),ie(d,a),a.checked=a.__value===r[0],ie(d,_),ie(n,x),ie(n,S),ie(S,k),k.checked=k.__value===r[0],ie(S,C),D||(N=[Tt(e,"click",r[3]),Tt(a,"change",r[7]),Tt(k,"change",r[9])],D=!0)},p(z,B){B&1&&(a.checked=a.__value===z[0]),B&1&&(k.checked=k.__value===z[0])},d(z){z&&(ve(e),ve(t),ve(n)),P.r(),D=!1,_n(N)}}}function O5(r){let e,t,n;return{c(){e=fe("button"),e.textContent="StreetView",Ee(e,"class","secondary")},m(l,u){be(l,e,u),t||(n=Tt(e,"click",r[2]),t=!0)},p:Mt,d(l){l&&ve(e),t=!1,n()}}}function N5(r){let e,t,n;function l(a,_){return a[1]?O5:F5}let u=l(r),d=u(r);return{c(){d.c(),e=$n()},m(a,_){d.m(a,_),be(a,e,_),t||(n=Tt(B5,"keydown",r[4]),t=!0)},p(a,[_]){u===(u=l(a))&&d?d.p(a,_):(d.d(1),d=u(a),d&&(d.c(),d.m(e.parentNode,e)))},i:Mt,o:Mt,d(a){a&&ve(e),d.d(a),t=!1,n()}}}function j5(r,e,t){let n;wt(r,Kf,N=>t(1,n=N));let{map:l}=e,{maptilerBasemap:u}=e,d="google",a=[];function _(){Rt(Kf,n=!1,n),l.on("click",S),l.getCanvas().style.cursor="crosshair";for(let N of R5(l,u))a.push([N,l.getPaintProperty(N,"line-color")]),l.setPaintProperty(N,"line-color","cyan")}function x(){Rt(Kf,n=!0,n),l.off("click",S),l.getCanvas().style.cursor="inherit";for(let[N,z]of a)l.setPaintProperty(N,"line-color",z);a=[]}ti(x);function S(N){let z=N.lngLat.lng,B=N.lngLat.lat;d=="google"?window.open(`http://maps.google.com/maps?q=&layer=c&cbll=${B},${z}&cbp=11,0,0,0,0`,"_blank"):d=="bing"&&window.open(`https://www.bing.com/maps?cp=${B}~${z}&style=x`,"_blank")}function k(N){!n&&N.key=="Escape"&&(N.stopPropagation(),x())}const C=[[]];function P(){d=this.__value,t(0,d)}function D(){d=this.__value,t(0,d)}return r.$$set=N=>{"map"in N&&t(5,l=N.map),"maptilerBasemap"in N&&t(6,u=N.maptilerBasemap)},[d,n,_,x,k,l,u,P,C,D]}class U5 extends Ht{constructor(e){super(),Zt(this,e,j5,N5,Ut,{map:5,maptilerBasemap:6})}}function Hn(r){return{id:r,beforeId:V5(r)}}function V5(r){let e=Hi(ls);if(!e){console.warn(`getBeforeId(${r}) called before map is ready. Z-ordering may be incorrect.`);return}let t,n=!1;for(let l=p1.length-1;l>=0;l--){let u=p1[l];if(u==r){n=!0;break}e.getLayer(u)&&(t=u)}if(!n)throw new Error(`Layer ID ${r} not defined in layerZorder`);return t}let im=r=>r,om=r=>r;const p1=[im(om("Background")),"neighbourhood-boundaries",im("Ferry line"),"debug-borders","debug-crosses","debug-filters","cells","interior-roads-outlines","interior-roads","compare-route","shortcuts","shortcuts-focus",om("Building"),"draw-area-lines","draw-area-preview","one-ways",om("Road labels"),im("road_label"),"animate-shortcuts","modal-filters","boundary","neighbourhood-boundary","auto-boundaries-areas","auto-boundaries-severances","freehand-line","edit-polygon-fill","edit-polygon-lines","edit-polygon-vertices"];function q5(r){let e;return{c(){e=rt("Back")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function G5(r){let e,t,n,l;return e=new Zr({props:{$$slots:{default:[q5]},$$scope:{ctx:r}}}),e.$on("click",r[2]),{c(){je(e.$$.fragment)},m(u,d){Oe(e,u,d),t=!0,n||(l=Tt(window,"keydown",r[1]),n=!0)},p(u,[d]){const a={};d&8&&(a.$$scope={dirty:d,ctx:u}),e.$set(a)},i(u){t||(oe(e.$$.fragment,u),t=!0)},o(u){de(e.$$.fragment,u),t=!1},d(u){Ne(e,u),n=!1,l()}}}function W5(r){let e=us();function t(l){l.key=="Escape"&&(l.stopPropagation(),e("click"))}return[e,t,()=>e("click")]}class Od extends Ht{constructor(e){super(),Zt(this,e,W5,G5,Ut,{})}}function Z5(r){let e,t;const n=[Hn("one-ways"),{filter:["all",["==",["get","kind"],"interior_road"],["!=",["get","direction"],"both"]]},{layout:{"icon-image":"oneway-arrow","icon-size":1,"symbol-placement":"line","symbol-spacing":50,"icon-allow-overlap":!0,"icon-rotate":["case",["==",["get","direction"],"forwards"],0,180]}},{paint:{"icon-opacity":["case",["get","direction_edited"],1,.5]}}];let l={};for(let u=0;u({}),m1=r=>({}),X5=r=>({}),g1=r=>({});function K5(r){let e,t;const n=[Hn("neighbourhood-boundary"),{paint:{"fill-color":"black","fill-opacity":.3}}];let l={};for(let u=0;u{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function Y5(r){let e,t,n,l,u,d,a,_,x,S,k;e=new Pi({props:{data:y1(r[3]),$$slots:{default:[K5]},$$scope:{ctx:r}}});const C=[Hn("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.8}}];let P={};for(let U=0;Ut.properties.kind=="boundary");return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]],e.geometry.coordinates[0]]}}}function eM(r,e,t){let n,l,u,{$$slots:d={},$$scope:a}=e,{gjInput:_}=e,{interactive:x=!0}=e,{onClickLine:S=(C,P)=>{}}=e;const k=C=>x&&S(C.detail.features[0],C.detail.event.lngLat);return r.$$set=C=>{"gjInput"in C&&t(4,_=C.gjInput),"interactive"in C&&t(0,x=C.interactive),"onClickLine"in C&&t(1,S=C.onClickLine),"$$scope"in C&&t(8,a=C.$$scope)},r.$$.update=()=>{r.$$.dirty&16&&t(3,n=Km(_)),r.$$.dirty&16&&t(5,l=Math.max(..._.features.map(C=>C.properties.kind=="interior_road"?C.properties.shortcuts:0))),r.$$.dirty&32&&t(2,u=kc(["interpolate-hcl",["linear"],["get","shortcuts"],0,"white",1,"#F19A93",l,"#A32015"],"blue"))},[x,S,u,n,_,l,d,k,a]}class Nd extends Ht{constructor(e){super(),Zt(this,e,eM,Q5,Ut,{gjInput:4,interactive:0,onClickLine:1})}}function tM(r){let e;return{c(){e=rt("Choose project")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function rM(r){let e;return{c(){e=rt("Pick neighbourhood")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function nM(r){let e;return{c(){e=rt("Editing")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function iM(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D;return u=new Zr({props:{$$slots:{default:[tM]},$$scope:{ctx:r}}}),u.$on("click",r[4]),_=new Zr({props:{$$slots:{default:[rM]},$$scope:{ctx:r}}}),_.$on("click",r[5]),k=new Zr({props:{$$slots:{default:[nM]},$$scope:{ctx:r}}}),k.$on("click",r[6]),{c(){e=fe("div"),t=fe("nav"),n=fe("ul"),l=fe("li"),je(u.$$.fragment),d=Ve(),a=fe("li"),je(_.$$.fragment),x=Ve(),S=fe("li"),je(k.$$.fragment),C=Ve(),P=fe("li"),P.textContent="Debug mode",Ee(t,"aria-label","breadcrumb"),Ee(e,"slot","top")},m(N,z){be(N,e,z),ie(e,t),ie(t,n),ie(n,l),Oe(u,l,null),ie(n,d),ie(n,a),Oe(_,a,null),ie(n,x),ie(n,S),Oe(k,S,null),ie(n,C),ie(n,P),D=!0},p(N,z){const B={};z&256&&(B.$$scope={dirty:z,ctx:N}),u.$set(B);const O={};z&256&&(O.$$scope={dirty:z,ctx:N}),_.$set(O);const G={};z&256&&(G.$$scope={dirty:z,ctx:N}),k.$set(G)},i(N){D||(oe(u.$$.fragment,N),oe(_.$$.fragment,N),oe(k.$$.fragment,N),D=!0)},o(N){de(u.$$.fragment,N),de(_.$$.fragment,N),de(k.$$.fragment,N),D=!1},d(N){N&&ve(e),Ne(u),Ne(_),Ne(k)}}}function oM(r){let e,t,n;return t=new Od({}),t.$on("click",r[3]),{c(){e=fe("div"),je(t.$$.fragment),Ee(e,"slot","sidebar")},m(l,u){be(l,e,u),Oe(t,e,null),n=!0},p:Mt,i(l){n||(oe(t.$$.fragment,l),n=!0)},o(l){de(t.$$.fragment,l),n=!1},d(l){l&&ve(e),Ne(t)}}}function sM(r){let e,t;return e=new zd({props:{properties:r[7]}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&128&&(u.properties=n[7]),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function aM(r){let e,t,n;return t=new Os({props:{openOn:"hover",$$slots:{default:[sM,({props:l})=>({7:l}),({props:l})=>l?128:0]},$$scope:{ctx:r}}}),{c(){e=fe("div"),je(t.$$.fragment),Ee(e,"slot","line-popup")},m(l,u){be(l,e,u),Oe(t,e,null),n=!0},p(l,u){const d={};u&384&&(d.$$scope={dirty:u,ctx:l}),t.$set(d)},i(l){n||(oe(t.$$.fragment,l),n=!0)},o(l){de(t.$$.fragment,l),n=!1},d(l){l&&ve(e),Ne(t)}}}function lM(r){let e,t;return e=new zd({props:{properties:r[7]}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&128&&(u.properties=n[7]),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function cM(r){let e,t;return e=new Os({props:{openOn:"hover",$$slots:{default:[lM,({props:n})=>({7:n}),({props:n})=>n?128:0]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&384&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function uM(r){let e,t;return e=new zd({props:{properties:r[7]}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&128&&(u.properties=n[7]),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function hM(r){let e,t;return e=new Os({props:{openOn:"hover",$$slots:{default:[uM,({props:n})=>({7:n}),({props:n})=>n?128:0]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&384&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function fM(r){let e,t,n,l;const u=[Hn("debug-borders"),{filter:["==",["get","kind"],"border_intersection"]},{paint:{"circle-radius":15,"circle-color":"green"}}];let d={$$slots:{default:[cM]},$$scope:{ctx:r}};for(let x=0;x({7:n}),({props:n})=>n?128:0]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&384&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function mM(r){let e,t;const n=[Hn("debug-filters"),{paint:{"circle-radius":15,"circle-color":"black"}}];let l={$$slots:{default:[pM]},$$scope:{ctx:r}};for(let u=0;ut(0,n=S)),wt(r,pr,S=>t(1,l=S)),[n,l,(S,k)=>window.open(dn(S.properties).way,"_blank"),()=>Rt(pr,l={mode:"neighbourhood"},l),()=>Rt(pr,l={mode:"title"},l),()=>Rt(pr,l={mode:"network"},l),()=>Rt(pr,l={mode:"neighbourhood"},l)]}class vM extends Ht{constructor(e){super(),Zt(this,e,yM,_M,Ut,{})}}function v1(r,e,t){const n=r.slice();return n[7]=e[t][0],n[8]=e[t][1],n[9]=e[t][2],n}function b1(r){let e,t,n,l,u,d,a=r[8]+"",_,x,S,k,C;function P(){return r[3](r[7])}return{c(){e=fe("button"),t=fe("img"),l=Ve(),u=fe("br"),d=Ve(),_=rt(a),x=Ve(),En(t.src,n=`/ltn//filters/${r[7]}_icon.gif`)||Ee(t,"src",n),Ee(t,"width","80"),Ee(t,"alt",r[8]),Ee(e,"class","outline"),fn(e,"width","100%"),e.disabled=S=r[0]==r[7]},m(D,N){be(D,e,N),ie(e,t),ie(e,l),ie(e,u),ie(e,d),ie(e,_),ie(e,x),k||(C=Tt(e,"click",P),k=!0)},p(D,N){r=D,N&1&&S!==(S=r[0]==r[7])&&(e.disabled=S)},d(D){D&&ve(e),k=!1,C()}}}function bM(r){let e,t,n,l,u,d,a,_,x,S,k,C,P=r[1][2]+"",D,N,z,B,O,G,U=Jn(r[2]),K=[];for(let X=0;X({6:n}),({dialog:n})=>n?64:0]},$$scope:{ctx:r}}}),e.$on("close",r[5]),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,[l]){const u={};l&4163&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function xM(r,e,t){let n,l;wt(r,Om,x=>t(0,l=x));let u=[["walk_cycle_only","Walking/cycling only","A physical barrier that only allows people walking, cycling, and rolling to pass. Often planters or bollards. Larger vehicles cannot enter."],["no_entry","No entry","An alternative sign to indicate vehicles are not allowed to enter the street. Only people walking, cycling, and rolling may pass through."],["bus_gate","Bus gate","A bus gate sign and traffic cameras are installed to allow buses, pedestrians, and cyclists to pass. There is no physical barrier."],["school_street","School street","A closure during school hours only. The barrier usually allows teachers and staff to access the school."]];const d=x=>Rt(Om,l=x,l),a=x=>dn(x).close();function _(x){ur.call(this,r,x)}return r.$$.update=()=>{r.$$.dirty&1&&t(1,n=u.find(x=>x[0]==l))},[l,n,u,d,a,_]}class SM extends Ht{constructor(e){super(),Zt(this,e,xM,wM,Ut,{})}}function w1(r){let e,t;return e=new Pi({props:{data:r[0],$$slots:{default:[kM]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&1&&(u.data=n[0]),l&64&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function kM(r){let e,t;const n=[Hn("freehand-line"),{paint:{"line-width":5,"line-color":"red"}}];let l={};for(let u=0;u{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function EM(r,e,t){let{map:n}=e,l=null;const u=us();n.on("dragstart",d),n.on("mousemove",a),n.on("mouseup",_),ti(()=>{n.dragPan.enable(),n.off("dragstart",d),n.off("mousemove",a),n.off("mouseup",_)});function d(){n.dragPan.disable(),t(0,l={type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}})}function a(x){l&&(l.geometry.coordinates.push(x.lngLat.toArray()),t(0,l))}function _(){l&&(u("done",l),t(0,l=null))}return r.$$set=x=>{"map"in x&&t(1,n=x.map)},[l,n]}class MM extends Ht{constructor(e){super(),Zt(this,e,EM,TM,Ut,{map:1})}}function CM(r){let e;const t=r[3].default,n=Vr(t,r,r[5],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&32)&&Gr(n,t,l,l[5],e?qr(t,l[5],u,null):Wr(l[5]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function IM(r){let e,t;const n=[Hn("modal-filters"),{layout:{"icon-image":["get","filter_kind"],"icon-rotate":["get","angle"],"icon-allow-overlap":!0,"icon-size":.1}},{paint:{"icon-opacity":["case",["get","edited"],1,.5]}}];let l={$$slots:{default:[CM]},$$scope:{ctx:r}};for(let u=0;ut(1,l=x)),wt(r,ia,x=>t(2,u=x));let{$$slots:d={},$$scope:a}=e;function _(x){ur.call(this,r,x)}return r.$$set=x=>{"$$scope"in x&&t(5,a=x.$$scope)},r.$$.update=()=>{r.$$.dirty&6&&t(0,n=u>0?JSON.parse(l.renderModalFilters()):null)},[n,l,u,d,_,a]}class jd extends Ht{constructor(e){super(),Zt(this,e,LM,AM,Ut,{})}}var x1=Object.prototype.toString,Sw=function(e){var t=x1.call(e),n=t==="[object Arguments]";return n||(n=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&x1.call(e.callee)==="[object Function]"),n},sm,S1;function PM(){if(S1)return sm;S1=1;var r;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Sw,l=Object.prototype.propertyIsEnumerable,u=!l.call({toString:null},"toString"),d=l.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],_=function(C){var P=C.constructor;return P&&P.prototype===C},x={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},S=function(){if(typeof window>"u")return!1;for(var C in window)try{if(!x["$"+C]&&e.call(window,C)&&window[C]!==null&&typeof window[C]=="object")try{_(window[C])}catch{return!0}}catch{return!0}return!1}(),k=function(C){if(typeof window>"u"||!S)return _(C);try{return _(C)}catch{return!1}};r=function(P){var D=P!==null&&typeof P=="object",N=t.call(P)==="[object Function]",z=n(P),B=D&&t.call(P)==="[object String]",O=[];if(!D&&!N&&!z)throw new TypeError("Object.keys called on a non-object");var G=d&&N;if(B&&P.length>0&&!e.call(P,0))for(var U=0;U0)for(var K=0;K"u"||!ci?Mr:ci(Uint8Array),el={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Mr:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Mr:ArrayBuffer,"%ArrayIteratorPrototype%":cc&&ci?ci([][Symbol.iterator]()):Mr,"%AsyncFromSyncIteratorPrototype%":Mr,"%AsyncFunction%":mc,"%AsyncGenerator%":mc,"%AsyncGeneratorFunction%":mc,"%AsyncIteratorPrototype%":mc,"%Atomics%":typeof Atomics>"u"?Mr:Atomics,"%BigInt%":typeof BigInt>"u"?Mr:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Mr:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Mr:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Mr:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":eC,"%eval%":eval,"%EvalError%":tC,"%Float32Array%":typeof Float32Array>"u"?Mr:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Mr:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Mr:FinalizationRegistry,"%Function%":Ew,"%GeneratorFunction%":mc,"%Int8Array%":typeof Int8Array>"u"?Mr:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Mr:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Mr:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":cc&&ci?ci(ci([][Symbol.iterator]())):Mr,"%JSON%":typeof JSON=="object"?JSON:Mr,"%Map%":typeof Map>"u"?Mr:Map,"%MapIteratorPrototype%":typeof Map>"u"||!cc||!ci?Mr:ci(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Mr:Promise,"%Proxy%":typeof Proxy>"u"?Mr:Proxy,"%RangeError%":rC,"%ReferenceError%":nC,"%Reflect%":typeof Reflect>"u"?Mr:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Mr:Set,"%SetIteratorPrototype%":typeof Set>"u"||!cc||!ci?Mr:ci(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Mr:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":cc&&ci?ci(""[Symbol.iterator]()):Mr,"%Symbol%":cc?Symbol:Mr,"%SyntaxError%":Tc,"%ThrowTypeError%":oC,"%TypedArray%":aC,"%TypeError%":bc,"%Uint8Array%":typeof Uint8Array>"u"?Mr:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Mr:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Mr:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Mr:Uint32Array,"%URIError%":iC,"%WeakMap%":typeof WeakMap>"u"?Mr:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Mr:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Mr:WeakSet};if(ci)try{null.error}catch(r){var lC=ci(ci(r));el["%Error.prototype%"]=lC}var cC=function r(e){var t;if(e==="%AsyncFunction%")t=lm("async function () {}");else if(e==="%GeneratorFunction%")t=lm("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=lm("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=r("%AsyncGenerator%");l&&ci&&(t=ci(l.prototype))}return el[e]=t,t},C1={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Eh=Vg,gd=Tw,uC=Eh.call(Function.call,Array.prototype.concat),hC=Eh.call(Function.apply,Array.prototype.splice),I1=Eh.call(Function.call,String.prototype.replace),_d=Eh.call(Function.call,String.prototype.slice),fC=Eh.call(Function.call,RegExp.prototype.exec),dC=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,pC=/\\(\\)?/g,mC=function(e){var t=_d(e,0,1),n=_d(e,-1);if(t==="%"&&n!=="%")throw new Tc("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new Tc("invalid intrinsic syntax, expected opening `%`");var l=[];return I1(e,dC,function(u,d,a,_){l[l.length]=a?I1(_,pC,"$1"):d||u}),l},gC=function(e,t){var n=e,l;if(gd(C1,n)&&(l=C1[n],n="%"+l[0]+"%"),gd(el,n)){var u=el[n];if(u===mc&&(u=cC(n)),typeof u>"u"&&!t)throw new bc("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:n,value:u}}throw new Tc("intrinsic "+e+" does not exist!")},hs=function(e,t){if(typeof e!="string"||e.length===0)throw new bc("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new bc('"allowMissing" argument must be a boolean');if(fC(/^%?[^%]*%?$/,e)===null)throw new Tc("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=mC(e),l=n.length>0?n[0]:"",u=gC("%"+l+"%",t),d=u.name,a=u.value,_=!1,x=u.alias;x&&(l=x[0],hC(n,uC([0,1],x)));for(var S=1,k=!0;S=n.length){var N=Qa(a,C);k=!!N,k&&"get"in N&&!("originalValue"in N.get)?a=N.get:a=a[C]}else k=gd(a,C),a=a[C];k&&!_&&(el[d]=a)}}return a},um,A1;function qg(){if(A1)return um;A1=1;var r=hs,e=r("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return um=e,um}var _C=hs,Yf=_C("%Object.getOwnPropertyDescriptor%",!0);if(Yf)try{Yf([],"length")}catch{Yf=null}var Gg=Yf,L1=qg(),yC=kw,uc=ba,P1=Gg,Wg=function(e,t,n){if(!e||typeof e!="object"&&typeof e!="function")throw new uc("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new uc("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new uc("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new uc("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new uc("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new uc("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,d=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,_=!!P1&&P1(e,t);if(L1)L1(e,t,{configurable:d===null&&_?_.configurable:!d,enumerable:l===null&&_?_.enumerable:!l,value:n,writable:u===null&&_?_.writable:!u});else if(a||!l&&!u&&!d)e[t]=n;else throw new yC("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Jm=qg(),Mw=function(){return!!Jm};Mw.hasArrayLengthDefineBug=function(){if(!Jm)return null;try{return Jm([],"length",{value:1}).length!==1}catch{return!0}};var Zg=Mw,vC=jg,bC=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",wC=Object.prototype.toString,xC=Array.prototype.concat,z1=Wg,SC=function(r){return typeof r=="function"&&wC.call(r)==="[object Function]"},Cw=Zg(),kC=function(r,e,t,n){if(e in r){if(n===!0){if(r[e]===t)return}else if(!SC(n)||!n())return}Cw?z1(r,e,t,!0):z1(r,e,t)},Iw=function(r,e){var t=arguments.length>2?arguments[2]:{},n=vC(e);bC&&(n=xC.call(n,Object.getOwnPropertySymbols(e)));for(var l=0;l4294967295||MC(t)!==t)throw new B1("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],l=!0,u=!0;if("length"in e&&R1){var d=R1(e,"length");d&&!d.configurable&&(l=!1),d&&!d.writable&&(u=!1)}return(l||u||!n)&&(EC?D1(e,"length",t,!0,!0):D1(e,"length",t)),e};(function(r){var e=Vg,t=hs,n=CC,l=ba,u=t("%Function.prototype.apply%"),d=t("%Function.prototype.call%"),a=t("%Reflect.apply%",!0)||e.call(d,u),_=qg(),x=t("%Math.max%");r.exports=function(C){if(typeof C!="function")throw new l("a function is required");var P=a(e,d,arguments);return n(P,1+x(0,C.length-(arguments.length-1)),!0)};var S=function(){return a(e,u,arguments)};_?_(r.exports,"apply",{value:S}):r.exports.apply=S})(Aw);var Rc=Aw.exports,Lw=hs,Pw=Rc,IC=Pw(Lw("String.prototype.indexOf")),Ro=function(e,t){var n=Lw(e,!!t);return typeof n=="function"&&IC(e,".prototype.")>-1?Pw(n):n},AC=jg,zw=Ud(),Dw=Ro,F1=Object,LC=Dw("Array.prototype.push"),O1=Dw("Object.prototype.propertyIsEnumerable"),PC=zw?Object.getOwnPropertySymbols:null,Rw=function(e,t){if(e==null)throw new TypeError("target must be an object");var n=F1(e);if(arguments.length===1)return n;for(var l=1;l2&&!!arguments[2];return(!n||HC)&&(ZC?N1(e,"name",t,!0,!0):N1(e,"name",t)),e},KC=XC,JC=ba,YC=Object,Nw=KC(function(){if(this==null||this!==YC(this))throw new JC("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0),QC=Nw,eI=il.supportsDescriptors,tI=Object.getOwnPropertyDescriptor,jw=function(){if(eI&&/a/mig.flags==="gim"){var e=tI(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var t="",n={};if(Object.defineProperty(n,"hasIndices",{get:function(){t+="d"}}),Object.defineProperty(n,"sticky",{get:function(){t+="y"}}),t==="dy")return e.get}}return QC},rI=il.supportsDescriptors,nI=jw,iI=Object.getOwnPropertyDescriptor,oI=Object.defineProperty,sI=TypeError,j1=Object.getPrototypeOf,aI=/a/,lI=function(){if(!rI||!j1)throw new sI("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=nI(),t=j1(aI),n=iI(t,"flags");return(!n||n.get!==e)&&oI(t,"flags",{configurable:!0,enumerable:!1,get:e}),e},cI=il,uI=Rc,hI=Nw,Uw=jw,fI=lI,Vw=uI(Uw());cI(Vw,{getPolyfill:Uw,implementation:hI,shim:fI});var dI=Vw,Qf={exports:{}},pI=Ud,ol=function(){return pI()&&!!Symbol.toStringTag},mI=ol(),gI=Ro,Ym=gI("Object.prototype.toString"),Vd=function(e){return mI&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:Ym(e)==="[object Arguments]"},qw=function(e){return Vd(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Ym(e)!=="[object Array]"&&Ym(e.callee)==="[object Function]"},_I=function(){return Vd(arguments)}();Vd.isLegacyArguments=qw;var Gw=_I?Vd:qw;const yI={},vI=Object.freeze(Object.defineProperty({__proto__:null,default:yI},Symbol.toStringTag,{value:"Module"})),bI=Dd(vI);var Hg=typeof Map=="function"&&Map.prototype,fm=Object.getOwnPropertyDescriptor&&Hg?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,yd=Hg&&fm&&typeof fm.get=="function"?fm.get:null,U1=Hg&&Map.prototype.forEach,$g=typeof Set=="function"&&Set.prototype,dm=Object.getOwnPropertyDescriptor&&$g?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,vd=$g&&dm&&typeof dm.get=="function"?dm.get:null,V1=$g&&Set.prototype.forEach,wI=typeof WeakMap=="function"&&WeakMap.prototype,ah=wI?WeakMap.prototype.has:null,xI=typeof WeakSet=="function"&&WeakSet.prototype,lh=xI?WeakSet.prototype.has:null,SI=typeof WeakRef=="function"&&WeakRef.prototype,q1=SI?WeakRef.prototype.deref:null,kI=Boolean.prototype.valueOf,TI=Object.prototype.toString,EI=Function.prototype.toString,MI=String.prototype.match,Xg=String.prototype.slice,ca=String.prototype.replace,CI=String.prototype.toUpperCase,G1=String.prototype.toLowerCase,Ww=RegExp.prototype.test,W1=Array.prototype.concat,as=Array.prototype.join,II=Array.prototype.slice,Z1=Math.floor,Qm=typeof BigInt=="function"?BigInt.prototype.valueOf:null,pm=Object.getOwnPropertySymbols,eg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ec=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Di=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ec||"symbol")?Symbol.toStringTag:null,Zw=Object.prototype.propertyIsEnumerable,H1=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function $1(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||Ww.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var n=r<0?-Z1(-r):Z1(r);if(n!==r){var l=String(n),u=Xg.call(e,l.length+1);return ca.call(l,t,"$&_")+"."+ca.call(ca.call(u,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ca.call(e,t,"$&_")}var tg=bI,X1=tg.custom,K1=$w(X1)?X1:null,AI=function r(e,t,n,l){var u=t||{};if(oa(u,"quoteStyle")&&u.quoteStyle!=="single"&&u.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(oa(u,"maxStringLength")&&(typeof u.maxStringLength=="number"?u.maxStringLength<0&&u.maxStringLength!==1/0:u.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var d=oa(u,"customInspect")?u.customInspect:!0;if(typeof d!="boolean"&&d!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(oa(u,"indent")&&u.indent!==null&&u.indent!==" "&&!(parseInt(u.indent,10)===u.indent&&u.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(oa(u,"numericSeparator")&&typeof u.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=u.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Kw(e,u);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var _=String(e);return a?$1(e,_):_}if(typeof e=="bigint"){var x=String(e)+"n";return a?$1(e,x):x}var S=typeof u.depth>"u"?5:u.depth;if(typeof n>"u"&&(n=0),n>=S&&S>0&&typeof e=="object")return rg(e)?"[Array]":"[Object]";var k=$I(u,n);if(typeof l>"u")l=[];else if(Xw(l,e)>=0)return"[Circular]";function C(Ze,Me,ft){if(Me&&(l=II.call(l),l.push(Me)),ft){var Ct={depth:u.depth};return oa(u,"quoteStyle")&&(Ct.quoteStyle=u.quoteStyle),r(Ze,Ct,n+1,l)}return r(Ze,u,n+1,l)}if(typeof e=="function"&&!J1(e)){var P=NI(e),D=Of(e,C);return"[Function"+(P?": "+P:" (anonymous)")+"]"+(D.length>0?" { "+as.call(D,", ")+" }":"")}if($w(e)){var N=Ec?ca.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):eg.call(e);return typeof e=="object"&&!Ec?qu(N):N}if(WI(e)){for(var z="<"+G1.call(String(e.nodeName)),B=e.attributes||[],O=0;O",z}if(rg(e)){if(e.length===0)return"[]";var G=Of(e,C);return k&&!HI(G)?"["+ng(G,k)+"]":"[ "+as.call(G,", ")+" ]"}if(zI(e)){var U=Of(e,C);return!("cause"in Error.prototype)&&"cause"in e&&!Zw.call(e,"cause")?"{ ["+String(e)+"] "+as.call(W1.call("[cause]: "+C(e.cause),U),", ")+" }":U.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+as.call(U,", ")+" }"}if(typeof e=="object"&&d){if(K1&&typeof e[K1]=="function"&&tg)return tg(e,{depth:S-n});if(d!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(jI(e)){var K=[];return U1&&U1.call(e,function(Ze,Me){K.push(C(Me,e,!0)+" => "+C(Ze,e))}),Y1("Map",yd.call(e),K,k)}if(qI(e)){var me=[];return V1&&V1.call(e,function(Ze){me.push(C(Ze,e))}),Y1("Set",vd.call(e),me,k)}if(UI(e))return mm("WeakMap");if(GI(e))return mm("WeakSet");if(VI(e))return mm("WeakRef");if(RI(e))return qu(C(Number(e)));if(FI(e))return qu(C(Qm.call(e)));if(BI(e))return qu(kI.call(e));if(DI(e))return qu(C(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===xh)return"{ [object globalThis] }";if(!PI(e)&&!J1(e)){var X=Of(e,C),Y=H1?H1(e)===Object.prototype:e instanceof Object||e.constructor===Object,_e=e instanceof Object?"":"null prototype",ze=!Y&&Di&&Object(e)===e&&Di in e?Xg.call(wa(e),8,-1):_e?"Object":"",re=Y||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",ce=re+(ze||_e?"["+as.call(W1.call([],ze||[],_e||[]),": ")+"] ":"");return X.length===0?ce+"{}":k?ce+"{"+ng(X,k)+"}":ce+"{ "+as.call(X,", ")+" }"}return String(e)};function Hw(r,e,t){var n=(t.quoteStyle||e)==="double"?'"':"'";return n+r+n}function LI(r){return ca.call(String(r),/"/g,""")}function rg(r){return wa(r)==="[object Array]"&&(!Di||!(typeof r=="object"&&Di in r))}function PI(r){return wa(r)==="[object Date]"&&(!Di||!(typeof r=="object"&&Di in r))}function J1(r){return wa(r)==="[object RegExp]"&&(!Di||!(typeof r=="object"&&Di in r))}function zI(r){return wa(r)==="[object Error]"&&(!Di||!(typeof r=="object"&&Di in r))}function DI(r){return wa(r)==="[object String]"&&(!Di||!(typeof r=="object"&&Di in r))}function RI(r){return wa(r)==="[object Number]"&&(!Di||!(typeof r=="object"&&Di in r))}function BI(r){return wa(r)==="[object Boolean]"&&(!Di||!(typeof r=="object"&&Di in r))}function $w(r){if(Ec)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!eg)return!1;try{return eg.call(r),!0}catch{}return!1}function FI(r){if(!r||typeof r!="object"||!Qm)return!1;try{return Qm.call(r),!0}catch{}return!1}var OI=Object.prototype.hasOwnProperty||function(r){return r in this};function oa(r,e){return OI.call(r,e)}function wa(r){return TI.call(r)}function NI(r){if(r.name)return r.name;var e=MI.call(EI.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function Xw(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,n=r.length;te.maxStringLength){var t=r.length-e.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return Kw(Xg.call(r,0,e.maxStringLength),e)+n}var l=ca.call(ca.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ZI);return Hw(l,"single",e)}function ZI(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+CI.call(e.toString(16))}function qu(r){return"Object("+r+")"}function mm(r){return r+" { ? }"}function Y1(r,e,t,n){var l=n?ng(t,n):as.call(t,", ");return r+" ("+e+") {"+l+"}"}function HI(r){for(var e=0;e=0)return!1;return!0}function $I(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=as.call(Array(r.indent+1)," ");else return null;return{base:t,prev:as.call(Array(e+1),t)}}function ng(r,e){if(r.length===0)return"";var t=` `+e.prev+e.base;return t+as.call(r,","+t)+` -`+e.prev}function Of(r,e){var t=rg(r),n=[];if(t){n.length=r.length;for(var l=0;l=n)return t+1;var l=ov(e,t);if(l<55296||l>56319)return t+1;var u=ov(e,t+1);return u<56320||u>57343?t+1:t+2},_m=function(e){var t=0;return{next:function(){var l=t>=e.length,u;return l||(u=e[t],t+=1),{done:l,value:u}}}},sv=function(e,t){if(_A(e)||tv(e))return _m(e);if(yA(e)){var n=0;return{next:function(){var u=xA(e,n),d=wA(e,n,u);return n=u,{done:u>e.length,value:d}}}}if(t&&typeof e["_es6-shim iterator_"]<"u")return e["_es6-shim iterator_"]()};if(!vA&&!bA)Qf.exports=function(e){if(e!=null)return sv(e,!0)};else{var SA=tx,kA=nx,av=qo("Map.prototype.forEach",!0),lv=qo("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var cv=qo("Map.prototype.iterator",!0),uv=qo("Set.prototype.iterator",!0);var hv=qo("Map.prototype.@@iterator",!0)||qo("Map.prototype._es6-shim iterator_",!0),fv=qo("Set.prototype.@@iterator",!0)||qo("Set.prototype._es6-shim iterator_",!0),TA=function(e){if(SA(e)){if(cv)return rv(cv(e));if(hv)return hv(e);if(av){var t=[];return av(e,function(l,u){iv(t,[u,l])}),_m(t)}}if(kA(e)){if(uv)return rv(uv(e));if(fv)return fv(e);if(lv){var n=[];return lv(e,function(l){iv(n,l)}),_m(n)}}};Qf.exports=function(e){return TA(e)||sv(e)}}}var EA=Qf.exports,dv=function(r){return r!==r},ix=function(e,t){return e===0&&t===0?1/e===1/t:!!(e===t||dv(e)&&dv(t))},MA=ix,ox=function(){return typeof Object.is=="function"?Object.is:MA},CA=ox,IA=il,AA=function(){var e=CA();return IA(Object,{is:e},{is:function(){return Object.is!==e}}),e},LA=il,PA=Rc,zA=ix,sx=ox,DA=AA,ax=PA(sx(),Object);LA(ax,{getPolyfill:sx,implementation:zA,shim:DA});var RA=ax,BA=Rc,lx=Ro,FA=hs,ig=FA("%ArrayBuffer%",!0),ed=lx("ArrayBuffer.prototype.byteLength",!0),OA=lx("Object.prototype.toString"),pv=!!ig&&!ed&&new ig(0).slice,mv=!!pv&&BA(pv),cx=ed||mv?function(e){if(!e||typeof e!="object")return!1;try{return ed?ed(e):mv(e,0),!0}catch{return!1}}:ig?function(e){return OA(e)==="[object ArrayBuffer]"}:function(e){return!1},NA=Date.prototype.getDay,jA=function(e){try{return NA.call(e),!0}catch{return!1}},UA=Object.prototype.toString,VA="[object Date]",qA=ol(),GA=function(e){return typeof e!="object"||e===null?!1:qA?jA(e):UA.call(e)===VA},og=Ro,ux=ol(),hx,fx,sg,ag;if(ux){hx=og("Object.prototype.hasOwnProperty"),fx=og("RegExp.prototype.exec"),sg={};var ym=function(){throw sg};ag={toString:ym,valueOf:ym},typeof Symbol.toPrimitive=="symbol"&&(ag[Symbol.toPrimitive]=ym)}var WA=og("Object.prototype.toString"),ZA=Object.getOwnPropertyDescriptor,HA="[object RegExp]",$A=ux?function(e){if(!e||typeof e!="object")return!1;var t=ZA(e,"lastIndex"),n=t&&hx(t,"value");if(!n)return!1;try{fx(e,ag)}catch(l){return l===sg}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:WA(e)===HA},XA=Ro,gv=XA("SharedArrayBuffer.prototype.byteLength",!0),KA=gv?function(e){if(!e||typeof e!="object")return!1;try{return gv(e),!0}catch{return!1}}:function(e){return!1},JA=Number.prototype.toString,YA=function(e){try{return JA.call(e),!0}catch{return!1}},QA=Object.prototype.toString,eL="[object Number]",tL=ol(),rL=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:tL?YA(e):QA.call(e)===eL},dx=Ro,nL=dx("Boolean.prototype.toString"),iL=dx("Object.prototype.toString"),oL=function(e){try{return nL(e),!0}catch{return!1}},sL="[object Boolean]",aL=ol(),lL=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:aL&&Symbol.toStringTag in e?oL(e):iL(e)===sL},lg={exports:{}},cL=Object.prototype.toString,uL=jg();if(uL){var hL=Symbol.prototype.toString,fL=/^Symbol\(.*\)$/,dL=function(e){return typeof e.valueOf()!="symbol"?!1:fL.test(hL.call(e))};lg.exports=function(e){if(typeof e=="symbol")return!0;if(cL.call(e)!=="[object Symbol]")return!1;try{return dL(e)}catch{return!1}}}else lg.exports=function(e){return!1};var pL=lg.exports,cg={exports:{}},_v=typeof BigInt<"u"&&BigInt,mL=function(){return typeof _v=="function"&&typeof BigInt=="function"&&typeof _v(42)=="bigint"&&typeof BigInt(42)=="bigint"},gL=mL();if(gL){var _L=BigInt.prototype.valueOf,yL=function(e){try{return _L.call(e),!0}catch{}return!1};cg.exports=function(e){return e===null||typeof e>"u"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:yL(e)}}else cg.exports=function(e){return!1};var vL=cg.exports,bL=Qw,wL=rL,xL=lL,SL=pL,kL=vL,TL=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(bL(e))return"String";if(wL(e))return"Number";if(xL(e))return"Boolean";if(SL(e))return"Symbol";if(kL(e))return"BigInt"},xd=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,yv=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Sd;xd||(Sd=function(e){return!1});var ug=xd?xd.prototype.has:null,vm=yv?yv.prototype.has:null;!Sd&&!ug&&(Sd=function(e){return!1});var EL=Sd||function(e){if(!e||typeof e!="object")return!1;try{if(ug.call(e,ug),vm)try{vm.call(e,vm)}catch{return!0}return e instanceof xd}catch{}return!1},hg={exports:{}},ML=hs,px=Ro,CL=ML("%WeakSet%",!0),bm=px("WeakSet.prototype.has",!0);if(bm){var wm=px("WeakMap.prototype.has",!0);hg.exports=function(e){if(!e||typeof e!="object")return!1;try{if(bm(e,bm),wm)try{wm(e,wm)}catch{return!0}return e instanceof CL}catch{}return!1}}else hg.exports=function(e){return!1};var IL=hg.exports,AL=tx,LL=nx,PL=EL,zL=IL,DL=function(e){if(e&&typeof e=="object"){if(AL(e))return"Map";if(LL(e))return"Set";if(PL(e))return"WeakMap";if(zL(e))return"WeakSet"}return!1},mx=Function.prototype.toString,gc=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,fg,td;if(typeof gc=="function"&&typeof Object.defineProperty=="function")try{fg=Object.defineProperty({},"length",{get:function(){throw td}}),td={},gc(function(){throw 42},null,fg)}catch(r){r!==td&&(gc=null)}else gc=null;var RL=/^\s*class\b/,dg=function(e){try{var t=mx.call(e);return RL.test(t)}catch{return!1}},xm=function(e){try{return dg(e)?!1:(mx.call(e),!0)}catch{return!1}},rd=Object.prototype.toString,BL="[object Object]",FL="[object Function]",OL="[object GeneratorFunction]",NL="[object HTMLAllCollection]",jL="[object HTML document.all class]",UL="[object HTMLCollection]",VL=typeof Symbol=="function"&&!!Symbol.toStringTag,qL=!(0 in[,]),pg=function(){return!1};if(typeof document=="object"){var GL=document.all;rd.call(GL)===rd.call(document.all)&&(pg=function(e){if((qL||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=rd.call(e);return(t===NL||t===jL||t===UL||t===BL)&&e("")==null}catch{}return!1})}var WL=gc?function(e){if(pg(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{gc(e,null,fg)}catch(t){if(t!==td)return!1}return!dg(e)&&xm(e)}:function(e){if(pg(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(VL)return xm(e);if(dg(e))return!1;var t=rd.call(e);return t!==FL&&t!==OL&&!/^\[object HTML/.test(t)?!1:xm(e)},ZL=WL,HL=Object.prototype.toString,gx=Object.prototype.hasOwnProperty,$L=function(e,t,n){for(var l=0,u=e.length;l=3&&(l=n),HL.call(e)==="[object Array]"?$L(e,t,l):typeof e=="string"?XL(e,t,l):KL(e,t,l)},YL=JL,QL=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Sm=QL,eP=typeof globalThis>"u"?xh:globalThis,tP=function(){for(var e=[],t=0;t"u"?xh:globalThis,mg=rP(),e_=Qg("String.prototype.slice"),km=Object.getPrototypeOf,iP=Qg("Array.prototype.indexOf",!0)||function(e,t){for(var n=0;n-1?t:t!=="Object"?!1:sP(e)}return nd?oP(e):null},lP=Ro,wv=lP("ArrayBuffer.prototype.byteLength",!0),cP=cx,uP=function(e){return cP(e)?wv?wv(e):e.byteLength:NaN},yx=VC,fs=Ro,xv=fI,hP=hs,Mc=EA,fP=Jw,Sv=RA,kv=qw,Tv=Yw,Ev=cx,Mv=GA,Cv=$A,Iv=KA,Av=Ng,Lv=TL,Pv=DL,zv=aP,Dv=uP,Rv=fs("SharedArrayBuffer.prototype.byteLength",!0),Bv=fs("Date.prototype.getTime"),Tm=Object.getPrototypeOf,Fv=fs("Object.prototype.toString"),Ed=hP("%Set%",!0),gg=fs("Map.prototype.has",!0),Md=fs("Map.prototype.get",!0),Ov=fs("Map.prototype.size",!0),Cd=fs("Set.prototype.add",!0),vx=fs("Set.prototype.delete",!0),Id=fs("Set.prototype.has",!0),id=fs("Set.prototype.size",!0);function Nv(r,e,t,n){for(var l=Mc(r),u;(u=l.next())&&!u.done;)if(Ho(e,u.value,t,n))return vx(r,u.value),!0;return!1}function bx(r){if(typeof r>"u")return null;if(typeof r!="object")return typeof r=="symbol"?!1:typeof r=="string"||typeof r=="number"?+r==+r:!0}function dP(r,e,t,n,l,u){var d=bx(t);if(d!=null)return d;var a=Md(e,d),_=yx({},l,{strict:!1});return typeof a>"u"&&!gg(e,d)||!Ho(n,a,_,u)?!1:!gg(r,d)&&Ho(n,a,_,u)}function pP(r,e,t){var n=bx(t);return n??(Id(e,n)&&!Id(r,n))}function jv(r,e,t,n,l,u){for(var d=Mc(r),a,_;(a=d.next())&&!a.done;)if(_=a.value,Ho(t,_,l,u)&&Ho(n,Md(e,_),l,u))return vx(r,_),!0;return!1}function Ho(r,e,t,n){var l=t||{};if(l.strict?Sv(r,e):r===e)return!0;var u=Lv(r),d=Lv(e);if(u!==d)return!1;if(!r||!e||typeof r!="object"&&typeof e!="object")return l.strict?Sv(r,e):r==e;var a=n.has(r),_=n.has(e),x;if(a&&_){if(n.get(r)===n.get(e))return!0}else x={};return a||n.set(r,x),_||n.set(e,x),_P(r,e,l,n)}function Uv(r){return!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number"?!1:!!(r.constructor&&r.constructor.isBuffer&&r.constructor.isBuffer(r))}function mP(r,e,t,n){if(id(r)!==id(e))return!1;for(var l=Mc(r),u=Mc(e),d,a,_;(d=l.next())&&!d.done;)if(d.value&&typeof d.value=="object")_||(_=new Ed),Cd(_,d.value);else if(!Id(e,d.value)){if(t.strict||!pP(r,e,d.value))return!1;_||(_=new Ed),Cd(_,d.value)}if(_){for(;(a=u.next())&&!a.done;)if(a.value&&typeof a.value=="object"){if(!Nv(_,a.value,t.strict,n))return!1}else if(!t.strict&&!Id(r,a.value)&&!Nv(_,a.value,t.strict,n))return!1;return id(_)===0}return!0}function gP(r,e,t,n){if(Ov(r)!==Ov(e))return!1;for(var l=Mc(r),u=Mc(e),d,a,_,x,S,k;(d=l.next())&&!d.done;)if(x=d.value[0],S=d.value[1],x&&typeof x=="object")_||(_=new Ed),Cd(_,x);else if(k=Md(e,x),typeof k>"u"&&!gg(e,x)||!Ho(S,k,t,n)){if(t.strict||!dP(r,e,x,S,t,n))return!1;_||(_=new Ed),Cd(_,x)}if(_){for(;(a=u.next())&&!a.done;)if(x=a.value[0],k=a.value[1],x&&typeof x=="object"){if(!jv(_,r,x,k,t,n))return!1}else if(!t.strict&&(!r.has(x)||!Ho(Md(r,x),k,t,n))&&!jv(_,r,x,k,yx({},t,{strict:!1}),n))return!1;return id(_)===0}return!0}function _P(r,e,t,n){var l,u;if(typeof r!=typeof e||r==null||e==null||Fv(r)!==Fv(e)||kv(r)!==kv(e))return!1;var d=Tv(r),a=Tv(e);if(d!==a)return!1;var _=r instanceof Error,x=e instanceof Error;if(_!==x||(_||x)&&(r.name!==e.name||r.message!==e.message))return!1;var S=Cv(r),k=Cv(e);if(S!==k||(S||k)&&(r.source!==e.source||xv(r)!==xv(e)))return!1;var C=Mv(r),P=Mv(e);if(C!==P||(C||P)&&Bv(r)!==Bv(e)||t.strict&&Tm&&Tm(r)!==Tm(e))return!1;var D=zv(r),N=zv(e);if(D!==N)return!1;if(D||N){if(r.length!==e.length)return!1;for(l=0;l=0;l--)if(me[l]!=X[l])return!1;for(l=me.length-1;l>=0;l--)if(u=me[l],!Ho(r[u],e[u],t,n))return!1;var Y=Pv(r),_e=Pv(e);return Y!==_e?!1:Y==="Set"||_e==="Set"?mP(r,e,t,n):Y==="Map"?gP(r,e,t,n):!0}var yP=function(e,t,n){return Ho(e,t,n,fP())};const vP=xg(yP);var bP=Object.defineProperty,Hr=(r,e)=>bP(r,"name",{value:e,configurable:!0}),wP=class{constructor(e){this.direction=!1,this.compareProperties=!0;var t,n,l;this.precision=10**-((t=e==null?void 0:e.precision)!=null?t:17),this.direction=(n=e==null?void 0:e.direction)!=null?n:!1,this.compareProperties=(l=e==null?void 0:e.compareProperties)!=null?l:!0}compare(e,t){if(e.type!==t.type||!eh(e,t))return!1;switch(e.type){case"Point":return this.compareCoord(e.coordinates,t.coordinates);case"LineString":return this.compareLine(e.coordinates,t.coordinates);case"Polygon":return this.comparePolygon(e,t);case"GeometryCollection":return this.compareGeometryCollection(e,t);case"Feature":return this.compareFeature(e,t);case"FeatureCollection":return this.compareFeatureCollection(e,t);default:if(e.type.startsWith("Multi")){const n=_g(e),l=_g(t);return n.every(u=>l.some(d=>this.compare(u,d)))}}return!1}compareCoord(e,t){return e.length===t.length&&e.every((n,l)=>Math.abs(n-t[l])=0&&(n=[].concat(e.slice(l,e.length),e.slice(1,l+1))),n}comparePath(e,t){return e.every((n,l)=>this.compareCoord(n,t[l]))}comparePolygon(e,t){if(this.compareLine(e.coordinates[0],t.coordinates[0],1,!0)){const n=e.coordinates.slice(1,e.coordinates.length),l=t.coordinates.slice(1,t.coordinates.length);return n.every(u=>l.some(d=>this.compareLine(u,d,1,!0)))}return!1}compareGeometryCollection(e,t){return eh(e.geometries,t.geometries)&&this.compareBBox(e,t)&&e.geometries.every((n,l)=>this.compare(n,t.geometries[l]))}compareFeature(e,t){return e.id===t.id&&(this.compareProperties?vP(e.properties,t.properties):!0)&&this.compareBBox(e,t)&&this.compare(e.geometry,t.geometry)}compareFeatureCollection(e,t){return eh(e.features,t.features)&&this.compareBBox(e,t)&&e.features.every((n,l)=>this.compare(n,t.features[l]))}compareBBox(e,t){return!e.bbox&&!t.bbox||(e.bbox&&t.bbox?this.compareCoord(e.bbox,t.bbox):!1)}};Hr(wP,"GeojsonEquality");function eh(r,e){return r.coordinates?r.coordinates.length===e.coordinates.length:r.length===e.length}Hr(eh,"sameLength");function _g(r){return r.coordinates.map(e=>({type:r.type.replace("Multi",""),coordinates:e}))}Hr(_g,"explode");var ho=63710088e-1,wx={centimeters:ho*100,centimetres:ho*100,degrees:360/(2*Math.PI),feet:ho*3.28084,inches:ho*39.37,kilometers:ho/1e3,kilometres:ho/1e3,meters:ho,metres:ho,miles:ho/1609.344,millimeters:ho*1e3,millimetres:ho*1e3,nauticalmiles:ho/1852,radians:1,yards:ho*1.0936},Vv={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function xa(r,e,t={}){const n={type:"Feature"};return(t.id===0||t.id)&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.properties=e||{},n.geometry=r,n}Hr(xa,"feature");function xP(r,e,t={}){switch(r){case"Point":return Cc(e).geometry;case"LineString":return r_(e).geometry;case"Polygon":return t_(e).geometry;case"MultiPoint":return Sx(e).geometry;case"MultiLineString":return xx(e).geometry;case"MultiPolygon":return kx(e).geometry;default:throw new Error(r+" is invalid")}}Hr(xP,"geometry");function Cc(r,e,t={}){if(!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ic(r[0])||!Ic(r[1]))throw new Error("coordinates must contain numbers");return xa({type:"Point",coordinates:r},e,t)}Hr(Cc,"point");function SP(r,e,t={}){return qd(r.map(n=>Cc(n,e)),t)}Hr(SP,"points");function t_(r,e,t={}){for(const l of r){if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(l[l.length-1].length!==l[0].length)throw new Error("First and last Position are not equivalent.");for(let u=0;ut_(n,e)),t)}Hr(kP,"polygons");function r_(r,e,t={}){if(r.length<2)throw new Error("coordinates must be an array of two or more positions");return xa({type:"LineString",coordinates:r},e,t)}Hr(r_,"lineString");function TP(r,e,t={}){return qd(r.map(n=>r_(n,e)),t)}Hr(TP,"lineStrings");function qd(r,e={}){const t={type:"FeatureCollection"};return e.id&&(t.id=e.id),e.bbox&&(t.bbox=e.bbox),t.features=r,t}Hr(qd,"featureCollection");function xx(r,e,t={}){return xa({type:"MultiLineString",coordinates:r},e,t)}Hr(xx,"multiLineString");function Sx(r,e,t={}){return xa({type:"MultiPoint",coordinates:r},e,t)}Hr(Sx,"multiPoint");function kx(r,e,t={}){return xa({type:"MultiPolygon",coordinates:r},e,t)}Hr(kx,"multiPolygon");function EP(r,e,t={}){return xa({type:"GeometryCollection",geometries:r},e,t)}Hr(EP,"geometryCollection");function MP(r,e=0){if(e&&!(e>=0))throw new Error("precision must be a positive number");const t=Math.pow(10,e||0);return Math.round(r*t)/t}Hr(MP,"round");function n_(r,e="kilometers"){const t=wx[e];if(!t)throw new Error(e+" units is invalid");return r*t}Hr(n_,"radiansToLength");function Gd(r,e="kilometers"){const t=wx[e];if(!t)throw new Error(e+" units is invalid");return r/t}Hr(Gd,"lengthToRadians");function CP(r,e){return bh(Gd(r,e))}Hr(CP,"lengthToDegrees");function IP(r){let e=r%360;return e<0&&(e+=360),e}Hr(IP,"bearingToAzimuth");function bh(r){return r%(2*Math.PI)*180/Math.PI}Hr(bh,"radiansToDegrees");function Lo(r){return r%360*Math.PI/180}Hr(Lo,"degreesToRadians");function AP(r,e="kilometers",t="kilometers"){if(!(r>=0))throw new Error("length must be a positive number");return n_(Gd(r,e),t)}Hr(AP,"convertLength");function LP(r,e="meters",t="kilometers"){if(!(r>=0))throw new Error("area must be a positive number");const n=Vv[e];if(!n)throw new Error("invalid original units");const l=Vv[t];if(!l)throw new Error("invalid final units");return r/n*l}Hr(LP,"convertArea");function Ic(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}Hr(Ic,"isNumber");function PP(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}Hr(PP,"isObject");function zP(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(e=>{if(!Ic(e))throw new Error("bbox must only contain numbers")})}Hr(zP,"validateBBox");function DP(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}Hr(DP,"validateId");var RP=Object.defineProperty,Sa=(r,e)=>RP(r,"name",{value:e,configurable:!0});function Ac(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return[...r.geometry.coordinates];if(r.type==="Point")return[...r.coordinates]}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return[...r];throw new Error("coord must be GeoJSON Point or an Array of numbers")}Sa(Ac,"getCoord");function BP(r){if(Array.isArray(r))return r;if(r.type==="Feature"){if(r.geometry!==null)return r.geometry.coordinates}else if(r.coordinates)return r.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}Sa(BP,"getCoords");function Tx(r){if(r.length>1&&Ic(r[0])&&Ic(r[1]))return!0;if(Array.isArray(r[0])&&r[0].length)return Tx(r[0]);throw new Error("coordinates must only contain numbers")}Sa(Tx,"containsNumber");function FP(r,e,t){if(!e||!t)throw new Error("type and name required");if(!r||r.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+r.type)}Sa(FP,"geojsonType");function OP(r,e,t){if(!r)throw new Error("No feature passed");if(!t)throw new Error(".featureOf() requires a name");if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+t+", Feature with geometry required");if(!r.geometry||r.geometry.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+r.geometry.type)}Sa(OP,"featureOf");function NP(r,e,t){if(!r)throw new Error("No featureCollection passed");if(!t)throw new Error(".collectionOf() requires a name");if(!r||r.type!=="FeatureCollection")throw new Error("Invalid input to "+t+", FeatureCollection required");for(const n of r.features){if(!n||n.type!=="Feature"||!n.geometry)throw new Error("Invalid input to "+t+", Feature with geometry required");if(!n.geometry||n.geometry.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+n.geometry.type)}}Sa(NP,"collectionOf");function Ex(r){return r.type==="Feature"?r.geometry:r}Sa(Ex,"getGeom");function jP(r,e){return r.type==="FeatureCollection"?"FeatureCollection":r.type==="GeometryCollection"?"GeometryCollection":r.type==="Feature"&&r.geometry!==null?r.geometry.type:r.type}Sa(jP,"getType");var UP=Object.defineProperty,Mx=(r,e)=>UP(r,"name",{value:e,configurable:!0});function i_(r,e,t={}){if(t.final===!0)return Cx(r,e);const n=Ac(r),l=Ac(e),u=Lo(n[0]),d=Lo(l[0]),a=Lo(n[1]),_=Lo(l[1]),x=Math.sin(d-u)*Math.cos(_),S=Math.cos(a)*Math.sin(_)-Math.sin(a)*Math.cos(_)*Math.cos(d-u);return bh(Math.atan2(x,S))}Mx(i_,"bearing");function Cx(r,e){let t=i_(e,r);return t=(t+180)%360,t}Mx(Cx,"calculateFinalBearing");var VP=Object.defineProperty,qP=(r,e)=>VP(r,"name",{value:e,configurable:!0});function Ix(r,e,t,n={}){const l=Ac(r),u=Lo(l[0]),d=Lo(l[1]),a=Lo(t),_=Gd(e,n.units),x=Math.asin(Math.sin(d)*Math.cos(_)+Math.cos(d)*Math.sin(_)*Math.cos(a)),S=u+Math.atan2(Math.sin(a)*Math.sin(_)*Math.cos(d),Math.cos(_)-Math.sin(d)*Math.sin(x)),k=bh(S),C=bh(x);return Cc([k,C],n.properties)}qP(Ix,"destination");var GP=Object.defineProperty,WP=(r,e)=>GP(r,"name",{value:e,configurable:!0});function Ax(r,e,t={}){var n=Ac(r),l=Ac(e),u=Lo(l[1]-n[1]),d=Lo(l[0]-n[0]),a=Lo(n[1]),_=Lo(l[1]),x=Math.pow(Math.sin(u/2),2)+Math.pow(Math.sin(d/2),2)*Math.cos(a)*Math.cos(_);return n_(2*Math.atan2(Math.sqrt(x),Math.sqrt(1-x)),t.units)}WP(Ax,"distance");var ZP=Object.defineProperty,HP=(r,e)=>ZP(r,"name",{value:e,configurable:!0});function Lx(r,e,t={}){const l=Ex(r).coordinates;let u=0;for(let d=0;d=u&&d===l.length-1);d++)if(u>=e){const a=e-u;if(a){const _=i_(l[d],l[d-1])-180;return Ix(l[d],a,_,t)}else return Cc(l[d])}else u+=Ax(l[d],l[d+1],t);return Cc(l[l.length-1])}HP(Lx,"along");var $P=Lx;function XP(r){let e,t;const n=[Hn("animate-shortcuts"),{paint:{"circle-radius":10,"circle-color":"purple","circle-stroke-color":"black","circle-stroke-width":1}}];let l={};for(let u=0;uclearInterval(a));function _(){return n.features.map(P=>1/P.properties.directness).reduce((P,D)=>P+D,0)}function x(){return n.features.length==0?[]:Array.from({length:JP},S)}function S(){let P=Math.random()*l,D=0;for(let[N,z]of n.features.entries())if(D+=1/z.properties.directness,P$P(n.features[P],D,{units:"kilometers"}))}}function C(){for(let[P,D]of u.entries())D.distance+=QP,D.distance>=n.features[D.idx].properties.length_meters/1e3&&(u[P]=S());t(0,d=k())}return r.$$set=P=>{"paths"in P&&t(1,n=P.paths)},r.$$.update=()=>{r.$$.dirty&2&&n&&(l=_(),u=x())},[d,n]}class t6 extends Ht{constructor(e){super(),Zt(this,e,e6,KP,Ut,{paths:1})}}function r6(r){let e;return{c(){e=rt("Choose project")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function n6(r){let e;return{c(){e=rt("Pick neighbourhood")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function i6(r){let e;return{c(){e=fe("p"),e.textContent=`Now that you've defined a neighbourhood boundary, you can see the +`+e.prev}function Of(r,e){var t=rg(r),n=[];if(t){n.length=r.length;for(var l=0;l=n)return t+1;var l=sv(e,t);if(l<55296||l>56319)return t+1;var u=sv(e,t+1);return u<56320||u>57343?t+1:t+2},_m=function(e){var t=0;return{next:function(){var l=t>=e.length,u;return l||(u=e[t],t+=1),{done:l,value:u}}}},av=function(e,t){if(yA(e)||rv(e))return _m(e);if(vA(e)){var n=0;return{next:function(){var u=SA(e,n),d=xA(e,n,u);return n=u,{done:u>e.length,value:d}}}}if(t&&typeof e["_es6-shim iterator_"]<"u")return e["_es6-shim iterator_"]()};if(!bA&&!wA)Qf.exports=function(e){if(e!=null)return av(e,!0)};else{var kA=rx,TA=ix,lv=qo("Map.prototype.forEach",!0),cv=qo("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var uv=qo("Map.prototype.iterator",!0),hv=qo("Set.prototype.iterator",!0);var fv=qo("Map.prototype.@@iterator",!0)||qo("Map.prototype._es6-shim iterator_",!0),dv=qo("Set.prototype.@@iterator",!0)||qo("Set.prototype._es6-shim iterator_",!0),EA=function(e){if(kA(e)){if(uv)return nv(uv(e));if(fv)return fv(e);if(lv){var t=[];return lv(e,function(l,u){ov(t,[u,l])}),_m(t)}}if(TA(e)){if(hv)return nv(hv(e));if(dv)return dv(e);if(cv){var n=[];return cv(e,function(l){ov(n,l)}),_m(n)}}};Qf.exports=function(e){return EA(e)||av(e)}}}var MA=Qf.exports,pv=function(r){return r!==r},ox=function(e,t){return e===0&&t===0?1/e===1/t:!!(e===t||pv(e)&&pv(t))},CA=ox,sx=function(){return typeof Object.is=="function"?Object.is:CA},IA=sx,AA=il,LA=function(){var e=IA();return AA(Object,{is:e},{is:function(){return Object.is!==e}}),e},PA=il,zA=Rc,DA=ox,ax=sx,RA=LA,lx=zA(ax(),Object);PA(lx,{getPolyfill:ax,implementation:DA,shim:RA});var BA=lx,FA=Rc,cx=Ro,OA=hs,ig=OA("%ArrayBuffer%",!0),ed=cx("ArrayBuffer.prototype.byteLength",!0),NA=cx("Object.prototype.toString"),mv=!!ig&&!ed&&new ig(0).slice,gv=!!mv&&FA(mv),ux=ed||gv?function(e){if(!e||typeof e!="object")return!1;try{return ed?ed(e):gv(e,0),!0}catch{return!1}}:ig?function(e){return NA(e)==="[object ArrayBuffer]"}:function(e){return!1},jA=Date.prototype.getDay,UA=function(e){try{return jA.call(e),!0}catch{return!1}},VA=Object.prototype.toString,qA="[object Date]",GA=ol(),WA=function(e){return typeof e!="object"||e===null?!1:GA?UA(e):VA.call(e)===qA},og=Ro,hx=ol(),fx,dx,sg,ag;if(hx){fx=og("Object.prototype.hasOwnProperty"),dx=og("RegExp.prototype.exec"),sg={};var ym=function(){throw sg};ag={toString:ym,valueOf:ym},typeof Symbol.toPrimitive=="symbol"&&(ag[Symbol.toPrimitive]=ym)}var ZA=og("Object.prototype.toString"),HA=Object.getOwnPropertyDescriptor,$A="[object RegExp]",XA=hx?function(e){if(!e||typeof e!="object")return!1;var t=HA(e,"lastIndex"),n=t&&fx(t,"value");if(!n)return!1;try{dx(e,ag)}catch(l){return l===sg}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:ZA(e)===$A},KA=Ro,_v=KA("SharedArrayBuffer.prototype.byteLength",!0),JA=_v?function(e){if(!e||typeof e!="object")return!1;try{return _v(e),!0}catch{return!1}}:function(e){return!1},YA=Number.prototype.toString,QA=function(e){try{return YA.call(e),!0}catch{return!1}},eL=Object.prototype.toString,tL="[object Number]",rL=ol(),nL=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:rL?QA(e):eL.call(e)===tL},px=Ro,iL=px("Boolean.prototype.toString"),oL=px("Object.prototype.toString"),sL=function(e){try{return iL(e),!0}catch{return!1}},aL="[object Boolean]",lL=ol(),cL=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:lL&&Symbol.toStringTag in e?sL(e):oL(e)===aL},lg={exports:{}},uL=Object.prototype.toString,hL=Ug();if(hL){var fL=Symbol.prototype.toString,dL=/^Symbol\(.*\)$/,pL=function(e){return typeof e.valueOf()!="symbol"?!1:dL.test(fL.call(e))};lg.exports=function(e){if(typeof e=="symbol")return!0;if(uL.call(e)!=="[object Symbol]")return!1;try{return pL(e)}catch{return!1}}}else lg.exports=function(e){return!1};var mL=lg.exports,cg={exports:{}},yv=typeof BigInt<"u"&&BigInt,gL=function(){return typeof yv=="function"&&typeof BigInt=="function"&&typeof yv(42)=="bigint"&&typeof BigInt(42)=="bigint"},_L=gL();if(_L){var yL=BigInt.prototype.valueOf,vL=function(e){try{return yL.call(e),!0}catch{}return!1};cg.exports=function(e){return e===null||typeof e>"u"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:vL(e)}}else cg.exports=function(e){return!1};var bL=cg.exports,wL=ex,xL=nL,SL=cL,kL=mL,TL=bL,EL=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(wL(e))return"String";if(xL(e))return"Number";if(SL(e))return"Boolean";if(kL(e))return"Symbol";if(TL(e))return"BigInt"},xd=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,vv=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Sd;xd||(Sd=function(e){return!1});var ug=xd?xd.prototype.has:null,vm=vv?vv.prototype.has:null;!Sd&&!ug&&(Sd=function(e){return!1});var ML=Sd||function(e){if(!e||typeof e!="object")return!1;try{if(ug.call(e,ug),vm)try{vm.call(e,vm)}catch{return!0}return e instanceof xd}catch{}return!1},hg={exports:{}},CL=hs,mx=Ro,IL=CL("%WeakSet%",!0),bm=mx("WeakSet.prototype.has",!0);if(bm){var wm=mx("WeakMap.prototype.has",!0);hg.exports=function(e){if(!e||typeof e!="object")return!1;try{if(bm(e,bm),wm)try{wm(e,wm)}catch{return!0}return e instanceof IL}catch{}return!1}}else hg.exports=function(e){return!1};var AL=hg.exports,LL=rx,PL=ix,zL=ML,DL=AL,RL=function(e){if(e&&typeof e=="object"){if(LL(e))return"Map";if(PL(e))return"Set";if(zL(e))return"WeakMap";if(DL(e))return"WeakSet"}return!1},gx=Function.prototype.toString,gc=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,fg,td;if(typeof gc=="function"&&typeof Object.defineProperty=="function")try{fg=Object.defineProperty({},"length",{get:function(){throw td}}),td={},gc(function(){throw 42},null,fg)}catch(r){r!==td&&(gc=null)}else gc=null;var BL=/^\s*class\b/,dg=function(e){try{var t=gx.call(e);return BL.test(t)}catch{return!1}},xm=function(e){try{return dg(e)?!1:(gx.call(e),!0)}catch{return!1}},rd=Object.prototype.toString,FL="[object Object]",OL="[object Function]",NL="[object GeneratorFunction]",jL="[object HTMLAllCollection]",UL="[object HTML document.all class]",VL="[object HTMLCollection]",qL=typeof Symbol=="function"&&!!Symbol.toStringTag,GL=!(0 in[,]),pg=function(){return!1};if(typeof document=="object"){var WL=document.all;rd.call(WL)===rd.call(document.all)&&(pg=function(e){if((GL||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=rd.call(e);return(t===jL||t===UL||t===VL||t===FL)&&e("")==null}catch{}return!1})}var ZL=gc?function(e){if(pg(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{gc(e,null,fg)}catch(t){if(t!==td)return!1}return!dg(e)&&xm(e)}:function(e){if(pg(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(qL)return xm(e);if(dg(e))return!1;var t=rd.call(e);return t!==OL&&t!==NL&&!/^\[object HTML/.test(t)?!1:xm(e)},HL=ZL,$L=Object.prototype.toString,_x=Object.prototype.hasOwnProperty,XL=function(e,t,n){for(var l=0,u=e.length;l=3&&(l=n),$L.call(e)==="[object Array]"?XL(e,t,l):typeof e=="string"?KL(e,t,l):JL(e,t,l)},QL=YL,eP=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Sm=eP,tP=typeof globalThis>"u"?xh:globalThis,rP=function(){for(var e=[],t=0;t"u"?xh:globalThis,mg=nP(),t_=e_("String.prototype.slice"),km=Object.getPrototypeOf,oP=e_("Array.prototype.indexOf",!0)||function(e,t){for(var n=0;n-1?t:t!=="Object"?!1:aP(e)}return nd?sP(e):null},cP=Ro,xv=cP("ArrayBuffer.prototype.byteLength",!0),uP=ux,hP=function(e){return uP(e)?xv?xv(e):e.byteLength:NaN},vx=qC,fs=Ro,Sv=dI,fP=hs,Mc=MA,dP=Yw,kv=BA,Tv=Gw,Ev=Qw,Mv=ux,Cv=WA,Iv=XA,Av=JA,Lv=jg,Pv=EL,zv=RL,Dv=lP,Rv=hP,Bv=fs("SharedArrayBuffer.prototype.byteLength",!0),Fv=fs("Date.prototype.getTime"),Tm=Object.getPrototypeOf,Ov=fs("Object.prototype.toString"),Ed=fP("%Set%",!0),gg=fs("Map.prototype.has",!0),Md=fs("Map.prototype.get",!0),Nv=fs("Map.prototype.size",!0),Cd=fs("Set.prototype.add",!0),bx=fs("Set.prototype.delete",!0),Id=fs("Set.prototype.has",!0),id=fs("Set.prototype.size",!0);function jv(r,e,t,n){for(var l=Mc(r),u;(u=l.next())&&!u.done;)if(Ho(e,u.value,t,n))return bx(r,u.value),!0;return!1}function wx(r){if(typeof r>"u")return null;if(typeof r!="object")return typeof r=="symbol"?!1:typeof r=="string"||typeof r=="number"?+r==+r:!0}function pP(r,e,t,n,l,u){var d=wx(t);if(d!=null)return d;var a=Md(e,d),_=vx({},l,{strict:!1});return typeof a>"u"&&!gg(e,d)||!Ho(n,a,_,u)?!1:!gg(r,d)&&Ho(n,a,_,u)}function mP(r,e,t){var n=wx(t);return n??(Id(e,n)&&!Id(r,n))}function Uv(r,e,t,n,l,u){for(var d=Mc(r),a,_;(a=d.next())&&!a.done;)if(_=a.value,Ho(t,_,l,u)&&Ho(n,Md(e,_),l,u))return bx(r,_),!0;return!1}function Ho(r,e,t,n){var l=t||{};if(l.strict?kv(r,e):r===e)return!0;var u=Pv(r),d=Pv(e);if(u!==d)return!1;if(!r||!e||typeof r!="object"&&typeof e!="object")return l.strict?kv(r,e):r==e;var a=n.has(r),_=n.has(e),x;if(a&&_){if(n.get(r)===n.get(e))return!0}else x={};return a||n.set(r,x),_||n.set(e,x),yP(r,e,l,n)}function Vv(r){return!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number"?!1:!!(r.constructor&&r.constructor.isBuffer&&r.constructor.isBuffer(r))}function gP(r,e,t,n){if(id(r)!==id(e))return!1;for(var l=Mc(r),u=Mc(e),d,a,_;(d=l.next())&&!d.done;)if(d.value&&typeof d.value=="object")_||(_=new Ed),Cd(_,d.value);else if(!Id(e,d.value)){if(t.strict||!mP(r,e,d.value))return!1;_||(_=new Ed),Cd(_,d.value)}if(_){for(;(a=u.next())&&!a.done;)if(a.value&&typeof a.value=="object"){if(!jv(_,a.value,t.strict,n))return!1}else if(!t.strict&&!Id(r,a.value)&&!jv(_,a.value,t.strict,n))return!1;return id(_)===0}return!0}function _P(r,e,t,n){if(Nv(r)!==Nv(e))return!1;for(var l=Mc(r),u=Mc(e),d,a,_,x,S,k;(d=l.next())&&!d.done;)if(x=d.value[0],S=d.value[1],x&&typeof x=="object")_||(_=new Ed),Cd(_,x);else if(k=Md(e,x),typeof k>"u"&&!gg(e,x)||!Ho(S,k,t,n)){if(t.strict||!pP(r,e,x,S,t,n))return!1;_||(_=new Ed),Cd(_,x)}if(_){for(;(a=u.next())&&!a.done;)if(x=a.value[0],k=a.value[1],x&&typeof x=="object"){if(!Uv(_,r,x,k,t,n))return!1}else if(!t.strict&&(!r.has(x)||!Ho(Md(r,x),k,t,n))&&!Uv(_,r,x,k,vx({},t,{strict:!1}),n))return!1;return id(_)===0}return!0}function yP(r,e,t,n){var l,u;if(typeof r!=typeof e||r==null||e==null||Ov(r)!==Ov(e)||Tv(r)!==Tv(e))return!1;var d=Ev(r),a=Ev(e);if(d!==a)return!1;var _=r instanceof Error,x=e instanceof Error;if(_!==x||(_||x)&&(r.name!==e.name||r.message!==e.message))return!1;var S=Iv(r),k=Iv(e);if(S!==k||(S||k)&&(r.source!==e.source||Sv(r)!==Sv(e)))return!1;var C=Cv(r),P=Cv(e);if(C!==P||(C||P)&&Fv(r)!==Fv(e)||t.strict&&Tm&&Tm(r)!==Tm(e))return!1;var D=Dv(r),N=Dv(e);if(D!==N)return!1;if(D||N){if(r.length!==e.length)return!1;for(l=0;l=0;l--)if(me[l]!=X[l])return!1;for(l=me.length-1;l>=0;l--)if(u=me[l],!Ho(r[u],e[u],t,n))return!1;var Y=zv(r),_e=zv(e);return Y!==_e?!1:Y==="Set"||_e==="Set"?gP(r,e,t,n):Y==="Map"?_P(r,e,t,n):!0}var vP=function(e,t,n){return Ho(e,t,n,dP())};const bP=Sg(vP);var wP=Object.defineProperty,Hr=(r,e)=>wP(r,"name",{value:e,configurable:!0}),xP=class{constructor(e){this.direction=!1,this.compareProperties=!0;var t,n,l;this.precision=10**-((t=e==null?void 0:e.precision)!=null?t:17),this.direction=(n=e==null?void 0:e.direction)!=null?n:!1,this.compareProperties=(l=e==null?void 0:e.compareProperties)!=null?l:!0}compare(e,t){if(e.type!==t.type||!eh(e,t))return!1;switch(e.type){case"Point":return this.compareCoord(e.coordinates,t.coordinates);case"LineString":return this.compareLine(e.coordinates,t.coordinates);case"Polygon":return this.comparePolygon(e,t);case"GeometryCollection":return this.compareGeometryCollection(e,t);case"Feature":return this.compareFeature(e,t);case"FeatureCollection":return this.compareFeatureCollection(e,t);default:if(e.type.startsWith("Multi")){const n=_g(e),l=_g(t);return n.every(u=>l.some(d=>this.compare(u,d)))}}return!1}compareCoord(e,t){return e.length===t.length&&e.every((n,l)=>Math.abs(n-t[l])=0&&(n=[].concat(e.slice(l,e.length),e.slice(1,l+1))),n}comparePath(e,t){return e.every((n,l)=>this.compareCoord(n,t[l]))}comparePolygon(e,t){if(this.compareLine(e.coordinates[0],t.coordinates[0],1,!0)){const n=e.coordinates.slice(1,e.coordinates.length),l=t.coordinates.slice(1,t.coordinates.length);return n.every(u=>l.some(d=>this.compareLine(u,d,1,!0)))}return!1}compareGeometryCollection(e,t){return eh(e.geometries,t.geometries)&&this.compareBBox(e,t)&&e.geometries.every((n,l)=>this.compare(n,t.geometries[l]))}compareFeature(e,t){return e.id===t.id&&(this.compareProperties?bP(e.properties,t.properties):!0)&&this.compareBBox(e,t)&&this.compare(e.geometry,t.geometry)}compareFeatureCollection(e,t){return eh(e.features,t.features)&&this.compareBBox(e,t)&&e.features.every((n,l)=>this.compare(n,t.features[l]))}compareBBox(e,t){return!e.bbox&&!t.bbox||(e.bbox&&t.bbox?this.compareCoord(e.bbox,t.bbox):!1)}};Hr(xP,"GeojsonEquality");function eh(r,e){return r.coordinates?r.coordinates.length===e.coordinates.length:r.length===e.length}Hr(eh,"sameLength");function _g(r){return r.coordinates.map(e=>({type:r.type.replace("Multi",""),coordinates:e}))}Hr(_g,"explode");var ho=63710088e-1,xx={centimeters:ho*100,centimetres:ho*100,degrees:360/(2*Math.PI),feet:ho*3.28084,inches:ho*39.37,kilometers:ho/1e3,kilometres:ho/1e3,meters:ho,metres:ho,miles:ho/1609.344,millimeters:ho*1e3,millimetres:ho*1e3,nauticalmiles:ho/1852,radians:1,yards:ho*1.0936},qv={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function xa(r,e,t={}){const n={type:"Feature"};return(t.id===0||t.id)&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.properties=e||{},n.geometry=r,n}Hr(xa,"feature");function SP(r,e,t={}){switch(r){case"Point":return Cc(e).geometry;case"LineString":return n_(e).geometry;case"Polygon":return r_(e).geometry;case"MultiPoint":return kx(e).geometry;case"MultiLineString":return Sx(e).geometry;case"MultiPolygon":return Tx(e).geometry;default:throw new Error(r+" is invalid")}}Hr(SP,"geometry");function Cc(r,e,t={}){if(!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ic(r[0])||!Ic(r[1]))throw new Error("coordinates must contain numbers");return xa({type:"Point",coordinates:r},e,t)}Hr(Cc,"point");function kP(r,e,t={}){return qd(r.map(n=>Cc(n,e)),t)}Hr(kP,"points");function r_(r,e,t={}){for(const l of r){if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(l[l.length-1].length!==l[0].length)throw new Error("First and last Position are not equivalent.");for(let u=0;ur_(n,e)),t)}Hr(TP,"polygons");function n_(r,e,t={}){if(r.length<2)throw new Error("coordinates must be an array of two or more positions");return xa({type:"LineString",coordinates:r},e,t)}Hr(n_,"lineString");function EP(r,e,t={}){return qd(r.map(n=>n_(n,e)),t)}Hr(EP,"lineStrings");function qd(r,e={}){const t={type:"FeatureCollection"};return e.id&&(t.id=e.id),e.bbox&&(t.bbox=e.bbox),t.features=r,t}Hr(qd,"featureCollection");function Sx(r,e,t={}){return xa({type:"MultiLineString",coordinates:r},e,t)}Hr(Sx,"multiLineString");function kx(r,e,t={}){return xa({type:"MultiPoint",coordinates:r},e,t)}Hr(kx,"multiPoint");function Tx(r,e,t={}){return xa({type:"MultiPolygon",coordinates:r},e,t)}Hr(Tx,"multiPolygon");function MP(r,e,t={}){return xa({type:"GeometryCollection",geometries:r},e,t)}Hr(MP,"geometryCollection");function CP(r,e=0){if(e&&!(e>=0))throw new Error("precision must be a positive number");const t=Math.pow(10,e||0);return Math.round(r*t)/t}Hr(CP,"round");function i_(r,e="kilometers"){const t=xx[e];if(!t)throw new Error(e+" units is invalid");return r*t}Hr(i_,"radiansToLength");function Gd(r,e="kilometers"){const t=xx[e];if(!t)throw new Error(e+" units is invalid");return r/t}Hr(Gd,"lengthToRadians");function IP(r,e){return bh(Gd(r,e))}Hr(IP,"lengthToDegrees");function AP(r){let e=r%360;return e<0&&(e+=360),e}Hr(AP,"bearingToAzimuth");function bh(r){return r%(2*Math.PI)*180/Math.PI}Hr(bh,"radiansToDegrees");function Lo(r){return r%360*Math.PI/180}Hr(Lo,"degreesToRadians");function LP(r,e="kilometers",t="kilometers"){if(!(r>=0))throw new Error("length must be a positive number");return i_(Gd(r,e),t)}Hr(LP,"convertLength");function PP(r,e="meters",t="kilometers"){if(!(r>=0))throw new Error("area must be a positive number");const n=qv[e];if(!n)throw new Error("invalid original units");const l=qv[t];if(!l)throw new Error("invalid final units");return r/n*l}Hr(PP,"convertArea");function Ic(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}Hr(Ic,"isNumber");function zP(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}Hr(zP,"isObject");function DP(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(e=>{if(!Ic(e))throw new Error("bbox must only contain numbers")})}Hr(DP,"validateBBox");function RP(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}Hr(RP,"validateId");var BP=Object.defineProperty,Sa=(r,e)=>BP(r,"name",{value:e,configurable:!0});function Ac(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return[...r.geometry.coordinates];if(r.type==="Point")return[...r.coordinates]}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return[...r];throw new Error("coord must be GeoJSON Point or an Array of numbers")}Sa(Ac,"getCoord");function FP(r){if(Array.isArray(r))return r;if(r.type==="Feature"){if(r.geometry!==null)return r.geometry.coordinates}else if(r.coordinates)return r.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}Sa(FP,"getCoords");function Ex(r){if(r.length>1&&Ic(r[0])&&Ic(r[1]))return!0;if(Array.isArray(r[0])&&r[0].length)return Ex(r[0]);throw new Error("coordinates must only contain numbers")}Sa(Ex,"containsNumber");function OP(r,e,t){if(!e||!t)throw new Error("type and name required");if(!r||r.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+r.type)}Sa(OP,"geojsonType");function NP(r,e,t){if(!r)throw new Error("No feature passed");if(!t)throw new Error(".featureOf() requires a name");if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+t+", Feature with geometry required");if(!r.geometry||r.geometry.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+r.geometry.type)}Sa(NP,"featureOf");function jP(r,e,t){if(!r)throw new Error("No featureCollection passed");if(!t)throw new Error(".collectionOf() requires a name");if(!r||r.type!=="FeatureCollection")throw new Error("Invalid input to "+t+", FeatureCollection required");for(const n of r.features){if(!n||n.type!=="Feature"||!n.geometry)throw new Error("Invalid input to "+t+", Feature with geometry required");if(!n.geometry||n.geometry.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+n.geometry.type)}}Sa(jP,"collectionOf");function Mx(r){return r.type==="Feature"?r.geometry:r}Sa(Mx,"getGeom");function UP(r,e){return r.type==="FeatureCollection"?"FeatureCollection":r.type==="GeometryCollection"?"GeometryCollection":r.type==="Feature"&&r.geometry!==null?r.geometry.type:r.type}Sa(UP,"getType");var VP=Object.defineProperty,Cx=(r,e)=>VP(r,"name",{value:e,configurable:!0});function o_(r,e,t={}){if(t.final===!0)return Ix(r,e);const n=Ac(r),l=Ac(e),u=Lo(n[0]),d=Lo(l[0]),a=Lo(n[1]),_=Lo(l[1]),x=Math.sin(d-u)*Math.cos(_),S=Math.cos(a)*Math.sin(_)-Math.sin(a)*Math.cos(_)*Math.cos(d-u);return bh(Math.atan2(x,S))}Cx(o_,"bearing");function Ix(r,e){let t=o_(e,r);return t=(t+180)%360,t}Cx(Ix,"calculateFinalBearing");var qP=Object.defineProperty,GP=(r,e)=>qP(r,"name",{value:e,configurable:!0});function Ax(r,e,t,n={}){const l=Ac(r),u=Lo(l[0]),d=Lo(l[1]),a=Lo(t),_=Gd(e,n.units),x=Math.asin(Math.sin(d)*Math.cos(_)+Math.cos(d)*Math.sin(_)*Math.cos(a)),S=u+Math.atan2(Math.sin(a)*Math.sin(_)*Math.cos(d),Math.cos(_)-Math.sin(d)*Math.sin(x)),k=bh(S),C=bh(x);return Cc([k,C],n.properties)}GP(Ax,"destination");var WP=Object.defineProperty,ZP=(r,e)=>WP(r,"name",{value:e,configurable:!0});function Lx(r,e,t={}){var n=Ac(r),l=Ac(e),u=Lo(l[1]-n[1]),d=Lo(l[0]-n[0]),a=Lo(n[1]),_=Lo(l[1]),x=Math.pow(Math.sin(u/2),2)+Math.pow(Math.sin(d/2),2)*Math.cos(a)*Math.cos(_);return i_(2*Math.atan2(Math.sqrt(x),Math.sqrt(1-x)),t.units)}ZP(Lx,"distance");var HP=Object.defineProperty,$P=(r,e)=>HP(r,"name",{value:e,configurable:!0});function Px(r,e,t={}){const l=Mx(r).coordinates;let u=0;for(let d=0;d=u&&d===l.length-1);d++)if(u>=e){const a=e-u;if(a){const _=o_(l[d],l[d-1])-180;return Ax(l[d],a,_,t)}else return Cc(l[d])}else u+=Lx(l[d],l[d+1],t);return Cc(l[l.length-1])}$P(Px,"along");var XP=Px;function KP(r){let e,t;const n=[Hn("animate-shortcuts"),{paint:{"circle-radius":10,"circle-color":"purple","circle-stroke-color":"black","circle-stroke-width":1}}];let l={};for(let u=0;uclearInterval(a));function _(){return n.features.map(P=>1/P.properties.directness).reduce((P,D)=>P+D,0)}function x(){return n.features.length==0?[]:Array.from({length:YP},S)}function S(){let P=Math.random()*l,D=0;for(let[N,z]of n.features.entries())if(D+=1/z.properties.directness,PXP(n.features[P],D,{units:"kilometers"}))}}function C(){for(let[P,D]of u.entries())D.distance+=e6,D.distance>=n.features[D.idx].properties.length_meters/1e3&&(u[P]=S());t(0,d=k())}return r.$$set=P=>{"paths"in P&&t(1,n=P.paths)},r.$$.update=()=>{r.$$.dirty&2&&n&&(l=_(),u=x())},[d,n]}class r6 extends Ht{constructor(e){super(),Zt(this,e,t6,JP,Ut,{paths:1})}}function n6(r){let e;return{c(){e=rt("Choose project")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function i6(r){let e;return{c(){e=rt("Pick neighbourhood")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function o6(r){let e;return{c(){e=fe("p"),e.textContent=`Now that you've defined a neighbourhood boundary, you can see the possible shortcuts that vehicles are currently able to take through it. You can add a new modal filter to try and solve this. The colored "cell" areas show what's reachable for drivers without - leaving the boundary you've drawn.`},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function o6(r){let e;return{c(){e=rt("View shortcuts")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function s6(r){let e;return{c(){e=rt("Route")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function a6(r){let e;return{c(){e=rt("Change this boundary")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function l6(r){let e;return{c(){e=rt("Debug")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function c6(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D,N,z,B,O,G,U,K,me,X,Y,_e,ze,re;return u=new Zr({props:{$$slots:{default:[r6]},$$scope:{ctx:r}}}),u.$on("click",r[25]),_=new Zr({props:{$$slots:{default:[n6]},$$scope:{ctx:r}}}),_.$on("click",r[26]),C=new Og({props:{$$slots:{default:[i6]},$$scope:{ctx:r}}}),B=new Zr({props:{$$slots:{default:[o6]},$$scope:{ctx:r}}}),B.$on("click",r[27]),U=new Zr({props:{$$slots:{default:[s6]},$$scope:{ctx:r}}}),U.$on("click",r[28]),X=new Zr({props:{$$slots:{default:[a6]},$$scope:{ctx:r}}}),X.$on("click",r[29]),ze=new Zr({props:{$$slots:{default:[l6]},$$scope:{ctx:r}}}),ze.$on("click",r[30]),{c(){e=fe("div"),t=fe("nav"),n=fe("ul"),l=fe("li"),je(u.$$.fragment),d=Ve(),a=fe("li"),je(_.$$.fragment),x=Ve(),S=fe("li"),k=rt(`Editing - `),je(C.$$.fragment),P=Ve(),D=fe("nav"),N=fe("ul"),z=fe("li"),je(B.$$.fragment),O=Ve(),G=fe("li"),je(U.$$.fragment),K=Ve(),me=fe("li"),je(X.$$.fragment),Y=Ve(),_e=fe("li"),je(ze.$$.fragment),Ee(t,"aria-label","breadcrumb"),Ee(e,"slot","top"),fn(e,"display","flex"),fn(e,"justify-content","space-between")},m(ce,Ze){be(ce,e,Ze),ie(e,t),ie(t,n),ie(n,l),Oe(u,l,null),ie(n,d),ie(n,a),Oe(_,a,null),ie(n,x),ie(n,S),ie(S,k),Oe(C,S,null),ie(e,P),ie(e,D),ie(D,N),ie(N,z),Oe(B,z,null),ie(N,O),ie(N,G),Oe(U,G,null),ie(N,K),ie(N,me),Oe(X,me,null),ie(N,Y),ie(N,_e),Oe(ze,_e,null),re=!0},p(ce,Ze){const Me={};Ze[1]&8&&(Me.$$scope={dirty:Ze,ctx:ce}),u.$set(Me);const ft={};Ze[1]&8&&(ft.$$scope={dirty:Ze,ctx:ce}),_.$set(ft);const Ct={};Ze[1]&8&&(Ct.$$scope={dirty:Ze,ctx:ce}),C.$set(Ct);const Ot={};Ze[1]&8&&(Ot.$$scope={dirty:Ze,ctx:ce}),B.$set(Ot);const Ke={};Ze[1]&8&&(Ke.$$scope={dirty:Ze,ctx:ce}),U.$set(Ke);const Kt={};Ze[1]&8&&(Kt.$$scope={dirty:Ze,ctx:ce}),X.$set(Kt);const vt={};Ze[1]&8&&(vt.$$scope={dirty:Ze,ctx:ce}),ze.$set(vt)},i(ce){re||(oe(u.$$.fragment,ce),oe(_.$$.fragment,ce),oe(C.$$.fragment,ce),oe(B.$$.fragment,ce),oe(U.$$.fragment,ce),oe(X.$$.fragment,ce),oe(ze.$$.fragment,ce),re=!0)},o(ce){de(u.$$.fragment,ce),de(_.$$.fragment,ce),de(C.$$.fragment,ce),de(B.$$.fragment,ce),de(U.$$.fragment,ce),de(X.$$.fragment,ce),de(ze.$$.fragment,ce),re=!1},d(ce){ce&&ve(e),Ne(u),Ne(_),Ne(C),Ne(B),Ne(U),Ne(X),Ne(ze)}}}function qv(r){let e;return{c(){e=fe("mark"),e.textContent=`Some parts of the neighbourhood aren't reachable by drivers, shown in - red`},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function u6(r){let e,t,n;return{c(){e=rt("Undo ("),t=rt(r[4]),n=rt(")")},m(l,u){be(l,e,u),be(l,t,u),be(l,n,u)},p(l,u){u[0]&16&&Ar(t,l[4])},d(l){l&&(ve(e),ve(t),ve(n))}}}function h6(r){let e;return{c(){e=rt("Undo")},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function f6(r){let e,t,n;return{c(){e=rt("Redo ("),t=rt(r[5]),n=rt(")")},m(l,u){be(l,e,u),be(l,t,u),be(l,n,u)},p(l,u){u[0]&32&&Ar(t,l[5])},d(l){l&&(ve(e),ve(t),ve(n))}}}function d6(r){let e;return{c(){e=rt("Redo")},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function Gv(r){let e,t;return e=new xM({}),e.$on("close",r[24]),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p:Mt,i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function p6(r){let e,t,n,l,u=dn(r[6]).properties.name+"",d,a,_=r[1].area_km2.toFixed(1)+"",x,S,k,C,P,D,N,z,B,O,G,U,K,me,X,Y,_e,ze,re,ce,Ze,Me,ft,Ct,Ot,Ke,Kt,vt,At,Vt,sr,fr,er,Nt,nr,tr=r[8]>0&&qv();function Lr(it,ne){return it[4]==0?h6:u6}let Pr=Lr(r),st=Pr(r);function Lt(it,ne){return it[5]==0?d6:f6}let De=Lt(r),at=De(r),tt=r[3]&&Gv(r);return{c(){e=fe("div"),t=fe("p"),n=rt("Editing neighbourhood "),l=fe("u"),d=rt(u),a=rt(` + leaving the boundary you've drawn.`},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function s6(r){let e;return{c(){e=rt("View shortcuts")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function a6(r){let e;return{c(){e=rt("Route")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function l6(r){let e;return{c(){e=rt("Change this boundary")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function c6(r){let e;return{c(){e=rt("Debug")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function u6(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D,N,z,B,O,G,U,K,me,X,Y,_e,ze,re;return u=new Zr({props:{$$slots:{default:[n6]},$$scope:{ctx:r}}}),u.$on("click",r[25]),_=new Zr({props:{$$slots:{default:[i6]},$$scope:{ctx:r}}}),_.$on("click",r[26]),C=new Ng({props:{$$slots:{default:[o6]},$$scope:{ctx:r}}}),B=new Zr({props:{$$slots:{default:[s6]},$$scope:{ctx:r}}}),B.$on("click",r[27]),U=new Zr({props:{$$slots:{default:[a6]},$$scope:{ctx:r}}}),U.$on("click",r[28]),X=new Zr({props:{$$slots:{default:[l6]},$$scope:{ctx:r}}}),X.$on("click",r[29]),ze=new Zr({props:{$$slots:{default:[c6]},$$scope:{ctx:r}}}),ze.$on("click",r[30]),{c(){e=fe("div"),t=fe("nav"),n=fe("ul"),l=fe("li"),je(u.$$.fragment),d=Ve(),a=fe("li"),je(_.$$.fragment),x=Ve(),S=fe("li"),k=rt(`Editing + `),je(C.$$.fragment),P=Ve(),D=fe("nav"),N=fe("ul"),z=fe("li"),je(B.$$.fragment),O=Ve(),G=fe("li"),je(U.$$.fragment),K=Ve(),me=fe("li"),je(X.$$.fragment),Y=Ve(),_e=fe("li"),je(ze.$$.fragment),Ee(t,"aria-label","breadcrumb"),Ee(e,"slot","top"),fn(e,"display","flex"),fn(e,"justify-content","space-between")},m(ce,Ze){be(ce,e,Ze),ie(e,t),ie(t,n),ie(n,l),Oe(u,l,null),ie(n,d),ie(n,a),Oe(_,a,null),ie(n,x),ie(n,S),ie(S,k),Oe(C,S,null),ie(e,P),ie(e,D),ie(D,N),ie(N,z),Oe(B,z,null),ie(N,O),ie(N,G),Oe(U,G,null),ie(N,K),ie(N,me),Oe(X,me,null),ie(N,Y),ie(N,_e),Oe(ze,_e,null),re=!0},p(ce,Ze){const Me={};Ze[1]&8&&(Me.$$scope={dirty:Ze,ctx:ce}),u.$set(Me);const ft={};Ze[1]&8&&(ft.$$scope={dirty:Ze,ctx:ce}),_.$set(ft);const Ct={};Ze[1]&8&&(Ct.$$scope={dirty:Ze,ctx:ce}),C.$set(Ct);const Ot={};Ze[1]&8&&(Ot.$$scope={dirty:Ze,ctx:ce}),B.$set(Ot);const Ke={};Ze[1]&8&&(Ke.$$scope={dirty:Ze,ctx:ce}),U.$set(Ke);const Kt={};Ze[1]&8&&(Kt.$$scope={dirty:Ze,ctx:ce}),X.$set(Kt);const vt={};Ze[1]&8&&(vt.$$scope={dirty:Ze,ctx:ce}),ze.$set(vt)},i(ce){re||(oe(u.$$.fragment,ce),oe(_.$$.fragment,ce),oe(C.$$.fragment,ce),oe(B.$$.fragment,ce),oe(U.$$.fragment,ce),oe(X.$$.fragment,ce),oe(ze.$$.fragment,ce),re=!0)},o(ce){de(u.$$.fragment,ce),de(_.$$.fragment,ce),de(C.$$.fragment,ce),de(B.$$.fragment,ce),de(U.$$.fragment,ce),de(X.$$.fragment,ce),de(ze.$$.fragment,ce),re=!1},d(ce){ce&&ve(e),Ne(u),Ne(_),Ne(C),Ne(B),Ne(U),Ne(X),Ne(ze)}}}function Gv(r){let e;return{c(){e=fe("mark"),e.textContent=`Some parts of the neighbourhood aren't reachable by drivers, shown in + red`},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function h6(r){let e,t,n;return{c(){e=rt("Undo ("),t=rt(r[4]),n=rt(")")},m(l,u){be(l,e,u),be(l,t,u),be(l,n,u)},p(l,u){u[0]&16&&Ar(t,l[4])},d(l){l&&(ve(e),ve(t),ve(n))}}}function f6(r){let e;return{c(){e=rt("Undo")},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function d6(r){let e,t,n;return{c(){e=rt("Redo ("),t=rt(r[5]),n=rt(")")},m(l,u){be(l,e,u),be(l,t,u),be(l,n,u)},p(l,u){u[0]&32&&Ar(t,l[5])},d(l){l&&(ve(e),ve(t),ve(n))}}}function p6(r){let e;return{c(){e=rt("Redo")},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function Wv(r){let e,t;return e=new SM({}),e.$on("close",r[24]),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p:Mt,i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function m6(r){let e,t,n,l,u=dn(r[6]).properties.name+"",d,a,_=r[1].area_km2.toFixed(1)+"",x,S,k,C,P,D,N,z,B,O,G,U,K,me,X,Y,_e,ze,re,ce,Ze,Me,ft,Ct,Ot,Ke,Kt,vt,At,Vt,sr,fr,er,Nt,nr,tr=r[8]>0&&Gv();function Lr(it,ne){return it[4]==0?f6:h6}let Pr=Lr(r),st=Pr(r);function Lt(it,ne){return it[5]==0?p6:d6}let De=Lt(r),at=De(r),tt=r[3]&&Wv(r);return{c(){e=fe("div"),t=fe("p"),n=rt("Editing neighbourhood "),l=fe("u"),d=rt(u),a=rt(` , with an area of `),x=rt(_),S=rt(" km²"),k=Ve(),tr&&tr.c(),C=Ve(),P=fe("div"),D=fe("button"),N=fe("img"),B=rt(` Add a modal filter`),G=Ve(),U=fe("button"),K=rt("Add many modal filters along line"),X=Ve(),Y=fe("button"),_e=rt("Reverse directions"),re=Ve(),ce=fe("button"),ce.textContent="Change modal filter type",Ze=Ve(),Me=fe("label"),ft=fe("input"),Ct=rt(` - Animate shortcuts`),Ot=Ve(),Ke=fe("div"),Kt=fe("button"),st.c(),At=Ve(),Vt=fe("button"),at.c(),fr=Ve(),tt&&tt.c(),En(N.src,z=`/ltn//filters/${r[9]}_icon.gif`)||Ee(N,"src",z),Ee(N,"width","30"),Ee(N,"alt","Add a modal filter"),D.disabled=O=r[0]=="filter",Ee(D,"data-tooltip","hotkey 1"),U.disabled=me=r[0]=="freehand-filters",Ee(U,"data-tooltip","hotkey 2"),Y.disabled=ze=r[0]=="oneway",Ee(Y,"data-tooltip","hotkey 3"),fn(P,"display","flex"),fn(P,"justify-content","space-between"),Ee(ft,"type","checkbox"),Kt.disabled=vt=r[4]==0,Ee(Kt,"data-tooltip","Ctrl+Z"),Vt.disabled=sr=r[5]==0,Ee(Vt,"data-tooltip","Ctrl+Y"),fn(Ke,"display","flex"),fn(Ke,"justify-content","space-between"),Ee(e,"slot","sidebar")},m(it,ne){be(it,e,ne),ie(e,t),ie(t,n),ie(t,l),ie(l,d),ie(t,a),ie(t,x),ie(t,S),ie(e,k),tr&&tr.m(e,null),ie(e,C),ie(e,P),ie(P,D),ie(D,N),ie(D,B),ie(P,G),ie(P,U),ie(U,K),ie(P,X),ie(P,Y),ie(Y,_e),ie(e,re),ie(e,ce),ie(e,Ze),ie(e,Me),ie(Me,ft),ft.checked=r[10],ie(Me,Ct),ie(e,Ot),ie(e,Ke),ie(Ke,Kt),st.m(Kt,null),ie(Ke,At),ie(Ke,Vt),at.m(Vt,null),ie(e,fr),tt&&tt.m(e,null),er=!0,Nt||(nr=[Tt(D,"click",r[19]),Tt(U,"click",r[20]),Tt(Y,"click",r[21]),Tt(ce,"click",r[22]),Tt(ft,"change",r[23]),Tt(Kt,"click",r[15]),Tt(Vt,"click",r[16])],Nt=!0)},p(it,ne){(!er||ne[0]&64)&&u!==(u=dn(it[6]).properties.name+"")&&Ar(d,u),(!er||ne[0]&2)&&_!==(_=it[1].area_km2.toFixed(1)+"")&&Ar(x,_),it[8]>0?tr||(tr=qv(),tr.c(),tr.m(e,C)):tr&&(tr.d(1),tr=null),(!er||ne[0]&512&&!En(N.src,z=`/ltn//filters/${it[9]}_icon.gif`))&&Ee(N,"src",z),(!er||ne[0]&1&&O!==(O=it[0]=="filter"))&&(D.disabled=O),(!er||ne[0]&1&&me!==(me=it[0]=="freehand-filters"))&&(U.disabled=me),(!er||ne[0]&1&&ze!==(ze=it[0]=="oneway"))&&(Y.disabled=ze),ne[0]&1024&&(ft.checked=it[10]),Pr===(Pr=Lr(it))&&st?st.p(it,ne):(st.d(1),st=Pr(it),st&&(st.c(),st.m(Kt,null))),(!er||ne[0]&16&&vt!==(vt=it[4]==0))&&(Kt.disabled=vt),De===(De=Lt(it))&&at?at.p(it,ne):(at.d(1),at=De(it),at&&(at.c(),at.m(Vt,null))),(!er||ne[0]&32&&sr!==(sr=it[5]==0))&&(Vt.disabled=sr),it[3]?tt?(tt.p(it,ne),ne[0]&8&&oe(tt,1)):(tt=Gv(it),tt.c(),oe(tt,1),tt.m(e,null)):tt&&(yr(),de(tt,1,1,()=>{tt=null}),vr())},i(it){er||(oe(tt),er=!0)},o(it){de(tt),er=!1},d(it){it&&ve(e),tr&&tr.d(),st.d(),at.d(),tt&&tt.d(),Nt=!1,_n(nr)}}}function m6(r){let e;return{c(){e=fe("p"),e.textContent="Click to change direction"},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function g6(r){let e,t,n,l;return{c(){e=fe("div"),t=fe("img"),l=rt(` - Click to add modal filter`),En(t.src,n=`/ltn//filters/${r[9]}_icon.gif`)||Ee(t,"src",n),Ee(t,"width","20"),Ee(t,"alt","Add modal filter")},m(u,d){be(u,e,d),ie(e,t),ie(e,l)},p(u,d){d[0]&512&&!En(t.src,n=`/ltn//filters/${u[9]}_icon.gif`)&&Ee(t,"src",n)},d(u){u&&ve(e)}}}function _6(r){let e,t=r[33].shortcuts+"",n,l,u=(r[33].name??"unnamed road")+"",d,a,_;function x(C,P){return C[0]=="filter"?g6:m6}let S=x(r),k=S(r);return{c(){e=fe("p"),n=rt(t),l=rt(" shortcuts through "),d=rt(u),a=Ve(),k.c(),_=$n()},m(C,P){be(C,e,P),ie(e,n),ie(e,l),ie(e,d),be(C,a,P),k.m(C,P),be(C,_,P)},p(C,P){P[1]&4&&t!==(t=C[33].shortcuts+"")&&Ar(n,t),P[1]&4&&u!==(u=(C[33].name??"unnamed road")+"")&&Ar(d,u),S===(S=x(C))&&k?k.p(C,P):(k.d(1),k=S(C),k&&(k.c(),k.m(_.parentNode,_)))},d(C){C&&(ve(e),ve(a),ve(_)),k.d(C)}}}function y6(r){let e,t,n;return t=new Os({props:{openOn:"hover",$$slots:{default:[_6,({props:l})=>({33:l}),({props:l})=>[0,l?4:0]]},$$scope:{ctx:r}}}),{c(){e=fe("div"),je(t.$$.fragment),Ee(e,"slot","line-popup")},m(l,u){be(l,e,u),Oe(t,e,null),n=!0},p(l,u){const d={};u[0]&513|u[1]&12&&(d.$$scope={dirty:u,ctx:l}),t.$set(d)},i(l){n||(oe(t.$$.fragment,l),n=!0)},o(l){de(t.$$.fragment,l),n=!1},d(l){l&&ve(e),Ne(t)}}}function Wv(r){let e,t;return e=new t6({props:{paths:r[7]}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l[0]&128&&(u.paths=n[7]),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function v6(r){let e;return{c(){e=rt("Click to delete")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function b6(r){let e,t;return e=new Os({props:{openOn:"hover",$$slots:{default:[v6]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l[1]&8&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function Zv(r){let e,t;return e=new EM({props:{map:dn(r[2])}}),e.$on("done",r[17]),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l[0]&4&&(u.map=dn(n[2])),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function w6(r){let e,t,n,l,u,d,a;t=new Nd({props:{gjInput:r[1],interactive:r[0]=="filter"||r[0]=="oneway",onClickLine:r[12],$$slots:{"line-popup":[y6]},$$scope:{ctx:r}}});let _=r[10]&&Wv(r);u=new jd({props:{$$slots:{default:[b6]},$$scope:{ctx:r}}}),u.$on("click",r[13]);let x=r[0]=="freehand-filters"&&Zv(r);return{c(){e=fe("div"),je(t.$$.fragment),n=Ve(),_&&_.c(),l=Ve(),je(u.$$.fragment),d=Ve(),x&&x.c(),Ee(e,"slot","map")},m(S,k){be(S,e,k),Oe(t,e,null),ie(e,n),_&&_.m(e,null),ie(e,l),Oe(u,e,null),ie(e,d),x&&x.m(e,null),a=!0},p(S,k){const C={};k[0]&2&&(C.gjInput=S[1]),k[0]&1&&(C.interactive=S[0]=="filter"||S[0]=="oneway"),k[0]&513|k[1]&8&&(C.$$scope={dirty:k,ctx:S}),t.$set(C),S[10]?_?(_.p(S,k),k[0]&1024&&oe(_,1)):(_=Wv(S),_.c(),oe(_,1),_.m(e,l)):_&&(yr(),de(_,1,1,()=>{_=null}),vr());const P={};k[1]&8&&(P.$$scope={dirty:k,ctx:S}),u.$set(P),S[0]=="freehand-filters"?x?(x.p(S,k),k[0]&1&&oe(x,1)):(x=Zv(S),x.c(),oe(x,1),x.m(e,null)):x&&(yr(),de(x,1,1,()=>{x=null}),vr())},i(S){a||(oe(t.$$.fragment,S),oe(_),oe(u.$$.fragment,S),oe(x),a=!0)},o(S){de(t.$$.fragment,S),de(_),de(u.$$.fragment,S),de(x),a=!1},d(S){S&&ve(e),Ne(t),_&&_.d(),Ne(u),x&&x.d()}}}function x6(r){let e,t,n,l;return e=new Fs({props:{$$slots:{map:[w6],sidebar:[p6],top:[c6]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(u,d){Oe(e,u,d),t=!0,n||(l=Tt(window,"keydown",r[14]),n=!0)},p(u,d){const a={};d[0]&4095|d[1]&8&&(a.$$scope={dirty:d,ctx:u}),e.$set(a)},i(u){t||(oe(e.$$.fragment,u),t=!0)},o(u){de(e.$$.fragment,u),t=!1},d(u){Ne(e,u),n=!1,l()}}}function S6(r,e,t){let n,l,u,d,a,_,x;wt(r,ia,vt=>t(18,l=vt)),wt(r,Om,vt=>t(9,u=vt)),wt(r,ri,vt=>t(31,d=vt)),wt(r,ls,vt=>t(2,a=vt)),wt(r,Wy,vt=>t(10,_=vt)),wt(r,pr,vt=>t(11,x=vt));let S="filter",k=!1,C=0,P=0,D,N,z=JSON.parse(d.getAllShortcuts());ti(()=>{a.doubleClickZoom.enable()});function B(vt){t(1,N=JSON.parse(d.renderNeighbourhood())),t(6,D=N.features.find(At=>At.properties.kind=="boundary")),t(4,C=N.undo_length),t(5,P=N.redo_length),t(7,z=JSON.parse(d.getAllShortcuts())),Sc()}function O(vt,At){S=="filter"?(d.addModalFilter(At,u),Rt(ia,l++,l)):S=="oneway"&&(d.toggleDirection(vt.properties.road),Rt(ia,l++,l))}function G(vt){let At=vt.detail.features[0];d.deleteModalFilter(At.properties.road),Rt(ia,l++,l)}function U(vt){vt.target.tagName!="INPUT"&&(vt.ctrlKey&&vt.key=="z"&&K(),vt.ctrlKey&&vt.key=="y"&&me(),vt.key=="1"&&t(0,S="filter"),vt.key=="2"&&t(0,S="freehand-filters"),vt.key=="3"&&t(0,S="oneway"))}function K(){d.undo(),Rt(ia,l++,l)}function me(){d.redo(),Rt(ia,l++,l)}function X(vt){let At=vt.detail;At&&(d.addManyModalFilters(At,u),Rt(ia,l++,l)),t(0,S="filter")}const Y=()=>t(0,S="filter"),_e=()=>t(0,S="freehand-filters"),ze=()=>t(0,S="oneway"),re=()=>t(3,k=!0);function ce(){_=this.checked,Wy.set(_)}const Ze=()=>t(3,k=!1),Me=()=>Rt(pr,x={mode:"title"},x),ft=()=>Rt(pr,x={mode:"network"},x),Ct=()=>Rt(pr,x={mode:"view-shortcuts"},x),Ot=()=>Rt(pr,x={mode:"route",prevMode:"neighbourhood"},x),Ke=()=>Rt(pr,x={mode:"set-boundary",name:dn(D).properties.name,existing:D},x),Kt=()=>Rt(pr,x={mode:"debug"},x);return r.$$.update=()=>{r.$$.dirty[0]&5&&(S=="oneway"?a.doubleClickZoom.disable():a.doubleClickZoom.enable()),r.$$.dirty[0]&262144&&B(),r.$$.dirty[0]&2&&t(8,n=N.features.filter(vt=>vt.properties.kind=="cell"&&vt.properties.cell_color=="disconnected").length)},[S,N,a,k,C,P,D,z,n,u,_,x,O,G,U,K,me,X,l,Y,_e,ze,re,ce,Ze,Me,ft,Ct,Ot,Ke,Kt]}class k6 extends Ht{constructor(e){super(),Zt(this,e,S6,x6,Ut,{},null,[-1,-1])}}const Px="/ltn/assets/delete-ec75e756.svg",zx="/ltn/assets/edit-f3f51206.svg";function Hv(r,e,t){const n=r.slice();return n[19]=e[t],n}function T6(r){let e;return{c(){e=rt("Choose project")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function E6(r){let e;return{c(){e=fe("p"),e.textContent=`Inside the neighbourhood you define, the goal is to eliminate (or + Animate shortcuts`),Ot=Ve(),Ke=fe("div"),Kt=fe("button"),st.c(),At=Ve(),Vt=fe("button"),at.c(),fr=Ve(),tt&&tt.c(),En(N.src,z=`/ltn//filters/${r[9]}_icon.gif`)||Ee(N,"src",z),Ee(N,"width","30"),Ee(N,"alt","Add a modal filter"),D.disabled=O=r[0]=="filter",Ee(D,"data-tooltip","hotkey 1"),U.disabled=me=r[0]=="freehand-filters",Ee(U,"data-tooltip","hotkey 2"),Y.disabled=ze=r[0]=="oneway",Ee(Y,"data-tooltip","hotkey 3"),fn(P,"display","flex"),fn(P,"justify-content","space-between"),Ee(ft,"type","checkbox"),Kt.disabled=vt=r[4]==0,Ee(Kt,"data-tooltip","Ctrl+Z"),Vt.disabled=sr=r[5]==0,Ee(Vt,"data-tooltip","Ctrl+Y"),fn(Ke,"display","flex"),fn(Ke,"justify-content","space-between"),Ee(e,"slot","sidebar")},m(it,ne){be(it,e,ne),ie(e,t),ie(t,n),ie(t,l),ie(l,d),ie(t,a),ie(t,x),ie(t,S),ie(e,k),tr&&tr.m(e,null),ie(e,C),ie(e,P),ie(P,D),ie(D,N),ie(D,B),ie(P,G),ie(P,U),ie(U,K),ie(P,X),ie(P,Y),ie(Y,_e),ie(e,re),ie(e,ce),ie(e,Ze),ie(e,Me),ie(Me,ft),ft.checked=r[10],ie(Me,Ct),ie(e,Ot),ie(e,Ke),ie(Ke,Kt),st.m(Kt,null),ie(Ke,At),ie(Ke,Vt),at.m(Vt,null),ie(e,fr),tt&&tt.m(e,null),er=!0,Nt||(nr=[Tt(D,"click",r[19]),Tt(U,"click",r[20]),Tt(Y,"click",r[21]),Tt(ce,"click",r[22]),Tt(ft,"change",r[23]),Tt(Kt,"click",r[15]),Tt(Vt,"click",r[16])],Nt=!0)},p(it,ne){(!er||ne[0]&64)&&u!==(u=dn(it[6]).properties.name+"")&&Ar(d,u),(!er||ne[0]&2)&&_!==(_=it[1].area_km2.toFixed(1)+"")&&Ar(x,_),it[8]>0?tr||(tr=Gv(),tr.c(),tr.m(e,C)):tr&&(tr.d(1),tr=null),(!er||ne[0]&512&&!En(N.src,z=`/ltn//filters/${it[9]}_icon.gif`))&&Ee(N,"src",z),(!er||ne[0]&1&&O!==(O=it[0]=="filter"))&&(D.disabled=O),(!er||ne[0]&1&&me!==(me=it[0]=="freehand-filters"))&&(U.disabled=me),(!er||ne[0]&1&&ze!==(ze=it[0]=="oneway"))&&(Y.disabled=ze),ne[0]&1024&&(ft.checked=it[10]),Pr===(Pr=Lr(it))&&st?st.p(it,ne):(st.d(1),st=Pr(it),st&&(st.c(),st.m(Kt,null))),(!er||ne[0]&16&&vt!==(vt=it[4]==0))&&(Kt.disabled=vt),De===(De=Lt(it))&&at?at.p(it,ne):(at.d(1),at=De(it),at&&(at.c(),at.m(Vt,null))),(!er||ne[0]&32&&sr!==(sr=it[5]==0))&&(Vt.disabled=sr),it[3]?tt?(tt.p(it,ne),ne[0]&8&&oe(tt,1)):(tt=Wv(it),tt.c(),oe(tt,1),tt.m(e,null)):tt&&(yr(),de(tt,1,1,()=>{tt=null}),vr())},i(it){er||(oe(tt),er=!0)},o(it){de(tt),er=!1},d(it){it&&ve(e),tr&&tr.d(),st.d(),at.d(),tt&&tt.d(),Nt=!1,_n(nr)}}}function g6(r){let e;return{c(){e=fe("p"),e.textContent="Click to change direction"},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function _6(r){let e,t,n,l;return{c(){e=fe("div"),t=fe("img"),l=rt(` + Click to add modal filter`),En(t.src,n=`/ltn//filters/${r[9]}_icon.gif`)||Ee(t,"src",n),Ee(t,"width","20"),Ee(t,"alt","Add modal filter")},m(u,d){be(u,e,d),ie(e,t),ie(e,l)},p(u,d){d[0]&512&&!En(t.src,n=`/ltn//filters/${u[9]}_icon.gif`)&&Ee(t,"src",n)},d(u){u&&ve(e)}}}function y6(r){let e,t=r[33].shortcuts+"",n,l,u=(r[33].name??"unnamed road")+"",d,a,_;function x(C,P){return C[0]=="filter"?_6:g6}let S=x(r),k=S(r);return{c(){e=fe("p"),n=rt(t),l=rt(" shortcuts through "),d=rt(u),a=Ve(),k.c(),_=$n()},m(C,P){be(C,e,P),ie(e,n),ie(e,l),ie(e,d),be(C,a,P),k.m(C,P),be(C,_,P)},p(C,P){P[1]&4&&t!==(t=C[33].shortcuts+"")&&Ar(n,t),P[1]&4&&u!==(u=(C[33].name??"unnamed road")+"")&&Ar(d,u),S===(S=x(C))&&k?k.p(C,P):(k.d(1),k=S(C),k&&(k.c(),k.m(_.parentNode,_)))},d(C){C&&(ve(e),ve(a),ve(_)),k.d(C)}}}function v6(r){let e,t,n;return t=new Os({props:{openOn:"hover",$$slots:{default:[y6,({props:l})=>({33:l}),({props:l})=>[0,l?4:0]]},$$scope:{ctx:r}}}),{c(){e=fe("div"),je(t.$$.fragment),Ee(e,"slot","line-popup")},m(l,u){be(l,e,u),Oe(t,e,null),n=!0},p(l,u){const d={};u[0]&513|u[1]&12&&(d.$$scope={dirty:u,ctx:l}),t.$set(d)},i(l){n||(oe(t.$$.fragment,l),n=!0)},o(l){de(t.$$.fragment,l),n=!1},d(l){l&&ve(e),Ne(t)}}}function Zv(r){let e,t;return e=new r6({props:{paths:r[7]}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l[0]&128&&(u.paths=n[7]),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function b6(r){let e;return{c(){e=rt("Click to delete")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function w6(r){let e,t;return e=new Os({props:{openOn:"hover",$$slots:{default:[b6]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l[1]&8&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function Hv(r){let e,t;return e=new MM({props:{map:dn(r[2])}}),e.$on("done",r[17]),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l[0]&4&&(u.map=dn(n[2])),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function x6(r){let e,t,n,l,u,d,a;t=new Nd({props:{gjInput:r[1],interactive:r[0]=="filter"||r[0]=="oneway",onClickLine:r[12],$$slots:{"line-popup":[v6]},$$scope:{ctx:r}}});let _=r[10]&&Zv(r);u=new jd({props:{$$slots:{default:[w6]},$$scope:{ctx:r}}}),u.$on("click",r[13]);let x=r[0]=="freehand-filters"&&Hv(r);return{c(){e=fe("div"),je(t.$$.fragment),n=Ve(),_&&_.c(),l=Ve(),je(u.$$.fragment),d=Ve(),x&&x.c(),Ee(e,"slot","map")},m(S,k){be(S,e,k),Oe(t,e,null),ie(e,n),_&&_.m(e,null),ie(e,l),Oe(u,e,null),ie(e,d),x&&x.m(e,null),a=!0},p(S,k){const C={};k[0]&2&&(C.gjInput=S[1]),k[0]&1&&(C.interactive=S[0]=="filter"||S[0]=="oneway"),k[0]&513|k[1]&8&&(C.$$scope={dirty:k,ctx:S}),t.$set(C),S[10]?_?(_.p(S,k),k[0]&1024&&oe(_,1)):(_=Zv(S),_.c(),oe(_,1),_.m(e,l)):_&&(yr(),de(_,1,1,()=>{_=null}),vr());const P={};k[1]&8&&(P.$$scope={dirty:k,ctx:S}),u.$set(P),S[0]=="freehand-filters"?x?(x.p(S,k),k[0]&1&&oe(x,1)):(x=Hv(S),x.c(),oe(x,1),x.m(e,null)):x&&(yr(),de(x,1,1,()=>{x=null}),vr())},i(S){a||(oe(t.$$.fragment,S),oe(_),oe(u.$$.fragment,S),oe(x),a=!0)},o(S){de(t.$$.fragment,S),de(_),de(u.$$.fragment,S),de(x),a=!1},d(S){S&&ve(e),Ne(t),_&&_.d(),Ne(u),x&&x.d()}}}function S6(r){let e,t,n,l;return e=new Fs({props:{$$slots:{map:[x6],sidebar:[m6],top:[u6]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(u,d){Oe(e,u,d),t=!0,n||(l=Tt(window,"keydown",r[14]),n=!0)},p(u,d){const a={};d[0]&4095|d[1]&8&&(a.$$scope={dirty:d,ctx:u}),e.$set(a)},i(u){t||(oe(e.$$.fragment,u),t=!0)},o(u){de(e.$$.fragment,u),t=!1},d(u){Ne(e,u),n=!1,l()}}}function k6(r,e,t){let n,l,u,d,a,_,x;wt(r,ia,vt=>t(18,l=vt)),wt(r,Om,vt=>t(9,u=vt)),wt(r,ri,vt=>t(31,d=vt)),wt(r,ls,vt=>t(2,a=vt)),wt(r,Zy,vt=>t(10,_=vt)),wt(r,pr,vt=>t(11,x=vt));let S="filter",k=!1,C=0,P=0,D,N,z=JSON.parse(d.getAllShortcuts());ti(()=>{a.doubleClickZoom.enable()});function B(vt){t(1,N=JSON.parse(d.renderNeighbourhood())),t(6,D=N.features.find(At=>At.properties.kind=="boundary")),t(4,C=N.undo_length),t(5,P=N.redo_length),t(7,z=JSON.parse(d.getAllShortcuts())),Sc()}function O(vt,At){S=="filter"?(d.addModalFilter(At,u),Rt(ia,l++,l)):S=="oneway"&&(d.toggleDirection(vt.properties.road),Rt(ia,l++,l))}function G(vt){let At=vt.detail.features[0];d.deleteModalFilter(At.properties.road),Rt(ia,l++,l)}function U(vt){vt.target.tagName!="INPUT"&&(vt.ctrlKey&&vt.key=="z"&&K(),vt.ctrlKey&&vt.key=="y"&&me(),vt.key=="1"&&t(0,S="filter"),vt.key=="2"&&t(0,S="freehand-filters"),vt.key=="3"&&t(0,S="oneway"))}function K(){d.undo(),Rt(ia,l++,l)}function me(){d.redo(),Rt(ia,l++,l)}function X(vt){let At=vt.detail;At&&(d.addManyModalFilters(At,u),Rt(ia,l++,l)),t(0,S="filter")}const Y=()=>t(0,S="filter"),_e=()=>t(0,S="freehand-filters"),ze=()=>t(0,S="oneway"),re=()=>t(3,k=!0);function ce(){_=this.checked,Zy.set(_)}const Ze=()=>t(3,k=!1),Me=()=>Rt(pr,x={mode:"title"},x),ft=()=>Rt(pr,x={mode:"network"},x),Ct=()=>Rt(pr,x={mode:"view-shortcuts"},x),Ot=()=>Rt(pr,x={mode:"route",prevMode:"neighbourhood"},x),Ke=()=>Rt(pr,x={mode:"set-boundary",name:dn(D).properties.name,existing:D},x),Kt=()=>Rt(pr,x={mode:"debug"},x);return r.$$.update=()=>{r.$$.dirty[0]&5&&(S=="oneway"?a.doubleClickZoom.disable():a.doubleClickZoom.enable()),r.$$.dirty[0]&262144&&B(),r.$$.dirty[0]&2&&t(8,n=N.features.filter(vt=>vt.properties.kind=="cell"&&vt.properties.cell_color=="disconnected").length)},[S,N,a,k,C,P,D,z,n,u,_,x,O,G,U,K,me,X,l,Y,_e,ze,re,ce,Ze,Me,ft,Ct,Ot,Ke,Kt]}class T6 extends Ht{constructor(e){super(),Zt(this,e,k6,S6,Ut,{},null,[-1,-1])}}const zx="/ltn/assets/delete-ec75e756.svg",Dx="/ltn/assets/edit-f3f51206.svg";function yg(r,e,t){let n=new Set(JSON.parse(r.toSavefile()).features.filter(l=>l.properties.kind=="boundary").map(l=>l.properties.name));for(;;){let l=window.prompt(e,t);if(!l)return null;if(n.has(l))window.alert(`There is already a neighbourhood called ${l}; please pick another name`);else return l}}function $v(r,e,t){const n=r.slice();return n[19]=e[t],n}function E6(r){let e;return{c(){e=rt("Choose project")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function M6(r){let e;return{c(){e=fe("p"),e.textContent=`Inside the neighbourhood you define, the goal is to eliminate (or deliberately permit) through-traffic. An appropriate neighbourhood boundary depends on many factors. The simplest approach is to find the area bounded on all sides by "main" roads, which are designed @@ -633,11 +633,11 @@ and limitations under the License. though -- maybe severances like rivers or rail should be part of a boundary. Bridges and tunnels near a boundary may be confusing as well. And note that your boundary may not match the conventional - definition of "neighbourhood."`},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function M6(r){let e;return{c(){e=rt("Route")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function C6(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D,N;return u=new Zr({props:{$$slots:{default:[T6]},$$scope:{ctx:r}}}),u.$on("click",r[16]),x=new Og({props:{$$slots:{default:[E6]},$$scope:{ctx:r}}}),D=new Zr({props:{$$slots:{default:[M6]},$$scope:{ctx:r}}}),D.$on("click",r[17]),{c(){e=fe("div"),t=fe("nav"),n=fe("ul"),l=fe("li"),je(u.$$.fragment),d=Ve(),a=fe("li"),_=rt(`Pick neighbourhood - `),je(x.$$.fragment),S=Ve(),k=fe("nav"),C=fe("ul"),P=fe("li"),je(D.$$.fragment),Ee(t,"aria-label","breadcrumb"),Ee(e,"slot","top"),fn(e,"display","flex"),fn(e,"justify-content","space-between")},m(z,B){be(z,e,B),ie(e,t),ie(t,n),ie(n,l),Oe(u,l,null),ie(n,d),ie(n,a),ie(a,_),Oe(x,a,null),ie(e,S),ie(e,k),ie(k,C),ie(C,P),Oe(D,P,null),N=!0},p(z,B){const O={};B&4194304&&(O.$$scope={dirty:B,ctx:z}),u.$set(O);const G={};B&4194304&&(G.$$scope={dirty:B,ctx:z}),x.$set(G);const U={};B&4194304&&(U.$$scope={dirty:B,ctx:z}),D.$set(U)},i(z){N||(oe(u.$$.fragment,z),oe(x.$$.fragment,z),oe(D.$$.fragment,z),N=!0)},o(z){de(u.$$.fragment,z),de(x.$$.fragment,z),de(D.$$.fragment,z),N=!1},d(z){z&&ve(e),Ne(u),Ne(x),Ne(D)}}}function I6(r){let e;return{c(){e=rt("Draw a new boundary")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function A6(r){let e;return{c(){e=rt("Use an auto-generated boundary")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function L6(r){let e=r[19]+"",t;return{c(){t=rt(e)},m(n,l){be(n,t,l)},p(n,l){l&2&&e!==(e=n[19]+"")&&Ar(t,e)},d(n){n&&ve(t)}}}function $v(r){let e,t,n,l,u,d,a,_,x,S,k;function C(){return r[13](r[19])}n=new Zr({props:{$$slots:{default:[L6]},$$scope:{ctx:r}}}),n.$on("click",C);function P(){return r[14](r[19])}function D(){return r[15](r[19])}return{c(){e=fe("li"),t=fe("span"),je(n.$$.fragment),l=Ve(),u=fe("button"),u.innerHTML=`Rename neighbourhood`,d=Ve(),a=fe("button"),a.innerHTML=`Delete neighbourhood`,_=Ve(),Ee(u,"class","secondary"),Ee(a,"class","secondary"),fn(t,"display","flex"),fn(t,"justify-content","space-between")},m(N,z){be(N,e,z),ie(e,t),Oe(n,t,null),ie(t,l),ie(t,u),ie(t,d),ie(t,a),ie(e,_),x=!0,S||(k=[Tt(u,"click",P),Tt(a,"click",D)],S=!0)},p(N,z){r=N;const B={};z&4194306&&(B.$$scope={dirty:z,ctx:r}),n.$set(B)},i(N){x||(oe(n.$$.fragment,N),x=!0)},o(N){de(n.$$.fragment,N),x=!1},d(N){N&&ve(e),Ne(n),S=!1,_n(k)}}}function P6(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D,N,z,B,O,G,U,K;n=new Zr({props:{$$slots:{default:[I6]},$$scope:{ctx:r}}}),n.$on("click",r[7]),d=new Zr({props:{$$slots:{default:[A6]},$$scope:{ctx:r}}}),d.$on("click",r[12]);let me=Jn(r[1]),X=[];for(let _e=0;_ede(X[_e],1,1,()=>{X[_e]=null});return{c(){e=fe("div"),t=fe("div"),je(n.$$.fragment),l=Ve(),u=fe("div"),je(d.$$.fragment),a=Ve(),_=fe("ul");for(let _e=0;_e({18:n}),({props:n})=>n?262144:0]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&4456448&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function R6(r){let e,t;const n=[Hn("neighbourhood-boundaries"),{filter:["==",["get","kind"],"boundary"]},{paint:{"fill-color":"red","fill-opacity":kc(.3,.5)}},{eventsIfTopMost:!0},{manageHoverState:!0},{hoverCursor:"pointer"}];let l={$$slots:{default:[D6]},$$scope:{ctx:r}};for(let u=0;ut(10,u=K)),wt(r,ha,K=>t(2,d=K)),wt(r,pr,K=>t(3,a=K));function _(K){u.setCurrentNeighbourhood(K),Rt(pr,a={mode:"neighbourhood"},a)}function x(K){window.confirm(`Really delete neighbourhood ${K}? You can't undo this.`)&&(u.deleteNeighbourhoodBoundary(K),Sc(),t(0,n=JSON.parse(u.toSavefile())))}function S(K){let me=window.prompt(`Rename neighbourhood ${K} to what?`,K);me&&(u.renameNeighbourhoodBoundary(K,me),Sc(),t(0,n=JSON.parse(u.toSavefile())))}function k(){let K=window.prompt("What do you want to name the neighbourhood?");K&&Rt(pr,a={mode:"set-boundary",name:K,existing:null},a)}function C(){ad(d+".geojson",u.toSavefile())}function P(){ad("debug_route_snapper.geojson",u.toRouteSnapperGj())}const D=K=>_(dn(K.detail.features[0].properties).name),N=()=>Rt(pr,a={mode:"auto-boundaries"},a),z=K=>_(K),B=K=>S(K),O=K=>x(K),G=()=>Rt(pr,a={mode:"title"},a),U=()=>Rt(pr,a={mode:"route",prevMode:"network"},a);return r.$$.update=()=>{r.$$.dirty&1024&&t(0,n=JSON.parse(u.toSavefile())),r.$$.dirty&1&&t(1,l=n.features.filter(K=>K.properties.kind=="boundary").map(K=>K.properties.name))},[n,l,d,a,_,x,S,k,C,P,u,D,N,z,B,O,G,U]}class N6 extends Ht{constructor(e){super(),Zt(this,e,O6,F6,Ut,{})}}function j6(r){let e;return{c(){e=rt("Choose project")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function U6(r){let e;return{c(){e=rt("Pick neighbourhood")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function Xv(r){let e,t,n;return t=new Zr({props:{$$slots:{default:[V6]},$$scope:{ctx:r}}}),t.$on("click",r[13]),{c(){e=fe("li"),je(t.$$.fragment)},m(l,u){be(l,e,u),Oe(t,e,null),n=!0},p(l,u){const d={};u&16384&&(d.$$scope={dirty:u,ctx:l}),t.$set(d)},i(l){n||(oe(t.$$.fragment,l),n=!0)},o(l){de(t.$$.fragment,l),n=!1},d(l){l&&ve(e),Ne(t)}}}function V6(r){let e;return{c(){e=rt("Editing")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function q6(r){let e,t,n,l,u,d,a,_,x,S,k,C;u=new Zr({props:{$$slots:{default:[j6]},$$scope:{ctx:r}}}),u.$on("click",r[11]),_=new Zr({props:{$$slots:{default:[U6]},$$scope:{ctx:r}}}),_.$on("click",r[12]);let P=r[0]=="neighbourhood"&&Xv(r);return{c(){e=fe("div"),t=fe("nav"),n=fe("ul"),l=fe("li"),je(u.$$.fragment),d=Ve(),a=fe("li"),je(_.$$.fragment),x=Ve(),P&&P.c(),S=Ve(),k=fe("li"),k.textContent="Routing",Ee(t,"aria-label","breadcrumb"),Ee(e,"slot","top")},m(D,N){be(D,e,N),ie(e,t),ie(t,n),ie(n,l),Oe(u,l,null),ie(n,d),ie(n,a),Oe(_,a,null),ie(n,x),P&&P.m(n,null),ie(n,S),ie(n,k),C=!0},p(D,N){const z={};N&16384&&(z.$$scope={dirty:N,ctx:D}),u.$set(z);const B={};N&16384&&(B.$$scope={dirty:N,ctx:D}),_.$set(B),D[0]=="neighbourhood"?P?(P.p(D,N),N&1&&oe(P,1)):(P=Xv(D),P.c(),oe(P,1),P.m(n,S)):P&&(yr(),de(P,1,1,()=>{P=null}),vr())},i(D){C||(oe(u.$$.fragment,D),oe(_.$$.fragment,D),oe(P),C=!0)},o(D){de(u.$$.fragment,D),de(_.$$.fragment,D),de(P),C=!1},d(D){D&&ve(e),Ne(u),Ne(_),P&&P.d()}}}function G6(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D,N,z,B;return t=new Od({}),t.$on("click",r[7]),{c(){e=fe("div"),je(t.$$.fragment),n=Ve(),l=fe("p"),l.textContent="Drag markers for a route",u=Ve(),d=fe("p"),d.innerHTML=`Route before + definition of "neighbourhood."`},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function C6(r){let e;return{c(){e=rt("Route")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function I6(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D,N;return u=new Zr({props:{$$slots:{default:[E6]},$$scope:{ctx:r}}}),u.$on("click",r[16]),x=new Ng({props:{$$slots:{default:[M6]},$$scope:{ctx:r}}}),D=new Zr({props:{$$slots:{default:[C6]},$$scope:{ctx:r}}}),D.$on("click",r[17]),{c(){e=fe("div"),t=fe("nav"),n=fe("ul"),l=fe("li"),je(u.$$.fragment),d=Ve(),a=fe("li"),_=rt(`Pick neighbourhood + `),je(x.$$.fragment),S=Ve(),k=fe("nav"),C=fe("ul"),P=fe("li"),je(D.$$.fragment),Ee(t,"aria-label","breadcrumb"),Ee(e,"slot","top"),fn(e,"display","flex"),fn(e,"justify-content","space-between")},m(z,B){be(z,e,B),ie(e,t),ie(t,n),ie(n,l),Oe(u,l,null),ie(n,d),ie(n,a),ie(a,_),Oe(x,a,null),ie(e,S),ie(e,k),ie(k,C),ie(C,P),Oe(D,P,null),N=!0},p(z,B){const O={};B&4194304&&(O.$$scope={dirty:B,ctx:z}),u.$set(O);const G={};B&4194304&&(G.$$scope={dirty:B,ctx:z}),x.$set(G);const U={};B&4194304&&(U.$$scope={dirty:B,ctx:z}),D.$set(U)},i(z){N||(oe(u.$$.fragment,z),oe(x.$$.fragment,z),oe(D.$$.fragment,z),N=!0)},o(z){de(u.$$.fragment,z),de(x.$$.fragment,z),de(D.$$.fragment,z),N=!1},d(z){z&&ve(e),Ne(u),Ne(x),Ne(D)}}}function A6(r){let e;return{c(){e=rt("Draw a new boundary")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function L6(r){let e;return{c(){e=rt("Use an auto-generated boundary")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function P6(r){let e=r[19]+"",t;return{c(){t=rt(e)},m(n,l){be(n,t,l)},p(n,l){l&2&&e!==(e=n[19]+"")&&Ar(t,e)},d(n){n&&ve(t)}}}function Xv(r){let e,t,n,l,u,d,a,_,x,S,k;function C(){return r[13](r[19])}n=new Zr({props:{$$slots:{default:[P6]},$$scope:{ctx:r}}}),n.$on("click",C);function P(){return r[14](r[19])}function D(){return r[15](r[19])}return{c(){e=fe("li"),t=fe("span"),je(n.$$.fragment),l=Ve(),u=fe("button"),u.innerHTML=`Rename neighbourhood`,d=Ve(),a=fe("button"),a.innerHTML=`Delete neighbourhood`,_=Ve(),Ee(u,"class","secondary"),Ee(a,"class","secondary"),fn(t,"display","flex"),fn(t,"justify-content","space-between")},m(N,z){be(N,e,z),ie(e,t),Oe(n,t,null),ie(t,l),ie(t,u),ie(t,d),ie(t,a),ie(e,_),x=!0,S||(k=[Tt(u,"click",P),Tt(a,"click",D)],S=!0)},p(N,z){r=N;const B={};z&4194306&&(B.$$scope={dirty:z,ctx:r}),n.$set(B)},i(N){x||(oe(n.$$.fragment,N),x=!0)},o(N){de(n.$$.fragment,N),x=!1},d(N){N&&ve(e),Ne(n),S=!1,_n(k)}}}function z6(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D,N,z,B,O,G,U,K;n=new Zr({props:{$$slots:{default:[A6]},$$scope:{ctx:r}}}),n.$on("click",r[7]),d=new Zr({props:{$$slots:{default:[L6]},$$scope:{ctx:r}}}),d.$on("click",r[12]);let me=Jn(r[1]),X=[];for(let _e=0;_ede(X[_e],1,1,()=>{X[_e]=null});return{c(){e=fe("div"),t=fe("div"),je(n.$$.fragment),l=Ve(),u=fe("div"),je(d.$$.fragment),a=Ve(),_=fe("ul");for(let _e=0;_e({18:n}),({props:n})=>n?262144:0]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&4456448&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function B6(r){let e,t;const n=[Hn("neighbourhood-boundaries"),{filter:["==",["get","kind"],"boundary"]},{paint:{"fill-color":"red","fill-opacity":kc(.3,.5)}},{eventsIfTopMost:!0},{manageHoverState:!0},{hoverCursor:"pointer"}];let l={$$slots:{default:[R6]},$$scope:{ctx:r}};for(let u=0;ut(10,u=K)),wt(r,ha,K=>t(2,d=K)),wt(r,pr,K=>t(3,a=K));function _(K){u.setCurrentNeighbourhood(K),Rt(pr,a={mode:"neighbourhood"},a)}function x(K){window.confirm(`Really delete neighbourhood ${K}? You can't undo this.`)&&(u.deleteNeighbourhoodBoundary(K),Sc(),t(0,n=JSON.parse(u.toSavefile())))}function S(K){let me=yg(u,`Rename neighbourhood ${K} to what?`,K);me&&(u.renameNeighbourhoodBoundary(K,me),Sc(),t(0,n=JSON.parse(u.toSavefile())))}function k(){let K=yg(u,"What do you want to name the neighbourhood?","");K&&Rt(pr,a={mode:"set-boundary",name:K,existing:null},a)}function C(){ad(d+".geojson",u.toSavefile())}function P(){ad("debug_route_snapper.geojson",u.toRouteSnapperGj())}const D=K=>_(dn(K.detail.features[0].properties).name),N=()=>Rt(pr,a={mode:"auto-boundaries"},a),z=K=>_(K),B=K=>S(K),O=K=>x(K),G=()=>Rt(pr,a={mode:"title"},a),U=()=>Rt(pr,a={mode:"route",prevMode:"network"},a);return r.$$.update=()=>{r.$$.dirty&1024&&t(0,n=JSON.parse(u.toSavefile())),r.$$.dirty&1&&t(1,l=n.features.filter(K=>K.properties.kind=="boundary").map(K=>K.properties.name))},[n,l,d,a,_,x,S,k,C,P,u,D,N,z,B,O,G,U]}class j6 extends Ht{constructor(e){super(),Zt(this,e,N6,O6,Ut,{})}}function U6(r){let e;return{c(){e=rt("Choose project")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function V6(r){let e;return{c(){e=rt("Pick neighbourhood")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function Kv(r){let e,t,n;return t=new Zr({props:{$$slots:{default:[q6]},$$scope:{ctx:r}}}),t.$on("click",r[13]),{c(){e=fe("li"),je(t.$$.fragment)},m(l,u){be(l,e,u),Oe(t,e,null),n=!0},p(l,u){const d={};u&16384&&(d.$$scope={dirty:u,ctx:l}),t.$set(d)},i(l){n||(oe(t.$$.fragment,l),n=!0)},o(l){de(t.$$.fragment,l),n=!1},d(l){l&&ve(e),Ne(t)}}}function q6(r){let e;return{c(){e=rt("Editing")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function G6(r){let e,t,n,l,u,d,a,_,x,S,k,C;u=new Zr({props:{$$slots:{default:[U6]},$$scope:{ctx:r}}}),u.$on("click",r[11]),_=new Zr({props:{$$slots:{default:[V6]},$$scope:{ctx:r}}}),_.$on("click",r[12]);let P=r[0]=="neighbourhood"&&Kv(r);return{c(){e=fe("div"),t=fe("nav"),n=fe("ul"),l=fe("li"),je(u.$$.fragment),d=Ve(),a=fe("li"),je(_.$$.fragment),x=Ve(),P&&P.c(),S=Ve(),k=fe("li"),k.textContent="Routing",Ee(t,"aria-label","breadcrumb"),Ee(e,"slot","top")},m(D,N){be(D,e,N),ie(e,t),ie(t,n),ie(n,l),Oe(u,l,null),ie(n,d),ie(n,a),Oe(_,a,null),ie(n,x),P&&P.m(n,null),ie(n,S),ie(n,k),C=!0},p(D,N){const z={};N&16384&&(z.$$scope={dirty:N,ctx:D}),u.$set(z);const B={};N&16384&&(B.$$scope={dirty:N,ctx:D}),_.$set(B),D[0]=="neighbourhood"?P?(P.p(D,N),N&1&&oe(P,1)):(P=Kv(D),P.c(),oe(P,1),P.m(n,S)):P&&(yr(),de(P,1,1,()=>{P=null}),vr())},i(D){C||(oe(u.$$.fragment,D),oe(_.$$.fragment,D),oe(P),C=!0)},o(D){de(u.$$.fragment,D),de(_.$$.fragment,D),de(P),C=!1},d(D){D&&ve(e),Ne(u),Ne(_),P&&P.d()}}}function W6(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D,N,z,B;return t=new Od({}),t.$on("click",r[7]),{c(){e=fe("div"),je(t.$$.fragment),n=Ve(),l=fe("p"),l.textContent="Drag markers for a route",u=Ve(),d=fe("p"),d.innerHTML=`Route before , route after`,a=Ve(),_=fe("label"),x=rt("Slow-down factor for main roads: "),S=rt(r[1]),k=Ve(),C=fe("input"),P=Ve(),D=fe("i"),D.textContent=`Increase to see how drivers may detour in heavy traffic. 1 means - free-flow.`,Ee(C,"type","range"),Ee(C,"min","1.0"),Ee(C,"max","5.0"),Ee(C,"step","0.1"),Ee(e,"slot","sidebar")},m(O,G){be(O,e,G),Oe(t,e,null),ie(e,n),ie(e,l),ie(e,u),ie(e,d),ie(e,a),ie(e,_),ie(_,x),ie(_,S),ie(_,k),ie(_,C),ei(C,r[1]),ie(e,P),ie(e,D),N=!0,z||(B=[Tt(C,"change",r[10]),Tt(C,"input",r[10])],z=!0)},p(O,G){(!N||G&2)&&Ar(S,O[1]),G&2&&ei(C,O[1])},i(O){N||(oe(t.$$.fragment,O),N=!0)},o(O){de(t.$$.fragment,O),N=!1},d(O){O&&ve(e),Ne(t),z=!1,_n(B)}}}function Kv(r){let e,t;return e=new Nd({props:{gjInput:JSON.parse(dn(r[4]).renderNeighbourhood()),interactive:!1}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&16&&(u.gjInput=JSON.parse(dn(n[4]).renderNeighbourhood())),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function W6(r){let e,t;const n=[Hn("compare-route"),{paint:{"line-width":10,"line-color":i5(["get","kind"],{before:"red",after:"blue"},"red")}}];let l={};for(let u=0;uzo(a,"lngLat",D));function z(O){r[9](O)}let B={draggable:!0,$$slots:{default:[H6]},$$scope:{ctx:r}};return r[2]!==void 0&&(B.lngLat=r[2]),S=new fd({props:B}),pn.push(()=>zo(S,"lngLat",z)),{c(){e=fe("div"),P&&P.c(),t=Ve(),je(n.$$.fragment),l=Ve(),je(u.$$.fragment),d=Ve(),je(a.$$.fragment),x=Ve(),je(S.$$.fragment),Ee(e,"slot","map")},m(O,G){be(O,e,G),P&&P.m(e,null),ie(e,t),Oe(n,e,null),ie(e,l),Oe(u,e,null),ie(e,d),Oe(a,e,null),ie(e,x),Oe(S,e,null),C=!0},p(O,G){O[0]=="neighbourhood"?P?(P.p(O,G),G&1&&oe(P,1)):(P=Kv(O),P.c(),oe(P,1),P.m(e,t)):P&&(yr(),de(P,1,1,()=>{P=null}),vr());const U={};G&32&&(U.data=O[5]),G&16384&&(U.$$scope={dirty:G,ctx:O}),u.$set(U);const K={};G&16384&&(K.$$scope={dirty:G,ctx:O}),!_&&G&8&&(_=!0,K.lngLat=O[3],Po(()=>_=!1)),a.$set(K);const me={};G&16384&&(me.$$scope={dirty:G,ctx:O}),!k&&G&4&&(k=!0,me.lngLat=O[2],Po(()=>k=!1)),S.$set(me)},i(O){C||(oe(P),oe(n.$$.fragment,O),oe(u.$$.fragment,O),oe(a.$$.fragment,O),oe(S.$$.fragment,O),C=!0)},o(O){de(P),de(n.$$.fragment,O),de(u.$$.fragment,O),de(a.$$.fragment,O),de(S.$$.fragment,O),C=!1},d(O){O&&ve(e),P&&P.d(),Ne(n),Ne(u),Ne(a),Ne(S)}}}function X6(r){let e,t;return e=new Fs({props:{$$slots:{map:[$6],sidebar:[G6],top:[q6]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,[l]){const u={};l&16511&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function K6(r,e,t){let n,l,u,d,a,_;wt(r,pr,B=>t(6,l=B)),wt(r,Gy,B=>t(1,u=B)),wt(r,Fm,B=>t(2,d=B)),wt(r,Bm,B=>t(3,a=B)),wt(r,ri,B=>t(4,_=B));let{prevMode:x}=e;function S(){Rt(pr,l={mode:x},l)}function k(B){a=B,Bm.set(a)}function C(B){d=B,Fm.set(d)}function P(){u=bg(this.value),Gy.set(u)}const D=()=>Rt(pr,l={mode:"title"},l),N=()=>Rt(pr,l={mode:"network"},l),z=()=>Rt(pr,l={mode:"neighbourhood"},l);return r.$$set=B=>{"prevMode"in B&&t(0,x=B.prevMode)},r.$$.update=()=>{r.$$.dirty&30&&t(5,n=JSON.parse(_.compareRoute(a.lng,a.lat,d.lng,d.lat,u)))},[x,u,d,a,_,n,l,S,k,C,P,D,N,z]}class J6 extends Ht{constructor(e){super(),Zt(this,e,K6,X6,Ut,{prevMode:0})}}const Y6="/ltn/assets/settings-342fb430.svg";function Jv(r){let e,t;return e=new Pd({props:{$$slots:{default:[Q6]},$$scope:{ctx:r}}}),e.$on("close",r[3]),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&17&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function Q6(r){let e,t,n,l,u,d,a,_,x;return n=new y5({}),{c(){e=fe("h1"),e.textContent="Settings",t=Ve(),je(n.$$.fragment),l=Ve(),u=fe("center"),d=fe("button"),d.textContent="Confirm"},m(S,k){be(S,e,k),be(S,t,k),Oe(n,S,k),be(S,l,k),be(S,u,k),ie(u,d),a=!0,_||(x=Tt(d,"click",r[2]),_=!0)},p:Mt,i(S){a||(oe(n.$$.fragment,S),a=!0)},o(S){de(n.$$.fragment,S),a=!1},d(S){S&&(ve(e),ve(t),ve(l),ve(u)),Ne(n,S),_=!1,x()}}}function ez(r){let e,t,n,l,u,d,a=r[0]&&Jv(r);return{c(){e=fe("button"),e.innerHTML=`Settings`,t=Ve(),a&&a.c(),n=$n(),Ee(e,"class","outline")},m(_,x){be(_,e,x),be(_,t,x),a&&a.m(_,x),be(_,n,x),l=!0,u||(d=Tt(e,"click",r[1]),u=!0)},p(_,[x]){_[0]?a?(a.p(_,x),x&1&&oe(a,1)):(a=Jv(_),a.c(),oe(a,1),a.m(n.parentNode,n)):a&&(yr(),de(a,1,1,()=>{a=null}),vr())},i(_){l||(oe(a),l=!0)},o(_){de(a),l=!1},d(_){_&&(ve(e),ve(t),ve(n)),a&&a.d(_),u=!1,d()}}}function tz(r,e,t){let n=!1;return[n,()=>t(0,n=!0),()=>t(0,n=!1),()=>t(0,n=!1)]}class rz extends Ht{constructor(e){super(),Zt(this,e,tz,ez,Ut,{})}}let Lc=Tr(null);const To=Tr([]);function Dx(r){if(r.length<3)return JSON.parse(Hi(Lc).inner.calculateRoute(r));let e=JSON.parse(JSON.stringify(r));e.push(e[0]);let t=JSON.parse(Hi(Lc).inner.calculateRoute(e));return t.properties.waypoints.pop(),t.geometry.type="Polygon",t.geometry.coordinates=[t.geometry.coordinates],t}const{window:nz}=Ad,iz=r=>({}),Yv=r=>({}),oz=r=>({}),Qv=r=>({});function eb(r,e,t){const n=r.slice();return n[44]=e[t],n[45]=e,n[46]=t,n}function tb(r,e,t){const n=r.slice();return n[47]=e[t],n[48]=e,n[49]=t,n}function sz(r){let e,t;const n=r[24]["extra-top"],l=Vr(n,r,r[38],Yv);return{c(){e=fe("div"),l&&l.c(),Ee(e,"slot","top")},m(u,d){be(u,e,d),l&&l.m(e,null),t=!0},p(u,d){l&&l.p&&(!t||d[1]&128)&&Gr(l,n,u,u[38],t?qr(n,u[38],d,iz):Wr(u[38]),Yv)},i(u){t||(oe(l,u),t=!0)},o(u){de(l,u),t=!1},d(u){u&&ve(e),l&&l.d(u)}}}function az(r){let e,t,n,l,u;return{c(){e=fe("ul"),e.innerHTML=`
  • Click + free-flow.`,Ee(C,"type","range"),Ee(C,"min","1.0"),Ee(C,"max","5.0"),Ee(C,"step","0.1"),Ee(e,"slot","sidebar")},m(O,G){be(O,e,G),Oe(t,e,null),ie(e,n),ie(e,l),ie(e,u),ie(e,d),ie(e,a),ie(e,_),ie(_,x),ie(_,S),ie(_,k),ie(_,C),ei(C,r[1]),ie(e,P),ie(e,D),N=!0,z||(B=[Tt(C,"change",r[10]),Tt(C,"input",r[10])],z=!0)},p(O,G){(!N||G&2)&&Ar(S,O[1]),G&2&&ei(C,O[1])},i(O){N||(oe(t.$$.fragment,O),N=!0)},o(O){de(t.$$.fragment,O),N=!1},d(O){O&&ve(e),Ne(t),z=!1,_n(B)}}}function Jv(r){let e,t;return e=new Nd({props:{gjInput:JSON.parse(dn(r[4]).renderNeighbourhood()),interactive:!1}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&16&&(u.gjInput=JSON.parse(dn(n[4]).renderNeighbourhood())),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function Z6(r){let e,t;const n=[Hn("compare-route"),{paint:{"line-width":10,"line-color":o5(["get","kind"],{before:"red",after:"blue"},"red")}}];let l={};for(let u=0;uzo(a,"lngLat",D));function z(O){r[9](O)}let B={draggable:!0,$$slots:{default:[$6]},$$scope:{ctx:r}};return r[2]!==void 0&&(B.lngLat=r[2]),S=new fd({props:B}),pn.push(()=>zo(S,"lngLat",z)),{c(){e=fe("div"),P&&P.c(),t=Ve(),je(n.$$.fragment),l=Ve(),je(u.$$.fragment),d=Ve(),je(a.$$.fragment),x=Ve(),je(S.$$.fragment),Ee(e,"slot","map")},m(O,G){be(O,e,G),P&&P.m(e,null),ie(e,t),Oe(n,e,null),ie(e,l),Oe(u,e,null),ie(e,d),Oe(a,e,null),ie(e,x),Oe(S,e,null),C=!0},p(O,G){O[0]=="neighbourhood"?P?(P.p(O,G),G&1&&oe(P,1)):(P=Jv(O),P.c(),oe(P,1),P.m(e,t)):P&&(yr(),de(P,1,1,()=>{P=null}),vr());const U={};G&32&&(U.data=O[5]),G&16384&&(U.$$scope={dirty:G,ctx:O}),u.$set(U);const K={};G&16384&&(K.$$scope={dirty:G,ctx:O}),!_&&G&8&&(_=!0,K.lngLat=O[3],Po(()=>_=!1)),a.$set(K);const me={};G&16384&&(me.$$scope={dirty:G,ctx:O}),!k&&G&4&&(k=!0,me.lngLat=O[2],Po(()=>k=!1)),S.$set(me)},i(O){C||(oe(P),oe(n.$$.fragment,O),oe(u.$$.fragment,O),oe(a.$$.fragment,O),oe(S.$$.fragment,O),C=!0)},o(O){de(P),de(n.$$.fragment,O),de(u.$$.fragment,O),de(a.$$.fragment,O),de(S.$$.fragment,O),C=!1},d(O){O&&ve(e),P&&P.d(),Ne(n),Ne(u),Ne(a),Ne(S)}}}function K6(r){let e,t;return e=new Fs({props:{$$slots:{map:[X6],sidebar:[W6],top:[G6]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,[l]){const u={};l&16511&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function J6(r,e,t){let n,l,u,d,a,_;wt(r,pr,B=>t(6,l=B)),wt(r,Wy,B=>t(1,u=B)),wt(r,Fm,B=>t(2,d=B)),wt(r,Bm,B=>t(3,a=B)),wt(r,ri,B=>t(4,_=B));let{prevMode:x}=e;function S(){Rt(pr,l={mode:x},l)}function k(B){a=B,Bm.set(a)}function C(B){d=B,Fm.set(d)}function P(){u=wg(this.value),Wy.set(u)}const D=()=>Rt(pr,l={mode:"title"},l),N=()=>Rt(pr,l={mode:"network"},l),z=()=>Rt(pr,l={mode:"neighbourhood"},l);return r.$$set=B=>{"prevMode"in B&&t(0,x=B.prevMode)},r.$$.update=()=>{r.$$.dirty&30&&t(5,n=JSON.parse(_.compareRoute(a.lng,a.lat,d.lng,d.lat,u)))},[x,u,d,a,_,n,l,S,k,C,P,D,N,z]}class Y6 extends Ht{constructor(e){super(),Zt(this,e,J6,K6,Ut,{prevMode:0})}}const Q6="/ltn/assets/settings-342fb430.svg";function Yv(r){let e,t;return e=new Pd({props:{$$slots:{default:[ez]},$$scope:{ctx:r}}}),e.$on("close",r[3]),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&17&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function ez(r){let e,t,n,l,u,d,a,_,x;return n=new v5({}),{c(){e=fe("h1"),e.textContent="Settings",t=Ve(),je(n.$$.fragment),l=Ve(),u=fe("center"),d=fe("button"),d.textContent="Confirm"},m(S,k){be(S,e,k),be(S,t,k),Oe(n,S,k),be(S,l,k),be(S,u,k),ie(u,d),a=!0,_||(x=Tt(d,"click",r[2]),_=!0)},p:Mt,i(S){a||(oe(n.$$.fragment,S),a=!0)},o(S){de(n.$$.fragment,S),a=!1},d(S){S&&(ve(e),ve(t),ve(l),ve(u)),Ne(n,S),_=!1,x()}}}function tz(r){let e,t,n,l,u,d,a=r[0]&&Yv(r);return{c(){e=fe("button"),e.innerHTML=`Settings`,t=Ve(),a&&a.c(),n=$n(),Ee(e,"class","outline")},m(_,x){be(_,e,x),be(_,t,x),a&&a.m(_,x),be(_,n,x),l=!0,u||(d=Tt(e,"click",r[1]),u=!0)},p(_,[x]){_[0]?a?(a.p(_,x),x&1&&oe(a,1)):(a=Yv(_),a.c(),oe(a,1),a.m(n.parentNode,n)):a&&(yr(),de(a,1,1,()=>{a=null}),vr())},i(_){l||(oe(a),l=!0)},o(_){de(a),l=!1},d(_){_&&(ve(e),ve(t),ve(n)),a&&a.d(_),u=!1,d()}}}function rz(r,e,t){let n=!1;return[n,()=>t(0,n=!0),()=>t(0,n=!1),()=>t(0,n=!1)]}class nz extends Ht{constructor(e){super(),Zt(this,e,rz,tz,Ut,{})}}let Lc=Tr(null);const To=Tr([]);function Rx(r){if(r.length<3)return JSON.parse(Hi(Lc).inner.calculateRoute(r));let e=JSON.parse(JSON.stringify(r));e.push(e[0]);let t=JSON.parse(Hi(Lc).inner.calculateRoute(e));return t.properties.waypoints.pop(),t.geometry.type="Polygon",t.geometry.coordinates=[t.geometry.coordinates],t}const{window:iz}=Ad,oz=r=>({}),Qv=r=>({}),sz=r=>({}),eb=r=>({});function tb(r,e,t){const n=r.slice();return n[44]=e[t],n[45]=e,n[46]=t,n}function rb(r,e,t){const n=r.slice();return n[47]=e[t],n[48]=e,n[49]=t,n}function az(r){let e,t;const n=r[24]["extra-top"],l=Vr(n,r,r[38],Qv);return{c(){e=fe("div"),l&&l.c(),Ee(e,"slot","top")},m(u,d){be(u,e,d),l&&l.m(e,null),t=!0},p(u,d){l&&l.p&&(!t||d[1]&128)&&Gr(l,n,u,u[38],t?qr(n,u[38],d,oz):Wr(u[38]),Qv)},i(u){t||(oe(l,u),t=!0)},o(u){de(l,u),t=!1},d(u){u&&ve(e),l&&l.d(u)}}}function lz(r){let e,t,n,l,u;return{c(){e=fe("ul"),e.innerHTML=`
  • Click the map to add new points, until there are at least 3 points
  • Click and drag any point to move it
  • Click a waypoint to toggle snapping
  • Right click @@ -647,14 +647,14 @@ and limitations under the License. or Escape to finish
  • From the main mode, 3 - to draw a new area
  • `},m(d,a){be(d,e,a),be(d,t,a),be(d,n,a),be(d,l,a),be(d,u,a)},p:Mt,d(d){d&&(ve(e),ve(t),ve(n),ve(l),ve(u))}}}function lz(r){let e,t=r[8].length+"",n,l;return{c(){e=rt("Undo ("),n=rt(t),l=rt(")")},m(u,d){be(u,e,d),be(u,n,d),be(u,l,d)},p(u,d){d[0]&256&&t!==(t=u[8].length+"")&&Ar(n,t)},d(u){u&&(ve(e),ve(n),ve(l))}}}function cz(r){let e;return{c(){e=rt("Undo")},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function uz(r){let e;return{c(){e=fe("p"),e.textContent="Drag to adjust. Click to toggle snapped. Right click to delete."},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function hz(r){let e,t,n,l,u,d,a,_,x,S,k,C,P;return k=Eb(r[36][0]),{c(){e=fe("fieldset"),t=fe("label"),n=fe("input"),l=rt(` + to draw a new area`},m(d,a){be(d,e,a),be(d,t,a),be(d,n,a),be(d,l,a),be(d,u,a)},p:Mt,d(d){d&&(ve(e),ve(t),ve(n),ve(l),ve(u))}}}function cz(r){let e,t=r[8].length+"",n,l;return{c(){e=rt("Undo ("),n=rt(t),l=rt(")")},m(u,d){be(u,e,d),be(u,n,d),be(u,l,d)},p(u,d){d[0]&256&&t!==(t=u[8].length+"")&&Ar(n,t)},d(u){u&&(ve(e),ve(n),ve(l))}}}function uz(r){let e;return{c(){e=rt("Undo")},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function hz(r){let e;return{c(){e=fe("p"),e.textContent="Drag to adjust. Click to toggle snapped. Right click to delete."},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function fz(r){let e,t,n,l,u,d,a,_,x,S,k,C,P;return k=Mb(r[36][0]),{c(){e=fe("fieldset"),t=fe("label"),n=fe("input"),l=rt(` Snap to roads`),u=Ve(),d=fe("label"),a=fe("input"),_=rt(` - Draw anywhere`),x=Ve(),S=fe("p"),S.textContent="Click to add at least 3 points",Ee(n,"type","radio"),n.__value="snap",ei(n,n.__value),Ee(a,"type","radio"),a.__value="free",ei(a,a.__value),k.p(n,a)},m(D,N){be(D,e,N),ie(e,t),ie(t,n),n.checked=n.__value===r[7],ie(t,l),ie(e,u),ie(e,d),ie(d,a),a.checked=a.__value===r[7],ie(d,_),be(D,x,N),be(D,S,N),C||(P=[Tt(n,"change",r[35]),Tt(a,"change",r[37])],C=!0)},p(D,N){N[0]&128&&(n.checked=n.__value===D[7]),N[0]&128&&(a.checked=a.__value===D[7])},d(D){D&&(ve(e),ve(x),ve(S)),k.r(),C=!1,_n(P)}}}function fz(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D,N,z,B;const O=r[24]["extra-sidebar"],G=Vr(O,r,r[38],Qv);S=new Og({props:{$$slots:{default:[az]},$$scope:{ctx:r}}});function U(ze,re){return ze[8].length==0?cz:lz}let K=U(r),me=K(r);function X(ze,re){return ze[5].length<3?hz:uz}let Y=X(r),_e=Y(r);return{c(){e=fe("div"),G&&G.c(),t=Ve(),n=fe("div"),l=fe("button"),u=rt("Finish"),a=Ve(),_=fe("button"),_.textContent="Cancel",x=Ve(),je(S.$$.fragment),k=Ve(),C=fe("button"),me.c(),D=Ve(),_e.c(),l.disabled=d=r[5].length<3,Ee(_,"class","secondary"),fn(n,"display","flex"),Ee(C,"class","secondary"),C.disabled=P=r[8].length==0,Ee(e,"slot","sidebar")},m(ze,re){be(ze,e,re),G&&G.m(e,null),ie(e,t),ie(e,n),ie(n,l),ie(l,u),ie(n,a),ie(n,_),ie(n,x),Oe(S,n,null),ie(e,k),ie(e,C),me.m(C,null),ie(e,D),_e.m(e,null),N=!0,z||(B=[Tt(l,"click",function(){wc(r[0])&&r[0].apply(this,arguments)}),Tt(_,"click",function(){wc(r[1])&&r[1].apply(this,arguments)}),Tt(C,"click",r[11])],z=!0)},p(ze,re){r=ze,G&&G.p&&(!N||re[1]&128)&&Gr(G,O,r,r[38],N?qr(O,r[38],re,oz):Wr(r[38]),Qv),(!N||re[0]&32&&d!==(d=r[5].length<3))&&(l.disabled=d);const ce={};re[1]&128&&(ce.$$scope={dirty:re,ctx:r}),S.$set(ce),K===(K=U(r))&&me?me.p(r,re):(me.d(1),me=K(r),me&&(me.c(),me.m(C,null))),(!N||re[0]&256&&P!==(P=r[8].length==0))&&(C.disabled=P),Y===(Y=X(r))&&_e?_e.p(r,re):(_e.d(1),_e=Y(r),_e&&(_e.c(),_e.m(e,null)))},i(ze){N||(oe(G,ze),oe(S.$$.fragment,ze),N=!0)},o(ze){de(G,ze),de(S.$$.fragment,ze),N=!1},d(ze){ze&&ve(e),G&&G.d(ze),Ne(S),me.d(),_e.d(),z=!1,_n(B)}}}function dz(r){let e;return{c(){e=fe("span"),Ee(e,"class","dot svelte-1cj4rwq"),hi(e,"snapped-node",r[47].snapped),hi(e,"free-node",!r[47].snapped),hi(e,"hide",r[4])},m(t,n){be(t,e,n)},p(t,n){n[0]&512&&hi(e,"snapped-node",t[47].snapped),n[0]&512&&hi(e,"free-node",!t[47].snapped),n[0]&16&&hi(e,"hide",t[4])},d(t){t&&ve(e)}}}function rb(r){let e,t,n;function l(x){r[25](x,r[47])}function u(){return r[26](r[47])}function d(){return r[27](r[47])}function a(){return r[28](r[47])}let _={draggable:!0,zIndex:0,$$slots:{default:[dz]},$$scope:{ctx:r}};return r[47].point!==void 0&&(_.lngLat=r[47].point),e=new fd({props:_}),pn.push(()=>zo(e,"lngLat",l)),e.$on("dragstart",u),e.$on("drag",d),e.$on("dragend",r[19]),e.$on("click",a),{c(){je(e.$$.fragment)},m(x,S){Oe(e,x,S),n=!0},p(x,S){r=x;const k={};S[0]&528|S[1]&128&&(k.$$scope={dirty:S,ctx:r}),!t&&S[0]&512&&(t=!0,k.lngLat=r[47].point,Po(()=>t=!1)),e.$set(k)},i(x){n||(oe(e.$$.fragment,x),n=!0)},o(x){de(e.$$.fragment,x),n=!1},d(x){Ne(e,x)}}}function pz(r){let e;return{c(){e=fe("span"),e.textContent=`${r[46]+1}`,Ee(e,"class","dot svelte-1cj4rwq"),hi(e,"snapped",r[44].snapped)},m(t,n){be(t,e,n)},p(t,n){n[0]&32&&hi(e,"snapped",t[44].snapped)},d(t){t&&ve(e)}}}function nb(r){let e,t,n;function l(_){r[29](_,r[44])}function u(){return r[30](r[46])}function d(){return r[31](r[46])}let a={draggable:!0,zIndex:1,$$slots:{default:[pz]},$$scope:{ctx:r}};return r[44].point!==void 0&&(a.lngLat=r[44].point),e=new fd({props:a}),pn.push(()=>zo(e,"lngLat",l)),e.$on("click",u),e.$on("contextmenu",d),e.$on("mouseenter",r[32]),e.$on("mouseleave",r[33]),e.$on("dragstart",r[21]),e.$on("dragend",r[34]),{c(){je(e.$$.fragment)},m(_,x){Oe(e,_,x),n=!0},p(_,x){r=_;const S={};x[0]&32|x[1]&128&&(S.$$scope={dirty:x,ctx:r}),!t&&x[0]&32&&(t=!0,S.lngLat=r[44].point,Po(()=>t=!1)),e.$set(S)},i(_){n||(oe(e.$$.fragment,_),n=!0)},o(_){de(e.$$.fragment,_),n=!1},d(_){Ne(e,_)}}}function mz(r){let e,t,n,l;const u=[Hn("draw-area-lines"),{paint:{"line-color":"black","line-width":10}}];let d={};for(let x=0;xde(k[z],1,1,()=>{k[z]=null});let P=Jn(r[5]),D=[];for(let z=0;zde(D[z],1,1,()=>{D[z]=null});return d=new Pi({props:{data:r[16](r[6],r[5]),generateId:!0,$$slots:{default:[mz]},$$scope:{ctx:r}}}),_=new Pi({props:{data:r[10],$$slots:{default:[gz]},$$scope:{ctx:r}}}),{c(){e=fe("div"),je(t.$$.fragment),n=Ve();for(let z=0;zt(5,l=st)),wt(r,Lc,st=>t(6,u=st));let{$$slots:d={},$$scope:a}=e,{map:_}=e,{finish:x}=e,{cancel:S}=e;ti(()=>{Rt(To,l=[],l),u==null||u.stop(),_.getCanvas().style.cursor="inherit"});let k="snap",C=[],P=[],D=null,N=!1,z=!1,B=!1;function O(st){let Lt=st.length==0?"crosshair":"inherit";_.getCanvas().style.cursor=Lt}function G(){let st=C.pop();t(8,C),st&&Rt(To,l=st,l)}function U(){C.length==100&&C.shift(),t(8,C=[...C,JSON.parse(JSON.stringify(l))])}function K(){t(7,k=k=="snap"?"free":"snap"),D&&t(23,D.snapped=k=="snap",D)}function me(st){l.length>=3||(U(),To.update(Lt=>(Lt.push({point:st.detail.lngLat.toArray(),snapped:k=="snap"}),Lt)))}function X(st){t(23,D={point:st.detail.lngLat.toArray(),snapped:k=="snap"})}function Y(st){U(),To.update(Lt=>(Lt[st].snapped=!Lt[st].snapped,Lt))}function _e(st){U(),To.update(Lt=>(Lt.splice(st,1),Lt)),t(2,N=!1)}function ze(st,Lt){try{if(st)return Dx(Lt)}catch{}return Xf()}function re(st,Lt,De,at){if(at||Lt.length>=3)return Xf();try{if(st&&Lt.length>0&&De)return JSON.parse(st.inner.calculateRoute([Lt[Lt.length-1],De]))}catch{}return Xf()}function ce(st,Lt,De){if(De)return;if(!st||Lt.length<3){t(9,P=[]);return}let at=[],tt=1,it=JSON.parse(JSON.stringify(Lt));it.push(it[0]);for(let ne=0;ne(Lt.splice(st.insertIdx,0,{point:st.point,snapped:st.snapped}),Lt)),t(4,B=!0)}function Me(st){To.update(Lt=>(Lt[st.insertIdx].point=st.point,Lt))}function ft(){t(4,B=!1)}function Ct(st){let Lt=st.target.tagName,De=Lt=="INPUT"||Lt=="TEXTAREA";st.key=="Enter"&&!De||st.key=="Escape"?(st.stopPropagation(),l.length>=3?x():window.alert("You can't save this area unless it has at least three points. Press 'Cancel' to discard these changes.")):st.key=="s"&&!De?K():st.key=="z"&&st.ctrlKey&&(st.stopPropagation(),G())}function Ot(){U(),t(3,z=!0)}const Ke=[[]];function Kt(st,Lt){r.$$.not_equal(Lt.point,st)&&(Lt.point=st,t(9,P))}const vt=st=>Ze(st),At=st=>Me(st),Vt=st=>{Ze(st),t(4,B=!1)};function sr(st,Lt){r.$$.not_equal(Lt.point,st)&&(Lt.point=st,To.set(l))}const fr=st=>Y(st),er=st=>_e(st),Nt=()=>t(2,N=!0),nr=()=>t(2,N=!1),tr=()=>t(3,z=!1);function Lr(){k=this.__value,t(7,k)}function Pr(){k=this.__value,t(7,k)}return r.$$set=st=>{"map"in st&&t(22,_=st.map),"finish"in st&&t(0,x=st.finish),"cancel"in st&&t(1,S=st.cancel),"$$scope"in st&&t(38,a=st.$$scope)},r.$$.update=()=>{r.$$.dirty[0]&112&&ce(u,l,B),r.$$.dirty[0]&8388716&&t(10,n=re(u,l,D,N||z)),r.$$.dirty[0]&32&&O(l)},[x,S,N,z,B,l,u,k,C,P,n,G,me,X,Y,_e,ze,Ze,Me,ft,Ct,Ot,_,D,d,Kt,vt,At,Vt,sr,fr,er,Nt,nr,tr,Lr,Ke,Pr,a]}class bz extends Ht{constructor(e){super(),Zt(this,e,vz,yz,Ut,{map:22,finish:0,cancel:1},null,[-1,-1])}}function wz(r){let e;return{c(){e=rt("Choose project")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function xz(r){let e;return{c(){e=rt("Pick neighbourhood")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function Sz(r){let e;return{c(){e=fe("li"),e.textContent="Creating new neighbourhood boundary"},m(t,n){be(t,e,n)},p:Mt,i:Mt,o:Mt,d(t){t&&ve(e)}}}function kz(r){let e,t,n,l,u;return t=new Zr({props:{$$slots:{default:[Tz]},$$scope:{ctx:r}}}),t.$on("click",r[8]),{c(){e=fe("li"),je(t.$$.fragment),n=Ve(),l=fe("li"),l.textContent="Changing neighbourhood boundary"},m(d,a){be(d,e,a),Oe(t,e,null),be(d,n,a),be(d,l,a),u=!0},p(d,a){const _={};a&2048&&(_.$$scope={dirty:a,ctx:d}),t.$set(_)},i(d){u||(oe(t.$$.fragment,d),u=!0)},o(d){de(t.$$.fragment,d),u=!1},d(d){d&&(ve(e),ve(n),ve(l)),Ne(t)}}}function Tz(r){let e;return{c(){e=rt("Editing")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function Ez(r){let e,t,n,l,u,d,a,_,x,S,k,C;u=new Zr({props:{$$slots:{default:[wz]},$$scope:{ctx:r}}}),u.$on("click",r[6]),_=new Zr({props:{$$slots:{default:[xz]},$$scope:{ctx:r}}}),_.$on("click",r[7]);const P=[kz,Sz],D=[];function N(z,B){return z[1]?0:1}return S=N(r),k=D[S]=P[S](r),{c(){e=fe("div"),t=fe("nav"),n=fe("ul"),l=fe("li"),je(u.$$.fragment),d=Ve(),a=fe("li"),je(_.$$.fragment),x=Ve(),k.c(),Ee(t,"aria-label","breadcrumb"),Ee(e,"slot","extra-top")},m(z,B){be(z,e,B),ie(e,t),ie(t,n),ie(n,l),Oe(u,l,null),ie(n,d),ie(n,a),Oe(_,a,null),ie(n,x),D[S].m(n,null),C=!0},p(z,B){const O={};B&2048&&(O.$$scope={dirty:B,ctx:z}),u.$set(O);const G={};B&2048&&(G.$$scope={dirty:B,ctx:z}),_.$set(G);let U=S;S=N(z),S===U?D[S].p(z,B):(yr(),de(D[U],1,1,()=>{D[U]=null}),vr(),k=D[S],k?k.p(z,B):(k=D[S]=P[S](z),k.c()),oe(k,1),k.m(n,null))},i(z){C||(oe(u.$$.fragment,z),oe(_.$$.fragment,z),oe(k),C=!0)},o(z){de(u.$$.fragment,z),de(_.$$.fragment,z),de(k),C=!1},d(z){z&&ve(e),Ne(u),Ne(_),D[S].d()}}}function Mz(r){let e,t,n,l;return{c(){e=fe("div"),t=fe("h1"),n=rt("Draw your neighbourhood boundary for "),l=rt(r[0]),Ee(e,"slot","extra-sidebar")},m(u,d){be(u,e,d),ie(e,t),ie(t,n),ie(t,l)},p(u,d){d&1&&Ar(l,u[0])},d(u){u&&ve(e)}}}function Cz(r){let e,t;return e=new bz({props:{map:dn(r[3]),finish:r[4],cancel:r[5],$$slots:{"extra-sidebar":[Mz],"extra-top":[Ez]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,[l]){const u={};l&8&&(u.map=dn(n[3])),l&2055&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function Iz(r,e,t){let n,l,u,d;wt(r,pr,D=>t(2,n=D)),wt(r,ri,D=>t(9,l=D)),wt(r,To,D=>t(10,u=D)),wt(r,ls,D=>t(3,d=D));let{name:a}=e,{existing:_}=e;_&&(_.properties.waypoints?Rt(To,u=_.properties.waypoints.map(D=>({point:[D.lon,D.lat],snapped:D.snapped})),u):Rt(To,u=_.geometry.coordinates[0].slice(1).map(D=>({point:D,snapped:!1})),u));function x(){if(u.length>=3)try{let D=Dx(u);l.setNeighbourhoodBoundary(a,D),Sc(),l.setCurrentNeighbourhood(a),Rt(pr,n={mode:"neighbourhood"},n)}catch{window.alert("Known georust bug hit, sorry. You may need to just refresh the page now."),S()}}function S(){_?Rt(pr,n={mode:"neighbourhood"},n):Rt(pr,n={mode:"network"},n)}const k=()=>Rt(pr,n={mode:"title"},n),C=()=>Rt(pr,n={mode:"network"},n),P=()=>Rt(pr,n={mode:"neighbourhood"},n);return r.$$set=D=>{"name"in D&&t(0,a=D.name),"existing"in D&&t(1,_=D.existing)},[a,_,n,d,x,S,k,C,P]}class Az extends Ht{constructor(e){super(),Zt(this,e,Iz,Cz,Ut,{name:0,existing:1})}}function Lz(r){let e;return{c(){e=rt("Choose project")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function Pz(r){let e;return{c(){e=rt("Pick neighbourhood")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function zz(r){let e,t,n,l,u,d,a,_,x,S,k;return u=new Zr({props:{$$slots:{default:[Lz]},$$scope:{ctx:r}}}),u.$on("click",r[10]),_=new Zr({props:{$$slots:{default:[Pz]},$$scope:{ctx:r}}}),_.$on("click",r[11]),{c(){e=fe("div"),t=fe("nav"),n=fe("ul"),l=fe("li"),je(u.$$.fragment),d=Ve(),a=fe("li"),je(_.$$.fragment),x=Ve(),S=fe("li"),S.textContent="Use an auto-generated boundary",Ee(t,"aria-label","breadcrumb"),Ee(e,"slot","top")},m(C,P){be(C,e,P),ie(e,t),ie(t,n),ie(n,l),Oe(u,l,null),ie(n,d),ie(n,a),Oe(_,a,null),ie(n,x),ie(n,S),k=!0},p(C,P){const D={};P&16384&&(D.$$scope={dirty:P,ctx:C}),u.$set(D);const N={};P&16384&&(N.$$scope={dirty:P,ctx:C}),_.$set(N)},i(C){k||(oe(u.$$.fragment,C),oe(_.$$.fragment,C),k=!0)},o(C){de(u.$$.fragment,C),de(_.$$.fragment,C),k=!1},d(C){C&&ve(e),Ne(u),Ne(_)}}}function Dz(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D,N,z,B;return t=new Od({}),t.$on("click",r[7]),{c(){e=fe("div"),je(t.$$.fragment),n=Ve(),l=fe("p"),l.textContent=`Click an area to use it as a neighbourhood. These are generated by finding + Draw anywhere`),x=Ve(),S=fe("p"),S.textContent="Click to add at least 3 points",Ee(n,"type","radio"),n.__value="snap",ei(n,n.__value),Ee(a,"type","radio"),a.__value="free",ei(a,a.__value),k.p(n,a)},m(D,N){be(D,e,N),ie(e,t),ie(t,n),n.checked=n.__value===r[7],ie(t,l),ie(e,u),ie(e,d),ie(d,a),a.checked=a.__value===r[7],ie(d,_),be(D,x,N),be(D,S,N),C||(P=[Tt(n,"change",r[35]),Tt(a,"change",r[37])],C=!0)},p(D,N){N[0]&128&&(n.checked=n.__value===D[7]),N[0]&128&&(a.checked=a.__value===D[7])},d(D){D&&(ve(e),ve(x),ve(S)),k.r(),C=!1,_n(P)}}}function dz(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D,N,z,B;const O=r[24]["extra-sidebar"],G=Vr(O,r,r[38],eb);S=new Ng({props:{$$slots:{default:[lz]},$$scope:{ctx:r}}});function U(ze,re){return ze[8].length==0?uz:cz}let K=U(r),me=K(r);function X(ze,re){return ze[5].length<3?fz:hz}let Y=X(r),_e=Y(r);return{c(){e=fe("div"),G&&G.c(),t=Ve(),n=fe("div"),l=fe("button"),u=rt("Finish"),a=Ve(),_=fe("button"),_.textContent="Cancel",x=Ve(),je(S.$$.fragment),k=Ve(),C=fe("button"),me.c(),D=Ve(),_e.c(),l.disabled=d=r[5].length<3,Ee(_,"class","secondary"),fn(n,"display","flex"),Ee(C,"class","secondary"),C.disabled=P=r[8].length==0,Ee(e,"slot","sidebar")},m(ze,re){be(ze,e,re),G&&G.m(e,null),ie(e,t),ie(e,n),ie(n,l),ie(l,u),ie(n,a),ie(n,_),ie(n,x),Oe(S,n,null),ie(e,k),ie(e,C),me.m(C,null),ie(e,D),_e.m(e,null),N=!0,z||(B=[Tt(l,"click",function(){wc(r[0])&&r[0].apply(this,arguments)}),Tt(_,"click",function(){wc(r[1])&&r[1].apply(this,arguments)}),Tt(C,"click",r[11])],z=!0)},p(ze,re){r=ze,G&&G.p&&(!N||re[1]&128)&&Gr(G,O,r,r[38],N?qr(O,r[38],re,sz):Wr(r[38]),eb),(!N||re[0]&32&&d!==(d=r[5].length<3))&&(l.disabled=d);const ce={};re[1]&128&&(ce.$$scope={dirty:re,ctx:r}),S.$set(ce),K===(K=U(r))&&me?me.p(r,re):(me.d(1),me=K(r),me&&(me.c(),me.m(C,null))),(!N||re[0]&256&&P!==(P=r[8].length==0))&&(C.disabled=P),Y===(Y=X(r))&&_e?_e.p(r,re):(_e.d(1),_e=Y(r),_e&&(_e.c(),_e.m(e,null)))},i(ze){N||(oe(G,ze),oe(S.$$.fragment,ze),N=!0)},o(ze){de(G,ze),de(S.$$.fragment,ze),N=!1},d(ze){ze&&ve(e),G&&G.d(ze),Ne(S),me.d(),_e.d(),z=!1,_n(B)}}}function pz(r){let e;return{c(){e=fe("span"),Ee(e,"class","dot svelte-1cj4rwq"),hi(e,"snapped-node",r[47].snapped),hi(e,"free-node",!r[47].snapped),hi(e,"hide",r[4])},m(t,n){be(t,e,n)},p(t,n){n[0]&512&&hi(e,"snapped-node",t[47].snapped),n[0]&512&&hi(e,"free-node",!t[47].snapped),n[0]&16&&hi(e,"hide",t[4])},d(t){t&&ve(e)}}}function nb(r){let e,t,n;function l(x){r[25](x,r[47])}function u(){return r[26](r[47])}function d(){return r[27](r[47])}function a(){return r[28](r[47])}let _={draggable:!0,zIndex:0,$$slots:{default:[pz]},$$scope:{ctx:r}};return r[47].point!==void 0&&(_.lngLat=r[47].point),e=new fd({props:_}),pn.push(()=>zo(e,"lngLat",l)),e.$on("dragstart",u),e.$on("drag",d),e.$on("dragend",r[19]),e.$on("click",a),{c(){je(e.$$.fragment)},m(x,S){Oe(e,x,S),n=!0},p(x,S){r=x;const k={};S[0]&528|S[1]&128&&(k.$$scope={dirty:S,ctx:r}),!t&&S[0]&512&&(t=!0,k.lngLat=r[47].point,Po(()=>t=!1)),e.$set(k)},i(x){n||(oe(e.$$.fragment,x),n=!0)},o(x){de(e.$$.fragment,x),n=!1},d(x){Ne(e,x)}}}function mz(r){let e;return{c(){e=fe("span"),e.textContent=`${r[46]+1}`,Ee(e,"class","dot svelte-1cj4rwq"),hi(e,"snapped",r[44].snapped)},m(t,n){be(t,e,n)},p(t,n){n[0]&32&&hi(e,"snapped",t[44].snapped)},d(t){t&&ve(e)}}}function ib(r){let e,t,n;function l(_){r[29](_,r[44])}function u(){return r[30](r[46])}function d(){return r[31](r[46])}let a={draggable:!0,zIndex:1,$$slots:{default:[mz]},$$scope:{ctx:r}};return r[44].point!==void 0&&(a.lngLat=r[44].point),e=new fd({props:a}),pn.push(()=>zo(e,"lngLat",l)),e.$on("click",u),e.$on("contextmenu",d),e.$on("mouseenter",r[32]),e.$on("mouseleave",r[33]),e.$on("dragstart",r[21]),e.$on("dragend",r[34]),{c(){je(e.$$.fragment)},m(_,x){Oe(e,_,x),n=!0},p(_,x){r=_;const S={};x[0]&32|x[1]&128&&(S.$$scope={dirty:x,ctx:r}),!t&&x[0]&32&&(t=!0,S.lngLat=r[44].point,Po(()=>t=!1)),e.$set(S)},i(_){n||(oe(e.$$.fragment,_),n=!0)},o(_){de(e.$$.fragment,_),n=!1},d(_){Ne(e,_)}}}function gz(r){let e,t,n,l;const u=[Hn("draw-area-lines"),{paint:{"line-color":"black","line-width":10}}];let d={};for(let x=0;xde(k[z],1,1,()=>{k[z]=null});let P=Jn(r[5]),D=[];for(let z=0;zde(D[z],1,1,()=>{D[z]=null});return d=new Pi({props:{data:r[16](r[6],r[5]),generateId:!0,$$slots:{default:[gz]},$$scope:{ctx:r}}}),_=new Pi({props:{data:r[10],$$slots:{default:[_z]},$$scope:{ctx:r}}}),{c(){e=fe("div"),je(t.$$.fragment),n=Ve();for(let z=0;zt(5,l=st)),wt(r,Lc,st=>t(6,u=st));let{$$slots:d={},$$scope:a}=e,{map:_}=e,{finish:x}=e,{cancel:S}=e;ti(()=>{Rt(To,l=[],l),u==null||u.stop(),_.getCanvas().style.cursor="inherit"});let k="snap",C=[],P=[],D=null,N=!1,z=!1,B=!1;function O(st){let Lt=st.length==0?"crosshair":"inherit";_.getCanvas().style.cursor=Lt}function G(){let st=C.pop();t(8,C),st&&Rt(To,l=st,l)}function U(){C.length==100&&C.shift(),t(8,C=[...C,JSON.parse(JSON.stringify(l))])}function K(){t(7,k=k=="snap"?"free":"snap"),D&&t(23,D.snapped=k=="snap",D)}function me(st){l.length>=3||(U(),To.update(Lt=>(Lt.push({point:st.detail.lngLat.toArray(),snapped:k=="snap"}),Lt)))}function X(st){t(23,D={point:st.detail.lngLat.toArray(),snapped:k=="snap"})}function Y(st){U(),To.update(Lt=>(Lt[st].snapped=!Lt[st].snapped,Lt))}function _e(st){U(),To.update(Lt=>(Lt.splice(st,1),Lt)),t(2,N=!1)}function ze(st,Lt){try{if(st)return Rx(Lt)}catch{}return Xf()}function re(st,Lt,De,at){if(at||Lt.length>=3)return Xf();try{if(st&&Lt.length>0&&De)return JSON.parse(st.inner.calculateRoute([Lt[Lt.length-1],De]))}catch{}return Xf()}function ce(st,Lt,De){if(De)return;if(!st||Lt.length<3){t(9,P=[]);return}let at=[],tt=1,it=JSON.parse(JSON.stringify(Lt));it.push(it[0]);for(let ne=0;ne(Lt.splice(st.insertIdx,0,{point:st.point,snapped:st.snapped}),Lt)),t(4,B=!0)}function Me(st){To.update(Lt=>(Lt[st.insertIdx].point=st.point,Lt))}function ft(){t(4,B=!1)}function Ct(st){let Lt=st.target.tagName,De=Lt=="INPUT"||Lt=="TEXTAREA";st.key=="Enter"&&!De||st.key=="Escape"?(st.stopPropagation(),l.length>=3?x():window.alert("You can't save this area unless it has at least three points. Press 'Cancel' to discard these changes.")):st.key=="s"&&!De?K():st.key=="z"&&st.ctrlKey&&(st.stopPropagation(),G())}function Ot(){U(),t(3,z=!0)}const Ke=[[]];function Kt(st,Lt){r.$$.not_equal(Lt.point,st)&&(Lt.point=st,t(9,P))}const vt=st=>Ze(st),At=st=>Me(st),Vt=st=>{Ze(st),t(4,B=!1)};function sr(st,Lt){r.$$.not_equal(Lt.point,st)&&(Lt.point=st,To.set(l))}const fr=st=>Y(st),er=st=>_e(st),Nt=()=>t(2,N=!0),nr=()=>t(2,N=!1),tr=()=>t(3,z=!1);function Lr(){k=this.__value,t(7,k)}function Pr(){k=this.__value,t(7,k)}return r.$$set=st=>{"map"in st&&t(22,_=st.map),"finish"in st&&t(0,x=st.finish),"cancel"in st&&t(1,S=st.cancel),"$$scope"in st&&t(38,a=st.$$scope)},r.$$.update=()=>{r.$$.dirty[0]&112&&ce(u,l,B),r.$$.dirty[0]&8388716&&t(10,n=re(u,l,D,N||z)),r.$$.dirty[0]&32&&O(l)},[x,S,N,z,B,l,u,k,C,P,n,G,me,X,Y,_e,ze,Ze,Me,ft,Ct,Ot,_,D,d,Kt,vt,At,Vt,sr,fr,er,Nt,nr,tr,Lr,Ke,Pr,a]}class wz extends Ht{constructor(e){super(),Zt(this,e,bz,vz,Ut,{map:22,finish:0,cancel:1},null,[-1,-1])}}function xz(r){let e;return{c(){e=rt("Choose project")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function Sz(r){let e;return{c(){e=rt("Pick neighbourhood")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function kz(r){let e;return{c(){e=fe("li"),e.textContent="Creating new neighbourhood boundary"},m(t,n){be(t,e,n)},p:Mt,i:Mt,o:Mt,d(t){t&&ve(e)}}}function Tz(r){let e,t,n,l,u;return t=new Zr({props:{$$slots:{default:[Ez]},$$scope:{ctx:r}}}),t.$on("click",r[8]),{c(){e=fe("li"),je(t.$$.fragment),n=Ve(),l=fe("li"),l.textContent="Changing neighbourhood boundary"},m(d,a){be(d,e,a),Oe(t,e,null),be(d,n,a),be(d,l,a),u=!0},p(d,a){const _={};a&2048&&(_.$$scope={dirty:a,ctx:d}),t.$set(_)},i(d){u||(oe(t.$$.fragment,d),u=!0)},o(d){de(t.$$.fragment,d),u=!1},d(d){d&&(ve(e),ve(n),ve(l)),Ne(t)}}}function Ez(r){let e;return{c(){e=rt("Editing")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function Mz(r){let e,t,n,l,u,d,a,_,x,S,k,C;u=new Zr({props:{$$slots:{default:[xz]},$$scope:{ctx:r}}}),u.$on("click",r[6]),_=new Zr({props:{$$slots:{default:[Sz]},$$scope:{ctx:r}}}),_.$on("click",r[7]);const P=[Tz,kz],D=[];function N(z,B){return z[1]?0:1}return S=N(r),k=D[S]=P[S](r),{c(){e=fe("div"),t=fe("nav"),n=fe("ul"),l=fe("li"),je(u.$$.fragment),d=Ve(),a=fe("li"),je(_.$$.fragment),x=Ve(),k.c(),Ee(t,"aria-label","breadcrumb"),Ee(e,"slot","extra-top")},m(z,B){be(z,e,B),ie(e,t),ie(t,n),ie(n,l),Oe(u,l,null),ie(n,d),ie(n,a),Oe(_,a,null),ie(n,x),D[S].m(n,null),C=!0},p(z,B){const O={};B&2048&&(O.$$scope={dirty:B,ctx:z}),u.$set(O);const G={};B&2048&&(G.$$scope={dirty:B,ctx:z}),_.$set(G);let U=S;S=N(z),S===U?D[S].p(z,B):(yr(),de(D[U],1,1,()=>{D[U]=null}),vr(),k=D[S],k?k.p(z,B):(k=D[S]=P[S](z),k.c()),oe(k,1),k.m(n,null))},i(z){C||(oe(u.$$.fragment,z),oe(_.$$.fragment,z),oe(k),C=!0)},o(z){de(u.$$.fragment,z),de(_.$$.fragment,z),de(k),C=!1},d(z){z&&ve(e),Ne(u),Ne(_),D[S].d()}}}function Cz(r){let e,t,n,l;return{c(){e=fe("div"),t=fe("h1"),n=rt("Draw your neighbourhood boundary for "),l=rt(r[0]),Ee(e,"slot","extra-sidebar")},m(u,d){be(u,e,d),ie(e,t),ie(t,n),ie(t,l)},p(u,d){d&1&&Ar(l,u[0])},d(u){u&&ve(e)}}}function Iz(r){let e,t;return e=new wz({props:{map:dn(r[3]),finish:r[4],cancel:r[5],$$slots:{"extra-sidebar":[Cz],"extra-top":[Mz]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,[l]){const u={};l&8&&(u.map=dn(n[3])),l&2055&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function Az(r,e,t){let n,l,u,d;wt(r,pr,D=>t(2,n=D)),wt(r,ri,D=>t(9,l=D)),wt(r,To,D=>t(10,u=D)),wt(r,ls,D=>t(3,d=D));let{name:a}=e,{existing:_}=e;_&&(_.properties.waypoints?Rt(To,u=_.properties.waypoints.map(D=>({point:[D.lon,D.lat],snapped:D.snapped})),u):Rt(To,u=_.geometry.coordinates[0].slice(1).map(D=>({point:D,snapped:!1})),u));function x(){if(u.length>=3)try{let D=Rx(u);l.setNeighbourhoodBoundary(a,D),Sc(),l.setCurrentNeighbourhood(a),Rt(pr,n={mode:"neighbourhood"},n)}catch{window.alert("Known georust bug hit, sorry. You may need to just refresh the page now."),S()}}function S(){_?Rt(pr,n={mode:"neighbourhood"},n):Rt(pr,n={mode:"network"},n)}const k=()=>Rt(pr,n={mode:"title"},n),C=()=>Rt(pr,n={mode:"network"},n),P=()=>Rt(pr,n={mode:"neighbourhood"},n);return r.$$set=D=>{"name"in D&&t(0,a=D.name),"existing"in D&&t(1,_=D.existing)},[a,_,n,d,x,S,k,C,P]}class Lz extends Ht{constructor(e){super(),Zt(this,e,Az,Iz,Ut,{name:0,existing:1})}}function Pz(r){let e;return{c(){e=rt("Choose project")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function zz(r){let e;return{c(){e=rt("Pick neighbourhood")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function Dz(r){let e,t,n,l,u,d,a,_,x,S,k;return u=new Zr({props:{$$slots:{default:[Pz]},$$scope:{ctx:r}}}),u.$on("click",r[10]),_=new Zr({props:{$$slots:{default:[zz]},$$scope:{ctx:r}}}),_.$on("click",r[11]),{c(){e=fe("div"),t=fe("nav"),n=fe("ul"),l=fe("li"),je(u.$$.fragment),d=Ve(),a=fe("li"),je(_.$$.fragment),x=Ve(),S=fe("li"),S.textContent="Use an auto-generated boundary",Ee(t,"aria-label","breadcrumb"),Ee(e,"slot","top")},m(C,P){be(C,e,P),ie(e,t),ie(t,n),ie(n,l),Oe(u,l,null),ie(n,d),ie(n,a),Oe(_,a,null),ie(n,x),ie(n,S),k=!0},p(C,P){const D={};P&16384&&(D.$$scope={dirty:P,ctx:C}),u.$set(D);const N={};P&16384&&(N.$$scope={dirty:P,ctx:C}),_.$set(N)},i(C){k||(oe(u.$$.fragment,C),oe(_.$$.fragment,C),k=!0)},o(C){de(u.$$.fragment,C),de(_.$$.fragment,C),k=!1},d(C){C&&ve(e),Ne(u),Ne(_)}}}function Rz(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D,N,z,B;return t=new Od({}),t.$on("click",r[7]),{c(){e=fe("div"),je(t.$$.fragment),n=Ve(),l=fe("p"),l.textContent=`Click an area to use it as a neighbourhood. These are generated by finding roads, railways, and water that form severances. There are many bugs; this is experimental. The colors are arbitrary, just to distinguish better.`,u=Ve(),d=fe("button"),d.textContent="Export to GeoJSON",a=Ve(),_=fe("label"),x=rt(`Minimum area (km²) `),S=fe("input"),k=Ve(),C=fe("label"),P=fe("input"),D=rt(` - Remove areas not touching a big road`),Ee(d,"class","secondary"),Ee(S,"type","number"),Ee(S,"min","0"),Ee(S,"max","1"),Ee(S,"step","0.01"),Ee(P,"type","checkbox"),Ee(e,"slot","sidebar")},m(O,G){be(O,e,G),Oe(t,e,null),ie(e,n),ie(e,l),ie(e,u),ie(e,d),ie(e,a),ie(e,_),ie(_,x),ie(_,S),ei(S,r[0]),ie(e,k),ie(e,C),ie(C,P),P.checked=r[1],ie(C,D),N=!0,z||(B=[Tt(d,"click",r[5]),Tt(S,"input",r[8]),Tt(P,"change",r[9])],z=!0)},p(O,G){G&1&&bg(S.value)!==O[0]&&ei(S,O[0]),G&2&&(P.checked=O[1])},i(O){N||(oe(t.$$.fragment,O),N=!0)},o(O){de(t.$$.fragment,O),N=!1},d(O){O&&ve(e),Ne(t),z=!1,_n(B)}}}function Rz(r){let e,t,n=r[13].area_km2.toFixed(1)+"",l,u,d,a,_,x=r[13].touches_big_road+"",S,k,C=r[13].touches_railway+"",P,D,N=r[13].touches_waterway+"",z;return{c(){e=fe("p"),t=rt("Area: "),l=rt(n),u=rt(" km²"),d=Ve(),a=fe("p"),_=rt("Borders roads = "),S=rt(x),k=rt(", railway = "),P=rt(C),D=rt(`, - water = `),z=rt(N)},m(B,O){be(B,e,O),ie(e,t),ie(e,l),ie(e,u),be(B,d,O),be(B,a,O),ie(a,_),ie(a,S),ie(a,k),ie(a,P),ie(a,D),ie(a,z)},p(B,O){O&8192&&n!==(n=B[13].area_km2.toFixed(1)+"")&&Ar(l,n),O&8192&&x!==(x=B[13].touches_big_road+"")&&Ar(S,x),O&8192&&C!==(C=B[13].touches_railway+"")&&Ar(P,C),O&8192&&N!==(N=B[13].touches_waterway+"")&&Ar(z,N)},d(B){B&&(ve(e),ve(d),ve(a))}}}function Bz(r){let e,t;return e=new Os({props:{openOn:"hover",$$slots:{default:[Rz,({props:n})=>({13:n}),({props:n})=>n?8192:0]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&24576&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function Fz(r){let e,t,n,l;const u=[Hn("auto-boundaries-areas"),{filter:r[6](r[0],r[1])},{manageHoverState:!0},{paint:{"fill-color":["match",["%",["id"],5],0,"blue",1,"yellow",2,"green",3,"purple",4,"orange","black"],"fill-opacity":kc(.3,.7)}},{hoverCursor:"pointer"}];let d={$$slots:{default:[Bz]},$$scope:{ctx:r}};for(let x=0;xt(2,n=z)),wt(r,ri,z=>t(12,l=z));let u=JSON.parse(l.renderAutoBoundaries()),d=0,a=!0;function _(z){let B=window.prompt("What do you want to name the neighbourhood?");if(B)try{let O={type:"Feature",properties:{},geometry:u.features[z.detail.features[0].id].geometry};l.setNeighbourhoodBoundary(B,O),Sc(),l.setCurrentNeighbourhood(B),Rt(pr,n={mode:"neighbourhood"},n)}catch(O){console.log(O),window.alert("Known georust bug hit, sorry. You may need to just refresh the page now.")}}function x(){ad("auto_boundaries.geojson",JSON.stringify(u,null," "))}function S(z,B){let O=["all",r5,[">=",["get","area_km2"],z]];return B&&O.push(["get","touches_big_road"]),O}const k=()=>Rt(pr,n={mode:"network"},n);function C(){d=bg(this.value),t(0,d)}function P(){a=this.checked,t(1,a)}return[d,a,n,u,_,x,S,k,C,P,()=>Rt(pr,n={mode:"title"},n),()=>Rt(pr,n={mode:"network"},n)]}class Uz extends Ht{constructor(e){super(),Zt(this,e,jz,Nz,Ut,{})}}const Vz=["==",["geometry-type"],"Polygon"],qz=["==",["geometry-type"],"LineString"],Gz=["==",["geometry-type"],"Point"];function Rx(){return{type:"FeatureCollection",features:[]}}function Em(r){return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:Bx(r)}}}function Bx(r){return[Math.round(r[0]*1e7)/1e7,Math.round(r[1]*1e7)/1e7]}const Fx=Tr(Rx()),Ox=Tr(0),Wz=100;class Zz{constructor(e){Wn(this,"map");Wn(this,"active");Wn(this,"eventListenersSuccess");Wn(this,"eventListenersUpdated");Wn(this,"eventListenersFailure");Wn(this,"points");Wn(this,"cursor");Wn(this,"hover");Wn(this,"dragFrom");Wn(this,"previousStates");Wn(this,"onMouseMove",e=>{if(this.active&&!this.dragFrom)this.recalculateHovering(e);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let t=this.dragFrom[0]-e.lngLat.lng,n=this.dragFrom[1]-e.lngLat.lat;for(let l of this.points)l[0]-=t,l[1]-=n}else this.points[this.hover]=e.lngLat.toArray();this.dragFrom=e.lngLat.toArray(),this.redraw()}});Wn(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let t=[];if(ib(this.points).forEach((n,l)=>{t.push([l+1,tk(n,this.cursor).properties.dist])}),t.sort((n,l)=>n[1]-l[1]),t.length>0){let n=t[0][0];this.points.splice(n,0,this.cursor.geometry.coordinates),this.hover=n}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(e))});Wn(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=Em(e.lngLat.toArray()),this.onClick(e),this.finish())});Wn(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});Wn(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});Wn(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});Wn(this,"onKeyDown",e=>{this.active&&e.key=="Escape"&&(e.stopPropagation(),this.cancel())});this.map=e,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let e=this.polygonFeature();if(e)for(let t of this.eventListenersSuccess)t(e);else for(let t of this.eventListenersFailure)t();this.stop()}cancel(){for(let e of this.eventListenersFailure)e();this.stop()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(e){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(e.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let e=Rx();this.points.forEach((l,u)=>{let d=Em(l);d.properties.hover=this.hover==u,d.properties.idx=u,e.features.push(d)}),e.features=e.features.concat(ib(this.points));let t=this.polygonFeature();t&&(t.properties.hover=this.hover=="polygon",e.features.push(t)),Fx.set(e);let n="crosshair";this.hover!=null&&(n=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=n,Ox.set(this.previousStates.length)}pointsUpdated(){let e=this.polygonFeature();if(e)for(let t of this.eventListenersUpdated)t(e)}recalculateHovering(e){this.cursor=null,this.hover=null;for(let t of this.map.queryRenderedFeatures(e.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(t.geometry.type=="Polygon"){this.hover="polygon";break}else if(t.geometry.type=="Point"&&Object.hasOwn(t.properties,"idx")){this.hover=t.properties.idx;break}this.hover==null&&(this.cursor=Em(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(Bx),t=[JSON.parse(JSON.stringify(e))];return t[0].push(JSON.parse(JSON.stringify(t[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:t},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>Wz&&this.previousStates.shift()}}function ib(r){let e=[];for(let t=0;t=3&&e.push({type:"Feature",geometry:{type:"LineString",coordinates:[r[r.length-1],r[0]]},properties:{}}),e}function Hz(r){let e,t,n;return{c(){e=rt("Undo ("),t=rt(r[1]),n=rt(")")},m(l,u){be(l,e,u),be(l,t,u),be(l,n,u)},p(l,u){u&2&&Ar(t,l[1])},d(l){l&&(ve(e),ve(t),ve(n))}}}function $z(r){let e;return{c(){e=rt("Undo")},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function Xz(r){let e,t,n,l,u,d,a,_,x,S,k;function C(N,z){return N[1]==0?$z:Hz}let P=C(r),D=P(r);return{c(){e=fe("div"),t=fe("button"),t.textContent="Finish",n=Ve(),l=fe("button"),l.textContent="Cancel",u=Ve(),d=fe("button"),D.c(),_=Ve(),x=fe("ul"),x.innerHTML=`
  • Click + Remove areas not touching a big road`),Ee(d,"class","secondary"),Ee(S,"type","number"),Ee(S,"min","0"),Ee(S,"max","1"),Ee(S,"step","0.01"),Ee(P,"type","checkbox"),Ee(e,"slot","sidebar")},m(O,G){be(O,e,G),Oe(t,e,null),ie(e,n),ie(e,l),ie(e,u),ie(e,d),ie(e,a),ie(e,_),ie(_,x),ie(_,S),ei(S,r[0]),ie(e,k),ie(e,C),ie(C,P),P.checked=r[1],ie(C,D),N=!0,z||(B=[Tt(d,"click",r[5]),Tt(S,"input",r[8]),Tt(P,"change",r[9])],z=!0)},p(O,G){G&1&&wg(S.value)!==O[0]&&ei(S,O[0]),G&2&&(P.checked=O[1])},i(O){N||(oe(t.$$.fragment,O),N=!0)},o(O){de(t.$$.fragment,O),N=!1},d(O){O&&ve(e),Ne(t),z=!1,_n(B)}}}function Bz(r){let e,t,n=r[13].area_km2.toFixed(1)+"",l,u,d,a,_,x=r[13].touches_big_road+"",S,k,C=r[13].touches_railway+"",P,D,N=r[13].touches_waterway+"",z;return{c(){e=fe("p"),t=rt("Area: "),l=rt(n),u=rt(" km²"),d=Ve(),a=fe("p"),_=rt("Borders roads = "),S=rt(x),k=rt(", railway = "),P=rt(C),D=rt(`, + water = `),z=rt(N)},m(B,O){be(B,e,O),ie(e,t),ie(e,l),ie(e,u),be(B,d,O),be(B,a,O),ie(a,_),ie(a,S),ie(a,k),ie(a,P),ie(a,D),ie(a,z)},p(B,O){O&8192&&n!==(n=B[13].area_km2.toFixed(1)+"")&&Ar(l,n),O&8192&&x!==(x=B[13].touches_big_road+"")&&Ar(S,x),O&8192&&C!==(C=B[13].touches_railway+"")&&Ar(P,C),O&8192&&N!==(N=B[13].touches_waterway+"")&&Ar(z,N)},d(B){B&&(ve(e),ve(d),ve(a))}}}function Fz(r){let e,t;return e=new Os({props:{openOn:"hover",$$slots:{default:[Bz,({props:n})=>({13:n}),({props:n})=>n?8192:0]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&24576&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function Oz(r){let e,t,n,l;const u=[Hn("auto-boundaries-areas"),{filter:r[6](r[0],r[1])},{manageHoverState:!0},{paint:{"fill-color":["match",["%",["id"],5],0,"blue",1,"yellow",2,"green",3,"purple",4,"orange","black"],"fill-opacity":kc(.3,.7)}},{hoverCursor:"pointer"}];let d={$$slots:{default:[Fz]},$$scope:{ctx:r}};for(let x=0;xt(2,n=z)),wt(r,ri,z=>t(12,l=z));let u=JSON.parse(l.renderAutoBoundaries()),d=0,a=!0;function _(z){let B=yg(l,"What do you want to name the neighbourhood?","");if(B)try{let O={type:"Feature",properties:{},geometry:u.features[z.detail.features[0].id].geometry};l.setNeighbourhoodBoundary(B,O),Sc(),l.setCurrentNeighbourhood(B),Rt(pr,n={mode:"neighbourhood"},n)}catch(O){console.log(O),window.alert("Known georust bug hit, sorry. You may need to just refresh the page now.")}}function x(){ad("auto_boundaries.geojson",JSON.stringify(u,null," "))}function S(z,B){let O=["all",n5,[">=",["get","area_km2"],z]];return B&&O.push(["get","touches_big_road"]),O}const k=()=>Rt(pr,n={mode:"network"},n);function C(){d=wg(this.value),t(0,d)}function P(){a=this.checked,t(1,a)}return[d,a,n,u,_,x,S,k,C,P,()=>Rt(pr,n={mode:"title"},n),()=>Rt(pr,n={mode:"network"},n)]}class Vz extends Ht{constructor(e){super(),Zt(this,e,Uz,jz,Ut,{})}}const qz=["==",["geometry-type"],"Polygon"],Gz=["==",["geometry-type"],"LineString"],Wz=["==",["geometry-type"],"Point"];function Bx(){return{type:"FeatureCollection",features:[]}}function Em(r){return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:Fx(r)}}}function Fx(r){return[Math.round(r[0]*1e7)/1e7,Math.round(r[1]*1e7)/1e7]}const Ox=Tr(Bx()),Nx=Tr(0),Zz=100;class Hz{constructor(e){Wn(this,"map");Wn(this,"active");Wn(this,"eventListenersSuccess");Wn(this,"eventListenersUpdated");Wn(this,"eventListenersFailure");Wn(this,"points");Wn(this,"cursor");Wn(this,"hover");Wn(this,"dragFrom");Wn(this,"previousStates");Wn(this,"onMouseMove",e=>{if(this.active&&!this.dragFrom)this.recalculateHovering(e);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let t=this.dragFrom[0]-e.lngLat.lng,n=this.dragFrom[1]-e.lngLat.lat;for(let l of this.points)l[0]-=t,l[1]-=n}else this.points[this.hover]=e.lngLat.toArray();this.dragFrom=e.lngLat.toArray(),this.redraw()}});Wn(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let t=[];if(ob(this.points).forEach((n,l)=>{t.push([l+1,rk(n,this.cursor).properties.dist])}),t.sort((n,l)=>n[1]-l[1]),t.length>0){let n=t[0][0];this.points.splice(n,0,this.cursor.geometry.coordinates),this.hover=n}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(e))});Wn(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=Em(e.lngLat.toArray()),this.onClick(e),this.finish())});Wn(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});Wn(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});Wn(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});Wn(this,"onKeyDown",e=>{this.active&&e.key=="Escape"&&(e.stopPropagation(),this.cancel())});this.map=e,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let e=this.polygonFeature();if(e)for(let t of this.eventListenersSuccess)t(e);else for(let t of this.eventListenersFailure)t();this.stop()}cancel(){for(let e of this.eventListenersFailure)e();this.stop()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(e){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(e.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let e=Bx();this.points.forEach((l,u)=>{let d=Em(l);d.properties.hover=this.hover==u,d.properties.idx=u,e.features.push(d)}),e.features=e.features.concat(ob(this.points));let t=this.polygonFeature();t&&(t.properties.hover=this.hover=="polygon",e.features.push(t)),Ox.set(e);let n="crosshair";this.hover!=null&&(n=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=n,Nx.set(this.previousStates.length)}pointsUpdated(){let e=this.polygonFeature();if(e)for(let t of this.eventListenersUpdated)t(e)}recalculateHovering(e){this.cursor=null,this.hover=null;for(let t of this.map.queryRenderedFeatures(e.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(t.geometry.type=="Polygon"){this.hover="polygon";break}else if(t.geometry.type=="Point"&&Object.hasOwn(t.properties,"idx")){this.hover=t.properties.idx;break}this.hover==null&&(this.cursor=Em(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(Fx),t=[JSON.parse(JSON.stringify(e))];return t[0].push(JSON.parse(JSON.stringify(t[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:t},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>Zz&&this.previousStates.shift()}}function ob(r){let e=[];for(let t=0;t=3&&e.push({type:"Feature",geometry:{type:"LineString",coordinates:[r[r.length-1],r[0]]},properties:{}}),e}function $z(r){let e,t,n;return{c(){e=rt("Undo ("),t=rt(r[1]),n=rt(")")},m(l,u){be(l,e,u),be(l,t,u),be(l,n,u)},p(l,u){u&2&&Ar(t,l[1])},d(l){l&&(ve(e),ve(t),ve(n))}}}function Xz(r){let e;return{c(){e=rt("Undo")},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function Kz(r){let e,t,n,l,u,d,a,_,x,S,k;function C(N,z){return N[1]==0?Xz:$z}let P=C(r),D=P(r);return{c(){e=fe("div"),t=fe("button"),t.textContent="Finish",n=Ve(),l=fe("button"),l.textContent="Cancel",u=Ve(),d=fe("button"),D.c(),_=Ve(),x=fe("ul"),x.innerHTML=`
  • Click the map to add a vertex
  • Click a vertex to delete it
  • Drag a vertex or the polygon to move it
  • Press Control+Z @@ -662,14 +662,14 @@ and limitations under the License. or double click to finish
  • Press Escape - to cancel
  • `,d.disabled=a=r[1]==0,fn(e,"display","flex"),fn(e,"justify-content","space-between")},m(N,z){be(N,e,z),ie(e,t),ie(e,n),ie(e,l),ie(e,u),ie(e,d),D.m(d,null),be(N,_,z),be(N,x,z),S||(k=[Tt(t,"click",r[2]),Tt(l,"click",r[3]),Tt(d,"click",r[4])],S=!0)},p(N,[z]){P===(P=C(N))&&D?D.p(N,z):(D.d(1),D=P(N),D&&(D.c(),D.m(d,null))),z&2&&a!==(a=N[1]==0)&&(d.disabled=a)},i:Mt,o:Mt,d(N){N&&(ve(e),ve(_),ve(x)),D.d(),S=!1,_n(k)}}}function Kz(r,e,t){let n;wt(r,Ox,_=>t(1,n=_));let{polygonTool:l}=e;const u=()=>l.finish(),d=()=>l.cancel(),a=()=>l.undo();return r.$$set=_=>{"polygonTool"in _&&t(0,l=_.polygonTool)},[l,n,u,d,a]}class Jz extends Ht{constructor(e){super(),Zt(this,e,Kz,Xz,Ut,{polygonTool:0})}}let Yz=Date.now();function Mh(r){return`${r}-${Yz++}`}const Nx=Symbol.for("svelte-maplibre");function Qz(){return Cb(Nx)}function ob(r){return{subscribe:r.subscribe}}function jx({key:r,setPopupTarget:e=!1,setCluster:t=!1,setMouseEvent:n=!1}){let l=Qz(),u=Tr(null),d=ob(u),a={...l,[r]:ob(u)};if(e&&(a.popupTarget=d),n){let _=Tr(null);a.layerEvent=_,l.layerEvent=_}return t&&(a.cluster=Tr()),wg(Nx,a),{...l,self:u}}function e8(){return jx({key:"source",setCluster:!0})}function t8(r=!0){return jx({key:"layer",setPopupTarget:r,setMouseEvent:r})}function sb(r){let e;return t=>{if(t)for(let n in t){let l=e==null?void 0:e[n],u=t[n];l!==u&&r(n,u,l)}else if(e)for(let n in e)r(n,void 0,e[n]);e=t}}function r8(r,...e){let t=[r];for(let n of e)if(n)Array.isArray(n)&&n[0]===r?t.push(...n.slice(1)):t.push(n);else continue;if(t.length!==1)return t.length===2?t[1]:t}function n8(r){return r===!0?["has","point_count"]:r===!1?["!",["has","point_count"]]:void 0}function ab(r){let e=r[0],t,n,l=lb(r);return{c(){l.c(),t=$n()},m(u,d){l.m(u,d),be(u,t,d),n=!0},p(u,d){d[0]&1&&Ut(e,e=u[0])?(yr(),de(l,1,1,Mt),vr(),l=lb(u),l.c(),oe(l,1),l.m(t.parentNode,t)):l.p(u,d)},i(u){n||(oe(l),n=!0)},o(u){de(l),n=!1},d(u){u&&ve(t),l.d(u)}}}function lb(r){let e;const t=r[36].default,n=Vr(t,r,r[35],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u[1]&16)&&Gr(n,t,l,l[35],e?qr(t,l[35],u,null):Wr(l[35]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function i8(r){let e,t,n=r[0]&&ab(r);return{c(){n&&n.c(),e=$n()},m(l,u){n&&n.m(l,u),be(l,e,u),t=!0},p(l,u){l[0]?n?(n.p(l,u),u[0]&1&&oe(n,1)):(n=ab(l),n.c(),oe(n,1),n.m(e.parentNode,e)):n&&(yr(),de(n,1,1,()=>{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function o8(r,e,t){let n,l,u,d,a,_,x,S,k,C,P,D,{$$slots:N={},$$scope:z}=e,{id:B=Mh("layer")}=e,{source:O=void 0}=e,{sourceLayer:G=void 0}=e,{beforeId:U=void 0}=e,{beforeLayerType:K=void 0}=e,{type:me}=e,{paint:X=void 0}=e,{layout:Y=void 0}=e,{filter:_e=void 0}=e,{applyToClusters:ze=void 0}=e,{minzoom:re=void 0}=e,{maxzoom:ce=void 0}=e,{manageHoverState:Ze=!1}=e,{hovered:Me=null}=e,{interactive:ft=!0}=e,{hoverCursor:Ct=void 0}=e,{eventsIfTopMost:Ot=!1}=e;const Ke=us(),{map:Kt,source:vt,self:At,minzoom:Vt,maxzoom:sr,eventTopMost:fr,layerInfo:er}=t8();wt(r,Kt,De=>t(31,k=De)),wt(r,vt,De=>t(32,C=De)),wt(r,At,De=>t(0,S=De)),wt(r,Vt,De=>t(34,D=De)),wt(r,sr,De=>t(33,P=De)),ti(()=>{S&&k&&(er.delete(S),k==null||k.removeLayer(S))});let Nt;function nr(De){var ne,br;if(!ft||!S||!k||Ot&&fr(De)!==S)return;let at=De.features??[],tt=(br=(ne=at[0])==null?void 0:ne.properties)==null?void 0:br.cluster_id,it={event:De,map:k,clusterId:tt,layer:S,source:a,features:at};Ke(De.type,it)}function tr(De){var ne,br;if(!ft||!S||!k||Ot&&fr(De)!==S)return;Ct&&(k.getCanvas().style.cursor=Ct);let at=De.features??[];t(6,Me=at[0]??null);let tt=(br=(ne=at[0])==null?void 0:ne.properties)==null?void 0:br.cluster_id;Ke("mouseenter",{event:De,map:k,clusterId:tt,layer:S,source:a,features:at})}function Lr(De){var ne,br,We;if(!ft||!k)return;if(Ot&&fr(De)!==S){t(6,Me=null),Ze&&Nt!==void 0&&(k==null||k.setFeatureState({source:a,sourceLayer:G,id:Nt},{hover:!1}),Nt=void 0);return}k.getCanvas().style.cursor=Ct;let at=De.features??[],tt=(br=(ne=at[0])==null?void 0:ne.properties)==null?void 0:br.cluster_id,it=(We=at[0])==null?void 0:We.id;it!==Nt&&(Ze&&(Nt!==void 0&&(k==null||k.setFeatureState({source:a,id:Nt,sourceLayer:G},{hover:!1})),k==null||k.setFeatureState({source:a,id:it,sourceLayer:G},{hover:!0})),Nt=it,t(6,Me=at[0]??null)),Ke("mousemove",{event:De,map:k,clusterId:tt,layer:S,source:a,features:at})}function Pr(De){if(!(!ft||!S||!k)){if(Ct&&(k.getCanvas().style.cursor=""),t(6,Me=null),Ze&&Nt!==void 0){const at={source:a,id:Nt,sourceLayer:G};k==null||k.setFeatureState(at,{hover:!1}),Nt=void 0}Ke("mouseleave",{map:k,layer:S,source:a})}}let st=!0;function Lt(De){k&&(k.off("click",De,nr),k.off("dblclick",De,nr),k.off("contextmenu",De,nr),k.off("mouseenter",De,tr),k.off("mousemove",De,Lr),k.off("mouseleave",De,Pr))}return ti(()=>{k&&S&&Lt(S)}),r.$$set=De=>{"id"in De&&t(7,B=De.id),"source"in De&&t(8,O=De.source),"sourceLayer"in De&&t(9,G=De.sourceLayer),"beforeId"in De&&t(10,U=De.beforeId),"beforeLayerType"in De&&t(11,K=De.beforeLayerType),"type"in De&&t(12,me=De.type),"paint"in De&&t(13,X=De.paint),"layout"in De&&t(14,Y=De.layout),"filter"in De&&t(15,_e=De.filter),"applyToClusters"in De&&t(16,ze=De.applyToClusters),"minzoom"in De&&t(17,re=De.minzoom),"maxzoom"in De&&t(18,ce=De.maxzoom),"manageHoverState"in De&&t(19,Ze=De.manageHoverState),"hovered"in De&&t(6,Me=De.hovered),"interactive"in De&&t(20,ft=De.interactive),"hoverCursor"in De&&t(21,Ct=De.hoverCursor),"eventsIfTopMost"in De&&t(22,Ot=De.eventsIfTopMost),"$$scope"in De&&t(35,z=De.$$scope)},r.$$.update=()=>{if(r.$$.dirty[0]&65536&&t(30,n=n8(ze)),r.$$.dirty[0]&1073774592&&t(24,l=r8("all",n,_e)),r.$$.dirty[0]&131072|r.$$.dirty[1]&8&&t(26,u=re??D),r.$$.dirty[0]&262144|r.$$.dirty[1]&4&&t(25,d=ce??P),r.$$.dirty[0]&256|r.$$.dirty[1]&2&&t(29,a=O||C),r.$$.dirty[0]&654343809|r.$$.dirty[1]&1&&k&&S!==B&&a){S&&(Lt(S),er.delete(S));let De=U;if(!U&&K){let at=k.getStyle().layers,tt=typeof K=="function"?K:ne=>ne.type===K,it=at==null?void 0:at.find(tt);it&&(De=it.id)}Rt(At,S=B,S),k.addLayer(rl({id:S,type:me,source:a,"source-layer":G,filter:l,paint:X,layout:Y,minzoom:u,maxzoom:d}),De),t(23,st=!0),k.on("click",S,nr),k.on("dblclick",S,nr),k.on("contextmenu",S,nr),k.on("mouseenter",S,tr),k.on("mousemove",S,Lr),k.on("mouseleave",S,Pr)}r.$$.dirty[0]&1048577&&S&&er.set(S,{interactive:ft}),r.$$.dirty[0]&1|r.$$.dirty[1]&1&&t(28,_=S?sb((De,at)=>k==null?void 0:k.setPaintProperty(S,De,at)):void 0),r.$$.dirty[0]&1|r.$$.dirty[1]&1&&t(27,x=S?sb((De,at)=>k==null?void 0:k.setLayoutProperty(S,De,at)):void 0),r.$$.dirty[0]&268443648&&(_==null||_(X)),r.$$.dirty[0]&134234112&&(x==null||x(Y)),r.$$.dirty[0]&100663297|r.$$.dirty[1]&1&&S&&(k==null||k.setLayerZoomRange(S,u,d)),r.$$.dirty[0]&25165825|r.$$.dirty[1]&1&&S&&(st?t(23,st=!1):k==null||k.setFilter(S,l))},[S,Kt,vt,At,Vt,sr,Me,B,O,G,U,K,me,X,Y,_e,ze,re,ce,Ze,ft,Ct,Ot,st,l,d,u,x,_,a,n,k,C,P,D,z,N]}class o_ extends Ht{constructor(e){super(),Zt(this,e,o8,i8,Ut,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}}function s8(r){let e;const t=r[16].default,n=Vr(t,r,r[24],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&16777216)&&Gr(n,t,l,l[24],e?qr(t,l[24],u,null):Wr(l[24]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function a8(r){let e,t,n;function l(d){r[17](d)}let u={id:r[1],type:"circle",source:r[2],sourceLayer:r[3],beforeId:r[4],beforeLayerType:r[5],paint:r[6],layout:r[7],filter:r[8],applyToClusters:r[9],minzoom:r[10],maxzoom:r[11],hoverCursor:r[12],manageHoverState:r[13],eventsIfTopMost:r[14],interactive:r[15],$$slots:{default:[s8]},$$scope:{ctx:r}};return r[0]!==void 0&&(u.hovered=r[0]),e=new o_({props:u}),pn.push(()=>zo(e,"hovered",l)),e.$on("click",r[18]),e.$on("dblclick",r[19]),e.$on("contextmenu",r[20]),e.$on("mouseenter",r[21]),e.$on("mousemove",r[22]),e.$on("mouseleave",r[23]),{c(){je(e.$$.fragment)},m(d,a){Oe(e,d,a),n=!0},p(d,[a]){const _={};a&2&&(_.id=d[1]),a&4&&(_.source=d[2]),a&8&&(_.sourceLayer=d[3]),a&16&&(_.beforeId=d[4]),a&32&&(_.beforeLayerType=d[5]),a&64&&(_.paint=d[6]),a&128&&(_.layout=d[7]),a&256&&(_.filter=d[8]),a&512&&(_.applyToClusters=d[9]),a&1024&&(_.minzoom=d[10]),a&2048&&(_.maxzoom=d[11]),a&4096&&(_.hoverCursor=d[12]),a&8192&&(_.manageHoverState=d[13]),a&16384&&(_.eventsIfTopMost=d[14]),a&32768&&(_.interactive=d[15]),a&16777216&&(_.$$scope={dirty:a,ctx:d}),!t&&a&1&&(t=!0,_.hovered=d[0],Po(()=>t=!1)),e.$set(_)},i(d){n||(oe(e.$$.fragment,d),n=!0)},o(d){de(e.$$.fragment,d),n=!1},d(d){Ne(e,d)}}}function l8(r,e,t){let{$$slots:n={},$$scope:l}=e,{id:u=Mh("circle")}=e,{source:d=void 0}=e,{sourceLayer:a=void 0}=e,{beforeId:_=void 0}=e,{beforeLayerType:x=void 0}=e,{paint:S}=e,{layout:k=void 0}=e,{filter:C=void 0}=e,{applyToClusters:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:N=void 0}=e,{hoverCursor:z=void 0}=e,{manageHoverState:B=!1}=e,{hovered:O=null}=e,{eventsIfTopMost:G=!1}=e,{interactive:U=!0}=e;function K(ce){O=ce,t(0,O)}function me(ce){ur.call(this,r,ce)}function X(ce){ur.call(this,r,ce)}function Y(ce){ur.call(this,r,ce)}function _e(ce){ur.call(this,r,ce)}function ze(ce){ur.call(this,r,ce)}function re(ce){ur.call(this,r,ce)}return r.$$set=ce=>{"id"in ce&&t(1,u=ce.id),"source"in ce&&t(2,d=ce.source),"sourceLayer"in ce&&t(3,a=ce.sourceLayer),"beforeId"in ce&&t(4,_=ce.beforeId),"beforeLayerType"in ce&&t(5,x=ce.beforeLayerType),"paint"in ce&&t(6,S=ce.paint),"layout"in ce&&t(7,k=ce.layout),"filter"in ce&&t(8,C=ce.filter),"applyToClusters"in ce&&t(9,P=ce.applyToClusters),"minzoom"in ce&&t(10,D=ce.minzoom),"maxzoom"in ce&&t(11,N=ce.maxzoom),"hoverCursor"in ce&&t(12,z=ce.hoverCursor),"manageHoverState"in ce&&t(13,B=ce.manageHoverState),"hovered"in ce&&t(0,O=ce.hovered),"eventsIfTopMost"in ce&&t(14,G=ce.eventsIfTopMost),"interactive"in ce&&t(15,U=ce.interactive),"$$scope"in ce&&t(24,l=ce.$$scope)},[O,u,d,a,_,x,S,k,C,P,D,N,z,B,G,U,n,K,me,X,Y,_e,ze,re,l]}class c8 extends Ht{constructor(e){super(),Zt(this,e,l8,a8,Ut,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function u8(r){let e;const t=r[15].default,n=Vr(t,r,r[23],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&8388608)&&Gr(n,t,l,l[23],e?qr(t,l[23],u,null):Wr(l[23]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function h8(r){let e,t,n;function l(d){r[16](d)}let u={id:r[1],type:"fill",source:r[2],sourceLayer:r[3],beforeId:r[4],beforeLayerType:r[5],paint:r[6],layout:r[7],filter:r[8],minzoom:r[9],maxzoom:r[10],hoverCursor:r[11],manageHoverState:r[12],eventsIfTopMost:r[13],interactive:r[14],$$slots:{default:[u8]},$$scope:{ctx:r}};return r[0]!==void 0&&(u.hovered=r[0]),e=new o_({props:u}),pn.push(()=>zo(e,"hovered",l)),e.$on("click",r[17]),e.$on("dblclick",r[18]),e.$on("contextmenu",r[19]),e.$on("mouseenter",r[20]),e.$on("mousemove",r[21]),e.$on("mouseleave",r[22]),{c(){je(e.$$.fragment)},m(d,a){Oe(e,d,a),n=!0},p(d,[a]){const _={};a&2&&(_.id=d[1]),a&4&&(_.source=d[2]),a&8&&(_.sourceLayer=d[3]),a&16&&(_.beforeId=d[4]),a&32&&(_.beforeLayerType=d[5]),a&64&&(_.paint=d[6]),a&128&&(_.layout=d[7]),a&256&&(_.filter=d[8]),a&512&&(_.minzoom=d[9]),a&1024&&(_.maxzoom=d[10]),a&2048&&(_.hoverCursor=d[11]),a&4096&&(_.manageHoverState=d[12]),a&8192&&(_.eventsIfTopMost=d[13]),a&16384&&(_.interactive=d[14]),a&8388608&&(_.$$scope={dirty:a,ctx:d}),!t&&a&1&&(t=!0,_.hovered=d[0],Po(()=>t=!1)),e.$set(_)},i(d){n||(oe(e.$$.fragment,d),n=!0)},o(d){de(e.$$.fragment,d),n=!1},d(d){Ne(e,d)}}}function f8(r,e,t){let{$$slots:n={},$$scope:l}=e,{id:u=Mh("fill")}=e,{source:d=void 0}=e,{sourceLayer:a=void 0}=e,{beforeId:_=void 0}=e,{beforeLayerType:x=void 0}=e,{paint:S}=e,{layout:k=void 0}=e,{filter:C=void 0}=e,{minzoom:P=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:N=void 0}=e,{manageHoverState:z=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:O=!1}=e,{interactive:G=!0}=e;function U(re){B=re,t(0,B)}function K(re){ur.call(this,r,re)}function me(re){ur.call(this,r,re)}function X(re){ur.call(this,r,re)}function Y(re){ur.call(this,r,re)}function _e(re){ur.call(this,r,re)}function ze(re){ur.call(this,r,re)}return r.$$set=re=>{"id"in re&&t(1,u=re.id),"source"in re&&t(2,d=re.source),"sourceLayer"in re&&t(3,a=re.sourceLayer),"beforeId"in re&&t(4,_=re.beforeId),"beforeLayerType"in re&&t(5,x=re.beforeLayerType),"paint"in re&&t(6,S=re.paint),"layout"in re&&t(7,k=re.layout),"filter"in re&&t(8,C=re.filter),"minzoom"in re&&t(9,P=re.minzoom),"maxzoom"in re&&t(10,D=re.maxzoom),"hoverCursor"in re&&t(11,N=re.hoverCursor),"manageHoverState"in re&&t(12,z=re.manageHoverState),"hovered"in re&&t(0,B=re.hovered),"eventsIfTopMost"in re&&t(13,O=re.eventsIfTopMost),"interactive"in re&&t(14,G=re.interactive),"$$scope"in re&&t(23,l=re.$$scope)},[B,u,d,a,_,x,S,k,C,P,D,N,z,O,G,n,U,K,me,X,Y,_e,ze,l]}class d8 extends Ht{constructor(e){super(),Zt(this,e,f8,h8,Ut,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function p8(r,e,t,n,l){let u=!1;r.getSource(e)&&(u=!0,r.removeSource(e));const d=()=>{n(e)&&(r.addSource(e,t),l())};if(u){const a=()=>{e&&(r.getSource(e)?setTimeout(a,1):d())};a()}else d()}function m8(r,e,t){Lb().then(()=>{let n=Hi(r);if(!n)return;n.getSource(e)===t&&n.removeSource(e)})}function cb(r){let e=r[0],t,n,l=ub(r);return{c(){l.c(),t=$n()},m(u,d){l.m(u,d),be(u,t,d),n=!0},p(u,d){d&1&&Ut(e,e=u[0])?(yr(),de(l,1,1,Mt),vr(),l=ub(u),l.c(),oe(l,1),l.m(t.parentNode,t)):l.p(u,d)},i(u){n||(oe(l),n=!0)},o(u){de(l),n=!1},d(u){u&&ve(t),l.d(u)}}}function ub(r){let e;const t=r[15].default,n=Vr(t,r,r[14],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&16384)&&Gr(n,t,l,l[14],e?qr(t,l[14],u,null):Wr(l[14]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function g8(r){let e,t,n=r[0]&&cb(r);return{c(){n&&n.c(),e=$n()},m(l,u){n&&n.m(l,u),be(l,e,u),t=!0},p(l,[u]){l[0]?n?(n.p(l,u),u&1&&oe(n,1)):(n=cb(l),n.c(),oe(n,1),n.m(e.parentNode,e)):n&&(yr(),de(n,1,1,()=>{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function _8(r,e,t){let n,l,u,{$$slots:d={},$$scope:a}=e,{id:_=Mh("geojson")}=e,{data:x}=e,{generateId:S=!1}=e,{promoteId:k=void 0}=e,{filter:C=void 0}=e,{lineMetrics:P=void 0}=e,{cluster:D=void 0}=e;const{map:N,cluster:z,self:B}=e8();wt(r,N,U=>t(13,l=U)),wt(r,z,U=>t(16,u=U)),wt(r,B,U=>t(0,n=U));let O,G=!0;return ti(()=>{n&&O&&l&&(m8(N,n,O),Rt(B,n=null,n),t(11,O=void 0))}),r.$$set=U=>{"id"in U&&t(4,_=U.id),"data"in U&&t(5,x=U.data),"generateId"in U&&t(6,S=U.generateId),"promoteId"in U&&t(7,k=U.promoteId),"filter"in U&&t(8,C=U.filter),"lineMetrics"in U&&t(9,P=U.lineMetrics),"cluster"in U&&t(10,D=U.cluster),"$$scope"in U&&t(14,a=U.$$scope)},r.$$.update=()=>{r.$$.dirty&1024&&Rt(z,u=D,u),r.$$.dirty&12273&&l&&n!==_&&(Rt(B,n=_,n),p8(l,n,rl({type:"geojson",data:x,filter:C,lineMetrics:P,generateId:S,promoteId:k,cluster:!!D,clusterMinPoints:D==null?void 0:D.minPoints,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius,clusterProperties:D==null?void 0:D.properties}),U=>l&&U===n,()=>{n&&(t(11,O=l==null?void 0:l.getSource(n)),t(12,G=!0))})),r.$$.dirty&8208&&(l==null||l.on("style.load",()=>{t(11,O=l==null?void 0:l.getSource(_))})),r.$$.dirty&6176&&O&&(G?t(12,G=!1):O.setData(x)),r.$$.dirty&3072&&(O==null||O.setClusterOptions(rl({cluster:!!D,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius})))},[n,N,z,B,_,x,S,k,C,P,D,O,G,l,a,d]}class y8 extends Ht{constructor(e){super(),Zt(this,e,_8,g8,Ut,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function v8(r){let e;const t=r[15].default,n=Vr(t,r,r[23],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&8388608)&&Gr(n,t,l,l[23],e?qr(t,l[23],u,null):Wr(l[23]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function b8(r){let e,t,n;function l(d){r[16](d)}let u={id:r[1],type:"line",source:r[2],sourceLayer:r[3],beforeId:r[4],beforeLayerType:r[5],paint:r[6],layout:r[7],filter:r[8],minzoom:r[9],maxzoom:r[10],hoverCursor:r[11],manageHoverState:r[12],eventsIfTopMost:r[13],interactive:r[14],$$slots:{default:[v8]},$$scope:{ctx:r}};return r[0]!==void 0&&(u.hovered=r[0]),e=new o_({props:u}),pn.push(()=>zo(e,"hovered",l)),e.$on("click",r[17]),e.$on("dblclick",r[18]),e.$on("contextmenu",r[19]),e.$on("mouseenter",r[20]),e.$on("mousemove",r[21]),e.$on("mouseleave",r[22]),{c(){je(e.$$.fragment)},m(d,a){Oe(e,d,a),n=!0},p(d,[a]){const _={};a&2&&(_.id=d[1]),a&4&&(_.source=d[2]),a&8&&(_.sourceLayer=d[3]),a&16&&(_.beforeId=d[4]),a&32&&(_.beforeLayerType=d[5]),a&64&&(_.paint=d[6]),a&128&&(_.layout=d[7]),a&256&&(_.filter=d[8]),a&512&&(_.minzoom=d[9]),a&1024&&(_.maxzoom=d[10]),a&2048&&(_.hoverCursor=d[11]),a&4096&&(_.manageHoverState=d[12]),a&8192&&(_.eventsIfTopMost=d[13]),a&16384&&(_.interactive=d[14]),a&8388608&&(_.$$scope={dirty:a,ctx:d}),!t&&a&1&&(t=!0,_.hovered=d[0],Po(()=>t=!1)),e.$set(_)},i(d){n||(oe(e.$$.fragment,d),n=!0)},o(d){de(e.$$.fragment,d),n=!1},d(d){Ne(e,d)}}}function w8(r,e,t){let{$$slots:n={},$$scope:l}=e,{id:u=Mh("line")}=e,{source:d=void 0}=e,{sourceLayer:a=void 0}=e,{beforeId:_=void 0}=e,{beforeLayerType:x=void 0}=e,{paint:S}=e,{layout:k=void 0}=e,{filter:C=void 0}=e,{minzoom:P=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:N=void 0}=e,{manageHoverState:z=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:O=!1}=e,{interactive:G=!0}=e;function U(re){B=re,t(0,B)}function K(re){ur.call(this,r,re)}function me(re){ur.call(this,r,re)}function X(re){ur.call(this,r,re)}function Y(re){ur.call(this,r,re)}function _e(re){ur.call(this,r,re)}function ze(re){ur.call(this,r,re)}return r.$$set=re=>{"id"in re&&t(1,u=re.id),"source"in re&&t(2,d=re.source),"sourceLayer"in re&&t(3,a=re.sourceLayer),"beforeId"in re&&t(4,_=re.beforeId),"beforeLayerType"in re&&t(5,x=re.beforeLayerType),"paint"in re&&t(6,S=re.paint),"layout"in re&&t(7,k=re.layout),"filter"in re&&t(8,C=re.filter),"minzoom"in re&&t(9,P=re.minzoom),"maxzoom"in re&&t(10,D=re.maxzoom),"hoverCursor"in re&&t(11,N=re.hoverCursor),"manageHoverState"in re&&t(12,z=re.manageHoverState),"hovered"in re&&t(0,B=re.hovered),"eventsIfTopMost"in re&&t(13,O=re.eventsIfTopMost),"interactive"in re&&t(14,G=re.interactive),"$$scope"in re&&t(23,l=re.$$scope)},[B,u,d,a,_,x,S,k,C,P,D,N,z,O,G,n,U,K,me,X,Y,_e,ze,l]}class x8 extends Ht{constructor(e){super(),Zt(this,e,w8,b8,Ut,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function S8(r){let e,t,n,l,u,d;return e=new d8({props:{id:"edit-polygon-fill",filter:Vz,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),n=new x8({props:{id:"edit-polygon-lines",filter:qz,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),u=new c8({props:{id:"edit-polygon-vertices",filter:Gz,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){je(e.$$.fragment),t=Ve(),je(n.$$.fragment),l=Ve(),je(u.$$.fragment)},m(a,_){Oe(e,a,_),be(a,t,_),Oe(n,a,_),be(a,l,_),Oe(u,a,_),d=!0},p:Mt,i(a){d||(oe(e.$$.fragment,a),oe(n.$$.fragment,a),oe(u.$$.fragment,a),d=!0)},o(a){de(e.$$.fragment,a),de(n.$$.fragment,a),de(u.$$.fragment,a),d=!1},d(a){a&&(ve(t),ve(l)),Ne(e,a),Ne(n,a),Ne(u,a)}}}function k8(r){let e,t;return e=new y8({props:{data:r[0],$$slots:{default:[S8]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,[l]){const u={};l&1&&(u.data=n[0]),l&2&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function T8(r,e,t){let n;return wt(r,Fx,l=>t(0,n=l)),[n]}class E8 extends Ht{constructor(e){super(),Zt(this,e,T8,k8,Ut,{})}}function M8(r){let e,t,n,l,u,d,a;return{c(){e=fe("button"),e.textContent="Import current view",t=Ve(),n=fe("i"),n.textContent="or...",l=Ve(),u=fe("button"),u.textContent="Draw an area to import on the map",Ee(e,"type","button"),Ee(u,"type","button")},m(_,x){be(_,e,x),be(_,t,x),be(_,n,x),be(_,l,x),be(_,u,x),d||(a=[Tt(e,"click",r[2]),Tt(u,"click",r[3])],d=!0)},p:Mt,i:Mt,o:Mt,d(_){_&&(ve(e),ve(t),ve(n),ve(l),ve(u)),d=!1,_n(a)}}}function C8(r){let e,t;return e=new Jz({props:{polygonTool:r[0]}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&1&&(u.polygonTool=n[0]),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function I8(r){let e,t,n,l,u,d,a,_,x;const S=[C8,M8],k=[];function C(P,D){return P[0]?0:1}return e=C(r),t=k[e]=S[e](r),{c(){t.c(),n=Ve(),l=fe("label"),u=fe("input"),d=rt(`Save a copy of the osm.xml - after importing`),Ee(u,"type","checkbox")},m(P,D){k[e].m(P,D),be(P,n,D),be(P,l,D),ie(l,u),u.checked=r[1],ie(l,d),a=!0,_||(x=Tt(u,"change",r[5]),_=!0)},p(P,[D]){let N=e;e=C(P),e===N?k[e].p(P,D):(yr(),de(k[N],1,1,()=>{k[N]=null}),vr(),t=k[e],t?t.p(P,D):(t=k[e]=S[e](P),t.c()),oe(t,1),t.m(n.parentNode,n)),D&2&&(u.checked=P[1])},i(P){a||(oe(t),a=!0)},o(P){de(t),a=!1},d(P){P&&(ve(n),ve(l)),k[e].d(P),_=!1,x()}}}function Zu(r){return[r.lng,r.lat]}function A8(r,e,t){let{map:n}=e;const l=us();let u=null,d=!1;async function a(C){try{l("loading","Loading from Overpass");let D=await(await fetch(Ux(C))).text();d&&ad("osm.xml",D),l("gotXml",{xml:D,boundary:C})}catch(P){l("error",P.toString())}}function _(){let C=n.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[Zu(C.getSouthWest()),Zu(C.getNorthWest()),Zu(C.getNorthEast()),Zu(C.getSouthEast()),Zu(C.getSouthWest())]],type:"Polygon"}}}async function x(){if(n){if(n.getZoom()<13){l("error","Zoom in more to import");return}await a(_())}}function S(){n&&(t(0,u=new Zz(n)),u.startNew(),u.addEventListenerSuccess(async C=>{t(0,u=null),await a(C)}),u.addEventListenerFailure(()=>{t(0,u=null)}))}function k(){d=this.checked,t(1,d)}return r.$$set=C=>{"map"in C&&t(4,n=C.map)},[u,d,x,S,n,k]}class L8 extends Ht{constructor(e){super(),Zt(this,e,A8,I8,Ut,{map:4})}}function Ux(r){let e='poly:"';for(let[n,l]of r.geometry.coordinates[0])e+=`${l} ${n} `;return e=e.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${e}); node(w)->.x; <;); out meta;`}`}async function yg(r){ha.set(r);try{let e=JSON.parse(window.localStorage.getItem(r));console.time("get OSM input");let[t,n]=await P8(e);console.timeEnd("get OSM input"),console.time("load"),ri.set(new Bb(new Uint8Array(t),n,e.study_area_name||void 0)),Hi(ri).loadSavefile(e),console.timeEnd("load"),Vx()}catch(e){window.alert(`Couldn't open project: ${e}`),ha.set("")}}async function P8(r){if(r.study_area_name){let e=Hi(dh)?`/osm/${r.study_area_name}.pbf`:`https://assets.od2net.org/severance_pbfs/${r.study_area_name}.pbf`;console.log(`Grabbing ${e}`);let n=await(await fetch(e)).arrayBuffer(),l=Hi(dh)?`/boundaries/${r.study_area_name}.geojson`:`https://assets.od2net.org/boundaries/${r.study_area_name}.geojson`,d=await(await fetch(l)).json();return[n,d]}else{console.log("Grabbing from Overpass");let e=r.features.find(l=>l.properties.kind=="study_area_boundary");return[await(await fetch(Ux(e))).arrayBuffer(),e]}}function Vx(){pr.set({mode:"network"}),Lc.set(new nk(Hi(ls),Hi(ri).toRouteSnapper(),Tr(Xf()),Tr(!0),Tr(0))),Hi(ls).fitBounds(Array.from(Hi(ri).getBounds()),{animate:!1}),Bm.set(hb()),Fm.set(hb())}function hb(){let r=Hi(ri).getBounds(),e=r[0]+Math.random()*(r[2]-r[0]),t=r[1]+Math.random()*(r[3]-r[1]);return new Pc.LngLat(e,t)}function fb(r,e,t){const n=r.slice();return n[18]=e[t][0],n[19]=e[t][1],n}function db(r,e,t){const n=r.slice();return n[22]=e[t],n}function z8(r){let e;return{c(){e=fe("div"),e.innerHTML='',Ee(e,"slot","top")},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function D8(r){let e;return{c(){e=fe("p"),e.textContent="Waiting for MapLibre and WASM to load..."},m(t,n){be(t,e,n)},p:Mt,i:Mt,o:Mt,d(t){t&&ve(e)}}}function R8(r){let e,t,n,l,u,d,a,_,x,S,k,C,P;t=new Zr({props:{$$slots:{default:[B8]},$$scope:{ctx:r}}}),t.$on("click",r[10]);let D=Jn(r[2].entries()),N=[];for(let B=0;Bde(N[B],1,1,()=>{N[B]=null});return{c(){e=fe("div"),je(t.$$.fragment),n=Ve(),l=fe("p"),l.textContent="Load a saved project:",u=Ve(),d=fe("ul");for(let B=0;B`,d=Ve(),a=fe("button"),a.innerHTML=`Delete project`,_=Ve(),Ee(u,"class","secondary"),Ee(a,"class","secondary"),fn(t,"display","flex"),fn(t,"justify-content","space-between")},m(N,z){be(N,e,z),ie(e,t),Oe(n,t,null),ie(t,l),ie(t,u),ie(t,d),ie(t,a),ie(e,_),x=!0,S||(k=[Tt(u,"click",P),Tt(a,"click",D)],S=!0)},p(N,z){r=N;const B={};z&33554436&&(B.$$scope={dirty:z,ctx:r}),n.$set(B)},i(N){x||(oe(n.$$.fragment,N),x=!0)},o(N){de(n.$$.fragment,N),x=!1},d(N){N&&ve(e),Ne(n),S=!1,_n(k)}}}function mb(r){let e,t=(r[18]??"custom area")+"",n,l,u,d,a=Jn(r[19]),_=[];for(let S=0;Sde(_[S],1,1,()=>{_[S]=null});return{c(){e=fe("u"),n=rt(t),l=Ve();for(let S=0;S<_.length;S+=1)_[S].c();u=$n()},m(S,k){be(S,e,k),ie(e,n),be(S,l,k);for(let C=0;C<_.length;C+=1)_[C]&&_[C].m(S,k);be(S,u,k),d=!0},p(S,k){if((!d||k&4)&&t!==(t=(S[18]??"custom area")+"")&&Ar(n,t),k&900){a=Jn(S[19]);let C;for(C=0;C{d[S]=null}),vr(),n=d[t],n?n.p(_,x):(n=d[t]=u[t](_),n.c()),oe(n,1),n.m(e,null))},i(_){l||(oe(n),l=!0)},o(_){de(n),l=!1},d(_){_&&ve(e),d[t].d()}}}function N8(r){let e,t,n,l;return e=new zb({props:{loading:r[1]}}),n=new Fs({props:{$$slots:{sidebar:[O8],top:[z8]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment),t=Ve(),je(n.$$.fragment)},m(u,d){Oe(e,u,d),be(u,t,d),Oe(n,u,d),l=!0},p(u,[d]){const a={};d&2&&(a.loading=u[1]),e.$set(a);const _={};d&33554493&&(_.$$scope={dirty:d,ctx:u}),n.$set(_)},i(u){l||(oe(e.$$.fragment,u),oe(n.$$.fragment,u),l=!0)},o(u){de(e.$$.fragment,u),de(n.$$.fragment,u),l=!1},d(u){u&&ve(t),Ne(e,u),Ne(n,u)}}}function Uf(){let r=new Map;for(let e=0;et(15,n=K)),wt(r,Lc,K=>t(16,l=K)),wt(r,ri,K=>t(17,u=K)),wt(r,ls,K=>t(4,d=K)),wt(r,pr,K=>t(5,a=K));let{wasmReady:_}=e,x="";Rt(ri,u=null,u),Rt(Lc,l=null,l),Rt(ha,n="",n);let S=Uf(),k;async function C(K){let me="ltn_"+k.files[0].name;t(1,x=`Loading from file ${me}`),window.localStorage.setItem(me,await k.files[0].text()),t(2,S=Uf()),await yg(me),t(1,x="")}function P(K){window.confirm(`Really delete project ${K}? You can't undo this.`)&&(window.localStorage.removeItem(K),t(2,S=Uf()))}function D(K){let me=window.prompt(`Rename project ${K} to what?`,K);if(me){me.startsWith("ltn_")||(me=`ltn_${me}`);let X=window.localStorage.getItem(K);window.localStorage.setItem(me,X),window.localStorage.removeItem(K),t(2,S=Uf())}}async function N(K){t(1,x=`Loading project ${K}`),await yg(K),t(1,x="")}const z=()=>Rt(pr,a={mode:"new-project"},a),B=K=>N(K),O=K=>D(K),G=K=>P(K);function U(K){pn[K?"unshift":"push"](()=>{k=K,t(3,k)})}return r.$$set=K=>{"wasmReady"in K&&t(0,_=K.wasmReady)},[_,x,S,k,d,a,C,P,D,N,z,B,O,G,U]}class U8 extends Ht{constructor(e){super(),Zt(this,e,j8,N8,Ut,{wasmReady:0})}}function gb(r,e,t){const n=r.slice();return n[17]=e[t][0],n[18]=e[t][1],n}function _b(r,e,t){const n=r.slice();return n[21]=e[t][0],n[22]=e[t][1],n}function V8(r){let e;return{c(){e=rt("Choose project")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function q8(r){let e,t,n,l,u,d,a,_;return u=new Zr({props:{$$slots:{default:[V8]},$$scope:{ctx:r}}}),u.$on("click",r[13]),{c(){e=fe("div"),t=fe("nav"),n=fe("ul"),l=fe("li"),je(u.$$.fragment),d=Ve(),a=fe("li"),a.textContent="New project",Ee(t,"aria-label","breadcrumb"),Ee(e,"slot","top")},m(x,S){be(x,e,S),ie(e,t),ie(t,n),ie(n,l),Oe(u,l,null),ie(n,d),ie(n,a),_=!0},p(x,S){const k={};S&33554432&&(k.$$scope={dirty:S,ctx:x}),u.$set(k)},i(x){_||(oe(u.$$.fragment,x),_=!0)},o(x){de(u.$$.fragment,x),_=!1},d(x){x&&ve(e),Ne(u)}}}function yb(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D;e=new zb({props:{loading:r[4]}});let N=Jn(r[3]),z=[];for(let B=0;Br[9].call(u))},m(B,O){Oe(e,B,O),be(B,t,O),be(B,n,O),ie(n,l),ie(n,u),ie(u,d);for(let G=0;G{S=null}),vr())},i(k){a||(oe(S),a=!0)},o(k){de(S),a=!1},d(k){k&&ve(e),S&&S.d(),_=!1,x()}}}function W8(r){let e,t,n;return t=new E8({}),{c(){e=fe("div"),je(t.$$.fragment),Ee(e,"slot","map")},m(l,u){be(l,e,u),Oe(t,e,null),n=!0},p:Mt,i(l){n||(oe(t.$$.fragment,l),n=!0)},o(l){de(t.$$.fragment,l),n=!1},d(l){l&&ve(e),Ne(t)}}}function Z8(r){let e,t;return e=new Fs({props:{$$slots:{map:[W8],sidebar:[G8],top:[q8]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,[l]){const u={};l&33554558&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function H8(r,e,t){let n,l,u,d,a;wt(r,ha,U=>t(14,n=U)),wt(r,ri,U=>t(15,l=U)),wt(r,dh,U=>t(16,u=U)),wt(r,ls,U=>t(5,d=U)),wt(r,pr,U=>t(6,a=U));let _="",x="",S=[],k="";Ld(async()=>{let U=await fetch(u?"/osm/areas.json":"https://assets.od2net.org/severance_pbfs/areas.json");t(3,S=await U.json())});function C(U){t(4,k="Loading OSM");try{Rt(ri,l=new Bb(new TextEncoder().encode(U.detail.xml),U.detail.boundary,void 0),l),Rt(ha,n=`ltn_${_}`,n),Vx(),Sc()}catch(K){window.alert(`Couldn't import from Overpass: ${K}`)}t(4,k="")}async function P(){if(x=="")return;let U=`ltn_${_}`;window.localStorage.setItem(U,JSON.stringify({type:"FeatureCollection",features:[],study_area_name:x})),t(4,k=`Loading pre-clipped OSM area ${x}`),await yg(U),t(4,k="")}function D(){_=this.value,t(1,_)}function N(){x=Mb(this),t(2,x),t(3,S)}return[P,_,x,S,k,d,a,C,D,N,()=>P(),U=>t(4,k=U.detail),U=>window.alert(U.detail),()=>Rt(pr,a={mode:"title"},a)]}class $8 extends Ht{constructor(e){super(),Zt(this,e,H8,Z8,Ut,{loadExample:0})}get loadExample(){return this.$$.ctx[0]}}const{window:X8}=Ad;function K8(r){let e;return{c(){e=rt("Choose project")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function J8(r){let e;return{c(){e=rt("Pick neighbourhood")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function Y8(r){let e;return{c(){e=rt("Editing")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function Q8(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D;return u=new Zr({props:{$$slots:{default:[K8]},$$scope:{ctx:r}}}),u.$on("click",r[9]),_=new Zr({props:{$$slots:{default:[J8]},$$scope:{ctx:r}}}),_.$on("click",r[10]),k=new Zr({props:{$$slots:{default:[Y8]},$$scope:{ctx:r}}}),k.$on("click",r[5]),{c(){e=fe("div"),t=fe("nav"),n=fe("ul"),l=fe("li"),je(u.$$.fragment),d=Ve(),a=fe("li"),je(_.$$.fragment),x=Ve(),S=fe("li"),je(k.$$.fragment),C=Ve(),P=fe("li"),P.textContent="Viewing shortcuts",Ee(t,"aria-label","breadcrumb"),Ee(e,"slot","top")},m(N,z){be(N,e,z),ie(e,t),ie(t,n),ie(n,l),Oe(u,l,null),ie(n,d),ie(n,a),Oe(_,a,null),ie(n,x),ie(n,S),Oe(k,S,null),ie(n,C),ie(n,P),D=!0},p(N,z){const B={};z&8192&&(B.$$scope={dirty:z,ctx:N}),u.$set(B);const O={};z&8192&&(O.$$scope={dirty:z,ctx:N}),_.$set(O);const G={};z&8192&&(G.$$scope={dirty:z,ctx:N}),k.$set(G)},i(N){D||(oe(u.$$.fragment,N),oe(_.$$.fragment,N),oe(k.$$.fragment,N),D=!0)},o(N){de(u.$$.fragment,N),de(_.$$.fragment,N),de(k.$$.fragment,N),D=!1},d(N){N&&ve(e),Ne(u),Ne(_),Ne(k)}}}function eD(r){let e,t,n,l,u,d,a,_,x,S=r[0].shortcutIndex+1+"",k,C,P=r[0].gj.features.length+"",D,N,z,B,O,G,U,K,me,X=dn(r[0].gj.features[r[0].shortcutIndex].properties).directness.toFixed(1)+"",Y,_e,ze,re,ce;return{c(){e=fe("p"),e.textContent=`This shows all possible shortcuts crossing the blue road you've chosen. + to cancel`,d.disabled=a=r[1]==0,fn(e,"display","flex"),fn(e,"justify-content","space-between")},m(N,z){be(N,e,z),ie(e,t),ie(e,n),ie(e,l),ie(e,u),ie(e,d),D.m(d,null),be(N,_,z),be(N,x,z),S||(k=[Tt(t,"click",r[2]),Tt(l,"click",r[3]),Tt(d,"click",r[4])],S=!0)},p(N,[z]){P===(P=C(N))&&D?D.p(N,z):(D.d(1),D=P(N),D&&(D.c(),D.m(d,null))),z&2&&a!==(a=N[1]==0)&&(d.disabled=a)},i:Mt,o:Mt,d(N){N&&(ve(e),ve(_),ve(x)),D.d(),S=!1,_n(k)}}}function Jz(r,e,t){let n;wt(r,Nx,_=>t(1,n=_));let{polygonTool:l}=e;const u=()=>l.finish(),d=()=>l.cancel(),a=()=>l.undo();return r.$$set=_=>{"polygonTool"in _&&t(0,l=_.polygonTool)},[l,n,u,d,a]}class Yz extends Ht{constructor(e){super(),Zt(this,e,Jz,Kz,Ut,{polygonTool:0})}}let Qz=Date.now();function Mh(r){return`${r}-${Qz++}`}const jx=Symbol.for("svelte-maplibre");function e8(){return Ib(jx)}function sb(r){return{subscribe:r.subscribe}}function Ux({key:r,setPopupTarget:e=!1,setCluster:t=!1,setMouseEvent:n=!1}){let l=e8(),u=Tr(null),d=sb(u),a={...l,[r]:sb(u)};if(e&&(a.popupTarget=d),n){let _=Tr(null);a.layerEvent=_,l.layerEvent=_}return t&&(a.cluster=Tr()),xg(jx,a),{...l,self:u}}function t8(){return Ux({key:"source",setCluster:!0})}function r8(r=!0){return Ux({key:"layer",setPopupTarget:r,setMouseEvent:r})}function ab(r){let e;return t=>{if(t)for(let n in t){let l=e==null?void 0:e[n],u=t[n];l!==u&&r(n,u,l)}else if(e)for(let n in e)r(n,void 0,e[n]);e=t}}function n8(r,...e){let t=[r];for(let n of e)if(n)Array.isArray(n)&&n[0]===r?t.push(...n.slice(1)):t.push(n);else continue;if(t.length!==1)return t.length===2?t[1]:t}function i8(r){return r===!0?["has","point_count"]:r===!1?["!",["has","point_count"]]:void 0}function lb(r){let e=r[0],t,n,l=cb(r);return{c(){l.c(),t=$n()},m(u,d){l.m(u,d),be(u,t,d),n=!0},p(u,d){d[0]&1&&Ut(e,e=u[0])?(yr(),de(l,1,1,Mt),vr(),l=cb(u),l.c(),oe(l,1),l.m(t.parentNode,t)):l.p(u,d)},i(u){n||(oe(l),n=!0)},o(u){de(l),n=!1},d(u){u&&ve(t),l.d(u)}}}function cb(r){let e;const t=r[36].default,n=Vr(t,r,r[35],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u[1]&16)&&Gr(n,t,l,l[35],e?qr(t,l[35],u,null):Wr(l[35]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function o8(r){let e,t,n=r[0]&&lb(r);return{c(){n&&n.c(),e=$n()},m(l,u){n&&n.m(l,u),be(l,e,u),t=!0},p(l,u){l[0]?n?(n.p(l,u),u[0]&1&&oe(n,1)):(n=lb(l),n.c(),oe(n,1),n.m(e.parentNode,e)):n&&(yr(),de(n,1,1,()=>{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function s8(r,e,t){let n,l,u,d,a,_,x,S,k,C,P,D,{$$slots:N={},$$scope:z}=e,{id:B=Mh("layer")}=e,{source:O=void 0}=e,{sourceLayer:G=void 0}=e,{beforeId:U=void 0}=e,{beforeLayerType:K=void 0}=e,{type:me}=e,{paint:X=void 0}=e,{layout:Y=void 0}=e,{filter:_e=void 0}=e,{applyToClusters:ze=void 0}=e,{minzoom:re=void 0}=e,{maxzoom:ce=void 0}=e,{manageHoverState:Ze=!1}=e,{hovered:Me=null}=e,{interactive:ft=!0}=e,{hoverCursor:Ct=void 0}=e,{eventsIfTopMost:Ot=!1}=e;const Ke=us(),{map:Kt,source:vt,self:At,minzoom:Vt,maxzoom:sr,eventTopMost:fr,layerInfo:er}=r8();wt(r,Kt,De=>t(31,k=De)),wt(r,vt,De=>t(32,C=De)),wt(r,At,De=>t(0,S=De)),wt(r,Vt,De=>t(34,D=De)),wt(r,sr,De=>t(33,P=De)),ti(()=>{S&&k&&(er.delete(S),k==null||k.removeLayer(S))});let Nt;function nr(De){var ne,br;if(!ft||!S||!k||Ot&&fr(De)!==S)return;let at=De.features??[],tt=(br=(ne=at[0])==null?void 0:ne.properties)==null?void 0:br.cluster_id,it={event:De,map:k,clusterId:tt,layer:S,source:a,features:at};Ke(De.type,it)}function tr(De){var ne,br;if(!ft||!S||!k||Ot&&fr(De)!==S)return;Ct&&(k.getCanvas().style.cursor=Ct);let at=De.features??[];t(6,Me=at[0]??null);let tt=(br=(ne=at[0])==null?void 0:ne.properties)==null?void 0:br.cluster_id;Ke("mouseenter",{event:De,map:k,clusterId:tt,layer:S,source:a,features:at})}function Lr(De){var ne,br,We;if(!ft||!k)return;if(Ot&&fr(De)!==S){t(6,Me=null),Ze&&Nt!==void 0&&(k==null||k.setFeatureState({source:a,sourceLayer:G,id:Nt},{hover:!1}),Nt=void 0);return}k.getCanvas().style.cursor=Ct;let at=De.features??[],tt=(br=(ne=at[0])==null?void 0:ne.properties)==null?void 0:br.cluster_id,it=(We=at[0])==null?void 0:We.id;it!==Nt&&(Ze&&(Nt!==void 0&&(k==null||k.setFeatureState({source:a,id:Nt,sourceLayer:G},{hover:!1})),k==null||k.setFeatureState({source:a,id:it,sourceLayer:G},{hover:!0})),Nt=it,t(6,Me=at[0]??null)),Ke("mousemove",{event:De,map:k,clusterId:tt,layer:S,source:a,features:at})}function Pr(De){if(!(!ft||!S||!k)){if(Ct&&(k.getCanvas().style.cursor=""),t(6,Me=null),Ze&&Nt!==void 0){const at={source:a,id:Nt,sourceLayer:G};k==null||k.setFeatureState(at,{hover:!1}),Nt=void 0}Ke("mouseleave",{map:k,layer:S,source:a})}}let st=!0;function Lt(De){k&&(k.off("click",De,nr),k.off("dblclick",De,nr),k.off("contextmenu",De,nr),k.off("mouseenter",De,tr),k.off("mousemove",De,Lr),k.off("mouseleave",De,Pr))}return ti(()=>{k&&S&&Lt(S)}),r.$$set=De=>{"id"in De&&t(7,B=De.id),"source"in De&&t(8,O=De.source),"sourceLayer"in De&&t(9,G=De.sourceLayer),"beforeId"in De&&t(10,U=De.beforeId),"beforeLayerType"in De&&t(11,K=De.beforeLayerType),"type"in De&&t(12,me=De.type),"paint"in De&&t(13,X=De.paint),"layout"in De&&t(14,Y=De.layout),"filter"in De&&t(15,_e=De.filter),"applyToClusters"in De&&t(16,ze=De.applyToClusters),"minzoom"in De&&t(17,re=De.minzoom),"maxzoom"in De&&t(18,ce=De.maxzoom),"manageHoverState"in De&&t(19,Ze=De.manageHoverState),"hovered"in De&&t(6,Me=De.hovered),"interactive"in De&&t(20,ft=De.interactive),"hoverCursor"in De&&t(21,Ct=De.hoverCursor),"eventsIfTopMost"in De&&t(22,Ot=De.eventsIfTopMost),"$$scope"in De&&t(35,z=De.$$scope)},r.$$.update=()=>{if(r.$$.dirty[0]&65536&&t(30,n=i8(ze)),r.$$.dirty[0]&1073774592&&t(24,l=n8("all",n,_e)),r.$$.dirty[0]&131072|r.$$.dirty[1]&8&&t(26,u=re??D),r.$$.dirty[0]&262144|r.$$.dirty[1]&4&&t(25,d=ce??P),r.$$.dirty[0]&256|r.$$.dirty[1]&2&&t(29,a=O||C),r.$$.dirty[0]&654343809|r.$$.dirty[1]&1&&k&&S!==B&&a){S&&(Lt(S),er.delete(S));let De=U;if(!U&&K){let at=k.getStyle().layers,tt=typeof K=="function"?K:ne=>ne.type===K,it=at==null?void 0:at.find(tt);it&&(De=it.id)}Rt(At,S=B,S),k.addLayer(rl({id:S,type:me,source:a,"source-layer":G,filter:l,paint:X,layout:Y,minzoom:u,maxzoom:d}),De),t(23,st=!0),k.on("click",S,nr),k.on("dblclick",S,nr),k.on("contextmenu",S,nr),k.on("mouseenter",S,tr),k.on("mousemove",S,Lr),k.on("mouseleave",S,Pr)}r.$$.dirty[0]&1048577&&S&&er.set(S,{interactive:ft}),r.$$.dirty[0]&1|r.$$.dirty[1]&1&&t(28,_=S?ab((De,at)=>k==null?void 0:k.setPaintProperty(S,De,at)):void 0),r.$$.dirty[0]&1|r.$$.dirty[1]&1&&t(27,x=S?ab((De,at)=>k==null?void 0:k.setLayoutProperty(S,De,at)):void 0),r.$$.dirty[0]&268443648&&(_==null||_(X)),r.$$.dirty[0]&134234112&&(x==null||x(Y)),r.$$.dirty[0]&100663297|r.$$.dirty[1]&1&&S&&(k==null||k.setLayerZoomRange(S,u,d)),r.$$.dirty[0]&25165825|r.$$.dirty[1]&1&&S&&(st?t(23,st=!1):k==null||k.setFilter(S,l))},[S,Kt,vt,At,Vt,sr,Me,B,O,G,U,K,me,X,Y,_e,ze,re,ce,Ze,ft,Ct,Ot,st,l,d,u,x,_,a,n,k,C,P,D,z,N]}class s_ extends Ht{constructor(e){super(),Zt(this,e,s8,o8,Ut,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}}function a8(r){let e;const t=r[16].default,n=Vr(t,r,r[24],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&16777216)&&Gr(n,t,l,l[24],e?qr(t,l[24],u,null):Wr(l[24]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function l8(r){let e,t,n;function l(d){r[17](d)}let u={id:r[1],type:"circle",source:r[2],sourceLayer:r[3],beforeId:r[4],beforeLayerType:r[5],paint:r[6],layout:r[7],filter:r[8],applyToClusters:r[9],minzoom:r[10],maxzoom:r[11],hoverCursor:r[12],manageHoverState:r[13],eventsIfTopMost:r[14],interactive:r[15],$$slots:{default:[a8]},$$scope:{ctx:r}};return r[0]!==void 0&&(u.hovered=r[0]),e=new s_({props:u}),pn.push(()=>zo(e,"hovered",l)),e.$on("click",r[18]),e.$on("dblclick",r[19]),e.$on("contextmenu",r[20]),e.$on("mouseenter",r[21]),e.$on("mousemove",r[22]),e.$on("mouseleave",r[23]),{c(){je(e.$$.fragment)},m(d,a){Oe(e,d,a),n=!0},p(d,[a]){const _={};a&2&&(_.id=d[1]),a&4&&(_.source=d[2]),a&8&&(_.sourceLayer=d[3]),a&16&&(_.beforeId=d[4]),a&32&&(_.beforeLayerType=d[5]),a&64&&(_.paint=d[6]),a&128&&(_.layout=d[7]),a&256&&(_.filter=d[8]),a&512&&(_.applyToClusters=d[9]),a&1024&&(_.minzoom=d[10]),a&2048&&(_.maxzoom=d[11]),a&4096&&(_.hoverCursor=d[12]),a&8192&&(_.manageHoverState=d[13]),a&16384&&(_.eventsIfTopMost=d[14]),a&32768&&(_.interactive=d[15]),a&16777216&&(_.$$scope={dirty:a,ctx:d}),!t&&a&1&&(t=!0,_.hovered=d[0],Po(()=>t=!1)),e.$set(_)},i(d){n||(oe(e.$$.fragment,d),n=!0)},o(d){de(e.$$.fragment,d),n=!1},d(d){Ne(e,d)}}}function c8(r,e,t){let{$$slots:n={},$$scope:l}=e,{id:u=Mh("circle")}=e,{source:d=void 0}=e,{sourceLayer:a=void 0}=e,{beforeId:_=void 0}=e,{beforeLayerType:x=void 0}=e,{paint:S}=e,{layout:k=void 0}=e,{filter:C=void 0}=e,{applyToClusters:P=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:N=void 0}=e,{hoverCursor:z=void 0}=e,{manageHoverState:B=!1}=e,{hovered:O=null}=e,{eventsIfTopMost:G=!1}=e,{interactive:U=!0}=e;function K(ce){O=ce,t(0,O)}function me(ce){ur.call(this,r,ce)}function X(ce){ur.call(this,r,ce)}function Y(ce){ur.call(this,r,ce)}function _e(ce){ur.call(this,r,ce)}function ze(ce){ur.call(this,r,ce)}function re(ce){ur.call(this,r,ce)}return r.$$set=ce=>{"id"in ce&&t(1,u=ce.id),"source"in ce&&t(2,d=ce.source),"sourceLayer"in ce&&t(3,a=ce.sourceLayer),"beforeId"in ce&&t(4,_=ce.beforeId),"beforeLayerType"in ce&&t(5,x=ce.beforeLayerType),"paint"in ce&&t(6,S=ce.paint),"layout"in ce&&t(7,k=ce.layout),"filter"in ce&&t(8,C=ce.filter),"applyToClusters"in ce&&t(9,P=ce.applyToClusters),"minzoom"in ce&&t(10,D=ce.minzoom),"maxzoom"in ce&&t(11,N=ce.maxzoom),"hoverCursor"in ce&&t(12,z=ce.hoverCursor),"manageHoverState"in ce&&t(13,B=ce.manageHoverState),"hovered"in ce&&t(0,O=ce.hovered),"eventsIfTopMost"in ce&&t(14,G=ce.eventsIfTopMost),"interactive"in ce&&t(15,U=ce.interactive),"$$scope"in ce&&t(24,l=ce.$$scope)},[O,u,d,a,_,x,S,k,C,P,D,N,z,B,G,U,n,K,me,X,Y,_e,ze,re,l]}class u8 extends Ht{constructor(e){super(),Zt(this,e,c8,l8,Ut,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function h8(r){let e;const t=r[15].default,n=Vr(t,r,r[23],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&8388608)&&Gr(n,t,l,l[23],e?qr(t,l[23],u,null):Wr(l[23]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function f8(r){let e,t,n;function l(d){r[16](d)}let u={id:r[1],type:"fill",source:r[2],sourceLayer:r[3],beforeId:r[4],beforeLayerType:r[5],paint:r[6],layout:r[7],filter:r[8],minzoom:r[9],maxzoom:r[10],hoverCursor:r[11],manageHoverState:r[12],eventsIfTopMost:r[13],interactive:r[14],$$slots:{default:[h8]},$$scope:{ctx:r}};return r[0]!==void 0&&(u.hovered=r[0]),e=new s_({props:u}),pn.push(()=>zo(e,"hovered",l)),e.$on("click",r[17]),e.$on("dblclick",r[18]),e.$on("contextmenu",r[19]),e.$on("mouseenter",r[20]),e.$on("mousemove",r[21]),e.$on("mouseleave",r[22]),{c(){je(e.$$.fragment)},m(d,a){Oe(e,d,a),n=!0},p(d,[a]){const _={};a&2&&(_.id=d[1]),a&4&&(_.source=d[2]),a&8&&(_.sourceLayer=d[3]),a&16&&(_.beforeId=d[4]),a&32&&(_.beforeLayerType=d[5]),a&64&&(_.paint=d[6]),a&128&&(_.layout=d[7]),a&256&&(_.filter=d[8]),a&512&&(_.minzoom=d[9]),a&1024&&(_.maxzoom=d[10]),a&2048&&(_.hoverCursor=d[11]),a&4096&&(_.manageHoverState=d[12]),a&8192&&(_.eventsIfTopMost=d[13]),a&16384&&(_.interactive=d[14]),a&8388608&&(_.$$scope={dirty:a,ctx:d}),!t&&a&1&&(t=!0,_.hovered=d[0],Po(()=>t=!1)),e.$set(_)},i(d){n||(oe(e.$$.fragment,d),n=!0)},o(d){de(e.$$.fragment,d),n=!1},d(d){Ne(e,d)}}}function d8(r,e,t){let{$$slots:n={},$$scope:l}=e,{id:u=Mh("fill")}=e,{source:d=void 0}=e,{sourceLayer:a=void 0}=e,{beforeId:_=void 0}=e,{beforeLayerType:x=void 0}=e,{paint:S}=e,{layout:k=void 0}=e,{filter:C=void 0}=e,{minzoom:P=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:N=void 0}=e,{manageHoverState:z=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:O=!1}=e,{interactive:G=!0}=e;function U(re){B=re,t(0,B)}function K(re){ur.call(this,r,re)}function me(re){ur.call(this,r,re)}function X(re){ur.call(this,r,re)}function Y(re){ur.call(this,r,re)}function _e(re){ur.call(this,r,re)}function ze(re){ur.call(this,r,re)}return r.$$set=re=>{"id"in re&&t(1,u=re.id),"source"in re&&t(2,d=re.source),"sourceLayer"in re&&t(3,a=re.sourceLayer),"beforeId"in re&&t(4,_=re.beforeId),"beforeLayerType"in re&&t(5,x=re.beforeLayerType),"paint"in re&&t(6,S=re.paint),"layout"in re&&t(7,k=re.layout),"filter"in re&&t(8,C=re.filter),"minzoom"in re&&t(9,P=re.minzoom),"maxzoom"in re&&t(10,D=re.maxzoom),"hoverCursor"in re&&t(11,N=re.hoverCursor),"manageHoverState"in re&&t(12,z=re.manageHoverState),"hovered"in re&&t(0,B=re.hovered),"eventsIfTopMost"in re&&t(13,O=re.eventsIfTopMost),"interactive"in re&&t(14,G=re.interactive),"$$scope"in re&&t(23,l=re.$$scope)},[B,u,d,a,_,x,S,k,C,P,D,N,z,O,G,n,U,K,me,X,Y,_e,ze,l]}class p8 extends Ht{constructor(e){super(),Zt(this,e,d8,f8,Ut,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function m8(r,e,t,n,l){let u=!1;r.getSource(e)&&(u=!0,r.removeSource(e));const d=()=>{n(e)&&(r.addSource(e,t),l())};if(u){const a=()=>{e&&(r.getSource(e)?setTimeout(a,1):d())};a()}else d()}function g8(r,e,t){Pb().then(()=>{let n=Hi(r);if(!n)return;n.getSource(e)===t&&n.removeSource(e)})}function ub(r){let e=r[0],t,n,l=hb(r);return{c(){l.c(),t=$n()},m(u,d){l.m(u,d),be(u,t,d),n=!0},p(u,d){d&1&&Ut(e,e=u[0])?(yr(),de(l,1,1,Mt),vr(),l=hb(u),l.c(),oe(l,1),l.m(t.parentNode,t)):l.p(u,d)},i(u){n||(oe(l),n=!0)},o(u){de(l),n=!1},d(u){u&&ve(t),l.d(u)}}}function hb(r){let e;const t=r[15].default,n=Vr(t,r,r[14],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&16384)&&Gr(n,t,l,l[14],e?qr(t,l[14],u,null):Wr(l[14]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function _8(r){let e,t,n=r[0]&&ub(r);return{c(){n&&n.c(),e=$n()},m(l,u){n&&n.m(l,u),be(l,e,u),t=!0},p(l,[u]){l[0]?n?(n.p(l,u),u&1&&oe(n,1)):(n=ub(l),n.c(),oe(n,1),n.m(e.parentNode,e)):n&&(yr(),de(n,1,1,()=>{n=null}),vr())},i(l){t||(oe(n),t=!0)},o(l){de(n),t=!1},d(l){l&&ve(e),n&&n.d(l)}}}function y8(r,e,t){let n,l,u,{$$slots:d={},$$scope:a}=e,{id:_=Mh("geojson")}=e,{data:x}=e,{generateId:S=!1}=e,{promoteId:k=void 0}=e,{filter:C=void 0}=e,{lineMetrics:P=void 0}=e,{cluster:D=void 0}=e;const{map:N,cluster:z,self:B}=t8();wt(r,N,U=>t(13,l=U)),wt(r,z,U=>t(16,u=U)),wt(r,B,U=>t(0,n=U));let O,G=!0;return ti(()=>{n&&O&&l&&(g8(N,n,O),Rt(B,n=null,n),t(11,O=void 0))}),r.$$set=U=>{"id"in U&&t(4,_=U.id),"data"in U&&t(5,x=U.data),"generateId"in U&&t(6,S=U.generateId),"promoteId"in U&&t(7,k=U.promoteId),"filter"in U&&t(8,C=U.filter),"lineMetrics"in U&&t(9,P=U.lineMetrics),"cluster"in U&&t(10,D=U.cluster),"$$scope"in U&&t(14,a=U.$$scope)},r.$$.update=()=>{r.$$.dirty&1024&&Rt(z,u=D,u),r.$$.dirty&12273&&l&&n!==_&&(Rt(B,n=_,n),m8(l,n,rl({type:"geojson",data:x,filter:C,lineMetrics:P,generateId:S,promoteId:k,cluster:!!D,clusterMinPoints:D==null?void 0:D.minPoints,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius,clusterProperties:D==null?void 0:D.properties}),U=>l&&U===n,()=>{n&&(t(11,O=l==null?void 0:l.getSource(n)),t(12,G=!0))})),r.$$.dirty&8208&&(l==null||l.on("style.load",()=>{t(11,O=l==null?void 0:l.getSource(_))})),r.$$.dirty&6176&&O&&(G?t(12,G=!1):O.setData(x)),r.$$.dirty&3072&&(O==null||O.setClusterOptions(rl({cluster:!!D,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius})))},[n,N,z,B,_,x,S,k,C,P,D,O,G,l,a,d]}class v8 extends Ht{constructor(e){super(),Zt(this,e,y8,_8,Ut,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function b8(r){let e;const t=r[15].default,n=Vr(t,r,r[23],null);return{c(){n&&n.c()},m(l,u){n&&n.m(l,u),e=!0},p(l,u){n&&n.p&&(!e||u&8388608)&&Gr(n,t,l,l[23],e?qr(t,l[23],u,null):Wr(l[23]),null)},i(l){e||(oe(n,l),e=!0)},o(l){de(n,l),e=!1},d(l){n&&n.d(l)}}}function w8(r){let e,t,n;function l(d){r[16](d)}let u={id:r[1],type:"line",source:r[2],sourceLayer:r[3],beforeId:r[4],beforeLayerType:r[5],paint:r[6],layout:r[7],filter:r[8],minzoom:r[9],maxzoom:r[10],hoverCursor:r[11],manageHoverState:r[12],eventsIfTopMost:r[13],interactive:r[14],$$slots:{default:[b8]},$$scope:{ctx:r}};return r[0]!==void 0&&(u.hovered=r[0]),e=new s_({props:u}),pn.push(()=>zo(e,"hovered",l)),e.$on("click",r[17]),e.$on("dblclick",r[18]),e.$on("contextmenu",r[19]),e.$on("mouseenter",r[20]),e.$on("mousemove",r[21]),e.$on("mouseleave",r[22]),{c(){je(e.$$.fragment)},m(d,a){Oe(e,d,a),n=!0},p(d,[a]){const _={};a&2&&(_.id=d[1]),a&4&&(_.source=d[2]),a&8&&(_.sourceLayer=d[3]),a&16&&(_.beforeId=d[4]),a&32&&(_.beforeLayerType=d[5]),a&64&&(_.paint=d[6]),a&128&&(_.layout=d[7]),a&256&&(_.filter=d[8]),a&512&&(_.minzoom=d[9]),a&1024&&(_.maxzoom=d[10]),a&2048&&(_.hoverCursor=d[11]),a&4096&&(_.manageHoverState=d[12]),a&8192&&(_.eventsIfTopMost=d[13]),a&16384&&(_.interactive=d[14]),a&8388608&&(_.$$scope={dirty:a,ctx:d}),!t&&a&1&&(t=!0,_.hovered=d[0],Po(()=>t=!1)),e.$set(_)},i(d){n||(oe(e.$$.fragment,d),n=!0)},o(d){de(e.$$.fragment,d),n=!1},d(d){Ne(e,d)}}}function x8(r,e,t){let{$$slots:n={},$$scope:l}=e,{id:u=Mh("line")}=e,{source:d=void 0}=e,{sourceLayer:a=void 0}=e,{beforeId:_=void 0}=e,{beforeLayerType:x=void 0}=e,{paint:S}=e,{layout:k=void 0}=e,{filter:C=void 0}=e,{minzoom:P=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:N=void 0}=e,{manageHoverState:z=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:O=!1}=e,{interactive:G=!0}=e;function U(re){B=re,t(0,B)}function K(re){ur.call(this,r,re)}function me(re){ur.call(this,r,re)}function X(re){ur.call(this,r,re)}function Y(re){ur.call(this,r,re)}function _e(re){ur.call(this,r,re)}function ze(re){ur.call(this,r,re)}return r.$$set=re=>{"id"in re&&t(1,u=re.id),"source"in re&&t(2,d=re.source),"sourceLayer"in re&&t(3,a=re.sourceLayer),"beforeId"in re&&t(4,_=re.beforeId),"beforeLayerType"in re&&t(5,x=re.beforeLayerType),"paint"in re&&t(6,S=re.paint),"layout"in re&&t(7,k=re.layout),"filter"in re&&t(8,C=re.filter),"minzoom"in re&&t(9,P=re.minzoom),"maxzoom"in re&&t(10,D=re.maxzoom),"hoverCursor"in re&&t(11,N=re.hoverCursor),"manageHoverState"in re&&t(12,z=re.manageHoverState),"hovered"in re&&t(0,B=re.hovered),"eventsIfTopMost"in re&&t(13,O=re.eventsIfTopMost),"interactive"in re&&t(14,G=re.interactive),"$$scope"in re&&t(23,l=re.$$scope)},[B,u,d,a,_,x,S,k,C,P,D,N,z,O,G,n,U,K,me,X,Y,_e,ze,l]}class S8 extends Ht{constructor(e){super(),Zt(this,e,x8,w8,Ut,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function k8(r){let e,t,n,l,u,d;return e=new p8({props:{id:"edit-polygon-fill",filter:qz,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),n=new S8({props:{id:"edit-polygon-lines",filter:Gz,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),u=new u8({props:{id:"edit-polygon-vertices",filter:Wz,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){je(e.$$.fragment),t=Ve(),je(n.$$.fragment),l=Ve(),je(u.$$.fragment)},m(a,_){Oe(e,a,_),be(a,t,_),Oe(n,a,_),be(a,l,_),Oe(u,a,_),d=!0},p:Mt,i(a){d||(oe(e.$$.fragment,a),oe(n.$$.fragment,a),oe(u.$$.fragment,a),d=!0)},o(a){de(e.$$.fragment,a),de(n.$$.fragment,a),de(u.$$.fragment,a),d=!1},d(a){a&&(ve(t),ve(l)),Ne(e,a),Ne(n,a),Ne(u,a)}}}function T8(r){let e,t;return e=new v8({props:{data:r[0],$$slots:{default:[k8]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,[l]){const u={};l&1&&(u.data=n[0]),l&2&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function E8(r,e,t){let n;return wt(r,Ox,l=>t(0,n=l)),[n]}class M8 extends Ht{constructor(e){super(),Zt(this,e,E8,T8,Ut,{})}}function C8(r){let e,t,n,l,u,d,a;return{c(){e=fe("button"),e.textContent="Import current view",t=Ve(),n=fe("i"),n.textContent="or...",l=Ve(),u=fe("button"),u.textContent="Draw an area to import on the map",Ee(e,"type","button"),Ee(u,"type","button")},m(_,x){be(_,e,x),be(_,t,x),be(_,n,x),be(_,l,x),be(_,u,x),d||(a=[Tt(e,"click",r[2]),Tt(u,"click",r[3])],d=!0)},p:Mt,i:Mt,o:Mt,d(_){_&&(ve(e),ve(t),ve(n),ve(l),ve(u)),d=!1,_n(a)}}}function I8(r){let e,t;return e=new Yz({props:{polygonTool:r[0]}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&1&&(u.polygonTool=n[0]),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function A8(r){let e,t,n,l,u,d,a,_,x;const S=[I8,C8],k=[];function C(P,D){return P[0]?0:1}return e=C(r),t=k[e]=S[e](r),{c(){t.c(),n=Ve(),l=fe("label"),u=fe("input"),d=rt(`Save a copy of the osm.xml + after importing`),Ee(u,"type","checkbox")},m(P,D){k[e].m(P,D),be(P,n,D),be(P,l,D),ie(l,u),u.checked=r[1],ie(l,d),a=!0,_||(x=Tt(u,"change",r[5]),_=!0)},p(P,[D]){let N=e;e=C(P),e===N?k[e].p(P,D):(yr(),de(k[N],1,1,()=>{k[N]=null}),vr(),t=k[e],t?t.p(P,D):(t=k[e]=S[e](P),t.c()),oe(t,1),t.m(n.parentNode,n)),D&2&&(u.checked=P[1])},i(P){a||(oe(t),a=!0)},o(P){de(t),a=!1},d(P){P&&(ve(n),ve(l)),k[e].d(P),_=!1,x()}}}function Zu(r){return[r.lng,r.lat]}function L8(r,e,t){let{map:n}=e;const l=us();let u=null,d=!1;async function a(C){try{l("loading","Loading from Overpass");let D=await(await fetch(Vx(C))).text();d&&ad("osm.xml",D),l("gotXml",{xml:D,boundary:C})}catch(P){l("error",P.toString())}}function _(){let C=n.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[Zu(C.getSouthWest()),Zu(C.getNorthWest()),Zu(C.getNorthEast()),Zu(C.getSouthEast()),Zu(C.getSouthWest())]],type:"Polygon"}}}async function x(){if(n){if(n.getZoom()<13){l("error","Zoom in more to import");return}await a(_())}}function S(){n&&(t(0,u=new Hz(n)),u.startNew(),u.addEventListenerSuccess(async C=>{t(0,u=null),await a(C)}),u.addEventListenerFailure(()=>{t(0,u=null)}))}function k(){d=this.checked,t(1,d)}return r.$$set=C=>{"map"in C&&t(4,n=C.map)},[u,d,x,S,n,k]}class P8 extends Ht{constructor(e){super(),Zt(this,e,L8,A8,Ut,{map:4})}}function Vx(r){let e='poly:"';for(let[n,l]of r.geometry.coordinates[0])e+=`${l} ${n} `;return e=e.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${e}); node(w)->.x; <;); out meta;`}`}async function vg(r){ha.set(r);try{let e=JSON.parse(window.localStorage.getItem(r));console.time("get OSM input");let[t,n]=await z8(e);console.timeEnd("get OSM input"),console.time("load"),ri.set(new Fb(new Uint8Array(t),n,e.study_area_name||void 0)),Hi(ri).loadSavefile(e),console.timeEnd("load"),qx()}catch(e){window.alert(`Couldn't open project: ${e}`),ha.set("")}}async function z8(r){if(r.study_area_name){let e=Hi(dh)?`/osm/${r.study_area_name}.pbf`:`https://assets.od2net.org/severance_pbfs/${r.study_area_name}.pbf`;console.log(`Grabbing ${e}`);let n=await(await fetch(e)).arrayBuffer(),l=Hi(dh)?`/boundaries/${r.study_area_name}.geojson`:`https://assets.od2net.org/boundaries/${r.study_area_name}.geojson`,d=await(await fetch(l)).json();return[n,d]}else{console.log("Grabbing from Overpass");let e=r.features.find(l=>l.properties.kind=="study_area_boundary");return[await(await fetch(Vx(e))).arrayBuffer(),e]}}function qx(){pr.set({mode:"network"}),Lc.set(new ik(Hi(ls),Hi(ri).toRouteSnapper(),Tr(Xf()),Tr(!0),Tr(0))),Hi(ls).fitBounds(Array.from(Hi(ri).getBounds()),{animate:!1}),Bm.set(fb()),Fm.set(fb())}function fb(){let r=Hi(ri).getBounds(),e=r[0]+Math.random()*(r[2]-r[0]),t=r[1]+Math.random()*(r[3]-r[1]);return new Pc.LngLat(e,t)}function db(r,e,t){const n=r.slice();return n[18]=e[t][0],n[19]=e[t][1],n}function pb(r,e,t){const n=r.slice();return n[22]=e[t],n}function D8(r){let e;return{c(){e=fe("div"),e.innerHTML='',Ee(e,"slot","top")},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function R8(r){let e;return{c(){e=fe("p"),e.textContent="Waiting for MapLibre and WASM to load..."},m(t,n){be(t,e,n)},p:Mt,i:Mt,o:Mt,d(t){t&&ve(e)}}}function B8(r){let e,t,n,l,u,d,a,_,x,S,k,C,P;t=new Zr({props:{$$slots:{default:[F8]},$$scope:{ctx:r}}}),t.$on("click",r[10]);let D=Jn(r[2].entries()),N=[];for(let B=0;Bde(N[B],1,1,()=>{N[B]=null});return{c(){e=fe("div"),je(t.$$.fragment),n=Ve(),l=fe("p"),l.textContent="Load a saved project:",u=Ve(),d=fe("ul");for(let B=0;B`,d=Ve(),a=fe("button"),a.innerHTML=`Delete project`,_=Ve(),Ee(u,"class","secondary"),Ee(a,"class","secondary"),fn(t,"display","flex"),fn(t,"justify-content","space-between")},m(N,z){be(N,e,z),ie(e,t),Oe(n,t,null),ie(t,l),ie(t,u),ie(t,d),ie(t,a),ie(e,_),x=!0,S||(k=[Tt(u,"click",P),Tt(a,"click",D)],S=!0)},p(N,z){r=N;const B={};z&33554436&&(B.$$scope={dirty:z,ctx:r}),n.$set(B)},i(N){x||(oe(n.$$.fragment,N),x=!0)},o(N){de(n.$$.fragment,N),x=!1},d(N){N&&ve(e),Ne(n),S=!1,_n(k)}}}function gb(r){let e,t=(r[18]??"custom area")+"",n,l,u,d,a=Jn(r[19]),_=[];for(let S=0;Sde(_[S],1,1,()=>{_[S]=null});return{c(){e=fe("u"),n=rt(t),l=Ve();for(let S=0;S<_.length;S+=1)_[S].c();u=$n()},m(S,k){be(S,e,k),ie(e,n),be(S,l,k);for(let C=0;C<_.length;C+=1)_[C]&&_[C].m(S,k);be(S,u,k),d=!0},p(S,k){if((!d||k&4)&&t!==(t=(S[18]??"custom area")+"")&&Ar(n,t),k&900){a=Jn(S[19]);let C;for(C=0;C{d[S]=null}),vr(),n=d[t],n?n.p(_,x):(n=d[t]=u[t](_),n.c()),oe(n,1),n.m(e,null))},i(_){l||(oe(n),l=!0)},o(_){de(n),l=!1},d(_){_&&ve(e),d[t].d()}}}function j8(r){let e,t,n,l;return e=new Db({props:{loading:r[1]}}),n=new Fs({props:{$$slots:{sidebar:[N8],top:[D8]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment),t=Ve(),je(n.$$.fragment)},m(u,d){Oe(e,u,d),be(u,t,d),Oe(n,u,d),l=!0},p(u,[d]){const a={};d&2&&(a.loading=u[1]),e.$set(a);const _={};d&33554493&&(_.$$scope={dirty:d,ctx:u}),n.$set(_)},i(u){l||(oe(e.$$.fragment,u),oe(n.$$.fragment,u),l=!0)},o(u){de(e.$$.fragment,u),de(n.$$.fragment,u),l=!1},d(u){u&&ve(t),Ne(e,u),Ne(n,u)}}}function Uf(){let r=new Map;for(let e=0;et(15,n=K)),wt(r,Lc,K=>t(16,l=K)),wt(r,ri,K=>t(17,u=K)),wt(r,ls,K=>t(4,d=K)),wt(r,pr,K=>t(5,a=K));let{wasmReady:_}=e,x="";Rt(ri,u=null,u),Rt(Lc,l=null,l),Rt(ha,n="",n);let S=Uf(),k;async function C(K){let me="ltn_"+k.files[0].name;t(1,x=`Loading from file ${me}`),window.localStorage.setItem(me,await k.files[0].text()),t(2,S=Uf()),await vg(me),t(1,x="")}function P(K){window.confirm(`Really delete project ${K}? You can't undo this.`)&&(window.localStorage.removeItem(K),t(2,S=Uf()))}function D(K){let me=window.prompt(`Rename project ${K} to what?`,K);if(me){me.startsWith("ltn_")||(me=`ltn_${me}`);let X=window.localStorage.getItem(K);window.localStorage.setItem(me,X),window.localStorage.removeItem(K),t(2,S=Uf())}}async function N(K){t(1,x=`Loading project ${K}`),await vg(K),t(1,x="")}const z=()=>Rt(pr,a={mode:"new-project"},a),B=K=>N(K),O=K=>D(K),G=K=>P(K);function U(K){pn[K?"unshift":"push"](()=>{k=K,t(3,k)})}return r.$$set=K=>{"wasmReady"in K&&t(0,_=K.wasmReady)},[_,x,S,k,d,a,C,P,D,N,z,B,O,G,U]}class V8 extends Ht{constructor(e){super(),Zt(this,e,U8,j8,Ut,{wasmReady:0})}}function _b(r,e,t){const n=r.slice();return n[17]=e[t][0],n[18]=e[t][1],n}function yb(r,e,t){const n=r.slice();return n[21]=e[t][0],n[22]=e[t][1],n}function q8(r){let e;return{c(){e=rt("Choose project")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function G8(r){let e,t,n,l,u,d,a,_;return u=new Zr({props:{$$slots:{default:[q8]},$$scope:{ctx:r}}}),u.$on("click",r[13]),{c(){e=fe("div"),t=fe("nav"),n=fe("ul"),l=fe("li"),je(u.$$.fragment),d=Ve(),a=fe("li"),a.textContent="New project",Ee(t,"aria-label","breadcrumb"),Ee(e,"slot","top")},m(x,S){be(x,e,S),ie(e,t),ie(t,n),ie(n,l),Oe(u,l,null),ie(n,d),ie(n,a),_=!0},p(x,S){const k={};S&33554432&&(k.$$scope={dirty:S,ctx:x}),u.$set(k)},i(x){_||(oe(u.$$.fragment,x),_=!0)},o(x){de(u.$$.fragment,x),_=!1},d(x){x&&ve(e),Ne(u)}}}function vb(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D;e=new Db({props:{loading:r[4]}});let N=Jn(r[3]),z=[];for(let B=0;Br[9].call(u))},m(B,O){Oe(e,B,O),be(B,t,O),be(B,n,O),ie(n,l),ie(n,u),ie(u,d);for(let G=0;G{S=null}),vr())},i(k){a||(oe(S),a=!0)},o(k){de(S),a=!1},d(k){k&&ve(e),S&&S.d(),_=!1,x()}}}function Z8(r){let e,t,n;return t=new M8({}),{c(){e=fe("div"),je(t.$$.fragment),Ee(e,"slot","map")},m(l,u){be(l,e,u),Oe(t,e,null),n=!0},p:Mt,i(l){n||(oe(t.$$.fragment,l),n=!0)},o(l){de(t.$$.fragment,l),n=!1},d(l){l&&ve(e),Ne(t)}}}function H8(r){let e,t;return e=new Fs({props:{$$slots:{map:[Z8],sidebar:[W8],top:[G8]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,[l]){const u={};l&33554558&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function $8(r,e,t){let n,l,u,d,a;wt(r,ha,U=>t(14,n=U)),wt(r,ri,U=>t(15,l=U)),wt(r,dh,U=>t(16,u=U)),wt(r,ls,U=>t(5,d=U)),wt(r,pr,U=>t(6,a=U));let _="",x="",S=[],k="";Ld(async()=>{let U=await fetch(u?"/osm/areas.json":"https://assets.od2net.org/severance_pbfs/areas.json");t(3,S=await U.json())});function C(U){t(4,k="Loading OSM");try{Rt(ri,l=new Fb(new TextEncoder().encode(U.detail.xml),U.detail.boundary,void 0),l),Rt(ha,n=`ltn_${_}`,n),qx(),Sc()}catch(K){window.alert(`Couldn't import from Overpass: ${K}`)}t(4,k="")}async function P(){if(x=="")return;let U=`ltn_${_}`;window.localStorage.setItem(U,JSON.stringify({type:"FeatureCollection",features:[],study_area_name:x})),t(4,k=`Loading pre-clipped OSM area ${x}`),await vg(U),t(4,k="")}function D(){_=this.value,t(1,_)}function N(){x=Cb(this),t(2,x),t(3,S)}return[P,_,x,S,k,d,a,C,D,N,()=>P(),U=>t(4,k=U.detail),U=>window.alert(U.detail),()=>Rt(pr,a={mode:"title"},a)]}class X8 extends Ht{constructor(e){super(),Zt(this,e,$8,H8,Ut,{loadExample:0})}get loadExample(){return this.$$.ctx[0]}}const{window:K8}=Ad;function J8(r){let e;return{c(){e=rt("Choose project")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function Y8(r){let e;return{c(){e=rt("Pick neighbourhood")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function Q8(r){let e;return{c(){e=rt("Editing")},m(t,n){be(t,e,n)},d(t){t&&ve(e)}}}function eD(r){let e,t,n,l,u,d,a,_,x,S,k,C,P,D;return u=new Zr({props:{$$slots:{default:[J8]},$$scope:{ctx:r}}}),u.$on("click",r[9]),_=new Zr({props:{$$slots:{default:[Y8]},$$scope:{ctx:r}}}),_.$on("click",r[10]),k=new Zr({props:{$$slots:{default:[Q8]},$$scope:{ctx:r}}}),k.$on("click",r[5]),{c(){e=fe("div"),t=fe("nav"),n=fe("ul"),l=fe("li"),je(u.$$.fragment),d=Ve(),a=fe("li"),je(_.$$.fragment),x=Ve(),S=fe("li"),je(k.$$.fragment),C=Ve(),P=fe("li"),P.textContent="Viewing shortcuts",Ee(t,"aria-label","breadcrumb"),Ee(e,"slot","top")},m(N,z){be(N,e,z),ie(e,t),ie(t,n),ie(n,l),Oe(u,l,null),ie(n,d),ie(n,a),Oe(_,a,null),ie(n,x),ie(n,S),Oe(k,S,null),ie(n,C),ie(n,P),D=!0},p(N,z){const B={};z&8192&&(B.$$scope={dirty:z,ctx:N}),u.$set(B);const O={};z&8192&&(O.$$scope={dirty:z,ctx:N}),_.$set(O);const G={};z&8192&&(G.$$scope={dirty:z,ctx:N}),k.$set(G)},i(N){D||(oe(u.$$.fragment,N),oe(_.$$.fragment,N),oe(k.$$.fragment,N),D=!0)},o(N){de(u.$$.fragment,N),de(_.$$.fragment,N),de(k.$$.fragment,N),D=!1},d(N){N&&ve(e),Ne(u),Ne(_),Ne(k)}}}function tD(r){let e,t,n,l,u,d,a,_,x,S=r[0].shortcutIndex+1+"",k,C,P=r[0].gj.features.length+"",D,N,z,B,O,G,U,K,me,X=dn(r[0].gj.features[r[0].shortcutIndex].properties).directness.toFixed(1)+"",Y,_e,ze,re,ce;return{c(){e=fe("p"),e.textContent=`This shows all possible shortcuts crossing the blue road you've chosen. A shortcut is defined as a route starting and ending outside the neighbourhood, but cutting through it. It might not actually be considered a "good shortcut" in practice -- this tool doesn't know any real traffic patterns; it's just looking for any possible path. This view lets you understand the limits of this assumption.`,t=Ve(),n=fe("button"),n.textContent="Pick a different road",l=Ve(),u=fe("div"),d=fe("button"),a=rt("Previous"),x=Ve(),k=rt(S),C=rt(" / "),D=rt(P),N=Ve(),z=fe("button"),B=rt("Next"),G=Ve(),U=fe("p"),K=rt("This shortcut is "),me=fe("b"),Y=rt(X),_e=rt("x"),ze=rt(` - the length of the shortest route using all roads, not just this neighbourhood`),d.disabled=_=r[0].shortcutIndex==0,Ee(d,"data-tooltip","Left"),z.disabled=O=r[0].shortcutIndex==r[0].gj.features.length-1,Ee(z,"data-tooltip","Right"),fn(u,"display","flex"),fn(u,"justify-content","space-between")},m(Ze,Me){be(Ze,e,Me),be(Ze,t,Me),be(Ze,n,Me),be(Ze,l,Me),be(Ze,u,Me),ie(u,d),ie(d,a),ie(u,x),ie(u,k),ie(u,C),ie(u,D),ie(u,N),ie(u,z),ie(z,B),be(Ze,G,Me),be(Ze,U,Me),ie(U,K),ie(U,me),ie(me,Y),ie(me,_e),ie(U,ze),re||(ce=[Tt(n,"click",r[8]),Tt(d,"click",r[6]),Tt(z,"click",r[7])],re=!0)},p(Ze,Me){Me&1&&_!==(_=Ze[0].shortcutIndex==0)&&(d.disabled=_),Me&1&&S!==(S=Ze[0].shortcutIndex+1+"")&&Ar(k,S),Me&1&&P!==(P=Ze[0].gj.features.length+"")&&Ar(D,P),Me&1&&O!==(O=Ze[0].shortcutIndex==Ze[0].gj.features.length-1)&&(z.disabled=O),Me&1&&X!==(X=dn(Ze[0].gj.features[Ze[0].shortcutIndex].properties).directness.toFixed(1)+"")&&Ar(Y,X)},d(Ze){Ze&&(ve(e),ve(t),ve(n),ve(l),ve(u),ve(G),ve(U)),re=!1,_n(ce)}}}function tD(r){let e;return{c(){e=fe("p"),e.textContent="Click a road to see shortcuts"},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function rD(r){let e,t,n,l;t=new Od({}),t.$on("click",r[5]);function u(_,x){if(_[0].state=="neutral")return tD;if(_[0].state=="chose-road")return eD}let d=u(r),a=d&&d(r);return{c(){e=fe("div"),je(t.$$.fragment),n=Ve(),a&&a.c(),Ee(e,"slot","sidebar")},m(_,x){be(_,e,x),Oe(t,e,null),ie(e,n),a&&a.m(e,null),l=!0},p(_,x){d===(d=u(_))&&a?a.p(_,x):(a&&a.d(1),a=d&&d(_),a&&(a.c(),a.m(e,null)))},i(_){l||(oe(t.$$.fragment,_),l=!0)},o(_){de(t.$$.fragment,_),l=!1},d(_){_&&ve(e),Ne(t),a&&a.d()}}}function nD(r){let e,t,n,l,u,d;return e=new Pi({props:{data:Km(JSON.parse(dn(r[2]).renderNeighbourhood())),$$slots:{default:[oD]},$$scope:{ctx:r}}}),n=new Pi({props:{data:r[0].gj.features[r[0].shortcutIndex],$$slots:{default:[sD]},$$scope:{ctx:r}}}),u=new Pi({props:{data:r[0].roadGj,$$slots:{default:[aD]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment),t=Ve(),je(n.$$.fragment),l=Ve(),je(u.$$.fragment)},m(a,_){Oe(e,a,_),be(a,t,_),Oe(n,a,_),be(a,l,_),Oe(u,a,_),d=!0},p(a,_){const x={};_&4&&(x.data=Km(JSON.parse(dn(a[2]).renderNeighbourhood()))),_&8192&&(x.$$scope={dirty:_,ctx:a}),e.$set(x);const S={};_&1&&(S.data=a[0].gj.features[a[0].shortcutIndex]),_&8192&&(S.$$scope={dirty:_,ctx:a}),n.$set(S);const k={};_&1&&(k.data=a[0].roadGj),_&8192&&(k.$$scope={dirty:_,ctx:a}),u.$set(k)},i(a){d||(oe(e.$$.fragment,a),oe(n.$$.fragment,a),oe(u.$$.fragment,a),d=!0)},o(a){de(e.$$.fragment,a),de(n.$$.fragment,a),de(u.$$.fragment,a),d=!1},d(a){a&&(ve(t),ve(l)),Ne(e,a),Ne(n,a),Ne(u,a)}}}function iD(r){let e,t;return e=new Nd({props:{gjInput:JSON.parse(dn(r[2]).renderNeighbourhood()),onClickLine:r[3],$$slots:{"line-popup":[cD]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&4&&(u.gjInput=JSON.parse(dn(n[2]).renderNeighbourhood())),l&8192&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function oD(r){let e,t;const n=[Hn("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.3}}];let l={};for(let u=0;u({12:l}),({props:l})=>l?4096:0]},$$scope:{ctx:r}}}),{c(){e=fe("div"),je(t.$$.fragment),Ee(e,"slot","line-popup")},m(l,u){be(l,e,u),Oe(t,e,null),n=!0},p(l,u){const d={};u&12288&&(d.$$scope={dirty:u,ctx:l}),t.$set(d)},i(l){n||(oe(t.$$.fragment,l),n=!0)},o(l){de(t.$$.fragment,l),n=!1},d(l){l&&ve(e),Ne(t)}}}function uD(r){let e,t,n,l,u,d;const a=[iD,nD],_=[];function x(S,k){return S[0].state=="neutral"?0:S[0].state=="chose-road"?1:-1}return~(t=x(r))&&(n=_[t]=a[t](r)),u=new jd({}),{c(){e=fe("div"),n&&n.c(),l=Ve(),je(u.$$.fragment),Ee(e,"slot","map")},m(S,k){be(S,e,k),~t&&_[t].m(e,null),ie(e,l),Oe(u,e,null),d=!0},p(S,k){let C=t;t=x(S),t===C?~t&&_[t].p(S,k):(n&&(yr(),de(_[C],1,1,()=>{_[C]=null}),vr()),~t?(n=_[t],n?n.p(S,k):(n=_[t]=a[t](S),n.c()),oe(n,1),n.m(e,l)):n=null)},i(S){d||(oe(n),oe(u.$$.fragment,S),d=!0)},o(S){de(n),de(u.$$.fragment,S),d=!1},d(S){S&&ve(e),~t&&_[t].d(),Ne(u)}}}function hD(r){let e,t,n,l;return e=new Fs({props:{$$slots:{map:[uD],sidebar:[rD],top:[Q8]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(u,d){Oe(e,u,d),t=!0,n||(l=Tt(X8,"keydown",r[4]),n=!0)},p(u,[d]){const a={};d&8199&&(a.$$scope={dirty:d,ctx:u}),e.$set(a)},i(u){t||(oe(e.$$.fragment,u),t=!0)},o(u){de(e.$$.fragment,u),t=!1},d(u){Ne(e,u),n=!1,l()}}}function fD(r,e,t){let n,l,u;wt(r,pr,N=>t(1,n=N)),wt(r,ls,N=>t(11,l=N)),wt(r,ri,N=>t(2,u=N));let d={state:"neutral"};function a(N,z){let B=JSON.parse(u.getShortcutsCrossingRoad(N.properties.id));if(B.features.length==0){window.alert("No shortcuts here");return}t(0,d={state:"chose-road",roadGj:N,gj:B,shortcutIndex:0})}Ld(()=>{l==null||l.keyboard.disable()}),ti(()=>{l==null||l.keyboard.enable()});function _(N){d.state=="chose-road"&&(N.key=="ArrowLeft"&&d.shortcutIndex>0&&(N.stopPropagation(),t(0,d.shortcutIndex--,d)),N.key=="ArrowRight"&&(N.stopPropagation(),d.shortcutIndex!=d.gj.features.length-1&&t(0,d.shortcutIndex++,d)))}function x(){Rt(pr,n={mode:"neighbourhood"},n)}function S(){d.state=="chose-road"&&t(0,d.shortcutIndex--,d)}function k(){d.state=="chose-road"&&t(0,d.shortcutIndex++,d)}return[d,n,u,a,_,x,S,k,()=>t(0,d={state:"neutral"}),()=>Rt(pr,n={mode:"title"},n),()=>Rt(pr,n={mode:"network"},n)]}class dD extends Ht{constructor(e){super(),Zt(this,e,fD,hD,Ut,{})}}function pD(r){let e,t,n,l,u,d,a,_,x;return l=new rz({}),{c(){e=fe("div"),t=fe("button"),t.innerHTML=`A/B Street logo`,n=Ve(),je(l.$$.fragment),u=Ve(),d=fe("span"),Ee(t,"class","outline"),fn(d,"width","100%"),Ee(e,"slot","top"),fn(e,"display","flex")},m(S,k){be(S,e,k),ie(e,t),ie(e,n),Oe(l,e,null),ie(e,u),ie(e,d),r[19](d),a=!0,_||(x=Tt(t,"click",r[18]),_=!0)},p:Mt,i(S){a||(oe(l.$$.fragment,S),a=!0)},o(S){de(l.$$.fragment,S),a=!1},d(S){S&&ve(e),Ne(l),r[19](null),_=!1,x()}}}function wb(r){let e,t,n,l,u,d;return n=new j5({props:{map:dn(r[6]),maptilerBasemap:r[7]}}),{c(){e=fe("button"),e.textContent="Zoom to fit study area",t=Ve(),je(n.$$.fragment),Ee(e,"class","secondary")},m(a,_){be(a,e,_),be(a,t,_),Oe(n,a,_),l=!0,u||(d=Tt(e,"click",r[10]),u=!0)},p(a,_){const x={};_&64&&(x.map=dn(a[6])),_&128&&(x.maptilerBasemap=a[7]),n.$set(x)},i(a){l||(oe(n.$$.fragment,a),l=!0)},o(a){de(n.$$.fragment,a),l=!1},d(a){a&&(ve(e),ve(t)),Ne(n,a),u=!1,d()}}}function mD(r){let e,t,n,l,u,d,a=r[5]&&wb(r);return{c(){e=fe("div"),t=fe("div"),n=Ve(),l=fe("hr"),u=Ve(),a&&a.c(),Ee(e,"slot","left")},m(_,x){be(_,e,x),ie(e,t),r[17](t),ie(e,n),ie(e,l),ie(e,u),a&&a.m(e,null),d=!0},p(_,x){_[5]?a?(a.p(_,x),x&32&&oe(a,1)):(a=wb(_),a.c(),oe(a,1),a.m(e,null)):a&&(yr(),de(a,1,1,()=>{a=null}),vr())},i(_){d||(oe(a),d=!0)},o(_){de(a),d=!1},d(_){_&&ve(e),r[17](null),a&&a.d()}}}function gD(r){let e,t;return e=new $8({}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p:Mt,i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function _D(r){let e,t;return e=new U8({props:{wasmReady:r[4]}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&16&&(u.wasmReady=n[4]),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function xb(r){let e,t,n,l,u,d;e=new Pi({props:{data:JSON.parse(r[5].getInvertedBoundary()),$$slots:{default:[yD]},$$scope:{ctx:r}}});const a=[TD,kD,SD,xD,wD,bD,vD],_=[];function x(S,k){return S[8].mode=="network"?0:S[8].mode=="set-boundary"?1:S[8].mode=="auto-boundaries"?2:S[8].mode=="neighbourhood"?3:S[8].mode=="view-shortcuts"?4:S[8].mode=="route"?5:S[8].mode=="debug"?6:-1}return~(n=x(r))&&(l=_[n]=a[n](r)),{c(){je(e.$$.fragment),t=Ve(),l&&l.c(),u=$n()},m(S,k){Oe(e,S,k),be(S,t,k),~n&&_[n].m(S,k),be(S,u,k),d=!0},p(S,k){const C={};k&32&&(C.data=JSON.parse(S[5].getInvertedBoundary())),k&2097152&&(C.$$scope={dirty:k,ctx:S}),e.$set(C);let P=n;n=x(S),n===P?~n&&_[n].p(S,k):(l&&(yr(),de(_[P],1,1,()=>{_[P]=null}),vr()),~n?(l=_[n],l?l.p(S,k):(l=_[n]=a[n](S),l.c()),oe(l,1),l.m(u.parentNode,u)):l=null)},i(S){d||(oe(e.$$.fragment,S),oe(l),d=!0)},o(S){de(e.$$.fragment,S),de(l),d=!1},d(S){S&&(ve(t),ve(u)),Ne(e,S),~n&&_[n].d(S)}}}function yD(r){let e,t;const n=[Hn("boundary"),{paint:{"fill-color":"black","fill-opacity":.3}}];let l={};for(let u=0;u{C[O]=null}),vr()),~u?(d=C[u],d?d.p(N,z):(d=C[u]=k[u](N),d.c()),oe(d,1),d.m(a.parentNode,a)):d=null),N[5]?D?(D.p(N,z),z&32&&oe(D,1)):(D=xb(N),D.c(),oe(D,1),D.m(_.parentNode,_)):D&&(yr(),de(D,1,1,()=>{D=null}),vr())},i(N){S||(oe(e.$$.fragment,N),oe(d),oe(D),oe(x.$$.fragment,N),S=!0)},o(N){de(e.$$.fragment,N),de(d),de(D),de(x.$$.fragment,N),S=!1},d(N){N&&(ve(t),ve(n),ve(l),ve(a),ve(_)),Ne(e,N),r[14](null),~u&&C[u].d(N),D&&D.d(N),Ne(x,N)}}}function MD(r){let e,t,n,l;function u(a){r[15](a)}let d={style:`https://api.maptiler.com/maps/${r[7]}/style.json?key=${Dm}`,standardControls:!0,hash:!0,images:[{id:"walk_cycle_only",url:"/ltn//filters/walk_cycle_only_icon.gif"},{id:"no_entry",url:"/ltn//filters/no_entry_icon.gif"},{id:"bus_gate",url:"/ltn//filters/bus_gate_icon.gif"},{id:"school_street",url:"/ltn//filters/school_street_icon.gif"},{id:"oneway-arrow",url:lk}],$$slots:{default:[ED]},$$scope:{ctx:r}};return r[0]!==void 0&&(d.map=r[0]),t=new e3({props:d}),pn.push(()=>zo(t,"map",u)),t.$on("error",r[16]),{c(){e=fe("div"),je(t.$$.fragment),Ee(e,"slot","main"),fn(e,"position","relative"),fn(e,"width","100%"),fn(e,"height","100%")},m(a,_){be(a,e,_),Oe(t,e,null),l=!0},p(a,_){const x={};_&128&&(x.style=`https://api.maptiler.com/maps/${a[7]}/style.json?key=${Dm}`),_&2097465&&(x.$$scope={dirty:_,ctx:a}),!n&&_&1&&(n=!0,x.map=a[0],Po(()=>n=!1)),t.$set(x)},i(a){l||(oe(t.$$.fragment,a),l=!0)},o(a){de(t.$$.fragment,a),l=!1},d(a){a&&ve(e),Ne(t)}}}function CD(r){let e,t,n,l;return e=new ak({}),n=new u5({props:{$$slots:{main:[MD],left:[mD],top:[pD]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment),t=Ve(),je(n.$$.fragment)},m(u,d){Oe(e,u,d),be(u,t,d),Oe(n,u,d),l=!0},p(u,[d]){const a={};d&2098175&&(a.$$scope={dirty:d,ctx:u}),n.$set(a)},i(u){l||(oe(e.$$.fragment,u),oe(n.$$.fragment,u),l=!0)},o(u){de(e.$$.fragment,u),de(n.$$.fragment,u),l=!1},d(u){u&&ve(t),Ne(e,u),Ne(n,u)}}}function ID(r,e,t){let n,l,u,d,a,_,x,S,k;wt(r,Xm,Y=>t(11,n=Y)),wt(r,$m,Y=>t(12,l=Y)),wt(r,Hm,Y=>t(13,u=Y)),wt(r,ri,Y=>t(5,d=Y)),wt(r,ls,Y=>t(6,a=Y)),wt(r,dh,Y=>t(20,_=Y)),wt(r,Rm,Y=>t(7,x=Y)),wt(r,pr,Y=>t(8,S=Y)),wt(r,hd,Y=>t(9,k=Y));let C=!1;Ld(async()=>{await Fb(),await Ub(),t(4,C=!0);try{(await fetch("/osm/areas.json")).ok&&(Rt(dh,_=!0,_),console.log("Using local cache, not od2net.org"))}catch{}});let P;function D(){a.fitBounds(Array.from(d.getBounds()),{animate:!1})}let N,z,B;function O(Y){pn[Y?"unshift":"push"](()=>{B=Y,t(3,B),t(11,n)})}function G(Y){P=Y,t(0,P)}const U=Y=>{console.log(Y.detail.error)};function K(Y){pn[Y?"unshift":"push"](()=>{z=Y,t(2,z),t(12,l)})}const me=()=>Rt(hd,k=!0,k);function X(Y){pn[Y?"unshift":"push"](()=>{N=Y,t(1,N),t(13,u)})}return r.$$.update=()=>{r.$$.dirty&1&&P&&ls.set(P),r.$$.dirty&8194&&N&&u&&(t(1,N.innerHTML="",N),N.appendChild(u)),r.$$.dirty&4100&&z&&l&&(t(2,z.innerHTML="",z),z.appendChild(l)),r.$$.dirty&2056&&B&&n&&(t(3,B.innerHTML="",B),B.appendChild(n))},[P,N,z,B,C,d,a,x,S,k,D,n,l,u,O,G,U,K,me,X]}class AD extends Ht{constructor(e){super(),Zt(this,e,ID,CD,Ut,{})}}new AD({target:document.getElementById("app")}); + the length of the shortest route using all roads, not just this neighbourhood`),d.disabled=_=r[0].shortcutIndex==0,Ee(d,"data-tooltip","Left"),z.disabled=O=r[0].shortcutIndex==r[0].gj.features.length-1,Ee(z,"data-tooltip","Right"),fn(u,"display","flex"),fn(u,"justify-content","space-between")},m(Ze,Me){be(Ze,e,Me),be(Ze,t,Me),be(Ze,n,Me),be(Ze,l,Me),be(Ze,u,Me),ie(u,d),ie(d,a),ie(u,x),ie(u,k),ie(u,C),ie(u,D),ie(u,N),ie(u,z),ie(z,B),be(Ze,G,Me),be(Ze,U,Me),ie(U,K),ie(U,me),ie(me,Y),ie(me,_e),ie(U,ze),re||(ce=[Tt(n,"click",r[8]),Tt(d,"click",r[6]),Tt(z,"click",r[7])],re=!0)},p(Ze,Me){Me&1&&_!==(_=Ze[0].shortcutIndex==0)&&(d.disabled=_),Me&1&&S!==(S=Ze[0].shortcutIndex+1+"")&&Ar(k,S),Me&1&&P!==(P=Ze[0].gj.features.length+"")&&Ar(D,P),Me&1&&O!==(O=Ze[0].shortcutIndex==Ze[0].gj.features.length-1)&&(z.disabled=O),Me&1&&X!==(X=dn(Ze[0].gj.features[Ze[0].shortcutIndex].properties).directness.toFixed(1)+"")&&Ar(Y,X)},d(Ze){Ze&&(ve(e),ve(t),ve(n),ve(l),ve(u),ve(G),ve(U)),re=!1,_n(ce)}}}function rD(r){let e;return{c(){e=fe("p"),e.textContent="Click a road to see shortcuts"},m(t,n){be(t,e,n)},p:Mt,d(t){t&&ve(e)}}}function nD(r){let e,t,n,l;t=new Od({}),t.$on("click",r[5]);function u(_,x){if(_[0].state=="neutral")return rD;if(_[0].state=="chose-road")return tD}let d=u(r),a=d&&d(r);return{c(){e=fe("div"),je(t.$$.fragment),n=Ve(),a&&a.c(),Ee(e,"slot","sidebar")},m(_,x){be(_,e,x),Oe(t,e,null),ie(e,n),a&&a.m(e,null),l=!0},p(_,x){d===(d=u(_))&&a?a.p(_,x):(a&&a.d(1),a=d&&d(_),a&&(a.c(),a.m(e,null)))},i(_){l||(oe(t.$$.fragment,_),l=!0)},o(_){de(t.$$.fragment,_),l=!1},d(_){_&&ve(e),Ne(t),a&&a.d()}}}function iD(r){let e,t,n,l,u,d;return e=new Pi({props:{data:Km(JSON.parse(dn(r[2]).renderNeighbourhood())),$$slots:{default:[sD]},$$scope:{ctx:r}}}),n=new Pi({props:{data:r[0].gj.features[r[0].shortcutIndex],$$slots:{default:[aD]},$$scope:{ctx:r}}}),u=new Pi({props:{data:r[0].roadGj,$$slots:{default:[lD]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment),t=Ve(),je(n.$$.fragment),l=Ve(),je(u.$$.fragment)},m(a,_){Oe(e,a,_),be(a,t,_),Oe(n,a,_),be(a,l,_),Oe(u,a,_),d=!0},p(a,_){const x={};_&4&&(x.data=Km(JSON.parse(dn(a[2]).renderNeighbourhood()))),_&8192&&(x.$$scope={dirty:_,ctx:a}),e.$set(x);const S={};_&1&&(S.data=a[0].gj.features[a[0].shortcutIndex]),_&8192&&(S.$$scope={dirty:_,ctx:a}),n.$set(S);const k={};_&1&&(k.data=a[0].roadGj),_&8192&&(k.$$scope={dirty:_,ctx:a}),u.$set(k)},i(a){d||(oe(e.$$.fragment,a),oe(n.$$.fragment,a),oe(u.$$.fragment,a),d=!0)},o(a){de(e.$$.fragment,a),de(n.$$.fragment,a),de(u.$$.fragment,a),d=!1},d(a){a&&(ve(t),ve(l)),Ne(e,a),Ne(n,a),Ne(u,a)}}}function oD(r){let e,t;return e=new Nd({props:{gjInput:JSON.parse(dn(r[2]).renderNeighbourhood()),onClickLine:r[3],$$slots:{"line-popup":[uD]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&4&&(u.gjInput=JSON.parse(dn(n[2]).renderNeighbourhood())),l&8192&&(u.$$scope={dirty:l,ctx:n}),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function sD(r){let e,t;const n=[Hn("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.3}}];let l={};for(let u=0;u({12:l}),({props:l})=>l?4096:0]},$$scope:{ctx:r}}}),{c(){e=fe("div"),je(t.$$.fragment),Ee(e,"slot","line-popup")},m(l,u){be(l,e,u),Oe(t,e,null),n=!0},p(l,u){const d={};u&12288&&(d.$$scope={dirty:u,ctx:l}),t.$set(d)},i(l){n||(oe(t.$$.fragment,l),n=!0)},o(l){de(t.$$.fragment,l),n=!1},d(l){l&&ve(e),Ne(t)}}}function hD(r){let e,t,n,l,u,d;const a=[oD,iD],_=[];function x(S,k){return S[0].state=="neutral"?0:S[0].state=="chose-road"?1:-1}return~(t=x(r))&&(n=_[t]=a[t](r)),u=new jd({}),{c(){e=fe("div"),n&&n.c(),l=Ve(),je(u.$$.fragment),Ee(e,"slot","map")},m(S,k){be(S,e,k),~t&&_[t].m(e,null),ie(e,l),Oe(u,e,null),d=!0},p(S,k){let C=t;t=x(S),t===C?~t&&_[t].p(S,k):(n&&(yr(),de(_[C],1,1,()=>{_[C]=null}),vr()),~t?(n=_[t],n?n.p(S,k):(n=_[t]=a[t](S),n.c()),oe(n,1),n.m(e,l)):n=null)},i(S){d||(oe(n),oe(u.$$.fragment,S),d=!0)},o(S){de(n),de(u.$$.fragment,S),d=!1},d(S){S&&ve(e),~t&&_[t].d(),Ne(u)}}}function fD(r){let e,t,n,l;return e=new Fs({props:{$$slots:{map:[hD],sidebar:[nD],top:[eD]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment)},m(u,d){Oe(e,u,d),t=!0,n||(l=Tt(K8,"keydown",r[4]),n=!0)},p(u,[d]){const a={};d&8199&&(a.$$scope={dirty:d,ctx:u}),e.$set(a)},i(u){t||(oe(e.$$.fragment,u),t=!0)},o(u){de(e.$$.fragment,u),t=!1},d(u){Ne(e,u),n=!1,l()}}}function dD(r,e,t){let n,l,u;wt(r,pr,N=>t(1,n=N)),wt(r,ls,N=>t(11,l=N)),wt(r,ri,N=>t(2,u=N));let d={state:"neutral"};function a(N,z){let B=JSON.parse(u.getShortcutsCrossingRoad(N.properties.id));if(B.features.length==0){window.alert("No shortcuts here");return}t(0,d={state:"chose-road",roadGj:N,gj:B,shortcutIndex:0})}Ld(()=>{l==null||l.keyboard.disable()}),ti(()=>{l==null||l.keyboard.enable()});function _(N){d.state=="chose-road"&&(N.key=="ArrowLeft"&&d.shortcutIndex>0&&(N.stopPropagation(),t(0,d.shortcutIndex--,d)),N.key=="ArrowRight"&&(N.stopPropagation(),d.shortcutIndex!=d.gj.features.length-1&&t(0,d.shortcutIndex++,d)))}function x(){Rt(pr,n={mode:"neighbourhood"},n)}function S(){d.state=="chose-road"&&t(0,d.shortcutIndex--,d)}function k(){d.state=="chose-road"&&t(0,d.shortcutIndex++,d)}return[d,n,u,a,_,x,S,k,()=>t(0,d={state:"neutral"}),()=>Rt(pr,n={mode:"title"},n),()=>Rt(pr,n={mode:"network"},n)]}class pD extends Ht{constructor(e){super(),Zt(this,e,dD,fD,Ut,{})}}function mD(r){let e,t,n,l,u,d,a,_,x;return l=new nz({}),{c(){e=fe("div"),t=fe("button"),t.innerHTML=`A/B Street logo`,n=Ve(),je(l.$$.fragment),u=Ve(),d=fe("span"),Ee(t,"class","outline"),fn(d,"width","100%"),Ee(e,"slot","top"),fn(e,"display","flex")},m(S,k){be(S,e,k),ie(e,t),ie(e,n),Oe(l,e,null),ie(e,u),ie(e,d),r[19](d),a=!0,_||(x=Tt(t,"click",r[18]),_=!0)},p:Mt,i(S){a||(oe(l.$$.fragment,S),a=!0)},o(S){de(l.$$.fragment,S),a=!1},d(S){S&&ve(e),Ne(l),r[19](null),_=!1,x()}}}function xb(r){let e,t,n,l,u,d;return n=new U5({props:{map:dn(r[6]),maptilerBasemap:r[7]}}),{c(){e=fe("button"),e.textContent="Zoom to fit study area",t=Ve(),je(n.$$.fragment),Ee(e,"class","secondary")},m(a,_){be(a,e,_),be(a,t,_),Oe(n,a,_),l=!0,u||(d=Tt(e,"click",r[10]),u=!0)},p(a,_){const x={};_&64&&(x.map=dn(a[6])),_&128&&(x.maptilerBasemap=a[7]),n.$set(x)},i(a){l||(oe(n.$$.fragment,a),l=!0)},o(a){de(n.$$.fragment,a),l=!1},d(a){a&&(ve(e),ve(t)),Ne(n,a),u=!1,d()}}}function gD(r){let e,t,n,l,u,d,a=r[5]&&xb(r);return{c(){e=fe("div"),t=fe("div"),n=Ve(),l=fe("hr"),u=Ve(),a&&a.c(),Ee(e,"slot","left")},m(_,x){be(_,e,x),ie(e,t),r[17](t),ie(e,n),ie(e,l),ie(e,u),a&&a.m(e,null),d=!0},p(_,x){_[5]?a?(a.p(_,x),x&32&&oe(a,1)):(a=xb(_),a.c(),oe(a,1),a.m(e,null)):a&&(yr(),de(a,1,1,()=>{a=null}),vr())},i(_){d||(oe(a),d=!0)},o(_){de(a),d=!1},d(_){_&&ve(e),r[17](null),a&&a.d()}}}function _D(r){let e,t;return e=new X8({}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p:Mt,i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function yD(r){let e,t;return e=new V8({props:{wasmReady:r[4]}}),{c(){je(e.$$.fragment)},m(n,l){Oe(e,n,l),t=!0},p(n,l){const u={};l&16&&(u.wasmReady=n[4]),e.$set(u)},i(n){t||(oe(e.$$.fragment,n),t=!0)},o(n){de(e.$$.fragment,n),t=!1},d(n){Ne(e,n)}}}function Sb(r){let e,t,n,l,u,d;e=new Pi({props:{data:JSON.parse(r[5].getInvertedBoundary()),$$slots:{default:[vD]},$$scope:{ctx:r}}});const a=[ED,TD,kD,SD,xD,wD,bD],_=[];function x(S,k){return S[8].mode=="network"?0:S[8].mode=="set-boundary"?1:S[8].mode=="auto-boundaries"?2:S[8].mode=="neighbourhood"?3:S[8].mode=="view-shortcuts"?4:S[8].mode=="route"?5:S[8].mode=="debug"?6:-1}return~(n=x(r))&&(l=_[n]=a[n](r)),{c(){je(e.$$.fragment),t=Ve(),l&&l.c(),u=$n()},m(S,k){Oe(e,S,k),be(S,t,k),~n&&_[n].m(S,k),be(S,u,k),d=!0},p(S,k){const C={};k&32&&(C.data=JSON.parse(S[5].getInvertedBoundary())),k&2097152&&(C.$$scope={dirty:k,ctx:S}),e.$set(C);let P=n;n=x(S),n===P?~n&&_[n].p(S,k):(l&&(yr(),de(_[P],1,1,()=>{_[P]=null}),vr()),~n?(l=_[n],l?l.p(S,k):(l=_[n]=a[n](S),l.c()),oe(l,1),l.m(u.parentNode,u)):l=null)},i(S){d||(oe(e.$$.fragment,S),oe(l),d=!0)},o(S){de(e.$$.fragment,S),de(l),d=!1},d(S){S&&(ve(t),ve(u)),Ne(e,S),~n&&_[n].d(S)}}}function vD(r){let e,t;const n=[Hn("boundary"),{paint:{"fill-color":"black","fill-opacity":.3}}];let l={};for(let u=0;u{C[O]=null}),vr()),~u?(d=C[u],d?d.p(N,z):(d=C[u]=k[u](N),d.c()),oe(d,1),d.m(a.parentNode,a)):d=null),N[5]?D?(D.p(N,z),z&32&&oe(D,1)):(D=Sb(N),D.c(),oe(D,1),D.m(_.parentNode,_)):D&&(yr(),de(D,1,1,()=>{D=null}),vr())},i(N){S||(oe(e.$$.fragment,N),oe(d),oe(D),oe(x.$$.fragment,N),S=!0)},o(N){de(e.$$.fragment,N),de(d),de(D),de(x.$$.fragment,N),S=!1},d(N){N&&(ve(t),ve(n),ve(l),ve(a),ve(_)),Ne(e,N),r[14](null),~u&&C[u].d(N),D&&D.d(N),Ne(x,N)}}}function CD(r){let e,t,n,l;function u(a){r[15](a)}let d={style:`https://api.maptiler.com/maps/${r[7]}/style.json?key=${Dm}`,standardControls:!0,hash:!0,images:[{id:"walk_cycle_only",url:"/ltn//filters/walk_cycle_only_icon.gif"},{id:"no_entry",url:"/ltn//filters/no_entry_icon.gif"},{id:"bus_gate",url:"/ltn//filters/bus_gate_icon.gif"},{id:"school_street",url:"/ltn//filters/school_street_icon.gif"},{id:"oneway-arrow",url:ck}],$$slots:{default:[MD]},$$scope:{ctx:r}};return r[0]!==void 0&&(d.map=r[0]),t=new t3({props:d}),pn.push(()=>zo(t,"map",u)),t.$on("error",r[16]),{c(){e=fe("div"),je(t.$$.fragment),Ee(e,"slot","main"),fn(e,"position","relative"),fn(e,"width","100%"),fn(e,"height","100%")},m(a,_){be(a,e,_),Oe(t,e,null),l=!0},p(a,_){const x={};_&128&&(x.style=`https://api.maptiler.com/maps/${a[7]}/style.json?key=${Dm}`),_&2097465&&(x.$$scope={dirty:_,ctx:a}),!n&&_&1&&(n=!0,x.map=a[0],Po(()=>n=!1)),t.$set(x)},i(a){l||(oe(t.$$.fragment,a),l=!0)},o(a){de(t.$$.fragment,a),l=!1},d(a){a&&ve(e),Ne(t)}}}function ID(r){let e,t,n,l;return e=new lk({}),n=new h5({props:{$$slots:{main:[CD],left:[gD],top:[mD]},$$scope:{ctx:r}}}),{c(){je(e.$$.fragment),t=Ve(),je(n.$$.fragment)},m(u,d){Oe(e,u,d),be(u,t,d),Oe(n,u,d),l=!0},p(u,[d]){const a={};d&2098175&&(a.$$scope={dirty:d,ctx:u}),n.$set(a)},i(u){l||(oe(e.$$.fragment,u),oe(n.$$.fragment,u),l=!0)},o(u){de(e.$$.fragment,u),de(n.$$.fragment,u),l=!1},d(u){u&&ve(t),Ne(e,u),Ne(n,u)}}}function AD(r,e,t){let n,l,u,d,a,_,x,S,k;wt(r,Xm,Y=>t(11,n=Y)),wt(r,$m,Y=>t(12,l=Y)),wt(r,Hm,Y=>t(13,u=Y)),wt(r,ri,Y=>t(5,d=Y)),wt(r,ls,Y=>t(6,a=Y)),wt(r,dh,Y=>t(20,_=Y)),wt(r,Rm,Y=>t(7,x=Y)),wt(r,pr,Y=>t(8,S=Y)),wt(r,hd,Y=>t(9,k=Y));let C=!1;Ld(async()=>{await Ob(),await Vb(),t(4,C=!0);try{(await fetch("/osm/areas.json")).ok&&(Rt(dh,_=!0,_),console.log("Using local cache, not od2net.org"))}catch{}});let P;function D(){a.fitBounds(Array.from(d.getBounds()),{animate:!1})}let N,z,B;function O(Y){pn[Y?"unshift":"push"](()=>{B=Y,t(3,B),t(11,n)})}function G(Y){P=Y,t(0,P)}const U=Y=>{console.log(Y.detail.error)};function K(Y){pn[Y?"unshift":"push"](()=>{z=Y,t(2,z),t(12,l)})}const me=()=>Rt(hd,k=!0,k);function X(Y){pn[Y?"unshift":"push"](()=>{N=Y,t(1,N),t(13,u)})}return r.$$.update=()=>{r.$$.dirty&1&&P&&ls.set(P),r.$$.dirty&8194&&N&&u&&(t(1,N.innerHTML="",N),N.appendChild(u)),r.$$.dirty&4100&&z&&l&&(t(2,z.innerHTML="",z),z.appendChild(l)),r.$$.dirty&2056&&B&&n&&(t(3,B.innerHTML="",B),B.appendChild(n))},[P,N,z,B,C,d,a,x,S,k,D,n,l,u,O,G,U,K,me,X]}class LD extends Ht{constructor(e){super(),Zt(this,e,AD,ID,Ut,{})}}new LD({target:document.getElementById("app")}); diff --git a/index.html b/index.html index 5008341..23855c0 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ The low-traffic neighbourhood (LTN) tool, v2 - +