From d1f18f177c2dfcb0917a830fa39b280295ec505b Mon Sep 17 00:00:00 2001 From: dabreegster Date: Sun, 4 Feb 2024 11:21:25 +0000 Subject: [PATCH] deploy: 830c72517486add3ebb708473c7a85ad2c291651 --- assets/{main-b3c9e294.js => main-e27d7352.js} | 148 +++++++++--------- assets/settings-342fb430.svg | 1 + index.html | 2 +- 3 files changed, 76 insertions(+), 75 deletions(-) rename assets/{main-b3c9e294.js => main-e27d7352.js} (68%) create mode 100644 assets/settings-342fb430.svg diff --git a/assets/main-b3c9e294.js b/assets/main-e27d7352.js similarity index 68% rename from assets/main-b3c9e294.js rename to assets/main-e27d7352.js index 60188c7..21a8ad8 100644 --- a/assets/main-b3c9e294.js +++ b/assets/main-e27d7352.js @@ -1,7 +1,7 @@ -var wS=Object.defineProperty;var SS=(e,t,n)=>t in e?wS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Xn=(e,t,n)=>(SS(e,typeof t!="symbol"?t+"":t,n),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const u of r)if(u.type==="childList")for(const p of u.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&i(p)}).observe(document,{childList:!0,subtree:!0});function n(r){const u={};return r.integrity&&(u.integrity=r.integrity),r.referrerPolicy&&(u.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?u.credentials="include":r.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(r){if(r.ep)return;r.ep=!0;const u=n(r);fetch(r.href,u)}})();function Pe(){}function Ir(e,t){for(const n in t)e[n]=t[n];return e}function Nb(e){return e()}function Rv(){return Object.create(null)}function or(e){e.forEach(Nb)}function fg(e){return typeof e=="function"}function en(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let Lm;function Tr(e,t){return e===t?!0:(Lm||(Lm=document.createElement("a")),Lm.href=t,e===Lm.href)}function ES(e){return Object.keys(e).length===0}function Db(e,...t){if(e==null){for(const i of t)i(void 0);return Pe}const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function Rb(e){let t;return Db(e,n=>t=n)(),t}function Ee(e,t,n){e.$$.on_destroy.push(Db(t,n))}function mr(e,t,n,i){if(e){const r=Ob(e,t,n,i);return e[0](r)}}function Ob(e,t,n,i){return e[1]&&i?Ir(n.ctx.slice(),e[1](i(t))):n.ctx}function gr(e,t,n,i){if(e[2]&&i){const r=e[2](i(n));if(t.dirty===void 0)return r;if(typeof r=="object"){const u=[],p=Math.max(t.dirty.length,r.length);for(let a=0;a32){const t=[],n=e.ctx.length/32;for(let i=0;ie.removeEventListener(t,n,i)}function TS(e){return function(t){return t.preventDefault(),e.call(this,t)}}function kt(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function LS(e){return Array.from(e.childNodes)}function qi(e,t){t=""+t,e.data!==t&&(e.data=t)}function jl(e,t){e.value=t??""}function Qi(e,t,n,i){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,i?"important":"")}function Wm(e,t,n){for(let i=0;i{const r=e.$$.callbacks[t];if(r){const u=MS(t,n,{cancelable:i});return r.slice().forEach(p=>{p.call(e,u)}),!u.defaultPrevented}return!0}}function Fb(e,t){return ud().$$.context.set(e,t),t}function PS(e){return ud().$$.context.get(e)}function li(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(i=>i.call(this,t))}const Th=[],tr=[];let Ah=[];const Q_=[],Bb=Promise.resolve();let $_=!1;function Vb(){$_||($_=!0,Bb.then(Ub))}function AS(){return Vb(),Bb}function Gf(e){Ah.push(e)}function Du(e){Q_.push(e)}const U_=new Set;let Sh=0;function Ub(){if(Sh!==0)return;const e=Uf;do{try{for(;She.indexOf(i)===-1?t.push(i):n.push(i)),n.forEach(i=>i()),Ah=t}const Bm=new Set;let yc;function Di(){yc={r:0,c:[],p:yc}}function Ri(){yc.r||or(yc.c),yc=yc.p}function Et(e,t){e&&e.i&&(Bm.delete(e),e.i(t))}function Pt(e,t,n,i){if(e&&e.o){if(Bm.has(e))return;Bm.add(e),yc.c.push(()=>{Bm.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function aa(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function DS(e,t){Pt(e,1,1,()=>{t.delete(e.key)})}function RS(e,t,n,i,r,u,p,a,_,x,S,L){let A=e.length,N=u.length,z=A;const H={};for(;z--;)H[e[z].key]=z;const Z=[],K=new Map,V=new Map,X=[];for(z=N;z--;){const ut=L(r,u,z),gt=n(ut);let at=p.get(gt);at?i&&X.push(()=>at.p(ut,t)):(at=x(gt,ut),at.c()),K.set(gt,Z[z]=at),gt in H&&V.set(gt,Math.abs(z-H[gt]))}const Q=new Set,it=new Set;function ht(ut){Et(ut,1),ut.m(a,S),p.set(ut.key,ut),S=ut.first,N--}for(;A&&N;){const ut=Z[N-1],gt=e[A-1],at=ut.key,Lt=gt.key;ut===gt?(S=ut.first,A--,N--):K.has(Lt)?!p.has(at)||Q.has(at)?ht(ut):it.has(Lt)?A--:V.get(at)>V.get(Lt)?(it.add(at),ht(ut)):(Q.add(Lt),A--):(_(gt,p),A--)}for(;A--;){const ut=e[A];K.has(ut.key)||_(ut,p)}for(;N;)ht(Z[N-1]);return or(X),Z}function Gb(e,t){const n={},i={},r={$$scope:1};let u=e.length;for(;u--;){const p=e[u],a=t[u];if(a){for(const _ in p)_ in a||(i[_]=1);for(const _ in a)r[_]||(n[_]=a[_],r[_]=1);e[u]=a}else for(const _ in p)r[_]=1}for(const p in i)p in n||(n[p]=void 0);return n}function Ru(e,t,n){const i=e.$$.props[t];i!==void 0&&(e.$$.bound[i]=n,n(e.$$.ctx[i]))}function te(e){e&&e.c()}function Qt(e,t,n){const{fragment:i,after_update:r}=e.$$;i&&i.m(t,n),Gf(()=>{const u=e.$$.on_mount.map(Nb).filter(fg);e.$$.on_destroy?e.$$.on_destroy.push(...u):or(u),e.$$.on_mount=[]}),r.forEach(Gf)}function $t(e,t){const n=e.$$;n.fragment!==null&&(NS(n.after_update),or(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function OS(e,t){e.$$.dirty[0]===-1&&(Th.push(e),Vb(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const z=N.length?N[0]:A;return x.ctx&&r(x.ctx[L],x.ctx[L]=z)&&(!x.skip_bound&&x.bound[L]&&x.bound[L](z),S&&OS(e,L)),A}):[],x.update(),S=!0,or(x.before_update),x.fragment=i?i(x.ctx):!1,t.target){if(t.hydrate){const L=LS(t.target);x.fragment&&x.fragment.l(L),L.forEach(Dt)}else x.fragment&&x.fragment.c();t.intro&&Et(e.$$.fragment),Qt(e,t.target,t.anchor),Ub()}Rf(_)}class cn{constructor(){Xn(this,"$$");Xn(this,"$$set")}$destroy(){$t(this,1),this.$destroy=Pe}$on(t,n){if(!fg(n))return Pe;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!ES(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const zS="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(zS);const FS="/ltn/assets/logo-7ace0a42.png";let de;const Vl=new Array(128).fill(void 0);Vl.push(void 0,null,!0,!1);function dn(e){return Vl[e]}let Of=Vl.length;function BS(e){e<132||(Vl[e]=Of,Of=e)}function cs(e){const t=dn(e);return BS(e),t}let Ts=0,If=null;function kh(){return(If===null||If.byteLength===0)&&(If=new Uint8Array(de.memory.buffer)),If}const Vm=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},VS=typeof Vm.encodeInto=="function"?function(e,t){return Vm.encodeInto(e,t)}:function(e,t){const n=Vm.encode(e);return t.set(n),{read:e.length,written:n.length}};function Bl(e,t,n){if(n===void 0){const a=Vm.encode(e),_=t(a.length,1)>>>0;return kh().subarray(_,_+a.length).set(a),Ts=a.length,_}let i=e.length,r=t(i,1)>>>0;const u=kh();let p=0;for(;p127)break;u[r+p]=a}if(p!==i){p!==0&&(e=e.slice(p)),r=n(r,i,i=p+e.length*3,1)>>>0;const a=kh().subarray(r+p,r+i),_=VS(e,a);p+=_.written}return Ts=p,r}function Lh(e){return e==null}let Cf=null;function Qe(){return(Cf===null||Cf.byteLength===0)&&(Cf=new Int32Array(de.memory.buffer)),Cf}const jb=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&jb.decode();function ea(e,t){return e=e>>>0,jb.decode(kh().subarray(e,e+t))}function ai(e){Of===Vl.length&&Vl.push(Vl.length+1);const t=Of;return Of=Vl[t],Vl[t]=e,t}let Tf=null;function qb(){return(Tf===null||Tf.byteLength===0)&&(Tf=new Float64Array(de.memory.buffer)),Tf}let Lf=null;function US(){return(Lf===null||Lf.byteLength===0)&&(Lf=new BigInt64Array(de.memory.buffer)),Lf}function ty(e){const t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){const r=e.description;return r==null?"Symbol":`Symbol(${r})`}if(t=="function"){const r=e.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(e)){const r=e.length;let u="[";r>0&&(u+=ty(e[0]));for(let p=1;p1)i=n[1];else return toString.call(e);if(i=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message} -${e.stack}`:i}function GS(e,t){const n=t(e.length*1,1)>>>0;return kh().set(e,n/1),Ts=e.length,n}function jS(e,t){return e=e>>>0,qb().subarray(e/8,e/8+t)}function qS(e,t){return e=e>>>0,kh().subarray(e/1,e/1+t)}function gc(e,t){try{return e.apply(this,t)}catch(n){de.__wbindgen_exn_store(ai(n))}}class ZS{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){const t=this.__destroy_into_raw();de.__wbg_ltn_free(t)}constructor(t,n){try{const _=de.__wbindgen_add_to_stack_pointer(-16),x=GS(t,de.__wbindgen_malloc),S=Ts;var i=Lh(n)?0:Bl(n,de.__wbindgen_malloc,de.__wbindgen_realloc),r=Ts;de.ltn_new(_,x,S,i,r);var u=Qe()[_/4+0],p=Qe()[_/4+1],a=Qe()[_/4+2];if(a)throw cs(p);return this.__wbg_ptr=u>>>0,this}finally{de.__wbindgen_add_to_stack_pointer(16)}}getInvertedBoundary(){let t,n;try{const x=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_getInvertedBoundary(x,this.__wbg_ptr);var i=Qe()[x/4+0],r=Qe()[x/4+1],u=Qe()[x/4+2],p=Qe()[x/4+3],a=i,_=r;if(p)throw a=0,_=0,cs(u);return t=a,n=_,ea(a,_)}finally{de.__wbindgen_add_to_stack_pointer(16),de.__wbindgen_free(t,n,1)}}getBounds(){try{const r=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_getBounds(r,this.__wbg_ptr);var t=Qe()[r/4+0],n=Qe()[r/4+1],i=jS(t,n).slice();return de.__wbindgen_free(t,n*8,8),i}finally{de.__wbindgen_add_to_stack_pointer(16)}}toRouteSnapper(){try{const r=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_toRouteSnapper(r,this.__wbg_ptr);var t=Qe()[r/4+0],n=Qe()[r/4+1],i=qS(t,n).slice();return de.__wbindgen_free(t,n*1,1),i}finally{de.__wbindgen_add_to_stack_pointer(16)}}toRouteSnapperGj(){let t,n;try{const x=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_toRouteSnapperGj(x,this.__wbg_ptr);var i=Qe()[x/4+0],r=Qe()[x/4+1],u=Qe()[x/4+2],p=Qe()[x/4+3],a=i,_=r;if(p)throw a=0,_=0,cs(u);return t=a,n=_,ea(a,_)}finally{de.__wbindgen_add_to_stack_pointer(16),de.__wbindgen_free(t,n,1)}}renderModalFilters(){let t,n;try{const x=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_renderModalFilters(x,this.__wbg_ptr);var i=Qe()[x/4+0],r=Qe()[x/4+1],u=Qe()[x/4+2],p=Qe()[x/4+3],a=i,_=r;if(p)throw a=0,_=0,cs(u);return t=a,n=_,ea(a,_)}finally{de.__wbindgen_add_to_stack_pointer(16),de.__wbindgen_free(t,n,1)}}renderNeighbourhood(){let t,n;try{const x=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_renderNeighbourhood(x,this.__wbg_ptr);var i=Qe()[x/4+0],r=Qe()[x/4+1],u=Qe()[x/4+2],p=Qe()[x/4+3],a=i,_=r;if(p)throw a=0,_=0,cs(u);return t=a,n=_,ea(a,_)}finally{de.__wbindgen_add_to_stack_pointer(16),de.__wbindgen_free(t,n,1)}}setNeighbourhoodBoundary(t,n){try{const u=de.__wbindgen_add_to_stack_pointer(-16),p=Bl(t,de.__wbindgen_malloc,de.__wbindgen_realloc),a=Ts;de.ltn_setNeighbourhoodBoundary(u,this.__wbg_ptr,p,a,ai(n));var i=Qe()[u/4+0],r=Qe()[u/4+1];if(r)throw cs(i)}finally{de.__wbindgen_add_to_stack_pointer(16)}}deleteNeighbourhoodBoundary(t){const n=Bl(t,de.__wbindgen_malloc,de.__wbindgen_realloc),i=Ts;de.ltn_deleteNeighbourhoodBoundary(this.__wbg_ptr,n,i)}setCurrentNeighbourhood(t){try{const r=de.__wbindgen_add_to_stack_pointer(-16),u=Bl(t,de.__wbindgen_malloc,de.__wbindgen_realloc),p=Ts;de.ltn_setCurrentNeighbourhood(r,this.__wbg_ptr,u,p);var n=Qe()[r/4+0],i=Qe()[r/4+1];if(i)throw cs(n)}finally{de.__wbindgen_add_to_stack_pointer(16)}}addModalFilter(t,n){try{const u=de.__wbindgen_add_to_stack_pointer(-16),p=Bl(n,de.__wbindgen_malloc,de.__wbindgen_realloc),a=Ts;de.ltn_addModalFilter(u,this.__wbg_ptr,ai(t),p,a);var i=Qe()[u/4+0],r=Qe()[u/4+1];if(r)throw cs(i)}finally{de.__wbindgen_add_to_stack_pointer(16)}}addManyModalFilters(t,n){try{const u=de.__wbindgen_add_to_stack_pointer(-16),p=Bl(n,de.__wbindgen_malloc,de.__wbindgen_realloc),a=Ts;de.ltn_addManyModalFilters(u,this.__wbg_ptr,ai(t),p,a);var i=Qe()[u/4+0],r=Qe()[u/4+1];if(r)throw cs(i)}finally{de.__wbindgen_add_to_stack_pointer(16)}}deleteModalFilter(t){de.ltn_deleteModalFilter(this.__wbg_ptr,t)}undo(){de.ltn_undo(this.__wbg_ptr)}redo(){de.ltn_redo(this.__wbg_ptr)}getShortcutsCrossingRoad(t){let n,i;try{const S=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_getShortcutsCrossingRoad(S,this.__wbg_ptr,t);var r=Qe()[S/4+0],u=Qe()[S/4+1],p=Qe()[S/4+2],a=Qe()[S/4+3],_=r,x=u;if(a)throw _=0,x=0,cs(p);return n=_,i=x,ea(_,x)}finally{de.__wbindgen_add_to_stack_pointer(16),de.__wbindgen_free(n,i,1)}}toSavefile(){let t,n;try{const x=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_toSavefile(x,this.__wbg_ptr);var i=Qe()[x/4+0],r=Qe()[x/4+1],u=Qe()[x/4+2],p=Qe()[x/4+3],a=i,_=r;if(p)throw a=0,_=0,cs(u);return t=a,n=_,ea(a,_)}finally{de.__wbindgen_add_to_stack_pointer(16),de.__wbindgen_free(t,n,1)}}loadSavefile(t){try{const r=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_loadSavefile(r,this.__wbg_ptr,ai(t));var n=Qe()[r/4+0],i=Qe()[r/4+1];if(i)throw cs(n)}finally{de.__wbindgen_add_to_stack_pointer(16)}}compareRoute(t,n,i,r){let u,p;try{const N=de.__wbindgen_add_to_stack_pointer(-16);de.ltn_compareRoute(N,this.__wbg_ptr,t,n,i,r);var a=Qe()[N/4+0],_=Qe()[N/4+1],x=Qe()[N/4+2],S=Qe()[N/4+3],L=a,A=_;if(S)throw L=0,A=0,cs(x);return u=L,p=A,ea(L,A)}finally{de.__wbindgen_add_to_stack_pointer(16),de.__wbindgen_free(u,p,1)}}}async function WS(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){if(e.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",i);else throw i}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function XS(){const e={};return e.wbg={},e.wbg.__wbindgen_object_drop_ref=function(t){cs(t)},e.wbg.__wbindgen_string_get=function(t,n){const i=dn(n),r=typeof i=="string"?i:void 0;var u=Lh(r)?0:Bl(r,de.__wbindgen_malloc,de.__wbindgen_realloc),p=Ts;Qe()[t/4+1]=p,Qe()[t/4+0]=u},e.wbg.__wbindgen_error_new=function(t,n){const i=new Error(ea(t,n));return ai(i)},e.wbg.__wbindgen_boolean_get=function(t){const n=dn(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_is_bigint=function(t){return typeof dn(t)=="bigint"},e.wbg.__wbindgen_bigint_from_i64=function(t){return ai(t)},e.wbg.__wbindgen_jsval_eq=function(t,n){return dn(t)===dn(n)},e.wbg.__wbindgen_bigint_from_u64=function(t){const n=BigInt.asUintN(64,t);return ai(n)},e.wbg.__wbindgen_number_get=function(t,n){const i=dn(n),r=typeof i=="number"?i:void 0;qb()[t/8+1]=Lh(r)?0:r,Qe()[t/4+0]=!Lh(r)},e.wbg.__wbindgen_is_object=function(t){const n=dn(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_in=function(t,n){return dn(t)in dn(n)},e.wbg.__wbindgen_string_new=function(t,n){const i=ea(t,n);return ai(i)},e.wbg.__wbindgen_is_undefined=function(t){return dn(t)===void 0},e.wbg.__wbindgen_object_clone_ref=function(t){const n=dn(t);return ai(n)},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return dn(t)==dn(n)},e.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(t,n){const i=dn(t)[dn(n)];return ai(i)},e.wbg.__wbg_debug_34c9290896ec9856=function(t){console.debug(dn(t))},e.wbg.__wbg_error_e60eff06f24ab7a4=function(t){console.error(dn(t))},e.wbg.__wbg_info_d7d58472d0bab115=function(t){console.info(dn(t))},e.wbg.__wbg_log_a4530b4fe289336f=function(t){console.log(dn(t))},e.wbg.__wbg_warn_f260f49434e45e62=function(t){console.warn(dn(t))},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return ai(t)},e.wbg.__wbg_stack_658279fe44541cf6=function(t,n){const i=dn(n).stack,r=Bl(i,de.__wbindgen_malloc,de.__wbindgen_realloc),u=Ts;Qe()[t/4+1]=u,Qe()[t/4+0]=r},e.wbg.__wbg_error_f851667af71bcfc6=function(t,n){let i,r;try{i=t,r=n,console.error(ea(t,n))}finally{de.__wbindgen_free(i,r,1)}},e.wbg.__wbg_performance_3f3012faa4463882=function(t){const n=dn(t).performance;return ai(n)},e.wbg.__wbg_now_2fd65358804c9485=function(t){return dn(t).now()},e.wbg.__wbg_get_f01601b5a68d10e3=function(t,n){const i=dn(t)[n>>>0];return ai(i)},e.wbg.__wbg_length_1009b1af0c481d7b=function(t){return dn(t).length},e.wbg.__wbindgen_is_function=function(t){return typeof dn(t)=="function"},e.wbg.__wbg_newnoargs_c62ea9419c21fbac=function(t,n){const i=new Function(ea(t,n));return ai(i)},e.wbg.__wbg_next_9b877f231f476d01=function(t){const n=dn(t).next;return ai(n)},e.wbg.__wbg_next_6529ee0cca8d57ed=function(){return gc(function(t){const n=dn(t).next();return ai(n)},arguments)},e.wbg.__wbg_done_5fe336b092d60cf2=function(t){return dn(t).done},e.wbg.__wbg_value_0c248a78fdc8e19f=function(t){const n=dn(t).value;return ai(n)},e.wbg.__wbg_iterator_db7ca081358d4fb2=function(){return ai(Symbol.iterator)},e.wbg.__wbg_get_7b48513de5dc5ea4=function(){return gc(function(t,n){const i=Reflect.get(dn(t),dn(n));return ai(i)},arguments)},e.wbg.__wbg_call_90c26b09837aba1c=function(){return gc(function(t,n){const i=dn(t).call(dn(n));return ai(i)},arguments)},e.wbg.__wbg_self_f0e34d89f33b99fd=function(){return gc(function(){const t=self.self;return ai(t)},arguments)},e.wbg.__wbg_window_d3b084224f4774d7=function(){return gc(function(){const t=window.window;return ai(t)},arguments)},e.wbg.__wbg_globalThis_9caa27ff917c6860=function(){return gc(function(){const t=globalThis.globalThis;return ai(t)},arguments)},e.wbg.__wbg_global_35dfdd59a4da3e74=function(){return gc(function(){const t=global.global;return ai(t)},arguments)},e.wbg.__wbg_isArray_74fb723e24f76012=function(t){return Array.isArray(dn(t))},e.wbg.__wbg_instanceof_ArrayBuffer_e7d53d51371448e2=function(t){let n;try{n=dn(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_isSafeInteger_f93fde0dca9820f8=function(t){return Number.isSafeInteger(dn(t))},e.wbg.__wbg_entries_9e2e2aa45aa5094a=function(t){const n=Object.entries(dn(t));return ai(n)},e.wbg.__wbg_buffer_a448f833075b71ba=function(t){const n=dn(t).buffer;return ai(n)},e.wbg.__wbg_new_8f67e318f15d7254=function(t){const n=new Uint8Array(dn(t));return ai(n)},e.wbg.__wbg_set_2357bf09366ee480=function(t,n,i){dn(t).set(dn(n),i>>>0)},e.wbg.__wbg_length_1d25fa9e4ac21ce7=function(t){return dn(t).length},e.wbg.__wbg_instanceof_Uint8Array_bced6f43aed8c1aa=function(t){let n;try{n=dn(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbindgen_bigint_get_as_i64=function(t,n){const i=dn(n),r=typeof i=="bigint"?i:void 0;US()[t/8+1]=Lh(r)?BigInt(0):r,Qe()[t/4+0]=!Lh(r)},e.wbg.__wbindgen_debug_string=function(t,n){const i=ty(dn(n)),r=Bl(i,de.__wbindgen_malloc,de.__wbindgen_realloc),u=Ts;Qe()[t/4+1]=u,Qe()[t/4+0]=r},e.wbg.__wbindgen_throw=function(t,n){throw new Error(ea(t,n))},e.wbg.__wbindgen_memory=function(){const t=de.memory;return ai(t)},e}function HS(e,t){return de=e.exports,Zb.__wbindgen_wasm_module=t,Lf=null,Tf=null,Cf=null,If=null,de}async function Zb(e){if(de!==void 0)return de;typeof e>"u"&&(e="/ltn/assets/backend_bg.wasm");const t=XS();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:i}=await WS(await e,t);return HS(n,i)}let Xe;const Wb=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Wb.decode();let Mf=null;function zf(){return(Mf===null||Mf.byteLength===0)&&(Mf=new Uint8Array(Xe.memory.buffer)),Mf}function Ul(e,t){return e=e>>>0,Wb.decode(zf().subarray(e,e+t))}const Gl=new Array(128).fill(void 0);Gl.push(void 0,null,!0,!1);let Ff=Gl.length;function Fr(e){Ff===Gl.length&&Gl.push(Gl.length+1);const t=Ff;return Ff=Gl[t],Gl[t]=e,t}function Tn(e){return Gl[e]}function YS(e){e<132||(Gl[e]=Ff,Ff=e)}function Um(e){const t=Tn(e);return YS(e),t}function G_(e){return e==null}let Pf=null;function KS(){return(Pf===null||Pf.byteLength===0)&&(Pf=new Float64Array(Xe.memory.buffer)),Pf}let Af=null;function Ii(){return(Af===null||Af.byteLength===0)&&(Af=new Int32Array(Xe.memory.buffer)),Af}let Mu=0;const Gm=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},JS=typeof Gm.encodeInto=="function"?function(e,t){return Gm.encodeInto(e,t)}:function(e,t){const n=Gm.encode(e);return t.set(n),{read:e.length,written:n.length}};function Mm(e,t,n){if(n===void 0){const a=Gm.encode(e),_=t(a.length,1)>>>0;return zf().subarray(_,_+a.length).set(a),Mu=a.length,_}let i=e.length,r=t(i,1)>>>0;const u=zf();let p=0;for(;p127)break;u[r+p]=a}if(p!==i){p!==0&&(e=e.slice(p)),r=n(r,i,i=p+e.length*3,1)>>>0;const a=zf().subarray(r+p,r+i),_=JS(e,a);p+=_.written}return Mu=p,r}function ey(e){const t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){const r=e.description;return r==null?"Symbol":`Symbol(${r})`}if(t=="function"){const r=e.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(e)){const r=e.length;let u="[";r>0&&(u+=ey(e[0]));for(let p=1;p1)i=n[1];else return toString.call(e);if(i=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message} -${e.stack}`:i}function QS(e,t){const n=t(e.length*1,1)>>>0;return zf().set(e,n/1),Mu=e.length,n}function j_(e,t){try{return e.apply(this,t)}catch(n){Xe.__wbindgen_exn_store(Fr(n))}}class Xm{static __wrap(t){t=t>>>0;const n=Object.create(Xm.prototype);return n.__wbg_ptr=t,n}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){const t=this.__destroy_into_raw();Xe.__wbg_jsroutesnapper_free(t)}constructor(t){try{const u=Xe.__wbindgen_add_to_stack_pointer(-16),p=QS(t,Xe.__wbindgen_malloc),a=Mu;Xe.jsroutesnapper_new(u,p,a);var n=Ii()[u/4+0],i=Ii()[u/4+1],r=Ii()[u/4+2];if(r)throw Um(i);return Xm.__wrap(n)}finally{Xe.__wbindgen_add_to_stack_pointer(16)}}setRouteConfig(t){Xe.jsroutesnapper_setRouteConfig(this.__wbg_ptr,Fr(t))}setAreaMode(){Xe.jsroutesnapper_setAreaMode(this.__wbg_ptr)}getConfig(){let t,n;try{const u=Xe.__wbindgen_add_to_stack_pointer(-16);Xe.jsroutesnapper_getConfig(u,this.__wbg_ptr);var i=Ii()[u/4+0],r=Ii()[u/4+1];return t=i,n=r,Ul(i,r)}finally{Xe.__wbindgen_add_to_stack_pointer(16),Xe.__wbindgen_free(t,n,1)}}toFinalFeature(){try{const i=Xe.__wbindgen_add_to_stack_pointer(-16);Xe.jsroutesnapper_toFinalFeature(i,this.__wbg_ptr);var t=Ii()[i/4+0],n=Ii()[i/4+1];let r;return t!==0&&(r=Ul(t,n).slice(),Xe.__wbindgen_free(t,n*1)),r}finally{Xe.__wbindgen_add_to_stack_pointer(16)}}renderGeojson(){let t,n;try{const u=Xe.__wbindgen_add_to_stack_pointer(-16);Xe.jsroutesnapper_renderGeojson(u,this.__wbg_ptr);var i=Ii()[u/4+0],r=Ii()[u/4+1];return t=i,n=r,Ul(i,r)}finally{Xe.__wbindgen_add_to_stack_pointer(16),Xe.__wbindgen_free(t,n,1)}}toggleSnapMode(){Xe.jsroutesnapper_toggleSnapMode(this.__wbg_ptr)}onMouseMove(t,n,i){return Xe.jsroutesnapper_onMouseMove(this.__wbg_ptr,t,n,i)!==0}onClick(){Xe.jsroutesnapper_onClick(this.__wbg_ptr)}onDragStart(){return Xe.jsroutesnapper_onDragStart(this.__wbg_ptr)!==0}onMouseUp(){return Xe.jsroutesnapper_onMouseUp(this.__wbg_ptr)!==0}clearState(){Xe.jsroutesnapper_clearState(this.__wbg_ptr)}editExisting(t){try{const r=Xe.__wbindgen_add_to_stack_pointer(-16);Xe.jsroutesnapper_editExisting(r,this.__wbg_ptr,Fr(t));var n=Ii()[r/4+0],i=Ii()[r/4+1];if(i)throw Um(n)}finally{Xe.__wbindgen_add_to_stack_pointer(16)}}debugRenderGraph(){let t,n;try{const u=Xe.__wbindgen_add_to_stack_pointer(-16);Xe.jsroutesnapper_debugRenderGraph(u,this.__wbg_ptr);var i=Ii()[u/4+0],r=Ii()[u/4+1];return t=i,n=r,Ul(i,r)}finally{Xe.__wbindgen_add_to_stack_pointer(16),Xe.__wbindgen_free(t,n,1)}}routeNameForWaypoints(t){let n,i;try{const S=Xe.__wbindgen_add_to_stack_pointer(-16);Xe.jsroutesnapper_routeNameForWaypoints(S,this.__wbg_ptr,Fr(t));var r=Ii()[S/4+0],u=Ii()[S/4+1],p=Ii()[S/4+2],a=Ii()[S/4+3],_=r,x=u;if(a)throw _=0,x=0,Um(p);return n=_,i=x,Ul(_,x)}finally{Xe.__wbindgen_add_to_stack_pointer(16),Xe.__wbindgen_free(n,i,1)}}addSnappedWaypoint(t,n){Xe.jsroutesnapper_addSnappedWaypoint(this.__wbg_ptr,t,n)}undo(){Xe.jsroutesnapper_undo(this.__wbg_ptr)}}async function $S(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){if(e.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",i);else throw i}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function tE(){const e={};return e.wbg={},e.wbg.__wbindgen_string_new=function(t,n){const i=Ul(t,n);return Fr(i)},e.wbg.__wbindgen_object_drop_ref=function(t){Um(t)},e.wbg.__wbindgen_error_new=function(t,n){const i=new Error(Ul(t,n));return Fr(i)},e.wbg.__wbindgen_is_object=function(t){const n=Tn(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_is_undefined=function(t){return Tn(t)===void 0},e.wbg.__wbindgen_in=function(t,n){return Tn(t)in Tn(n)},e.wbg.__wbindgen_number_get=function(t,n){const i=Tn(n),r=typeof i=="number"?i:void 0;KS()[t/8+1]=G_(r)?0:r,Ii()[t/4+0]=!G_(r)},e.wbg.__wbindgen_boolean_get=function(t){const n=Tn(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_object_clone_ref=function(t){const n=Tn(t);return Fr(n)},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return Tn(t)==Tn(n)},e.wbg.__wbindgen_string_get=function(t,n){const i=Tn(n),r=typeof i=="string"?i:void 0;var u=G_(r)?0:Mm(r,Xe.__wbindgen_malloc,Xe.__wbindgen_realloc),p=Mu;Ii()[t/4+1]=p,Ii()[t/4+0]=u},e.wbg.__wbg_String_4370c5505c674d30=function(t,n){const i=String(Tn(n)),r=Mm(i,Xe.__wbindgen_malloc,Xe.__wbindgen_realloc),u=Mu;Ii()[t/4+1]=u,Ii()[t/4+0]=r},e.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea=function(t,n){const i=Tn(t)[Tn(n)];return Fr(i)},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return Fr(t)},e.wbg.__wbg_stack_658279fe44541cf6=function(t,n){const i=Tn(n).stack,r=Mm(i,Xe.__wbindgen_malloc,Xe.__wbindgen_realloc),u=Mu;Ii()[t/4+1]=u,Ii()[t/4+0]=r},e.wbg.__wbg_error_f851667af71bcfc6=function(t,n){let i,r;try{i=t,r=n,console.error(Ul(t,n))}finally{Xe.__wbindgen_free(i,r,1)}},e.wbg.__wbg_debug_9a6b3243fbbebb61=function(t){console.debug(Tn(t))},e.wbg.__wbg_error_788ae33f81d3b84b=function(t){console.error(Tn(t))},e.wbg.__wbg_info_2e30e8204b29d91d=function(t){console.info(Tn(t))},e.wbg.__wbg_log_1d3ae0273d8f4f8a=function(t){console.log(Tn(t))},e.wbg.__wbg_warn_d60e832f9882c1b2=function(t){console.warn(Tn(t))},e.wbg.__wbg_get_44be0491f933a435=function(t,n){const i=Tn(t)[n>>>0];return Fr(i)},e.wbg.__wbg_length_fff51ee6522a1a18=function(t){return Tn(t).length},e.wbg.__wbindgen_is_function=function(t){return typeof Tn(t)=="function"},e.wbg.__wbg_next_526fc47e980da008=function(t){const n=Tn(t).next;return Fr(n)},e.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return j_(function(t){const n=Tn(t).next();return Fr(n)},arguments)},e.wbg.__wbg_done_5c1f01fb660d73b5=function(t){return Tn(t).done},e.wbg.__wbg_value_1695675138684bd5=function(t){const n=Tn(t).value;return Fr(n)},e.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return Fr(Symbol.iterator)},e.wbg.__wbg_get_97b561fb56f034b5=function(){return j_(function(t,n){const i=Reflect.get(Tn(t),Tn(n));return Fr(i)},arguments)},e.wbg.__wbg_call_cb65541d95d71282=function(){return j_(function(t,n){const i=Tn(t).call(Tn(n));return Fr(i)},arguments)},e.wbg.__wbg_isArray_4c24b343cb13cfb1=function(t){return Array.isArray(Tn(t))},e.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(t){let n;try{n=Tn(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_buffer_085ec1f694018c4f=function(t){const n=Tn(t).buffer;return Fr(n)},e.wbg.__wbg_new_8125e318e6245eed=function(t){const n=new Uint8Array(Tn(t));return Fr(n)},e.wbg.__wbg_set_5cf90238115182c3=function(t,n,i){Tn(t).set(Tn(n),i>>>0)},e.wbg.__wbg_length_72e2208bbc0efc61=function(t){return Tn(t).length},e.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(t){let n;try{n=Tn(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbindgen_debug_string=function(t,n){const i=ey(Tn(n)),r=Mm(i,Xe.__wbindgen_malloc,Xe.__wbindgen_realloc),u=Mu;Ii()[t/4+1]=u,Ii()[t/4+0]=r},e.wbg.__wbindgen_throw=function(t,n){throw new Error(Ul(t,n))},e.wbg.__wbindgen_memory=function(){const t=Xe.memory;return Fr(t)},e}function eE(e,t){return Xe=e.exports,Xb.__wbindgen_wasm_module=t,Pf=null,Af=null,Mf=null,Xe}async function Xb(e){if(Xe!==void 0)return Xe;typeof e>"u"&&(e="/ltn/assets/route_snapper_bg.wasm");const t=tE();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:i}=await $S(await e,t);return eE(n,i)}const Eh=[];function q_(e,t){return{subscribe:fi(e,t).subscribe}}function fi(e,t=Pe){let n;const i=new Set;function r(a){if(en(e,a)&&(e=a,n)){const _=!Eh.length;for(const x of i)x[1](),Eh.push(x,e);if(_){for(let x=0;x{i.delete(x),i.size===0&&n&&(n(),n=null)}}return{set:r,update:u,subscribe:p}}let nE=Date.now();function ip(e){return`${e}-${nE++}`}const Iy=Symbol.for("svelte-maplibre");function rp(){return PS(Iy)}function iE(e){let t=new WeakMap;return n=>{var p;let i=t.get(n.originalEvent);if(i!==void 0)return i;let u=(p=n.target.queryRenderedFeatures(n.point).find(a=>{var _;return(_=e.get(a.layer.id))==null?void 0:_.interactive}))==null?void 0:p.layer.id;return t.set(n.originalEvent,u),u}}function rE(){let e=new Map;return Fb(Iy,{map:fi(null),source:q_(null),layer:q_(null),popupTarget:q_(null),cluster:fi(),loadedImages:fi(new Set),minzoom:fi(0),maxzoom:fi(24),layerEvent:fi(null),layerInfo:e,eventTopMost:iE(e)})}function Ov(e){return{subscribe:e.subscribe}}function Cy({key:e,setPopupTarget:t=!1,setCluster:n=!1,setMouseEvent:i=!1}){let r=rp(),u=fi(null),p=Ov(u),a={...r,[e]:Ov(u)};if(t&&(a.popupTarget=p),i){let _=fi(null);a.layerEvent=_,r.layerEvent=_}return n&&(a.cluster=fi()),Fb(Iy,a),{...r,self:u}}function oE(){return Cy({key:"source",setCluster:!0})}function sE(e=!0){return Cy({key:"layer",setPopupTarget:e,setMouseEvent:e})}function aE(){return Cy({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function lE(e){return"layerType"in e&&e.layerType==="deckgl"}var Hb=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Kb(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}),n}var Jb={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(Hb,function(){var n,i,r;function u(a,_){if(!n)n=_;else if(!i)i=_;else{var x="var sharedChunk = {}; ("+n+")(sharedChunk); ("+i+")(sharedChunk);",S={};n(S),r=_(S),typeof window<"u"&&(r.workerUrl=window.URL.createObjectURL(new Blob([x],{type:"text/javascript"})))}}u(["exports"],function(a){function _(l,o,c,f){return new(c||(c=Promise))(function(m,v){function w(P){try{T(f.next(P))}catch(D){v(D)}}function E(P){try{T(f.throw(P))}catch(D){v(D)}}function T(P){var D;P.done?m(P.value):(D=P.value,D instanceof c?D:new c(function(F){F(D)})).then(w,E)}T((f=f.apply(l,o||[])).next())})}function x(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}typeof SuppressedError=="function"&&SuppressedError;var S=L;function L(l,o){this.x=l,this.y=o}L.prototype={clone:function(){return new L(this.x,this.y)},add:function(l){return this.clone()._add(l)},sub:function(l){return this.clone()._sub(l)},multByPoint:function(l){return this.clone()._multByPoint(l)},divByPoint:function(l){return this.clone()._divByPoint(l)},mult:function(l){return this.clone()._mult(l)},div:function(l){return this.clone()._div(l)},rotate:function(l){return this.clone()._rotate(l)},rotateAround:function(l,o){return this.clone()._rotateAround(l,o)},matMult:function(l){return this.clone()._matMult(l)},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(l){return this.x===l.x&&this.y===l.y},dist:function(l){return Math.sqrt(this.distSqr(l))},distSqr:function(l){var o=l.x-this.x,c=l.y-this.y;return o*o+c*c},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(l){return Math.atan2(this.y-l.y,this.x-l.x)},angleWith:function(l){return this.angleWithSep(l.x,l.y)},angleWithSep:function(l,o){return Math.atan2(this.x*o-this.y*l,this.x*l+this.y*o)},_matMult:function(l){var o=l[2]*this.x+l[3]*this.y;return this.x=l[0]*this.x+l[1]*this.y,this.y=o,this},_add:function(l){return this.x+=l.x,this.y+=l.y,this},_sub:function(l){return this.x-=l.x,this.y-=l.y,this},_mult:function(l){return this.x*=l,this.y*=l,this},_div:function(l){return this.x/=l,this.y/=l,this},_multByPoint:function(l){return this.x*=l.x,this.y*=l.y,this},_divByPoint:function(l){return this.x/=l.x,this.y/=l.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var l=this.y;return this.y=this.x,this.x=-l,this},_rotate:function(l){var o=Math.cos(l),c=Math.sin(l),f=c*this.x+o*this.y;return this.x=o*this.x-c*this.y,this.y=f,this},_rotateAround:function(l,o){var c=Math.cos(l),f=Math.sin(l),m=o.y+f*(this.x-o.x)+c*(this.y-o.y);return this.x=o.x+c*(this.x-o.x)-f*(this.y-o.y),this.y=m,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},L.convert=function(l){return l instanceof L?l:Array.isArray(l)?new L(l[0],l[1]):l};var A=x(S),N=z;function z(l,o,c,f){this.cx=3*l,this.bx=3*(c-l)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(f-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=l,this.p1y=o,this.p2x=c,this.p2y=f}z.prototype={sampleCurveX:function(l){return((this.ax*l+this.bx)*l+this.cx)*l},sampleCurveY:function(l){return((this.ay*l+this.by)*l+this.cy)*l},sampleCurveDerivativeX:function(l){return(3*this.ax*l+2*this.bx)*l+this.cx},solveCurveX:function(l,o){if(o===void 0&&(o=1e-6),l<0)return 0;if(l>1)return 1;for(var c=l,f=0;f<8;f++){var m=this.sampleCurveX(c)-l;if(Math.abs(m)m?w=c:E=c,c=.5*(E-w)+w;return c},solve:function(l,o){return this.sampleCurveY(this.solveCurveX(l,o))}};var H=x(N);let Z,K;function V(){return Z==null&&(Z=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Z}function X(){if(K==null&&(K=!1,V())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let f=0;f<5*5;f++){const m=4*f;o.fillStyle=`rgb(${m},${m+1},${m+2})`,o.fillRect(f%5,Math.floor(f/5),1,1)}const c=o.getImageData(0,0,5,5).data;for(let f=0;f<5*5*4;f++)if(f%4!=3&&c[f]!==f){K=!0;break}}}return K||!1}function Q(l,o,c,f){const m=new H(l,o,c,f);return function(v){return m.solve(v)}}const it=Q(.25,.1,.25,1);function ht(l,o,c){return Math.min(c,Math.max(o,l))}function ut(l,o,c){const f=c-o,m=((l-o)%f+f)%f+o;return m===o?c:m}function gt(l,...o){for(const c of o)for(const f in c)l[f]=c[f];return l}let at=1;function Lt(l,o,c){const f={};for(const m in l)f[m]=o.call(c||this,l[m],m,l);return f}function bt(l,o,c){const f={};for(const m in l)o.call(c||this,l[m],m,l)&&(f[m]=l[m]);return f}function yt(l){return Array.isArray(l)?l.map(yt):typeof l=="object"&&l?Lt(l,yt):l}const he={};function Nt(l){he[l]||(typeof console<"u"&&console.warn(l),he[l]=!0)}function Gt(l,o,c){return(c.y-l.y)*(o.x-l.x)>(o.y-l.y)*(c.x-l.x)}function Yt(l){let o=0;for(let c,f,m=0,v=l.length,w=v-1;m"u")throw new Error("VideoFrame not supported");const v=new VideoFrame(l,{timestamp:0});try{const w=v==null?void 0:v.format;if(!w||!w.startsWith("BGR")&&!w.startsWith("RGB"))throw new Error(`Unrecognized format ${w}`);const E=w.startsWith("BGR"),T=new Uint8ClampedArray(f*m*4);if(yield v.copyTo(T,function(P,D,F,U,W){const Y=4*Math.max(-D,0),tt=(Math.max(0,F)-F)*U*4+Y,ct=4*U,ft=Math.max(0,D),Tt=Math.max(0,F);return{rect:{x:ft,y:Tt,width:Math.min(P.width,D+U)-ft,height:Math.min(P.height,F+W)-Tt},layout:[{offset:tt,stride:ct}]}}(l,o,c,f,m)),E)for(let P=0;PcancelAnimationFrame(o)}},getImageData(l,o=0){return this.getImageCanvasContext(l).getImageData(-o,-o,l.width+2*o,l.height+2*o)},getImageCanvasContext(l){const o=window.document.createElement("canvas"),c=o.getContext("2d",{willReadFrequently:!0});if(!c)throw new Error("failed to create canvas 2d context");return o.width=l.width,o.height=l.height,c.drawImage(l,0,0,l.width,l.height),c},resolveURL:l=>(mn||(mn=document.createElement("a")),mn.href=l,mn.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Qn==null&&(Qn=matchMedia("(prefers-reduced-motion: reduce)")),Qn.matches)}},ie={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class De extends Error{constructor(o,c,f,m){super(`AJAXError: ${c} (${o}): ${f}`),this.status=o,this.statusText=c,this.url=f,this.body=m}}const pn=we()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,Zn=l=>ie.REGISTERED_PROTOCOLS[l.substring(0,l.indexOf("://"))];function Ar(l,o){const c=new AbortController,f=new Request(l.url,{method:l.method||"GET",body:l.body,credentials:l.credentials,headers:l.headers,cache:l.cache,referrer:pn(),signal:c.signal});let m=!1,v=!1;return l.type==="json"&&f.headers.set("Accept","application/json"),v||fetch(f).then(w=>w.ok?(E=>{(l.type==="arrayBuffer"||l.type==="image"?E.arrayBuffer():l.type==="json"?E.json():E.text()).then(T=>{v||(m=!0,o(null,T,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(T=>{v||o(new Error(T.message))})})(w):w.blob().then(E=>o(new De(w.status,w.statusText,l.url,E)))).catch(w=>{w.code!==20&&o(new Error(w.message))}),{cancel:()=>{v=!0,m||c.abort()}}}const mi=function(l,o){if(/:\/\//.test(l.url)&&!/^https?:|^file:/.test(l.url)){if(we()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",l,o);if(!we())return(Zn(l.url)||Ar)(l,o)}if(!(/^file:/.test(c=l.url)||/^file:/.test(pn())&&!/^\w+:/.test(c))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Ar(l,o);if(we()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",l,o,void 0,!0)}var c;return function(f,m){const v=new XMLHttpRequest;v.open(f.method||"GET",f.url,!0),f.type!=="arrayBuffer"&&f.type!=="image"||(v.responseType="arraybuffer");for(const w in f.headers)v.setRequestHeader(w,f.headers[w]);return f.type==="json"&&(v.responseType="text",v.setRequestHeader("Accept","application/json")),v.withCredentials=f.credentials==="include",v.onerror=()=>{m(new Error(v.statusText))},v.onload=()=>{if((v.status>=200&&v.status<300||v.status===0)&&v.response!==null){let w=v.response;if(f.type==="json")try{w=JSON.parse(v.response)}catch(E){return m(E)}m(null,w,v.getResponseHeader("Cache-Control"),v.getResponseHeader("Expires"))}else{const w=new Blob([v.response],{type:v.getResponseHeader("Content-Type")});m(new De(v.status,v.statusText,f.url,w))}},v.send(f.body),{cancel:()=>v.abort()}}(l,o)},wt=function(l,o){return mi(gt(l,{type:"arrayBuffer"}),o)};function Ue(l){if(!l||l.indexOf("://")<=0||l.indexOf("data:image/")===0||l.indexOf("blob:")===0)return!0;const o=new URL(l),c=window.location;return o.protocol===c.protocol&&o.host===c.host}function ze(l,o,c){c[l]&&c[l].indexOf(o)!==-1||(c[l]=c[l]||[],c[l].push(o))}function Wn(l,o,c){if(c&&c[l]){const f=c[l].indexOf(o);f!==-1&&c[l].splice(f,1)}}class nn{constructor(o,c={}){gt(this,c),this.type=o}}class Ie extends nn{constructor(o,c={}){super("error",gt({error:o},c))}}class An{on(o,c){return this._listeners=this._listeners||{},ze(o,c,this._listeners),this}off(o,c){return Wn(o,c,this._listeners),Wn(o,c,this._oneTimeListeners),this}once(o,c){return c?(this._oneTimeListeners=this._oneTimeListeners||{},ze(o,c,this._oneTimeListeners),this):new Promise(f=>this.once(o,f))}fire(o,c){typeof o=="string"&&(o=new nn(o,c||{}));const f=o.type;if(this.listens(f)){o.target=this;const m=this._listeners&&this._listeners[f]?this._listeners[f].slice():[];for(const E of m)E.call(this,o);const v=this._oneTimeListeners&&this._oneTimeListeners[f]?this._oneTimeListeners[f].slice():[];for(const E of v)Wn(f,E,this._oneTimeListeners),E.call(this,o);const w=this._eventedParent;w&&(gt(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),w.fire(o))}else o instanceof Ie&&console.error(o.error);return this}listens(o){return this._listeners&&this._listeners[o]&&this._listeners[o].length>0||this._oneTimeListeners&&this._oneTimeListeners[o]&&this._oneTimeListeners[o].length>0||this._eventedParent&&this._eventedParent.listens(o)}setEventedParent(o,c){return this._eventedParent=o,this._eventedParentData=c,this}}var jt={$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"},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}},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 Fi=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function sr(l,o){const c={};for(const f in l)f!=="ref"&&(c[f]=l[f]);return Fi.forEach(f=>{f in o&&(c[f]=o[f])}),c}function zn(l,o){if(Array.isArray(l)){if(!Array.isArray(o)||l.length!==o.length)return!1;for(let c=0;c`:l.itemType.kind==="value"?"array":`array<${o}>`}return l.kind}const It=[xs,le,hn,Je,kr,st,es,j(on),B,G,J];function mt(l,o){if(o.kind==="error")return null;if(l.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!mt(l.itemType,o.itemType))&&(typeof l.N!="number"||l.N===o.N))return null}else{if(l.kind===o.kind)return null;if(l.kind==="value"){for(const c of It)if(!mt(c,o))return null}}return`Expected ${ot(l)} but found ${ot(o)} instead.`}function rt(l,o){return o.some(c=>c.kind===l.kind)}function xt(l,o){return o.some(c=>c==="null"?l===null:c==="array"?Array.isArray(l):c==="object"?l&&!Array.isArray(l)&&typeof l=="object":c===typeof l)}function qt(l,o){return l.kind==="array"&&o.kind==="array"?l.itemType.kind===o.itemType.kind&&typeof l.N=="number":l.kind===o.kind}const Zt=.96422,Xt=.82521,ke=4/29,Ke=6/29,Ce=3*Ke*Ke,Be=Ke*Ke*Ke,rn=Math.PI/180,Gn=180/Math.PI;function $n(l){return(l%=360)<0&&(l+=360),l}function Pn([l,o,c,f]){let m,v;const w=qr((.2225045*(l=Mn(l))+.7168786*(o=Mn(o))+.0606169*(c=Mn(c)))/1);l===o&&o===c?m=v=w:(m=qr((.4360747*l+.3850649*o+.1430804*c)/Zt),v=qr((.0139322*l+.0971045*o+.7141733*c)/Xt));const E=116*w-16;return[E<0?0:E,500*(m-w),200*(w-v),f]}function Mn(l){return l<=.04045?l/12.92:Math.pow((l+.055)/1.055,2.4)}function qr(l){return l>Be?Math.pow(l,1/3):l/Ce+ke}function oi([l,o,c,f]){let m=(l+16)/116,v=isNaN(o)?m:m+o/500,w=isNaN(c)?m:m-c/200;return m=1*Nr(m),v=Zt*Nr(v),w=Xt*Nr(w),[nr(3.1338561*v-1.6168667*m-.4906146*w),nr(-.9787684*v+1.9161415*m+.033454*w),nr(.0719453*v-.2289914*m+1.4052427*w),f]}function nr(l){return(l=l<=.00304?12.92*l:1.055*Math.pow(l,1/2.4)-.055)<0?0:l>1?1:l}function Nr(l){return l>Ke?l*l*l:Ce*(l-ke)}function ns(l){return parseInt(l.padEnd(2,l),16)/255}function xd(l,o){return ou(o?l/100:l,0,1)}function ou(l,o,c){return Math.min(Math.max(o,l),c)}function su(l){return!l.some(Number.isNaN)}const Dg={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 Yn{constructor(o,c,f,m=1,v=!0){this.r=o,this.g=c,this.b=f,this.a=m,v||(this.r*=m,this.g*=m,this.b*=m,m||this.overwriteGetter("rgb",[o,c,f,m]))}static parse(o){if(o instanceof Yn)return o;if(typeof o!="string")return;const c=function(f){if((f=f.toLowerCase().trim())==="transparent")return[0,0,0,0];const m=Dg[f];if(m){const[w,E,T]=m;return[w/255,E/255,T/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 E=1;return[ns(f.slice(E,E+=w)),ns(f.slice(E,E+=w)),ns(f.slice(E,E+=w)),ns(f.slice(E,E+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[E,T,P,D,F,U,W,Y,tt,ct,ft,Tt]=w,_t=[D||" ",W||" ",ct].join("");if(_t===" "||_t===" /"||_t===",,"||_t===",,,"){const Mt=[P,U,tt].join(""),Ft=Mt==="%%%"?100:Mt===""?255:0;if(Ft){const Ht=[ou(+T/Ft,0,1),ou(+F/Ft,0,1),ou(+Y/Ft,0,1),ft?xd(+ft,Tt):1];if(su(Ht))return Ht}}return}}const v=f.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(v){const[w,E,T,P,D,F,U,W,Y]=v,tt=[T||" ",D||" ",U].join("");if(tt===" "||tt===" /"||tt===",,"||tt===",,,"){const ct=[+E,ou(+P,0,100),ou(+F,0,100),W?xd(+W,Y):1];if(su(ct))return function([ft,Tt,_t,Mt]){function Ft(Ht){const ye=(Ht+ft/30)%12,Le=Tt*Math.min(_t,1-_t);return _t-Le*Math.max(-1,Math.min(ye-3,9-ye,1))}return ft=$n(ft),Tt/=100,_t/=100,[Ft(0),Ft(8),Ft(4),Mt]}(ct)}}}(o);return c?new Yn(...c,!1):void 0}get rgb(){const{r:o,g:c,b:f,a:m}=this,v=m||1/0;return this.overwriteGetter("rgb",[o/v,c/v,f/v,m])}get hcl(){return this.overwriteGetter("hcl",function(o){const[c,f,m,v]=Pn(o),w=Math.sqrt(f*f+m*m);return[Math.round(1e4*w)?$n(Math.atan2(m,f)*Gn):NaN,w,c,v]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Pn(this.rgb))}overwriteGetter(o,c){return Object.defineProperty(this,o,{value:c}),c}toString(){const[o,c,f,m]=this.rgb;return`rgba(${[o,c,f].map(v=>Math.round(255*v)).join(",")},${m})`}}Yn.black=new Yn(0,0,0,1),Yn.white=new Yn(1,1,1,1),Yn.transparent=new Yn(0,0,0,0),Yn.red=new Yn(1,0,0,1);class fp{constructor(o,c,f){this.sensitivity=o?c?"variant":"case":c?"accent":"base",this.locale=f,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(o,c){return this.collator.compare(o,c)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Fc{constructor(o,c,f,m,v){this.text=o,this.image=c,this.scale=f,this.fontStack=m,this.textColor=v}}class Zr{constructor(o){this.sections=o}static fromString(o){return new Zr([new Fc(o,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(o=>o.text.length!==0||o.image&&o.image.name.length!==0)}static factory(o){return o instanceof Zr?o:Zr.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class No{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof No)return o;if(typeof o=="number")return new No([o,o,o,o]);if(Array.isArray(o)&&!(o.length<1||o.length>4)){for(const c of o)if(typeof c!="number")return;switch(o.length){case 1:o=[o[0],o[0],o[0],o[0]];break;case 2:o=[o[0],o[1],o[0],o[1]];break;case 3:o=[o[0],o[1],o[2],o[1]]}return new No(o)}}toString(){return JSON.stringify(this.values)}}const Rg=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class is{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof is)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let c=0;c=0&&l<=255&&typeof o=="number"&&o>=0&&o<=255&&typeof c=="number"&&c>=0&&c<=255?f===void 0||typeof f=="number"&&f>=0&&f<=1?null:`Invalid rgba value [${[l,o,c,f].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof f=="number"?[l,o,c,f]:[l,o,c]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function au(l){if(l===null||typeof l=="string"||typeof l=="boolean"||typeof l=="number"||l instanceof Yn||l instanceof fp||l instanceof Zr||l instanceof No||l instanceof is||l instanceof Dr)return!0;if(Array.isArray(l)){for(const o of l)if(!au(o))return!1;return!0}if(typeof l=="object"){for(const o in l)if(!au(l[o]))return!1;return!0}return!1}function xi(l){if(l===null)return xs;if(typeof l=="string")return hn;if(typeof l=="boolean")return Je;if(typeof l=="number")return le;if(l instanceof Yn)return kr;if(l instanceof fp)return ws;if(l instanceof Zr)return st;if(l instanceof No)return B;if(l instanceof is)return J;if(l instanceof Dr)return G;if(Array.isArray(l)){const o=l.length;let c;for(const f of l){const m=xi(f);if(c){if(c===m)continue;c=on;break}c=m}return j(c||on,o)}return es}function Fn(l){const o=typeof l;return l===null?"":o==="string"||o==="number"||o==="boolean"?String(l):l instanceof Yn||l instanceof Zr||l instanceof No||l instanceof is||l instanceof Dr?l.toString():JSON.stringify(l)}class wl{constructor(o,c){this.type=o,this.value=c}static parse(o,c){if(o.length!==2)return c.error(`'literal' expression requires exactly one argument, but found ${o.length-1} instead.`);if(!au(o[1]))return c.error("invalid value");const f=o[1];let m=xi(f);const v=c.expectedType;return m.kind!=="array"||m.N!==0||!v||v.kind!=="array"||typeof v.N=="number"&&v.N!==0||(m=v),new wl(m,f)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Mi{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const Vc={string:hn,number:le,boolean:Je,object:es};class rs{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");let f,m=1;const v=o[0];if(v==="array"){let E,T;if(o.length>2){const P=o[1];if(typeof P!="string"||!(P in Vc)||P==="object")return c.error('The item type argument of "array" must be one of string, number, boolean',1);E=Vc[P],m++}else E=on;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return c.error('The length argument to "array" must be a positive integer literal',2);T=o[2],m++}f=j(E,T)}else{if(!Vc[v])throw new Error(`Types doesn't contain name = ${v}`);f=Vc[v]}const w=[];for(;mo.outputDefined())}}const dp={"to-boolean":Je,"to-color":kr,"to-number":le,"to-string":hn};class Ya{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");const f=o[0];if(!dp[f])throw new Error(`Can't parse ${f} as it is not part of the known types`);if((f==="to-boolean"||f==="to-string")&&o.length!==2)return c.error("Expected one argument.");const m=dp[f],v=[];for(let w=1;w4?`Invalid rbga value ${JSON.stringify(c)}: expected an array containing either three or four numeric values.`:Bc(c[0],c[1],c[2],c[3]),!f))return new Yn(c[0]/255,c[1]/255,c[2]/255,c[3])}throw new Mi(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(o);const m=No.parse(c);if(m)return m}throw new Mi(`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(o);const m=is.parse(c);if(m)return m}throw new Mi(`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(o),c===null)return 0;const m=Number(c);if(!isNaN(m))return m}throw new Mi(`Could not convert ${JSON.stringify(c)} to number.`)}case"formatted":return Zr.fromString(Fn(this.args[0].evaluate(o)));case"resolvedImage":return Dr.fromString(Fn(this.args[0].evaluate(o)));default:return Fn(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const wd=["Unknown","Point","LineString","Polygon"];class mp{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"?wd[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(o){let c=this._parseColorCache[o];return c||(c=this._parseColorCache[o]=Yn.parse(o)),c}}class Uc{constructor(o,c,f=[],m,v=new Sa,w=[]){this.registry=o,this.path=f,this.key=f.map(E=>`[${E}]`).join(""),this.scope=v,this.errors=w,this.expectedType=m,this._isConstant=c}parse(o,c,f,m,v={}){return c?this.concat(c,f,m)._parse(o,v):this._parse(o,v)}_parse(o,c){function f(m,v,w){return w==="assert"?new rs(v,[m]):w==="coerce"?new Ya(v,[m]):m}if(o!==null&&typeof o!="string"&&typeof o!="boolean"&&typeof o!="number"||(o=["literal",o]),Array.isArray(o)){if(o.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const m=o[0];if(typeof m!="string")return this.error(`Expression name must be a string, but found ${typeof m} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const v=this.registry[m];if(v){let w=v.parse(o,this);if(!w)return null;if(this.expectedType){const E=this.expectedType,T=w.type;if(E.kind!=="string"&&E.kind!=="number"&&E.kind!=="boolean"&&E.kind!=="object"&&E.kind!=="array"||T.kind!=="value")if(E.kind!=="color"&&E.kind!=="formatted"&&E.kind!=="resolvedImage"||T.kind!=="value"&&T.kind!=="string")if(E.kind!=="padding"||T.kind!=="value"&&T.kind!=="number"&&T.kind!=="array")if(E.kind!=="variableAnchorOffsetCollection"||T.kind!=="value"&&T.kind!=="array"){if(this.checkSubtype(E,T))return null}else w=f(w,E,c.typeAnnotation||"coerce");else w=f(w,E,c.typeAnnotation||"coerce");else w=f(w,E,c.typeAnnotation||"coerce");else w=f(w,E,c.typeAnnotation||"assert")}if(!(w instanceof wl)&&w.type.kind!=="resolvedImage"&&this._isConstant(w)){const E=new mp;try{w=new wl(w.type,w.evaluate(E))}catch(T){return this.error(T.message),null}}return w}return this.error(`Unknown expression "${m}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(o===void 0?"'undefined' value invalid. Use null instead.":typeof o=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof o} instead.`)}concat(o,c,f){const m=typeof o=="number"?this.path.concat(o):this.path,v=f?this.scope.concat(f):this.scope;return new Uc(this.registry,this._isConstant,m,c||null,v,this.errors)}error(o,...c){const f=`${this.key}${c.map(m=>`[${m}]`).join("")}`;this.errors.push(new ri(f,o))}checkSubtype(o,c){const f=mt(o,c);return f&&this.error(f),f}}class Gc{constructor(o,c,f){this.type=ws,this.locale=f,this.caseSensitive=o,this.diacriticSensitive=c}static parse(o,c){if(o.length!==2)return c.error("Expected one argument.");const f=o[1];if(typeof f!="object"||Array.isArray(f))return c.error("Collator options argument must be an object.");const m=c.parse(f["case-sensitive"]!==void 0&&f["case-sensitive"],1,Je);if(!m)return null;const v=c.parse(f["diacritic-sensitive"]!==void 0&&f["diacritic-sensitive"],1,Je);if(!v)return null;let w=null;return f.locale&&(w=c.parse(f.locale,1,hn),!w)?null:new Gc(m,v,w)}evaluate(o){return new fp(this.caseSensitive.evaluate(o),this.diacriticSensitive.evaluate(o),this.locale?this.locale.evaluate(o):null)}eachChild(o){o(this.caseSensitive),o(this.diacriticSensitive),this.locale&&o(this.locale)}outputDefined(){return!1}}const Ka=8192;function gp(l,o){l[0]=Math.min(l[0],o[0]),l[1]=Math.min(l[1],o[1]),l[2]=Math.max(l[2],o[0]),l[3]=Math.max(l[3],o[1])}function Yu(l,o){return!(l[0]<=o[0]||l[2]>=o[2]||l[1]<=o[1]||l[3]>=o[3])}function Sd(l,o){const c=(180+l[0])/360,f=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l[1]*Math.PI/360)))/360,m=Math.pow(2,o.z);return[Math.round(c*m*Ka),Math.round(f*m*Ka)]}function Og(l,o,c){const f=l[0]-o[0],m=l[1]-o[1],v=l[0]-c[0],w=l[1]-c[1];return f*w-v*m==0&&f*v<=0&&m*w<=0}function _p(l,o){let c=!1;for(let w=0,E=o.length;w(f=l)[1]!=(v=T[P+1])[1]>f[1]&&f[0]<(v[0]-m[0])*(f[1]-m[1])/(v[1]-m[1])+m[0]&&(c=!c)}}var f,m,v;return c}function yp(l,o){for(let c=0;c0&&E<0||w<0&&E>0}function zg(l,o,c){for(const P of c)for(let D=0;Dc[2]){const m=.5*f;let v=l[0]-c[0]>m?-f:c[0]-l[0]>m?f:0;v===0&&(v=l[0]-c[2]>m?-f:c[2]-l[0]>m?f:0),l[0]+=v}gp(o,l)}function vp(l,o,c,f){const m=Math.pow(2,f.z)*Ka,v=[f.x*Ka,f.y*Ka],w=[];for(const E of l)for(const T of E){const P=[T.x+v[0],T.y+v[1]];Ld(P,o,c,m),w.push(P)}return w}function bp(l,o,c,f){const m=Math.pow(2,f.z)*Ka,v=[f.x*Ka,f.y*Ka],w=[];for(const T of l){const P=[];for(const D of T){const F=[D.x+v[0],D.y+v[1]];gp(o,F),P.push(F)}w.push(P)}if(o[2]-o[0]<=m/2){(E=o)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(const T of w)for(const P of T)Ld(P,o,c,m)}var E;return w}class Sl{constructor(o,c){this.type=Je,this.geojson=o,this.geometries=c}static parse(o,c){if(o.length!==2)return c.error(`'within' expression requires exactly one argument, but found ${o.length-1} instead.`);if(au(o[1])){const f=o[1];if(f.type==="FeatureCollection")for(let m=0;m!Array.isArray(P)||P.length===o.length-1);let T=null;for(const[P,D]of E){T=new Uc(c.registry,Zc,c.path,null,c.scope);const F=[];let U=!1;for(let W=1;W{return U=F,Array.isArray(U)?`(${U.map(ot).join(", ")})`:`(${ot(U.type)}...)`;var U}).join(" | "),D=[];for(let F=1;F{c=o?c&&Zc(f):c&&f instanceof wl}),!!c&&Wc(l)&&Xc(l,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Wc(l){if(l instanceof os&&(l.name==="get"&&l.args.length===1||l.name==="feature-state"||l.name==="has"&&l.args.length===1||l.name==="properties"||l.name==="geometry-type"||l.name==="id"||/^filter-/.test(l.name))||l instanceof Sl)return!1;let o=!0;return l.eachChild(c=>{o&&!Wc(c)&&(o=!1)}),o}function Ku(l){if(l instanceof os&&l.name==="feature-state")return!1;let o=!0;return l.eachChild(c=>{o&&!Ku(c)&&(o=!1)}),o}function Xc(l,o){if(l instanceof os&&o.indexOf(l.name)>=0)return!1;let c=!0;return l.eachChild(f=>{c&&!Xc(f,o)&&(c=!1)}),c}function lu(l,o){const c=l.length-1;let f,m,v=0,w=c,E=0;for(;v<=w;)if(E=Math.floor((v+w)/2),f=l[E],m=l[E+1],f<=o){if(E===c||oo))throw new Mi("Input is not a number.");w=E-1}return 0}class Ja{constructor(o,c,f){this.type=o,this.input=c,this.labels=[],this.outputs=[];for(const[m,v]of f)this.labels.push(m),this.outputs.push(v)}static parse(o,c){if(o.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return c.error("Expected an even number of arguments.");const f=c.parse(o[1],1,le);if(!f)return null;const m=[];let v=null;c.expectedType&&c.expectedType.kind!=="value"&&(v=c.expectedType);for(let w=1;w=E)return c.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',P);const F=c.parse(T,D,v);if(!F)return null;v=v||F.type,m.push([E,F])}return new Ja(v,f,m)}evaluate(o){const c=this.labels,f=this.outputs;if(c.length===1)return f[0].evaluate(o);const m=this.input.evaluate(o);if(m<=c[0])return f[0].evaluate(o);const v=c.length;return m>=c[v-1]?f[v-1].evaluate(o):f[lu(c,m)].evaluate(o)}eachChild(o){o(this.input);for(const c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function In(l,o,c){return l+c*(o-l)}function Hc(l,o,c){return l.map((f,m)=>In(f,o[m],c))}const Do={number:In,color:function(l,o,c,f="rgb"){switch(f){case"rgb":{const[m,v,w,E]=Hc(l.rgb,o.rgb,c);return new Yn(m,v,w,E,!1)}case"hcl":{const[m,v,w,E]=l.hcl,[T,P,D,F]=o.hcl;let U,W;if(isNaN(m)||isNaN(T))isNaN(m)?isNaN(T)?U=NaN:(U=T,w!==1&&w!==0||(W=P)):(U=m,D!==1&&D!==0||(W=v));else{let Tt=T-m;T>m&&Tt>180?Tt-=360:T180&&(Tt+=360),U=m+c*Tt}const[Y,tt,ct,ft]=function([Tt,_t,Mt,Ft]){return Tt=isNaN(Tt)?0:Tt*rn,oi([Mt,Math.cos(Tt)*_t,Math.sin(Tt)*_t,Ft])}([U,W??In(v,P,c),In(w,D,c),In(E,F,c)]);return new Yn(Y,tt,ct,ft,!1)}case"lab":{const[m,v,w,E]=oi(Hc(l.lab,o.lab,c));return new Yn(m,v,w,E,!1)}}},array:Hc,padding:function(l,o,c){return new No(Hc(l.values,o.values,c))},variableAnchorOffsetCollection:function(l,o,c){const f=l.values,m=o.values;if(f.length!==m.length)throw new Mi(`Cannot interpolate values of different length. from: ${l.toString()}, to: ${o.toString()}`);const v=[];for(let w=0;wtypeof D!="number"||D<0||D>1))return c.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);m={name:"cubic-bezier",controlPoints:P}}}if(o.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return c.error("Expected an even number of arguments.");if(v=c.parse(v,2,le),!v)return null;const E=[];let T=null;f==="interpolate-hcl"||f==="interpolate-lab"?T=kr:c.expectedType&&c.expectedType.kind!=="value"&&(T=c.expectedType);for(let P=0;P=D)return c.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',U);const Y=c.parse(F,W,T);if(!Y)return null;T=T||Y.type,E.push([D,Y])}return qt(T,le)||qt(T,kr)||qt(T,B)||qt(T,J)||qt(T,j(le))?new Ro(T,f,m,v,E):c.error(`Type ${ot(T)} is not interpolatable.`)}evaluate(o){const c=this.labels,f=this.outputs;if(c.length===1)return f[0].evaluate(o);const m=this.input.evaluate(o);if(m<=c[0])return f[0].evaluate(o);const v=c.length;if(m>=c[v-1])return f[v-1].evaluate(o);const w=lu(c,m),E=Ro.interpolationFactor(this.interpolation,m,c[w],c[w+1]),T=f[w].evaluate(o),P=f[w+1].evaluate(o);switch(this.operator){case"interpolate":return Do[this.type.kind](T,P,E);case"interpolate-hcl":return Do.color(T,P,E,"hcl");case"interpolate-lab":return Do.color(T,P,E,"lab")}}eachChild(o){o(this.input);for(const c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function xp(l,o,c,f){const m=f-c,v=l-c;return m===0?0:o===1?v/m:(Math.pow(o,v)-1)/(Math.pow(o,m)-1)}class Yc{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expectected at least one argument.");let f=null;const m=c.expectedType;m&&m.kind!=="value"&&(f=m);const v=[];for(const E of o.slice(1)){const T=c.parse(E,1+v.length,f,void 0,{typeAnnotation:"omit"});if(!T)return null;f=f||T.type,v.push(T)}if(!f)throw new Error("No output type");const w=m&&v.some(E=>mt(m,E.type));return new Yc(w?on:f,v)}evaluate(o){let c,f=null,m=0;for(const v of this.args)if(m++,f=v.evaluate(o),f&&f instanceof Dr&&!f.available&&(c||(c=f.name),f=null,m===this.args.length&&(f=c)),f!==null)break;return f}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}class Kc{constructor(o,c){this.type=c.type,this.bindings=[].concat(o),this.result=c}evaluate(o){return this.result.evaluate(o)}eachChild(o){for(const c of this.bindings)o(c[1]);o(this.result)}static parse(o,c){if(o.length<4)return c.error(`Expected at least 3 arguments, but found ${o.length-1} instead.`);const f=[];for(let v=1;v=f.length)throw new Mi(`Array index out of bounds: ${c} > ${f.length-1}.`);if(c!==Math.floor(c))throw new Mi(`Array index must be an integer, but found ${c} instead.`);return f[c]}eachChild(o){o(this.index),o(this.input)}outputDefined(){return!1}}class Sp{constructor(o,c){this.type=Je,this.needle=o,this.haystack=c}static parse(o,c){if(o.length!==3)return c.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const f=c.parse(o[1],1,on),m=c.parse(o[2],2,on);return f&&m?rt(f.type,[Je,hn,le,xs,on])?new Sp(f,m):c.error(`Expected first argument to be of type boolean, string, number or null, but found ${ot(f.type)} instead`):null}evaluate(o){const c=this.needle.evaluate(o),f=this.haystack.evaluate(o);if(!f)return!1;if(!xt(c,["boolean","string","number","null"]))throw new Mi(`Expected first argument to be of type boolean, string, number or null, but found ${ot(xi(c))} instead.`);if(!xt(f,["string","array"]))throw new Mi(`Expected second argument to be of type array or string, but found ${ot(xi(f))} instead.`);return f.indexOf(c)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class Jc{constructor(o,c,f){this.type=le,this.needle=o,this.haystack=c,this.fromIndex=f}static parse(o,c){if(o.length<=2||o.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const f=c.parse(o[1],1,on),m=c.parse(o[2],2,on);if(!f||!m)return null;if(!rt(f.type,[Je,hn,le,xs,on]))return c.error(`Expected first argument to be of type boolean, string, number or null, but found ${ot(f.type)} instead`);if(o.length===4){const v=c.parse(o[3],3,le);return v?new Jc(f,m,v):null}return new Jc(f,m)}evaluate(o){const c=this.needle.evaluate(o),f=this.haystack.evaluate(o);if(!xt(c,["boolean","string","number","null"]))throw new Mi(`Expected first argument to be of type boolean, string, number or null, but found ${ot(xi(c))} instead.`);if(!xt(f,["string","array"]))throw new Mi(`Expected second argument to be of type array or string, but found ${ot(xi(f))} instead.`);if(this.fromIndex){const m=this.fromIndex.evaluate(o);return f.indexOf(c,m)}return f.indexOf(c)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class Ep{constructor(o,c,f,m,v,w){this.inputType=o,this.type=c,this.input=f,this.cases=m,this.outputs=v,this.otherwise=w}static parse(o,c){if(o.length<5)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return c.error("Expected an even number of arguments.");let f,m;c.expectedType&&c.expectedType.kind!=="value"&&(m=c.expectedType);const v={},w=[];for(let P=2;PNumber.MAX_SAFE_INTEGER)return U.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof Y=="number"&&Math.floor(Y)!==Y)return U.error("Numeric branch labels must be integer values.");if(f){if(U.checkSubtype(f,xi(Y)))return null}else f=xi(Y);if(v[String(Y)]!==void 0)return U.error("Branch labels must be unique.");v[String(Y)]=w.length}const W=c.parse(F,P,m);if(!W)return null;m=m||W.type,w.push(W)}const E=c.parse(o[1],1,on);if(!E)return null;const T=c.parse(o[o.length-1],o.length-1,m);return T?E.type.kind!=="value"&&c.concat(1).checkSubtype(f,E.type)?null:new Ep(f,m,E,v,w,T):null}evaluate(o){const c=this.input.evaluate(o);return(xi(c)===this.inputType&&this.outputs[this.cases[c]]||this.otherwise).evaluate(o)}eachChild(o){o(this.input),this.outputs.forEach(o),o(this.otherwise)}outputDefined(){return this.outputs.every(o=>o.outputDefined())&&this.otherwise.outputDefined()}}class Ip{constructor(o,c,f){this.type=o,this.branches=c,this.otherwise=f}static parse(o,c){if(o.length<4)return c.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return c.error("Expected an odd number of arguments.");let f;c.expectedType&&c.expectedType.kind!=="value"&&(f=c.expectedType);const m=[];for(let w=1;wc.outputDefined())&&this.otherwise.outputDefined()}}class Qc{constructor(o,c,f,m){this.type=o,this.input=c,this.beginIndex=f,this.endIndex=m}static parse(o,c){if(o.length<=2||o.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const f=c.parse(o[1],1,on),m=c.parse(o[2],2,le);if(!f||!m)return null;if(!rt(f.type,[j(on),hn,on]))return c.error(`Expected first argument to be of type array or string, but found ${ot(f.type)} instead`);if(o.length===4){const v=c.parse(o[3],3,le);return v?new Qc(f.type,f,m,v):null}return new Qc(f.type,f,m)}evaluate(o){const c=this.input.evaluate(o),f=this.beginIndex.evaluate(o);if(!xt(c,["string","array"]))throw new Mi(`Expected first argument to be of type array or string, but found ${ot(xi(c))} instead.`);if(this.endIndex){const m=this.endIndex.evaluate(o);return c.slice(f,m)}return c.slice(f)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function Md(l,o){return l==="=="||l==="!="?o.kind==="boolean"||o.kind==="string"||o.kind==="number"||o.kind==="null"||o.kind==="value":o.kind==="string"||o.kind==="number"||o.kind==="value"}function Pd(l,o,c,f){return f.compare(o,c)===0}function uu(l,o,c){const f=l!=="=="&&l!=="!=";return class Qb{constructor(v,w,E){this.type=Je,this.lhs=v,this.rhs=w,this.collator=E,this.hasUntypedArgument=v.type.kind==="value"||w.type.kind==="value"}static parse(v,w){if(v.length!==3&&v.length!==4)return w.error("Expected two or three arguments.");const E=v[0];let T=w.parse(v[1],1,on);if(!T)return null;if(!Md(E,T.type))return w.concat(1).error(`"${E}" comparisons are not supported for type '${ot(T.type)}'.`);let P=w.parse(v[2],2,on);if(!P)return null;if(!Md(E,P.type))return w.concat(2).error(`"${E}" comparisons are not supported for type '${ot(P.type)}'.`);if(T.type.kind!==P.type.kind&&T.type.kind!=="value"&&P.type.kind!=="value")return w.error(`Cannot compare types '${ot(T.type)}' and '${ot(P.type)}'.`);f&&(T.type.kind==="value"&&P.type.kind!=="value"?T=new rs(P.type,[T]):T.type.kind!=="value"&&P.type.kind==="value"&&(P=new rs(T.type,[P])));let D=null;if(v.length===4){if(T.type.kind!=="string"&&P.type.kind!=="string"&&T.type.kind!=="value"&&P.type.kind!=="value")return w.error("Cannot use collator to compare non-string types.");if(D=w.parse(v[3],3,ws),!D)return null}return new Qb(T,P,D)}evaluate(v){const w=this.lhs.evaluate(v),E=this.rhs.evaluate(v);if(f&&this.hasUntypedArgument){const T=xi(w),P=xi(E);if(T.kind!==P.kind||T.kind!=="string"&&T.kind!=="number")throw new Mi(`Expected arguments for "${l}" to be (string, string) or (number, number), but found (${T.kind}, ${P.kind}) instead.`)}if(this.collator&&!f&&this.hasUntypedArgument){const T=xi(w),P=xi(E);if(T.kind!=="string"||P.kind!=="string")return o(v,w,E)}return this.collator?c(v,w,E,this.collator.evaluate(v)):o(v,w,E)}eachChild(v){v(this.lhs),v(this.rhs),this.collator&&v(this.collator)}outputDefined(){return!0}}}const Fg=uu("==",function(l,o,c){return o===c},Pd),Bg=uu("!=",function(l,o,c){return o!==c},function(l,o,c,f){return!Pd(0,o,c,f)}),Vg=uu("<",function(l,o,c){return o",function(l,o,c){return o>c},function(l,o,c,f){return f.compare(o,c)>0}),Gg=uu("<=",function(l,o,c){return o<=c},function(l,o,c,f){return f.compare(o,c)<=0}),jg=uu(">=",function(l,o,c){return o>=c},function(l,o,c,f){return f.compare(o,c)>=0});class Cp{constructor(o,c,f,m,v){this.type=hn,this.number=o,this.locale=c,this.currency=f,this.minFractionDigits=m,this.maxFractionDigits=v}static parse(o,c){if(o.length!==3)return c.error("Expected two arguments.");const f=c.parse(o[1],1,le);if(!f)return null;const m=o[2];if(typeof m!="object"||Array.isArray(m))return c.error("NumberFormat options argument must be an object.");let v=null;if(m.locale&&(v=c.parse(m.locale,1,hn),!v))return null;let w=null;if(m.currency&&(w=c.parse(m.currency,1,hn),!w))return null;let E=null;if(m["min-fraction-digits"]&&(E=c.parse(m["min-fraction-digits"],1,le),!E))return null;let T=null;return m["max-fraction-digits"]&&(T=c.parse(m["max-fraction-digits"],1,le),!T)?null:new Cp(f,v,w,E,T)}evaluate(o){return new Intl.NumberFormat(this.locale?this.locale.evaluate(o):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(o):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(o):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(o):void 0}).format(this.number.evaluate(o))}eachChild(o){o(this.number),this.locale&&o(this.locale),this.currency&&o(this.currency),this.minFractionDigits&&o(this.minFractionDigits),this.maxFractionDigits&&o(this.maxFractionDigits)}outputDefined(){return!1}}class $c{constructor(o){this.type=st,this.sections=o}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");const f=o[1];if(!Array.isArray(f)&&typeof f=="object")return c.error("First argument must be an image or text section.");const m=[];let v=!1;for(let w=1;w<=o.length-1;++w){const E=o[w];if(v&&typeof E=="object"&&!Array.isArray(E)){v=!1;let T=null;if(E["font-scale"]&&(T=c.parse(E["font-scale"],1,le),!T))return null;let P=null;if(E["text-font"]&&(P=c.parse(E["text-font"],1,j(hn)),!P))return null;let D=null;if(E["text-color"]&&(D=c.parse(E["text-color"],1,kr),!D))return null;const F=m[m.length-1];F.scale=T,F.font=P,F.textColor=D}else{const T=c.parse(o[w],1,on);if(!T)return null;const P=T.type.kind;if(P!=="string"&&P!=="value"&&P!=="null"&&P!=="resolvedImage")return c.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");v=!0,m.push({content:T,scale:null,font:null,textColor:null})}}return new $c(m)}evaluate(o){return new Zr(this.sections.map(c=>{const f=c.content.evaluate(o);return xi(f)===G?new Fc("",f,null,null,null):new Fc(Fn(f),null,c.scale?c.scale.evaluate(o):null,c.font?c.font.evaluate(o).join(","):null,c.textColor?c.textColor.evaluate(o):null)}))}eachChild(o){for(const c of this.sections)o(c.content),c.scale&&o(c.scale),c.font&&o(c.font),c.textColor&&o(c.textColor)}outputDefined(){return!1}}class Tp{constructor(o){this.type=G,this.input=o}static parse(o,c){if(o.length!==2)return c.error("Expected two arguments.");const f=c.parse(o[1],1,hn);return f?new Tp(f):c.error("No image name provided.")}evaluate(o){const c=this.input.evaluate(o),f=Dr.fromString(c);return f&&o.availableImages&&(f.available=o.availableImages.indexOf(c)>-1),f}eachChild(o){o(this.input)}outputDefined(){return!1}}class Lp{constructor(o){this.type=le,this.input=o}static parse(o,c){if(o.length!==2)return c.error(`Expected 1 argument, but found ${o.length-1} instead.`);const f=c.parse(o[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 ${ot(f.type)} instead.`):new Lp(f):null}evaluate(o){const c=this.input.evaluate(o);if(typeof c=="string"||Array.isArray(c))return c.length;throw new Mi(`Expected value to be of type string or array, but found ${ot(xi(c))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const cu={"==":Fg,"!=":Bg,">":Ug,"<":Vg,">=":jg,"<=":Gg,array:rs,at:wp,boolean:rs,case:Ip,coalesce:Yc,collator:Gc,format:$c,image:Tp,in:Sp,"index-of":Jc,interpolate:Ro,"interpolate-hcl":Ro,"interpolate-lab":Ro,length:Lp,let:Kc,literal:wl,match:Ep,number:rs,"number-format":Cp,object:rs,slice:Qc,step:Ja,string:rs,"to-boolean":Ya,"to-color":Ya,"to-number":Ya,"to-string":Ya,var:qc,within:Sl};function Ad(l,[o,c,f,m]){o=o.evaluate(l),c=c.evaluate(l),f=f.evaluate(l);const v=m?m.evaluate(l):1,w=Bc(o,c,f,v);if(w)throw new Mi(w);return new Yn(o/255,c/255,f/255,v,!1)}function kd(l,o){return l in o}function Mp(l,o){const c=o[l];return c===void 0?null:c}function El(l){return{type:l}}function Nd(l){return{result:"success",value:l}}function Qa(l){return{result:"error",value:l}}function hu(l){return l["property-type"]==="data-driven"||l["property-type"]==="cross-faded-data-driven"}function Dd(l){return!!l.expression&&l.expression.parameters.indexOf("zoom")>-1}function Pp(l){return!!l.expression&&l.expression.interpolated}function Bn(l){return l instanceof Number?"number":l instanceof String?"string":l instanceof Boolean?"boolean":Array.isArray(l)?"array":l===null?"null":typeof l}function wi(l){return typeof l=="object"&&l!==null&&!Array.isArray(l)}function qg(l){return l}function Cn(l,o){const c=o.type==="color",f=l.stops&&typeof l.stops[0][0]=="object",m=f||!(f||l.property!==void 0),v=l.type||(Pp(o)?"exponential":"interval");if(c||o.type==="padding"){const D=c?Yn.parse:No.parse;(l=yo({},l)).stops&&(l.stops=l.stops.map(F=>[F[0],D(F[1])])),l.default=D(l.default?l.default:o.default)}if(l.colorSpace&&(w=l.colorSpace)!=="rgb"&&w!=="hcl"&&w!=="lab")throw new Error(`Unknown color space: "${l.colorSpace}"`);var w;let E,T,P;if(v==="exponential")E=Ju;else if(v==="interval")E=gi;else if(v==="categorical"){E=Si,T=Object.create(null);for(const D of l.stops)T[D[0]]=D[1];P=typeof l.stops[0][0]}else{if(v!=="identity")throw new Error(`Unknown function type "${v}"`);E=Rd}if(f){const D={},F=[];for(let Y=0;YY[0]),evaluate:({zoom:Y},tt)=>Ju({stops:U,base:l.base},o,Y).evaluate(Y,tt)}}if(m){const D=v==="exponential"?{name:"exponential",base:l.base!==void 0?l.base:1}:null;return{kind:"camera",interpolationType:D,interpolationFactor:Ro.interpolationFactor.bind(void 0,D),zoomStops:l.stops.map(F=>F[0]),evaluate:({zoom:F})=>E(l,o,F,T,P)}}return{kind:"source",evaluate(D,F){const U=F&&F.properties?F.properties[l.property]:void 0;return U===void 0?Il(l.default,o.default):E(l,o,U,T,P)}}}function Il(l,o,c){return l!==void 0?l:o!==void 0?o:c!==void 0?c:void 0}function Si(l,o,c,f,m){return Il(typeof c===m?f[c]:void 0,l.default,o.default)}function gi(l,o,c){if(Bn(c)!=="number")return Il(l.default,o.default);const f=l.stops.length;if(f===1||c<=l.stops[0][0])return l.stops[0][1];if(c>=l.stops[f-1][0])return l.stops[f-1][1];const m=lu(l.stops.map(v=>v[0]),c);return l.stops[m][1]}function Ju(l,o,c){const f=l.base!==void 0?l.base:1;if(Bn(c)!=="number")return Il(l.default,o.default);const m=l.stops.length;if(m===1||c<=l.stops[0][0])return l.stops[0][1];if(c>=l.stops[m-1][0])return l.stops[m-1][1];const v=lu(l.stops.map(D=>D[0]),c),w=function(D,F,U,W){const Y=W-U,tt=D-U;return Y===0?0:F===1?tt/Y:(Math.pow(F,tt)-1)/(Math.pow(F,Y)-1)}(c,f,l.stops[v][0],l.stops[v+1][0]),E=l.stops[v][1],T=l.stops[v+1][1],P=Do[o.type]||qg;return typeof E.evaluate=="function"?{evaluate(...D){const F=E.evaluate.apply(void 0,D),U=T.evaluate.apply(void 0,D);if(F!==void 0&&U!==void 0)return P(F,U,w,l.colorSpace)}}:P(E,T,w,l.colorSpace)}function Rd(l,o,c){switch(o.type){case"color":c=Yn.parse(c);break;case"formatted":c=Zr.fromString(c.toString());break;case"resolvedImage":c=Dr.fromString(c.toString());break;case"padding":c=No.parse(c);break;default:Bn(c)===o.type||o.type==="enum"&&o.values[c]||(c=void 0)}return Il(c,l.default,o.default)}os.register(cu,{error:[{kind:"error"},[hn],(l,[o])=>{throw new Mi(o.evaluate(l))}],typeof:[hn,[on],(l,[o])=>ot(xi(o.evaluate(l)))],"to-rgba":[j(le,4),[kr],(l,[o])=>{const[c,f,m,v]=o.evaluate(l).rgb;return[255*c,255*f,255*m,v]}],rgb:[kr,[le,le,le],Ad],rgba:[kr,[le,le,le,le],Ad],has:{type:Je,overloads:[[[hn],(l,[o])=>kd(o.evaluate(l),l.properties())],[[hn,es],(l,[o,c])=>kd(o.evaluate(l),c.evaluate(l))]]},get:{type:on,overloads:[[[hn],(l,[o])=>Mp(o.evaluate(l),l.properties())],[[hn,es],(l,[o,c])=>Mp(o.evaluate(l),c.evaluate(l))]]},"feature-state":[on,[hn],(l,[o])=>Mp(o.evaluate(l),l.featureState||{})],properties:[es,[],l=>l.properties()],"geometry-type":[hn,[],l=>l.geometryType()],id:[on,[],l=>l.id()],zoom:[le,[],l=>l.globals.zoom],"heatmap-density":[le,[],l=>l.globals.heatmapDensity||0],"line-progress":[le,[],l=>l.globals.lineProgress||0],accumulated:[on,[],l=>l.globals.accumulated===void 0?null:l.globals.accumulated],"+":[le,El(le),(l,o)=>{let c=0;for(const f of o)c+=f.evaluate(l);return c}],"*":[le,El(le),(l,o)=>{let c=1;for(const f of o)c*=f.evaluate(l);return c}],"-":{type:le,overloads:[[[le,le],(l,[o,c])=>o.evaluate(l)-c.evaluate(l)],[[le],(l,[o])=>-o.evaluate(l)]]},"/":[le,[le,le],(l,[o,c])=>o.evaluate(l)/c.evaluate(l)],"%":[le,[le,le],(l,[o,c])=>o.evaluate(l)%c.evaluate(l)],ln2:[le,[],()=>Math.LN2],pi:[le,[],()=>Math.PI],e:[le,[],()=>Math.E],"^":[le,[le,le],(l,[o,c])=>Math.pow(o.evaluate(l),c.evaluate(l))],sqrt:[le,[le],(l,[o])=>Math.sqrt(o.evaluate(l))],log10:[le,[le],(l,[o])=>Math.log(o.evaluate(l))/Math.LN10],ln:[le,[le],(l,[o])=>Math.log(o.evaluate(l))],log2:[le,[le],(l,[o])=>Math.log(o.evaluate(l))/Math.LN2],sin:[le,[le],(l,[o])=>Math.sin(o.evaluate(l))],cos:[le,[le],(l,[o])=>Math.cos(o.evaluate(l))],tan:[le,[le],(l,[o])=>Math.tan(o.evaluate(l))],asin:[le,[le],(l,[o])=>Math.asin(o.evaluate(l))],acos:[le,[le],(l,[o])=>Math.acos(o.evaluate(l))],atan:[le,[le],(l,[o])=>Math.atan(o.evaluate(l))],min:[le,El(le),(l,o)=>Math.min(...o.map(c=>c.evaluate(l)))],max:[le,El(le),(l,o)=>Math.max(...o.map(c=>c.evaluate(l)))],abs:[le,[le],(l,[o])=>Math.abs(o.evaluate(l))],round:[le,[le],(l,[o])=>{const c=o.evaluate(l);return c<0?-Math.round(-c):Math.round(c)}],floor:[le,[le],(l,[o])=>Math.floor(o.evaluate(l))],ceil:[le,[le],(l,[o])=>Math.ceil(o.evaluate(l))],"filter-==":[Je,[hn,on],(l,[o,c])=>l.properties()[o.value]===c.value],"filter-id-==":[Je,[on],(l,[o])=>l.id()===o.value],"filter-type-==":[Je,[hn],(l,[o])=>l.geometryType()===o.value],"filter-<":[Je,[hn,on],(l,[o,c])=>{const f=l.properties()[o.value],m=c.value;return typeof f==typeof m&&f{const c=l.id(),f=o.value;return typeof c==typeof f&&c":[Je,[hn,on],(l,[o,c])=>{const f=l.properties()[o.value],m=c.value;return typeof f==typeof m&&f>m}],"filter-id->":[Je,[on],(l,[o])=>{const c=l.id(),f=o.value;return typeof c==typeof f&&c>f}],"filter-<=":[Je,[hn,on],(l,[o,c])=>{const f=l.properties()[o.value],m=c.value;return typeof f==typeof m&&f<=m}],"filter-id-<=":[Je,[on],(l,[o])=>{const c=l.id(),f=o.value;return typeof c==typeof f&&c<=f}],"filter->=":[Je,[hn,on],(l,[o,c])=>{const f=l.properties()[o.value],m=c.value;return typeof f==typeof m&&f>=m}],"filter-id->=":[Je,[on],(l,[o])=>{const c=l.id(),f=o.value;return typeof c==typeof f&&c>=f}],"filter-has":[Je,[on],(l,[o])=>o.value in l.properties()],"filter-has-id":[Je,[],l=>l.id()!==null&&l.id()!==void 0],"filter-type-in":[Je,[j(hn)],(l,[o])=>o.value.indexOf(l.geometryType())>=0],"filter-id-in":[Je,[j(on)],(l,[o])=>o.value.indexOf(l.id())>=0],"filter-in-small":[Je,[hn,j(on)],(l,[o,c])=>c.value.indexOf(l.properties()[o.value])>=0],"filter-in-large":[Je,[hn,j(on)],(l,[o,c])=>function(f,m,v,w){for(;v<=w;){const E=v+w>>1;if(m[E]===f)return!0;m[E]>f?w=E-1:v=E+1}return!1}(l.properties()[o.value],c.value,0,c.value.length-1)],all:{type:Je,overloads:[[[Je,Je],(l,[o,c])=>o.evaluate(l)&&c.evaluate(l)],[El(Je),(l,o)=>{for(const c of o)if(!c.evaluate(l))return!1;return!0}]]},any:{type:Je,overloads:[[[Je,Je],(l,[o,c])=>o.evaluate(l)||c.evaluate(l)],[El(Je),(l,o)=>{for(const c of o)if(c.evaluate(l))return!0;return!1}]]},"!":[Je,[Je],(l,[o])=>!o.evaluate(l)],"is-supported-script":[Je,[hn],(l,[o])=>{const c=l.globals&&l.globals.isSupportedScript;return!c||c(o.evaluate(l))}],upcase:[hn,[hn],(l,[o])=>o.evaluate(l).toUpperCase()],downcase:[hn,[hn],(l,[o])=>o.evaluate(l).toLowerCase()],concat:[hn,El(on),(l,o)=>o.map(c=>Fn(c.evaluate(l))).join("")],"resolved-locale":[hn,[ws],(l,[o])=>o.evaluate(l).resolvedLocale()]});class Ap{constructor(o,c){var f;this.expression=o,this._warningHistory={},this._evaluator=new mp,this._defaultValue=c?(f=c).type==="color"&&wi(f.default)?new Yn(0,0,0,0):f.type==="color"?Yn.parse(f.default)||null:f.type==="padding"?No.parse(f.default)||null:f.type==="variableAnchorOffsetCollection"?is.parse(f.default)||null:f.default===void 0?null:f.default:null,this._enumValues=c&&c.type==="enum"?c.values:null}evaluateWithoutErrorHandling(o,c,f,m,v,w){return this._evaluator.globals=o,this._evaluator.feature=c,this._evaluator.featureState=f,this._evaluator.canonical=m,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=w,this.expression.evaluate(this._evaluator)}evaluate(o,c,f,m,v,w){this._evaluator.globals=o,this._evaluator.feature=c||null,this._evaluator.featureState=f||null,this._evaluator.canonical=m,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=w||null;try{const E=this.expression.evaluate(this._evaluator);if(E==null||typeof E=="number"&&E!=E)return this._defaultValue;if(this._enumValues&&!(E in this._enumValues))throw new Mi(`Expected value to be one of ${Object.keys(this._enumValues).map(T=>JSON.stringify(T)).join(", ")}, but found ${JSON.stringify(E)} instead.`);return E}catch(E){return this._warningHistory[E.message]||(this._warningHistory[E.message]=!0,typeof console<"u"&&console.warn(E.message)),this._defaultValue}}}function th(l){return Array.isArray(l)&&l.length>0&&typeof l[0]=="string"&&l[0]in cu}function eh(l,o){const c=new Uc(cu,Zc,[],o?function(m){const v={color:kr,string:hn,number:le,enum:hn,boolean:Je,formatted:st,padding:B,resolvedImage:G,variableAnchorOffsetCollection:J};return m.type==="array"?j(v[m.value]||on,m.length):v[m.type]}(o):void 0),f=c.parse(l,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return f?Nd(new Ap(f,o)):Qa(c.errors)}class kp{constructor(o,c){this.kind=o,this._styleExpression=c,this.isStateDependent=o!=="constant"&&!Ku(c.expression)}evaluateWithoutErrorHandling(o,c,f,m,v,w){return this._styleExpression.evaluateWithoutErrorHandling(o,c,f,m,v,w)}evaluate(o,c,f,m,v,w){return this._styleExpression.evaluate(o,c,f,m,v,w)}}class nh{constructor(o,c,f,m){this.kind=o,this.zoomStops=f,this._styleExpression=c,this.isStateDependent=o!=="camera"&&!Ku(c.expression),this.interpolationType=m}evaluateWithoutErrorHandling(o,c,f,m,v,w){return this._styleExpression.evaluateWithoutErrorHandling(o,c,f,m,v,w)}evaluate(o,c,f,m,v,w){return this._styleExpression.evaluate(o,c,f,m,v,w)}interpolationFactor(o,c,f){return this.interpolationType?Ro.interpolationFactor(this.interpolationType,o,c,f):0}}function Np(l,o){const c=eh(l,o);if(c.result==="error")return c;const f=c.value.expression,m=Wc(f);if(!m&&!hu(o))return Qa([new ri("","data expressions not supported")]);const v=Xc(f,["zoom"]);if(!v&&!Dd(o))return Qa([new ri("","zoom expressions not supported")]);const w=$u(f);return w||v?w instanceof ri?Qa([w]):w instanceof Ro&&!Pp(o)?Qa([new ri("",'"interpolate" expressions cannot be used with this property')]):Nd(w?new nh(m?"camera":"composite",c.value,w.labels,w instanceof Ro?w.interpolation:void 0):new kp(m?"constant":"source",c.value)):Qa([new ri("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Qu{constructor(o,c){this._parameters=o,this._specification=c,yo(this,Cn(this._parameters,this._specification))}static deserialize(o){return new Qu(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function $u(l){let o=null;if(l instanceof Kc)o=$u(l.result);else if(l instanceof Yc){for(const c of l.args)if(o=$u(c),o)break}else(l instanceof Ja||l instanceof Ro)&&l.input instanceof os&&l.input.name==="zoom"&&(o=l);return o instanceof ri||l.eachChild(c=>{const f=$u(c);f instanceof ri?o=f:!o&&f?o=new ri("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&f&&o!==f&&(o=new ri("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function tc(l){if(l===!0||l===!1)return!0;if(!Array.isArray(l)||l.length===0)return!1;switch(l[0]){case"has":return l.length>=2&&l[1]!=="$id"&&l[1]!=="$type";case"in":return l.length>=3&&(typeof l[1]!="string"||Array.isArray(l[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return l.length!==3||Array.isArray(l[1])||Array.isArray(l[2]);case"any":case"all":for(const o of l.slice(1))if(!tc(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const Zg={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Dp(l){if(l==null)return{filter:()=>!0,needGeometry:!1};tc(l)||(l=ih(l));const o=eh(l,Zg);if(o.result==="error")throw new Error(o.value.map(c=>`${c.key}: ${c.message}`).join(", "));return{filter:(c,f,m)=>o.value.evaluate(c,f,{},m),needGeometry:Od(l)}}function Wg(l,o){return lo?1:0}function Od(l){if(!Array.isArray(l))return!1;if(l[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?Rp(l[1],l[2],o):o==="any"?(c=l.slice(1),["any"].concat(c.map(ih))):o==="all"?["all"].concat(l.slice(1).map(ih)):o==="none"?["all"].concat(l.slice(1).map(ih).map(ec)):o==="in"?zd(l[1],l.slice(2)):o==="!in"?ec(zd(l[1],l.slice(2))):o==="has"?Fd(l[1]):o==="!has"?ec(Fd(l[1])):o!=="within"||l;var c}function Rp(l,o,c){switch(l){case"$type":return[`filter-type-${c}`,o];case"$id":return[`filter-id-${c}`,o];default:return[`filter-${c}`,l,o]}}function zd(l,o){if(o.length===0)return!1;switch(l){case"$type":return["filter-type-in",["literal",o]];case"$id":return["filter-id-in",["literal",o]];default:return o.length>200&&!o.some(c=>typeof c!=typeof o[0])?["filter-in-large",l,["literal",o.sort(Wg)]]:["filter-in-small",l,["literal",o]]}}function Fd(l){switch(l){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",l]}}function ec(l){return["!",l]}function rh(l){const o=typeof l;if(o==="number"||o==="boolean"||o==="string"||l==null)return JSON.stringify(l);if(Array.isArray(l)){let m="[";for(const v of l)m+=`${rh(v)},`;return`${m}]`}const c=Object.keys(l).sort();let f="{";for(let m=0;mf.maximum?[new se(o,c,`${c} is greater than the maximum value ${f.maximum}`)]:[]}function sh(l){const o=l.valueSpec,c=Pi(l.value.type);let f,m,v,w={};const E=c!=="categorical"&&l.value.property===void 0,T=!E,P=Bn(l.value.stops)==="array"&&Bn(l.value.stops[0])==="array"&&Bn(l.value.stops[0][0])==="object",D=vo({key:l.key,value:l.value,valueSpec:l.styleSpec.function,validateSpec:l.validateSpec,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(W){if(c==="identity")return[new se(W.key,W.value,'identity function may not have a "stops" property')];let Y=[];const tt=W.value;return Y=Y.concat(pu({key:W.key,value:tt,valueSpec:W.valueSpec,validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec,arrayElementValidator:F})),Bn(tt)==="array"&&tt.length===0&&Y.push(new se(W.key,tt,"array must have at least one stop")),Y},default:function(W){return W.validateSpec({key:W.key,value:W.value,valueSpec:o,validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec})}}});return c==="identity"&&E&&D.push(new se(l.key,l.value,'missing required property "property"')),c==="identity"||l.value.stops||D.push(new se(l.key,l.value,'missing required property "stops"')),c==="exponential"&&l.valueSpec.expression&&!Pp(l.valueSpec)&&D.push(new se(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(T&&!hu(l.valueSpec)?D.push(new se(l.key,l.value,"property functions not supported")):E&&!Dd(l.valueSpec)&&D.push(new se(l.key,l.value,"zoom functions not supported"))),c!=="categorical"&&!P||l.value.property!==void 0||D.push(new se(l.key,l.value,'"property" property is required')),D;function F(W){let Y=[];const tt=W.value,ct=W.key;if(Bn(tt)!=="array")return[new se(ct,tt,`array expected, ${Bn(tt)} found`)];if(tt.length!==2)return[new se(ct,tt,`array length 2 expected, length ${tt.length} found`)];if(P){if(Bn(tt[0])!=="object")return[new se(ct,tt,`object expected, ${Bn(tt[0])} found`)];if(tt[0].zoom===void 0)return[new se(ct,tt,"object stop key must have zoom")];if(tt[0].value===void 0)return[new se(ct,tt,"object stop key must have value")];if(v&&v>Pi(tt[0].zoom))return[new se(ct,tt[0].zoom,"stop zoom values must appear in ascending order")];Pi(tt[0].zoom)!==v&&(v=Pi(tt[0].zoom),m=void 0,w={}),Y=Y.concat(vo({key:`${ct}[0]`,value:tt[0],valueSpec:{zoom:{}},validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec,objectElementValidators:{zoom:nc,value:U}}))}else Y=Y.concat(U({key:`${ct}[0]`,value:tt[0],valueSpec:{},validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec},tt));return th(Cl(tt[1]))?Y.concat([new se(`${ct}[1]`,tt[1],"expressions are not allowed in function stops.")]):Y.concat(W.validateSpec({key:`${ct}[1]`,value:tt[1],valueSpec:o,validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec}))}function U(W,Y){const tt=Bn(W.value),ct=Pi(W.value),ft=W.value!==null?W.value:Y;if(f){if(tt!==f)return[new se(W.key,ft,`${tt} stop domain type must match previous stop domain type ${f}`)]}else f=tt;if(tt!=="number"&&tt!=="string"&&tt!=="boolean")return[new se(W.key,ft,"stop domain value must be a number, string, or boolean")];if(tt!=="number"&&c!=="categorical"){let Tt=`number expected, ${tt} found`;return hu(o)&&c===void 0&&(Tt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new se(W.key,ft,Tt)]}return c!=="categorical"||tt!=="number"||isFinite(ct)&&Math.floor(ct)===ct?c!=="categorical"&&tt==="number"&&m!==void 0&&ctnew se(`${l.key}${f.key}`,l.value,f.message));const c=o.value.expression||o.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!c.outputDefined())return[new se(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!Ku(c))return[new se(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter"&&!Ku(c))return[new se(l.key,l.value,'"feature-state" data expressions are not supported with filters.')];if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!Xc(c,["zoom","feature-state"]))return[new se(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!Wc(c))return[new se(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ic(l){const o=l.key,c=l.value,f=l.valueSpec,m=[];return Array.isArray(f.values)?f.values.indexOf(Pi(c))===-1&&m.push(new se(o,c,`expected one of [${f.values.join(", ")}], ${JSON.stringify(c)} found`)):Object.keys(f.values).indexOf(Pi(c))===-1&&m.push(new se(o,c,`expected one of [${Object.keys(f.values).join(", ")}], ${JSON.stringify(c)} found`)),m}function fu(l){return tc(Cl(l.value))?Tl(yo({},l,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Vd(l)}function Vd(l){const o=l.value,c=l.key;if(Bn(o)!=="array")return[new se(c,o,`array expected, ${Bn(o)} found`)];const f=l.styleSpec;let m,v=[];if(o.length<1)return[new se(c,o,"filter array must have at least 1 element")];switch(v=v.concat(ic({key:`${c}[0]`,value:o[0],valueSpec:f.filter_operator,style:l.style,styleSpec:l.styleSpec})),Pi(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&Pi(o[1])==="$type"&&v.push(new se(c,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&v.push(new se(c,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(m=Bn(o[1]),m!=="string"&&v.push(new se(`${c}[1]`,o[1],`string expected, ${m} found`)));for(let w=2;w{P in c&&o.push(new se(f,c[P],`"${P}" is prohibited for ref layers`))}),m.layers.forEach(P=>{Pi(P.id)===E&&(T=P)}),T?T.ref?o.push(new se(f,c.ref,"ref cannot reference another ref layer")):w=Pi(T.type):o.push(new se(f,c.ref,`ref layer "${E}" not found`))}else if(w!=="background")if(c.source){const T=m.sources&&m.sources[c.source],P=T&&Pi(T.type);T?P==="vector"&&w==="raster"?o.push(new se(f,c.source,`layer "${c.id}" requires a raster source`)):P!=="raster-dem"&&w==="hillshade"?o.push(new se(f,c.source,`layer "${c.id}" requires a raster-dem source`)):P==="raster"&&w!=="raster"?o.push(new se(f,c.source,`layer "${c.id}" requires a vector source`)):P!=="vector"||c["source-layer"]?P==="raster-dem"&&w!=="hillshade"?o.push(new se(f,c.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!c.paint||!c.paint["line-gradient"]||P==="geojson"&&T.lineMetrics||o.push(new se(f,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new se(f,c,`layer "${c.id}" must specify a "source-layer"`)):o.push(new se(f,c.source,`source "${c.source}" not found`))}else o.push(new se(f,c,'missing required property "source"'));return o=o.concat(vo({key:f,value:c,valueSpec:v.layer,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*":()=>[],type:()=>l.validateSpec({key:`${f}.type`,value:c.type,valueSpec:v.layer.type,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,object:c,objectKey:"type"}),filter:fu,layout:T=>vo({layer:c,key:T.key,value:T.value,style:T.style,styleSpec:T.styleSpec,validateSpec:T.validateSpec,objectElementValidators:{"*":P=>jd(yo({layerType:w},P))}}),paint:T=>vo({layer:c,key:T.key,value:T.value,style:T.style,styleSpec:T.styleSpec,validateSpec:T.validateSpec,objectElementValidators:{"*":P=>Gd(yo({layerType:w},P))}})}})),o}function qs(l){const o=l.value,c=l.key,f=Bn(o);return f!=="string"?[new se(c,o,`string expected, ${f} found`)]:[]}const rc={promoteId:function({key:l,value:o}){if(Bn(o)==="string")return qs({key:l,value:o});{const c=[];for(const f in o)c.push(...qs({key:`${l}.${f}`,value:o[f]}));return c}}};function Oo(l){const o=l.value,c=l.key,f=l.styleSpec,m=l.style,v=l.validateSpec;if(!o.type)return[new se(c,o,'"type" is required')];const w=Pi(o.type);let E;switch(w){case"vector":case"raster":return E=vo({key:c,value:o,valueSpec:f[`source_${w.replace("-","_")}`],style:l.style,styleSpec:f,objectElementValidators:rc,validateSpec:v}),E;case"raster-dem":return E=function(T){var P;const D=(P=T.sourceName)!==null&&P!==void 0?P:"",F=T.value,U=T.styleSpec,W=U.source_raster_dem,Y=T.style;let tt=[];const ct=Bn(F);if(F===void 0)return tt;if(ct!=="object")return tt.push(new se("source_raster_dem",F,`object expected, ${ct} found`)),tt;const ft=Pi(F.encoding)==="custom",Tt=["redFactor","greenFactor","blueFactor","baseShift"],_t=T.value.encoding?`"${T.value.encoding}"`:"Default";for(const Mt in F)!ft&&Tt.includes(Mt)?tt.push(new se(Mt,F[Mt],`In "${D}": "${Mt}" is only valid when "encoding" is set to "custom". ${_t} encoding found`)):W[Mt]?tt=tt.concat(T.validateSpec({key:Mt,value:F[Mt],valueSpec:W[Mt],validateSpec:T.validateSpec,style:Y,styleSpec:U})):tt.push(new se(Mt,F[Mt],`unknown property "${Mt}"`));return tt}({sourceName:c,value:o,style:l.style,styleSpec:f,validateSpec:v}),E;case"geojson":if(E=vo({key:c,value:o,valueSpec:f.source_geojson,style:m,styleSpec:f,validateSpec:v,objectElementValidators:rc}),o.cluster)for(const T in o.clusterProperties){const[P,D]=o.clusterProperties[T],F=typeof P=="string"?[P,["accumulated"],["get",T]]:P;E.push(...Tl({key:`${c}.${T}.map`,value:D,validateSpec:v,expressionContext:"cluster-map"})),E.push(...Tl({key:`${c}.${T}.reduce`,value:F,validateSpec:v,expressionContext:"cluster-reduce"}))}return E;case"video":return vo({key:c,value:o,valueSpec:f.source_video,style:m,validateSpec:v,styleSpec:f});case"image":return vo({key:c,value:o,valueSpec:f.source_image,style:m,validateSpec:v,styleSpec:f});case"canvas":return[new se(c,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ic({key:`${c}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:m,validateSpec:v,styleSpec:f})}}function oc(l){const o=l.value,c=l.styleSpec,f=c.light,m=l.style;let v=[];const w=Bn(o);if(o===void 0)return v;if(w!=="object")return v=v.concat([new se("light",o,`object expected, ${w} found`)]),v;for(const E in o){const T=E.match(/^(.*)-transition$/);v=v.concat(T&&f[T[1]]&&f[T[1]].transition?l.validateSpec({key:E,value:o[E],valueSpec:c.transition,validateSpec:l.validateSpec,style:m,styleSpec:c}):f[E]?l.validateSpec({key:E,value:o[E],valueSpec:f[E],validateSpec:l.validateSpec,style:m,styleSpec:c}):[new se(E,o[E],`unknown property "${E}"`)])}return v}function Zd(l){const o=l.value,c=l.styleSpec,f=c.terrain,m=l.style;let v=[];const w=Bn(o);if(o===void 0)return v;if(w!=="object")return v=v.concat([new se("terrain",o,`object expected, ${w} found`)]),v;for(const E in o)v=v.concat(f[E]?l.validateSpec({key:E,value:o[E],valueSpec:f[E],validateSpec:l.validateSpec,style:m,styleSpec:c}):[new se(E,o[E],`unknown property "${E}"`)]);return v}function Wd(l){let o=[];const c=l.value,f=l.key;if(Array.isArray(c)){const m=[],v=[];for(const w in c)c[w].id&&m.includes(c[w].id)&&o.push(new se(f,c,`all the sprites' ids must be unique, but ${c[w].id} is duplicated`)),m.push(c[w].id),c[w].url&&v.includes(c[w].url)&&o.push(new se(f,c,`all the sprites' URLs must be unique, but ${c[w].url} is duplicated`)),v.push(c[w].url),o=o.concat(vo({key:`${f}[${w}]`,value:c[w],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:l.validateSpec}));return o}return qs({key:f,value:c})}const Xd={"*":()=>[],array:pu,boolean:function(l){const o=l.value,c=l.key,f=Bn(o);return f!=="boolean"?[new se(c,o,`boolean expected, ${f} found`)]:[]},number:nc,color:function(l){const o=l.key,c=l.value,f=Bn(c);return f!=="string"?[new se(o,c,`color expected, ${f} found`)]:Yn.parse(String(c))?[]:[new se(o,c,`color expected, "${c}" found`)]},constants:Bd,enum:ic,filter:fu,function:sh,layer:qd,object:vo,source:Oo,light:oc,terrain:Zd,string:qs,formatted:function(l){return qs(l).length===0?[]:Tl(l)},resolvedImage:function(l){return qs(l).length===0?[]:Tl(l)},padding:function(l){const o=l.key,c=l.value;if(Bn(c)==="array"){if(c.length<1||c.length>4)return[new se(o,c,`padding requires 1 to 4 values; ${c.length} values found`)];const f={type:"number"};let m=[];for(let v=0;v[]}})),l.constants&&(c=c.concat(Bd({key:"constants",value:l.constants,style:l,styleSpec:o,validateSpec:Ea}))),ah(c)}function Ia(l){return function(o){return l({...o,validateSpec:Ea})}}function ah(l){return[].concat(l).sort((o,c)=>o.line-c.line)}function Ca(l){return function(...o){return ah(l.apply(this,o))}}ss.source=Ca(Ia(Oo)),ss.sprite=Ca(Ia(Wd)),ss.glyphs=Ca(Ia(Hd)),ss.light=Ca(Ia(oc)),ss.terrain=Ca(Ia(Zd)),ss.layer=Ca(Ia(qd)),ss.filter=Ca(Ia(fu)),ss.paintProperty=Ca(Ia(Gd)),ss.layoutProperty=Ca(Ia(jd));const Ta=ss,Xg=Ta.light,Op=Ta.paintProperty,Yd=Ta.layoutProperty;function lh(l,o){let c=!1;if(o&&o.length)for(const f of o)l.fire(new Ie(new Error(f.message))),c=!0;return c}class du{constructor(o,c,f){const m=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const w=new Int32Array(this.arrayBuffer);o=w[0],this.d=(c=w[1])+2*(f=w[2]);for(let T=0;T=F[Y+0]&&m>=F[Y+1])?(E[W]=!0,w.push(D[W])):E[W]=!1}}}}_forEachCell(o,c,f,m,v,w,E,T){const P=this._convertToCellCoord(o),D=this._convertToCellCoord(c),F=this._convertToCellCoord(f),U=this._convertToCellCoord(m);for(let W=P;W<=F;W++)for(let Y=D;Y<=U;Y++){const tt=this.d*Y+W;if((!T||T(this._convertFromCellCoord(W),this._convertFromCellCoord(Y),this._convertFromCellCoord(W+1),this._convertFromCellCoord(Y+1)))&&v.call(this,o,c,f,m,tt,w,E,T))return}}_convertFromCellCoord(o){return(o-this.padding)/this.scale}_convertToCellCoord(o){return Math.max(0,Math.min(this.d-1,Math.floor(o*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const o=this.cells,c=3+this.cells.length+1+1;let f=0;for(let w=0;w=0)continue;const w=l[v];m[v]=La[f].shallow.indexOf(v)>=0?w:$a(w,o)}l instanceof Error&&(m.message=l.message)}if(m.$name)throw new Error("$name property is reserved for worker serialization logic.");return f!=="Object"&&(m.$name=f),m}throw new Error("can't serialize object of type "+typeof l)}function mu(l){if(l==null||typeof l=="boolean"||typeof l=="number"||typeof l=="string"||l instanceof Boolean||l instanceof Number||l instanceof String||l instanceof Date||l instanceof RegExp||l instanceof Blob||uh(l)||Ye(l)||ArrayBuffer.isView(l)||l instanceof ImageData)return l;if(Array.isArray(l))return l.map(mu);if(typeof l=="object"){const o=l.$name||"Object";if(!La[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:c}=La[o];if(!c)throw new Error(`can't deserialize unregistered class ${o}`);if(c.deserialize)return c.deserialize(l);const f=Object.create(c.prototype);for(const m of Object.keys(l)){if(m==="$name")continue;const v=l[m];f[m]=La[o].shallow.indexOf(m)>=0?v:mu(v)}return f}throw new Error("can't deserialize object of type "+typeof l)}class Kd{constructor(){this.first=!0}update(o,c){const f=Math.floor(o);return this.first?(this.first=!1,this.lastIntegerZoom=f,this.lastIntegerZoomTime=0,this.lastZoom=o,this.lastFloorZoom=f,!0):(this.lastFloorZoom>f?(this.lastIntegerZoom=f+1,this.lastIntegerZoomTime=c):this.lastFloorZooml>=128&&l<=255,Arabic:l=>l>=1536&&l<=1791,"Arabic Supplement":l=>l>=1872&&l<=1919,"Arabic Extended-A":l=>l>=2208&&l<=2303,"Hangul Jamo":l=>l>=4352&&l<=4607,"Unified Canadian Aboriginal Syllabics":l=>l>=5120&&l<=5759,Khmer:l=>l>=6016&&l<=6143,"Unified Canadian Aboriginal Syllabics Extended":l=>l>=6320&&l<=6399,"General Punctuation":l=>l>=8192&&l<=8303,"Letterlike Symbols":l=>l>=8448&&l<=8527,"Number Forms":l=>l>=8528&&l<=8591,"Miscellaneous Technical":l=>l>=8960&&l<=9215,"Control Pictures":l=>l>=9216&&l<=9279,"Optical Character Recognition":l=>l>=9280&&l<=9311,"Enclosed Alphanumerics":l=>l>=9312&&l<=9471,"Geometric Shapes":l=>l>=9632&&l<=9727,"Miscellaneous Symbols":l=>l>=9728&&l<=9983,"Miscellaneous Symbols and Arrows":l=>l>=11008&&l<=11263,"CJK Radicals Supplement":l=>l>=11904&&l<=12031,"Kangxi Radicals":l=>l>=12032&&l<=12255,"Ideographic Description Characters":l=>l>=12272&&l<=12287,"CJK Symbols and Punctuation":l=>l>=12288&&l<=12351,Hiragana:l=>l>=12352&&l<=12447,Katakana:l=>l>=12448&&l<=12543,Bopomofo:l=>l>=12544&&l<=12591,"Hangul Compatibility Jamo":l=>l>=12592&&l<=12687,Kanbun:l=>l>=12688&&l<=12703,"Bopomofo Extended":l=>l>=12704&&l<=12735,"CJK Strokes":l=>l>=12736&&l<=12783,"Katakana Phonetic Extensions":l=>l>=12784&&l<=12799,"Enclosed CJK Letters and Months":l=>l>=12800&&l<=13055,"CJK Compatibility":l=>l>=13056&&l<=13311,"CJK Unified Ideographs Extension A":l=>l>=13312&&l<=19903,"Yijing Hexagram Symbols":l=>l>=19904&&l<=19967,"CJK Unified Ideographs":l=>l>=19968&&l<=40959,"Yi Syllables":l=>l>=40960&&l<=42127,"Yi Radicals":l=>l>=42128&&l<=42191,"Hangul Jamo Extended-A":l=>l>=43360&&l<=43391,"Hangul Syllables":l=>l>=44032&&l<=55215,"Hangul Jamo Extended-B":l=>l>=55216&&l<=55295,"Private Use Area":l=>l>=57344&&l<=63743,"CJK Compatibility Ideographs":l=>l>=63744&&l<=64255,"Arabic Presentation Forms-A":l=>l>=64336&&l<=65023,"Vertical Forms":l=>l>=65040&&l<=65055,"CJK Compatibility Forms":l=>l>=65072&&l<=65103,"Small Form Variants":l=>l>=65104&&l<=65135,"Arabic Presentation Forms-B":l=>l>=65136&&l<=65279,"Halfwidth and Fullwidth Forms":l=>l>=65280&&l<=65519};function zp(l){for(const o of l)if(Bp(o.charCodeAt(0)))return!0;return!1}function Fp(l){for(const o of l)if(!Hg(o.charCodeAt(0)))return!1;return!0}function Hg(l){return!(_e.Arabic(l)||_e["Arabic Supplement"](l)||_e["Arabic Extended-A"](l)||_e["Arabic Presentation Forms-A"](l)||_e["Arabic Presentation Forms-B"](l))}function Bp(l){return!(l!==746&&l!==747&&(l<4352||!(_e["Bopomofo Extended"](l)||_e.Bopomofo(l)||_e["CJK Compatibility Forms"](l)&&!(l>=65097&&l<=65103)||_e["CJK Compatibility Ideographs"](l)||_e["CJK Compatibility"](l)||_e["CJK Radicals Supplement"](l)||_e["CJK Strokes"](l)||!(!_e["CJK Symbols and Punctuation"](l)||l>=12296&&l<=12305||l>=12308&&l<=12319||l===12336)||_e["CJK Unified Ideographs Extension A"](l)||_e["CJK Unified Ideographs"](l)||_e["Enclosed CJK Letters and Months"](l)||_e["Hangul Compatibility Jamo"](l)||_e["Hangul Jamo Extended-A"](l)||_e["Hangul Jamo Extended-B"](l)||_e["Hangul Jamo"](l)||_e["Hangul Syllables"](l)||_e.Hiragana(l)||_e["Ideographic Description Characters"](l)||_e.Kanbun(l)||_e["Kangxi Radicals"](l)||_e["Katakana Phonetic Extensions"](l)||_e.Katakana(l)&&l!==12540||!(!_e["Halfwidth and Fullwidth Forms"](l)||l===65288||l===65289||l===65293||l>=65306&&l<=65310||l===65339||l===65341||l===65343||l>=65371&&l<=65503||l===65507||l>=65512&&l<=65519)||!(!_e["Small Form Variants"](l)||l>=65112&&l<=65118||l>=65123&&l<=65126)||_e["Unified Canadian Aboriginal Syllabics"](l)||_e["Unified Canadian Aboriginal Syllabics Extended"](l)||_e["Vertical Forms"](l)||_e["Yijing Hexagram Symbols"](l)||_e["Yi Syllables"](l)||_e["Yi Radicals"](l))))}function Jd(l){return!(Bp(l)||function(o){return!!(_e["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||_e["General Punctuation"](o)&&(o===8214||o===8224||o===8225||o===8240||o===8241||o===8251||o===8252||o===8258||o===8263||o===8264||o===8265||o===8273)||_e["Letterlike Symbols"](o)||_e["Number Forms"](o)||_e["Miscellaneous Technical"](o)&&(o>=8960&&o<=8967||o>=8972&&o<=8991||o>=8996&&o<=9e3||o===9003||o>=9085&&o<=9114||o>=9150&&o<=9165||o===9167||o>=9169&&o<=9179||o>=9186&&o<=9215)||_e["Control Pictures"](o)&&o!==9251||_e["Optical Character Recognition"](o)||_e["Enclosed Alphanumerics"](o)||_e["Geometric Shapes"](o)||_e["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||_e["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||_e["CJK Symbols and Punctuation"](o)||_e.Katakana(o)||_e["Private Use Area"](o)||_e["CJK Compatibility Forms"](o)||_e["Small Form Variants"](o)||_e["Halfwidth and Fullwidth Forms"](o)||o===8734||o===8756||o===8757||o>=9984&&o<=10087||o>=10102&&o<=10131||o===65532||o===65533)}(l))}function Qd(l){return l>=1424&&l<=2303||_e["Arabic Presentation Forms-A"](l)||_e["Arabic Presentation Forms-B"](l)}function $d(l,o){return!(!o&&Qd(l)||l>=2304&&l<=3583||l>=3840&&l<=4255||_e.Khmer(l))}function Yg(l){for(const o of l)if(Qd(o.charCodeAt(0)))return!0;return!1}const Vp="deferred",Up="loading",Gp="loaded";let jp=null,bo="unavailable",tl=null;const sc=function(l){l&&typeof l=="string"&&l.indexOf("NetworkError")>-1&&(bo="error"),jp&&jp(l)};function qp(){ac.fire(new nn("pluginStateChange",{pluginStatus:bo,pluginURL:tl}))}const ac=new An,Zp=function(){return bo},tm=function(){if(bo!==Vp||!tl)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");bo=Up,qp(),tl&&wt({url:tl},l=>{l?sc(l):(bo=Gp,qp())})},zo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>bo===Gp||zo.applyArabicShaping!=null,isLoading:()=>bo===Up,setState(l){if(!we())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");bo=l.pluginStatus,tl=l.pluginURL},isParsed(){if(!we())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return zo.applyArabicShaping!=null&&zo.processBidirectionalText!=null&&zo.processStyledBidirectionalText!=null},getPluginURL(){if(!we())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return tl}};class ci{constructor(o,c){this.zoom=o,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 Kd,this.transition={})}isSupportedScript(o){return function(c,f){for(const m of c)if(!$d(m.charCodeAt(0),f))return!1;return!0}(o,zo.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const o=this.zoom,c=o-Math.floor(o),f=this.crossFadingFactor();return o>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:c+(1-c)*f}:{fromScale:.5,toScale:1,t:1-(1-f)*c}}}class ch{constructor(o,c){this.property=o,this.value=c,this.expression=function(f,m){if(wi(f))return new Qu(f,m);if(th(f)){const v=Np(f,m);if(v.result==="error")throw new Error(v.value.map(w=>`${w.key}: ${w.message}`).join(", "));return v.value}{let v=f;return m.type==="color"&&typeof f=="string"?v=Yn.parse(f):m.type!=="padding"||typeof f!="number"&&!Array.isArray(f)?m.type==="variableAnchorOffsetCollection"&&Array.isArray(f)&&(v=is.parse(f)):v=No.parse(f),{kind:"constant",evaluate:()=>v}}}(c===void 0?o.specification.default:c,o.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(o,c,f){return this.property.possiblyEvaluate(this,o,c,f)}}class Wp{constructor(o){this.property=o,this.value=new ch(o,void 0)}transitioned(o,c){return new nm(this.property,this.value,c,gt({},o.transition,this.transition),o.now)}untransitioned(){return new nm(this.property,this.value,null,{},0)}}class em{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return yt(this._values[o].value.value)}setValue(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Wp(this._values[o].property)),this._values[o].value=new ch(this._values[o].property,c===null?void 0:yt(c))}getTransition(o){return yt(this._values[o].transition)}setTransition(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Wp(this._values[o].property)),this._values[o].transition=yt(c)||void 0}serialize(){const o={};for(const c of Object.keys(this._values)){const f=this.getValue(c);f!==void 0&&(o[c]=f);const m=this.getTransition(c);m!==void 0&&(o[`${c}-transition`]=m)}return o}transitioned(o,c){const f=new im(this._properties);for(const m of Object.keys(this._values))f._values[m]=this._values[m].transitioned(o,c._values[m]);return f}untransitioned(){const o=new im(this._properties);for(const c of Object.keys(this._values))o._values[c]=this._values[c].untransitioned();return o}}class nm{constructor(o,c,f,m,v){this.property=o,this.value=c,this.begin=v+m.delay||0,this.end=this.begin+m.duration||0,o.specification.transition&&(m.delay||m.duration)&&(this.prior=f)}possiblyEvaluate(o,c,f){const m=o.now||0,v=this.value.possiblyEvaluate(o,c,f),w=this.prior;if(w){if(m>this.end)return this.prior=null,v;if(this.value.isDataDriven())return this.prior=null,v;if(m=1)return 1;const P=T*T,D=P*T;return 4*(T<.5?D:3*(T-P)+D-.75)}(E))}}return v}}class im{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,c,f){const m=new hh(this._properties);for(const v of Object.keys(this._values))m._values[v]=this._values[v].possiblyEvaluate(o,c,f);return m}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class Kg{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return yt(this._values[o].value)}setValue(o,c){this._values[o]=new ch(this._values[o].property,c===null?void 0:yt(c))}serialize(){const o={};for(const c of Object.keys(this._values)){const f=this.getValue(c);f!==void 0&&(o[c]=f)}return o}possiblyEvaluate(o,c,f){const m=new hh(this._properties);for(const v of Object.keys(this._values))m._values[v]=this._values[v].possiblyEvaluate(o,c,f);return m}}class so{constructor(o,c,f){this.property=o,this.value=c,this.parameters=f}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,c,f,m){return this.property.evaluate(this.value,this.parameters,o,c,f,m)}}class hh{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class Ne{constructor(o){this.specification=o}possiblyEvaluate(o,c){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(c)}interpolate(o,c,f){const m=Do[this.specification.type];return m?m(o,c,f):o}}class je{constructor(o,c){this.specification=o,this.overrides=c}possiblyEvaluate(o,c,f,m){return new so(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(c,null,{},f,m)}:o.expression,c)}interpolate(o,c,f){if(o.value.kind!=="constant"||c.value.kind!=="constant")return o;if(o.value.value===void 0||c.value.value===void 0)return new so(this,{kind:"constant",value:void 0},o.parameters);const m=Do[this.specification.type];if(m){const v=m(o.value.value,c.value.value,f);return new so(this,{kind:"constant",value:v},o.parameters)}return o}evaluate(o,c,f,m,v,w){return o.kind==="constant"?o.value:o.evaluate(c,f,m,v,w)}}class lc extends je{possiblyEvaluate(o,c,f,m){if(o.value===void 0)return new so(this,{kind:"constant",value:void 0},c);if(o.expression.kind==="constant"){const v=o.expression.evaluate(c,null,{},f,m),w=o.property.specification.type==="resolvedImage"&&typeof v!="string"?v.name:v,E=this._calculate(w,w,w,c);return new so(this,{kind:"constant",value:E},c)}if(o.expression.kind==="camera"){const v=this._calculate(o.expression.evaluate({zoom:c.zoom-1}),o.expression.evaluate({zoom:c.zoom}),o.expression.evaluate({zoom:c.zoom+1}),c);return new so(this,{kind:"constant",value:v},c)}return new so(this,o.expression,c)}evaluate(o,c,f,m,v,w){if(o.kind==="source"){const E=o.evaluate(c,f,m,v,w);return this._calculate(E,E,E,c)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(c.zoom)-1},f,m),o.evaluate({zoom:Math.floor(c.zoom)},f,m),o.evaluate({zoom:Math.floor(c.zoom)+1},f,m),c):o.value}_calculate(o,c,f,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:f,to:c}}interpolate(o){return o}}class Xp{constructor(o){this.specification=o}possiblyEvaluate(o,c,f,m){if(o.value!==void 0){if(o.expression.kind==="constant"){const v=o.expression.evaluate(c,null,{},f,m);return this._calculate(v,v,v,c)}return this._calculate(o.expression.evaluate(new ci(Math.floor(c.zoom-1),c)),o.expression.evaluate(new ci(Math.floor(c.zoom),c)),o.expression.evaluate(new ci(Math.floor(c.zoom+1),c)),c)}}_calculate(o,c,f,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:f,to:c}}interpolate(o){return o}}class Hp{constructor(o){this.specification=o}possiblyEvaluate(o,c,f,m){return!!o.expression.evaluate(c,null,{},f,m)}interpolate(){return!1}}class Wi{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const c in o){const f=o[c];f.specification.overridable&&this.overridableProperties.push(c);const m=this.defaultPropertyValues[c]=new ch(f,void 0),v=this.defaultTransitionablePropertyValues[c]=new Wp(f);this.defaultTransitioningPropertyValues[c]=v.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=m.possiblyEvaluate({})}}}xe("DataDrivenProperty",je),xe("DataConstantProperty",Ne),xe("CrossFadedDataDrivenProperty",lc),xe("CrossFadedProperty",Xp),xe("ColorRampProperty",Hp);const Yp="-transition";class as extends An{constructor(o,c){if(super(),this.id=o.id,this.type=o.type,this._featureFilter={filter:()=>!0,needGeometry:!1},o.type!=="custom"&&(this.metadata=o.metadata,this.minzoom=o.minzoom,this.maxzoom=o.maxzoom,o.type!=="background"&&(this.source=o.source,this.sourceLayer=o["source-layer"],this.filter=o.filter),c.layout&&(this._unevaluatedLayout=new Kg(c.layout)),c.paint)){this._transitionablePaint=new em(c.paint);for(const f in o.paint)this.setPaintProperty(f,o.paint[f],{validate:!1});for(const f in o.layout)this.setLayoutProperty(f,o.layout[f],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new hh(c.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)}setLayoutProperty(o,c,f={}){c!=null&&this._validate(Yd,`layers.${this.id}.layout.${o}`,o,c,f)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,c):this.visibility=c)}getPaintProperty(o){return o.endsWith(Yp)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,c,f={}){if(c!=null&&this._validate(Op,`layers.${this.id}.paint.${o}`,o,c,f))return!1;if(o.endsWith(Yp))return this._transitionablePaint.setTransition(o.slice(0,-11),c||void 0),!1;{const m=this._transitionablePaint._values[o],v=m.property.specification["property-type"]==="cross-faded-data-driven",w=m.value.isDataDriven(),E=m.value;this._transitionablePaint.setValue(o,c),this._handleSpecialPaintPropertyUpdate(o);const T=this._transitionablePaint._values[o].value;return T.isDataDriven()||w||v||this._handleOverridablePaintPropertyUpdate(o,E,T)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,c,f){return!1}isHidden(o){return!!(this.minzoom&&o=this.maxzoom)||this.visibility==="none"}updateTransitions(o){this._transitioningPaint=this._transitionablePaint.transitioned(o,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(o,c){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,c)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,c)}serialize(){const o={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&&(o.layout=o.layout||{},o.layout.visibility=this.visibility),bt(o,(c,f)=>!(c===void 0||f==="layout"&&!Object.keys(c).length||f==="paint"&&!Object.keys(c).length))}_validate(o,c,f,m,v={}){return(!v||v.validate!==!1)&&lh(this,o.call(Ta,{key:c,layerType:this.type,objectKey:f,value:m,styleSpec:jt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const o in this.paint._values){const c=this.paint.get(o);if(c instanceof so&&hu(c.property.specification)&&(c.value.kind==="source"||c.value.kind==="composite")&&c.value.isStateDependent)return!0}return!1}}const rm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ll{constructor(o,c){this._structArray=o,this._pos1=c*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Ai{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(o,c){return o._trim(),c&&(o.isTransferred=!0,c.push(o.arrayBuffer)),{length:o.length,arrayBuffer:o.arrayBuffer}}static deserialize(o){const c=Object.create(this.prototype);return c.arrayBuffer=o.arrayBuffer,c.length=o.length,c.capacity=o.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(o){this.reserve(o),this.length=o}reserve(o){if(o>this.capacity){this.capacity=Math.max(o,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 Ei(l,o=1){let c=0,f=0;return{members:l.map(m=>{const v=rm[m.type].BYTES_PER_ELEMENT,w=c=gu(c,Math.max(o,v)),E=m.components||1;return f=Math.max(f,v),c+=v*E,{name:m.name,type:m.type,components:E,offset:w}}),size:gu(c,Math.max(f,o)),alignment:o}}function gu(l,o){return Math.ceil(l/o)*o}class uc extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c){const f=this.length;return this.resize(f+1),this.emplace(f,o,c)}emplace(o,c,f){const m=2*o;return this.int16[m+0]=c,this.int16[m+1]=f,o}}uc.prototype.bytesPerElement=4,xe("StructArrayLayout2i4",uc);class cc extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,f){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,f)}emplace(o,c,f,m){const v=3*o;return this.int16[v+0]=c,this.int16[v+1]=f,this.int16[v+2]=m,o}}cc.prototype.bytesPerElement=6,xe("StructArrayLayout3i6",cc);class Ml extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,f,m){const v=this.length;return this.resize(v+1),this.emplace(v,o,c,f,m)}emplace(o,c,f,m,v){const w=4*o;return this.int16[w+0]=c,this.int16[w+1]=f,this.int16[w+2]=m,this.int16[w+3]=v,o}}Ml.prototype.bytesPerElement=8,xe("StructArrayLayout4i8",Ml);class Kp extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,f,m,v,w){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,f,m,v,w)}emplace(o,c,f,m,v,w,E){const T=6*o;return this.int16[T+0]=c,this.int16[T+1]=f,this.int16[T+2]=m,this.int16[T+3]=v,this.int16[T+4]=w,this.int16[T+5]=E,o}}Kp.prototype.bytesPerElement=12,xe("StructArrayLayout2i4i12",Kp);class Jp extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,f,m,v,w){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,f,m,v,w)}emplace(o,c,f,m,v,w,E){const T=4*o,P=8*o;return this.int16[T+0]=c,this.int16[T+1]=f,this.uint8[P+4]=m,this.uint8[P+5]=v,this.uint8[P+6]=w,this.uint8[P+7]=E,o}}Jp.prototype.bytesPerElement=8,xe("StructArrayLayout2i4ub8",Jp);class _u extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c){const f=this.length;return this.resize(f+1),this.emplace(f,o,c)}emplace(o,c,f){const m=2*o;return this.float32[m+0]=c,this.float32[m+1]=f,o}}_u.prototype.bytesPerElement=8,xe("StructArrayLayout2f8",_u);class Qp extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,f,m,v,w,E,T,P,D){const F=this.length;return this.resize(F+1),this.emplace(F,o,c,f,m,v,w,E,T,P,D)}emplace(o,c,f,m,v,w,E,T,P,D,F){const U=10*o;return this.uint16[U+0]=c,this.uint16[U+1]=f,this.uint16[U+2]=m,this.uint16[U+3]=v,this.uint16[U+4]=w,this.uint16[U+5]=E,this.uint16[U+6]=T,this.uint16[U+7]=P,this.uint16[U+8]=D,this.uint16[U+9]=F,o}}Qp.prototype.bytesPerElement=20,xe("StructArrayLayout10ui20",Qp);class $p extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,f,m,v,w,E,T,P,D,F,U){const W=this.length;return this.resize(W+1),this.emplace(W,o,c,f,m,v,w,E,T,P,D,F,U)}emplace(o,c,f,m,v,w,E,T,P,D,F,U,W){const Y=12*o;return this.int16[Y+0]=c,this.int16[Y+1]=f,this.int16[Y+2]=m,this.int16[Y+3]=v,this.uint16[Y+4]=w,this.uint16[Y+5]=E,this.uint16[Y+6]=T,this.uint16[Y+7]=P,this.int16[Y+8]=D,this.int16[Y+9]=F,this.int16[Y+10]=U,this.int16[Y+11]=W,o}}$p.prototype.bytesPerElement=24,xe("StructArrayLayout4i4ui4i24",$p);class Vn extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,f){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,f)}emplace(o,c,f,m){const v=3*o;return this.float32[v+0]=c,this.float32[v+1]=f,this.float32[v+2]=m,o}}Vn.prototype.bytesPerElement=12,xe("StructArrayLayout3f12",Vn);class y extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.uint32[1*o+0]=c,o}}y.prototype.bytesPerElement=4,xe("StructArrayLayout1ul4",y);class s extends Ai{_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(o,c,f,m,v,w,E,T,P){const D=this.length;return this.resize(D+1),this.emplace(D,o,c,f,m,v,w,E,T,P)}emplace(o,c,f,m,v,w,E,T,P,D){const F=10*o,U=5*o;return this.int16[F+0]=c,this.int16[F+1]=f,this.int16[F+2]=m,this.int16[F+3]=v,this.int16[F+4]=w,this.int16[F+5]=E,this.uint32[U+3]=T,this.uint16[F+8]=P,this.uint16[F+9]=D,o}}s.prototype.bytesPerElement=20,xe("StructArrayLayout6i1ul2ui20",s);class h extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,f,m,v,w){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,f,m,v,w)}emplace(o,c,f,m,v,w,E){const T=6*o;return this.int16[T+0]=c,this.int16[T+1]=f,this.int16[T+2]=m,this.int16[T+3]=v,this.int16[T+4]=w,this.int16[T+5]=E,o}}h.prototype.bytesPerElement=12,xe("StructArrayLayout2i2i2i12",h);class d extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,f,m,v){const w=this.length;return this.resize(w+1),this.emplace(w,o,c,f,m,v)}emplace(o,c,f,m,v,w){const E=4*o,T=8*o;return this.float32[E+0]=c,this.float32[E+1]=f,this.float32[E+2]=m,this.int16[T+6]=v,this.int16[T+7]=w,o}}d.prototype.bytesPerElement=16,xe("StructArrayLayout2f1f2i16",d);class g extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,f,m){const v=this.length;return this.resize(v+1),this.emplace(v,o,c,f,m)}emplace(o,c,f,m,v){const w=12*o,E=3*o;return this.uint8[w+0]=c,this.uint8[w+1]=f,this.float32[E+1]=m,this.float32[E+2]=v,o}}g.prototype.bytesPerElement=12,xe("StructArrayLayout2ub2f12",g);class b extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,f){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,f)}emplace(o,c,f,m){const v=3*o;return this.uint16[v+0]=c,this.uint16[v+1]=f,this.uint16[v+2]=m,o}}b.prototype.bytesPerElement=6,xe("StructArrayLayout3ui6",b);class I extends Ai{_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(o,c,f,m,v,w,E,T,P,D,F,U,W,Y,tt,ct,ft){const Tt=this.length;return this.resize(Tt+1),this.emplace(Tt,o,c,f,m,v,w,E,T,P,D,F,U,W,Y,tt,ct,ft)}emplace(o,c,f,m,v,w,E,T,P,D,F,U,W,Y,tt,ct,ft,Tt){const _t=24*o,Mt=12*o,Ft=48*o;return this.int16[_t+0]=c,this.int16[_t+1]=f,this.uint16[_t+2]=m,this.uint16[_t+3]=v,this.uint32[Mt+2]=w,this.uint32[Mt+3]=E,this.uint32[Mt+4]=T,this.uint16[_t+10]=P,this.uint16[_t+11]=D,this.uint16[_t+12]=F,this.float32[Mt+7]=U,this.float32[Mt+8]=W,this.uint8[Ft+36]=Y,this.uint8[Ft+37]=tt,this.uint8[Ft+38]=ct,this.uint32[Mt+10]=ft,this.int16[_t+22]=Tt,o}}I.prototype.bytesPerElement=48,xe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",I);class C extends Ai{_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(o,c,f,m,v,w,E,T,P,D,F,U,W,Y,tt,ct,ft,Tt,_t,Mt,Ft,Ht,ye,Le,ge,fe,ae,Se){const ue=this.length;return this.resize(ue+1),this.emplace(ue,o,c,f,m,v,w,E,T,P,D,F,U,W,Y,tt,ct,ft,Tt,_t,Mt,Ft,Ht,ye,Le,ge,fe,ae,Se)}emplace(o,c,f,m,v,w,E,T,P,D,F,U,W,Y,tt,ct,ft,Tt,_t,Mt,Ft,Ht,ye,Le,ge,fe,ae,Se,ue){const ne=32*o,Fe=16*o;return this.int16[ne+0]=c,this.int16[ne+1]=f,this.int16[ne+2]=m,this.int16[ne+3]=v,this.int16[ne+4]=w,this.int16[ne+5]=E,this.int16[ne+6]=T,this.int16[ne+7]=P,this.uint16[ne+8]=D,this.uint16[ne+9]=F,this.uint16[ne+10]=U,this.uint16[ne+11]=W,this.uint16[ne+12]=Y,this.uint16[ne+13]=tt,this.uint16[ne+14]=ct,this.uint16[ne+15]=ft,this.uint16[ne+16]=Tt,this.uint16[ne+17]=_t,this.uint16[ne+18]=Mt,this.uint16[ne+19]=Ft,this.uint16[ne+20]=Ht,this.uint16[ne+21]=ye,this.uint16[ne+22]=Le,this.uint32[Fe+12]=ge,this.float32[Fe+13]=fe,this.float32[Fe+14]=ae,this.uint16[ne+30]=Se,this.uint16[ne+31]=ue,o}}C.prototype.bytesPerElement=64,xe("StructArrayLayout8i15ui1ul2f2ui64",C);class M extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.float32[1*o+0]=c,o}}M.prototype.bytesPerElement=4,xe("StructArrayLayout1f4",M);class k extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,f){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,f)}emplace(o,c,f,m){const v=3*o;return this.uint16[6*o+0]=c,this.float32[v+1]=f,this.float32[v+2]=m,o}}k.prototype.bytesPerElement=12,xe("StructArrayLayout1ui2f12",k);class R extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,f){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,f)}emplace(o,c,f,m){const v=4*o;return this.uint32[2*o+0]=c,this.uint16[v+2]=f,this.uint16[v+3]=m,o}}R.prototype.bytesPerElement=8,xe("StructArrayLayout1ul2ui8",R);class O extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c){const f=this.length;return this.resize(f+1),this.emplace(f,o,c)}emplace(o,c,f){const m=2*o;return this.uint16[m+0]=c,this.uint16[m+1]=f,o}}O.prototype.bytesPerElement=4,xe("StructArrayLayout2ui4",O);class q extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.uint16[1*o+0]=c,o}}q.prototype.bytesPerElement=2,xe("StructArrayLayout1ui2",q);class nt extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,f,m){const v=this.length;return this.resize(v+1),this.emplace(v,o,c,f,m)}emplace(o,c,f,m,v){const w=4*o;return this.float32[w+0]=c,this.float32[w+1]=f,this.float32[w+2]=m,this.float32[w+3]=v,o}}nt.prototype.bytesPerElement=16,xe("StructArrayLayout4f16",nt);class et extends Ll{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 A(this.anchorPointX,this.anchorPointY)}}et.prototype.size=20;class lt extends s{get(o){return new et(this,o)}}xe("CollisionBoxArray",lt);class $ extends Ll{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(o){this._structArray.uint8[this._pos1+37]=o}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(o){this._structArray.uint8[this._pos1+38]=o}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(o){this._structArray.uint32[this._pos4+10]=o}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}$.prototype.size=48;class St extends I{get(o){return new $(this,o)}}xe("PlacedSymbolArray",St);class Ot extends Ll{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(o){this._structArray.uint32[this._pos4+12]=o}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]}}Ot.prototype.size=64;class pt extends C{get(o){return new Ot(this,o)}}xe("SymbolInstanceArray",pt);class Ct extends M{getoffsetX(o){return this.float32[1*o+0]}}xe("GlyphOffsetArray",Ct);class Bt extends cc{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}xe("SymbolLineVertexArray",Bt);class Vt extends Ll{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]}}Vt.prototype.size=12;class Wt extends k{get(o){return new Vt(this,o)}}xe("TextAnchorOffsetArray",Wt);class ee extends Ll{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]}}ee.prototype.size=8;class Kt extends R{get(o){return new ee(this,o)}}xe("FeatureIndexArray",Kt);class oe extends uc{}class Te extends uc{}class bn extends uc{}class pe extends Kp{}class qe extends Jp{}class Me extends _u{}class Kn extends Qp{}class vn extends $p{}class fn extends Vn{}class xn extends y{}class Bi extends h{}class si extends g{}class Rr extends b{}class ar extends O{}const Xi=Ei([{name:"a_pos",components:2,type:"Int16"}],4),{members:Fo}=Xi;class hi{constructor(o=[]){this.segments=o}prepareSegment(o,c,f,m){let v=this.segments[this.segments.length-1];return o>hi.MAX_VERTEX_ARRAY_LENGTH&&Nt(`Max vertices per segment is ${hi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!v||v.vertexLength+o>hi.MAX_VERTEX_ARRAY_LENGTH||v.sortKey!==m)&&(v={vertexOffset:c.length,primitiveOffset:f.length,vertexLength:0,primitiveLength:0},m!==void 0&&(v.sortKey=m),this.segments.push(v)),v}get(){return this.segments}destroy(){for(const o of this.segments)for(const c in o.vaos)o.vaos[c].destroy()}static simpleSegment(o,c,f,m){return new hi([{vertexOffset:o,primitiveOffset:c,vertexLength:f,primitiveLength:m,vaos:{},sortKey:0}])}}function Zs(l,o){return 256*(l=ht(Math.floor(l),0,255))+ht(Math.floor(o),0,255)}hi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,xe("SegmentVector",hi);const Ws=Ei([{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 el={exports:{}},Pl={exports:{}};Pl.exports=function(l,o){var c,f,m,v,w,E,T,P;for(f=l.length-(c=3&l.length),m=o,w=3432918353,E=461845907,P=0;P>>16)*w&65535)<<16)&4294967295)<<15|T>>>17))*E+(((T>>>16)*E&65535)<<16)&4294967295)<<13|m>>>19))+((5*(m>>>16)&65535)<<16)&4294967295))+((58964+(v>>>16)&65535)<<16);switch(T=0,c){case 3:T^=(255&l.charCodeAt(P+2))<<16;case 2:T^=(255&l.charCodeAt(P+1))<<8;case 1:m^=T=(65535&(T=(T=(65535&(T^=255&l.charCodeAt(P)))*w+(((T>>>16)*w&65535)<<16)&4294967295)<<15|T>>>17))*E+(((T>>>16)*E&65535)<<16)&4294967295}return m^=l.length,m=2246822507*(65535&(m^=m>>>16))+((2246822507*(m>>>16)&65535)<<16)&4294967295,m=3266489909*(65535&(m^=m>>>13))+((3266489909*(m>>>16)&65535)<<16)&4294967295,(m^=m>>>16)>>>0};var yu=Pl.exports,Wr={exports:{}};Wr.exports=function(l,o){for(var c,f=l.length,m=o^f,v=0;f>=4;)c=1540483477*(65535&(c=255&l.charCodeAt(v)|(255&l.charCodeAt(++v))<<8|(255&l.charCodeAt(++v))<<16|(255&l.charCodeAt(++v))<<24))+((1540483477*(c>>>16)&65535)<<16),m=1540483477*(65535&m)+((1540483477*(m>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),f-=4,++v;switch(f){case 3:m^=(255&l.charCodeAt(v+2))<<16;case 2:m^=(255&l.charCodeAt(v+1))<<8;case 1:m=1540483477*(65535&(m^=255&l.charCodeAt(v)))+((1540483477*(m>>>16)&65535)<<16)}return m=1540483477*(65535&(m^=m>>>13))+((1540483477*(m>>>16)&65535)<<16),(m^=m>>>15)>>>0};var Or=yu,ao=Wr.exports;el.exports=Or,el.exports.murmur3=Or,el.exports.murmur2=ao;var Al=x(el.exports);class Vi{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,c,f,m){this.ids.push(lr(o)),this.positions.push(c,f,m)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const c=lr(o);let f=0,m=this.ids.length-1;for(;f>1;this.ids[w]>=c?m=w:f=w+1}const v=[];for(;this.ids[f]===c;)v.push({index:this.positions[3*f],start:this.positions[3*f+1],end:this.positions[3*f+2]}),f++;return v}static serialize(o,c){const f=new Float64Array(o.ids),m=new Uint32Array(o.positions);return xo(f,m,0,f.length-1),c&&c.push(f.buffer,m.buffer),{ids:f,positions:m}}static deserialize(o){const c=new Vi;return c.ids=o.ids,c.positions=o.positions,c.indexed=!0,c}}function lr(l){const o=+l;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Al(String(l))}function xo(l,o,c,f){for(;c>1];let v=c-1,w=f+1;for(;;){do v++;while(l[v]m);if(v>=w)break;Ui(l,v,w),Ui(o,3*v,3*w),Ui(o,3*v+1,3*w+1),Ui(o,3*v+2,3*w+2)}w-c`u_${m}`),this.type=f}setUniform(o,c,f){o.set(f.constantOr(this.value))}getBinding(o,c,f){return this.type==="color"?new sm(o,c):new ph(o,c)}}class Nl{constructor(o,c){this.uniformNames=c.map(f=>`u_${f}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,c){this.pixelRatioFrom=c.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=c.tlbr,this.patternTo=o.tlbr}setUniform(o,c,f,m){const v=m==="u_pattern_to"?this.patternTo:m==="u_pattern_from"?this.patternFrom:m==="u_pixel_ratio_to"?this.pixelRatioTo:m==="u_pixel_ratio_from"?this.pixelRatioFrom:null;v&&o.set(v)}getBinding(o,c,f){return f.substr(0,9)==="u_pattern"?new om(o,c):new ph(o,c)}}class Hs{constructor(o,c,f,m){this.expression=o,this.type=f,this.maxValue=0,this.paintVertexAttributes=c.map(v=>({name:`a_${v}`,type:"Float32",components:f==="color"?2:1,offset:0})),this.paintVertexArray=new m}populatePaintArray(o,c,f,m,v){const w=this.paintVertexArray.length,E=this.expression.evaluate(new ci(0),c,{},m,[],v);this.paintVertexArray.resize(o),this._setPaintValue(w,o,E)}updatePaintArray(o,c,f,m){const v=this.expression.evaluate({zoom:0},f,m);this._setPaintValue(o,c,v)}_setPaintValue(o,c,f){if(this.type==="color"){const m=tf(f);for(let v=o;v`u_${E}_t`),this.type=f,this.useIntegerZoom=m,this.zoom=v,this.maxValue=0,this.paintVertexAttributes=c.map(E=>({name:`a_${E}`,type:"Float32",components:f==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(o,c,f,m,v){const w=this.expression.evaluate(new ci(this.zoom),c,{},m,[],v),E=this.expression.evaluate(new ci(this.zoom+1),c,{},m,[],v),T=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(T,o,w,E)}updatePaintArray(o,c,f,m){const v=this.expression.evaluate({zoom:this.zoom},f,m),w=this.expression.evaluate({zoom:this.zoom+1},f,m);this._setPaintValue(o,c,v,w)}_setPaintValue(o,c,f,m){if(this.type==="color"){const v=tf(f),w=tf(m);for(let E=o;E`#define HAS_UNIFORM_${m}`))}return o}getBinderAttributes(){const o=[];for(const c in this.binders){const f=this.binders[c];if(f instanceof Hs||f instanceof ls)for(let m=0;m!0){this.programConfigurations={};for(const m of o)this.programConfigurations[m.id]=new ef(m,c,f);this.needsUpload=!1,this._featureMap=new Vi,this._bufferOffset=0}populatePaintArrays(o,c,f,m,v,w){for(const E in this.programConfigurations)this.programConfigurations[E].populatePaintArrays(o,c,m,v,w);c.id!==void 0&&this._featureMap.add(c.id,f,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,c,f,m){for(const v of f)this.needsUpload=this.programConfigurations[v.id].updatePaintArrays(o,this._featureMap,c,v,m)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(const c in this.programConfigurations)this.programConfigurations[c].upload(o);this.needsUpload=!1}}destroy(){for(const o in this.programConfigurations)this.programConfigurations[o].destroy()}}function Lw(l,o){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"]}[l]||[l.replace(`${o}-`,"").replace(/-/g,"_")]}function e0(l,o,c){const f={color:{source:_u,composite:nt},number:{source:M,composite:_u}},m=function(v){return{"line-pattern":{source:Kn,composite:Kn},"fill-pattern":{source:Kn,composite:Kn},"fill-extrusion-pattern":{source:Kn,composite:Kn}}[v]}(l);return m&&m[c]||f[o][c]}xe("ConstantBinder",Xs),xe("CrossFadedConstantBinder",Nl),xe("SourceExpressionBinder",Hs),xe("CrossFadedCompositeBinder",Ys),xe("CompositeExpressionBinder",ls),xe("ProgramConfiguration",ef,{omit:["_buffers"]}),xe("ProgramConfigurationSet",Ma);const ir=8192,Qg=Math.pow(2,14)-1,n0=-Qg-1;function hc(l){const o=ir/l.extent,c=l.loadGeometry();for(let f=0;fw.x+1||Tw.y+1)&&Nt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return c}function pc(l,o){return{type:l.type,id:l.id,properties:l.properties,geometry:o?hc(l):[]}}function am(l,o,c,f,m){l.emplaceBack(2*o+(f+1)/2,2*c+(m+1)/2)}class $g{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new Te,this.indexArray=new Rr,this.segments=new hi,this.programConfigurations=new Ma(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,f){const m=this.layers[0],v=[];let w=null,E=!1;m.type==="circle"&&(w=m.layout.get("circle-sort-key"),E=!w.isConstant());for(const{feature:T,id:P,index:D,sourceLayerIndex:F}of o){const U=this.layers[0]._featureFilter.needGeometry,W=pc(T,U);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom),W,f))continue;const Y=E?w.evaluate(W,{},f):void 0,tt={id:P,properties:T.properties,type:T.type,sourceLayerIndex:F,index:D,geometry:U?W.geometry:hc(T),patterns:{},sortKey:Y};v.push(tt)}E&&v.sort((T,P)=>T.sortKey-P.sortKey);for(const T of v){const{geometry:P,index:D,sourceLayerIndex:F}=T,U=o[D].feature;this.addFeature(T,P,D,f),c.featureIndex.insert(U,P,D,F,this.index)}}update(o,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,Fo),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(o,c,f,m){for(const v of c)for(const w of v){const E=w.x,T=w.y;if(E<0||E>=ir||T<0||T>=ir)continue;const P=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),D=P.vertexLength;am(this.layoutVertexArray,E,T,-1,-1),am(this.layoutVertexArray,E,T,1,-1),am(this.layoutVertexArray,E,T,1,1),am(this.layoutVertexArray,E,T,-1,1),this.indexArray.emplaceBack(D,D+1,D+2),this.indexArray.emplaceBack(D,D+3,D+2),P.vertexLength+=4,P.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,f,{},m)}}function i0(l,o){for(let c=0;c1){if(t_(l,o))return!0;for(let f=0;f1?c:c.sub(o)._mult(m)._add(o))}function s0(l,o){let c,f,m,v=!1;for(let w=0;wo.y!=m.y>o.y&&o.x<(m.x-f.x)*(o.y-f.y)/(m.y-f.y)+f.x&&(v=!v)}return v}function fh(l,o){let c=!1;for(let f=0,m=l.length-1;fo.y!=w.y>o.y&&o.x<(w.x-v.x)*(o.y-v.y)/(w.y-v.y)+v.x&&(c=!c)}return c}function kw(l,o,c){const f=c[0],m=c[2];if(l.xm.x&&o.x>m.x||l.ym.y&&o.y>m.y)return!1;const v=Gt(l,o,c[0]);return v!==Gt(l,o,c[1])||v!==Gt(l,o,c[2])||v!==Gt(l,o,c[3])}function nf(l,o,c){const f=o.paint.get(l).value;return f.kind==="constant"?f.value:c.programConfigurations.get(o.id).getMaxValue(l)}function lm(l){return Math.sqrt(l[0]*l[0]+l[1]*l[1])}function um(l,o,c,f,m){if(!o[0]&&!o[1])return l;const v=A.convert(o)._mult(m);c==="viewport"&&v._rotate(-f);const w=[];for(let E=0;Ec0(ct,tt))}(P,T),W=F?D*E:D;for(const Y of m)for(const tt of Y){const ct=F?tt:c0(tt,T);let ft=W;const Tt=cm([],[tt.x,tt.y,0,1],T);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ft*=Tt[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ft*=w.cameraToCenterDistance/Tt[3]),Mw(U,ct,ft))return!0}return!1}}function c0(l,o){const c=cm([],[l.x,l.y,0,1],o);return new A(c[0]/c[3],c[1]/c[3])}class h0 extends $g{}let p0;xe("HeatmapBucket",h0,{omit:["layers"]});var Ow={get paint(){return p0=p0||new Wi({"heatmap-radius":new je(jt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new je(jt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ne(jt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Hp(jt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ne(jt.paint_heatmap["heatmap-opacity"])})}};function i_(l,{width:o,height:c},f,m){if(m){if(m instanceof Uint8ClampedArray)m=new Uint8Array(m.buffer);else if(m.length!==o*c*f)throw new RangeError(`mismatched image size. expected: ${m.length} but got: ${o*c*f}`)}else m=new Uint8Array(o*c*f);return l.width=o,l.height=c,l.data=m,l}function f0(l,{width:o,height:c},f){if(o===l.width&&c===l.height)return;const m=i_({},{width:o,height:c},f);r_(l,m,{x:0,y:0},{x:0,y:0},{width:Math.min(l.width,o),height:Math.min(l.height,c)},f),l.width=o,l.height=c,l.data=m.data}function r_(l,o,c,f,m,v){if(m.width===0||m.height===0)return o;if(m.width>l.width||m.height>l.height||c.x>l.width-m.width||c.y>l.height-m.height)throw new RangeError("out of range source coordinates for image copy");if(m.width>o.width||m.height>o.height||f.x>o.width-m.width||f.y>o.height-m.height)throw new RangeError("out of range destination coordinates for image copy");const w=l.data,E=o.data;if(w===E)throw new Error("srcData equals dstData, so image is already copied");for(let T=0;T{o[l.evaluationKey]=T;const P=l.expression.evaluate(o);m.data[w+E+0]=Math.floor(255*P.r/P.a),m.data[w+E+1]=Math.floor(255*P.g/P.a),m.data[w+E+2]=Math.floor(255*P.b/P.a),m.data[w+E+3]=Math.floor(255*P.a)};if(l.clips)for(let w=0,E=0;w80*c){f=v=l[0],m=w=l[1];for(var Y=c;Yv&&(v=E),T>w&&(w=T);P=(P=Math.max(v-f,w-m))!==0?32767/P:0}return sf(U,W,c,f,m,P,0),W}function g0(l,o,c,f,m){var v,w;if(m===l_(l,o,c,f)>0)for(v=o;v=o;v-=f)w=v0(v,l[v],l[v+1],w);return w&&pm(w,w.next)&&(lf(w),w=w.next),w}function fc(l,o){if(!l)return l;o||(o=l);var c,f=l;do if(c=!1,f.steiner||!pm(f,f.next)&&Hi(f.prev,f,f.next)!==0)f=f.next;else{if(lf(f),(f=o=f.prev)===f.next)break;c=!0}while(c||f!==o);return o}function sf(l,o,c,f,m,v,w){if(l){!w&&v&&function(D,F,U,W){var Y=D;do Y.z===0&&(Y.z=s_(Y.x,Y.y,F,U,W)),Y.prevZ=Y.prev,Y.nextZ=Y.next,Y=Y.next;while(Y!==D);Y.prevZ.nextZ=null,Y.prevZ=null,function(tt){var ct,ft,Tt,_t,Mt,Ft,Ht,ye,Le=1;do{for(ft=tt,tt=null,Mt=null,Ft=0;ft;){for(Ft++,Tt=ft,Ht=0,ct=0;ct0||ye>0&&Tt;)Ht!==0&&(ye===0||!Tt||ft.z<=Tt.z)?(_t=ft,ft=ft.nextZ,Ht--):(_t=Tt,Tt=Tt.nextZ,ye--),Mt?Mt.nextZ=_t:tt=_t,_t.prevZ=Mt,Mt=_t;ft=Tt}Mt.nextZ=null,Le*=2}while(Ft>1)}(Y)}(l,f,m,v);for(var E,T,P=l;l.prev!==l.next;)if(E=l.prev,T=l.next,v?jw(l,f,m,v):Gw(l))o.push(E.i/c|0),o.push(l.i/c|0),o.push(T.i/c|0),lf(l),l=T.next,P=T.next;else if((l=T)===P){w?w===1?sf(l=qw(fc(l),o,c),o,c,f,m,v,2):w===2&&Zw(l,o,c,f,m,v):sf(fc(l),o,c,f,m,v,1);break}}}function Gw(l){var o=l.prev,c=l,f=l.next;if(Hi(o,c,f)>=0)return!1;for(var m=o.x,v=c.x,w=f.x,E=o.y,T=c.y,P=f.y,D=mv?m>w?m:w:v>w?v:w,W=E>T?E>P?E:P:T>P?T:P,Y=f.next;Y!==o;){if(Y.x>=D&&Y.x<=U&&Y.y>=F&&Y.y<=W&&mh(m,E,v,T,w,P,Y.x,Y.y)&&Hi(Y.prev,Y,Y.next)>=0)return!1;Y=Y.next}return!0}function jw(l,o,c,f){var m=l.prev,v=l,w=l.next;if(Hi(m,v,w)>=0)return!1;for(var E=m.x,T=v.x,P=w.x,D=m.y,F=v.y,U=w.y,W=ET?E>P?E:P:T>P?T:P,ct=D>F?D>U?D:U:F>U?F:U,ft=s_(W,Y,o,c,f),Tt=s_(tt,ct,o,c,f),_t=l.prevZ,Mt=l.nextZ;_t&&_t.z>=ft&&Mt&&Mt.z<=Tt;){if(_t.x>=W&&_t.x<=tt&&_t.y>=Y&&_t.y<=ct&&_t!==m&&_t!==w&&mh(E,D,T,F,P,U,_t.x,_t.y)&&Hi(_t.prev,_t,_t.next)>=0||(_t=_t.prevZ,Mt.x>=W&&Mt.x<=tt&&Mt.y>=Y&&Mt.y<=ct&&Mt!==m&&Mt!==w&&mh(E,D,T,F,P,U,Mt.x,Mt.y)&&Hi(Mt.prev,Mt,Mt.next)>=0))return!1;Mt=Mt.nextZ}for(;_t&&_t.z>=ft;){if(_t.x>=W&&_t.x<=tt&&_t.y>=Y&&_t.y<=ct&&_t!==m&&_t!==w&&mh(E,D,T,F,P,U,_t.x,_t.y)&&Hi(_t.prev,_t,_t.next)>=0)return!1;_t=_t.prevZ}for(;Mt&&Mt.z<=Tt;){if(Mt.x>=W&&Mt.x<=tt&&Mt.y>=Y&&Mt.y<=ct&&Mt!==m&&Mt!==w&&mh(E,D,T,F,P,U,Mt.x,Mt.y)&&Hi(Mt.prev,Mt,Mt.next)>=0)return!1;Mt=Mt.nextZ}return!0}function qw(l,o,c){var f=l;do{var m=f.prev,v=f.next.next;!pm(m,v)&&_0(m,f,f.next,v)&&af(m,v)&&af(v,m)&&(o.push(m.i/c|0),o.push(f.i/c|0),o.push(v.i/c|0),lf(f),lf(f.next),f=l=v),f=f.next}while(f!==l);return fc(f)}function Zw(l,o,c,f,m,v){var w=l;do{for(var E=w.next.next;E!==w.prev;){if(w.i!==E.i&&Kw(w,E)){var T=y0(w,E);return w=fc(w,w.next),T=fc(T,T.next),sf(w,o,c,f,m,v,0),void sf(T,o,c,f,m,v,0)}E=E.next}w=w.next}while(w!==l)}function Ww(l,o){return l.x-o.x}function Xw(l,o){var c=function(m,v){var w,E=v,T=m.x,P=m.y,D=-1/0;do{if(P<=E.y&&P>=E.next.y&&E.next.y!==E.y){var F=E.x+(P-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(F<=T&&F>D&&(D=F,w=E.x=E.x&&E.x>=Y&&T!==E.x&&mh(Pw.x||E.x===w.x&&Hw(w,E)))&&(w=E,ct=U)),E=E.next;while(E!==W);return w}(l,o);if(!c)return o;var f=y0(c,l);return fc(f,f.next),fc(c,c.next)}function Hw(l,o){return Hi(l.prev,l,o.prev)<0&&Hi(o.next,l,l.next)<0}function s_(l,o,c,f,m){return(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l=(l-c)*m|0)|l<<8))|l<<4))|l<<2))|l<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-f)*m|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function Yw(l){var o=l,c=l;do(o.x=(l-w)*(v-E)&&(l-w)*(f-E)>=(c-w)*(o-E)&&(c-w)*(v-E)>=(m-w)*(f-E)}function Kw(l,o){return l.next.i!==o.i&&l.prev.i!==o.i&&!function(c,f){var m=c;do{if(m.i!==c.i&&m.next.i!==c.i&&m.i!==f.i&&m.next.i!==f.i&&_0(m,m.next,c,f))return!0;m=m.next}while(m!==c);return!1}(l,o)&&(af(l,o)&&af(o,l)&&function(c,f){var m=c,v=!1,w=(c.x+f.x)/2,E=(c.y+f.y)/2;do m.y>E!=m.next.y>E&&m.next.y!==m.y&&w<(m.next.x-m.x)*(E-m.y)/(m.next.y-m.y)+m.x&&(v=!v),m=m.next;while(m!==c);return v}(l,o)&&(Hi(l.prev,l,o.prev)||Hi(l,o.prev,o))||pm(l,o)&&Hi(l.prev,l,l.next)>0&&Hi(o.prev,o,o.next)>0)}function Hi(l,o,c){return(o.y-l.y)*(c.x-o.x)-(o.x-l.x)*(c.y-o.y)}function pm(l,o){return l.x===o.x&&l.y===o.y}function _0(l,o,c,f){var m=dm(Hi(l,o,c)),v=dm(Hi(l,o,f)),w=dm(Hi(c,f,l)),E=dm(Hi(c,f,o));return m!==v&&w!==E||!(m!==0||!fm(l,c,o))||!(v!==0||!fm(l,f,o))||!(w!==0||!fm(c,l,f))||!(E!==0||!fm(c,o,f))}function fm(l,o,c){return o.x<=Math.max(l.x,c.x)&&o.x>=Math.min(l.x,c.x)&&o.y<=Math.max(l.y,c.y)&&o.y>=Math.min(l.y,c.y)}function dm(l){return l>0?1:l<0?-1:0}function af(l,o){return Hi(l.prev,l,l.next)<0?Hi(l,o,l.next)>=0&&Hi(l,l.prev,o)>=0:Hi(l,o,l.prev)<0||Hi(l,l.next,o)<0}function y0(l,o){var c=new a_(l.i,l.x,l.y),f=new a_(o.i,o.x,o.y),m=l.next,v=o.prev;return l.next=o,o.prev=l,c.next=m,m.prev=c,f.next=c,c.prev=f,v.next=f,f.prev=v,f}function v0(l,o,c,f){var m=new a_(l,o,c);return f?(m.next=f.next,m.prev=f,f.next.prev=m,f.next=m):(m.prev=m,m.next=m),m}function lf(l){l.next.prev=l.prev,l.prev.next=l.next,l.prevZ&&(l.prevZ.nextZ=l.nextZ),l.nextZ&&(l.nextZ.prevZ=l.prevZ)}function a_(l,o,c){this.i=l,this.x=o,this.y=c,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function l_(l,o,c,f){for(var m=0,v=o,w=c-f;v0&&c.holes.push(f+=l[m-1].length)}return c};var b0=x(o_.exports);function Jw(l,o,c,f,m){x0(l,o,c||0,f||l.length-1,m||Qw)}function x0(l,o,c,f,m){for(;f>c;){if(f-c>600){var v=f-c+1,w=o-c+1,E=Math.log(v),T=.5*Math.exp(2*E/3),P=.5*Math.sqrt(E*T*(v-T)/v)*(w-v/2<0?-1:1);x0(l,o,Math.max(c,Math.floor(o-w*T/v+P)),Math.min(f,Math.floor(o+(v-w)*T/v+P)),m)}var D=l[o],F=c,U=f;for(uf(l,c,o),m(l[f],D)>0&&uf(l,c,f);F0;)U--}m(l[c],D)===0?uf(l,c,U):uf(l,++U,f),U<=o&&(c=U+1),o<=U&&(f=U-1)}}function uf(l,o,c){var f=l[o];l[o]=l[c],l[c]=f}function Qw(l,o){return lo?1:0}function u_(l,o){const c=l.length;if(c<=1)return[l];const f=[];let m,v;for(let w=0;w1)for(let w=0;wc.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new bn,this.indexArray=new Rr,this.indexArray2=new ar,this.programConfigurations=new Ma(o.layers,o.zoom),this.segments=new hi,this.segments2=new hi,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,f){this.hasPattern=c_("fill",this.layers,c);const m=this.layers[0].layout.get("fill-sort-key"),v=!m.isConstant(),w=[];for(const{feature:E,id:T,index:P,sourceLayerIndex:D}of o){const F=this.layers[0]._featureFilter.needGeometry,U=pc(E,F);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom),U,f))continue;const W=v?m.evaluate(U,{},f,c.availableImages):void 0,Y={id:T,properties:E.properties,type:E.type,sourceLayerIndex:D,index:P,geometry:F?U.geometry:hc(E),patterns:{},sortKey:W};w.push(Y)}v&&w.sort((E,T)=>E.sortKey-T.sortKey);for(const E of w){const{geometry:T,index:P,sourceLayerIndex:D}=E;if(this.hasPattern){const F=h_("fill",this.layers,E,this.zoom,c);this.patternFeatures.push(F)}else this.addFeature(E,T,P,f,{});c.featureIndex.insert(o[P].feature,T,P,D,this.index)}}update(o,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,f)}addFeatures(o,c,f){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,c,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,Uw),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.indexBuffer2=o.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(o),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(o,c,f,m,v){for(const w of u_(c,500)){let E=0;for(const W of w)E+=W.length;const T=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray),P=T.vertexLength,D=[],F=[];for(const W of w){if(W.length===0)continue;W!==w[0]&&F.push(D.length/2);const Y=this.segments2.prepareSegment(W.length,this.layoutVertexArray,this.indexArray2),tt=Y.vertexLength;this.layoutVertexArray.emplaceBack(W[0].x,W[0].y),this.indexArray2.emplaceBack(tt+W.length-1,tt),D.push(W[0].x),D.push(W[0].y);for(let ct=1;ct>3}if(m--,f===1||f===2)v+=l.readSVarint(),w+=l.readSVarint(),f===1&&(o&&E.push(o),o=[]),o.push(new o2(v,w));else{if(f!==7)throw new Error("unknown command "+f);o&&o.push(o[0].clone())}}return o&&E.push(o),E},gh.prototype.bbox=function(){var l=this._pbf;l.pos=this._geometry;for(var o=l.readVarint()+l.pos,c=1,f=0,m=0,v=0,w=1/0,E=-1/0,T=1/0,P=-1/0;l.pos>3}if(f--,c===1||c===2)(m+=l.readSVarint())E&&(E=m),(v+=l.readSVarint())P&&(P=v);else if(c!==7)throw new Error("unknown command "+c)}return[w,T,E,P]},gh.prototype.toGeoJSON=function(l,o,c){var f,m,v=this.extent*Math.pow(2,c),w=this.extent*l,E=this.extent*o,T=this.loadGeometry(),P=gh.types[this.type];function D(W){for(var Y=0;Y>3;m=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 m}(c))}C0.prototype.feature=function(l){if(l<0||l>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[l];var o=this._pbf.readVarint()+this._pbf.pos;return new l2(this._pbf,o,this.extent,this._keys,this._values)};var c2=I0;function h2(l,o,c){if(l===3){var f=new c2(c,c.readVarint()+c.pos);f.length&&(o[f.name]=f)}}vu.VectorTile=function(l,o){this.layers=l.readFields(h2,{},o)},vu.VectorTileFeature=E0,vu.VectorTileLayer=I0;const p2=vu.VectorTileFeature.types,f_=Math.pow(2,13);function cf(l,o,c,f,m,v,w,E){l.emplaceBack(o,c,2*Math.floor(f*f_)+w,m*f_*2,v*f_*2,Math.round(E))}class d_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new pe,this.centroidVertexArray=new oe,this.indexArray=new Rr,this.programConfigurations=new Ma(o.layers,o.zoom),this.segments=new hi,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,f){this.features=[],this.hasPattern=c_("fill-extrusion",this.layers,c);for(const{feature:m,id:v,index:w,sourceLayerIndex:E}of o){const T=this.layers[0]._featureFilter.needGeometry,P=pc(m,T);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom),P,f))continue;const D={id:v,sourceLayerIndex:E,index:w,geometry:T?P.geometry:hc(m),properties:m.properties,type:m.type,patterns:{}};this.hasPattern?this.features.push(h_("fill-extrusion",this.layers,D,this.zoom,c)):this.addFeature(D,D.geometry,w,f,{}),c.featureIndex.insert(m,D.geometry,w,E,this.index,!0)}}addFeatures(o,c,f){for(const m of this.features){const{geometry:v}=m;this.addFeature(m,v,m.index,c,f)}}update(o,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,f)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,r2),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,i2.members,!0),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(o,c,f,m,v){const w={x:0,y:0,vertexCount:0};for(const E of u_(c,500)){let T=0;for(const Y of E)T+=Y.length;let P=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const Y of E){if(Y.length===0||d2(Y))continue;let tt=0;for(let ct=0;ct=1){const Tt=Y[ct-1];if(!f2(ft,Tt)){P.vertexLength+4>hi.MAX_VERTEX_ARRAY_LENGTH&&(P=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const _t=ft.sub(Tt)._perp()._unit(),Mt=Tt.dist(ft);tt+Mt>32768&&(tt=0),cf(this.layoutVertexArray,ft.x,ft.y,_t.x,_t.y,0,0,tt),cf(this.layoutVertexArray,ft.x,ft.y,_t.x,_t.y,0,1,tt),w.x+=2*ft.x,w.y+=2*ft.y,w.vertexCount+=2,tt+=Mt,cf(this.layoutVertexArray,Tt.x,Tt.y,_t.x,_t.y,0,0,tt),cf(this.layoutVertexArray,Tt.x,Tt.y,_t.x,_t.y,0,1,tt),w.x+=2*Tt.x,w.y+=2*Tt.y,w.vertexCount+=2;const Ft=P.vertexLength;this.indexArray.emplaceBack(Ft,Ft+2,Ft+1),this.indexArray.emplaceBack(Ft+1,Ft+2,Ft+3),P.vertexLength+=4,P.primitiveLength+=2}}}}if(P.vertexLength+T>hi.MAX_VERTEX_ARRAY_LENGTH&&(P=this.segments.prepareSegment(T,this.layoutVertexArray,this.indexArray)),p2[o.type]!=="Polygon")continue;const D=[],F=[],U=P.vertexLength;for(const Y of E)if(Y.length!==0){Y!==E[0]&&F.push(D.length/2);for(let tt=0;ttir)||l.y===o.y&&(l.y<0||l.y>ir)}function d2(l){return l.every(o=>o.x<0)||l.every(o=>o.x>ir)||l.every(o=>o.y<0)||l.every(o=>o.y>ir)}let T0;xe("FillExtrusionBucket",d_,{omit:["layers","features"]});var m2={get paint(){return T0=T0||new Wi({"fill-extrusion-opacity":new Ne(jt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new je(jt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ne(jt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ne(jt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new lc(jt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new je(jt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new je(jt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ne(jt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class g2 extends as{constructor(o){super(o,m2)}createBucket(o){return new d_(o)}queryRadius(){return lm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,c,f,m,v,w,E,T){const P=um(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,E),D=this.paint.get("fill-extrusion-height").evaluate(c,f),F=this.paint.get("fill-extrusion-base").evaluate(c,f),U=function(Y,tt,ct,ft){const Tt=[];for(const _t of Y){const Mt=[_t.x,_t.y,0,1];cm(Mt,Mt,tt),Tt.push(new A(Mt[0]/Mt[3],Mt[1]/Mt[3]))}return Tt}(P,T),W=function(Y,tt,ct,ft){const Tt=[],_t=[],Mt=ft[8]*tt,Ft=ft[9]*tt,Ht=ft[10]*tt,ye=ft[11]*tt,Le=ft[8]*ct,ge=ft[9]*ct,fe=ft[10]*ct,ae=ft[11]*ct;for(const Se of Y){const ue=[],ne=[];for(const Fe of Se){const Ae=Fe.x,gn=Fe.y,pi=ft[0]*Ae+ft[4]*gn+ft[12],_i=ft[1]*Ae+ft[5]*gn+ft[13],cr=ft[2]*Ae+ft[6]*gn+ft[14],us=ft[3]*Ae+ft[7]*gn+ft[15],So=cr+Ht,rr=us+ye,zr=pi+Le,Hr=_i+ge,Eo=cr+fe,Io=us+ae,hr=new A((pi+Mt)/rr,(_i+Ft)/rr);hr.z=So/rr,ue.push(hr);const pr=new A(zr/Io,Hr/Io);pr.z=Eo/Io,ne.push(pr)}Tt.push(ue),_t.push(ne)}return[Tt,_t]}(m,F,D,T);return function(Y,tt,ct){let ft=1/0;r0(ct,tt)&&(ft=L0(ct,tt[0]));for(let Tt=0;Ttc.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(c=>{this.gradients[c.id]={}}),this.layoutVertexArray=new qe,this.layoutVertexArray2=new Me,this.indexArray=new Rr,this.programConfigurations=new Ma(o.layers,o.zoom),this.segments=new hi,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,f){this.hasPattern=c_("line",this.layers,c);const m=this.layers[0].layout.get("line-sort-key"),v=!m.isConstant(),w=[];for(const{feature:E,id:T,index:P,sourceLayerIndex:D}of o){const F=this.layers[0]._featureFilter.needGeometry,U=pc(E,F);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom),U,f))continue;const W=v?m.evaluate(U,{},f):void 0,Y={id:T,properties:E.properties,type:E.type,sourceLayerIndex:D,index:P,geometry:F?U.geometry:hc(E),patterns:{},sortKey:W};w.push(Y)}v&&w.sort((E,T)=>E.sortKey-T.sortKey);for(const E of w){const{geometry:T,index:P,sourceLayerIndex:D}=E;if(this.hasPattern){const F=h_("line",this.layers,E,this.zoom,c);this.patternFeatures.push(F)}else this.addFeature(E,T,P,f,{});c.featureIndex.insert(o[P].feature,T,P,D,this.index)}}update(o,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,f)}addFeatures(o,c,f){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,c,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=o.createVertexBuffer(this.layoutVertexArray2,b2)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,y2),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(o){if(o.properties&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_end"))return{start:+o.properties.mapbox_clip_start,end:+o.properties.mapbox_clip_end}}addFeature(o,c,f,m,v){const w=this.layers[0].layout,E=w.get("line-join").evaluate(o,{}),T=w.get("line-cap"),P=w.get("line-miter-limit"),D=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const F of c)this.addLine(F,o,E,T,P,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,f,v,m)}addLine(o,c,f,m,v,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ft=0;ft=2&&o[T-1].equals(o[T-2]);)T--;let P=0;for(;P0;if(ye&&ft>P){const ae=U.dist(W);if(ae>2*D){const Se=U.sub(U.sub(W)._mult(D/ae)._round());this.updateDistance(W,Se),this.addCurrentVertex(Se,tt,0,0,F),W=Se}}const ge=W&&Y;let fe=ge?f:E?"butt":m;if(ge&&fe==="round"&&(Ftv&&(fe="bevel"),fe==="bevel"&&(Ft>2&&(fe="flipbevel"),Ft100)Tt=ct.mult(-1);else{const ae=Ft*tt.add(ct).mag()/tt.sub(ct).mag();Tt._perp()._mult(ae*(Le?-1:1))}this.addCurrentVertex(U,Tt,0,0,F),this.addCurrentVertex(U,Tt.mult(-1),0,0,F)}else if(fe==="bevel"||fe==="fakeround"){const ae=-Math.sqrt(Ft*Ft-1),Se=Le?ae:0,ue=Le?0:ae;if(W&&this.addCurrentVertex(U,tt,Se,ue,F),fe==="fakeround"){const ne=Math.round(180*Ht/Math.PI/20);for(let Fe=1;Fe2*D){const Se=U.add(Y.sub(U)._mult(D/ae)._round());this.updateDistance(U,Se),this.addCurrentVertex(Se,ct,0,0,F),U=Se}}}}addCurrentVertex(o,c,f,m,v,w=!1){const E=c.y*m-c.x,T=-c.y-c.x*m;this.addHalfVertex(o,c.x+c.y*f,c.y-c.x*f,w,!1,f,v),this.addHalfVertex(o,E,T,w,!0,-m,v),this.distance>M0/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,c,f,m,v,w))}addHalfVertex({x:o,y:c},f,m,v,w,E,T){const P=.5*(this.lineClips?this.scaledDistance*(M0-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(v?1:0),(c<<1)+(w?1:0),Math.round(63*f)+128,Math.round(63*m)+128,1+(E===0?0:E<0?-1:1)|(63&P)<<2,P>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const D=T.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,D),T.primitiveLength++),w?this.e2=D:this.e1=D}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(o,c){this.distance+=o.dist(c),this.updateScaledDistance()}}let P0,A0;xe("LineBucket",m_,{omit:["layers","patternFeatures"]});var k0={get paint(){return A0=A0||new Wi({"line-opacity":new je(jt.paint_line["line-opacity"]),"line-color":new je(jt.paint_line["line-color"]),"line-translate":new Ne(jt.paint_line["line-translate"]),"line-translate-anchor":new Ne(jt.paint_line["line-translate-anchor"]),"line-width":new je(jt.paint_line["line-width"]),"line-gap-width":new je(jt.paint_line["line-gap-width"]),"line-offset":new je(jt.paint_line["line-offset"]),"line-blur":new je(jt.paint_line["line-blur"]),"line-dasharray":new Xp(jt.paint_line["line-dasharray"]),"line-pattern":new lc(jt.paint_line["line-pattern"]),"line-gradient":new Hp(jt.paint_line["line-gradient"])})},get layout(){return P0=P0||new Wi({"line-cap":new Ne(jt.layout_line["line-cap"]),"line-join":new je(jt.layout_line["line-join"]),"line-miter-limit":new Ne(jt.layout_line["line-miter-limit"]),"line-round-limit":new Ne(jt.layout_line["line-round-limit"]),"line-sort-key":new je(jt.layout_line["line-sort-key"])})}};class S2 extends je{possiblyEvaluate(o,c){return c=new ci(Math.floor(c.zoom),{now:c.now,fadeDuration:c.fadeDuration,zoomHistory:c.zoomHistory,transition:c.transition}),super.possiblyEvaluate(o,c)}evaluate(o,c,f,m){return c=gt({},c,{zoom:Math.floor(c.zoom)}),super.evaluate(o,c,f,m)}}let mm;class E2 extends as{constructor(o){super(o,k0),this.gradientVersion=0,mm||(mm=new S2(k0.paint.properties["line-width"].specification),mm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){const c=this.gradientExpression();this.stepInterpolant=!!function(f){return f._styleExpression!==void 0}(c)&&c._styleExpression.expression instanceof Ja,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(o,c){super.recalculate(o,c),this.paint._values["line-floorwidth"]=mm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new m_(o)}queryRadius(o){const c=o,f=N0(nf("line-width",this,c),nf("line-gap-width",this,c)),m=nf("line-offset",this,c);return f/2+Math.abs(m)+lm(this.paint.get("line-translate"))}queryIntersectsFeature(o,c,f,m,v,w,E){const T=um(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,E),P=E/2*N0(this.paint.get("line-width").evaluate(c,f),this.paint.get("line-gap-width").evaluate(c,f)),D=this.paint.get("line-offset").evaluate(c,f);return D&&(m=function(F,U){const W=[];for(let Y=0;Y=3){for(let ct=0;ct0?o+2*l:l}const I2=Ei([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),C2=Ei([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ei([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const T2=Ei([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Ei([{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 D0=Ei([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),L2=Ei([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function M2(l,o,c){return l.sections.forEach(f=>{f.text=function(m,v,w){const E=v.layout.get("text-transform").evaluate(w,{});return E==="uppercase"?m=m.toLocaleUpperCase():E==="lowercase"&&(m=m.toLocaleLowerCase()),zo.applyArabicShaping&&(m=zo.applyArabicShaping(m)),m}(f.text,o,c)}),l}Ei([{name:"triangle",components:3,type:"Uint16"}]),Ei([{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"}]),Ei([{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"}]),Ei([{type:"Float32",name:"offsetX"}]),Ei([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Ei([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const pf={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ur=24,R0=ti,O0=function(l,o,c,f,m){var v,w,E=8*m-f-1,T=(1<>1,D=-7,F=c?m-1:0,U=c?-1:1,W=l[o+F];for(F+=U,v=W&(1<<-D)-1,W>>=-D,D+=E;D>0;v=256*v+l[o+F],F+=U,D-=8);for(w=v&(1<<-D)-1,v>>=-D,D+=f;D>0;w=256*w+l[o+F],F+=U,D-=8);if(v===0)v=1-P;else{if(v===T)return w?NaN:1/0*(W?-1:1);w+=Math.pow(2,f),v-=P}return(W?-1:1)*w*Math.pow(2,v-f)},z0=function(l,o,c,f,m,v){var w,E,T,P=8*v-m-1,D=(1<>1,U=m===23?Math.pow(2,-24)-Math.pow(2,-77):0,W=f?0:v-1,Y=f?1:-1,tt=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(E=isNaN(o)?1:0,w=D):(w=Math.floor(Math.log(o)/Math.LN2),o*(T=Math.pow(2,-w))<1&&(w--,T*=2),(o+=w+F>=1?U/T:U*Math.pow(2,1-F))*T>=2&&(w++,T/=2),w+F>=D?(E=0,w=D):w+F>=1?(E=(o*T-1)*Math.pow(2,m),w+=F):(E=o*Math.pow(2,F-1)*Math.pow(2,m),w=0));m>=8;l[c+W]=255&E,W+=Y,E/=256,m-=8);for(w=w<0;l[c+W]=255&w,W+=Y,w/=256,P-=8);l[c+W-Y]|=128*tt};function ti(l){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(l)?l:new Uint8Array(l||0),this.pos=0,this.type=0,this.length=this.buf.length}ti.Varint=0,ti.Fixed64=1,ti.Bytes=2,ti.Fixed32=5;var g_=4294967296,F0=1/g_,B0=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Dl(l){return l.type===ti.Bytes?l.readVarint()+l.pos:l.pos+1}function _h(l,o,c){return c?4294967296*o+(l>>>0):4294967296*(o>>>0)+(l>>>0)}function V0(l,o,c){var f=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));c.realloc(f);for(var m=c.pos-1;m>=l;m--)c.buf[m+f]=c.buf[m]}function P2(l,o){for(var c=0;c>>8,l[c+2]=o>>>16,l[c+3]=o>>>24}function U0(l,o){return(l[o]|l[o+1]<<8|l[o+2]<<16)+(l[o+3]<<24)}ti.prototype={destroy:function(){this.buf=null},readFields:function(l,o,c){for(c=c||this.length;this.pos>3,v=this.pos;this.type=7&f,l(m,o,this),this.pos===v&&this.skip(f)}return o},readMessage:function(l,o){return this.readFields(l,o,this.readVarint()+this.pos)},readFixed32:function(){var l=gm(this.buf,this.pos);return this.pos+=4,l},readSFixed32:function(){var l=U0(this.buf,this.pos);return this.pos+=4,l},readFixed64:function(){var l=gm(this.buf,this.pos)+gm(this.buf,this.pos+4)*g_;return this.pos+=8,l},readSFixed64:function(){var l=gm(this.buf,this.pos)+U0(this.buf,this.pos+4)*g_;return this.pos+=8,l},readFloat:function(){var l=O0(this.buf,this.pos,!0,23,4);return this.pos+=4,l},readDouble:function(){var l=O0(this.buf,this.pos,!0,52,8);return this.pos+=8,l},readVarint:function(l){var o,c,f=this.buf;return o=127&(c=f[this.pos++]),c<128?o:(o|=(127&(c=f[this.pos++]))<<7,c<128?o:(o|=(127&(c=f[this.pos++]))<<14,c<128?o:(o|=(127&(c=f[this.pos++]))<<21,c<128?o:function(m,v,w){var E,T,P=w.buf;if(E=(112&(T=P[w.pos++]))>>4,T<128||(E|=(127&(T=P[w.pos++]))<<3,T<128)||(E|=(127&(T=P[w.pos++]))<<10,T<128)||(E|=(127&(T=P[w.pos++]))<<17,T<128)||(E|=(127&(T=P[w.pos++]))<<24,T<128)||(E|=(1&(T=P[w.pos++]))<<31,T<128))return _h(m,E,v);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(c=f[this.pos]))<<28,l,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var l=this.readVarint();return l%2==1?(l+1)/-2:l/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var l=this.readVarint()+this.pos,o=this.pos;return this.pos=l,l-o>=12&&B0?function(c,f,m){return B0.decode(c.subarray(f,m))}(this.buf,o,l):function(c,f,m){for(var v="",w=f;w239?4:D>223?3:D>191?2:1;if(w+U>m)break;U===1?D<128&&(F=D):U===2?(192&(E=c[w+1]))==128&&(F=(31&D)<<6|63&E)<=127&&(F=null):U===3?(T=c[w+2],(192&(E=c[w+1]))==128&&(192&T)==128&&((F=(15&D)<<12|(63&E)<<6|63&T)<=2047||F>=55296&&F<=57343)&&(F=null)):U===4&&(T=c[w+2],P=c[w+3],(192&(E=c[w+1]))==128&&(192&T)==128&&(192&P)==128&&((F=(15&D)<<18|(63&E)<<12|(63&T)<<6|63&P)<=65535||F>=1114112)&&(F=null)),F===null?(F=65533,U=1):F>65535&&(F-=65536,v+=String.fromCharCode(F>>>10&1023|55296),F=56320|1023&F),v+=String.fromCharCode(F),w+=U}return v}(this.buf,o,l)},readBytes:function(){var l=this.readVarint()+this.pos,o=this.buf.subarray(this.pos,l);return this.pos=l,o},readPackedVarint:function(l,o){if(this.type!==ti.Bytes)return l.push(this.readVarint(o));var c=Dl(this);for(l=l||[];this.pos127;);else if(o===ti.Bytes)this.pos=this.readVarint()+this.pos;else if(o===ti.Fixed32)this.pos+=4;else{if(o!==ti.Fixed64)throw new Error("Unimplemented type: "+o);this.pos+=8}},writeTag:function(l,o){this.writeVarint(l<<3|o)},realloc:function(l){for(var o=this.length||16;o268435455||l<0?function(o,c){var f,m;if(o>=0?(f=o%4294967296|0,m=o/4294967296|0):(m=~(-o/4294967296),4294967295^(f=~(-o%4294967296))?f=f+1|0:(f=0,m=m+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");c.realloc(10),function(v,w,E){E.buf[E.pos++]=127&v|128,v>>>=7,E.buf[E.pos++]=127&v|128,v>>>=7,E.buf[E.pos++]=127&v|128,v>>>=7,E.buf[E.pos++]=127&v|128,E.buf[E.pos]=127&(v>>>=7)}(f,0,c),function(v,w){var E=(7&v)<<4;w.buf[w.pos++]|=E|((v>>>=3)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v)))))}(m,c)}(l,this):(this.realloc(4),this.buf[this.pos++]=127&l|(l>127?128:0),l<=127||(this.buf[this.pos++]=127&(l>>>=7)|(l>127?128:0),l<=127||(this.buf[this.pos++]=127&(l>>>=7)|(l>127?128:0),l<=127||(this.buf[this.pos++]=l>>>7&127))))},writeSVarint:function(l){this.writeVarint(l<0?2*-l-1:2*l)},writeBoolean:function(l){this.writeVarint(!!l)},writeString:function(l){l=String(l),this.realloc(4*l.length),this.pos++;var o=this.pos;this.pos=function(f,m,v){for(var w,E,T=0;T55295&&w<57344){if(!E){w>56319||T+1===m.length?(f[v++]=239,f[v++]=191,f[v++]=189):E=w;continue}if(w<56320){f[v++]=239,f[v++]=191,f[v++]=189,E=w;continue}w=E-55296<<10|w-56320|65536,E=null}else E&&(f[v++]=239,f[v++]=191,f[v++]=189,E=null);w<128?f[v++]=w:(w<2048?f[v++]=w>>6|192:(w<65536?f[v++]=w>>12|224:(f[v++]=w>>18|240,f[v++]=w>>12&63|128),f[v++]=w>>6&63|128),f[v++]=63&w|128)}return v}(this.buf,l,this.pos);var c=this.pos-o;c>=128&&V0(o,c,this),this.pos=o-1,this.writeVarint(c),this.pos+=c},writeFloat:function(l){this.realloc(4),z0(this.buf,l,this.pos,!0,23,4),this.pos+=4},writeDouble:function(l){this.realloc(8),z0(this.buf,l,this.pos,!0,52,8),this.pos+=8},writeBytes:function(l){var o=l.length;this.writeVarint(o),this.realloc(o);for(var c=0;c=128&&V0(c,f,this),this.pos=c-1,this.writeVarint(f),this.pos+=f},writeMessage:function(l,o,c){this.writeTag(l,ti.Bytes),this.writeRawMessage(o,c)},writePackedVarint:function(l,o){o.length&&this.writeMessage(l,P2,o)},writePackedSVarint:function(l,o){o.length&&this.writeMessage(l,A2,o)},writePackedBoolean:function(l,o){o.length&&this.writeMessage(l,D2,o)},writePackedFloat:function(l,o){o.length&&this.writeMessage(l,k2,o)},writePackedDouble:function(l,o){o.length&&this.writeMessage(l,N2,o)},writePackedFixed32:function(l,o){o.length&&this.writeMessage(l,R2,o)},writePackedSFixed32:function(l,o){o.length&&this.writeMessage(l,O2,o)},writePackedFixed64:function(l,o){o.length&&this.writeMessage(l,z2,o)},writePackedSFixed64:function(l,o){o.length&&this.writeMessage(l,F2,o)},writeBytesField:function(l,o){this.writeTag(l,ti.Bytes),this.writeBytes(o)},writeFixed32Field:function(l,o){this.writeTag(l,ti.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(l,o){this.writeTag(l,ti.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(l,o){this.writeTag(l,ti.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(l,o){this.writeTag(l,ti.Fixed64),this.writeSFixed64(o)},writeVarintField:function(l,o){this.writeTag(l,ti.Varint),this.writeVarint(o)},writeSVarintField:function(l,o){this.writeTag(l,ti.Varint),this.writeSVarint(o)},writeStringField:function(l,o){this.writeTag(l,ti.Bytes),this.writeString(o)},writeFloatField:function(l,o){this.writeTag(l,ti.Fixed32),this.writeFloat(o)},writeDoubleField:function(l,o){this.writeTag(l,ti.Fixed64),this.writeDouble(o)},writeBooleanField:function(l,o){this.writeVarintField(l,!!o)}};var __=x(R0);const y_=3;function B2(l,o,c){l===1&&c.readMessage(V2,o)}function V2(l,o,c){if(l===3){const{id:f,bitmap:m,width:v,height:w,left:E,top:T,advance:P}=c.readMessage(U2,{});o.push({id:f,bitmap:new of({width:v+2*y_,height:w+2*y_},m),metrics:{width:v,height:w,left:E,top:T,advance:P}})}}function U2(l,o,c){l===1?o.id=c.readVarint():l===2?o.bitmap=c.readBytes():l===3?o.width=c.readVarint():l===4?o.height=c.readVarint():l===5?o.left=c.readSVarint():l===6?o.top=c.readSVarint():l===7&&(o.advance=c.readVarint())}const G0=y_;function j0(l){let o=0,c=0;for(const w of l)o+=w.w*w.h,c=Math.max(c,w.w);l.sort((w,E)=>E.h-w.h);const f=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),c),h:1/0}];let m=0,v=0;for(const w of l)for(let E=f.length-1;E>=0;E--){const T=f[E];if(!(w.w>T.w||w.h>T.h)){if(w.x=T.x,w.y=T.y,v=Math.max(v,w.y+w.h),m=Math.max(m,w.x+w.w),w.w===T.w&&w.h===T.h){const P=f.pop();E=0&&f>=o&&ym[this.text.charCodeAt(f)];f--)c--;this.text=this.text.substring(o,c),this.sectionIndex=this.sectionIndex.slice(o,c)}substring(o,c){const f=new vh;return f.text=this.text.substring(o,c),f.sectionIndex=this.sectionIndex.slice(o,c),f.sections=this.sections,f}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((o,c)=>Math.max(o,this.sections[c].scale),0)}addTextSection(o,c){this.text+=o.text,this.sections.push(df.forText(o.scale,o.fontStack||c));const f=this.sections.length-1;for(let m=0;m=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function _m(l,o,c,f,m,v,w,E,T,P,D,F,U,W,Y,tt){const ct=vh.fromFeature(l,m);let ft;F===a.ai.vertical&&ct.verticalizePunctuation();const{processBidirectionalText:Tt,processStyledBidirectionalText:_t}=zo;if(Tt&&ct.sections.length===1){ft=[];const Ht=Tt(ct.toString(),b_(ct,P,v,o,f,W,Y));for(const ye of Ht){const Le=new vh;Le.text=ye,Le.sections=ct.sections;for(let ge=0;ge0&&Ol>Vo&&(Vo=Ol)}else{const Is=Le[wn.fontStack],Go=Is&&Is[Yr];if(Go&&Go.rect)Pa=Go.rect,Ks=Go.metrics;else{const Ol=ye[wn.fontStack],vf=Ol&&Ol[Yr];if(!vf)continue;Ks=vf.metrics}dr=(pr-wn.scale)*ur}Js?(Ht.verticalizable=!0,uo.push({glyph:Yr,imageName:Aa,x:pi,y:_i+dr,vertical:Js,scale:wn.scale,fontStack:wn.fontStack,sectionIndex:co,metrics:Ks,rect:Pa}),pi+=Rl*wn.scale+Fe):(uo.push({glyph:Yr,imageName:Aa,x:pi,y:_i+dr,vertical:Js,scale:wn.scale,fontStack:wn.fontStack,sectionIndex:co,metrics:Ks,rect:Pa}),pi+=Ks.advance*wn.scale+Fe)}uo.length!==0&&(cr=Math.max(pi-Fe,cr),q2(uo,0,uo.length-1,So,Vo)),pi=0;const Uo=ae*pr+Vo;Co.lineOffset=Math.max(Vo,lo),_i+=Uo,us=Math.max(Uo,us),++rr}var zr;const Hr=_i-ff,{horizontalAlign:Eo,verticalAlign:Io}=x_(Se);(function(hr,pr,lo,Co,uo,Vo,Uo,fr,wn){const co=(pr-lo)*uo;let Yr=0;Yr=Vo!==Uo?-fr*Co-ff:(-Co*wn+.5)*Uo;for(const dr of hr)for(const Ks of dr.positionedGlyphs)Ks.x+=co,Ks.y+=Yr})(Ht.positionedLines,So,Eo,Io,cr,us,ae,Hr,fe.length),Ht.top+=-Io*Hr,Ht.bottom=Ht.top+Hr,Ht.left+=-Eo*cr,Ht.right=Ht.left+cr}(Ft,o,c,f,ft,w,E,T,F,P,U,tt),!function(Ht){for(const ye of Ht)if(ye.positionedGlyphs.length!==0)return!1;return!0}(Mt)&&Ft}const ym={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},G2={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 Z0(l,o,c,f,m,v){if(o.imageName){const w=f[o.imageName];return w?w.displaySize[0]*o.scale*ur/v+m:0}{const w=c[o.fontStack],E=w&&w[l];return E?E.metrics.advance*o.scale+m:0}}function W0(l,o,c,f){const m=Math.pow(l-o,2);return f?l=0;let D=0;for(let U=0;Uw.id),this.index=o.index,this.pixelRatio=o.pixelRatio,this.sourceLayerIndex=o.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=n_([]),this.placementViewportMatrix=n_([]);const c=this.layers[0]._unevaluatedLayout._values;this.textSizeData=K0(this.zoom,c["text-size"]),this.iconSizeData=K0(this.zoom,c["icon-size"]);const f=this.layers[0].layout,m=f.get("symbol-sort-key"),v=f.get("symbol-z-order");this.canOverlap=w_(f,"text-overlap","text-allow-overlap")!=="never"||w_(f,"icon-overlap","icon-allow-overlap")!=="never"||f.get("text-ignore-placement")||f.get("icon-ignore-placement"),this.sortFeaturesByKey=v!=="viewport-y"&&!m.isConstant(),this.sortFeaturesByY=(v==="viewport-y"||v==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,f.get("symbol-placement")==="point"&&(this.writingModes=f.get("text-writing-mode").map(w=>a.ai[w])),this.stateDependentLayerIds=this.layers.filter(w=>w.isStateDependent()).map(w=>w.id),this.sourceID=o.sourceID}createArrays(){this.text=new E_(new Ma(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new E_(new Ma(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new Ct,this.lineVertexArray=new Bt,this.symbolInstances=new pt,this.textAnchorOffsets=new Wt}calculateGlyphDependencies(o,c,f,m,v){for(let w=0;w0)&&(w.value.kind!=="constant"||w.value.value.length>0),D=T.value.kind!=="constant"||!!T.value.value||Object.keys(T.parameters).length>0,F=v.get("symbol-sort-key");if(this.features=[],!P&&!D)return;const U=c.iconDependencies,W=c.glyphDependencies,Y=c.availableImages,tt=new ci(this.zoom);for(const{feature:ct,id:ft,index:Tt,sourceLayerIndex:_t}of o){const Mt=m._featureFilter.needGeometry,Ft=pc(ct,Mt);if(!m._featureFilter.filter(tt,Ft,f))continue;let Ht,ye;if(Mt||(Ft.geometry=hc(ct)),P){const ge=m.getValueAndResolveTokens("text-field",Ft,f,Y),fe=Zr.factory(ge);H2(fe)&&(this.hasRTLText=!0),(!this.hasRTLText||Zp()==="unavailable"||this.hasRTLText&&zo.isParsed())&&(Ht=M2(fe,m,Ft))}if(D){const ge=m.getValueAndResolveTokens("icon-image",Ft,f,Y);ye=ge instanceof Dr?ge:Dr.fromString(ge)}if(!Ht&&!ye)continue;const Le=this.sortFeaturesByKey?F.evaluate(Ft,{},f):void 0;if(this.features.push({id:ft,text:Ht,icon:ye,index:Tt,sourceLayerIndex:_t,geometry:Ft.geometry,properties:ct.properties,type:W2[ct.type],sortKey:Le}),ye&&(U[ye.name]=!0),Ht){const ge=w.evaluate(Ft,{},f).join(","),fe=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.ai.vertical)>=0;for(const ae of Ht.sections)if(ae.image)U[ae.image.name]=!0;else{const Se=zp(Ht.toString()),ue=ae.fontStack||ge,ne=W[ue]=W[ue]||{};this.calculateGlyphDependencies(ae.text,ne,fe,this.allowVerticalPlacement,Se)}}}v.get("symbol-placement")==="line"&&(this.features=function(ct){const ft={},Tt={},_t=[];let Mt=0;function Ft(ge){_t.push(ct[ge]),Mt++}function Ht(ge,fe,ae){const Se=Tt[ge];return delete Tt[ge],Tt[fe]=Se,_t[Se].geometry[0].pop(),_t[Se].geometry[0]=_t[Se].geometry[0].concat(ae[0]),Se}function ye(ge,fe,ae){const Se=ft[fe];return delete ft[fe],ft[ge]=Se,_t[Se].geometry[0].shift(),_t[Se].geometry[0]=ae[0].concat(_t[Se].geometry[0]),Se}function Le(ge,fe,ae){const Se=ae?fe[0][fe[0].length-1]:fe[0][0];return`${ge}:${Se.x}:${Se.y}`}for(let ge=0;gege.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ct,ft)=>ct.sortKey-ft.sortKey)}update(o,c,f){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,c,this.layers,f),this.icon.programConfigurations.updatePaintArrays(o,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(o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(o),this.iconCollisionBox.upload(o)),this.text.upload(o,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(o,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(o,c){const f=this.lineVertexArray.length;if(o.segment!==void 0){let m=o.dist(c[o.segment+1]),v=o.dist(c[o.segment]);const w={};for(let E=o.segment+1;E=0;E--)w[E]={x:c[E].x,y:c[E].y,tileUnitDistanceFromAnchor:v},E>0&&(v+=c[E-1].dist(c[E]));for(let E=0;E0}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(o,c){const f=o.placedSymbolArray.get(c),m=f.vertexStartIndex+4*f.numGlyphs;for(let v=f.vertexStartIndex;vm[E]-m[T]||v[T]-v[E]),w}addToSortKeyRanges(o,c){const f=this.sortKeyRanges[this.sortKeyRanges.length-1];f&&f.sortKey===c?f.symbolInstanceEnd=o+1:this.sortKeyRanges.push({sortKey:c,symbolInstanceStart:o,symbolInstanceEnd:o+1})}sortFeatures(o){if(this.sortFeaturesByY&&this.sortedAngle!==o&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(o),this.sortedAngle=o,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((m,v,w)=>{m>=0&&w.indexOf(m)===v&&this.addIndicesForPlacedSymbol(this.text,m)}),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 J0,Q0;xe("SymbolBucket",bh,{omit:["layers","collisionBoxArray","features","compareText"]}),bh.MAX_GLYPHS=65535,bh.addDynamicAttributes=S_;var C_={get paint(){return Q0=Q0||new Wi({"icon-opacity":new je(jt.paint_symbol["icon-opacity"]),"icon-color":new je(jt.paint_symbol["icon-color"]),"icon-halo-color":new je(jt.paint_symbol["icon-halo-color"]),"icon-halo-width":new je(jt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new je(jt.paint_symbol["icon-halo-blur"]),"icon-translate":new Ne(jt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ne(jt.paint_symbol["icon-translate-anchor"]),"text-opacity":new je(jt.paint_symbol["text-opacity"]),"text-color":new je(jt.paint_symbol["text-color"],{runtimeType:kr,getOverride:l=>l.textColor,hasOverride:l=>!!l.textColor}),"text-halo-color":new je(jt.paint_symbol["text-halo-color"]),"text-halo-width":new je(jt.paint_symbol["text-halo-width"]),"text-halo-blur":new je(jt.paint_symbol["text-halo-blur"]),"text-translate":new Ne(jt.paint_symbol["text-translate"]),"text-translate-anchor":new Ne(jt.paint_symbol["text-translate-anchor"])})},get layout(){return J0=J0||new Wi({"symbol-placement":new Ne(jt.layout_symbol["symbol-placement"]),"symbol-spacing":new Ne(jt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ne(jt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new je(jt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ne(jt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ne(jt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ne(jt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ne(jt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ne(jt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ne(jt.layout_symbol["icon-rotation-alignment"]),"icon-size":new je(jt.layout_symbol["icon-size"]),"icon-text-fit":new Ne(jt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ne(jt.layout_symbol["icon-text-fit-padding"]),"icon-image":new je(jt.layout_symbol["icon-image"]),"icon-rotate":new je(jt.layout_symbol["icon-rotate"]),"icon-padding":new je(jt.layout_symbol["icon-padding"]),"icon-keep-upright":new Ne(jt.layout_symbol["icon-keep-upright"]),"icon-offset":new je(jt.layout_symbol["icon-offset"]),"icon-anchor":new je(jt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ne(jt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ne(jt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ne(jt.layout_symbol["text-rotation-alignment"]),"text-field":new je(jt.layout_symbol["text-field"]),"text-font":new je(jt.layout_symbol["text-font"]),"text-size":new je(jt.layout_symbol["text-size"]),"text-max-width":new je(jt.layout_symbol["text-max-width"]),"text-line-height":new Ne(jt.layout_symbol["text-line-height"]),"text-letter-spacing":new je(jt.layout_symbol["text-letter-spacing"]),"text-justify":new je(jt.layout_symbol["text-justify"]),"text-radial-offset":new je(jt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ne(jt.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new je(jt.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new je(jt.layout_symbol["text-anchor"]),"text-max-angle":new Ne(jt.layout_symbol["text-max-angle"]),"text-writing-mode":new Ne(jt.layout_symbol["text-writing-mode"]),"text-rotate":new je(jt.layout_symbol["text-rotate"]),"text-padding":new Ne(jt.layout_symbol["text-padding"]),"text-keep-upright":new Ne(jt.layout_symbol["text-keep-upright"]),"text-transform":new je(jt.layout_symbol["text-transform"]),"text-offset":new je(jt.layout_symbol["text-offset"]),"text-allow-overlap":new Ne(jt.layout_symbol["text-allow-overlap"]),"text-overlap":new Ne(jt.layout_symbol["text-overlap"]),"text-ignore-placement":new Ne(jt.layout_symbol["text-ignore-placement"]),"text-optional":new Ne(jt.layout_symbol["text-optional"])})}};class $0{constructor(o){if(o.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=o.property.overrides?o.property.overrides.runtimeType:xs,this.defaultValue=o}evaluate(o){if(o.formattedSection){const c=this.defaultValue.property.overrides;if(c&&c.hasOverride(o.formattedSection))return c.getOverride(o.formattedSection)}return o.feature&&o.featureState?this.defaultValue.evaluate(o.feature,o.featureState):this.defaultValue.property.specification.default}eachChild(o){this.defaultValue.isConstant()||o(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}xe("FormatSectionOverride",$0,{omit:["defaultValue"]});class bm extends as{constructor(o){super(o,C_)}recalculate(o,c){if(super.recalculate(o,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 m=[];for(const v of f)m.indexOf(v)<0&&m.push(v);this.layout._values["text-writing-mode"]=m}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,c,f,m){const v=this.layout.get(o).evaluate(c,{},f,m),w=this._unevaluatedLayout._values[o];return w.isDataDriven()||th(w.value)||!v?v:function(E,T){return T.replace(/{([^{}]+)}/g,(P,D)=>E&&D in E?String(E[D]):"")}(c.properties,v)}createBucket(o){return new bh(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of C_.paint.overridableProperties){if(!bm.hasPaintOverride(this.layout,o))continue;const c=this.paint.get(o),f=new $0(c),m=new Ap(f,c.property.specification);let v=null;v=c.value.kind==="constant"||c.value.kind==="source"?new kp("source",m):new nh("composite",m,c.value.zoomStops),this.paint._values[o]=new so(c.property,v,c.parameters)}}_handleOverridablePaintPropertyUpdate(o,c,f){return!(!this.layout||c.isDataDriven()||f.isDataDriven())&&bm.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,c){const f=o.get("text-field"),m=C_.paint.properties[c];let v=!1;const w=E=>{for(const T of E)if(m.overrides&&m.overrides.hasOverride(T))return void(v=!0)};if(f.value.kind==="constant"&&f.value.value instanceof Zr)w(f.value.value.sections);else if(f.value.kind==="source"){const E=P=>{v||(P instanceof wl&&xi(P.value)===st?w(P.value.sections):P instanceof $c?w(P.sections):P.eachChild(E))},T=f.value;T._styleExpression&&E(T._styleExpression.expression)}return v}}let tv;var Y2={get paint(){return tv=tv||new Wi({"background-color":new Ne(jt.paint_background["background-color"]),"background-pattern":new Xp(jt.paint_background["background-pattern"]),"background-opacity":new Ne(jt.paint_background["background-opacity"])})}};class K2 extends as{constructor(o){super(o,Y2)}}let ev;var J2={get paint(){return ev=ev||new Wi({"raster-opacity":new Ne(jt.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ne(jt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ne(jt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ne(jt.paint_raster["raster-brightness-max"]),"raster-saturation":new Ne(jt.paint_raster["raster-saturation"]),"raster-contrast":new Ne(jt.paint_raster["raster-contrast"]),"raster-resampling":new Ne(jt.paint_raster["raster-resampling"]),"raster-fade-duration":new Ne(jt.paint_raster["raster-fade-duration"])})}};class Q2 extends as{constructor(o){super(o,J2)}}class $2 extends as{constructor(o){super(o,{}),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=o}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 tS{constructor(o){this._callback=o,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const T_=63710088e-1;class wu{constructor(o,c){if(isNaN(o)||isNaN(c))throw new Error(`Invalid LngLat object: (${o}, ${c})`);if(this.lng=+o,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 wu(ut(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){const c=Math.PI/180,f=this.lat*c,m=o.lat*c,v=Math.sin(f)*Math.sin(m)+Math.cos(f)*Math.cos(m)*Math.cos((o.lng-this.lng)*c);return T_*Math.acos(Math.min(v,1))}static convert(o){if(o instanceof wu)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new wu(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new wu(Number("lng"in o?o.lng:o.lon),Number(o.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 nv=2*Math.PI*T_;function iv(l){return nv*Math.cos(l*Math.PI/180)}function rv(l){return(180+l)/360}function ov(l){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l*Math.PI/360)))/360}function sv(l,o){return l/iv(o)}function av(l){return 360*l-180}function L_(l){return 360/Math.PI*Math.atan(Math.exp((180-360*l)*Math.PI/180))-90}class xm{constructor(o,c,f=0){this.x=+o,this.y=+c,this.z=+f}static fromLngLat(o,c=0){const f=wu.convert(o);return new xm(rv(f.lng),ov(f.lat),sv(c,f.lat))}toLngLat(){return new wu(av(this.x),L_(this.y))}toAltitude(){return this.z*iv(L_(this.y))}meterInMercatorCoordinateUnits(){return 1/nv*(o=L_(this.y),1/Math.cos(o*Math.PI/180));var o}}function lv(l,o,c){var f=2*Math.PI*6378137/256/Math.pow(2,c);return[l*f-2*Math.PI*6378137/2,o*f-2*Math.PI*6378137/2]}class M_{constructor(o,c,f){if(o<0||o>25||f<0||f>=Math.pow(2,o)||c<0||c>=Math.pow(2,o))throw new Error(`x=${c}, y=${f}, z=${o} outside of bounds. 0<=x<${Math.pow(2,o)}, 0<=y<${Math.pow(2,o)} 0<=z<=25 `);this.z=o,this.x=c,this.y=f,this.key=gf(0,o,o,c,f)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,c,f){const m=(w=this.y,E=this.z,T=lv(256*(v=this.x),256*(w=Math.pow(2,E)-w-1),E),P=lv(256*(v+1),256*(w+1),E),T[0]+","+T[1]+","+P[0]+","+P[1]);var v,w,E,T,P;const D=function(F,U,W){let Y,tt="";for(let ct=F;ct>0;ct--)Y=1<1?"@2x":"").replace(/{quadkey}/g,D).replace(/{bbox-epsg-3857}/g,m)}isChildOf(o){const c=this.z-o.z;return c>0&&o.x===this.x>>c&&o.y===this.y>>c}getTilePoint(o){const c=Math.pow(2,this.z);return new A((o.x*c-this.x)*ir,(o.y*c-this.y)*ir)}toString(){return`${this.z}/${this.x}/${this.y}`}}class uv{constructor(o,c){this.wrap=o,this.canonical=c,this.key=gf(o,c.z,c.z,c.x,c.y)}}class Es{constructor(o,c,f,m,v){if(o= z; overscaledZ = ${o}; z = ${f}`);this.overscaledZ=o,this.wrap=c,this.canonical=new M_(f,+m,+v),this.key=gf(c,o,f,m,v)}clone(){return new Es(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(o){return this.overscaledZ===o.overscaledZ&&this.wrap===o.wrap&&this.canonical.equals(o.canonical)}scaledTo(o){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const c=this.canonical.z-o;return o>this.canonical.z?new Es(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Es(o,this.wrap,o,this.canonical.x>>c,this.canonical.y>>c)}calculateScaledKey(o,c){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const f=this.canonical.z-o;return o>this.canonical.z?gf(this.wrap*+c,o,this.canonical.z,this.canonical.x,this.canonical.y):gf(this.wrap*+c,o,o,this.canonical.x>>f,this.canonical.y>>f)}isChildOf(o){if(o.wrap!==this.wrap)return!1;const c=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ>c&&o.canonical.y===this.canonical.y>>c}children(o){if(this.overscaledZ>=o)return[new Es(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,m=2*this.canonical.y;return[new Es(c,this.wrap,c,f,m),new Es(c,this.wrap,c,f+1,m),new Es(c,this.wrap,c,f,m+1),new Es(c,this.wrap,c,f+1,m+1)]}isLessThan(o){return this.wrapo.wrap)&&(this.overscaledZo.overscaledZ)&&(this.canonical.xo.canonical.x)&&this.canonical.ythis.max&&(this.max=F),F=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+(o+1)}unpack(o,c,f){return o*this.redFactor+c*this.greenFactor+f*this.blueFactor-this.baseShift}getPixels(){return new Ss({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,c,f){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let m=c*this.dim,v=c*this.dim+this.dim,w=f*this.dim,E=f*this.dim+this.dim;switch(c){case-1:m=v-1;break;case 1:v=m+1}switch(f){case-1:w=E-1;break;case 1:E=w+1}const T=-c*this.dim,P=-f*this.dim;for(let D=w;D=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${o} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[o]}}class pv{constructor(o,c,f,m,v){this.type="Feature",this._vectorTileFeature=o,o._z=c,o._x=f,o._y=m,this.properties=o.properties,this.id=v}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(o){this._geometry=o}toJSON(){const o={geometry:this.geometry};for(const c in this)c!=="_geometry"&&c!=="_vectorTileFeature"&&(o[c]=this[c]);return o}}class fv{constructor(o,c){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new du(ir,16,0),this.grid3D=new du(ir,16,0),this.featureIndexArray=new Kt,this.promoteId=c}insert(o,c,f,m,v,w){const E=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(f,m,v);const T=w?this.grid3D:this.grid;for(let P=0;P=0&&F[3]>=0&&T.insert(E,F[0],F[1],F[2],F[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new vu.VectorTile(new __(this.rawTileData)).layers,this.sourceLayerCoder=new hv(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,c,f,m){this.loadVTLayers();const v=o.params||{},w=ir/o.tileSize/o.scale,E=Dp(v.filter),T=o.queryGeometry,P=o.queryPadding*w,D=mv(T),F=this.grid.query(D.minX-P,D.minY-P,D.maxX+P,D.maxY+P),U=mv(o.cameraQueryGeometry),W=this.grid3D.query(U.minX-P,U.minY-P,U.maxX+P,U.maxY+P,(ct,ft,Tt,_t)=>function(Mt,Ft,Ht,ye,Le){for(const fe of Mt)if(Ft<=fe.x&&Ht<=fe.y&&ye>=fe.x&&Le>=fe.y)return!0;const ge=[new A(Ft,Ht),new A(Ft,Le),new A(ye,Le),new A(ye,Ht)];if(Mt.length>2){for(const fe of ge)if(fh(Mt,fe))return!0}for(let fe=0;fe(_t||(_t=hc(Mt)),Ft.queryIntersectsFeature(T,Mt,Ht,_t,this.z,o.transform,w,o.pixelPosMatrix)))}return Y}loadMatchingFeature(o,c,f,m,v,w,E,T,P,D,F){const U=this.bucketLayerIDs[c];if(w&&!function(ct,ft){for(let Tt=0;Tt=0)return!0;return!1}(w,U))return;const W=this.sourceLayerCoder.decode(f),Y=this.vtLayers[W].feature(m);if(v.needGeometry){const ct=pc(Y,!0);if(!v.filter(new ci(this.tileID.overscaledZ),ct,this.tileID.canonical))return}else if(!v.filter(new ci(this.tileID.overscaledZ),Y))return;const tt=this.getId(Y,W);for(let ct=0;ct{const E=o instanceof hh?o.get(w):null;return E&&E.evaluate?E.evaluate(c,f,m):E})}function mv(l){let o=1/0,c=1/0,f=-1/0,m=-1/0;for(const v of l)o=Math.min(o,v.x),c=Math.min(c,v.y),f=Math.max(f,v.x),m=Math.max(m,v.y);return{minX:o,minY:c,maxX:f,maxY:m}}function eS(l,o){return o-l}function gv(l,o,c,f,m){const v=[];for(let w=0;w=f&&F.x>=f||(D.x>=f?D=new A(f,D.y+(f-D.x)/(F.x-D.x)*(F.y-D.y))._round():F.x>=f&&(F=new A(f,D.y+(f-D.x)/(F.x-D.x)*(F.y-D.y))._round()),D.y>=m&&F.y>=m||(D.y>=m?D=new A(D.x+(m-D.y)/(F.y-D.y)*(F.x-D.x),m)._round():F.y>=m&&(F=new A(D.x+(m-D.y)/(F.y-D.y)*(F.x-D.x),m)._round()),T&&D.equals(T[T.length-1])||(T=[D],v.push(T)),T.push(F)))))}}return v}xe("FeatureIndex",fv,{omit:["rawTileData","sourceLayerCoder"]});class Su extends A{constructor(o,c,f,m){super(o,c),this.angle=f,m!==void 0&&(this.segment=m)}clone(){return new Su(this.x,this.y,this.angle,this.segment)}}function _v(l,o,c,f,m){if(o.segment===void 0||c===0)return!0;let v=o,w=o.segment+1,E=0;for(;E>-c/2;){if(w--,w<0)return!1;E-=l[w].dist(v),v=l[w]}E+=l[w].dist(l[w+1]),w++;const T=[];let P=0;for(;Ef;)P-=T.shift().angleDelta;if(P>m)return!1;w++,E+=D.dist(F)}return!0}function yv(l){let o=0;for(let c=0;cP){const Y=(P-T)/W,tt=Do.number(F.x,U.x,Y),ct=Do.number(F.y,U.y,Y),ft=new Su(tt,ct,U.angleTo(F),D);return ft._round(),!w||_v(l,ft,E,w,o)?ft:void 0}T+=W}}function iS(l,o,c,f,m,v,w,E,T){const P=vv(f,v,w),D=bv(f,m),F=D*w,U=l[0].x===0||l[0].x===T||l[0].y===0||l[0].y===T;return o-F=0&&Mt=0&&Ft=0&&U+P<=D){const Ht=new Su(Mt,Ft,Tt,Y);Ht._round(),f&&!_v(l,Ht,v,f,m)||W.push(Ht)}}F+=ft}return E||W.length||w||(W=xv(l,F/2,c,f,m,v,w,!0,T)),W}xe("Anchor",Su);const xh=Bo;function wv(l,o,c,f){const m=[],v=l.image,w=v.pixelRatio,E=v.paddedRect.w-2*xh,T=v.paddedRect.h-2*xh,P=l.right-l.left,D=l.bottom-l.top,F=v.stretchX||[[0,E]],U=v.stretchY||[[0,T]],W=(ae,Se)=>ae+Se[1]-Se[0],Y=F.reduce(W,0),tt=U.reduce(W,0),ct=E-Y,ft=T-tt;let Tt=0,_t=Y,Mt=0,Ft=tt,Ht=0,ye=ct,Le=0,ge=ft;if(v.content&&f){const ae=v.content;Tt=wm(F,0,ae[0]),Mt=wm(U,0,ae[1]),_t=wm(F,ae[0],ae[2]),Ft=wm(U,ae[1],ae[3]),Ht=ae[0]-Tt,Le=ae[1]-Mt,ye=ae[2]-ae[0]-_t,ge=ae[3]-ae[1]-Ft}const fe=(ae,Se,ue,ne)=>{const Fe=Sm(ae.stretch-Tt,_t,P,l.left),Ae=Em(ae.fixed-Ht,ye,ae.stretch,Y),gn=Sm(Se.stretch-Mt,Ft,D,l.top),pi=Em(Se.fixed-Le,ge,Se.stretch,tt),_i=Sm(ue.stretch-Tt,_t,P,l.left),cr=Em(ue.fixed-Ht,ye,ue.stretch,Y),us=Sm(ne.stretch-Mt,Ft,D,l.top),So=Em(ne.fixed-Le,ge,ne.stretch,tt),rr=new A(Fe,gn),zr=new A(_i,gn),Hr=new A(_i,us),Eo=new A(Fe,us),Io=new A(Ae/w,pi/w),hr=new A(cr/w,So/w),pr=o*Math.PI/180;if(pr){const uo=Math.sin(pr),Vo=Math.cos(pr),Uo=[Vo,-uo,uo,Vo];rr._matMult(Uo),zr._matMult(Uo),Eo._matMult(Uo),Hr._matMult(Uo)}const lo=ae.stretch+ae.fixed,Co=Se.stretch+Se.fixed;return{tl:rr,tr:zr,bl:Eo,br:Hr,tex:{x:v.paddedRect.x+xh+lo,y:v.paddedRect.y+xh+Co,w:ue.stretch+ue.fixed-lo,h:ne.stretch+ne.fixed-Co},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Io,pixelOffsetBR:hr,minFontScaleX:ye/w/P,minFontScaleY:ge/w/D,isSDF:c}};if(f&&(v.stretchX||v.stretchY)){const ae=Sv(F,ct,Y),Se=Sv(U,ft,tt);for(let ue=0;ue0&&(Y=Math.max(10,Y),this.circleDiameter=Y)}else{let F=w.top*E-T[0],U=w.bottom*E+T[2],W=w.left*E-T[3],Y=w.right*E+T[1];const tt=w.collisionPadding;if(tt&&(W-=tt[0]*E,F-=tt[1]*E,Y+=tt[2]*E,U+=tt[3]*E),D){const ct=new A(W,F),ft=new A(Y,F),Tt=new A(W,U),_t=new A(Y,U),Mt=D*Math.PI/180;ct._rotate(Mt),ft._rotate(Mt),Tt._rotate(Mt),_t._rotate(Mt),W=Math.min(ct.x,ft.x,Tt.x,_t.x),Y=Math.max(ct.x,ft.x,Tt.x,_t.x),F=Math.min(ct.y,ft.y,Tt.y,_t.y),U=Math.max(ct.y,ft.y,Tt.y,_t.y)}o.emplaceBack(c.x,c.y,W,F,Y,U,f,m,v)}this.boxEndIndex=o.length}}class rS{constructor(o=[],c=oS){if(this.data=o,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(o){this.data.push(o),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const o=this.data[0],c=this.data.pop();return this.length--,this.length>0&&(this.data[0]=c,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:c,compare:f}=this,m=c[o];for(;o>0;){const v=o-1>>1,w=c[v];if(f(m,w)>=0)break;c[o]=w,o=v}c[o]=m}_down(o){const{data:c,compare:f}=this,m=this.length>>1,v=c[o];for(;o=0)break;c[o]=E,o=w}c[o]=v}}function oS(l,o){return lo?1:0}function sS(l,o=1,c=!1){let f=1/0,m=1/0,v=-1/0,w=-1/0;const E=l[0];for(let W=0;Wv)&&(v=Y.x),(!W||Y.y>w)&&(w=Y.y)}const T=Math.min(v-f,w-m);let P=T/2;const D=new rS([],aS);if(T===0)return new A(f,m);for(let W=f;WF.d||!F.d)&&(F=W,c&&console.log("found best %d after %d probes",Math.round(1e4*W.d)/1e4,U)),W.max-F.d<=o||(P=W.h/2,D.push(new wh(W.p.x-P,W.p.y-P,P,l)),D.push(new wh(W.p.x+P,W.p.y-P,P,l)),D.push(new wh(W.p.x-P,W.p.y+P,P,l)),D.push(new wh(W.p.x+P,W.p.y+P,P,l)),U+=4)}return c&&(console.log(`num probes: ${U}`),console.log(`best distance: ${F.d}`)),F.p}function aS(l,o){return o.max-l.max}function wh(l,o,c,f){this.p=new A(l,o),this.h=c,this.d=function(m,v){let w=!1,E=1/0;for(let T=0;Tm.y!=Y.y>m.y&&m.x<(Y.x-W.x)*(m.y-W.y)/(Y.y-W.y)+W.x&&(w=!w),E=Math.min(E,o0(m,W,Y))}}return(w?1:-1)*Math.sqrt(E)}(this.p,f),this.max=this.d+this.h*Math.SQRT2}var Xr;a.aq=void 0,(Xr=a.aq||(a.aq={}))[Xr.center=1]="center",Xr[Xr.left=2]="left",Xr[Xr.right=3]="right",Xr[Xr.top=4]="top",Xr[Xr.bottom=5]="bottom",Xr[Xr["top-left"]=6]="top-left",Xr[Xr["top-right"]=7]="top-right",Xr[Xr["bottom-left"]=8]="bottom-left",Xr[Xr["bottom-right"]=9]="bottom-right";const Eu=7,P_=Number.POSITIVE_INFINITY;function Ev(l,o){return o[1]!==P_?function(c,f,m){let v=0,w=0;switch(f=Math.abs(f),m=Math.abs(m),c){case"top-right":case"top-left":case"top":w=m-Eu;break;case"bottom-right":case"bottom-left":case"bottom":w=-m+Eu}switch(c){case"top-right":case"bottom-right":case"right":v=-f;break;case"top-left":case"bottom-left":case"left":v=f}return[v,w]}(l,o[0],o[1]):function(c,f){let m=0,v=0;f<0&&(f=0);const w=f/Math.SQRT2;switch(c){case"top-right":case"top-left":v=w-Eu;break;case"bottom-right":case"bottom-left":v=-w+Eu;break;case"bottom":v=-f+Eu;break;case"top":v=f-Eu}switch(c){case"top-right":case"bottom-right":m=-w;break;case"top-left":case"bottom-left":m=w;break;case"left":m=f;break;case"right":m=-f}return[m,v]}(l,o[0])}function Iv(l,o,c){var f;const m=l.layout,v=(f=m.get("text-variable-anchor-offset"))===null||f===void 0?void 0:f.evaluate(o,{},c);if(v){const E=v.values,T=[];for(let P=0;PU*ur);D.startsWith("top")?F[1]-=Eu:D.startsWith("bottom")&&(F[1]+=Eu),T[P+1]=F}return new is(T)}const w=m.get("text-variable-anchor");if(w){let E;E=l._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[m.get("text-radial-offset").evaluate(o,{},c)*ur,P_]:m.get("text-offset").evaluate(o,{},c).map(P=>P*ur);const T=[];for(const P of w)T.push(P,Ev(P,E));return new is(T)}return null}function A_(l){switch(l){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function lS(l,o,c,f,m,v,w,E,T,P,D){let F=v.textMaxSize.evaluate(o,{});F===void 0&&(F=w);const U=l.layers[0].layout,W=U.get("icon-offset").evaluate(o,{},D),Y=Tv(c.horizontal),tt=w/24,ct=l.tilePixelRatio*tt,ft=l.tilePixelRatio*F/24,Tt=l.tilePixelRatio*E,_t=l.tilePixelRatio*U.get("symbol-spacing"),Mt=U.get("text-padding")*l.tilePixelRatio,Ft=function(ne,Fe,Ae,gn=1){const pi=ne.get("icon-padding").evaluate(Fe,{},Ae),_i=pi&&pi.values;return[_i[0]*gn,_i[1]*gn,_i[2]*gn,_i[3]*gn]}(U,o,D,l.tilePixelRatio),Ht=U.get("text-max-angle")/180*Math.PI,ye=U.get("text-rotation-alignment")!=="viewport"&&U.get("symbol-placement")!=="point",Le=U.get("icon-rotation-alignment")==="map"&&U.get("symbol-placement")!=="point",ge=U.get("symbol-placement"),fe=_t/2,ae=U.get("icon-text-fit");let Se;f&&ae!=="none"&&(l.allowVerticalPlacement&&c.vertical&&(Se=Y0(f,c.vertical,ae,U.get("icon-text-fit-padding"),W,tt)),Y&&(f=Y0(f,Y,ae,U.get("icon-text-fit-padding"),W,tt)));const ue=(ne,Fe)=>{Fe.x<0||Fe.x>=ir||Fe.y<0||Fe.y>=ir||function(Ae,gn,pi,_i,cr,us,So,rr,zr,Hr,Eo,Io,hr,pr,lo,Co,uo,Vo,Uo,fr,wn,co,Yr,dr,Ks){const Pa=Ae.addToLineVertexArray(gn,pi);let Aa,Rl,Js,Is,Go=0,Ol=0,vf=0,Av=0,B_=-1,V_=-1;const zl={};let kv=Al("");if(Ae.allowVerticalPlacement&&_i.vertical){const ho=rr.layout.get("text-rotate").evaluate(wn,{},dr)+90;Js=new Im(zr,gn,Hr,Eo,Io,_i.vertical,hr,pr,lo,ho),So&&(Is=new Im(zr,gn,Hr,Eo,Io,So,uo,Vo,lo,ho))}if(cr){const ho=rr.layout.get("icon-rotate").evaluate(wn,{}),Cs=rr.layout.get("icon-text-fit")!=="none",dc=wv(cr,ho,Yr,Cs),Na=So?wv(So,ho,Yr,Cs):void 0;Rl=new Im(zr,gn,Hr,Eo,Io,cr,uo,Vo,!1,ho),Go=4*dc.length;const mc=Ae.iconSizeData;let il=null;mc.kind==="source"?(il=[nl*rr.layout.get("icon-size").evaluate(wn,{})],il[0]>xu&&Nt(`${Ae.layerIds[0]}: Value for "icon-size" is >= ${mf}. Reduce your "icon-size".`)):mc.kind==="composite"&&(il=[nl*co.compositeIconSizes[0].evaluate(wn,{},dr),nl*co.compositeIconSizes[1].evaluate(wn,{},dr)],(il[0]>xu||il[1]>xu)&&Nt(`${Ae.layerIds[0]}: Value for "icon-size" is >= ${mf}. Reduce your "icon-size".`)),Ae.addSymbols(Ae.icon,dc,il,fr,Uo,wn,a.ai.none,gn,Pa.lineStartIndex,Pa.lineLength,-1,dr),B_=Ae.icon.placedSymbolArray.length-1,Na&&(Ol=4*Na.length,Ae.addSymbols(Ae.icon,Na,il,fr,Uo,wn,a.ai.vertical,gn,Pa.lineStartIndex,Pa.lineLength,-1,dr),V_=Ae.icon.placedSymbolArray.length-1)}const Nv=Object.keys(_i.horizontal);for(const ho of Nv){const Cs=_i.horizontal[ho];if(!Aa){kv=Al(Cs.text);const Na=rr.layout.get("text-rotate").evaluate(wn,{},dr);Aa=new Im(zr,gn,Hr,Eo,Io,Cs,hr,pr,lo,Na)}const dc=Cs.positionedLines.length===1;if(vf+=Cv(Ae,gn,Cs,us,rr,lo,wn,Co,Pa,_i.vertical?a.ai.horizontal:a.ai.horizontalOnly,dc?Nv:[ho],zl,B_,co,dr),dc)break}_i.vertical&&(Av+=Cv(Ae,gn,_i.vertical,us,rr,lo,wn,Co,Pa,a.ai.vertical,["vertical"],zl,V_,co,dr));const hS=Aa?Aa.boxStartIndex:Ae.collisionBoxArray.length,pS=Aa?Aa.boxEndIndex:Ae.collisionBoxArray.length,fS=Js?Js.boxStartIndex:Ae.collisionBoxArray.length,dS=Js?Js.boxEndIndex:Ae.collisionBoxArray.length,mS=Rl?Rl.boxStartIndex:Ae.collisionBoxArray.length,gS=Rl?Rl.boxEndIndex:Ae.collisionBoxArray.length,_S=Is?Is.boxStartIndex:Ae.collisionBoxArray.length,yS=Is?Is.boxEndIndex:Ae.collisionBoxArray.length;let ka=-1;const Tm=(ho,Cs)=>ho&&ho.circleDiameter?Math.max(ho.circleDiameter,Cs):Cs;ka=Tm(Aa,ka),ka=Tm(Js,ka),ka=Tm(Rl,ka),ka=Tm(Is,ka);const Dv=ka>-1?1:0;Dv&&(ka*=Ks/ur),Ae.glyphOffsetArray.length>=bh.MAX_GLYPHS&&Nt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),wn.sortKey!==void 0&&Ae.addToSortKeyRanges(Ae.symbolInstances.length,wn.sortKey);const vS=Iv(rr,wn,dr),[bS,xS]=function(ho,Cs){const dc=ho.length,Na=Cs==null?void 0:Cs.values;if((Na==null?void 0:Na.length)>0)for(let mc=0;mc=0?zl.right:-1,zl.center>=0?zl.center:-1,zl.left>=0?zl.left:-1,zl.vertical||-1,B_,V_,kv,hS,pS,fS,dS,mS,gS,_S,yS,Hr,vf,Av,Go,Ol,Dv,0,hr,ka,bS,xS)}(l,Fe,ne,c,f,m,Se,l.layers[0],l.collisionBoxArray,o.index,o.sourceLayerIndex,l.index,ct,[Mt,Mt,Mt,Mt],ye,T,Tt,Ft,Le,W,o,v,P,D,w)};if(ge==="line")for(const ne of gv(o.geometry,0,0,ir,ir)){const Fe=iS(ne,_t,Ht,c.vertical||Y,f,24,ft,l.overscaling,ir);for(const Ae of Fe)Y&&uS(l,Y.text,fe,Ae)||ue(ne,Ae)}else if(ge==="line-center"){for(const ne of o.geometry)if(ne.length>1){const Fe=nS(ne,Ht,c.vertical||Y,f,24,ft);Fe&&ue(ne,Fe)}}else if(o.type==="Polygon")for(const ne of u_(o.geometry,0)){const Fe=sS(ne,16);ue(ne[0],new Su(Fe.x,Fe.y,0))}else if(o.type==="LineString")for(const ne of o.geometry)ue(ne,new Su(ne[0].x,ne[0].y,0));else if(o.type==="Point")for(const ne of o.geometry)for(const Fe of ne)ue([Fe],new Su(Fe.x,Fe.y,0))}function Cv(l,o,c,f,m,v,w,E,T,P,D,F,U,W,Y){const tt=function(Tt,_t,Mt,Ft,Ht,ye,Le,ge){const fe=Ft.layout.get("text-rotate").evaluate(ye,{})*Math.PI/180,ae=[];for(const Se of _t.positionedLines)for(const ue of Se.positionedGlyphs){if(!ue.rect)continue;const ne=ue.rect||{};let Fe=G0+1,Ae=!0,gn=1,pi=0;const _i=(Ht||ge)&&ue.vertical,cr=ue.metrics.advance*ue.scale/2;if(ge&&_t.verticalizable&&(pi=Se.lineOffset/2-(ue.imageName?-(ur-ue.metrics.width*ue.scale)/2:(ue.scale-1)*ur)),ue.imageName){const fr=Le[ue.imageName];Ae=fr.sdf,gn=fr.pixelRatio,Fe=Bo/gn}const us=Ht?[ue.x+cr,ue.y]:[0,0];let So=Ht?[0,0]:[ue.x+cr+Mt[0],ue.y+Mt[1]-pi],rr=[0,0];_i&&(rr=So,So=[0,0]);const zr=ue.metrics.isDoubleResolution?2:1,Hr=(ue.metrics.left-Fe)*ue.scale-cr+So[0],Eo=(-ue.metrics.top-Fe)*ue.scale+So[1],Io=Hr+ne.w/zr*ue.scale/gn,hr=Eo+ne.h/zr*ue.scale/gn,pr=new A(Hr,Eo),lo=new A(Io,Eo),Co=new A(Hr,hr),uo=new A(Io,hr);if(_i){const fr=new A(-cr,cr-ff),wn=-Math.PI/2,co=ur/2-cr,Yr=new A(5-ff-co,-(ue.imageName?co:0)),dr=new A(...rr);pr._rotateAround(wn,fr)._add(Yr)._add(dr),lo._rotateAround(wn,fr)._add(Yr)._add(dr),Co._rotateAround(wn,fr)._add(Yr)._add(dr),uo._rotateAround(wn,fr)._add(Yr)._add(dr)}if(fe){const fr=Math.sin(fe),wn=Math.cos(fe),co=[wn,-fr,fr,wn];pr._matMult(co),lo._matMult(co),Co._matMult(co),uo._matMult(co)}const Vo=new A(0,0),Uo=new A(0,0);ae.push({tl:pr,tr:lo,bl:Co,br:uo,tex:ne,writingMode:_t.writingMode,glyphOffset:us,sectionIndex:ue.sectionIndex,isSDF:Ae,pixelOffsetTL:Vo,pixelOffsetBR:Uo,minFontScaleX:0,minFontScaleY:0})}return ae}(0,c,E,m,v,w,f,l.allowVerticalPlacement),ct=l.textSizeData;let ft=null;ct.kind==="source"?(ft=[nl*m.layout.get("text-size").evaluate(w,{})],ft[0]>xu&&Nt(`${l.layerIds[0]}: Value for "text-size" is >= ${mf}. Reduce your "text-size".`)):ct.kind==="composite"&&(ft=[nl*W.compositeTextSizes[0].evaluate(w,{},Y),nl*W.compositeTextSizes[1].evaluate(w,{},Y)],(ft[0]>xu||ft[1]>xu)&&Nt(`${l.layerIds[0]}: Value for "text-size" is >= ${mf}. Reduce your "text-size".`)),l.addSymbols(l.text,tt,ft,E,v,w,P,o,T.lineStartIndex,T.lineLength,U,Y);for(const Tt of D)F[Tt]=l.text.placedSymbolArray.length-1;return 4*tt.length}function Tv(l){for(const o in l)return l[o];return null}function uS(l,o,c,f){const m=l.compareText;if(o in m){const v=m[o];for(let w=v.length-1;w>=0;w--)if(f.dist(v[w])>4;if(m!==1)throw new Error(`Got v${m} data when expected v1.`);const v=Lv[15&f];if(!v)throw new Error("Unrecognized array type.");const[w]=new Uint16Array(o,2,1),[E]=new Uint32Array(o,4,1);return new k_(E,w,v,o)}constructor(o,c=64,f=Float64Array,m){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+c,2),65535),this.ArrayType=f,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const v=Lv.indexOf(this.ArrayType),w=2*o*this.ArrayType.BYTES_PER_ELEMENT,E=o*this.IndexArrayType.BYTES_PER_ELEMENT,T=(8-E%8)%8;if(v<0)throw new Error(`Unexpected typed array class: ${f}.`);m&&m instanceof ArrayBuffer?(this.data=m,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+T,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+w+E+T),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+T,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+v]),new Uint16Array(this.data,2,1)[0]=c,new Uint32Array(this.data,4,1)[0]=o)}add(o,c){const f=this._pos>>1;return this.ids[f]=f,this.coords[this._pos++]=o,this.coords[this._pos++]=c,f}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return N_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,c,f,m){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:w,nodeSize:E}=this,T=[0,v.length-1,0],P=[];for(;T.length;){const D=T.pop()||0,F=T.pop()||0,U=T.pop()||0;if(F-U<=E){for(let ct=U;ct<=F;ct++){const ft=w[2*ct],Tt=w[2*ct+1];ft>=o&&ft<=f&&Tt>=c&&Tt<=m&&P.push(v[ct])}continue}const W=U+F>>1,Y=w[2*W],tt=w[2*W+1];Y>=o&&Y<=f&&tt>=c&&tt<=m&&P.push(v[W]),(D===0?o<=Y:c<=tt)&&(T.push(U),T.push(W-1),T.push(1-D)),(D===0?f>=Y:m>=tt)&&(T.push(W+1),T.push(F),T.push(1-D))}return P}within(o,c,f){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:m,coords:v,nodeSize:w}=this,E=[0,m.length-1,0],T=[],P=f*f;for(;E.length;){const D=E.pop()||0,F=E.pop()||0,U=E.pop()||0;if(F-U<=w){for(let ct=U;ct<=F;ct++)Pv(v[2*ct],v[2*ct+1],o,c)<=P&&T.push(m[ct]);continue}const W=U+F>>1,Y=v[2*W],tt=v[2*W+1];Pv(Y,tt,o,c)<=P&&T.push(m[W]),(D===0?o-f<=Y:c-f<=tt)&&(E.push(U),E.push(W-1),E.push(1-D)),(D===0?o+f>=Y:c+f>=tt)&&(E.push(W+1),E.push(F),E.push(1-D))}return T}}function N_(l,o,c,f,m,v){if(m-f<=c)return;const w=f+m>>1;Mv(l,o,w,f,m,v),N_(l,o,c,f,w-1,1-v),N_(l,o,c,w+1,m,1-v)}function Mv(l,o,c,f,m,v){for(;m>f;){if(m-f>600){const P=m-f+1,D=c-f+1,F=Math.log(P),U=.5*Math.exp(2*F/3),W=.5*Math.sqrt(F*U*(P-U)/P)*(D-P/2<0?-1:1);Mv(l,o,c,Math.max(f,Math.floor(c-D*U/P+W)),Math.min(m,Math.floor(c+(P-D)*U/P+W)),v)}const w=o[2*c+v];let E=f,T=m;for(_f(l,o,f,c),o[2*m+v]>w&&_f(l,o,f,m);Ew;)T--}o[2*f+v]===w?_f(l,o,f,T):(T++,_f(l,o,T,m)),T<=c&&(f=T+1),c<=T&&(m=T-1)}}function _f(l,o,c,f){D_(l,c,f),D_(o,2*c,2*f),D_(o,2*c+1,2*f+1)}function D_(l,o,c){const f=l[o];l[o]=l[c],l[c]=f}function Pv(l,o,c,f){const m=l-c,v=o-f;return m*m+v*v}var R_;a.bh=void 0,(R_=a.bh||(a.bh={})).create="create",R_.load="load",R_.fullLoad="fullLoad";let Cm=null,yf=[];const O_=1e3/60,z_="loadTime",F_="fullLoadTime",cS={mark(l){performance.mark(l)},frame(l){const o=l;Cm!=null&&yf.push(o-Cm),Cm=o},clearMetrics(){Cm=null,yf=[],performance.clearMeasures(z_),performance.clearMeasures(F_);for(const l in a.bh)performance.clearMarks(a.bh[l])},getPerformanceMetrics(){performance.measure(z_,a.bh.create,a.bh.load),performance.measure(F_,a.bh.create,a.bh.fullLoad);const l=performance.getEntriesByName(z_)[0].duration,o=performance.getEntriesByName(F_)[0].duration,c=yf.length,f=1/(yf.reduce((v,w)=>v+w,0)/c/1e3),m=yf.filter(v=>v>O_).reduce((v,w)=>v+(w-O_)/O_,0);return{loadTime:l,fullLoadTime:o,fps:f,percentDroppedFrames:m/(c+m)*100,totalFrames:c}}};a.$=function(l,o,c){var f,m,v,w,E,T,P,D,F,U,W,Y,tt=c[0],ct=c[1],ft=c[2];return o===l?(l[12]=o[0]*tt+o[4]*ct+o[8]*ft+o[12],l[13]=o[1]*tt+o[5]*ct+o[9]*ft+o[13],l[14]=o[2]*tt+o[6]*ct+o[10]*ft+o[14],l[15]=o[3]*tt+o[7]*ct+o[11]*ft+o[15]):(m=o[1],v=o[2],w=o[3],E=o[4],T=o[5],P=o[6],D=o[7],F=o[8],U=o[9],W=o[10],Y=o[11],l[0]=f=o[0],l[1]=m,l[2]=v,l[3]=w,l[4]=E,l[5]=T,l[6]=P,l[7]=D,l[8]=F,l[9]=U,l[10]=W,l[11]=Y,l[12]=f*tt+E*ct+F*ft+o[12],l[13]=m*tt+T*ct+U*ft+o[13],l[14]=v*tt+P*ct+W*ft+o[14],l[15]=w*tt+D*ct+Y*ft+o[15]),l},a.A=dh,a.B=Do,a.C=class{constructor(l,o,c){this.receive=f=>{const m=f.data,v=m.id;if(v&&(!m.targetMapId||this.mapId===m.targetMapId))if(m.type===""){delete this.tasks[v];const w=this.cancelCallbacks[v];delete this.cancelCallbacks[v],w&&w()}else we()||m.mustQueue?(this.tasks[v]=m,this.taskQueue.push(v),this.invoker.trigger()):this.processTask(v,m)},this.process=()=>{if(!this.taskQueue.length)return;const f=this.taskQueue.shift(),m=this.tasks[f];delete this.tasks[f],this.taskQueue.length&&this.invoker.trigger(),m&&this.processTask(f,m)},this.target=l,this.parent=o,this.mapId=c,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new tS(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=we()?l:window}send(l,o,c,f,m=!1){const v=Math.round(1e18*Math.random()).toString(36).substring(0,10);c&&(this.callbacks[v]=c);const w=[],E={id:v,type:l,hasCallback:!!c,targetMapId:f,mustQueue:m,sourceMapId:this.mapId,data:$a(o,w)};return this.target.postMessage(E,{transfer:w}),{cancel:()=>{c&&delete this.callbacks[v],this.target.postMessage({id:v,type:"",targetMapId:f,sourceMapId:this.mapId})}}}processTask(l,o){if(o.type===""){const c=this.callbacks[l];delete this.callbacks[l],c&&(o.error?c(mu(o.error)):c(null,mu(o.data)))}else{let c=!1;const f=[],m=o.hasCallback?(E,T)=>{c=!0,delete this.cancelCallbacks[l];const P={id:l,type:"",sourceMapId:this.mapId,error:E?$a(E):null,data:$a(T,f)};this.target.postMessage(P,{transfer:f})}:E=>{c=!0};let v=null;const w=mu(o.data);if(this.parent[o.type])v=this.parent[o.type](o.sourceMapId,w,m);else if("getWorkerSource"in this.parent){const E=o.type.split(".");v=this.parent.getWorkerSource(o.sourceMapId,E[0],w.source)[E[1]](w,m)}else m(new Error(`Could not find function ${o.type}`));!c&&v&&v.cancel&&(this.cancelCallbacks[l]=v.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.D=Ne,a.E=An,a.F=function(l,o){const c={};for(let f=0;f{}}},a.Y=se,a.Z=function(){var l=new dh(16);return dh!=Float32Array&&(l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[11]=0,l[12]=0,l[13]=0,l[14]=0),l[0]=1,l[5]=1,l[10]=1,l[15]=1,l},a._=_,a.a=Ye,a.a$=class extends q{},a.a0=function(l,o,c){var f=c[0],m=c[1],v=c[2];return l[0]=o[0]*f,l[1]=o[1]*f,l[2]=o[2]*f,l[3]=o[3]*f,l[4]=o[4]*m,l[5]=o[5]*m,l[6]=o[6]*m,l[7]=o[7]*m,l[8]=o[8]*v,l[9]=o[9]*v,l[10]=o[10]*v,l[11]=o[11]*v,l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15],l},a.a1=u0,a.a2=function(){return at++},a.a3=lt,a.a4=bh,a.a5=function(){zo.isLoading()||zo.isLoaded()||Zp()!=="deferred"||tm()},a.a6=Dp,a.a7=pc,a.a8=ci,a.a9=pv,a.aA=sc,a.aB=function(l){l=l.slice();const o=Object.create(null);for(let c=0;c{f[w.source]?c.push({command:En.removeLayer,args:[w.id]}):v.push(w)}),c=c.concat(m),function(w,E,T){E=E||[];const P=(w=w||[]).map(js),D=E.map(js),F=w.reduce(wa,{}),U=E.reduce(wa,{}),W=P.slice(),Y=Object.create(null);let tt,ct,ft,Tt,_t,Mt,Ft;for(tt=0,ct=0;tt@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(c,f,m,v)=>{const w=m||v;return o[f]=!w||w.toLowerCase(),""}),o["max-age"]){const c=parseInt(o["max-age"],10);isNaN(c)?delete o["max-age"]:o["max-age"]=c}return o},a.ab=function(l,o){const c=[];for(const f in l)f in o||c.push(f);return c},a.ac=function(l){if(me==null){const o=l.navigator?l.navigator.userAgent:null;me=!!l.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return me},a.ad=ht,a.ae=function(l,o,c){var f=Math.sin(c),m=Math.cos(c),v=o[0],w=o[1],E=o[2],T=o[3],P=o[4],D=o[5],F=o[6],U=o[7];return o!==l&&(l[8]=o[8],l[9]=o[9],l[10]=o[10],l[11]=o[11],l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15]),l[0]=v*m+P*f,l[1]=w*m+D*f,l[2]=E*m+F*f,l[3]=T*m+U*f,l[4]=P*m-v*f,l[5]=D*m-w*f,l[6]=F*m-E*f,l[7]=U*m-T*f,l},a.af=function(l){var o=new dh(16);return o[0]=l[0],o[1]=l[1],o[2]=l[2],o[3]=l[3],o[4]=l[4],o[5]=l[5],o[6]=l[6],o[7]=l[7],o[8]=l[8],o[9]=l[9],o[10]=l[10],o[11]=l[11],o[12]=l[12],o[13]=l[13],o[14]=l[14],o[15]=l[15],o},a.ag=cm,a.ah=function(l,o){let c=0,f=0;if(l.kind==="constant")f=l.layoutSize;else if(l.kind!=="source"){const{interpolationType:m,minZoom:v,maxZoom:w}=l,E=m?ht(Ro.interpolationFactor(m,o,v,w),0,1):0;l.kind==="camera"?f=Do.number(l.minSize,l.maxSize,E):c=E}return{uSizeT:c,uSize:f}},a.aj=function(l,{uSize:o,uSizeT:c},{lowerSize:f,upperSize:m}){return l.kind==="source"?f/nl:l.kind==="composite"?Do.number(f/nl,m/nl,c):o},a.ak=S_,a.al=function(l,o,c,f){const m=o.y-l.y,v=o.x-l.x,w=f.y-c.y,E=f.x-c.x,T=w*v-E*m;if(T===0)return null;const P=(E*(l.y-c.y)-w*(l.x-c.x))/T;return new A(l.x+P*v,l.y+P*m)},a.am=gv,a.an=i0,a.ao=n_,a.ap=ur,a.ar=w_,a.as=function(l,o){var c=o[0],f=o[1],m=o[2],v=o[3],w=o[4],E=o[5],T=o[6],P=o[7],D=o[8],F=o[9],U=o[10],W=o[11],Y=o[12],tt=o[13],ct=o[14],ft=o[15],Tt=c*E-f*w,_t=c*T-m*w,Mt=c*P-v*w,Ft=f*T-m*E,Ht=f*P-v*E,ye=m*P-v*T,Le=D*tt-F*Y,ge=D*ct-U*Y,fe=D*ft-W*Y,ae=F*ct-U*tt,Se=F*ft-W*tt,ue=U*ft-W*ct,ne=Tt*ue-_t*Se+Mt*ae+Ft*fe-Ht*ge+ye*Le;return ne?(l[0]=(E*ue-T*Se+P*ae)*(ne=1/ne),l[1]=(m*Se-f*ue-v*ae)*ne,l[2]=(tt*ye-ct*Ht+ft*Ft)*ne,l[3]=(U*Ht-F*ye-W*Ft)*ne,l[4]=(T*fe-w*ue-P*ge)*ne,l[5]=(c*ue-m*fe+v*ge)*ne,l[6]=(ct*Mt-Y*ye-ft*_t)*ne,l[7]=(D*ye-U*Mt+W*_t)*ne,l[8]=(w*Se-E*fe+P*Le)*ne,l[9]=(f*fe-c*Se-v*Le)*ne,l[10]=(Y*Ht-tt*Mt+ft*Tt)*ne,l[11]=(F*Mt-D*Ht-W*Tt)*ne,l[12]=(E*ge-w*ae-T*Le)*ne,l[13]=(c*ae-f*ge+m*Le)*ne,l[14]=(tt*_t-Y*Ft-ct*Tt)*ne,l[15]=(D*Ft-F*_t+U*Tt)*ne,l):null},a.at=A_,a.au=x_,a.av=k_,a.aw=function(){const l={},o=jt.$version;for(const c in jt.$root){const f=jt.$root[c];if(f.required){let m=null;m=c==="version"?o:f.type==="array"?[]:{},m!=null&&(l[c]=m)}}return l},a.ax=En,a.ay=Kd,a.az=pn,a.b=function(l,o){const c=new Blob([new Uint8Array(l)],{type:"image/png"});createImageBitmap(c).then(f=>{o(null,f)}).catch(f=>{o(new Error(`Could not load image because of ${f.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},a.b0=Rr,a.b1=function(l,o){var c=l[0],f=l[1],m=l[2],v=l[3],w=l[4],E=l[5],T=l[6],P=l[7],D=l[8],F=l[9],U=l[10],W=l[11],Y=l[12],tt=l[13],ct=l[14],ft=l[15],Tt=o[0],_t=o[1],Mt=o[2],Ft=o[3],Ht=o[4],ye=o[5],Le=o[6],ge=o[7],fe=o[8],ae=o[9],Se=o[10],ue=o[11],ne=o[12],Fe=o[13],Ae=o[14],gn=o[15];return Math.abs(c-Tt)<=wo*Math.max(1,Math.abs(c),Math.abs(Tt))&&Math.abs(f-_t)<=wo*Math.max(1,Math.abs(f),Math.abs(_t))&&Math.abs(m-Mt)<=wo*Math.max(1,Math.abs(m),Math.abs(Mt))&&Math.abs(v-Ft)<=wo*Math.max(1,Math.abs(v),Math.abs(Ft))&&Math.abs(w-Ht)<=wo*Math.max(1,Math.abs(w),Math.abs(Ht))&&Math.abs(E-ye)<=wo*Math.max(1,Math.abs(E),Math.abs(ye))&&Math.abs(T-Le)<=wo*Math.max(1,Math.abs(T),Math.abs(Le))&&Math.abs(P-ge)<=wo*Math.max(1,Math.abs(P),Math.abs(ge))&&Math.abs(D-fe)<=wo*Math.max(1,Math.abs(D),Math.abs(fe))&&Math.abs(F-ae)<=wo*Math.max(1,Math.abs(F),Math.abs(ae))&&Math.abs(U-Se)<=wo*Math.max(1,Math.abs(U),Math.abs(Se))&&Math.abs(W-ue)<=wo*Math.max(1,Math.abs(W),Math.abs(ue))&&Math.abs(Y-ne)<=wo*Math.max(1,Math.abs(Y),Math.abs(ne))&&Math.abs(tt-Fe)<=wo*Math.max(1,Math.abs(tt),Math.abs(Fe))&&Math.abs(ct-Ae)<=wo*Math.max(1,Math.abs(ct),Math.abs(Ae))&&Math.abs(ft-gn)<=wo*Math.max(1,Math.abs(ft),Math.abs(gn))},a.b2=function(l,o){return l[0]=o[0],l[1]=o[1],l[2]=o[2],l[3]=o[3],l[4]=o[4],l[5]=o[5],l[6]=o[6],l[7]=o[7],l[8]=o[8],l[9]=o[9],l[10]=o[10],l[11]=o[11],l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15],l},a.b3=function(l,o,c){return l[0]=o[0]*c[0],l[1]=o[1]*c[1],l[2]=o[2]*c[2],l[3]=o[3]*c[3],l},a.b4=function(l,o){return l[0]*o[0]+l[1]*o[1]+l[2]*o[2]+l[3]*o[3]},a.b5=ut,a.b6=uv,a.b7=sv,a.b8=function(l,o,c,f,m){var v,w=1/Math.tan(o/2);return l[0]=w/c,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=w,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[11]=-1,l[12]=0,l[13]=0,l[15]=0,m!=null&&m!==1/0?(l[10]=(m+f)*(v=1/(f-m)),l[14]=2*m*f*v):(l[10]=-1,l[14]=-2*f),l},a.b9=function(l,o,c){var f=Math.sin(c),m=Math.cos(c),v=o[4],w=o[5],E=o[6],T=o[7],P=o[8],D=o[9],F=o[10],U=o[11];return o!==l&&(l[0]=o[0],l[1]=o[1],l[2]=o[2],l[3]=o[3],l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15]),l[4]=v*m+P*f,l[5]=w*m+D*f,l[6]=E*m+F*f,l[7]=T*m+U*f,l[8]=P*m-v*f,l[9]=D*m-w*f,l[10]=F*m-E*f,l[11]=U*m-T*f,l},a.bA=S,a.bB=R0,a.bC=eh,a.bD=zo,a.ba=Q,a.bb=it,a.bc=function(l,o){return l[0]=o[0],l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=o[1],l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=o[2],l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,l},a.bd=class extends cc{},a.be=T_,a.bf=av,a.bg=cS,a.bi=De,a.bj=function(l,o,c=!1){if(bo===Vp||bo===Up||bo===Gp)throw new Error("setRTLTextPlugin cannot be called multiple times.");tl=qn.resolveURL(l),bo=Vp,jp=o,qp(),c||tm()},a.bk=Zp,a.bl=function(l,o){const c={};for(let m=0;mne*ur)}let ge=w?"center":c.get("text-justify").evaluate(P,{},l.canonical);const fe=c.get("symbol-placement"),ae=fe==="point"?c.get("text-max-width").evaluate(P,{},l.canonical)*ur:0,Se=()=>{l.bucket.allowVerticalPlacement&&zp(Mt)&&(Y.vertical=_m(tt,l.glyphMap,l.glyphPositions,l.imagePositions,D,ae,v,ye,"left",Ht,ft,a.ai.vertical,!0,fe,U,F))};if(!w&&Le){const ue=new Set;if(ge==="auto")for(let Fe=0;Fe{o(null,c),URL.revokeObjectURL(c.src),c.onload=null,window.requestAnimationFrame(()=>{c.src=On})},c.onerror=()=>o(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 f=new Blob([new Uint8Array(l)],{type:"image/png"});c.src=l.byteLength?URL.createObjectURL(f):On},a.e=gt,a.f=function(l,o){return mi(gt(l,{type:"json"}),o)},a.g=Zn,a.h=qn,a.i=we,a.j=Ie,a.k=nn,a.l=wt,a.m=mi,a.n=function(l){return new __(l).readFields(B2,[])},a.o=function(l,o,c){if(!l.length)return c(null,[]);let f=l.length;const m=new Array(l.length);let v=null;l.forEach((w,E)=>{o(w,(T,P)=>{T&&(v=T),m[E]=P,--f==0&&c(v,m)})})},a.p=j0,a.q=of,a.r=Wi,a.s=Ue,a.t=Xg,a.u=_e,a.v=jt,a.w=Nt,a.x=lh,a.y=Ta,a.z=function([l,o,c]){return o+=90,o*=Math.PI/180,c*=Math.PI/180,{x:l*Math.cos(o)*Math.sin(c),y:l*Math.sin(o)*Math.sin(c),z:l*Math.cos(c)}}}),u(["./shared"],function(a){class _{constructor(B){this.keyCache={},B&&this.replace(B)}replace(B){this._layerConfigs={},this._layers={},this.update(B,[])}update(B,G){for(const j of B){this._layerConfigs[j.id]=j;const ot=this._layers[j.id]=a.aC(j);ot._featureFilter=a.a6(ot.filter),this.keyCache[j.id]&&delete this.keyCache[j.id]}for(const j of G)delete this.keyCache[j],delete this._layerConfigs[j],delete this._layers[j];this.familiesBySource={};const J=a.bl(Object.values(this._layerConfigs),this.keyCache);for(const j of J){const ot=j.map(Zt=>this._layers[Zt.id]),It=ot[0];if(It.visibility==="none")continue;const mt=It.source||"";let rt=this.familiesBySource[mt];rt||(rt=this.familiesBySource[mt]={});const xt=It.sourceLayer||"_geojsonTileLayer";let qt=rt[xt];qt||(qt=rt[xt]=[]),qt.push(ot)}}}class x{constructor(B){const G={},J=[];for(const mt in B){const rt=B[mt],xt=G[mt]={};for(const qt in rt){const Zt=rt[+qt];if(!Zt||Zt.bitmap.width===0||Zt.bitmap.height===0)continue;const Xt={x:0,y:0,w:Zt.bitmap.width+2,h:Zt.bitmap.height+2};J.push(Xt),xt[qt]={rect:Xt,metrics:Zt.metrics}}}const{w:j,h:ot}=a.p(J),It=new a.q({width:j||1,height:ot||1});for(const mt in B){const rt=B[mt];for(const xt in rt){const qt=rt[+xt];if(!qt||qt.bitmap.width===0||qt.bitmap.height===0)continue;const Zt=G[mt][xt].rect;a.q.copy(qt.bitmap,It,{x:0,y:0},{x:Zt.x+1,y:Zt.y+1},qt.bitmap)}}this.image=It,this.positions=G}}a.bm("GlyphAtlas",x);class S{constructor(B){this.tileID=new a.O(B.tileID.overscaledZ,B.tileID.wrap,B.tileID.canonical.z,B.tileID.canonical.x,B.tileID.canonical.y),this.uid=B.uid,this.zoom=B.zoom,this.pixelRatio=B.pixelRatio,this.tileSize=B.tileSize,this.source=B.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=B.showCollisionBoxes,this.collectResourceTiming=!!B.collectResourceTiming,this.returnDependencies=!!B.returnDependencies,this.promoteId=B.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(B,G,J,j,ot){this.status="parsing",this.data=B,this.collisionBoxArray=new a.a3;const It=new a.bn(Object.keys(B.layers).sort()),mt=new a.bo(this.tileID,this.promoteId);mt.bucketLayerIDs=[];const rt={},xt={featureIndex:mt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:J},qt=G.familiesBySource[this.source];for(const Pn in qt){const Mn=B.layers[Pn];if(!Mn)continue;Mn.version===1&&a.w(`Vector tile source "${this.source}" layer "${Pn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const qr=It.encode(Pn),oi=[];for(let nr=0;nr=Nr.maxzoom||Nr.visibility!=="none"&&(L(nr,this.zoom,J),(rt[Nr.id]=Nr.createBucket({index:mt.bucketLayerIDs.length,layers:nr,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:qr,sourceID:this.source})).populate(oi,xt,this.tileID.canonical),mt.bucketLayerIDs.push(nr.map(ns=>ns.id)))}}let Zt,Xt,ke,Ke;const Ce=a.aH(xt.glyphDependencies,Pn=>Object.keys(Pn).map(Number));this.inFlightDependencies.forEach(Pn=>Pn==null?void 0:Pn.cancel()),this.inFlightDependencies=[];const Be=++this.dependencySentinel;Object.keys(Ce).length?this.inFlightDependencies.push(j.send("getGlyphs",{uid:this.uid,stacks:Ce,source:this.source,tileID:this.tileID,type:"glyphs"},(Pn,Mn)=>{Be===this.dependencySentinel&&(Zt||(Zt=Pn,Xt=Mn,$n.call(this)))})):Xt={};const rn=Object.keys(xt.iconDependencies);rn.length?this.inFlightDependencies.push(j.send("getImages",{icons:rn,source:this.source,tileID:this.tileID,type:"icons"},(Pn,Mn)=>{Be===this.dependencySentinel&&(Zt||(Zt=Pn,ke=Mn,$n.call(this)))})):ke={};const Gn=Object.keys(xt.patternDependencies);function $n(){if(Zt)return ot(Zt);if(Xt&&ke&&Ke){const Pn=new x(Xt),Mn=new a.bp(ke,Ke);for(const qr in rt){const oi=rt[qr];oi instanceof a.a4?(L(oi.layers,this.zoom,J),a.bq({bucket:oi,glyphMap:Xt,glyphPositions:Pn.positions,imageMap:ke,imagePositions:Mn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):oi.hasPattern&&(oi instanceof a.br||oi instanceof a.bs||oi instanceof a.bt)&&(L(oi.layers,this.zoom,J),oi.addFeatures(xt,this.tileID.canonical,Mn.patternPositions))}this.status="done",ot(null,{buckets:Object.values(rt).filter(qr=>!qr.isEmpty()),featureIndex:mt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Pn.image,imageAtlas:Mn,glyphMap:this.returnDependencies?Xt:null,iconMap:this.returnDependencies?ke:null,glyphPositions:this.returnDependencies?Pn.positions:null})}}Gn.length?this.inFlightDependencies.push(j.send("getImages",{icons:Gn,source:this.source,tileID:this.tileID,type:"patterns"},(Pn,Mn)=>{Be===this.dependencySentinel&&(Zt||(Zt=Pn,Ke=Mn,$n.call(this)))})):Ke={},$n.call(this)}}function L(st,B,G){const J=new a.a8(B);for(const j of st)j.recalculate(J,G)}function A(st,B){const G=a.l(st.request,(J,j,ot,It)=>{if(J)B(J);else if(j)try{const mt=new a.bw.VectorTile(new a.bv(j));B(null,{vectorTile:mt,rawData:j,cacheControl:ot,expires:It})}catch(mt){const rt=new Uint8Array(j);let xt=`Unable to parse the tile at ${st.request.url}, `;xt+=rt[0]===31&&rt[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${mt.messge}`,B(new Error(xt))}});return()=>{G.cancel(),B()}}class N{constructor(B,G,J,j){this.actor=B,this.layerIndex=G,this.availableImages=J,this.loadVectorData=j||A,this.fetching={},this.loading={},this.loaded={}}loadTile(B,G){const J=B.uid;this.loading||(this.loading={});const j=!!(B&&B.request&&B.request.collectResourceTiming)&&new a.bu(B.request),ot=this.loading[J]=new S(B);ot.abort=this.loadVectorData(B,(It,mt)=>{if(delete this.loading[J],It||!mt)return ot.status="done",this.loaded[J]=ot,G(It);const rt=mt.rawData,xt={};mt.expires&&(xt.expires=mt.expires),mt.cacheControl&&(xt.cacheControl=mt.cacheControl);const qt={};if(j){const Zt=j.finish();Zt&&(qt.resourceTiming=JSON.parse(JSON.stringify(Zt)))}ot.vectorTile=mt.vectorTile,ot.parse(mt.vectorTile,this.layerIndex,this.availableImages,this.actor,(Zt,Xt)=>{if(delete this.fetching[J],Zt||!Xt)return G(Zt);G(null,a.e({rawTileData:rt.slice(0)},Xt,xt,qt))}),this.loaded=this.loaded||{},this.loaded[J]=ot,this.fetching[J]={rawTileData:rt,cacheControl:xt,resourceTiming:qt}})}reloadTile(B,G){const J=this.loaded,j=B.uid;if(J&&J[j]){const ot=J[j];ot.showCollisionBoxes=B.showCollisionBoxes,ot.status==="parsing"?ot.parse(ot.vectorTile,this.layerIndex,this.availableImages,this.actor,(It,mt)=>{if(It||!mt)return G(It,mt);let rt;if(this.fetching[j]){const{rawTileData:xt,cacheControl:qt,resourceTiming:Zt}=this.fetching[j];delete this.fetching[j],rt=a.e({rawTileData:xt.slice(0)},mt,qt,Zt)}else rt=mt;G(null,rt)}):ot.status==="done"&&(ot.vectorTile?ot.parse(ot.vectorTile,this.layerIndex,this.availableImages,this.actor,G):G())}}abortTile(B,G){const J=this.loading,j=B.uid;J&&J[j]&&J[j].abort&&(J[j].abort(),delete J[j]),G()}removeTile(B,G){const J=this.loaded,j=B.uid;J&&J[j]&&delete J[j],G()}}class z{constructor(){this.loaded={}}loadTile(B,G){return a._(this,void 0,void 0,function*(){const{uid:J,encoding:j,rawImageData:ot,redFactor:It,greenFactor:mt,blueFactor:rt,baseShift:xt}=B,qt=ot.width+2,Zt=ot.height+2,Xt=a.a(ot)?new a.R({width:qt,height:Zt},yield a.bx(ot,-1,-1,qt,Zt)):ot,ke=new a.by(J,Xt,j,It,mt,rt,xt);this.loaded=this.loaded||{},this.loaded[J]=ke,G(null,ke)})}removeTile(B){const G=this.loaded,J=B.uid;G&&G[J]&&delete G[J]}}function H(st,B){if(st.length!==0){Z(st[0],B);for(var G=1;G=Math.abs(mt)?G-rt+mt:mt-rt+G,G=rt}G+J>=0!=!!B&&st.reverse()}var K=a.bz(function st(B,G){var J,j=B&&B.type;if(j==="FeatureCollection")for(J=0;J>31}function we(st,B){for(var G=st.loadGeometry(),J=st.type,j=0,ot=0,It=G.length,mt=0;mtst},$e=Math.fround||(Ve=new Float32Array(1),st=>(Ve[0]=+st,Ve[0]));var Ve;const Ge=3,mn=5,Qn=6;class qn{constructor(B){this.options=Object.assign(Object.create(On),B),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(B){const{log:G,minZoom:J,maxZoom:j}=this.options;G&&console.time("total time");const ot=`prepare ${B.length} points`;G&&console.time(ot),this.points=B;const It=[];for(let rt=0;rt=J;rt--){const xt=+Date.now();mt=this.trees[rt]=this._createTree(this._cluster(mt,rt)),G&&console.log("z%d: %d clusters in %dms",rt,mt.numItems,+Date.now()-xt)}return G&&console.timeEnd("total time"),this}getClusters(B,G){let J=((B[0]+180)%360+360)%360-180;const j=Math.max(-90,Math.min(90,B[1]));let ot=B[2]===180?180:((B[2]+180)%360+360)%360-180;const It=Math.max(-90,Math.min(90,B[3]));if(B[2]-B[0]>=360)J=-180,ot=180;else if(J>ot){const Zt=this.getClusters([J,j,180,It],G),Xt=this.getClusters([-180,j,ot,It],G);return Zt.concat(Xt)}const mt=this.trees[this._limitZoom(G)],rt=mt.range(pn(J),Zn(It),pn(ot),Zn(j)),xt=mt.data,qt=[];for(const Zt of rt){const Xt=this.stride*Zt;qt.push(xt[Xt+mn]>1?ie(xt,Xt,this.clusterProps):this.points[xt[Xt+Ge]])}return qt}getChildren(B){const G=this._getOriginId(B),J=this._getOriginZoom(B),j="No cluster with the specified id.",ot=this.trees[J];if(!ot)throw new Error(j);const It=ot.data;if(G*this.stride>=It.length)throw new Error(j);const mt=this.options.radius/(this.options.extent*Math.pow(2,J-1)),rt=ot.within(It[G*this.stride],It[G*this.stride+1],mt),xt=[];for(const qt of rt){const Zt=qt*this.stride;It[Zt+4]===B&&xt.push(It[Zt+mn]>1?ie(It,Zt,this.clusterProps):this.points[It[Zt+Ge]])}if(xt.length===0)throw new Error(j);return xt}getLeaves(B,G,J){const j=[];return this._appendLeaves(j,B,G=G||10,J=J||0,0),j}getTile(B,G,J){const j=this.trees[this._limitZoom(B)],ot=Math.pow(2,B),{extent:It,radius:mt}=this.options,rt=mt/It,xt=(J-rt)/ot,qt=(J+1+rt)/ot,Zt={features:[]};return this._addTileFeatures(j.range((G-rt)/ot,xt,(G+1+rt)/ot,qt),j.data,G,J,ot,Zt),G===0&&this._addTileFeatures(j.range(1-rt/ot,xt,1,qt),j.data,ot,J,ot,Zt),G===ot-1&&this._addTileFeatures(j.range(0,xt,rt/ot,qt),j.data,-1,J,ot,Zt),Zt.features.length?Zt:null}getClusterExpansionZoom(B){let G=this._getOriginZoom(B)-1;for(;G<=this.options.maxZoom;){const J=this.getChildren(B);if(G++,J.length!==1)break;B=J[0].properties.cluster_id}return G}_appendLeaves(B,G,J,j,ot){const It=this.getChildren(G);for(const mt of It){const rt=mt.properties;if(rt&&rt.cluster?ot+rt.point_count<=j?ot+=rt.point_count:ot=this._appendLeaves(B,rt.cluster_id,J,j,ot):ot1;let qt,Zt,Xt;if(xt)qt=De(G,rt,this.clusterProps),Zt=G[rt],Xt=G[rt+1];else{const Ce=this.points[G[rt+Ge]];qt=Ce.properties;const[Be,rn]=Ce.geometry.coordinates;Zt=pn(Be),Xt=Zn(rn)}const ke={type:1,geometry:[[Math.round(this.options.extent*(Zt*ot-J)),Math.round(this.options.extent*(Xt*ot-j))]],tags:qt};let Ke;Ke=xt||this.options.generateId?G[rt+Ge]:this.points[G[rt+Ge]].id,Ke!==void 0&&(ke.id=Ke),It.features.push(ke)}}_limitZoom(B){return Math.max(this.options.minZoom,Math.min(Math.floor(+B),this.options.maxZoom+1))}_cluster(B,G){const{radius:J,extent:j,reduce:ot,minPoints:It}=this.options,mt=J/(j*Math.pow(2,G)),rt=B.data,xt=[],qt=this.stride;for(let Zt=0;ZtG&&(Be+=rt[Gn+mn])}if(Be>Ce&&Be>=It){let rn,Gn=Xt*Ce,$n=ke*Ce,Pn=-1;const Mn=((Zt/qt|0)<<5)+(G+1)+this.points.length;for(const qr of Ke){const oi=qr*qt;if(rt[oi+2]<=G)continue;rt[oi+2]=G;const nr=rt[oi+mn];Gn+=rt[oi]*nr,$n+=rt[oi+1]*nr,rt[oi+4]=Mn,ot&&(rn||(rn=this._map(rt,Zt,!0),Pn=this.clusterProps.length,this.clusterProps.push(rn)),ot(rn,this._map(rt,oi)))}rt[Zt+4]=Mn,xt.push(Gn/Be,$n/Be,1/0,Mn,-1,Be),ot&&xt.push(Pn)}else{for(let rn=0;rn1)for(const rn of Ke){const Gn=rn*qt;if(!(rt[Gn+2]<=G)){rt[Gn+2]=G;for(let $n=0;$n>5}_getOriginZoom(B){return(B-this.points.length)%32}_map(B,G,J){if(B[G+mn]>1){const It=this.clusterProps[B[G+Qn]];return J?Object.assign({},It):It}const j=this.points[B[G+Ge]].properties,ot=this.options.map(j);return J&&ot===j?Object.assign({},ot):ot}}function ie(st,B,G){return{type:"Feature",id:st[B+Ge],properties:De(st,B,G),geometry:{type:"Point",coordinates:[(J=st[B],360*(J-.5)),Ar(st[B+1])]}};var J}function De(st,B,G){const J=st[B+mn],j=J>=1e4?`${Math.round(J/1e3)}k`:J>=1e3?Math.round(J/100)/10+"k":J,ot=st[B+Qn],It=ot===-1?{}:Object.assign({},G[ot]);return Object.assign(It,{cluster:!0,cluster_id:st[B+Ge],point_count:J,point_count_abbreviated:j})}function pn(st){return st/360+.5}function Zn(st){const B=Math.sin(st*Math.PI/180),G=.5-.25*Math.log((1+B)/(1-B))/Math.PI;return G<0?0:G>1?1:G}function Ar(st){const B=(180-360*st)*Math.PI/180;return 360*Math.atan(Math.exp(B))/Math.PI-90}function mi(st,B,G,J){for(var j,ot=J,It=G-B>>1,mt=G-B,rt=st[B],xt=st[B+1],qt=st[G],Zt=st[G+1],Xt=B+3;Xtot)j=Xt,ot=ke;else if(ke===ot){var Ke=Math.abs(Xt-It);KeJ&&(j-B>3&&mi(st,B,j,J),st[j+2]=ot,G-j>3&&mi(st,j,G,J))}function wt(st,B,G,J,j,ot){var It=j-G,mt=ot-J;if(It!==0||mt!==0){var rt=((st-G)*It+(B-J)*mt)/(It*It+mt*mt);rt>1?(G=j,J=ot):rt>0&&(G+=It*rt,J+=mt*rt)}return(It=st-G)*It+(mt=B-J)*mt}function Ue(st,B,G,J){var j={id:st===void 0?null:st,type:B,geometry:G,tags:J,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(ot){var It=ot.geometry,mt=ot.type;if(mt==="Point"||mt==="MultiPoint"||mt==="LineString")ze(ot,It);else if(mt==="Polygon"||mt==="MultiLineString")for(var rt=0;rt0&&(It+=J?(j*xt-rt*ot)/2:Math.sqrt(Math.pow(rt-j,2)+Math.pow(xt-ot,2))),j=rt,ot=xt}var qt=B.length-3;B[2]=1,mi(B,0,qt,G),B[qt+2]=1,B.size=Math.abs(It),B.start=0,B.end=B.size}function An(st,B,G,J){for(var j=0;j1?1:G}function sr(st,B,G,J,j,ot,It,mt){if(J/=B,ot>=(G/=B)&&It=J)return null;for(var rt=[],xt=0;xt=G&&Ke=J)){var Ce=[];if(Xt==="Point"||Xt==="MultiPoint")zn(Zt,Ce,G,J,j);else if(Xt==="LineString")En(Zt,Ce,G,J,j,!1,mt.lineMetrics);else if(Xt==="MultiLineString")oo(Zt,Ce,G,J,j,!1);else if(Xt==="Polygon")oo(Zt,Ce,G,J,j,!0);else if(Xt==="MultiPolygon")for(var Be=0;Be=G&&It<=J&&(B.push(st[ot]),B.push(st[ot+1]),B.push(st[ot+2]))}}function En(st,B,G,J,j,ot,It){for(var mt,rt,xt=$o(st),qt=j===0?Ha:Gs,Zt=st.start,Xt=0;XtG&&(rt=qt(xt,ke,Ke,Be,rn,G),It&&(xt.start=Zt+mt*rt)):Gn>J?$n=G&&(rt=qt(xt,ke,Ke,Be,rn,G),Pn=!0),$n>J&&Gn<=J&&(rt=qt(xt,ke,Ke,Be,rn,J),Pn=!0),!ot&&Pn&&(It&&(xt.end=Zt+mt*rt),B.push(xt),xt=$o(st)),It&&(Zt+=mt)}var Mn=st.length-3;ke=st[Mn],Ke=st[Mn+1],Ce=st[Mn+2],(Gn=j===0?ke:Ke)>=G&&Gn<=J&&ts(xt,ke,Ke,Ce),Mn=xt.length-3,ot&&Mn>=3&&(xt[Mn]!==xt[0]||xt[Mn+1]!==xt[1])&&ts(xt,xt[0],xt[1],xt[2]),xt.length&&B.push(xt)}function $o(st){var B=[];return B.size=st.size,B.start=st.start,B.end=st.end,B}function oo(st,B,G,J,j,ot){for(var It=0;ItIt.maxX&&(It.maxX=qt),Zt>It.maxY&&(It.maxY=Zt)}return It}function Sa(st,B,G,J){var j=B.geometry,ot=B.type,It=[];if(ot==="Point"||ot==="MultiPoint")for(var mt=0;mt0&&B.size<(j?It:J))G.numPoints+=B.length/3;else{for(var mt=[],rt=0;rtIt)&&(G.numSimplified++,mt.push(B[rt]),mt.push(B[rt+1])),G.numPoints++;j&&function(xt,qt){for(var Zt=0,Xt=0,ke=xt.length,Ke=ke-2;Xt0===qt)for(Xt=0,ke=xt.length;Xt24)throw new Error("maxZoom should be in the 0-24 range");if(B.promoteId&&B.generateId)throw new Error("promoteId and generateId cannot be used together.");var J=function(j,ot){var It=[];if(j.type==="FeatureCollection")for(var mt=0;mt1&&console.time("creation"),Xt=this.tiles[Zt]=ri(st,B,G,J,rt),this.tileCoords.push({z:B,x:G,y:J}),xt)){xt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",B,G,J,Xt.numFeatures,Xt.numPoints,Xt.numSimplified),console.timeEnd("creation"));var ke="z"+B;this.stats[ke]=(this.stats[ke]||0)+1,this.total++}if(Xt.source=st,j){if(B===rt.maxZoom||B===j)continue;var Ke=1<1&&console.time("clipping");var Ce,Be,rn,Gn,$n,Pn,Mn=.5*rt.buffer/rt.extent,qr=.5-Mn,oi=.5+Mn,nr=1+Mn;Ce=Be=rn=Gn=null,$n=sr(st,qt,G-Mn,G+oi,0,Xt.minX,Xt.maxX,rt),Pn=sr(st,qt,G+qr,G+nr,0,Xt.minX,Xt.maxX,rt),st=null,$n&&(Ce=sr($n,qt,J-Mn,J+oi,1,Xt.minY,Xt.maxY,rt),Be=sr($n,qt,J+qr,J+nr,1,Xt.minY,Xt.maxY,rt),$n=null),Pn&&(rn=sr(Pn,qt,J-Mn,J+oi,1,Xt.minY,Xt.maxY,rt),Gn=sr(Pn,qt,J+qr,J+nr,1,Xt.minY,Xt.maxY,rt),Pn=null),xt>1&&console.timeEnd("clipping"),mt.push(Ce||[],B+1,2*G,2*J),mt.push(Be||[],B+1,2*G,2*J+1),mt.push(rn||[],B+1,2*G+1,2*J),mt.push(Gn||[],B+1,2*G+1,2*J+1)}}},le.prototype.getTile=function(st,B,G){var J=this.options,j=J.extent,ot=J.debug;if(st<0||st>24)return null;var It=1<1&&console.log("drilling down to z%d-%d-%d",st,B,G);for(var rt,xt=st,qt=B,Zt=G;!rt&&xt>0;)xt--,qt=Math.floor(qt/2),Zt=Math.floor(Zt/2),rt=this.tiles[hn(xt,qt,Zt)];return rt&&rt.source?(ot>1&&console.log("found parent tile z%d-%d-%d",xt,qt,Zt),ot>1&&console.time("drilling down"),this.splitTile(rt.source,xt,qt,Zt,st,B,G),ot>1&&console.timeEnd("drilling down"),this.tiles[mt]?se(this.tiles[mt],j):null):null};class on extends N{constructor(B,G,J,j){super(B,G,J),this._dataUpdateable=new Map,this.loadGeoJSON=(ot,It)=>{const{promoteId:mt}=ot;if(ot.request)return a.f(ot.request,(rt,xt,qt,Zt)=>{this._dataUpdateable=kr(xt,mt)?es(xt,mt):void 0,It(rt,xt,qt,Zt)});if(typeof ot.data=="string")try{const rt=JSON.parse(ot.data);this._dataUpdateable=kr(rt,mt)?es(rt,mt):void 0,It(null,rt)}catch{It(new Error(`Input data given to '${ot.source}' is not a valid GeoJSON object.`))}else ot.dataDiff?this._dataUpdateable?(function(rt,xt,qt){var Zt,Xt,ke,Ke;if(xt.removeAll&&rt.clear(),xt.remove)for(const Ce of xt.remove)rt.delete(Ce);if(xt.add)for(const Ce of xt.add){const Be=Je(Ce,qt);Be!=null&&rt.set(Be,Ce)}if(xt.update)for(const Ce of xt.update){let Be=rt.get(Ce.id);if(Be==null)continue;const rn=!Ce.removeAllProperties&&(((Zt=Ce.removeProperties)===null||Zt===void 0?void 0:Zt.length)>0||((Xt=Ce.addOrUpdateProperties)===null||Xt===void 0?void 0:Xt.length)>0);if((Ce.newGeometry||Ce.removeAllProperties||rn)&&(Be=Object.assign({},Be),rt.set(Ce.id,Be),rn&&(Be.properties=Object.assign({},Be.properties))),Ce.newGeometry&&(Be.geometry=Ce.newGeometry),Ce.removeAllProperties)Be.properties={};else if(((ke=Ce.removeProperties)===null||ke===void 0?void 0:ke.length)>0)for(const Gn of Ce.removeProperties)Object.prototype.hasOwnProperty.call(Be.properties,Gn)&&delete Be.properties[Gn];if(((Ke=Ce.addOrUpdateProperties)===null||Ke===void 0?void 0:Ke.length)>0)for(const{key:Gn,value:$n}of Ce.addOrUpdateProperties)Be.properties[Gn]=$n}}(this._dataUpdateable,ot.dataDiff,mt),It(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):It(new Error(`Cannot update existing geojson data in ${ot.source}`)):It(new Error(`Input data given to '${ot.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},this.loadVectorData=this.loadGeoJSONTile,j&&(this.loadGeoJSON=j)}loadGeoJSONTile(B,G){const J=B.tileID.canonical;if(!this._geoJSONIndex)return G(null,null);const j=this._geoJSONIndex.getTile(J.z,J.x,J.y);if(!j)return G(null,null);const ot=new class{constructor(mt){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.N,this.length=mt.length,this._features=mt}feature(mt){return new class{constructor(rt){this._feature=rt,this.extent=a.N,this.type=rt.type,this.properties=rt.tags,"id"in rt&&!isNaN(rt.id)&&(this.id=parseInt(rt.id,10))}loadGeometry(){if(this._feature.type===1){const rt=[];for(const xt of this._feature.geometry)rt.push([new a.P(xt[0],xt[1])]);return rt}{const rt=[];for(const xt of this._feature.geometry){const qt=[];for(const Zt of xt)qt.push(new a.P(Zt[0],Zt[1]));rt.push(qt)}return rt}}toGeoJSON(rt,xt,qt){return V.call(this,rt,xt,qt)}}(this._features[mt])}}(j.features);let It=Ye(ot);It.byteOffset===0&&It.byteLength===It.buffer.byteLength||(It=new Uint8Array(It)),G(null,{vectorTile:ot,rawData:It.buffer})}loadData(B,G){var J;(J=this._pendingRequest)===null||J===void 0||J.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const j=!!(B&&B.request&&B.request.collectResourceTiming)&&new a.bu(B.request);this._pendingCallback=G,this._pendingRequest=this.loadGeoJSON(B,(ot,It)=>{if(delete this._pendingCallback,delete this._pendingRequest,ot||!It)return G(ot);if(typeof It!="object")return G(new Error(`Input data given to '${B.source}' is not a valid GeoJSON object.`));{K(It,!0);try{if(B.filter){const rt=a.bC(B.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(rt.result==="error")throw new Error(rt.value.map(qt=>`${qt.key}: ${qt.message}`).join(", "));It={type:"FeatureCollection",features:It.features.filter(qt=>rt.value.evaluate({zoom:0},qt))}}this._geoJSONIndex=B.cluster?new qn(function({superclusterOptions:rt,clusterProperties:xt}){if(!xt||!rt)return rt;const qt={},Zt={},Xt={accumulated:null,zoom:0},ke={properties:null},Ke=Object.keys(xt);for(const Ce of Ke){const[Be,rn]=xt[Ce],Gn=a.bC(rn),$n=a.bC(typeof Be=="string"?[Be,["accumulated"],["get",Ce]]:Be);qt[Ce]=Gn.value,Zt[Ce]=$n.value}return rt.map=Ce=>{ke.properties=Ce;const Be={};for(const rn of Ke)Be[rn]=qt[rn].evaluate(Xt,ke);return Be},rt.reduce=(Ce,Be)=>{ke.properties=Be;for(const rn of Ke)Xt.accumulated=Ce[rn],Ce[rn]=Zt[rn].evaluate(Xt,ke)},rt}(B)).load(It.features):function(rt,xt){return new le(rt,xt)}(It,B.geojsonVtOptions)}catch(rt){return G(rt)}this.loaded={};const mt={};if(j){const rt=j.finish();rt&&(mt.resourceTiming={},mt.resourceTiming[B.source]=JSON.parse(JSON.stringify(rt)))}G(null,mt)}})}reloadTile(B,G){const J=this.loaded;return J&&J[B.uid]?super.reloadTile(B,G):this.loadTile(B,G)}removeSource(B,G){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),G()}getClusterExpansionZoom(B,G){try{G(null,this._geoJSONIndex.getClusterExpansionZoom(B.clusterId))}catch(J){G(J)}}getClusterChildren(B,G){try{G(null,this._geoJSONIndex.getChildren(B.clusterId))}catch(J){G(J)}}getClusterLeaves(B,G){try{G(null,this._geoJSONIndex.getLeaves(B.clusterId,B.limit,B.offset))}catch(J){G(J)}}}class ws{constructor(B){this.self=B,this.actor=new a.C(B,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:N,geojson:on},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(G,J)=>{if(this.workerSourceTypes[G])throw new Error(`Worker source with name "${G}" already registered.`);this.workerSourceTypes[G]=J},this.self.registerRTLTextPlugin=G=>{if(a.bD.isParsed())throw new Error("RTL text plugin already registered.");a.bD.applyArabicShaping=G.applyArabicShaping,a.bD.processBidirectionalText=G.processBidirectionalText,a.bD.processStyledBidirectionalText=G.processStyledBidirectionalText}}setReferrer(B,G){this.referrer=G}setImages(B,G,J){this.availableImages[B]=G;for(const j in this.workerSources[B]){const ot=this.workerSources[B][j];for(const It in ot)ot[It].availableImages=G}J()}setLayers(B,G,J){this.getLayerIndex(B).replace(G),J()}updateLayers(B,G,J){this.getLayerIndex(B).update(G.layers,G.removedIds),J()}loadTile(B,G,J){this.getWorkerSource(B,G.type,G.source).loadTile(G,J)}loadDEMTile(B,G,J){this.getDEMWorkerSource(B,G.source).loadTile(G,J)}reloadTile(B,G,J){this.getWorkerSource(B,G.type,G.source).reloadTile(G,J)}abortTile(B,G,J){this.getWorkerSource(B,G.type,G.source).abortTile(G,J)}removeTile(B,G,J){this.getWorkerSource(B,G.type,G.source).removeTile(G,J)}removeDEMTile(B,G){this.getDEMWorkerSource(B,G.source).removeTile(G)}removeSource(B,G,J){if(!this.workerSources[B]||!this.workerSources[B][G.type]||!this.workerSources[B][G.type][G.source])return;const j=this.workerSources[B][G.type][G.source];delete this.workerSources[B][G.type][G.source],j.removeSource!==void 0?j.removeSource(G,J):J()}loadWorkerSource(B,G,J){try{this.self.importScripts(G.url),J()}catch(j){J(j.toString())}}syncRTLPluginState(B,G,J){try{a.bD.setState(G);const j=a.bD.getPluginURL();if(a.bD.isLoaded()&&!a.bD.isParsed()&&j!=null){this.self.importScripts(j);const ot=a.bD.isParsed();J(ot?void 0:new Error(`RTL Text Plugin failed to import scripts from ${j}`),ot)}}catch(j){J(j.toString())}}getAvailableImages(B){let G=this.availableImages[B];return G||(G=[]),G}getLayerIndex(B){let G=this.layerIndexes[B];return G||(G=this.layerIndexes[B]=new _),G}getWorkerSource(B,G,J){return this.workerSources[B]||(this.workerSources[B]={}),this.workerSources[B][G]||(this.workerSources[B][G]={}),this.workerSources[B][G][J]||(this.workerSources[B][G][J]=new this.workerSourceTypes[G]({send:(j,ot,It)=>{this.actor.send(j,ot,It,B)}},this.getLayerIndex(B),this.getAvailableImages(B))),this.workerSources[B][G][J]}getDEMWorkerSource(B,G){return this.demWorkerSources[B]||(this.demWorkerSources[B]={}),this.demWorkerSources[B][G]||(this.demWorkerSources[B][G]=new z),this.demWorkerSources[B][G]}}return a.i()&&(self.worker=new ws(self)),ws}),u(["./shared"],function(a){var _="3.6.2";class x{static testProp(s){if(!x.docStyle)return s[0];for(let h=0;h{window.removeEventListener("click",x.suppressClickInternal,!0)},0)}static mousePos(s,h){const d=s.getBoundingClientRect();return new a.P(h.clientX-d.left-s.clientLeft,h.clientY-d.top-s.clientTop)}static touchPos(s,h){const d=s.getBoundingClientRect(),g=[];for(let b=0;b{s=[],h=0,d=0,g={}},y.addThrottleControl=k=>{const R=d++;return g[R]=k,R},y.removeThrottleControl=k=>{delete g[k],C()},y.getImage=(k,R,O=!0)=>{S.supported&&(k.headers||(k.headers={}),k.headers.accept="image/webp,*/*");const q={requestParameters:k,supportImageRefresh:O,callback:R,cancelled:!1,completed:!1,cancel:()=>{q.completed||q.cancelled||(q.cancelled=!0,q.innerRequest&&(q.innerRequest.cancel(),h--),C())}};return s.push(q),C(),q};const b=k=>{const{requestParameters:R,supportImageRefresh:O,callback:q}=k;return a.e(R,{type:"image"}),(O!==!1||a.i()||a.g(R.url)||R.headers&&!Object.keys(R.headers).reduce((nt,et)=>nt&&et==="accept",!0)?a.m:M)(R,(nt,et,lt,$)=>{I(k,q,nt,et,lt,$)})},I=(k,R,O,q,nt,et)=>{O?R(O):q instanceof HTMLImageElement||a.a(q)?R(null,q):q&&((lt,$)=>{typeof createImageBitmap=="function"?a.b(lt,$):a.d(lt,$)})(q,(lt,$)=>{lt!=null?R(lt):$!=null&&R(null,$,{cacheControl:nt,expires:et})}),k.cancelled||(k.completed=!0,h--,C())},C=()=>{const k=(()=>{const R=Object.keys(g);let O=!1;if(R.length>0){for(const q of R)if(O=g[q](),O)break}return O})()?a.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:a.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let R=h;R0;R++){const O=s.shift();if(O.cancelled){R--;continue}const q=b(O);h++,O.innerRequest=q}},M=(k,R)=>{const O=new Image,q=k.url;let nt=!1;const et=k.credentials;return et&&et==="include"?O.crossOrigin="use-credentials":(et&&et==="same-origin"||!a.s(q))&&(O.crossOrigin="anonymous"),O.fetchPriority="high",O.onload=()=>{R(null,O),O.onerror=O.onload=null},O.onerror=()=>{nt||R(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")),O.onerror=O.onload=null},O.src=q,{cancel:()=>{nt=!0,O.src=""}}}}(Z||(Z={})),Z.resetRequestQueue(),function(y){y.Glyphs="Glyphs",y.Image="Image",y.Source="Source",y.SpriteImage="SpriteImage",y.SpriteJSON="SpriteJSON",y.Style="Style",y.Tile="Tile",y.Unknown="Unknown"}(K||(K={}));class V{constructor(s){this._transformRequestFn=s}transformRequest(s,h){return this._transformRequestFn&&this._transformRequestFn(s,h)||{url:s}}normalizeSpriteURL(s,h,d){const g=function(b){const I=b.match(X);if(!I)throw new Error(`Unable to parse URL "${b}"`);return{protocol:I[1],authority:I[2],path:I[3]||"/",params:I[4]?I[4].split("&"):[]}}(s);return g.path+=`${h}${d}`,function(b){const I=b.params.length?`?${b.params.join("&")}`:"";return`${b.protocol}://${b.authority}${b.path}${I}`}(g)}setTransformRequest(s){this._transformRequestFn=s}}const X=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Q(y){var s=new a.A(3);return s[0]=y[0],s[1]=y[1],s[2]=y[2],s}var it,ht=function(y,s,h){return y[0]=s[0]-h[0],y[1]=s[1]-h[1],y[2]=s[2]-h[2],y};it=new a.A(3),a.A!=Float32Array&&(it[0]=0,it[1]=0,it[2]=0);var ut=function(y){var s=y[0],h=y[1];return s*s+h*h};function gt(y){const s=[];if(typeof y=="string")s.push({id:"default",url:y});else if(y&&y.length>0){const h=[];for(const{id:d,url:g}of y){const b=`${d}${g}`;h.indexOf(b)===-1&&(h.push(b),s.push({id:d,url:g}))}}return s}function at(y,s,h,d,g){if(d)return void y(d);if(g!==Object.values(s).length||g!==Object.values(h).length)return;const b={};for(const I in s){b[I]={};const C=a.h.getImageCanvasContext(h[I]),M=s[I];for(const k in M){const{width:R,height:O,x:q,y:nt,sdf:et,pixelRatio:lt,stretchX:$,stretchY:St,content:Ot}=M[k];b[I][k]={data:null,pixelRatio:lt,sdf:et,stretchX:$,stretchY:St,content:Ot,spriteData:{width:R,height:O,x:q,y:nt,context:C}}}}y(null,b)}(function(){var y=new a.A(2);a.A!=Float32Array&&(y[0]=0,y[1]=0)})();class Lt{constructor(s,h,d,g){this.context=s,this.format=d,this.texture=s.gl.createTexture(),this.update(h,g)}update(s,h,d){const{width:g,height:b}=s,I=!(this.size&&this.size[0]===g&&this.size[1]===b||d),{context:C}=this,{gl:M}=C;if(this.useMipmap=!!(h&&h.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),C.pixelStoreUnpackFlipY.set(!1),C.pixelStoreUnpack.set(1),C.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!h||h.premultiply!==!1)),I)this.size=[g,b],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||a.a(s)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,s):M.texImage2D(M.TEXTURE_2D,0,this.format,g,b,0,this.format,M.UNSIGNED_BYTE,s.data);else{const{x:k,y:R}=d||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||a.a(s)?M.texSubImage2D(M.TEXTURE_2D,0,k,R,M.RGBA,M.UNSIGNED_BYTE,s):M.texSubImage2D(M.TEXTURE_2D,0,k,R,g,b,M.RGBA,M.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D)}bind(s,h,d){const{context:g}=this,{gl:b}=g;b.bindTexture(b.TEXTURE_2D,this.texture),d!==b.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=b.LINEAR),s!==this.filter&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,s),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,d||s),this.filter=s),h!==this.wrap&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,h),b.texParameteri(b.TEXTURE_2D,b.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:s}=this.context;s.deleteTexture(this.texture),this.texture=null}}function bt(y){const{userImage:s}=y;return!!(s&&s.render&&s.render())&&(y.data.replace(new Uint8Array(s.data.buffer)),!0)}class yt 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(s){if(this.loaded!==s&&(this.loaded=s,s)){for(const{ids:h,callback:d}of this.requestors)this._notify(h,d);this.requestors=[]}}getImage(s){const h=this.images[s];if(h&&!h.data&&h.spriteData){const d=h.spriteData;h.data=new a.R({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),h.spriteData=null}return h}addImage(s,h){if(this.images[s])throw new Error(`Image id ${s} already exist, use updateImage instead`);this._validate(s,h)&&(this.images[s]=h)}_validate(s,h){let d=!0;const g=h.data||h.spriteData;return this._validateStretch(h.stretchX,g&&g.width)||(this.fire(new a.j(new Error(`Image "${s}" has invalid "stretchX" value`))),d=!1),this._validateStretch(h.stretchY,g&&g.height)||(this.fire(new a.j(new Error(`Image "${s}" has invalid "stretchY" value`))),d=!1),this._validateContent(h.content,h)||(this.fire(new a.j(new Error(`Image "${s}" has invalid "content" value`))),d=!1),d}_validateStretch(s,h){if(!s)return!0;let d=0;for(const g of s){if(g[0]-1);M++,b[M]=C,I[M]=k,I[M+1]=he}for(let C=0,M=0;C{let C=this.entries[g];C||(C=this.entries[g]={glyphs:{},requests:{},ranges:{}});let M=C.glyphs[b];if(M!==void 0)return void I(null,{stack:g,id:b,glyph:M});if(M=this._tinySDF(C,g,b),M)return C.glyphs[b]=M,void I(null,{stack:g,id:b,glyph:M});const k=Math.floor(b/256);if(256*k>65535)return void I(new Error("glyphs > 65535 not supported"));if(C.ranges[k])return void I(null,{stack:g,id:b,glyph:M});if(!this.url)return void I(new Error("glyphsUrl is not set"));let R=C.requests[k];R||(R=C.requests[k]=[],Yt.loadGlyphRange(g,k,this.url,this.requestManager,(O,q)=>{if(q){for(const nt in q)this._doesCharSupportLocalGlyph(+nt)||(C.glyphs[+nt]=q[+nt]);C.ranges[k]=!0}for(const nt of R)nt(O,q);delete C.requests[k]})),R.push((O,q)=>{O?I(O):q&&I(null,{stack:g,id:b,glyph:q[b]||null})})},(g,b)=>{if(g)h(g);else if(b){const I={};for(const{stack:C,id:M,glyph:k}of b)(I[C]||(I[C]={}))[M]=k&&{id:k.id,bitmap:k.bitmap.clone(),metrics:k.metrics};h(null,I)}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&(a.u["CJK Unified Ideographs"](s)||a.u["Hangul Syllables"](s)||a.u.Hiragana(s)||a.u.Katakana(s))}_tinySDF(s,h,d){const g=this.localIdeographFontFamily;if(!g||!this._doesCharSupportLocalGlyph(d))return;let b=s.tinySDF;if(!b){let C="400";/bold/i.test(h)?C="900":/medium/i.test(h)?C="500":/light/i.test(h)&&(C="200"),b=s.tinySDF=new Yt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:C})}const I=b.draw(String.fromCharCode(d));return{id:d,bitmap:new a.q({width:I.width||60,height:I.height||60},I.data),metrics:{width:I.glyphWidth/2||24,height:I.glyphHeight/2||24,left:I.glyphLeft/2+.5||0,top:I.glyphTop/2-27.5||-8,advance:I.glyphAdvance/2||24,isDoubleResolution:!0}}}}Yt.loadGlyphRange=function(y,s,h,d,g){const b=256*s,I=b+255,C=d.transformRequest(h.replace("{fontstack}",y).replace("{range}",`${b}-${I}`),K.Glyphs);a.l(C,(M,k)=>{if(M)g(M);else if(k){const R={};for(const O of a.n(k))R[O.id]=O;g(null,R)}})},Yt.TinySDF=class{constructor({fontSize:y=24,buffer:s=3,radius:h=8,cutoff:d=.25,fontFamily:g="sans-serif",fontWeight:b="normal",fontStyle:I="normal"}={}){this.buffer=s,this.cutoff=d,this.radius=h;const C=this.size=y+4*s,M=this._createCanvas(C),k=this.ctx=M.getContext("2d",{willReadFrequently:!0});k.font=`${I} ${b} ${y}px ${g}`,k.textBaseline="alphabetic",k.textAlign="left",k.fillStyle="black",this.gridOuter=new Float64Array(C*C),this.gridInner=new Float64Array(C*C),this.f=new Float64Array(C),this.z=new Float64Array(C+1),this.v=new Uint16Array(C)}_createCanvas(y){const s=document.createElement("canvas");return s.width=s.height=y,s}draw(y){const{width:s,actualBoundingBoxAscent:h,actualBoundingBoxDescent:d,actualBoundingBoxLeft:g,actualBoundingBoxRight:b}=this.ctx.measureText(y),I=Math.ceil(h),C=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(b-g))),M=Math.min(this.size-this.buffer,I+Math.ceil(d)),k=C+2*this.buffer,R=M+2*this.buffer,O=Math.max(k*R,0),q=new Uint8ClampedArray(O),nt={data:q,width:k,height:R,glyphWidth:C,glyphHeight:M,glyphTop:I,glyphLeft:0,glyphAdvance:s};if(C===0||M===0)return nt;const{ctx:et,buffer:lt,gridInner:$,gridOuter:St}=this;et.clearRect(lt,lt,C,M),et.fillText(y,lt,lt+I);const Ot=et.getImageData(lt,lt,C,M);St.fill(he,0,O),$.fill(0,0,O);for(let pt=0;pt0?Wt*Wt:0,$[Vt]=Wt<0?Wt*Wt:0}}Nt(St,0,0,k,R,k,this.f,this.v,this.z),Nt($,lt,lt,C,M,k,this.f,this.v,this.z);for(let pt=0;pt1&&(M=s[++C]);const R=Math.abs(k-M.left),O=Math.abs(k-M.right),q=Math.min(R,O);let nt;const et=b/d*(g+1);if(M.isDash){const lt=g-Math.abs(et);nt=Math.sqrt(q*q+lt*lt)}else nt=g-Math.sqrt(q*q+et*et);this.data[I+k]=Math.max(0,Math.min(255,nt+128))}}}addRegularDash(s){for(let C=s.length-1;C>=0;--C){const M=s[C],k=s[C+1];M.zeroLength?s.splice(C,1):k&&k.isDash===M.isDash&&(k.left=M.left,s.splice(C,1))}const h=s[0],d=s[s.length-1];h.isDash===d.isDash&&(h.left=d.left-this.width,d.right=h.right+this.width);const g=this.width*this.nextRow;let b=0,I=s[b];for(let C=0;C1&&(I=s[++b]);const M=Math.abs(C-I.left),k=Math.abs(C-I.right),R=Math.min(M,k);this.data[g+C]=Math.max(0,Math.min(255,(I.isDash?R:-R)+128))}}addDash(s,h){const d=h?7:0,g=2*d+1;if(this.nextRow+g>this.height)return a.w("LineAtlas out of space"),null;let b=0;for(let C=0;C{g.send(s,h,b)},d=d||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(s=!0){this.actors.forEach(h=>{h.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}}function Ve(y,s,h){const d=function(g,b){if(g)return h(g);if(b){const I=a.F(a.e(b,y),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);b.vector_layers&&(I.vectorLayers=b.vector_layers,I.vectorLayerIds=I.vectorLayers.map(C=>C.id)),h(null,I)}};return y.url?a.f(s.transformRequest(y.url,K.Source),d):a.h.frame(()=>d(null,y))}class Ge{constructor(s,h){s&&(h?this.setSouthWest(s).setNorthEast(h):Array.isArray(s)&&(s.length===4?this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]]):this.setSouthWest(s[0]).setNorthEast(s[1])))}setNorthEast(s){return this._ne=s instanceof a.L?new a.L(s.lng,s.lat):a.L.convert(s),this}setSouthWest(s){return this._sw=s instanceof a.L?new a.L(s.lng,s.lat):a.L.convert(s),this}extend(s){const h=this._sw,d=this._ne;let g,b;if(s instanceof a.L)g=s,b=s;else{if(!(s instanceof Ge))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(Ge.convert(s)):this.extend(a.L.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(a.L.convert(s)):this;if(g=s._sw,b=s._ne,!g||!b)return this}return h||d?(h.lng=Math.min(g.lng,h.lng),h.lat=Math.min(g.lat,h.lat),d.lng=Math.max(b.lng,d.lng),d.lat=Math.max(b.lat,d.lat)):(this._sw=new a.L(g.lng,g.lat),this._ne=new a.L(b.lng,b.lat)),this}getCenter(){return new a.L((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.L(this.getWest(),this.getNorth())}getSouthEast(){return new a.L(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(s){const{lng:h,lat:d}=a.L.convert(s);let g=this._sw.lng<=h&&h<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=h&&h>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&g}static convert(s){return s instanceof Ge?s:s&&new Ge(s)}static fromLngLat(s,h=0){const d=360*h/40075017,g=d/Math.cos(Math.PI/180*s.lat);return new Ge(new a.L(s.lng-g,s.lat-d),new a.L(s.lng+g,s.lat+d))}}class mn{constructor(s,h,d){this.bounds=Ge.convert(this.validateBounds(s)),this.minzoom=h||0,this.maxzoom=d||24}validateBounds(s){return Array.isArray(s)&&s.length===4?[Math.max(-180,s[0]),Math.max(-90,s[1]),Math.min(180,s[2]),Math.min(90,s[3])]:[-180,-90,180,90]}contains(s){const h=Math.pow(2,s.z),d=Math.floor(a.G(this.bounds.getWest())*h),g=Math.floor(a.H(this.bounds.getNorth())*h),b=Math.ceil(a.G(this.bounds.getEast())*h),I=Math.ceil(a.H(this.bounds.getSouth())*h);return s.x>=d&&s.x=g&&s.y{this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this._tileJSONRequest=Ve(this._options,this.map._requestManager,(b,I)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),b?this.fire(new a.j(b)):I&&(a.e(this,I),I.bounds&&(this.tileBounds=new mn(I.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"})))})},this.serialize=()=>a.e({},this._options),this.id=s,this.dispatcher=d,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.e(this,a.F(h,["url","scheme","tileSize","promoteId"])),this._options=a.e({type:"vector"},h),this._collectResourceTiming=h.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(g)}loaded(){return this._loaded}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}onAdd(s){this.map=s,this.load()}setSourceProperty(s){this._tileJSONRequest&&this._tileJSONRequest.cancel(),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(s,h){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),g={request:this.map._requestManager.transformRequest(d,K.Tile),uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function b(I,C){return delete s.request,s.aborted?h(null):I&&I.status!==404?h(I):(C&&C.resourceTiming&&(s.resourceTiming=C.resourceTiming),this.map._refreshExpiredTiles&&C&&s.setExpiryData(C),s.loadVectorData(C,this.map.painter),h(null),void(s.reloadCallback&&(this.loadTile(s,s.reloadCallback),s.reloadCallback=null)))}g.request.collectResourceTiming=this._collectResourceTiming,s.actor&&s.state!=="expired"?s.state==="loading"?s.reloadCallback=h:s.request=s.actor.send("reloadTile",g,b.bind(this)):(s.actor=this.dispatcher.getActor(),s.request=s.actor.send("loadTile",g,b.bind(this)))}abortTile(s){s.request&&(s.request.cancel(),delete s.request),s.actor&&s.actor.send("abortTile",{uid:s.uid,type:this.type,source:this.id},void 0)}unloadTile(s){s.unloadVectorData(),s.actor&&s.actor.send("removeTile",{uid:s.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class qn extends a.E{constructor(s,h,d,g){super(),this.id=s,this.dispatcher=d,this.setEventedParent(g),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.F(h,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this._tileJSONRequest=Ve(this._options,this.map._requestManager,(s,h)=>{this._tileJSONRequest=null,this._loaded=!0,s?this.fire(new a.j(s)):h&&(a.e(this,h),h.bounds&&(this.tileBounds=new mn(h.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"})))})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}setSourceProperty(s){this._tileJSONRequest&&this._tileJSONRequest.cancel(),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}serialize(){return a.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s,h){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);s.request=Z.getImage(this.map._requestManager.transformRequest(d,K.Tile),(g,b,I)=>{if(delete s.request,s.aborted)s.state="unloaded",h(null);else if(g)s.state="errored",h(g);else if(b){this.map._refreshExpiredTiles&&I&&s.setExpiryData(I);const C=this.map.painter.context,M=C.gl;s.texture=this.map.painter.getTileTexture(b.width),s.texture?s.texture.update(b,{useMipmap:!0}):(s.texture=new Lt(C,b,M.RGBA,{useMipmap:!0}),s.texture.bind(M.LINEAR,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST),C.extTextureFilterAnisotropic&&M.texParameterf(M.TEXTURE_2D,C.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,C.extTextureFilterAnisotropicMax)),s.state="loaded",h(null)}},this.map._refreshExpiredTiles)}abortTile(s,h){s.request&&(s.request.cancel(),delete s.request),h()}unloadTile(s,h){s.texture&&this.map.painter.saveTileTexture(s.texture),h()}hasTransition(){return!1}}class ie extends qn{constructor(s,h,d,g){super(s,h,d,g),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(s,h){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),g=this.map._requestManager.transformRequest(d,K.Tile);function b(I,C){I&&(s.state="errored",h(I)),C&&(s.dem=C,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded",h(null))}s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.request=Z.getImage(g,(I,C,M)=>a._(this,void 0,void 0,function*(){if(delete s.request,s.aborted)s.state="unloaded",h(null);else if(I)s.state="errored",h(I);else if(C){this.map._refreshExpiredTiles&&s.setExpiryData(M);const k=a.a(C)&&a.J()?C:yield function(O){return a._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&a.K()){const q=O.width+2,nt=O.height+2;try{return new a.R({width:q,height:nt},yield a.M(O,-1,-1,q,nt))}catch{}}return a.h.getImageData(O,1)})}(C),R={uid:s.uid,coord:s.tileID,source:this.id,rawImageData:k,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};s.actor&&s.state!=="expired"||(s.actor=this.dispatcher.getActor(),s.actor.send("loadDEMTile",R,b))}}),this.map._refreshExpiredTiles)}_getNeighboringTiles(s){const h=s.canonical,d=Math.pow(2,h.z),g=(h.x-1+d)%d,b=h.x===0?s.wrap-1:s.wrap,I=(h.x+1+d)%d,C=h.x+1===d?s.wrap+1:s.wrap,M={};return M[new a.O(s.overscaledZ,b,h.z,g,h.y).key]={backfilled:!1},M[new a.O(s.overscaledZ,C,h.z,I,h.y).key]={backfilled:!1},h.y>0&&(M[new a.O(s.overscaledZ,b,h.z,g,h.y-1).key]={backfilled:!1},M[new a.O(s.overscaledZ,s.wrap,h.z,h.x,h.y-1).key]={backfilled:!1},M[new a.O(s.overscaledZ,C,h.z,I,h.y-1).key]={backfilled:!1}),h.y+1{this._updateWorkerData()},this.serialize=()=>a.e({},this._options,{type:this.type,data:this._data}),this.id=s,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=d.getActor(),this.setEventedParent(g),this._data=h.data,this._options=a.e({},h),this._collectResourceTiming=h.collectResourceTiming,h.maxzoom!==void 0&&(this.maxzoom=h.maxzoom),h.type&&(this.type=h.type),h.attribution&&(this.attribution=h.attribution),this.promoteId=h.promoteId;const b=a.N/this.tileSize;this.workerOptions=a.e({source:this.id,cluster:h.cluster||!1,geojsonVtOptions:{buffer:(h.buffer!==void 0?h.buffer:128)*b,tolerance:(h.tolerance!==void 0?h.tolerance:.375)*b,extent:a.N,maxZoom:this.maxzoom,lineMetrics:h.lineMetrics||!1,generateId:h.generateId||!1},superclusterOptions:{maxZoom:h.clusterMaxZoom!==void 0?h.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,h.clusterMinPoints||2),extent:a.N,radius:(h.clusterRadius||50)*b,log:!1,generateId:h.generateId||!1},clusterProperties:h.clusterProperties,filter:h.filter},h.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(s){this.map=s,this.load()}setData(s){return this._data=s,this._updateWorkerData(),this}updateData(s){return this._updateWorkerData(s),this}setClusterOptions(s){return this.workerOptions.cluster=s.cluster,s&&(s.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=s.clusterRadius),s.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=s.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(s,h){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:s,source:this.id},h),this}getClusterChildren(s,h){return this.actor.send("geojson.getClusterChildren",{clusterId:s,source:this.id},h),this}getClusterLeaves(s,h,d,g){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:s,limit:h,offset:d},g),this}_updateWorkerData(s){const h=a.e({},this.workerOptions);s?h.dataDiff=s:typeof this._data=="string"?(h.request=this.map._requestManager.transformRequest(a.h.resolveURL(this._data),K.Source),h.request.collectResourceTiming=this._collectResourceTiming):h.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new a.k("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,h,(d,g)=>{if(this._pendingLoads--,this._removed||g&&g.abandoned)return void this.fire(new a.k("dataabort",{dataType:"source"}));let b=null;if(g&&g.resourceTiming&&g.resourceTiming[this.id]&&(b=g.resourceTiming[this.id].slice(0)),d)return void this.fire(new a.j(d));const I={dataType:"source"};this._collectResourceTiming&&b&&b.length>0&&a.e(I,{resourceTiming:b}),this.fire(new a.k("data",Object.assign(Object.assign({},I),{sourceDataType:"metadata"}))),this.fire(new a.k("data",Object.assign(Object.assign({},I),{sourceDataType:"content"})))})}loaded(){return this._pendingLoads===0}loadTile(s,h){const d=s.actor?"reloadTile":"loadTile";s.actor=this.actor;const g={type:this.type,uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.request=this.actor.send(d,g,(b,I)=>(delete s.request,s.unloadVectorData(),s.aborted?h(null):b?h(b):(s.loadVectorData(I,this.map.painter,d==="reloadTile"),h(null))))}abortTile(s){s.request&&(s.request.cancel(),delete s.request),s.aborted=!0}unloadTile(s){s.unloadVectorData(),this.actor.send("removeTile",{uid:s.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}}var pn=a.Q([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Zn extends a.E{constructor(s,h,d,g){super(),this.load=(b,I)=>{this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=Z.getImage(this.map._requestManager.transformRequest(this.url,K.Image),(C,M)=>{this._request=null,this._loaded=!0,C?this.fire(new a.j(C)):M&&(this.image=M,b&&(this.coordinates=b),I&&I(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||!this.image)return;const b=this.map.painter.context,I=b.gl;this.boundsBuffer||(this.boundsBuffer=b.createVertexBuffer(this._boundsArray,pn.members)),this.boundsSegments||(this.boundsSegments=a.S.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Lt(b,this.image,I.RGBA),this.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE));let C=!1;for(const M in this.tiles){const k=this.tiles[M];k.state!=="loaded"&&(k.state="loaded",k.texture=this.texture,C=!0)}C&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=s,this.dispatcher=d,this.coordinates=h.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(g),this.options=h}loaded(){return this._loaded}updateImage(s){return s.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=s.url,this.load(s.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(s){this.coordinates=s;const h=s.map(a.U.fromLngLat);this.tileID=function(g){let b=1/0,I=1/0,C=-1/0,M=-1/0;for(const q of g)b=Math.min(b,q.x),I=Math.min(I,q.y),C=Math.max(C,q.x),M=Math.max(M,q.y);const k=Math.max(C-b,M-I),R=Math.max(0,Math.floor(-Math.log(k)/Math.LN2)),O=Math.pow(2,R);return new a.W(R,Math.floor((b+C)/2*O),Math.floor((I+M)/2*O))}(h),this.minzoom=this.maxzoom=this.tileID.z;const d=h.map(g=>this.tileID.getTilePoint(g)._round());return this._boundsArray=new a.V,this._boundsArray.emplaceBack(d[0].x,d[0].y,0,0),this._boundsArray.emplaceBack(d[1].x,d[1].y,a.N,0),this._boundsArray.emplaceBack(d[3].x,d[3].y,0,a.N),this._boundsArray.emplaceBack(d[2].x,d[2].y,a.N,a.N),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new a.k("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(s,h){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={},h(null)):(s.state="errored",h(null))}hasTransition(){return!1}}class Ar extends Zn{constructor(s,h,d,g){super(s,h,d,g),this.load=()=>{this._loaded=!1;const b=this.options;this.urls=[];for(const I of b.urls)this.urls.push(this.map._requestManager.transformRequest(I,K.Source).url);a.X(this.urls,(I,C)=>{this._loaded=!0,I?this.fire(new a.j(I)):C&&(this.video=C,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const b=this.map.painter.context,I=b.gl;this.boundsBuffer||(this.boundsBuffer=b.createVertexBuffer(this._boundsArray,pn.members)),this.boundsSegments||(this.boundsSegments=a.S.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE),I.texSubImage2D(I.TEXTURE_2D,0,0,0,I.RGBA,I.UNSIGNED_BYTE,this.video)):(this.texture=new Lt(b,this.video,I.RGBA),this.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE));let C=!1;for(const M in this.tiles){const k=this.tiles[M];k.state!=="loaded"&&(k.state="loaded",k.texture=this.texture,C=!0)}C&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=h}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){const h=this.video.seekable;sh.end(0)?this.fire(new a.j(new a.Y(`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=s}}getVideo(){return this.video}onAdd(s){this.map||(this.map=s,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}}class mi extends Zn{constructor(s,h,d,g){super(s,h,d,g),this.load=()=>{this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new 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())},this.prepare=()=>{let b=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,b=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,b=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const I=this.map.painter.context,C=I.gl;this.boundsBuffer||(this.boundsBuffer=I.createVertexBuffer(this._boundsArray,pn.members)),this.boundsSegments||(this.boundsSegments=a.S.simpleSegment(0,0,4,2)),this.texture?(b||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Lt(I,this.canvas,C.RGBA,{premultiply:!0});let M=!1;for(const k in this.tiles){const R=this.tiles[k];R.state!=="loaded"&&(R.state="loaded",R.texture=this.texture,M=!0)}M&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),h.coordinates?Array.isArray(h.coordinates)&&h.coordinates.length===4&&!h.coordinates.some(b=>!Array.isArray(b)||b.length!==2||b.some(I=>typeof I!="number"))||this.fire(new a.j(new a.Y(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.j(new a.Y(`sources.${s}`,null,'missing required property "coordinates"'))),h.animate&&typeof h.animate!="boolean"&&this.fire(new a.j(new a.Y(`sources.${s}`,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.Y(`sources.${s}`,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.Y(`sources.${s}`,null,'missing required property "canvas"'))),this.options=h,this.animate=h.animate===void 0||h.animate}getCanvas(){return this.canvas}onAdd(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const s of[this.canvas.width,this.canvas.height])if(isNaN(s)||s<=0)return!0;return!1}}const wt={},Ue=y=>{switch(y){case"geojson":return De;case"image":return Zn;case"raster":return qn;case"raster-dem":return ie;case"vector":return Qn;case"video":return Ar;case"canvas":return mi}return wt[y]};function ze(y,s){const h=a.Z();return a.$(h,h,[1,1,0]),a.a0(h,h,[.5*y.width,.5*y.height,1]),a.a1(h,h,y.calculatePosMatrix(s.toUnwrapped()))}function Wn(y,s,h,d,g,b){const I=function(O,q,nt){if(O)for(const et of O){const lt=q[et];if(lt&<.source===nt&<.type==="fill-extrusion")return!0}else for(const et in q){const lt=q[et];if(lt.source===nt&<.type==="fill-extrusion")return!0}return!1}(g&&g.layers,s,y.id),C=b.maxPitchScaleFactor(),M=y.tilesIn(d,C,I);M.sort(nn);const k=[];for(const O of M)k.push({wrappedTileID:O.tileID.wrapped().key,queryResults:O.tile.queryRenderedFeatures(s,h,y._state,O.queryGeometry,O.cameraQueryGeometry,O.scale,g,b,C,ze(y.transform,O.tileID))});const R=function(O){const q={},nt={};for(const et of O){const lt=et.queryResults,$=et.wrappedTileID,St=nt[$]=nt[$]||{};for(const Ot in lt){const pt=lt[Ot],Ct=St[Ot]=St[Ot]||{},Bt=q[Ot]=q[Ot]||[];for(const Vt of pt)Ct[Vt.featureIndex]||(Ct[Vt.featureIndex]=!0,Bt.push(Vt))}}return q}(k);for(const O in R)R[O].forEach(q=>{const nt=q.feature,et=y.getFeatureState(nt.layer["source-layer"],nt.id);nt.source=nt.layer.source,nt.layer["source-layer"]&&(nt.sourceLayer=nt.layer["source-layer"]),nt.state=et});return R}function nn(y,s){const h=y.tileID,d=s.tileID;return h.overscaledZ-d.overscaledZ||h.canonical.y-d.canonical.y||h.wrap-d.wrap||h.canonical.x-d.canonical.x}class Ie{constructor(s,h){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=a.a2(),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(s){const h=s+this.timeAdded;hb.getLayer(k)).filter(Boolean);if(M.length!==0){C.layers=M,C.stateDependentLayerIds&&(C.stateDependentLayers=C.stateDependentLayerIds.map(k=>M.filter(R=>R.id===k)[0]));for(const k of M)I[k.id]=C}}return I}(s.buckets,h.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const b=this.buckets[g];if(b instanceof a.a4){if(this.hasSymbolBuckets=!0,!d)break;b.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const b=this.buckets[g];if(b instanceof a.a4&&b.hasRTLText){this.hasRTLText=!0,a.a5();break}}this.queryPadding=0;for(const g in this.buckets){const b=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,h.style.getLayer(g).queryRadius(b))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new a.a3}unloadVectorData(){for(const s in this.buckets)this.buckets[s].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(s){return this.buckets[s.id]}upload(s){for(const d in this.buckets){const g=this.buckets[d];g.uploadPending()&&g.upload(s)}const h=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Lt(s,this.imageAtlas.image,h.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Lt(s,this.glyphAtlasImage,h.ALPHA),this.glyphAtlasImage=null)}prepare(s){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(s,this.imageAtlasTexture)}queryRenderedFeatures(s,h,d,g,b,I,C,M,k,R){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:g,cameraQueryGeometry:b,scale:I,tileSize:this.tileSize,pixelPosMatrix:R,transform:M,params:C,queryPadding:this.queryPadding*k},s,h,d):{}}querySourceFeatures(s,h){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const g=d.loadVTLayers(),b=h&&h.sourceLayer?h.sourceLayer:"",I=g._geojsonTileLayer||g[b];if(!I)return;const C=a.a6(h&&h.filter),{z:M,x:k,y:R}=this.tileID.canonical,O={z:M,x:k,y:R};for(let q=0;qd)g=!1;else if(h)if(this.expirationTime{this.remove(s,b)},d)),this.data[g].push(b),this.order.push(g),this.order.length>this.max){const I=this._getAndRemoveByKey(this.order[0]);I&&this.onRemove(I)}return this}has(s){return s.wrapped().key in this.data}getAndRemove(s){return this.has(s)?this._getAndRemoveByKey(s.wrapped().key):null}_getAndRemoveByKey(s){const h=this.data[s].shift();return h.timeout&&clearTimeout(h.timeout),this.data[s].length===0&&delete this.data[s],this.order.splice(this.order.indexOf(s),1),h.value}getByKey(s){const h=this.data[s];return h?h[0].value:null}get(s){return this.has(s)?this.data[s.wrapped().key][0].value:null}remove(s,h){if(!this.has(s))return this;const d=s.wrapped().key,g=h===void 0?0:this.data[d].indexOf(h),b=this.data[d][g];return this.data[d].splice(g,1),b.timeout&&clearTimeout(b.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(b.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(s){for(this.max=s;this.order.length>this.max;){const h=this._getAndRemoveByKey(this.order[0]);h&&this.onRemove(h)}return this}filter(s){const h=[];for(const d in this.data)for(const g of this.data[d])s(g.value)||h.push(g);for(const d of h)this.remove(d.value.tileID,d)}}class jt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,h,d){const g=String(h);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][g]=this.stateChanges[s][g]||{},a.e(this.stateChanges[s][g],d),this.deletedStates[s]===null){this.deletedStates[s]={};for(const b in this.state[s])b!==g&&(this.deletedStates[s][b]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][g]===null){this.deletedStates[s][g]={};for(const b in this.state[s][g])d[b]||(this.deletedStates[s][g][b]=null)}else for(const b in d)this.deletedStates[s]&&this.deletedStates[s][g]&&this.deletedStates[s][g][b]===null&&delete this.deletedStates[s][g][b]}removeFeatureState(s,h,d){if(this.deletedStates[s]===null)return;const g=String(h);if(this.deletedStates[s]=this.deletedStates[s]||{},d&&h!==void 0)this.deletedStates[s][g]!==null&&(this.deletedStates[s][g]=this.deletedStates[s][g]||{},this.deletedStates[s][g][d]=null);else if(h!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][g])for(d in this.deletedStates[s][g]={},this.stateChanges[s][g])this.deletedStates[s][g][d]=null;else this.deletedStates[s][g]=null;else this.deletedStates[s]=null}getState(s,h){const d=String(h),g=a.e({},(this.state[s]||{})[d],(this.stateChanges[s]||{})[d]);if(this.deletedStates[s]===null)return{};if(this.deletedStates[s]){const b=this.deletedStates[s][h];if(b===null)return{};for(const I in b)delete g[I]}return g}initializeTileState(s,h){s.setFeatureState(this.state,h)}coalesceChanges(s,h){const d={};for(const g in this.stateChanges){this.state[g]=this.state[g]||{};const b={};for(const I in this.stateChanges[g])this.state[g][I]||(this.state[g][I]={}),a.e(this.state[g][I],this.stateChanges[g][I]),b[I]=this.state[g][I];d[g]=b}for(const g in this.deletedStates){this.state[g]=this.state[g]||{};const b={};if(this.deletedStates[g]===null)for(const I in this.state[g])b[I]={},this.state[g][I]={};else for(const I in this.deletedStates[g]){if(this.deletedStates[g][I]===null)this.state[g][I]={};else for(const C of Object.keys(this.deletedStates[g][I]))delete this.state[g][I][C];b[I]=this.state[g][I]}d[g]=d[g]||{},a.e(d[g],b)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const g in s)s[g].setFeatureState(d,h)}}class Fi extends a.E{constructor(s,h,d){super(),this.id=s,this.dispatcher=d,this.on("data",g=>{g.dataType==="source"&&g.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&g.dataType==="source"&&g.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((g,b,I,C)=>{const M=new(Ue(b.type))(g,b,I,C);if(M.id!==g)throw new Error(`Expected Source id to be ${g} instead of ${M.id}`);return M})(s,h,d,this),this._tiles={},this._cache=new An(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new jt,this._didEmitContent=!1,this._updated=!1}onAdd(s){this.map=s,this._maxTileCacheSize=s?s._maxTileCacheSize:null,this._maxTileCacheZoomLevels=s?s._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(s)}onRemove(s){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(s)}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 s in this._tiles){const h=this._tiles[s];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 s=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,s&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(s,h){return this._source.loadTile(s,h)}_unloadTile(s){if(this._source.unloadTile)return this._source.unloadTile(s,()=>{})}_abortTile(s){this._source.abortTile&&this._source.abortTile(s,()=>{}),this._source.fire(new a.k("dataabort",{tile:s,coord:s.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(s){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const h in this._tiles){const d=this._tiles[h];d.upload(s),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(sr).map(s=>s.key)}getRenderableIds(s){const h=[];for(const d in this._tiles)this._isIdRenderable(d,s)&&h.push(this._tiles[d]);return s?h.sort((d,g)=>{const b=d.tileID,I=g.tileID,C=new a.P(b.canonical.x,b.canonical.y)._rotate(this.transform.angle),M=new a.P(I.canonical.x,I.canonical.y)._rotate(this.transform.angle);return b.overscaledZ-I.overscaledZ||M.y-C.y||M.x-C.x}).map(d=>d.tileID.key):h.map(d=>d.tileID).sort(sr).map(d=>d.key)}hasRenderableParent(s){const h=this.findLoadedParent(s,0);return!!h&&this._isIdRenderable(h.tileID.key)}_isIdRenderable(s,h){return this._tiles[s]&&this._tiles[s].hasData()&&!this._coveredTiles[s]&&(h||!this._tiles[s].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const s in this._tiles)this._tiles[s].state!=="errored"&&this._reloadTile(s,"reloading")}}_reloadTile(s,h){const d=this._tiles[s];d&&(d.state!=="loading"&&(d.state=h),this._loadTile(d,this._tileLoaded.bind(this,d,s,h)))}_tileLoaded(s,h,d,g){if(g)return s.state="errored",void(g.status!==404?this._source.fire(new a.j(g,{tile:s})):this.update(this.transform,this.terrain));s.timeAdded=a.h.now(),d==="expired"&&(s.refreshedUponExpiration=!0),this._setTileReloadTimer(h,s),this.getSource().type==="raster-dem"&&s.dem&&this._backfillDEM(s),this._state.initializeTileState(s,this.map?this.map.painter:null),s.aborted||this._source.fire(new a.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){const h=this.getRenderableIds();for(let g=0;g1||(Math.abs(I)>1&&(Math.abs(I+M)===1?I+=M:Math.abs(I-M)===1&&(I-=M)),b.dem&&g.dem&&(g.dem.backfillBorder(b.dem,I,C),g.neighboringTiles&&g.neighboringTiles[k]&&(g.neighboringTiles[k].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,h,d,g){for(const b in this._tiles){let I=this._tiles[b];if(g[b]||!I.hasData()||I.tileID.overscaledZ<=h||I.tileID.overscaledZ>d)continue;let C=I.tileID;for(;I&&I.tileID.overscaledZ>h+1;){const k=I.tileID.scaledTo(I.tileID.overscaledZ-1);I=this._tiles[k.key],I&&I.hasData()&&(C=k)}let M=C;for(;M.overscaledZ>h;)if(M=M.scaledTo(M.overscaledZ-1),s[M.key]){g[C.key]=C;break}}}findLoadedParent(s,h){if(s.key in this._loadedParentTiles){const d=this._loadedParentTiles[s.key];return d&&d.tileID.overscaledZ>=h?d:null}for(let d=s.overscaledZ-1;d>=h;d--){const g=s.scaledTo(d),b=this._getLoadedTile(g);if(b)return b}}_getLoadedTile(s){const h=this._tiles[s.key];return h&&h.hasData()?h:this._cache.getByKey(s.wrapped().key)}updateCacheSize(s){const h=Math.ceil(s.width/this._source.tileSize)+1,d=Math.ceil(s.height/this._source.tileSize)+1,g=Math.floor(h*d*(this._maxTileCacheZoomLevels===null?a.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),b=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(b)}handleWrapJump(s){const h=Math.round((s-(this._prevLng===void 0?s:this._prevLng))/360);if(this._prevLng=s,h){const d={};for(const g in this._tiles){const b=this._tiles[g];b.tileID=b.tileID.unwrapTo(b.tileID.wrap+h),d[b.tileID.key]=b}this._tiles=d;for(const g in this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(const g in this._tiles)this._setTileReloadTimer(g,this._tiles[g])}}update(s,h){if(this.transform=s,this.terrain=h,!this._sourceLoaded||this._paused)return;let d;this.updateCacheSize(s),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=s.getVisibleUnwrappedCoordinates(this._source.tileID).map(R=>new a.O(R.canonical.z,R.wrap,R.canonical.z,R.canonical.x,R.canonical.y)):(d=s.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&&(d=d.filter(R=>this._source.hasTile(R)))):d=[];const g=s.coveringZoomLevel(this._source),b=Math.max(g-Fi.maxOverzooming,this._source.minzoom),I=Math.max(g+Fi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const R={};for(const O of d)if(O.canonical.z>this._source.minzoom){const q=O.scaledTo(O.canonical.z-1);R[q.key]=q;const nt=O.scaledTo(Math.max(this._source.minzoom,Math.min(O.canonical.z,5)));R[nt.key]=nt}d=d.concat(Object.values(R))}const C=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,C&&this.fire(new a.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const M=this._updateRetainedTiles(d,g);if(zn(this._source.type)){const R={},O={},q=Object.keys(M),nt=a.h.now();for(const et of q){const lt=M[et],$=this._tiles[et];if(!$||$.fadeEndTime!==0&&$.fadeEndTime<=nt)continue;const St=this.findLoadedParent(lt,b);St&&(this._addTile(St.tileID),R[St.tileID.key]=St.tileID),O[et]=lt}this._retainLoadedChildren(O,g,I,M);for(const et in R)M[et]||(this._coveredTiles[et]=!0,M[et]=R[et]);if(h){const et={},lt={};for(const $ of d)this._tiles[$.key].hasData()?et[$.key]=$:lt[$.key]=$;for(const $ in lt){const St=lt[$].children(this._source.maxzoom);this._tiles[St[0].key]&&this._tiles[St[1].key]&&this._tiles[St[2].key]&&this._tiles[St[3].key]&&(et[St[0].key]=M[St[0].key]=St[0],et[St[1].key]=M[St[1].key]=St[1],et[St[2].key]=M[St[2].key]=St[2],et[St[3].key]=M[St[3].key]=St[3],delete lt[$])}for(const $ in lt){const St=this.findLoadedParent(lt[$],this._source.minzoom);if(St){et[St.tileID.key]=M[St.tileID.key]=St.tileID;for(const Ot in et)et[Ot].isChildOf(St.tileID)&&delete et[Ot]}}for(const $ in this._tiles)et[$]||(this._coveredTiles[$]=!0)}}for(const R in M)this._tiles[R].clearFadeHold();const k=a.ab(this._tiles,M);for(const R of k){const O=this._tiles[R];O.hasSymbolBuckets&&!O.holdingForFade()?O.setHoldDuration(this.map._fadeDuration):O.hasSymbolBuckets&&!O.symbolFadeFinished()||this._removeTile(R)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const s in this._tiles)this._tiles[s].holdingForFade()&&this._removeTile(s)}_updateRetainedTiles(s,h){const d={},g={},b=Math.max(h-Fi.maxOverzooming,this._source.minzoom),I=Math.max(h+Fi.maxUnderzooming,this._source.minzoom),C={};for(const M of s){const k=this._addTile(M);d[M.key]=M,k.hasData()||hthis._source.maxzoom){const O=M.children(this._source.maxzoom)[0],q=this.getTile(O);if(q&&q.hasData()){d[O.key]=O;continue}}else{const O=M.children(this._source.maxzoom);if(d[O[0].key]&&d[O[1].key]&&d[O[2].key]&&d[O[3].key])continue}let R=k.wasRequested();for(let O=M.overscaledZ-1;O>=b;--O){const q=M.scaledTo(O);if(g[q.key])break;if(g[q.key]=!0,k=this.getTile(q),!k&&R&&(k=this._addTile(q)),k){const nt=k.hasData();if((R||nt)&&(d[q.key]=q),R=k.wasRequested(),nt)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const s in this._tiles){const h=[];let d,g=this._tiles[s].tileID;for(;g.overscaledZ>0;){if(g.key in this._loadedParentTiles){d=this._loadedParentTiles[g.key];break}h.push(g.key);const b=g.scaledTo(g.overscaledZ-1);if(d=this._getLoadedTile(b),d)break;g=b}for(const b of h)this._loadedParentTiles[b]=d}}_addTile(s){let h=this._tiles[s.key];if(h)return h;h=this._cache.getAndRemove(s),h&&(this._setTileReloadTimer(s.key,h),h.tileID=s,this._state.initializeTileState(h,this.map?this.map.painter:null),this._cacheTimers[s.key]&&(clearTimeout(this._cacheTimers[s.key]),delete this._cacheTimers[s.key],this._setTileReloadTimer(s.key,h)));const d=h;return h||(h=new Ie(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(h,this._tileLoaded.bind(this,h,s.key,h.state))),h.uses++,this._tiles[s.key]=h,d||this._source.fire(new a.k("dataloading",{tile:h,coord:h.tileID,dataType:"source"})),h}_setTileReloadTimer(s,h){s in this._timers&&(clearTimeout(this._timers[s]),delete this._timers[s]);const d=h.getExpiryTimeout();d&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},d))}_removeTile(s){const h=this._tiles[s];h&&(h.uses--,delete this._tiles[s],this._timers[s]&&(clearTimeout(this._timers[s]),delete this._timers[s]),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))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const s in this._tiles)this._removeTile(s);this._cache.reset()}tilesIn(s,h,d){const g=[],b=this.transform;if(!b)return g;const I=d?b.getCameraQueryGeometry(s):s,C=s.map(et=>b.pointCoordinate(et,this.terrain)),M=I.map(et=>b.pointCoordinate(et,this.terrain)),k=this.getIds();let R=1/0,O=1/0,q=-1/0,nt=-1/0;for(const et of M)R=Math.min(R,et.x),O=Math.min(O,et.y),q=Math.max(q,et.x),nt=Math.max(nt,et.y);for(let et=0;et=0&&pt[1].y+Ot>=0){const Ct=C.map(Vt=>$.getTilePoint(Vt)),Bt=M.map(Vt=>$.getTilePoint(Vt));g.push({tile:lt,tileID:$,queryGeometry:Ct,cameraQueryGeometry:Bt,scale:St})}}return g}getVisibleCoordinates(s){const h=this.getRenderableIds(s).map(d=>this._tiles[d].tileID);for(const d of h)d.posMatrix=this.transform.calculatePosMatrix(d.toUnwrapped());return h}hasTransition(){if(this._source.hasTransition())return!0;if(zn(this._source.type)){const s=a.h.now();for(const h in this._tiles)if(this._tiles[h].fadeEndTime>=s)return!0}return!1}setFeatureState(s,h,d){this._state.updateState(s=s||"_geojsonTileLayer",h,d)}removeFeatureState(s,h,d){this._state.removeFeatureState(s=s||"_geojsonTileLayer",h,d)}getFeatureState(s,h){return this._state.getState(s=s||"_geojsonTileLayer",h)}setDependencies(s,h,d){const g=this._tiles[s];g&&g.setDependencies(h,d)}reloadTilesForDependencies(s,h){for(const d in this._tiles)this._tiles[d].hasDependency(s,h)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(s,h))}}function sr(y,s){const h=Math.abs(2*y.wrap)-+(y.wrap<0),d=Math.abs(2*s.wrap)-+(s.wrap<0);return y.overscaledZ-s.overscaledZ||d-h||s.canonical.y-y.canonical.y||s.canonical.x-y.canonical.x}function zn(y){return y==="raster"||y==="image"||y==="video"}Fi.maxOverzooming=10,Fi.maxUnderzooming=3;const En="mapboxgl_preloaded_worker_pool";class $o{constructor(){this.active={}}acquire(s){if(!this.workers)for(this.workers=[];this.workers.length<$o.workerCount;)this.workers.push(new Worker(a.c.WORKER_URL));return this.active[s]=!0,this.workers.slice()}release(s){delete this.active[s],this.numActive()===0&&(this.workers.forEach(h=>{h.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[En]}numActive(){return Object.keys(this.active).length}}const oo=Math.floor(a.h.hardwareConcurrency/2);let ts;function Ha(){return ts||(ts=new $o),ts}$o.workerCount=a.ac(globalThis)?Math.max(Math.min(oo,3),1):1;class Gs{constructor(s,h){this.reset(s,h)}reset(s,h){this.points=s||[],this._distances=[0];for(let d=1;d0?(g-I)/C:0;return this.points[b].mult(1-M).add(this.points[h].mult(M))}}function js(y,s){let h=!0;return y==="always"||y!=="never"&&s!=="never"||(h=!1),h}class wa{constructor(s,h,d){const g=this.boxCells=[],b=this.circleCells=[];this.xCellCount=Math.ceil(s/d),this.yCellCount=Math.ceil(h/d);for(let I=0;Ithis.width||g<0||h>this.height)return[];const M=[];if(s<=0&&h<=0&&this.width<=d&&this.height<=g){if(b)return[{key:null,x1:s,y1:h,x2:d,y2:g}];for(let k=0;k0}hitTestCircle(s,h,d,g,b){const I=s-d,C=s+d,M=h-d,k=h+d;if(C<0||I>this.width||k<0||M>this.height)return!1;const R=[];return this._forEachCell(I,M,C,k,this._queryCellCircle,R,{hitTest:!0,overlapMode:g,circle:{x:s,y:h,radius:d},seenUids:{box:{},circle:{}}},b),R.length>0}_queryCell(s,h,d,g,b,I,C,M){const{seenUids:k,hitTest:R,overlapMode:O}=C,q=this.boxCells[b];if(q!==null){const et=this.bboxes;for(const lt of q)if(!k.box[lt]){k.box[lt]=!0;const $=4*lt,St=this.boxKeys[lt];if(s<=et[$+2]&&h<=et[$+3]&&d>=et[$+0]&&g>=et[$+1]&&(!M||M(St))&&(!R||!js(O,St.overlapMode))&&(I.push({key:St,x1:et[$],y1:et[$+1],x2:et[$+2],y2:et[$+3]}),R))return!0}}const nt=this.circleCells[b];if(nt!==null){const et=this.circles;for(const lt of nt)if(!k.circle[lt]){k.circle[lt]=!0;const $=3*lt,St=this.circleKeys[lt];if(this._circleAndRectCollide(et[$],et[$+1],et[$+2],s,h,d,g)&&(!M||M(St))&&(!R||!js(O,St.overlapMode))){const Ot=et[$],pt=et[$+1],Ct=et[$+2];if(I.push({key:St,x1:Ot-Ct,y1:pt-Ct,x2:Ot+Ct,y2:pt+Ct}),R)return!0}}}return!1}_queryCellCircle(s,h,d,g,b,I,C,M){const{circle:k,seenUids:R,overlapMode:O}=C,q=this.boxCells[b];if(q!==null){const et=this.bboxes;for(const lt of q)if(!R.box[lt]){R.box[lt]=!0;const $=4*lt,St=this.boxKeys[lt];if(this._circleAndRectCollide(k.x,k.y,k.radius,et[$+0],et[$+1],et[$+2],et[$+3])&&(!M||M(St))&&!js(O,St.overlapMode))return I.push(!0),!0}}const nt=this.circleCells[b];if(nt!==null){const et=this.circles;for(const lt of nt)if(!R.circle[lt]){R.circle[lt]=!0;const $=3*lt,St=this.circleKeys[lt];if(this._circlesCollide(et[$],et[$+1],et[$+2],k.x,k.y,k.radius)&&(!M||M(St))&&!js(O,St.overlapMode))return I.push(!0),!0}}}_forEachCell(s,h,d,g,b,I,C,M){const k=this._convertToXCellCoord(s),R=this._convertToYCellCoord(h),O=this._convertToXCellCoord(d),q=this._convertToYCellCoord(g);for(let nt=k;nt<=O;nt++)for(let et=R;et<=q;et++)if(b.call(this,s,h,d,g,this.xCellCount*et+nt,I,C,M))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,h,d,g,b,I){const C=g-s,M=b-h,k=d+I;return k*k>C*C+M*M}_circleAndRectCollide(s,h,d,g,b,I,C){const M=(I-g)/2,k=Math.abs(s-(g+M));if(k>M+d)return!1;const R=(C-b)/2,O=Math.abs(h-(b+R));if(O>R+d)return!1;if(k<=M||O<=R)return!0;const q=k-M,nt=O-R;return q*q+nt*nt<=d*d}}function se(y,s,h,d,g){const b=a.Z();return s?(a.a0(b,b,[1/g,1/g,1]),h||a.ae(b,b,d.angle)):a.a1(b,d.labelPlaneMatrix,y),b}function yo(y,s,h,d,g){if(s){const b=a.af(y);return a.a0(b,b,[g,g,1]),h||a.ae(b,b,-d.angle),b}return d.glCoordMatrix}function ri(y,s,h){let d;h?(d=[y.x,y.y,h(y.x,y.y),1],a.ag(d,d,s)):(d=[y.x,y.y,0,1],j(d,d,s));const g=d[3];return{point:new a.P(d[0]/g,d[1]/g),signedDistanceFromCamera:g}}function Sa(y,s){return .5+y/s*.5}function xs(y,s){const h=y[0]/y[3],d=y[1]/y[3];return h>=-s[0]&&h<=s[0]&&d>=-s[1]&&d<=s[1]}function le(y,s,h,d,g,b,I,C,M,k){const R=d?y.textSizeData:y.iconSizeData,O=a.ah(R,h.transform.zoom),q=[256/h.width*2+1,256/h.height*2+1],nt=d?y.text.dynamicLayoutVertexArray:y.icon.dynamicLayoutVertexArray;nt.clear();const et=y.lineVertexArray,lt=d?y.text.placedSymbolArray:y.icon.placedSymbolArray,$=h.transform.width/h.transform.height;let St=!1;for(let Ot=0;OtMath.abs(h.x-s.x)*d?{useVertical:!0}:(y===a.ai.vertical?s.yh.x)?{needsFlipping:!0}:null}function kr(y,s,h,d,g,b,I,C,M,k,R,O,q,nt,et,lt){const $=s/24,St=y.lineOffsetX*$,Ot=y.lineOffsetY*$;let pt;if(y.numGlyphs>1){const Ct=y.glyphStartIndex+y.numGlyphs,Bt=y.lineStartIndex,Vt=y.lineStartIndex+y.lineLength,Wt=hn($,C,St,Ot,h,R,O,y,M,b,q,et,lt);if(!Wt)return{notEnoughRoom:!0};const ee=ri(Wt.first.point,I,lt).point,Kt=ri(Wt.last.point,I,lt).point;if(d&&!h){const oe=Je(y.writingMode,ee,Kt,nt);if(oe)return oe}pt=[Wt.first];for(let oe=y.glyphStartIndex+1;oe0?ee.point:es(O,Wt,Bt,1,g,lt),oe=Je(y.writingMode,Bt,Kt,nt);if(oe)return oe}const Ct=B($*C.getoffsetX(y.glyphStartIndex),St,Ot,h,R,O,y.segment,y.lineStartIndex,y.lineStartIndex+y.lineLength,M,b,q,et,lt);if(!Ct)return{notEnoughRoom:!0};pt=[Ct]}for(const Ct of pt)a.ak(k,Ct.point,Ct.angle);return{}}function es(y,s,h,d,g,b){const I=ri(y.add(y.sub(s)._unit()),g,b).point,C=h.sub(I);return h.add(C._mult(d/C.mag()))}function on(y,s){const{projectionCache:h,lineVertexArray:d,labelPlaneMatrix:g,tileAnchorPoint:b,distanceFromAnchor:I,getElevation:C,previousVertex:M,direction:k,absOffsetX:R}=s;if(h.projections[y])return h.projections[y];const O=new a.P(d.getx(y),d.gety(y)),q=ri(O,g,C);if(q.signedDistanceFromCamera>0)return h.projections[y]=q.point,q.point;const nt=y-k;return es(I===0?b:new a.P(d.getx(nt),d.gety(nt)),O,M,R-I+1,g,C)}function ws(y,s,h){return y._unit()._perp()._mult(s*h)}function st(y,s,h,d,g,b,I,C){const{projectionCache:M,direction:k}=C;if(M.offsets[y])return M.offsets[y];const R=h.add(s);if(y+k=g)return M.offsets[y]=R,R;const O=on(y+k,C),q=ws(O.sub(h),I,k),nt=h.add(q),et=O.add(q);return M.offsets[y]=a.al(b,R,nt,et)||R,M.offsets[y]}function B(y,s,h,d,g,b,I,C,M,k,R,O,q,nt){const et=d?y-s:y+s;let lt=et>0?1:-1,$=0;d&&(lt*=-1,$=Math.PI),lt<0&&($+=Math.PI);let St,Ot,pt=lt>0?C+I:C+I+1,Ct=g,Bt=g,Vt=0,Wt=0;const ee=Math.abs(et),Kt=[];let oe;for(;Vt+Wt<=ee;){if(pt+=lt,pt=M)return null;Vt+=Wt,Bt=Ct,Ot=St;const pe={projectionCache:O,lineVertexArray:k,labelPlaneMatrix:R,tileAnchorPoint:b,distanceFromAnchor:Vt,getElevation:nt,previousVertex:Bt,direction:lt,absOffsetX:ee};if(Ct=on(pt,pe),h===0)Kt.push(Bt),oe=Ct.sub(Bt);else{let qe;const Me=Ct.sub(Bt);qe=Me.mag()===0?ws(on(pt+lt,pe).sub(Ct),h,lt):ws(Me,h,lt),Ot||(Ot=Bt.add(qe)),St=st(pt,qe,Ct,C,M,Ot,h,pe),Kt.push(Ot),oe=St.sub(Ot)}Wt=oe.mag()}const Te=oe._mult((ee-Vt)/Wt)._add(Ot||Bt),bn=$+Math.atan2(Ct.y-Bt.y,Ct.x-Bt.x);return Kt.push(Te),{point:Te,angle:q?bn:0,path:Kt}}const G=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function J(y,s){for(let h=0;h=1;fn--)Me.push(pe.path[fn]);for(let fn=1;fnri(xn,M,et));Me=fn.some(xn=>xn.signedDistanceFromCamera<=0)?[]:fn.map(xn=>xn.point)}let vn=[];if(Me.length>0){const fn=Me[0].clone(),xn=Me[0].clone();for(let Bi=1;Bi=oe.x&&xn.x<=Te.x&&fn.y>=oe.y&&xn.y<=Te.y?[Me]:xn.xTe.x||xn.yTe.y?[]:a.am([Me],oe.x,oe.y,Te.x,Te.y)}for(const fn of vn){bn.reset(fn,.25*Kt);let xn=0;xn=bn.length<=.5*Kt?1:Math.ceil(bn.paddedLength/Kn)+1;for(let Bi=0;Bi=this.screenRightBoundary||gthis.screenBottomBoundary}isInsideGrid(s,h,d,g){return d>=0&&s=0&&hd.collisionGroupID===h}}return this.collisionGroups[s]}}function Ke(y,s,h,d,g){const{horizontalAlign:b,verticalAlign:I}=a.au(y);return new a.P(-(b-.5)*s+d[0]*g,-(I-.5)*h+d[1]*g)}function Ce(y,s,h,d,g,b){const{x1:I,x2:C,y1:M,y2:k,anchorPointX:R,anchorPointY:O}=y,q=new a.P(s,h);return d&&q._rotate(g?b:-b),{x1:I+q.x,y1:M+q.y,x2:C+q.x,y2:k+q.y,anchorPointX:R,anchorPointY:O}}class Be{constructor(s,h,d,g,b){this.transform=s.clone(),this.terrain=h,this.collisionIndex=new It(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new ke(g),this.collisionCircleArrays={},this.prevPlacement=b,b&&(b.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(s,h,d,g){const b=d.getBucket(h),I=d.latestFeatureIndex;if(!b||!I||h.id!==b.layerIds[0])return;const C=d.collisionBoxArray,M=b.layers[0].layout,k=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),R=d.tileSize/a.N,O=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),q=M.get("text-pitch-alignment")==="map",nt=M.get("text-rotation-alignment")==="map",et=mt(d,1,this.transform.zoom),lt=se(O,q,nt,this.transform,et);let $=null;if(q){const Ot=yo(O,q,nt,this.transform,et);$=a.a1([],this.transform.labelPlaneMatrix,Ot)}this.retainedQueryData[b.bucketInstanceId]=new Xt(b.bucketInstanceId,I,b.sourceLayerIndex,b.index,d.tileID);const St={bucket:b,layout:M,posMatrix:O,textLabelPlaneMatrix:lt,labelToScreenMatrix:$,scale:k,textPixelRatio:R,holdingForFade:d.holdingForFade(),collisionBoxArray:C,partiallyEvaluatedTextSize:a.ah(b.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(b.sourceID)};if(g)for(const Ot of b.sortKeyRanges){const{sortKey:pt,symbolInstanceStart:Ct,symbolInstanceEnd:Bt}=Ot;s.push({sortKey:pt,symbolInstanceStart:Ct,symbolInstanceEnd:Bt,parameters:St})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:b.symbolInstances.length,parameters:St})}attemptAnchorPlacement(s,h,d,g,b,I,C,M,k,R,O,q,nt,et,lt,$){const St=a.aq[s.textAnchor],Ot=[s.textOffset0,s.textOffset1],pt=Ke(St,d,g,Ot,b),Ct=this.collisionIndex.placeCollisionBox(Ce(h,pt.x,pt.y,I,C,this.transform.angle),O,M,k,R.predicate,$);if((!lt||this.collisionIndex.placeCollisionBox(Ce(lt,pt.x,pt.y,I,C,this.transform.angle),O,M,k,R.predicate,$).box.length!==0)&&Ct.box.length>0){let Bt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[q.crossTileID]&&this.prevPlacement.placements[q.crossTileID]&&this.prevPlacement.placements[q.crossTileID].text&&(Bt=this.prevPlacement.variableOffsets[q.crossTileID].anchor),q.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[q.crossTileID]={textOffset:Ot,width:d,height:g,anchor:St,textBoxScale:b,prevAnchor:Bt},this.markUsedJustification(nt,St,q,et),nt.allowVerticalPlacement&&(this.markUsedOrientation(nt,et,q),this.placedOrientations[q.crossTileID]=et),{shift:pt,placedGlyphBoxes:Ct}}}placeLayerBucketPart(s,h,d){const{bucket:g,layout:b,posMatrix:I,textLabelPlaneMatrix:C,labelToScreenMatrix:M,textPixelRatio:k,holdingForFade:R,collisionBoxArray:O,partiallyEvaluatedTextSize:q,collisionGroup:nt}=s.parameters,et=b.get("text-optional"),lt=b.get("icon-optional"),$=a.ar(b,"text-overlap","text-allow-overlap"),St=$==="always",Ot=a.ar(b,"icon-overlap","icon-allow-overlap"),pt=Ot==="always",Ct=b.get("text-rotation-alignment")==="map",Bt=b.get("text-pitch-alignment")==="map",Vt=b.get("icon-text-fit")!=="none",Wt=b.get("symbol-z-order")==="viewport-y",ee=St&&(pt||!g.hasIconData()||lt),Kt=pt&&(St||!g.hasTextData()||et);!g.collisionArrays&&O&&g.deserializeCollisionBoxes(O);const oe=this.retainedQueryData[g.bucketInstanceId].tileID,Te=this.terrain?(pe,qe)=>this.terrain.getElevation(oe,pe,qe):null,bn=(pe,qe)=>{var Me,Kn;if(h[pe.crossTileID])return;if(R)return void(this.placements[pe.crossTileID]=new qt(!1,!1,!1));let vn=!1,fn=!1,xn=!0,Bi=null,si={box:null,offscreen:null},Rr={box:null,offscreen:null},ar=null,Xi=null,Fo=null,hi=0,Zs=0,Ws=0;qe.textFeatureIndex?hi=qe.textFeatureIndex:pe.useRuntimeCollisionCircles&&(hi=pe.featureIndex),qe.verticalTextFeatureIndex&&(Zs=qe.verticalTextFeatureIndex);const el=qe.textBox;if(el){const Wr=Vi=>{let lr=a.ai.horizontal;if(g.allowVerticalPlacement&&!Vi&&this.prevPlacement){const xo=this.prevPlacement.placedOrientations[pe.crossTileID];xo&&(this.placedOrientations[pe.crossTileID]=xo,lr=xo,this.markUsedOrientation(g,lr,pe))}return lr},Or=(Vi,lr)=>{if(g.allowVerticalPlacement&&pe.numVerticalGlyphVertices>0&&qe.verticalTextBox){for(const xo of g.writingModes)if(xo===a.ai.vertical?(si=lr(),Rr=si):si=Vi(),si&&si.box&&si.box.length)break}else si=Vi()},ao=pe.textAnchorOffsetStartIndex,Al=pe.textAnchorOffsetEndIndex;if(Al===ao){const Vi=(lr,xo)=>{const Ui=this.collisionIndex.placeCollisionBox(lr,$,k,I,nt.predicate,Te);return Ui&&Ui.box&&Ui.box.length&&(this.markUsedOrientation(g,xo,pe),this.placedOrientations[pe.crossTileID]=xo),Ui};Or(()=>Vi(el,a.ai.horizontal),()=>{const lr=qe.verticalTextBox;return g.allowVerticalPlacement&&pe.numVerticalGlyphVertices>0&&lr?Vi(lr,a.ai.vertical):{box:null,offscreen:null}}),Wr(si&&si.box&&si.box.length)}else{let Vi=a.aq[(Kn=(Me=this.prevPlacement)===null||Me===void 0?void 0:Me.variableOffsets[pe.crossTileID])===null||Kn===void 0?void 0:Kn.anchor];const lr=(Ui,kl,ph)=>{const om=Ui.x2-Ui.x1,sm=Ui.y2-Ui.y1,Jg=pe.textBoxScale,tf=Vt&&Ot==="never"?kl:null;let Xs={box:[],offscreen:!1},Nl=$==="never"?1:2,Hs="never";Vi&&Nl++;for(let ls=0;lslr(el,qe.iconBox,a.ai.horizontal),()=>{const Ui=qe.verticalTextBox;return g.allowVerticalPlacement&&!(si&&si.box&&si.box.length)&&pe.numVerticalGlyphVertices>0&&Ui?lr(Ui,qe.verticalIconBox,a.ai.vertical):{box:null,offscreen:null}}),si&&(vn=si.box,xn=si.offscreen);const xo=Wr(si&&si.box);if(!vn&&this.prevPlacement){const Ui=this.prevPlacement.variableOffsets[pe.crossTileID];Ui&&(this.variableOffsets[pe.crossTileID]=Ui,this.markUsedJustification(g,Ui.anchor,pe,xo))}}}if(ar=si,vn=ar&&ar.box&&ar.box.length>0,xn=ar&&ar.offscreen,pe.useRuntimeCollisionCircles){const Wr=g.text.placedSymbolArray.get(pe.centerJustifiedTextSymbolIndex),Or=a.aj(g.textSizeData,q,Wr),ao=b.get("text-padding");Xi=this.collisionIndex.placeCollisionCircles($,Wr,g.lineVertexArray,g.glyphOffsetArray,Or,I,C,M,d,Bt,nt.predicate,pe.collisionCircleDiameter,ao,Te),Xi.circles.length&&Xi.collisionDetected&&!d&&a.w("Collisions detected, but collision boxes are not shown"),vn=St||Xi.circles.length>0&&!Xi.collisionDetected,xn=xn&&Xi.offscreen}if(qe.iconFeatureIndex&&(Ws=qe.iconFeatureIndex),qe.iconBox){const Wr=Or=>{const ao=Vt&&Bi?Ce(Or,Bi.x,Bi.y,Ct,Bt,this.transform.angle):Or;return this.collisionIndex.placeCollisionBox(ao,Ot,k,I,nt.predicate,Te)};Rr&&Rr.box&&Rr.box.length&&qe.verticalIconBox?(Fo=Wr(qe.verticalIconBox),fn=Fo.box.length>0):(Fo=Wr(qe.iconBox),fn=Fo.box.length>0),xn=xn&&Fo.offscreen}const Pl=et||pe.numHorizontalGlyphVertices===0&&pe.numVerticalGlyphVertices===0,yu=lt||pe.numIconVertices===0;if(Pl||yu?yu?Pl||(fn=fn&&vn):vn=fn&&vn:fn=vn=fn&&vn,vn&&ar&&ar.box&&this.collisionIndex.insertCollisionBox(ar.box,$,b.get("text-ignore-placement"),g.bucketInstanceId,Rr&&Rr.box&&Zs?Zs:hi,nt.ID),fn&&Fo&&this.collisionIndex.insertCollisionBox(Fo.box,Ot,b.get("icon-ignore-placement"),g.bucketInstanceId,Ws,nt.ID),Xi&&(vn&&this.collisionIndex.insertCollisionCircles(Xi.circles,$,b.get("text-ignore-placement"),g.bucketInstanceId,hi,nt.ID),d)){const Wr=g.bucketInstanceId;let Or=this.collisionCircleArrays[Wr];Or===void 0&&(Or=this.collisionCircleArrays[Wr]=new Zt);for(let ao=0;ao=0;--qe){const Me=pe[qe];bn(g.symbolInstances.get(Me),g.collisionArrays[Me])}}else for(let pe=s.symbolInstanceStart;pe=0&&(s.text.placedSymbolArray.get(C).crossTileID=b>=0&&C!==b?0:d.crossTileID)}markUsedOrientation(s,h,d){const g=h===a.ai.horizontal||h===a.ai.horizontalOnly?h:0,b=h===a.ai.vertical?h:0,I=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const C of I)s.text.placedSymbolArray.get(C).placedOrientation=g;d.verticalPlacedTextSymbolIndex&&(s.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=b)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const h=this.prevPlacement;let d=!1;this.prevZoomAdjustment=h?h.zoomAdjustment(this.transform.zoom):0;const g=h?h.symbolFadeChange(s):1,b=h?h.opacities:{},I=h?h.variableOffsets:{},C=h?h.placedOrientations:{};for(const M in this.placements){const k=this.placements[M],R=b[M];R?(this.opacities[M]=new xt(R,g,k.text,k.icon),d=d||k.text!==R.text.placed||k.icon!==R.icon.placed):(this.opacities[M]=new xt(null,g,k.text,k.icon,k.skipFade),d=d||k.text||k.icon)}for(const M in b){const k=b[M];if(!this.opacities[M]){const R=new xt(k,g,!1,!1);R.isHidden()||(this.opacities[M]=R,d=d||k.text.placed||k.icon.placed)}}for(const M in I)this.variableOffsets[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.variableOffsets[M]=I[M]);for(const M in C)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=C[M]);if(h&&h.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=h?h.lastPlacementChangeTime:s)}updateLayerOpacities(s,h){const d={};for(const g of h){const b=g.getBucket(s);b&&g.latestFeatureIndex&&s.id===b.layerIds[0]&&this.updateBucketOpacities(b,d,g.collisionBoxArray)}}updateBucketOpacities(s,h,d){s.hasTextData()&&(s.text.opacityVertexArray.clear(),s.text.hasVisibleVertices=!1),s.hasIconData()&&(s.icon.opacityVertexArray.clear(),s.icon.hasVisibleVertices=!1),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexArray.clear(),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexArray.clear();const g=s.layers[0],b=g.layout,I=new xt(null,0,!1,!1,!0),C=b.get("text-allow-overlap"),M=b.get("icon-allow-overlap"),k=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),R=b.get("text-rotation-alignment")==="map",O=b.get("text-pitch-alignment")==="map",q=b.get("icon-text-fit")!=="none",nt=new xt(null,0,C&&(M||!s.hasIconData()||b.get("icon-optional")),M&&(C||!s.hasTextData()||b.get("text-optional")),!0);!s.collisionArrays&&d&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(d);const et=(lt,$,St)=>{for(let Ot=0;Ot<$/4;Ot++)lt.opacityVertexArray.emplaceBack(St);lt.hasVisibleVertices=lt.hasVisibleVertices||St!==ns};for(let lt=0;lt0,Vt=this.placedOrientations[$.crossTileID],Wt=Vt===a.ai.vertical,ee=Vt===a.ai.horizontal||Vt===a.ai.horizontalOnly;if(St>0||Ot>0){const Kt=Nr(Ct.text);et(s.text,St,Wt?ns:Kt),et(s.text,Ot,ee?ns:Kt);const oe=Ct.text.isHidden();[$.rightJustifiedTextSymbolIndex,$.centerJustifiedTextSymbolIndex,$.leftJustifiedTextSymbolIndex].forEach(pe=>{pe>=0&&(s.text.placedSymbolArray.get(pe).hidden=oe||Wt?1:0)}),$.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get($.verticalPlacedTextSymbolIndex).hidden=oe||ee?1:0);const Te=this.variableOffsets[$.crossTileID];Te&&this.markUsedJustification(s,Te.anchor,$,Vt);const bn=this.placedOrientations[$.crossTileID];bn&&(this.markUsedJustification(s,"left",$,bn),this.markUsedOrientation(s,bn,$))}if(Bt){const Kt=Nr(Ct.icon),oe=!(q&&$.verticalPlacedIconSymbolIndex&&Wt);$.placedIconSymbolIndex>=0&&(et(s.icon,$.numIconVertices,oe?Kt:ns),s.icon.placedSymbolArray.get($.placedIconSymbolIndex).hidden=Ct.icon.isHidden()),$.verticalPlacedIconSymbolIndex>=0&&(et(s.icon,$.numVerticalIconVertices,oe?ns:Kt),s.icon.placedSymbolArray.get($.verticalPlacedIconSymbolIndex).hidden=Ct.icon.isHidden())}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const Kt=s.collisionArrays[lt];if(Kt){let oe=new a.P(0,0);if(Kt.textBox||Kt.verticalTextBox){let bn=!0;if(k){const pe=this.variableOffsets[pt];pe?(oe=Ke(pe.anchor,pe.width,pe.height,pe.textOffset,pe.textBoxScale),R&&oe._rotate(O?this.transform.angle:-this.transform.angle)):bn=!1}Kt.textBox&&rn(s.textCollisionBox.collisionVertexArray,Ct.text.placed,!bn||Wt,oe.x,oe.y),Kt.verticalTextBox&&rn(s.textCollisionBox.collisionVertexArray,Ct.text.placed,!bn||ee,oe.x,oe.y)}const Te=!!(!ee&&Kt.verticalIconBox);Kt.iconBox&&rn(s.iconCollisionBox.collisionVertexArray,Ct.icon.placed,Te,q?oe.x:0,q?oe.y:0),Kt.verticalIconBox&&rn(s.iconCollisionBox.collisionVertexArray,Ct.icon.placed,!Te,q?oe.x:0,q?oe.y:0)}}}if(s.sortFeatures(this.transform.angle),this.retainedQueryData[s.bucketInstanceId]&&(this.retainedQueryData[s.bucketInstanceId].featureSortOrder=s.featureSortOrder),s.hasTextData()&&s.text.opacityVertexBuffer&&s.text.opacityVertexBuffer.updateData(s.text.opacityVertexArray),s.hasIconData()&&s.icon.opacityVertexBuffer&&s.icon.opacityVertexBuffer.updateData(s.icon.opacityVertexArray),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexBuffer&&s.iconCollisionBox.collisionVertexBuffer.updateData(s.iconCollisionBox.collisionVertexArray),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexBuffer&&s.textCollisionBox.collisionVertexBuffer.updateData(s.textCollisionBox.collisionVertexArray),s.text.opacityVertexArray.length!==s.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${s.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${s.text.layoutVertexArray.length}) / 4`);if(s.icon.opacityVertexArray.length!==s.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${s.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${s.icon.layoutVertexArray.length}) / 4`);if(s.bucketInstanceId in this.collisionCircleArrays){const lt=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=lt.invProjMatrix,s.placementViewportMatrix=lt.viewportMatrix,s.collisionCircleArray=lt.circles,delete this.collisionCircleArrays[s.bucketInstanceId]}}symbolFadeChange(s){return this.fadeDuration===0?1:(s-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(s){return Math.max(0,(this.transform.zoom-s)/1.5)}hasTransitions(s){return this.stale||s-this.lastPlacementChangeTimes}setStale(){this.stale=!0}}function rn(y,s,h,d,g){y.emplaceBack(s?1:0,h?1:0,d||0,g||0),y.emplaceBack(s?1:0,h?1:0,d||0,g||0),y.emplaceBack(s?1:0,h?1:0,d||0,g||0),y.emplaceBack(s?1:0,h?1:0,d||0,g||0)}const Gn=Math.pow(2,25),$n=Math.pow(2,24),Pn=Math.pow(2,17),Mn=Math.pow(2,16),qr=Math.pow(2,9),oi=Math.pow(2,8),nr=Math.pow(2,1);function Nr(y){if(y.opacity===0&&!y.placed)return 0;if(y.opacity===1&&y.placed)return 4294967295;const s=y.placed?1:0,h=Math.floor(127*y.opacity);return h*Gn+s*$n+h*Pn+s*Mn+h*qr+s*oi+h*nr+s}const ns=0;class xd{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&!s.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(s,h,d,g,b){const I=this._bucketParts;for(;this._currentTileIndexC.sortKey-M.sortKey));this._currentPartIndex!this._forceFullPlacement&&a.h.now()-g>2;for(;this._currentPlacementIndex>=0;){const I=h[s[this._currentPlacementIndex]],C=this.placement.collisionIndex.transform.zoom;if(I.type==="symbol"&&(!I.minzoom||I.minzoom<=C)&&(!I.maxzoom||I.maxzoom>C)){if(this._inProgressLayer||(this._inProgressLayer=new xd(I)),this._inProgressLayer.continuePlacement(d[I.source],this.placement,this._showCollisionBoxes,I,b))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const su=512/a.N/2;class Dg{constructor(s,h,d){this.tileID=s,this.bucketInstanceId=d,this._symbolsByKey={};const g=new Map;for(let b=0;b({x:Math.floor(M.anchorX*su),y:Math.floor(M.anchorY*su)})),crossTileIDs:I.map(M=>M.crossTileID)};if(C.positions.length>128){const M=new a.av(C.positions.length,16,Uint16Array);for(const{x:k,y:R}of C.positions)M.add(k,R);M.finish(),delete C.positions,C.index=M}this._symbolsByKey[b]=C}}getScaledCoordinates(s,h){const{x:d,y:g,z:b}=this.tileID.canonical,{x:I,y:C,z:M}=h.canonical,k=su/Math.pow(2,M-b),R=(C*a.N+s.anchorY)*k,O=g*a.N*su;return{x:Math.floor((I*a.N+s.anchorX)*k-d*a.N*su),y:Math.floor(R-O)}}findMatches(s,h,d){const g=this.tileID.canonical.zs)}}class Yn{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class fp{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(s){const h=Math.round((s-this.lng)/360);if(h!==0)for(const d in this.indexes){const g=this.indexes[d],b={};for(const I in g){const C=g[I];C.tileID=C.tileID.unwrapTo(C.tileID.wrap+h),b[C.tileID.key]=C}this.indexes[d]=b}this.lng=s}addBucket(s,h,d){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===h.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let b=0;bs.overscaledZ)for(const C in I){const M=I[C];M.tileID.isChildOf(s)&&M.findMatches(h.symbolInstances,s,g)}else{const C=I[s.scaledTo(Number(b)).key];C&&C.findMatches(h.symbolInstances,s,g)}}for(let b=0;b{h[d]=!0});for(const d in this.layerIndexes)h[d]||delete this.layerIndexes[d]}}const Zr=(y,s)=>a.x(y,s&&s.filter(h=>h.identifier!=="source.canvas")),No=a.F(a.ax,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),Rg=a.F(a.ax,["setCenter","setZoom","setBearing","setPitch"]),is=a.aw();class Dr extends a.E{constructor(s,h={}){super(),this.map=s,this.dispatcher=new $e(Ha(),this,s._getMapId()),this.imageManager=new yt,this.imageManager.setEventedParent(this),this.glyphManager=new Yt(s._requestManager,h.localIdeographFontFamily),this.lineAtlas=new On(256,512),this.crossTileSymbolIndex=new Fc,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.az());const d=this;this._rtlTextPluginCallback=Dr.registerForPluginStateChange(g=>{d.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:g.pluginStatus,pluginURL:g.pluginURL},(b,I)=>{if(a.aA(b),I&&I.every(C=>C))for(const C in d.sourceCaches){const M=d.sourceCaches[C].getSource().type;M!=="vector"&&M!=="geojson"||d.sourceCaches[C].reload()}})}),this.on("data",g=>{if(g.dataType!=="source"||g.sourceDataType!=="metadata")return;const b=this.sourceCaches[g.sourceId];if(!b)return;const I=b.getSource();if(I&&I.vectorLayerIds)for(const C in this._layers){const M=this._layers[C];M.source===I.id&&this._validateLayer(M)}})}loadURL(s,h={},d){this.fire(new a.k("dataloading",{dataType:"style"})),h.validate=typeof h.validate!="boolean"||h.validate;const g=this.map._requestManager.transformRequest(s,K.Style);this._request=a.f(g,(b,I)=>{this._request=null,b?this.fire(new a.j(b)):I&&this._load(I,h,d)})}loadJSON(s,h={},d){this.fire(new a.k("dataloading",{dataType:"style"})),this._request=a.h.frame(()=>{this._request=null,h.validate=h.validate!==!1,this._load(s,h,d)})}loadEmpty(){this.fire(new a.k("dataloading",{dataType:"style"})),this._load(is,{validate:!1})}_load(s,h,d){var g;const b=h.transformStyle?h.transformStyle(d,s):s;if(!h.validate||!Zr(this,a.y(b))){this._loaded=!0,this.stylesheet=b;for(const I in b.sources)this.addSource(I,b.sources[I],{validate:!1});b.sprite?this._loadSprite(b.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(b.glyphs),this._createLayers(),this.light=new Ye(this.stylesheet.light),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new a.k("data",{dataType:"style"})),this.fire(new a.k("style.load"))}}_createLayers(){const s=a.aB(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",s),this._order=s.map(h=>h.id),this._layers={},this._serializedLayers=null;for(const h of s){const d=a.aC(h);d.setEventedParent(this,{layer:{id:h.id}}),this._layers[h.id]=d}}_loadSprite(s,h=!1,d=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(g,b,I,C){const M=gt(g),k=M.length,R=I>1?"@2x":"",O={},q={},nt={};for(const{id:et,url:lt}of M){const $=b.transformRequest(b.normalizeSpriteURL(lt,R,".json"),K.SpriteJSON),St=`${et}_${$.url}`;O[St]=a.f($,(Ct,Bt)=>{delete O[St],q[et]=Bt,at(C,q,nt,Ct,k)});const Ot=b.transformRequest(b.normalizeSpriteURL(lt,R,".png"),K.SpriteImage),pt=`${et}_${Ot.url}`;O[pt]=Z.getImage(Ot,(Ct,Bt)=>{delete O[pt],nt[et]=Bt,at(C,q,nt,Ct,k)})}return{cancel(){for(const et of Object.values(O))et.cancel()}}}(s,this.map._requestManager,this.map.getPixelRatio(),(g,b)=>{if(this._spriteRequest=null,g)this.fire(new a.j(g));else if(b)for(const I in b){this._spritesImagesIds[I]=[];const C=this._spritesImagesIds[I]?this._spritesImagesIds[I].filter(M=>!(M in b)):[];for(const M of C)this.imageManager.removeImage(M),this._changedImages[M]=!0;for(const M in b[I]){const k=I==="default"?M:`${I}:${M}`;this._spritesImagesIds[I].push(k),k in this.imageManager.images?this.imageManager.updateImage(k,b[I][M],!1):this.imageManager.addImage(k,b[I][M]),h&&(this._changedImages[k]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),h&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.k("data",{dataType:"style"})),d&&d(g)})}_unloadSprite(){for(const s of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(s),this._changedImages[s]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}_validateLayer(s){const h=this.sourceCaches[s.source];if(!h)return;const d=s.sourceLayer;if(!d)return;const g=h.getSource();(g.type==="geojson"||g.vectorLayerIds&&g.vectorLayerIds.indexOf(d)===-1)&&this.fire(new a.j(new Error(`Source layer "${d}" does not exist on source "${g.id}" as specified by style layer "${s.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const s in this.sourceCaches)if(!this.sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(s){const h=this._serializedAllLayers();if(!s||s.length===0)return Object.values(h);const d=[];for(const g of s)h[g]&&d.push(h[g]);return d}_serializedAllLayers(){let s=this._serializedLayers;if(s)return s;s=this._serializedLayers={};const h=Object.keys(this._layers);for(const d of h){const g=this._layers[d];g.type!=="custom"&&(s[d]=g.serialize())}return s}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const s in this.sourceCaches)if(this.sourceCaches[s].hasTransition())return!0;for(const s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(s){if(!this._loaded)return;const h=this._changed;if(this._changed){const g=Object.keys(this._updatedLayers),b=Object.keys(this._removedLayers);(g.length||b.length)&&this._updateWorkerLayers(g,b);for(const I in this._updatedSources){const C=this._updatedSources[I];if(C==="reload")this._reloadSource(I);else{if(C!=="clear")throw new Error(`Invalid action ${C}`);this._clearSource(I)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const I in this._updatedPaintProps)this._layers[I].updateTransitions(s);this.light.updateTransitions(s),this._resetUpdates()}const d={};for(const g in this.sourceCaches){const b=this.sourceCaches[g];d[g]=b.used,b.used=!1}for(const g of this._order){const b=this._layers[g];b.recalculate(s,this._availableImages),!b.isHidden(s.zoom)&&b.source&&(this.sourceCaches[b.source].used=!0)}for(const g in d){const b=this.sourceCaches[g];d[g]!==b.used&&b.fire(new a.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:g}))}this.light.recalculate(s),this.z=s.zoom,h&&this.fire(new a.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const h in this.sourceCaches)this.sourceCaches[h].reloadTilesForDependencies(["icons","patterns"],s);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(s,h){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(s),removedIds:h})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(s,h={}){this._checkLoaded();const d=this.serialize();if(s=h.transformStyle?h.transformStyle(d,s):s,Zr(this,a.y(s)))return!1;(s=a.aD(s)).layers=a.aB(s.layers);const g=a.aE(d,s).filter(I=>!(I.command in Rg));if(g.length===0)return!1;const b=g.filter(I=>!(I.command in No));if(b.length>0)throw new Error(`Unimplemented: ${b.map(I=>I.command).join(", ")}.`);for(const I of g)I.command!=="setTransition"&&this[I.command].apply(this,I.args);return this.stylesheet=s,this._serializedLayers=null,!0}addImage(s,h){if(this.getImage(s))return this.fire(new a.j(new Error(`An image named "${s}" already exists.`)));this.imageManager.addImage(s,h),this._afterImageUpdated(s)}updateImage(s,h){this.imageManager.updateImage(s,h)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){if(!this.getImage(s))return this.fire(new a.j(new Error(`An image named "${s}" does not exist.`)));this.imageManager.removeImage(s),this._afterImageUpdated(s)}_afterImageUpdated(s){this._availableImages=this.imageManager.listImages(),this._changedImages[s]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,h,d={}){if(this._checkLoaded(),this.sourceCaches[s]!==void 0)throw new Error(`Source "${s}" 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.y.source,`sources.${s}`,h,null,d))return;this.map&&this.map._collectResourceTiming&&(h.collectResourceTiming=!0);const g=this.sourceCaches[s]=new Fi(s,h,this.dispatcher);g.style=this,g.setEventedParent(this,()=>({isSourceLoaded:g.loaded(),source:g.serialize(),sourceId:s})),g.onAdd(this.map),this._changed=!0}removeSource(s){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===s)return this.fire(new a.j(new Error(`Source "${s}" cannot be removed while layer "${d}" is using it.`)));const h=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],h.fire(new a.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:s})),h.setEventedParent(null),h.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(s,h){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error(`There is no source with this ID=${s}`);const d=this.sourceCaches[s].getSource();if(d.type!=="geojson")throw new Error(`geojsonSource.type is ${d.type}, which is !== 'geojson`);d.setData(h),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,h,d={}){this._checkLoaded();const g=s.id;if(this.getLayer(g))return void this.fire(new a.j(new Error(`Layer "${g}" already exists on this map.`)));let b;if(s.type==="custom"){if(Zr(this,a.aF(s)))return;b=a.aC(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(g,s.source),s=a.aD(s),s=a.e(s,{source:g})),this._validate(a.y.layer,`layers.${g}`,s,{arrayIndex:-1},d))return;b=a.aC(s),this._validateLayer(b),b.setEventedParent(this,{layer:{id:g}})}const I=h?this._order.indexOf(h):this._order.length;if(h&&I===-1)this.fire(new a.j(new Error(`Cannot add layer "${g}" before non-existing layer "${h}".`)));else{if(this._order.splice(I,0,g),this._layerOrderChanged=!0,this._layers[g]=b,this._removedLayers[g]&&b.source&&b.type!=="custom"){const C=this._removedLayers[g];delete this._removedLayers[g],C.type!==b.type?this._updatedSources[b.source]="clear":(this._updatedSources[b.source]="reload",this.sourceCaches[b.source].pause())}this._updateLayer(b),b.onAdd&&b.onAdd(this.map)}}moveLayer(s,h){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new a.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===h)return;const d=this._order.indexOf(s);this._order.splice(d,1);const g=h?this._order.indexOf(h):this._order.length;h&&g===-1?this.fire(new a.j(new Error(`Cannot move layer "${s}" before non-existing layer "${h}".`))):(this._order.splice(g,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();const h=this._layers[s];if(!h)return void this.fire(new a.j(new Error(`Cannot remove non-existing layer "${s}".`)));h.setEventedParent(null);const d=this._order.indexOf(s);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=h,delete this._layers[s],this._serializedLayers&&delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],h.onRemove&&h.onRemove(this.map)}getLayer(s){return this._layers[s]}getLayersOrder(){return[...this._order]}hasLayer(s){return s in this._layers}setLayerZoomRange(s,h,d){this._checkLoaded();const g=this.getLayer(s);g?g.minzoom===h&&g.maxzoom===d||(h!=null&&(g.minzoom=h),d!=null&&(g.maxzoom=d),this._updateLayer(g)):this.fire(new a.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,h,d={}){this._checkLoaded();const g=this.getLayer(s);if(g){if(!a.aG(g.filter,h))return h==null?(g.filter=void 0,void this._updateLayer(g)):void(this._validate(a.y.filter,`layers.${g.id}.filter`,h,null,d)||(g.filter=a.aD(h),this._updateLayer(g)))}else this.fire(new a.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return a.aD(this.getLayer(s).filter)}setLayoutProperty(s,h,d,g={}){this._checkLoaded();const b=this.getLayer(s);b?a.aG(b.getLayoutProperty(h),d)||(b.setLayoutProperty(h,d,g),this._updateLayer(b)):this.fire(new a.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,h){const d=this.getLayer(s);if(d)return d.getLayoutProperty(h);this.fire(new a.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,h,d,g={}){this._checkLoaded();const b=this.getLayer(s);b?a.aG(b.getPaintProperty(h),d)||(b.setPaintProperty(h,d,g)&&this._updateLayer(b),this._changed=!0,this._updatedPaintProps[s]=!0):this.fire(new a.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,h){return this.getLayer(s).getPaintProperty(h)}setFeatureState(s,h){this._checkLoaded();const d=s.source,g=s.sourceLayer,b=this.sourceCaches[d];if(b===void 0)return void this.fire(new a.j(new Error(`The source '${d}' does not exist in the map's style.`)));const I=b.getSource().type;I==="geojson"&&g?this.fire(new a.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):I!=="vector"||g?(s.id===void 0&&this.fire(new a.j(new Error("The feature id parameter must be provided."))),b.setFeatureState(g,s.id,h)):this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,h){this._checkLoaded();const d=s.source,g=this.sourceCaches[d];if(g===void 0)return void this.fire(new a.j(new Error(`The source '${d}' does not exist in the map's style.`)));const b=g.getSource().type,I=b==="vector"?s.sourceLayer:void 0;b!=="vector"||I?h&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new a.j(new Error("A feature id is required to remove its specific state property."))):g.removeFeatureState(I,s.id,h):this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const h=s.source,d=s.sourceLayer,g=this.sourceCaches[h];if(g!==void 0)return g.getSource().type!=="vector"||d?(s.id===void 0&&this.fire(new a.j(new Error("The feature id parameter must be provided."))),g.getFeatureState(d,s.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 s=a.aH(this.sourceCaches,b=>b.serialize()),h=this._serializeByIds(this._order),d=this.map.getTerrain()||void 0,g=this.stylesheet;return a.aI({version:g.version,name:g.name,metadata:g.metadata,light:g.light,center:g.center,zoom:g.zoom,bearing:g.bearing,pitch:g.pitch,sprite:g.sprite,glyphs:g.glyphs,transition:g.transition,sources:s,layers:h,terrain:d},b=>b!==void 0)}_updateLayer(s){this._updatedLayers[s.id]=!0,s.source&&!this._updatedSources[s.source]&&this.sourceCaches[s.source].getSource().type!=="raster"&&(this._updatedSources[s.source]="reload",this.sourceCaches[s.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(s){const h=I=>this._layers[I].type==="fill-extrusion",d={},g=[];for(let I=this._order.length-1;I>=0;I--){const C=this._order[I];if(h(C)){d[C]=I;for(const M of s){const k=M[C];if(k)for(const R of k)g.push(R)}}}g.sort((I,C)=>C.intersectionZ-I.intersectionZ);const b=[];for(let I=this._order.length-1;I>=0;I--){const C=this._order[I];if(h(C))for(let M=g.length-1;M>=0;M--){const k=g[M].feature;if(d[k.layer.id]{const ee=St.featureSortOrder;if(ee){const Kt=ee.indexOf(Vt.featureIndex);return ee.indexOf(Wt.featureIndex)-Kt}return Wt.featureIndex-Vt.featureIndex});for(const Vt of Bt)Ct.push(Vt)}}for(const St in et)et[St].forEach(Ot=>{const pt=Ot.feature,Ct=k[C[St].source].getFeatureState(pt.layer["source-layer"],pt.id);pt.source=pt.layer.source,pt.layer["source-layer"]&&(pt.sourceLayer=pt.layer["source-layer"]),pt.state=Ct});return et}(this._layers,I,this.sourceCaches,s,h,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(b)}querySourceFeatures(s,h){h&&h.filter&&this._validate(a.y.filter,"querySourceFeatures.filter",h.filter,null,h);const d=this.sourceCaches[s];return d?function(g,b){const I=g.getRenderableIds().map(k=>g.getTileByID(k)),C=[],M={};for(let k=0;k{wt[g]=b})(s,h),h.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:s,url:h.workerSourceURL},d):d(null,null))}getLight(){return this.light.getLight()}setLight(s,h={}){this._checkLoaded();const d=this.light.getLight();let g=!1;for(const I in s)if(!a.aG(s[I],d[I])){g=!0;break}if(!g)return;const b={now:a.h.now(),transition:a.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(s,h),this.light.updateTransitions(b)}_validate(s,h,d,g,b={}){return(!b||b.validate!==!1)&&Zr(this,s.call(a.y,a.e({key:h,style:this.serialize(),value:d,styleSpec:a.v},g)))}_remove(s=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.aJ.off("pluginStateChange",this._rtlTextPluginCallback);for(const h in this._layers)this._layers[h].setEventedParent(null);for(const h in this.sourceCaches){const d=this.sourceCaches[h];d.setEventedParent(null),d.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(s)}_clearSource(s){this.sourceCaches[s].clearTiles()}_reloadSource(s){this.sourceCaches[s].resume(),this.sourceCaches[s].reload()}_updateSources(s){for(const h in this.sourceCaches)this.sourceCaches[h].update(s,this.map.terrain)}_generateCollisionBoxes(){for(const s in this.sourceCaches)this._reloadSource(s)}_updatePlacement(s,h,d,g,b=!1){let I=!1,C=!1;const M={};for(const k of this._order){const R=this._layers[k];if(R.type!=="symbol")continue;if(!M[R.source]){const q=this.sourceCaches[R.source];M[R.source]=q.getRenderableIds(!0).map(nt=>q.getTileByID(nt)).sort((nt,et)=>et.tileID.overscaledZ-nt.tileID.overscaledZ||(nt.tileID.isLessThan(et.tileID)?-1:1))}const O=this.crossTileSymbolIndex.addLayer(R,M[R.source],s.center.lng);I=I||O}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((b=b||this._layerOrderChanged||d===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.h.now(),s.zoom))&&(this.pauseablePlacement=new ou(s,this.map.terrain,this._order,b,h,d,g,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,M),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.h.now()),C=!0),I&&this.pauseablePlacement.placement.setStale()),C||I)for(const k of this._order){const R=this._layers[k];R.type==="symbol"&&this.placement.updateLayerOpacities(R,M[R.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.h.now())}_releaseSymbolFadeTiles(){for(const s in this.sourceCaches)this.sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,h,d){this.imageManager.getImages(h.icons,d),this._updateTilesForChangedImages();const g=this.sourceCaches[h.source];g&&g.setDependencies(h.tileID.key,h.type,h.icons)}getGlyphs(s,h,d){this.glyphManager.getGlyphs(h.stacks,d);const g=this.sourceCaches[h.source];g&&g.setDependencies(h.tileID.key,h.type,[""])}getResource(s,h,d){return a.m(h,d)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,h={}){this._checkLoaded(),s&&this._validate(a.y.glyphs,"glyphs",s,null,h)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,h,d={},g){this._checkLoaded();const b=[{id:s,url:h}],I=[...gt(this.stylesheet.sprite),...b];this._validate(a.y.sprite,"sprite",I,null,d)||(this.stylesheet.sprite=I,this._loadSprite(b,!0,g))}removeSprite(s){this._checkLoaded();const h=gt(this.stylesheet.sprite);if(h.find(d=>d.id===s)){if(this._spritesImagesIds[s])for(const d of this._spritesImagesIds[s])this.imageManager.removeImage(d),this._changedImages[d]=!0;h.splice(h.findIndex(d=>d.id===s),1),this.stylesheet.sprite=h.length>0?h:void 0,delete this._spritesImagesIds[s],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}else this.fire(new a.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return gt(this.stylesheet.sprite)}setSprite(s,h={},d){this._checkLoaded(),s&&this._validate(a.y.sprite,"sprite",s,null,h)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,d):(this._unloadSprite(),d&&d(null)))}}Dr.registerForPluginStateChange=a.aK;var Bc=a.Q([{name:"a_pos",type:"Int16",components:2}]),au="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 xi={prelude:Fn(`#ifdef GL_ES +var SS=Object.defineProperty;var ES=(e,t,n)=>t in e?SS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var qn=(e,t,n)=>(ES(e,typeof t!="symbol"?t+"":t,n),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const u of r)if(u.type==="childList")for(const p of u.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&i(p)}).observe(document,{childList:!0,subtree:!0});function n(r){const u={};return r.integrity&&(u.integrity=r.integrity),r.referrerPolicy&&(u.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?u.credentials="include":r.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(r){if(r.ep)return;r.ep=!0;const u=n(r);fetch(r.href,u)}})();function Le(){}function Ir(e,t){for(const n in t)e[n]=t[n];return e}function Rb(e){return e()}function Ov(){return Object.create(null)}function or(e){e.forEach(Rb)}function fg(e){return typeof e=="function"}function Qe(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let Lm;function Tr(e,t){return e===t?!0:(Lm||(Lm=document.createElement("a")),Lm.href=t,e===Lm.href)}function IS(e){return Object.keys(e).length===0}function Ob(e,...t){if(e==null){for(const i of t)i(void 0);return Le}const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function zb(e){let t;return Ob(e,n=>t=n)(),t}function Ee(e,t,n){e.$$.on_destroy.push(Ob(t,n))}function mr(e,t,n,i){if(e){const r=Fb(e,t,n,i);return e[0](r)}}function Fb(e,t,n,i){return e[1]&&i?Ir(n.ctx.slice(),e[1](i(t))):n.ctx}function gr(e,t,n,i){if(e[2]&&i){const r=e[2](i(n));if(t.dirty===void 0)return r;if(typeof r=="object"){const u=[],p=Math.max(t.dirty.length,r.length);for(let a=0;a32){const t=[],n=e.ctx.length/32;for(let i=0;ie.removeEventListener(t,n,i)}function LS(e){return function(t){return t.preventDefault(),e.call(this,t)}}function kt(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function MS(e){return Array.from(e.childNodes)}function Gi(e,t){t=""+t,e.data!==t&&(e.data=t)}function jl(e,t){e.value=t??""}function Wn(e,t,n,i){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,i?"important":"")}function Wm(e,t,n){for(let i=0;i{const r=e.$$.callbacks[t];if(r){const u=PS(t,n,{cancelable:i});return r.slice().forEach(p=>{p.call(e,u)}),!u.defaultPrevented}return!0}}function Vb(e,t){return ud().$$.context.set(e,t),t}function AS(e){return ud().$$.context.get(e)}function ai(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(i=>i.call(this,t))}const Th=[],Qi=[];let Ah=[];const Q_=[],Ub=Promise.resolve();let $_=!1;function Gb(){$_||($_=!0,Ub.then(jb))}function kS(){return Gb(),Ub}function Gf(e){Ah.push(e)}function Du(e){Q_.push(e)}const U_=new Set;let Sh=0;function jb(){if(Sh!==0)return;const e=Uf;do{try{for(;She.indexOf(i)===-1?t.push(i):n.push(i)),n.forEach(i=>i()),Ah=t}const Bm=new Set;let yc;function Ii(){yc={r:0,c:[],p:yc}}function Ci(){yc.r||or(yc.c),yc=yc.p}function wt(e,t){e&&e.i&&(Bm.delete(e),e.i(t))}function Pt(e,t,n,i){if(e&&e.o){if(Bm.has(e))return;Bm.add(e),yc.c.push(()=>{Bm.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function aa(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function RS(e,t){Pt(e,1,1,()=>{t.delete(e.key)})}function OS(e,t,n,i,r,u,p,a,_,x,S,L){let A=e.length,N=u.length,O=A;const Z={};for(;O--;)Z[e[O].key]=O;const G=[],K=new Map,V=new Map,H=[];for(O=N;O--;){const ft=L(r,u,O),dt=n(ft);let ut=p.get(dt);ut?i&&H.push(()=>ut.p(ft,t)):(ut=x(dt,ft),ut.c()),K.set(dt,G[O]=ut),dt in Z&&V.set(dt,Math.abs(O-Z[dt]))}const Q=new Set,it=new Set;function ht(ft){wt(ft,1),ft.m(a,S),p.set(ft.key,ft),S=ft.first,N--}for(;A&&N;){const ft=G[N-1],dt=e[A-1],ut=ft.key,Mt=dt.key;ft===dt?(S=ft.first,A--,N--):K.has(Mt)?!p.has(ut)||Q.has(ut)?ht(ft):it.has(Mt)?A--:V.get(ut)>V.get(Mt)?(it.add(ut),ht(ft)):(Q.add(Mt),A--):(_(dt,p),A--)}for(;A--;){const ft=e[A];K.has(ft.key)||_(ft,p)}for(;N;)ht(G[N-1]);return or(H),G}function qb(e,t){const n={},i={},r={$$scope:1};let u=e.length;for(;u--;){const p=e[u],a=t[u];if(a){for(const _ in p)_ in a||(i[_]=1);for(const _ in a)r[_]||(n[_]=a[_],r[_]=1);e[u]=a}else for(const _ in p)r[_]=1}for(const p in i)p in n||(n[p]=void 0);return n}function Ru(e,t,n){const i=e.$$.props[t];i!==void 0&&(e.$$.bound[i]=n,n(e.$$.ctx[i]))}function ee(e){e&&e.c()}function $t(e,t,n){const{fragment:i,after_update:r}=e.$$;i&&i.m(t,n),Gf(()=>{const u=e.$$.on_mount.map(Rb).filter(fg);e.$$.on_destroy?e.$$.on_destroy.push(...u):or(u),e.$$.on_mount=[]}),r.forEach(Gf)}function te(e,t){const n=e.$$;n.fragment!==null&&(DS(n.after_update),or(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function zS(e,t){e.$$.dirty[0]===-1&&(Th.push(e),Gb(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const O=N.length?N[0]:A;return x.ctx&&r(x.ctx[L],x.ctx[L]=O)&&(!x.skip_bound&&x.bound[L]&&x.bound[L](O),S&&zS(e,L)),A}):[],x.update(),S=!0,or(x.before_update),x.fragment=i?i(x.ctx):!1,t.target){if(t.hydrate){const L=MS(t.target);x.fragment&&x.fragment.l(L),L.forEach(At)}else x.fragment&&x.fragment.c();t.intro&&wt(e.$$.fragment),$t(e,t.target,t.anchor),jb()}Rf(_)}class sn{constructor(){qn(this,"$$");qn(this,"$$set")}$destroy(){te(this,1),this.$destroy=Le}$on(t,n){if(!fg(n))return Le;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!IS(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const FS="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(FS);const BS="/ltn/assets/logo-7ace0a42.png";let fe;const Vl=new Array(128).fill(void 0);Vl.push(void 0,null,!0,!1);function pn(e){return Vl[e]}let Of=Vl.length;function VS(e){e<132||(Vl[e]=Of,Of=e)}function hs(e){const t=pn(e);return VS(e),t}let Ts=0,If=null;function kh(){return(If===null||If.byteLength===0)&&(If=new Uint8Array(fe.memory.buffer)),If}const Vm=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},US=typeof Vm.encodeInto=="function"?function(e,t){return Vm.encodeInto(e,t)}:function(e,t){const n=Vm.encode(e);return t.set(n),{read:e.length,written:n.length}};function Bl(e,t,n){if(n===void 0){const a=Vm.encode(e),_=t(a.length,1)>>>0;return kh().subarray(_,_+a.length).set(a),Ts=a.length,_}let i=e.length,r=t(i,1)>>>0;const u=kh();let p=0;for(;p127)break;u[r+p]=a}if(p!==i){p!==0&&(e=e.slice(p)),r=n(r,i,i=p+e.length*3,1)>>>0;const a=kh().subarray(r+p,r+i),_=US(e,a);p+=_.written}return Ts=p,r}function Lh(e){return e==null}let Cf=null;function Je(){return(Cf===null||Cf.byteLength===0)&&(Cf=new Int32Array(fe.memory.buffer)),Cf}const Zb=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Zb.decode();function ea(e,t){return e=e>>>0,Zb.decode(kh().subarray(e,e+t))}function si(e){Of===Vl.length&&Vl.push(Vl.length+1);const t=Of;return Of=Vl[t],Vl[t]=e,t}let Tf=null;function Wb(){return(Tf===null||Tf.byteLength===0)&&(Tf=new Float64Array(fe.memory.buffer)),Tf}let Lf=null;function GS(){return(Lf===null||Lf.byteLength===0)&&(Lf=new BigInt64Array(fe.memory.buffer)),Lf}function ty(e){const t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){const r=e.description;return r==null?"Symbol":`Symbol(${r})`}if(t=="function"){const r=e.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(e)){const r=e.length;let u="[";r>0&&(u+=ty(e[0]));for(let p=1;p1)i=n[1];else return toString.call(e);if(i=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message} +${e.stack}`:i}function jS(e,t){const n=t(e.length*1,1)>>>0;return kh().set(e,n/1),Ts=e.length,n}function qS(e,t){return e=e>>>0,Wb().subarray(e/8,e/8+t)}function ZS(e,t){return e=e>>>0,kh().subarray(e/1,e/1+t)}function gc(e,t){try{return e.apply(this,t)}catch(n){fe.__wbindgen_exn_store(si(n))}}class WS{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){const t=this.__destroy_into_raw();fe.__wbg_ltn_free(t)}constructor(t,n){try{const _=fe.__wbindgen_add_to_stack_pointer(-16),x=jS(t,fe.__wbindgen_malloc),S=Ts;var i=Lh(n)?0:Bl(n,fe.__wbindgen_malloc,fe.__wbindgen_realloc),r=Ts;fe.ltn_new(_,x,S,i,r);var u=Je()[_/4+0],p=Je()[_/4+1],a=Je()[_/4+2];if(a)throw hs(p);return this.__wbg_ptr=u>>>0,this}finally{fe.__wbindgen_add_to_stack_pointer(16)}}getInvertedBoundary(){let t,n;try{const x=fe.__wbindgen_add_to_stack_pointer(-16);fe.ltn_getInvertedBoundary(x,this.__wbg_ptr);var i=Je()[x/4+0],r=Je()[x/4+1],u=Je()[x/4+2],p=Je()[x/4+3],a=i,_=r;if(p)throw a=0,_=0,hs(u);return t=a,n=_,ea(a,_)}finally{fe.__wbindgen_add_to_stack_pointer(16),fe.__wbindgen_free(t,n,1)}}getBounds(){try{const r=fe.__wbindgen_add_to_stack_pointer(-16);fe.ltn_getBounds(r,this.__wbg_ptr);var t=Je()[r/4+0],n=Je()[r/4+1],i=qS(t,n).slice();return fe.__wbindgen_free(t,n*8,8),i}finally{fe.__wbindgen_add_to_stack_pointer(16)}}toRouteSnapper(){try{const r=fe.__wbindgen_add_to_stack_pointer(-16);fe.ltn_toRouteSnapper(r,this.__wbg_ptr);var t=Je()[r/4+0],n=Je()[r/4+1],i=ZS(t,n).slice();return fe.__wbindgen_free(t,n*1,1),i}finally{fe.__wbindgen_add_to_stack_pointer(16)}}toRouteSnapperGj(){let t,n;try{const x=fe.__wbindgen_add_to_stack_pointer(-16);fe.ltn_toRouteSnapperGj(x,this.__wbg_ptr);var i=Je()[x/4+0],r=Je()[x/4+1],u=Je()[x/4+2],p=Je()[x/4+3],a=i,_=r;if(p)throw a=0,_=0,hs(u);return t=a,n=_,ea(a,_)}finally{fe.__wbindgen_add_to_stack_pointer(16),fe.__wbindgen_free(t,n,1)}}renderModalFilters(){let t,n;try{const x=fe.__wbindgen_add_to_stack_pointer(-16);fe.ltn_renderModalFilters(x,this.__wbg_ptr);var i=Je()[x/4+0],r=Je()[x/4+1],u=Je()[x/4+2],p=Je()[x/4+3],a=i,_=r;if(p)throw a=0,_=0,hs(u);return t=a,n=_,ea(a,_)}finally{fe.__wbindgen_add_to_stack_pointer(16),fe.__wbindgen_free(t,n,1)}}renderNeighbourhood(){let t,n;try{const x=fe.__wbindgen_add_to_stack_pointer(-16);fe.ltn_renderNeighbourhood(x,this.__wbg_ptr);var i=Je()[x/4+0],r=Je()[x/4+1],u=Je()[x/4+2],p=Je()[x/4+3],a=i,_=r;if(p)throw a=0,_=0,hs(u);return t=a,n=_,ea(a,_)}finally{fe.__wbindgen_add_to_stack_pointer(16),fe.__wbindgen_free(t,n,1)}}setNeighbourhoodBoundary(t,n){try{const u=fe.__wbindgen_add_to_stack_pointer(-16),p=Bl(t,fe.__wbindgen_malloc,fe.__wbindgen_realloc),a=Ts;fe.ltn_setNeighbourhoodBoundary(u,this.__wbg_ptr,p,a,si(n));var i=Je()[u/4+0],r=Je()[u/4+1];if(r)throw hs(i)}finally{fe.__wbindgen_add_to_stack_pointer(16)}}deleteNeighbourhoodBoundary(t){const n=Bl(t,fe.__wbindgen_malloc,fe.__wbindgen_realloc),i=Ts;fe.ltn_deleteNeighbourhoodBoundary(this.__wbg_ptr,n,i)}setCurrentNeighbourhood(t){try{const r=fe.__wbindgen_add_to_stack_pointer(-16),u=Bl(t,fe.__wbindgen_malloc,fe.__wbindgen_realloc),p=Ts;fe.ltn_setCurrentNeighbourhood(r,this.__wbg_ptr,u,p);var n=Je()[r/4+0],i=Je()[r/4+1];if(i)throw hs(n)}finally{fe.__wbindgen_add_to_stack_pointer(16)}}addModalFilter(t,n){try{const u=fe.__wbindgen_add_to_stack_pointer(-16),p=Bl(n,fe.__wbindgen_malloc,fe.__wbindgen_realloc),a=Ts;fe.ltn_addModalFilter(u,this.__wbg_ptr,si(t),p,a);var i=Je()[u/4+0],r=Je()[u/4+1];if(r)throw hs(i)}finally{fe.__wbindgen_add_to_stack_pointer(16)}}addManyModalFilters(t,n){try{const u=fe.__wbindgen_add_to_stack_pointer(-16),p=Bl(n,fe.__wbindgen_malloc,fe.__wbindgen_realloc),a=Ts;fe.ltn_addManyModalFilters(u,this.__wbg_ptr,si(t),p,a);var i=Je()[u/4+0],r=Je()[u/4+1];if(r)throw hs(i)}finally{fe.__wbindgen_add_to_stack_pointer(16)}}deleteModalFilter(t){fe.ltn_deleteModalFilter(this.__wbg_ptr,t)}undo(){fe.ltn_undo(this.__wbg_ptr)}redo(){fe.ltn_redo(this.__wbg_ptr)}getShortcutsCrossingRoad(t){let n,i;try{const S=fe.__wbindgen_add_to_stack_pointer(-16);fe.ltn_getShortcutsCrossingRoad(S,this.__wbg_ptr,t);var r=Je()[S/4+0],u=Je()[S/4+1],p=Je()[S/4+2],a=Je()[S/4+3],_=r,x=u;if(a)throw _=0,x=0,hs(p);return n=_,i=x,ea(_,x)}finally{fe.__wbindgen_add_to_stack_pointer(16),fe.__wbindgen_free(n,i,1)}}toSavefile(){let t,n;try{const x=fe.__wbindgen_add_to_stack_pointer(-16);fe.ltn_toSavefile(x,this.__wbg_ptr);var i=Je()[x/4+0],r=Je()[x/4+1],u=Je()[x/4+2],p=Je()[x/4+3],a=i,_=r;if(p)throw a=0,_=0,hs(u);return t=a,n=_,ea(a,_)}finally{fe.__wbindgen_add_to_stack_pointer(16),fe.__wbindgen_free(t,n,1)}}loadSavefile(t){try{const r=fe.__wbindgen_add_to_stack_pointer(-16);fe.ltn_loadSavefile(r,this.__wbg_ptr,si(t));var n=Je()[r/4+0],i=Je()[r/4+1];if(i)throw hs(n)}finally{fe.__wbindgen_add_to_stack_pointer(16)}}compareRoute(t,n,i,r){let u,p;try{const N=fe.__wbindgen_add_to_stack_pointer(-16);fe.ltn_compareRoute(N,this.__wbg_ptr,t,n,i,r);var a=Je()[N/4+0],_=Je()[N/4+1],x=Je()[N/4+2],S=Je()[N/4+3],L=a,A=_;if(S)throw L=0,A=0,hs(x);return u=L,p=A,ea(L,A)}finally{fe.__wbindgen_add_to_stack_pointer(16),fe.__wbindgen_free(u,p,1)}}}async function XS(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){if(e.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",i);else throw i}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function HS(){const e={};return e.wbg={},e.wbg.__wbindgen_object_drop_ref=function(t){hs(t)},e.wbg.__wbindgen_string_get=function(t,n){const i=pn(n),r=typeof i=="string"?i:void 0;var u=Lh(r)?0:Bl(r,fe.__wbindgen_malloc,fe.__wbindgen_realloc),p=Ts;Je()[t/4+1]=p,Je()[t/4+0]=u},e.wbg.__wbindgen_error_new=function(t,n){const i=new Error(ea(t,n));return si(i)},e.wbg.__wbindgen_boolean_get=function(t){const n=pn(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_is_bigint=function(t){return typeof pn(t)=="bigint"},e.wbg.__wbindgen_bigint_from_i64=function(t){return si(t)},e.wbg.__wbindgen_jsval_eq=function(t,n){return pn(t)===pn(n)},e.wbg.__wbindgen_bigint_from_u64=function(t){const n=BigInt.asUintN(64,t);return si(n)},e.wbg.__wbindgen_number_get=function(t,n){const i=pn(n),r=typeof i=="number"?i:void 0;Wb()[t/8+1]=Lh(r)?0:r,Je()[t/4+0]=!Lh(r)},e.wbg.__wbindgen_is_object=function(t){const n=pn(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_in=function(t,n){return pn(t)in pn(n)},e.wbg.__wbindgen_string_new=function(t,n){const i=ea(t,n);return si(i)},e.wbg.__wbindgen_is_undefined=function(t){return pn(t)===void 0},e.wbg.__wbindgen_object_clone_ref=function(t){const n=pn(t);return si(n)},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return pn(t)==pn(n)},e.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(t,n){const i=pn(t)[pn(n)];return si(i)},e.wbg.__wbg_debug_34c9290896ec9856=function(t){console.debug(pn(t))},e.wbg.__wbg_error_e60eff06f24ab7a4=function(t){console.error(pn(t))},e.wbg.__wbg_info_d7d58472d0bab115=function(t){console.info(pn(t))},e.wbg.__wbg_log_a4530b4fe289336f=function(t){console.log(pn(t))},e.wbg.__wbg_warn_f260f49434e45e62=function(t){console.warn(pn(t))},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return si(t)},e.wbg.__wbg_stack_658279fe44541cf6=function(t,n){const i=pn(n).stack,r=Bl(i,fe.__wbindgen_malloc,fe.__wbindgen_realloc),u=Ts;Je()[t/4+1]=u,Je()[t/4+0]=r},e.wbg.__wbg_error_f851667af71bcfc6=function(t,n){let i,r;try{i=t,r=n,console.error(ea(t,n))}finally{fe.__wbindgen_free(i,r,1)}},e.wbg.__wbg_performance_3f3012faa4463882=function(t){const n=pn(t).performance;return si(n)},e.wbg.__wbg_now_2fd65358804c9485=function(t){return pn(t).now()},e.wbg.__wbg_get_f01601b5a68d10e3=function(t,n){const i=pn(t)[n>>>0];return si(i)},e.wbg.__wbg_length_1009b1af0c481d7b=function(t){return pn(t).length},e.wbg.__wbindgen_is_function=function(t){return typeof pn(t)=="function"},e.wbg.__wbg_newnoargs_c62ea9419c21fbac=function(t,n){const i=new Function(ea(t,n));return si(i)},e.wbg.__wbg_next_9b877f231f476d01=function(t){const n=pn(t).next;return si(n)},e.wbg.__wbg_next_6529ee0cca8d57ed=function(){return gc(function(t){const n=pn(t).next();return si(n)},arguments)},e.wbg.__wbg_done_5fe336b092d60cf2=function(t){return pn(t).done},e.wbg.__wbg_value_0c248a78fdc8e19f=function(t){const n=pn(t).value;return si(n)},e.wbg.__wbg_iterator_db7ca081358d4fb2=function(){return si(Symbol.iterator)},e.wbg.__wbg_get_7b48513de5dc5ea4=function(){return gc(function(t,n){const i=Reflect.get(pn(t),pn(n));return si(i)},arguments)},e.wbg.__wbg_call_90c26b09837aba1c=function(){return gc(function(t,n){const i=pn(t).call(pn(n));return si(i)},arguments)},e.wbg.__wbg_self_f0e34d89f33b99fd=function(){return gc(function(){const t=self.self;return si(t)},arguments)},e.wbg.__wbg_window_d3b084224f4774d7=function(){return gc(function(){const t=window.window;return si(t)},arguments)},e.wbg.__wbg_globalThis_9caa27ff917c6860=function(){return gc(function(){const t=globalThis.globalThis;return si(t)},arguments)},e.wbg.__wbg_global_35dfdd59a4da3e74=function(){return gc(function(){const t=global.global;return si(t)},arguments)},e.wbg.__wbg_isArray_74fb723e24f76012=function(t){return Array.isArray(pn(t))},e.wbg.__wbg_instanceof_ArrayBuffer_e7d53d51371448e2=function(t){let n;try{n=pn(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_isSafeInteger_f93fde0dca9820f8=function(t){return Number.isSafeInteger(pn(t))},e.wbg.__wbg_entries_9e2e2aa45aa5094a=function(t){const n=Object.entries(pn(t));return si(n)},e.wbg.__wbg_buffer_a448f833075b71ba=function(t){const n=pn(t).buffer;return si(n)},e.wbg.__wbg_new_8f67e318f15d7254=function(t){const n=new Uint8Array(pn(t));return si(n)},e.wbg.__wbg_set_2357bf09366ee480=function(t,n,i){pn(t).set(pn(n),i>>>0)},e.wbg.__wbg_length_1d25fa9e4ac21ce7=function(t){return pn(t).length},e.wbg.__wbg_instanceof_Uint8Array_bced6f43aed8c1aa=function(t){let n;try{n=pn(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbindgen_bigint_get_as_i64=function(t,n){const i=pn(n),r=typeof i=="bigint"?i:void 0;GS()[t/8+1]=Lh(r)?BigInt(0):r,Je()[t/4+0]=!Lh(r)},e.wbg.__wbindgen_debug_string=function(t,n){const i=ty(pn(n)),r=Bl(i,fe.__wbindgen_malloc,fe.__wbindgen_realloc),u=Ts;Je()[t/4+1]=u,Je()[t/4+0]=r},e.wbg.__wbindgen_throw=function(t,n){throw new Error(ea(t,n))},e.wbg.__wbindgen_memory=function(){const t=fe.memory;return si(t)},e}function YS(e,t){return fe=e.exports,Xb.__wbindgen_wasm_module=t,Lf=null,Tf=null,Cf=null,If=null,fe}async function Xb(e){if(fe!==void 0)return fe;typeof e>"u"&&(e="/ltn/assets/backend_bg.wasm");const t=HS();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:i}=await XS(await e,t);return YS(n,i)}let We;const Hb=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Hb.decode();let Mf=null;function zf(){return(Mf===null||Mf.byteLength===0)&&(Mf=new Uint8Array(We.memory.buffer)),Mf}function Ul(e,t){return e=e>>>0,Hb.decode(zf().subarray(e,e+t))}const Gl=new Array(128).fill(void 0);Gl.push(void 0,null,!0,!1);let Ff=Gl.length;function zr(e){Ff===Gl.length&&Gl.push(Gl.length+1);const t=Ff;return Ff=Gl[t],Gl[t]=e,t}function Tn(e){return Gl[e]}function KS(e){e<132||(Gl[e]=Ff,Ff=e)}function Um(e){const t=Tn(e);return KS(e),t}function G_(e){return e==null}let Pf=null;function JS(){return(Pf===null||Pf.byteLength===0)&&(Pf=new Float64Array(We.memory.buffer)),Pf}let Af=null;function Si(){return(Af===null||Af.byteLength===0)&&(Af=new Int32Array(We.memory.buffer)),Af}let Mu=0;const Gm=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},QS=typeof Gm.encodeInto=="function"?function(e,t){return Gm.encodeInto(e,t)}:function(e,t){const n=Gm.encode(e);return t.set(n),{read:e.length,written:n.length}};function Mm(e,t,n){if(n===void 0){const a=Gm.encode(e),_=t(a.length,1)>>>0;return zf().subarray(_,_+a.length).set(a),Mu=a.length,_}let i=e.length,r=t(i,1)>>>0;const u=zf();let p=0;for(;p127)break;u[r+p]=a}if(p!==i){p!==0&&(e=e.slice(p)),r=n(r,i,i=p+e.length*3,1)>>>0;const a=zf().subarray(r+p,r+i),_=QS(e,a);p+=_.written}return Mu=p,r}function ey(e){const t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){const r=e.description;return r==null?"Symbol":`Symbol(${r})`}if(t=="function"){const r=e.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(e)){const r=e.length;let u="[";r>0&&(u+=ey(e[0]));for(let p=1;p1)i=n[1];else return toString.call(e);if(i=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message} +${e.stack}`:i}function $S(e,t){const n=t(e.length*1,1)>>>0;return zf().set(e,n/1),Mu=e.length,n}function j_(e,t){try{return e.apply(this,t)}catch(n){We.__wbindgen_exn_store(zr(n))}}class Xm{static __wrap(t){t=t>>>0;const n=Object.create(Xm.prototype);return n.__wbg_ptr=t,n}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){const t=this.__destroy_into_raw();We.__wbg_jsroutesnapper_free(t)}constructor(t){try{const u=We.__wbindgen_add_to_stack_pointer(-16),p=$S(t,We.__wbindgen_malloc),a=Mu;We.jsroutesnapper_new(u,p,a);var n=Si()[u/4+0],i=Si()[u/4+1],r=Si()[u/4+2];if(r)throw Um(i);return Xm.__wrap(n)}finally{We.__wbindgen_add_to_stack_pointer(16)}}setRouteConfig(t){We.jsroutesnapper_setRouteConfig(this.__wbg_ptr,zr(t))}setAreaMode(){We.jsroutesnapper_setAreaMode(this.__wbg_ptr)}getConfig(){let t,n;try{const u=We.__wbindgen_add_to_stack_pointer(-16);We.jsroutesnapper_getConfig(u,this.__wbg_ptr);var i=Si()[u/4+0],r=Si()[u/4+1];return t=i,n=r,Ul(i,r)}finally{We.__wbindgen_add_to_stack_pointer(16),We.__wbindgen_free(t,n,1)}}toFinalFeature(){try{const i=We.__wbindgen_add_to_stack_pointer(-16);We.jsroutesnapper_toFinalFeature(i,this.__wbg_ptr);var t=Si()[i/4+0],n=Si()[i/4+1];let r;return t!==0&&(r=Ul(t,n).slice(),We.__wbindgen_free(t,n*1)),r}finally{We.__wbindgen_add_to_stack_pointer(16)}}renderGeojson(){let t,n;try{const u=We.__wbindgen_add_to_stack_pointer(-16);We.jsroutesnapper_renderGeojson(u,this.__wbg_ptr);var i=Si()[u/4+0],r=Si()[u/4+1];return t=i,n=r,Ul(i,r)}finally{We.__wbindgen_add_to_stack_pointer(16),We.__wbindgen_free(t,n,1)}}toggleSnapMode(){We.jsroutesnapper_toggleSnapMode(this.__wbg_ptr)}onMouseMove(t,n,i){return We.jsroutesnapper_onMouseMove(this.__wbg_ptr,t,n,i)!==0}onClick(){We.jsroutesnapper_onClick(this.__wbg_ptr)}onDragStart(){return We.jsroutesnapper_onDragStart(this.__wbg_ptr)!==0}onMouseUp(){return We.jsroutesnapper_onMouseUp(this.__wbg_ptr)!==0}clearState(){We.jsroutesnapper_clearState(this.__wbg_ptr)}editExisting(t){try{const r=We.__wbindgen_add_to_stack_pointer(-16);We.jsroutesnapper_editExisting(r,this.__wbg_ptr,zr(t));var n=Si()[r/4+0],i=Si()[r/4+1];if(i)throw Um(n)}finally{We.__wbindgen_add_to_stack_pointer(16)}}debugRenderGraph(){let t,n;try{const u=We.__wbindgen_add_to_stack_pointer(-16);We.jsroutesnapper_debugRenderGraph(u,this.__wbg_ptr);var i=Si()[u/4+0],r=Si()[u/4+1];return t=i,n=r,Ul(i,r)}finally{We.__wbindgen_add_to_stack_pointer(16),We.__wbindgen_free(t,n,1)}}routeNameForWaypoints(t){let n,i;try{const S=We.__wbindgen_add_to_stack_pointer(-16);We.jsroutesnapper_routeNameForWaypoints(S,this.__wbg_ptr,zr(t));var r=Si()[S/4+0],u=Si()[S/4+1],p=Si()[S/4+2],a=Si()[S/4+3],_=r,x=u;if(a)throw _=0,x=0,Um(p);return n=_,i=x,Ul(_,x)}finally{We.__wbindgen_add_to_stack_pointer(16),We.__wbindgen_free(n,i,1)}}addSnappedWaypoint(t,n){We.jsroutesnapper_addSnappedWaypoint(this.__wbg_ptr,t,n)}undo(){We.jsroutesnapper_undo(this.__wbg_ptr)}}async function tE(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){if(e.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",i);else throw i}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function eE(){const e={};return e.wbg={},e.wbg.__wbindgen_string_new=function(t,n){const i=Ul(t,n);return zr(i)},e.wbg.__wbindgen_object_drop_ref=function(t){Um(t)},e.wbg.__wbindgen_error_new=function(t,n){const i=new Error(Ul(t,n));return zr(i)},e.wbg.__wbindgen_is_object=function(t){const n=Tn(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_is_undefined=function(t){return Tn(t)===void 0},e.wbg.__wbindgen_in=function(t,n){return Tn(t)in Tn(n)},e.wbg.__wbindgen_number_get=function(t,n){const i=Tn(n),r=typeof i=="number"?i:void 0;JS()[t/8+1]=G_(r)?0:r,Si()[t/4+0]=!G_(r)},e.wbg.__wbindgen_boolean_get=function(t){const n=Tn(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_object_clone_ref=function(t){const n=Tn(t);return zr(n)},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return Tn(t)==Tn(n)},e.wbg.__wbindgen_string_get=function(t,n){const i=Tn(n),r=typeof i=="string"?i:void 0;var u=G_(r)?0:Mm(r,We.__wbindgen_malloc,We.__wbindgen_realloc),p=Mu;Si()[t/4+1]=p,Si()[t/4+0]=u},e.wbg.__wbg_String_4370c5505c674d30=function(t,n){const i=String(Tn(n)),r=Mm(i,We.__wbindgen_malloc,We.__wbindgen_realloc),u=Mu;Si()[t/4+1]=u,Si()[t/4+0]=r},e.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea=function(t,n){const i=Tn(t)[Tn(n)];return zr(i)},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return zr(t)},e.wbg.__wbg_stack_658279fe44541cf6=function(t,n){const i=Tn(n).stack,r=Mm(i,We.__wbindgen_malloc,We.__wbindgen_realloc),u=Mu;Si()[t/4+1]=u,Si()[t/4+0]=r},e.wbg.__wbg_error_f851667af71bcfc6=function(t,n){let i,r;try{i=t,r=n,console.error(Ul(t,n))}finally{We.__wbindgen_free(i,r,1)}},e.wbg.__wbg_debug_9a6b3243fbbebb61=function(t){console.debug(Tn(t))},e.wbg.__wbg_error_788ae33f81d3b84b=function(t){console.error(Tn(t))},e.wbg.__wbg_info_2e30e8204b29d91d=function(t){console.info(Tn(t))},e.wbg.__wbg_log_1d3ae0273d8f4f8a=function(t){console.log(Tn(t))},e.wbg.__wbg_warn_d60e832f9882c1b2=function(t){console.warn(Tn(t))},e.wbg.__wbg_get_44be0491f933a435=function(t,n){const i=Tn(t)[n>>>0];return zr(i)},e.wbg.__wbg_length_fff51ee6522a1a18=function(t){return Tn(t).length},e.wbg.__wbindgen_is_function=function(t){return typeof Tn(t)=="function"},e.wbg.__wbg_next_526fc47e980da008=function(t){const n=Tn(t).next;return zr(n)},e.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return j_(function(t){const n=Tn(t).next();return zr(n)},arguments)},e.wbg.__wbg_done_5c1f01fb660d73b5=function(t){return Tn(t).done},e.wbg.__wbg_value_1695675138684bd5=function(t){const n=Tn(t).value;return zr(n)},e.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return zr(Symbol.iterator)},e.wbg.__wbg_get_97b561fb56f034b5=function(){return j_(function(t,n){const i=Reflect.get(Tn(t),Tn(n));return zr(i)},arguments)},e.wbg.__wbg_call_cb65541d95d71282=function(){return j_(function(t,n){const i=Tn(t).call(Tn(n));return zr(i)},arguments)},e.wbg.__wbg_isArray_4c24b343cb13cfb1=function(t){return Array.isArray(Tn(t))},e.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(t){let n;try{n=Tn(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_buffer_085ec1f694018c4f=function(t){const n=Tn(t).buffer;return zr(n)},e.wbg.__wbg_new_8125e318e6245eed=function(t){const n=new Uint8Array(Tn(t));return zr(n)},e.wbg.__wbg_set_5cf90238115182c3=function(t,n,i){Tn(t).set(Tn(n),i>>>0)},e.wbg.__wbg_length_72e2208bbc0efc61=function(t){return Tn(t).length},e.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(t){let n;try{n=Tn(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbindgen_debug_string=function(t,n){const i=ey(Tn(n)),r=Mm(i,We.__wbindgen_malloc,We.__wbindgen_realloc),u=Mu;Si()[t/4+1]=u,Si()[t/4+0]=r},e.wbg.__wbindgen_throw=function(t,n){throw new Error(Ul(t,n))},e.wbg.__wbindgen_memory=function(){const t=We.memory;return zr(t)},e}function nE(e,t){return We=e.exports,Yb.__wbindgen_wasm_module=t,Pf=null,Af=null,Mf=null,We}async function Yb(e){if(We!==void 0)return We;typeof e>"u"&&(e="/ltn/assets/route_snapper_bg.wasm");const t=eE();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:i}=await tE(await e,t);return nE(n,i)}const Eh=[];function q_(e,t){return{subscribe:pi(e,t).subscribe}}function pi(e,t=Le){let n;const i=new Set;function r(a){if(Qe(e,a)&&(e=a,n)){const _=!Eh.length;for(const x of i)x[1](),Eh.push(x,e);if(_){for(let x=0;x{i.delete(x),i.size===0&&n&&(n(),n=null)}}return{set:r,update:u,subscribe:p}}let iE=Date.now();function ip(e){return`${e}-${iE++}`}const Iy=Symbol.for("svelte-maplibre");function rp(){return AS(Iy)}function rE(e){let t=new WeakMap;return n=>{var p;let i=t.get(n.originalEvent);if(i!==void 0)return i;let u=(p=n.target.queryRenderedFeatures(n.point).find(a=>{var _;return(_=e.get(a.layer.id))==null?void 0:_.interactive}))==null?void 0:p.layer.id;return t.set(n.originalEvent,u),u}}function oE(){let e=new Map;return Vb(Iy,{map:pi(null),source:q_(null),layer:q_(null),popupTarget:q_(null),cluster:pi(),loadedImages:pi(new Set),minzoom:pi(0),maxzoom:pi(24),layerEvent:pi(null),layerInfo:e,eventTopMost:rE(e)})}function zv(e){return{subscribe:e.subscribe}}function Cy({key:e,setPopupTarget:t=!1,setCluster:n=!1,setMouseEvent:i=!1}){let r=rp(),u=pi(null),p=zv(u),a={...r,[e]:zv(u)};if(t&&(a.popupTarget=p),i){let _=pi(null);a.layerEvent=_,r.layerEvent=_}return n&&(a.cluster=pi()),Vb(Iy,a),{...r,self:u}}function sE(){return Cy({key:"source",setCluster:!0})}function aE(e=!0){return Cy({key:"layer",setPopupTarget:e,setMouseEvent:e})}function lE(){return Cy({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function uE(e){return"layerType"in e&&e.layerType==="deckgl"}var Kb=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Qb(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}),n}var $b={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(Kb,function(){var n,i,r;function u(a,_){if(!n)n=_;else if(!i)i=_;else{var x="var sharedChunk = {}; ("+n+")(sharedChunk); ("+i+")(sharedChunk);",S={};n(S),r=_(S),typeof window<"u"&&(r.workerUrl=window.URL.createObjectURL(new Blob([x],{type:"text/javascript"})))}}u(["exports"],function(a){function _(l,o,c,f){return new(c||(c=Promise))(function(m,v){function w(P){try{T(f.next(P))}catch(D){v(D)}}function E(P){try{T(f.throw(P))}catch(D){v(D)}}function T(P){var D;P.done?m(P.value):(D=P.value,D instanceof c?D:new c(function(F){F(D)})).then(w,E)}T((f=f.apply(l,o||[])).next())})}function x(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}typeof SuppressedError=="function"&&SuppressedError;var S=L;function L(l,o){this.x=l,this.y=o}L.prototype={clone:function(){return new L(this.x,this.y)},add:function(l){return this.clone()._add(l)},sub:function(l){return this.clone()._sub(l)},multByPoint:function(l){return this.clone()._multByPoint(l)},divByPoint:function(l){return this.clone()._divByPoint(l)},mult:function(l){return this.clone()._mult(l)},div:function(l){return this.clone()._div(l)},rotate:function(l){return this.clone()._rotate(l)},rotateAround:function(l,o){return this.clone()._rotateAround(l,o)},matMult:function(l){return this.clone()._matMult(l)},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(l){return this.x===l.x&&this.y===l.y},dist:function(l){return Math.sqrt(this.distSqr(l))},distSqr:function(l){var o=l.x-this.x,c=l.y-this.y;return o*o+c*c},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(l){return Math.atan2(this.y-l.y,this.x-l.x)},angleWith:function(l){return this.angleWithSep(l.x,l.y)},angleWithSep:function(l,o){return Math.atan2(this.x*o-this.y*l,this.x*l+this.y*o)},_matMult:function(l){var o=l[2]*this.x+l[3]*this.y;return this.x=l[0]*this.x+l[1]*this.y,this.y=o,this},_add:function(l){return this.x+=l.x,this.y+=l.y,this},_sub:function(l){return this.x-=l.x,this.y-=l.y,this},_mult:function(l){return this.x*=l,this.y*=l,this},_div:function(l){return this.x/=l,this.y/=l,this},_multByPoint:function(l){return this.x*=l.x,this.y*=l.y,this},_divByPoint:function(l){return this.x/=l.x,this.y/=l.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var l=this.y;return this.y=this.x,this.x=-l,this},_rotate:function(l){var o=Math.cos(l),c=Math.sin(l),f=c*this.x+o*this.y;return this.x=o*this.x-c*this.y,this.y=f,this},_rotateAround:function(l,o){var c=Math.cos(l),f=Math.sin(l),m=o.y+f*(this.x-o.x)+c*(this.y-o.y);return this.x=o.x+c*(this.x-o.x)-f*(this.y-o.y),this.y=m,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},L.convert=function(l){return l instanceof L?l:Array.isArray(l)?new L(l[0],l[1]):l};var A=x(S),N=O;function O(l,o,c,f){this.cx=3*l,this.bx=3*(c-l)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(f-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=l,this.p1y=o,this.p2x=c,this.p2y=f}O.prototype={sampleCurveX:function(l){return((this.ax*l+this.bx)*l+this.cx)*l},sampleCurveY:function(l){return((this.ay*l+this.by)*l+this.cy)*l},sampleCurveDerivativeX:function(l){return(3*this.ax*l+2*this.bx)*l+this.cx},solveCurveX:function(l,o){if(o===void 0&&(o=1e-6),l<0)return 0;if(l>1)return 1;for(var c=l,f=0;f<8;f++){var m=this.sampleCurveX(c)-l;if(Math.abs(m)m?w=c:E=c,c=.5*(E-w)+w;return c},solve:function(l,o){return this.sampleCurveY(this.solveCurveX(l,o))}};var Z=x(N);let G,K;function V(){return G==null&&(G=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),G}function H(){if(K==null&&(K=!1,V())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let f=0;f<5*5;f++){const m=4*f;o.fillStyle=`rgb(${m},${m+1},${m+2})`,o.fillRect(f%5,Math.floor(f/5),1,1)}const c=o.getImageData(0,0,5,5).data;for(let f=0;f<5*5*4;f++)if(f%4!=3&&c[f]!==f){K=!0;break}}}return K||!1}function Q(l,o,c,f){const m=new Z(l,o,c,f);return function(v){return m.solve(v)}}const it=Q(.25,.1,.25,1);function ht(l,o,c){return Math.min(c,Math.max(o,l))}function ft(l,o,c){const f=c-o,m=((l-o)%f+f)%f+o;return m===o?c:m}function dt(l,...o){for(const c of o)for(const f in c)l[f]=c[f];return l}let ut=1;function Mt(l,o,c){const f={};for(const m in l)f[m]=o.call(c||this,l[m],m,l);return f}function xt(l,o,c){const f={};for(const m in l)o.call(c||this,l[m],m,l)&&(f[m]=l[m]);return f}function yt(l){return Array.isArray(l)?l.map(yt):typeof l=="object"&&l?Mt(l,yt):l}const de={};function Rt(l){de[l]||(typeof console<"u"&&console.warn(l),de[l]=!0)}function Gt(l,o,c){return(c.y-l.y)*(o.x-l.x)>(o.y-l.y)*(c.x-l.x)}function Kt(l){let o=0;for(let c,f,m=0,v=l.length,w=v-1;m"u")throw new Error("VideoFrame not supported");const v=new VideoFrame(l,{timestamp:0});try{const w=v==null?void 0:v.format;if(!w||!w.startsWith("BGR")&&!w.startsWith("RGB"))throw new Error(`Unrecognized format ${w}`);const E=w.startsWith("BGR"),T=new Uint8ClampedArray(f*m*4);if(yield v.copyTo(T,function(P,D,F,U,X){const Y=4*Math.max(-D,0),tt=(Math.max(0,F)-F)*U*4+Y,lt=4*U,pt=Math.max(0,D),Tt=Math.max(0,F);return{rect:{x:pt,y:Tt,width:Math.min(P.width,D+U)-pt,height:Math.min(P.height,F+X)-Tt},layout:[{offset:tt,stride:lt}]}}(l,o,c,f,m)),E)for(let P=0;PcancelAnimationFrame(o)}},getImageData(l,o=0){return this.getImageCanvasContext(l).getImageData(-o,-o,l.width+2*o,l.height+2*o)},getImageCanvasContext(l){const o=window.document.createElement("canvas"),c=o.getContext("2d",{willReadFrequently:!0});if(!c)throw new Error("failed to create canvas 2d context");return o.width=l.width,o.height=l.height,c.drawImage(l,0,0,l.width,l.height),c},resolveURL:l=>(fn||(fn=document.createElement("a")),fn.href=l,fn.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Mn==null&&(Mn=matchMedia("(prefers-reduced-motion: reduce)")),Mn.matches)}},Wt={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class Me extends Error{constructor(o,c,f,m){super(`AJAXError: ${c} (${o}): ${f}`),this.status=o,this.statusText=c,this.url=f,this.body=m}}const yn=be()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,ni=l=>Wt.REGISTERED_PROTOCOLS[l.substring(0,l.indexOf("://"))];function _o(l,o){const c=new AbortController,f=new Request(l.url,{method:l.method||"GET",body:l.body,credentials:l.credentials,headers:l.headers,cache:l.cache,referrer:yn(),signal:c.signal});let m=!1,v=!1;return l.type==="json"&&f.headers.set("Accept","application/json"),v||fetch(f).then(w=>w.ok?(E=>{(l.type==="arrayBuffer"||l.type==="image"?E.arrayBuffer():l.type==="json"?E.json():E.text()).then(T=>{v||(m=!0,o(null,T,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(T=>{v||o(new Error(T.message))})})(w):w.blob().then(E=>o(new Me(w.status,w.statusText,l.url,E)))).catch(w=>{w.code!==20&&o(new Error(w.message))}),{cancel:()=>{v=!0,m||c.abort()}}}const tr=function(l,o){if(/:\/\//.test(l.url)&&!/^https?:|^file:/.test(l.url)){if(be()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",l,o);if(!be())return(ni(l.url)||_o)(l,o)}if(!(/^file:/.test(c=l.url)||/^file:/.test(yn())&&!/^\w+:/.test(c))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return _o(l,o);if(be()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",l,o,void 0,!0)}var c;return function(f,m){const v=new XMLHttpRequest;v.open(f.method||"GET",f.url,!0),f.type!=="arrayBuffer"&&f.type!=="image"||(v.responseType="arraybuffer");for(const w in f.headers)v.setRequestHeader(w,f.headers[w]);return f.type==="json"&&(v.responseType="text",v.setRequestHeader("Accept","application/json")),v.withCredentials=f.credentials==="include",v.onerror=()=>{m(new Error(v.statusText))},v.onload=()=>{if((v.status>=200&&v.status<300||v.status===0)&&v.response!==null){let w=v.response;if(f.type==="json")try{w=JSON.parse(v.response)}catch(E){return m(E)}m(null,w,v.getResponseHeader("Cache-Control"),v.getResponseHeader("Expires"))}else{const w=new Blob([v.response],{type:v.getResponseHeader("Content-Type")});m(new Me(v.status,v.statusText,f.url,w))}},v.send(f.body),{cancel:()=>v.abort()}}(l,o)},Ct=function(l,o){return tr(dt(l,{type:"arrayBuffer"}),o)};function Ge(l){if(!l||l.indexOf("://")<=0||l.indexOf("data:image/")===0||l.indexOf("blob:")===0)return!0;const o=new URL(l),c=window.location;return o.protocol===c.protocol&&o.host===c.host}function je(l,o,c){c[l]&&c[l].indexOf(o)!==-1||(c[l]=c[l]||[],c[l].push(o))}function er(l,o,c){if(c&&c[l]){const f=c[l].indexOf(o);f!==-1&&c[l].splice(f,1)}}class Xn{constructor(o,c={}){dt(this,c),this.type=o}}class dn extends Xn{constructor(o,c={}){super("error",dt({error:o},c))}}class qi{on(o,c){return this._listeners=this._listeners||{},je(o,c,this._listeners),this}off(o,c){return er(o,c,this._listeners),er(o,c,this._oneTimeListeners),this}once(o,c){return c?(this._oneTimeListeners=this._oneTimeListeners||{},je(o,c,this._oneTimeListeners),this):new Promise(f=>this.once(o,f))}fire(o,c){typeof o=="string"&&(o=new Xn(o,c||{}));const f=o.type;if(this.listens(f)){o.target=this;const m=this._listeners&&this._listeners[f]?this._listeners[f].slice():[];for(const E of m)E.call(this,o);const v=this._oneTimeListeners&&this._oneTimeListeners[f]?this._oneTimeListeners[f].slice():[];for(const E of v)er(f,E,this._oneTimeListeners),E.call(this,o);const w=this._eventedParent;w&&(dt(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),w.fire(o))}else o instanceof dn&&console.error(o.error);return this}listens(o){return this._listeners&&this._listeners[o]&&this._listeners[o].length>0||this._oneTimeListeners&&this._oneTimeListeners[o]&&this._oneTimeListeners[o].length>0||this._eventedParent&&this._eventedParent.listens(o)}setEventedParent(o,c){return this._eventedParent=o,this._eventedParentData=c,this}}var jt={$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"},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}},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 Oi=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function sr(l,o){const c={};for(const f in l)f!=="ref"&&(c[f]=l[f]);return Oi.forEach(f=>{f in o&&(c[f]=o[f])}),c}function On(l,o){if(Array.isArray(l)){if(!Array.isArray(o)||l.length!==o.length)return!1;for(let c=0;c`:l.itemType.kind==="value"?"array":`array<${o}>`}return l.kind}const Et=[xs,le,cn,Ke,Ar,st,ns,q(en),B,j,J];function gt(l,o){if(o.kind==="error")return null;if(l.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!gt(l.itemType,o.itemType))&&(typeof l.N!="number"||l.N===o.N))return null}else{if(l.kind===o.kind)return null;if(l.kind==="value"){for(const c of Et)if(!gt(c,o))return null}}return`Expected ${ot(l)} but found ${ot(o)} instead.`}function rt(l,o){return o.some(c=>c.kind===l.kind)}function bt(l,o){return o.some(c=>c==="null"?l===null:c==="array"?Array.isArray(l):c==="object"?l&&!Array.isArray(l)&&typeof l=="object":c===typeof l)}function qt(l,o){return l.kind==="array"&&o.kind==="array"?l.itemType.kind===o.itemType.kind&&typeof l.N=="number":l.kind===o.kind}const Zt=.96422,Ht=.82521,Ne=4/29,Ye=6/29,Ie=3*Ye*Ye,Fe=Ye*Ye*Ye,tn=Math.PI/180,Un=180/Math.PI;function Jn(l){return(l%=360)<0&&(l+=360),l}function An([l,o,c,f]){let m,v;const w=jr((.2225045*(l=Pn(l))+.7168786*(o=Pn(o))+.0606169*(c=Pn(c)))/1);l===o&&o===c?m=v=w:(m=jr((.4360747*l+.3850649*o+.1430804*c)/Zt),v=jr((.0139322*l+.0971045*o+.7141733*c)/Ht));const E=116*w-16;return[E<0?0:E,500*(m-w),200*(w-v),f]}function Pn(l){return l<=.04045?l/12.92:Math.pow((l+.055)/1.055,2.4)}function jr(l){return l>Fe?Math.pow(l,1/3):l/Ie+Ne}function ri([l,o,c,f]){let m=(l+16)/116,v=isNaN(o)?m:m+o/500,w=isNaN(c)?m:m-c/200;return m=1*kr(m),v=Zt*kr(v),w=Ht*kr(w),[nr(3.1338561*v-1.6168667*m-.4906146*w),nr(-.9787684*v+1.9161415*m+.033454*w),nr(.0719453*v-.2289914*m+1.4052427*w),f]}function nr(l){return(l=l<=.00304?12.92*l:1.055*Math.pow(l,1/2.4)-.055)<0?0:l>1?1:l}function kr(l){return l>Ye?l*l*l:Ie*(l-Ne)}function is(l){return parseInt(l.padEnd(2,l),16)/255}function xd(l,o){return ou(o?l/100:l,0,1)}function ou(l,o,c){return Math.min(Math.max(o,l),c)}function su(l){return!l.some(Number.isNaN)}const Dg={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 Hn{constructor(o,c,f,m=1,v=!0){this.r=o,this.g=c,this.b=f,this.a=m,v||(this.r*=m,this.g*=m,this.b*=m,m||this.overwriteGetter("rgb",[o,c,f,m]))}static parse(o){if(o instanceof Hn)return o;if(typeof o!="string")return;const c=function(f){if((f=f.toLowerCase().trim())==="transparent")return[0,0,0,0];const m=Dg[f];if(m){const[w,E,T]=m;return[w/255,E/255,T/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 E=1;return[is(f.slice(E,E+=w)),is(f.slice(E,E+=w)),is(f.slice(E,E+=w)),is(f.slice(E,E+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[E,T,P,D,F,U,X,Y,tt,lt,pt,Tt]=w,_t=[D||" ",X||" ",lt].join("");if(_t===" "||_t===" /"||_t===",,"||_t===",,,"){const Lt=[P,U,tt].join(""),Ft=Lt==="%%%"?100:Lt===""?255:0;if(Ft){const Yt=[ou(+T/Ft,0,1),ou(+F/Ft,0,1),ou(+Y/Ft,0,1),pt?xd(+pt,Tt):1];if(su(Yt))return Yt}}return}}const v=f.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(v){const[w,E,T,P,D,F,U,X,Y]=v,tt=[T||" ",D||" ",U].join("");if(tt===" "||tt===" /"||tt===",,"||tt===",,,"){const lt=[+E,ou(+P,0,100),ou(+F,0,100),X?xd(+X,Y):1];if(su(lt))return function([pt,Tt,_t,Lt]){function Ft(Yt){const ye=(Yt+pt/30)%12,Te=Tt*Math.min(_t,1-_t);return _t-Te*Math.max(-1,Math.min(ye-3,9-ye,1))}return pt=Jn(pt),Tt/=100,_t/=100,[Ft(0),Ft(8),Ft(4),Lt]}(lt)}}}(o);return c?new Hn(...c,!1):void 0}get rgb(){const{r:o,g:c,b:f,a:m}=this,v=m||1/0;return this.overwriteGetter("rgb",[o/v,c/v,f/v,m])}get hcl(){return this.overwriteGetter("hcl",function(o){const[c,f,m,v]=An(o),w=Math.sqrt(f*f+m*m);return[Math.round(1e4*w)?Jn(Math.atan2(m,f)*Un):NaN,w,c,v]}(this.rgb))}get lab(){return this.overwriteGetter("lab",An(this.rgb))}overwriteGetter(o,c){return Object.defineProperty(this,o,{value:c}),c}toString(){const[o,c,f,m]=this.rgb;return`rgba(${[o,c,f].map(v=>Math.round(255*v)).join(",")},${m})`}}Hn.black=new Hn(0,0,0,1),Hn.white=new Hn(1,1,1,1),Hn.transparent=new Hn(0,0,0,0),Hn.red=new Hn(1,0,0,1);class fp{constructor(o,c,f){this.sensitivity=o?c?"variant":"case":c?"accent":"base",this.locale=f,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(o,c){return this.collator.compare(o,c)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Fc{constructor(o,c,f,m,v){this.text=o,this.image=c,this.scale=f,this.fontStack=m,this.textColor=v}}class qr{constructor(o){this.sections=o}static fromString(o){return new qr([new Fc(o,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(o=>o.text.length!==0||o.image&&o.image.name.length!==0)}static factory(o){return o instanceof qr?o:qr.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class No{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof No)return o;if(typeof o=="number")return new No([o,o,o,o]);if(Array.isArray(o)&&!(o.length<1||o.length>4)){for(const c of o)if(typeof c!="number")return;switch(o.length){case 1:o=[o[0],o[0],o[0],o[0]];break;case 2:o=[o[0],o[1],o[0],o[1]];break;case 3:o=[o[0],o[1],o[2],o[1]]}return new No(o)}}toString(){return JSON.stringify(this.values)}}const Rg=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class rs{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof rs)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let c=0;c=0&&l<=255&&typeof o=="number"&&o>=0&&o<=255&&typeof c=="number"&&c>=0&&c<=255?f===void 0||typeof f=="number"&&f>=0&&f<=1?null:`Invalid rgba value [${[l,o,c,f].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof f=="number"?[l,o,c,f]:[l,o,c]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function au(l){if(l===null||typeof l=="string"||typeof l=="boolean"||typeof l=="number"||l instanceof Hn||l instanceof fp||l instanceof qr||l instanceof No||l instanceof rs||l instanceof Nr)return!0;if(Array.isArray(l)){for(const o of l)if(!au(o))return!1;return!0}if(typeof l=="object"){for(const o in l)if(!au(l[o]))return!1;return!0}return!1}function vi(l){if(l===null)return xs;if(typeof l=="string")return cn;if(typeof l=="boolean")return Ke;if(typeof l=="number")return le;if(l instanceof Hn)return Ar;if(l instanceof fp)return ws;if(l instanceof qr)return st;if(l instanceof No)return B;if(l instanceof rs)return J;if(l instanceof Nr)return j;if(Array.isArray(l)){const o=l.length;let c;for(const f of l){const m=vi(f);if(c){if(c===m)continue;c=en;break}c=m}return q(c||en,o)}return ns}function zn(l){const o=typeof l;return l===null?"":o==="string"||o==="number"||o==="boolean"?String(l):l instanceof Hn||l instanceof qr||l instanceof No||l instanceof rs||l instanceof Nr?l.toString():JSON.stringify(l)}class wl{constructor(o,c){this.type=o,this.value=c}static parse(o,c){if(o.length!==2)return c.error(`'literal' expression requires exactly one argument, but found ${o.length-1} instead.`);if(!au(o[1]))return c.error("invalid value");const f=o[1];let m=vi(f);const v=c.expectedType;return m.kind!=="array"||m.N!==0||!v||v.kind!=="array"||typeof v.N=="number"&&v.N!==0||(m=v),new wl(m,f)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Mi{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const Vc={string:cn,number:le,boolean:Ke,object:ns};class os{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");let f,m=1;const v=o[0];if(v==="array"){let E,T;if(o.length>2){const P=o[1];if(typeof P!="string"||!(P in Vc)||P==="object")return c.error('The item type argument of "array" must be one of string, number, boolean',1);E=Vc[P],m++}else E=en;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return c.error('The length argument to "array" must be a positive integer literal',2);T=o[2],m++}f=q(E,T)}else{if(!Vc[v])throw new Error(`Types doesn't contain name = ${v}`);f=Vc[v]}const w=[];for(;mo.outputDefined())}}const dp={"to-boolean":Ke,"to-color":Ar,"to-number":le,"to-string":cn};class Ya{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");const f=o[0];if(!dp[f])throw new Error(`Can't parse ${f} as it is not part of the known types`);if((f==="to-boolean"||f==="to-string")&&o.length!==2)return c.error("Expected one argument.");const m=dp[f],v=[];for(let w=1;w4?`Invalid rbga value ${JSON.stringify(c)}: expected an array containing either three or four numeric values.`:Bc(c[0],c[1],c[2],c[3]),!f))return new Hn(c[0]/255,c[1]/255,c[2]/255,c[3])}throw new Mi(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(o);const m=No.parse(c);if(m)return m}throw new Mi(`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(o);const m=rs.parse(c);if(m)return m}throw new Mi(`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(o),c===null)return 0;const m=Number(c);if(!isNaN(m))return m}throw new Mi(`Could not convert ${JSON.stringify(c)} to number.`)}case"formatted":return qr.fromString(zn(this.args[0].evaluate(o)));case"resolvedImage":return Nr.fromString(zn(this.args[0].evaluate(o)));default:return zn(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const wd=["Unknown","Point","LineString","Polygon"];class mp{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"?wd[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(o){let c=this._parseColorCache[o];return c||(c=this._parseColorCache[o]=Hn.parse(o)),c}}class Uc{constructor(o,c,f=[],m,v=new Sa,w=[]){this.registry=o,this.path=f,this.key=f.map(E=>`[${E}]`).join(""),this.scope=v,this.errors=w,this.expectedType=m,this._isConstant=c}parse(o,c,f,m,v={}){return c?this.concat(c,f,m)._parse(o,v):this._parse(o,v)}_parse(o,c){function f(m,v,w){return w==="assert"?new os(v,[m]):w==="coerce"?new Ya(v,[m]):m}if(o!==null&&typeof o!="string"&&typeof o!="boolean"&&typeof o!="number"||(o=["literal",o]),Array.isArray(o)){if(o.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const m=o[0];if(typeof m!="string")return this.error(`Expression name must be a string, but found ${typeof m} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const v=this.registry[m];if(v){let w=v.parse(o,this);if(!w)return null;if(this.expectedType){const E=this.expectedType,T=w.type;if(E.kind!=="string"&&E.kind!=="number"&&E.kind!=="boolean"&&E.kind!=="object"&&E.kind!=="array"||T.kind!=="value")if(E.kind!=="color"&&E.kind!=="formatted"&&E.kind!=="resolvedImage"||T.kind!=="value"&&T.kind!=="string")if(E.kind!=="padding"||T.kind!=="value"&&T.kind!=="number"&&T.kind!=="array")if(E.kind!=="variableAnchorOffsetCollection"||T.kind!=="value"&&T.kind!=="array"){if(this.checkSubtype(E,T))return null}else w=f(w,E,c.typeAnnotation||"coerce");else w=f(w,E,c.typeAnnotation||"coerce");else w=f(w,E,c.typeAnnotation||"coerce");else w=f(w,E,c.typeAnnotation||"assert")}if(!(w instanceof wl)&&w.type.kind!=="resolvedImage"&&this._isConstant(w)){const E=new mp;try{w=new wl(w.type,w.evaluate(E))}catch(T){return this.error(T.message),null}}return w}return this.error(`Unknown expression "${m}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(o===void 0?"'undefined' value invalid. Use null instead.":typeof o=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof o} instead.`)}concat(o,c,f){const m=typeof o=="number"?this.path.concat(o):this.path,v=f?this.scope.concat(f):this.scope;return new Uc(this.registry,this._isConstant,m,c||null,v,this.errors)}error(o,...c){const f=`${this.key}${c.map(m=>`[${m}]`).join("")}`;this.errors.push(new ii(f,o))}checkSubtype(o,c){const f=gt(o,c);return f&&this.error(f),f}}class Gc{constructor(o,c,f){this.type=ws,this.locale=f,this.caseSensitive=o,this.diacriticSensitive=c}static parse(o,c){if(o.length!==2)return c.error("Expected one argument.");const f=o[1];if(typeof f!="object"||Array.isArray(f))return c.error("Collator options argument must be an object.");const m=c.parse(f["case-sensitive"]!==void 0&&f["case-sensitive"],1,Ke);if(!m)return null;const v=c.parse(f["diacritic-sensitive"]!==void 0&&f["diacritic-sensitive"],1,Ke);if(!v)return null;let w=null;return f.locale&&(w=c.parse(f.locale,1,cn),!w)?null:new Gc(m,v,w)}evaluate(o){return new fp(this.caseSensitive.evaluate(o),this.diacriticSensitive.evaluate(o),this.locale?this.locale.evaluate(o):null)}eachChild(o){o(this.caseSensitive),o(this.diacriticSensitive),this.locale&&o(this.locale)}outputDefined(){return!1}}const Ka=8192;function gp(l,o){l[0]=Math.min(l[0],o[0]),l[1]=Math.min(l[1],o[1]),l[2]=Math.max(l[2],o[0]),l[3]=Math.max(l[3],o[1])}function Yu(l,o){return!(l[0]<=o[0]||l[2]>=o[2]||l[1]<=o[1]||l[3]>=o[3])}function Sd(l,o){const c=(180+l[0])/360,f=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l[1]*Math.PI/360)))/360,m=Math.pow(2,o.z);return[Math.round(c*m*Ka),Math.round(f*m*Ka)]}function Og(l,o,c){const f=l[0]-o[0],m=l[1]-o[1],v=l[0]-c[0],w=l[1]-c[1];return f*w-v*m==0&&f*v<=0&&m*w<=0}function _p(l,o){let c=!1;for(let w=0,E=o.length;w(f=l)[1]!=(v=T[P+1])[1]>f[1]&&f[0]<(v[0]-m[0])*(f[1]-m[1])/(v[1]-m[1])+m[0]&&(c=!c)}}var f,m,v;return c}function yp(l,o){for(let c=0;c0&&E<0||w<0&&E>0}function zg(l,o,c){for(const P of c)for(let D=0;Dc[2]){const m=.5*f;let v=l[0]-c[0]>m?-f:c[0]-l[0]>m?f:0;v===0&&(v=l[0]-c[2]>m?-f:c[2]-l[0]>m?f:0),l[0]+=v}gp(o,l)}function vp(l,o,c,f){const m=Math.pow(2,f.z)*Ka,v=[f.x*Ka,f.y*Ka],w=[];for(const E of l)for(const T of E){const P=[T.x+v[0],T.y+v[1]];Ld(P,o,c,m),w.push(P)}return w}function bp(l,o,c,f){const m=Math.pow(2,f.z)*Ka,v=[f.x*Ka,f.y*Ka],w=[];for(const T of l){const P=[];for(const D of T){const F=[D.x+v[0],D.y+v[1]];gp(o,F),P.push(F)}w.push(P)}if(o[2]-o[0]<=m/2){(E=o)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(const T of w)for(const P of T)Ld(P,o,c,m)}var E;return w}class Sl{constructor(o,c){this.type=Ke,this.geojson=o,this.geometries=c}static parse(o,c){if(o.length!==2)return c.error(`'within' expression requires exactly one argument, but found ${o.length-1} instead.`);if(au(o[1])){const f=o[1];if(f.type==="FeatureCollection")for(let m=0;m!Array.isArray(P)||P.length===o.length-1);let T=null;for(const[P,D]of E){T=new Uc(c.registry,Zc,c.path,null,c.scope);const F=[];let U=!1;for(let X=1;X{return U=F,Array.isArray(U)?`(${U.map(ot).join(", ")})`:`(${ot(U.type)}...)`;var U}).join(" | "),D=[];for(let F=1;F{c=o?c&&Zc(f):c&&f instanceof wl}),!!c&&Wc(l)&&Xc(l,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Wc(l){if(l instanceof ss&&(l.name==="get"&&l.args.length===1||l.name==="feature-state"||l.name==="has"&&l.args.length===1||l.name==="properties"||l.name==="geometry-type"||l.name==="id"||/^filter-/.test(l.name))||l instanceof Sl)return!1;let o=!0;return l.eachChild(c=>{o&&!Wc(c)&&(o=!1)}),o}function Ku(l){if(l instanceof ss&&l.name==="feature-state")return!1;let o=!0;return l.eachChild(c=>{o&&!Ku(c)&&(o=!1)}),o}function Xc(l,o){if(l instanceof ss&&o.indexOf(l.name)>=0)return!1;let c=!0;return l.eachChild(f=>{c&&!Xc(f,o)&&(c=!1)}),c}function lu(l,o){const c=l.length-1;let f,m,v=0,w=c,E=0;for(;v<=w;)if(E=Math.floor((v+w)/2),f=l[E],m=l[E+1],f<=o){if(E===c||oo))throw new Mi("Input is not a number.");w=E-1}return 0}class Ja{constructor(o,c,f){this.type=o,this.input=c,this.labels=[],this.outputs=[];for(const[m,v]of f)this.labels.push(m),this.outputs.push(v)}static parse(o,c){if(o.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return c.error("Expected an even number of arguments.");const f=c.parse(o[1],1,le);if(!f)return null;const m=[];let v=null;c.expectedType&&c.expectedType.kind!=="value"&&(v=c.expectedType);for(let w=1;w=E)return c.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',P);const F=c.parse(T,D,v);if(!F)return null;v=v||F.type,m.push([E,F])}return new Ja(v,f,m)}evaluate(o){const c=this.labels,f=this.outputs;if(c.length===1)return f[0].evaluate(o);const m=this.input.evaluate(o);if(m<=c[0])return f[0].evaluate(o);const v=c.length;return m>=c[v-1]?f[v-1].evaluate(o):f[lu(c,m)].evaluate(o)}eachChild(o){o(this.input);for(const c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function In(l,o,c){return l+c*(o-l)}function Hc(l,o,c){return l.map((f,m)=>In(f,o[m],c))}const Do={number:In,color:function(l,o,c,f="rgb"){switch(f){case"rgb":{const[m,v,w,E]=Hc(l.rgb,o.rgb,c);return new Hn(m,v,w,E,!1)}case"hcl":{const[m,v,w,E]=l.hcl,[T,P,D,F]=o.hcl;let U,X;if(isNaN(m)||isNaN(T))isNaN(m)?isNaN(T)?U=NaN:(U=T,w!==1&&w!==0||(X=P)):(U=m,D!==1&&D!==0||(X=v));else{let Tt=T-m;T>m&&Tt>180?Tt-=360:T180&&(Tt+=360),U=m+c*Tt}const[Y,tt,lt,pt]=function([Tt,_t,Lt,Ft]){return Tt=isNaN(Tt)?0:Tt*tn,ri([Lt,Math.cos(Tt)*_t,Math.sin(Tt)*_t,Ft])}([U,X??In(v,P,c),In(w,D,c),In(E,F,c)]);return new Hn(Y,tt,lt,pt,!1)}case"lab":{const[m,v,w,E]=ri(Hc(l.lab,o.lab,c));return new Hn(m,v,w,E,!1)}}},array:Hc,padding:function(l,o,c){return new No(Hc(l.values,o.values,c))},variableAnchorOffsetCollection:function(l,o,c){const f=l.values,m=o.values;if(f.length!==m.length)throw new Mi(`Cannot interpolate values of different length. from: ${l.toString()}, to: ${o.toString()}`);const v=[];for(let w=0;wtypeof D!="number"||D<0||D>1))return c.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);m={name:"cubic-bezier",controlPoints:P}}}if(o.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return c.error("Expected an even number of arguments.");if(v=c.parse(v,2,le),!v)return null;const E=[];let T=null;f==="interpolate-hcl"||f==="interpolate-lab"?T=Ar:c.expectedType&&c.expectedType.kind!=="value"&&(T=c.expectedType);for(let P=0;P=D)return c.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',U);const Y=c.parse(F,X,T);if(!Y)return null;T=T||Y.type,E.push([D,Y])}return qt(T,le)||qt(T,Ar)||qt(T,B)||qt(T,J)||qt(T,q(le))?new Ro(T,f,m,v,E):c.error(`Type ${ot(T)} is not interpolatable.`)}evaluate(o){const c=this.labels,f=this.outputs;if(c.length===1)return f[0].evaluate(o);const m=this.input.evaluate(o);if(m<=c[0])return f[0].evaluate(o);const v=c.length;if(m>=c[v-1])return f[v-1].evaluate(o);const w=lu(c,m),E=Ro.interpolationFactor(this.interpolation,m,c[w],c[w+1]),T=f[w].evaluate(o),P=f[w+1].evaluate(o);switch(this.operator){case"interpolate":return Do[this.type.kind](T,P,E);case"interpolate-hcl":return Do.color(T,P,E,"hcl");case"interpolate-lab":return Do.color(T,P,E,"lab")}}eachChild(o){o(this.input);for(const c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function xp(l,o,c,f){const m=f-c,v=l-c;return m===0?0:o===1?v/m:(Math.pow(o,v)-1)/(Math.pow(o,m)-1)}class Yc{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expectected at least one argument.");let f=null;const m=c.expectedType;m&&m.kind!=="value"&&(f=m);const v=[];for(const E of o.slice(1)){const T=c.parse(E,1+v.length,f,void 0,{typeAnnotation:"omit"});if(!T)return null;f=f||T.type,v.push(T)}if(!f)throw new Error("No output type");const w=m&&v.some(E=>gt(m,E.type));return new Yc(w?en:f,v)}evaluate(o){let c,f=null,m=0;for(const v of this.args)if(m++,f=v.evaluate(o),f&&f instanceof Nr&&!f.available&&(c||(c=f.name),f=null,m===this.args.length&&(f=c)),f!==null)break;return f}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}class Kc{constructor(o,c){this.type=c.type,this.bindings=[].concat(o),this.result=c}evaluate(o){return this.result.evaluate(o)}eachChild(o){for(const c of this.bindings)o(c[1]);o(this.result)}static parse(o,c){if(o.length<4)return c.error(`Expected at least 3 arguments, but found ${o.length-1} instead.`);const f=[];for(let v=1;v=f.length)throw new Mi(`Array index out of bounds: ${c} > ${f.length-1}.`);if(c!==Math.floor(c))throw new Mi(`Array index must be an integer, but found ${c} instead.`);return f[c]}eachChild(o){o(this.index),o(this.input)}outputDefined(){return!1}}class Sp{constructor(o,c){this.type=Ke,this.needle=o,this.haystack=c}static parse(o,c){if(o.length!==3)return c.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const f=c.parse(o[1],1,en),m=c.parse(o[2],2,en);return f&&m?rt(f.type,[Ke,cn,le,xs,en])?new Sp(f,m):c.error(`Expected first argument to be of type boolean, string, number or null, but found ${ot(f.type)} instead`):null}evaluate(o){const c=this.needle.evaluate(o),f=this.haystack.evaluate(o);if(!f)return!1;if(!bt(c,["boolean","string","number","null"]))throw new Mi(`Expected first argument to be of type boolean, string, number or null, but found ${ot(vi(c))} instead.`);if(!bt(f,["string","array"]))throw new Mi(`Expected second argument to be of type array or string, but found ${ot(vi(f))} instead.`);return f.indexOf(c)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class Jc{constructor(o,c,f){this.type=le,this.needle=o,this.haystack=c,this.fromIndex=f}static parse(o,c){if(o.length<=2||o.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const f=c.parse(o[1],1,en),m=c.parse(o[2],2,en);if(!f||!m)return null;if(!rt(f.type,[Ke,cn,le,xs,en]))return c.error(`Expected first argument to be of type boolean, string, number or null, but found ${ot(f.type)} instead`);if(o.length===4){const v=c.parse(o[3],3,le);return v?new Jc(f,m,v):null}return new Jc(f,m)}evaluate(o){const c=this.needle.evaluate(o),f=this.haystack.evaluate(o);if(!bt(c,["boolean","string","number","null"]))throw new Mi(`Expected first argument to be of type boolean, string, number or null, but found ${ot(vi(c))} instead.`);if(!bt(f,["string","array"]))throw new Mi(`Expected second argument to be of type array or string, but found ${ot(vi(f))} instead.`);if(this.fromIndex){const m=this.fromIndex.evaluate(o);return f.indexOf(c,m)}return f.indexOf(c)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class Ep{constructor(o,c,f,m,v,w){this.inputType=o,this.type=c,this.input=f,this.cases=m,this.outputs=v,this.otherwise=w}static parse(o,c){if(o.length<5)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return c.error("Expected an even number of arguments.");let f,m;c.expectedType&&c.expectedType.kind!=="value"&&(m=c.expectedType);const v={},w=[];for(let P=2;PNumber.MAX_SAFE_INTEGER)return U.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof Y=="number"&&Math.floor(Y)!==Y)return U.error("Numeric branch labels must be integer values.");if(f){if(U.checkSubtype(f,vi(Y)))return null}else f=vi(Y);if(v[String(Y)]!==void 0)return U.error("Branch labels must be unique.");v[String(Y)]=w.length}const X=c.parse(F,P,m);if(!X)return null;m=m||X.type,w.push(X)}const E=c.parse(o[1],1,en);if(!E)return null;const T=c.parse(o[o.length-1],o.length-1,m);return T?E.type.kind!=="value"&&c.concat(1).checkSubtype(f,E.type)?null:new Ep(f,m,E,v,w,T):null}evaluate(o){const c=this.input.evaluate(o);return(vi(c)===this.inputType&&this.outputs[this.cases[c]]||this.otherwise).evaluate(o)}eachChild(o){o(this.input),this.outputs.forEach(o),o(this.otherwise)}outputDefined(){return this.outputs.every(o=>o.outputDefined())&&this.otherwise.outputDefined()}}class Ip{constructor(o,c,f){this.type=o,this.branches=c,this.otherwise=f}static parse(o,c){if(o.length<4)return c.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return c.error("Expected an odd number of arguments.");let f;c.expectedType&&c.expectedType.kind!=="value"&&(f=c.expectedType);const m=[];for(let w=1;wc.outputDefined())&&this.otherwise.outputDefined()}}class Qc{constructor(o,c,f,m){this.type=o,this.input=c,this.beginIndex=f,this.endIndex=m}static parse(o,c){if(o.length<=2||o.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const f=c.parse(o[1],1,en),m=c.parse(o[2],2,le);if(!f||!m)return null;if(!rt(f.type,[q(en),cn,en]))return c.error(`Expected first argument to be of type array or string, but found ${ot(f.type)} instead`);if(o.length===4){const v=c.parse(o[3],3,le);return v?new Qc(f.type,f,m,v):null}return new Qc(f.type,f,m)}evaluate(o){const c=this.input.evaluate(o),f=this.beginIndex.evaluate(o);if(!bt(c,["string","array"]))throw new Mi(`Expected first argument to be of type array or string, but found ${ot(vi(c))} instead.`);if(this.endIndex){const m=this.endIndex.evaluate(o);return c.slice(f,m)}return c.slice(f)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function Md(l,o){return l==="=="||l==="!="?o.kind==="boolean"||o.kind==="string"||o.kind==="number"||o.kind==="null"||o.kind==="value":o.kind==="string"||o.kind==="number"||o.kind==="value"}function Pd(l,o,c,f){return f.compare(o,c)===0}function uu(l,o,c){const f=l!=="=="&&l!=="!=";return class tx{constructor(v,w,E){this.type=Ke,this.lhs=v,this.rhs=w,this.collator=E,this.hasUntypedArgument=v.type.kind==="value"||w.type.kind==="value"}static parse(v,w){if(v.length!==3&&v.length!==4)return w.error("Expected two or three arguments.");const E=v[0];let T=w.parse(v[1],1,en);if(!T)return null;if(!Md(E,T.type))return w.concat(1).error(`"${E}" comparisons are not supported for type '${ot(T.type)}'.`);let P=w.parse(v[2],2,en);if(!P)return null;if(!Md(E,P.type))return w.concat(2).error(`"${E}" comparisons are not supported for type '${ot(P.type)}'.`);if(T.type.kind!==P.type.kind&&T.type.kind!=="value"&&P.type.kind!=="value")return w.error(`Cannot compare types '${ot(T.type)}' and '${ot(P.type)}'.`);f&&(T.type.kind==="value"&&P.type.kind!=="value"?T=new os(P.type,[T]):T.type.kind!=="value"&&P.type.kind==="value"&&(P=new os(T.type,[P])));let D=null;if(v.length===4){if(T.type.kind!=="string"&&P.type.kind!=="string"&&T.type.kind!=="value"&&P.type.kind!=="value")return w.error("Cannot use collator to compare non-string types.");if(D=w.parse(v[3],3,ws),!D)return null}return new tx(T,P,D)}evaluate(v){const w=this.lhs.evaluate(v),E=this.rhs.evaluate(v);if(f&&this.hasUntypedArgument){const T=vi(w),P=vi(E);if(T.kind!==P.kind||T.kind!=="string"&&T.kind!=="number")throw new Mi(`Expected arguments for "${l}" to be (string, string) or (number, number), but found (${T.kind}, ${P.kind}) instead.`)}if(this.collator&&!f&&this.hasUntypedArgument){const T=vi(w),P=vi(E);if(T.kind!=="string"||P.kind!=="string")return o(v,w,E)}return this.collator?c(v,w,E,this.collator.evaluate(v)):o(v,w,E)}eachChild(v){v(this.lhs),v(this.rhs),this.collator&&v(this.collator)}outputDefined(){return!0}}}const Fg=uu("==",function(l,o,c){return o===c},Pd),Bg=uu("!=",function(l,o,c){return o!==c},function(l,o,c,f){return!Pd(0,o,c,f)}),Vg=uu("<",function(l,o,c){return o",function(l,o,c){return o>c},function(l,o,c,f){return f.compare(o,c)>0}),Gg=uu("<=",function(l,o,c){return o<=c},function(l,o,c,f){return f.compare(o,c)<=0}),jg=uu(">=",function(l,o,c){return o>=c},function(l,o,c,f){return f.compare(o,c)>=0});class Cp{constructor(o,c,f,m,v){this.type=cn,this.number=o,this.locale=c,this.currency=f,this.minFractionDigits=m,this.maxFractionDigits=v}static parse(o,c){if(o.length!==3)return c.error("Expected two arguments.");const f=c.parse(o[1],1,le);if(!f)return null;const m=o[2];if(typeof m!="object"||Array.isArray(m))return c.error("NumberFormat options argument must be an object.");let v=null;if(m.locale&&(v=c.parse(m.locale,1,cn),!v))return null;let w=null;if(m.currency&&(w=c.parse(m.currency,1,cn),!w))return null;let E=null;if(m["min-fraction-digits"]&&(E=c.parse(m["min-fraction-digits"],1,le),!E))return null;let T=null;return m["max-fraction-digits"]&&(T=c.parse(m["max-fraction-digits"],1,le),!T)?null:new Cp(f,v,w,E,T)}evaluate(o){return new Intl.NumberFormat(this.locale?this.locale.evaluate(o):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(o):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(o):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(o):void 0}).format(this.number.evaluate(o))}eachChild(o){o(this.number),this.locale&&o(this.locale),this.currency&&o(this.currency),this.minFractionDigits&&o(this.minFractionDigits),this.maxFractionDigits&&o(this.maxFractionDigits)}outputDefined(){return!1}}class $c{constructor(o){this.type=st,this.sections=o}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");const f=o[1];if(!Array.isArray(f)&&typeof f=="object")return c.error("First argument must be an image or text section.");const m=[];let v=!1;for(let w=1;w<=o.length-1;++w){const E=o[w];if(v&&typeof E=="object"&&!Array.isArray(E)){v=!1;let T=null;if(E["font-scale"]&&(T=c.parse(E["font-scale"],1,le),!T))return null;let P=null;if(E["text-font"]&&(P=c.parse(E["text-font"],1,q(cn)),!P))return null;let D=null;if(E["text-color"]&&(D=c.parse(E["text-color"],1,Ar),!D))return null;const F=m[m.length-1];F.scale=T,F.font=P,F.textColor=D}else{const T=c.parse(o[w],1,en);if(!T)return null;const P=T.type.kind;if(P!=="string"&&P!=="value"&&P!=="null"&&P!=="resolvedImage")return c.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");v=!0,m.push({content:T,scale:null,font:null,textColor:null})}}return new $c(m)}evaluate(o){return new qr(this.sections.map(c=>{const f=c.content.evaluate(o);return vi(f)===j?new Fc("",f,null,null,null):new Fc(zn(f),null,c.scale?c.scale.evaluate(o):null,c.font?c.font.evaluate(o).join(","):null,c.textColor?c.textColor.evaluate(o):null)}))}eachChild(o){for(const c of this.sections)o(c.content),c.scale&&o(c.scale),c.font&&o(c.font),c.textColor&&o(c.textColor)}outputDefined(){return!1}}class Tp{constructor(o){this.type=j,this.input=o}static parse(o,c){if(o.length!==2)return c.error("Expected two arguments.");const f=c.parse(o[1],1,cn);return f?new Tp(f):c.error("No image name provided.")}evaluate(o){const c=this.input.evaluate(o),f=Nr.fromString(c);return f&&o.availableImages&&(f.available=o.availableImages.indexOf(c)>-1),f}eachChild(o){o(this.input)}outputDefined(){return!1}}class Lp{constructor(o){this.type=le,this.input=o}static parse(o,c){if(o.length!==2)return c.error(`Expected 1 argument, but found ${o.length-1} instead.`);const f=c.parse(o[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 ${ot(f.type)} instead.`):new Lp(f):null}evaluate(o){const c=this.input.evaluate(o);if(typeof c=="string"||Array.isArray(c))return c.length;throw new Mi(`Expected value to be of type string or array, but found ${ot(vi(c))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const cu={"==":Fg,"!=":Bg,">":Ug,"<":Vg,">=":jg,"<=":Gg,array:os,at:wp,boolean:os,case:Ip,coalesce:Yc,collator:Gc,format:$c,image:Tp,in:Sp,"index-of":Jc,interpolate:Ro,"interpolate-hcl":Ro,"interpolate-lab":Ro,length:Lp,let:Kc,literal:wl,match:Ep,number:os,"number-format":Cp,object:os,slice:Qc,step:Ja,string:os,"to-boolean":Ya,"to-color":Ya,"to-number":Ya,"to-string":Ya,var:qc,within:Sl};function Ad(l,[o,c,f,m]){o=o.evaluate(l),c=c.evaluate(l),f=f.evaluate(l);const v=m?m.evaluate(l):1,w=Bc(o,c,f,v);if(w)throw new Mi(w);return new Hn(o/255,c/255,f/255,v,!1)}function kd(l,o){return l in o}function Mp(l,o){const c=o[l];return c===void 0?null:c}function El(l){return{type:l}}function Nd(l){return{result:"success",value:l}}function Qa(l){return{result:"error",value:l}}function hu(l){return l["property-type"]==="data-driven"||l["property-type"]==="cross-faded-data-driven"}function Dd(l){return!!l.expression&&l.expression.parameters.indexOf("zoom")>-1}function Pp(l){return!!l.expression&&l.expression.interpolated}function Fn(l){return l instanceof Number?"number":l instanceof String?"string":l instanceof Boolean?"boolean":Array.isArray(l)?"array":l===null?"null":typeof l}function bi(l){return typeof l=="object"&&l!==null&&!Array.isArray(l)}function qg(l){return l}function Cn(l,o){const c=o.type==="color",f=l.stops&&typeof l.stops[0][0]=="object",m=f||!(f||l.property!==void 0),v=l.type||(Pp(o)?"exponential":"interval");if(c||o.type==="padding"){const D=c?Hn.parse:No.parse;(l=yo({},l)).stops&&(l.stops=l.stops.map(F=>[F[0],D(F[1])])),l.default=D(l.default?l.default:o.default)}if(l.colorSpace&&(w=l.colorSpace)!=="rgb"&&w!=="hcl"&&w!=="lab")throw new Error(`Unknown color space: "${l.colorSpace}"`);var w;let E,T,P;if(v==="exponential")E=Ju;else if(v==="interval")E=di;else if(v==="categorical"){E=xi,T=Object.create(null);for(const D of l.stops)T[D[0]]=D[1];P=typeof l.stops[0][0]}else{if(v!=="identity")throw new Error(`Unknown function type "${v}"`);E=Rd}if(f){const D={},F=[];for(let Y=0;YY[0]),evaluate:({zoom:Y},tt)=>Ju({stops:U,base:l.base},o,Y).evaluate(Y,tt)}}if(m){const D=v==="exponential"?{name:"exponential",base:l.base!==void 0?l.base:1}:null;return{kind:"camera",interpolationType:D,interpolationFactor:Ro.interpolationFactor.bind(void 0,D),zoomStops:l.stops.map(F=>F[0]),evaluate:({zoom:F})=>E(l,o,F,T,P)}}return{kind:"source",evaluate(D,F){const U=F&&F.properties?F.properties[l.property]:void 0;return U===void 0?Il(l.default,o.default):E(l,o,U,T,P)}}}function Il(l,o,c){return l!==void 0?l:o!==void 0?o:c!==void 0?c:void 0}function xi(l,o,c,f,m){return Il(typeof c===m?f[c]:void 0,l.default,o.default)}function di(l,o,c){if(Fn(c)!=="number")return Il(l.default,o.default);const f=l.stops.length;if(f===1||c<=l.stops[0][0])return l.stops[0][1];if(c>=l.stops[f-1][0])return l.stops[f-1][1];const m=lu(l.stops.map(v=>v[0]),c);return l.stops[m][1]}function Ju(l,o,c){const f=l.base!==void 0?l.base:1;if(Fn(c)!=="number")return Il(l.default,o.default);const m=l.stops.length;if(m===1||c<=l.stops[0][0])return l.stops[0][1];if(c>=l.stops[m-1][0])return l.stops[m-1][1];const v=lu(l.stops.map(D=>D[0]),c),w=function(D,F,U,X){const Y=X-U,tt=D-U;return Y===0?0:F===1?tt/Y:(Math.pow(F,tt)-1)/(Math.pow(F,Y)-1)}(c,f,l.stops[v][0],l.stops[v+1][0]),E=l.stops[v][1],T=l.stops[v+1][1],P=Do[o.type]||qg;return typeof E.evaluate=="function"?{evaluate(...D){const F=E.evaluate.apply(void 0,D),U=T.evaluate.apply(void 0,D);if(F!==void 0&&U!==void 0)return P(F,U,w,l.colorSpace)}}:P(E,T,w,l.colorSpace)}function Rd(l,o,c){switch(o.type){case"color":c=Hn.parse(c);break;case"formatted":c=qr.fromString(c.toString());break;case"resolvedImage":c=Nr.fromString(c.toString());break;case"padding":c=No.parse(c);break;default:Fn(c)===o.type||o.type==="enum"&&o.values[c]||(c=void 0)}return Il(c,l.default,o.default)}ss.register(cu,{error:[{kind:"error"},[cn],(l,[o])=>{throw new Mi(o.evaluate(l))}],typeof:[cn,[en],(l,[o])=>ot(vi(o.evaluate(l)))],"to-rgba":[q(le,4),[Ar],(l,[o])=>{const[c,f,m,v]=o.evaluate(l).rgb;return[255*c,255*f,255*m,v]}],rgb:[Ar,[le,le,le],Ad],rgba:[Ar,[le,le,le,le],Ad],has:{type:Ke,overloads:[[[cn],(l,[o])=>kd(o.evaluate(l),l.properties())],[[cn,ns],(l,[o,c])=>kd(o.evaluate(l),c.evaluate(l))]]},get:{type:en,overloads:[[[cn],(l,[o])=>Mp(o.evaluate(l),l.properties())],[[cn,ns],(l,[o,c])=>Mp(o.evaluate(l),c.evaluate(l))]]},"feature-state":[en,[cn],(l,[o])=>Mp(o.evaluate(l),l.featureState||{})],properties:[ns,[],l=>l.properties()],"geometry-type":[cn,[],l=>l.geometryType()],id:[en,[],l=>l.id()],zoom:[le,[],l=>l.globals.zoom],"heatmap-density":[le,[],l=>l.globals.heatmapDensity||0],"line-progress":[le,[],l=>l.globals.lineProgress||0],accumulated:[en,[],l=>l.globals.accumulated===void 0?null:l.globals.accumulated],"+":[le,El(le),(l,o)=>{let c=0;for(const f of o)c+=f.evaluate(l);return c}],"*":[le,El(le),(l,o)=>{let c=1;for(const f of o)c*=f.evaluate(l);return c}],"-":{type:le,overloads:[[[le,le],(l,[o,c])=>o.evaluate(l)-c.evaluate(l)],[[le],(l,[o])=>-o.evaluate(l)]]},"/":[le,[le,le],(l,[o,c])=>o.evaluate(l)/c.evaluate(l)],"%":[le,[le,le],(l,[o,c])=>o.evaluate(l)%c.evaluate(l)],ln2:[le,[],()=>Math.LN2],pi:[le,[],()=>Math.PI],e:[le,[],()=>Math.E],"^":[le,[le,le],(l,[o,c])=>Math.pow(o.evaluate(l),c.evaluate(l))],sqrt:[le,[le],(l,[o])=>Math.sqrt(o.evaluate(l))],log10:[le,[le],(l,[o])=>Math.log(o.evaluate(l))/Math.LN10],ln:[le,[le],(l,[o])=>Math.log(o.evaluate(l))],log2:[le,[le],(l,[o])=>Math.log(o.evaluate(l))/Math.LN2],sin:[le,[le],(l,[o])=>Math.sin(o.evaluate(l))],cos:[le,[le],(l,[o])=>Math.cos(o.evaluate(l))],tan:[le,[le],(l,[o])=>Math.tan(o.evaluate(l))],asin:[le,[le],(l,[o])=>Math.asin(o.evaluate(l))],acos:[le,[le],(l,[o])=>Math.acos(o.evaluate(l))],atan:[le,[le],(l,[o])=>Math.atan(o.evaluate(l))],min:[le,El(le),(l,o)=>Math.min(...o.map(c=>c.evaluate(l)))],max:[le,El(le),(l,o)=>Math.max(...o.map(c=>c.evaluate(l)))],abs:[le,[le],(l,[o])=>Math.abs(o.evaluate(l))],round:[le,[le],(l,[o])=>{const c=o.evaluate(l);return c<0?-Math.round(-c):Math.round(c)}],floor:[le,[le],(l,[o])=>Math.floor(o.evaluate(l))],ceil:[le,[le],(l,[o])=>Math.ceil(o.evaluate(l))],"filter-==":[Ke,[cn,en],(l,[o,c])=>l.properties()[o.value]===c.value],"filter-id-==":[Ke,[en],(l,[o])=>l.id()===o.value],"filter-type-==":[Ke,[cn],(l,[o])=>l.geometryType()===o.value],"filter-<":[Ke,[cn,en],(l,[o,c])=>{const f=l.properties()[o.value],m=c.value;return typeof f==typeof m&&f{const c=l.id(),f=o.value;return typeof c==typeof f&&c":[Ke,[cn,en],(l,[o,c])=>{const f=l.properties()[o.value],m=c.value;return typeof f==typeof m&&f>m}],"filter-id->":[Ke,[en],(l,[o])=>{const c=l.id(),f=o.value;return typeof c==typeof f&&c>f}],"filter-<=":[Ke,[cn,en],(l,[o,c])=>{const f=l.properties()[o.value],m=c.value;return typeof f==typeof m&&f<=m}],"filter-id-<=":[Ke,[en],(l,[o])=>{const c=l.id(),f=o.value;return typeof c==typeof f&&c<=f}],"filter->=":[Ke,[cn,en],(l,[o,c])=>{const f=l.properties()[o.value],m=c.value;return typeof f==typeof m&&f>=m}],"filter-id->=":[Ke,[en],(l,[o])=>{const c=l.id(),f=o.value;return typeof c==typeof f&&c>=f}],"filter-has":[Ke,[en],(l,[o])=>o.value in l.properties()],"filter-has-id":[Ke,[],l=>l.id()!==null&&l.id()!==void 0],"filter-type-in":[Ke,[q(cn)],(l,[o])=>o.value.indexOf(l.geometryType())>=0],"filter-id-in":[Ke,[q(en)],(l,[o])=>o.value.indexOf(l.id())>=0],"filter-in-small":[Ke,[cn,q(en)],(l,[o,c])=>c.value.indexOf(l.properties()[o.value])>=0],"filter-in-large":[Ke,[cn,q(en)],(l,[o,c])=>function(f,m,v,w){for(;v<=w;){const E=v+w>>1;if(m[E]===f)return!0;m[E]>f?w=E-1:v=E+1}return!1}(l.properties()[o.value],c.value,0,c.value.length-1)],all:{type:Ke,overloads:[[[Ke,Ke],(l,[o,c])=>o.evaluate(l)&&c.evaluate(l)],[El(Ke),(l,o)=>{for(const c of o)if(!c.evaluate(l))return!1;return!0}]]},any:{type:Ke,overloads:[[[Ke,Ke],(l,[o,c])=>o.evaluate(l)||c.evaluate(l)],[El(Ke),(l,o)=>{for(const c of o)if(c.evaluate(l))return!0;return!1}]]},"!":[Ke,[Ke],(l,[o])=>!o.evaluate(l)],"is-supported-script":[Ke,[cn],(l,[o])=>{const c=l.globals&&l.globals.isSupportedScript;return!c||c(o.evaluate(l))}],upcase:[cn,[cn],(l,[o])=>o.evaluate(l).toUpperCase()],downcase:[cn,[cn],(l,[o])=>o.evaluate(l).toLowerCase()],concat:[cn,El(en),(l,o)=>o.map(c=>zn(c.evaluate(l))).join("")],"resolved-locale":[cn,[ws],(l,[o])=>o.evaluate(l).resolvedLocale()]});class Ap{constructor(o,c){var f;this.expression=o,this._warningHistory={},this._evaluator=new mp,this._defaultValue=c?(f=c).type==="color"&&bi(f.default)?new Hn(0,0,0,0):f.type==="color"?Hn.parse(f.default)||null:f.type==="padding"?No.parse(f.default)||null:f.type==="variableAnchorOffsetCollection"?rs.parse(f.default)||null:f.default===void 0?null:f.default:null,this._enumValues=c&&c.type==="enum"?c.values:null}evaluateWithoutErrorHandling(o,c,f,m,v,w){return this._evaluator.globals=o,this._evaluator.feature=c,this._evaluator.featureState=f,this._evaluator.canonical=m,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=w,this.expression.evaluate(this._evaluator)}evaluate(o,c,f,m,v,w){this._evaluator.globals=o,this._evaluator.feature=c||null,this._evaluator.featureState=f||null,this._evaluator.canonical=m,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=w||null;try{const E=this.expression.evaluate(this._evaluator);if(E==null||typeof E=="number"&&E!=E)return this._defaultValue;if(this._enumValues&&!(E in this._enumValues))throw new Mi(`Expected value to be one of ${Object.keys(this._enumValues).map(T=>JSON.stringify(T)).join(", ")}, but found ${JSON.stringify(E)} instead.`);return E}catch(E){return this._warningHistory[E.message]||(this._warningHistory[E.message]=!0,typeof console<"u"&&console.warn(E.message)),this._defaultValue}}}function th(l){return Array.isArray(l)&&l.length>0&&typeof l[0]=="string"&&l[0]in cu}function eh(l,o){const c=new Uc(cu,Zc,[],o?function(m){const v={color:Ar,string:cn,number:le,enum:cn,boolean:Ke,formatted:st,padding:B,resolvedImage:j,variableAnchorOffsetCollection:J};return m.type==="array"?q(v[m.value]||en,m.length):v[m.type]}(o):void 0),f=c.parse(l,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return f?Nd(new Ap(f,o)):Qa(c.errors)}class kp{constructor(o,c){this.kind=o,this._styleExpression=c,this.isStateDependent=o!=="constant"&&!Ku(c.expression)}evaluateWithoutErrorHandling(o,c,f,m,v,w){return this._styleExpression.evaluateWithoutErrorHandling(o,c,f,m,v,w)}evaluate(o,c,f,m,v,w){return this._styleExpression.evaluate(o,c,f,m,v,w)}}class nh{constructor(o,c,f,m){this.kind=o,this.zoomStops=f,this._styleExpression=c,this.isStateDependent=o!=="camera"&&!Ku(c.expression),this.interpolationType=m}evaluateWithoutErrorHandling(o,c,f,m,v,w){return this._styleExpression.evaluateWithoutErrorHandling(o,c,f,m,v,w)}evaluate(o,c,f,m,v,w){return this._styleExpression.evaluate(o,c,f,m,v,w)}interpolationFactor(o,c,f){return this.interpolationType?Ro.interpolationFactor(this.interpolationType,o,c,f):0}}function Np(l,o){const c=eh(l,o);if(c.result==="error")return c;const f=c.value.expression,m=Wc(f);if(!m&&!hu(o))return Qa([new ii("","data expressions not supported")]);const v=Xc(f,["zoom"]);if(!v&&!Dd(o))return Qa([new ii("","zoom expressions not supported")]);const w=$u(f);return w||v?w instanceof ii?Qa([w]):w instanceof Ro&&!Pp(o)?Qa([new ii("",'"interpolate" expressions cannot be used with this property')]):Nd(w?new nh(m?"camera":"composite",c.value,w.labels,w instanceof Ro?w.interpolation:void 0):new kp(m?"constant":"source",c.value)):Qa([new ii("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Qu{constructor(o,c){this._parameters=o,this._specification=c,yo(this,Cn(this._parameters,this._specification))}static deserialize(o){return new Qu(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function $u(l){let o=null;if(l instanceof Kc)o=$u(l.result);else if(l instanceof Yc){for(const c of l.args)if(o=$u(c),o)break}else(l instanceof Ja||l instanceof Ro)&&l.input instanceof ss&&l.input.name==="zoom"&&(o=l);return o instanceof ii||l.eachChild(c=>{const f=$u(c);f instanceof ii?o=f:!o&&f?o=new ii("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&f&&o!==f&&(o=new ii("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function tc(l){if(l===!0||l===!1)return!0;if(!Array.isArray(l)||l.length===0)return!1;switch(l[0]){case"has":return l.length>=2&&l[1]!=="$id"&&l[1]!=="$type";case"in":return l.length>=3&&(typeof l[1]!="string"||Array.isArray(l[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return l.length!==3||Array.isArray(l[1])||Array.isArray(l[2]);case"any":case"all":for(const o of l.slice(1))if(!tc(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const Zg={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Dp(l){if(l==null)return{filter:()=>!0,needGeometry:!1};tc(l)||(l=ih(l));const o=eh(l,Zg);if(o.result==="error")throw new Error(o.value.map(c=>`${c.key}: ${c.message}`).join(", "));return{filter:(c,f,m)=>o.value.evaluate(c,f,{},m),needGeometry:Od(l)}}function Wg(l,o){return lo?1:0}function Od(l){if(!Array.isArray(l))return!1;if(l[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?Rp(l[1],l[2],o):o==="any"?(c=l.slice(1),["any"].concat(c.map(ih))):o==="all"?["all"].concat(l.slice(1).map(ih)):o==="none"?["all"].concat(l.slice(1).map(ih).map(ec)):o==="in"?zd(l[1],l.slice(2)):o==="!in"?ec(zd(l[1],l.slice(2))):o==="has"?Fd(l[1]):o==="!has"?ec(Fd(l[1])):o!=="within"||l;var c}function Rp(l,o,c){switch(l){case"$type":return[`filter-type-${c}`,o];case"$id":return[`filter-id-${c}`,o];default:return[`filter-${c}`,l,o]}}function zd(l,o){if(o.length===0)return!1;switch(l){case"$type":return["filter-type-in",["literal",o]];case"$id":return["filter-id-in",["literal",o]];default:return o.length>200&&!o.some(c=>typeof c!=typeof o[0])?["filter-in-large",l,["literal",o.sort(Wg)]]:["filter-in-small",l,["literal",o]]}}function Fd(l){switch(l){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",l]}}function ec(l){return["!",l]}function rh(l){const o=typeof l;if(o==="number"||o==="boolean"||o==="string"||l==null)return JSON.stringify(l);if(Array.isArray(l)){let m="[";for(const v of l)m+=`${rh(v)},`;return`${m}]`}const c=Object.keys(l).sort();let f="{";for(let m=0;mf.maximum?[new se(o,c,`${c} is greater than the maximum value ${f.maximum}`)]:[]}function sh(l){const o=l.valueSpec,c=Pi(l.value.type);let f,m,v,w={};const E=c!=="categorical"&&l.value.property===void 0,T=!E,P=Fn(l.value.stops)==="array"&&Fn(l.value.stops[0])==="array"&&Fn(l.value.stops[0][0])==="object",D=vo({key:l.key,value:l.value,valueSpec:l.styleSpec.function,validateSpec:l.validateSpec,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(X){if(c==="identity")return[new se(X.key,X.value,'identity function may not have a "stops" property')];let Y=[];const tt=X.value;return Y=Y.concat(pu({key:X.key,value:tt,valueSpec:X.valueSpec,validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec,arrayElementValidator:F})),Fn(tt)==="array"&&tt.length===0&&Y.push(new se(X.key,tt,"array must have at least one stop")),Y},default:function(X){return X.validateSpec({key:X.key,value:X.value,valueSpec:o,validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec})}}});return c==="identity"&&E&&D.push(new se(l.key,l.value,'missing required property "property"')),c==="identity"||l.value.stops||D.push(new se(l.key,l.value,'missing required property "stops"')),c==="exponential"&&l.valueSpec.expression&&!Pp(l.valueSpec)&&D.push(new se(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(T&&!hu(l.valueSpec)?D.push(new se(l.key,l.value,"property functions not supported")):E&&!Dd(l.valueSpec)&&D.push(new se(l.key,l.value,"zoom functions not supported"))),c!=="categorical"&&!P||l.value.property!==void 0||D.push(new se(l.key,l.value,'"property" property is required')),D;function F(X){let Y=[];const tt=X.value,lt=X.key;if(Fn(tt)!=="array")return[new se(lt,tt,`array expected, ${Fn(tt)} found`)];if(tt.length!==2)return[new se(lt,tt,`array length 2 expected, length ${tt.length} found`)];if(P){if(Fn(tt[0])!=="object")return[new se(lt,tt,`object expected, ${Fn(tt[0])} found`)];if(tt[0].zoom===void 0)return[new se(lt,tt,"object stop key must have zoom")];if(tt[0].value===void 0)return[new se(lt,tt,"object stop key must have value")];if(v&&v>Pi(tt[0].zoom))return[new se(lt,tt[0].zoom,"stop zoom values must appear in ascending order")];Pi(tt[0].zoom)!==v&&(v=Pi(tt[0].zoom),m=void 0,w={}),Y=Y.concat(vo({key:`${lt}[0]`,value:tt[0],valueSpec:{zoom:{}},validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec,objectElementValidators:{zoom:nc,value:U}}))}else Y=Y.concat(U({key:`${lt}[0]`,value:tt[0],valueSpec:{},validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec},tt));return th(Cl(tt[1]))?Y.concat([new se(`${lt}[1]`,tt[1],"expressions are not allowed in function stops.")]):Y.concat(X.validateSpec({key:`${lt}[1]`,value:tt[1],valueSpec:o,validateSpec:X.validateSpec,style:X.style,styleSpec:X.styleSpec}))}function U(X,Y){const tt=Fn(X.value),lt=Pi(X.value),pt=X.value!==null?X.value:Y;if(f){if(tt!==f)return[new se(X.key,pt,`${tt} stop domain type must match previous stop domain type ${f}`)]}else f=tt;if(tt!=="number"&&tt!=="string"&&tt!=="boolean")return[new se(X.key,pt,"stop domain value must be a number, string, or boolean")];if(tt!=="number"&&c!=="categorical"){let Tt=`number expected, ${tt} found`;return hu(o)&&c===void 0&&(Tt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new se(X.key,pt,Tt)]}return c!=="categorical"||tt!=="number"||isFinite(lt)&&Math.floor(lt)===lt?c!=="categorical"&&tt==="number"&&m!==void 0&<new se(`${l.key}${f.key}`,l.value,f.message));const c=o.value.expression||o.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!c.outputDefined())return[new se(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!Ku(c))return[new se(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter"&&!Ku(c))return[new se(l.key,l.value,'"feature-state" data expressions are not supported with filters.')];if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!Xc(c,["zoom","feature-state"]))return[new se(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!Wc(c))return[new se(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ic(l){const o=l.key,c=l.value,f=l.valueSpec,m=[];return Array.isArray(f.values)?f.values.indexOf(Pi(c))===-1&&m.push(new se(o,c,`expected one of [${f.values.join(", ")}], ${JSON.stringify(c)} found`)):Object.keys(f.values).indexOf(Pi(c))===-1&&m.push(new se(o,c,`expected one of [${Object.keys(f.values).join(", ")}], ${JSON.stringify(c)} found`)),m}function fu(l){return tc(Cl(l.value))?Tl(yo({},l,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Vd(l)}function Vd(l){const o=l.value,c=l.key;if(Fn(o)!=="array")return[new se(c,o,`array expected, ${Fn(o)} found`)];const f=l.styleSpec;let m,v=[];if(o.length<1)return[new se(c,o,"filter array must have at least 1 element")];switch(v=v.concat(ic({key:`${c}[0]`,value:o[0],valueSpec:f.filter_operator,style:l.style,styleSpec:l.styleSpec})),Pi(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&Pi(o[1])==="$type"&&v.push(new se(c,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&v.push(new se(c,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(m=Fn(o[1]),m!=="string"&&v.push(new se(`${c}[1]`,o[1],`string expected, ${m} found`)));for(let w=2;w{P in c&&o.push(new se(f,c[P],`"${P}" is prohibited for ref layers`))}),m.layers.forEach(P=>{Pi(P.id)===E&&(T=P)}),T?T.ref?o.push(new se(f,c.ref,"ref cannot reference another ref layer")):w=Pi(T.type):o.push(new se(f,c.ref,`ref layer "${E}" not found`))}else if(w!=="background")if(c.source){const T=m.sources&&m.sources[c.source],P=T&&Pi(T.type);T?P==="vector"&&w==="raster"?o.push(new se(f,c.source,`layer "${c.id}" requires a raster source`)):P!=="raster-dem"&&w==="hillshade"?o.push(new se(f,c.source,`layer "${c.id}" requires a raster-dem source`)):P==="raster"&&w!=="raster"?o.push(new se(f,c.source,`layer "${c.id}" requires a vector source`)):P!=="vector"||c["source-layer"]?P==="raster-dem"&&w!=="hillshade"?o.push(new se(f,c.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!c.paint||!c.paint["line-gradient"]||P==="geojson"&&T.lineMetrics||o.push(new se(f,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new se(f,c,`layer "${c.id}" must specify a "source-layer"`)):o.push(new se(f,c.source,`source "${c.source}" not found`))}else o.push(new se(f,c,'missing required property "source"'));return o=o.concat(vo({key:f,value:c,valueSpec:v.layer,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*":()=>[],type:()=>l.validateSpec({key:`${f}.type`,value:c.type,valueSpec:v.layer.type,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,object:c,objectKey:"type"}),filter:fu,layout:T=>vo({layer:c,key:T.key,value:T.value,style:T.style,styleSpec:T.styleSpec,validateSpec:T.validateSpec,objectElementValidators:{"*":P=>jd(yo({layerType:w},P))}}),paint:T=>vo({layer:c,key:T.key,value:T.value,style:T.style,styleSpec:T.styleSpec,validateSpec:T.validateSpec,objectElementValidators:{"*":P=>Gd(yo({layerType:w},P))}})}})),o}function qs(l){const o=l.value,c=l.key,f=Fn(o);return f!=="string"?[new se(c,o,`string expected, ${f} found`)]:[]}const rc={promoteId:function({key:l,value:o}){if(Fn(o)==="string")return qs({key:l,value:o});{const c=[];for(const f in o)c.push(...qs({key:`${l}.${f}`,value:o[f]}));return c}}};function Oo(l){const o=l.value,c=l.key,f=l.styleSpec,m=l.style,v=l.validateSpec;if(!o.type)return[new se(c,o,'"type" is required')];const w=Pi(o.type);let E;switch(w){case"vector":case"raster":return E=vo({key:c,value:o,valueSpec:f[`source_${w.replace("-","_")}`],style:l.style,styleSpec:f,objectElementValidators:rc,validateSpec:v}),E;case"raster-dem":return E=function(T){var P;const D=(P=T.sourceName)!==null&&P!==void 0?P:"",F=T.value,U=T.styleSpec,X=U.source_raster_dem,Y=T.style;let tt=[];const lt=Fn(F);if(F===void 0)return tt;if(lt!=="object")return tt.push(new se("source_raster_dem",F,`object expected, ${lt} found`)),tt;const pt=Pi(F.encoding)==="custom",Tt=["redFactor","greenFactor","blueFactor","baseShift"],_t=T.value.encoding?`"${T.value.encoding}"`:"Default";for(const Lt in F)!pt&&Tt.includes(Lt)?tt.push(new se(Lt,F[Lt],`In "${D}": "${Lt}" is only valid when "encoding" is set to "custom". ${_t} encoding found`)):X[Lt]?tt=tt.concat(T.validateSpec({key:Lt,value:F[Lt],valueSpec:X[Lt],validateSpec:T.validateSpec,style:Y,styleSpec:U})):tt.push(new se(Lt,F[Lt],`unknown property "${Lt}"`));return tt}({sourceName:c,value:o,style:l.style,styleSpec:f,validateSpec:v}),E;case"geojson":if(E=vo({key:c,value:o,valueSpec:f.source_geojson,style:m,styleSpec:f,validateSpec:v,objectElementValidators:rc}),o.cluster)for(const T in o.clusterProperties){const[P,D]=o.clusterProperties[T],F=typeof P=="string"?[P,["accumulated"],["get",T]]:P;E.push(...Tl({key:`${c}.${T}.map`,value:D,validateSpec:v,expressionContext:"cluster-map"})),E.push(...Tl({key:`${c}.${T}.reduce`,value:F,validateSpec:v,expressionContext:"cluster-reduce"}))}return E;case"video":return vo({key:c,value:o,valueSpec:f.source_video,style:m,validateSpec:v,styleSpec:f});case"image":return vo({key:c,value:o,valueSpec:f.source_image,style:m,validateSpec:v,styleSpec:f});case"canvas":return[new se(c,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ic({key:`${c}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:m,validateSpec:v,styleSpec:f})}}function oc(l){const o=l.value,c=l.styleSpec,f=c.light,m=l.style;let v=[];const w=Fn(o);if(o===void 0)return v;if(w!=="object")return v=v.concat([new se("light",o,`object expected, ${w} found`)]),v;for(const E in o){const T=E.match(/^(.*)-transition$/);v=v.concat(T&&f[T[1]]&&f[T[1]].transition?l.validateSpec({key:E,value:o[E],valueSpec:c.transition,validateSpec:l.validateSpec,style:m,styleSpec:c}):f[E]?l.validateSpec({key:E,value:o[E],valueSpec:f[E],validateSpec:l.validateSpec,style:m,styleSpec:c}):[new se(E,o[E],`unknown property "${E}"`)])}return v}function Zd(l){const o=l.value,c=l.styleSpec,f=c.terrain,m=l.style;let v=[];const w=Fn(o);if(o===void 0)return v;if(w!=="object")return v=v.concat([new se("terrain",o,`object expected, ${w} found`)]),v;for(const E in o)v=v.concat(f[E]?l.validateSpec({key:E,value:o[E],valueSpec:f[E],validateSpec:l.validateSpec,style:m,styleSpec:c}):[new se(E,o[E],`unknown property "${E}"`)]);return v}function Wd(l){let o=[];const c=l.value,f=l.key;if(Array.isArray(c)){const m=[],v=[];for(const w in c)c[w].id&&m.includes(c[w].id)&&o.push(new se(f,c,`all the sprites' ids must be unique, but ${c[w].id} is duplicated`)),m.push(c[w].id),c[w].url&&v.includes(c[w].url)&&o.push(new se(f,c,`all the sprites' URLs must be unique, but ${c[w].url} is duplicated`)),v.push(c[w].url),o=o.concat(vo({key:`${f}[${w}]`,value:c[w],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:l.validateSpec}));return o}return qs({key:f,value:c})}const Xd={"*":()=>[],array:pu,boolean:function(l){const o=l.value,c=l.key,f=Fn(o);return f!=="boolean"?[new se(c,o,`boolean expected, ${f} found`)]:[]},number:nc,color:function(l){const o=l.key,c=l.value,f=Fn(c);return f!=="string"?[new se(o,c,`color expected, ${f} found`)]:Hn.parse(String(c))?[]:[new se(o,c,`color expected, "${c}" found`)]},constants:Bd,enum:ic,filter:fu,function:sh,layer:qd,object:vo,source:Oo,light:oc,terrain:Zd,string:qs,formatted:function(l){return qs(l).length===0?[]:Tl(l)},resolvedImage:function(l){return qs(l).length===0?[]:Tl(l)},padding:function(l){const o=l.key,c=l.value;if(Fn(c)==="array"){if(c.length<1||c.length>4)return[new se(o,c,`padding requires 1 to 4 values; ${c.length} values found`)];const f={type:"number"};let m=[];for(let v=0;v[]}})),l.constants&&(c=c.concat(Bd({key:"constants",value:l.constants,style:l,styleSpec:o,validateSpec:Ea}))),ah(c)}function Ia(l){return function(o){return l({...o,validateSpec:Ea})}}function ah(l){return[].concat(l).sort((o,c)=>o.line-c.line)}function Ca(l){return function(...o){return ah(l.apply(this,o))}}as.source=Ca(Ia(Oo)),as.sprite=Ca(Ia(Wd)),as.glyphs=Ca(Ia(Hd)),as.light=Ca(Ia(oc)),as.terrain=Ca(Ia(Zd)),as.layer=Ca(Ia(qd)),as.filter=Ca(Ia(fu)),as.paintProperty=Ca(Ia(Gd)),as.layoutProperty=Ca(Ia(jd));const Ta=as,Xg=Ta.light,Op=Ta.paintProperty,Yd=Ta.layoutProperty;function lh(l,o){let c=!1;if(o&&o.length)for(const f of o)l.fire(new dn(new Error(f.message))),c=!0;return c}class du{constructor(o,c,f){const m=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const w=new Int32Array(this.arrayBuffer);o=w[0],this.d=(c=w[1])+2*(f=w[2]);for(let T=0;T=F[Y+0]&&m>=F[Y+1])?(E[X]=!0,w.push(D[X])):E[X]=!1}}}}_forEachCell(o,c,f,m,v,w,E,T){const P=this._convertToCellCoord(o),D=this._convertToCellCoord(c),F=this._convertToCellCoord(f),U=this._convertToCellCoord(m);for(let X=P;X<=F;X++)for(let Y=D;Y<=U;Y++){const tt=this.d*Y+X;if((!T||T(this._convertFromCellCoord(X),this._convertFromCellCoord(Y),this._convertFromCellCoord(X+1),this._convertFromCellCoord(Y+1)))&&v.call(this,o,c,f,m,tt,w,E,T))return}}_convertFromCellCoord(o){return(o-this.padding)/this.scale}_convertToCellCoord(o){return Math.max(0,Math.min(this.d-1,Math.floor(o*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const o=this.cells,c=3+this.cells.length+1+1;let f=0;for(let w=0;w=0)continue;const w=l[v];m[v]=La[f].shallow.indexOf(v)>=0?w:$a(w,o)}l instanceof Error&&(m.message=l.message)}if(m.$name)throw new Error("$name property is reserved for worker serialization logic.");return f!=="Object"&&(m.$name=f),m}throw new Error("can't serialize object of type "+typeof l)}function mu(l){if(l==null||typeof l=="boolean"||typeof l=="number"||typeof l=="string"||l instanceof Boolean||l instanceof Number||l instanceof String||l instanceof Date||l instanceof RegExp||l instanceof Blob||uh(l)||an(l)||ArrayBuffer.isView(l)||l instanceof ImageData)return l;if(Array.isArray(l))return l.map(mu);if(typeof l=="object"){const o=l.$name||"Object";if(!La[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:c}=La[o];if(!c)throw new Error(`can't deserialize unregistered class ${o}`);if(c.deserialize)return c.deserialize(l);const f=Object.create(c.prototype);for(const m of Object.keys(l)){if(m==="$name")continue;const v=l[m];f[m]=La[o].shallow.indexOf(m)>=0?v:mu(v)}return f}throw new Error("can't deserialize object of type "+typeof l)}class Kd{constructor(){this.first=!0}update(o,c){const f=Math.floor(o);return this.first?(this.first=!1,this.lastIntegerZoom=f,this.lastIntegerZoomTime=0,this.lastZoom=o,this.lastFloorZoom=f,!0):(this.lastFloorZoom>f?(this.lastIntegerZoom=f+1,this.lastIntegerZoomTime=c):this.lastFloorZooml>=128&&l<=255,Arabic:l=>l>=1536&&l<=1791,"Arabic Supplement":l=>l>=1872&&l<=1919,"Arabic Extended-A":l=>l>=2208&&l<=2303,"Hangul Jamo":l=>l>=4352&&l<=4607,"Unified Canadian Aboriginal Syllabics":l=>l>=5120&&l<=5759,Khmer:l=>l>=6016&&l<=6143,"Unified Canadian Aboriginal Syllabics Extended":l=>l>=6320&&l<=6399,"General Punctuation":l=>l>=8192&&l<=8303,"Letterlike Symbols":l=>l>=8448&&l<=8527,"Number Forms":l=>l>=8528&&l<=8591,"Miscellaneous Technical":l=>l>=8960&&l<=9215,"Control Pictures":l=>l>=9216&&l<=9279,"Optical Character Recognition":l=>l>=9280&&l<=9311,"Enclosed Alphanumerics":l=>l>=9312&&l<=9471,"Geometric Shapes":l=>l>=9632&&l<=9727,"Miscellaneous Symbols":l=>l>=9728&&l<=9983,"Miscellaneous Symbols and Arrows":l=>l>=11008&&l<=11263,"CJK Radicals Supplement":l=>l>=11904&&l<=12031,"Kangxi Radicals":l=>l>=12032&&l<=12255,"Ideographic Description Characters":l=>l>=12272&&l<=12287,"CJK Symbols and Punctuation":l=>l>=12288&&l<=12351,Hiragana:l=>l>=12352&&l<=12447,Katakana:l=>l>=12448&&l<=12543,Bopomofo:l=>l>=12544&&l<=12591,"Hangul Compatibility Jamo":l=>l>=12592&&l<=12687,Kanbun:l=>l>=12688&&l<=12703,"Bopomofo Extended":l=>l>=12704&&l<=12735,"CJK Strokes":l=>l>=12736&&l<=12783,"Katakana Phonetic Extensions":l=>l>=12784&&l<=12799,"Enclosed CJK Letters and Months":l=>l>=12800&&l<=13055,"CJK Compatibility":l=>l>=13056&&l<=13311,"CJK Unified Ideographs Extension A":l=>l>=13312&&l<=19903,"Yijing Hexagram Symbols":l=>l>=19904&&l<=19967,"CJK Unified Ideographs":l=>l>=19968&&l<=40959,"Yi Syllables":l=>l>=40960&&l<=42127,"Yi Radicals":l=>l>=42128&&l<=42191,"Hangul Jamo Extended-A":l=>l>=43360&&l<=43391,"Hangul Syllables":l=>l>=44032&&l<=55215,"Hangul Jamo Extended-B":l=>l>=55216&&l<=55295,"Private Use Area":l=>l>=57344&&l<=63743,"CJK Compatibility Ideographs":l=>l>=63744&&l<=64255,"Arabic Presentation Forms-A":l=>l>=64336&&l<=65023,"Vertical Forms":l=>l>=65040&&l<=65055,"CJK Compatibility Forms":l=>l>=65072&&l<=65103,"Small Form Variants":l=>l>=65104&&l<=65135,"Arabic Presentation Forms-B":l=>l>=65136&&l<=65279,"Halfwidth and Fullwidth Forms":l=>l>=65280&&l<=65519};function zp(l){for(const o of l)if(Bp(o.charCodeAt(0)))return!0;return!1}function Fp(l){for(const o of l)if(!Hg(o.charCodeAt(0)))return!1;return!0}function Hg(l){return!(_e.Arabic(l)||_e["Arabic Supplement"](l)||_e["Arabic Extended-A"](l)||_e["Arabic Presentation Forms-A"](l)||_e["Arabic Presentation Forms-B"](l))}function Bp(l){return!(l!==746&&l!==747&&(l<4352||!(_e["Bopomofo Extended"](l)||_e.Bopomofo(l)||_e["CJK Compatibility Forms"](l)&&!(l>=65097&&l<=65103)||_e["CJK Compatibility Ideographs"](l)||_e["CJK Compatibility"](l)||_e["CJK Radicals Supplement"](l)||_e["CJK Strokes"](l)||!(!_e["CJK Symbols and Punctuation"](l)||l>=12296&&l<=12305||l>=12308&&l<=12319||l===12336)||_e["CJK Unified Ideographs Extension A"](l)||_e["CJK Unified Ideographs"](l)||_e["Enclosed CJK Letters and Months"](l)||_e["Hangul Compatibility Jamo"](l)||_e["Hangul Jamo Extended-A"](l)||_e["Hangul Jamo Extended-B"](l)||_e["Hangul Jamo"](l)||_e["Hangul Syllables"](l)||_e.Hiragana(l)||_e["Ideographic Description Characters"](l)||_e.Kanbun(l)||_e["Kangxi Radicals"](l)||_e["Katakana Phonetic Extensions"](l)||_e.Katakana(l)&&l!==12540||!(!_e["Halfwidth and Fullwidth Forms"](l)||l===65288||l===65289||l===65293||l>=65306&&l<=65310||l===65339||l===65341||l===65343||l>=65371&&l<=65503||l===65507||l>=65512&&l<=65519)||!(!_e["Small Form Variants"](l)||l>=65112&&l<=65118||l>=65123&&l<=65126)||_e["Unified Canadian Aboriginal Syllabics"](l)||_e["Unified Canadian Aboriginal Syllabics Extended"](l)||_e["Vertical Forms"](l)||_e["Yijing Hexagram Symbols"](l)||_e["Yi Syllables"](l)||_e["Yi Radicals"](l))))}function Jd(l){return!(Bp(l)||function(o){return!!(_e["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||_e["General Punctuation"](o)&&(o===8214||o===8224||o===8225||o===8240||o===8241||o===8251||o===8252||o===8258||o===8263||o===8264||o===8265||o===8273)||_e["Letterlike Symbols"](o)||_e["Number Forms"](o)||_e["Miscellaneous Technical"](o)&&(o>=8960&&o<=8967||o>=8972&&o<=8991||o>=8996&&o<=9e3||o===9003||o>=9085&&o<=9114||o>=9150&&o<=9165||o===9167||o>=9169&&o<=9179||o>=9186&&o<=9215)||_e["Control Pictures"](o)&&o!==9251||_e["Optical Character Recognition"](o)||_e["Enclosed Alphanumerics"](o)||_e["Geometric Shapes"](o)||_e["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||_e["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||_e["CJK Symbols and Punctuation"](o)||_e.Katakana(o)||_e["Private Use Area"](o)||_e["CJK Compatibility Forms"](o)||_e["Small Form Variants"](o)||_e["Halfwidth and Fullwidth Forms"](o)||o===8734||o===8756||o===8757||o>=9984&&o<=10087||o>=10102&&o<=10131||o===65532||o===65533)}(l))}function Qd(l){return l>=1424&&l<=2303||_e["Arabic Presentation Forms-A"](l)||_e["Arabic Presentation Forms-B"](l)}function $d(l,o){return!(!o&&Qd(l)||l>=2304&&l<=3583||l>=3840&&l<=4255||_e.Khmer(l))}function Yg(l){for(const o of l)if(Qd(o.charCodeAt(0)))return!0;return!1}const Vp="deferred",Up="loading",Gp="loaded";let jp=null,bo="unavailable",tl=null;const sc=function(l){l&&typeof l=="string"&&l.indexOf("NetworkError")>-1&&(bo="error"),jp&&jp(l)};function qp(){ac.fire(new Xn("pluginStateChange",{pluginStatus:bo,pluginURL:tl}))}const ac=new qi,Zp=function(){return bo},tm=function(){if(bo!==Vp||!tl)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");bo=Up,qp(),tl&&Ct({url:tl},l=>{l?sc(l):(bo=Gp,qp())})},zo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>bo===Gp||zo.applyArabicShaping!=null,isLoading:()=>bo===Up,setState(l){if(!be())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");bo=l.pluginStatus,tl=l.pluginURL},isParsed(){if(!be())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return zo.applyArabicShaping!=null&&zo.processBidirectionalText!=null&&zo.processStyledBidirectionalText!=null},getPluginURL(){if(!be())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return tl}};class ui{constructor(o,c){this.zoom=o,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 Kd,this.transition={})}isSupportedScript(o){return function(c,f){for(const m of c)if(!$d(m.charCodeAt(0),f))return!1;return!0}(o,zo.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const o=this.zoom,c=o-Math.floor(o),f=this.crossFadingFactor();return o>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:c+(1-c)*f}:{fromScale:.5,toScale:1,t:1-(1-f)*c}}}class ch{constructor(o,c){this.property=o,this.value=c,this.expression=function(f,m){if(bi(f))return new Qu(f,m);if(th(f)){const v=Np(f,m);if(v.result==="error")throw new Error(v.value.map(w=>`${w.key}: ${w.message}`).join(", "));return v.value}{let v=f;return m.type==="color"&&typeof f=="string"?v=Hn.parse(f):m.type!=="padding"||typeof f!="number"&&!Array.isArray(f)?m.type==="variableAnchorOffsetCollection"&&Array.isArray(f)&&(v=rs.parse(f)):v=No.parse(f),{kind:"constant",evaluate:()=>v}}}(c===void 0?o.specification.default:c,o.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(o,c,f){return this.property.possiblyEvaluate(this,o,c,f)}}class Wp{constructor(o){this.property=o,this.value=new ch(o,void 0)}transitioned(o,c){return new nm(this.property,this.value,c,dt({},o.transition,this.transition),o.now)}untransitioned(){return new nm(this.property,this.value,null,{},0)}}class em{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return yt(this._values[o].value.value)}setValue(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Wp(this._values[o].property)),this._values[o].value=new ch(this._values[o].property,c===null?void 0:yt(c))}getTransition(o){return yt(this._values[o].transition)}setTransition(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Wp(this._values[o].property)),this._values[o].transition=yt(c)||void 0}serialize(){const o={};for(const c of Object.keys(this._values)){const f=this.getValue(c);f!==void 0&&(o[c]=f);const m=this.getTransition(c);m!==void 0&&(o[`${c}-transition`]=m)}return o}transitioned(o,c){const f=new im(this._properties);for(const m of Object.keys(this._values))f._values[m]=this._values[m].transitioned(o,c._values[m]);return f}untransitioned(){const o=new im(this._properties);for(const c of Object.keys(this._values))o._values[c]=this._values[c].untransitioned();return o}}class nm{constructor(o,c,f,m,v){this.property=o,this.value=c,this.begin=v+m.delay||0,this.end=this.begin+m.duration||0,o.specification.transition&&(m.delay||m.duration)&&(this.prior=f)}possiblyEvaluate(o,c,f){const m=o.now||0,v=this.value.possiblyEvaluate(o,c,f),w=this.prior;if(w){if(m>this.end)return this.prior=null,v;if(this.value.isDataDriven())return this.prior=null,v;if(m=1)return 1;const P=T*T,D=P*T;return 4*(T<.5?D:3*(T-P)+D-.75)}(E))}}return v}}class im{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,c,f){const m=new hh(this._properties);for(const v of Object.keys(this._values))m._values[v]=this._values[v].possiblyEvaluate(o,c,f);return m}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class Kg{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return yt(this._values[o].value)}setValue(o,c){this._values[o]=new ch(this._values[o].property,c===null?void 0:yt(c))}serialize(){const o={};for(const c of Object.keys(this._values)){const f=this.getValue(c);f!==void 0&&(o[c]=f)}return o}possiblyEvaluate(o,c,f){const m=new hh(this._properties);for(const v of Object.keys(this._values))m._values[v]=this._values[v].possiblyEvaluate(o,c,f);return m}}class oo{constructor(o,c,f){this.property=o,this.value=c,this.parameters=f}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,c,f,m){return this.property.evaluate(this.value,this.parameters,o,c,f,m)}}class hh{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class De{constructor(o){this.specification=o}possiblyEvaluate(o,c){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(c)}interpolate(o,c,f){const m=Do[this.specification.type];return m?m(o,c,f):o}}class Ve{constructor(o,c){this.specification=o,this.overrides=c}possiblyEvaluate(o,c,f,m){return new oo(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(c,null,{},f,m)}:o.expression,c)}interpolate(o,c,f){if(o.value.kind!=="constant"||c.value.kind!=="constant")return o;if(o.value.value===void 0||c.value.value===void 0)return new oo(this,{kind:"constant",value:void 0},o.parameters);const m=Do[this.specification.type];if(m){const v=m(o.value.value,c.value.value,f);return new oo(this,{kind:"constant",value:v},o.parameters)}return o}evaluate(o,c,f,m,v,w){return o.kind==="constant"?o.value:o.evaluate(c,f,m,v,w)}}class lc extends Ve{possiblyEvaluate(o,c,f,m){if(o.value===void 0)return new oo(this,{kind:"constant",value:void 0},c);if(o.expression.kind==="constant"){const v=o.expression.evaluate(c,null,{},f,m),w=o.property.specification.type==="resolvedImage"&&typeof v!="string"?v.name:v,E=this._calculate(w,w,w,c);return new oo(this,{kind:"constant",value:E},c)}if(o.expression.kind==="camera"){const v=this._calculate(o.expression.evaluate({zoom:c.zoom-1}),o.expression.evaluate({zoom:c.zoom}),o.expression.evaluate({zoom:c.zoom+1}),c);return new oo(this,{kind:"constant",value:v},c)}return new oo(this,o.expression,c)}evaluate(o,c,f,m,v,w){if(o.kind==="source"){const E=o.evaluate(c,f,m,v,w);return this._calculate(E,E,E,c)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(c.zoom)-1},f,m),o.evaluate({zoom:Math.floor(c.zoom)},f,m),o.evaluate({zoom:Math.floor(c.zoom)+1},f,m),c):o.value}_calculate(o,c,f,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:f,to:c}}interpolate(o){return o}}class Xp{constructor(o){this.specification=o}possiblyEvaluate(o,c,f,m){if(o.value!==void 0){if(o.expression.kind==="constant"){const v=o.expression.evaluate(c,null,{},f,m);return this._calculate(v,v,v,c)}return this._calculate(o.expression.evaluate(new ui(Math.floor(c.zoom-1),c)),o.expression.evaluate(new ui(Math.floor(c.zoom),c)),o.expression.evaluate(new ui(Math.floor(c.zoom+1),c)),c)}}_calculate(o,c,f,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:f,to:c}}interpolate(o){return o}}class Hp{constructor(o){this.specification=o}possiblyEvaluate(o,c,f,m){return!!o.expression.evaluate(c,null,{},f,m)}interpolate(){return!1}}class Zi{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const c in o){const f=o[c];f.specification.overridable&&this.overridableProperties.push(c);const m=this.defaultPropertyValues[c]=new ch(f,void 0),v=this.defaultTransitionablePropertyValues[c]=new Wp(f);this.defaultTransitioningPropertyValues[c]=v.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=m.possiblyEvaluate({})}}}we("DataDrivenProperty",Ve),we("DataConstantProperty",De),we("CrossFadedDataDrivenProperty",lc),we("CrossFadedProperty",Xp),we("ColorRampProperty",Hp);const Yp="-transition";class ls extends qi{constructor(o,c){if(super(),this.id=o.id,this.type=o.type,this._featureFilter={filter:()=>!0,needGeometry:!1},o.type!=="custom"&&(this.metadata=o.metadata,this.minzoom=o.minzoom,this.maxzoom=o.maxzoom,o.type!=="background"&&(this.source=o.source,this.sourceLayer=o["source-layer"],this.filter=o.filter),c.layout&&(this._unevaluatedLayout=new Kg(c.layout)),c.paint)){this._transitionablePaint=new em(c.paint);for(const f in o.paint)this.setPaintProperty(f,o.paint[f],{validate:!1});for(const f in o.layout)this.setLayoutProperty(f,o.layout[f],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new hh(c.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)}setLayoutProperty(o,c,f={}){c!=null&&this._validate(Yd,`layers.${this.id}.layout.${o}`,o,c,f)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,c):this.visibility=c)}getPaintProperty(o){return o.endsWith(Yp)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,c,f={}){if(c!=null&&this._validate(Op,`layers.${this.id}.paint.${o}`,o,c,f))return!1;if(o.endsWith(Yp))return this._transitionablePaint.setTransition(o.slice(0,-11),c||void 0),!1;{const m=this._transitionablePaint._values[o],v=m.property.specification["property-type"]==="cross-faded-data-driven",w=m.value.isDataDriven(),E=m.value;this._transitionablePaint.setValue(o,c),this._handleSpecialPaintPropertyUpdate(o);const T=this._transitionablePaint._values[o].value;return T.isDataDriven()||w||v||this._handleOverridablePaintPropertyUpdate(o,E,T)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,c,f){return!1}isHidden(o){return!!(this.minzoom&&o=this.maxzoom)||this.visibility==="none"}updateTransitions(o){this._transitioningPaint=this._transitionablePaint.transitioned(o,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(o,c){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,c)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,c)}serialize(){const o={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&&(o.layout=o.layout||{},o.layout.visibility=this.visibility),xt(o,(c,f)=>!(c===void 0||f==="layout"&&!Object.keys(c).length||f==="paint"&&!Object.keys(c).length))}_validate(o,c,f,m,v={}){return(!v||v.validate!==!1)&&lh(this,o.call(Ta,{key:c,layerType:this.type,objectKey:f,value:m,styleSpec:jt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const o in this.paint._values){const c=this.paint.get(o);if(c instanceof oo&&hu(c.property.specification)&&(c.value.kind==="source"||c.value.kind==="composite")&&c.value.isStateDependent)return!0}return!1}}const rm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ll{constructor(o,c){this._structArray=o,this._pos1=c*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Ai{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(o,c){return o._trim(),c&&(o.isTransferred=!0,c.push(o.arrayBuffer)),{length:o.length,arrayBuffer:o.arrayBuffer}}static deserialize(o){const c=Object.create(this.prototype);return c.arrayBuffer=o.arrayBuffer,c.length=o.length,c.capacity=o.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(o){this.reserve(o),this.length=o}reserve(o){if(o>this.capacity){this.capacity=Math.max(o,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 wi(l,o=1){let c=0,f=0;return{members:l.map(m=>{const v=rm[m.type].BYTES_PER_ELEMENT,w=c=gu(c,Math.max(o,v)),E=m.components||1;return f=Math.max(f,v),c+=v*E,{name:m.name,type:m.type,components:E,offset:w}}),size:gu(c,Math.max(f,o)),alignment:o}}function gu(l,o){return Math.ceil(l/o)*o}class uc extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c){const f=this.length;return this.resize(f+1),this.emplace(f,o,c)}emplace(o,c,f){const m=2*o;return this.int16[m+0]=c,this.int16[m+1]=f,o}}uc.prototype.bytesPerElement=4,we("StructArrayLayout2i4",uc);class cc extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,f){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,f)}emplace(o,c,f,m){const v=3*o;return this.int16[v+0]=c,this.int16[v+1]=f,this.int16[v+2]=m,o}}cc.prototype.bytesPerElement=6,we("StructArrayLayout3i6",cc);class Ml extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,f,m){const v=this.length;return this.resize(v+1),this.emplace(v,o,c,f,m)}emplace(o,c,f,m,v){const w=4*o;return this.int16[w+0]=c,this.int16[w+1]=f,this.int16[w+2]=m,this.int16[w+3]=v,o}}Ml.prototype.bytesPerElement=8,we("StructArrayLayout4i8",Ml);class Kp extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,f,m,v,w){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,f,m,v,w)}emplace(o,c,f,m,v,w,E){const T=6*o;return this.int16[T+0]=c,this.int16[T+1]=f,this.int16[T+2]=m,this.int16[T+3]=v,this.int16[T+4]=w,this.int16[T+5]=E,o}}Kp.prototype.bytesPerElement=12,we("StructArrayLayout2i4i12",Kp);class Jp extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,f,m,v,w){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,f,m,v,w)}emplace(o,c,f,m,v,w,E){const T=4*o,P=8*o;return this.int16[T+0]=c,this.int16[T+1]=f,this.uint8[P+4]=m,this.uint8[P+5]=v,this.uint8[P+6]=w,this.uint8[P+7]=E,o}}Jp.prototype.bytesPerElement=8,we("StructArrayLayout2i4ub8",Jp);class _u extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c){const f=this.length;return this.resize(f+1),this.emplace(f,o,c)}emplace(o,c,f){const m=2*o;return this.float32[m+0]=c,this.float32[m+1]=f,o}}_u.prototype.bytesPerElement=8,we("StructArrayLayout2f8",_u);class Qp extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,f,m,v,w,E,T,P,D){const F=this.length;return this.resize(F+1),this.emplace(F,o,c,f,m,v,w,E,T,P,D)}emplace(o,c,f,m,v,w,E,T,P,D,F){const U=10*o;return this.uint16[U+0]=c,this.uint16[U+1]=f,this.uint16[U+2]=m,this.uint16[U+3]=v,this.uint16[U+4]=w,this.uint16[U+5]=E,this.uint16[U+6]=T,this.uint16[U+7]=P,this.uint16[U+8]=D,this.uint16[U+9]=F,o}}Qp.prototype.bytesPerElement=20,we("StructArrayLayout10ui20",Qp);class $p extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,f,m,v,w,E,T,P,D,F,U){const X=this.length;return this.resize(X+1),this.emplace(X,o,c,f,m,v,w,E,T,P,D,F,U)}emplace(o,c,f,m,v,w,E,T,P,D,F,U,X){const Y=12*o;return this.int16[Y+0]=c,this.int16[Y+1]=f,this.int16[Y+2]=m,this.int16[Y+3]=v,this.uint16[Y+4]=w,this.uint16[Y+5]=E,this.uint16[Y+6]=T,this.uint16[Y+7]=P,this.int16[Y+8]=D,this.int16[Y+9]=F,this.int16[Y+10]=U,this.int16[Y+11]=X,o}}$p.prototype.bytesPerElement=24,we("StructArrayLayout4i4ui4i24",$p);class Bn extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,f){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,f)}emplace(o,c,f,m){const v=3*o;return this.float32[v+0]=c,this.float32[v+1]=f,this.float32[v+2]=m,o}}Bn.prototype.bytesPerElement=12,we("StructArrayLayout3f12",Bn);class y extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.uint32[1*o+0]=c,o}}y.prototype.bytesPerElement=4,we("StructArrayLayout1ul4",y);class s extends Ai{_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(o,c,f,m,v,w,E,T,P){const D=this.length;return this.resize(D+1),this.emplace(D,o,c,f,m,v,w,E,T,P)}emplace(o,c,f,m,v,w,E,T,P,D){const F=10*o,U=5*o;return this.int16[F+0]=c,this.int16[F+1]=f,this.int16[F+2]=m,this.int16[F+3]=v,this.int16[F+4]=w,this.int16[F+5]=E,this.uint32[U+3]=T,this.uint16[F+8]=P,this.uint16[F+9]=D,o}}s.prototype.bytesPerElement=20,we("StructArrayLayout6i1ul2ui20",s);class h extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,f,m,v,w){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,f,m,v,w)}emplace(o,c,f,m,v,w,E){const T=6*o;return this.int16[T+0]=c,this.int16[T+1]=f,this.int16[T+2]=m,this.int16[T+3]=v,this.int16[T+4]=w,this.int16[T+5]=E,o}}h.prototype.bytesPerElement=12,we("StructArrayLayout2i2i2i12",h);class d extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,f,m,v){const w=this.length;return this.resize(w+1),this.emplace(w,o,c,f,m,v)}emplace(o,c,f,m,v,w){const E=4*o,T=8*o;return this.float32[E+0]=c,this.float32[E+1]=f,this.float32[E+2]=m,this.int16[T+6]=v,this.int16[T+7]=w,o}}d.prototype.bytesPerElement=16,we("StructArrayLayout2f1f2i16",d);class g extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,f,m){const v=this.length;return this.resize(v+1),this.emplace(v,o,c,f,m)}emplace(o,c,f,m,v){const w=12*o,E=3*o;return this.uint8[w+0]=c,this.uint8[w+1]=f,this.float32[E+1]=m,this.float32[E+2]=v,o}}g.prototype.bytesPerElement=12,we("StructArrayLayout2ub2f12",g);class b extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,f){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,f)}emplace(o,c,f,m){const v=3*o;return this.uint16[v+0]=c,this.uint16[v+1]=f,this.uint16[v+2]=m,o}}b.prototype.bytesPerElement=6,we("StructArrayLayout3ui6",b);class I extends Ai{_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(o,c,f,m,v,w,E,T,P,D,F,U,X,Y,tt,lt,pt){const Tt=this.length;return this.resize(Tt+1),this.emplace(Tt,o,c,f,m,v,w,E,T,P,D,F,U,X,Y,tt,lt,pt)}emplace(o,c,f,m,v,w,E,T,P,D,F,U,X,Y,tt,lt,pt,Tt){const _t=24*o,Lt=12*o,Ft=48*o;return this.int16[_t+0]=c,this.int16[_t+1]=f,this.uint16[_t+2]=m,this.uint16[_t+3]=v,this.uint32[Lt+2]=w,this.uint32[Lt+3]=E,this.uint32[Lt+4]=T,this.uint16[_t+10]=P,this.uint16[_t+11]=D,this.uint16[_t+12]=F,this.float32[Lt+7]=U,this.float32[Lt+8]=X,this.uint8[Ft+36]=Y,this.uint8[Ft+37]=tt,this.uint8[Ft+38]=lt,this.uint32[Lt+10]=pt,this.int16[_t+22]=Tt,o}}I.prototype.bytesPerElement=48,we("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",I);class C extends Ai{_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(o,c,f,m,v,w,E,T,P,D,F,U,X,Y,tt,lt,pt,Tt,_t,Lt,Ft,Yt,ye,Te,ge,pe,ae,Se){const ue=this.length;return this.resize(ue+1),this.emplace(ue,o,c,f,m,v,w,E,T,P,D,F,U,X,Y,tt,lt,pt,Tt,_t,Lt,Ft,Yt,ye,Te,ge,pe,ae,Se)}emplace(o,c,f,m,v,w,E,T,P,D,F,U,X,Y,tt,lt,pt,Tt,_t,Lt,Ft,Yt,ye,Te,ge,pe,ae,Se,ue){const ie=32*o,ze=16*o;return this.int16[ie+0]=c,this.int16[ie+1]=f,this.int16[ie+2]=m,this.int16[ie+3]=v,this.int16[ie+4]=w,this.int16[ie+5]=E,this.int16[ie+6]=T,this.int16[ie+7]=P,this.uint16[ie+8]=D,this.uint16[ie+9]=F,this.uint16[ie+10]=U,this.uint16[ie+11]=X,this.uint16[ie+12]=Y,this.uint16[ie+13]=tt,this.uint16[ie+14]=lt,this.uint16[ie+15]=pt,this.uint16[ie+16]=Tt,this.uint16[ie+17]=_t,this.uint16[ie+18]=Lt,this.uint16[ie+19]=Ft,this.uint16[ie+20]=Yt,this.uint16[ie+21]=ye,this.uint16[ie+22]=Te,this.uint32[ze+12]=ge,this.float32[ze+13]=pe,this.float32[ze+14]=ae,this.uint16[ie+30]=Se,this.uint16[ie+31]=ue,o}}C.prototype.bytesPerElement=64,we("StructArrayLayout8i15ui1ul2f2ui64",C);class M extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.float32[1*o+0]=c,o}}M.prototype.bytesPerElement=4,we("StructArrayLayout1f4",M);class k extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,f){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,f)}emplace(o,c,f,m){const v=3*o;return this.uint16[6*o+0]=c,this.float32[v+1]=f,this.float32[v+2]=m,o}}k.prototype.bytesPerElement=12,we("StructArrayLayout1ui2f12",k);class R extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,f){const m=this.length;return this.resize(m+1),this.emplace(m,o,c,f)}emplace(o,c,f,m){const v=4*o;return this.uint32[2*o+0]=c,this.uint16[v+2]=f,this.uint16[v+3]=m,o}}R.prototype.bytesPerElement=8,we("StructArrayLayout1ul2ui8",R);class z extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c){const f=this.length;return this.resize(f+1),this.emplace(f,o,c)}emplace(o,c,f){const m=2*o;return this.uint16[m+0]=c,this.uint16[m+1]=f,o}}z.prototype.bytesPerElement=4,we("StructArrayLayout2ui4",z);class W extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.uint16[1*o+0]=c,o}}W.prototype.bytesPerElement=2,we("StructArrayLayout1ui2",W);class nt extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,f,m){const v=this.length;return this.resize(v+1),this.emplace(v,o,c,f,m)}emplace(o,c,f,m,v){const w=4*o;return this.float32[w+0]=c,this.float32[w+1]=f,this.float32[w+2]=m,this.float32[w+3]=v,o}}nt.prototype.bytesPerElement=16,we("StructArrayLayout4f16",nt);class et extends Ll{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 A(this.anchorPointX,this.anchorPointY)}}et.prototype.size=20;class at extends s{get(o){return new et(this,o)}}we("CollisionBoxArray",at);class $ extends Ll{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(o){this._structArray.uint8[this._pos1+37]=o}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(o){this._structArray.uint8[this._pos1+38]=o}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(o){this._structArray.uint32[this._pos4+10]=o}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}$.prototype.size=48;class St extends I{get(o){return new $(this,o)}}we("PlacedSymbolArray",St);class Ot extends Ll{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(o){this._structArray.uint32[this._pos4+12]=o}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]}}Ot.prototype.size=64;class ct extends C{get(o){return new Ot(this,o)}}we("SymbolInstanceArray",ct);class It extends M{getoffsetX(o){return this.float32[1*o+0]}}we("GlyphOffsetArray",It);class Bt extends cc{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}we("SymbolLineVertexArray",Bt);class Vt extends Ll{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]}}Vt.prototype.size=12;class Xt extends k{get(o){return new Vt(this,o)}}we("TextAnchorOffsetArray",Xt);class ne extends Ll{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]}}ne.prototype.size=8;class Qt extends R{get(o){return new ne(this,o)}}we("FeatureIndexArray",Qt);class oe extends uc{}class Ce extends uc{}class bn extends uc{}class he extends Kp{}class Ue extends Jp{}class Pe extends _u{}class Yn extends Qp{}class vn extends $p{}class hn extends Bn{}class xn extends y{}class zi extends h{}class oi extends g{}class Dr extends b{}class ar extends z{}const Wi=wi([{name:"a_pos",components:2,type:"Int16"}],4),{members:Fo}=Wi;class ci{constructor(o=[]){this.segments=o}prepareSegment(o,c,f,m){let v=this.segments[this.segments.length-1];return o>ci.MAX_VERTEX_ARRAY_LENGTH&&Rt(`Max vertices per segment is ${ci.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!v||v.vertexLength+o>ci.MAX_VERTEX_ARRAY_LENGTH||v.sortKey!==m)&&(v={vertexOffset:c.length,primitiveOffset:f.length,vertexLength:0,primitiveLength:0},m!==void 0&&(v.sortKey=m),this.segments.push(v)),v}get(){return this.segments}destroy(){for(const o of this.segments)for(const c in o.vaos)o.vaos[c].destroy()}static simpleSegment(o,c,f,m){return new ci([{vertexOffset:o,primitiveOffset:c,vertexLength:f,primitiveLength:m,vaos:{},sortKey:0}])}}function Zs(l,o){return 256*(l=ht(Math.floor(l),0,255))+ht(Math.floor(o),0,255)}ci.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,we("SegmentVector",ci);const Ws=wi([{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 el={exports:{}},Pl={exports:{}};Pl.exports=function(l,o){var c,f,m,v,w,E,T,P;for(f=l.length-(c=3&l.length),m=o,w=3432918353,E=461845907,P=0;P>>16)*w&65535)<<16)&4294967295)<<15|T>>>17))*E+(((T>>>16)*E&65535)<<16)&4294967295)<<13|m>>>19))+((5*(m>>>16)&65535)<<16)&4294967295))+((58964+(v>>>16)&65535)<<16);switch(T=0,c){case 3:T^=(255&l.charCodeAt(P+2))<<16;case 2:T^=(255&l.charCodeAt(P+1))<<8;case 1:m^=T=(65535&(T=(T=(65535&(T^=255&l.charCodeAt(P)))*w+(((T>>>16)*w&65535)<<16)&4294967295)<<15|T>>>17))*E+(((T>>>16)*E&65535)<<16)&4294967295}return m^=l.length,m=2246822507*(65535&(m^=m>>>16))+((2246822507*(m>>>16)&65535)<<16)&4294967295,m=3266489909*(65535&(m^=m>>>13))+((3266489909*(m>>>16)&65535)<<16)&4294967295,(m^=m>>>16)>>>0};var yu=Pl.exports,Zr={exports:{}};Zr.exports=function(l,o){for(var c,f=l.length,m=o^f,v=0;f>=4;)c=1540483477*(65535&(c=255&l.charCodeAt(v)|(255&l.charCodeAt(++v))<<8|(255&l.charCodeAt(++v))<<16|(255&l.charCodeAt(++v))<<24))+((1540483477*(c>>>16)&65535)<<16),m=1540483477*(65535&m)+((1540483477*(m>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),f-=4,++v;switch(f){case 3:m^=(255&l.charCodeAt(v+2))<<16;case 2:m^=(255&l.charCodeAt(v+1))<<8;case 1:m=1540483477*(65535&(m^=255&l.charCodeAt(v)))+((1540483477*(m>>>16)&65535)<<16)}return m=1540483477*(65535&(m^=m>>>13))+((1540483477*(m>>>16)&65535)<<16),(m^=m>>>15)>>>0};var Rr=yu,so=Zr.exports;el.exports=Rr,el.exports.murmur3=Rr,el.exports.murmur2=so;var Al=x(el.exports);class Fi{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,c,f,m){this.ids.push(lr(o)),this.positions.push(c,f,m)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const c=lr(o);let f=0,m=this.ids.length-1;for(;f>1;this.ids[w]>=c?m=w:f=w+1}const v=[];for(;this.ids[f]===c;)v.push({index:this.positions[3*f],start:this.positions[3*f+1],end:this.positions[3*f+2]}),f++;return v}static serialize(o,c){const f=new Float64Array(o.ids),m=new Uint32Array(o.positions);return xo(f,m,0,f.length-1),c&&c.push(f.buffer,m.buffer),{ids:f,positions:m}}static deserialize(o){const c=new Fi;return c.ids=o.ids,c.positions=o.positions,c.indexed=!0,c}}function lr(l){const o=+l;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Al(String(l))}function xo(l,o,c,f){for(;c>1];let v=c-1,w=f+1;for(;;){do v++;while(l[v]m);if(v>=w)break;Bi(l,v,w),Bi(o,3*v,3*w),Bi(o,3*v+1,3*w+1),Bi(o,3*v+2,3*w+2)}w-c`u_${m}`),this.type=f}setUniform(o,c,f){o.set(f.constantOr(this.value))}getBinding(o,c,f){return this.type==="color"?new sm(o,c):new ph(o,c)}}class Nl{constructor(o,c){this.uniformNames=c.map(f=>`u_${f}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,c){this.pixelRatioFrom=c.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=c.tlbr,this.patternTo=o.tlbr}setUniform(o,c,f,m){const v=m==="u_pattern_to"?this.patternTo:m==="u_pattern_from"?this.patternFrom:m==="u_pixel_ratio_to"?this.pixelRatioTo:m==="u_pixel_ratio_from"?this.pixelRatioFrom:null;v&&o.set(v)}getBinding(o,c,f){return f.substr(0,9)==="u_pattern"?new om(o,c):new ph(o,c)}}class Hs{constructor(o,c,f,m){this.expression=o,this.type=f,this.maxValue=0,this.paintVertexAttributes=c.map(v=>({name:`a_${v}`,type:"Float32",components:f==="color"?2:1,offset:0})),this.paintVertexArray=new m}populatePaintArray(o,c,f,m,v){const w=this.paintVertexArray.length,E=this.expression.evaluate(new ui(0),c,{},m,[],v);this.paintVertexArray.resize(o),this._setPaintValue(w,o,E)}updatePaintArray(o,c,f,m){const v=this.expression.evaluate({zoom:0},f,m);this._setPaintValue(o,c,v)}_setPaintValue(o,c,f){if(this.type==="color"){const m=tf(f);for(let v=o;v`u_${E}_t`),this.type=f,this.useIntegerZoom=m,this.zoom=v,this.maxValue=0,this.paintVertexAttributes=c.map(E=>({name:`a_${E}`,type:"Float32",components:f==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(o,c,f,m,v){const w=this.expression.evaluate(new ui(this.zoom),c,{},m,[],v),E=this.expression.evaluate(new ui(this.zoom+1),c,{},m,[],v),T=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(T,o,w,E)}updatePaintArray(o,c,f,m){const v=this.expression.evaluate({zoom:this.zoom},f,m),w=this.expression.evaluate({zoom:this.zoom+1},f,m);this._setPaintValue(o,c,v,w)}_setPaintValue(o,c,f,m){if(this.type==="color"){const v=tf(f),w=tf(m);for(let E=o;E`#define HAS_UNIFORM_${m}`))}return o}getBinderAttributes(){const o=[];for(const c in this.binders){const f=this.binders[c];if(f instanceof Hs||f instanceof us)for(let m=0;m!0){this.programConfigurations={};for(const m of o)this.programConfigurations[m.id]=new ef(m,c,f);this.needsUpload=!1,this._featureMap=new Fi,this._bufferOffset=0}populatePaintArrays(o,c,f,m,v,w){for(const E in this.programConfigurations)this.programConfigurations[E].populatePaintArrays(o,c,m,v,w);c.id!==void 0&&this._featureMap.add(c.id,f,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,c,f,m){for(const v of f)this.needsUpload=this.programConfigurations[v.id].updatePaintArrays(o,this._featureMap,c,v,m)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(const c in this.programConfigurations)this.programConfigurations[c].upload(o);this.needsUpload=!1}}destroy(){for(const o in this.programConfigurations)this.programConfigurations[o].destroy()}}function Mw(l,o){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"]}[l]||[l.replace(`${o}-`,"").replace(/-/g,"_")]}function n0(l,o,c){const f={color:{source:_u,composite:nt},number:{source:M,composite:_u}},m=function(v){return{"line-pattern":{source:Yn,composite:Yn},"fill-pattern":{source:Yn,composite:Yn},"fill-extrusion-pattern":{source:Yn,composite:Yn}}[v]}(l);return m&&m[c]||f[o][c]}we("ConstantBinder",Xs),we("CrossFadedConstantBinder",Nl),we("SourceExpressionBinder",Hs),we("CrossFadedCompositeBinder",Ys),we("CompositeExpressionBinder",us),we("ProgramConfiguration",ef,{omit:["_buffers"]}),we("ProgramConfigurationSet",Ma);const ir=8192,Qg=Math.pow(2,14)-1,i0=-Qg-1;function hc(l){const o=ir/l.extent,c=l.loadGeometry();for(let f=0;fw.x+1||Tw.y+1)&&Rt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return c}function pc(l,o){return{type:l.type,id:l.id,properties:l.properties,geometry:o?hc(l):[]}}function am(l,o,c,f,m){l.emplaceBack(2*o+(f+1)/2,2*c+(m+1)/2)}class $g{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new Ce,this.indexArray=new Dr,this.segments=new ci,this.programConfigurations=new Ma(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,f){const m=this.layers[0],v=[];let w=null,E=!1;m.type==="circle"&&(w=m.layout.get("circle-sort-key"),E=!w.isConstant());for(const{feature:T,id:P,index:D,sourceLayerIndex:F}of o){const U=this.layers[0]._featureFilter.needGeometry,X=pc(T,U);if(!this.layers[0]._featureFilter.filter(new ui(this.zoom),X,f))continue;const Y=E?w.evaluate(X,{},f):void 0,tt={id:P,properties:T.properties,type:T.type,sourceLayerIndex:F,index:D,geometry:U?X.geometry:hc(T),patterns:{},sortKey:Y};v.push(tt)}E&&v.sort((T,P)=>T.sortKey-P.sortKey);for(const T of v){const{geometry:P,index:D,sourceLayerIndex:F}=T,U=o[D].feature;this.addFeature(T,P,D,f),c.featureIndex.insert(U,P,D,F,this.index)}}update(o,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,Fo),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(o,c,f,m){for(const v of c)for(const w of v){const E=w.x,T=w.y;if(E<0||E>=ir||T<0||T>=ir)continue;const P=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),D=P.vertexLength;am(this.layoutVertexArray,E,T,-1,-1),am(this.layoutVertexArray,E,T,1,-1),am(this.layoutVertexArray,E,T,1,1),am(this.layoutVertexArray,E,T,-1,1),this.indexArray.emplaceBack(D,D+1,D+2),this.indexArray.emplaceBack(D,D+3,D+2),P.vertexLength+=4,P.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,f,{},m)}}function r0(l,o){for(let c=0;c1){if(t_(l,o))return!0;for(let f=0;f1?c:c.sub(o)._mult(m)._add(o))}function a0(l,o){let c,f,m,v=!1;for(let w=0;wo.y!=m.y>o.y&&o.x<(m.x-f.x)*(o.y-f.y)/(m.y-f.y)+f.x&&(v=!v)}return v}function fh(l,o){let c=!1;for(let f=0,m=l.length-1;fo.y!=w.y>o.y&&o.x<(w.x-v.x)*(o.y-v.y)/(w.y-v.y)+v.x&&(c=!c)}return c}function Nw(l,o,c){const f=c[0],m=c[2];if(l.xm.x&&o.x>m.x||l.ym.y&&o.y>m.y)return!1;const v=Gt(l,o,c[0]);return v!==Gt(l,o,c[1])||v!==Gt(l,o,c[2])||v!==Gt(l,o,c[3])}function nf(l,o,c){const f=o.paint.get(l).value;return f.kind==="constant"?f.value:c.programConfigurations.get(o.id).getMaxValue(l)}function lm(l){return Math.sqrt(l[0]*l[0]+l[1]*l[1])}function um(l,o,c,f,m){if(!o[0]&&!o[1])return l;const v=A.convert(o)._mult(m);c==="viewport"&&v._rotate(-f);const w=[];for(let E=0;Eh0(lt,tt))}(P,T),X=F?D*E:D;for(const Y of m)for(const tt of Y){const lt=F?tt:h0(tt,T);let pt=X;const Tt=cm([],[tt.x,tt.y,0,1],T);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?pt*=Tt[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(pt*=w.cameraToCenterDistance/Tt[3]),Pw(U,lt,pt))return!0}return!1}}function h0(l,o){const c=cm([],[l.x,l.y,0,1],o);return new A(c[0]/c[3],c[1]/c[3])}class p0 extends $g{}let f0;we("HeatmapBucket",p0,{omit:["layers"]});var zw={get paint(){return f0=f0||new Zi({"heatmap-radius":new Ve(jt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ve(jt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new De(jt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Hp(jt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new De(jt.paint_heatmap["heatmap-opacity"])})}};function i_(l,{width:o,height:c},f,m){if(m){if(m instanceof Uint8ClampedArray)m=new Uint8Array(m.buffer);else if(m.length!==o*c*f)throw new RangeError(`mismatched image size. expected: ${m.length} but got: ${o*c*f}`)}else m=new Uint8Array(o*c*f);return l.width=o,l.height=c,l.data=m,l}function d0(l,{width:o,height:c},f){if(o===l.width&&c===l.height)return;const m=i_({},{width:o,height:c},f);r_(l,m,{x:0,y:0},{x:0,y:0},{width:Math.min(l.width,o),height:Math.min(l.height,c)},f),l.width=o,l.height=c,l.data=m.data}function r_(l,o,c,f,m,v){if(m.width===0||m.height===0)return o;if(m.width>l.width||m.height>l.height||c.x>l.width-m.width||c.y>l.height-m.height)throw new RangeError("out of range source coordinates for image copy");if(m.width>o.width||m.height>o.height||f.x>o.width-m.width||f.y>o.height-m.height)throw new RangeError("out of range destination coordinates for image copy");const w=l.data,E=o.data;if(w===E)throw new Error("srcData equals dstData, so image is already copied");for(let T=0;T{o[l.evaluationKey]=T;const P=l.expression.evaluate(o);m.data[w+E+0]=Math.floor(255*P.r/P.a),m.data[w+E+1]=Math.floor(255*P.g/P.a),m.data[w+E+2]=Math.floor(255*P.b/P.a),m.data[w+E+3]=Math.floor(255*P.a)};if(l.clips)for(let w=0,E=0;w80*c){f=v=l[0],m=w=l[1];for(var Y=c;Yv&&(v=E),T>w&&(w=T);P=(P=Math.max(v-f,w-m))!==0?32767/P:0}return sf(U,X,c,f,m,P,0),X}function _0(l,o,c,f,m){var v,w;if(m===l_(l,o,c,f)>0)for(v=o;v=o;v-=f)w=b0(v,l[v],l[v+1],w);return w&&pm(w,w.next)&&(lf(w),w=w.next),w}function fc(l,o){if(!l)return l;o||(o=l);var c,f=l;do if(c=!1,f.steiner||!pm(f,f.next)&&Xi(f.prev,f,f.next)!==0)f=f.next;else{if(lf(f),(f=o=f.prev)===f.next)break;c=!0}while(c||f!==o);return o}function sf(l,o,c,f,m,v,w){if(l){!w&&v&&function(D,F,U,X){var Y=D;do Y.z===0&&(Y.z=s_(Y.x,Y.y,F,U,X)),Y.prevZ=Y.prev,Y.nextZ=Y.next,Y=Y.next;while(Y!==D);Y.prevZ.nextZ=null,Y.prevZ=null,function(tt){var lt,pt,Tt,_t,Lt,Ft,Yt,ye,Te=1;do{for(pt=tt,tt=null,Lt=null,Ft=0;pt;){for(Ft++,Tt=pt,Yt=0,lt=0;lt0||ye>0&&Tt;)Yt!==0&&(ye===0||!Tt||pt.z<=Tt.z)?(_t=pt,pt=pt.nextZ,Yt--):(_t=Tt,Tt=Tt.nextZ,ye--),Lt?Lt.nextZ=_t:tt=_t,_t.prevZ=Lt,Lt=_t;pt=Tt}Lt.nextZ=null,Te*=2}while(Ft>1)}(Y)}(l,f,m,v);for(var E,T,P=l;l.prev!==l.next;)if(E=l.prev,T=l.next,v?qw(l,f,m,v):jw(l))o.push(E.i/c|0),o.push(l.i/c|0),o.push(T.i/c|0),lf(l),l=T.next,P=T.next;else if((l=T)===P){w?w===1?sf(l=Zw(fc(l),o,c),o,c,f,m,v,2):w===2&&Ww(l,o,c,f,m,v):sf(fc(l),o,c,f,m,v,1);break}}}function jw(l){var o=l.prev,c=l,f=l.next;if(Xi(o,c,f)>=0)return!1;for(var m=o.x,v=c.x,w=f.x,E=o.y,T=c.y,P=f.y,D=mv?m>w?m:w:v>w?v:w,X=E>T?E>P?E:P:T>P?T:P,Y=f.next;Y!==o;){if(Y.x>=D&&Y.x<=U&&Y.y>=F&&Y.y<=X&&mh(m,E,v,T,w,P,Y.x,Y.y)&&Xi(Y.prev,Y,Y.next)>=0)return!1;Y=Y.next}return!0}function qw(l,o,c,f){var m=l.prev,v=l,w=l.next;if(Xi(m,v,w)>=0)return!1;for(var E=m.x,T=v.x,P=w.x,D=m.y,F=v.y,U=w.y,X=ET?E>P?E:P:T>P?T:P,lt=D>F?D>U?D:U:F>U?F:U,pt=s_(X,Y,o,c,f),Tt=s_(tt,lt,o,c,f),_t=l.prevZ,Lt=l.nextZ;_t&&_t.z>=pt&&Lt&&Lt.z<=Tt;){if(_t.x>=X&&_t.x<=tt&&_t.y>=Y&&_t.y<=lt&&_t!==m&&_t!==w&&mh(E,D,T,F,P,U,_t.x,_t.y)&&Xi(_t.prev,_t,_t.next)>=0||(_t=_t.prevZ,Lt.x>=X&&Lt.x<=tt&&Lt.y>=Y&&Lt.y<=lt&&Lt!==m&&Lt!==w&&mh(E,D,T,F,P,U,Lt.x,Lt.y)&&Xi(Lt.prev,Lt,Lt.next)>=0))return!1;Lt=Lt.nextZ}for(;_t&&_t.z>=pt;){if(_t.x>=X&&_t.x<=tt&&_t.y>=Y&&_t.y<=lt&&_t!==m&&_t!==w&&mh(E,D,T,F,P,U,_t.x,_t.y)&&Xi(_t.prev,_t,_t.next)>=0)return!1;_t=_t.prevZ}for(;Lt&&Lt.z<=Tt;){if(Lt.x>=X&&Lt.x<=tt&&Lt.y>=Y&&Lt.y<=lt&&Lt!==m&&Lt!==w&&mh(E,D,T,F,P,U,Lt.x,Lt.y)&&Xi(Lt.prev,Lt,Lt.next)>=0)return!1;Lt=Lt.nextZ}return!0}function Zw(l,o,c){var f=l;do{var m=f.prev,v=f.next.next;!pm(m,v)&&y0(m,f,f.next,v)&&af(m,v)&&af(v,m)&&(o.push(m.i/c|0),o.push(f.i/c|0),o.push(v.i/c|0),lf(f),lf(f.next),f=l=v),f=f.next}while(f!==l);return fc(f)}function Ww(l,o,c,f,m,v){var w=l;do{for(var E=w.next.next;E!==w.prev;){if(w.i!==E.i&&Jw(w,E)){var T=v0(w,E);return w=fc(w,w.next),T=fc(T,T.next),sf(w,o,c,f,m,v,0),void sf(T,o,c,f,m,v,0)}E=E.next}w=w.next}while(w!==l)}function Xw(l,o){return l.x-o.x}function Hw(l,o){var c=function(m,v){var w,E=v,T=m.x,P=m.y,D=-1/0;do{if(P<=E.y&&P>=E.next.y&&E.next.y!==E.y){var F=E.x+(P-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(F<=T&&F>D&&(D=F,w=E.x=E.x&&E.x>=Y&&T!==E.x&&mh(Pw.x||E.x===w.x&&Yw(w,E)))&&(w=E,lt=U)),E=E.next;while(E!==X);return w}(l,o);if(!c)return o;var f=v0(c,l);return fc(f,f.next),fc(c,c.next)}function Yw(l,o){return Xi(l.prev,l,o.prev)<0&&Xi(o.next,l,l.next)<0}function s_(l,o,c,f,m){return(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l=(l-c)*m|0)|l<<8))|l<<4))|l<<2))|l<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-f)*m|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function Kw(l){var o=l,c=l;do(o.x=(l-w)*(v-E)&&(l-w)*(f-E)>=(c-w)*(o-E)&&(c-w)*(v-E)>=(m-w)*(f-E)}function Jw(l,o){return l.next.i!==o.i&&l.prev.i!==o.i&&!function(c,f){var m=c;do{if(m.i!==c.i&&m.next.i!==c.i&&m.i!==f.i&&m.next.i!==f.i&&y0(m,m.next,c,f))return!0;m=m.next}while(m!==c);return!1}(l,o)&&(af(l,o)&&af(o,l)&&function(c,f){var m=c,v=!1,w=(c.x+f.x)/2,E=(c.y+f.y)/2;do m.y>E!=m.next.y>E&&m.next.y!==m.y&&w<(m.next.x-m.x)*(E-m.y)/(m.next.y-m.y)+m.x&&(v=!v),m=m.next;while(m!==c);return v}(l,o)&&(Xi(l.prev,l,o.prev)||Xi(l,o.prev,o))||pm(l,o)&&Xi(l.prev,l,l.next)>0&&Xi(o.prev,o,o.next)>0)}function Xi(l,o,c){return(o.y-l.y)*(c.x-o.x)-(o.x-l.x)*(c.y-o.y)}function pm(l,o){return l.x===o.x&&l.y===o.y}function y0(l,o,c,f){var m=dm(Xi(l,o,c)),v=dm(Xi(l,o,f)),w=dm(Xi(c,f,l)),E=dm(Xi(c,f,o));return m!==v&&w!==E||!(m!==0||!fm(l,c,o))||!(v!==0||!fm(l,f,o))||!(w!==0||!fm(c,l,f))||!(E!==0||!fm(c,o,f))}function fm(l,o,c){return o.x<=Math.max(l.x,c.x)&&o.x>=Math.min(l.x,c.x)&&o.y<=Math.max(l.y,c.y)&&o.y>=Math.min(l.y,c.y)}function dm(l){return l>0?1:l<0?-1:0}function af(l,o){return Xi(l.prev,l,l.next)<0?Xi(l,o,l.next)>=0&&Xi(l,l.prev,o)>=0:Xi(l,o,l.prev)<0||Xi(l,l.next,o)<0}function v0(l,o){var c=new a_(l.i,l.x,l.y),f=new a_(o.i,o.x,o.y),m=l.next,v=o.prev;return l.next=o,o.prev=l,c.next=m,m.prev=c,f.next=c,c.prev=f,v.next=f,f.prev=v,f}function b0(l,o,c,f){var m=new a_(l,o,c);return f?(m.next=f.next,m.prev=f,f.next.prev=m,f.next=m):(m.prev=m,m.next=m),m}function lf(l){l.next.prev=l.prev,l.prev.next=l.next,l.prevZ&&(l.prevZ.nextZ=l.nextZ),l.nextZ&&(l.nextZ.prevZ=l.prevZ)}function a_(l,o,c){this.i=l,this.x=o,this.y=c,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function l_(l,o,c,f){for(var m=0,v=o,w=c-f;v0&&c.holes.push(f+=l[m-1].length)}return c};var x0=x(o_.exports);function Qw(l,o,c,f,m){w0(l,o,c||0,f||l.length-1,m||$w)}function w0(l,o,c,f,m){for(;f>c;){if(f-c>600){var v=f-c+1,w=o-c+1,E=Math.log(v),T=.5*Math.exp(2*E/3),P=.5*Math.sqrt(E*T*(v-T)/v)*(w-v/2<0?-1:1);w0(l,o,Math.max(c,Math.floor(o-w*T/v+P)),Math.min(f,Math.floor(o+(v-w)*T/v+P)),m)}var D=l[o],F=c,U=f;for(uf(l,c,o),m(l[f],D)>0&&uf(l,c,f);F0;)U--}m(l[c],D)===0?uf(l,c,U):uf(l,++U,f),U<=o&&(c=U+1),o<=U&&(f=U-1)}}function uf(l,o,c){var f=l[o];l[o]=l[c],l[c]=f}function $w(l,o){return lo?1:0}function u_(l,o){const c=l.length;if(c<=1)return[l];const f=[];let m,v;for(let w=0;w1)for(let w=0;wc.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new bn,this.indexArray=new Dr,this.indexArray2=new ar,this.programConfigurations=new Ma(o.layers,o.zoom),this.segments=new ci,this.segments2=new ci,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,f){this.hasPattern=c_("fill",this.layers,c);const m=this.layers[0].layout.get("fill-sort-key"),v=!m.isConstant(),w=[];for(const{feature:E,id:T,index:P,sourceLayerIndex:D}of o){const F=this.layers[0]._featureFilter.needGeometry,U=pc(E,F);if(!this.layers[0]._featureFilter.filter(new ui(this.zoom),U,f))continue;const X=v?m.evaluate(U,{},f,c.availableImages):void 0,Y={id:T,properties:E.properties,type:E.type,sourceLayerIndex:D,index:P,geometry:F?U.geometry:hc(E),patterns:{},sortKey:X};w.push(Y)}v&&w.sort((E,T)=>E.sortKey-T.sortKey);for(const E of w){const{geometry:T,index:P,sourceLayerIndex:D}=E;if(this.hasPattern){const F=h_("fill",this.layers,E,this.zoom,c);this.patternFeatures.push(F)}else this.addFeature(E,T,P,f,{});c.featureIndex.insert(o[P].feature,T,P,D,this.index)}}update(o,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,f)}addFeatures(o,c,f){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,c,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,Gw),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.indexBuffer2=o.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(o),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(o,c,f,m,v){for(const w of u_(c,500)){let E=0;for(const X of w)E+=X.length;const T=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray),P=T.vertexLength,D=[],F=[];for(const X of w){if(X.length===0)continue;X!==w[0]&&F.push(D.length/2);const Y=this.segments2.prepareSegment(X.length,this.layoutVertexArray,this.indexArray2),tt=Y.vertexLength;this.layoutVertexArray.emplaceBack(X[0].x,X[0].y),this.indexArray2.emplaceBack(tt+X.length-1,tt),D.push(X[0].x),D.push(X[0].y);for(let lt=1;lt>3}if(m--,f===1||f===2)v+=l.readSVarint(),w+=l.readSVarint(),f===1&&(o&&E.push(o),o=[]),o.push(new s2(v,w));else{if(f!==7)throw new Error("unknown command "+f);o&&o.push(o[0].clone())}}return o&&E.push(o),E},gh.prototype.bbox=function(){var l=this._pbf;l.pos=this._geometry;for(var o=l.readVarint()+l.pos,c=1,f=0,m=0,v=0,w=1/0,E=-1/0,T=1/0,P=-1/0;l.pos>3}if(f--,c===1||c===2)(m+=l.readSVarint())E&&(E=m),(v+=l.readSVarint())P&&(P=v);else if(c!==7)throw new Error("unknown command "+c)}return[w,T,E,P]},gh.prototype.toGeoJSON=function(l,o,c){var f,m,v=this.extent*Math.pow(2,c),w=this.extent*l,E=this.extent*o,T=this.loadGeometry(),P=gh.types[this.type];function D(X){for(var Y=0;Y>3;m=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 m}(c))}T0.prototype.feature=function(l){if(l<0||l>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[l];var o=this._pbf.readVarint()+this._pbf.pos;return new u2(this._pbf,o,this.extent,this._keys,this._values)};var h2=C0;function p2(l,o,c){if(l===3){var f=new h2(c,c.readVarint()+c.pos);f.length&&(o[f.name]=f)}}vu.VectorTile=function(l,o){this.layers=l.readFields(p2,{},o)},vu.VectorTileFeature=I0,vu.VectorTileLayer=C0;const f2=vu.VectorTileFeature.types,f_=Math.pow(2,13);function cf(l,o,c,f,m,v,w,E){l.emplaceBack(o,c,2*Math.floor(f*f_)+w,m*f_*2,v*f_*2,Math.round(E))}class d_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new he,this.centroidVertexArray=new oe,this.indexArray=new Dr,this.programConfigurations=new Ma(o.layers,o.zoom),this.segments=new ci,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,f){this.features=[],this.hasPattern=c_("fill-extrusion",this.layers,c);for(const{feature:m,id:v,index:w,sourceLayerIndex:E}of o){const T=this.layers[0]._featureFilter.needGeometry,P=pc(m,T);if(!this.layers[0]._featureFilter.filter(new ui(this.zoom),P,f))continue;const D={id:v,sourceLayerIndex:E,index:w,geometry:T?P.geometry:hc(m),properties:m.properties,type:m.type,patterns:{}};this.hasPattern?this.features.push(h_("fill-extrusion",this.layers,D,this.zoom,c)):this.addFeature(D,D.geometry,w,f,{}),c.featureIndex.insert(m,D.geometry,w,E,this.index,!0)}}addFeatures(o,c,f){for(const m of this.features){const{geometry:v}=m;this.addFeature(m,v,m.index,c,f)}}update(o,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,f)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,o2),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,r2.members,!0),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(o,c,f,m,v){const w={x:0,y:0,vertexCount:0};for(const E of u_(c,500)){let T=0;for(const Y of E)T+=Y.length;let P=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const Y of E){if(Y.length===0||m2(Y))continue;let tt=0;for(let lt=0;lt=1){const Tt=Y[lt-1];if(!d2(pt,Tt)){P.vertexLength+4>ci.MAX_VERTEX_ARRAY_LENGTH&&(P=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const _t=pt.sub(Tt)._perp()._unit(),Lt=Tt.dist(pt);tt+Lt>32768&&(tt=0),cf(this.layoutVertexArray,pt.x,pt.y,_t.x,_t.y,0,0,tt),cf(this.layoutVertexArray,pt.x,pt.y,_t.x,_t.y,0,1,tt),w.x+=2*pt.x,w.y+=2*pt.y,w.vertexCount+=2,tt+=Lt,cf(this.layoutVertexArray,Tt.x,Tt.y,_t.x,_t.y,0,0,tt),cf(this.layoutVertexArray,Tt.x,Tt.y,_t.x,_t.y,0,1,tt),w.x+=2*Tt.x,w.y+=2*Tt.y,w.vertexCount+=2;const Ft=P.vertexLength;this.indexArray.emplaceBack(Ft,Ft+2,Ft+1),this.indexArray.emplaceBack(Ft+1,Ft+2,Ft+3),P.vertexLength+=4,P.primitiveLength+=2}}}}if(P.vertexLength+T>ci.MAX_VERTEX_ARRAY_LENGTH&&(P=this.segments.prepareSegment(T,this.layoutVertexArray,this.indexArray)),f2[o.type]!=="Polygon")continue;const D=[],F=[],U=P.vertexLength;for(const Y of E)if(Y.length!==0){Y!==E[0]&&F.push(D.length/2);for(let tt=0;ttir)||l.y===o.y&&(l.y<0||l.y>ir)}function m2(l){return l.every(o=>o.x<0)||l.every(o=>o.x>ir)||l.every(o=>o.y<0)||l.every(o=>o.y>ir)}let L0;we("FillExtrusionBucket",d_,{omit:["layers","features"]});var g2={get paint(){return L0=L0||new Zi({"fill-extrusion-opacity":new De(jt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ve(jt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new De(jt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new De(jt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new lc(jt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ve(jt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ve(jt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new De(jt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class _2 extends ls{constructor(o){super(o,g2)}createBucket(o){return new d_(o)}queryRadius(){return lm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,c,f,m,v,w,E,T){const P=um(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,E),D=this.paint.get("fill-extrusion-height").evaluate(c,f),F=this.paint.get("fill-extrusion-base").evaluate(c,f),U=function(Y,tt,lt,pt){const Tt=[];for(const _t of Y){const Lt=[_t.x,_t.y,0,1];cm(Lt,Lt,tt),Tt.push(new A(Lt[0]/Lt[3],Lt[1]/Lt[3]))}return Tt}(P,T),X=function(Y,tt,lt,pt){const Tt=[],_t=[],Lt=pt[8]*tt,Ft=pt[9]*tt,Yt=pt[10]*tt,ye=pt[11]*tt,Te=pt[8]*lt,ge=pt[9]*lt,pe=pt[10]*lt,ae=pt[11]*lt;for(const Se of Y){const ue=[],ie=[];for(const ze of Se){const Ae=ze.x,mn=ze.y,hi=pt[0]*Ae+pt[4]*mn+pt[12],mi=pt[1]*Ae+pt[5]*mn+pt[13],cr=pt[2]*Ae+pt[6]*mn+pt[14],cs=pt[3]*Ae+pt[7]*mn+pt[15],So=cr+Yt,rr=cs+ye,Or=hi+Te,Xr=mi+ge,Eo=cr+pe,Io=cs+ae,hr=new A((hi+Lt)/rr,(mi+Ft)/rr);hr.z=So/rr,ue.push(hr);const pr=new A(Or/Io,Xr/Io);pr.z=Eo/Io,ie.push(pr)}Tt.push(ue),_t.push(ie)}return[Tt,_t]}(m,F,D,T);return function(Y,tt,lt){let pt=1/0;o0(lt,tt)&&(pt=M0(lt,tt[0]));for(let Tt=0;Ttc.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(c=>{this.gradients[c.id]={}}),this.layoutVertexArray=new Ue,this.layoutVertexArray2=new Pe,this.indexArray=new Dr,this.programConfigurations=new Ma(o.layers,o.zoom),this.segments=new ci,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,f){this.hasPattern=c_("line",this.layers,c);const m=this.layers[0].layout.get("line-sort-key"),v=!m.isConstant(),w=[];for(const{feature:E,id:T,index:P,sourceLayerIndex:D}of o){const F=this.layers[0]._featureFilter.needGeometry,U=pc(E,F);if(!this.layers[0]._featureFilter.filter(new ui(this.zoom),U,f))continue;const X=v?m.evaluate(U,{},f):void 0,Y={id:T,properties:E.properties,type:E.type,sourceLayerIndex:D,index:P,geometry:F?U.geometry:hc(E),patterns:{},sortKey:X};w.push(Y)}v&&w.sort((E,T)=>E.sortKey-T.sortKey);for(const E of w){const{geometry:T,index:P,sourceLayerIndex:D}=E;if(this.hasPattern){const F=h_("line",this.layers,E,this.zoom,c);this.patternFeatures.push(F)}else this.addFeature(E,T,P,f,{});c.featureIndex.insert(o[P].feature,T,P,D,this.index)}}update(o,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,f)}addFeatures(o,c,f){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,c,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=o.createVertexBuffer(this.layoutVertexArray2,x2)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,v2),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(o){if(o.properties&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_end"))return{start:+o.properties.mapbox_clip_start,end:+o.properties.mapbox_clip_end}}addFeature(o,c,f,m,v){const w=this.layers[0].layout,E=w.get("line-join").evaluate(o,{}),T=w.get("line-cap"),P=w.get("line-miter-limit"),D=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const F of c)this.addLine(F,o,E,T,P,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,f,v,m)}addLine(o,c,f,m,v,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let pt=0;pt=2&&o[T-1].equals(o[T-2]);)T--;let P=0;for(;P0;if(ye&&pt>P){const ae=U.dist(X);if(ae>2*D){const Se=U.sub(U.sub(X)._mult(D/ae)._round());this.updateDistance(X,Se),this.addCurrentVertex(Se,tt,0,0,F),X=Se}}const ge=X&&Y;let pe=ge?f:E?"butt":m;if(ge&&pe==="round"&&(Ftv&&(pe="bevel"),pe==="bevel"&&(Ft>2&&(pe="flipbevel"),Ft100)Tt=lt.mult(-1);else{const ae=Ft*tt.add(lt).mag()/tt.sub(lt).mag();Tt._perp()._mult(ae*(Te?-1:1))}this.addCurrentVertex(U,Tt,0,0,F),this.addCurrentVertex(U,Tt.mult(-1),0,0,F)}else if(pe==="bevel"||pe==="fakeround"){const ae=-Math.sqrt(Ft*Ft-1),Se=Te?ae:0,ue=Te?0:ae;if(X&&this.addCurrentVertex(U,tt,Se,ue,F),pe==="fakeround"){const ie=Math.round(180*Yt/Math.PI/20);for(let ze=1;ze2*D){const Se=U.add(Y.sub(U)._mult(D/ae)._round());this.updateDistance(U,Se),this.addCurrentVertex(Se,lt,0,0,F),U=Se}}}}addCurrentVertex(o,c,f,m,v,w=!1){const E=c.y*m-c.x,T=-c.y-c.x*m;this.addHalfVertex(o,c.x+c.y*f,c.y-c.x*f,w,!1,f,v),this.addHalfVertex(o,E,T,w,!0,-m,v),this.distance>P0/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,c,f,m,v,w))}addHalfVertex({x:o,y:c},f,m,v,w,E,T){const P=.5*(this.lineClips?this.scaledDistance*(P0-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(v?1:0),(c<<1)+(w?1:0),Math.round(63*f)+128,Math.round(63*m)+128,1+(E===0?0:E<0?-1:1)|(63&P)<<2,P>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const D=T.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,D),T.primitiveLength++),w?this.e2=D:this.e1=D}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(o,c){this.distance+=o.dist(c),this.updateScaledDistance()}}let A0,k0;we("LineBucket",m_,{omit:["layers","patternFeatures"]});var N0={get paint(){return k0=k0||new Zi({"line-opacity":new Ve(jt.paint_line["line-opacity"]),"line-color":new Ve(jt.paint_line["line-color"]),"line-translate":new De(jt.paint_line["line-translate"]),"line-translate-anchor":new De(jt.paint_line["line-translate-anchor"]),"line-width":new Ve(jt.paint_line["line-width"]),"line-gap-width":new Ve(jt.paint_line["line-gap-width"]),"line-offset":new Ve(jt.paint_line["line-offset"]),"line-blur":new Ve(jt.paint_line["line-blur"]),"line-dasharray":new Xp(jt.paint_line["line-dasharray"]),"line-pattern":new lc(jt.paint_line["line-pattern"]),"line-gradient":new Hp(jt.paint_line["line-gradient"])})},get layout(){return A0=A0||new Zi({"line-cap":new De(jt.layout_line["line-cap"]),"line-join":new Ve(jt.layout_line["line-join"]),"line-miter-limit":new De(jt.layout_line["line-miter-limit"]),"line-round-limit":new De(jt.layout_line["line-round-limit"]),"line-sort-key":new Ve(jt.layout_line["line-sort-key"])})}};class E2 extends Ve{possiblyEvaluate(o,c){return c=new ui(Math.floor(c.zoom),{now:c.now,fadeDuration:c.fadeDuration,zoomHistory:c.zoomHistory,transition:c.transition}),super.possiblyEvaluate(o,c)}evaluate(o,c,f,m){return c=dt({},c,{zoom:Math.floor(c.zoom)}),super.evaluate(o,c,f,m)}}let mm;class I2 extends ls{constructor(o){super(o,N0),this.gradientVersion=0,mm||(mm=new E2(N0.paint.properties["line-width"].specification),mm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){const c=this.gradientExpression();this.stepInterpolant=!!function(f){return f._styleExpression!==void 0}(c)&&c._styleExpression.expression instanceof Ja,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(o,c){super.recalculate(o,c),this.paint._values["line-floorwidth"]=mm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new m_(o)}queryRadius(o){const c=o,f=D0(nf("line-width",this,c),nf("line-gap-width",this,c)),m=nf("line-offset",this,c);return f/2+Math.abs(m)+lm(this.paint.get("line-translate"))}queryIntersectsFeature(o,c,f,m,v,w,E){const T=um(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,E),P=E/2*D0(this.paint.get("line-width").evaluate(c,f),this.paint.get("line-gap-width").evaluate(c,f)),D=this.paint.get("line-offset").evaluate(c,f);return D&&(m=function(F,U){const X=[];for(let Y=0;Y=3){for(let lt=0;lt0?o+2*l:l}const C2=wi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),T2=wi([{name:"a_projected_pos",components:3,type:"Float32"}],4);wi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const L2=wi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);wi([{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 R0=wi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),M2=wi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function P2(l,o,c){return l.sections.forEach(f=>{f.text=function(m,v,w){const E=v.layout.get("text-transform").evaluate(w,{});return E==="uppercase"?m=m.toLocaleUpperCase():E==="lowercase"&&(m=m.toLocaleLowerCase()),zo.applyArabicShaping&&(m=zo.applyArabicShaping(m)),m}(f.text,o,c)}),l}wi([{name:"triangle",components:3,type:"Uint16"}]),wi([{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"}]),wi([{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"}]),wi([{type:"Float32",name:"offsetX"}]),wi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),wi([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const pf={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ur=24,O0=Qn,z0=function(l,o,c,f,m){var v,w,E=8*m-f-1,T=(1<>1,D=-7,F=c?m-1:0,U=c?-1:1,X=l[o+F];for(F+=U,v=X&(1<<-D)-1,X>>=-D,D+=E;D>0;v=256*v+l[o+F],F+=U,D-=8);for(w=v&(1<<-D)-1,v>>=-D,D+=f;D>0;w=256*w+l[o+F],F+=U,D-=8);if(v===0)v=1-P;else{if(v===T)return w?NaN:1/0*(X?-1:1);w+=Math.pow(2,f),v-=P}return(X?-1:1)*w*Math.pow(2,v-f)},F0=function(l,o,c,f,m,v){var w,E,T,P=8*v-m-1,D=(1<>1,U=m===23?Math.pow(2,-24)-Math.pow(2,-77):0,X=f?0:v-1,Y=f?1:-1,tt=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(E=isNaN(o)?1:0,w=D):(w=Math.floor(Math.log(o)/Math.LN2),o*(T=Math.pow(2,-w))<1&&(w--,T*=2),(o+=w+F>=1?U/T:U*Math.pow(2,1-F))*T>=2&&(w++,T/=2),w+F>=D?(E=0,w=D):w+F>=1?(E=(o*T-1)*Math.pow(2,m),w+=F):(E=o*Math.pow(2,F-1)*Math.pow(2,m),w=0));m>=8;l[c+X]=255&E,X+=Y,E/=256,m-=8);for(w=w<0;l[c+X]=255&w,X+=Y,w/=256,P-=8);l[c+X-Y]|=128*tt};function Qn(l){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(l)?l:new Uint8Array(l||0),this.pos=0,this.type=0,this.length=this.buf.length}Qn.Varint=0,Qn.Fixed64=1,Qn.Bytes=2,Qn.Fixed32=5;var g_=4294967296,B0=1/g_,V0=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Dl(l){return l.type===Qn.Bytes?l.readVarint()+l.pos:l.pos+1}function _h(l,o,c){return c?4294967296*o+(l>>>0):4294967296*(o>>>0)+(l>>>0)}function U0(l,o,c){var f=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));c.realloc(f);for(var m=c.pos-1;m>=l;m--)c.buf[m+f]=c.buf[m]}function A2(l,o){for(var c=0;c>>8,l[c+2]=o>>>16,l[c+3]=o>>>24}function G0(l,o){return(l[o]|l[o+1]<<8|l[o+2]<<16)+(l[o+3]<<24)}Qn.prototype={destroy:function(){this.buf=null},readFields:function(l,o,c){for(c=c||this.length;this.pos>3,v=this.pos;this.type=7&f,l(m,o,this),this.pos===v&&this.skip(f)}return o},readMessage:function(l,o){return this.readFields(l,o,this.readVarint()+this.pos)},readFixed32:function(){var l=gm(this.buf,this.pos);return this.pos+=4,l},readSFixed32:function(){var l=G0(this.buf,this.pos);return this.pos+=4,l},readFixed64:function(){var l=gm(this.buf,this.pos)+gm(this.buf,this.pos+4)*g_;return this.pos+=8,l},readSFixed64:function(){var l=gm(this.buf,this.pos)+G0(this.buf,this.pos+4)*g_;return this.pos+=8,l},readFloat:function(){var l=z0(this.buf,this.pos,!0,23,4);return this.pos+=4,l},readDouble:function(){var l=z0(this.buf,this.pos,!0,52,8);return this.pos+=8,l},readVarint:function(l){var o,c,f=this.buf;return o=127&(c=f[this.pos++]),c<128?o:(o|=(127&(c=f[this.pos++]))<<7,c<128?o:(o|=(127&(c=f[this.pos++]))<<14,c<128?o:(o|=(127&(c=f[this.pos++]))<<21,c<128?o:function(m,v,w){var E,T,P=w.buf;if(E=(112&(T=P[w.pos++]))>>4,T<128||(E|=(127&(T=P[w.pos++]))<<3,T<128)||(E|=(127&(T=P[w.pos++]))<<10,T<128)||(E|=(127&(T=P[w.pos++]))<<17,T<128)||(E|=(127&(T=P[w.pos++]))<<24,T<128)||(E|=(1&(T=P[w.pos++]))<<31,T<128))return _h(m,E,v);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(c=f[this.pos]))<<28,l,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var l=this.readVarint();return l%2==1?(l+1)/-2:l/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var l=this.readVarint()+this.pos,o=this.pos;return this.pos=l,l-o>=12&&V0?function(c,f,m){return V0.decode(c.subarray(f,m))}(this.buf,o,l):function(c,f,m){for(var v="",w=f;w239?4:D>223?3:D>191?2:1;if(w+U>m)break;U===1?D<128&&(F=D):U===2?(192&(E=c[w+1]))==128&&(F=(31&D)<<6|63&E)<=127&&(F=null):U===3?(T=c[w+2],(192&(E=c[w+1]))==128&&(192&T)==128&&((F=(15&D)<<12|(63&E)<<6|63&T)<=2047||F>=55296&&F<=57343)&&(F=null)):U===4&&(T=c[w+2],P=c[w+3],(192&(E=c[w+1]))==128&&(192&T)==128&&(192&P)==128&&((F=(15&D)<<18|(63&E)<<12|(63&T)<<6|63&P)<=65535||F>=1114112)&&(F=null)),F===null?(F=65533,U=1):F>65535&&(F-=65536,v+=String.fromCharCode(F>>>10&1023|55296),F=56320|1023&F),v+=String.fromCharCode(F),w+=U}return v}(this.buf,o,l)},readBytes:function(){var l=this.readVarint()+this.pos,o=this.buf.subarray(this.pos,l);return this.pos=l,o},readPackedVarint:function(l,o){if(this.type!==Qn.Bytes)return l.push(this.readVarint(o));var c=Dl(this);for(l=l||[];this.pos127;);else if(o===Qn.Bytes)this.pos=this.readVarint()+this.pos;else if(o===Qn.Fixed32)this.pos+=4;else{if(o!==Qn.Fixed64)throw new Error("Unimplemented type: "+o);this.pos+=8}},writeTag:function(l,o){this.writeVarint(l<<3|o)},realloc:function(l){for(var o=this.length||16;o268435455||l<0?function(o,c){var f,m;if(o>=0?(f=o%4294967296|0,m=o/4294967296|0):(m=~(-o/4294967296),4294967295^(f=~(-o%4294967296))?f=f+1|0:(f=0,m=m+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");c.realloc(10),function(v,w,E){E.buf[E.pos++]=127&v|128,v>>>=7,E.buf[E.pos++]=127&v|128,v>>>=7,E.buf[E.pos++]=127&v|128,v>>>=7,E.buf[E.pos++]=127&v|128,E.buf[E.pos]=127&(v>>>=7)}(f,0,c),function(v,w){var E=(7&v)<<4;w.buf[w.pos++]|=E|((v>>>=3)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v)))))}(m,c)}(l,this):(this.realloc(4),this.buf[this.pos++]=127&l|(l>127?128:0),l<=127||(this.buf[this.pos++]=127&(l>>>=7)|(l>127?128:0),l<=127||(this.buf[this.pos++]=127&(l>>>=7)|(l>127?128:0),l<=127||(this.buf[this.pos++]=l>>>7&127))))},writeSVarint:function(l){this.writeVarint(l<0?2*-l-1:2*l)},writeBoolean:function(l){this.writeVarint(!!l)},writeString:function(l){l=String(l),this.realloc(4*l.length),this.pos++;var o=this.pos;this.pos=function(f,m,v){for(var w,E,T=0;T55295&&w<57344){if(!E){w>56319||T+1===m.length?(f[v++]=239,f[v++]=191,f[v++]=189):E=w;continue}if(w<56320){f[v++]=239,f[v++]=191,f[v++]=189,E=w;continue}w=E-55296<<10|w-56320|65536,E=null}else E&&(f[v++]=239,f[v++]=191,f[v++]=189,E=null);w<128?f[v++]=w:(w<2048?f[v++]=w>>6|192:(w<65536?f[v++]=w>>12|224:(f[v++]=w>>18|240,f[v++]=w>>12&63|128),f[v++]=w>>6&63|128),f[v++]=63&w|128)}return v}(this.buf,l,this.pos);var c=this.pos-o;c>=128&&U0(o,c,this),this.pos=o-1,this.writeVarint(c),this.pos+=c},writeFloat:function(l){this.realloc(4),F0(this.buf,l,this.pos,!0,23,4),this.pos+=4},writeDouble:function(l){this.realloc(8),F0(this.buf,l,this.pos,!0,52,8),this.pos+=8},writeBytes:function(l){var o=l.length;this.writeVarint(o),this.realloc(o);for(var c=0;c=128&&U0(c,f,this),this.pos=c-1,this.writeVarint(f),this.pos+=f},writeMessage:function(l,o,c){this.writeTag(l,Qn.Bytes),this.writeRawMessage(o,c)},writePackedVarint:function(l,o){o.length&&this.writeMessage(l,A2,o)},writePackedSVarint:function(l,o){o.length&&this.writeMessage(l,k2,o)},writePackedBoolean:function(l,o){o.length&&this.writeMessage(l,R2,o)},writePackedFloat:function(l,o){o.length&&this.writeMessage(l,N2,o)},writePackedDouble:function(l,o){o.length&&this.writeMessage(l,D2,o)},writePackedFixed32:function(l,o){o.length&&this.writeMessage(l,O2,o)},writePackedSFixed32:function(l,o){o.length&&this.writeMessage(l,z2,o)},writePackedFixed64:function(l,o){o.length&&this.writeMessage(l,F2,o)},writePackedSFixed64:function(l,o){o.length&&this.writeMessage(l,B2,o)},writeBytesField:function(l,o){this.writeTag(l,Qn.Bytes),this.writeBytes(o)},writeFixed32Field:function(l,o){this.writeTag(l,Qn.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(l,o){this.writeTag(l,Qn.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(l,o){this.writeTag(l,Qn.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(l,o){this.writeTag(l,Qn.Fixed64),this.writeSFixed64(o)},writeVarintField:function(l,o){this.writeTag(l,Qn.Varint),this.writeVarint(o)},writeSVarintField:function(l,o){this.writeTag(l,Qn.Varint),this.writeSVarint(o)},writeStringField:function(l,o){this.writeTag(l,Qn.Bytes),this.writeString(o)},writeFloatField:function(l,o){this.writeTag(l,Qn.Fixed32),this.writeFloat(o)},writeDoubleField:function(l,o){this.writeTag(l,Qn.Fixed64),this.writeDouble(o)},writeBooleanField:function(l,o){this.writeVarintField(l,!!o)}};var __=x(O0);const y_=3;function V2(l,o,c){l===1&&c.readMessage(U2,o)}function U2(l,o,c){if(l===3){const{id:f,bitmap:m,width:v,height:w,left:E,top:T,advance:P}=c.readMessage(G2,{});o.push({id:f,bitmap:new of({width:v+2*y_,height:w+2*y_},m),metrics:{width:v,height:w,left:E,top:T,advance:P}})}}function G2(l,o,c){l===1?o.id=c.readVarint():l===2?o.bitmap=c.readBytes():l===3?o.width=c.readVarint():l===4?o.height=c.readVarint():l===5?o.left=c.readSVarint():l===6?o.top=c.readSVarint():l===7&&(o.advance=c.readVarint())}const j0=y_;function q0(l){let o=0,c=0;for(const w of l)o+=w.w*w.h,c=Math.max(c,w.w);l.sort((w,E)=>E.h-w.h);const f=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),c),h:1/0}];let m=0,v=0;for(const w of l)for(let E=f.length-1;E>=0;E--){const T=f[E];if(!(w.w>T.w||w.h>T.h)){if(w.x=T.x,w.y=T.y,v=Math.max(v,w.y+w.h),m=Math.max(m,w.x+w.w),w.w===T.w&&w.h===T.h){const P=f.pop();E=0&&f>=o&&ym[this.text.charCodeAt(f)];f--)c--;this.text=this.text.substring(o,c),this.sectionIndex=this.sectionIndex.slice(o,c)}substring(o,c){const f=new vh;return f.text=this.text.substring(o,c),f.sectionIndex=this.sectionIndex.slice(o,c),f.sections=this.sections,f}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((o,c)=>Math.max(o,this.sections[c].scale),0)}addTextSection(o,c){this.text+=o.text,this.sections.push(df.forText(o.scale,o.fontStack||c));const f=this.sections.length-1;for(let m=0;m=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function _m(l,o,c,f,m,v,w,E,T,P,D,F,U,X,Y,tt){const lt=vh.fromFeature(l,m);let pt;F===a.ai.vertical&<.verticalizePunctuation();const{processBidirectionalText:Tt,processStyledBidirectionalText:_t}=zo;if(Tt&<.sections.length===1){pt=[];const Yt=Tt(lt.toString(),b_(lt,P,v,o,f,X,Y));for(const ye of Yt){const Te=new vh;Te.text=ye,Te.sections=lt.sections;for(let ge=0;ge0&&Ol>Vo&&(Vo=Ol)}else{const Is=Te[wn.fontStack],Go=Is&&Is[Hr];if(Go&&Go.rect)Pa=Go.rect,Ks=Go.metrics;else{const Ol=ye[wn.fontStack],vf=Ol&&Ol[Hr];if(!vf)continue;Ks=vf.metrics}dr=(pr-wn.scale)*ur}Js?(Yt.verticalizable=!0,lo.push({glyph:Hr,imageName:Aa,x:hi,y:mi+dr,vertical:Js,scale:wn.scale,fontStack:wn.fontStack,sectionIndex:uo,metrics:Ks,rect:Pa}),hi+=Rl*wn.scale+ze):(lo.push({glyph:Hr,imageName:Aa,x:hi,y:mi+dr,vertical:Js,scale:wn.scale,fontStack:wn.fontStack,sectionIndex:uo,metrics:Ks,rect:Pa}),hi+=Ks.advance*wn.scale+ze)}lo.length!==0&&(cr=Math.max(hi-ze,cr),Z2(lo,0,lo.length-1,So,Vo)),hi=0;const Uo=ae*pr+Vo;Co.lineOffset=Math.max(Vo,ao),mi+=Uo,cs=Math.max(Uo,cs),++rr}var Or;const Xr=mi-ff,{horizontalAlign:Eo,verticalAlign:Io}=x_(Se);(function(hr,pr,ao,Co,lo,Vo,Uo,fr,wn){const uo=(pr-ao)*lo;let Hr=0;Hr=Vo!==Uo?-fr*Co-ff:(-Co*wn+.5)*Uo;for(const dr of hr)for(const Ks of dr.positionedGlyphs)Ks.x+=uo,Ks.y+=Hr})(Yt.positionedLines,So,Eo,Io,cr,cs,ae,Xr,pe.length),Yt.top+=-Io*Xr,Yt.bottom=Yt.top+Xr,Yt.left+=-Eo*cr,Yt.right=Yt.left+cr}(Ft,o,c,f,pt,w,E,T,F,P,U,tt),!function(Yt){for(const ye of Yt)if(ye.positionedGlyphs.length!==0)return!1;return!0}(Lt)&&Ft}const ym={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},j2={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 W0(l,o,c,f,m,v){if(o.imageName){const w=f[o.imageName];return w?w.displaySize[0]*o.scale*ur/v+m:0}{const w=c[o.fontStack],E=w&&w[l];return E?E.metrics.advance*o.scale+m:0}}function X0(l,o,c,f){const m=Math.pow(l-o,2);return f?l=0;let D=0;for(let U=0;Uw.id),this.index=o.index,this.pixelRatio=o.pixelRatio,this.sourceLayerIndex=o.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=n_([]),this.placementViewportMatrix=n_([]);const c=this.layers[0]._unevaluatedLayout._values;this.textSizeData=J0(this.zoom,c["text-size"]),this.iconSizeData=J0(this.zoom,c["icon-size"]);const f=this.layers[0].layout,m=f.get("symbol-sort-key"),v=f.get("symbol-z-order");this.canOverlap=w_(f,"text-overlap","text-allow-overlap")!=="never"||w_(f,"icon-overlap","icon-allow-overlap")!=="never"||f.get("text-ignore-placement")||f.get("icon-ignore-placement"),this.sortFeaturesByKey=v!=="viewport-y"&&!m.isConstant(),this.sortFeaturesByY=(v==="viewport-y"||v==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,f.get("symbol-placement")==="point"&&(this.writingModes=f.get("text-writing-mode").map(w=>a.ai[w])),this.stateDependentLayerIds=this.layers.filter(w=>w.isStateDependent()).map(w=>w.id),this.sourceID=o.sourceID}createArrays(){this.text=new E_(new Ma(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new E_(new Ma(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new It,this.lineVertexArray=new Bt,this.symbolInstances=new ct,this.textAnchorOffsets=new Xt}calculateGlyphDependencies(o,c,f,m,v){for(let w=0;w0)&&(w.value.kind!=="constant"||w.value.value.length>0),D=T.value.kind!=="constant"||!!T.value.value||Object.keys(T.parameters).length>0,F=v.get("symbol-sort-key");if(this.features=[],!P&&!D)return;const U=c.iconDependencies,X=c.glyphDependencies,Y=c.availableImages,tt=new ui(this.zoom);for(const{feature:lt,id:pt,index:Tt,sourceLayerIndex:_t}of o){const Lt=m._featureFilter.needGeometry,Ft=pc(lt,Lt);if(!m._featureFilter.filter(tt,Ft,f))continue;let Yt,ye;if(Lt||(Ft.geometry=hc(lt)),P){const ge=m.getValueAndResolveTokens("text-field",Ft,f,Y),pe=qr.factory(ge);Y2(pe)&&(this.hasRTLText=!0),(!this.hasRTLText||Zp()==="unavailable"||this.hasRTLText&&zo.isParsed())&&(Yt=P2(pe,m,Ft))}if(D){const ge=m.getValueAndResolveTokens("icon-image",Ft,f,Y);ye=ge instanceof Nr?ge:Nr.fromString(ge)}if(!Yt&&!ye)continue;const Te=this.sortFeaturesByKey?F.evaluate(Ft,{},f):void 0;if(this.features.push({id:pt,text:Yt,icon:ye,index:Tt,sourceLayerIndex:_t,geometry:Ft.geometry,properties:lt.properties,type:X2[lt.type],sortKey:Te}),ye&&(U[ye.name]=!0),Yt){const ge=w.evaluate(Ft,{},f).join(","),pe=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.ai.vertical)>=0;for(const ae of Yt.sections)if(ae.image)U[ae.image.name]=!0;else{const Se=zp(Yt.toString()),ue=ae.fontStack||ge,ie=X[ue]=X[ue]||{};this.calculateGlyphDependencies(ae.text,ie,pe,this.allowVerticalPlacement,Se)}}}v.get("symbol-placement")==="line"&&(this.features=function(lt){const pt={},Tt={},_t=[];let Lt=0;function Ft(ge){_t.push(lt[ge]),Lt++}function Yt(ge,pe,ae){const Se=Tt[ge];return delete Tt[ge],Tt[pe]=Se,_t[Se].geometry[0].pop(),_t[Se].geometry[0]=_t[Se].geometry[0].concat(ae[0]),Se}function ye(ge,pe,ae){const Se=pt[pe];return delete pt[pe],pt[ge]=Se,_t[Se].geometry[0].shift(),_t[Se].geometry[0]=ae[0].concat(_t[Se].geometry[0]),Se}function Te(ge,pe,ae){const Se=ae?pe[0][pe[0].length-1]:pe[0][0];return`${ge}:${Se.x}:${Se.y}`}for(let ge=0;gege.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((lt,pt)=>lt.sortKey-pt.sortKey)}update(o,c,f){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,c,this.layers,f),this.icon.programConfigurations.updatePaintArrays(o,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(o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(o),this.iconCollisionBox.upload(o)),this.text.upload(o,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(o,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(o,c){const f=this.lineVertexArray.length;if(o.segment!==void 0){let m=o.dist(c[o.segment+1]),v=o.dist(c[o.segment]);const w={};for(let E=o.segment+1;E=0;E--)w[E]={x:c[E].x,y:c[E].y,tileUnitDistanceFromAnchor:v},E>0&&(v+=c[E-1].dist(c[E]));for(let E=0;E0}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(o,c){const f=o.placedSymbolArray.get(c),m=f.vertexStartIndex+4*f.numGlyphs;for(let v=f.vertexStartIndex;vm[E]-m[T]||v[T]-v[E]),w}addToSortKeyRanges(o,c){const f=this.sortKeyRanges[this.sortKeyRanges.length-1];f&&f.sortKey===c?f.symbolInstanceEnd=o+1:this.sortKeyRanges.push({sortKey:c,symbolInstanceStart:o,symbolInstanceEnd:o+1})}sortFeatures(o){if(this.sortFeaturesByY&&this.sortedAngle!==o&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(o),this.sortedAngle=o,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((m,v,w)=>{m>=0&&w.indexOf(m)===v&&this.addIndicesForPlacedSymbol(this.text,m)}),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 Q0,$0;we("SymbolBucket",bh,{omit:["layers","collisionBoxArray","features","compareText"]}),bh.MAX_GLYPHS=65535,bh.addDynamicAttributes=S_;var C_={get paint(){return $0=$0||new Zi({"icon-opacity":new Ve(jt.paint_symbol["icon-opacity"]),"icon-color":new Ve(jt.paint_symbol["icon-color"]),"icon-halo-color":new Ve(jt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ve(jt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ve(jt.paint_symbol["icon-halo-blur"]),"icon-translate":new De(jt.paint_symbol["icon-translate"]),"icon-translate-anchor":new De(jt.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ve(jt.paint_symbol["text-opacity"]),"text-color":new Ve(jt.paint_symbol["text-color"],{runtimeType:Ar,getOverride:l=>l.textColor,hasOverride:l=>!!l.textColor}),"text-halo-color":new Ve(jt.paint_symbol["text-halo-color"]),"text-halo-width":new Ve(jt.paint_symbol["text-halo-width"]),"text-halo-blur":new Ve(jt.paint_symbol["text-halo-blur"]),"text-translate":new De(jt.paint_symbol["text-translate"]),"text-translate-anchor":new De(jt.paint_symbol["text-translate-anchor"])})},get layout(){return Q0=Q0||new Zi({"symbol-placement":new De(jt.layout_symbol["symbol-placement"]),"symbol-spacing":new De(jt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new De(jt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ve(jt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new De(jt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new De(jt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new De(jt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new De(jt.layout_symbol["icon-ignore-placement"]),"icon-optional":new De(jt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new De(jt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ve(jt.layout_symbol["icon-size"]),"icon-text-fit":new De(jt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new De(jt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ve(jt.layout_symbol["icon-image"]),"icon-rotate":new Ve(jt.layout_symbol["icon-rotate"]),"icon-padding":new Ve(jt.layout_symbol["icon-padding"]),"icon-keep-upright":new De(jt.layout_symbol["icon-keep-upright"]),"icon-offset":new Ve(jt.layout_symbol["icon-offset"]),"icon-anchor":new Ve(jt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new De(jt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new De(jt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new De(jt.layout_symbol["text-rotation-alignment"]),"text-field":new Ve(jt.layout_symbol["text-field"]),"text-font":new Ve(jt.layout_symbol["text-font"]),"text-size":new Ve(jt.layout_symbol["text-size"]),"text-max-width":new Ve(jt.layout_symbol["text-max-width"]),"text-line-height":new De(jt.layout_symbol["text-line-height"]),"text-letter-spacing":new Ve(jt.layout_symbol["text-letter-spacing"]),"text-justify":new Ve(jt.layout_symbol["text-justify"]),"text-radial-offset":new Ve(jt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new De(jt.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ve(jt.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ve(jt.layout_symbol["text-anchor"]),"text-max-angle":new De(jt.layout_symbol["text-max-angle"]),"text-writing-mode":new De(jt.layout_symbol["text-writing-mode"]),"text-rotate":new Ve(jt.layout_symbol["text-rotate"]),"text-padding":new De(jt.layout_symbol["text-padding"]),"text-keep-upright":new De(jt.layout_symbol["text-keep-upright"]),"text-transform":new Ve(jt.layout_symbol["text-transform"]),"text-offset":new Ve(jt.layout_symbol["text-offset"]),"text-allow-overlap":new De(jt.layout_symbol["text-allow-overlap"]),"text-overlap":new De(jt.layout_symbol["text-overlap"]),"text-ignore-placement":new De(jt.layout_symbol["text-ignore-placement"]),"text-optional":new De(jt.layout_symbol["text-optional"])})}};class tv{constructor(o){if(o.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=o.property.overrides?o.property.overrides.runtimeType:xs,this.defaultValue=o}evaluate(o){if(o.formattedSection){const c=this.defaultValue.property.overrides;if(c&&c.hasOverride(o.formattedSection))return c.getOverride(o.formattedSection)}return o.feature&&o.featureState?this.defaultValue.evaluate(o.feature,o.featureState):this.defaultValue.property.specification.default}eachChild(o){this.defaultValue.isConstant()||o(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}we("FormatSectionOverride",tv,{omit:["defaultValue"]});class bm extends ls{constructor(o){super(o,C_)}recalculate(o,c){if(super.recalculate(o,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 m=[];for(const v of f)m.indexOf(v)<0&&m.push(v);this.layout._values["text-writing-mode"]=m}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,c,f,m){const v=this.layout.get(o).evaluate(c,{},f,m),w=this._unevaluatedLayout._values[o];return w.isDataDriven()||th(w.value)||!v?v:function(E,T){return T.replace(/{([^{}]+)}/g,(P,D)=>E&&D in E?String(E[D]):"")}(c.properties,v)}createBucket(o){return new bh(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of C_.paint.overridableProperties){if(!bm.hasPaintOverride(this.layout,o))continue;const c=this.paint.get(o),f=new tv(c),m=new Ap(f,c.property.specification);let v=null;v=c.value.kind==="constant"||c.value.kind==="source"?new kp("source",m):new nh("composite",m,c.value.zoomStops),this.paint._values[o]=new oo(c.property,v,c.parameters)}}_handleOverridablePaintPropertyUpdate(o,c,f){return!(!this.layout||c.isDataDriven()||f.isDataDriven())&&bm.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,c){const f=o.get("text-field"),m=C_.paint.properties[c];let v=!1;const w=E=>{for(const T of E)if(m.overrides&&m.overrides.hasOverride(T))return void(v=!0)};if(f.value.kind==="constant"&&f.value.value instanceof qr)w(f.value.value.sections);else if(f.value.kind==="source"){const E=P=>{v||(P instanceof wl&&vi(P.value)===st?w(P.value.sections):P instanceof $c?w(P.sections):P.eachChild(E))},T=f.value;T._styleExpression&&E(T._styleExpression.expression)}return v}}let ev;var K2={get paint(){return ev=ev||new Zi({"background-color":new De(jt.paint_background["background-color"]),"background-pattern":new Xp(jt.paint_background["background-pattern"]),"background-opacity":new De(jt.paint_background["background-opacity"])})}};class J2 extends ls{constructor(o){super(o,K2)}}let nv;var Q2={get paint(){return nv=nv||new Zi({"raster-opacity":new De(jt.paint_raster["raster-opacity"]),"raster-hue-rotate":new De(jt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new De(jt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new De(jt.paint_raster["raster-brightness-max"]),"raster-saturation":new De(jt.paint_raster["raster-saturation"]),"raster-contrast":new De(jt.paint_raster["raster-contrast"]),"raster-resampling":new De(jt.paint_raster["raster-resampling"]),"raster-fade-duration":new De(jt.paint_raster["raster-fade-duration"])})}};class $2 extends ls{constructor(o){super(o,Q2)}}class tS extends ls{constructor(o){super(o,{}),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=o}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 eS{constructor(o){this._callback=o,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const T_=63710088e-1;class wu{constructor(o,c){if(isNaN(o)||isNaN(c))throw new Error(`Invalid LngLat object: (${o}, ${c})`);if(this.lng=+o,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 wu(ft(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){const c=Math.PI/180,f=this.lat*c,m=o.lat*c,v=Math.sin(f)*Math.sin(m)+Math.cos(f)*Math.cos(m)*Math.cos((o.lng-this.lng)*c);return T_*Math.acos(Math.min(v,1))}static convert(o){if(o instanceof wu)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new wu(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new wu(Number("lng"in o?o.lng:o.lon),Number(o.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 iv=2*Math.PI*T_;function rv(l){return iv*Math.cos(l*Math.PI/180)}function ov(l){return(180+l)/360}function sv(l){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l*Math.PI/360)))/360}function av(l,o){return l/rv(o)}function lv(l){return 360*l-180}function L_(l){return 360/Math.PI*Math.atan(Math.exp((180-360*l)*Math.PI/180))-90}class xm{constructor(o,c,f=0){this.x=+o,this.y=+c,this.z=+f}static fromLngLat(o,c=0){const f=wu.convert(o);return new xm(ov(f.lng),sv(f.lat),av(c,f.lat))}toLngLat(){return new wu(lv(this.x),L_(this.y))}toAltitude(){return this.z*rv(L_(this.y))}meterInMercatorCoordinateUnits(){return 1/iv*(o=L_(this.y),1/Math.cos(o*Math.PI/180));var o}}function uv(l,o,c){var f=2*Math.PI*6378137/256/Math.pow(2,c);return[l*f-2*Math.PI*6378137/2,o*f-2*Math.PI*6378137/2]}class M_{constructor(o,c,f){if(o<0||o>25||f<0||f>=Math.pow(2,o)||c<0||c>=Math.pow(2,o))throw new Error(`x=${c}, y=${f}, z=${o} outside of bounds. 0<=x<${Math.pow(2,o)}, 0<=y<${Math.pow(2,o)} 0<=z<=25 `);this.z=o,this.x=c,this.y=f,this.key=gf(0,o,o,c,f)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,c,f){const m=(w=this.y,E=this.z,T=uv(256*(v=this.x),256*(w=Math.pow(2,E)-w-1),E),P=uv(256*(v+1),256*(w+1),E),T[0]+","+T[1]+","+P[0]+","+P[1]);var v,w,E,T,P;const D=function(F,U,X){let Y,tt="";for(let lt=F;lt>0;lt--)Y=1<1?"@2x":"").replace(/{quadkey}/g,D).replace(/{bbox-epsg-3857}/g,m)}isChildOf(o){const c=this.z-o.z;return c>0&&o.x===this.x>>c&&o.y===this.y>>c}getTilePoint(o){const c=Math.pow(2,this.z);return new A((o.x*c-this.x)*ir,(o.y*c-this.y)*ir)}toString(){return`${this.z}/${this.x}/${this.y}`}}class cv{constructor(o,c){this.wrap=o,this.canonical=c,this.key=gf(o,c.z,c.z,c.x,c.y)}}class Es{constructor(o,c,f,m,v){if(o= z; overscaledZ = ${o}; z = ${f}`);this.overscaledZ=o,this.wrap=c,this.canonical=new M_(f,+m,+v),this.key=gf(c,o,f,m,v)}clone(){return new Es(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(o){return this.overscaledZ===o.overscaledZ&&this.wrap===o.wrap&&this.canonical.equals(o.canonical)}scaledTo(o){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const c=this.canonical.z-o;return o>this.canonical.z?new Es(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Es(o,this.wrap,o,this.canonical.x>>c,this.canonical.y>>c)}calculateScaledKey(o,c){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const f=this.canonical.z-o;return o>this.canonical.z?gf(this.wrap*+c,o,this.canonical.z,this.canonical.x,this.canonical.y):gf(this.wrap*+c,o,o,this.canonical.x>>f,this.canonical.y>>f)}isChildOf(o){if(o.wrap!==this.wrap)return!1;const c=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ>c&&o.canonical.y===this.canonical.y>>c}children(o){if(this.overscaledZ>=o)return[new Es(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,m=2*this.canonical.y;return[new Es(c,this.wrap,c,f,m),new Es(c,this.wrap,c,f+1,m),new Es(c,this.wrap,c,f,m+1),new Es(c,this.wrap,c,f+1,m+1)]}isLessThan(o){return this.wrapo.wrap)&&(this.overscaledZo.overscaledZ)&&(this.canonical.xo.canonical.x)&&this.canonical.ythis.max&&(this.max=F),F=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+(o+1)}unpack(o,c,f){return o*this.redFactor+c*this.greenFactor+f*this.blueFactor-this.baseShift}getPixels(){return new Ss({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,c,f){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let m=c*this.dim,v=c*this.dim+this.dim,w=f*this.dim,E=f*this.dim+this.dim;switch(c){case-1:m=v-1;break;case 1:v=m+1}switch(f){case-1:w=E-1;break;case 1:E=w+1}const T=-c*this.dim,P=-f*this.dim;for(let D=w;D=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${o} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[o]}}class fv{constructor(o,c,f,m,v){this.type="Feature",this._vectorTileFeature=o,o._z=c,o._x=f,o._y=m,this.properties=o.properties,this.id=v}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(o){this._geometry=o}toJSON(){const o={geometry:this.geometry};for(const c in this)c!=="_geometry"&&c!=="_vectorTileFeature"&&(o[c]=this[c]);return o}}class dv{constructor(o,c){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new du(ir,16,0),this.grid3D=new du(ir,16,0),this.featureIndexArray=new Qt,this.promoteId=c}insert(o,c,f,m,v,w){const E=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(f,m,v);const T=w?this.grid3D:this.grid;for(let P=0;P=0&&F[3]>=0&&T.insert(E,F[0],F[1],F[2],F[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new vu.VectorTile(new __(this.rawTileData)).layers,this.sourceLayerCoder=new pv(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,c,f,m){this.loadVTLayers();const v=o.params||{},w=ir/o.tileSize/o.scale,E=Dp(v.filter),T=o.queryGeometry,P=o.queryPadding*w,D=gv(T),F=this.grid.query(D.minX-P,D.minY-P,D.maxX+P,D.maxY+P),U=gv(o.cameraQueryGeometry),X=this.grid3D.query(U.minX-P,U.minY-P,U.maxX+P,U.maxY+P,(lt,pt,Tt,_t)=>function(Lt,Ft,Yt,ye,Te){for(const pe of Lt)if(Ft<=pe.x&&Yt<=pe.y&&ye>=pe.x&&Te>=pe.y)return!0;const ge=[new A(Ft,Yt),new A(Ft,Te),new A(ye,Te),new A(ye,Yt)];if(Lt.length>2){for(const pe of ge)if(fh(Lt,pe))return!0}for(let pe=0;pe(_t||(_t=hc(Lt)),Ft.queryIntersectsFeature(T,Lt,Yt,_t,this.z,o.transform,w,o.pixelPosMatrix)))}return Y}loadMatchingFeature(o,c,f,m,v,w,E,T,P,D,F){const U=this.bucketLayerIDs[c];if(w&&!function(lt,pt){for(let Tt=0;Tt=0)return!0;return!1}(w,U))return;const X=this.sourceLayerCoder.decode(f),Y=this.vtLayers[X].feature(m);if(v.needGeometry){const lt=pc(Y,!0);if(!v.filter(new ui(this.tileID.overscaledZ),lt,this.tileID.canonical))return}else if(!v.filter(new ui(this.tileID.overscaledZ),Y))return;const tt=this.getId(Y,X);for(let lt=0;lt{const E=o instanceof hh?o.get(w):null;return E&&E.evaluate?E.evaluate(c,f,m):E})}function gv(l){let o=1/0,c=1/0,f=-1/0,m=-1/0;for(const v of l)o=Math.min(o,v.x),c=Math.min(c,v.y),f=Math.max(f,v.x),m=Math.max(m,v.y);return{minX:o,minY:c,maxX:f,maxY:m}}function nS(l,o){return o-l}function _v(l,o,c,f,m){const v=[];for(let w=0;w=f&&F.x>=f||(D.x>=f?D=new A(f,D.y+(f-D.x)/(F.x-D.x)*(F.y-D.y))._round():F.x>=f&&(F=new A(f,D.y+(f-D.x)/(F.x-D.x)*(F.y-D.y))._round()),D.y>=m&&F.y>=m||(D.y>=m?D=new A(D.x+(m-D.y)/(F.y-D.y)*(F.x-D.x),m)._round():F.y>=m&&(F=new A(D.x+(m-D.y)/(F.y-D.y)*(F.x-D.x),m)._round()),T&&D.equals(T[T.length-1])||(T=[D],v.push(T)),T.push(F)))))}}return v}we("FeatureIndex",dv,{omit:["rawTileData","sourceLayerCoder"]});class Su extends A{constructor(o,c,f,m){super(o,c),this.angle=f,m!==void 0&&(this.segment=m)}clone(){return new Su(this.x,this.y,this.angle,this.segment)}}function yv(l,o,c,f,m){if(o.segment===void 0||c===0)return!0;let v=o,w=o.segment+1,E=0;for(;E>-c/2;){if(w--,w<0)return!1;E-=l[w].dist(v),v=l[w]}E+=l[w].dist(l[w+1]),w++;const T=[];let P=0;for(;Ef;)P-=T.shift().angleDelta;if(P>m)return!1;w++,E+=D.dist(F)}return!0}function vv(l){let o=0;for(let c=0;cP){const Y=(P-T)/X,tt=Do.number(F.x,U.x,Y),lt=Do.number(F.y,U.y,Y),pt=new Su(tt,lt,U.angleTo(F),D);return pt._round(),!w||yv(l,pt,E,w,o)?pt:void 0}T+=X}}function rS(l,o,c,f,m,v,w,E,T){const P=bv(f,v,w),D=xv(f,m),F=D*w,U=l[0].x===0||l[0].x===T||l[0].y===0||l[0].y===T;return o-F=0&&Lt=0&&Ft=0&&U+P<=D){const Yt=new Su(Lt,Ft,Tt,Y);Yt._round(),f&&!yv(l,Yt,v,f,m)||X.push(Yt)}}F+=pt}return E||X.length||w||(X=wv(l,F/2,c,f,m,v,w,!0,T)),X}we("Anchor",Su);const xh=Bo;function Sv(l,o,c,f){const m=[],v=l.image,w=v.pixelRatio,E=v.paddedRect.w-2*xh,T=v.paddedRect.h-2*xh,P=l.right-l.left,D=l.bottom-l.top,F=v.stretchX||[[0,E]],U=v.stretchY||[[0,T]],X=(ae,Se)=>ae+Se[1]-Se[0],Y=F.reduce(X,0),tt=U.reduce(X,0),lt=E-Y,pt=T-tt;let Tt=0,_t=Y,Lt=0,Ft=tt,Yt=0,ye=lt,Te=0,ge=pt;if(v.content&&f){const ae=v.content;Tt=wm(F,0,ae[0]),Lt=wm(U,0,ae[1]),_t=wm(F,ae[0],ae[2]),Ft=wm(U,ae[1],ae[3]),Yt=ae[0]-Tt,Te=ae[1]-Lt,ye=ae[2]-ae[0]-_t,ge=ae[3]-ae[1]-Ft}const pe=(ae,Se,ue,ie)=>{const ze=Sm(ae.stretch-Tt,_t,P,l.left),Ae=Em(ae.fixed-Yt,ye,ae.stretch,Y),mn=Sm(Se.stretch-Lt,Ft,D,l.top),hi=Em(Se.fixed-Te,ge,Se.stretch,tt),mi=Sm(ue.stretch-Tt,_t,P,l.left),cr=Em(ue.fixed-Yt,ye,ue.stretch,Y),cs=Sm(ie.stretch-Lt,Ft,D,l.top),So=Em(ie.fixed-Te,ge,ie.stretch,tt),rr=new A(ze,mn),Or=new A(mi,mn),Xr=new A(mi,cs),Eo=new A(ze,cs),Io=new A(Ae/w,hi/w),hr=new A(cr/w,So/w),pr=o*Math.PI/180;if(pr){const lo=Math.sin(pr),Vo=Math.cos(pr),Uo=[Vo,-lo,lo,Vo];rr._matMult(Uo),Or._matMult(Uo),Eo._matMult(Uo),Xr._matMult(Uo)}const ao=ae.stretch+ae.fixed,Co=Se.stretch+Se.fixed;return{tl:rr,tr:Or,bl:Eo,br:Xr,tex:{x:v.paddedRect.x+xh+ao,y:v.paddedRect.y+xh+Co,w:ue.stretch+ue.fixed-ao,h:ie.stretch+ie.fixed-Co},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Io,pixelOffsetBR:hr,minFontScaleX:ye/w/P,minFontScaleY:ge/w/D,isSDF:c}};if(f&&(v.stretchX||v.stretchY)){const ae=Ev(F,lt,Y),Se=Ev(U,pt,tt);for(let ue=0;ue0&&(Y=Math.max(10,Y),this.circleDiameter=Y)}else{let F=w.top*E-T[0],U=w.bottom*E+T[2],X=w.left*E-T[3],Y=w.right*E+T[1];const tt=w.collisionPadding;if(tt&&(X-=tt[0]*E,F-=tt[1]*E,Y+=tt[2]*E,U+=tt[3]*E),D){const lt=new A(X,F),pt=new A(Y,F),Tt=new A(X,U),_t=new A(Y,U),Lt=D*Math.PI/180;lt._rotate(Lt),pt._rotate(Lt),Tt._rotate(Lt),_t._rotate(Lt),X=Math.min(lt.x,pt.x,Tt.x,_t.x),Y=Math.max(lt.x,pt.x,Tt.x,_t.x),F=Math.min(lt.y,pt.y,Tt.y,_t.y),U=Math.max(lt.y,pt.y,Tt.y,_t.y)}o.emplaceBack(c.x,c.y,X,F,Y,U,f,m,v)}this.boxEndIndex=o.length}}class oS{constructor(o=[],c=sS){if(this.data=o,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(o){this.data.push(o),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const o=this.data[0],c=this.data.pop();return this.length--,this.length>0&&(this.data[0]=c,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:c,compare:f}=this,m=c[o];for(;o>0;){const v=o-1>>1,w=c[v];if(f(m,w)>=0)break;c[o]=w,o=v}c[o]=m}_down(o){const{data:c,compare:f}=this,m=this.length>>1,v=c[o];for(;o=0)break;c[o]=E,o=w}c[o]=v}}function sS(l,o){return lo?1:0}function aS(l,o=1,c=!1){let f=1/0,m=1/0,v=-1/0,w=-1/0;const E=l[0];for(let X=0;Xv)&&(v=Y.x),(!X||Y.y>w)&&(w=Y.y)}const T=Math.min(v-f,w-m);let P=T/2;const D=new oS([],lS);if(T===0)return new A(f,m);for(let X=f;XF.d||!F.d)&&(F=X,c&&console.log("found best %d after %d probes",Math.round(1e4*X.d)/1e4,U)),X.max-F.d<=o||(P=X.h/2,D.push(new wh(X.p.x-P,X.p.y-P,P,l)),D.push(new wh(X.p.x+P,X.p.y-P,P,l)),D.push(new wh(X.p.x-P,X.p.y+P,P,l)),D.push(new wh(X.p.x+P,X.p.y+P,P,l)),U+=4)}return c&&(console.log(`num probes: ${U}`),console.log(`best distance: ${F.d}`)),F.p}function lS(l,o){return o.max-l.max}function wh(l,o,c,f){this.p=new A(l,o),this.h=c,this.d=function(m,v){let w=!1,E=1/0;for(let T=0;Tm.y!=Y.y>m.y&&m.x<(Y.x-X.x)*(m.y-X.y)/(Y.y-X.y)+X.x&&(w=!w),E=Math.min(E,s0(m,X,Y))}}return(w?1:-1)*Math.sqrt(E)}(this.p,f),this.max=this.d+this.h*Math.SQRT2}var Wr;a.aq=void 0,(Wr=a.aq||(a.aq={}))[Wr.center=1]="center",Wr[Wr.left=2]="left",Wr[Wr.right=3]="right",Wr[Wr.top=4]="top",Wr[Wr.bottom=5]="bottom",Wr[Wr["top-left"]=6]="top-left",Wr[Wr["top-right"]=7]="top-right",Wr[Wr["bottom-left"]=8]="bottom-left",Wr[Wr["bottom-right"]=9]="bottom-right";const Eu=7,P_=Number.POSITIVE_INFINITY;function Iv(l,o){return o[1]!==P_?function(c,f,m){let v=0,w=0;switch(f=Math.abs(f),m=Math.abs(m),c){case"top-right":case"top-left":case"top":w=m-Eu;break;case"bottom-right":case"bottom-left":case"bottom":w=-m+Eu}switch(c){case"top-right":case"bottom-right":case"right":v=-f;break;case"top-left":case"bottom-left":case"left":v=f}return[v,w]}(l,o[0],o[1]):function(c,f){let m=0,v=0;f<0&&(f=0);const w=f/Math.SQRT2;switch(c){case"top-right":case"top-left":v=w-Eu;break;case"bottom-right":case"bottom-left":v=-w+Eu;break;case"bottom":v=-f+Eu;break;case"top":v=f-Eu}switch(c){case"top-right":case"bottom-right":m=-w;break;case"top-left":case"bottom-left":m=w;break;case"left":m=f;break;case"right":m=-f}return[m,v]}(l,o[0])}function Cv(l,o,c){var f;const m=l.layout,v=(f=m.get("text-variable-anchor-offset"))===null||f===void 0?void 0:f.evaluate(o,{},c);if(v){const E=v.values,T=[];for(let P=0;PU*ur);D.startsWith("top")?F[1]-=Eu:D.startsWith("bottom")&&(F[1]+=Eu),T[P+1]=F}return new rs(T)}const w=m.get("text-variable-anchor");if(w){let E;E=l._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[m.get("text-radial-offset").evaluate(o,{},c)*ur,P_]:m.get("text-offset").evaluate(o,{},c).map(P=>P*ur);const T=[];for(const P of w)T.push(P,Iv(P,E));return new rs(T)}return null}function A_(l){switch(l){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function uS(l,o,c,f,m,v,w,E,T,P,D){let F=v.textMaxSize.evaluate(o,{});F===void 0&&(F=w);const U=l.layers[0].layout,X=U.get("icon-offset").evaluate(o,{},D),Y=Lv(c.horizontal),tt=w/24,lt=l.tilePixelRatio*tt,pt=l.tilePixelRatio*F/24,Tt=l.tilePixelRatio*E,_t=l.tilePixelRatio*U.get("symbol-spacing"),Lt=U.get("text-padding")*l.tilePixelRatio,Ft=function(ie,ze,Ae,mn=1){const hi=ie.get("icon-padding").evaluate(ze,{},Ae),mi=hi&&hi.values;return[mi[0]*mn,mi[1]*mn,mi[2]*mn,mi[3]*mn]}(U,o,D,l.tilePixelRatio),Yt=U.get("text-max-angle")/180*Math.PI,ye=U.get("text-rotation-alignment")!=="viewport"&&U.get("symbol-placement")!=="point",Te=U.get("icon-rotation-alignment")==="map"&&U.get("symbol-placement")!=="point",ge=U.get("symbol-placement"),pe=_t/2,ae=U.get("icon-text-fit");let Se;f&&ae!=="none"&&(l.allowVerticalPlacement&&c.vertical&&(Se=K0(f,c.vertical,ae,U.get("icon-text-fit-padding"),X,tt)),Y&&(f=K0(f,Y,ae,U.get("icon-text-fit-padding"),X,tt)));const ue=(ie,ze)=>{ze.x<0||ze.x>=ir||ze.y<0||ze.y>=ir||function(Ae,mn,hi,mi,cr,cs,So,rr,Or,Xr,Eo,Io,hr,pr,ao,Co,lo,Vo,Uo,fr,wn,uo,Hr,dr,Ks){const Pa=Ae.addToLineVertexArray(mn,hi);let Aa,Rl,Js,Is,Go=0,Ol=0,vf=0,kv=0,B_=-1,V_=-1;const zl={};let Nv=Al("");if(Ae.allowVerticalPlacement&&mi.vertical){const co=rr.layout.get("text-rotate").evaluate(wn,{},dr)+90;Js=new Im(Or,mn,Xr,Eo,Io,mi.vertical,hr,pr,ao,co),So&&(Is=new Im(Or,mn,Xr,Eo,Io,So,lo,Vo,ao,co))}if(cr){const co=rr.layout.get("icon-rotate").evaluate(wn,{}),Cs=rr.layout.get("icon-text-fit")!=="none",dc=Sv(cr,co,Hr,Cs),Na=So?Sv(So,co,Hr,Cs):void 0;Rl=new Im(Or,mn,Xr,Eo,Io,cr,lo,Vo,!1,co),Go=4*dc.length;const mc=Ae.iconSizeData;let il=null;mc.kind==="source"?(il=[nl*rr.layout.get("icon-size").evaluate(wn,{})],il[0]>xu&&Rt(`${Ae.layerIds[0]}: Value for "icon-size" is >= ${mf}. Reduce your "icon-size".`)):mc.kind==="composite"&&(il=[nl*uo.compositeIconSizes[0].evaluate(wn,{},dr),nl*uo.compositeIconSizes[1].evaluate(wn,{},dr)],(il[0]>xu||il[1]>xu)&&Rt(`${Ae.layerIds[0]}: Value for "icon-size" is >= ${mf}. Reduce your "icon-size".`)),Ae.addSymbols(Ae.icon,dc,il,fr,Uo,wn,a.ai.none,mn,Pa.lineStartIndex,Pa.lineLength,-1,dr),B_=Ae.icon.placedSymbolArray.length-1,Na&&(Ol=4*Na.length,Ae.addSymbols(Ae.icon,Na,il,fr,Uo,wn,a.ai.vertical,mn,Pa.lineStartIndex,Pa.lineLength,-1,dr),V_=Ae.icon.placedSymbolArray.length-1)}const Dv=Object.keys(mi.horizontal);for(const co of Dv){const Cs=mi.horizontal[co];if(!Aa){Nv=Al(Cs.text);const Na=rr.layout.get("text-rotate").evaluate(wn,{},dr);Aa=new Im(Or,mn,Xr,Eo,Io,Cs,hr,pr,ao,Na)}const dc=Cs.positionedLines.length===1;if(vf+=Tv(Ae,mn,Cs,cs,rr,ao,wn,Co,Pa,mi.vertical?a.ai.horizontal:a.ai.horizontalOnly,dc?Dv:[co],zl,B_,uo,dr),dc)break}mi.vertical&&(kv+=Tv(Ae,mn,mi.vertical,cs,rr,ao,wn,Co,Pa,a.ai.vertical,["vertical"],zl,V_,uo,dr));const pS=Aa?Aa.boxStartIndex:Ae.collisionBoxArray.length,fS=Aa?Aa.boxEndIndex:Ae.collisionBoxArray.length,dS=Js?Js.boxStartIndex:Ae.collisionBoxArray.length,mS=Js?Js.boxEndIndex:Ae.collisionBoxArray.length,gS=Rl?Rl.boxStartIndex:Ae.collisionBoxArray.length,_S=Rl?Rl.boxEndIndex:Ae.collisionBoxArray.length,yS=Is?Is.boxStartIndex:Ae.collisionBoxArray.length,vS=Is?Is.boxEndIndex:Ae.collisionBoxArray.length;let ka=-1;const Tm=(co,Cs)=>co&&co.circleDiameter?Math.max(co.circleDiameter,Cs):Cs;ka=Tm(Aa,ka),ka=Tm(Js,ka),ka=Tm(Rl,ka),ka=Tm(Is,ka);const Rv=ka>-1?1:0;Rv&&(ka*=Ks/ur),Ae.glyphOffsetArray.length>=bh.MAX_GLYPHS&&Rt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),wn.sortKey!==void 0&&Ae.addToSortKeyRanges(Ae.symbolInstances.length,wn.sortKey);const bS=Cv(rr,wn,dr),[xS,wS]=function(co,Cs){const dc=co.length,Na=Cs==null?void 0:Cs.values;if((Na==null?void 0:Na.length)>0)for(let mc=0;mc=0?zl.right:-1,zl.center>=0?zl.center:-1,zl.left>=0?zl.left:-1,zl.vertical||-1,B_,V_,Nv,pS,fS,dS,mS,gS,_S,yS,vS,Xr,vf,kv,Go,Ol,Rv,0,hr,ka,xS,wS)}(l,ze,ie,c,f,m,Se,l.layers[0],l.collisionBoxArray,o.index,o.sourceLayerIndex,l.index,lt,[Lt,Lt,Lt,Lt],ye,T,Tt,Ft,Te,X,o,v,P,D,w)};if(ge==="line")for(const ie of _v(o.geometry,0,0,ir,ir)){const ze=rS(ie,_t,Yt,c.vertical||Y,f,24,pt,l.overscaling,ir);for(const Ae of ze)Y&&cS(l,Y.text,pe,Ae)||ue(ie,Ae)}else if(ge==="line-center"){for(const ie of o.geometry)if(ie.length>1){const ze=iS(ie,Yt,c.vertical||Y,f,24,pt);ze&&ue(ie,ze)}}else if(o.type==="Polygon")for(const ie of u_(o.geometry,0)){const ze=aS(ie,16);ue(ie[0],new Su(ze.x,ze.y,0))}else if(o.type==="LineString")for(const ie of o.geometry)ue(ie,new Su(ie[0].x,ie[0].y,0));else if(o.type==="Point")for(const ie of o.geometry)for(const ze of ie)ue([ze],new Su(ze.x,ze.y,0))}function Tv(l,o,c,f,m,v,w,E,T,P,D,F,U,X,Y){const tt=function(Tt,_t,Lt,Ft,Yt,ye,Te,ge){const pe=Ft.layout.get("text-rotate").evaluate(ye,{})*Math.PI/180,ae=[];for(const Se of _t.positionedLines)for(const ue of Se.positionedGlyphs){if(!ue.rect)continue;const ie=ue.rect||{};let ze=j0+1,Ae=!0,mn=1,hi=0;const mi=(Yt||ge)&&ue.vertical,cr=ue.metrics.advance*ue.scale/2;if(ge&&_t.verticalizable&&(hi=Se.lineOffset/2-(ue.imageName?-(ur-ue.metrics.width*ue.scale)/2:(ue.scale-1)*ur)),ue.imageName){const fr=Te[ue.imageName];Ae=fr.sdf,mn=fr.pixelRatio,ze=Bo/mn}const cs=Yt?[ue.x+cr,ue.y]:[0,0];let So=Yt?[0,0]:[ue.x+cr+Lt[0],ue.y+Lt[1]-hi],rr=[0,0];mi&&(rr=So,So=[0,0]);const Or=ue.metrics.isDoubleResolution?2:1,Xr=(ue.metrics.left-ze)*ue.scale-cr+So[0],Eo=(-ue.metrics.top-ze)*ue.scale+So[1],Io=Xr+ie.w/Or*ue.scale/mn,hr=Eo+ie.h/Or*ue.scale/mn,pr=new A(Xr,Eo),ao=new A(Io,Eo),Co=new A(Xr,hr),lo=new A(Io,hr);if(mi){const fr=new A(-cr,cr-ff),wn=-Math.PI/2,uo=ur/2-cr,Hr=new A(5-ff-uo,-(ue.imageName?uo:0)),dr=new A(...rr);pr._rotateAround(wn,fr)._add(Hr)._add(dr),ao._rotateAround(wn,fr)._add(Hr)._add(dr),Co._rotateAround(wn,fr)._add(Hr)._add(dr),lo._rotateAround(wn,fr)._add(Hr)._add(dr)}if(pe){const fr=Math.sin(pe),wn=Math.cos(pe),uo=[wn,-fr,fr,wn];pr._matMult(uo),ao._matMult(uo),Co._matMult(uo),lo._matMult(uo)}const Vo=new A(0,0),Uo=new A(0,0);ae.push({tl:pr,tr:ao,bl:Co,br:lo,tex:ie,writingMode:_t.writingMode,glyphOffset:cs,sectionIndex:ue.sectionIndex,isSDF:Ae,pixelOffsetTL:Vo,pixelOffsetBR:Uo,minFontScaleX:0,minFontScaleY:0})}return ae}(0,c,E,m,v,w,f,l.allowVerticalPlacement),lt=l.textSizeData;let pt=null;lt.kind==="source"?(pt=[nl*m.layout.get("text-size").evaluate(w,{})],pt[0]>xu&&Rt(`${l.layerIds[0]}: Value for "text-size" is >= ${mf}. Reduce your "text-size".`)):lt.kind==="composite"&&(pt=[nl*X.compositeTextSizes[0].evaluate(w,{},Y),nl*X.compositeTextSizes[1].evaluate(w,{},Y)],(pt[0]>xu||pt[1]>xu)&&Rt(`${l.layerIds[0]}: Value for "text-size" is >= ${mf}. Reduce your "text-size".`)),l.addSymbols(l.text,tt,pt,E,v,w,P,o,T.lineStartIndex,T.lineLength,U,Y);for(const Tt of D)F[Tt]=l.text.placedSymbolArray.length-1;return 4*tt.length}function Lv(l){for(const o in l)return l[o];return null}function cS(l,o,c,f){const m=l.compareText;if(o in m){const v=m[o];for(let w=v.length-1;w>=0;w--)if(f.dist(v[w])>4;if(m!==1)throw new Error(`Got v${m} data when expected v1.`);const v=Mv[15&f];if(!v)throw new Error("Unrecognized array type.");const[w]=new Uint16Array(o,2,1),[E]=new Uint32Array(o,4,1);return new k_(E,w,v,o)}constructor(o,c=64,f=Float64Array,m){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+c,2),65535),this.ArrayType=f,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const v=Mv.indexOf(this.ArrayType),w=2*o*this.ArrayType.BYTES_PER_ELEMENT,E=o*this.IndexArrayType.BYTES_PER_ELEMENT,T=(8-E%8)%8;if(v<0)throw new Error(`Unexpected typed array class: ${f}.`);m&&m instanceof ArrayBuffer?(this.data=m,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+T,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+w+E+T),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+T,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+v]),new Uint16Array(this.data,2,1)[0]=c,new Uint32Array(this.data,4,1)[0]=o)}add(o,c){const f=this._pos>>1;return this.ids[f]=f,this.coords[this._pos++]=o,this.coords[this._pos++]=c,f}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return N_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,c,f,m){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:w,nodeSize:E}=this,T=[0,v.length-1,0],P=[];for(;T.length;){const D=T.pop()||0,F=T.pop()||0,U=T.pop()||0;if(F-U<=E){for(let lt=U;lt<=F;lt++){const pt=w[2*lt],Tt=w[2*lt+1];pt>=o&&pt<=f&&Tt>=c&&Tt<=m&&P.push(v[lt])}continue}const X=U+F>>1,Y=w[2*X],tt=w[2*X+1];Y>=o&&Y<=f&&tt>=c&&tt<=m&&P.push(v[X]),(D===0?o<=Y:c<=tt)&&(T.push(U),T.push(X-1),T.push(1-D)),(D===0?f>=Y:m>=tt)&&(T.push(X+1),T.push(F),T.push(1-D))}return P}within(o,c,f){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:m,coords:v,nodeSize:w}=this,E=[0,m.length-1,0],T=[],P=f*f;for(;E.length;){const D=E.pop()||0,F=E.pop()||0,U=E.pop()||0;if(F-U<=w){for(let lt=U;lt<=F;lt++)Av(v[2*lt],v[2*lt+1],o,c)<=P&&T.push(m[lt]);continue}const X=U+F>>1,Y=v[2*X],tt=v[2*X+1];Av(Y,tt,o,c)<=P&&T.push(m[X]),(D===0?o-f<=Y:c-f<=tt)&&(E.push(U),E.push(X-1),E.push(1-D)),(D===0?o+f>=Y:c+f>=tt)&&(E.push(X+1),E.push(F),E.push(1-D))}return T}}function N_(l,o,c,f,m,v){if(m-f<=c)return;const w=f+m>>1;Pv(l,o,w,f,m,v),N_(l,o,c,f,w-1,1-v),N_(l,o,c,w+1,m,1-v)}function Pv(l,o,c,f,m,v){for(;m>f;){if(m-f>600){const P=m-f+1,D=c-f+1,F=Math.log(P),U=.5*Math.exp(2*F/3),X=.5*Math.sqrt(F*U*(P-U)/P)*(D-P/2<0?-1:1);Pv(l,o,c,Math.max(f,Math.floor(c-D*U/P+X)),Math.min(m,Math.floor(c+(P-D)*U/P+X)),v)}const w=o[2*c+v];let E=f,T=m;for(_f(l,o,f,c),o[2*m+v]>w&&_f(l,o,f,m);Ew;)T--}o[2*f+v]===w?_f(l,o,f,T):(T++,_f(l,o,T,m)),T<=c&&(f=T+1),c<=T&&(m=T-1)}}function _f(l,o,c,f){D_(l,c,f),D_(o,2*c,2*f),D_(o,2*c+1,2*f+1)}function D_(l,o,c){const f=l[o];l[o]=l[c],l[c]=f}function Av(l,o,c,f){const m=l-c,v=o-f;return m*m+v*v}var R_;a.bh=void 0,(R_=a.bh||(a.bh={})).create="create",R_.load="load",R_.fullLoad="fullLoad";let Cm=null,yf=[];const O_=1e3/60,z_="loadTime",F_="fullLoadTime",hS={mark(l){performance.mark(l)},frame(l){const o=l;Cm!=null&&yf.push(o-Cm),Cm=o},clearMetrics(){Cm=null,yf=[],performance.clearMeasures(z_),performance.clearMeasures(F_);for(const l in a.bh)performance.clearMarks(a.bh[l])},getPerformanceMetrics(){performance.measure(z_,a.bh.create,a.bh.load),performance.measure(F_,a.bh.create,a.bh.fullLoad);const l=performance.getEntriesByName(z_)[0].duration,o=performance.getEntriesByName(F_)[0].duration,c=yf.length,f=1/(yf.reduce((v,w)=>v+w,0)/c/1e3),m=yf.filter(v=>v>O_).reduce((v,w)=>v+(w-O_)/O_,0);return{loadTime:l,fullLoadTime:o,fps:f,percentDroppedFrames:m/(c+m)*100,totalFrames:c}}};a.$=function(l,o,c){var f,m,v,w,E,T,P,D,F,U,X,Y,tt=c[0],lt=c[1],pt=c[2];return o===l?(l[12]=o[0]*tt+o[4]*lt+o[8]*pt+o[12],l[13]=o[1]*tt+o[5]*lt+o[9]*pt+o[13],l[14]=o[2]*tt+o[6]*lt+o[10]*pt+o[14],l[15]=o[3]*tt+o[7]*lt+o[11]*pt+o[15]):(m=o[1],v=o[2],w=o[3],E=o[4],T=o[5],P=o[6],D=o[7],F=o[8],U=o[9],X=o[10],Y=o[11],l[0]=f=o[0],l[1]=m,l[2]=v,l[3]=w,l[4]=E,l[5]=T,l[6]=P,l[7]=D,l[8]=F,l[9]=U,l[10]=X,l[11]=Y,l[12]=f*tt+E*lt+F*pt+o[12],l[13]=m*tt+T*lt+U*pt+o[13],l[14]=v*tt+P*lt+X*pt+o[14],l[15]=w*tt+D*lt+Y*pt+o[15]),l},a.A=dh,a.B=Do,a.C=class{constructor(l,o,c){this.receive=f=>{const m=f.data,v=m.id;if(v&&(!m.targetMapId||this.mapId===m.targetMapId))if(m.type===""){delete this.tasks[v];const w=this.cancelCallbacks[v];delete this.cancelCallbacks[v],w&&w()}else be()||m.mustQueue?(this.tasks[v]=m,this.taskQueue.push(v),this.invoker.trigger()):this.processTask(v,m)},this.process=()=>{if(!this.taskQueue.length)return;const f=this.taskQueue.shift(),m=this.tasks[f];delete this.tasks[f],this.taskQueue.length&&this.invoker.trigger(),m&&this.processTask(f,m)},this.target=l,this.parent=o,this.mapId=c,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new eS(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=be()?l:window}send(l,o,c,f,m=!1){const v=Math.round(1e18*Math.random()).toString(36).substring(0,10);c&&(this.callbacks[v]=c);const w=[],E={id:v,type:l,hasCallback:!!c,targetMapId:f,mustQueue:m,sourceMapId:this.mapId,data:$a(o,w)};return this.target.postMessage(E,{transfer:w}),{cancel:()=>{c&&delete this.callbacks[v],this.target.postMessage({id:v,type:"",targetMapId:f,sourceMapId:this.mapId})}}}processTask(l,o){if(o.type===""){const c=this.callbacks[l];delete this.callbacks[l],c&&(o.error?c(mu(o.error)):c(null,mu(o.data)))}else{let c=!1;const f=[],m=o.hasCallback?(E,T)=>{c=!0,delete this.cancelCallbacks[l];const P={id:l,type:"",sourceMapId:this.mapId,error:E?$a(E):null,data:$a(T,f)};this.target.postMessage(P,{transfer:f})}:E=>{c=!0};let v=null;const w=mu(o.data);if(this.parent[o.type])v=this.parent[o.type](o.sourceMapId,w,m);else if("getWorkerSource"in this.parent){const E=o.type.split(".");v=this.parent.getWorkerSource(o.sourceMapId,E[0],w.source)[E[1]](w,m)}else m(new Error(`Could not find function ${o.type}`));!c&&v&&v.cancel&&(this.cancelCallbacks[l]=v.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.D=De,a.E=qi,a.F=function(l,o){const c={};for(let f=0;f{}}},a.Y=se,a.Z=function(){var l=new dh(16);return dh!=Float32Array&&(l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[11]=0,l[12]=0,l[13]=0,l[14]=0),l[0]=1,l[5]=1,l[10]=1,l[15]=1,l},a._=_,a.a=an,a.a$=class extends W{},a.a0=function(l,o,c){var f=c[0],m=c[1],v=c[2];return l[0]=o[0]*f,l[1]=o[1]*f,l[2]=o[2]*f,l[3]=o[3]*f,l[4]=o[4]*m,l[5]=o[5]*m,l[6]=o[6]*m,l[7]=o[7]*m,l[8]=o[8]*v,l[9]=o[9]*v,l[10]=o[10]*v,l[11]=o[11]*v,l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15],l},a.a1=c0,a.a2=function(){return ut++},a.a3=at,a.a4=bh,a.a5=function(){zo.isLoading()||zo.isLoaded()||Zp()!=="deferred"||tm()},a.a6=Dp,a.a7=pc,a.a8=ui,a.a9=fv,a.aA=sc,a.aB=function(l){l=l.slice();const o=Object.create(null);for(let c=0;c{f[w.source]?c.push({command:En.removeLayer,args:[w.id]}):v.push(w)}),c=c.concat(m),function(w,E,T){E=E||[];const P=(w=w||[]).map(js),D=E.map(js),F=w.reduce(wa,{}),U=E.reduce(wa,{}),X=P.slice(),Y=Object.create(null);let tt,lt,pt,Tt,_t,Lt,Ft;for(tt=0,lt=0;tt@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(c,f,m,v)=>{const w=m||v;return o[f]=!w||w.toLowerCase(),""}),o["max-age"]){const c=parseInt(o["max-age"],10);isNaN(c)?delete o["max-age"]:o["max-age"]=c}return o},a.ab=function(l,o){const c=[];for(const f in l)f in o||c.push(f);return c},a.ac=function(l){if(me==null){const o=l.navigator?l.navigator.userAgent:null;me=!!l.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return me},a.ad=ht,a.ae=function(l,o,c){var f=Math.sin(c),m=Math.cos(c),v=o[0],w=o[1],E=o[2],T=o[3],P=o[4],D=o[5],F=o[6],U=o[7];return o!==l&&(l[8]=o[8],l[9]=o[9],l[10]=o[10],l[11]=o[11],l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15]),l[0]=v*m+P*f,l[1]=w*m+D*f,l[2]=E*m+F*f,l[3]=T*m+U*f,l[4]=P*m-v*f,l[5]=D*m-w*f,l[6]=F*m-E*f,l[7]=U*m-T*f,l},a.af=function(l){var o=new dh(16);return o[0]=l[0],o[1]=l[1],o[2]=l[2],o[3]=l[3],o[4]=l[4],o[5]=l[5],o[6]=l[6],o[7]=l[7],o[8]=l[8],o[9]=l[9],o[10]=l[10],o[11]=l[11],o[12]=l[12],o[13]=l[13],o[14]=l[14],o[15]=l[15],o},a.ag=cm,a.ah=function(l,o){let c=0,f=0;if(l.kind==="constant")f=l.layoutSize;else if(l.kind!=="source"){const{interpolationType:m,minZoom:v,maxZoom:w}=l,E=m?ht(Ro.interpolationFactor(m,o,v,w),0,1):0;l.kind==="camera"?f=Do.number(l.minSize,l.maxSize,E):c=E}return{uSizeT:c,uSize:f}},a.aj=function(l,{uSize:o,uSizeT:c},{lowerSize:f,upperSize:m}){return l.kind==="source"?f/nl:l.kind==="composite"?Do.number(f/nl,m/nl,c):o},a.ak=S_,a.al=function(l,o,c,f){const m=o.y-l.y,v=o.x-l.x,w=f.y-c.y,E=f.x-c.x,T=w*v-E*m;if(T===0)return null;const P=(E*(l.y-c.y)-w*(l.x-c.x))/T;return new A(l.x+P*v,l.y+P*m)},a.am=_v,a.an=r0,a.ao=n_,a.ap=ur,a.ar=w_,a.as=function(l,o){var c=o[0],f=o[1],m=o[2],v=o[3],w=o[4],E=o[5],T=o[6],P=o[7],D=o[8],F=o[9],U=o[10],X=o[11],Y=o[12],tt=o[13],lt=o[14],pt=o[15],Tt=c*E-f*w,_t=c*T-m*w,Lt=c*P-v*w,Ft=f*T-m*E,Yt=f*P-v*E,ye=m*P-v*T,Te=D*tt-F*Y,ge=D*lt-U*Y,pe=D*pt-X*Y,ae=F*lt-U*tt,Se=F*pt-X*tt,ue=U*pt-X*lt,ie=Tt*ue-_t*Se+Lt*ae+Ft*pe-Yt*ge+ye*Te;return ie?(l[0]=(E*ue-T*Se+P*ae)*(ie=1/ie),l[1]=(m*Se-f*ue-v*ae)*ie,l[2]=(tt*ye-lt*Yt+pt*Ft)*ie,l[3]=(U*Yt-F*ye-X*Ft)*ie,l[4]=(T*pe-w*ue-P*ge)*ie,l[5]=(c*ue-m*pe+v*ge)*ie,l[6]=(lt*Lt-Y*ye-pt*_t)*ie,l[7]=(D*ye-U*Lt+X*_t)*ie,l[8]=(w*Se-E*pe+P*Te)*ie,l[9]=(f*pe-c*Se-v*Te)*ie,l[10]=(Y*Yt-tt*Lt+pt*Tt)*ie,l[11]=(F*Lt-D*Yt-X*Tt)*ie,l[12]=(E*ge-w*ae-T*Te)*ie,l[13]=(c*ae-f*ge+m*Te)*ie,l[14]=(tt*_t-Y*Ft-lt*Tt)*ie,l[15]=(D*Ft-F*_t+U*Tt)*ie,l):null},a.at=A_,a.au=x_,a.av=k_,a.aw=function(){const l={},o=jt.$version;for(const c in jt.$root){const f=jt.$root[c];if(f.required){let m=null;m=c==="version"?o:f.type==="array"?[]:{},m!=null&&(l[c]=m)}}return l},a.ax=En,a.ay=Kd,a.az=yn,a.b=function(l,o){const c=new Blob([new Uint8Array(l)],{type:"image/png"});createImageBitmap(c).then(f=>{o(null,f)}).catch(f=>{o(new Error(`Could not load image because of ${f.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},a.b0=Dr,a.b1=function(l,o){var c=l[0],f=l[1],m=l[2],v=l[3],w=l[4],E=l[5],T=l[6],P=l[7],D=l[8],F=l[9],U=l[10],X=l[11],Y=l[12],tt=l[13],lt=l[14],pt=l[15],Tt=o[0],_t=o[1],Lt=o[2],Ft=o[3],Yt=o[4],ye=o[5],Te=o[6],ge=o[7],pe=o[8],ae=o[9],Se=o[10],ue=o[11],ie=o[12],ze=o[13],Ae=o[14],mn=o[15];return Math.abs(c-Tt)<=wo*Math.max(1,Math.abs(c),Math.abs(Tt))&&Math.abs(f-_t)<=wo*Math.max(1,Math.abs(f),Math.abs(_t))&&Math.abs(m-Lt)<=wo*Math.max(1,Math.abs(m),Math.abs(Lt))&&Math.abs(v-Ft)<=wo*Math.max(1,Math.abs(v),Math.abs(Ft))&&Math.abs(w-Yt)<=wo*Math.max(1,Math.abs(w),Math.abs(Yt))&&Math.abs(E-ye)<=wo*Math.max(1,Math.abs(E),Math.abs(ye))&&Math.abs(T-Te)<=wo*Math.max(1,Math.abs(T),Math.abs(Te))&&Math.abs(P-ge)<=wo*Math.max(1,Math.abs(P),Math.abs(ge))&&Math.abs(D-pe)<=wo*Math.max(1,Math.abs(D),Math.abs(pe))&&Math.abs(F-ae)<=wo*Math.max(1,Math.abs(F),Math.abs(ae))&&Math.abs(U-Se)<=wo*Math.max(1,Math.abs(U),Math.abs(Se))&&Math.abs(X-ue)<=wo*Math.max(1,Math.abs(X),Math.abs(ue))&&Math.abs(Y-ie)<=wo*Math.max(1,Math.abs(Y),Math.abs(ie))&&Math.abs(tt-ze)<=wo*Math.max(1,Math.abs(tt),Math.abs(ze))&&Math.abs(lt-Ae)<=wo*Math.max(1,Math.abs(lt),Math.abs(Ae))&&Math.abs(pt-mn)<=wo*Math.max(1,Math.abs(pt),Math.abs(mn))},a.b2=function(l,o){return l[0]=o[0],l[1]=o[1],l[2]=o[2],l[3]=o[3],l[4]=o[4],l[5]=o[5],l[6]=o[6],l[7]=o[7],l[8]=o[8],l[9]=o[9],l[10]=o[10],l[11]=o[11],l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15],l},a.b3=function(l,o,c){return l[0]=o[0]*c[0],l[1]=o[1]*c[1],l[2]=o[2]*c[2],l[3]=o[3]*c[3],l},a.b4=function(l,o){return l[0]*o[0]+l[1]*o[1]+l[2]*o[2]+l[3]*o[3]},a.b5=ft,a.b6=cv,a.b7=av,a.b8=function(l,o,c,f,m){var v,w=1/Math.tan(o/2);return l[0]=w/c,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=w,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[11]=-1,l[12]=0,l[13]=0,l[15]=0,m!=null&&m!==1/0?(l[10]=(m+f)*(v=1/(f-m)),l[14]=2*m*f*v):(l[10]=-1,l[14]=-2*f),l},a.b9=function(l,o,c){var f=Math.sin(c),m=Math.cos(c),v=o[4],w=o[5],E=o[6],T=o[7],P=o[8],D=o[9],F=o[10],U=o[11];return o!==l&&(l[0]=o[0],l[1]=o[1],l[2]=o[2],l[3]=o[3],l[12]=o[12],l[13]=o[13],l[14]=o[14],l[15]=o[15]),l[4]=v*m+P*f,l[5]=w*m+D*f,l[6]=E*m+F*f,l[7]=T*m+U*f,l[8]=P*m-v*f,l[9]=D*m-w*f,l[10]=F*m-E*f,l[11]=U*m-T*f,l},a.bA=S,a.bB=O0,a.bC=eh,a.bD=zo,a.ba=Q,a.bb=it,a.bc=function(l,o){return l[0]=o[0],l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=o[1],l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=o[2],l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,l},a.bd=class extends cc{},a.be=T_,a.bf=lv,a.bg=hS,a.bi=Me,a.bj=function(l,o,c=!1){if(bo===Vp||bo===Up||bo===Gp)throw new Error("setRTLTextPlugin cannot be called multiple times.");tl=ln.resolveURL(l),bo=Vp,jp=o,qp(),c||tm()},a.bk=Zp,a.bl=function(l,o){const c={};for(let m=0;mie*ur)}let ge=w?"center":c.get("text-justify").evaluate(P,{},l.canonical);const pe=c.get("symbol-placement"),ae=pe==="point"?c.get("text-max-width").evaluate(P,{},l.canonical)*ur:0,Se=()=>{l.bucket.allowVerticalPlacement&&zp(Lt)&&(Y.vertical=_m(tt,l.glyphMap,l.glyphPositions,l.imagePositions,D,ae,v,ye,"left",Yt,pt,a.ai.vertical,!0,pe,U,F))};if(!w&&Te){const ue=new Set;if(ge==="auto")for(let ze=0;ze{o(null,c),URL.revokeObjectURL(c.src),c.onload=null,window.requestAnimationFrame(()=>{c.src=jn})},c.onerror=()=>o(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 f=new Blob([new Uint8Array(l)],{type:"image/png"});c.src=l.byteLength?URL.createObjectURL(f):jn},a.e=dt,a.f=function(l,o){return tr(dt(l,{type:"json"}),o)},a.g=ni,a.h=ln,a.i=be,a.j=dn,a.k=Xn,a.l=Ct,a.m=tr,a.n=function(l){return new __(l).readFields(V2,[])},a.o=function(l,o,c){if(!l.length)return c(null,[]);let f=l.length;const m=new Array(l.length);let v=null;l.forEach((w,E)=>{o(w,(T,P)=>{T&&(v=T),m[E]=P,--f==0&&c(v,m)})})},a.p=q0,a.q=of,a.r=Zi,a.s=Ge,a.t=Xg,a.u=_e,a.v=jt,a.w=Rt,a.x=lh,a.y=Ta,a.z=function([l,o,c]){return o+=90,o*=Math.PI/180,c*=Math.PI/180,{x:l*Math.cos(o)*Math.sin(c),y:l*Math.sin(o)*Math.sin(c),z:l*Math.cos(c)}}}),u(["./shared"],function(a){class _{constructor(B){this.keyCache={},B&&this.replace(B)}replace(B){this._layerConfigs={},this._layers={},this.update(B,[])}update(B,j){for(const q of B){this._layerConfigs[q.id]=q;const ot=this._layers[q.id]=a.aC(q);ot._featureFilter=a.a6(ot.filter),this.keyCache[q.id]&&delete this.keyCache[q.id]}for(const q of j)delete this.keyCache[q],delete this._layerConfigs[q],delete this._layers[q];this.familiesBySource={};const J=a.bl(Object.values(this._layerConfigs),this.keyCache);for(const q of J){const ot=q.map(Zt=>this._layers[Zt.id]),Et=ot[0];if(Et.visibility==="none")continue;const gt=Et.source||"";let rt=this.familiesBySource[gt];rt||(rt=this.familiesBySource[gt]={});const bt=Et.sourceLayer||"_geojsonTileLayer";let qt=rt[bt];qt||(qt=rt[bt]=[]),qt.push(ot)}}}class x{constructor(B){const j={},J=[];for(const gt in B){const rt=B[gt],bt=j[gt]={};for(const qt in rt){const Zt=rt[+qt];if(!Zt||Zt.bitmap.width===0||Zt.bitmap.height===0)continue;const Ht={x:0,y:0,w:Zt.bitmap.width+2,h:Zt.bitmap.height+2};J.push(Ht),bt[qt]={rect:Ht,metrics:Zt.metrics}}}const{w:q,h:ot}=a.p(J),Et=new a.q({width:q||1,height:ot||1});for(const gt in B){const rt=B[gt];for(const bt in rt){const qt=rt[+bt];if(!qt||qt.bitmap.width===0||qt.bitmap.height===0)continue;const Zt=j[gt][bt].rect;a.q.copy(qt.bitmap,Et,{x:0,y:0},{x:Zt.x+1,y:Zt.y+1},qt.bitmap)}}this.image=Et,this.positions=j}}a.bm("GlyphAtlas",x);class S{constructor(B){this.tileID=new a.O(B.tileID.overscaledZ,B.tileID.wrap,B.tileID.canonical.z,B.tileID.canonical.x,B.tileID.canonical.y),this.uid=B.uid,this.zoom=B.zoom,this.pixelRatio=B.pixelRatio,this.tileSize=B.tileSize,this.source=B.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=B.showCollisionBoxes,this.collectResourceTiming=!!B.collectResourceTiming,this.returnDependencies=!!B.returnDependencies,this.promoteId=B.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(B,j,J,q,ot){this.status="parsing",this.data=B,this.collisionBoxArray=new a.a3;const Et=new a.bn(Object.keys(B.layers).sort()),gt=new a.bo(this.tileID,this.promoteId);gt.bucketLayerIDs=[];const rt={},bt={featureIndex:gt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:J},qt=j.familiesBySource[this.source];for(const An in qt){const Pn=B.layers[An];if(!Pn)continue;Pn.version===1&&a.w(`Vector tile source "${this.source}" layer "${An}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const jr=Et.encode(An),ri=[];for(let nr=0;nr=kr.maxzoom||kr.visibility!=="none"&&(L(nr,this.zoom,J),(rt[kr.id]=kr.createBucket({index:gt.bucketLayerIDs.length,layers:nr,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:jr,sourceID:this.source})).populate(ri,bt,this.tileID.canonical),gt.bucketLayerIDs.push(nr.map(is=>is.id)))}}let Zt,Ht,Ne,Ye;const Ie=a.aH(bt.glyphDependencies,An=>Object.keys(An).map(Number));this.inFlightDependencies.forEach(An=>An==null?void 0:An.cancel()),this.inFlightDependencies=[];const Fe=++this.dependencySentinel;Object.keys(Ie).length?this.inFlightDependencies.push(q.send("getGlyphs",{uid:this.uid,stacks:Ie,source:this.source,tileID:this.tileID,type:"glyphs"},(An,Pn)=>{Fe===this.dependencySentinel&&(Zt||(Zt=An,Ht=Pn,Jn.call(this)))})):Ht={};const tn=Object.keys(bt.iconDependencies);tn.length?this.inFlightDependencies.push(q.send("getImages",{icons:tn,source:this.source,tileID:this.tileID,type:"icons"},(An,Pn)=>{Fe===this.dependencySentinel&&(Zt||(Zt=An,Ne=Pn,Jn.call(this)))})):Ne={};const Un=Object.keys(bt.patternDependencies);function Jn(){if(Zt)return ot(Zt);if(Ht&&Ne&&Ye){const An=new x(Ht),Pn=new a.bp(Ne,Ye);for(const jr in rt){const ri=rt[jr];ri instanceof a.a4?(L(ri.layers,this.zoom,J),a.bq({bucket:ri,glyphMap:Ht,glyphPositions:An.positions,imageMap:Ne,imagePositions:Pn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):ri.hasPattern&&(ri instanceof a.br||ri instanceof a.bs||ri instanceof a.bt)&&(L(ri.layers,this.zoom,J),ri.addFeatures(bt,this.tileID.canonical,Pn.patternPositions))}this.status="done",ot(null,{buckets:Object.values(rt).filter(jr=>!jr.isEmpty()),featureIndex:gt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:An.image,imageAtlas:Pn,glyphMap:this.returnDependencies?Ht:null,iconMap:this.returnDependencies?Ne:null,glyphPositions:this.returnDependencies?An.positions:null})}}Un.length?this.inFlightDependencies.push(q.send("getImages",{icons:Un,source:this.source,tileID:this.tileID,type:"patterns"},(An,Pn)=>{Fe===this.dependencySentinel&&(Zt||(Zt=An,Ye=Pn,Jn.call(this)))})):Ye={},Jn.call(this)}}function L(st,B,j){const J=new a.a8(B);for(const q of st)q.recalculate(J,j)}function A(st,B){const j=a.l(st.request,(J,q,ot,Et)=>{if(J)B(J);else if(q)try{const gt=new a.bw.VectorTile(new a.bv(q));B(null,{vectorTile:gt,rawData:q,cacheControl:ot,expires:Et})}catch(gt){const rt=new Uint8Array(q);let bt=`Unable to parse the tile at ${st.request.url}, `;bt+=rt[0]===31&&rt[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${gt.messge}`,B(new Error(bt))}});return()=>{j.cancel(),B()}}class N{constructor(B,j,J,q){this.actor=B,this.layerIndex=j,this.availableImages=J,this.loadVectorData=q||A,this.fetching={},this.loading={},this.loaded={}}loadTile(B,j){const J=B.uid;this.loading||(this.loading={});const q=!!(B&&B.request&&B.request.collectResourceTiming)&&new a.bu(B.request),ot=this.loading[J]=new S(B);ot.abort=this.loadVectorData(B,(Et,gt)=>{if(delete this.loading[J],Et||!gt)return ot.status="done",this.loaded[J]=ot,j(Et);const rt=gt.rawData,bt={};gt.expires&&(bt.expires=gt.expires),gt.cacheControl&&(bt.cacheControl=gt.cacheControl);const qt={};if(q){const Zt=q.finish();Zt&&(qt.resourceTiming=JSON.parse(JSON.stringify(Zt)))}ot.vectorTile=gt.vectorTile,ot.parse(gt.vectorTile,this.layerIndex,this.availableImages,this.actor,(Zt,Ht)=>{if(delete this.fetching[J],Zt||!Ht)return j(Zt);j(null,a.e({rawTileData:rt.slice(0)},Ht,bt,qt))}),this.loaded=this.loaded||{},this.loaded[J]=ot,this.fetching[J]={rawTileData:rt,cacheControl:bt,resourceTiming:qt}})}reloadTile(B,j){const J=this.loaded,q=B.uid;if(J&&J[q]){const ot=J[q];ot.showCollisionBoxes=B.showCollisionBoxes,ot.status==="parsing"?ot.parse(ot.vectorTile,this.layerIndex,this.availableImages,this.actor,(Et,gt)=>{if(Et||!gt)return j(Et,gt);let rt;if(this.fetching[q]){const{rawTileData:bt,cacheControl:qt,resourceTiming:Zt}=this.fetching[q];delete this.fetching[q],rt=a.e({rawTileData:bt.slice(0)},gt,qt,Zt)}else rt=gt;j(null,rt)}):ot.status==="done"&&(ot.vectorTile?ot.parse(ot.vectorTile,this.layerIndex,this.availableImages,this.actor,j):j())}}abortTile(B,j){const J=this.loading,q=B.uid;J&&J[q]&&J[q].abort&&(J[q].abort(),delete J[q]),j()}removeTile(B,j){const J=this.loaded,q=B.uid;J&&J[q]&&delete J[q],j()}}class O{constructor(){this.loaded={}}loadTile(B,j){return a._(this,void 0,void 0,function*(){const{uid:J,encoding:q,rawImageData:ot,redFactor:Et,greenFactor:gt,blueFactor:rt,baseShift:bt}=B,qt=ot.width+2,Zt=ot.height+2,Ht=a.a(ot)?new a.R({width:qt,height:Zt},yield a.bx(ot,-1,-1,qt,Zt)):ot,Ne=new a.by(J,Ht,q,Et,gt,rt,bt);this.loaded=this.loaded||{},this.loaded[J]=Ne,j(null,Ne)})}removeTile(B){const j=this.loaded,J=B.uid;j&&j[J]&&delete j[J]}}function Z(st,B){if(st.length!==0){G(st[0],B);for(var j=1;j=Math.abs(gt)?j-rt+gt:gt-rt+j,j=rt}j+J>=0!=!!B&&st.reverse()}var K=a.bz(function st(B,j){var J,q=B&&B.type;if(q==="FeatureCollection")for(J=0;J>31}function be(st,B){for(var j=st.loadGeometry(),J=st.type,q=0,ot=0,Et=j.length,gt=0;gtst},He=Math.fround||(ke=new Float32Array(1),st=>(ke[0]=+st,ke[0]));var ke;const Be=3,fn=5,Mn=6;class ln{constructor(B){this.options=Object.assign(Object.create(jn),B),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(B){const{log:j,minZoom:J,maxZoom:q}=this.options;j&&console.time("total time");const ot=`prepare ${B.length} points`;j&&console.time(ot),this.points=B;const Et=[];for(let rt=0;rt=J;rt--){const bt=+Date.now();gt=this.trees[rt]=this._createTree(this._cluster(gt,rt)),j&&console.log("z%d: %d clusters in %dms",rt,gt.numItems,+Date.now()-bt)}return j&&console.timeEnd("total time"),this}getClusters(B,j){let J=((B[0]+180)%360+360)%360-180;const q=Math.max(-90,Math.min(90,B[1]));let ot=B[2]===180?180:((B[2]+180)%360+360)%360-180;const Et=Math.max(-90,Math.min(90,B[3]));if(B[2]-B[0]>=360)J=-180,ot=180;else if(J>ot){const Zt=this.getClusters([J,q,180,Et],j),Ht=this.getClusters([-180,q,ot,Et],j);return Zt.concat(Ht)}const gt=this.trees[this._limitZoom(j)],rt=gt.range(yn(J),ni(Et),yn(ot),ni(q)),bt=gt.data,qt=[];for(const Zt of rt){const Ht=this.stride*Zt;qt.push(bt[Ht+fn]>1?Wt(bt,Ht,this.clusterProps):this.points[bt[Ht+Be]])}return qt}getChildren(B){const j=this._getOriginId(B),J=this._getOriginZoom(B),q="No cluster with the specified id.",ot=this.trees[J];if(!ot)throw new Error(q);const Et=ot.data;if(j*this.stride>=Et.length)throw new Error(q);const gt=this.options.radius/(this.options.extent*Math.pow(2,J-1)),rt=ot.within(Et[j*this.stride],Et[j*this.stride+1],gt),bt=[];for(const qt of rt){const Zt=qt*this.stride;Et[Zt+4]===B&&bt.push(Et[Zt+fn]>1?Wt(Et,Zt,this.clusterProps):this.points[Et[Zt+Be]])}if(bt.length===0)throw new Error(q);return bt}getLeaves(B,j,J){const q=[];return this._appendLeaves(q,B,j=j||10,J=J||0,0),q}getTile(B,j,J){const q=this.trees[this._limitZoom(B)],ot=Math.pow(2,B),{extent:Et,radius:gt}=this.options,rt=gt/Et,bt=(J-rt)/ot,qt=(J+1+rt)/ot,Zt={features:[]};return this._addTileFeatures(q.range((j-rt)/ot,bt,(j+1+rt)/ot,qt),q.data,j,J,ot,Zt),j===0&&this._addTileFeatures(q.range(1-rt/ot,bt,1,qt),q.data,ot,J,ot,Zt),j===ot-1&&this._addTileFeatures(q.range(0,bt,rt/ot,qt),q.data,-1,J,ot,Zt),Zt.features.length?Zt:null}getClusterExpansionZoom(B){let j=this._getOriginZoom(B)-1;for(;j<=this.options.maxZoom;){const J=this.getChildren(B);if(j++,J.length!==1)break;B=J[0].properties.cluster_id}return j}_appendLeaves(B,j,J,q,ot){const Et=this.getChildren(j);for(const gt of Et){const rt=gt.properties;if(rt&&rt.cluster?ot+rt.point_count<=q?ot+=rt.point_count:ot=this._appendLeaves(B,rt.cluster_id,J,q,ot):ot1;let qt,Zt,Ht;if(bt)qt=Me(j,rt,this.clusterProps),Zt=j[rt],Ht=j[rt+1];else{const Ie=this.points[j[rt+Be]];qt=Ie.properties;const[Fe,tn]=Ie.geometry.coordinates;Zt=yn(Fe),Ht=ni(tn)}const Ne={type:1,geometry:[[Math.round(this.options.extent*(Zt*ot-J)),Math.round(this.options.extent*(Ht*ot-q))]],tags:qt};let Ye;Ye=bt||this.options.generateId?j[rt+Be]:this.points[j[rt+Be]].id,Ye!==void 0&&(Ne.id=Ye),Et.features.push(Ne)}}_limitZoom(B){return Math.max(this.options.minZoom,Math.min(Math.floor(+B),this.options.maxZoom+1))}_cluster(B,j){const{radius:J,extent:q,reduce:ot,minPoints:Et}=this.options,gt=J/(q*Math.pow(2,j)),rt=B.data,bt=[],qt=this.stride;for(let Zt=0;Ztj&&(Fe+=rt[Un+fn])}if(Fe>Ie&&Fe>=Et){let tn,Un=Ht*Ie,Jn=Ne*Ie,An=-1;const Pn=((Zt/qt|0)<<5)+(j+1)+this.points.length;for(const jr of Ye){const ri=jr*qt;if(rt[ri+2]<=j)continue;rt[ri+2]=j;const nr=rt[ri+fn];Un+=rt[ri]*nr,Jn+=rt[ri+1]*nr,rt[ri+4]=Pn,ot&&(tn||(tn=this._map(rt,Zt,!0),An=this.clusterProps.length,this.clusterProps.push(tn)),ot(tn,this._map(rt,ri)))}rt[Zt+4]=Pn,bt.push(Un/Fe,Jn/Fe,1/0,Pn,-1,Fe),ot&&bt.push(An)}else{for(let tn=0;tn1)for(const tn of Ye){const Un=tn*qt;if(!(rt[Un+2]<=j)){rt[Un+2]=j;for(let Jn=0;Jn>5}_getOriginZoom(B){return(B-this.points.length)%32}_map(B,j,J){if(B[j+fn]>1){const Et=this.clusterProps[B[j+Mn]];return J?Object.assign({},Et):Et}const q=this.points[B[j+Be]].properties,ot=this.options.map(q);return J&&ot===q?Object.assign({},ot):ot}}function Wt(st,B,j){return{type:"Feature",id:st[B+Be],properties:Me(st,B,j),geometry:{type:"Point",coordinates:[(J=st[B],360*(J-.5)),_o(st[B+1])]}};var J}function Me(st,B,j){const J=st[B+fn],q=J>=1e4?`${Math.round(J/1e3)}k`:J>=1e3?Math.round(J/100)/10+"k":J,ot=st[B+Mn],Et=ot===-1?{}:Object.assign({},j[ot]);return Object.assign(Et,{cluster:!0,cluster_id:st[B+Be],point_count:J,point_count_abbreviated:q})}function yn(st){return st/360+.5}function ni(st){const B=Math.sin(st*Math.PI/180),j=.5-.25*Math.log((1+B)/(1-B))/Math.PI;return j<0?0:j>1?1:j}function _o(st){const B=(180-360*st)*Math.PI/180;return 360*Math.atan(Math.exp(B))/Math.PI-90}function tr(st,B,j,J){for(var q,ot=J,Et=j-B>>1,gt=j-B,rt=st[B],bt=st[B+1],qt=st[j],Zt=st[j+1],Ht=B+3;Htot)q=Ht,ot=Ne;else if(Ne===ot){var Ye=Math.abs(Ht-Et);YeJ&&(q-B>3&&tr(st,B,q,J),st[q+2]=ot,j-q>3&&tr(st,q,j,J))}function Ct(st,B,j,J,q,ot){var Et=q-j,gt=ot-J;if(Et!==0||gt!==0){var rt=((st-j)*Et+(B-J)*gt)/(Et*Et+gt*gt);rt>1?(j=q,J=ot):rt>0&&(j+=Et*rt,J+=gt*rt)}return(Et=st-j)*Et+(gt=B-J)*gt}function Ge(st,B,j,J){var q={id:st===void 0?null:st,type:B,geometry:j,tags:J,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(ot){var Et=ot.geometry,gt=ot.type;if(gt==="Point"||gt==="MultiPoint"||gt==="LineString")je(ot,Et);else if(gt==="Polygon"||gt==="MultiLineString")for(var rt=0;rt0&&(Et+=J?(q*bt-rt*ot)/2:Math.sqrt(Math.pow(rt-q,2)+Math.pow(bt-ot,2))),q=rt,ot=bt}var qt=B.length-3;B[2]=1,tr(B,0,qt,j),B[qt+2]=1,B.size=Math.abs(Et),B.start=0,B.end=B.size}function qi(st,B,j,J){for(var q=0;q1?1:j}function sr(st,B,j,J,q,ot,Et,gt){if(J/=B,ot>=(j/=B)&&Et=J)return null;for(var rt=[],bt=0;bt=j&&Ye=J)){var Ie=[];if(Ht==="Point"||Ht==="MultiPoint")On(Zt,Ie,j,J,q);else if(Ht==="LineString")En(Zt,Ie,j,J,q,!1,gt.lineMetrics);else if(Ht==="MultiLineString")ro(Zt,Ie,j,J,q,!1);else if(Ht==="Polygon")ro(Zt,Ie,j,J,q,!0);else if(Ht==="MultiPolygon")for(var Fe=0;Fe=j&&Et<=J&&(B.push(st[ot]),B.push(st[ot+1]),B.push(st[ot+2]))}}function En(st,B,j,J,q,ot,Et){for(var gt,rt,bt=ts(st),qt=q===0?Ha:Gs,Zt=st.start,Ht=0;Htj&&(rt=qt(bt,Ne,Ye,Fe,tn,j),Et&&(bt.start=Zt+gt*rt)):Un>J?Jn=j&&(rt=qt(bt,Ne,Ye,Fe,tn,j),An=!0),Jn>J&&Un<=J&&(rt=qt(bt,Ne,Ye,Fe,tn,J),An=!0),!ot&&An&&(Et&&(bt.end=Zt+gt*rt),B.push(bt),bt=ts(st)),Et&&(Zt+=gt)}var Pn=st.length-3;Ne=st[Pn],Ye=st[Pn+1],Ie=st[Pn+2],(Un=q===0?Ne:Ye)>=j&&Un<=J&&es(bt,Ne,Ye,Ie),Pn=bt.length-3,ot&&Pn>=3&&(bt[Pn]!==bt[0]||bt[Pn+1]!==bt[1])&&es(bt,bt[0],bt[1],bt[2]),bt.length&&B.push(bt)}function ts(st){var B=[];return B.size=st.size,B.start=st.start,B.end=st.end,B}function ro(st,B,j,J,q,ot){for(var Et=0;EtEt.maxX&&(Et.maxX=qt),Zt>Et.maxY&&(Et.maxY=Zt)}return Et}function Sa(st,B,j,J){var q=B.geometry,ot=B.type,Et=[];if(ot==="Point"||ot==="MultiPoint")for(var gt=0;gt0&&B.size<(q?Et:J))j.numPoints+=B.length/3;else{for(var gt=[],rt=0;rtEt)&&(j.numSimplified++,gt.push(B[rt]),gt.push(B[rt+1])),j.numPoints++;q&&function(bt,qt){for(var Zt=0,Ht=0,Ne=bt.length,Ye=Ne-2;Ht0===qt)for(Ht=0,Ne=bt.length;Ht24)throw new Error("maxZoom should be in the 0-24 range");if(B.promoteId&&B.generateId)throw new Error("promoteId and generateId cannot be used together.");var J=function(q,ot){var Et=[];if(q.type==="FeatureCollection")for(var gt=0;gt1&&console.time("creation"),Ht=this.tiles[Zt]=ii(st,B,j,J,rt),this.tileCoords.push({z:B,x:j,y:J}),bt)){bt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",B,j,J,Ht.numFeatures,Ht.numPoints,Ht.numSimplified),console.timeEnd("creation"));var Ne="z"+B;this.stats[Ne]=(this.stats[Ne]||0)+1,this.total++}if(Ht.source=st,q){if(B===rt.maxZoom||B===q)continue;var Ye=1<1&&console.time("clipping");var Ie,Fe,tn,Un,Jn,An,Pn=.5*rt.buffer/rt.extent,jr=.5-Pn,ri=.5+Pn,nr=1+Pn;Ie=Fe=tn=Un=null,Jn=sr(st,qt,j-Pn,j+ri,0,Ht.minX,Ht.maxX,rt),An=sr(st,qt,j+jr,j+nr,0,Ht.minX,Ht.maxX,rt),st=null,Jn&&(Ie=sr(Jn,qt,J-Pn,J+ri,1,Ht.minY,Ht.maxY,rt),Fe=sr(Jn,qt,J+jr,J+nr,1,Ht.minY,Ht.maxY,rt),Jn=null),An&&(tn=sr(An,qt,J-Pn,J+ri,1,Ht.minY,Ht.maxY,rt),Un=sr(An,qt,J+jr,J+nr,1,Ht.minY,Ht.maxY,rt),An=null),bt>1&&console.timeEnd("clipping"),gt.push(Ie||[],B+1,2*j,2*J),gt.push(Fe||[],B+1,2*j,2*J+1),gt.push(tn||[],B+1,2*j+1,2*J),gt.push(Un||[],B+1,2*j+1,2*J+1)}}},le.prototype.getTile=function(st,B,j){var J=this.options,q=J.extent,ot=J.debug;if(st<0||st>24)return null;var Et=1<1&&console.log("drilling down to z%d-%d-%d",st,B,j);for(var rt,bt=st,qt=B,Zt=j;!rt&&bt>0;)bt--,qt=Math.floor(qt/2),Zt=Math.floor(Zt/2),rt=this.tiles[cn(bt,qt,Zt)];return rt&&rt.source?(ot>1&&console.log("found parent tile z%d-%d-%d",bt,qt,Zt),ot>1&&console.time("drilling down"),this.splitTile(rt.source,bt,qt,Zt,st,B,j),ot>1&&console.timeEnd("drilling down"),this.tiles[gt]?se(this.tiles[gt],q):null):null};class en extends N{constructor(B,j,J,q){super(B,j,J),this._dataUpdateable=new Map,this.loadGeoJSON=(ot,Et)=>{const{promoteId:gt}=ot;if(ot.request)return a.f(ot.request,(rt,bt,qt,Zt)=>{this._dataUpdateable=Ar(bt,gt)?ns(bt,gt):void 0,Et(rt,bt,qt,Zt)});if(typeof ot.data=="string")try{const rt=JSON.parse(ot.data);this._dataUpdateable=Ar(rt,gt)?ns(rt,gt):void 0,Et(null,rt)}catch{Et(new Error(`Input data given to '${ot.source}' is not a valid GeoJSON object.`))}else ot.dataDiff?this._dataUpdateable?(function(rt,bt,qt){var Zt,Ht,Ne,Ye;if(bt.removeAll&&rt.clear(),bt.remove)for(const Ie of bt.remove)rt.delete(Ie);if(bt.add)for(const Ie of bt.add){const Fe=Ke(Ie,qt);Fe!=null&&rt.set(Fe,Ie)}if(bt.update)for(const Ie of bt.update){let Fe=rt.get(Ie.id);if(Fe==null)continue;const tn=!Ie.removeAllProperties&&(((Zt=Ie.removeProperties)===null||Zt===void 0?void 0:Zt.length)>0||((Ht=Ie.addOrUpdateProperties)===null||Ht===void 0?void 0:Ht.length)>0);if((Ie.newGeometry||Ie.removeAllProperties||tn)&&(Fe=Object.assign({},Fe),rt.set(Ie.id,Fe),tn&&(Fe.properties=Object.assign({},Fe.properties))),Ie.newGeometry&&(Fe.geometry=Ie.newGeometry),Ie.removeAllProperties)Fe.properties={};else if(((Ne=Ie.removeProperties)===null||Ne===void 0?void 0:Ne.length)>0)for(const Un of Ie.removeProperties)Object.prototype.hasOwnProperty.call(Fe.properties,Un)&&delete Fe.properties[Un];if(((Ye=Ie.addOrUpdateProperties)===null||Ye===void 0?void 0:Ye.length)>0)for(const{key:Un,value:Jn}of Ie.addOrUpdateProperties)Fe.properties[Un]=Jn}}(this._dataUpdateable,ot.dataDiff,gt),Et(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):Et(new Error(`Cannot update existing geojson data in ${ot.source}`)):Et(new Error(`Input data given to '${ot.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},this.loadVectorData=this.loadGeoJSONTile,q&&(this.loadGeoJSON=q)}loadGeoJSONTile(B,j){const J=B.tileID.canonical;if(!this._geoJSONIndex)return j(null,null);const q=this._geoJSONIndex.getTile(J.z,J.x,J.y);if(!q)return j(null,null);const ot=new class{constructor(gt){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.N,this.length=gt.length,this._features=gt}feature(gt){return new class{constructor(rt){this._feature=rt,this.extent=a.N,this.type=rt.type,this.properties=rt.tags,"id"in rt&&!isNaN(rt.id)&&(this.id=parseInt(rt.id,10))}loadGeometry(){if(this._feature.type===1){const rt=[];for(const bt of this._feature.geometry)rt.push([new a.P(bt[0],bt[1])]);return rt}{const rt=[];for(const bt of this._feature.geometry){const qt=[];for(const Zt of bt)qt.push(new a.P(Zt[0],Zt[1]));rt.push(qt)}return rt}}toGeoJSON(rt,bt,qt){return V.call(this,rt,bt,qt)}}(this._features[gt])}}(q.features);let Et=an(ot);Et.byteOffset===0&&Et.byteLength===Et.buffer.byteLength||(Et=new Uint8Array(Et)),j(null,{vectorTile:ot,rawData:Et.buffer})}loadData(B,j){var J;(J=this._pendingRequest)===null||J===void 0||J.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const q=!!(B&&B.request&&B.request.collectResourceTiming)&&new a.bu(B.request);this._pendingCallback=j,this._pendingRequest=this.loadGeoJSON(B,(ot,Et)=>{if(delete this._pendingCallback,delete this._pendingRequest,ot||!Et)return j(ot);if(typeof Et!="object")return j(new Error(`Input data given to '${B.source}' is not a valid GeoJSON object.`));{K(Et,!0);try{if(B.filter){const rt=a.bC(B.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(rt.result==="error")throw new Error(rt.value.map(qt=>`${qt.key}: ${qt.message}`).join(", "));Et={type:"FeatureCollection",features:Et.features.filter(qt=>rt.value.evaluate({zoom:0},qt))}}this._geoJSONIndex=B.cluster?new ln(function({superclusterOptions:rt,clusterProperties:bt}){if(!bt||!rt)return rt;const qt={},Zt={},Ht={accumulated:null,zoom:0},Ne={properties:null},Ye=Object.keys(bt);for(const Ie of Ye){const[Fe,tn]=bt[Ie],Un=a.bC(tn),Jn=a.bC(typeof Fe=="string"?[Fe,["accumulated"],["get",Ie]]:Fe);qt[Ie]=Un.value,Zt[Ie]=Jn.value}return rt.map=Ie=>{Ne.properties=Ie;const Fe={};for(const tn of Ye)Fe[tn]=qt[tn].evaluate(Ht,Ne);return Fe},rt.reduce=(Ie,Fe)=>{Ne.properties=Fe;for(const tn of Ye)Ht.accumulated=Ie[tn],Ie[tn]=Zt[tn].evaluate(Ht,Ne)},rt}(B)).load(Et.features):function(rt,bt){return new le(rt,bt)}(Et,B.geojsonVtOptions)}catch(rt){return j(rt)}this.loaded={};const gt={};if(q){const rt=q.finish();rt&&(gt.resourceTiming={},gt.resourceTiming[B.source]=JSON.parse(JSON.stringify(rt)))}j(null,gt)}})}reloadTile(B,j){const J=this.loaded;return J&&J[B.uid]?super.reloadTile(B,j):this.loadTile(B,j)}removeSource(B,j){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),j()}getClusterExpansionZoom(B,j){try{j(null,this._geoJSONIndex.getClusterExpansionZoom(B.clusterId))}catch(J){j(J)}}getClusterChildren(B,j){try{j(null,this._geoJSONIndex.getChildren(B.clusterId))}catch(J){j(J)}}getClusterLeaves(B,j){try{j(null,this._geoJSONIndex.getLeaves(B.clusterId,B.limit,B.offset))}catch(J){j(J)}}}class ws{constructor(B){this.self=B,this.actor=new a.C(B,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:N,geojson:en},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(j,J)=>{if(this.workerSourceTypes[j])throw new Error(`Worker source with name "${j}" already registered.`);this.workerSourceTypes[j]=J},this.self.registerRTLTextPlugin=j=>{if(a.bD.isParsed())throw new Error("RTL text plugin already registered.");a.bD.applyArabicShaping=j.applyArabicShaping,a.bD.processBidirectionalText=j.processBidirectionalText,a.bD.processStyledBidirectionalText=j.processStyledBidirectionalText}}setReferrer(B,j){this.referrer=j}setImages(B,j,J){this.availableImages[B]=j;for(const q in this.workerSources[B]){const ot=this.workerSources[B][q];for(const Et in ot)ot[Et].availableImages=j}J()}setLayers(B,j,J){this.getLayerIndex(B).replace(j),J()}updateLayers(B,j,J){this.getLayerIndex(B).update(j.layers,j.removedIds),J()}loadTile(B,j,J){this.getWorkerSource(B,j.type,j.source).loadTile(j,J)}loadDEMTile(B,j,J){this.getDEMWorkerSource(B,j.source).loadTile(j,J)}reloadTile(B,j,J){this.getWorkerSource(B,j.type,j.source).reloadTile(j,J)}abortTile(B,j,J){this.getWorkerSource(B,j.type,j.source).abortTile(j,J)}removeTile(B,j,J){this.getWorkerSource(B,j.type,j.source).removeTile(j,J)}removeDEMTile(B,j){this.getDEMWorkerSource(B,j.source).removeTile(j)}removeSource(B,j,J){if(!this.workerSources[B]||!this.workerSources[B][j.type]||!this.workerSources[B][j.type][j.source])return;const q=this.workerSources[B][j.type][j.source];delete this.workerSources[B][j.type][j.source],q.removeSource!==void 0?q.removeSource(j,J):J()}loadWorkerSource(B,j,J){try{this.self.importScripts(j.url),J()}catch(q){J(q.toString())}}syncRTLPluginState(B,j,J){try{a.bD.setState(j);const q=a.bD.getPluginURL();if(a.bD.isLoaded()&&!a.bD.isParsed()&&q!=null){this.self.importScripts(q);const ot=a.bD.isParsed();J(ot?void 0:new Error(`RTL Text Plugin failed to import scripts from ${q}`),ot)}}catch(q){J(q.toString())}}getAvailableImages(B){let j=this.availableImages[B];return j||(j=[]),j}getLayerIndex(B){let j=this.layerIndexes[B];return j||(j=this.layerIndexes[B]=new _),j}getWorkerSource(B,j,J){return this.workerSources[B]||(this.workerSources[B]={}),this.workerSources[B][j]||(this.workerSources[B][j]={}),this.workerSources[B][j][J]||(this.workerSources[B][j][J]=new this.workerSourceTypes[j]({send:(q,ot,Et)=>{this.actor.send(q,ot,Et,B)}},this.getLayerIndex(B),this.getAvailableImages(B))),this.workerSources[B][j][J]}getDEMWorkerSource(B,j){return this.demWorkerSources[B]||(this.demWorkerSources[B]={}),this.demWorkerSources[B][j]||(this.demWorkerSources[B][j]=new O),this.demWorkerSources[B][j]}}return a.i()&&(self.worker=new ws(self)),ws}),u(["./shared"],function(a){var _="3.6.2";class x{static testProp(s){if(!x.docStyle)return s[0];for(let h=0;h{window.removeEventListener("click",x.suppressClickInternal,!0)},0)}static mousePos(s,h){const d=s.getBoundingClientRect();return new a.P(h.clientX-d.left-s.clientLeft,h.clientY-d.top-s.clientTop)}static touchPos(s,h){const d=s.getBoundingClientRect(),g=[];for(let b=0;b{s=[],h=0,d=0,g={}},y.addThrottleControl=k=>{const R=d++;return g[R]=k,R},y.removeThrottleControl=k=>{delete g[k],C()},y.getImage=(k,R,z=!0)=>{S.supported&&(k.headers||(k.headers={}),k.headers.accept="image/webp,*/*");const W={requestParameters:k,supportImageRefresh:z,callback:R,cancelled:!1,completed:!1,cancel:()=>{W.completed||W.cancelled||(W.cancelled=!0,W.innerRequest&&(W.innerRequest.cancel(),h--),C())}};return s.push(W),C(),W};const b=k=>{const{requestParameters:R,supportImageRefresh:z,callback:W}=k;return a.e(R,{type:"image"}),(z!==!1||a.i()||a.g(R.url)||R.headers&&!Object.keys(R.headers).reduce((nt,et)=>nt&&et==="accept",!0)?a.m:M)(R,(nt,et,at,$)=>{I(k,W,nt,et,at,$)})},I=(k,R,z,W,nt,et)=>{z?R(z):W instanceof HTMLImageElement||a.a(W)?R(null,W):W&&((at,$)=>{typeof createImageBitmap=="function"?a.b(at,$):a.d(at,$)})(W,(at,$)=>{at!=null?R(at):$!=null&&R(null,$,{cacheControl:nt,expires:et})}),k.cancelled||(k.completed=!0,h--,C())},C=()=>{const k=(()=>{const R=Object.keys(g);let z=!1;if(R.length>0){for(const W of R)if(z=g[W](),z)break}return z})()?a.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:a.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let R=h;R0;R++){const z=s.shift();if(z.cancelled){R--;continue}const W=b(z);h++,z.innerRequest=W}},M=(k,R)=>{const z=new Image,W=k.url;let nt=!1;const et=k.credentials;return et&&et==="include"?z.crossOrigin="use-credentials":(et&&et==="same-origin"||!a.s(W))&&(z.crossOrigin="anonymous"),z.fetchPriority="high",z.onload=()=>{R(null,z),z.onerror=z.onload=null},z.onerror=()=>{nt||R(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")),z.onerror=z.onload=null},z.src=W,{cancel:()=>{nt=!0,z.src=""}}}}(G||(G={})),G.resetRequestQueue(),function(y){y.Glyphs="Glyphs",y.Image="Image",y.Source="Source",y.SpriteImage="SpriteImage",y.SpriteJSON="SpriteJSON",y.Style="Style",y.Tile="Tile",y.Unknown="Unknown"}(K||(K={}));class V{constructor(s){this._transformRequestFn=s}transformRequest(s,h){return this._transformRequestFn&&this._transformRequestFn(s,h)||{url:s}}normalizeSpriteURL(s,h,d){const g=function(b){const I=b.match(H);if(!I)throw new Error(`Unable to parse URL "${b}"`);return{protocol:I[1],authority:I[2],path:I[3]||"/",params:I[4]?I[4].split("&"):[]}}(s);return g.path+=`${h}${d}`,function(b){const I=b.params.length?`?${b.params.join("&")}`:"";return`${b.protocol}://${b.authority}${b.path}${I}`}(g)}setTransformRequest(s){this._transformRequestFn=s}}const H=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Q(y){var s=new a.A(3);return s[0]=y[0],s[1]=y[1],s[2]=y[2],s}var it,ht=function(y,s,h){return y[0]=s[0]-h[0],y[1]=s[1]-h[1],y[2]=s[2]-h[2],y};it=new a.A(3),a.A!=Float32Array&&(it[0]=0,it[1]=0,it[2]=0);var ft=function(y){var s=y[0],h=y[1];return s*s+h*h};function dt(y){const s=[];if(typeof y=="string")s.push({id:"default",url:y});else if(y&&y.length>0){const h=[];for(const{id:d,url:g}of y){const b=`${d}${g}`;h.indexOf(b)===-1&&(h.push(b),s.push({id:d,url:g}))}}return s}function ut(y,s,h,d,g){if(d)return void y(d);if(g!==Object.values(s).length||g!==Object.values(h).length)return;const b={};for(const I in s){b[I]={};const C=a.h.getImageCanvasContext(h[I]),M=s[I];for(const k in M){const{width:R,height:z,x:W,y:nt,sdf:et,pixelRatio:at,stretchX:$,stretchY:St,content:Ot}=M[k];b[I][k]={data:null,pixelRatio:at,sdf:et,stretchX:$,stretchY:St,content:Ot,spriteData:{width:R,height:z,x:W,y:nt,context:C}}}}y(null,b)}(function(){var y=new a.A(2);a.A!=Float32Array&&(y[0]=0,y[1]=0)})();class Mt{constructor(s,h,d,g){this.context=s,this.format=d,this.texture=s.gl.createTexture(),this.update(h,g)}update(s,h,d){const{width:g,height:b}=s,I=!(this.size&&this.size[0]===g&&this.size[1]===b||d),{context:C}=this,{gl:M}=C;if(this.useMipmap=!!(h&&h.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),C.pixelStoreUnpackFlipY.set(!1),C.pixelStoreUnpack.set(1),C.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!h||h.premultiply!==!1)),I)this.size=[g,b],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||a.a(s)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,s):M.texImage2D(M.TEXTURE_2D,0,this.format,g,b,0,this.format,M.UNSIGNED_BYTE,s.data);else{const{x:k,y:R}=d||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||a.a(s)?M.texSubImage2D(M.TEXTURE_2D,0,k,R,M.RGBA,M.UNSIGNED_BYTE,s):M.texSubImage2D(M.TEXTURE_2D,0,k,R,g,b,M.RGBA,M.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D)}bind(s,h,d){const{context:g}=this,{gl:b}=g;b.bindTexture(b.TEXTURE_2D,this.texture),d!==b.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=b.LINEAR),s!==this.filter&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,s),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,d||s),this.filter=s),h!==this.wrap&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,h),b.texParameteri(b.TEXTURE_2D,b.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:s}=this.context;s.deleteTexture(this.texture),this.texture=null}}function xt(y){const{userImage:s}=y;return!!(s&&s.render&&s.render())&&(y.data.replace(new Uint8Array(s.data.buffer)),!0)}class yt 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(s){if(this.loaded!==s&&(this.loaded=s,s)){for(const{ids:h,callback:d}of this.requestors)this._notify(h,d);this.requestors=[]}}getImage(s){const h=this.images[s];if(h&&!h.data&&h.spriteData){const d=h.spriteData;h.data=new a.R({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),h.spriteData=null}return h}addImage(s,h){if(this.images[s])throw new Error(`Image id ${s} already exist, use updateImage instead`);this._validate(s,h)&&(this.images[s]=h)}_validate(s,h){let d=!0;const g=h.data||h.spriteData;return this._validateStretch(h.stretchX,g&&g.width)||(this.fire(new a.j(new Error(`Image "${s}" has invalid "stretchX" value`))),d=!1),this._validateStretch(h.stretchY,g&&g.height)||(this.fire(new a.j(new Error(`Image "${s}" has invalid "stretchY" value`))),d=!1),this._validateContent(h.content,h)||(this.fire(new a.j(new Error(`Image "${s}" has invalid "content" value`))),d=!1),d}_validateStretch(s,h){if(!s)return!0;let d=0;for(const g of s){if(g[0]-1);M++,b[M]=C,I[M]=k,I[M+1]=de}for(let C=0,M=0;C{let C=this.entries[g];C||(C=this.entries[g]={glyphs:{},requests:{},ranges:{}});let M=C.glyphs[b];if(M!==void 0)return void I(null,{stack:g,id:b,glyph:M});if(M=this._tinySDF(C,g,b),M)return C.glyphs[b]=M,void I(null,{stack:g,id:b,glyph:M});const k=Math.floor(b/256);if(256*k>65535)return void I(new Error("glyphs > 65535 not supported"));if(C.ranges[k])return void I(null,{stack:g,id:b,glyph:M});if(!this.url)return void I(new Error("glyphsUrl is not set"));let R=C.requests[k];R||(R=C.requests[k]=[],Kt.loadGlyphRange(g,k,this.url,this.requestManager,(z,W)=>{if(W){for(const nt in W)this._doesCharSupportLocalGlyph(+nt)||(C.glyphs[+nt]=W[+nt]);C.ranges[k]=!0}for(const nt of R)nt(z,W);delete C.requests[k]})),R.push((z,W)=>{z?I(z):W&&I(null,{stack:g,id:b,glyph:W[b]||null})})},(g,b)=>{if(g)h(g);else if(b){const I={};for(const{stack:C,id:M,glyph:k}of b)(I[C]||(I[C]={}))[M]=k&&{id:k.id,bitmap:k.bitmap.clone(),metrics:k.metrics};h(null,I)}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&(a.u["CJK Unified Ideographs"](s)||a.u["Hangul Syllables"](s)||a.u.Hiragana(s)||a.u.Katakana(s))}_tinySDF(s,h,d){const g=this.localIdeographFontFamily;if(!g||!this._doesCharSupportLocalGlyph(d))return;let b=s.tinySDF;if(!b){let C="400";/bold/i.test(h)?C="900":/medium/i.test(h)?C="500":/light/i.test(h)&&(C="200"),b=s.tinySDF=new Kt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:C})}const I=b.draw(String.fromCharCode(d));return{id:d,bitmap:new a.q({width:I.width||60,height:I.height||60},I.data),metrics:{width:I.glyphWidth/2||24,height:I.glyphHeight/2||24,left:I.glyphLeft/2+.5||0,top:I.glyphTop/2-27.5||-8,advance:I.glyphAdvance/2||24,isDoubleResolution:!0}}}}Kt.loadGlyphRange=function(y,s,h,d,g){const b=256*s,I=b+255,C=d.transformRequest(h.replace("{fontstack}",y).replace("{range}",`${b}-${I}`),K.Glyphs);a.l(C,(M,k)=>{if(M)g(M);else if(k){const R={};for(const z of a.n(k))R[z.id]=z;g(null,R)}})},Kt.TinySDF=class{constructor({fontSize:y=24,buffer:s=3,radius:h=8,cutoff:d=.25,fontFamily:g="sans-serif",fontWeight:b="normal",fontStyle:I="normal"}={}){this.buffer=s,this.cutoff=d,this.radius=h;const C=this.size=y+4*s,M=this._createCanvas(C),k=this.ctx=M.getContext("2d",{willReadFrequently:!0});k.font=`${I} ${b} ${y}px ${g}`,k.textBaseline="alphabetic",k.textAlign="left",k.fillStyle="black",this.gridOuter=new Float64Array(C*C),this.gridInner=new Float64Array(C*C),this.f=new Float64Array(C),this.z=new Float64Array(C+1),this.v=new Uint16Array(C)}_createCanvas(y){const s=document.createElement("canvas");return s.width=s.height=y,s}draw(y){const{width:s,actualBoundingBoxAscent:h,actualBoundingBoxDescent:d,actualBoundingBoxLeft:g,actualBoundingBoxRight:b}=this.ctx.measureText(y),I=Math.ceil(h),C=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(b-g))),M=Math.min(this.size-this.buffer,I+Math.ceil(d)),k=C+2*this.buffer,R=M+2*this.buffer,z=Math.max(k*R,0),W=new Uint8ClampedArray(z),nt={data:W,width:k,height:R,glyphWidth:C,glyphHeight:M,glyphTop:I,glyphLeft:0,glyphAdvance:s};if(C===0||M===0)return nt;const{ctx:et,buffer:at,gridInner:$,gridOuter:St}=this;et.clearRect(at,at,C,M),et.fillText(y,at,at+I);const Ot=et.getImageData(at,at,C,M);St.fill(de,0,z),$.fill(0,0,z);for(let ct=0;ct0?Xt*Xt:0,$[Vt]=Xt<0?Xt*Xt:0}}Rt(St,0,0,k,R,k,this.f,this.v,this.z),Rt($,at,at,C,M,k,this.f,this.v,this.z);for(let ct=0;ct1&&(M=s[++C]);const R=Math.abs(k-M.left),z=Math.abs(k-M.right),W=Math.min(R,z);let nt;const et=b/d*(g+1);if(M.isDash){const at=g-Math.abs(et);nt=Math.sqrt(W*W+at*at)}else nt=g-Math.sqrt(W*W+et*et);this.data[I+k]=Math.max(0,Math.min(255,nt+128))}}}addRegularDash(s){for(let C=s.length-1;C>=0;--C){const M=s[C],k=s[C+1];M.zeroLength?s.splice(C,1):k&&k.isDash===M.isDash&&(k.left=M.left,s.splice(C,1))}const h=s[0],d=s[s.length-1];h.isDash===d.isDash&&(h.left=d.left-this.width,d.right=h.right+this.width);const g=this.width*this.nextRow;let b=0,I=s[b];for(let C=0;C1&&(I=s[++b]);const M=Math.abs(C-I.left),k=Math.abs(C-I.right),R=Math.min(M,k);this.data[g+C]=Math.max(0,Math.min(255,(I.isDash?R:-R)+128))}}addDash(s,h){const d=h?7:0,g=2*d+1;if(this.nextRow+g>this.height)return a.w("LineAtlas out of space"),null;let b=0;for(let C=0;C{g.send(s,h,b)},d=d||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(s=!0){this.actors.forEach(h=>{h.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}}function ke(y,s,h){const d=function(g,b){if(g)return h(g);if(b){const I=a.F(a.e(b,y),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);b.vector_layers&&(I.vectorLayers=b.vector_layers,I.vectorLayerIds=I.vectorLayers.map(C=>C.id)),h(null,I)}};return y.url?a.f(s.transformRequest(y.url,K.Source),d):a.h.frame(()=>d(null,y))}class Be{constructor(s,h){s&&(h?this.setSouthWest(s).setNorthEast(h):Array.isArray(s)&&(s.length===4?this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]]):this.setSouthWest(s[0]).setNorthEast(s[1])))}setNorthEast(s){return this._ne=s instanceof a.L?new a.L(s.lng,s.lat):a.L.convert(s),this}setSouthWest(s){return this._sw=s instanceof a.L?new a.L(s.lng,s.lat):a.L.convert(s),this}extend(s){const h=this._sw,d=this._ne;let g,b;if(s instanceof a.L)g=s,b=s;else{if(!(s instanceof Be))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(Be.convert(s)):this.extend(a.L.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(a.L.convert(s)):this;if(g=s._sw,b=s._ne,!g||!b)return this}return h||d?(h.lng=Math.min(g.lng,h.lng),h.lat=Math.min(g.lat,h.lat),d.lng=Math.max(b.lng,d.lng),d.lat=Math.max(b.lat,d.lat)):(this._sw=new a.L(g.lng,g.lat),this._ne=new a.L(b.lng,b.lat)),this}getCenter(){return new a.L((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.L(this.getWest(),this.getNorth())}getSouthEast(){return new a.L(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(s){const{lng:h,lat:d}=a.L.convert(s);let g=this._sw.lng<=h&&h<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=h&&h>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&g}static convert(s){return s instanceof Be?s:s&&new Be(s)}static fromLngLat(s,h=0){const d=360*h/40075017,g=d/Math.cos(Math.PI/180*s.lat);return new Be(new a.L(s.lng-g,s.lat-d),new a.L(s.lng+g,s.lat+d))}}class fn{constructor(s,h,d){this.bounds=Be.convert(this.validateBounds(s)),this.minzoom=h||0,this.maxzoom=d||24}validateBounds(s){return Array.isArray(s)&&s.length===4?[Math.max(-180,s[0]),Math.max(-90,s[1]),Math.min(180,s[2]),Math.min(90,s[3])]:[-180,-90,180,90]}contains(s){const h=Math.pow(2,s.z),d=Math.floor(a.G(this.bounds.getWest())*h),g=Math.floor(a.H(this.bounds.getNorth())*h),b=Math.ceil(a.G(this.bounds.getEast())*h),I=Math.ceil(a.H(this.bounds.getSouth())*h);return s.x>=d&&s.x=g&&s.y{this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this._tileJSONRequest=ke(this._options,this.map._requestManager,(b,I)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),b?this.fire(new a.j(b)):I&&(a.e(this,I),I.bounds&&(this.tileBounds=new fn(I.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"})))})},this.serialize=()=>a.e({},this._options),this.id=s,this.dispatcher=d,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.e(this,a.F(h,["url","scheme","tileSize","promoteId"])),this._options=a.e({type:"vector"},h),this._collectResourceTiming=h.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(g)}loaded(){return this._loaded}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}onAdd(s){this.map=s,this.load()}setSourceProperty(s){this._tileJSONRequest&&this._tileJSONRequest.cancel(),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(s,h){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),g={request:this.map._requestManager.transformRequest(d,K.Tile),uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function b(I,C){return delete s.request,s.aborted?h(null):I&&I.status!==404?h(I):(C&&C.resourceTiming&&(s.resourceTiming=C.resourceTiming),this.map._refreshExpiredTiles&&C&&s.setExpiryData(C),s.loadVectorData(C,this.map.painter),h(null),void(s.reloadCallback&&(this.loadTile(s,s.reloadCallback),s.reloadCallback=null)))}g.request.collectResourceTiming=this._collectResourceTiming,s.actor&&s.state!=="expired"?s.state==="loading"?s.reloadCallback=h:s.request=s.actor.send("reloadTile",g,b.bind(this)):(s.actor=this.dispatcher.getActor(),s.request=s.actor.send("loadTile",g,b.bind(this)))}abortTile(s){s.request&&(s.request.cancel(),delete s.request),s.actor&&s.actor.send("abortTile",{uid:s.uid,type:this.type,source:this.id},void 0)}unloadTile(s){s.unloadVectorData(),s.actor&&s.actor.send("removeTile",{uid:s.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class ln extends a.E{constructor(s,h,d,g){super(),this.id=s,this.dispatcher=d,this.setEventedParent(g),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.F(h,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this._tileJSONRequest=ke(this._options,this.map._requestManager,(s,h)=>{this._tileJSONRequest=null,this._loaded=!0,s?this.fire(new a.j(s)):h&&(a.e(this,h),h.bounds&&(this.tileBounds=new fn(h.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"})))})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}setSourceProperty(s){this._tileJSONRequest&&this._tileJSONRequest.cancel(),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}serialize(){return a.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s,h){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);s.request=G.getImage(this.map._requestManager.transformRequest(d,K.Tile),(g,b,I)=>{if(delete s.request,s.aborted)s.state="unloaded",h(null);else if(g)s.state="errored",h(g);else if(b){this.map._refreshExpiredTiles&&I&&s.setExpiryData(I);const C=this.map.painter.context,M=C.gl;s.texture=this.map.painter.getTileTexture(b.width),s.texture?s.texture.update(b,{useMipmap:!0}):(s.texture=new Mt(C,b,M.RGBA,{useMipmap:!0}),s.texture.bind(M.LINEAR,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST),C.extTextureFilterAnisotropic&&M.texParameterf(M.TEXTURE_2D,C.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,C.extTextureFilterAnisotropicMax)),s.state="loaded",h(null)}},this.map._refreshExpiredTiles)}abortTile(s,h){s.request&&(s.request.cancel(),delete s.request),h()}unloadTile(s,h){s.texture&&this.map.painter.saveTileTexture(s.texture),h()}hasTransition(){return!1}}class Wt extends ln{constructor(s,h,d,g){super(s,h,d,g),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(s,h){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),g=this.map._requestManager.transformRequest(d,K.Tile);function b(I,C){I&&(s.state="errored",h(I)),C&&(s.dem=C,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded",h(null))}s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.request=G.getImage(g,(I,C,M)=>a._(this,void 0,void 0,function*(){if(delete s.request,s.aborted)s.state="unloaded",h(null);else if(I)s.state="errored",h(I);else if(C){this.map._refreshExpiredTiles&&s.setExpiryData(M);const k=a.a(C)&&a.J()?C:yield function(z){return a._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&a.K()){const W=z.width+2,nt=z.height+2;try{return new a.R({width:W,height:nt},yield a.M(z,-1,-1,W,nt))}catch{}}return a.h.getImageData(z,1)})}(C),R={uid:s.uid,coord:s.tileID,source:this.id,rawImageData:k,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};s.actor&&s.state!=="expired"||(s.actor=this.dispatcher.getActor(),s.actor.send("loadDEMTile",R,b))}}),this.map._refreshExpiredTiles)}_getNeighboringTiles(s){const h=s.canonical,d=Math.pow(2,h.z),g=(h.x-1+d)%d,b=h.x===0?s.wrap-1:s.wrap,I=(h.x+1+d)%d,C=h.x+1===d?s.wrap+1:s.wrap,M={};return M[new a.O(s.overscaledZ,b,h.z,g,h.y).key]={backfilled:!1},M[new a.O(s.overscaledZ,C,h.z,I,h.y).key]={backfilled:!1},h.y>0&&(M[new a.O(s.overscaledZ,b,h.z,g,h.y-1).key]={backfilled:!1},M[new a.O(s.overscaledZ,s.wrap,h.z,h.x,h.y-1).key]={backfilled:!1},M[new a.O(s.overscaledZ,C,h.z,I,h.y-1).key]={backfilled:!1}),h.y+1{this._updateWorkerData()},this.serialize=()=>a.e({},this._options,{type:this.type,data:this._data}),this.id=s,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=d.getActor(),this.setEventedParent(g),this._data=h.data,this._options=a.e({},h),this._collectResourceTiming=h.collectResourceTiming,h.maxzoom!==void 0&&(this.maxzoom=h.maxzoom),h.type&&(this.type=h.type),h.attribution&&(this.attribution=h.attribution),this.promoteId=h.promoteId;const b=a.N/this.tileSize;this.workerOptions=a.e({source:this.id,cluster:h.cluster||!1,geojsonVtOptions:{buffer:(h.buffer!==void 0?h.buffer:128)*b,tolerance:(h.tolerance!==void 0?h.tolerance:.375)*b,extent:a.N,maxZoom:this.maxzoom,lineMetrics:h.lineMetrics||!1,generateId:h.generateId||!1},superclusterOptions:{maxZoom:h.clusterMaxZoom!==void 0?h.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,h.clusterMinPoints||2),extent:a.N,radius:(h.clusterRadius||50)*b,log:!1,generateId:h.generateId||!1},clusterProperties:h.clusterProperties,filter:h.filter},h.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(s){this.map=s,this.load()}setData(s){return this._data=s,this._updateWorkerData(),this}updateData(s){return this._updateWorkerData(s),this}setClusterOptions(s){return this.workerOptions.cluster=s.cluster,s&&(s.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=s.clusterRadius),s.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=s.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(s,h){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:s,source:this.id},h),this}getClusterChildren(s,h){return this.actor.send("geojson.getClusterChildren",{clusterId:s,source:this.id},h),this}getClusterLeaves(s,h,d,g){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:s,limit:h,offset:d},g),this}_updateWorkerData(s){const h=a.e({},this.workerOptions);s?h.dataDiff=s:typeof this._data=="string"?(h.request=this.map._requestManager.transformRequest(a.h.resolveURL(this._data),K.Source),h.request.collectResourceTiming=this._collectResourceTiming):h.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new a.k("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,h,(d,g)=>{if(this._pendingLoads--,this._removed||g&&g.abandoned)return void this.fire(new a.k("dataabort",{dataType:"source"}));let b=null;if(g&&g.resourceTiming&&g.resourceTiming[this.id]&&(b=g.resourceTiming[this.id].slice(0)),d)return void this.fire(new a.j(d));const I={dataType:"source"};this._collectResourceTiming&&b&&b.length>0&&a.e(I,{resourceTiming:b}),this.fire(new a.k("data",Object.assign(Object.assign({},I),{sourceDataType:"metadata"}))),this.fire(new a.k("data",Object.assign(Object.assign({},I),{sourceDataType:"content"})))})}loaded(){return this._pendingLoads===0}loadTile(s,h){const d=s.actor?"reloadTile":"loadTile";s.actor=this.actor;const g={type:this.type,uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.request=this.actor.send(d,g,(b,I)=>(delete s.request,s.unloadVectorData(),s.aborted?h(null):b?h(b):(s.loadVectorData(I,this.map.painter,d==="reloadTile"),h(null))))}abortTile(s){s.request&&(s.request.cancel(),delete s.request),s.aborted=!0}unloadTile(s){s.unloadVectorData(),this.actor.send("removeTile",{uid:s.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}}var yn=a.Q([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class ni extends a.E{constructor(s,h,d,g){super(),this.load=(b,I)=>{this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=G.getImage(this.map._requestManager.transformRequest(this.url,K.Image),(C,M)=>{this._request=null,this._loaded=!0,C?this.fire(new a.j(C)):M&&(this.image=M,b&&(this.coordinates=b),I&&I(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||!this.image)return;const b=this.map.painter.context,I=b.gl;this.boundsBuffer||(this.boundsBuffer=b.createVertexBuffer(this._boundsArray,yn.members)),this.boundsSegments||(this.boundsSegments=a.S.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Mt(b,this.image,I.RGBA),this.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE));let C=!1;for(const M in this.tiles){const k=this.tiles[M];k.state!=="loaded"&&(k.state="loaded",k.texture=this.texture,C=!0)}C&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=s,this.dispatcher=d,this.coordinates=h.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(g),this.options=h}loaded(){return this._loaded}updateImage(s){return s.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=s.url,this.load(s.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(s){this.coordinates=s;const h=s.map(a.U.fromLngLat);this.tileID=function(g){let b=1/0,I=1/0,C=-1/0,M=-1/0;for(const W of g)b=Math.min(b,W.x),I=Math.min(I,W.y),C=Math.max(C,W.x),M=Math.max(M,W.y);const k=Math.max(C-b,M-I),R=Math.max(0,Math.floor(-Math.log(k)/Math.LN2)),z=Math.pow(2,R);return new a.W(R,Math.floor((b+C)/2*z),Math.floor((I+M)/2*z))}(h),this.minzoom=this.maxzoom=this.tileID.z;const d=h.map(g=>this.tileID.getTilePoint(g)._round());return this._boundsArray=new a.V,this._boundsArray.emplaceBack(d[0].x,d[0].y,0,0),this._boundsArray.emplaceBack(d[1].x,d[1].y,a.N,0),this._boundsArray.emplaceBack(d[3].x,d[3].y,0,a.N),this._boundsArray.emplaceBack(d[2].x,d[2].y,a.N,a.N),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new a.k("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(s,h){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={},h(null)):(s.state="errored",h(null))}hasTransition(){return!1}}class _o extends ni{constructor(s,h,d,g){super(s,h,d,g),this.load=()=>{this._loaded=!1;const b=this.options;this.urls=[];for(const I of b.urls)this.urls.push(this.map._requestManager.transformRequest(I,K.Source).url);a.X(this.urls,(I,C)=>{this._loaded=!0,I?this.fire(new a.j(I)):C&&(this.video=C,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const b=this.map.painter.context,I=b.gl;this.boundsBuffer||(this.boundsBuffer=b.createVertexBuffer(this._boundsArray,yn.members)),this.boundsSegments||(this.boundsSegments=a.S.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE),I.texSubImage2D(I.TEXTURE_2D,0,0,0,I.RGBA,I.UNSIGNED_BYTE,this.video)):(this.texture=new Mt(b,this.video,I.RGBA),this.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE));let C=!1;for(const M in this.tiles){const k=this.tiles[M];k.state!=="loaded"&&(k.state="loaded",k.texture=this.texture,C=!0)}C&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=h}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){const h=this.video.seekable;sh.end(0)?this.fire(new a.j(new a.Y(`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=s}}getVideo(){return this.video}onAdd(s){this.map||(this.map=s,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}}class tr extends ni{constructor(s,h,d,g){super(s,h,d,g),this.load=()=>{this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new 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())},this.prepare=()=>{let b=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,b=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,b=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const I=this.map.painter.context,C=I.gl;this.boundsBuffer||(this.boundsBuffer=I.createVertexBuffer(this._boundsArray,yn.members)),this.boundsSegments||(this.boundsSegments=a.S.simpleSegment(0,0,4,2)),this.texture?(b||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Mt(I,this.canvas,C.RGBA,{premultiply:!0});let M=!1;for(const k in this.tiles){const R=this.tiles[k];R.state!=="loaded"&&(R.state="loaded",R.texture=this.texture,M=!0)}M&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),h.coordinates?Array.isArray(h.coordinates)&&h.coordinates.length===4&&!h.coordinates.some(b=>!Array.isArray(b)||b.length!==2||b.some(I=>typeof I!="number"))||this.fire(new a.j(new a.Y(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.j(new a.Y(`sources.${s}`,null,'missing required property "coordinates"'))),h.animate&&typeof h.animate!="boolean"&&this.fire(new a.j(new a.Y(`sources.${s}`,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.Y(`sources.${s}`,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.Y(`sources.${s}`,null,'missing required property "canvas"'))),this.options=h,this.animate=h.animate===void 0||h.animate}getCanvas(){return this.canvas}onAdd(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const s of[this.canvas.width,this.canvas.height])if(isNaN(s)||s<=0)return!0;return!1}}const Ct={},Ge=y=>{switch(y){case"geojson":return Me;case"image":return ni;case"raster":return ln;case"raster-dem":return Wt;case"vector":return Mn;case"video":return _o;case"canvas":return tr}return Ct[y]};function je(y,s){const h=a.Z();return a.$(h,h,[1,1,0]),a.a0(h,h,[.5*y.width,.5*y.height,1]),a.a1(h,h,y.calculatePosMatrix(s.toUnwrapped()))}function er(y,s,h,d,g,b){const I=function(z,W,nt){if(z)for(const et of z){const at=W[et];if(at&&at.source===nt&&at.type==="fill-extrusion")return!0}else for(const et in W){const at=W[et];if(at.source===nt&&at.type==="fill-extrusion")return!0}return!1}(g&&g.layers,s,y.id),C=b.maxPitchScaleFactor(),M=y.tilesIn(d,C,I);M.sort(Xn);const k=[];for(const z of M)k.push({wrappedTileID:z.tileID.wrapped().key,queryResults:z.tile.queryRenderedFeatures(s,h,y._state,z.queryGeometry,z.cameraQueryGeometry,z.scale,g,b,C,je(y.transform,z.tileID))});const R=function(z){const W={},nt={};for(const et of z){const at=et.queryResults,$=et.wrappedTileID,St=nt[$]=nt[$]||{};for(const Ot in at){const ct=at[Ot],It=St[Ot]=St[Ot]||{},Bt=W[Ot]=W[Ot]||[];for(const Vt of ct)It[Vt.featureIndex]||(It[Vt.featureIndex]=!0,Bt.push(Vt))}}return W}(k);for(const z in R)R[z].forEach(W=>{const nt=W.feature,et=y.getFeatureState(nt.layer["source-layer"],nt.id);nt.source=nt.layer.source,nt.layer["source-layer"]&&(nt.sourceLayer=nt.layer["source-layer"]),nt.state=et});return R}function Xn(y,s){const h=y.tileID,d=s.tileID;return h.overscaledZ-d.overscaledZ||h.canonical.y-d.canonical.y||h.wrap-d.wrap||h.canonical.x-d.canonical.x}class dn{constructor(s,h){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=a.a2(),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(s){const h=s+this.timeAdded;hb.getLayer(k)).filter(Boolean);if(M.length!==0){C.layers=M,C.stateDependentLayerIds&&(C.stateDependentLayers=C.stateDependentLayerIds.map(k=>M.filter(R=>R.id===k)[0]));for(const k of M)I[k.id]=C}}return I}(s.buckets,h.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const b=this.buckets[g];if(b instanceof a.a4){if(this.hasSymbolBuckets=!0,!d)break;b.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const b=this.buckets[g];if(b instanceof a.a4&&b.hasRTLText){this.hasRTLText=!0,a.a5();break}}this.queryPadding=0;for(const g in this.buckets){const b=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,h.style.getLayer(g).queryRadius(b))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new a.a3}unloadVectorData(){for(const s in this.buckets)this.buckets[s].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(s){return this.buckets[s.id]}upload(s){for(const d in this.buckets){const g=this.buckets[d];g.uploadPending()&&g.upload(s)}const h=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Mt(s,this.imageAtlas.image,h.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Mt(s,this.glyphAtlasImage,h.ALPHA),this.glyphAtlasImage=null)}prepare(s){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(s,this.imageAtlasTexture)}queryRenderedFeatures(s,h,d,g,b,I,C,M,k,R){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:g,cameraQueryGeometry:b,scale:I,tileSize:this.tileSize,pixelPosMatrix:R,transform:M,params:C,queryPadding:this.queryPadding*k},s,h,d):{}}querySourceFeatures(s,h){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const g=d.loadVTLayers(),b=h&&h.sourceLayer?h.sourceLayer:"",I=g._geojsonTileLayer||g[b];if(!I)return;const C=a.a6(h&&h.filter),{z:M,x:k,y:R}=this.tileID.canonical,z={z:M,x:k,y:R};for(let W=0;Wd)g=!1;else if(h)if(this.expirationTime{this.remove(s,b)},d)),this.data[g].push(b),this.order.push(g),this.order.length>this.max){const I=this._getAndRemoveByKey(this.order[0]);I&&this.onRemove(I)}return this}has(s){return s.wrapped().key in this.data}getAndRemove(s){return this.has(s)?this._getAndRemoveByKey(s.wrapped().key):null}_getAndRemoveByKey(s){const h=this.data[s].shift();return h.timeout&&clearTimeout(h.timeout),this.data[s].length===0&&delete this.data[s],this.order.splice(this.order.indexOf(s),1),h.value}getByKey(s){const h=this.data[s];return h?h[0].value:null}get(s){return this.has(s)?this.data[s.wrapped().key][0].value:null}remove(s,h){if(!this.has(s))return this;const d=s.wrapped().key,g=h===void 0?0:this.data[d].indexOf(h),b=this.data[d][g];return this.data[d].splice(g,1),b.timeout&&clearTimeout(b.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(b.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(s){for(this.max=s;this.order.length>this.max;){const h=this._getAndRemoveByKey(this.order[0]);h&&this.onRemove(h)}return this}filter(s){const h=[];for(const d in this.data)for(const g of this.data[d])s(g.value)||h.push(g);for(const d of h)this.remove(d.value.tileID,d)}}class jt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,h,d){const g=String(h);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][g]=this.stateChanges[s][g]||{},a.e(this.stateChanges[s][g],d),this.deletedStates[s]===null){this.deletedStates[s]={};for(const b in this.state[s])b!==g&&(this.deletedStates[s][b]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][g]===null){this.deletedStates[s][g]={};for(const b in this.state[s][g])d[b]||(this.deletedStates[s][g][b]=null)}else for(const b in d)this.deletedStates[s]&&this.deletedStates[s][g]&&this.deletedStates[s][g][b]===null&&delete this.deletedStates[s][g][b]}removeFeatureState(s,h,d){if(this.deletedStates[s]===null)return;const g=String(h);if(this.deletedStates[s]=this.deletedStates[s]||{},d&&h!==void 0)this.deletedStates[s][g]!==null&&(this.deletedStates[s][g]=this.deletedStates[s][g]||{},this.deletedStates[s][g][d]=null);else if(h!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][g])for(d in this.deletedStates[s][g]={},this.stateChanges[s][g])this.deletedStates[s][g][d]=null;else this.deletedStates[s][g]=null;else this.deletedStates[s]=null}getState(s,h){const d=String(h),g=a.e({},(this.state[s]||{})[d],(this.stateChanges[s]||{})[d]);if(this.deletedStates[s]===null)return{};if(this.deletedStates[s]){const b=this.deletedStates[s][h];if(b===null)return{};for(const I in b)delete g[I]}return g}initializeTileState(s,h){s.setFeatureState(this.state,h)}coalesceChanges(s,h){const d={};for(const g in this.stateChanges){this.state[g]=this.state[g]||{};const b={};for(const I in this.stateChanges[g])this.state[g][I]||(this.state[g][I]={}),a.e(this.state[g][I],this.stateChanges[g][I]),b[I]=this.state[g][I];d[g]=b}for(const g in this.deletedStates){this.state[g]=this.state[g]||{};const b={};if(this.deletedStates[g]===null)for(const I in this.state[g])b[I]={},this.state[g][I]={};else for(const I in this.deletedStates[g]){if(this.deletedStates[g][I]===null)this.state[g][I]={};else for(const C of Object.keys(this.deletedStates[g][I]))delete this.state[g][I][C];b[I]=this.state[g][I]}d[g]=d[g]||{},a.e(d[g],b)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const g in s)s[g].setFeatureState(d,h)}}class Oi extends a.E{constructor(s,h,d){super(),this.id=s,this.dispatcher=d,this.on("data",g=>{g.dataType==="source"&&g.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&g.dataType==="source"&&g.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((g,b,I,C)=>{const M=new(Ge(b.type))(g,b,I,C);if(M.id!==g)throw new Error(`Expected Source id to be ${g} instead of ${M.id}`);return M})(s,h,d,this),this._tiles={},this._cache=new qi(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new jt,this._didEmitContent=!1,this._updated=!1}onAdd(s){this.map=s,this._maxTileCacheSize=s?s._maxTileCacheSize:null,this._maxTileCacheZoomLevels=s?s._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(s)}onRemove(s){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(s)}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 s in this._tiles){const h=this._tiles[s];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 s=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,s&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(s,h){return this._source.loadTile(s,h)}_unloadTile(s){if(this._source.unloadTile)return this._source.unloadTile(s,()=>{})}_abortTile(s){this._source.abortTile&&this._source.abortTile(s,()=>{}),this._source.fire(new a.k("dataabort",{tile:s,coord:s.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(s){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const h in this._tiles){const d=this._tiles[h];d.upload(s),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(sr).map(s=>s.key)}getRenderableIds(s){const h=[];for(const d in this._tiles)this._isIdRenderable(d,s)&&h.push(this._tiles[d]);return s?h.sort((d,g)=>{const b=d.tileID,I=g.tileID,C=new a.P(b.canonical.x,b.canonical.y)._rotate(this.transform.angle),M=new a.P(I.canonical.x,I.canonical.y)._rotate(this.transform.angle);return b.overscaledZ-I.overscaledZ||M.y-C.y||M.x-C.x}).map(d=>d.tileID.key):h.map(d=>d.tileID).sort(sr).map(d=>d.key)}hasRenderableParent(s){const h=this.findLoadedParent(s,0);return!!h&&this._isIdRenderable(h.tileID.key)}_isIdRenderable(s,h){return this._tiles[s]&&this._tiles[s].hasData()&&!this._coveredTiles[s]&&(h||!this._tiles[s].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const s in this._tiles)this._tiles[s].state!=="errored"&&this._reloadTile(s,"reloading")}}_reloadTile(s,h){const d=this._tiles[s];d&&(d.state!=="loading"&&(d.state=h),this._loadTile(d,this._tileLoaded.bind(this,d,s,h)))}_tileLoaded(s,h,d,g){if(g)return s.state="errored",void(g.status!==404?this._source.fire(new a.j(g,{tile:s})):this.update(this.transform,this.terrain));s.timeAdded=a.h.now(),d==="expired"&&(s.refreshedUponExpiration=!0),this._setTileReloadTimer(h,s),this.getSource().type==="raster-dem"&&s.dem&&this._backfillDEM(s),this._state.initializeTileState(s,this.map?this.map.painter:null),s.aborted||this._source.fire(new a.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){const h=this.getRenderableIds();for(let g=0;g1||(Math.abs(I)>1&&(Math.abs(I+M)===1?I+=M:Math.abs(I-M)===1&&(I-=M)),b.dem&&g.dem&&(g.dem.backfillBorder(b.dem,I,C),g.neighboringTiles&&g.neighboringTiles[k]&&(g.neighboringTiles[k].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,h,d,g){for(const b in this._tiles){let I=this._tiles[b];if(g[b]||!I.hasData()||I.tileID.overscaledZ<=h||I.tileID.overscaledZ>d)continue;let C=I.tileID;for(;I&&I.tileID.overscaledZ>h+1;){const k=I.tileID.scaledTo(I.tileID.overscaledZ-1);I=this._tiles[k.key],I&&I.hasData()&&(C=k)}let M=C;for(;M.overscaledZ>h;)if(M=M.scaledTo(M.overscaledZ-1),s[M.key]){g[C.key]=C;break}}}findLoadedParent(s,h){if(s.key in this._loadedParentTiles){const d=this._loadedParentTiles[s.key];return d&&d.tileID.overscaledZ>=h?d:null}for(let d=s.overscaledZ-1;d>=h;d--){const g=s.scaledTo(d),b=this._getLoadedTile(g);if(b)return b}}_getLoadedTile(s){const h=this._tiles[s.key];return h&&h.hasData()?h:this._cache.getByKey(s.wrapped().key)}updateCacheSize(s){const h=Math.ceil(s.width/this._source.tileSize)+1,d=Math.ceil(s.height/this._source.tileSize)+1,g=Math.floor(h*d*(this._maxTileCacheZoomLevels===null?a.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),b=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(b)}handleWrapJump(s){const h=Math.round((s-(this._prevLng===void 0?s:this._prevLng))/360);if(this._prevLng=s,h){const d={};for(const g in this._tiles){const b=this._tiles[g];b.tileID=b.tileID.unwrapTo(b.tileID.wrap+h),d[b.tileID.key]=b}this._tiles=d;for(const g in this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(const g in this._tiles)this._setTileReloadTimer(g,this._tiles[g])}}update(s,h){if(this.transform=s,this.terrain=h,!this._sourceLoaded||this._paused)return;let d;this.updateCacheSize(s),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=s.getVisibleUnwrappedCoordinates(this._source.tileID).map(R=>new a.O(R.canonical.z,R.wrap,R.canonical.z,R.canonical.x,R.canonical.y)):(d=s.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&&(d=d.filter(R=>this._source.hasTile(R)))):d=[];const g=s.coveringZoomLevel(this._source),b=Math.max(g-Oi.maxOverzooming,this._source.minzoom),I=Math.max(g+Oi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const R={};for(const z of d)if(z.canonical.z>this._source.minzoom){const W=z.scaledTo(z.canonical.z-1);R[W.key]=W;const nt=z.scaledTo(Math.max(this._source.minzoom,Math.min(z.canonical.z,5)));R[nt.key]=nt}d=d.concat(Object.values(R))}const C=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,C&&this.fire(new a.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const M=this._updateRetainedTiles(d,g);if(On(this._source.type)){const R={},z={},W=Object.keys(M),nt=a.h.now();for(const et of W){const at=M[et],$=this._tiles[et];if(!$||$.fadeEndTime!==0&&$.fadeEndTime<=nt)continue;const St=this.findLoadedParent(at,b);St&&(this._addTile(St.tileID),R[St.tileID.key]=St.tileID),z[et]=at}this._retainLoadedChildren(z,g,I,M);for(const et in R)M[et]||(this._coveredTiles[et]=!0,M[et]=R[et]);if(h){const et={},at={};for(const $ of d)this._tiles[$.key].hasData()?et[$.key]=$:at[$.key]=$;for(const $ in at){const St=at[$].children(this._source.maxzoom);this._tiles[St[0].key]&&this._tiles[St[1].key]&&this._tiles[St[2].key]&&this._tiles[St[3].key]&&(et[St[0].key]=M[St[0].key]=St[0],et[St[1].key]=M[St[1].key]=St[1],et[St[2].key]=M[St[2].key]=St[2],et[St[3].key]=M[St[3].key]=St[3],delete at[$])}for(const $ in at){const St=this.findLoadedParent(at[$],this._source.minzoom);if(St){et[St.tileID.key]=M[St.tileID.key]=St.tileID;for(const Ot in et)et[Ot].isChildOf(St.tileID)&&delete et[Ot]}}for(const $ in this._tiles)et[$]||(this._coveredTiles[$]=!0)}}for(const R in M)this._tiles[R].clearFadeHold();const k=a.ab(this._tiles,M);for(const R of k){const z=this._tiles[R];z.hasSymbolBuckets&&!z.holdingForFade()?z.setHoldDuration(this.map._fadeDuration):z.hasSymbolBuckets&&!z.symbolFadeFinished()||this._removeTile(R)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const s in this._tiles)this._tiles[s].holdingForFade()&&this._removeTile(s)}_updateRetainedTiles(s,h){const d={},g={},b=Math.max(h-Oi.maxOverzooming,this._source.minzoom),I=Math.max(h+Oi.maxUnderzooming,this._source.minzoom),C={};for(const M of s){const k=this._addTile(M);d[M.key]=M,k.hasData()||hthis._source.maxzoom){const z=M.children(this._source.maxzoom)[0],W=this.getTile(z);if(W&&W.hasData()){d[z.key]=z;continue}}else{const z=M.children(this._source.maxzoom);if(d[z[0].key]&&d[z[1].key]&&d[z[2].key]&&d[z[3].key])continue}let R=k.wasRequested();for(let z=M.overscaledZ-1;z>=b;--z){const W=M.scaledTo(z);if(g[W.key])break;if(g[W.key]=!0,k=this.getTile(W),!k&&R&&(k=this._addTile(W)),k){const nt=k.hasData();if((R||nt)&&(d[W.key]=W),R=k.wasRequested(),nt)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const s in this._tiles){const h=[];let d,g=this._tiles[s].tileID;for(;g.overscaledZ>0;){if(g.key in this._loadedParentTiles){d=this._loadedParentTiles[g.key];break}h.push(g.key);const b=g.scaledTo(g.overscaledZ-1);if(d=this._getLoadedTile(b),d)break;g=b}for(const b of h)this._loadedParentTiles[b]=d}}_addTile(s){let h=this._tiles[s.key];if(h)return h;h=this._cache.getAndRemove(s),h&&(this._setTileReloadTimer(s.key,h),h.tileID=s,this._state.initializeTileState(h,this.map?this.map.painter:null),this._cacheTimers[s.key]&&(clearTimeout(this._cacheTimers[s.key]),delete this._cacheTimers[s.key],this._setTileReloadTimer(s.key,h)));const d=h;return h||(h=new dn(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(h,this._tileLoaded.bind(this,h,s.key,h.state))),h.uses++,this._tiles[s.key]=h,d||this._source.fire(new a.k("dataloading",{tile:h,coord:h.tileID,dataType:"source"})),h}_setTileReloadTimer(s,h){s in this._timers&&(clearTimeout(this._timers[s]),delete this._timers[s]);const d=h.getExpiryTimeout();d&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},d))}_removeTile(s){const h=this._tiles[s];h&&(h.uses--,delete this._tiles[s],this._timers[s]&&(clearTimeout(this._timers[s]),delete this._timers[s]),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))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const s in this._tiles)this._removeTile(s);this._cache.reset()}tilesIn(s,h,d){const g=[],b=this.transform;if(!b)return g;const I=d?b.getCameraQueryGeometry(s):s,C=s.map(et=>b.pointCoordinate(et,this.terrain)),M=I.map(et=>b.pointCoordinate(et,this.terrain)),k=this.getIds();let R=1/0,z=1/0,W=-1/0,nt=-1/0;for(const et of M)R=Math.min(R,et.x),z=Math.min(z,et.y),W=Math.max(W,et.x),nt=Math.max(nt,et.y);for(let et=0;et=0&&ct[1].y+Ot>=0){const It=C.map(Vt=>$.getTilePoint(Vt)),Bt=M.map(Vt=>$.getTilePoint(Vt));g.push({tile:at,tileID:$,queryGeometry:It,cameraQueryGeometry:Bt,scale:St})}}return g}getVisibleCoordinates(s){const h=this.getRenderableIds(s).map(d=>this._tiles[d].tileID);for(const d of h)d.posMatrix=this.transform.calculatePosMatrix(d.toUnwrapped());return h}hasTransition(){if(this._source.hasTransition())return!0;if(On(this._source.type)){const s=a.h.now();for(const h in this._tiles)if(this._tiles[h].fadeEndTime>=s)return!0}return!1}setFeatureState(s,h,d){this._state.updateState(s=s||"_geojsonTileLayer",h,d)}removeFeatureState(s,h,d){this._state.removeFeatureState(s=s||"_geojsonTileLayer",h,d)}getFeatureState(s,h){return this._state.getState(s=s||"_geojsonTileLayer",h)}setDependencies(s,h,d){const g=this._tiles[s];g&&g.setDependencies(h,d)}reloadTilesForDependencies(s,h){for(const d in this._tiles)this._tiles[d].hasDependency(s,h)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(s,h))}}function sr(y,s){const h=Math.abs(2*y.wrap)-+(y.wrap<0),d=Math.abs(2*s.wrap)-+(s.wrap<0);return y.overscaledZ-s.overscaledZ||d-h||s.canonical.y-y.canonical.y||s.canonical.x-y.canonical.x}function On(y){return y==="raster"||y==="image"||y==="video"}Oi.maxOverzooming=10,Oi.maxUnderzooming=3;const En="mapboxgl_preloaded_worker_pool";class ts{constructor(){this.active={}}acquire(s){if(!this.workers)for(this.workers=[];this.workers.length{h.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[En]}numActive(){return Object.keys(this.active).length}}const ro=Math.floor(a.h.hardwareConcurrency/2);let es;function Ha(){return es||(es=new ts),es}ts.workerCount=a.ac(globalThis)?Math.max(Math.min(ro,3),1):1;class Gs{constructor(s,h){this.reset(s,h)}reset(s,h){this.points=s||[],this._distances=[0];for(let d=1;d0?(g-I)/C:0;return this.points[b].mult(1-M).add(this.points[h].mult(M))}}function js(y,s){let h=!0;return y==="always"||y!=="never"&&s!=="never"||(h=!1),h}class wa{constructor(s,h,d){const g=this.boxCells=[],b=this.circleCells=[];this.xCellCount=Math.ceil(s/d),this.yCellCount=Math.ceil(h/d);for(let I=0;Ithis.width||g<0||h>this.height)return[];const M=[];if(s<=0&&h<=0&&this.width<=d&&this.height<=g){if(b)return[{key:null,x1:s,y1:h,x2:d,y2:g}];for(let k=0;k0}hitTestCircle(s,h,d,g,b){const I=s-d,C=s+d,M=h-d,k=h+d;if(C<0||I>this.width||k<0||M>this.height)return!1;const R=[];return this._forEachCell(I,M,C,k,this._queryCellCircle,R,{hitTest:!0,overlapMode:g,circle:{x:s,y:h,radius:d},seenUids:{box:{},circle:{}}},b),R.length>0}_queryCell(s,h,d,g,b,I,C,M){const{seenUids:k,hitTest:R,overlapMode:z}=C,W=this.boxCells[b];if(W!==null){const et=this.bboxes;for(const at of W)if(!k.box[at]){k.box[at]=!0;const $=4*at,St=this.boxKeys[at];if(s<=et[$+2]&&h<=et[$+3]&&d>=et[$+0]&&g>=et[$+1]&&(!M||M(St))&&(!R||!js(z,St.overlapMode))&&(I.push({key:St,x1:et[$],y1:et[$+1],x2:et[$+2],y2:et[$+3]}),R))return!0}}const nt=this.circleCells[b];if(nt!==null){const et=this.circles;for(const at of nt)if(!k.circle[at]){k.circle[at]=!0;const $=3*at,St=this.circleKeys[at];if(this._circleAndRectCollide(et[$],et[$+1],et[$+2],s,h,d,g)&&(!M||M(St))&&(!R||!js(z,St.overlapMode))){const Ot=et[$],ct=et[$+1],It=et[$+2];if(I.push({key:St,x1:Ot-It,y1:ct-It,x2:Ot+It,y2:ct+It}),R)return!0}}}return!1}_queryCellCircle(s,h,d,g,b,I,C,M){const{circle:k,seenUids:R,overlapMode:z}=C,W=this.boxCells[b];if(W!==null){const et=this.bboxes;for(const at of W)if(!R.box[at]){R.box[at]=!0;const $=4*at,St=this.boxKeys[at];if(this._circleAndRectCollide(k.x,k.y,k.radius,et[$+0],et[$+1],et[$+2],et[$+3])&&(!M||M(St))&&!js(z,St.overlapMode))return I.push(!0),!0}}const nt=this.circleCells[b];if(nt!==null){const et=this.circles;for(const at of nt)if(!R.circle[at]){R.circle[at]=!0;const $=3*at,St=this.circleKeys[at];if(this._circlesCollide(et[$],et[$+1],et[$+2],k.x,k.y,k.radius)&&(!M||M(St))&&!js(z,St.overlapMode))return I.push(!0),!0}}}_forEachCell(s,h,d,g,b,I,C,M){const k=this._convertToXCellCoord(s),R=this._convertToYCellCoord(h),z=this._convertToXCellCoord(d),W=this._convertToYCellCoord(g);for(let nt=k;nt<=z;nt++)for(let et=R;et<=W;et++)if(b.call(this,s,h,d,g,this.xCellCount*et+nt,I,C,M))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,h,d,g,b,I){const C=g-s,M=b-h,k=d+I;return k*k>C*C+M*M}_circleAndRectCollide(s,h,d,g,b,I,C){const M=(I-g)/2,k=Math.abs(s-(g+M));if(k>M+d)return!1;const R=(C-b)/2,z=Math.abs(h-(b+R));if(z>R+d)return!1;if(k<=M||z<=R)return!0;const W=k-M,nt=z-R;return W*W+nt*nt<=d*d}}function se(y,s,h,d,g){const b=a.Z();return s?(a.a0(b,b,[1/g,1/g,1]),h||a.ae(b,b,d.angle)):a.a1(b,d.labelPlaneMatrix,y),b}function yo(y,s,h,d,g){if(s){const b=a.af(y);return a.a0(b,b,[g,g,1]),h||a.ae(b,b,-d.angle),b}return d.glCoordMatrix}function ii(y,s,h){let d;h?(d=[y.x,y.y,h(y.x,y.y),1],a.ag(d,d,s)):(d=[y.x,y.y,0,1],q(d,d,s));const g=d[3];return{point:new a.P(d[0]/g,d[1]/g),signedDistanceFromCamera:g}}function Sa(y,s){return .5+y/s*.5}function xs(y,s){const h=y[0]/y[3],d=y[1]/y[3];return h>=-s[0]&&h<=s[0]&&d>=-s[1]&&d<=s[1]}function le(y,s,h,d,g,b,I,C,M,k){const R=d?y.textSizeData:y.iconSizeData,z=a.ah(R,h.transform.zoom),W=[256/h.width*2+1,256/h.height*2+1],nt=d?y.text.dynamicLayoutVertexArray:y.icon.dynamicLayoutVertexArray;nt.clear();const et=y.lineVertexArray,at=d?y.text.placedSymbolArray:y.icon.placedSymbolArray,$=h.transform.width/h.transform.height;let St=!1;for(let Ot=0;OtMath.abs(h.x-s.x)*d?{useVertical:!0}:(y===a.ai.vertical?s.yh.x)?{needsFlipping:!0}:null}function Ar(y,s,h,d,g,b,I,C,M,k,R,z,W,nt,et,at){const $=s/24,St=y.lineOffsetX*$,Ot=y.lineOffsetY*$;let ct;if(y.numGlyphs>1){const It=y.glyphStartIndex+y.numGlyphs,Bt=y.lineStartIndex,Vt=y.lineStartIndex+y.lineLength,Xt=cn($,C,St,Ot,h,R,z,y,M,b,W,et,at);if(!Xt)return{notEnoughRoom:!0};const ne=ii(Xt.first.point,I,at).point,Qt=ii(Xt.last.point,I,at).point;if(d&&!h){const oe=Ke(y.writingMode,ne,Qt,nt);if(oe)return oe}ct=[Xt.first];for(let oe=y.glyphStartIndex+1;oe0?ne.point:ns(z,Xt,Bt,1,g,at),oe=Ke(y.writingMode,Bt,Qt,nt);if(oe)return oe}const It=B($*C.getoffsetX(y.glyphStartIndex),St,Ot,h,R,z,y.segment,y.lineStartIndex,y.lineStartIndex+y.lineLength,M,b,W,et,at);if(!It)return{notEnoughRoom:!0};ct=[It]}for(const It of ct)a.ak(k,It.point,It.angle);return{}}function ns(y,s,h,d,g,b){const I=ii(y.add(y.sub(s)._unit()),g,b).point,C=h.sub(I);return h.add(C._mult(d/C.mag()))}function en(y,s){const{projectionCache:h,lineVertexArray:d,labelPlaneMatrix:g,tileAnchorPoint:b,distanceFromAnchor:I,getElevation:C,previousVertex:M,direction:k,absOffsetX:R}=s;if(h.projections[y])return h.projections[y];const z=new a.P(d.getx(y),d.gety(y)),W=ii(z,g,C);if(W.signedDistanceFromCamera>0)return h.projections[y]=W.point,W.point;const nt=y-k;return ns(I===0?b:new a.P(d.getx(nt),d.gety(nt)),z,M,R-I+1,g,C)}function ws(y,s,h){return y._unit()._perp()._mult(s*h)}function st(y,s,h,d,g,b,I,C){const{projectionCache:M,direction:k}=C;if(M.offsets[y])return M.offsets[y];const R=h.add(s);if(y+k=g)return M.offsets[y]=R,R;const z=en(y+k,C),W=ws(z.sub(h),I,k),nt=h.add(W),et=z.add(W);return M.offsets[y]=a.al(b,R,nt,et)||R,M.offsets[y]}function B(y,s,h,d,g,b,I,C,M,k,R,z,W,nt){const et=d?y-s:y+s;let at=et>0?1:-1,$=0;d&&(at*=-1,$=Math.PI),at<0&&($+=Math.PI);let St,Ot,ct=at>0?C+I:C+I+1,It=g,Bt=g,Vt=0,Xt=0;const ne=Math.abs(et),Qt=[];let oe;for(;Vt+Xt<=ne;){if(ct+=at,ct=M)return null;Vt+=Xt,Bt=It,Ot=St;const he={projectionCache:z,lineVertexArray:k,labelPlaneMatrix:R,tileAnchorPoint:b,distanceFromAnchor:Vt,getElevation:nt,previousVertex:Bt,direction:at,absOffsetX:ne};if(It=en(ct,he),h===0)Qt.push(Bt),oe=It.sub(Bt);else{let Ue;const Pe=It.sub(Bt);Ue=Pe.mag()===0?ws(en(ct+at,he).sub(It),h,at):ws(Pe,h,at),Ot||(Ot=Bt.add(Ue)),St=st(ct,Ue,It,C,M,Ot,h,he),Qt.push(Ot),oe=St.sub(Ot)}Xt=oe.mag()}const Ce=oe._mult((ne-Vt)/Xt)._add(Ot||Bt),bn=$+Math.atan2(It.y-Bt.y,It.x-Bt.x);return Qt.push(Ce),{point:Ce,angle:W?bn:0,path:Qt}}const j=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function J(y,s){for(let h=0;h=1;hn--)Pe.push(he.path[hn]);for(let hn=1;hnii(xn,M,et));Pe=hn.some(xn=>xn.signedDistanceFromCamera<=0)?[]:hn.map(xn=>xn.point)}let vn=[];if(Pe.length>0){const hn=Pe[0].clone(),xn=Pe[0].clone();for(let zi=1;zi=oe.x&&xn.x<=Ce.x&&hn.y>=oe.y&&xn.y<=Ce.y?[Pe]:xn.xCe.x||xn.yCe.y?[]:a.am([Pe],oe.x,oe.y,Ce.x,Ce.y)}for(const hn of vn){bn.reset(hn,.25*Qt);let xn=0;xn=bn.length<=.5*Qt?1:Math.ceil(bn.paddedLength/Yn)+1;for(let zi=0;zi=this.screenRightBoundary||gthis.screenBottomBoundary}isInsideGrid(s,h,d,g){return d>=0&&s=0&&hd.collisionGroupID===h}}return this.collisionGroups[s]}}function Ye(y,s,h,d,g){const{horizontalAlign:b,verticalAlign:I}=a.au(y);return new a.P(-(b-.5)*s+d[0]*g,-(I-.5)*h+d[1]*g)}function Ie(y,s,h,d,g,b){const{x1:I,x2:C,y1:M,y2:k,anchorPointX:R,anchorPointY:z}=y,W=new a.P(s,h);return d&&W._rotate(g?b:-b),{x1:I+W.x,y1:M+W.y,x2:C+W.x,y2:k+W.y,anchorPointX:R,anchorPointY:z}}class Fe{constructor(s,h,d,g,b){this.transform=s.clone(),this.terrain=h,this.collisionIndex=new Et(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new Ne(g),this.collisionCircleArrays={},this.prevPlacement=b,b&&(b.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(s,h,d,g){const b=d.getBucket(h),I=d.latestFeatureIndex;if(!b||!I||h.id!==b.layerIds[0])return;const C=d.collisionBoxArray,M=b.layers[0].layout,k=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),R=d.tileSize/a.N,z=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),W=M.get("text-pitch-alignment")==="map",nt=M.get("text-rotation-alignment")==="map",et=gt(d,1,this.transform.zoom),at=se(z,W,nt,this.transform,et);let $=null;if(W){const Ot=yo(z,W,nt,this.transform,et);$=a.a1([],this.transform.labelPlaneMatrix,Ot)}this.retainedQueryData[b.bucketInstanceId]=new Ht(b.bucketInstanceId,I,b.sourceLayerIndex,b.index,d.tileID);const St={bucket:b,layout:M,posMatrix:z,textLabelPlaneMatrix:at,labelToScreenMatrix:$,scale:k,textPixelRatio:R,holdingForFade:d.holdingForFade(),collisionBoxArray:C,partiallyEvaluatedTextSize:a.ah(b.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(b.sourceID)};if(g)for(const Ot of b.sortKeyRanges){const{sortKey:ct,symbolInstanceStart:It,symbolInstanceEnd:Bt}=Ot;s.push({sortKey:ct,symbolInstanceStart:It,symbolInstanceEnd:Bt,parameters:St})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:b.symbolInstances.length,parameters:St})}attemptAnchorPlacement(s,h,d,g,b,I,C,M,k,R,z,W,nt,et,at,$){const St=a.aq[s.textAnchor],Ot=[s.textOffset0,s.textOffset1],ct=Ye(St,d,g,Ot,b),It=this.collisionIndex.placeCollisionBox(Ie(h,ct.x,ct.y,I,C,this.transform.angle),z,M,k,R.predicate,$);if((!at||this.collisionIndex.placeCollisionBox(Ie(at,ct.x,ct.y,I,C,this.transform.angle),z,M,k,R.predicate,$).box.length!==0)&&It.box.length>0){let Bt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[W.crossTileID]&&this.prevPlacement.placements[W.crossTileID]&&this.prevPlacement.placements[W.crossTileID].text&&(Bt=this.prevPlacement.variableOffsets[W.crossTileID].anchor),W.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[W.crossTileID]={textOffset:Ot,width:d,height:g,anchor:St,textBoxScale:b,prevAnchor:Bt},this.markUsedJustification(nt,St,W,et),nt.allowVerticalPlacement&&(this.markUsedOrientation(nt,et,W),this.placedOrientations[W.crossTileID]=et),{shift:ct,placedGlyphBoxes:It}}}placeLayerBucketPart(s,h,d){const{bucket:g,layout:b,posMatrix:I,textLabelPlaneMatrix:C,labelToScreenMatrix:M,textPixelRatio:k,holdingForFade:R,collisionBoxArray:z,partiallyEvaluatedTextSize:W,collisionGroup:nt}=s.parameters,et=b.get("text-optional"),at=b.get("icon-optional"),$=a.ar(b,"text-overlap","text-allow-overlap"),St=$==="always",Ot=a.ar(b,"icon-overlap","icon-allow-overlap"),ct=Ot==="always",It=b.get("text-rotation-alignment")==="map",Bt=b.get("text-pitch-alignment")==="map",Vt=b.get("icon-text-fit")!=="none",Xt=b.get("symbol-z-order")==="viewport-y",ne=St&&(ct||!g.hasIconData()||at),Qt=ct&&(St||!g.hasTextData()||et);!g.collisionArrays&&z&&g.deserializeCollisionBoxes(z);const oe=this.retainedQueryData[g.bucketInstanceId].tileID,Ce=this.terrain?(he,Ue)=>this.terrain.getElevation(oe,he,Ue):null,bn=(he,Ue)=>{var Pe,Yn;if(h[he.crossTileID])return;if(R)return void(this.placements[he.crossTileID]=new qt(!1,!1,!1));let vn=!1,hn=!1,xn=!0,zi=null,oi={box:null,offscreen:null},Dr={box:null,offscreen:null},ar=null,Wi=null,Fo=null,ci=0,Zs=0,Ws=0;Ue.textFeatureIndex?ci=Ue.textFeatureIndex:he.useRuntimeCollisionCircles&&(ci=he.featureIndex),Ue.verticalTextFeatureIndex&&(Zs=Ue.verticalTextFeatureIndex);const el=Ue.textBox;if(el){const Zr=Fi=>{let lr=a.ai.horizontal;if(g.allowVerticalPlacement&&!Fi&&this.prevPlacement){const xo=this.prevPlacement.placedOrientations[he.crossTileID];xo&&(this.placedOrientations[he.crossTileID]=xo,lr=xo,this.markUsedOrientation(g,lr,he))}return lr},Rr=(Fi,lr)=>{if(g.allowVerticalPlacement&&he.numVerticalGlyphVertices>0&&Ue.verticalTextBox){for(const xo of g.writingModes)if(xo===a.ai.vertical?(oi=lr(),Dr=oi):oi=Fi(),oi&&oi.box&&oi.box.length)break}else oi=Fi()},so=he.textAnchorOffsetStartIndex,Al=he.textAnchorOffsetEndIndex;if(Al===so){const Fi=(lr,xo)=>{const Bi=this.collisionIndex.placeCollisionBox(lr,$,k,I,nt.predicate,Ce);return Bi&&Bi.box&&Bi.box.length&&(this.markUsedOrientation(g,xo,he),this.placedOrientations[he.crossTileID]=xo),Bi};Rr(()=>Fi(el,a.ai.horizontal),()=>{const lr=Ue.verticalTextBox;return g.allowVerticalPlacement&&he.numVerticalGlyphVertices>0&&lr?Fi(lr,a.ai.vertical):{box:null,offscreen:null}}),Zr(oi&&oi.box&&oi.box.length)}else{let Fi=a.aq[(Yn=(Pe=this.prevPlacement)===null||Pe===void 0?void 0:Pe.variableOffsets[he.crossTileID])===null||Yn===void 0?void 0:Yn.anchor];const lr=(Bi,kl,ph)=>{const om=Bi.x2-Bi.x1,sm=Bi.y2-Bi.y1,Jg=he.textBoxScale,tf=Vt&&Ot==="never"?kl:null;let Xs={box:[],offscreen:!1},Nl=$==="never"?1:2,Hs="never";Fi&&Nl++;for(let us=0;uslr(el,Ue.iconBox,a.ai.horizontal),()=>{const Bi=Ue.verticalTextBox;return g.allowVerticalPlacement&&!(oi&&oi.box&&oi.box.length)&&he.numVerticalGlyphVertices>0&&Bi?lr(Bi,Ue.verticalIconBox,a.ai.vertical):{box:null,offscreen:null}}),oi&&(vn=oi.box,xn=oi.offscreen);const xo=Zr(oi&&oi.box);if(!vn&&this.prevPlacement){const Bi=this.prevPlacement.variableOffsets[he.crossTileID];Bi&&(this.variableOffsets[he.crossTileID]=Bi,this.markUsedJustification(g,Bi.anchor,he,xo))}}}if(ar=oi,vn=ar&&ar.box&&ar.box.length>0,xn=ar&&ar.offscreen,he.useRuntimeCollisionCircles){const Zr=g.text.placedSymbolArray.get(he.centerJustifiedTextSymbolIndex),Rr=a.aj(g.textSizeData,W,Zr),so=b.get("text-padding");Wi=this.collisionIndex.placeCollisionCircles($,Zr,g.lineVertexArray,g.glyphOffsetArray,Rr,I,C,M,d,Bt,nt.predicate,he.collisionCircleDiameter,so,Ce),Wi.circles.length&&Wi.collisionDetected&&!d&&a.w("Collisions detected, but collision boxes are not shown"),vn=St||Wi.circles.length>0&&!Wi.collisionDetected,xn=xn&&Wi.offscreen}if(Ue.iconFeatureIndex&&(Ws=Ue.iconFeatureIndex),Ue.iconBox){const Zr=Rr=>{const so=Vt&&zi?Ie(Rr,zi.x,zi.y,It,Bt,this.transform.angle):Rr;return this.collisionIndex.placeCollisionBox(so,Ot,k,I,nt.predicate,Ce)};Dr&&Dr.box&&Dr.box.length&&Ue.verticalIconBox?(Fo=Zr(Ue.verticalIconBox),hn=Fo.box.length>0):(Fo=Zr(Ue.iconBox),hn=Fo.box.length>0),xn=xn&&Fo.offscreen}const Pl=et||he.numHorizontalGlyphVertices===0&&he.numVerticalGlyphVertices===0,yu=at||he.numIconVertices===0;if(Pl||yu?yu?Pl||(hn=hn&&vn):vn=hn&&vn:hn=vn=hn&&vn,vn&&ar&&ar.box&&this.collisionIndex.insertCollisionBox(ar.box,$,b.get("text-ignore-placement"),g.bucketInstanceId,Dr&&Dr.box&&Zs?Zs:ci,nt.ID),hn&&Fo&&this.collisionIndex.insertCollisionBox(Fo.box,Ot,b.get("icon-ignore-placement"),g.bucketInstanceId,Ws,nt.ID),Wi&&(vn&&this.collisionIndex.insertCollisionCircles(Wi.circles,$,b.get("text-ignore-placement"),g.bucketInstanceId,ci,nt.ID),d)){const Zr=g.bucketInstanceId;let Rr=this.collisionCircleArrays[Zr];Rr===void 0&&(Rr=this.collisionCircleArrays[Zr]=new Zt);for(let so=0;so=0;--Ue){const Pe=he[Ue];bn(g.symbolInstances.get(Pe),g.collisionArrays[Pe])}}else for(let he=s.symbolInstanceStart;he=0&&(s.text.placedSymbolArray.get(C).crossTileID=b>=0&&C!==b?0:d.crossTileID)}markUsedOrientation(s,h,d){const g=h===a.ai.horizontal||h===a.ai.horizontalOnly?h:0,b=h===a.ai.vertical?h:0,I=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const C of I)s.text.placedSymbolArray.get(C).placedOrientation=g;d.verticalPlacedTextSymbolIndex&&(s.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=b)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const h=this.prevPlacement;let d=!1;this.prevZoomAdjustment=h?h.zoomAdjustment(this.transform.zoom):0;const g=h?h.symbolFadeChange(s):1,b=h?h.opacities:{},I=h?h.variableOffsets:{},C=h?h.placedOrientations:{};for(const M in this.placements){const k=this.placements[M],R=b[M];R?(this.opacities[M]=new bt(R,g,k.text,k.icon),d=d||k.text!==R.text.placed||k.icon!==R.icon.placed):(this.opacities[M]=new bt(null,g,k.text,k.icon,k.skipFade),d=d||k.text||k.icon)}for(const M in b){const k=b[M];if(!this.opacities[M]){const R=new bt(k,g,!1,!1);R.isHidden()||(this.opacities[M]=R,d=d||k.text.placed||k.icon.placed)}}for(const M in I)this.variableOffsets[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.variableOffsets[M]=I[M]);for(const M in C)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=C[M]);if(h&&h.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=h?h.lastPlacementChangeTime:s)}updateLayerOpacities(s,h){const d={};for(const g of h){const b=g.getBucket(s);b&&g.latestFeatureIndex&&s.id===b.layerIds[0]&&this.updateBucketOpacities(b,d,g.collisionBoxArray)}}updateBucketOpacities(s,h,d){s.hasTextData()&&(s.text.opacityVertexArray.clear(),s.text.hasVisibleVertices=!1),s.hasIconData()&&(s.icon.opacityVertexArray.clear(),s.icon.hasVisibleVertices=!1),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexArray.clear(),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexArray.clear();const g=s.layers[0],b=g.layout,I=new bt(null,0,!1,!1,!0),C=b.get("text-allow-overlap"),M=b.get("icon-allow-overlap"),k=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),R=b.get("text-rotation-alignment")==="map",z=b.get("text-pitch-alignment")==="map",W=b.get("icon-text-fit")!=="none",nt=new bt(null,0,C&&(M||!s.hasIconData()||b.get("icon-optional")),M&&(C||!s.hasTextData()||b.get("text-optional")),!0);!s.collisionArrays&&d&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(d);const et=(at,$,St)=>{for(let Ot=0;Ot<$/4;Ot++)at.opacityVertexArray.emplaceBack(St);at.hasVisibleVertices=at.hasVisibleVertices||St!==is};for(let at=0;at0,Vt=this.placedOrientations[$.crossTileID],Xt=Vt===a.ai.vertical,ne=Vt===a.ai.horizontal||Vt===a.ai.horizontalOnly;if(St>0||Ot>0){const Qt=kr(It.text);et(s.text,St,Xt?is:Qt),et(s.text,Ot,ne?is:Qt);const oe=It.text.isHidden();[$.rightJustifiedTextSymbolIndex,$.centerJustifiedTextSymbolIndex,$.leftJustifiedTextSymbolIndex].forEach(he=>{he>=0&&(s.text.placedSymbolArray.get(he).hidden=oe||Xt?1:0)}),$.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get($.verticalPlacedTextSymbolIndex).hidden=oe||ne?1:0);const Ce=this.variableOffsets[$.crossTileID];Ce&&this.markUsedJustification(s,Ce.anchor,$,Vt);const bn=this.placedOrientations[$.crossTileID];bn&&(this.markUsedJustification(s,"left",$,bn),this.markUsedOrientation(s,bn,$))}if(Bt){const Qt=kr(It.icon),oe=!(W&&$.verticalPlacedIconSymbolIndex&&Xt);$.placedIconSymbolIndex>=0&&(et(s.icon,$.numIconVertices,oe?Qt:is),s.icon.placedSymbolArray.get($.placedIconSymbolIndex).hidden=It.icon.isHidden()),$.verticalPlacedIconSymbolIndex>=0&&(et(s.icon,$.numVerticalIconVertices,oe?is:Qt),s.icon.placedSymbolArray.get($.verticalPlacedIconSymbolIndex).hidden=It.icon.isHidden())}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const Qt=s.collisionArrays[at];if(Qt){let oe=new a.P(0,0);if(Qt.textBox||Qt.verticalTextBox){let bn=!0;if(k){const he=this.variableOffsets[ct];he?(oe=Ye(he.anchor,he.width,he.height,he.textOffset,he.textBoxScale),R&&oe._rotate(z?this.transform.angle:-this.transform.angle)):bn=!1}Qt.textBox&&tn(s.textCollisionBox.collisionVertexArray,It.text.placed,!bn||Xt,oe.x,oe.y),Qt.verticalTextBox&&tn(s.textCollisionBox.collisionVertexArray,It.text.placed,!bn||ne,oe.x,oe.y)}const Ce=!!(!ne&&Qt.verticalIconBox);Qt.iconBox&&tn(s.iconCollisionBox.collisionVertexArray,It.icon.placed,Ce,W?oe.x:0,W?oe.y:0),Qt.verticalIconBox&&tn(s.iconCollisionBox.collisionVertexArray,It.icon.placed,!Ce,W?oe.x:0,W?oe.y:0)}}}if(s.sortFeatures(this.transform.angle),this.retainedQueryData[s.bucketInstanceId]&&(this.retainedQueryData[s.bucketInstanceId].featureSortOrder=s.featureSortOrder),s.hasTextData()&&s.text.opacityVertexBuffer&&s.text.opacityVertexBuffer.updateData(s.text.opacityVertexArray),s.hasIconData()&&s.icon.opacityVertexBuffer&&s.icon.opacityVertexBuffer.updateData(s.icon.opacityVertexArray),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexBuffer&&s.iconCollisionBox.collisionVertexBuffer.updateData(s.iconCollisionBox.collisionVertexArray),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexBuffer&&s.textCollisionBox.collisionVertexBuffer.updateData(s.textCollisionBox.collisionVertexArray),s.text.opacityVertexArray.length!==s.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${s.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${s.text.layoutVertexArray.length}) / 4`);if(s.icon.opacityVertexArray.length!==s.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${s.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${s.icon.layoutVertexArray.length}) / 4`);if(s.bucketInstanceId in this.collisionCircleArrays){const at=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=at.invProjMatrix,s.placementViewportMatrix=at.viewportMatrix,s.collisionCircleArray=at.circles,delete this.collisionCircleArrays[s.bucketInstanceId]}}symbolFadeChange(s){return this.fadeDuration===0?1:(s-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(s){return Math.max(0,(this.transform.zoom-s)/1.5)}hasTransitions(s){return this.stale||s-this.lastPlacementChangeTimes}setStale(){this.stale=!0}}function tn(y,s,h,d,g){y.emplaceBack(s?1:0,h?1:0,d||0,g||0),y.emplaceBack(s?1:0,h?1:0,d||0,g||0),y.emplaceBack(s?1:0,h?1:0,d||0,g||0),y.emplaceBack(s?1:0,h?1:0,d||0,g||0)}const Un=Math.pow(2,25),Jn=Math.pow(2,24),An=Math.pow(2,17),Pn=Math.pow(2,16),jr=Math.pow(2,9),ri=Math.pow(2,8),nr=Math.pow(2,1);function kr(y){if(y.opacity===0&&!y.placed)return 0;if(y.opacity===1&&y.placed)return 4294967295;const s=y.placed?1:0,h=Math.floor(127*y.opacity);return h*Un+s*Jn+h*An+s*Pn+h*jr+s*ri+h*nr+s}const is=0;class xd{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&!s.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(s,h,d,g,b){const I=this._bucketParts;for(;this._currentTileIndexC.sortKey-M.sortKey));this._currentPartIndex!this._forceFullPlacement&&a.h.now()-g>2;for(;this._currentPlacementIndex>=0;){const I=h[s[this._currentPlacementIndex]],C=this.placement.collisionIndex.transform.zoom;if(I.type==="symbol"&&(!I.minzoom||I.minzoom<=C)&&(!I.maxzoom||I.maxzoom>C)){if(this._inProgressLayer||(this._inProgressLayer=new xd(I)),this._inProgressLayer.continuePlacement(d[I.source],this.placement,this._showCollisionBoxes,I,b))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const su=512/a.N/2;class Dg{constructor(s,h,d){this.tileID=s,this.bucketInstanceId=d,this._symbolsByKey={};const g=new Map;for(let b=0;b({x:Math.floor(M.anchorX*su),y:Math.floor(M.anchorY*su)})),crossTileIDs:I.map(M=>M.crossTileID)};if(C.positions.length>128){const M=new a.av(C.positions.length,16,Uint16Array);for(const{x:k,y:R}of C.positions)M.add(k,R);M.finish(),delete C.positions,C.index=M}this._symbolsByKey[b]=C}}getScaledCoordinates(s,h){const{x:d,y:g,z:b}=this.tileID.canonical,{x:I,y:C,z:M}=h.canonical,k=su/Math.pow(2,M-b),R=(C*a.N+s.anchorY)*k,z=g*a.N*su;return{x:Math.floor((I*a.N+s.anchorX)*k-d*a.N*su),y:Math.floor(R-z)}}findMatches(s,h,d){const g=this.tileID.canonical.zs)}}class Hn{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class fp{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(s){const h=Math.round((s-this.lng)/360);if(h!==0)for(const d in this.indexes){const g=this.indexes[d],b={};for(const I in g){const C=g[I];C.tileID=C.tileID.unwrapTo(C.tileID.wrap+h),b[C.tileID.key]=C}this.indexes[d]=b}this.lng=s}addBucket(s,h,d){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===h.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let b=0;bs.overscaledZ)for(const C in I){const M=I[C];M.tileID.isChildOf(s)&&M.findMatches(h.symbolInstances,s,g)}else{const C=I[s.scaledTo(Number(b)).key];C&&C.findMatches(h.symbolInstances,s,g)}}for(let b=0;b{h[d]=!0});for(const d in this.layerIndexes)h[d]||delete this.layerIndexes[d]}}const qr=(y,s)=>a.x(y,s&&s.filter(h=>h.identifier!=="source.canvas")),No=a.F(a.ax,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),Rg=a.F(a.ax,["setCenter","setZoom","setBearing","setPitch"]),rs=a.aw();class Nr extends a.E{constructor(s,h={}){super(),this.map=s,this.dispatcher=new He(Ha(),this,s._getMapId()),this.imageManager=new yt,this.imageManager.setEventedParent(this),this.glyphManager=new Kt(s._requestManager,h.localIdeographFontFamily),this.lineAtlas=new jn(256,512),this.crossTileSymbolIndex=new Fc,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.az());const d=this;this._rtlTextPluginCallback=Nr.registerForPluginStateChange(g=>{d.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:g.pluginStatus,pluginURL:g.pluginURL},(b,I)=>{if(a.aA(b),I&&I.every(C=>C))for(const C in d.sourceCaches){const M=d.sourceCaches[C].getSource().type;M!=="vector"&&M!=="geojson"||d.sourceCaches[C].reload()}})}),this.on("data",g=>{if(g.dataType!=="source"||g.sourceDataType!=="metadata")return;const b=this.sourceCaches[g.sourceId];if(!b)return;const I=b.getSource();if(I&&I.vectorLayerIds)for(const C in this._layers){const M=this._layers[C];M.source===I.id&&this._validateLayer(M)}})}loadURL(s,h={},d){this.fire(new a.k("dataloading",{dataType:"style"})),h.validate=typeof h.validate!="boolean"||h.validate;const g=this.map._requestManager.transformRequest(s,K.Style);this._request=a.f(g,(b,I)=>{this._request=null,b?this.fire(new a.j(b)):I&&this._load(I,h,d)})}loadJSON(s,h={},d){this.fire(new a.k("dataloading",{dataType:"style"})),this._request=a.h.frame(()=>{this._request=null,h.validate=h.validate!==!1,this._load(s,h,d)})}loadEmpty(){this.fire(new a.k("dataloading",{dataType:"style"})),this._load(rs,{validate:!1})}_load(s,h,d){var g;const b=h.transformStyle?h.transformStyle(d,s):s;if(!h.validate||!qr(this,a.y(b))){this._loaded=!0,this.stylesheet=b;for(const I in b.sources)this.addSource(I,b.sources[I],{validate:!1});b.sprite?this._loadSprite(b.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(b.glyphs),this._createLayers(),this.light=new an(this.stylesheet.light),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new a.k("data",{dataType:"style"})),this.fire(new a.k("style.load"))}}_createLayers(){const s=a.aB(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",s),this._order=s.map(h=>h.id),this._layers={},this._serializedLayers=null;for(const h of s){const d=a.aC(h);d.setEventedParent(this,{layer:{id:h.id}}),this._layers[h.id]=d}}_loadSprite(s,h=!1,d=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(g,b,I,C){const M=dt(g),k=M.length,R=I>1?"@2x":"",z={},W={},nt={};for(const{id:et,url:at}of M){const $=b.transformRequest(b.normalizeSpriteURL(at,R,".json"),K.SpriteJSON),St=`${et}_${$.url}`;z[St]=a.f($,(It,Bt)=>{delete z[St],W[et]=Bt,ut(C,W,nt,It,k)});const Ot=b.transformRequest(b.normalizeSpriteURL(at,R,".png"),K.SpriteImage),ct=`${et}_${Ot.url}`;z[ct]=G.getImage(Ot,(It,Bt)=>{delete z[ct],nt[et]=Bt,ut(C,W,nt,It,k)})}return{cancel(){for(const et of Object.values(z))et.cancel()}}}(s,this.map._requestManager,this.map.getPixelRatio(),(g,b)=>{if(this._spriteRequest=null,g)this.fire(new a.j(g));else if(b)for(const I in b){this._spritesImagesIds[I]=[];const C=this._spritesImagesIds[I]?this._spritesImagesIds[I].filter(M=>!(M in b)):[];for(const M of C)this.imageManager.removeImage(M),this._changedImages[M]=!0;for(const M in b[I]){const k=I==="default"?M:`${I}:${M}`;this._spritesImagesIds[I].push(k),k in this.imageManager.images?this.imageManager.updateImage(k,b[I][M],!1):this.imageManager.addImage(k,b[I][M]),h&&(this._changedImages[k]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),h&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.k("data",{dataType:"style"})),d&&d(g)})}_unloadSprite(){for(const s of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(s),this._changedImages[s]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}_validateLayer(s){const h=this.sourceCaches[s.source];if(!h)return;const d=s.sourceLayer;if(!d)return;const g=h.getSource();(g.type==="geojson"||g.vectorLayerIds&&g.vectorLayerIds.indexOf(d)===-1)&&this.fire(new a.j(new Error(`Source layer "${d}" does not exist on source "${g.id}" as specified by style layer "${s.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const s in this.sourceCaches)if(!this.sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(s){const h=this._serializedAllLayers();if(!s||s.length===0)return Object.values(h);const d=[];for(const g of s)h[g]&&d.push(h[g]);return d}_serializedAllLayers(){let s=this._serializedLayers;if(s)return s;s=this._serializedLayers={};const h=Object.keys(this._layers);for(const d of h){const g=this._layers[d];g.type!=="custom"&&(s[d]=g.serialize())}return s}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const s in this.sourceCaches)if(this.sourceCaches[s].hasTransition())return!0;for(const s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(s){if(!this._loaded)return;const h=this._changed;if(this._changed){const g=Object.keys(this._updatedLayers),b=Object.keys(this._removedLayers);(g.length||b.length)&&this._updateWorkerLayers(g,b);for(const I in this._updatedSources){const C=this._updatedSources[I];if(C==="reload")this._reloadSource(I);else{if(C!=="clear")throw new Error(`Invalid action ${C}`);this._clearSource(I)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const I in this._updatedPaintProps)this._layers[I].updateTransitions(s);this.light.updateTransitions(s),this._resetUpdates()}const d={};for(const g in this.sourceCaches){const b=this.sourceCaches[g];d[g]=b.used,b.used=!1}for(const g of this._order){const b=this._layers[g];b.recalculate(s,this._availableImages),!b.isHidden(s.zoom)&&b.source&&(this.sourceCaches[b.source].used=!0)}for(const g in d){const b=this.sourceCaches[g];d[g]!==b.used&&b.fire(new a.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:g}))}this.light.recalculate(s),this.z=s.zoom,h&&this.fire(new a.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const h in this.sourceCaches)this.sourceCaches[h].reloadTilesForDependencies(["icons","patterns"],s);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(s,h){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(s),removedIds:h})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(s,h={}){this._checkLoaded();const d=this.serialize();if(s=h.transformStyle?h.transformStyle(d,s):s,qr(this,a.y(s)))return!1;(s=a.aD(s)).layers=a.aB(s.layers);const g=a.aE(d,s).filter(I=>!(I.command in Rg));if(g.length===0)return!1;const b=g.filter(I=>!(I.command in No));if(b.length>0)throw new Error(`Unimplemented: ${b.map(I=>I.command).join(", ")}.`);for(const I of g)I.command!=="setTransition"&&this[I.command].apply(this,I.args);return this.stylesheet=s,this._serializedLayers=null,!0}addImage(s,h){if(this.getImage(s))return this.fire(new a.j(new Error(`An image named "${s}" already exists.`)));this.imageManager.addImage(s,h),this._afterImageUpdated(s)}updateImage(s,h){this.imageManager.updateImage(s,h)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){if(!this.getImage(s))return this.fire(new a.j(new Error(`An image named "${s}" does not exist.`)));this.imageManager.removeImage(s),this._afterImageUpdated(s)}_afterImageUpdated(s){this._availableImages=this.imageManager.listImages(),this._changedImages[s]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,h,d={}){if(this._checkLoaded(),this.sourceCaches[s]!==void 0)throw new Error(`Source "${s}" 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.y.source,`sources.${s}`,h,null,d))return;this.map&&this.map._collectResourceTiming&&(h.collectResourceTiming=!0);const g=this.sourceCaches[s]=new Oi(s,h,this.dispatcher);g.style=this,g.setEventedParent(this,()=>({isSourceLoaded:g.loaded(),source:g.serialize(),sourceId:s})),g.onAdd(this.map),this._changed=!0}removeSource(s){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===s)return this.fire(new a.j(new Error(`Source "${s}" cannot be removed while layer "${d}" is using it.`)));const h=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],h.fire(new a.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:s})),h.setEventedParent(null),h.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(s,h){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error(`There is no source with this ID=${s}`);const d=this.sourceCaches[s].getSource();if(d.type!=="geojson")throw new Error(`geojsonSource.type is ${d.type}, which is !== 'geojson`);d.setData(h),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,h,d={}){this._checkLoaded();const g=s.id;if(this.getLayer(g))return void this.fire(new a.j(new Error(`Layer "${g}" already exists on this map.`)));let b;if(s.type==="custom"){if(qr(this,a.aF(s)))return;b=a.aC(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(g,s.source),s=a.aD(s),s=a.e(s,{source:g})),this._validate(a.y.layer,`layers.${g}`,s,{arrayIndex:-1},d))return;b=a.aC(s),this._validateLayer(b),b.setEventedParent(this,{layer:{id:g}})}const I=h?this._order.indexOf(h):this._order.length;if(h&&I===-1)this.fire(new a.j(new Error(`Cannot add layer "${g}" before non-existing layer "${h}".`)));else{if(this._order.splice(I,0,g),this._layerOrderChanged=!0,this._layers[g]=b,this._removedLayers[g]&&b.source&&b.type!=="custom"){const C=this._removedLayers[g];delete this._removedLayers[g],C.type!==b.type?this._updatedSources[b.source]="clear":(this._updatedSources[b.source]="reload",this.sourceCaches[b.source].pause())}this._updateLayer(b),b.onAdd&&b.onAdd(this.map)}}moveLayer(s,h){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new a.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===h)return;const d=this._order.indexOf(s);this._order.splice(d,1);const g=h?this._order.indexOf(h):this._order.length;h&&g===-1?this.fire(new a.j(new Error(`Cannot move layer "${s}" before non-existing layer "${h}".`))):(this._order.splice(g,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();const h=this._layers[s];if(!h)return void this.fire(new a.j(new Error(`Cannot remove non-existing layer "${s}".`)));h.setEventedParent(null);const d=this._order.indexOf(s);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=h,delete this._layers[s],this._serializedLayers&&delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],h.onRemove&&h.onRemove(this.map)}getLayer(s){return this._layers[s]}getLayersOrder(){return[...this._order]}hasLayer(s){return s in this._layers}setLayerZoomRange(s,h,d){this._checkLoaded();const g=this.getLayer(s);g?g.minzoom===h&&g.maxzoom===d||(h!=null&&(g.minzoom=h),d!=null&&(g.maxzoom=d),this._updateLayer(g)):this.fire(new a.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,h,d={}){this._checkLoaded();const g=this.getLayer(s);if(g){if(!a.aG(g.filter,h))return h==null?(g.filter=void 0,void this._updateLayer(g)):void(this._validate(a.y.filter,`layers.${g.id}.filter`,h,null,d)||(g.filter=a.aD(h),this._updateLayer(g)))}else this.fire(new a.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return a.aD(this.getLayer(s).filter)}setLayoutProperty(s,h,d,g={}){this._checkLoaded();const b=this.getLayer(s);b?a.aG(b.getLayoutProperty(h),d)||(b.setLayoutProperty(h,d,g),this._updateLayer(b)):this.fire(new a.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,h){const d=this.getLayer(s);if(d)return d.getLayoutProperty(h);this.fire(new a.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,h,d,g={}){this._checkLoaded();const b=this.getLayer(s);b?a.aG(b.getPaintProperty(h),d)||(b.setPaintProperty(h,d,g)&&this._updateLayer(b),this._changed=!0,this._updatedPaintProps[s]=!0):this.fire(new a.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,h){return this.getLayer(s).getPaintProperty(h)}setFeatureState(s,h){this._checkLoaded();const d=s.source,g=s.sourceLayer,b=this.sourceCaches[d];if(b===void 0)return void this.fire(new a.j(new Error(`The source '${d}' does not exist in the map's style.`)));const I=b.getSource().type;I==="geojson"&&g?this.fire(new a.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):I!=="vector"||g?(s.id===void 0&&this.fire(new a.j(new Error("The feature id parameter must be provided."))),b.setFeatureState(g,s.id,h)):this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,h){this._checkLoaded();const d=s.source,g=this.sourceCaches[d];if(g===void 0)return void this.fire(new a.j(new Error(`The source '${d}' does not exist in the map's style.`)));const b=g.getSource().type,I=b==="vector"?s.sourceLayer:void 0;b!=="vector"||I?h&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new a.j(new Error("A feature id is required to remove its specific state property."))):g.removeFeatureState(I,s.id,h):this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const h=s.source,d=s.sourceLayer,g=this.sourceCaches[h];if(g!==void 0)return g.getSource().type!=="vector"||d?(s.id===void 0&&this.fire(new a.j(new Error("The feature id parameter must be provided."))),g.getFeatureState(d,s.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 s=a.aH(this.sourceCaches,b=>b.serialize()),h=this._serializeByIds(this._order),d=this.map.getTerrain()||void 0,g=this.stylesheet;return a.aI({version:g.version,name:g.name,metadata:g.metadata,light:g.light,center:g.center,zoom:g.zoom,bearing:g.bearing,pitch:g.pitch,sprite:g.sprite,glyphs:g.glyphs,transition:g.transition,sources:s,layers:h,terrain:d},b=>b!==void 0)}_updateLayer(s){this._updatedLayers[s.id]=!0,s.source&&!this._updatedSources[s.source]&&this.sourceCaches[s.source].getSource().type!=="raster"&&(this._updatedSources[s.source]="reload",this.sourceCaches[s.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(s){const h=I=>this._layers[I].type==="fill-extrusion",d={},g=[];for(let I=this._order.length-1;I>=0;I--){const C=this._order[I];if(h(C)){d[C]=I;for(const M of s){const k=M[C];if(k)for(const R of k)g.push(R)}}}g.sort((I,C)=>C.intersectionZ-I.intersectionZ);const b=[];for(let I=this._order.length-1;I>=0;I--){const C=this._order[I];if(h(C))for(let M=g.length-1;M>=0;M--){const k=g[M].feature;if(d[k.layer.id]{const ne=St.featureSortOrder;if(ne){const Qt=ne.indexOf(Vt.featureIndex);return ne.indexOf(Xt.featureIndex)-Qt}return Xt.featureIndex-Vt.featureIndex});for(const Vt of Bt)It.push(Vt)}}for(const St in et)et[St].forEach(Ot=>{const ct=Ot.feature,It=k[C[St].source].getFeatureState(ct.layer["source-layer"],ct.id);ct.source=ct.layer.source,ct.layer["source-layer"]&&(ct.sourceLayer=ct.layer["source-layer"]),ct.state=It});return et}(this._layers,I,this.sourceCaches,s,h,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(b)}querySourceFeatures(s,h){h&&h.filter&&this._validate(a.y.filter,"querySourceFeatures.filter",h.filter,null,h);const d=this.sourceCaches[s];return d?function(g,b){const I=g.getRenderableIds().map(k=>g.getTileByID(k)),C=[],M={};for(let k=0;k{Ct[g]=b})(s,h),h.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:s,url:h.workerSourceURL},d):d(null,null))}getLight(){return this.light.getLight()}setLight(s,h={}){this._checkLoaded();const d=this.light.getLight();let g=!1;for(const I in s)if(!a.aG(s[I],d[I])){g=!0;break}if(!g)return;const b={now:a.h.now(),transition:a.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(s,h),this.light.updateTransitions(b)}_validate(s,h,d,g,b={}){return(!b||b.validate!==!1)&&qr(this,s.call(a.y,a.e({key:h,style:this.serialize(),value:d,styleSpec:a.v},g)))}_remove(s=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.aJ.off("pluginStateChange",this._rtlTextPluginCallback);for(const h in this._layers)this._layers[h].setEventedParent(null);for(const h in this.sourceCaches){const d=this.sourceCaches[h];d.setEventedParent(null),d.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(s)}_clearSource(s){this.sourceCaches[s].clearTiles()}_reloadSource(s){this.sourceCaches[s].resume(),this.sourceCaches[s].reload()}_updateSources(s){for(const h in this.sourceCaches)this.sourceCaches[h].update(s,this.map.terrain)}_generateCollisionBoxes(){for(const s in this.sourceCaches)this._reloadSource(s)}_updatePlacement(s,h,d,g,b=!1){let I=!1,C=!1;const M={};for(const k of this._order){const R=this._layers[k];if(R.type!=="symbol")continue;if(!M[R.source]){const W=this.sourceCaches[R.source];M[R.source]=W.getRenderableIds(!0).map(nt=>W.getTileByID(nt)).sort((nt,et)=>et.tileID.overscaledZ-nt.tileID.overscaledZ||(nt.tileID.isLessThan(et.tileID)?-1:1))}const z=this.crossTileSymbolIndex.addLayer(R,M[R.source],s.center.lng);I=I||z}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((b=b||this._layerOrderChanged||d===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.h.now(),s.zoom))&&(this.pauseablePlacement=new ou(s,this.map.terrain,this._order,b,h,d,g,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,M),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.h.now()),C=!0),I&&this.pauseablePlacement.placement.setStale()),C||I)for(const k of this._order){const R=this._layers[k];R.type==="symbol"&&this.placement.updateLayerOpacities(R,M[R.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.h.now())}_releaseSymbolFadeTiles(){for(const s in this.sourceCaches)this.sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,h,d){this.imageManager.getImages(h.icons,d),this._updateTilesForChangedImages();const g=this.sourceCaches[h.source];g&&g.setDependencies(h.tileID.key,h.type,h.icons)}getGlyphs(s,h,d){this.glyphManager.getGlyphs(h.stacks,d);const g=this.sourceCaches[h.source];g&&g.setDependencies(h.tileID.key,h.type,[""])}getResource(s,h,d){return a.m(h,d)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,h={}){this._checkLoaded(),s&&this._validate(a.y.glyphs,"glyphs",s,null,h)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,h,d={},g){this._checkLoaded();const b=[{id:s,url:h}],I=[...dt(this.stylesheet.sprite),...b];this._validate(a.y.sprite,"sprite",I,null,d)||(this.stylesheet.sprite=I,this._loadSprite(b,!0,g))}removeSprite(s){this._checkLoaded();const h=dt(this.stylesheet.sprite);if(h.find(d=>d.id===s)){if(this._spritesImagesIds[s])for(const d of this._spritesImagesIds[s])this.imageManager.removeImage(d),this._changedImages[d]=!0;h.splice(h.findIndex(d=>d.id===s),1),this.stylesheet.sprite=h.length>0?h:void 0,delete this._spritesImagesIds[s],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}else this.fire(new a.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return dt(this.stylesheet.sprite)}setSprite(s,h={},d){this._checkLoaded(),s&&this._validate(a.y.sprite,"sprite",s,null,h)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,d):(this._unloadSprite(),d&&d(null)))}}Nr.registerForPluginStateChange=a.aK;var Bc=a.Q([{name:"a_pos",type:"Int16",components:2}]),au="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 vi={prelude:zn(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -56,15 +56,15 @@ vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=frac #else return 0.0; #endif -}`),background:Fn(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity; +}`),background:zn(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity; #ifdef OVERDRAW_INSPECTOR gl_FragColor=vec4(1.0); #endif -}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:Fn(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity; +}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:zn(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity; #ifdef OVERDRAW_INSPECTOR gl_FragColor=vec4(1.0); #endif -}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:Fn(`varying vec3 v_data;varying float v_visibility; +}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:zn(`varying vec3 v_data;varying float v_visibility; #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump float radius #pragma mapbox: define lowp float blur @@ -100,7 +100,7 @@ void main(void) { #pragma mapbox: initialize highp vec4 stroke_color #pragma mapbox: initialize mediump float stroke_width #pragma mapbox: initialize lowp float stroke_opacity -vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Fn("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Fn(`uniform highp float u_intensity;varying vec2 v_extrude; +vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:zn("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:zn(`uniform highp float u_intensity;varying vec2 v_extrude; #pragma mapbox: define highp float weight #define GAUSS_COEF 0.3989422804014327 void main() { @@ -117,11 +117,11 @@ const highp float ZERO=1.0/255.0/16.0; void main(void) { #pragma mapbox: initialize highp float weight #pragma mapbox: initialize mediump float radius -vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:Fn(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity; +vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:zn(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity; #ifdef OVERDRAW_INSPECTOR gl_FragColor=vec4(0.0); #endif -}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:Fn("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Fn("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:Fn("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:Fn(`#pragma mapbox: define highp vec4 color +}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:zn("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:zn("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:zn("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:zn(`#pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize highp vec4 color @@ -136,7 +136,7 @@ gl_FragColor=vec4(1.0); void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float opacity -gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:Fn(`varying vec2 v_pos; +gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:zn(`varying vec2 v_pos; #pragma mapbox: define highp vec4 outline_color #pragma mapbox: define lowp float opacity void main() { @@ -152,7 +152,7 @@ gl_FragColor=vec4(1.0); void main() { #pragma mapbox: initialize highp vec4 outline_color #pragma mapbox: initialize lowp float opacity -gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:Fn(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; +gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:zn(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to @@ -176,7 +176,7 @@ void main() { #pragma mapbox: initialize mediump vec4 pattern_to #pragma mapbox: initialize lowp float pixel_ratio_from #pragma mapbox: initialize lowp float pixel_ratio_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:Fn(`#ifdef GL_ES +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:zn(`#ifdef GL_ES precision highp float; #endif uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b; @@ -203,7 +203,7 @@ void main() { #pragma mapbox: initialize mediump vec4 pattern_to #pragma mapbox: initialize lowp float pixel_ratio_from #pragma mapbox: initialize lowp float pixel_ratio_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:Fn(`varying vec4 v_color;void main() {gl_FragColor=v_color; +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:zn(`varying vec4 v_color;void main() {gl_FragColor=v_color; #ifdef OVERDRAW_INSPECTOR gl_FragColor=vec4(1.0); #endif @@ -225,7 +225,7 @@ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_off #else float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; #endif -base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:Fn(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; +base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:zn(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; #pragma mapbox: define lowp float base #pragma mapbox: define lowp float height #pragma mapbox: define lowp vec4 pattern_from @@ -269,20 +269,20 @@ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; #endif base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 ? a_pos -: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:Fn(`#ifdef GL_ES +: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:zn(`#ifdef GL_ES precision highp float; #endif uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0); #ifdef OVERDRAW_INSPECTOR gl_FragColor=vec4(1.0); #endif -}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Fn(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent; +}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:zn(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent; #define PI 3.141592653589793 void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color; #ifdef OVERDRAW_INSPECTOR gl_FragColor=vec4(1.0); #endif -}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:Fn(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale; +}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:zn(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale; #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity @@ -316,7 +316,7 @@ v_gamma_scale=1.0; #else float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; #endif -v_width2=vec2(outset,inset);}`),lineGradient:Fn(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv; +v_width2=vec2(outset,inset);}`),lineGradient:zn(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv; #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity void main() { @@ -346,7 +346,7 @@ v_gamma_scale=1.0; #else float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; #endif -v_width2=vec2(outset,inset);}`),linePattern:Fn(`#ifdef GL_ES +v_width2=vec2(outset,inset);}`),linePattern:zn(`#ifdef GL_ES precision highp float; #endif uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; @@ -398,7 +398,7 @@ v_gamma_scale=1.0; #else float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; #endif -v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Fn(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; +v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:zn(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity @@ -439,11 +439,11 @@ v_gamma_scale=1.0; #else float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; #endif -v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:Fn(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); +v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:zn(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); #ifdef OVERDRAW_INSPECTOR gl_FragColor=vec4(1.0); #endif -}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:Fn(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity; +}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:zn(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity; #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize lowp float opacity @@ -457,7 +457,7 @@ void main() { #pragma mapbox: initialize lowp float opacity vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:Fn(`#define SDF_PX 8.0 +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:zn(`#define SDF_PX 8.0 uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1; #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color @@ -488,7 +488,7 @@ void main() { #pragma mapbox: initialize lowp float halo_blur vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:Fn(`#define SDF_PX 8.0 +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:zn(`#define SDF_PX 8.0 #define SDF 1.0 #define ICON 0.0 uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1; @@ -525,62 +525,62 @@ void main() { #pragma mapbox: initialize lowp float halo_blur vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:Fn("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",au),terrainDepth:Fn("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",au),terrainCoords:Fn("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",au)};function Fn(y,s){const h=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=s.match(/attribute ([\w]+) ([\w]+)/g),g=y.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),b=s.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),I=b?b.concat(g):g,C={};return{fragmentSource:y=y.replace(h,(M,k,R,O,q)=>(C[q]=!0,k==="define"?` -#ifndef HAS_UNIFORM_u_${q} -varying ${R} ${O} ${q}; +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:zn("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",au),terrainDepth:zn("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",au),terrainCoords:zn("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",au)};function zn(y,s){const h=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=s.match(/attribute ([\w]+) ([\w]+)/g),g=y.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),b=s.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),I=b?b.concat(g):g,C={};return{fragmentSource:y=y.replace(h,(M,k,R,z,W)=>(C[W]=!0,k==="define"?` +#ifndef HAS_UNIFORM_u_${W} +varying ${R} ${z} ${W}; #else -uniform ${R} ${O} u_${q}; +uniform ${R} ${z} u_${W}; #endif `:` -#ifdef HAS_UNIFORM_u_${q} - ${R} ${O} ${q} = u_${q}; -#endif -`)),vertexSource:s=s.replace(h,(M,k,R,O,q)=>{const nt=O==="float"?"vec2":"vec4",et=q.match(/color/)?"color":nt;return C[q]?k==="define"?` -#ifndef HAS_UNIFORM_u_${q} -uniform lowp float u_${q}_t; -attribute ${R} ${nt} a_${q}; -varying ${R} ${O} ${q}; +#ifdef HAS_UNIFORM_u_${W} + ${R} ${z} ${W} = u_${W}; +#endif +`)),vertexSource:s=s.replace(h,(M,k,R,z,W)=>{const nt=z==="float"?"vec2":"vec4",et=W.match(/color/)?"color":nt;return C[W]?k==="define"?` +#ifndef HAS_UNIFORM_u_${W} +uniform lowp float u_${W}_t; +attribute ${R} ${nt} a_${W}; +varying ${R} ${z} ${W}; #else -uniform ${R} ${O} u_${q}; +uniform ${R} ${z} u_${W}; #endif `:et==="vec4"?` -#ifndef HAS_UNIFORM_u_${q} - ${q} = a_${q}; +#ifndef HAS_UNIFORM_u_${W} + ${W} = a_${W}; #else - ${R} ${O} ${q} = u_${q}; + ${R} ${z} ${W} = u_${W}; #endif `:` -#ifndef HAS_UNIFORM_u_${q} - ${q} = unpack_mix_${et}(a_${q}, u_${q}_t); +#ifndef HAS_UNIFORM_u_${W} + ${W} = unpack_mix_${et}(a_${W}, u_${W}_t); #else - ${R} ${O} ${q} = u_${q}; + ${R} ${z} ${W} = u_${W}; #endif `:k==="define"?` -#ifndef HAS_UNIFORM_u_${q} -uniform lowp float u_${q}_t; -attribute ${R} ${nt} a_${q}; +#ifndef HAS_UNIFORM_u_${W} +uniform lowp float u_${W}_t; +attribute ${R} ${nt} a_${W}; #else -uniform ${R} ${O} u_${q}; +uniform ${R} ${z} u_${W}; #endif `:et==="vec4"?` -#ifndef HAS_UNIFORM_u_${q} - ${R} ${O} ${q} = a_${q}; +#ifndef HAS_UNIFORM_u_${W} + ${R} ${z} ${W} = a_${W}; #else - ${R} ${O} ${q} = u_${q}; + ${R} ${z} ${W} = u_${W}; #endif `:` -#ifndef HAS_UNIFORM_u_${q} - ${R} ${O} ${q} = unpack_mix_${et}(a_${q}, u_${q}_t); +#ifndef HAS_UNIFORM_u_${W} + ${R} ${z} ${W} = unpack_mix_${et}(a_${W}, u_${W}_t); #else - ${R} ${O} ${q} = u_${q}; + ${R} ${z} ${W} = u_${W}; #endif -`}),staticAttributes:d,staticUniforms:I}}class wl{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(s,h,d,g,b,I,C,M,k){this.context=s;let R=this.boundPaintVertexBuffers.length!==g.length;for(let O=0;!R&&O({u_depth:new a.aL(Vt,Wt.u_depth),u_terrain:new a.aL(Vt,Wt.u_terrain),u_terrain_dim:new a.aM(Vt,Wt.u_terrain_dim),u_terrain_matrix:new a.aN(Vt,Wt.u_terrain_matrix),u_terrain_unpack:new a.aO(Vt,Wt.u_terrain_unpack),u_terrain_exaggeration:new a.aM(Vt,Wt.u_terrain_exaggeration)}))(s,Bt),this.binderUniforms=d?d.getUniforms(s,Bt):[]}draw(s,h,d,g,b,I,C,M,k,R,O,q,nt,et,lt,$,St,Ot){const pt=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(d),s.setStencilMode(g),s.setColorMode(b),s.setCullFace(I),M){s.activeTexture.set(pt.TEXTURE2),pt.bindTexture(pt.TEXTURE_2D,M.depthTexture),s.activeTexture.set(pt.TEXTURE3),pt.bindTexture(pt.TEXTURE_2D,M.texture);for(const Bt in this.terrainUniforms)this.terrainUniforms[Bt].set(M[Bt])}for(const Bt in this.fixedUniforms)this.fixedUniforms[Bt].set(C[Bt]);lt&<.setUniforms(s,this.binderUniforms,nt,{zoom:et});let Ct=0;switch(h){case pt.LINES:Ct=2;break;case pt.TRIANGLES:Ct=3;break;case pt.LINE_STRIP:Ct=1}for(const Bt of q.get()){const Vt=Bt.vaos||(Bt.vaos={});(Vt[k]||(Vt[k]=new wl)).bind(s,this,R,lt?lt.getPaintVertexBuffers():[],O,Bt.vertexOffset,$,St,Ot),pt.drawElements(h,Bt.primitiveLength*Ct,pt.UNSIGNED_SHORT,Bt.primitiveOffset*Ct*2)}}}function rs(y,s,h){const d=1/mt(h,1,s.transform.tileZoom),g=Math.pow(2,h.tileID.overscaledZ),b=h.tileSize*Math.pow(2,s.transform.tileZoom)/g,I=b*(h.tileID.canonical.x+h.tileID.wrap*g),C=b*h.tileID.canonical.y;return{u_image:0,u_texsize:h.imageAtlasTexture.size,u_scale:[d,y.fromScale,y.toScale],u_fade:y.t,u_pixel_coord_upper:[I>>16,C>>16],u_pixel_coord_lower:[65535&I,65535&C]}}const dp=(y,s,h,d)=>{const g=s.style.light,b=g.properties.get("position"),I=[b.x,b.y,b.z],C=function(){var k=new a.A(9);return a.A!=Float32Array&&(k[1]=0,k[2]=0,k[3]=0,k[5]=0,k[6]=0,k[7]=0),k[0]=1,k[4]=1,k[8]=1,k}();g.properties.get("anchor")==="viewport"&&function(k,R){var O=Math.sin(R),q=Math.cos(R);k[0]=q,k[1]=O,k[2]=0,k[3]=-O,k[4]=q,k[5]=0,k[6]=0,k[7]=0,k[8]=1}(C,-s.transform.angle),function(k,R,O){var q=R[0],nt=R[1],et=R[2];k[0]=q*O[0]+nt*O[3]+et*O[6],k[1]=q*O[1]+nt*O[4]+et*O[7],k[2]=q*O[2]+nt*O[5]+et*O[8]}(I,I,C);const M=g.properties.get("color");return{u_matrix:y,u_lightpos:I,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+h,u_opacity:d}},Ya=(y,s,h,d,g,b,I)=>a.e(dp(y,s,h,d),rs(b,s,I),{u_height_factor:-Math.pow(2,g.overscaledZ)/I.tileSize/8}),wd=y=>({u_matrix:y}),mp=(y,s,h,d)=>a.e(wd(y),rs(h,s,d)),Uc=(y,s)=>({u_matrix:y,u_world:s}),Gc=(y,s,h,d,g)=>a.e(mp(y,s,h,d),{u_world:g}),Ka=(y,s,h,d)=>{const g=y.transform;let b,I;if(d.paint.get("circle-pitch-alignment")==="map"){const C=mt(h,1,g.zoom);b=!0,I=[C,C]}else b=!1,I=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:y.translatePosMatrix(s.posMatrix,h,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+b,u_device_pixel_ratio:y.pixelRatio,u_extrude_scale:I}},gp=(y,s,h)=>{const d=mt(h,1,s.zoom),g=Math.pow(2,s.zoom-h.tileID.overscaledZ),b=h.tileID.overscaleFactor();return{u_matrix:y,u_camera_to_center_distance:s.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[s.pixelsToGLUnits[0]/(d*g),s.pixelsToGLUnits[1]/(d*g)],u_overscale_factor:b}},Yu=(y,s,h=1)=>({u_matrix:y,u_color:s,u_overlay:0,u_overlay_scale:h}),Sd=y=>({u_matrix:y}),Og=(y,s,h,d)=>({u_matrix:y,u_extrude_scale:mt(s,1,h),u_intensity:d});function _p(y,s){const h=Math.pow(2,s.canonical.z),d=s.canonical.y;return[new a.U(0,d/h).toLngLat().lat,new a.U(0,(d+1)/h).toLngLat().lat]}const yp=(y,s,h,d)=>{const g=y.transform;return{u_matrix:jc(y,s,h,d),u_ratio:1/mt(s,1,g.zoom),u_device_pixel_ratio:y.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},Ed=(y,s,h,d,g)=>a.e(yp(y,s,h,g),{u_image:0,u_image_height:d}),zg=(y,s,h,d,g)=>{const b=y.transform,I=Cd(s,b);return{u_matrix:jc(y,s,h,g),u_texsize:s.imageAtlasTexture.size,u_ratio:1/mt(s,1,b.zoom),u_device_pixel_ratio:y.pixelRatio,u_image:0,u_scale:[I,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/b.pixelsToGLUnits[0],1/b.pixelsToGLUnits[1]]}},Id=(y,s,h,d,g,b)=>{const I=y.lineAtlas,C=Cd(s,y.transform),M=h.layout.get("line-cap")==="round",k=I.getDash(d.from,M),R=I.getDash(d.to,M),O=k.width*g.fromScale,q=R.width*g.toScale;return a.e(yp(y,s,h,b),{u_patternscale_a:[C/O,-k.height/2],u_patternscale_b:[C/q,-R.height/2],u_sdfgamma:I.width/(256*Math.min(O,q)*y.pixelRatio)/2,u_image:0,u_tex_y_a:k.y,u_tex_y_b:R.y,u_mix:g.t})};function Cd(y,s){return 1/mt(y,1,s.tileZoom)}function jc(y,s,h,d){return y.translatePosMatrix(d?d.posMatrix:s.tileID.posMatrix,s,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}const Td=(y,s,h,d,g)=>{return{u_matrix:y,u_tl_parent:s,u_scale_parent:h,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*g.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:g.paint.get("raster-brightness-min"),u_brightness_high:g.paint.get("raster-brightness-max"),u_saturation_factor:(I=g.paint.get("raster-saturation"),I>0?1-1/(1.001-I):-I),u_contrast_factor:(b=g.paint.get("raster-contrast"),b>0?1/(1-b):1+b),u_spin_weights:Ld(g.paint.get("raster-hue-rotate"))};var b,I};function Ld(y){y*=Math.PI/180;const s=Math.sin(y),h=Math.cos(y);return[(2*h+1)/3,(-Math.sqrt(3)*s-h+1)/3,(Math.sqrt(3)*s-h+1)/3]}const vp=(y,s,h,d,g,b,I,C,M,k)=>{const R=g.transform;return{u_is_size_zoom_constant:+(y==="constant"||y==="source"),u_is_size_feature_constant:+(y==="constant"||y==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:R.cameraToCenterDistance,u_pitch:R.pitch/360*2*Math.PI,u_rotate_symbol:+h,u_aspect_ratio:R.width/R.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:b,u_label_plane_matrix:I,u_coord_matrix:C,u_is_text:+M,u_pitch_with_map:+d,u_texsize:k,u_texture:0}},bp=(y,s,h,d,g,b,I,C,M,k,R)=>{const O=g.transform;return a.e(vp(y,s,h,d,g,b,I,C,M,k),{u_gamma_scale:d?Math.cos(O._pitch)*O.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+R})},Sl=(y,s,h,d,g,b,I,C,M,k)=>a.e(bp(y,s,h,d,g,b,I,C,!0,M,!0),{u_texsize_icon:k,u_texture_icon:1}),qc=(y,s,h)=>({u_matrix:y,u_opacity:s,u_color:h}),os=(y,s,h,d,g,b)=>a.e(function(I,C,M,k){const R=M.imageManager.getPattern(I.from.toString()),O=M.imageManager.getPattern(I.to.toString()),{width:q,height:nt}=M.imageManager.getPixelSize(),et=Math.pow(2,k.tileID.overscaledZ),lt=k.tileSize*Math.pow(2,M.transform.tileZoom)/et,$=lt*(k.tileID.canonical.x+k.tileID.wrap*et),St=lt*k.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:R.tl,u_pattern_br_a:R.br,u_pattern_tl_b:O.tl,u_pattern_br_b:O.br,u_texsize:[q,nt],u_mix:C.t,u_pattern_size_a:R.displaySize,u_pattern_size_b:O.displaySize,u_scale_a:C.fromScale,u_scale_b:C.toScale,u_tile_units_to_pixels:1/mt(k,1,M.transform.tileZoom),u_pixel_coord_upper:[$>>16,St>>16],u_pixel_coord_lower:[65535&$,65535&St]}}(d,b,h,g),{u_matrix:y,u_opacity:s}),Zc={fillExtrusion:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_lightpos:new a.aP(y,s.u_lightpos),u_lightintensity:new a.aM(y,s.u_lightintensity),u_lightcolor:new a.aP(y,s.u_lightcolor),u_vertical_gradient:new a.aM(y,s.u_vertical_gradient),u_opacity:new a.aM(y,s.u_opacity)}),fillExtrusionPattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_lightpos:new a.aP(y,s.u_lightpos),u_lightintensity:new a.aM(y,s.u_lightintensity),u_lightcolor:new a.aP(y,s.u_lightcolor),u_vertical_gradient:new a.aM(y,s.u_vertical_gradient),u_height_factor:new a.aM(y,s.u_height_factor),u_image:new a.aL(y,s.u_image),u_texsize:new a.aQ(y,s.u_texsize),u_pixel_coord_upper:new a.aQ(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.aQ(y,s.u_pixel_coord_lower),u_scale:new a.aP(y,s.u_scale),u_fade:new a.aM(y,s.u_fade),u_opacity:new a.aM(y,s.u_opacity)}),fill:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix)}),fillPattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_image:new a.aL(y,s.u_image),u_texsize:new a.aQ(y,s.u_texsize),u_pixel_coord_upper:new a.aQ(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.aQ(y,s.u_pixel_coord_lower),u_scale:new a.aP(y,s.u_scale),u_fade:new a.aM(y,s.u_fade)}),fillOutline:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_world:new a.aQ(y,s.u_world)}),fillOutlinePattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_world:new a.aQ(y,s.u_world),u_image:new a.aL(y,s.u_image),u_texsize:new a.aQ(y,s.u_texsize),u_pixel_coord_upper:new a.aQ(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.aQ(y,s.u_pixel_coord_lower),u_scale:new a.aP(y,s.u_scale),u_fade:new a.aM(y,s.u_fade)}),circle:(y,s)=>({u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_scale_with_map:new a.aL(y,s.u_scale_with_map),u_pitch_with_map:new a.aL(y,s.u_pitch_with_map),u_extrude_scale:new a.aQ(y,s.u_extrude_scale),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_matrix:new a.aN(y,s.u_matrix)}),collisionBox:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_pixels_to_tile_units:new a.aM(y,s.u_pixels_to_tile_units),u_extrude_scale:new a.aQ(y,s.u_extrude_scale),u_overscale_factor:new a.aM(y,s.u_overscale_factor)}),collisionCircle:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_inv_matrix:new a.aN(y,s.u_inv_matrix),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_viewport_size:new a.aQ(y,s.u_viewport_size)}),debug:(y,s)=>({u_color:new a.aR(y,s.u_color),u_matrix:new a.aN(y,s.u_matrix),u_overlay:new a.aL(y,s.u_overlay),u_overlay_scale:new a.aM(y,s.u_overlay_scale)}),clippingMask:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix)}),heatmap:(y,s)=>({u_extrude_scale:new a.aM(y,s.u_extrude_scale),u_intensity:new a.aM(y,s.u_intensity),u_matrix:new a.aN(y,s.u_matrix)}),heatmapTexture:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_world:new a.aQ(y,s.u_world),u_image:new a.aL(y,s.u_image),u_color_ramp:new a.aL(y,s.u_color_ramp),u_opacity:new a.aM(y,s.u_opacity)}),hillshade:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_image:new a.aL(y,s.u_image),u_latrange:new a.aQ(y,s.u_latrange),u_light:new a.aQ(y,s.u_light),u_shadow:new a.aR(y,s.u_shadow),u_highlight:new a.aR(y,s.u_highlight),u_accent:new a.aR(y,s.u_accent)}),hillshadePrepare:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_image:new a.aL(y,s.u_image),u_dimension:new a.aQ(y,s.u_dimension),u_zoom:new a.aM(y,s.u_zoom),u_unpack:new a.aO(y,s.u_unpack)}),line:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_ratio:new a.aM(y,s.u_ratio),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_units_to_pixels:new a.aQ(y,s.u_units_to_pixels)}),lineGradient:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_ratio:new a.aM(y,s.u_ratio),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_units_to_pixels:new a.aQ(y,s.u_units_to_pixels),u_image:new a.aL(y,s.u_image),u_image_height:new a.aM(y,s.u_image_height)}),linePattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_texsize:new a.aQ(y,s.u_texsize),u_ratio:new a.aM(y,s.u_ratio),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_image:new a.aL(y,s.u_image),u_units_to_pixels:new a.aQ(y,s.u_units_to_pixels),u_scale:new a.aP(y,s.u_scale),u_fade:new a.aM(y,s.u_fade)}),lineSDF:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_ratio:new a.aM(y,s.u_ratio),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_units_to_pixels:new a.aQ(y,s.u_units_to_pixels),u_patternscale_a:new a.aQ(y,s.u_patternscale_a),u_patternscale_b:new a.aQ(y,s.u_patternscale_b),u_sdfgamma:new a.aM(y,s.u_sdfgamma),u_image:new a.aL(y,s.u_image),u_tex_y_a:new a.aM(y,s.u_tex_y_a),u_tex_y_b:new a.aM(y,s.u_tex_y_b),u_mix:new a.aM(y,s.u_mix)}),raster:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_tl_parent:new a.aQ(y,s.u_tl_parent),u_scale_parent:new a.aM(y,s.u_scale_parent),u_buffer_scale:new a.aM(y,s.u_buffer_scale),u_fade_t:new a.aM(y,s.u_fade_t),u_opacity:new a.aM(y,s.u_opacity),u_image0:new a.aL(y,s.u_image0),u_image1:new a.aL(y,s.u_image1),u_brightness_low:new a.aM(y,s.u_brightness_low),u_brightness_high:new a.aM(y,s.u_brightness_high),u_saturation_factor:new a.aM(y,s.u_saturation_factor),u_contrast_factor:new a.aM(y,s.u_contrast_factor),u_spin_weights:new a.aP(y,s.u_spin_weights)}),symbolIcon:(y,s)=>({u_is_size_zoom_constant:new a.aL(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aL(y,s.u_is_size_feature_constant),u_size_t:new a.aM(y,s.u_size_t),u_size:new a.aM(y,s.u_size),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_pitch:new a.aM(y,s.u_pitch),u_rotate_symbol:new a.aL(y,s.u_rotate_symbol),u_aspect_ratio:new a.aM(y,s.u_aspect_ratio),u_fade_change:new a.aM(y,s.u_fade_change),u_matrix:new a.aN(y,s.u_matrix),u_label_plane_matrix:new a.aN(y,s.u_label_plane_matrix),u_coord_matrix:new a.aN(y,s.u_coord_matrix),u_is_text:new a.aL(y,s.u_is_text),u_pitch_with_map:new a.aL(y,s.u_pitch_with_map),u_texsize:new a.aQ(y,s.u_texsize),u_texture:new a.aL(y,s.u_texture)}),symbolSDF:(y,s)=>({u_is_size_zoom_constant:new a.aL(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aL(y,s.u_is_size_feature_constant),u_size_t:new a.aM(y,s.u_size_t),u_size:new a.aM(y,s.u_size),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_pitch:new a.aM(y,s.u_pitch),u_rotate_symbol:new a.aL(y,s.u_rotate_symbol),u_aspect_ratio:new a.aM(y,s.u_aspect_ratio),u_fade_change:new a.aM(y,s.u_fade_change),u_matrix:new a.aN(y,s.u_matrix),u_label_plane_matrix:new a.aN(y,s.u_label_plane_matrix),u_coord_matrix:new a.aN(y,s.u_coord_matrix),u_is_text:new a.aL(y,s.u_is_text),u_pitch_with_map:new a.aL(y,s.u_pitch_with_map),u_texsize:new a.aQ(y,s.u_texsize),u_texture:new a.aL(y,s.u_texture),u_gamma_scale:new a.aM(y,s.u_gamma_scale),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_is_halo:new a.aL(y,s.u_is_halo)}),symbolTextAndIcon:(y,s)=>({u_is_size_zoom_constant:new a.aL(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aL(y,s.u_is_size_feature_constant),u_size_t:new a.aM(y,s.u_size_t),u_size:new a.aM(y,s.u_size),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_pitch:new a.aM(y,s.u_pitch),u_rotate_symbol:new a.aL(y,s.u_rotate_symbol),u_aspect_ratio:new a.aM(y,s.u_aspect_ratio),u_fade_change:new a.aM(y,s.u_fade_change),u_matrix:new a.aN(y,s.u_matrix),u_label_plane_matrix:new a.aN(y,s.u_label_plane_matrix),u_coord_matrix:new a.aN(y,s.u_coord_matrix),u_is_text:new a.aL(y,s.u_is_text),u_pitch_with_map:new a.aL(y,s.u_pitch_with_map),u_texsize:new a.aQ(y,s.u_texsize),u_texsize_icon:new a.aQ(y,s.u_texsize_icon),u_texture:new a.aL(y,s.u_texture),u_texture_icon:new a.aL(y,s.u_texture_icon),u_gamma_scale:new a.aM(y,s.u_gamma_scale),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_is_halo:new a.aL(y,s.u_is_halo)}),background:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_opacity:new a.aM(y,s.u_opacity),u_color:new a.aR(y,s.u_color)}),backgroundPattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_opacity:new a.aM(y,s.u_opacity),u_image:new a.aL(y,s.u_image),u_pattern_tl_a:new a.aQ(y,s.u_pattern_tl_a),u_pattern_br_a:new a.aQ(y,s.u_pattern_br_a),u_pattern_tl_b:new a.aQ(y,s.u_pattern_tl_b),u_pattern_br_b:new a.aQ(y,s.u_pattern_br_b),u_texsize:new a.aQ(y,s.u_texsize),u_mix:new a.aM(y,s.u_mix),u_pattern_size_a:new a.aQ(y,s.u_pattern_size_a),u_pattern_size_b:new a.aQ(y,s.u_pattern_size_b),u_scale_a:new a.aM(y,s.u_scale_a),u_scale_b:new a.aM(y,s.u_scale_b),u_pixel_coord_upper:new a.aQ(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.aQ(y,s.u_pixel_coord_lower),u_tile_units_to_pixels:new a.aM(y,s.u_tile_units_to_pixels)}),terrain:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_texture:new a.aL(y,s.u_texture),u_ele_delta:new a.aM(y,s.u_ele_delta)}),terrainDepth:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_ele_delta:new a.aM(y,s.u_ele_delta)}),terrainCoords:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_texture:new a.aL(y,s.u_texture),u_terrain_coords_id:new a.aM(y,s.u_terrain_coords_id),u_ele_delta:new a.aM(y,s.u_ele_delta)})};class Wc{constructor(s,h,d){this.context=s;const g=s.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){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,s.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ku={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Xc{constructor(s,h,d,g){this.length=h.length,this.attributes=d,this.itemSize=h.bytesPerElement,this.dynamicDraw=g,this.context=s;const b=s.gl;this.buffer=b.createBuffer(),s.bindVertexBuffer.set(this.buffer),b.bufferData(b.ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?b.DYNAMIC_DRAW:b.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(s){if(s.length!==this.length)throw new Error(`Length of new data is ${s.length}, which doesn't match current length of ${this.length}`);const h=this.context.gl;this.bind(),h.bufferSubData(h.ARRAY_BUFFER,0,s.arrayBuffer)}enableAttributes(s,h){for(let d=0;d0){const oe=a.Z(),Te=Wt;a.aU(oe,Vt.placementInvProjMatrix,y.transform.glCoordMatrix),a.aU(oe,oe,Vt.placementViewportMatrix),R.push({circleArray:Kt,circleOffset:q,transform:Te,invTransform:oe,coord:Ct}),O+=Kt.length/4,q=O}ee&&k.draw(C,M.LINES,Cn.disabled,Si.disabled,y.colorModeForRenderPass(),gi.disabled,gp(Wt,y.transform,Bt),y.style.map.terrain&&y.style.map.terrain.getTerrainData(Ct),h.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,null,y.transform.zoom,null,null,ee.collisionVertexBuffer)}if(!I||!R.length)return;const nt=y.useProgram("collisionCircle"),et=new a.aV;et.resize(4*O),et._trim();let lt=0;for(const pt of R)for(let Ct=0;Ct=0&&(et[$.associatedIconIndex]={shiftedAnchor:bn,angle:pe})}else J($.numGlyphs,q)}if(k){nt.clear();const lt=y.icon.placedSymbolArray;for(let $=0;$y.style.map.terrain.getElevation(ee,xo,Ui):null,lr=h.layout.get("text-rotation-alignment")==="map";le(oe,ee.posMatrix,y,g,hi,Zs,$,k,lr,Vi)}const Pl=y.translatePosMatrix(ee.posMatrix,Kt,b,I),yu=St||g&&Vt||el?Ap:hi,Wr=y.translatePosMatrix(Zs,Kt,b,I,!0),Or=pe&&h.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ao;ao=pe?oe.iconsInText?Sl(qe.kind,vn,Ot,$,y,Pl,yu,Wr,xn,ar):bp(qe.kind,vn,Ot,$,y,Pl,yu,Wr,g,xn,!0):vp(qe.kind,vn,Ot,$,y,Pl,yu,Wr,g,xn);const Al={program:Kn,buffers:Te,uniformValues:ao,atlasTexture:Bi,atlasTextureIcon:Xi,atlasInterpolation:si,atlasInterpolationIcon:Rr,isSDF:pe,hasHalo:Or};if(pt&&oe.canOverlap){Ct=!0;const Vi=Te.segments.get();for(const lr of Vi)Wt.push({segments:new a.S([lr]),sortKey:lr.sortKey,state:Al,terrainData:fn})}else Wt.push({segments:Te.segments,sortKey:0,state:Al,terrainData:fn})}Ct&&Wt.sort((ee,Kt)=>ee.sortKey-Kt.sortKey);for(const ee of Wt){const Kt=ee.state;if(q.activeTexture.set(nt.TEXTURE0),Kt.atlasTexture.bind(Kt.atlasInterpolation,nt.CLAMP_TO_EDGE),Kt.atlasTextureIcon&&(q.activeTexture.set(nt.TEXTURE1),Kt.atlasTextureIcon&&Kt.atlasTextureIcon.bind(Kt.atlasInterpolationIcon,nt.CLAMP_TO_EDGE)),Kt.isSDF){const oe=Kt.uniformValues;Kt.hasHalo&&(oe.u_is_halo=1,Np(Kt.buffers,ee.segments,h,y,Kt.program,Bt,R,O,oe,ee.terrainData)),oe.u_is_halo=0}Np(Kt.buffers,ee.segments,h,y,Kt.program,Bt,R,O,Kt.uniformValues,ee.terrainData)}}function Np(y,s,h,d,g,b,I,C,M,k){const R=d.context;g.draw(R,R.gl.TRIANGLES,b,I,C,gi.disabled,M,k,h.id,y.layoutVertexBuffer,y.indexBuffer,s,h.paint,d.transform.zoom,y.programConfigurations.get(h.id),y.dynamicLayoutVertexBuffer,y.opacityVertexBuffer)}function Qu(y,s,h,d,g){if(!h||!d||!d.imageAtlas)return;const b=d.imageAtlas.patternPositions;let I=b[h.to.toString()],C=b[h.from.toString()];if(!I&&C&&(I=C),!C&&I&&(C=I),!I||!C){const M=g.getPaintProperty(s);I=b[M],C=b[M]}I&&C&&y.setConstantPatternPositions(I,C)}function $u(y,s,h,d,g,b,I){const C=y.context.gl,M="fill-pattern",k=h.paint.get(M),R=k&&k.constantOr(1),O=h.getCrossfadeParameters();let q,nt,et,lt,$;I?(nt=R&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",q=C.LINES):(nt=R?"fillPattern":"fill",q=C.TRIANGLES);const St=k.constantOr(null);for(const Ot of d){const pt=s.getTile(Ot);if(R&&!pt.patternsLoaded())continue;const Ct=pt.getBucket(h);if(!Ct)continue;const Bt=Ct.programConfigurations.get(h.id),Vt=y.useProgram(nt,Bt),Wt=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Ot);R&&(y.context.activeTexture.set(C.TEXTURE0),pt.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),Bt.updatePaintBuffers(O)),Qu(Bt,M,St,pt,h);const ee=Wt?Ot:null,Kt=y.translatePosMatrix(ee?ee.posMatrix:Ot.posMatrix,pt,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));if(I){lt=Ct.indexBuffer2,$=Ct.segments2;const oe=[C.drawingBufferWidth,C.drawingBufferHeight];et=nt==="fillOutlinePattern"&&R?Gc(Kt,y,O,pt,oe):Uc(Kt,oe)}else lt=Ct.indexBuffer,$=Ct.segments,et=R?mp(Kt,y,O,pt):wd(Kt);Vt.draw(y.context,q,g,y.stencilModeForClipping(Ot),b,gi.disabled,et,Wt,h.id,Ct.layoutVertexBuffer,lt,$,h.paint,y.transform.zoom,Bt)}}function tc(y,s,h,d,g,b,I){const C=y.context,M=C.gl,k="fill-extrusion-pattern",R=h.paint.get(k),O=R.constantOr(1),q=h.getCrossfadeParameters(),nt=h.paint.get("fill-extrusion-opacity"),et=R.constantOr(null);for(const lt of d){const $=s.getTile(lt),St=$.getBucket(h);if(!St)continue;const Ot=y.style.map.terrain&&y.style.map.terrain.getTerrainData(lt),pt=St.programConfigurations.get(h.id),Ct=y.useProgram(O?"fillExtrusionPattern":"fillExtrusion",pt);O&&(y.context.activeTexture.set(M.TEXTURE0),$.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),pt.updatePaintBuffers(q)),Qu(pt,k,et,$,h);const Bt=y.translatePosMatrix(lt.posMatrix,$,h.paint.get("fill-extrusion-translate"),h.paint.get("fill-extrusion-translate-anchor")),Vt=h.paint.get("fill-extrusion-vertical-gradient"),Wt=O?Ya(Bt,y,Vt,nt,lt,q,$):dp(Bt,y,Vt,nt);Ct.draw(C,C.gl.TRIANGLES,g,b,I,gi.backCCW,Wt,Ot,h.id,St.layoutVertexBuffer,St.indexBuffer,St.segments,h.paint,y.transform.zoom,pt,y.style.map.terrain&&St.centroidVertexBuffer)}}function Zg(y,s,h,d,g,b,I){const C=y.context,M=C.gl,k=h.fbo;if(!k)return;const R=y.useProgram("hillshade"),O=y.style.map.terrain&&y.style.map.terrain.getTerrainData(s);C.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,k.colorAttachment.get()),R.draw(C,M.TRIANGLES,g,b,I,gi.disabled,((q,nt,et,lt)=>{const $=et.paint.get("hillshade-shadow-color"),St=et.paint.get("hillshade-highlight-color"),Ot=et.paint.get("hillshade-accent-color");let pt=et.paint.get("hillshade-illumination-direction")*(Math.PI/180);et.paint.get("hillshade-illumination-anchor")==="viewport"&&(pt-=q.transform.angle);const Ct=!q.options.moving;return{u_matrix:lt?lt.posMatrix:q.transform.calculatePosMatrix(nt.tileID.toUnwrapped(),Ct),u_image:0,u_latrange:_p(0,nt.tileID),u_light:[et.paint.get("hillshade-exaggeration"),pt],u_shadow:$,u_highlight:St,u_accent:Ot}})(y,h,d,O?s:null),O,d.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments)}function Dp(y,s,h,d,g,b){const I=y.context,C=I.gl,M=s.dem;if(M&&M.data){const k=M.dim,R=M.stride,O=M.getPixels();if(I.activeTexture.set(C.TEXTURE1),I.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||y.getTileTexture(R),s.demTexture){const nt=s.demTexture;nt.update(O,{premultiply:!1}),nt.bind(C.NEAREST,C.CLAMP_TO_EDGE)}else s.demTexture=new Lt(I,O,C.RGBA,{premultiply:!1}),s.demTexture.bind(C.NEAREST,C.CLAMP_TO_EDGE);I.activeTexture.set(C.TEXTURE0);let q=s.fbo;if(!q){const nt=new Lt(I,{width:k,height:k,data:null},C.RGBA);nt.bind(C.LINEAR,C.CLAMP_TO_EDGE),q=s.fbo=I.createFramebuffer(k,k,!0,!1),q.colorAttachment.set(nt.texture)}I.bindFramebuffer.set(q.framebuffer),I.viewport.set([0,0,k,k]),y.useProgram("hillshadePrepare").draw(I,C.TRIANGLES,d,g,b,gi.disabled,((nt,et)=>{const lt=et.stride,$=a.Z();return a.aS($,0,a.N,-a.N,0,0,1),a.$($,$,[0,-a.N,0]),{u_matrix:$,u_image:1,u_dimension:[lt,lt],u_zoom:nt.overscaledZ,u_unpack:et.getUnpackVector()}})(s.tileID,M),null,h.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function Wg(y,s,h,d,g,b){const I=d.paint.get("raster-fade-duration");if(!b&&I>0){const C=a.h.now(),M=(C-y.timeAdded)/I,k=s?(C-s.timeAdded)/I:-1,R=h.getSource(),O=g.coveringZoomLevel({tileSize:R.tileSize,roundZoom:R.roundZoom}),q=!s||Math.abs(s.tileID.overscaledZ-O)>Math.abs(y.tileID.overscaledZ-O),nt=q&&y.refreshedUponExpiration?1:a.ad(q?M:1-k,0,1);return y.refreshedUponExpiration&&M>=1&&(y.refreshedUponExpiration=!1),s?{opacity:1,mix:1-nt}:{opacity:nt,mix:0}}return{opacity:1,mix:0}}const Od=new a.aT(1,0,0,1),ih=new a.aT(0,1,0,1),Rp=new a.aT(0,0,1,1),zd=new a.aT(1,0,1,1),Fd=new a.aT(0,1,1,1);function ec(y,s,h,d){oh(y,0,s+h/2,y.transform.width,h,d)}function rh(y,s,h,d){oh(y,s-h/2,0,h,y.transform.height,d)}function oh(y,s,h,d,g,b){const I=y.context,C=I.gl;C.enable(C.SCISSOR_TEST),C.scissor(s*y.pixelRatio,h*y.pixelRatio,d*y.pixelRatio,g*y.pixelRatio),I.clear({color:b}),C.disable(C.SCISSOR_TEST)}function Bd(y,s,h){const d=y.context,g=d.gl,b=h.posMatrix,I=y.useProgram("debug"),C=Cn.disabled,M=Si.disabled,k=y.colorModeForRenderPass(),R="$debug",O=y.style.map.terrain&&y.style.map.terrain.getTerrainData(h);d.activeTexture.set(g.TEXTURE0);const q=s.getTileByID(h.key).latestRawTileData,nt=Math.floor((q&&q.byteLength||0)/1024),et=s.getTile(h).tileSize,lt=512/Math.min(et,512)*(h.overscaledZ/y.transform.zoom)*.5;let $=h.canonical.toString();h.overscaledZ!==h.canonical.z&&($+=` => ${h.overscaledZ}`),function(St,Ot){St.initDebugOverlayCanvas();const pt=St.debugOverlayCanvas,Ct=St.context.gl,Bt=St.debugOverlayCanvas.getContext("2d");Bt.clearRect(0,0,pt.width,pt.height),Bt.shadowColor="white",Bt.shadowBlur=2,Bt.lineWidth=1.5,Bt.strokeStyle="white",Bt.textBaseline="top",Bt.font="bold 36px Open Sans, sans-serif",Bt.fillText(Ot,5,5),Bt.strokeText(Ot,5,5),St.debugOverlayTexture.update(pt),St.debugOverlayTexture.bind(Ct.LINEAR,Ct.CLAMP_TO_EDGE)}(y,`${$} ${nt}kB`),I.draw(d,g.TRIANGLES,C,M,wi.alphaBlended,gi.disabled,Yu(b,a.aT.transparent,lt),null,R,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),I.draw(d,g.LINE_STRIP,C,M,k,gi.disabled,Yu(b,a.aT.red),O,R,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Pi(y,s,h){const d=y.context,g=d.gl,b=y.colorModeForRenderPass(),I=new Cn(g.LEQUAL,Cn.ReadWrite,y.depthRangeFor3D),C=y.useProgram("terrain"),M=s.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,y.width,y.height]);for(const k of h){const R=y.renderToTexture.getTexture(k),O=s.getTerrainData(k.tileID);d.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,R.texture);const q={u_matrix:y.transform.calculatePosMatrix(k.tileID.toUnwrapped()),u_texture:0,u_ele_delta:s.getMeshFrameDelta(y.transform.zoom)};C.draw(d,g.TRIANGLES,I,Si.disabled,b,gi.backCCW,q,O,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}class Cl{constructor(s,h){this.context=new qg(s),this.transform=h,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:a.Z(),renderTime:0},this.setup(),this.numSublayers=Fi.maxUnderzooming+Fi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Fc}resize(s,h,d){if(this.width=Math.floor(s*d),this.height=Math.floor(h*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const g of this.style._order)this.style._layers[g].resize()}setup(){const s=this.context,h=new a.a_;h.emplaceBack(0,0),h.emplaceBack(a.N,0),h.emplaceBack(0,a.N),h.emplaceBack(a.N,a.N),this.tileExtentBuffer=s.createVertexBuffer(h,Bc.members),this.tileExtentSegments=a.S.simpleSegment(0,0,4,2);const d=new a.a_;d.emplaceBack(0,0),d.emplaceBack(a.N,0),d.emplaceBack(0,a.N),d.emplaceBack(a.N,a.N),this.debugBuffer=s.createVertexBuffer(d,Bc.members),this.debugSegments=a.S.simpleSegment(0,0,4,5);const g=new a.V;g.emplaceBack(0,0,0,0),g.emplaceBack(a.N,0,a.N,0),g.emplaceBack(0,a.N,0,a.N),g.emplaceBack(a.N,a.N,a.N,a.N),this.rasterBoundsBuffer=s.createVertexBuffer(g,pn.members),this.rasterBoundsSegments=a.S.simpleSegment(0,0,4,2);const b=new a.a_;b.emplaceBack(0,0),b.emplaceBack(1,0),b.emplaceBack(0,1),b.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(b,Bc.members),this.viewportSegments=a.S.simpleSegment(0,0,4,2);const I=new a.a$;I.emplaceBack(0),I.emplaceBack(1),I.emplaceBack(3),I.emplaceBack(2),I.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(I);const C=new a.b0;C.emplaceBack(0,1,2),C.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(C);const M=this.context.gl;this.stencilClearMode=new Si({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO)}clearStencil(){const s=this.context,h=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=a.Z();a.aS(d,0,this.width,this.height,0,0,1),a.a0(d,d,[h.drawingBufferWidth,h.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,h.TRIANGLES,Cn.disabled,this.stencilClearMode,wi.disabled,gi.disabled,Sd(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,h){if(this.currentStencilSource===s.source||!s.isTileClipped()||!h||!h.length)return;this.currentStencilSource=s.source;const d=this.context,g=d.gl;this.nextStencilID+h.length>256&&this.clearStencil(),d.setColorMode(wi.disabled),d.setDepthMode(Cn.disabled);const b=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const I of h){const C=this._tileClippingMaskIDs[I.key]=this.nextStencilID++,M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(I);b.draw(d,g.TRIANGLES,Cn.disabled,new Si({func:g.ALWAYS,mask:0},C,255,g.KEEP,g.KEEP,g.REPLACE),wi.disabled,gi.disabled,Sd(I.posMatrix),M,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,h=this.context.gl;return new Si({func:h.NOTEQUAL,mask:255},s,255,h.KEEP,h.KEEP,h.REPLACE)}stencilModeForClipping(s){const h=this.context.gl;return new Si({func:h.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,h.KEEP,h.KEEP,h.REPLACE)}stencilConfigForOverlap(s){const h=this.context.gl,d=s.sort((I,C)=>C.overscaledZ-I.overscaledZ),g=d[d.length-1].overscaledZ,b=d[0].overscaledZ-g+1;if(b>1){this.currentStencilSource=void 0,this.nextStencilID+b>256&&this.clearStencil();const I={};for(let C=0;C=0;this.currentLayer--){const M=this.style._layers[d[this.currentLayer]],k=g[M.source],R=b[M.source];this._renderTileClippingMasks(M,R),this.renderLayer(this,k,M,R)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer$.source&&!$.isHidden(R)?[k.sourceCaches[$.source]]:[]),nt=q.filter($=>$.getSource().type==="vector"),et=q.filter($=>$.getSource().type!=="vector"),lt=$=>{(!O||O.getSource().maxzoom<$.getSource().maxzoom)&&(O=$)};return nt.forEach($=>lt($)),O||et.forEach($=>lt($)),O}(this.style,this.transform.zoom);M&&function(k,R,O){for(let q=0;qnt.style.map.terrain.getElevation(Vt,qe,Me):null)}}}(M,b,C,I,C.layout.get("text-rotation-alignment"),C.layout.get("text-pitch-alignment"),k),C.paint.get("icon-opacity").constantOr(1)!==0&&nh(b,I,C,M,!1,C.paint.get("icon-translate"),C.paint.get("icon-translate-anchor"),C.layout.get("icon-rotation-alignment"),C.layout.get("icon-pitch-alignment"),C.layout.get("icon-keep-upright"),R,O),C.paint.get("text-opacity").constantOr(1)!==0&&nh(b,I,C,M,!0,C.paint.get("text-translate"),C.paint.get("text-translate-anchor"),C.layout.get("text-rotation-alignment"),C.layout.get("text-pitch-alignment"),C.layout.get("text-keep-upright"),R,O),I.map.showCollisionBoxes&&(Rd(b,I,C,M,C.paint.get("text-translate"),C.paint.get("text-translate-anchor"),!0),Rd(b,I,C,M,C.paint.get("icon-translate"),C.paint.get("icon-translate-anchor"),!1))})(s,h,d,g,this.style.placement.variableOffsets);break;case"circle":(function(b,I,C,M){if(b.renderPass!=="translucent")return;const k=C.paint.get("circle-opacity"),R=C.paint.get("circle-stroke-width"),O=C.paint.get("circle-stroke-opacity"),q=!C.layout.get("circle-sort-key").isConstant();if(k.constantOr(1)===0&&(R.constantOr(1)===0||O.constantOr(1)===0))return;const nt=b.context,et=nt.gl,lt=b.depthModeForSublayer(0,Cn.ReadOnly),$=Si.disabled,St=b.colorModeForRenderPass(),Ot=[];for(let pt=0;ptpt.sortKey-Ct.sortKey);for(const pt of Ot){const{programConfiguration:Ct,program:Bt,layoutVertexBuffer:Vt,indexBuffer:Wt,uniformValues:ee,terrainData:Kt}=pt.state;Bt.draw(nt,et.TRIANGLES,lt,$,St,gi.disabled,ee,Kt,C.id,Vt,Wt,pt.segments,C.paint,b.transform.zoom,Ct)}})(s,h,d,g);break;case"heatmap":(function(b,I,C,M){if(C.paint.get("heatmap-opacity")!==0)if(b.renderPass==="offscreen"){const k=b.context,R=k.gl,O=Si.disabled,q=new wi([R.ONE,R.ONE],a.aT.transparent,[!0,!0,!0,!0]);(function(nt,et,lt){const $=nt.gl;nt.activeTexture.set($.TEXTURE1),nt.viewport.set([0,0,et.width/4,et.height/4]);let St=lt.heatmapFbo;if(St)$.bindTexture($.TEXTURE_2D,St.colorAttachment.get()),nt.bindFramebuffer.set(St.framebuffer);else{const Ot=$.createTexture();$.bindTexture($.TEXTURE_2D,Ot),$.texParameteri($.TEXTURE_2D,$.TEXTURE_WRAP_S,$.CLAMP_TO_EDGE),$.texParameteri($.TEXTURE_2D,$.TEXTURE_WRAP_T,$.CLAMP_TO_EDGE),$.texParameteri($.TEXTURE_2D,$.TEXTURE_MIN_FILTER,$.LINEAR),$.texParameteri($.TEXTURE_2D,$.TEXTURE_MAG_FILTER,$.LINEAR),St=lt.heatmapFbo=nt.createFramebuffer(et.width/4,et.height/4,!1,!1),function(pt,Ct,Bt,Vt){var Wt,ee;const Kt=pt.gl,oe=(Wt=pt.HALF_FLOAT)!==null&&Wt!==void 0?Wt:Kt.UNSIGNED_BYTE,Te=(ee=pt.RGBA16F)!==null&&ee!==void 0?ee:Kt.RGBA;Kt.texImage2D(Kt.TEXTURE_2D,0,Te,Ct.width/4,Ct.height/4,0,Kt.RGBA,oe,null),Vt.colorAttachment.set(Bt)}(nt,et,Ot,St)}})(k,b,C),k.clear({color:a.aT.transparent});for(let nt=0;nt{const pt=a.Z();a.aS(pt,0,lt.width,lt.height,0,0,1);const Ct=lt.context.gl;return{u_matrix:pt,u_world:[Ct.drawingBufferWidth,Ct.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:$.paint.get("heatmap-opacity")}})(k,R),null,R.id,k.viewportBuffer,k.quadTriangleIndexBuffer,k.viewportSegments,R.paint,k.transform.zoom)}(b,C))})(s,h,d,g);break;case"line":(function(b,I,C,M){if(b.renderPass!=="translucent")return;const k=C.paint.get("line-opacity"),R=C.paint.get("line-width");if(k.constantOr(1)===0||R.constantOr(1)===0)return;const O=b.depthModeForSublayer(0,Cn.ReadOnly),q=b.colorModeForRenderPass(),nt=C.paint.get("line-dasharray"),et=C.paint.get("line-pattern"),lt=et.constantOr(1),$=C.paint.get("line-gradient"),St=C.getCrossfadeParameters(),Ot=lt?"linePattern":nt?"lineSDF":$?"lineGradient":"line",pt=b.context,Ct=pt.gl;let Bt=!0;for(const Vt of M){const Wt=I.getTile(Vt);if(lt&&!Wt.patternsLoaded())continue;const ee=Wt.getBucket(C);if(!ee)continue;const Kt=ee.programConfigurations.get(C.id),oe=b.context.program.get(),Te=b.useProgram(Ot,Kt),bn=Bt||Te.program!==oe,pe=b.style.map.terrain&&b.style.map.terrain.getTerrainData(Vt),qe=et.constantOr(null);if(qe&&Wt.imageAtlas){const vn=Wt.imageAtlas,fn=vn.patternPositions[qe.to.toString()],xn=vn.patternPositions[qe.from.toString()];fn&&xn&&Kt.setConstantPatternPositions(fn,xn)}const Me=pe?Vt:null,Kn=lt?zg(b,Wt,C,St,Me):nt?Id(b,Wt,C,nt,St,Me):$?Ed(b,Wt,C,ee.lineClipsArray.length,Me):yp(b,Wt,C,Me);if(lt)pt.activeTexture.set(Ct.TEXTURE0),Wt.imageAtlasTexture.bind(Ct.LINEAR,Ct.CLAMP_TO_EDGE),Kt.updatePaintBuffers(St);else if(nt&&(bn||b.lineAtlas.dirty))pt.activeTexture.set(Ct.TEXTURE0),b.lineAtlas.bind(pt);else if($){const vn=ee.gradients[C.id];let fn=vn.texture;if(C.gradientVersion!==vn.version){let xn=256;if(C.stepInterpolant){const Bi=I.getSource().maxzoom,si=Vt.canonical.z===Bi?Math.ceil(1<0?h.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;const h=this.imageManager.getPattern(s.from.toString()),d=this.imageManager.getPattern(s.to.toString());return!h||!d}useProgram(s,h){this.cache=this.cache||{};const d=s+(h?h.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new Vc(this.context,xi[s],h,Zc[s],this._showOverdrawInspector,this.style.map.terrain)),this.cache[d]}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 s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Lt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:s,drawingBufferHeight:h}=this.context.gl;return this.width!==s||this.height!==h}}class vo{constructor(s,h){this.points=s,this.planes=h}static fromInvProjectionMatrix(s,h,d){const g=Math.pow(2,d),b=[[-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(C=>{const M=1/(C=a.ag([],C,s))[3]/h*g;return a.b3(C,C,[M,M,1/C[3],M])}),I=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(C=>{const M=function(q,nt){var et=nt[0],lt=nt[1],$=nt[2],St=et*et+lt*lt+$*$;return St>0&&(St=1/Math.sqrt(St)),q[0]=nt[0]*St,q[1]=nt[1]*St,q[2]=nt[2]*St,q}([],function(q,nt,et){var lt=nt[0],$=nt[1],St=nt[2],Ot=et[0],pt=et[1],Ct=et[2];return q[0]=$*Ct-St*pt,q[1]=St*Ot-lt*Ct,q[2]=lt*pt-$*Ot,q}([],ht([],b[C[0]],b[C[1]]),ht([],b[C[2]],b[C[1]]))),k=-((R=M)[0]*(O=b[C[1]])[0]+R[1]*O[1]+R[2]*O[2]);var R,O;return M.concat(k)});return new vo(b,I)}}class pu{constructor(s,h){this.min=s,this.max=h,this.center=function(d,g,b){return d[0]=.5*g[0],d[1]=.5*g[1],d[2]=.5*g[2],d}([],function(d,g,b){return d[0]=g[0]+b[0],d[1]=g[1]+b[1],d[2]=g[2]+b[2],d}([],this.min,this.max))}quadrant(s){const h=[s%2==0,s<2],d=Q(this.min),g=Q(this.max);for(let b=0;b=0&&I++;if(I===0)return 0;I!==h.length&&(d=!1)}if(d)return 2;for(let g=0;g<3;g++){let b=Number.MAX_VALUE,I=-Number.MAX_VALUE;for(let C=0;Cthis.max[g]-this.min[g])return 0}return 1}}class nc{constructor(s=0,h=0,d=0,g=0){if(isNaN(s)||s<0||isNaN(h)||h<0||isNaN(d)||d<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=h,this.left=d,this.right=g}interpolate(s,h,d){return h.top!=null&&s.top!=null&&(this.top=a.B.number(s.top,h.top,d)),h.bottom!=null&&s.bottom!=null&&(this.bottom=a.B.number(s.bottom,h.bottom,d)),h.left!=null&&s.left!=null&&(this.left=a.B.number(s.left,h.left,d)),h.right!=null&&s.right!=null&&(this.right=a.B.number(s.right,h.right,d)),this}getCenter(s,h){const d=a.ad((this.left+s-this.right)/2,0,s),g=a.ad((this.top+h-this.bottom)/2,0,h);return new a.P(d,g)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new nc(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class sh{constructor(s,h,d,g,b){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=b===void 0||!!b,this._minZoom=s||0,this._maxZoom=h||22,this._minPitch=d??0,this._maxPitch=g??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.L(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new nc,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const s=new sh(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this._minEleveationForCurrentTile=s._minEleveationForCurrentTile,this.zoom=s.zoom,this.angle=s.angle,this._fov=s._fov,this._pitch=s._pitch,this._unmodified=s._unmodified,this._edgeInsets=s._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}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(s){const h=-a.b5(s,-180,180)*Math.PI/180;this.angle!==h&&(this._unmodified=!1,this.angle=h,this._calcMatrices(),this.rotationMatrix=function(){var d=new a.A(4);return a.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,g,b){var I=g[0],C=g[1],M=g[2],k=g[3],R=Math.sin(b),O=Math.cos(b);d[0]=I*O+M*R,d[1]=C*O+k*R,d[2]=I*-R+M*O,d[3]=C*-R+k*O}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const h=a.ad(s,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(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=s/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(s){const h=Math.min(Math.max(s,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(s){s.lat===this._center.lat&&s.lng===this._center.lng||(this._unmodified=!1,this._center=s,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(s){s!==this._elevation&&(this._elevation=s,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(s){this._edgeInsets.equals(s)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,s,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(s){return this._edgeInsets.equals(s)}interpolatePadding(s,h,d){this._unmodified=!1,this._edgeInsets.interpolate(s,h,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const h=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,h)}getVisibleUnwrappedCoordinates(s){const h=[new a.b6(0,s)];if(this._renderWorldCopies){const d=this.pointCoordinate(new a.P(0,0)),g=this.pointCoordinate(new a.P(this.width,0)),b=this.pointCoordinate(new a.P(this.width,this.height)),I=this.pointCoordinate(new a.P(0,this.height)),C=Math.floor(Math.min(d.x,g.x,b.x,I.x)),M=Math.floor(Math.max(d.x,g.x,b.x,I.x)),k=1;for(let R=C-k;R<=M+k;R++)R!==0&&h.push(new a.b6(R,s))}return h}coveringTiles(s){var h,d;let g=this.coveringZoomLevel(s);const b=g;if(s.minzoom!==void 0&&gs.maxzoom&&(g=s.maxzoom);const I=this.pointCoordinate(this.getCameraPoint()),C=a.U.fromLngLat(this.center),M=Math.pow(2,g),k=[M*I.x,M*I.y,0],R=[M*C.x,M*C.y,0],O=vo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,g);let q=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(q=g);const nt=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,et=pt=>({aabb:new pu([pt*M,0,0],[(pt+1)*M,M,0]),zoom:0,x:0,y:0,wrap:pt,fullyVisible:!1}),lt=[],$=[],St=g,Ot=s.reparseOverscaled?b:g;if(this._renderWorldCopies)for(let pt=1;pt<=3;pt++)lt.push(et(-pt)),lt.push(et(pt));for(lt.push(et(0));lt.length>0;){const pt=lt.pop(),Ct=pt.x,Bt=pt.y;let Vt=pt.fullyVisible;if(!Vt){const Te=pt.aabb.intersects(O);if(Te===0)continue;Vt=Te===2}const Wt=s.terrain?k:R,ee=pt.aabb.distanceX(Wt),Kt=pt.aabb.distanceY(Wt),oe=Math.max(Math.abs(ee),Math.abs(Kt));if(pt.zoom===St||oe>nt+(1<=q){const Te=St-pt.zoom,bn=k[0]-.5-(Ct<>1),qe=pt.zoom+1;let Me=pt.aabb.quadrant(Te);if(s.terrain){const Kn=new a.O(qe,pt.wrap,qe,bn,pe),vn=s.terrain.getMinMaxElevation(Kn),fn=(h=vn.minElevation)!==null&&h!==void 0?h:this.elevation,xn=(d=vn.maxElevation)!==null&&d!==void 0?d:this.elevation;Me=new pu([Me.min[0],Me.min[1],fn],[Me.max[0],Me.max[1],xn])}lt.push({aabb:Me,zoom:qe,x:bn,y:pe,wrap:pt.wrap,fullyVisible:Vt})}}return $.sort((pt,Ct)=>pt.distanceSq-Ct.distanceSq).map(pt=>pt.tileID)}resize(s,h){this.width=s,this.height=h,this.pixelsToGLUnits=[2/s,-2/h],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const h=a.ad(s.lat,-this.maxValidLatitude,this.maxValidLatitude);return new a.P(a.G(s.lng)*this.worldSize,a.H(h)*this.worldSize)}unproject(s){return new a.U(s.x/this.worldSize,s.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(s){const h=this.pointLocation(this.centerPoint,s),d=s.getElevationForLngLatZoom(h,this.tileZoom);if(!(this.elevation-d))return;const g=this.getCameraPosition(),b=a.U.fromLngLat(g.lngLat,g.altitude),I=a.U.fromLngLat(h,d),C=b.x-I.x,M=b.y-I.y,k=b.z-I.z,R=Math.sqrt(C*C+M*M+k*k),O=this.scaleZoom(this.cameraToCenterDistance/R/this.tileSize);this._elevation=d,this._center=h,this.zoom=O}setLocationAtPoint(s,h){const d=this.pointCoordinate(h),g=this.pointCoordinate(this.centerPoint),b=this.locationCoordinate(s),I=new a.U(b.x-(d.x-g.x),b.y-(d.y-g.y));this.center=this.coordinateLocation(I),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,h){return h?this.coordinatePoint(this.locationCoordinate(s),h.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,h){return this.coordinateLocation(this.pointCoordinate(s,h))}locationCoordinate(s){return a.U.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,h){if(h){const q=h.pointCoordinate(s);if(q!=null)return q}const d=[s.x,s.y,0,1],g=[s.x,s.y,1,1];a.ag(d,d,this.pixelMatrixInverse),a.ag(g,g,this.pixelMatrixInverse);const b=d[3],I=g[3],C=d[1]/b,M=g[1]/I,k=d[2]/b,R=g[2]/I,O=k===R?0:(0-k)/(R-k);return new a.U(a.B.number(d[0]/b,g[0]/I,O)/this.worldSize,a.B.number(C,M,O)/this.worldSize)}coordinatePoint(s,h=0,d=this.pixelMatrix){const g=[s.x*this.worldSize,s.y*this.worldSize,h,1];return a.ag(g,g,d),new a.P(g[0]/g[3],g[1]/g[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new Ge().extend(this.pointLocation(new a.P(0,s))).extend(this.pointLocation(new a.P(this.width,s))).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 Ge([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(s){s?(this.lngRange=[s.getWest(),s.getEast()],this.latRange=[s.getSouth(),s.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(s,h=!1){const d=s.key,g=h?this._alignedPosMatrixCache:this._posMatrixCache;if(g[d])return g[d];const b=s.canonical,I=this.worldSize/this.zoomScale(b.z),C=b.x+Math.pow(2,b.z)*s.wrap,M=a.ao(new Float64Array(16));return a.$(M,M,[C*I,b.y*I,0]),a.a0(M,M,[I/a.N,I/a.N,1]),a.a1(M,h?this.alignedProjMatrix:this.projMatrix,M),g[d]=new Float32Array(M),g[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let s,h,d,g,b=-90,I=90,C=-180,M=180;const k=this.size,R=this._unmodified;if(this.latRange){const nt=this.latRange;b=a.H(nt[1])*this.worldSize,I=a.H(nt[0])*this.worldSize,s=I-bI&&(g=I-et)}if(this.lngRange){const nt=(C+M)/2,et=a.b5(O.x,nt-this.worldSize/2,nt+this.worldSize/2),lt=k.x/2;et-ltM&&(d=M-lt)}d===void 0&&g===void 0||(this.center=this.unproject(new a.P(d!==void 0?d:O.x,g!==void 0?g:O.y)).wrap()),this._unmodified=R,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,h=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=a.b7(1,this.center.lat)*this.worldSize;let g=a.ao(new Float64Array(16));a.a0(g,g,[this.width/2,-this.height/2,1]),a.$(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=a.ao(new Float64Array(16)),a.a0(g,g,[1,-1,1]),a.$(g,g,[-1,-1,0]),a.a0(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;const b=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),I=Math.min(this.elevation,this._minEleveationForCurrentTile),C=b-I*this._pixelPerMeter/Math.cos(this._pitch),M=I<0?C:b,k=Math.PI/2+this._pitch,R=this._fov*(.5+s.y/this.height),O=Math.sin(R)*M/Math.sin(a.ad(Math.PI-k-R,.01,Math.PI-.01)),q=this.getHorizon(),nt=2*Math.atan(q/this.cameraToCenterDistance)*(.5+s.y/(2*q)),et=Math.sin(nt)*M/Math.sin(a.ad(Math.PI-k-nt,.01,Math.PI-.01)),lt=Math.min(O,et),$=1.01*(Math.cos(Math.PI/2-this._pitch)*lt+M),St=this.height/50;g=new Float64Array(16),a.b8(g,this._fov,this.width/this.height,St,$),g[8]=2*-s.x/this.width,g[9]=2*s.y/this.height,a.a0(g,g,[1,-1,1]),a.$(g,g,[0,0,-this.cameraToCenterDistance]),a.b9(g,g,this._pitch),a.ae(g,g,this.angle),a.$(g,g,[-h,-d,0]),this.mercatorMatrix=a.a0([],g,[this.worldSize,this.worldSize,this.worldSize]),a.a0(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=a.a1(new Float64Array(16),this.labelPlaneMatrix,g),a.$(g,g,[0,0,-this.elevation]),this.projMatrix=g,this.invProjMatrix=a.as([],g),this.pixelMatrix3D=a.a1(new Float64Array(16),this.labelPlaneMatrix,g);const Ot=this.width%2/2,pt=this.height%2/2,Ct=Math.cos(this.angle),Bt=Math.sin(this.angle),Vt=h-Math.round(h)+Ct*Ot+Bt*pt,Wt=d-Math.round(d)+Ct*pt+Bt*Ot,ee=new Float64Array(g);if(a.$(ee,ee,[Vt>.5?Vt-1:Vt,Wt>.5?Wt-1:Wt,0]),this.alignedProjMatrix=ee,g=a.as(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");this.pixelMatrixInverse=g,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new a.P(0,0)),h=[s.x*this.worldSize,s.y*this.worldSize,0,1];return a.ag(h,h,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.P(0,s))}getCameraQueryGeometry(s){const h=this.getCameraPoint();if(s.length===1)return[s[0],h];{let d=h.x,g=h.y,b=h.x,I=h.y;for(const C of s)d=Math.min(d,C.x),g=Math.min(g,C.y),b=Math.max(b,C.x),I=Math.max(I,C.y);return[new a.P(d,g),new a.P(b,g),new a.P(b,I),new a.P(d,I),new a.P(d,g)]}}}function Tl(y,s){let h,d=!1,g=null,b=null;const I=()=>{g=null,d&&(y.apply(b,h),g=setTimeout(I,s),d=!1)};return(...C)=>(d=!0,b=this,h=C,g||I(),g)}class ic{constructor(s){this._getCurrentHash=()=>{const h=window.location.hash.replace("#","");if(this._hashName){let d;return h.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(d=g)}),(d&&d[1]||"").split("/")}return h.split("/")},this._onHashChange=()=>{const h=this._getCurrentHash();if(h.length>=3&&!h.some(d=>isNaN(d))){const d=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:d,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=Tl(this._updateHashUnthrottled,300),this._hashName=s&&encodeURIComponent(s)}addTo(s){return this._map=s,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(s){const h=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,g=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),b=Math.pow(10,g),I=Math.round(h.lng*b)/b,C=Math.round(h.lat*b)/b,M=this._map.getBearing(),k=this._map.getPitch();let R="";if(R+=s?`/${I}/${C}/${d}`:`${d}/${C}/${I}`,(M||k)&&(R+="/"+Math.round(10*M)/10),k&&(R+=`/${Math.round(k)}`),this._hashName){const O=this._hashName;let q=!1;const nt=window.location.hash.slice(1).split("&").map(et=>{const lt=et.split("=")[0];return lt===O?(q=!0,`${lt}=${R}`):et}).filter(et=>et);return q||nt.push(`${O}=${R}`),`#${nt.join("&")}`}return`#${R}`}}const fu={linearity:.3,easing:a.ba(0,0,.3,1)},Vd=a.e({deceleration:2500,maxSpeed:1400},fu),Ud=a.e({deceleration:20,maxSpeed:1400},fu),Gd=a.e({deceleration:1e3,maxSpeed:360},fu),jd=a.e({deceleration:1e3,maxSpeed:90},fu);class qd{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.h.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,h=a.h.now();for(;s.length>0&&h-s[0].time>160;)s.shift()}_onMoveEnd(s){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:b}of this._inertiaBuffer)h.zoom+=b.zoomDelta||0,h.bearing+=b.bearingDelta||0,h.pitch+=b.pitchDelta||0,b.panDelta&&h.pan._add(b.panDelta),b.around&&(h.around=b.around),b.pinchAround&&(h.pinchAround=b.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(h.pan.mag()){const b=rc(h.pan.mag(),d,a.e({},Vd,s||{}));g.offset=h.pan.mult(b.amount/h.pan.mag()),g.center=this._map.transform.center,qs(g,b)}if(h.zoom){const b=rc(h.zoom,d,Ud);g.zoom=this._map.transform.zoom+b.amount,qs(g,b)}if(h.bearing){const b=rc(h.bearing,d,Gd);g.bearing=this._map.transform.bearing+a.ad(b.amount,-179,179),qs(g,b)}if(h.pitch){const b=rc(h.pitch,d,jd);g.pitch=this._map.transform.pitch+b.amount,qs(g,b)}if(g.zoom||g.bearing){const b=h.pinchAround===void 0?h.around:h.pinchAround;g.around=b?this._map.unproject(b):this._map.getCenter()}return this.clear(),a.e(g,{noMoveStart:!0})}}function qs(y,s){(!y.duration||y.durationh.unproject(M)),C=b.reduce((M,k,R,O)=>M.add(k.div(O.length)),new a.P(0,0));super(s,{points:b,point:C,lngLats:I,lngLat:h.unproject(C),originalEvent:d}),this._defaultPrevented=!1}}class Zd extends a.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,h,d){super(s,{originalEvent:d}),this._defaultPrevented=!1}}class Wd{constructor(s,h){this._map=s,this._clickTolerance=h.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new Zd(s.type,this._map,s))}mousedown(s,h){return this._mousedownPos=h,this._firePreventable(new Oo(s.type,this._map,s))}mouseup(s){this._map.fire(new Oo(s.type,this._map,s))}click(s,h){this._mousedownPos&&this._mousedownPos.dist(h)>=this._clickTolerance||this._map.fire(new Oo(s.type,this._map,s))}dblclick(s){return this._firePreventable(new Oo(s.type,this._map,s))}mouseover(s){this._map.fire(new Oo(s.type,this._map,s))}mouseout(s){this._map.fire(new Oo(s.type,this._map,s))}touchstart(s){return this._firePreventable(new oc(s.type,this._map,s))}touchmove(s){this._map.fire(new oc(s.type,this._map,s))}touchend(s){this._map.fire(new oc(s.type,this._map,s))}touchcancel(s){this._map.fire(new oc(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Xd{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new Oo(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Oo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new Oo(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ea{constructor(s){this._map=s}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(s){return this.transform.pointLocation(a.P.convert(s),this._map.terrain)}}class Hd{constructor(s,h){this._map=s,this._tr=new Ea(s),this._el=s.getCanvasContainer(),this._container=s.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(s,h){this.isEnabled()&&s.shiftKey&&s.button===0&&(x.disableDrag(),this._startPos=this._lastPos=h,this._active=!0)}mousemoveWindow(s,h){if(!this._active)return;const d=h;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)b.fitScreenCoordinates(d,g,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(x.remove(this._box),this._box=null),x.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,h){return this._map.fire(new a.k(s,{originalEvent:h}))}}function ss(y,s){if(y.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${y.length}, points ${s.length}`);const h={};for(let d=0;dthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),d.length===this.numTouches&&(this.centroid=function(g){const b=new a.P(0,0);for(const I of g)b._add(I);return b.div(g.length)}(h),this.touches=ss(d,h)))}touchmove(s,h,d){if(this.aborted||!this.centroid)return;const g=ss(d,h);for(const b in this.touches){const I=g[b];(!I||I.dist(this.touches[b])>30)&&(this.aborted=!0)}}touchend(s,h,d){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class ah{constructor(s){this.singleTap=new Ia(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,h,d){this.singleTap.touchstart(s,h,d)}touchmove(s,h,d){this.singleTap.touchmove(s,h,d)}touchend(s,h,d){const g=this.singleTap.touchend(s,h,d);if(g){const b=s.timeStamp-this.lastTime<500,I=!this.lastTap||this.lastTap.dist(g)<30;if(b&&I||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class Ca{constructor(s){this._tr=new Ea(s),this._zoomIn=new ah({numTouches:1,numTaps:2}),this._zoomOut=new ah({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,h,d){this._zoomIn.touchstart(s,h,d),this._zoomOut.touchstart(s,h,d)}touchmove(s,h,d){this._zoomIn.touchmove(s,h,d),this._zoomOut.touchmove(s,h,d)}touchend(s,h,d){const g=this._zoomIn.touchend(s,h,d),b=this._zoomOut.touchend(s,h,d),I=this._tr;return g?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:I.zoom+1,around:I.unproject(g)},{originalEvent:s})}):b?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:I.zoom-1,around:I.unproject(b)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ta{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){const h=this._moveFunction(...s);if(h.bearingDelta||h.pitchDelta||h.around||h.panDelta)return this._active=!0,h}dragStart(s,h){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=h.length?h[0]:h,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,h){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const g=h.length?h[0]:h;return!this._moved&&g.dist(d){y.mousedown=y.dragStart,y.mousemoveWindow=y.dragMove,y.mouseup=y.dragEnd,y.contextmenu=function(s){s.preventDefault()}},du=({enable:y,clickTolerance:s,bearingDegreesPerPixelMoved:h=.8})=>{const d=new Op({checkCorrectEvent:g=>x.mouseButton(g)===0&&g.ctrlKey||x.mouseButton(g)===2});return new Ta({clickTolerance:s,move:(g,b)=>({bearingDelta:(b.x-g.x)*h}),moveStateManager:d,enable:y,assignEvents:lh})},La=({enable:y,clickTolerance:s,pitchDegreesPerPixelMoved:h=-.5})=>{const d=new Op({checkCorrectEvent:g=>x.mouseButton(g)===0&&g.ctrlKey||x.mouseButton(g)===2});return new Ta({clickTolerance:s,move:(g,b)=>({pitchDelta:(b.y-g.y)*h}),moveStateManager:d,enable:y,assignEvents:lh})};class xe{constructor(s,h){this._minTouches=s.cooperativeGestures?2:1,this._clickTolerance=s.clickTolerance||1,this._map=h,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new a.P(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(s,h,d){return this._calculateTransform(s,h,d)}touchmove(s,h,d){if(this._map._cooperativeGestures&&(this._minTouches===2&&d.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(s,!1,d.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(d.length0&&(this._active=!0);const g=ss(d,h),b=new a.P(0,0),I=new a.P(0,0);let C=0;for(const k in g){const R=g[k],O=this._touches[k];O&&(b._add(R),I._add(R.sub(O)),C++,g[k]=R)}if(this._touches=g,CMath.abs(y.x)}class Hg extends uh{constructor(s){super(),this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,h,d){super.touchstart(s,h,d),this._currentTouchCount=d.length}_start(s){this._lastPoints=s,Fp(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,h,d){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const g=s[0].sub(this._lastPoints[0]),b=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(g,b,d.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(g.y+b.y)/2*-.5}):void 0}gestureBeginsVertically(s,h,d){if(this._valid!==void 0)return this._valid;const g=s.mag()>=2,b=h.mag()>=2;if(!g&&!b)return;if(!g||!b)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const I=s.y>0==h.y>0;return Fp(s)&&Fp(h)&&I}}const Bp={panStep:100,bearingStep:15,pitchStep:10};class Jd{constructor(s){this._tr=new Ea(s);const h=Bp;this._panStep=h.panStep,this._bearingStep=h.bearingStep,this._pitchStep=h.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let h=0,d=0,g=0,b=0,I=0;switch(s.keyCode){case 61:case 107:case 171:case 187:h=1;break;case 189:case 109:case 173:h=-1;break;case 37:s.shiftKey?d=-1:(s.preventDefault(),b=-1);break;case 39:s.shiftKey?d=1:(s.preventDefault(),b=1);break;case 38:s.shiftKey?g=1:(s.preventDefault(),I=-1);break;case 40:s.shiftKey?g=-1:(s.preventDefault(),I=1);break;default:return}return this._rotationDisabled&&(d=0,g=0),{cameraAnimation:C=>{const M=this._tr;C.easeTo({duration:300,easeId:"keyboardHandler",easing:Qd,zoom:h?Math.round(M.zoom)+h*(s.shiftKey?2:1):M.zoom,bearing:M.bearing+d*this._bearingStep,pitch:M.pitch+g*this._pitchStep,offset:[-b*this._panStep,-I*this._panStep],center:M.center},{originalEvent:s})}}}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 Qd(y){return y*(2-y)}const $d=4.000244140625;class Yg{constructor(s,h){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=s,this._tr=new Ea(s),this._el=s.getCanvasContainer(),this._triggerRenderFrame=h,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(s){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!s[this._map._metaKey])return;s.preventDefault()}let h=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const d=a.h.now(),g=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,h!==0&&h%$d==0?this._type="wheel":h!==0&&Math.abs(h)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=h,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(g*h)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,h+=this._lastValue)),s.shiftKey&&h&&(h/=4),this._type&&(this._lastWheelEvent=s,this._delta-=h,this._active||this._start(s)),s.preventDefault()}_start(s){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=x.mousePos(this._el,s),d=this._tr;this._around=a.L.convert(this._aroundCenter?d.center:d.unproject(h)),this._aroundPoint=d.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._tr.transform;if(this._delta!==0){const C=this._type==="wheel"&&Math.abs(this._delta)>$d?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*C)));this._delta<0&&M!==0&&(M=1/M);const k=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(k*M))),this._type==="wheel"&&(this._startZoom=s.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const h=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,d=this._startZoom,g=this._easing;let b,I=!1;if(this._type==="wheel"&&d&&g){const C=Math.min((a.h.now()-this._lastWheelEventTime)/200,1),M=g(C);b=a.B.number(d,h,M),C<1?this._frameId||(this._frameId=!0):I=!0}else b=h,I=!0;return this._active=!0,I&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!I,zoomDelta:b-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let h=a.bb;if(this._prevEase){const d=this._prevEase,g=(a.h.now()-d.start)/d.duration,b=d.easing(g+.01)-d.easing(g),I=.27/Math.sqrt(b*b+1e-4)*.01,C=Math.sqrt(.0729-I*I);h=a.ba(I,C,.25,1)}return this._prevEase={start:a.h.now(),duration:s,easing:h},h}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Vp{constructor(s,h){this._clickZoom=s,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 Up{constructor(s){this._tr=new Ea(s),this.reset()}reset(){this._active=!1}dblclick(s,h){return s.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(h)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gp{constructor(){this._tap=new ah({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(s,h,d){if(!this._swipePoint)if(this._tapTime){const g=h[0],b=s.timeStamp-this._tapTime<500,I=this._tapPoint.dist(g)<30;b&&I?d.length>0&&(this._swipePoint=g,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(s,h,d)}touchmove(s,h,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const g=h[0],b=g.y-this._swipePoint.y;return this._swipePoint=g,s.preventDefault(),this._active=!0,{zoomDelta:b/128}}}else this._tap.touchmove(s,h,d)}touchend(s,h,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const g=this._tap.touchend(s,h,d);g&&(this._tapTime=s.timeStamp,this._tapPoint=g)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class jp{constructor(s,h,d){this._el=s,this._mousePan=h,this._touchPan=d}enable(s){this._inertiaOptions=s||{},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 bo{constructor(s,h,d){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=h,this._mousePitch=d}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 tl{constructor(s,h,d,g){this._el=s,this._touchZoom=h,this._touchRotate=d,this._tapDragZoom=g,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),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()}}const sc=y=>y.zoom||y.drag||y.pitch||y.rotate;class qp extends a.k{}function ac(y){return y.panDelta&&y.panDelta.mag()||y.zoomDelta||y.bearingDelta||y.pitchDelta}class Zp{constructor(s,h){this.handleWindowEvent=g=>{this.handleEvent(g,`${g.type}Window`)},this.handleEvent=(g,b)=>{if(g.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const I=g.type==="renderFrame"?void 0:g,C={needsRenderFrame:!1},M={},k={},R=g.touches,O=R?this._getMapTouches(R):void 0,q=O?x.touchPos(this._el,O):x.mousePos(this._el,g);for(const{handlerName:lt,handler:$,allowed:St}of this._handlers){if(!$.isEnabled())continue;let Ot;this._blockedByActive(k,St,lt)?$.reset():$[b||g.type]&&(Ot=$[b||g.type](g,q,O),this.mergeHandlerResult(C,M,Ot,lt,I),Ot&&Ot.needsRenderFrame&&this._triggerRenderFrame()),(Ot||$.isActive())&&(k[lt]=$)}const nt={};for(const lt in this._previousActiveHandlers)k[lt]||(nt[lt]=I);this._previousActiveHandlers=k,(Object.keys(nt).length||ac(C))&&(this._changes.push([C,M,nt]),this._triggerRenderFrame()),(Object.keys(k).length||ac(C))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:et}=C;et&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],et(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new qd(s),this._bearingSnap=h.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(h);const d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(const[g,b,I]of this._listeners)x.addEventListener(g,b,g===document?this.handleWindowEvent:this.handleEvent,I)}destroy(){for(const[s,h,d]of this._listeners)x.removeEventListener(s,h,s===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(s){const h=this._map,d=h.getCanvasContainer();this._add("mapEvent",new Wd(h,s));const g=h.boxZoom=new Hd(h,s);this._add("boxZoom",g),s.interactive&&s.boxZoom&&g.enable();const b=new Ca(h),I=new Up(h);h.doubleClickZoom=new Vp(I,b),this._add("tapZoom",b),this._add("clickZoom",I),s.interactive&&s.doubleClickZoom&&h.doubleClickZoom.enable();const C=new Gp;this._add("tapDragZoom",C);const M=h.touchPitch=new Hg(h);this._add("touchPitch",M),s.interactive&&s.touchPitch&&h.touchPitch.enable(s.touchPitch);const k=du(s),R=La(s);h.dragRotate=new bo(s,k,R),this._add("mouseRotate",k,["mousePitch"]),this._add("mousePitch",R,["mouseRotate"]),s.interactive&&s.dragRotate&&h.dragRotate.enable();const O=(({enable:St,clickTolerance:Ot})=>{const pt=new Op({checkCorrectEvent:Ct=>x.mouseButton(Ct)===0&&!Ct.ctrlKey});return new Ta({clickTolerance:Ot,move:(Ct,Bt)=>({around:Bt,panDelta:Bt.sub(Ct)}),activateOnStart:!0,moveStateManager:pt,enable:St,assignEvents:lh})})(s),q=new xe(s,h);h.dragPan=new jp(d,O,q),this._add("mousePan",O),this._add("touchPan",q,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&h.dragPan.enable(s.dragPan);const nt=new zp,et=new Kd;h.touchZoomRotate=new tl(d,et,nt,C),this._add("touchRotate",nt,["touchPan","touchZoom"]),this._add("touchZoom",et,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&h.touchZoomRotate.enable(s.touchZoomRotate);const lt=h.scrollZoom=new Yg(h,()=>this._triggerRenderFrame());this._add("scrollZoom",lt,["mousePan"]),s.interactive&&s.scrollZoom&&h.scrollZoom.enable(s.scrollZoom);const $=h.keyboard=new Jd(h);this._add("keyboard",$),s.interactive&&s.keyboard&&h.keyboard.enable(),this._add("blockableMapEvent",new Xd(h))}_add(s,h,d){this._handlers.push({handlerName:s,handler:h,allowed:d}),this._handlersById[s]=h}stop(s){if(!this._updatingCamera){for(const{handler:h}of this._handlers)h.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!sc(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,h,d){for(const g in s)if(g!==d&&(!h||h.indexOf(g)<0))return!0;return!1}_getMapTouches(s){const h=[];for(const d of s)this._el.contains(d.target)&&h.push(d);return h}mergeHandlerResult(s,h,d,g,b){if(!d)return;a.e(s,d);const I={handlerName:g,originalEvent:d.originalEvent||b};d.zoomDelta!==void 0&&(h.zoom=I),d.panDelta!==void 0&&(h.drag=I),d.pitchDelta!==void 0&&(h.pitch=I),d.bearingDelta!==void 0&&(h.rotate=I)}_applyChanges(){const s={},h={},d={};for(const[g,b,I]of this._changes)g.panDelta&&(s.panDelta=(s.panDelta||new a.P(0,0))._add(g.panDelta)),g.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(s.around=g.around),g.pinchAround!==void 0&&(s.pinchAround=g.pinchAround),g.noInertia&&(s.noInertia=g.noInertia),a.e(h,b),a.e(d,I);this._updateMapTransform(s,h,d),this._changes=[]}_updateMapTransform(s,h,d){const g=this._map,b=g._getTransformForUpdate(),I=g.terrain;if(!(ac(s)||I&&this._terrainMovement))return this._fireEvents(h,d,!0);let{panDelta:C,zoomDelta:M,bearingDelta:k,pitchDelta:R,around:O,pinchAround:q}=s;q!==void 0&&(O=q),g._stop(!0),O=O||g.transform.centerPoint;const nt=b.pointLocation(C?O.sub(C):O);k&&(b.bearing+=k),R&&(b.pitch+=R),M&&(b.zoom+=M),I?this._terrainMovement||!h.drag&&!h.zoom?h.drag&&this._terrainMovement?b.center=b.pointLocation(b.centerPoint.sub(C)):b.setLocationAtPoint(nt,O):(this._terrainMovement=!0,this._map._elevationFreeze=!0,b.setLocationAtPoint(nt,O),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,b.recalculateZoom(g.terrain)})):b.setLocationAtPoint(nt,O),g._applyUpdatedTransform(b),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(h,d,!0)}_fireEvents(s,h,d){const g=sc(this._eventsInProgress),b=sc(s),I={};for(const R in s){const{originalEvent:O}=s[R];this._eventsInProgress[R]||(I[`${R}start`]=O),this._eventsInProgress[R]=s[R]}!g&&b&&this._fireEvent("movestart",b.originalEvent);for(const R in I)this._fireEvent(R,I[R]);b&&this._fireEvent("move",b.originalEvent);for(const R in s){const{originalEvent:O}=s[R];this._fireEvent(R,O)}const C={};let M;for(const R in this._eventsInProgress){const{handlerName:O,originalEvent:q}=this._eventsInProgress[R];this._handlersById[O].isActive()||(delete this._eventsInProgress[R],M=h[O]||q,C[`${R}end`]=M)}for(const R in C)this._fireEvent(R,C[R]);const k=sc(this._eventsInProgress);if(d&&(g||b)&&!k){this._updatingCamera=!0;const R=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),O=q=>q!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new qp("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class tm extends a.E{constructor(s,h){super(),this._renderFrameCallback=()=>{const d=Math.min((a.h.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(d)),d<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=h.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new a.L(this.transform.center.lng,this.transform.center.lat)}setCenter(s,h){return this.jumpTo({center:s},h)}panBy(s,h,d){return s=a.P.convert(s).mult(-1),this.panTo(this.transform.center,a.e({offset:s},h),d)}panTo(s,h,d){return this.easeTo(a.e({center:s},h),d)}getZoom(){return this.transform.zoom}setZoom(s,h){return this.jumpTo({zoom:s},h),this}zoomTo(s,h,d){return this.easeTo(a.e({zoom:s},h),d)}zoomIn(s,h){return this.zoomTo(this.getZoom()+1,s,h),this}zoomOut(s,h){return this.zoomTo(this.getZoom()-1,s,h),this}getBearing(){return this.transform.bearing}setBearing(s,h){return this.jumpTo({bearing:s},h),this}getPadding(){return this.transform.padding}setPadding(s,h){return this.jumpTo({padding:s},h),this}rotateTo(s,h,d){return this.easeTo(a.e({bearing:s},h),d)}resetNorth(s,h){return this.rotateTo(0,a.e({duration:1e3},s),h),this}resetNorthPitch(s,h){return this.easeTo(a.e({bearing:0,pitch:0,duration:1e3},s),h),this}snapToNorth(s,h){return Math.abs(this.getBearing()){if(this._zooming&&(d.zoom=a.B.number(g,M,Vt)),this._rotating&&(d.bearing=a.B.number(b,k,Vt)),this._pitching&&(d.pitch=a.B.number(I,R,Vt)),this._padding&&(d.interpolatePadding(C,O,Vt),nt=d.centerPoint.add(q)),this.terrain&&!s.freezeElevation&&this._updateElevation(Vt),pt)d.setLocationAtPoint(pt,Ct);else{const Wt=d.zoomScale(d.zoom-g),ee=M>g?Math.min(2,Ot):Math.max(.5,Ot),Kt=Math.pow(ee,1-Vt),oe=d.unproject($.add(St.mult(Vt*Kt)).mult(Wt));d.setLocationAtPoint(d.renderWorldCopies?oe.wrap():oe,nt)}this._applyUpdatedTransform(d),this._fireMoveEvents(h)},Vt=>{this.terrain&&this._finalizeElevation(),this._afterEase(h,Vt)},s),this}_prepareEase(s,h,d={}){this._moving=!0,h||d.moving||this.fire(new a.k("movestart",s)),this._zooming&&!d.zooming&&this.fire(new a.k("zoomstart",s)),this._rotating&&!d.rotating&&this.fire(new a.k("rotatestart",s)),this._pitching&&!d.pitching&&this.fire(new a.k("pitchstart",s))}_prepareElevation(s){this._elevationCenter=s,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(s){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const h=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&h!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(d-(h-(d*s+this._elevationStart))/(1-s)),this._elevationTarget=h}this.transform.elevation=a.B.number(this._elevationStart,this._elevationTarget,s)}_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(s){if(!this.transformCameraUpdate)return;const h=s.clone(),{center:d,zoom:g,pitch:b,bearing:I,elevation:C}=this.transformCameraUpdate(h);d&&(h.center=d),g!==void 0&&(h.zoom=g),b!==void 0&&(h.pitch=b),I!==void 0&&(h.bearing=I),C!==void 0&&(h.elevation=C),this.transform.apply(h)}_fireMoveEvents(s){this.fire(new a.k("move",s)),this._zooming&&this.fire(new a.k("zoom",s)),this._rotating&&this.fire(new a.k("rotate",s)),this._pitching&&this.fire(new a.k("pitch",s))}_afterEase(s,h){if(this._easeId&&h&&this._easeId===h)return;delete this._easeId;const d=this._zooming,g=this._rotating,b=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new a.k("zoomend",s)),g&&this.fire(new a.k("rotateend",s)),b&&this.fire(new a.k("pitchend",s)),this.fire(new a.k("moveend",s))}flyTo(s,h){if(!s.essential&&a.h.prefersReducedMotion){const Me=a.F(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Me,h)}this.stop(),s=a.e({offset:[0,0],speed:1.2,curve:1.42,easing:a.bb},s);const d=this._getTransformForUpdate(),g=this.getZoom(),b=this.getBearing(),I=this.getPitch(),C=this.getPadding(),M="zoom"in s?a.ad(+s.zoom,d.minZoom,d.maxZoom):g,k="bearing"in s?this._normalizeBearing(s.bearing,b):b,R="pitch"in s?+s.pitch:I,O="padding"in s?s.padding:d.padding,q=d.zoomScale(M-g),nt=a.P.convert(s.offset);let et=d.centerPoint.add(nt);const lt=d.pointLocation(et),$=a.L.convert(s.center||lt);this._normalizeCenter($);const St=d.project(lt),Ot=d.project($).sub(St);let pt=s.curve;const Ct=Math.max(d.width,d.height),Bt=Ct/q,Vt=Ot.mag();if("minZoom"in s){const Me=a.ad(Math.min(s.minZoom,g,M),d.minZoom,d.maxZoom),Kn=Ct/d.zoomScale(Me-g);pt=Math.sqrt(Kn/Vt*2)}const Wt=pt*pt;function ee(Me){const Kn=(Bt*Bt-Ct*Ct+(Me?-1:1)*Wt*Wt*Vt*Vt)/(2*(Me?Bt:Ct)*Wt*Vt);return Math.log(Math.sqrt(Kn*Kn+1)-Kn)}function Kt(Me){return(Math.exp(Me)-Math.exp(-Me))/2}function oe(Me){return(Math.exp(Me)+Math.exp(-Me))/2}const Te=ee(!1);let bn=function(Me){return oe(Te)/oe(Te+pt*Me)},pe=function(Me){return Ct*((oe(Te)*(Kt(Kn=Te+pt*Me)/oe(Kn))-Kt(Te))/Wt)/Vt;var Kn},qe=(ee(!0)-Te)/pt;if(Math.abs(Vt)<1e-6||!isFinite(qe)){if(Math.abs(Ct-Bt)<1e-6)return this.easeTo(s,h);const Me=Bts.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=b!==k,this._pitching=R!==I,this._padding=!d.isPaddingEqual(O),this._prepareEase(h,!1),this.terrain&&this._prepareElevation($),this._ease(Me=>{const Kn=Me*qe,vn=1/bn(Kn);d.zoom=Me===1?M:g+d.scaleZoom(vn),this._rotating&&(d.bearing=a.B.number(b,k,Me)),this._pitching&&(d.pitch=a.B.number(I,R,Me)),this._padding&&(d.interpolatePadding(C,O,Me),et=d.centerPoint.add(nt)),this.terrain&&!s.freezeElevation&&this._updateElevation(Me);const fn=Me===1?$:d.unproject(St.add(Ot.mult(pe(Kn))).mult(vn));d.setLocationAtPoint(d.renderWorldCopies?fn.wrap():fn,et),this._applyUpdatedTransform(d),this._fireMoveEvents(h)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(h)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,h){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,h)}if(!s){const d=this.handlers;d&&d.stop(!1)}return this}_ease(s,h,d){d.animate===!1||d.duration===0?(s(1),h()):(this._easeStart=a.h.now(),this._easeOptions=d,this._onEaseFrame=s,this._onEaseEnd=h,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,h){s=a.b5(s,-180,180);const d=Math.abs(s-h);return Math.abs(s-360-h)180?-360:d<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(a.L.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}class zo{constructor(s={}){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=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options&&this.options.compact,this._container=x.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=x.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=x.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(){x.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(s,h){const d=this._map._getUIString(`AttributionControl.${h}`);s.title=d,s.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}const h=this._map.style.sourceCaches;for(const g in h){const b=h[g];if(b.used||b.usedForTerrain){const I=b.getSource();I.attribution&&s.indexOf(I.attribution)<0&&s.push(I.attribution)}}s=s.filter(g=>String(g).trim()),s.sort((g,b)=>g.length-b.length),s=s.filter((g,b)=>{for(let I=b+1;I=0)return!1;return!0});const d=s.join(" | ");d!==this._attribHTML&&(this._attribHTML=d,s.length?(this._innerContainer.innerHTML=d,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ci{constructor(s={}){this._updateCompact=()=>{const h=this._container.children;if(h.length){const d=h[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=x.create("div","maplibregl-ctrl");const h=x.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(){x.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ch{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const h=++this._id;return this._queue.push({callback:s,id:h,cancelled:!1}),h}remove(s){const h=this._currentlyRunning,d=h?this._queue.concat(h):this._queue;for(const g of d)if(g.id===s)return void(g.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const h=this._currentlyRunning=this._queue;this._queue=[];for(const d of h)if(!d.cancelled&&(d.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Wp={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var em=a.Q([{name:"a_pos3d",type:"Int16",components:3}]);class nm extends a.E{constructor(s){super(),this.sourceCache=s,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,s.usedForTerrain=!0,s.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(s,h){this.sourceCache.update(s,h),this._renderableTilesKeys=[];const d={};for(const g of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:h}))d[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),a.aS(g.posMatrix,0,a.N,0,a.N,0,1),this._tiles[g.key]=new Ie(g,this.tileSize));for(const g in this._tiles)d[g]||delete this._tiles[g]}freeRtt(s){for(const h in this._tiles){const d=this._tiles[h];(!s||d.tileID.equals(s)||d.tileID.isChildOf(s)||s.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(s=>this.getTileByID(s))}getTileByID(s){return this._tiles[s]}getTerrainCoords(s){const h={};for(const d of this._renderableTilesKeys){const g=this._tiles[d].tileID;if(g.canonical.equals(s.canonical)){const b=s.clone();b.posMatrix=new Float64Array(16),a.aS(b.posMatrix,0,a.N,0,a.N,0,1),h[d]=b}else if(g.canonical.isChildOf(s.canonical)){const b=s.clone();b.posMatrix=new Float64Array(16);const I=g.canonical.z-s.canonical.z,C=g.canonical.x-(g.canonical.x>>I<>I<>I;a.aS(b.posMatrix,0,k,0,k,0,1),a.$(b.posMatrix,b.posMatrix,[-C*k,-M*k,0]),h[d]=b}else if(s.canonical.isChildOf(g.canonical)){const b=s.clone();b.posMatrix=new Float64Array(16);const I=s.canonical.z-g.canonical.z,C=s.canonical.x-(s.canonical.x>>I<>I<>I;a.aS(b.posMatrix,0,a.N,0,a.N,0,1),a.$(b.posMatrix,b.posMatrix,[C*k,M*k,0]),a.a0(b.posMatrix,b.posMatrix,[1/2**I,1/2**I,0]),h[d]=b}}return h}getSourceTile(s,h){const d=this.sourceCache._source;let g=s.overscaledZ-this.deltaZoom;if(g>d.maxzoom&&(g=d.maxzoom),g=d.minzoom&&(!b||!b.dem);)b=this.sourceCache.getTileByID(s.scaledTo(g--).key);return b}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(h=>h.timeAdded>=s)}}class im{constructor(s,h,d){this.painter=s,this.sourceCache=new nm(h),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(s,h,d,g=a.N){var b;if(!(h>=0&&h=0&&ds.canonical.z&&(s.canonical.z>=g?b=s.canonical.z-g:a.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const I=s.canonical.x-(s.canonical.x>>b<>b<>8<<4|b>>8,h[I+3]=0;const d=new a.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(h.buffer)),g=new Lt(s,d,s.gl.RGBA,{premultiply:!1});return g.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(s){const h=new Uint8Array(4),d=this.painter.context,g=d.gl;d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(s.x,this.painter.height/devicePixelRatio-s.y-1,1,1,g.RGBA,g.UNSIGNED_BYTE,h),d.bindFramebuffer.set(null);const b=h[0]+(h[2]>>4<<8),I=h[1]+((15&h[2])<<8),C=this.coordsIndex[255-h[3]],M=C&&this.sourceCache.getTileByID(C);if(!M)return null;const k=this._coordsTextureSize,R=(1<0&&Math.sign(b)<0||!d&&Math.sign(g)<0&&Math.sign(b)>0?(g=360*Math.sign(b)+g,a.G(g)):h}}class Kg{constructor(s,h,d){this._context=s,this._size=h,this._tileSize=d,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const s of this._objects)s.texture.destroy(),s.fbo.destroy()}_createObject(s){const h=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),d=new Lt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return d.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),h.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),h.colorAttachment.set(d.texture),{id:s,fbo:h,texture:d,stamp:-1,inUse:!1}}getObjectForId(s){return this._objects[s]}useObject(s){s.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(h=>s.id!==h),this._recentlyUsed.push(s.id)}stampObject(s){s.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 s=this._createObject(this._objects.length);return this._objects.push(s),s}freeObject(s){s.inUse=!1}freeAllObjects(){for(const s of this._objects)this.freeObject(s)}isFull(){return!(this._objects.length!s.inUse)===!1}}const so={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class hh{constructor(s,h){this.painter=s,this.terrain=h,this.pool=new Kg(s.context,30,h.sourceCache.tileSize*h.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}prepareForRender(s,h){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(d=>!s._layers[d].isHidden(h)),this._coordsDescendingInv={};for(const d in s.sourceCaches){this._coordsDescendingInv[d]={};const g=s.sourceCaches[d].getVisibleCoordinates();for(const b of g){const I=this.terrain.sourceCache.getTerrainCoords(b);for(const C in I)this._coordsDescendingInv[d][C]||(this._coordsDescendingInv[d][C]=[]),this._coordsDescendingInv[d][C].push(I[C])}}this._coordsDescendingInvStr={};for(const d of s._order){const g=s._layers[d],b=g.source;if(so[g.type]&&!this._coordsDescendingInvStr[b]){this._coordsDescendingInvStr[b]={};for(const I in this._coordsDescendingInv[b])this._coordsDescendingInvStr[b][I]=this._coordsDescendingInv[b][I].map(C=>C.key).sort().join()}}for(const d of this._renderableTiles)for(const g in this._coordsDescendingInvStr){const b=this._coordsDescendingInvStr[g][d.tileID.key];b&&b!==d.rttCoords[g]&&(d.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const h=s.type,d=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(so[h]&&(this._prevType&&so[this._prevType]||this._stacks.push([]),this._prevType=h,this._stacks[this._stacks.length-1].push(s.id),!g))return!0;if(so[this._prevType]||so[h]&&g){this._prevType=h;const b=this._stacks.length-1,I=this._stacks[b]||[];for(const C of this._renderableTiles){if(this.pool.isFull()&&(Pi(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(C),C.rtt[b]){const k=this.pool.getObjectForId(C.rtt[b].id);if(k.stamp===C.rtt[b].stamp){this.pool.useObject(k);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),C.rtt[b]={id:M.id,stamp:M.stamp},d.context.bindFramebuffer.set(M.fbo.framebuffer),d.context.clear({color:a.aT.transparent,stencil:0}),d.currentStencilSource=void 0;for(let k=0;k{y.touchstart=y.dragStart,y.touchmoveWindow=y.dragMove,y.touchend=y.dragEnd},Xp={showCompass:!0,showZoom:!0,visualizePitch:!1};class Hp{constructor(s,h,d=!1){this.mousedown=I=>{this.startMouse(a.e({},I,{ctrlKey:!0,preventDefault:()=>I.preventDefault()}),x.mousePos(this.element,I)),x.addEventListener(window,"mousemove",this.mousemove),x.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=I=>{this.moveMouse(I,x.mousePos(this.element,I))},this.mouseup=I=>{this.mouseRotate.dragEnd(I),this.mousePitch&&this.mousePitch.dragEnd(I),this.offTemp()},this.touchstart=I=>{I.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=x.touchPos(this.element,I.targetTouches)[0],this.startTouch(I,this._startPos),x.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),x.addEventListener(window,"touchend",this.touchend))},this.touchmove=I=>{I.targetTouches.length!==1?this.reset():(this._lastPos=x.touchPos(this.element,I.targetTouches)[0],this.moveTouch(I,this._lastPos))},this.touchend=I=>{I.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 g=s.dragRotate._mouseRotate.getClickTolerance(),b=s.dragRotate._mousePitch.getClickTolerance();this.element=h,this.mouseRotate=du({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:I,clickTolerance:C,bearingDegreesPerPixelMoved:M=.8})=>{const k=new Yd;return new Ta({clickTolerance:C,move:(R,O)=>({bearingDelta:(O.x-R.x)*M}),moveStateManager:k,enable:I,assignEvents:lc})})({clickTolerance:g,enable:!0}),this.map=s,d&&(this.mousePitch=La({clickTolerance:b,enable:!0}),this.touchPitch=(({enable:I,clickTolerance:C,pitchDegreesPerPixelMoved:M=-.5})=>{const k=new Yd;return new Ta({clickTolerance:C,move:(R,O)=>({pitchDelta:(O.y-R.y)*M}),moveStateManager:k,enable:I,assignEvents:lc})})({clickTolerance:b,enable:!0})),x.addEventListener(h,"mousedown",this.mousedown),x.addEventListener(h,"touchstart",this.touchstart,{passive:!1}),x.addEventListener(h,"touchcancel",this.reset)}startMouse(s,h){this.mouseRotate.dragStart(s,h),this.mousePitch&&this.mousePitch.dragStart(s,h),x.disableDrag()}startTouch(s,h){this.touchRotate.dragStart(s,h),this.touchPitch&&this.touchPitch.dragStart(s,h),x.disableDrag()}moveMouse(s,h){const d=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(s,h)||{};if(g&&d.setBearing(d.getBearing()+g),this.mousePitch){const{pitchDelta:b}=this.mousePitch.dragMove(s,h)||{};b&&d.setPitch(d.getPitch()+b)}}moveTouch(s,h){const d=this.map,{bearingDelta:g}=this.touchRotate.dragMove(s,h)||{};if(g&&d.setBearing(d.getBearing()+g),this.touchPitch){const{pitchDelta:b}=this.touchPitch.dragMove(s,h)||{};b&&d.setPitch(d.getPitch()+b)}}off(){const s=this.element;x.removeEventListener(s,"mousedown",this.mousedown),x.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),x.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),x.removeEventListener(window,"touchend",this.touchend),x.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){x.enableDrag(),x.removeEventListener(window,"mousemove",this.mousemove),x.removeEventListener(window,"mouseup",this.mouseup),x.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),x.removeEventListener(window,"touchend",this.touchend)}}let Wi;function Yp(y,s,h){if(y=new a.L(y.lng,y.lat),s){const d=new a.L(y.lng-360,y.lat),g=new a.L(y.lng+360,y.lat),b=h.locationPoint(y).distSqr(s);h.locationPoint(d).distSqr(s)180;){const d=h.locationPoint(y);if(d.x>=0&&d.y>=0&&d.x<=h.width&&d.y<=h.height)break;y.lng>h.center.lng?y.lng-=360:y.lng+=360}return y}const as={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 rm(y,s,h){const d=y.classList;for(const g in as)d.remove(`maplibregl-${h}-anchor-${g}`);d.add(`maplibregl-${h}-anchor-${s}`)}class Ll extends a.E{constructor(s){if(super(),this._onKeyPress=h=>{const d=h.code,g=h.charCode||h.keyCode;d!=="Space"&&d!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=h=>{const d=h.originalEvent.target,g=this._element;this._popup&&(d===g||g.contains(d))&&this.togglePopup()},this._update=h=>{if(!this._map)return;const d=this._map.loaded()&&!this._map.isMoving();((h==null?void 0:h.type)==="terrain"||(h==null?void 0:h.type)==="render"&&!d)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=Yp(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let g="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?g=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(g=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let b="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?b="rotateX(0deg)":this._pitchAlignment==="map"&&(b=`rotateX(${this._map.getPitch()}deg)`),h&&h.type!=="moveend"||(this._pos=this._pos.round()),x.setTransform(this._element,`${as[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${b} ${g}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const I=this._map.unproject(this._pos),C=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=I.distanceTo(this._lngLat)>20*C?"0.2":"1.0",this._opacityTimeout=null},100))},this._onMove=h=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=h.point.dist(this._pointerdownPos)>=d}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=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment!=="auto"?s.pitchAlignment:this._rotationAlignment,s&&s.element)this._element=s.element,this._offset=a.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=x.create("div"),this._element.setAttribute("aria-label","Map marker");const h=x.createNS("http://www.w3.org/2000/svg","svg"),d=41,g=27;h.setAttributeNS(null,"display","block"),h.setAttributeNS(null,"height",`${d}px`),h.setAttributeNS(null,"width",`${g}px`),h.setAttributeNS(null,"viewBox",`0 0 ${g} ${d}`);const b=x.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"stroke","none"),b.setAttributeNS(null,"stroke-width","1"),b.setAttributeNS(null,"fill","none"),b.setAttributeNS(null,"fill-rule","evenodd");const I=x.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"fill-rule","nonzero");const C=x.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"transform","translate(3.0, 29.0)"),C.setAttributeNS(null,"fill","#000000");const M=[{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 St of M){const Ot=x.createNS("http://www.w3.org/2000/svg","ellipse");Ot.setAttributeNS(null,"opacity","0.04"),Ot.setAttributeNS(null,"cx","10.5"),Ot.setAttributeNS(null,"cy","5.80029008"),Ot.setAttributeNS(null,"rx",St.rx),Ot.setAttributeNS(null,"ry",St.ry),C.appendChild(Ot)}const k=x.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"fill",this._color);const R=x.createNS("http://www.w3.org/2000/svg","path");R.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"),k.appendChild(R);const O=x.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"opacity","0.25"),O.setAttributeNS(null,"fill","#000000");const q=x.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"),O.appendChild(q);const nt=x.createNS("http://www.w3.org/2000/svg","g");nt.setAttributeNS(null,"transform","translate(6.0, 7.0)"),nt.setAttributeNS(null,"fill","#FFFFFF");const et=x.createNS("http://www.w3.org/2000/svg","g");et.setAttributeNS(null,"transform","translate(8.0, 8.0)");const lt=x.createNS("http://www.w3.org/2000/svg","circle");lt.setAttributeNS(null,"fill","#000000"),lt.setAttributeNS(null,"opacity","0.25"),lt.setAttributeNS(null,"cx","5.5"),lt.setAttributeNS(null,"cy","5.5"),lt.setAttributeNS(null,"r","5.4999962");const $=x.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#FFFFFF"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962"),et.appendChild(lt),et.appendChild($),I.appendChild(C),I.appendChild(k),I.appendChild(O),I.appendChild(nt),I.appendChild(et),h.appendChild(I),h.setAttributeNS(null,"height",d*this._scale+"px"),h.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(h),this._offset=a.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",h=>{h.preventDefault()}),this._element.addEventListener("mousedown",h=>{h.preventDefault()}),rm(this._element,this._anchor,"marker"),s&&s.className)for(const h of s.className.split(" "))this._element.classList.add(h);this._popup=null}addTo(s){return this.remove(),this._map=s,s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.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),x.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=a.L.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const g=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[g,-1*(38.1-13.5+g)],"bottom-right":[-g,-1*(38.1-13.5+g)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._lngLat&&this._popup.setLngLat(this._lngLat),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 s=this._popup;return s?(s.isOpen()?s.remove():s.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(s){return this._offset=a.P.convert(s),this._update(),this}addClassName(s){this._element.classList.add(s)}removeClassName(s){this._element.classList.remove(s)}toggleClassName(s){return this._element.classList.toggle(s)}setDraggable(s){return this._draggable=!!s,this._map&&(s?(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(s){return this._rotation=s||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(s){return this._rotationAlignment=s||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(s){return this._pitchAlignment=s&&s!=="auto"?s:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Ai={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ei=0,gu=!1;const uc={maxWidth:100,unit:"metric"};function cc(y,s,h){const d=h&&h.maxWidth||100,g=y._container.clientHeight/2,b=y.unproject([0,g]),I=y.unproject([d,g]),C=b.distanceTo(I);if(h&&h.unit==="imperial"){const M=3.2808*C;M>5280?Ml(s,d,M/5280,y._getUIString("ScaleControl.Miles")):Ml(s,d,M,y._getUIString("ScaleControl.Feet"))}else h&&h.unit==="nautical"?Ml(s,d,C/1852,y._getUIString("ScaleControl.NauticalMiles")):C>=1e3?Ml(s,d,C/1e3,y._getUIString("ScaleControl.Kilometers")):Ml(s,d,C,y._getUIString("ScaleControl.Meters"))}function Ml(y,s,h,d){const g=function(b){const I=Math.pow(10,`${Math.floor(b)}`.length-1);let C=b/I;return C=C>=10?10:C>=5?5:C>=3?3:C>=2?2:C>=1?1:function(M){const k=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*k)/k}(C),I*C}(h);y.style.width=s*(g/h)+"px",y.innerHTML=`${g} ${d}`}const Kp={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Jp=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function _u(y){if(y){if(typeof y=="number"){const s=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(s,s),"top-right":new a.P(-s,s),bottom:new a.P(0,-y),"bottom-left":new a.P(s,-s),"bottom-right":new a.P(-s,-s),left:new a.P(y,0),right:new a.P(-y,0)}}if(y instanceof a.P||Array.isArray(y)){const s=a.P.convert(y);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}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 _u(new a.P(0,0))}const Qp={extend:(y,...s)=>a.e(y,...s),run(y){y()},logToElement(y,s=!1,h="log"){const d=window.document.getElementById(h);d&&(s&&(d.innerHTML=""),d.innerHTML+=`
${y}`)}},$p=_;class Vn{static get version(){return $p}static get workerCount(){return $o.workerCount}static set workerCount(s){$o.workerCount=s}static get maxParallelImageRequests(){return a.c.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(s){a.c.MAX_PARALLEL_IMAGE_REQUESTS=s}static get workerUrl(){return a.c.WORKER_URL}static set workerUrl(s){a.c.WORKER_URL=s}static addProtocol(s,h){a.c.REGISTERED_PROTOCOLS[s]=h}static removeProtocol(s){delete a.c.REGISTERED_PROTOCOLS[s]}}return Vn.Map=class extends tm{constructor(y){if(a.bg.mark(a.bh.create),(y=a.e({},je,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 sh(y.minZoom,y.maxZoom,y.minPitch,y.maxPitch,y.renderWorldCopies),{bearingSnap:y.bearingSnap}),this._cooperativeGesturesOnWheel=s=>{this._onCooperativeGesture(s,s[this._metaKey],1)},this._contextLost=s=>{s.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new a.k("webglcontextrestored",{originalEvent:s}))},this._onMapScroll=s=>{if(s.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=y.interactive,this._cooperativeGestures=y.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",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 ch,this._controls=[],this._mapId=a.a2(),this._locale=a.e({},Wp,y.locale),this._clickTolerance=y.clickTolerance,this._overridePixelRatio=y.pixelRatio,this._maxCanvasSize=y.maxCanvasSize,this.transformCameraUpdate=y.transformCameraUpdate,this._imageQueueHandle=Z.addThrottleControl(()=>this.isMoving()),this._requestManager=new V(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 s=!1;const h=Tl(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{s?h(d):s=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Zp(this,y),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=y.hash&&new ic(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 zo({customAttribution:y.customAttribution})),y.maplibreLogo&&this.addControl(new ci,y.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new a.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new a.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new a.k("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(y,s){if(s===void 0&&(s=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 d=this._controlPositions[s];return s.indexOf("bottom")!==-1?d.insertBefore(h,d.firstChild):d.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 s=this._controls.indexOf(y);return s>-1&&this._controls.splice(s,1),y.onRemove(this),this}hasControl(y){return this._controls.indexOf(y)>-1}calculateCameraOptionsFromTo(y,s,h,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(h,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(y,s,h,d)}resize(y){var s;const h=this._containerDimensions(),d=h[0],g=h[1],b=this._getClampedPixelRatio(d,g);if(this._resizeCanvas(d,g,b),this.painter.resize(d,g,b),this.painter.overLimit()){const C=this.painter.context.gl;this._maxCanvasSize=[C.drawingBufferWidth,C.drawingBufferHeight];const M=this._getClampedPixelRatio(d,g);this._resizeCanvas(d,g,M),this.painter.resize(d,g,M)}this.transform.resize(d,g),(s=this._requestedCameraState)===null||s===void 0||s.resize(d,g);const I=!this._moving;return I&&(this.stop(),this.fire(new a.k("movestart",y)).fire(new a.k("move",y))),this.fire(new a.k("resize",y)),I&&this.fire(new a.k("moveend",y)),this}_getClampedPixelRatio(y,s){const{0:h,1:d}=this._maxCanvasSize,g=this.getPixelRatio(),b=y*g,I=s*g;return Math.min(b>h?h/b:1,I>d?d/I:1)*g}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(Ge.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()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(y){return this._cooperativeGestures=y,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(y){return this.transform.locationPoint(a.L.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,s,h){if(y==="mouseenter"||y==="mouseover"){let d=!1;return{layer:s,listener:h,delegates:{mousemove:b=>{const I=this.getLayer(s)?this.queryRenderedFeatures(b.point,{layers:[s]}):[];I.length?d||(d=!0,h.call(this,new Oo(y,this,b.originalEvent,{features:I}))):d=!1},mouseout:()=>{d=!1}}}}if(y==="mouseleave"||y==="mouseout"){let d=!1;return{layer:s,listener:h,delegates:{mousemove:I=>{(this.getLayer(s)?this.queryRenderedFeatures(I.point,{layers:[s]}):[]).length?d=!0:d&&(d=!1,h.call(this,new Oo(y,this,I.originalEvent)))},mouseout:I=>{d&&(d=!1,h.call(this,new Oo(y,this,I.originalEvent)))}}}}{const d=g=>{const b=this.getLayer(s)?this.queryRenderedFeatures(g.point,{layers:[s]}):[];b.length&&(g.features=b,h.call(this,g),delete g.features)};return{layer:s,listener:h,delegates:{[y]:d}}}}on(y,s,h){if(h===void 0)return super.on(y,s);const d=this._createDelegatedListener(y,s,h);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[y]=this._delegatedListeners[y]||[],this._delegatedListeners[y].push(d);for(const g in d.delegates)this.on(g,d.delegates[g]);return this}once(y,s,h){if(h===void 0)return super.once(y,s);const d=this._createDelegatedListener(y,s,h);for(const g in d.delegates)this.once(g,d.delegates[g]);return this}off(y,s,h){return h===void 0?super.off(y,s):(this._delegatedListeners&&this._delegatedListeners[y]&&(d=>{const g=this._delegatedListeners[y];for(let b=0;bthis._updateStyle(y,s));const h=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!y)),y?(this.style=new Dr(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof y=="string"?this.style.loadURL(y,s,h):this.style.loadJSON(y,s,h),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Dr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(y,s){if(typeof y=="string"){const h=this._requestManager.transformRequest(y,K.Style);a.f(h,(d,g)=>{d?this.fire(new a.j(d)):g&&this._updateDiff(g,s)})}else typeof y=="object"&&this._updateDiff(y,s)}_updateDiff(y,s){try{this.style.setState(y,s)&&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,s)}}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,s){return this._lazyInitEmptyStyle(),this.style.addSource(y,s),this._update(!0)}isSourceLoaded(y){const s=this.style&&this.style.sourceCaches[y];if(s!==void 0)return s.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 s=this.style.sourceCaches[y.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${y.source}`);for(const h in this.style._layers){const d=this.style._layers[h];d.type==="hillshade"&&d.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 im(this.painter,s,y),this.painter.renderToTexture=new hh(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=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._minEleveationForCurrentTile=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._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new a.k("terrain",{terrain:y})),this}getTerrain(){var y,s;return(s=(y=this.terrain)===null||y===void 0?void 0:y.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const y=this.style&&this.style.sourceCaches;for(const s in y){const h=y[s]._tiles;for(const d in h){const g=h[d];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}addSourceType(y,s,h){return this._lazyInitEmptyStyle(),this.style.addSourceType(y,s,h)}removeSource(y){return this.style.removeSource(y),this._update(!0)}getSource(y){return this.style.getSource(y)}addImage(y,s,h={}){const{pixelRatio:d=1,sdf:g=!1,stretchX:b,stretchY:I,content:C}=h;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||a.a(s))){if(s.width===void 0||s.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:M,height:k,data:R}=s,O=s;return this.style.addImage(y,{data:new a.R({width:M,height:k},new Uint8Array(R)),pixelRatio:d,stretchX:b,stretchY:I,content:C,sdf:g,version:0,userImage:O}),O.onAdd&&O.onAdd(this,y),this}}{const{width:M,height:k,data:R}=a.h.getImageData(s);this.style.addImage(y,{data:new a.R({width:M,height:k},R),pixelRatio:d,stretchX:b,stretchY:I,content:C,sdf:g,version:0})}}updateImage(y,s){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 d=s instanceof HTMLImageElement||a.a(s)?a.h.getImageData(s):s,{width:g,height:b,data:I}=d;if(g===void 0||b===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(g!==h.data.width||b!==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 C=!(s instanceof HTMLImageElement||a.a(s));return h.data.replace(I,C),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,s){Z.getImage(this._requestManager.transformRequest(y,K.Image),s)}listImages(){return this.style.listImages()}addLayer(y,s){return this._lazyInitEmptyStyle(),this.style.addLayer(y,s),this._update(!0)}moveLayer(y,s){return this.style.moveLayer(y,s),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,s,h){return this.style.setLayerZoomRange(y,s,h),this._update(!0)}setFilter(y,s,h={}){return this.style.setFilter(y,s,h),this._update(!0)}getFilter(y){return this.style.getFilter(y)}setPaintProperty(y,s,h,d={}){return this.style.setPaintProperty(y,s,h,d),this._update(!0)}getPaintProperty(y,s){return this.style.getPaintProperty(y,s)}setLayoutProperty(y,s,h,d={}){return this.style.setLayoutProperty(y,s,h,d),this._update(!0)}getLayoutProperty(y,s){return this.style.getLayoutProperty(y,s)}setGlyphs(y,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(y,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(y,s,h={}){return this._lazyInitEmptyStyle(),this.style.addSprite(y,s,h,d=>{d||this._update(!0)}),this}removeSprite(y){return this._lazyInitEmptyStyle(),this.style.removeSprite(y),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(y,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(y,s,h=>{h||this._update(!0)}),this}setLight(y,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(y,s),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(y,s){return this.style.setFeatureState(y,s),this._update()}removeFeatureState(y,s){return this.style.removeFeatureState(y,s),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,s=0;return this._container&&(y=this._container.clientWidth||400,s=this._container.clientHeight||300),[y,s]}_setupContainer(){const y=this._container;y.classList.add("maplibregl-map");const s=this._canvasContainer=x.create("div","maplibregl-canvas-container",y);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=x.create("canvas","maplibregl-canvas",s),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(),d=this._getClampedPixelRatio(h[0],h[1]);this._resizeCanvas(h[0],h[1],d);const g=this._controlContainer=x.create("div","maplibregl-control-container",y),b=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(I=>{b[I]=x.create("div",`maplibregl-ctrl-${I} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=x.create("div","maplibregl-cooperative-gesture-screen",this._container);let y=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(y=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=` +`}),staticAttributes:d,staticUniforms:I}}class wl{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(s,h,d,g,b,I,C,M,k){this.context=s;let R=this.boundPaintVertexBuffers.length!==g.length;for(let z=0;!R&&z({u_depth:new a.aL(Vt,Xt.u_depth),u_terrain:new a.aL(Vt,Xt.u_terrain),u_terrain_dim:new a.aM(Vt,Xt.u_terrain_dim),u_terrain_matrix:new a.aN(Vt,Xt.u_terrain_matrix),u_terrain_unpack:new a.aO(Vt,Xt.u_terrain_unpack),u_terrain_exaggeration:new a.aM(Vt,Xt.u_terrain_exaggeration)}))(s,Bt),this.binderUniforms=d?d.getUniforms(s,Bt):[]}draw(s,h,d,g,b,I,C,M,k,R,z,W,nt,et,at,$,St,Ot){const ct=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(d),s.setStencilMode(g),s.setColorMode(b),s.setCullFace(I),M){s.activeTexture.set(ct.TEXTURE2),ct.bindTexture(ct.TEXTURE_2D,M.depthTexture),s.activeTexture.set(ct.TEXTURE3),ct.bindTexture(ct.TEXTURE_2D,M.texture);for(const Bt in this.terrainUniforms)this.terrainUniforms[Bt].set(M[Bt])}for(const Bt in this.fixedUniforms)this.fixedUniforms[Bt].set(C[Bt]);at&&at.setUniforms(s,this.binderUniforms,nt,{zoom:et});let It=0;switch(h){case ct.LINES:It=2;break;case ct.TRIANGLES:It=3;break;case ct.LINE_STRIP:It=1}for(const Bt of W.get()){const Vt=Bt.vaos||(Bt.vaos={});(Vt[k]||(Vt[k]=new wl)).bind(s,this,R,at?at.getPaintVertexBuffers():[],z,Bt.vertexOffset,$,St,Ot),ct.drawElements(h,Bt.primitiveLength*It,ct.UNSIGNED_SHORT,Bt.primitiveOffset*It*2)}}}function os(y,s,h){const d=1/gt(h,1,s.transform.tileZoom),g=Math.pow(2,h.tileID.overscaledZ),b=h.tileSize*Math.pow(2,s.transform.tileZoom)/g,I=b*(h.tileID.canonical.x+h.tileID.wrap*g),C=b*h.tileID.canonical.y;return{u_image:0,u_texsize:h.imageAtlasTexture.size,u_scale:[d,y.fromScale,y.toScale],u_fade:y.t,u_pixel_coord_upper:[I>>16,C>>16],u_pixel_coord_lower:[65535&I,65535&C]}}const dp=(y,s,h,d)=>{const g=s.style.light,b=g.properties.get("position"),I=[b.x,b.y,b.z],C=function(){var k=new a.A(9);return a.A!=Float32Array&&(k[1]=0,k[2]=0,k[3]=0,k[5]=0,k[6]=0,k[7]=0),k[0]=1,k[4]=1,k[8]=1,k}();g.properties.get("anchor")==="viewport"&&function(k,R){var z=Math.sin(R),W=Math.cos(R);k[0]=W,k[1]=z,k[2]=0,k[3]=-z,k[4]=W,k[5]=0,k[6]=0,k[7]=0,k[8]=1}(C,-s.transform.angle),function(k,R,z){var W=R[0],nt=R[1],et=R[2];k[0]=W*z[0]+nt*z[3]+et*z[6],k[1]=W*z[1]+nt*z[4]+et*z[7],k[2]=W*z[2]+nt*z[5]+et*z[8]}(I,I,C);const M=g.properties.get("color");return{u_matrix:y,u_lightpos:I,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+h,u_opacity:d}},Ya=(y,s,h,d,g,b,I)=>a.e(dp(y,s,h,d),os(b,s,I),{u_height_factor:-Math.pow(2,g.overscaledZ)/I.tileSize/8}),wd=y=>({u_matrix:y}),mp=(y,s,h,d)=>a.e(wd(y),os(h,s,d)),Uc=(y,s)=>({u_matrix:y,u_world:s}),Gc=(y,s,h,d,g)=>a.e(mp(y,s,h,d),{u_world:g}),Ka=(y,s,h,d)=>{const g=y.transform;let b,I;if(d.paint.get("circle-pitch-alignment")==="map"){const C=gt(h,1,g.zoom);b=!0,I=[C,C]}else b=!1,I=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:y.translatePosMatrix(s.posMatrix,h,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+b,u_device_pixel_ratio:y.pixelRatio,u_extrude_scale:I}},gp=(y,s,h)=>{const d=gt(h,1,s.zoom),g=Math.pow(2,s.zoom-h.tileID.overscaledZ),b=h.tileID.overscaleFactor();return{u_matrix:y,u_camera_to_center_distance:s.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[s.pixelsToGLUnits[0]/(d*g),s.pixelsToGLUnits[1]/(d*g)],u_overscale_factor:b}},Yu=(y,s,h=1)=>({u_matrix:y,u_color:s,u_overlay:0,u_overlay_scale:h}),Sd=y=>({u_matrix:y}),Og=(y,s,h,d)=>({u_matrix:y,u_extrude_scale:gt(s,1,h),u_intensity:d});function _p(y,s){const h=Math.pow(2,s.canonical.z),d=s.canonical.y;return[new a.U(0,d/h).toLngLat().lat,new a.U(0,(d+1)/h).toLngLat().lat]}const yp=(y,s,h,d)=>{const g=y.transform;return{u_matrix:jc(y,s,h,d),u_ratio:1/gt(s,1,g.zoom),u_device_pixel_ratio:y.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},Ed=(y,s,h,d,g)=>a.e(yp(y,s,h,g),{u_image:0,u_image_height:d}),zg=(y,s,h,d,g)=>{const b=y.transform,I=Cd(s,b);return{u_matrix:jc(y,s,h,g),u_texsize:s.imageAtlasTexture.size,u_ratio:1/gt(s,1,b.zoom),u_device_pixel_ratio:y.pixelRatio,u_image:0,u_scale:[I,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/b.pixelsToGLUnits[0],1/b.pixelsToGLUnits[1]]}},Id=(y,s,h,d,g,b)=>{const I=y.lineAtlas,C=Cd(s,y.transform),M=h.layout.get("line-cap")==="round",k=I.getDash(d.from,M),R=I.getDash(d.to,M),z=k.width*g.fromScale,W=R.width*g.toScale;return a.e(yp(y,s,h,b),{u_patternscale_a:[C/z,-k.height/2],u_patternscale_b:[C/W,-R.height/2],u_sdfgamma:I.width/(256*Math.min(z,W)*y.pixelRatio)/2,u_image:0,u_tex_y_a:k.y,u_tex_y_b:R.y,u_mix:g.t})};function Cd(y,s){return 1/gt(y,1,s.tileZoom)}function jc(y,s,h,d){return y.translatePosMatrix(d?d.posMatrix:s.tileID.posMatrix,s,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}const Td=(y,s,h,d,g)=>{return{u_matrix:y,u_tl_parent:s,u_scale_parent:h,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*g.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:g.paint.get("raster-brightness-min"),u_brightness_high:g.paint.get("raster-brightness-max"),u_saturation_factor:(I=g.paint.get("raster-saturation"),I>0?1-1/(1.001-I):-I),u_contrast_factor:(b=g.paint.get("raster-contrast"),b>0?1/(1-b):1+b),u_spin_weights:Ld(g.paint.get("raster-hue-rotate"))};var b,I};function Ld(y){y*=Math.PI/180;const s=Math.sin(y),h=Math.cos(y);return[(2*h+1)/3,(-Math.sqrt(3)*s-h+1)/3,(Math.sqrt(3)*s-h+1)/3]}const vp=(y,s,h,d,g,b,I,C,M,k)=>{const R=g.transform;return{u_is_size_zoom_constant:+(y==="constant"||y==="source"),u_is_size_feature_constant:+(y==="constant"||y==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:R.cameraToCenterDistance,u_pitch:R.pitch/360*2*Math.PI,u_rotate_symbol:+h,u_aspect_ratio:R.width/R.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:b,u_label_plane_matrix:I,u_coord_matrix:C,u_is_text:+M,u_pitch_with_map:+d,u_texsize:k,u_texture:0}},bp=(y,s,h,d,g,b,I,C,M,k,R)=>{const z=g.transform;return a.e(vp(y,s,h,d,g,b,I,C,M,k),{u_gamma_scale:d?Math.cos(z._pitch)*z.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+R})},Sl=(y,s,h,d,g,b,I,C,M,k)=>a.e(bp(y,s,h,d,g,b,I,C,!0,M,!0),{u_texsize_icon:k,u_texture_icon:1}),qc=(y,s,h)=>({u_matrix:y,u_opacity:s,u_color:h}),ss=(y,s,h,d,g,b)=>a.e(function(I,C,M,k){const R=M.imageManager.getPattern(I.from.toString()),z=M.imageManager.getPattern(I.to.toString()),{width:W,height:nt}=M.imageManager.getPixelSize(),et=Math.pow(2,k.tileID.overscaledZ),at=k.tileSize*Math.pow(2,M.transform.tileZoom)/et,$=at*(k.tileID.canonical.x+k.tileID.wrap*et),St=at*k.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:R.tl,u_pattern_br_a:R.br,u_pattern_tl_b:z.tl,u_pattern_br_b:z.br,u_texsize:[W,nt],u_mix:C.t,u_pattern_size_a:R.displaySize,u_pattern_size_b:z.displaySize,u_scale_a:C.fromScale,u_scale_b:C.toScale,u_tile_units_to_pixels:1/gt(k,1,M.transform.tileZoom),u_pixel_coord_upper:[$>>16,St>>16],u_pixel_coord_lower:[65535&$,65535&St]}}(d,b,h,g),{u_matrix:y,u_opacity:s}),Zc={fillExtrusion:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_lightpos:new a.aP(y,s.u_lightpos),u_lightintensity:new a.aM(y,s.u_lightintensity),u_lightcolor:new a.aP(y,s.u_lightcolor),u_vertical_gradient:new a.aM(y,s.u_vertical_gradient),u_opacity:new a.aM(y,s.u_opacity)}),fillExtrusionPattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_lightpos:new a.aP(y,s.u_lightpos),u_lightintensity:new a.aM(y,s.u_lightintensity),u_lightcolor:new a.aP(y,s.u_lightcolor),u_vertical_gradient:new a.aM(y,s.u_vertical_gradient),u_height_factor:new a.aM(y,s.u_height_factor),u_image:new a.aL(y,s.u_image),u_texsize:new a.aQ(y,s.u_texsize),u_pixel_coord_upper:new a.aQ(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.aQ(y,s.u_pixel_coord_lower),u_scale:new a.aP(y,s.u_scale),u_fade:new a.aM(y,s.u_fade),u_opacity:new a.aM(y,s.u_opacity)}),fill:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix)}),fillPattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_image:new a.aL(y,s.u_image),u_texsize:new a.aQ(y,s.u_texsize),u_pixel_coord_upper:new a.aQ(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.aQ(y,s.u_pixel_coord_lower),u_scale:new a.aP(y,s.u_scale),u_fade:new a.aM(y,s.u_fade)}),fillOutline:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_world:new a.aQ(y,s.u_world)}),fillOutlinePattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_world:new a.aQ(y,s.u_world),u_image:new a.aL(y,s.u_image),u_texsize:new a.aQ(y,s.u_texsize),u_pixel_coord_upper:new a.aQ(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.aQ(y,s.u_pixel_coord_lower),u_scale:new a.aP(y,s.u_scale),u_fade:new a.aM(y,s.u_fade)}),circle:(y,s)=>({u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_scale_with_map:new a.aL(y,s.u_scale_with_map),u_pitch_with_map:new a.aL(y,s.u_pitch_with_map),u_extrude_scale:new a.aQ(y,s.u_extrude_scale),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_matrix:new a.aN(y,s.u_matrix)}),collisionBox:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_pixels_to_tile_units:new a.aM(y,s.u_pixels_to_tile_units),u_extrude_scale:new a.aQ(y,s.u_extrude_scale),u_overscale_factor:new a.aM(y,s.u_overscale_factor)}),collisionCircle:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_inv_matrix:new a.aN(y,s.u_inv_matrix),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_viewport_size:new a.aQ(y,s.u_viewport_size)}),debug:(y,s)=>({u_color:new a.aR(y,s.u_color),u_matrix:new a.aN(y,s.u_matrix),u_overlay:new a.aL(y,s.u_overlay),u_overlay_scale:new a.aM(y,s.u_overlay_scale)}),clippingMask:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix)}),heatmap:(y,s)=>({u_extrude_scale:new a.aM(y,s.u_extrude_scale),u_intensity:new a.aM(y,s.u_intensity),u_matrix:new a.aN(y,s.u_matrix)}),heatmapTexture:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_world:new a.aQ(y,s.u_world),u_image:new a.aL(y,s.u_image),u_color_ramp:new a.aL(y,s.u_color_ramp),u_opacity:new a.aM(y,s.u_opacity)}),hillshade:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_image:new a.aL(y,s.u_image),u_latrange:new a.aQ(y,s.u_latrange),u_light:new a.aQ(y,s.u_light),u_shadow:new a.aR(y,s.u_shadow),u_highlight:new a.aR(y,s.u_highlight),u_accent:new a.aR(y,s.u_accent)}),hillshadePrepare:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_image:new a.aL(y,s.u_image),u_dimension:new a.aQ(y,s.u_dimension),u_zoom:new a.aM(y,s.u_zoom),u_unpack:new a.aO(y,s.u_unpack)}),line:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_ratio:new a.aM(y,s.u_ratio),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_units_to_pixels:new a.aQ(y,s.u_units_to_pixels)}),lineGradient:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_ratio:new a.aM(y,s.u_ratio),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_units_to_pixels:new a.aQ(y,s.u_units_to_pixels),u_image:new a.aL(y,s.u_image),u_image_height:new a.aM(y,s.u_image_height)}),linePattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_texsize:new a.aQ(y,s.u_texsize),u_ratio:new a.aM(y,s.u_ratio),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_image:new a.aL(y,s.u_image),u_units_to_pixels:new a.aQ(y,s.u_units_to_pixels),u_scale:new a.aP(y,s.u_scale),u_fade:new a.aM(y,s.u_fade)}),lineSDF:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_ratio:new a.aM(y,s.u_ratio),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_units_to_pixels:new a.aQ(y,s.u_units_to_pixels),u_patternscale_a:new a.aQ(y,s.u_patternscale_a),u_patternscale_b:new a.aQ(y,s.u_patternscale_b),u_sdfgamma:new a.aM(y,s.u_sdfgamma),u_image:new a.aL(y,s.u_image),u_tex_y_a:new a.aM(y,s.u_tex_y_a),u_tex_y_b:new a.aM(y,s.u_tex_y_b),u_mix:new a.aM(y,s.u_mix)}),raster:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_tl_parent:new a.aQ(y,s.u_tl_parent),u_scale_parent:new a.aM(y,s.u_scale_parent),u_buffer_scale:new a.aM(y,s.u_buffer_scale),u_fade_t:new a.aM(y,s.u_fade_t),u_opacity:new a.aM(y,s.u_opacity),u_image0:new a.aL(y,s.u_image0),u_image1:new a.aL(y,s.u_image1),u_brightness_low:new a.aM(y,s.u_brightness_low),u_brightness_high:new a.aM(y,s.u_brightness_high),u_saturation_factor:new a.aM(y,s.u_saturation_factor),u_contrast_factor:new a.aM(y,s.u_contrast_factor),u_spin_weights:new a.aP(y,s.u_spin_weights)}),symbolIcon:(y,s)=>({u_is_size_zoom_constant:new a.aL(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aL(y,s.u_is_size_feature_constant),u_size_t:new a.aM(y,s.u_size_t),u_size:new a.aM(y,s.u_size),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_pitch:new a.aM(y,s.u_pitch),u_rotate_symbol:new a.aL(y,s.u_rotate_symbol),u_aspect_ratio:new a.aM(y,s.u_aspect_ratio),u_fade_change:new a.aM(y,s.u_fade_change),u_matrix:new a.aN(y,s.u_matrix),u_label_plane_matrix:new a.aN(y,s.u_label_plane_matrix),u_coord_matrix:new a.aN(y,s.u_coord_matrix),u_is_text:new a.aL(y,s.u_is_text),u_pitch_with_map:new a.aL(y,s.u_pitch_with_map),u_texsize:new a.aQ(y,s.u_texsize),u_texture:new a.aL(y,s.u_texture)}),symbolSDF:(y,s)=>({u_is_size_zoom_constant:new a.aL(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aL(y,s.u_is_size_feature_constant),u_size_t:new a.aM(y,s.u_size_t),u_size:new a.aM(y,s.u_size),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_pitch:new a.aM(y,s.u_pitch),u_rotate_symbol:new a.aL(y,s.u_rotate_symbol),u_aspect_ratio:new a.aM(y,s.u_aspect_ratio),u_fade_change:new a.aM(y,s.u_fade_change),u_matrix:new a.aN(y,s.u_matrix),u_label_plane_matrix:new a.aN(y,s.u_label_plane_matrix),u_coord_matrix:new a.aN(y,s.u_coord_matrix),u_is_text:new a.aL(y,s.u_is_text),u_pitch_with_map:new a.aL(y,s.u_pitch_with_map),u_texsize:new a.aQ(y,s.u_texsize),u_texture:new a.aL(y,s.u_texture),u_gamma_scale:new a.aM(y,s.u_gamma_scale),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_is_halo:new a.aL(y,s.u_is_halo)}),symbolTextAndIcon:(y,s)=>({u_is_size_zoom_constant:new a.aL(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new a.aL(y,s.u_is_size_feature_constant),u_size_t:new a.aM(y,s.u_size_t),u_size:new a.aM(y,s.u_size),u_camera_to_center_distance:new a.aM(y,s.u_camera_to_center_distance),u_pitch:new a.aM(y,s.u_pitch),u_rotate_symbol:new a.aL(y,s.u_rotate_symbol),u_aspect_ratio:new a.aM(y,s.u_aspect_ratio),u_fade_change:new a.aM(y,s.u_fade_change),u_matrix:new a.aN(y,s.u_matrix),u_label_plane_matrix:new a.aN(y,s.u_label_plane_matrix),u_coord_matrix:new a.aN(y,s.u_coord_matrix),u_is_text:new a.aL(y,s.u_is_text),u_pitch_with_map:new a.aL(y,s.u_pitch_with_map),u_texsize:new a.aQ(y,s.u_texsize),u_texsize_icon:new a.aQ(y,s.u_texsize_icon),u_texture:new a.aL(y,s.u_texture),u_texture_icon:new a.aL(y,s.u_texture_icon),u_gamma_scale:new a.aM(y,s.u_gamma_scale),u_device_pixel_ratio:new a.aM(y,s.u_device_pixel_ratio),u_is_halo:new a.aL(y,s.u_is_halo)}),background:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_opacity:new a.aM(y,s.u_opacity),u_color:new a.aR(y,s.u_color)}),backgroundPattern:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_opacity:new a.aM(y,s.u_opacity),u_image:new a.aL(y,s.u_image),u_pattern_tl_a:new a.aQ(y,s.u_pattern_tl_a),u_pattern_br_a:new a.aQ(y,s.u_pattern_br_a),u_pattern_tl_b:new a.aQ(y,s.u_pattern_tl_b),u_pattern_br_b:new a.aQ(y,s.u_pattern_br_b),u_texsize:new a.aQ(y,s.u_texsize),u_mix:new a.aM(y,s.u_mix),u_pattern_size_a:new a.aQ(y,s.u_pattern_size_a),u_pattern_size_b:new a.aQ(y,s.u_pattern_size_b),u_scale_a:new a.aM(y,s.u_scale_a),u_scale_b:new a.aM(y,s.u_scale_b),u_pixel_coord_upper:new a.aQ(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.aQ(y,s.u_pixel_coord_lower),u_tile_units_to_pixels:new a.aM(y,s.u_tile_units_to_pixels)}),terrain:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_texture:new a.aL(y,s.u_texture),u_ele_delta:new a.aM(y,s.u_ele_delta)}),terrainDepth:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_ele_delta:new a.aM(y,s.u_ele_delta)}),terrainCoords:(y,s)=>({u_matrix:new a.aN(y,s.u_matrix),u_texture:new a.aL(y,s.u_texture),u_terrain_coords_id:new a.aM(y,s.u_terrain_coords_id),u_ele_delta:new a.aM(y,s.u_ele_delta)})};class Wc{constructor(s,h,d){this.context=s;const g=s.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){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,s.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ku={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Xc{constructor(s,h,d,g){this.length=h.length,this.attributes=d,this.itemSize=h.bytesPerElement,this.dynamicDraw=g,this.context=s;const b=s.gl;this.buffer=b.createBuffer(),s.bindVertexBuffer.set(this.buffer),b.bufferData(b.ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?b.DYNAMIC_DRAW:b.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(s){if(s.length!==this.length)throw new Error(`Length of new data is ${s.length}, which doesn't match current length of ${this.length}`);const h=this.context.gl;this.bind(),h.bufferSubData(h.ARRAY_BUFFER,0,s.arrayBuffer)}enableAttributes(s,h){for(let d=0;d0){const oe=a.Z(),Ce=Xt;a.aU(oe,Vt.placementInvProjMatrix,y.transform.glCoordMatrix),a.aU(oe,oe,Vt.placementViewportMatrix),R.push({circleArray:Qt,circleOffset:W,transform:Ce,invTransform:oe,coord:It}),z+=Qt.length/4,W=z}ne&&k.draw(C,M.LINES,Cn.disabled,xi.disabled,y.colorModeForRenderPass(),di.disabled,gp(Xt,y.transform,Bt),y.style.map.terrain&&y.style.map.terrain.getTerrainData(It),h.id,ne.layoutVertexBuffer,ne.indexBuffer,ne.segments,null,y.transform.zoom,null,null,ne.collisionVertexBuffer)}if(!I||!R.length)return;const nt=y.useProgram("collisionCircle"),et=new a.aV;et.resize(4*z),et._trim();let at=0;for(const ct of R)for(let It=0;It=0&&(et[$.associatedIconIndex]={shiftedAnchor:bn,angle:he})}else J($.numGlyphs,W)}if(k){nt.clear();const at=y.icon.placedSymbolArray;for(let $=0;$y.style.map.terrain.getElevation(ne,xo,Bi):null,lr=h.layout.get("text-rotation-alignment")==="map";le(oe,ne.posMatrix,y,g,ci,Zs,$,k,lr,Fi)}const Pl=y.translatePosMatrix(ne.posMatrix,Qt,b,I),yu=St||g&&Vt||el?Ap:ci,Zr=y.translatePosMatrix(Zs,Qt,b,I,!0),Rr=he&&h.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let so;so=he?oe.iconsInText?Sl(Ue.kind,vn,Ot,$,y,Pl,yu,Zr,xn,ar):bp(Ue.kind,vn,Ot,$,y,Pl,yu,Zr,g,xn,!0):vp(Ue.kind,vn,Ot,$,y,Pl,yu,Zr,g,xn);const Al={program:Yn,buffers:Ce,uniformValues:so,atlasTexture:zi,atlasTextureIcon:Wi,atlasInterpolation:oi,atlasInterpolationIcon:Dr,isSDF:he,hasHalo:Rr};if(ct&&oe.canOverlap){It=!0;const Fi=Ce.segments.get();for(const lr of Fi)Xt.push({segments:new a.S([lr]),sortKey:lr.sortKey,state:Al,terrainData:hn})}else Xt.push({segments:Ce.segments,sortKey:0,state:Al,terrainData:hn})}It&&Xt.sort((ne,Qt)=>ne.sortKey-Qt.sortKey);for(const ne of Xt){const Qt=ne.state;if(W.activeTexture.set(nt.TEXTURE0),Qt.atlasTexture.bind(Qt.atlasInterpolation,nt.CLAMP_TO_EDGE),Qt.atlasTextureIcon&&(W.activeTexture.set(nt.TEXTURE1),Qt.atlasTextureIcon&&Qt.atlasTextureIcon.bind(Qt.atlasInterpolationIcon,nt.CLAMP_TO_EDGE)),Qt.isSDF){const oe=Qt.uniformValues;Qt.hasHalo&&(oe.u_is_halo=1,Np(Qt.buffers,ne.segments,h,y,Qt.program,Bt,R,z,oe,ne.terrainData)),oe.u_is_halo=0}Np(Qt.buffers,ne.segments,h,y,Qt.program,Bt,R,z,Qt.uniformValues,ne.terrainData)}}function Np(y,s,h,d,g,b,I,C,M,k){const R=d.context;g.draw(R,R.gl.TRIANGLES,b,I,C,di.disabled,M,k,h.id,y.layoutVertexBuffer,y.indexBuffer,s,h.paint,d.transform.zoom,y.programConfigurations.get(h.id),y.dynamicLayoutVertexBuffer,y.opacityVertexBuffer)}function Qu(y,s,h,d,g){if(!h||!d||!d.imageAtlas)return;const b=d.imageAtlas.patternPositions;let I=b[h.to.toString()],C=b[h.from.toString()];if(!I&&C&&(I=C),!C&&I&&(C=I),!I||!C){const M=g.getPaintProperty(s);I=b[M],C=b[M]}I&&C&&y.setConstantPatternPositions(I,C)}function $u(y,s,h,d,g,b,I){const C=y.context.gl,M="fill-pattern",k=h.paint.get(M),R=k&&k.constantOr(1),z=h.getCrossfadeParameters();let W,nt,et,at,$;I?(nt=R&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",W=C.LINES):(nt=R?"fillPattern":"fill",W=C.TRIANGLES);const St=k.constantOr(null);for(const Ot of d){const ct=s.getTile(Ot);if(R&&!ct.patternsLoaded())continue;const It=ct.getBucket(h);if(!It)continue;const Bt=It.programConfigurations.get(h.id),Vt=y.useProgram(nt,Bt),Xt=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Ot);R&&(y.context.activeTexture.set(C.TEXTURE0),ct.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),Bt.updatePaintBuffers(z)),Qu(Bt,M,St,ct,h);const ne=Xt?Ot:null,Qt=y.translatePosMatrix(ne?ne.posMatrix:Ot.posMatrix,ct,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));if(I){at=It.indexBuffer2,$=It.segments2;const oe=[C.drawingBufferWidth,C.drawingBufferHeight];et=nt==="fillOutlinePattern"&&R?Gc(Qt,y,z,ct,oe):Uc(Qt,oe)}else at=It.indexBuffer,$=It.segments,et=R?mp(Qt,y,z,ct):wd(Qt);Vt.draw(y.context,W,g,y.stencilModeForClipping(Ot),b,di.disabled,et,Xt,h.id,It.layoutVertexBuffer,at,$,h.paint,y.transform.zoom,Bt)}}function tc(y,s,h,d,g,b,I){const C=y.context,M=C.gl,k="fill-extrusion-pattern",R=h.paint.get(k),z=R.constantOr(1),W=h.getCrossfadeParameters(),nt=h.paint.get("fill-extrusion-opacity"),et=R.constantOr(null);for(const at of d){const $=s.getTile(at),St=$.getBucket(h);if(!St)continue;const Ot=y.style.map.terrain&&y.style.map.terrain.getTerrainData(at),ct=St.programConfigurations.get(h.id),It=y.useProgram(z?"fillExtrusionPattern":"fillExtrusion",ct);z&&(y.context.activeTexture.set(M.TEXTURE0),$.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),ct.updatePaintBuffers(W)),Qu(ct,k,et,$,h);const Bt=y.translatePosMatrix(at.posMatrix,$,h.paint.get("fill-extrusion-translate"),h.paint.get("fill-extrusion-translate-anchor")),Vt=h.paint.get("fill-extrusion-vertical-gradient"),Xt=z?Ya(Bt,y,Vt,nt,at,W,$):dp(Bt,y,Vt,nt);It.draw(C,C.gl.TRIANGLES,g,b,I,di.backCCW,Xt,Ot,h.id,St.layoutVertexBuffer,St.indexBuffer,St.segments,h.paint,y.transform.zoom,ct,y.style.map.terrain&&St.centroidVertexBuffer)}}function Zg(y,s,h,d,g,b,I){const C=y.context,M=C.gl,k=h.fbo;if(!k)return;const R=y.useProgram("hillshade"),z=y.style.map.terrain&&y.style.map.terrain.getTerrainData(s);C.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,k.colorAttachment.get()),R.draw(C,M.TRIANGLES,g,b,I,di.disabled,((W,nt,et,at)=>{const $=et.paint.get("hillshade-shadow-color"),St=et.paint.get("hillshade-highlight-color"),Ot=et.paint.get("hillshade-accent-color");let ct=et.paint.get("hillshade-illumination-direction")*(Math.PI/180);et.paint.get("hillshade-illumination-anchor")==="viewport"&&(ct-=W.transform.angle);const It=!W.options.moving;return{u_matrix:at?at.posMatrix:W.transform.calculatePosMatrix(nt.tileID.toUnwrapped(),It),u_image:0,u_latrange:_p(0,nt.tileID),u_light:[et.paint.get("hillshade-exaggeration"),ct],u_shadow:$,u_highlight:St,u_accent:Ot}})(y,h,d,z?s:null),z,d.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments)}function Dp(y,s,h,d,g,b){const I=y.context,C=I.gl,M=s.dem;if(M&&M.data){const k=M.dim,R=M.stride,z=M.getPixels();if(I.activeTexture.set(C.TEXTURE1),I.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||y.getTileTexture(R),s.demTexture){const nt=s.demTexture;nt.update(z,{premultiply:!1}),nt.bind(C.NEAREST,C.CLAMP_TO_EDGE)}else s.demTexture=new Mt(I,z,C.RGBA,{premultiply:!1}),s.demTexture.bind(C.NEAREST,C.CLAMP_TO_EDGE);I.activeTexture.set(C.TEXTURE0);let W=s.fbo;if(!W){const nt=new Mt(I,{width:k,height:k,data:null},C.RGBA);nt.bind(C.LINEAR,C.CLAMP_TO_EDGE),W=s.fbo=I.createFramebuffer(k,k,!0,!1),W.colorAttachment.set(nt.texture)}I.bindFramebuffer.set(W.framebuffer),I.viewport.set([0,0,k,k]),y.useProgram("hillshadePrepare").draw(I,C.TRIANGLES,d,g,b,di.disabled,((nt,et)=>{const at=et.stride,$=a.Z();return a.aS($,0,a.N,-a.N,0,0,1),a.$($,$,[0,-a.N,0]),{u_matrix:$,u_image:1,u_dimension:[at,at],u_zoom:nt.overscaledZ,u_unpack:et.getUnpackVector()}})(s.tileID,M),null,h.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function Wg(y,s,h,d,g,b){const I=d.paint.get("raster-fade-duration");if(!b&&I>0){const C=a.h.now(),M=(C-y.timeAdded)/I,k=s?(C-s.timeAdded)/I:-1,R=h.getSource(),z=g.coveringZoomLevel({tileSize:R.tileSize,roundZoom:R.roundZoom}),W=!s||Math.abs(s.tileID.overscaledZ-z)>Math.abs(y.tileID.overscaledZ-z),nt=W&&y.refreshedUponExpiration?1:a.ad(W?M:1-k,0,1);return y.refreshedUponExpiration&&M>=1&&(y.refreshedUponExpiration=!1),s?{opacity:1,mix:1-nt}:{opacity:nt,mix:0}}return{opacity:1,mix:0}}const Od=new a.aT(1,0,0,1),ih=new a.aT(0,1,0,1),Rp=new a.aT(0,0,1,1),zd=new a.aT(1,0,1,1),Fd=new a.aT(0,1,1,1);function ec(y,s,h,d){oh(y,0,s+h/2,y.transform.width,h,d)}function rh(y,s,h,d){oh(y,s-h/2,0,h,y.transform.height,d)}function oh(y,s,h,d,g,b){const I=y.context,C=I.gl;C.enable(C.SCISSOR_TEST),C.scissor(s*y.pixelRatio,h*y.pixelRatio,d*y.pixelRatio,g*y.pixelRatio),I.clear({color:b}),C.disable(C.SCISSOR_TEST)}function Bd(y,s,h){const d=y.context,g=d.gl,b=h.posMatrix,I=y.useProgram("debug"),C=Cn.disabled,M=xi.disabled,k=y.colorModeForRenderPass(),R="$debug",z=y.style.map.terrain&&y.style.map.terrain.getTerrainData(h);d.activeTexture.set(g.TEXTURE0);const W=s.getTileByID(h.key).latestRawTileData,nt=Math.floor((W&&W.byteLength||0)/1024),et=s.getTile(h).tileSize,at=512/Math.min(et,512)*(h.overscaledZ/y.transform.zoom)*.5;let $=h.canonical.toString();h.overscaledZ!==h.canonical.z&&($+=` => ${h.overscaledZ}`),function(St,Ot){St.initDebugOverlayCanvas();const ct=St.debugOverlayCanvas,It=St.context.gl,Bt=St.debugOverlayCanvas.getContext("2d");Bt.clearRect(0,0,ct.width,ct.height),Bt.shadowColor="white",Bt.shadowBlur=2,Bt.lineWidth=1.5,Bt.strokeStyle="white",Bt.textBaseline="top",Bt.font="bold 36px Open Sans, sans-serif",Bt.fillText(Ot,5,5),Bt.strokeText(Ot,5,5),St.debugOverlayTexture.update(ct),St.debugOverlayTexture.bind(It.LINEAR,It.CLAMP_TO_EDGE)}(y,`${$} ${nt}kB`),I.draw(d,g.TRIANGLES,C,M,bi.alphaBlended,di.disabled,Yu(b,a.aT.transparent,at),null,R,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),I.draw(d,g.LINE_STRIP,C,M,k,di.disabled,Yu(b,a.aT.red),z,R,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Pi(y,s,h){const d=y.context,g=d.gl,b=y.colorModeForRenderPass(),I=new Cn(g.LEQUAL,Cn.ReadWrite,y.depthRangeFor3D),C=y.useProgram("terrain"),M=s.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,y.width,y.height]);for(const k of h){const R=y.renderToTexture.getTexture(k),z=s.getTerrainData(k.tileID);d.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,R.texture);const W={u_matrix:y.transform.calculatePosMatrix(k.tileID.toUnwrapped()),u_texture:0,u_ele_delta:s.getMeshFrameDelta(y.transform.zoom)};C.draw(d,g.TRIANGLES,I,xi.disabled,b,di.backCCW,W,z,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}class Cl{constructor(s,h){this.context=new qg(s),this.transform=h,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:a.Z(),renderTime:0},this.setup(),this.numSublayers=Oi.maxUnderzooming+Oi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Fc}resize(s,h,d){if(this.width=Math.floor(s*d),this.height=Math.floor(h*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const g of this.style._order)this.style._layers[g].resize()}setup(){const s=this.context,h=new a.a_;h.emplaceBack(0,0),h.emplaceBack(a.N,0),h.emplaceBack(0,a.N),h.emplaceBack(a.N,a.N),this.tileExtentBuffer=s.createVertexBuffer(h,Bc.members),this.tileExtentSegments=a.S.simpleSegment(0,0,4,2);const d=new a.a_;d.emplaceBack(0,0),d.emplaceBack(a.N,0),d.emplaceBack(0,a.N),d.emplaceBack(a.N,a.N),this.debugBuffer=s.createVertexBuffer(d,Bc.members),this.debugSegments=a.S.simpleSegment(0,0,4,5);const g=new a.V;g.emplaceBack(0,0,0,0),g.emplaceBack(a.N,0,a.N,0),g.emplaceBack(0,a.N,0,a.N),g.emplaceBack(a.N,a.N,a.N,a.N),this.rasterBoundsBuffer=s.createVertexBuffer(g,yn.members),this.rasterBoundsSegments=a.S.simpleSegment(0,0,4,2);const b=new a.a_;b.emplaceBack(0,0),b.emplaceBack(1,0),b.emplaceBack(0,1),b.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(b,Bc.members),this.viewportSegments=a.S.simpleSegment(0,0,4,2);const I=new a.a$;I.emplaceBack(0),I.emplaceBack(1),I.emplaceBack(3),I.emplaceBack(2),I.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(I);const C=new a.b0;C.emplaceBack(0,1,2),C.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(C);const M=this.context.gl;this.stencilClearMode=new xi({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO)}clearStencil(){const s=this.context,h=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=a.Z();a.aS(d,0,this.width,this.height,0,0,1),a.a0(d,d,[h.drawingBufferWidth,h.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,h.TRIANGLES,Cn.disabled,this.stencilClearMode,bi.disabled,di.disabled,Sd(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,h){if(this.currentStencilSource===s.source||!s.isTileClipped()||!h||!h.length)return;this.currentStencilSource=s.source;const d=this.context,g=d.gl;this.nextStencilID+h.length>256&&this.clearStencil(),d.setColorMode(bi.disabled),d.setDepthMode(Cn.disabled);const b=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const I of h){const C=this._tileClippingMaskIDs[I.key]=this.nextStencilID++,M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(I);b.draw(d,g.TRIANGLES,Cn.disabled,new xi({func:g.ALWAYS,mask:0},C,255,g.KEEP,g.KEEP,g.REPLACE),bi.disabled,di.disabled,Sd(I.posMatrix),M,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,h=this.context.gl;return new xi({func:h.NOTEQUAL,mask:255},s,255,h.KEEP,h.KEEP,h.REPLACE)}stencilModeForClipping(s){const h=this.context.gl;return new xi({func:h.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,h.KEEP,h.KEEP,h.REPLACE)}stencilConfigForOverlap(s){const h=this.context.gl,d=s.sort((I,C)=>C.overscaledZ-I.overscaledZ),g=d[d.length-1].overscaledZ,b=d[0].overscaledZ-g+1;if(b>1){this.currentStencilSource=void 0,this.nextStencilID+b>256&&this.clearStencil();const I={};for(let C=0;C=0;this.currentLayer--){const M=this.style._layers[d[this.currentLayer]],k=g[M.source],R=b[M.source];this._renderTileClippingMasks(M,R),this.renderLayer(this,k,M,R)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer$.source&&!$.isHidden(R)?[k.sourceCaches[$.source]]:[]),nt=W.filter($=>$.getSource().type==="vector"),et=W.filter($=>$.getSource().type!=="vector"),at=$=>{(!z||z.getSource().maxzoom<$.getSource().maxzoom)&&(z=$)};return nt.forEach($=>at($)),z||et.forEach($=>at($)),z}(this.style,this.transform.zoom);M&&function(k,R,z){for(let W=0;Wnt.style.map.terrain.getElevation(Vt,Ue,Pe):null)}}}(M,b,C,I,C.layout.get("text-rotation-alignment"),C.layout.get("text-pitch-alignment"),k),C.paint.get("icon-opacity").constantOr(1)!==0&&nh(b,I,C,M,!1,C.paint.get("icon-translate"),C.paint.get("icon-translate-anchor"),C.layout.get("icon-rotation-alignment"),C.layout.get("icon-pitch-alignment"),C.layout.get("icon-keep-upright"),R,z),C.paint.get("text-opacity").constantOr(1)!==0&&nh(b,I,C,M,!0,C.paint.get("text-translate"),C.paint.get("text-translate-anchor"),C.layout.get("text-rotation-alignment"),C.layout.get("text-pitch-alignment"),C.layout.get("text-keep-upright"),R,z),I.map.showCollisionBoxes&&(Rd(b,I,C,M,C.paint.get("text-translate"),C.paint.get("text-translate-anchor"),!0),Rd(b,I,C,M,C.paint.get("icon-translate"),C.paint.get("icon-translate-anchor"),!1))})(s,h,d,g,this.style.placement.variableOffsets);break;case"circle":(function(b,I,C,M){if(b.renderPass!=="translucent")return;const k=C.paint.get("circle-opacity"),R=C.paint.get("circle-stroke-width"),z=C.paint.get("circle-stroke-opacity"),W=!C.layout.get("circle-sort-key").isConstant();if(k.constantOr(1)===0&&(R.constantOr(1)===0||z.constantOr(1)===0))return;const nt=b.context,et=nt.gl,at=b.depthModeForSublayer(0,Cn.ReadOnly),$=xi.disabled,St=b.colorModeForRenderPass(),Ot=[];for(let ct=0;ctct.sortKey-It.sortKey);for(const ct of Ot){const{programConfiguration:It,program:Bt,layoutVertexBuffer:Vt,indexBuffer:Xt,uniformValues:ne,terrainData:Qt}=ct.state;Bt.draw(nt,et.TRIANGLES,at,$,St,di.disabled,ne,Qt,C.id,Vt,Xt,ct.segments,C.paint,b.transform.zoom,It)}})(s,h,d,g);break;case"heatmap":(function(b,I,C,M){if(C.paint.get("heatmap-opacity")!==0)if(b.renderPass==="offscreen"){const k=b.context,R=k.gl,z=xi.disabled,W=new bi([R.ONE,R.ONE],a.aT.transparent,[!0,!0,!0,!0]);(function(nt,et,at){const $=nt.gl;nt.activeTexture.set($.TEXTURE1),nt.viewport.set([0,0,et.width/4,et.height/4]);let St=at.heatmapFbo;if(St)$.bindTexture($.TEXTURE_2D,St.colorAttachment.get()),nt.bindFramebuffer.set(St.framebuffer);else{const Ot=$.createTexture();$.bindTexture($.TEXTURE_2D,Ot),$.texParameteri($.TEXTURE_2D,$.TEXTURE_WRAP_S,$.CLAMP_TO_EDGE),$.texParameteri($.TEXTURE_2D,$.TEXTURE_WRAP_T,$.CLAMP_TO_EDGE),$.texParameteri($.TEXTURE_2D,$.TEXTURE_MIN_FILTER,$.LINEAR),$.texParameteri($.TEXTURE_2D,$.TEXTURE_MAG_FILTER,$.LINEAR),St=at.heatmapFbo=nt.createFramebuffer(et.width/4,et.height/4,!1,!1),function(ct,It,Bt,Vt){var Xt,ne;const Qt=ct.gl,oe=(Xt=ct.HALF_FLOAT)!==null&&Xt!==void 0?Xt:Qt.UNSIGNED_BYTE,Ce=(ne=ct.RGBA16F)!==null&&ne!==void 0?ne:Qt.RGBA;Qt.texImage2D(Qt.TEXTURE_2D,0,Ce,It.width/4,It.height/4,0,Qt.RGBA,oe,null),Vt.colorAttachment.set(Bt)}(nt,et,Ot,St)}})(k,b,C),k.clear({color:a.aT.transparent});for(let nt=0;nt{const ct=a.Z();a.aS(ct,0,at.width,at.height,0,0,1);const It=at.context.gl;return{u_matrix:ct,u_world:[It.drawingBufferWidth,It.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:$.paint.get("heatmap-opacity")}})(k,R),null,R.id,k.viewportBuffer,k.quadTriangleIndexBuffer,k.viewportSegments,R.paint,k.transform.zoom)}(b,C))})(s,h,d,g);break;case"line":(function(b,I,C,M){if(b.renderPass!=="translucent")return;const k=C.paint.get("line-opacity"),R=C.paint.get("line-width");if(k.constantOr(1)===0||R.constantOr(1)===0)return;const z=b.depthModeForSublayer(0,Cn.ReadOnly),W=b.colorModeForRenderPass(),nt=C.paint.get("line-dasharray"),et=C.paint.get("line-pattern"),at=et.constantOr(1),$=C.paint.get("line-gradient"),St=C.getCrossfadeParameters(),Ot=at?"linePattern":nt?"lineSDF":$?"lineGradient":"line",ct=b.context,It=ct.gl;let Bt=!0;for(const Vt of M){const Xt=I.getTile(Vt);if(at&&!Xt.patternsLoaded())continue;const ne=Xt.getBucket(C);if(!ne)continue;const Qt=ne.programConfigurations.get(C.id),oe=b.context.program.get(),Ce=b.useProgram(Ot,Qt),bn=Bt||Ce.program!==oe,he=b.style.map.terrain&&b.style.map.terrain.getTerrainData(Vt),Ue=et.constantOr(null);if(Ue&&Xt.imageAtlas){const vn=Xt.imageAtlas,hn=vn.patternPositions[Ue.to.toString()],xn=vn.patternPositions[Ue.from.toString()];hn&&xn&&Qt.setConstantPatternPositions(hn,xn)}const Pe=he?Vt:null,Yn=at?zg(b,Xt,C,St,Pe):nt?Id(b,Xt,C,nt,St,Pe):$?Ed(b,Xt,C,ne.lineClipsArray.length,Pe):yp(b,Xt,C,Pe);if(at)ct.activeTexture.set(It.TEXTURE0),Xt.imageAtlasTexture.bind(It.LINEAR,It.CLAMP_TO_EDGE),Qt.updatePaintBuffers(St);else if(nt&&(bn||b.lineAtlas.dirty))ct.activeTexture.set(It.TEXTURE0),b.lineAtlas.bind(ct);else if($){const vn=ne.gradients[C.id];let hn=vn.texture;if(C.gradientVersion!==vn.version){let xn=256;if(C.stepInterpolant){const zi=I.getSource().maxzoom,oi=Vt.canonical.z===zi?Math.ceil(1<0?h.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;const h=this.imageManager.getPattern(s.from.toString()),d=this.imageManager.getPattern(s.to.toString());return!h||!d}useProgram(s,h){this.cache=this.cache||{};const d=s+(h?h.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new Vc(this.context,vi[s],h,Zc[s],this._showOverdrawInspector,this.style.map.terrain)),this.cache[d]}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 s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Mt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:s,drawingBufferHeight:h}=this.context.gl;return this.width!==s||this.height!==h}}class vo{constructor(s,h){this.points=s,this.planes=h}static fromInvProjectionMatrix(s,h,d){const g=Math.pow(2,d),b=[[-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(C=>{const M=1/(C=a.ag([],C,s))[3]/h*g;return a.b3(C,C,[M,M,1/C[3],M])}),I=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(C=>{const M=function(W,nt){var et=nt[0],at=nt[1],$=nt[2],St=et*et+at*at+$*$;return St>0&&(St=1/Math.sqrt(St)),W[0]=nt[0]*St,W[1]=nt[1]*St,W[2]=nt[2]*St,W}([],function(W,nt,et){var at=nt[0],$=nt[1],St=nt[2],Ot=et[0],ct=et[1],It=et[2];return W[0]=$*It-St*ct,W[1]=St*Ot-at*It,W[2]=at*ct-$*Ot,W}([],ht([],b[C[0]],b[C[1]]),ht([],b[C[2]],b[C[1]]))),k=-((R=M)[0]*(z=b[C[1]])[0]+R[1]*z[1]+R[2]*z[2]);var R,z;return M.concat(k)});return new vo(b,I)}}class pu{constructor(s,h){this.min=s,this.max=h,this.center=function(d,g,b){return d[0]=.5*g[0],d[1]=.5*g[1],d[2]=.5*g[2],d}([],function(d,g,b){return d[0]=g[0]+b[0],d[1]=g[1]+b[1],d[2]=g[2]+b[2],d}([],this.min,this.max))}quadrant(s){const h=[s%2==0,s<2],d=Q(this.min),g=Q(this.max);for(let b=0;b=0&&I++;if(I===0)return 0;I!==h.length&&(d=!1)}if(d)return 2;for(let g=0;g<3;g++){let b=Number.MAX_VALUE,I=-Number.MAX_VALUE;for(let C=0;Cthis.max[g]-this.min[g])return 0}return 1}}class nc{constructor(s=0,h=0,d=0,g=0){if(isNaN(s)||s<0||isNaN(h)||h<0||isNaN(d)||d<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=h,this.left=d,this.right=g}interpolate(s,h,d){return h.top!=null&&s.top!=null&&(this.top=a.B.number(s.top,h.top,d)),h.bottom!=null&&s.bottom!=null&&(this.bottom=a.B.number(s.bottom,h.bottom,d)),h.left!=null&&s.left!=null&&(this.left=a.B.number(s.left,h.left,d)),h.right!=null&&s.right!=null&&(this.right=a.B.number(s.right,h.right,d)),this}getCenter(s,h){const d=a.ad((this.left+s-this.right)/2,0,s),g=a.ad((this.top+h-this.bottom)/2,0,h);return new a.P(d,g)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new nc(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class sh{constructor(s,h,d,g,b){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=b===void 0||!!b,this._minZoom=s||0,this._maxZoom=h||22,this._minPitch=d??0,this._maxPitch=g??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.L(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new nc,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const s=new sh(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this._minEleveationForCurrentTile=s._minEleveationForCurrentTile,this.zoom=s.zoom,this.angle=s.angle,this._fov=s._fov,this._pitch=s._pitch,this._unmodified=s._unmodified,this._edgeInsets=s._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}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(s){const h=-a.b5(s,-180,180)*Math.PI/180;this.angle!==h&&(this._unmodified=!1,this.angle=h,this._calcMatrices(),this.rotationMatrix=function(){var d=new a.A(4);return a.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,g,b){var I=g[0],C=g[1],M=g[2],k=g[3],R=Math.sin(b),z=Math.cos(b);d[0]=I*z+M*R,d[1]=C*z+k*R,d[2]=I*-R+M*z,d[3]=C*-R+k*z}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const h=a.ad(s,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(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=s/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(s){const h=Math.min(Math.max(s,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(s){s.lat===this._center.lat&&s.lng===this._center.lng||(this._unmodified=!1,this._center=s,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(s){s!==this._elevation&&(this._elevation=s,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(s){this._edgeInsets.equals(s)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,s,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(s){return this._edgeInsets.equals(s)}interpolatePadding(s,h,d){this._unmodified=!1,this._edgeInsets.interpolate(s,h,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const h=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,h)}getVisibleUnwrappedCoordinates(s){const h=[new a.b6(0,s)];if(this._renderWorldCopies){const d=this.pointCoordinate(new a.P(0,0)),g=this.pointCoordinate(new a.P(this.width,0)),b=this.pointCoordinate(new a.P(this.width,this.height)),I=this.pointCoordinate(new a.P(0,this.height)),C=Math.floor(Math.min(d.x,g.x,b.x,I.x)),M=Math.floor(Math.max(d.x,g.x,b.x,I.x)),k=1;for(let R=C-k;R<=M+k;R++)R!==0&&h.push(new a.b6(R,s))}return h}coveringTiles(s){var h,d;let g=this.coveringZoomLevel(s);const b=g;if(s.minzoom!==void 0&&gs.maxzoom&&(g=s.maxzoom);const I=this.pointCoordinate(this.getCameraPoint()),C=a.U.fromLngLat(this.center),M=Math.pow(2,g),k=[M*I.x,M*I.y,0],R=[M*C.x,M*C.y,0],z=vo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,g);let W=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(W=g);const nt=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,et=ct=>({aabb:new pu([ct*M,0,0],[(ct+1)*M,M,0]),zoom:0,x:0,y:0,wrap:ct,fullyVisible:!1}),at=[],$=[],St=g,Ot=s.reparseOverscaled?b:g;if(this._renderWorldCopies)for(let ct=1;ct<=3;ct++)at.push(et(-ct)),at.push(et(ct));for(at.push(et(0));at.length>0;){const ct=at.pop(),It=ct.x,Bt=ct.y;let Vt=ct.fullyVisible;if(!Vt){const Ce=ct.aabb.intersects(z);if(Ce===0)continue;Vt=Ce===2}const Xt=s.terrain?k:R,ne=ct.aabb.distanceX(Xt),Qt=ct.aabb.distanceY(Xt),oe=Math.max(Math.abs(ne),Math.abs(Qt));if(ct.zoom===St||oe>nt+(1<=W){const Ce=St-ct.zoom,bn=k[0]-.5-(It<>1),Ue=ct.zoom+1;let Pe=ct.aabb.quadrant(Ce);if(s.terrain){const Yn=new a.O(Ue,ct.wrap,Ue,bn,he),vn=s.terrain.getMinMaxElevation(Yn),hn=(h=vn.minElevation)!==null&&h!==void 0?h:this.elevation,xn=(d=vn.maxElevation)!==null&&d!==void 0?d:this.elevation;Pe=new pu([Pe.min[0],Pe.min[1],hn],[Pe.max[0],Pe.max[1],xn])}at.push({aabb:Pe,zoom:Ue,x:bn,y:he,wrap:ct.wrap,fullyVisible:Vt})}}return $.sort((ct,It)=>ct.distanceSq-It.distanceSq).map(ct=>ct.tileID)}resize(s,h){this.width=s,this.height=h,this.pixelsToGLUnits=[2/s,-2/h],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const h=a.ad(s.lat,-this.maxValidLatitude,this.maxValidLatitude);return new a.P(a.G(s.lng)*this.worldSize,a.H(h)*this.worldSize)}unproject(s){return new a.U(s.x/this.worldSize,s.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(s){const h=this.pointLocation(this.centerPoint,s),d=s.getElevationForLngLatZoom(h,this.tileZoom);if(!(this.elevation-d))return;const g=this.getCameraPosition(),b=a.U.fromLngLat(g.lngLat,g.altitude),I=a.U.fromLngLat(h,d),C=b.x-I.x,M=b.y-I.y,k=b.z-I.z,R=Math.sqrt(C*C+M*M+k*k),z=this.scaleZoom(this.cameraToCenterDistance/R/this.tileSize);this._elevation=d,this._center=h,this.zoom=z}setLocationAtPoint(s,h){const d=this.pointCoordinate(h),g=this.pointCoordinate(this.centerPoint),b=this.locationCoordinate(s),I=new a.U(b.x-(d.x-g.x),b.y-(d.y-g.y));this.center=this.coordinateLocation(I),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,h){return h?this.coordinatePoint(this.locationCoordinate(s),h.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,h){return this.coordinateLocation(this.pointCoordinate(s,h))}locationCoordinate(s){return a.U.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,h){if(h){const W=h.pointCoordinate(s);if(W!=null)return W}const d=[s.x,s.y,0,1],g=[s.x,s.y,1,1];a.ag(d,d,this.pixelMatrixInverse),a.ag(g,g,this.pixelMatrixInverse);const b=d[3],I=g[3],C=d[1]/b,M=g[1]/I,k=d[2]/b,R=g[2]/I,z=k===R?0:(0-k)/(R-k);return new a.U(a.B.number(d[0]/b,g[0]/I,z)/this.worldSize,a.B.number(C,M,z)/this.worldSize)}coordinatePoint(s,h=0,d=this.pixelMatrix){const g=[s.x*this.worldSize,s.y*this.worldSize,h,1];return a.ag(g,g,d),new a.P(g[0]/g[3],g[1]/g[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new Be().extend(this.pointLocation(new a.P(0,s))).extend(this.pointLocation(new a.P(this.width,s))).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 Be([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(s){s?(this.lngRange=[s.getWest(),s.getEast()],this.latRange=[s.getSouth(),s.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(s,h=!1){const d=s.key,g=h?this._alignedPosMatrixCache:this._posMatrixCache;if(g[d])return g[d];const b=s.canonical,I=this.worldSize/this.zoomScale(b.z),C=b.x+Math.pow(2,b.z)*s.wrap,M=a.ao(new Float64Array(16));return a.$(M,M,[C*I,b.y*I,0]),a.a0(M,M,[I/a.N,I/a.N,1]),a.a1(M,h?this.alignedProjMatrix:this.projMatrix,M),g[d]=new Float32Array(M),g[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let s,h,d,g,b=-90,I=90,C=-180,M=180;const k=this.size,R=this._unmodified;if(this.latRange){const nt=this.latRange;b=a.H(nt[1])*this.worldSize,I=a.H(nt[0])*this.worldSize,s=I-bI&&(g=I-et)}if(this.lngRange){const nt=(C+M)/2,et=a.b5(z.x,nt-this.worldSize/2,nt+this.worldSize/2),at=k.x/2;et-atM&&(d=M-at)}d===void 0&&g===void 0||(this.center=this.unproject(new a.P(d!==void 0?d:z.x,g!==void 0?g:z.y)).wrap()),this._unmodified=R,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,h=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=a.b7(1,this.center.lat)*this.worldSize;let g=a.ao(new Float64Array(16));a.a0(g,g,[this.width/2,-this.height/2,1]),a.$(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=a.ao(new Float64Array(16)),a.a0(g,g,[1,-1,1]),a.$(g,g,[-1,-1,0]),a.a0(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;const b=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),I=Math.min(this.elevation,this._minEleveationForCurrentTile),C=b-I*this._pixelPerMeter/Math.cos(this._pitch),M=I<0?C:b,k=Math.PI/2+this._pitch,R=this._fov*(.5+s.y/this.height),z=Math.sin(R)*M/Math.sin(a.ad(Math.PI-k-R,.01,Math.PI-.01)),W=this.getHorizon(),nt=2*Math.atan(W/this.cameraToCenterDistance)*(.5+s.y/(2*W)),et=Math.sin(nt)*M/Math.sin(a.ad(Math.PI-k-nt,.01,Math.PI-.01)),at=Math.min(z,et),$=1.01*(Math.cos(Math.PI/2-this._pitch)*at+M),St=this.height/50;g=new Float64Array(16),a.b8(g,this._fov,this.width/this.height,St,$),g[8]=2*-s.x/this.width,g[9]=2*s.y/this.height,a.a0(g,g,[1,-1,1]),a.$(g,g,[0,0,-this.cameraToCenterDistance]),a.b9(g,g,this._pitch),a.ae(g,g,this.angle),a.$(g,g,[-h,-d,0]),this.mercatorMatrix=a.a0([],g,[this.worldSize,this.worldSize,this.worldSize]),a.a0(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=a.a1(new Float64Array(16),this.labelPlaneMatrix,g),a.$(g,g,[0,0,-this.elevation]),this.projMatrix=g,this.invProjMatrix=a.as([],g),this.pixelMatrix3D=a.a1(new Float64Array(16),this.labelPlaneMatrix,g);const Ot=this.width%2/2,ct=this.height%2/2,It=Math.cos(this.angle),Bt=Math.sin(this.angle),Vt=h-Math.round(h)+It*Ot+Bt*ct,Xt=d-Math.round(d)+It*ct+Bt*Ot,ne=new Float64Array(g);if(a.$(ne,ne,[Vt>.5?Vt-1:Vt,Xt>.5?Xt-1:Xt,0]),this.alignedProjMatrix=ne,g=a.as(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");this.pixelMatrixInverse=g,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new a.P(0,0)),h=[s.x*this.worldSize,s.y*this.worldSize,0,1];return a.ag(h,h,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.P(0,s))}getCameraQueryGeometry(s){const h=this.getCameraPoint();if(s.length===1)return[s[0],h];{let d=h.x,g=h.y,b=h.x,I=h.y;for(const C of s)d=Math.min(d,C.x),g=Math.min(g,C.y),b=Math.max(b,C.x),I=Math.max(I,C.y);return[new a.P(d,g),new a.P(b,g),new a.P(b,I),new a.P(d,I),new a.P(d,g)]}}}function Tl(y,s){let h,d=!1,g=null,b=null;const I=()=>{g=null,d&&(y.apply(b,h),g=setTimeout(I,s),d=!1)};return(...C)=>(d=!0,b=this,h=C,g||I(),g)}class ic{constructor(s){this._getCurrentHash=()=>{const h=window.location.hash.replace("#","");if(this._hashName){let d;return h.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(d=g)}),(d&&d[1]||"").split("/")}return h.split("/")},this._onHashChange=()=>{const h=this._getCurrentHash();if(h.length>=3&&!h.some(d=>isNaN(d))){const d=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:d,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=Tl(this._updateHashUnthrottled,300),this._hashName=s&&encodeURIComponent(s)}addTo(s){return this._map=s,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(s){const h=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,g=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),b=Math.pow(10,g),I=Math.round(h.lng*b)/b,C=Math.round(h.lat*b)/b,M=this._map.getBearing(),k=this._map.getPitch();let R="";if(R+=s?`/${I}/${C}/${d}`:`${d}/${C}/${I}`,(M||k)&&(R+="/"+Math.round(10*M)/10),k&&(R+=`/${Math.round(k)}`),this._hashName){const z=this._hashName;let W=!1;const nt=window.location.hash.slice(1).split("&").map(et=>{const at=et.split("=")[0];return at===z?(W=!0,`${at}=${R}`):et}).filter(et=>et);return W||nt.push(`${z}=${R}`),`#${nt.join("&")}`}return`#${R}`}}const fu={linearity:.3,easing:a.ba(0,0,.3,1)},Vd=a.e({deceleration:2500,maxSpeed:1400},fu),Ud=a.e({deceleration:20,maxSpeed:1400},fu),Gd=a.e({deceleration:1e3,maxSpeed:360},fu),jd=a.e({deceleration:1e3,maxSpeed:90},fu);class qd{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.h.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,h=a.h.now();for(;s.length>0&&h-s[0].time>160;)s.shift()}_onMoveEnd(s){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:b}of this._inertiaBuffer)h.zoom+=b.zoomDelta||0,h.bearing+=b.bearingDelta||0,h.pitch+=b.pitchDelta||0,b.panDelta&&h.pan._add(b.panDelta),b.around&&(h.around=b.around),b.pinchAround&&(h.pinchAround=b.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(h.pan.mag()){const b=rc(h.pan.mag(),d,a.e({},Vd,s||{}));g.offset=h.pan.mult(b.amount/h.pan.mag()),g.center=this._map.transform.center,qs(g,b)}if(h.zoom){const b=rc(h.zoom,d,Ud);g.zoom=this._map.transform.zoom+b.amount,qs(g,b)}if(h.bearing){const b=rc(h.bearing,d,Gd);g.bearing=this._map.transform.bearing+a.ad(b.amount,-179,179),qs(g,b)}if(h.pitch){const b=rc(h.pitch,d,jd);g.pitch=this._map.transform.pitch+b.amount,qs(g,b)}if(g.zoom||g.bearing){const b=h.pinchAround===void 0?h.around:h.pinchAround;g.around=b?this._map.unproject(b):this._map.getCenter()}return this.clear(),a.e(g,{noMoveStart:!0})}}function qs(y,s){(!y.duration||y.durationh.unproject(M)),C=b.reduce((M,k,R,z)=>M.add(k.div(z.length)),new a.P(0,0));super(s,{points:b,point:C,lngLats:I,lngLat:h.unproject(C),originalEvent:d}),this._defaultPrevented=!1}}class Zd extends a.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,h,d){super(s,{originalEvent:d}),this._defaultPrevented=!1}}class Wd{constructor(s,h){this._map=s,this._clickTolerance=h.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new Zd(s.type,this._map,s))}mousedown(s,h){return this._mousedownPos=h,this._firePreventable(new Oo(s.type,this._map,s))}mouseup(s){this._map.fire(new Oo(s.type,this._map,s))}click(s,h){this._mousedownPos&&this._mousedownPos.dist(h)>=this._clickTolerance||this._map.fire(new Oo(s.type,this._map,s))}dblclick(s){return this._firePreventable(new Oo(s.type,this._map,s))}mouseover(s){this._map.fire(new Oo(s.type,this._map,s))}mouseout(s){this._map.fire(new Oo(s.type,this._map,s))}touchstart(s){return this._firePreventable(new oc(s.type,this._map,s))}touchmove(s){this._map.fire(new oc(s.type,this._map,s))}touchend(s){this._map.fire(new oc(s.type,this._map,s))}touchcancel(s){this._map.fire(new oc(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Xd{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new Oo(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Oo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new Oo(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ea{constructor(s){this._map=s}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(s){return this.transform.pointLocation(a.P.convert(s),this._map.terrain)}}class Hd{constructor(s,h){this._map=s,this._tr=new Ea(s),this._el=s.getCanvasContainer(),this._container=s.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(s,h){this.isEnabled()&&s.shiftKey&&s.button===0&&(x.disableDrag(),this._startPos=this._lastPos=h,this._active=!0)}mousemoveWindow(s,h){if(!this._active)return;const d=h;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)b.fitScreenCoordinates(d,g,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(x.remove(this._box),this._box=null),x.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,h){return this._map.fire(new a.k(s,{originalEvent:h}))}}function as(y,s){if(y.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${y.length}, points ${s.length}`);const h={};for(let d=0;dthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),d.length===this.numTouches&&(this.centroid=function(g){const b=new a.P(0,0);for(const I of g)b._add(I);return b.div(g.length)}(h),this.touches=as(d,h)))}touchmove(s,h,d){if(this.aborted||!this.centroid)return;const g=as(d,h);for(const b in this.touches){const I=g[b];(!I||I.dist(this.touches[b])>30)&&(this.aborted=!0)}}touchend(s,h,d){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class ah{constructor(s){this.singleTap=new Ia(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,h,d){this.singleTap.touchstart(s,h,d)}touchmove(s,h,d){this.singleTap.touchmove(s,h,d)}touchend(s,h,d){const g=this.singleTap.touchend(s,h,d);if(g){const b=s.timeStamp-this.lastTime<500,I=!this.lastTap||this.lastTap.dist(g)<30;if(b&&I||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class Ca{constructor(s){this._tr=new Ea(s),this._zoomIn=new ah({numTouches:1,numTaps:2}),this._zoomOut=new ah({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,h,d){this._zoomIn.touchstart(s,h,d),this._zoomOut.touchstart(s,h,d)}touchmove(s,h,d){this._zoomIn.touchmove(s,h,d),this._zoomOut.touchmove(s,h,d)}touchend(s,h,d){const g=this._zoomIn.touchend(s,h,d),b=this._zoomOut.touchend(s,h,d),I=this._tr;return g?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:I.zoom+1,around:I.unproject(g)},{originalEvent:s})}):b?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:I.zoom-1,around:I.unproject(b)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ta{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){const h=this._moveFunction(...s);if(h.bearingDelta||h.pitchDelta||h.around||h.panDelta)return this._active=!0,h}dragStart(s,h){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=h.length?h[0]:h,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,h){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const g=h.length?h[0]:h;return!this._moved&&g.dist(d){y.mousedown=y.dragStart,y.mousemoveWindow=y.dragMove,y.mouseup=y.dragEnd,y.contextmenu=function(s){s.preventDefault()}},du=({enable:y,clickTolerance:s,bearingDegreesPerPixelMoved:h=.8})=>{const d=new Op({checkCorrectEvent:g=>x.mouseButton(g)===0&&g.ctrlKey||x.mouseButton(g)===2});return new Ta({clickTolerance:s,move:(g,b)=>({bearingDelta:(b.x-g.x)*h}),moveStateManager:d,enable:y,assignEvents:lh})},La=({enable:y,clickTolerance:s,pitchDegreesPerPixelMoved:h=-.5})=>{const d=new Op({checkCorrectEvent:g=>x.mouseButton(g)===0&&g.ctrlKey||x.mouseButton(g)===2});return new Ta({clickTolerance:s,move:(g,b)=>({pitchDelta:(b.y-g.y)*h}),moveStateManager:d,enable:y,assignEvents:lh})};class we{constructor(s,h){this._minTouches=s.cooperativeGestures?2:1,this._clickTolerance=s.clickTolerance||1,this._map=h,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new a.P(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(s,h,d){return this._calculateTransform(s,h,d)}touchmove(s,h,d){if(this._map._cooperativeGestures&&(this._minTouches===2&&d.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(s,!1,d.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(d.length0&&(this._active=!0);const g=as(d,h),b=new a.P(0,0),I=new a.P(0,0);let C=0;for(const k in g){const R=g[k],z=this._touches[k];z&&(b._add(R),I._add(R.sub(z)),C++,g[k]=R)}if(this._touches=g,CMath.abs(y.x)}class Hg extends uh{constructor(s){super(),this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,h,d){super.touchstart(s,h,d),this._currentTouchCount=d.length}_start(s){this._lastPoints=s,Fp(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,h,d){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const g=s[0].sub(this._lastPoints[0]),b=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(g,b,d.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(g.y+b.y)/2*-.5}):void 0}gestureBeginsVertically(s,h,d){if(this._valid!==void 0)return this._valid;const g=s.mag()>=2,b=h.mag()>=2;if(!g&&!b)return;if(!g||!b)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const I=s.y>0==h.y>0;return Fp(s)&&Fp(h)&&I}}const Bp={panStep:100,bearingStep:15,pitchStep:10};class Jd{constructor(s){this._tr=new Ea(s);const h=Bp;this._panStep=h.panStep,this._bearingStep=h.bearingStep,this._pitchStep=h.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let h=0,d=0,g=0,b=0,I=0;switch(s.keyCode){case 61:case 107:case 171:case 187:h=1;break;case 189:case 109:case 173:h=-1;break;case 37:s.shiftKey?d=-1:(s.preventDefault(),b=-1);break;case 39:s.shiftKey?d=1:(s.preventDefault(),b=1);break;case 38:s.shiftKey?g=1:(s.preventDefault(),I=-1);break;case 40:s.shiftKey?g=-1:(s.preventDefault(),I=1);break;default:return}return this._rotationDisabled&&(d=0,g=0),{cameraAnimation:C=>{const M=this._tr;C.easeTo({duration:300,easeId:"keyboardHandler",easing:Qd,zoom:h?Math.round(M.zoom)+h*(s.shiftKey?2:1):M.zoom,bearing:M.bearing+d*this._bearingStep,pitch:M.pitch+g*this._pitchStep,offset:[-b*this._panStep,-I*this._panStep],center:M.center},{originalEvent:s})}}}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 Qd(y){return y*(2-y)}const $d=4.000244140625;class Yg{constructor(s,h){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=s,this._tr=new Ea(s),this._el=s.getCanvasContainer(),this._triggerRenderFrame=h,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(s){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!s[this._map._metaKey])return;s.preventDefault()}let h=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const d=a.h.now(),g=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,h!==0&&h%$d==0?this._type="wheel":h!==0&&Math.abs(h)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=h,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(g*h)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,h+=this._lastValue)),s.shiftKey&&h&&(h/=4),this._type&&(this._lastWheelEvent=s,this._delta-=h,this._active||this._start(s)),s.preventDefault()}_start(s){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=x.mousePos(this._el,s),d=this._tr;this._around=a.L.convert(this._aroundCenter?d.center:d.unproject(h)),this._aroundPoint=d.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._tr.transform;if(this._delta!==0){const C=this._type==="wheel"&&Math.abs(this._delta)>$d?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*C)));this._delta<0&&M!==0&&(M=1/M);const k=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(k*M))),this._type==="wheel"&&(this._startZoom=s.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const h=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,d=this._startZoom,g=this._easing;let b,I=!1;if(this._type==="wheel"&&d&&g){const C=Math.min((a.h.now()-this._lastWheelEventTime)/200,1),M=g(C);b=a.B.number(d,h,M),C<1?this._frameId||(this._frameId=!0):I=!0}else b=h,I=!0;return this._active=!0,I&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!I,zoomDelta:b-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let h=a.bb;if(this._prevEase){const d=this._prevEase,g=(a.h.now()-d.start)/d.duration,b=d.easing(g+.01)-d.easing(g),I=.27/Math.sqrt(b*b+1e-4)*.01,C=Math.sqrt(.0729-I*I);h=a.ba(I,C,.25,1)}return this._prevEase={start:a.h.now(),duration:s,easing:h},h}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Vp{constructor(s,h){this._clickZoom=s,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 Up{constructor(s){this._tr=new Ea(s),this.reset()}reset(){this._active=!1}dblclick(s,h){return s.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(h)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gp{constructor(){this._tap=new ah({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(s,h,d){if(!this._swipePoint)if(this._tapTime){const g=h[0],b=s.timeStamp-this._tapTime<500,I=this._tapPoint.dist(g)<30;b&&I?d.length>0&&(this._swipePoint=g,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(s,h,d)}touchmove(s,h,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const g=h[0],b=g.y-this._swipePoint.y;return this._swipePoint=g,s.preventDefault(),this._active=!0,{zoomDelta:b/128}}}else this._tap.touchmove(s,h,d)}touchend(s,h,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const g=this._tap.touchend(s,h,d);g&&(this._tapTime=s.timeStamp,this._tapPoint=g)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class jp{constructor(s,h,d){this._el=s,this._mousePan=h,this._touchPan=d}enable(s){this._inertiaOptions=s||{},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 bo{constructor(s,h,d){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=h,this._mousePitch=d}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 tl{constructor(s,h,d,g){this._el=s,this._touchZoom=h,this._touchRotate=d,this._tapDragZoom=g,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),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()}}const sc=y=>y.zoom||y.drag||y.pitch||y.rotate;class qp extends a.k{}function ac(y){return y.panDelta&&y.panDelta.mag()||y.zoomDelta||y.bearingDelta||y.pitchDelta}class Zp{constructor(s,h){this.handleWindowEvent=g=>{this.handleEvent(g,`${g.type}Window`)},this.handleEvent=(g,b)=>{if(g.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const I=g.type==="renderFrame"?void 0:g,C={needsRenderFrame:!1},M={},k={},R=g.touches,z=R?this._getMapTouches(R):void 0,W=z?x.touchPos(this._el,z):x.mousePos(this._el,g);for(const{handlerName:at,handler:$,allowed:St}of this._handlers){if(!$.isEnabled())continue;let Ot;this._blockedByActive(k,St,at)?$.reset():$[b||g.type]&&(Ot=$[b||g.type](g,W,z),this.mergeHandlerResult(C,M,Ot,at,I),Ot&&Ot.needsRenderFrame&&this._triggerRenderFrame()),(Ot||$.isActive())&&(k[at]=$)}const nt={};for(const at in this._previousActiveHandlers)k[at]||(nt[at]=I);this._previousActiveHandlers=k,(Object.keys(nt).length||ac(C))&&(this._changes.push([C,M,nt]),this._triggerRenderFrame()),(Object.keys(k).length||ac(C))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:et}=C;et&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],et(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new qd(s),this._bearingSnap=h.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(h);const d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(const[g,b,I]of this._listeners)x.addEventListener(g,b,g===document?this.handleWindowEvent:this.handleEvent,I)}destroy(){for(const[s,h,d]of this._listeners)x.removeEventListener(s,h,s===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(s){const h=this._map,d=h.getCanvasContainer();this._add("mapEvent",new Wd(h,s));const g=h.boxZoom=new Hd(h,s);this._add("boxZoom",g),s.interactive&&s.boxZoom&&g.enable();const b=new Ca(h),I=new Up(h);h.doubleClickZoom=new Vp(I,b),this._add("tapZoom",b),this._add("clickZoom",I),s.interactive&&s.doubleClickZoom&&h.doubleClickZoom.enable();const C=new Gp;this._add("tapDragZoom",C);const M=h.touchPitch=new Hg(h);this._add("touchPitch",M),s.interactive&&s.touchPitch&&h.touchPitch.enable(s.touchPitch);const k=du(s),R=La(s);h.dragRotate=new bo(s,k,R),this._add("mouseRotate",k,["mousePitch"]),this._add("mousePitch",R,["mouseRotate"]),s.interactive&&s.dragRotate&&h.dragRotate.enable();const z=(({enable:St,clickTolerance:Ot})=>{const ct=new Op({checkCorrectEvent:It=>x.mouseButton(It)===0&&!It.ctrlKey});return new Ta({clickTolerance:Ot,move:(It,Bt)=>({around:Bt,panDelta:Bt.sub(It)}),activateOnStart:!0,moveStateManager:ct,enable:St,assignEvents:lh})})(s),W=new we(s,h);h.dragPan=new jp(d,z,W),this._add("mousePan",z),this._add("touchPan",W,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&h.dragPan.enable(s.dragPan);const nt=new zp,et=new Kd;h.touchZoomRotate=new tl(d,et,nt,C),this._add("touchRotate",nt,["touchPan","touchZoom"]),this._add("touchZoom",et,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&h.touchZoomRotate.enable(s.touchZoomRotate);const at=h.scrollZoom=new Yg(h,()=>this._triggerRenderFrame());this._add("scrollZoom",at,["mousePan"]),s.interactive&&s.scrollZoom&&h.scrollZoom.enable(s.scrollZoom);const $=h.keyboard=new Jd(h);this._add("keyboard",$),s.interactive&&s.keyboard&&h.keyboard.enable(),this._add("blockableMapEvent",new Xd(h))}_add(s,h,d){this._handlers.push({handlerName:s,handler:h,allowed:d}),this._handlersById[s]=h}stop(s){if(!this._updatingCamera){for(const{handler:h}of this._handlers)h.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!sc(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,h,d){for(const g in s)if(g!==d&&(!h||h.indexOf(g)<0))return!0;return!1}_getMapTouches(s){const h=[];for(const d of s)this._el.contains(d.target)&&h.push(d);return h}mergeHandlerResult(s,h,d,g,b){if(!d)return;a.e(s,d);const I={handlerName:g,originalEvent:d.originalEvent||b};d.zoomDelta!==void 0&&(h.zoom=I),d.panDelta!==void 0&&(h.drag=I),d.pitchDelta!==void 0&&(h.pitch=I),d.bearingDelta!==void 0&&(h.rotate=I)}_applyChanges(){const s={},h={},d={};for(const[g,b,I]of this._changes)g.panDelta&&(s.panDelta=(s.panDelta||new a.P(0,0))._add(g.panDelta)),g.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(s.around=g.around),g.pinchAround!==void 0&&(s.pinchAround=g.pinchAround),g.noInertia&&(s.noInertia=g.noInertia),a.e(h,b),a.e(d,I);this._updateMapTransform(s,h,d),this._changes=[]}_updateMapTransform(s,h,d){const g=this._map,b=g._getTransformForUpdate(),I=g.terrain;if(!(ac(s)||I&&this._terrainMovement))return this._fireEvents(h,d,!0);let{panDelta:C,zoomDelta:M,bearingDelta:k,pitchDelta:R,around:z,pinchAround:W}=s;W!==void 0&&(z=W),g._stop(!0),z=z||g.transform.centerPoint;const nt=b.pointLocation(C?z.sub(C):z);k&&(b.bearing+=k),R&&(b.pitch+=R),M&&(b.zoom+=M),I?this._terrainMovement||!h.drag&&!h.zoom?h.drag&&this._terrainMovement?b.center=b.pointLocation(b.centerPoint.sub(C)):b.setLocationAtPoint(nt,z):(this._terrainMovement=!0,this._map._elevationFreeze=!0,b.setLocationAtPoint(nt,z),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,b.recalculateZoom(g.terrain)})):b.setLocationAtPoint(nt,z),g._applyUpdatedTransform(b),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(h,d,!0)}_fireEvents(s,h,d){const g=sc(this._eventsInProgress),b=sc(s),I={};for(const R in s){const{originalEvent:z}=s[R];this._eventsInProgress[R]||(I[`${R}start`]=z),this._eventsInProgress[R]=s[R]}!g&&b&&this._fireEvent("movestart",b.originalEvent);for(const R in I)this._fireEvent(R,I[R]);b&&this._fireEvent("move",b.originalEvent);for(const R in s){const{originalEvent:z}=s[R];this._fireEvent(R,z)}const C={};let M;for(const R in this._eventsInProgress){const{handlerName:z,originalEvent:W}=this._eventsInProgress[R];this._handlersById[z].isActive()||(delete this._eventsInProgress[R],M=h[z]||W,C[`${R}end`]=M)}for(const R in C)this._fireEvent(R,C[R]);const k=sc(this._eventsInProgress);if(d&&(g||b)&&!k){this._updatingCamera=!0;const R=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),z=W=>W!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new qp("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class tm extends a.E{constructor(s,h){super(),this._renderFrameCallback=()=>{const d=Math.min((a.h.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(d)),d<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=h.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new a.L(this.transform.center.lng,this.transform.center.lat)}setCenter(s,h){return this.jumpTo({center:s},h)}panBy(s,h,d){return s=a.P.convert(s).mult(-1),this.panTo(this.transform.center,a.e({offset:s},h),d)}panTo(s,h,d){return this.easeTo(a.e({center:s},h),d)}getZoom(){return this.transform.zoom}setZoom(s,h){return this.jumpTo({zoom:s},h),this}zoomTo(s,h,d){return this.easeTo(a.e({zoom:s},h),d)}zoomIn(s,h){return this.zoomTo(this.getZoom()+1,s,h),this}zoomOut(s,h){return this.zoomTo(this.getZoom()-1,s,h),this}getBearing(){return this.transform.bearing}setBearing(s,h){return this.jumpTo({bearing:s},h),this}getPadding(){return this.transform.padding}setPadding(s,h){return this.jumpTo({padding:s},h),this}rotateTo(s,h,d){return this.easeTo(a.e({bearing:s},h),d)}resetNorth(s,h){return this.rotateTo(0,a.e({duration:1e3},s),h),this}resetNorthPitch(s,h){return this.easeTo(a.e({bearing:0,pitch:0,duration:1e3},s),h),this}snapToNorth(s,h){return Math.abs(this.getBearing()){if(this._zooming&&(d.zoom=a.B.number(g,M,Vt)),this._rotating&&(d.bearing=a.B.number(b,k,Vt)),this._pitching&&(d.pitch=a.B.number(I,R,Vt)),this._padding&&(d.interpolatePadding(C,z,Vt),nt=d.centerPoint.add(W)),this.terrain&&!s.freezeElevation&&this._updateElevation(Vt),ct)d.setLocationAtPoint(ct,It);else{const Xt=d.zoomScale(d.zoom-g),ne=M>g?Math.min(2,Ot):Math.max(.5,Ot),Qt=Math.pow(ne,1-Vt),oe=d.unproject($.add(St.mult(Vt*Qt)).mult(Xt));d.setLocationAtPoint(d.renderWorldCopies?oe.wrap():oe,nt)}this._applyUpdatedTransform(d),this._fireMoveEvents(h)},Vt=>{this.terrain&&this._finalizeElevation(),this._afterEase(h,Vt)},s),this}_prepareEase(s,h,d={}){this._moving=!0,h||d.moving||this.fire(new a.k("movestart",s)),this._zooming&&!d.zooming&&this.fire(new a.k("zoomstart",s)),this._rotating&&!d.rotating&&this.fire(new a.k("rotatestart",s)),this._pitching&&!d.pitching&&this.fire(new a.k("pitchstart",s))}_prepareElevation(s){this._elevationCenter=s,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(s){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const h=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&h!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(d-(h-(d*s+this._elevationStart))/(1-s)),this._elevationTarget=h}this.transform.elevation=a.B.number(this._elevationStart,this._elevationTarget,s)}_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(s){if(!this.transformCameraUpdate)return;const h=s.clone(),{center:d,zoom:g,pitch:b,bearing:I,elevation:C}=this.transformCameraUpdate(h);d&&(h.center=d),g!==void 0&&(h.zoom=g),b!==void 0&&(h.pitch=b),I!==void 0&&(h.bearing=I),C!==void 0&&(h.elevation=C),this.transform.apply(h)}_fireMoveEvents(s){this.fire(new a.k("move",s)),this._zooming&&this.fire(new a.k("zoom",s)),this._rotating&&this.fire(new a.k("rotate",s)),this._pitching&&this.fire(new a.k("pitch",s))}_afterEase(s,h){if(this._easeId&&h&&this._easeId===h)return;delete this._easeId;const d=this._zooming,g=this._rotating,b=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new a.k("zoomend",s)),g&&this.fire(new a.k("rotateend",s)),b&&this.fire(new a.k("pitchend",s)),this.fire(new a.k("moveend",s))}flyTo(s,h){if(!s.essential&&a.h.prefersReducedMotion){const Pe=a.F(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Pe,h)}this.stop(),s=a.e({offset:[0,0],speed:1.2,curve:1.42,easing:a.bb},s);const d=this._getTransformForUpdate(),g=this.getZoom(),b=this.getBearing(),I=this.getPitch(),C=this.getPadding(),M="zoom"in s?a.ad(+s.zoom,d.minZoom,d.maxZoom):g,k="bearing"in s?this._normalizeBearing(s.bearing,b):b,R="pitch"in s?+s.pitch:I,z="padding"in s?s.padding:d.padding,W=d.zoomScale(M-g),nt=a.P.convert(s.offset);let et=d.centerPoint.add(nt);const at=d.pointLocation(et),$=a.L.convert(s.center||at);this._normalizeCenter($);const St=d.project(at),Ot=d.project($).sub(St);let ct=s.curve;const It=Math.max(d.width,d.height),Bt=It/W,Vt=Ot.mag();if("minZoom"in s){const Pe=a.ad(Math.min(s.minZoom,g,M),d.minZoom,d.maxZoom),Yn=It/d.zoomScale(Pe-g);ct=Math.sqrt(Yn/Vt*2)}const Xt=ct*ct;function ne(Pe){const Yn=(Bt*Bt-It*It+(Pe?-1:1)*Xt*Xt*Vt*Vt)/(2*(Pe?Bt:It)*Xt*Vt);return Math.log(Math.sqrt(Yn*Yn+1)-Yn)}function Qt(Pe){return(Math.exp(Pe)-Math.exp(-Pe))/2}function oe(Pe){return(Math.exp(Pe)+Math.exp(-Pe))/2}const Ce=ne(!1);let bn=function(Pe){return oe(Ce)/oe(Ce+ct*Pe)},he=function(Pe){return It*((oe(Ce)*(Qt(Yn=Ce+ct*Pe)/oe(Yn))-Qt(Ce))/Xt)/Vt;var Yn},Ue=(ne(!0)-Ce)/ct;if(Math.abs(Vt)<1e-6||!isFinite(Ue)){if(Math.abs(It-Bt)<1e-6)return this.easeTo(s,h);const Pe=Bts.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=b!==k,this._pitching=R!==I,this._padding=!d.isPaddingEqual(z),this._prepareEase(h,!1),this.terrain&&this._prepareElevation($),this._ease(Pe=>{const Yn=Pe*Ue,vn=1/bn(Yn);d.zoom=Pe===1?M:g+d.scaleZoom(vn),this._rotating&&(d.bearing=a.B.number(b,k,Pe)),this._pitching&&(d.pitch=a.B.number(I,R,Pe)),this._padding&&(d.interpolatePadding(C,z,Pe),et=d.centerPoint.add(nt)),this.terrain&&!s.freezeElevation&&this._updateElevation(Pe);const hn=Pe===1?$:d.unproject(St.add(Ot.mult(he(Yn))).mult(vn));d.setLocationAtPoint(d.renderWorldCopies?hn.wrap():hn,et),this._applyUpdatedTransform(d),this._fireMoveEvents(h)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(h)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,h){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,h)}if(!s){const d=this.handlers;d&&d.stop(!1)}return this}_ease(s,h,d){d.animate===!1||d.duration===0?(s(1),h()):(this._easeStart=a.h.now(),this._easeOptions=d,this._onEaseFrame=s,this._onEaseEnd=h,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,h){s=a.b5(s,-180,180);const d=Math.abs(s-h);return Math.abs(s-360-h)180?-360:d<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(a.L.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}class zo{constructor(s={}){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=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options&&this.options.compact,this._container=x.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=x.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=x.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(){x.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(s,h){const d=this._map._getUIString(`AttributionControl.${h}`);s.title=d,s.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}const h=this._map.style.sourceCaches;for(const g in h){const b=h[g];if(b.used||b.usedForTerrain){const I=b.getSource();I.attribution&&s.indexOf(I.attribution)<0&&s.push(I.attribution)}}s=s.filter(g=>String(g).trim()),s.sort((g,b)=>g.length-b.length),s=s.filter((g,b)=>{for(let I=b+1;I=0)return!1;return!0});const d=s.join(" | ");d!==this._attribHTML&&(this._attribHTML=d,s.length?(this._innerContainer.innerHTML=d,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ui{constructor(s={}){this._updateCompact=()=>{const h=this._container.children;if(h.length){const d=h[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=x.create("div","maplibregl-ctrl");const h=x.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(){x.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ch{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const h=++this._id;return this._queue.push({callback:s,id:h,cancelled:!1}),h}remove(s){const h=this._currentlyRunning,d=h?this._queue.concat(h):this._queue;for(const g of d)if(g.id===s)return void(g.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const h=this._currentlyRunning=this._queue;this._queue=[];for(const d of h)if(!d.cancelled&&(d.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Wp={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var em=a.Q([{name:"a_pos3d",type:"Int16",components:3}]);class nm extends a.E{constructor(s){super(),this.sourceCache=s,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,s.usedForTerrain=!0,s.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(s,h){this.sourceCache.update(s,h),this._renderableTilesKeys=[];const d={};for(const g of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:h}))d[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),a.aS(g.posMatrix,0,a.N,0,a.N,0,1),this._tiles[g.key]=new dn(g,this.tileSize));for(const g in this._tiles)d[g]||delete this._tiles[g]}freeRtt(s){for(const h in this._tiles){const d=this._tiles[h];(!s||d.tileID.equals(s)||d.tileID.isChildOf(s)||s.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(s=>this.getTileByID(s))}getTileByID(s){return this._tiles[s]}getTerrainCoords(s){const h={};for(const d of this._renderableTilesKeys){const g=this._tiles[d].tileID;if(g.canonical.equals(s.canonical)){const b=s.clone();b.posMatrix=new Float64Array(16),a.aS(b.posMatrix,0,a.N,0,a.N,0,1),h[d]=b}else if(g.canonical.isChildOf(s.canonical)){const b=s.clone();b.posMatrix=new Float64Array(16);const I=g.canonical.z-s.canonical.z,C=g.canonical.x-(g.canonical.x>>I<>I<>I;a.aS(b.posMatrix,0,k,0,k,0,1),a.$(b.posMatrix,b.posMatrix,[-C*k,-M*k,0]),h[d]=b}else if(s.canonical.isChildOf(g.canonical)){const b=s.clone();b.posMatrix=new Float64Array(16);const I=s.canonical.z-g.canonical.z,C=s.canonical.x-(s.canonical.x>>I<>I<>I;a.aS(b.posMatrix,0,a.N,0,a.N,0,1),a.$(b.posMatrix,b.posMatrix,[C*k,M*k,0]),a.a0(b.posMatrix,b.posMatrix,[1/2**I,1/2**I,0]),h[d]=b}}return h}getSourceTile(s,h){const d=this.sourceCache._source;let g=s.overscaledZ-this.deltaZoom;if(g>d.maxzoom&&(g=d.maxzoom),g=d.minzoom&&(!b||!b.dem);)b=this.sourceCache.getTileByID(s.scaledTo(g--).key);return b}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(h=>h.timeAdded>=s)}}class im{constructor(s,h,d){this.painter=s,this.sourceCache=new nm(h),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(s,h,d,g=a.N){var b;if(!(h>=0&&h=0&&ds.canonical.z&&(s.canonical.z>=g?b=s.canonical.z-g:a.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const I=s.canonical.x-(s.canonical.x>>b<>b<>8<<4|b>>8,h[I+3]=0;const d=new a.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(h.buffer)),g=new Mt(s,d,s.gl.RGBA,{premultiply:!1});return g.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(s){const h=new Uint8Array(4),d=this.painter.context,g=d.gl;d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(s.x,this.painter.height/devicePixelRatio-s.y-1,1,1,g.RGBA,g.UNSIGNED_BYTE,h),d.bindFramebuffer.set(null);const b=h[0]+(h[2]>>4<<8),I=h[1]+((15&h[2])<<8),C=this.coordsIndex[255-h[3]],M=C&&this.sourceCache.getTileByID(C);if(!M)return null;const k=this._coordsTextureSize,R=(1<0&&Math.sign(b)<0||!d&&Math.sign(g)<0&&Math.sign(b)>0?(g=360*Math.sign(b)+g,a.G(g)):h}}class Kg{constructor(s,h,d){this._context=s,this._size=h,this._tileSize=d,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const s of this._objects)s.texture.destroy(),s.fbo.destroy()}_createObject(s){const h=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),d=new Mt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return d.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),h.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),h.colorAttachment.set(d.texture),{id:s,fbo:h,texture:d,stamp:-1,inUse:!1}}getObjectForId(s){return this._objects[s]}useObject(s){s.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(h=>s.id!==h),this._recentlyUsed.push(s.id)}stampObject(s){s.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 s=this._createObject(this._objects.length);return this._objects.push(s),s}freeObject(s){s.inUse=!1}freeAllObjects(){for(const s of this._objects)this.freeObject(s)}isFull(){return!(this._objects.length!s.inUse)===!1}}const oo={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class hh{constructor(s,h){this.painter=s,this.terrain=h,this.pool=new Kg(s.context,30,h.sourceCache.tileSize*h.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}prepareForRender(s,h){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(d=>!s._layers[d].isHidden(h)),this._coordsDescendingInv={};for(const d in s.sourceCaches){this._coordsDescendingInv[d]={};const g=s.sourceCaches[d].getVisibleCoordinates();for(const b of g){const I=this.terrain.sourceCache.getTerrainCoords(b);for(const C in I)this._coordsDescendingInv[d][C]||(this._coordsDescendingInv[d][C]=[]),this._coordsDescendingInv[d][C].push(I[C])}}this._coordsDescendingInvStr={};for(const d of s._order){const g=s._layers[d],b=g.source;if(oo[g.type]&&!this._coordsDescendingInvStr[b]){this._coordsDescendingInvStr[b]={};for(const I in this._coordsDescendingInv[b])this._coordsDescendingInvStr[b][I]=this._coordsDescendingInv[b][I].map(C=>C.key).sort().join()}}for(const d of this._renderableTiles)for(const g in this._coordsDescendingInvStr){const b=this._coordsDescendingInvStr[g][d.tileID.key];b&&b!==d.rttCoords[g]&&(d.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const h=s.type,d=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(oo[h]&&(this._prevType&&oo[this._prevType]||this._stacks.push([]),this._prevType=h,this._stacks[this._stacks.length-1].push(s.id),!g))return!0;if(oo[this._prevType]||oo[h]&&g){this._prevType=h;const b=this._stacks.length-1,I=this._stacks[b]||[];for(const C of this._renderableTiles){if(this.pool.isFull()&&(Pi(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(C),C.rtt[b]){const k=this.pool.getObjectForId(C.rtt[b].id);if(k.stamp===C.rtt[b].stamp){this.pool.useObject(k);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),C.rtt[b]={id:M.id,stamp:M.stamp},d.context.bindFramebuffer.set(M.fbo.framebuffer),d.context.clear({color:a.aT.transparent,stencil:0}),d.currentStencilSource=void 0;for(let k=0;k{y.touchstart=y.dragStart,y.touchmoveWindow=y.dragMove,y.touchend=y.dragEnd},Xp={showCompass:!0,showZoom:!0,visualizePitch:!1};class Hp{constructor(s,h,d=!1){this.mousedown=I=>{this.startMouse(a.e({},I,{ctrlKey:!0,preventDefault:()=>I.preventDefault()}),x.mousePos(this.element,I)),x.addEventListener(window,"mousemove",this.mousemove),x.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=I=>{this.moveMouse(I,x.mousePos(this.element,I))},this.mouseup=I=>{this.mouseRotate.dragEnd(I),this.mousePitch&&this.mousePitch.dragEnd(I),this.offTemp()},this.touchstart=I=>{I.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=x.touchPos(this.element,I.targetTouches)[0],this.startTouch(I,this._startPos),x.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),x.addEventListener(window,"touchend",this.touchend))},this.touchmove=I=>{I.targetTouches.length!==1?this.reset():(this._lastPos=x.touchPos(this.element,I.targetTouches)[0],this.moveTouch(I,this._lastPos))},this.touchend=I=>{I.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 g=s.dragRotate._mouseRotate.getClickTolerance(),b=s.dragRotate._mousePitch.getClickTolerance();this.element=h,this.mouseRotate=du({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:I,clickTolerance:C,bearingDegreesPerPixelMoved:M=.8})=>{const k=new Yd;return new Ta({clickTolerance:C,move:(R,z)=>({bearingDelta:(z.x-R.x)*M}),moveStateManager:k,enable:I,assignEvents:lc})})({clickTolerance:g,enable:!0}),this.map=s,d&&(this.mousePitch=La({clickTolerance:b,enable:!0}),this.touchPitch=(({enable:I,clickTolerance:C,pitchDegreesPerPixelMoved:M=-.5})=>{const k=new Yd;return new Ta({clickTolerance:C,move:(R,z)=>({pitchDelta:(z.y-R.y)*M}),moveStateManager:k,enable:I,assignEvents:lc})})({clickTolerance:b,enable:!0})),x.addEventListener(h,"mousedown",this.mousedown),x.addEventListener(h,"touchstart",this.touchstart,{passive:!1}),x.addEventListener(h,"touchcancel",this.reset)}startMouse(s,h){this.mouseRotate.dragStart(s,h),this.mousePitch&&this.mousePitch.dragStart(s,h),x.disableDrag()}startTouch(s,h){this.touchRotate.dragStart(s,h),this.touchPitch&&this.touchPitch.dragStart(s,h),x.disableDrag()}moveMouse(s,h){const d=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(s,h)||{};if(g&&d.setBearing(d.getBearing()+g),this.mousePitch){const{pitchDelta:b}=this.mousePitch.dragMove(s,h)||{};b&&d.setPitch(d.getPitch()+b)}}moveTouch(s,h){const d=this.map,{bearingDelta:g}=this.touchRotate.dragMove(s,h)||{};if(g&&d.setBearing(d.getBearing()+g),this.touchPitch){const{pitchDelta:b}=this.touchPitch.dragMove(s,h)||{};b&&d.setPitch(d.getPitch()+b)}}off(){const s=this.element;x.removeEventListener(s,"mousedown",this.mousedown),x.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),x.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),x.removeEventListener(window,"touchend",this.touchend),x.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){x.enableDrag(),x.removeEventListener(window,"mousemove",this.mousemove),x.removeEventListener(window,"mouseup",this.mouseup),x.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),x.removeEventListener(window,"touchend",this.touchend)}}let Zi;function Yp(y,s,h){if(y=new a.L(y.lng,y.lat),s){const d=new a.L(y.lng-360,y.lat),g=new a.L(y.lng+360,y.lat),b=h.locationPoint(y).distSqr(s);h.locationPoint(d).distSqr(s)180;){const d=h.locationPoint(y);if(d.x>=0&&d.y>=0&&d.x<=h.width&&d.y<=h.height)break;y.lng>h.center.lng?y.lng-=360:y.lng+=360}return y}const ls={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 rm(y,s,h){const d=y.classList;for(const g in ls)d.remove(`maplibregl-${h}-anchor-${g}`);d.add(`maplibregl-${h}-anchor-${s}`)}class Ll extends a.E{constructor(s){if(super(),this._onKeyPress=h=>{const d=h.code,g=h.charCode||h.keyCode;d!=="Space"&&d!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=h=>{const d=h.originalEvent.target,g=this._element;this._popup&&(d===g||g.contains(d))&&this.togglePopup()},this._update=h=>{if(!this._map)return;const d=this._map.loaded()&&!this._map.isMoving();((h==null?void 0:h.type)==="terrain"||(h==null?void 0:h.type)==="render"&&!d)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=Yp(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let g="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?g=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(g=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let b="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?b="rotateX(0deg)":this._pitchAlignment==="map"&&(b=`rotateX(${this._map.getPitch()}deg)`),h&&h.type!=="moveend"||(this._pos=this._pos.round()),x.setTransform(this._element,`${ls[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${b} ${g}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const I=this._map.unproject(this._pos),C=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=I.distanceTo(this._lngLat)>20*C?"0.2":"1.0",this._opacityTimeout=null},100))},this._onMove=h=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=h.point.dist(this._pointerdownPos)>=d}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=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment!=="auto"?s.pitchAlignment:this._rotationAlignment,s&&s.element)this._element=s.element,this._offset=a.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=x.create("div"),this._element.setAttribute("aria-label","Map marker");const h=x.createNS("http://www.w3.org/2000/svg","svg"),d=41,g=27;h.setAttributeNS(null,"display","block"),h.setAttributeNS(null,"height",`${d}px`),h.setAttributeNS(null,"width",`${g}px`),h.setAttributeNS(null,"viewBox",`0 0 ${g} ${d}`);const b=x.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"stroke","none"),b.setAttributeNS(null,"stroke-width","1"),b.setAttributeNS(null,"fill","none"),b.setAttributeNS(null,"fill-rule","evenodd");const I=x.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"fill-rule","nonzero");const C=x.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"transform","translate(3.0, 29.0)"),C.setAttributeNS(null,"fill","#000000");const M=[{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 St of M){const Ot=x.createNS("http://www.w3.org/2000/svg","ellipse");Ot.setAttributeNS(null,"opacity","0.04"),Ot.setAttributeNS(null,"cx","10.5"),Ot.setAttributeNS(null,"cy","5.80029008"),Ot.setAttributeNS(null,"rx",St.rx),Ot.setAttributeNS(null,"ry",St.ry),C.appendChild(Ot)}const k=x.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"fill",this._color);const R=x.createNS("http://www.w3.org/2000/svg","path");R.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"),k.appendChild(R);const z=x.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"opacity","0.25"),z.setAttributeNS(null,"fill","#000000");const W=x.createNS("http://www.w3.org/2000/svg","path");W.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"),z.appendChild(W);const nt=x.createNS("http://www.w3.org/2000/svg","g");nt.setAttributeNS(null,"transform","translate(6.0, 7.0)"),nt.setAttributeNS(null,"fill","#FFFFFF");const et=x.createNS("http://www.w3.org/2000/svg","g");et.setAttributeNS(null,"transform","translate(8.0, 8.0)");const at=x.createNS("http://www.w3.org/2000/svg","circle");at.setAttributeNS(null,"fill","#000000"),at.setAttributeNS(null,"opacity","0.25"),at.setAttributeNS(null,"cx","5.5"),at.setAttributeNS(null,"cy","5.5"),at.setAttributeNS(null,"r","5.4999962");const $=x.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#FFFFFF"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962"),et.appendChild(at),et.appendChild($),I.appendChild(C),I.appendChild(k),I.appendChild(z),I.appendChild(nt),I.appendChild(et),h.appendChild(I),h.setAttributeNS(null,"height",d*this._scale+"px"),h.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(h),this._offset=a.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",h=>{h.preventDefault()}),this._element.addEventListener("mousedown",h=>{h.preventDefault()}),rm(this._element,this._anchor,"marker"),s&&s.className)for(const h of s.className.split(" "))this._element.classList.add(h);this._popup=null}addTo(s){return this.remove(),this._map=s,s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.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),x.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=a.L.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const g=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[g,-1*(38.1-13.5+g)],"bottom-right":[-g,-1*(38.1-13.5+g)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._lngLat&&this._popup.setLngLat(this._lngLat),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 s=this._popup;return s?(s.isOpen()?s.remove():s.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(s){return this._offset=a.P.convert(s),this._update(),this}addClassName(s){this._element.classList.add(s)}removeClassName(s){this._element.classList.remove(s)}toggleClassName(s){return this._element.classList.toggle(s)}setDraggable(s){return this._draggable=!!s,this._map&&(s?(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(s){return this._rotation=s||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(s){return this._rotationAlignment=s||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(s){return this._pitchAlignment=s&&s!=="auto"?s:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Ai={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let wi=0,gu=!1;const uc={maxWidth:100,unit:"metric"};function cc(y,s,h){const d=h&&h.maxWidth||100,g=y._container.clientHeight/2,b=y.unproject([0,g]),I=y.unproject([d,g]),C=b.distanceTo(I);if(h&&h.unit==="imperial"){const M=3.2808*C;M>5280?Ml(s,d,M/5280,y._getUIString("ScaleControl.Miles")):Ml(s,d,M,y._getUIString("ScaleControl.Feet"))}else h&&h.unit==="nautical"?Ml(s,d,C/1852,y._getUIString("ScaleControl.NauticalMiles")):C>=1e3?Ml(s,d,C/1e3,y._getUIString("ScaleControl.Kilometers")):Ml(s,d,C,y._getUIString("ScaleControl.Meters"))}function Ml(y,s,h,d){const g=function(b){const I=Math.pow(10,`${Math.floor(b)}`.length-1);let C=b/I;return C=C>=10?10:C>=5?5:C>=3?3:C>=2?2:C>=1?1:function(M){const k=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*k)/k}(C),I*C}(h);y.style.width=s*(g/h)+"px",y.innerHTML=`${g} ${d}`}const Kp={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Jp=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function _u(y){if(y){if(typeof y=="number"){const s=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(s,s),"top-right":new a.P(-s,s),bottom:new a.P(0,-y),"bottom-left":new a.P(s,-s),"bottom-right":new a.P(-s,-s),left:new a.P(y,0),right:new a.P(-y,0)}}if(y instanceof a.P||Array.isArray(y)){const s=a.P.convert(y);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}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 _u(new a.P(0,0))}const Qp={extend:(y,...s)=>a.e(y,...s),run(y){y()},logToElement(y,s=!1,h="log"){const d=window.document.getElementById(h);d&&(s&&(d.innerHTML=""),d.innerHTML+=`
${y}`)}},$p=_;class Bn{static get version(){return $p}static get workerCount(){return ts.workerCount}static set workerCount(s){ts.workerCount=s}static get maxParallelImageRequests(){return a.c.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(s){a.c.MAX_PARALLEL_IMAGE_REQUESTS=s}static get workerUrl(){return a.c.WORKER_URL}static set workerUrl(s){a.c.WORKER_URL=s}static addProtocol(s,h){a.c.REGISTERED_PROTOCOLS[s]=h}static removeProtocol(s){delete a.c.REGISTERED_PROTOCOLS[s]}}return Bn.Map=class extends tm{constructor(y){if(a.bg.mark(a.bh.create),(y=a.e({},Ve,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 sh(y.minZoom,y.maxZoom,y.minPitch,y.maxPitch,y.renderWorldCopies),{bearingSnap:y.bearingSnap}),this._cooperativeGesturesOnWheel=s=>{this._onCooperativeGesture(s,s[this._metaKey],1)},this._contextLost=s=>{s.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new a.k("webglcontextrestored",{originalEvent:s}))},this._onMapScroll=s=>{if(s.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=y.interactive,this._cooperativeGestures=y.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",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 ch,this._controls=[],this._mapId=a.a2(),this._locale=a.e({},Wp,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 V(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 s=!1;const h=Tl(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{s?h(d):s=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Zp(this,y),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=y.hash&&new ic(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 zo({customAttribution:y.customAttribution})),y.maplibreLogo&&this.addControl(new ui,y.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new a.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new a.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new a.k("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(y,s){if(s===void 0&&(s=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 d=this._controlPositions[s];return s.indexOf("bottom")!==-1?d.insertBefore(h,d.firstChild):d.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 s=this._controls.indexOf(y);return s>-1&&this._controls.splice(s,1),y.onRemove(this),this}hasControl(y){return this._controls.indexOf(y)>-1}calculateCameraOptionsFromTo(y,s,h,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(h,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(y,s,h,d)}resize(y){var s;const h=this._containerDimensions(),d=h[0],g=h[1],b=this._getClampedPixelRatio(d,g);if(this._resizeCanvas(d,g,b),this.painter.resize(d,g,b),this.painter.overLimit()){const C=this.painter.context.gl;this._maxCanvasSize=[C.drawingBufferWidth,C.drawingBufferHeight];const M=this._getClampedPixelRatio(d,g);this._resizeCanvas(d,g,M),this.painter.resize(d,g,M)}this.transform.resize(d,g),(s=this._requestedCameraState)===null||s===void 0||s.resize(d,g);const I=!this._moving;return I&&(this.stop(),this.fire(new a.k("movestart",y)).fire(new a.k("move",y))),this.fire(new a.k("resize",y)),I&&this.fire(new a.k("moveend",y)),this}_getClampedPixelRatio(y,s){const{0:h,1:d}=this._maxCanvasSize,g=this.getPixelRatio(),b=y*g,I=s*g;return Math.min(b>h?h/b:1,I>d?d/I:1)*g}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(Be.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()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(y){return this._cooperativeGestures=y,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(y){return this.transform.locationPoint(a.L.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,s,h){if(y==="mouseenter"||y==="mouseover"){let d=!1;return{layer:s,listener:h,delegates:{mousemove:b=>{const I=this.getLayer(s)?this.queryRenderedFeatures(b.point,{layers:[s]}):[];I.length?d||(d=!0,h.call(this,new Oo(y,this,b.originalEvent,{features:I}))):d=!1},mouseout:()=>{d=!1}}}}if(y==="mouseleave"||y==="mouseout"){let d=!1;return{layer:s,listener:h,delegates:{mousemove:I=>{(this.getLayer(s)?this.queryRenderedFeatures(I.point,{layers:[s]}):[]).length?d=!0:d&&(d=!1,h.call(this,new Oo(y,this,I.originalEvent)))},mouseout:I=>{d&&(d=!1,h.call(this,new Oo(y,this,I.originalEvent)))}}}}{const d=g=>{const b=this.getLayer(s)?this.queryRenderedFeatures(g.point,{layers:[s]}):[];b.length&&(g.features=b,h.call(this,g),delete g.features)};return{layer:s,listener:h,delegates:{[y]:d}}}}on(y,s,h){if(h===void 0)return super.on(y,s);const d=this._createDelegatedListener(y,s,h);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[y]=this._delegatedListeners[y]||[],this._delegatedListeners[y].push(d);for(const g in d.delegates)this.on(g,d.delegates[g]);return this}once(y,s,h){if(h===void 0)return super.once(y,s);const d=this._createDelegatedListener(y,s,h);for(const g in d.delegates)this.once(g,d.delegates[g]);return this}off(y,s,h){return h===void 0?super.off(y,s):(this._delegatedListeners&&this._delegatedListeners[y]&&(d=>{const g=this._delegatedListeners[y];for(let b=0;bthis._updateStyle(y,s));const h=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!y)),y?(this.style=new Nr(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof y=="string"?this.style.loadURL(y,s,h):this.style.loadJSON(y,s,h),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Nr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(y,s){if(typeof y=="string"){const h=this._requestManager.transformRequest(y,K.Style);a.f(h,(d,g)=>{d?this.fire(new a.j(d)):g&&this._updateDiff(g,s)})}else typeof y=="object"&&this._updateDiff(y,s)}_updateDiff(y,s){try{this.style.setState(y,s)&&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,s)}}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,s){return this._lazyInitEmptyStyle(),this.style.addSource(y,s),this._update(!0)}isSourceLoaded(y){const s=this.style&&this.style.sourceCaches[y];if(s!==void 0)return s.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 s=this.style.sourceCaches[y.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${y.source}`);for(const h in this.style._layers){const d=this.style._layers[h];d.type==="hillshade"&&d.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 im(this.painter,s,y),this.painter.renderToTexture=new hh(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=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._minEleveationForCurrentTile=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._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new a.k("terrain",{terrain:y})),this}getTerrain(){var y,s;return(s=(y=this.terrain)===null||y===void 0?void 0:y.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const y=this.style&&this.style.sourceCaches;for(const s in y){const h=y[s]._tiles;for(const d in h){const g=h[d];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}addSourceType(y,s,h){return this._lazyInitEmptyStyle(),this.style.addSourceType(y,s,h)}removeSource(y){return this.style.removeSource(y),this._update(!0)}getSource(y){return this.style.getSource(y)}addImage(y,s,h={}){const{pixelRatio:d=1,sdf:g=!1,stretchX:b,stretchY:I,content:C}=h;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||a.a(s))){if(s.width===void 0||s.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:M,height:k,data:R}=s,z=s;return this.style.addImage(y,{data:new a.R({width:M,height:k},new Uint8Array(R)),pixelRatio:d,stretchX:b,stretchY:I,content:C,sdf:g,version:0,userImage:z}),z.onAdd&&z.onAdd(this,y),this}}{const{width:M,height:k,data:R}=a.h.getImageData(s);this.style.addImage(y,{data:new a.R({width:M,height:k},R),pixelRatio:d,stretchX:b,stretchY:I,content:C,sdf:g,version:0})}}updateImage(y,s){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 d=s instanceof HTMLImageElement||a.a(s)?a.h.getImageData(s):s,{width:g,height:b,data:I}=d;if(g===void 0||b===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(g!==h.data.width||b!==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 C=!(s instanceof HTMLImageElement||a.a(s));return h.data.replace(I,C),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,s){G.getImage(this._requestManager.transformRequest(y,K.Image),s)}listImages(){return this.style.listImages()}addLayer(y,s){return this._lazyInitEmptyStyle(),this.style.addLayer(y,s),this._update(!0)}moveLayer(y,s){return this.style.moveLayer(y,s),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,s,h){return this.style.setLayerZoomRange(y,s,h),this._update(!0)}setFilter(y,s,h={}){return this.style.setFilter(y,s,h),this._update(!0)}getFilter(y){return this.style.getFilter(y)}setPaintProperty(y,s,h,d={}){return this.style.setPaintProperty(y,s,h,d),this._update(!0)}getPaintProperty(y,s){return this.style.getPaintProperty(y,s)}setLayoutProperty(y,s,h,d={}){return this.style.setLayoutProperty(y,s,h,d),this._update(!0)}getLayoutProperty(y,s){return this.style.getLayoutProperty(y,s)}setGlyphs(y,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(y,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(y,s,h={}){return this._lazyInitEmptyStyle(),this.style.addSprite(y,s,h,d=>{d||this._update(!0)}),this}removeSprite(y){return this._lazyInitEmptyStyle(),this.style.removeSprite(y),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(y,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(y,s,h=>{h||this._update(!0)}),this}setLight(y,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(y,s),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(y,s){return this.style.setFeatureState(y,s),this._update()}removeFeatureState(y,s){return this.style.removeFeatureState(y,s),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,s=0;return this._container&&(y=this._container.clientWidth||400,s=this._container.clientHeight||300),[y,s]}_setupContainer(){const y=this._container;y.classList.add("maplibregl-map");const s=this._canvasContainer=x.create("div","maplibregl-canvas-container",y);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=x.create("canvas","maplibregl-canvas",s),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(),d=this._getClampedPixelRatio(h[0],h[1]);this._resizeCanvas(h[0],h[1],d);const g=this._controlContainer=x.create("div","maplibregl-control-container",y),b=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(I=>{b[I]=x.create("div",`maplibregl-ctrl-${I} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=x.create("div","maplibregl-cooperative-gesture-screen",this._container);let y=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(y=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`
${y}
${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}
- `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){x.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(y,s,h){this._canvas.width=Math.floor(h*y),this._canvas.height=Math.floor(h*s),this._canvas.style.width=`${y}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const y={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{s={requestedAttributes:y},d&&(s.statusMessage=d.statusMessage,s.type=d.type)},{once:!0});const h=this._canvas.getContext("webgl2",y)||this._canvas.getContext("webgl",y);if(!h){const d="Failed to initialize WebGL";throw s?(s.message=d,new Error(JSON.stringify(s))):new Error(d)}this.painter=new Cl(h,this.transform),S.testSupport(h)}_onCooperativeGesture(y,s,h){return!s&&h<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}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 s=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 g=this.transform.zoom,b=a.h.now();this.style.zoomHistory.update(g,b);const I=new a.a8(g,{now:b,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),C=I.crossFadingFactor();C===1&&C===this._crossFadingFactor||(h=!0,this._crossFadingFactor=C),this.style.update(I)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=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._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new a.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.bg.mark(a.bh.load),this.fire(new a.k("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,a.bg.mark(a.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=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._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Z.removeThrottleControl(this._imageQueueHandle),(y=this._resizeObserver)===null||y===void 0||y.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),x.remove(this._canvasContainer),x.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),a.bg.clearMetrics(),this._removed=!0,this.fire(new a.k("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=a.h.frame(y=>{a.bg.frame(y),this._frame=null,this._render(y)}))}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 Ne}getCameraTargetElevation(){return this.transform.elevation}},Vn.NavigationControl=class{constructor(y){this._updateZoomButtons=()=>{const s=this._map.getZoom(),h=s===this._map.getMaxZoom(),d=s===this._map.getMinZoom();this._zoomInButton.disabled=h,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",h.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const s=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=s},this._setButtonTitle=(s,h)=>{const d=this._map._getUIString(`NavigationControl.${h}`);s.title=d,s.setAttribute("aria-label",d)},this.options=a.e({},Xp,y),this._container=x.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),x.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),x.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=x.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 Hp(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){x.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,s){const h=x.create("button",y,this._container);return h.type="button",h.addEventListener("click",s),h}},Vn.GeolocateControl=class extends a.E{constructor(y){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new a.k("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=s,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(s),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(s),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new a.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const h=new a.L(s.coords.longitude,s.coords.latitude),d=s.coords.accuracy,g=this._map.getBearing(),b=a.e({bearing:g},this.options.fitBoundsOptions),I=Ge.fromLngLat(h,d);this._map.fitBounds(I,b,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const h=new a.L(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(h).addTo(this._map),this._userLocationDotMarker.setLngLat(h).addTo(this._map),this._accuracy=s.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=s=>{if(this._map){if(this.options.trackUserLocation)if(s.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(s.code===3&&gu)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new a.k("error",s)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=s=>{if(this._map){if(this._container.addEventListener("contextmenu",h=>h.preventDefault()),this._geolocateButton=x.create("button","maplibregl-ctrl-geolocate",this._container),x.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!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=x.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ll({element:this._dotElement}),this._circleElement=x.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ll({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",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({},Ai,y)}onAdd(y){return this._map=y,this._container=x.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(s,h=!1){Wi===void 0||h?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(d=>{Wi=d.state!=="denied",s(Wi)}).catch(()=>{Wi=!!window.navigator.geolocation,s(Wi)}):(Wi=!!window.navigator.geolocation,s(Wi)):s(Wi)}(this._setupUI),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(),x.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ei=0,gu=!1}_isOutOfMapMaxBounds(y){const s=this._map.getMaxBounds(),h=y.coords;return s&&(h.longitudes.getEast()||h.latitudes.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(),s=y.getSouthEast(),h=y.getNorthEast(),d=s.distanceTo(h),g=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}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":Ei--,gu=!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"),Ei++,Ei>1?(y={maximumAge:6e5,timeout:0},gu=!0):(y=this.options.positionOptions,gu=!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)}},Vn.AttributionControl=zo,Vn.LogoControl=ci,Vn.ScaleControl=class{constructor(y){this._onMove=()=>{cc(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,cc(this._map,this._container,this.options)},this.options=a.e({},uc,y)}getDefaultPosition(){return"bottom-left"}onAdd(y){return this._map=y,this._container=x.create("div","maplibregl-ctrl maplibregl-ctrl-scale",y.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){x.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},Vn.FullscreenControl=class extends a.E{constructor(y={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===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=x.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){x.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const y=this._fullscreenButton=x.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);x.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._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new a.k("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_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()}},Vn.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.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=y}onAdd(y){return this._map=y,this._container=x.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=x.create("button","maplibregl-ctrl-terrain",this._container),x.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(){x.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},Vn.Popup=class extends a.E{constructor(y){super(),this.remove=()=>(this._content&&x.remove(this._content),this._container&&(x.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),delete this._map),this.fire(new a.k("close")),this),this._onMouseUp=s=>{this._update(s.point)},this._onMouseMove=s=>{this._update(s.point)},this._onDrag=s=>{this._update(s.point)},this._update=s=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=x.create("div","maplibregl-popup",this._map.getContainer()),this._tip=x.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const I of this.options.className.split(" "))this._container.classList.add(I);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._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Yp(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!s)return;const h=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);let d=this.options.anchor;const g=_u(this.options.offset);if(!d){const I=this._container.offsetWidth,C=this._container.offsetHeight;let M;M=h.y+g.bottom.ythis._map.transform.height-C?["bottom"]:[],h.xthis._map.transform.width-I/2&&M.push("right"),d=M.length===0?"bottom":M.join("-")}const b=h.add(g[d]).round();x.setTransform(this._container,`${as[d]} translate(${b.x}px,${b.y}px)`),rm(this._container,d,"popup")},this._onClose=()=>{this.remove()},this.options=a.e(Object.create(Kp),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.L.convert(y),this._pos=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._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 s=document.createDocumentFragment(),h=document.createElement("body");let d;for(h.innerHTML=y;d=h.firstChild,d;)s.appendChild(d);return this.setDOMContent(s)}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=x.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)}_createCloseButton(){this.options.closeButton&&(this._closeButton=x.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(Jp);y&&y.focus()}},Vn.Marker=Ll,Vn.Style=Dr,Vn.LngLat=a.L,Vn.LngLatBounds=Ge,Vn.Point=a.P,Vn.MercatorCoordinate=a.U,Vn.Evented=a.E,Vn.AJAXError=a.bi,Vn.config=a.c,Vn.CanvasSource=mi,Vn.GeoJSONSource=De,Vn.ImageSource=Zn,Vn.RasterDEMTileSource=ie,Vn.RasterTileSource=qn,Vn.VectorTileSource=Qn,Vn.VideoSource=Ar,Vn.setRTLTextPlugin=a.bj,Vn.getRTLTextPluginStatus=a.bk,Vn.prewarm=function(){Ha().acquire(En)},Vn.clearPrewarmedResources=function(){const y=ts;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(En),ts=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()"))},Qp.extend(Vn,{isSafari:a.ac,getPerformanceMetrics:a.bg.getPerformanceMetrics}),Vn});var p=r;return p})})(Jb);var dg=Jb.exports;const Ls=Yb(dg);function zv(e){let t;return n=>{if(n)for(let i in n){let r=t==null?void 0:t[i],u=n[i];r!==u&&e(i,u,r)}else if(t)for(let i in t)e(i,void 0,t[i]);t=n}}function uE(e,...t){let n=[e];for(let i of t)if(i)Array.isArray(i)&&i[0]===e?n.push(...i.slice(1)):n.push(i);else continue;if(n.length!==1)return n.length===2?n[1]:n}function cE(e){return e===!0?["has","point_count"]:e===!1?["!",["has","point_count"]]:void 0}function ny(e,t){return["case",["boolean",["feature-state","hover"],!1],t,e]}var Hm=hE;function hE(e){var t,n,i;if(e){if(Array.isArray(e)){for(t=[],n=e.length,i=0;i{i=null}),Ri())},i(r){n||(Et(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&Dt(t),i&&i.d(r)}}}function fE(e,t,n){let i,r,u,p,a,_,x,S,L,A,N,z,{$$slots:H={},$$scope:Z}=t,{id:K=ip("layer")}=t,{source:V=void 0}=t,{sourceLayer:X=void 0}=t,{beforeId:Q=void 0}=t,{beforeLayerType:it=void 0}=t,{type:ht}=t,{paint:ut=void 0}=t,{layout:gt=void 0}=t,{filter:at=void 0}=t,{applyToClusters:Lt=void 0}=t,{minzoom:bt=void 0}=t,{maxzoom:yt=void 0}=t,{manageHoverState:he=!1}=t,{hovered:Nt=null}=t,{interactive:Gt=!0}=t,{hoverCursor:Yt=void 0}=t,{eventsIfTopMost:we=!1}=t;const me=np(),{map:Ye,source:On,self:$e,minzoom:Ve,maxzoom:Ge,eventTopMost:mn,layerInfo:Qn}=sE();Ee(e,Ye,wt=>n(31,L=wt)),Ee(e,On,wt=>n(32,A=wt)),Ee(e,$e,wt=>n(0,S=wt)),Ee(e,Ve,wt=>n(34,z=wt)),Ee(e,Ge,wt=>n(33,N=wt)),ks(()=>{S&&L&&(Qn.delete(S),L==null||L.removeLayer(S))});let qn;function ie(wt){var nn,Ie;if(!Gt||!S||!L||we&&mn(wt)!==S)return;let Ue=wt.features??[],ze=(Ie=(nn=Ue[0])==null?void 0:nn.properties)==null?void 0:Ie.cluster_id,Wn={event:wt,map:L,clusterId:ze,layer:S,source:a,features:Ue};me(wt.type,Wn)}function De(wt){var nn,Ie;if(!Gt||!S||!L||we&&mn(wt)!==S)return;Yt&&(L.getCanvas().style.cursor=Yt);let Ue=wt.features??[];n(6,Nt=Ue[0]??null);let ze=(Ie=(nn=Ue[0])==null?void 0:nn.properties)==null?void 0:Ie.cluster_id;me("mouseenter",{event:wt,map:L,clusterId:ze,layer:S,source:a,features:Ue})}function pn(wt){var nn,Ie,An;if(!Gt||!L)return;if(we&&mn(wt)!==S){n(6,Nt=null),he&&qn!==void 0&&(L==null||L.setFeatureState({source:a,sourceLayer:X,id:qn},{hover:!1}),qn=void 0);return}L.getCanvas().style.cursor=Yt;let Ue=wt.features??[],ze=(Ie=(nn=Ue[0])==null?void 0:nn.properties)==null?void 0:Ie.cluster_id,Wn=(An=Ue[0])==null?void 0:An.id;Wn!==qn&&(he&&(qn!==void 0&&(L==null||L.setFeatureState({source:a,id:qn,sourceLayer:X},{hover:!1})),L==null||L.setFeatureState({source:a,id:Wn,sourceLayer:X},{hover:!0})),qn=Wn,n(6,Nt=Ue[0]??null)),me("mousemove",{event:wt,map:L,clusterId:ze,layer:S,source:a,features:Ue})}function Zn(wt){if(!(!Gt||!S||!L)){if(Yt&&(L.getCanvas().style.cursor=""),n(6,Nt=null),he&&qn!==void 0){const Ue={source:a,id:qn,sourceLayer:X};L==null||L.setFeatureState(Ue,{hover:!1}),qn=void 0}me("mouseleave",{map:L,layer:S,source:a})}}let Ar=!0;function mi(wt){L&&(L.off("click",wt,ie),L.off("dblclick",wt,ie),L.off("contextmenu",wt,ie),L.off("mouseenter",wt,De),L.off("mousemove",wt,pn),L.off("mouseleave",wt,Zn))}return ks(()=>{L&&S&&mi(S)}),e.$$set=wt=>{"id"in wt&&n(7,K=wt.id),"source"in wt&&n(8,V=wt.source),"sourceLayer"in wt&&n(9,X=wt.sourceLayer),"beforeId"in wt&&n(10,Q=wt.beforeId),"beforeLayerType"in wt&&n(11,it=wt.beforeLayerType),"type"in wt&&n(12,ht=wt.type),"paint"in wt&&n(13,ut=wt.paint),"layout"in wt&&n(14,gt=wt.layout),"filter"in wt&&n(15,at=wt.filter),"applyToClusters"in wt&&n(16,Lt=wt.applyToClusters),"minzoom"in wt&&n(17,bt=wt.minzoom),"maxzoom"in wt&&n(18,yt=wt.maxzoom),"manageHoverState"in wt&&n(19,he=wt.manageHoverState),"hovered"in wt&&n(6,Nt=wt.hovered),"interactive"in wt&&n(20,Gt=wt.interactive),"hoverCursor"in wt&&n(21,Yt=wt.hoverCursor),"eventsIfTopMost"in wt&&n(22,we=wt.eventsIfTopMost),"$$scope"in wt&&n(35,Z=wt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&65536&&n(30,i=cE(Lt)),e.$$.dirty[0]&1073774592&&n(24,r=uE("all",i,at)),e.$$.dirty[0]&131072|e.$$.dirty[1]&8&&n(26,u=bt??z),e.$$.dirty[0]&262144|e.$$.dirty[1]&4&&n(25,p=yt??N),e.$$.dirty[0]&256|e.$$.dirty[1]&2&&n(29,a=V||A),e.$$.dirty[0]&654343809|e.$$.dirty[1]&1&&L&&S!==K&&a){S&&(mi(S),Qn.delete(S));let wt=Q;if(!Q&&it){let Ue=L.getStyle().layers,ze=typeof it=="function"?it:nn=>nn.type===it,Wn=Ue==null?void 0:Ue.find(ze);Wn&&(wt=Wn.id)}sn($e,S=K,S),L.addLayer(Hm({id:S,type:ht,source:a,"source-layer":X,filter:r,paint:ut,layout:gt,minzoom:u,maxzoom:p}),wt),n(23,Ar=!0),L.on("click",S,ie),L.on("dblclick",S,ie),L.on("contextmenu",S,ie),L.on("mouseenter",S,De),L.on("mousemove",S,pn),L.on("mouseleave",S,Zn)}e.$$.dirty[0]&1048577&&S&&Qn.set(S,{interactive:Gt}),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(28,_=S?zv((wt,Ue)=>L==null?void 0:L.setPaintProperty(S,wt,Ue)):void 0),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(27,x=S?zv((wt,Ue)=>L==null?void 0:L.setLayoutProperty(S,wt,Ue)):void 0),e.$$.dirty[0]&268443648&&(_==null||_(ut)),e.$$.dirty[0]&134234112&&(x==null||x(gt)),e.$$.dirty[0]&100663297|e.$$.dirty[1]&1&&S&&(L==null||L.setLayerZoomRange(S,u,p)),e.$$.dirty[0]&25165825|e.$$.dirty[1]&1&&S&&(Ar?n(23,Ar=!1):L==null||L.setFilter(S,r))},[S,Ye,On,$e,Ve,Ge,Nt,K,V,X,Q,it,ht,ut,gt,at,Lt,bt,yt,he,Gt,Yt,we,Ar,r,p,u,x,_,a,i,L,A,N,z,Z,H]}class mg extends cn{constructor(t){super(),un(this,t,fE,pE,en,{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 dE(e){let t;const n=e[16].default,i=mr(n,e,e[24],null);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u&16777216)&&_r(i,n,r,r[24],t?gr(n,r[24],u,null):yr(r[24]),null)},i(r){t||(Et(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function mE(e){let t,n,i;function r(p){e[17](p)}let u={id:e[1],type:"circle",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[dE]},$$scope:{ctx:e}};return e[0]!==void 0&&(u.hovered=e[0]),t=new mg({props:u}),tr.push(()=>Ru(t,"hovered",r)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){te(t.$$.fragment)},m(p,a){Qt(t,p,a),i=!0},p(p,[a]){const _={};a&2&&(_.id=p[1]),a&4&&(_.source=p[2]),a&8&&(_.sourceLayer=p[3]),a&16&&(_.beforeId=p[4]),a&32&&(_.beforeLayerType=p[5]),a&64&&(_.paint=p[6]),a&128&&(_.layout=p[7]),a&256&&(_.filter=p[8]),a&512&&(_.applyToClusters=p[9]),a&1024&&(_.minzoom=p[10]),a&2048&&(_.maxzoom=p[11]),a&4096&&(_.hoverCursor=p[12]),a&8192&&(_.manageHoverState=p[13]),a&16384&&(_.eventsIfTopMost=p[14]),a&32768&&(_.interactive=p[15]),a&16777216&&(_.$$scope={dirty:a,ctx:p}),!n&&a&1&&(n=!0,_.hovered=p[0],Du(()=>n=!1)),t.$set(_)},i(p){i||(Et(t.$$.fragment,p),i=!0)},o(p){Pt(t.$$.fragment,p),i=!1},d(p){$t(t,p)}}}function gE(e,t,n){let{$$slots:i={},$$scope:r}=t,{id:u=ip("circle")}=t,{source:p=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:_=void 0}=t,{beforeLayerType:x=void 0}=t,{paint:S}=t,{layout:L=void 0}=t,{filter:A=void 0}=t,{applyToClusters:N=void 0}=t,{minzoom:z=void 0}=t,{maxzoom:H=void 0}=t,{hoverCursor:Z=void 0}=t,{manageHoverState:K=!1}=t,{hovered:V=null}=t,{eventsIfTopMost:X=!1}=t,{interactive:Q=!0}=t;function it(yt){V=yt,n(0,V)}function ht(yt){li.call(this,e,yt)}function ut(yt){li.call(this,e,yt)}function gt(yt){li.call(this,e,yt)}function at(yt){li.call(this,e,yt)}function Lt(yt){li.call(this,e,yt)}function bt(yt){li.call(this,e,yt)}return e.$$set=yt=>{"id"in yt&&n(1,u=yt.id),"source"in yt&&n(2,p=yt.source),"sourceLayer"in yt&&n(3,a=yt.sourceLayer),"beforeId"in yt&&n(4,_=yt.beforeId),"beforeLayerType"in yt&&n(5,x=yt.beforeLayerType),"paint"in yt&&n(6,S=yt.paint),"layout"in yt&&n(7,L=yt.layout),"filter"in yt&&n(8,A=yt.filter),"applyToClusters"in yt&&n(9,N=yt.applyToClusters),"minzoom"in yt&&n(10,z=yt.minzoom),"maxzoom"in yt&&n(11,H=yt.maxzoom),"hoverCursor"in yt&&n(12,Z=yt.hoverCursor),"manageHoverState"in yt&&n(13,K=yt.manageHoverState),"hovered"in yt&&n(0,V=yt.hovered),"eventsIfTopMost"in yt&&n(14,X=yt.eventsIfTopMost),"interactive"in yt&&n(15,Q=yt.interactive),"$$scope"in yt&&n(24,r=yt.$$scope)},[V,u,p,a,_,x,S,L,A,N,z,H,Z,K,X,Q,i,it,ht,ut,gt,at,Lt,bt,r]}class hd extends cn{constructor(t){super(),un(this,t,gE,mE,en,{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 _E(e){let t;const n=e[15].default,i=mr(n,e,e[23],null);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u&8388608)&&_r(i,n,r,r[23],t?gr(n,r[23],u,null):yr(r[23]),null)},i(r){t||(Et(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function yE(e){let t,n,i;function r(p){e[16](p)}let u={id:e[1],type:"fill",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[_E]},$$scope:{ctx:e}};return e[0]!==void 0&&(u.hovered=e[0]),t=new mg({props:u}),tr.push(()=>Ru(t,"hovered",r)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){te(t.$$.fragment)},m(p,a){Qt(t,p,a),i=!0},p(p,[a]){const _={};a&2&&(_.id=p[1]),a&4&&(_.source=p[2]),a&8&&(_.sourceLayer=p[3]),a&16&&(_.beforeId=p[4]),a&32&&(_.beforeLayerType=p[5]),a&64&&(_.paint=p[6]),a&128&&(_.layout=p[7]),a&256&&(_.filter=p[8]),a&512&&(_.minzoom=p[9]),a&1024&&(_.maxzoom=p[10]),a&2048&&(_.hoverCursor=p[11]),a&4096&&(_.manageHoverState=p[12]),a&8192&&(_.eventsIfTopMost=p[13]),a&16384&&(_.interactive=p[14]),a&8388608&&(_.$$scope={dirty:a,ctx:p}),!n&&a&1&&(n=!0,_.hovered=p[0],Du(()=>n=!1)),t.$set(_)},i(p){i||(Et(t.$$.fragment,p),i=!0)},o(p){Pt(t.$$.fragment,p),i=!1},d(p){$t(t,p)}}}function vE(e,t,n){let{$$slots:i={},$$scope:r}=t,{id:u=ip("fill")}=t,{source:p=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:_=void 0}=t,{beforeLayerType:x=void 0}=t,{paint:S}=t,{layout:L=void 0}=t,{filter:A=void 0}=t,{minzoom:N=void 0}=t,{maxzoom:z=void 0}=t,{hoverCursor:H=void 0}=t,{manageHoverState:Z=!1}=t,{hovered:K=null}=t,{eventsIfTopMost:V=!1}=t,{interactive:X=!0}=t;function Q(bt){K=bt,n(0,K)}function it(bt){li.call(this,e,bt)}function ht(bt){li.call(this,e,bt)}function ut(bt){li.call(this,e,bt)}function gt(bt){li.call(this,e,bt)}function at(bt){li.call(this,e,bt)}function Lt(bt){li.call(this,e,bt)}return e.$$set=bt=>{"id"in bt&&n(1,u=bt.id),"source"in bt&&n(2,p=bt.source),"sourceLayer"in bt&&n(3,a=bt.sourceLayer),"beforeId"in bt&&n(4,_=bt.beforeId),"beforeLayerType"in bt&&n(5,x=bt.beforeLayerType),"paint"in bt&&n(6,S=bt.paint),"layout"in bt&&n(7,L=bt.layout),"filter"in bt&&n(8,A=bt.filter),"minzoom"in bt&&n(9,N=bt.minzoom),"maxzoom"in bt&&n(10,z=bt.maxzoom),"hoverCursor"in bt&&n(11,H=bt.hoverCursor),"manageHoverState"in bt&&n(12,Z=bt.manageHoverState),"hovered"in bt&&n(0,K=bt.hovered),"eventsIfTopMost"in bt&&n(13,V=bt.eventsIfTopMost),"interactive"in bt&&n(14,X=bt.interactive),"$$scope"in bt&&n(23,r=bt.$$scope)},[K,u,p,a,_,x,S,L,A,N,z,H,Z,V,X,i,Q,it,ht,ut,gt,at,Lt,r]}class op extends cn{constructor(t){super(),un(this,t,vE,yE,en,{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 bE(e,t,n){let i;const{map:r}=rp();Ee(e,r,_=>n(4,i=_));let{position:u="top-left"}=t,{container:p=void 0}=t,a=null;return ks(()=>{i!=null&&i.loaded()&&a&&i.removeControl(a)}),e.$$set=_=>{"position"in _&&n(1,u=_.position),"container"in _&&n(2,p=_.container)},e.$$.update=()=>{if(e.$$.dirty&30&&i&&!a){let _;typeof p=="string"?_=document.querySelector(p)??void 0:_=p,n(3,a=new Ls.FullscreenControl({container:_})),i.addControl(a,u)}},[r,u,p,a,i]}class xE extends cn{constructor(t){super(),un(this,t,bE,null,en,{position:1,container:2})}}function wE(e,t,n,i,r){let u=!1;e.getSource(t)&&(u=!0,e.removeSource(t));const p=()=>{i(t)&&(e.addSource(t,n),r())};if(u){const a=()=>{t&&(e.getSource(t)?setTimeout(a,1):p())};a()}else p()}function SE(e,t,n){AS().then(()=>{let i=Rb(e);if(!i)return;i.getSource(t)===n&&i.removeSource(t)})}function Vv(e){let t=e[0],n,i,r=Uv(e);return{c(){r.c(),n=ys()},m(u,p){r.m(u,p),Rt(u,n,p),i=!0},p(u,p){p&1&&en(t,t=u[0])?(Di(),Pt(r,1,1,Pe),Ri(),r=Uv(u),r.c(),Et(r,1),r.m(n.parentNode,n)):r.p(u,p)},i(u){i||(Et(r),i=!0)},o(u){Pt(r),i=!1},d(u){u&&Dt(n),r.d(u)}}}function Uv(e){let t;const n=e[15].default,i=mr(n,e,e[14],null);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u&16384)&&_r(i,n,r,r[14],t?gr(n,r[14],u,null):yr(r[14]),null)},i(r){t||(Et(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function EE(e){let t,n,i=e[0]&&Vv(e);return{c(){i&&i.c(),t=ys()},m(r,u){i&&i.m(r,u),Rt(r,t,u),n=!0},p(r,[u]){r[0]?i?(i.p(r,u),u&1&&Et(i,1)):(i=Vv(r),i.c(),Et(i,1),i.m(t.parentNode,t)):i&&(Di(),Pt(i,1,1,()=>{i=null}),Ri())},i(r){n||(Et(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&Dt(t),i&&i.d(r)}}}function IE(e,t,n){let i,r,u,{$$slots:p={},$$scope:a}=t,{id:_=ip("geojson")}=t,{data:x}=t,{generateId:S=!1}=t,{promoteId:L=void 0}=t,{filter:A=void 0}=t,{lineMetrics:N=void 0}=t,{cluster:z=void 0}=t;const{map:H,cluster:Z,self:K}=oE();Ee(e,H,Q=>n(13,r=Q)),Ee(e,Z,Q=>n(16,u=Q)),Ee(e,K,Q=>n(0,i=Q));let V,X=!0;return ks(()=>{i&&V&&r&&(SE(H,i,V),sn(K,i=null,i),n(11,V=void 0))}),e.$$set=Q=>{"id"in Q&&n(4,_=Q.id),"data"in Q&&n(5,x=Q.data),"generateId"in Q&&n(6,S=Q.generateId),"promoteId"in Q&&n(7,L=Q.promoteId),"filter"in Q&&n(8,A=Q.filter),"lineMetrics"in Q&&n(9,N=Q.lineMetrics),"cluster"in Q&&n(10,z=Q.cluster),"$$scope"in Q&&n(14,a=Q.$$scope)},e.$$.update=()=>{e.$$.dirty&1024&&sn(Z,u=z,u),e.$$.dirty&12273&&r&&i!==_&&(sn(K,i=_,i),wE(r,i,Hm({type:"geojson",data:x,filter:A,lineMetrics:N,generateId:S,promoteId:L,cluster:!!z,clusterMinPoints:z==null?void 0:z.minPoints,clusterMaxZoom:z==null?void 0:z.maxZoom,clusterRadius:z==null?void 0:z.radius,clusterProperties:z==null?void 0:z.properties}),Q=>r&&Q===i,()=>{i&&(n(11,V=r==null?void 0:r.getSource(i)),n(12,X=!0))})),e.$$.dirty&8208&&(r==null||r.on("style.load",()=>{n(11,V=r==null?void 0:r.getSource(_))})),e.$$.dirty&6176&&V&&(X?n(12,X=!1):V.setData(x)),e.$$.dirty&3072&&(V==null||V.setClusterOptions(Hm({cluster:!!z,clusterMaxZoom:z==null?void 0:z.maxZoom,clusterRadius:z==null?void 0:z.radius})))},[i,H,Z,K,_,x,S,L,A,N,z,V,X,r,a,p]}class Ms extends cn{constructor(t){super(),un(this,t,IE,EE,en,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function CE(e,t,n){let i;const{map:r}=rp();Ee(e,r,A=>n(8,i=A));let{position:u="top-left"}=t,{positionOptions:p=void 0}=t,{fitBoundsOptions:a=void 0}=t,{trackUserLocation:_=!1}=t,{showAccuracyCircle:x=!0}=t,{showUserLocation:S=!0}=t,L=null;return ks(()=>{i!=null&&i.loaded()&&L&&i.removeControl(L)}),e.$$set=A=>{"position"in A&&n(1,u=A.position),"positionOptions"in A&&n(2,p=A.positionOptions),"fitBoundsOptions"in A&&n(3,a=A.fitBoundsOptions),"trackUserLocation"in A&&n(4,_=A.trackUserLocation),"showAccuracyCircle"in A&&n(5,x=A.showAccuracyCircle),"showUserLocation"in A&&n(6,S=A.showUserLocation)},e.$$.update=()=>{e.$$.dirty&510&&i&&!L&&(n(7,L=new Ls.GeolocateControl({positionOptions:p,fitBoundsOptions:a,trackUserLocation:_,showAccuracyCircle:x,showUserLocation:S})),i.addControl(L,u))},[r,u,p,a,_,x,S,L,i]}class TE extends cn{constructor(t){super(),un(this,t,CE,null,en,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function LE(e){let t;const n=e[15].default,i=mr(n,e,e[23],null);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u&8388608)&&_r(i,n,r,r[23],t?gr(n,r[23],u,null):yr(r[23]),null)},i(r){t||(Et(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function ME(e){let t,n,i;function r(p){e[16](p)}let u={id:e[1],type:"line",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[LE]},$$scope:{ctx:e}};return e[0]!==void 0&&(u.hovered=e[0]),t=new mg({props:u}),tr.push(()=>Ru(t,"hovered",r)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){te(t.$$.fragment)},m(p,a){Qt(t,p,a),i=!0},p(p,[a]){const _={};a&2&&(_.id=p[1]),a&4&&(_.source=p[2]),a&8&&(_.sourceLayer=p[3]),a&16&&(_.beforeId=p[4]),a&32&&(_.beforeLayerType=p[5]),a&64&&(_.paint=p[6]),a&128&&(_.layout=p[7]),a&256&&(_.filter=p[8]),a&512&&(_.minzoom=p[9]),a&1024&&(_.maxzoom=p[10]),a&2048&&(_.hoverCursor=p[11]),a&4096&&(_.manageHoverState=p[12]),a&8192&&(_.eventsIfTopMost=p[13]),a&16384&&(_.interactive=p[14]),a&8388608&&(_.$$scope={dirty:a,ctx:p}),!n&&a&1&&(n=!0,_.hovered=p[0],Du(()=>n=!1)),t.$set(_)},i(p){i||(Et(t.$$.fragment,p),i=!0)},o(p){Pt(t.$$.fragment,p),i=!1},d(p){$t(t,p)}}}function PE(e,t,n){let{$$slots:i={},$$scope:r}=t,{id:u=ip("line")}=t,{source:p=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:_=void 0}=t,{beforeLayerType:x=void 0}=t,{paint:S}=t,{layout:L=void 0}=t,{filter:A=void 0}=t,{minzoom:N=void 0}=t,{maxzoom:z=void 0}=t,{hoverCursor:H=void 0}=t,{manageHoverState:Z=!1}=t,{hovered:K=null}=t,{eventsIfTopMost:V=!1}=t,{interactive:X=!0}=t;function Q(bt){K=bt,n(0,K)}function it(bt){li.call(this,e,bt)}function ht(bt){li.call(this,e,bt)}function ut(bt){li.call(this,e,bt)}function gt(bt){li.call(this,e,bt)}function at(bt){li.call(this,e,bt)}function Lt(bt){li.call(this,e,bt)}return e.$$set=bt=>{"id"in bt&&n(1,u=bt.id),"source"in bt&&n(2,p=bt.source),"sourceLayer"in bt&&n(3,a=bt.sourceLayer),"beforeId"in bt&&n(4,_=bt.beforeId),"beforeLayerType"in bt&&n(5,x=bt.beforeLayerType),"paint"in bt&&n(6,S=bt.paint),"layout"in bt&&n(7,L=bt.layout),"filter"in bt&&n(8,A=bt.filter),"minzoom"in bt&&n(9,N=bt.minzoom),"maxzoom"in bt&&n(10,z=bt.maxzoom),"hoverCursor"in bt&&n(11,H=bt.hoverCursor),"manageHoverState"in bt&&n(12,Z=bt.manageHoverState),"hovered"in bt&&n(0,K=bt.hovered),"eventsIfTopMost"in bt&&n(13,V=bt.eventsIfTopMost),"interactive"in bt&&n(14,X=bt.interactive),"$$scope"in bt&&n(23,r=bt.$$scope)},[K,u,p,a,_,x,S,L,A,N,z,H,Z,V,X,i,Q,it,ht,ut,gt,at,Lt,r]}class ru extends cn{constructor(t){super(),un(this,t,PE,ME,en,{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 AE(e){let t=e.getCenter(),n=Math.round(e.getZoom()*100)/100,i=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),r=Math.pow(10,i),u=Math.round(t.lat*r)/r,p=Math.round(t.lng*r)/r,a=`${n}/${u}/${p}`,_=e.getBearing(),x=e.getPitch();return(_||x)&&(a+=`/${Math.round(_*10)/10}`),x&&(a+=`/${Math.round(x)}`),`#${a}`}function kE(e){return e.replace("#","").split("/").map(parseFloat)}var Pm=Ty;function Ty(e,t){return e===t||e!==e&&t!==t?!0:typeof e!=typeof t||{}.toString.call(e)!={}.toString.call(t)||e!==Object(e)||!e?!1:Array.isArray(e)?Gv(e,t):{}.toString.call(e)=="[object Set]"?Gv(Array.from(e),Array.from(t)):{}.toString.call(e)=="[object Object]"?DE(e,t):NE(e,t)}function NE(e,t){return e.toString()===t.toString()}function Gv(e,t){var n=e.length;if(n!=t.length)return!1;for(var i=0;in(6,i=S));let{position:u="top-left"}=t,{showCompass:p=!0}=t,{showZoom:a=!0}=t,{visualizePitch:_=!1}=t,x=null;return ks(()=>{i!=null&&i.loaded()&&x&&i.removeControl(x)}),e.$$set=S=>{"position"in S&&n(1,u=S.position),"showCompass"in S&&n(2,p=S.showCompass),"showZoom"in S&&n(3,a=S.showZoom),"visualizePitch"in S&&n(4,_=S.visualizePitch)},e.$$.update=()=>{e.$$.dirty&126&&i&&!x&&(n(5,x=new Ls.NavigationControl({showCompass:p,showZoom:a,visualizePitch:_})),i.addControl(x,u))},[r,u,p,a,_,x,i]}class OE extends cn{constructor(t){super(),un(this,t,RE,null,en,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function zE(e,t,n){let i;const{map:r}=rp();Ee(e,r,x=>n(5,i=x));let{position:u="bottom-left"}=t,{maxWidth:p=void 0}=t,{unit:a="metric"}=t,_=null;return ks(()=>{i!=null&&i.loaded()&&_&&i.removeControl(_)}),e.$$set=x=>{"position"in x&&n(1,u=x.position),"maxWidth"in x&&n(2,p=x.maxWidth),"unit"in x&&n(3,a=x.unit)},e.$$.update=()=>{e.$$.dirty&62&&i&&!_&&(n(4,_=new Ls.ScaleControl({maxWidth:p,unit:a})),i.addControl(_,u))},[r,u,p,a,_,i]}class FE extends cn{constructor(t){super(),un(this,t,zE,null,en,{position:1,maxWidth:2,unit:3})}}const BE=e=>({map:e[0]&8,loadedImages:e[0]&16,allImagesLoaded:e[0]&32}),jv=e=>({map:e[3],loadedImages:e[4],allImagesLoaded:e[5]});function qv(e){let t,n,i=e[2]&&Zv(e);const r=e[34].default,u=mr(r,e,e[33],jv);return{c(){i&&i.c(),t=Jt(),u&&u.c()},m(p,a){i&&i.m(p,a),Rt(p,t,a),u&&u.m(p,a),n=!0},p(p,a){p[2]?i?(i.p(p,a),a[0]&4&&Et(i,1)):(i=Zv(p),i.c(),Et(i,1),i.m(t.parentNode,t)):i&&(Di(),Pt(i,1,1,()=>{i=null}),Ri()),u&&u.p&&(!n||a[0]&56|a[1]&4)&&_r(u,r,p,p[33],n?gr(r,p[33],a,BE):yr(p[33]),jv)},i(p){n||(Et(i),Et(u,p),n=!0)},o(p){Pt(i),Pt(u,p),n=!1},d(p){p&&Dt(t),i&&i.d(p),u&&u.d(p)}}}function Zv(e){let t,n,i,r,u,p,a,_;return t=new OE({props:{position:e[6]}}),i=new TE({props:{position:e[6],fitBoundsOptions:{maxZoom:12}}}),u=new xE({props:{position:e[6]}}),a=new FE({props:{position:e[6]}}),{c(){te(t.$$.fragment),n=Jt(),te(i.$$.fragment),r=Jt(),te(u.$$.fragment),p=Jt(),te(a.$$.fragment)},m(x,S){Qt(t,x,S),Rt(x,n,S),Qt(i,x,S),Rt(x,r,S),Qt(u,x,S),Rt(x,p,S),Qt(a,x,S),_=!0},p(x,S){const L={};S[0]&64&&(L.position=x[6]),t.$set(L);const A={};S[0]&64&&(A.position=x[6]),i.$set(A);const N={};S[0]&64&&(N.position=x[6]),u.$set(N);const z={};S[0]&64&&(z.position=x[6]),a.$set(z)},i(x){_||(Et(t.$$.fragment,x),Et(i.$$.fragment,x),Et(u.$$.fragment,x),Et(a.$$.fragment,x),_=!0)},o(x){Pt(t.$$.fragment,x),Pt(i.$$.fragment,x),Pt(u.$$.fragment,x),Pt(a.$$.fragment,x),_=!1},d(x){x&&(Dt(n),Dt(r),Dt(p)),$t(t,x),$t(i,x),$t(u,x),$t(a,x)}}}function VE(e){let t,n,i,r,u,p=e[3]&&e[0]&&qv(e);return{c(){t=vt("div"),p&&p.c(),kt(t,"class",n=Zm(e[1])+" svelte-p00lfq"),cl(t,"expand-map",!e[1])},m(a,_){Rt(a,t,_),p&&p.m(t,null),i=!0,r||(u=J_(e[9].call(null,t)),r=!0)},p(a,_){a[3]&&a[0]?p?(p.p(a,_),_[0]&9&&Et(p,1)):(p=qv(a),p.c(),Et(p,1),p.m(t,null)):p&&(Di(),Pt(p,1,1,()=>{p=null}),Ri()),(!i||_[0]&2&&n!==(n=Zm(a[1])+" svelte-p00lfq"))&&kt(t,"class",n),(!i||_[0]&2)&&cl(t,"expand-map",!a[1])},i(a){i||(Et(p),i=!0)},o(a){Pt(p),i=!1},d(a){a&&Dt(t),p&&p.d(),r=!1,u()}}}function UE(e,t,n){let i,r,u,p,{$$slots:a={},$$scope:_}=t,{map:x=null}=t,{class:S=void 0}=t,{style:L}=t,{diffStyleUpdates:A=!1}=t,{center:N=void 0}=t,{zoom:z=void 0}=t,{pitch:H=0}=t,{bearing:Z=0}=t,{bounds:K=void 0}=t,{hash:V=!1}=t,{loaded:X=!1}=t,{minZoom:Q=0}=t,{maxZoom:it=22}=t,{zoomOnDoubleClick:ht=!0}=t,{interactive:ut=!0}=t,{attributionControl:gt=!0}=t,{cooperativeGestures:at=!1}=t,{preserveDrawingBuffer:Lt=!1}=t,{maxBounds:bt=void 0}=t,{images:yt=[]}=t,{standardControls:he=!1}=t,{filterLayers:Nt=void 0}=t,{transformRequest:Gt=void 0}=t;const Yt=np(),{map:we,loadedImages:me}=rE();Ee(e,we,ie=>n(3,u=ie)),Ee(e,me,ie=>n(4,p=ie));let Ye=new Set;function On(ie){u!=null&&u.loaded()&&("url"in ie?(Ye.add(ie.id),u.loadImage(ie.url,(De,pn)=>{Ye.delete(ie.id),De?Yt("error",De):pn&&(u==null||u.addImage(ie.id,pn,ie.options),p.add(ie.id),me.set(p))})):(u.addImage(ie.id,ie.data,ie.options),p.add(ie.id),me.set(p)))}let $e,Ve,Ge,mn;function Qn(ie){if(V){let De=kE(window.location.hash);De.length>=3&&(n(11,z=De[0]),n(10,N=[De[2],De[1]])),De.length==5&&(n(15,Z=De[3]),n(14,H=De[4]))}return sn(we,u=new Ls.Map(Hm({container:ie,style:L,center:N,zoom:z,pitch:H,bearing:Z,minZoom:Q,maxZoom:it,interactive:ut,preserveDrawingBuffer:Lt,maxBounds:bt,bounds:K,attributionControl:gt,transformRequest:Gt,cooperativeGestures:at})),u),u.on("load",De=>{n(0,X=!0),Yt("load",u)}),u.on("error",De=>Yt("error",{...De,map:u})),u.on("movestart",De=>Yt("movestart",{...De,map:u})),u.on("moveend",De=>{if(n(10,N=De.target.getCenter()),n(11,z=De.target.getZoom()),n(12,K=De.target.getBounds()),Yt("moveend",{...De,map:u}),V){let pn=window.location.href.replace(/(#.+)?$/,AE(u));window.history.replaceState(window.history.state,"",pn)}}),u.on("zoomstart",De=>Yt("zoomstart",{...De,map:u})),u.on("zoom",De=>{n(11,z=De.target.getZoom()),Yt("zoom",{...De,map:u})}),u.on("zoomend",De=>{n(11,z=De.target.getZoom()),Yt("zoomend",{...De,map:u})}),u.on("style.load",()=>{if(u){const De=u.getStyle();if(n(30,$e=De.layers.map(pn=>pn.id)),n(31,Ve=Object.keys(De.sources)),mn)for(const[pn,Zn]of Object.entries(mn))u.addSource(pn,Zn);if(Ge)for(const pn of Ge)u.addLayer(pn)}}),u.on("styledata",De=>{if(u&&Nt){const pn=u.getStyle().layers;if(pn)for(let Zn of pn)Nt(Zn)||u.setLayoutProperty(Zn.id,"visibility","none")}Yt("styledata",{...De,map:u})}),{destroy(){n(0,X=!1),u==null||u.remove(),sn(we,u=null,u)}}}let qn=L;return e.$$set=ie=>{"map"in ie&&n(13,x=ie.map),"class"in ie&&n(1,S=ie.class),"style"in ie&&n(16,L=ie.style),"diffStyleUpdates"in ie&&n(17,A=ie.diffStyleUpdates),"center"in ie&&n(10,N=ie.center),"zoom"in ie&&n(11,z=ie.zoom),"pitch"in ie&&n(14,H=ie.pitch),"bearing"in ie&&n(15,Z=ie.bearing),"bounds"in ie&&n(12,K=ie.bounds),"hash"in ie&&n(18,V=ie.hash),"loaded"in ie&&n(0,X=ie.loaded),"minZoom"in ie&&n(19,Q=ie.minZoom),"maxZoom"in ie&&n(20,it=ie.maxZoom),"zoomOnDoubleClick"in ie&&n(21,ht=ie.zoomOnDoubleClick),"interactive"in ie&&n(22,ut=ie.interactive),"attributionControl"in ie&&n(23,gt=ie.attributionControl),"cooperativeGestures"in ie&&n(24,at=ie.cooperativeGestures),"preserveDrawingBuffer"in ie&&n(25,Lt=ie.preserveDrawingBuffer),"maxBounds"in ie&&n(26,bt=ie.maxBounds),"images"in ie&&n(27,yt=ie.images),"standardControls"in ie&&n(2,he=ie.standardControls),"filterLayers"in ie&&n(28,Nt=ie.filterLayers),"transformRequest"in ie&&n(29,Gt=ie.transformRequest),"$$scope"in ie&&n(33,_=ie.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&4&&n(6,i=typeof he=="boolean"?void 0:he),e.$$.dirty[0]&8&&n(13,x=u),e.$$.dirty[0]&134217737&&X&&u!=null&&u.loaded())for(let ie of yt)!Ye.has(ie.id)&&!u.hasImage(ie.id)&&On(ie);if(e.$$.dirty[0]&134217744&&n(5,r=yt.every(ie=>p.has(ie.id))),e.$$.dirty[0]&1073938440|e.$$.dirty[1]&3&&u&&!Pm(L,qn)){const ie=u.getStyle();if($e&&(Ge=ie.layers.filter(De=>!$e.includes(De.id))),Ve){const De=Object.keys(ie.sources).filter(pn=>!Ve.includes(pn));mn={};for(const pn of De)mn[pn]=ie.sources[pn]}n(32,qn=L),u.setStyle(L,{diff:A})}e.$$.dirty[0]&1032&&N&&!Pm(N,u==null?void 0:u.getCenter())&&(u==null||u.panTo(N)),e.$$.dirty[0]&2056&&z&&!Pm(z,u==null?void 0:u.getZoom())&&(u==null||u.zoomTo(z)),e.$$.dirty[0]&4104&&K&&!Pm(K,u==null?void 0:u.getBounds())&&(u==null||u.fitBounds(K)),e.$$.dirty[0]&2097160&&(ht?u==null||u.doubleClickZoom.enable():u==null||u.doubleClickZoom.disable())},[X,S,he,u,p,r,i,we,me,Qn,N,z,K,x,H,Z,L,A,V,Q,it,ht,ut,gt,at,Lt,bt,yt,Nt,Gt,$e,Ve,qn,_,a]}class GE extends cn{constructor(t){super(),un(this,t,UE,VE,en,{map:13,class:1,style:16,diffStyleUpdates:17,center:10,zoom:11,pitch:14,bearing:15,bounds:12,hash:18,loaded:0,minZoom:19,maxZoom:20,zoomOnDoubleClick:21,interactive:22,attributionControl:23,cooperativeGestures:24,preserveDrawingBuffer:25,maxBounds:26,images:27,standardControls:2,filterLayers:28,transformRequest:29},null,[-1,-1])}}function jE(e){let t,n,i,r,u,p,a;const _=e[17].default,x=mr(_,e,e[16],null);return{c(){t=vt("div"),x&&x.c(),kt(t,"tabindex",n=e[1]?0:void 0),kt(t,"role",i=e[1]?"button":void 0),Qi(t,"z-index",e[2])},m(S,L){Rt(S,t,L),x&&x.m(t,null),u=!0,p||(a=[J_(e[6].call(null,t)),J_(r=qE.call(null,t,e[0])),be(t,"click",e[18]),be(t,"dblclick",e[19]),be(t,"contextmenu",e[20]),be(t,"mouseenter",e[21]),be(t,"mouseleave",e[22]),be(t,"mousemove",e[23]),be(t,"keydown",e[7])],p=!0)},p(S,[L]){x&&x.p&&(!u||L&65536)&&_r(x,_,S,S[16],u?gr(_,S[16],L,null):yr(S[16]),null),(!u||L&2&&n!==(n=S[1]?0:void 0))&&kt(t,"tabindex",n),(!u||L&2&&i!==(i=S[1]?"button":void 0))&&kt(t,"role",i),r&&fg(r.update)&&L&1&&r.update.call(null,S[0]),L&4&&Qi(t,"z-index",S[2])},i(S){u||(Et(x,S),u=!0)},o(S){Pt(x,S),u=!1},d(S){S&&Dt(t),x&&x.d(S),p=!1,or(a)}}}function qE(e,t){const n=e.className;function i(r){r?e.className=`${n} ${r}`:e.className=n}return i(t),{update:i}}function ZE(e,t,n){let i,r,u,{$$slots:p={},$$scope:a}=t,{lngLat:_}=t,{class:x=void 0}=t,{interactive:S=!0}=t,{asButton:L=!1}=t,{draggable:A=!1}=t,{feature:N=null}=t,{offset:z=void 0}=t,{zIndex:H=void 0}=t,{rotation:Z=0}=t;const K=np(),{map:V,layerEvent:X,self:Q}=aE();Ee(e,V,Gt=>n(25,u=Gt)),Ee(e,X,Gt=>n(24,i=Gt)),Ee(e,Q,Gt=>n(15,r=Gt));function it(Gt){sn(Q,r=new Ls.Marker({element:Gt,rotation:Z,draggable:A,offset:z}).setLngLat(_).addTo(u),r);const Yt=()=>gt("dragstart"),we=()=>{ht(),gt("drag")},me=()=>{ht(),gt("dragend")};return A&&(r.on("dragstart",Yt),r.on("drag",we),r.on("dragend",me)),{destroy(){A&&(r==null||r.off("dragstart",Yt),r==null||r.off("drag",we),r==null||r.off("dragend",me)),r==null||r.remove()}}}function ht(){let Gt=r==null?void 0:r.getLngLat();Gt&&(Array.isArray(_)?n(9,_=[Gt.lng,Gt.lat]):_&&"lon"in _?n(9,_={lon:Gt.lng,lat:Gt.lat}):n(9,_=Gt))}function ut(Gt){Gt.key===" "&&(Gt.preventDefault(),Gt.stopPropagation(),gt("click"))}function gt(Gt){if(!S)return;let Yt=r==null?void 0:r.getLngLat();if(!Yt)return;const we=[Yt.lng,Yt.lat];let me={map:u,marker:r,lngLat:we,features:[{type:"Feature",properties:(N==null?void 0:N.properties)??{},geometry:{type:"Point",coordinates:we}}]};sn(X,i={...me,layerType:"marker",type:Gt},i),K(Gt,me)}const at=()=>gt("click"),Lt=()=>gt("dblclick"),bt=()=>gt("contextmenu"),yt=Gt=>{gt("mouseenter")},he=()=>{gt("mouseleave")},Nt=()=>gt("mousemove");return e.$$set=Gt=>{"lngLat"in Gt&&n(9,_=Gt.lngLat),"class"in Gt&&n(0,x=Gt.class),"interactive"in Gt&&n(10,S=Gt.interactive),"asButton"in Gt&&n(1,L=Gt.asButton),"draggable"in Gt&&n(11,A=Gt.draggable),"feature"in Gt&&n(12,N=Gt.feature),"offset"in Gt&&n(13,z=Gt.offset),"zIndex"in Gt&&n(2,H=Gt.zIndex),"rotation"in Gt&&n(14,Z=Gt.rotation),"$$scope"in Gt&&n(16,a=Gt.$$scope)},e.$$.update=()=>{e.$$.dirty&33280&&(r==null||r.setLngLat(_)),e.$$.dirty&40960&&(r==null||r.setOffset(z??[0,0])),e.$$.dirty&49152&&(r==null||r.setRotation(Z))},[x,L,H,V,X,Q,it,ut,gt,_,S,A,N,z,Z,r,a,p,at,Lt,bt,yt,he,Nt]}class Wv extends cn{constructor(t){super(),un(this,t,ZE,jE,en,{lngLat:9,class:0,interactive:10,asButton:1,draggable:11,feature:12,offset:13,zIndex:2,rotation:14})}}const WE=e=>({features:e[0]&16,data:e[0]&16,map:e[0]&4,close:e[0]&1}),Xv=e=>{var t;return{features:e[4],data:(t=e[4])==null?void 0:t[0],map:e[2],close:e[31]}};function Hv(e){let t,n,i=(e[4]||e[3]instanceof Ls.Marker)&&Yv(e);return{c(){t=vt("div"),i&&i.c()},m(r,u){Rt(r,t,u),i&&i.m(t,null),e[32](t),n=!0},p(r,u){r[4]||r[3]instanceof Ls.Marker?i?(i.p(r,u),u[0]&24&&Et(i,1)):(i=Yv(r),i.c(),Et(i,1),i.m(t,null)):i&&(Di(),Pt(i,1,1,()=>{i=null}),Ri())},i(r){n||(Et(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&Dt(t),i&&i.d(),e[32](null)}}}function Yv(e){let t;const n=e[30].default,i=mr(n,e,e[29],Xv);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u[0]&536870933)&&_r(i,n,r,r[29],t?gr(n,r[29],u,WE):yr(r[29]),Xv)},i(r){t||(Et(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function XE(e){let t,n,i=e[9].default&&Hv(e);return{c(){i&&i.c(),t=ys()},m(r,u){i&&i.m(r,u),Rt(r,t,u),n=!0},p(r,u){r[9].default?i?(i.p(r,u),u[0]&512&&Et(i,1)):(i=Hv(r),i.c(),Et(i,1),i.m(t.parentNode,t)):i&&(Di(),Pt(i,1,1,()=>{i=null}),Ri())},i(r){n||(Et(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&Dt(t),i&&i.d(r)}}}function HE(e,t,n){let i,r,u,p,a,_,{$$slots:x={},$$scope:S}=t;const L=IS(x);let{closeButton:A=void 0}=t,{closeOnClickOutside:N=!0}=t,{closeOnClickInside:z=!1}=t,{closeOnMove:H=!1}=t,{openOn:Z="click"}=t,{openIfTopMost:K=!0}=t,{focusAfterOpen:V=!0}=t,{anchor:X=void 0}=t,{offset:Q=void 0}=t,{popupClass:it=void 0}=t,{maxWidth:ht=void 0}=t,{lngLat:ut=void 0}=t,{html:gt=void 0}=t,{open:at=!1}=t;const{map:Lt,popupTarget:bt,layerEvent:yt,layer:he,eventTopMost:Nt}=rp();Ee(e,Lt,wt=>n(2,u=wt)),Ee(e,bt,wt=>n(3,a=wt)),Ee(e,yt,wt=>n(28,p=wt)),Ee(e,he,wt=>n(35,_=wt));const Gt=["click","dblclick","contextmenu"];let Yt,we=!1,me;function Ye(){if(!Yt)return;let wt=Yt.getElement();!wt||wt===me||(me=wt,Z==="hover"&&(me.style.pointerEvents="none"),me.addEventListener("mouseenter",()=>{n(24,we=!0)},{passive:!0}),me.addEventListener("mouseleave",()=>{n(24,we=!1)},{passive:!0}),me.addEventListener("click",()=>{z&&n(0,at=!1)},{passive:!0}))}cd(()=>{if(u)return u.on("click",pn),u.on("contextmenu",pn),typeof a=="string"&&(u.on("click",a,Ge),u.on("dblclick",a,Ge),u.on("contextmenu",a,Ge),u.on("mousemove",a,De),u.on("mouseleave",a,ie),u.on("touchstart",a,Qn),u.on("touchend",a,qn)),()=>{u!=null&&u.loaded()&&(Yt==null||Yt.remove(),u.off("click",pn),u.off("contextmenu",pn),a instanceof Ls.Marker?a.getPopup()===Yt&&a.setPopup(void 0):typeof a=="string"&&(u.off("click",a,Ge),u.off("dblclick",a,Ge),u.off("contextmenu",a,Ge),u.off("mousemove",a,De),u.off("mouseleave",a,ie),u.off("touchstart",a,Qn),u.off("touchend",a,qn)))}});function On(wt){return K?!("marker"in wt)&&!lE(wt)&&Nt(wt)!==_:!1}let $e=null,Ve="normal";function Ge(wt){wt.type===Z&&(On(wt)||("layerType"in wt?wt.layerType==="deckgl"?(n(10,ut=wt.coordinate),n(4,$e=wt.object?[wt.object]:null)):(n(10,ut=wt.lngLat),n(4,$e=wt.features??[])):(n(10,ut=wt.lngLat),n(4,$e=wt.features??[])),setTimeout(()=>n(0,at=!0))))}let mn=null;function Qn(wt){mn=wt.point}function qn(wt){if(!mn||Z!=="hover")return;let Ue=mn.dist(wt.point);mn=null,Ue<3&&(n(10,ut=wt.lngLat),n(4,$e=wt.features??[]),Yt.isOpen()?n(25,Ve="justOpened"):(n(25,Ve="opening"),n(0,at=!0)))}function ie(wt){Z!=="hover"||mn||Ve!=="normal"||(n(0,at=!1),n(4,$e=null))}function De(wt){if(!(Z!=="hover"||mn||Ve!=="normal")){if(On(wt)){n(0,at=!1),n(4,$e=null);return}n(0,at=!0),n(4,$e=wt.features??[]),n(10,ut=wt.lngLat)}}function pn(wt){if(Ve==="justOpened"){n(25,Ve="normal");return}if(!N)return;let Ue=[me,a instanceof Ls.Marker?a==null?void 0:a.getElement():null];at&&Yt.isOpen()&&!Ue.some(ze=>ze==null?void 0:ze.contains(wt.originalEvent.target))&&(wt.type==="contextmenu"&&Z==="contextmenu"||wt.type!=="contextmenu")&&n(0,at=!1)}ks(()=>{u&&(Yt!=null&&Yt.isOpen())&&Yt.remove()});let Zn;const Ar=()=>n(0,at=!1);function mi(wt){tr[wt?"unshift":"push"](()=>{Zn=wt,n(1,Zn)})}return e.$$set=wt=>{"closeButton"in wt&&n(11,A=wt.closeButton),"closeOnClickOutside"in wt&&n(12,N=wt.closeOnClickOutside),"closeOnClickInside"in wt&&n(13,z=wt.closeOnClickInside),"closeOnMove"in wt&&n(14,H=wt.closeOnMove),"openOn"in wt&&n(15,Z=wt.openOn),"openIfTopMost"in wt&&n(16,K=wt.openIfTopMost),"focusAfterOpen"in wt&&n(17,V=wt.focusAfterOpen),"anchor"in wt&&n(18,X=wt.anchor),"offset"in wt&&n(19,Q=wt.offset),"popupClass"in wt&&n(20,it=wt.popupClass),"maxWidth"in wt&&n(21,ht=wt.maxWidth),"lngLat"in wt&&n(10,ut=wt.lngLat),"html"in wt&&n(22,gt=wt.html),"open"in wt&&n(0,at=wt.open),"$$scope"in wt&&n(29,S=wt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&14336&&n(27,i=A??(!N&&!z)),e.$$.dirty[0]&146685952&&(Yt||(n(23,Yt=new Ls.Popup({closeButton:i,closeOnClick:!1,closeOnMove:H,focusAfterOpen:V,maxWidth:ht,className:it,anchor:X,offset:Q})),me=Yt.getElement(),Yt.on("open",()=>{n(0,at=!0),Ye()}),Yt.on("close",wt=>{n(0,at=!1)}))),e.$$.dirty[0]&8421384&&Yt&&a instanceof Ls.Marker&&(Z==="click"?a.setPopup(Yt):a.getPopup()===Yt&&a.setPopup(void 0)),e.$$.dirty[0]&268468224&&Gt.includes(Z)&&(p==null?void 0:p.type)===Z&&(Ge(p),sn(yt,p=null,p)),e.$$.dirty[0]&268468224&&n(26,r=Z==="hover"&&((p==null?void 0:p.type)==="mousemove"||(p==null?void 0:p.type)==="mouseenter")),e.$$.dirty[0]&352354304&&Z==="hover"&&yt&&(r&&p&&(p.layerType==="deckgl"?(n(10,ut=p.coordinate),n(4,$e=p.object?[p.object]:null)):(n(10,ut=p.lngLat),n(4,$e=p.features??[]))),n(0,at=(r||we)??!1)),e.$$.dirty[0]&12582914&&(Zn?Yt.setDOMContent(Zn):gt&&Yt.setHTML(gt)),e.$$.dirty[0]&8389632&&ut&&Yt.setLngLat(ut),e.$$.dirty[0]&41943045&&u){let wt=Yt.isOpen();at&&!wt?(Yt.addTo(u),Ve==="opening"&&n(25,Ve="justOpened")):!at&&wt&&Yt.remove()}},[at,Zn,u,a,$e,Lt,bt,yt,he,L,ut,A,N,z,H,Z,K,V,X,Q,it,ht,gt,Yt,we,Ve,r,i,p,S,x,Ar,mi]}class YE extends cn{constructor(t){super(),un(this,t,HE,XE,en,{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])}}function KE(e){let t;const n=e[16].default,i=mr(n,e,e[24],null);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u&16777216)&&_r(i,n,r,r[24],t?gr(n,r[24],u,null):yr(r[24]),null)},i(r){t||(Et(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function JE(e){let t,n,i;function r(p){e[17](p)}let u={id:e[1],type:"symbol",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[KE]},$$scope:{ctx:e}};return e[0]!==void 0&&(u.hovered=e[0]),t=new mg({props:u}),tr.push(()=>Ru(t,"hovered",r)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){te(t.$$.fragment)},m(p,a){Qt(t,p,a),i=!0},p(p,[a]){const _={};a&2&&(_.id=p[1]),a&4&&(_.source=p[2]),a&8&&(_.sourceLayer=p[3]),a&16&&(_.beforeId=p[4]),a&32&&(_.beforeLayerType=p[5]),a&64&&(_.paint=p[6]),a&128&&(_.layout=p[7]),a&256&&(_.filter=p[8]),a&512&&(_.applyToClusters=p[9]),a&1024&&(_.minzoom=p[10]),a&2048&&(_.maxzoom=p[11]),a&4096&&(_.hoverCursor=p[12]),a&8192&&(_.manageHoverState=p[13]),a&16384&&(_.eventsIfTopMost=p[14]),a&32768&&(_.interactive=p[15]),a&16777216&&(_.$$scope={dirty:a,ctx:p}),!n&&a&1&&(n=!0,_.hovered=p[0],Du(()=>n=!1)),t.$set(_)},i(p){i||(Et(t.$$.fragment,p),i=!0)},o(p){Pt(t.$$.fragment,p),i=!1},d(p){$t(t,p)}}}function QE(e,t,n){let{$$slots:i={},$$scope:r}=t,{id:u=ip("symbol")}=t,{source:p=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:_=void 0}=t,{beforeLayerType:x=void 0}=t,{paint:S=void 0}=t,{layout:L=void 0}=t,{filter:A=void 0}=t,{applyToClusters:N=void 0}=t,{minzoom:z=void 0}=t,{maxzoom:H=void 0}=t,{hoverCursor:Z=void 0}=t,{manageHoverState:K=!1}=t,{hovered:V=null}=t,{eventsIfTopMost:X=!1}=t,{interactive:Q=!0}=t;function it(yt){V=yt,n(0,V)}function ht(yt){li.call(this,e,yt)}function ut(yt){li.call(this,e,yt)}function gt(yt){li.call(this,e,yt)}function at(yt){li.call(this,e,yt)}function Lt(yt){li.call(this,e,yt)}function bt(yt){li.call(this,e,yt)}return e.$$set=yt=>{"id"in yt&&n(1,u=yt.id),"source"in yt&&n(2,p=yt.source),"sourceLayer"in yt&&n(3,a=yt.sourceLayer),"beforeId"in yt&&n(4,_=yt.beforeId),"beforeLayerType"in yt&&n(5,x=yt.beforeLayerType),"paint"in yt&&n(6,S=yt.paint),"layout"in yt&&n(7,L=yt.layout),"filter"in yt&&n(8,A=yt.filter),"applyToClusters"in yt&&n(9,N=yt.applyToClusters),"minzoom"in yt&&n(10,z=yt.minzoom),"maxzoom"in yt&&n(11,H=yt.maxzoom),"hoverCursor"in yt&&n(12,Z=yt.hoverCursor),"manageHoverState"in yt&&n(13,K=yt.manageHoverState),"hovered"in yt&&n(0,V=yt.hovered),"eventsIfTopMost"in yt&&n(14,X=yt.eventsIfTopMost),"interactive"in yt&&n(15,Q=yt.interactive),"$$scope"in yt&&n(24,r=yt.$$scope)},[V,u,p,a,_,x,S,L,A,N,z,H,Z,K,X,Q,i,it,ht,ut,gt,at,Lt,bt,r]}class $E extends cn{constructor(t){super(),un(this,t,QE,JE,en,{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 pd=Uint8Array,$b=Uint16Array,tI=Int32Array,eI=new pd([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]),nI=new pd([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]),tx=function(e,t){for(var n=new $b(31),i=0;i<31;++i)n[i]=t+=1<>1|(ii&21845)<<1,Fl=(Fl&52428)>>2|(Fl&13107)<<2,Fl=(Fl&61680)>>4|(Fl&3855)<<4,oI[ii]=((Fl&65280)>>8|(Fl&255)<<8)>>1;var Fl,ii,gg=new pd(288);for(ii=0;ii<144;++ii)gg[ii]=8;var ii;for(ii=144;ii<256;++ii)gg[ii]=9;var ii;for(ii=256;ii<280;++ii)gg[ii]=7;var ii;for(ii=280;ii<288;++ii)gg[ii]=8;var ii,sI=new pd(32);for(ii=0;ii<32;++ii)sI[ii]=5;var ii,aI=new pd(0),lI=typeof TextDecoder<"u"&&new TextDecoder,uI=0;try{lI.decode(aI,{stream:!0}),uI=1}catch{}const nx=fi({type:"FeatureCollection",features:[]}),cI=fi(!0),ix=fi(0),hI=30;class pI{constructor(t,n){Xn(this,"map");Xn(this,"inner");Xn(this,"active");Xn(this,"eventListenersSuccess");Xn(this,"eventListenersUpdated");Xn(this,"eventListenersFailure");Xn(this,"onMouseMove",t=>{if(!this.active)return;const n=[t.point.x-hI,t.point.y],i=this.map.unproject(t.point).distanceTo(this.map.unproject(n));this.inner.onMouseMove(t.lngLat.lng,t.lngLat.lat,i)&&(this.redraw(),this.dataUpdated())});Xn(this,"onClick",()=>{this.active&&(this.inner.onClick(),this.redraw(),this.dataUpdated())});Xn(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.inner.onClick(),this.finish())});Xn(this,"onDragStart",()=>{this.active&&this.inner.onDragStart()&&this.map.dragPan.disable()});Xn(this,"onMouseUp",()=>{this.active&&this.inner.onMouseUp()&&this.map.dragPan.enable()});Xn(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});Xn(this,"onKeyPress",t=>{this.active&&t.target.tagName!="INPUT"&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="s"?(t.stopPropagation(),this.inner.toggleSnapMode(),this.redraw()):t.key=="z"&&t.ctrlKey&&this.undo())});this.map=t,console.time("Deserialize and setup JsRouteSnapper"),this.inner=new Xm(n),console.timeEnd("Deserialize and setup JsRouteSnapper"),this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],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(t){t.properties??(t.properties={}),this.active&&window.alert("Bug: editExistingRoute called when tool is already active"),t.properties.waypoints||(t.properties.waypoints=[{lon:t.geometry.coordinates[0][0],lat:t.geometry.coordinates[0][1],snapped:!0},{lon:t.geometry.coordinates[t.geometry.coordinates.length-1][0],lat:t.geometry.coordinates[t.geometry.coordinates.length-1][1],snapped:!0}]),this.startRoute(),this.inner.editExisting(t.properties.waypoints),this.redraw()}editExistingArea(t){t.properties??(t.properties={}),this.active&&window.alert("Bug: editExistingArea called when tool is already active"),t.properties.waypoints||window.alert("Bug: editExistingArea called for a polygon not produced by the route-snapper"),this.startArea(),this.inner.editExisting(t.properties.waypoints),this.redraw()}addEventListenerSuccess(t){this.eventListenersSuccess.push(t)}addEventListenerUpdated(t){this.eventListenersUpdated.push(t)}addEventListenerFailure(t){this.eventListenersFailure.push(t)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}isActive(){return this.active}finish(){let t=this.inner.toFinalFeature();if(t)for(let n of this.eventListenersSuccess)n(JSON.parse(t));else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){this.inner.clearState(),this.finish()}setRouteConfig(t){this.inner.setRouteConfig(t),this.redraw()}addSnappedWaypoint(t){this.inner.addSnappedWaypoint(t[0],t[1]),this.redraw()}undo(){this.inner.undo(),this.redraw()}redraw(){let t=JSON.parse(this.inner.renderGeojson());nx.set(t),this.map.getCanvas().style.cursor=t.cursor,cI.set(t.snap_mode),ix.set(t.undo_length)}dataUpdated(){let t=this.inner.toFinalFeature();if(t)for(let n of this.eventListenersUpdated)n(JSON.parse(t))}}const Ly="MZEJTanw3WpxRvt7qDfo";let Hl=fi(null),rx=fi(`https://api.maptiler.com/maps/dataviz/style.json?key=${Ly}`),Pu=fi(""),Ym=fi(!0),iy=fi(null),ry=fi(null),oy=fi(null),Wo=fi(null),jf=fi(null),Km=fi(new dg.LngLat(0,0)),Jm=fi(new dg.LngLat(0,0)),_c=fi(1),jn=fi({mode:"title"});function fI(e){let t,n,i,r,u,p,a,_,x;return{c(){t=vt("label"),n=He(`Basemap: - `),i=vt("select"),r=vt("option"),r.textContent="MapTiler Dataviz",u=vt("option"),u.textContent="MapTiler Streets",p=vt("option"),p.textContent="MapTiler Satellite",a=vt("option"),a.textContent="OS Open Zoomstack",r.__value="dataviz",jl(r,r.__value),u.__value="streets",jl(u,u.__value),p.__value="hybrid",jl(p,p.__value),a.__value="uk-openzoomstack-light",jl(a,a.__value),e[0]===void 0&&Gf(()=>e[1].call(i))},m(S,L){Rt(S,t,L),dt(t,n),dt(t,i),dt(i,r),dt(i,u),dt(i,p),dt(i,a),Wm(i,e[0],!0),_||(x=be(i,"change",e[1]),_=!0)},p(S,[L]){L&1&&Wm(i,S[0])},i:Pe,o:Pe,d(S){S&&Dt(t),_=!1,x()}}}function dI(e,t,n){let i="dataviz";function r(){i=zb(this),n(0,i)}return e.$$.update=()=>{e.$$.dirty&1&&rx.set(`https://api.maptiler.com/maps/${i}/style.json?key=${Ly}`)},[i,r]}class mI extends cn{constructor(t){super(),un(this,t,dI,fI,en,{})}}var gI=Object.defineProperty,_I=(e,t,n)=>t in e?gI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kv=(e,t,n)=>(_I(e,typeof t!="symbol"?t+"":t,n),n);function qf(){}function ox(e){return e()}function Jv(){return Object.create(null)}function _g(e){e.forEach(ox)}function sx(e){return typeof e=="function"}function yI(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function vI(e){return Object.keys(e).length===0}function bI(e,t){e.appendChild(t)}function xI(e,t,n){e.insertBefore(t,n||null)}function ax(e){e.parentNode&&e.parentNode.removeChild(e)}function Qv(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function Iu(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function wI(e){return Array.from(e.childNodes)}function Am(e,t,n){e.classList.toggle(t,!!n)}let My;function Bf(e){My=e}const Mh=[],$v=[];let Nh=[];const t1=[],SI=Promise.resolve();let sy=!1;function EI(){sy||(sy=!0,SI.then(lx))}function ay(e){Nh.push(e)}const Z_=new Set;let Ih=0;function lx(){if(Ih!==0)return;const e=My;do{try{for(;Ihe.indexOf(i)===-1?t.push(i):n.push(i)),n.forEach(i=>i()),Nh=t}const TI=new Set;function LI(e,t){e&&e.i&&(TI.delete(e),e.i(t))}function MI(e,t,n){const{fragment:i,after_update:r}=e.$$;i&&i.m(t,n),ay(()=>{const u=e.$$.on_mount.map(ox).filter(sx);e.$$.on_destroy?e.$$.on_destroy.push(...u):_g(u),e.$$.on_mount=[]}),r.forEach(ay)}function PI(e,t){const n=e.$$;n.fragment!==null&&(CI(n.after_update),_g(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function AI(e,t){e.$$.dirty[0]===-1&&(Mh.push(e),EI(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const z=N.length?N[0]:A;return x.ctx&&r(x.ctx[L],x.ctx[L]=z)&&(!x.skip_bound&&x.bound[L]&&x.bound[L](z),S&&AI(e,L)),A}):[],x.update(),S=!0,_g(x.before_update),x.fragment=i?i(x.ctx):!1,t.target){if(t.hydrate){const L=wI(t.target);x.fragment&&x.fragment.l(L),L.forEach(ax)}else x.fragment&&x.fragment.c();t.intro&&LI(e.$$.fragment),MI(e,t.target,t.anchor),lx()}Bf(_)}class NI{constructor(){Kv(this,"$$"),Kv(this,"$$set")}$destroy(){PI(this,1),this.$destroy=qf}$on(t,n){if(!sx(n))return qf;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!vI(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const DI="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(DI);function RI(e){let t,n,i;return{c(){t=Qv("svg"),n=Qv("path"),Iu(n,"stroke-width","4"),Iu(n,"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"),Iu(n,"class","svelte-gzo3ar"),Iu(t,"width",i=e[0]==="list"?20:void 0),Iu(t,"viewBox","0 0 70 85"),Iu(t,"fill","none"),Iu(t,"class","svelte-gzo3ar"),Am(t,"in-map",e[0]!=="list"),Am(t,"list-icon",e[0]==="list")},m(r,u){xI(r,t,u),bI(t,n)},p(r,[u]){u&1&&i!==(i=r[0]==="list"?20:void 0)&&Iu(t,"width",i),u&1&&Am(t,"in-map",r[0]!=="list"),u&1&&Am(t,"list-icon",r[0]==="list")},i:qf,o:qf,d(r){r&&ax(t)}}}function OI(e,t,n){let{displayIn:i}=t;return e.$$set=r=>{"displayIn"in r&&n(0,i=r.displayIn)},[i]}class zI extends NI{constructor(t){super(),kI(this,t,OI,RI,yI,{displayIn:0})}}const FI=[{verbatimCoordinates:"40.123, -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:'40° 7´ 22.8" N 74° 7´ 22.8" W',verbatimLatitude:'40° 7´ 22.8" N',verbatimLongitude:'74° 7´ 22.8" W'},{verbatimCoordinates:"40° 7.38’ , -74° 7.38’",verbatimLatitude:"40° 7.38’",verbatimLongitude:"-74° 7.38’"},{verbatimCoordinates:"N40°7’22.8’’, W74°7’22.8’’",verbatimLatitude:"N40°7’22.8’’",verbatimLongitude:"W74°7’22.8’’"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:`40°7'22.8"N, 74°7'22.8"W`,verbatimLatitude:`40°7'22.8"N`,verbatimLongitude:`74°7'22.8"W`},{verbatimCoordinates:"40 7 22.8, -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"},{verbatimCoordinates:"40.123 -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123°,-74.123°",verbatimLatitude:"40.123°",verbatimLongitude:"-74.123°"},{verbatimCoordinates:"40.123N74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"4007.38N7407.38W",verbatimLatitude:"4007.38N",verbatimLongitude:"7407.38W"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:"400722.8N740722.8W",verbatimLatitude:"400722.8N",verbatimLongitude:"740722.8W"},{verbatimCoordinates:"N 40 7.38 W 74 7.38",verbatimLatitude:"N 40 7.38",verbatimLongitude:"W 74 7.38"},{verbatimCoordinates:"40:7:22.8N 74:7:22.8W",verbatimLatitude:"40:7:22.8N",verbatimLongitude:"74:7:22.8W"},{verbatimCoordinates:"40:7:23N,74:7:23W",verbatimLatitude:"40:7:23N",verbatimLongitude:"74:7:23W",decimalLatitude:40.1230555555,decimalLongitude:-74.1230555555},{verbatimCoordinates:'40°7’23"N 74°7’23"W',verbatimLatitude:'40°7’23"N',verbatimLongitude:'74°7’23"W',decimalLatitude:40.1230555555,decimalLongitude:-74.12305555555555},{verbatimCoordinates:'40°7’23"S 74°7’23"E',verbatimLatitude:'40°7’23"S',verbatimLongitude:'74°7’23"E',decimalLatitude:-40.1230555555,decimalLongitude:74.12305555555555},{verbatimCoordinates:'40°7’23" -74°7’23"',verbatimLatitude:'40°7’23"',verbatimLongitude:'-74°7’23"',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:'40d 7’ 23" N 74d 7’ 23" W',verbatimLatitude:'40d 7’ 23" N',verbatimLongitude:'74d 7’ 23" W',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:"40.123N 74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40 7 22.8; -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"}],BI={decimalLatitude:40.123,decimalLongitude:-74.123},VI=[{verbatimCoordinates:`50°4'17.698"south, 14°24'2.826"east`,verbatimLatitude:`50°4'17.698"south`,verbatimLongitude:`14°24'2.826"east`,decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"50d4m17.698S 14d24m2.826E",verbatimLatitude:"50d4m17.698S",verbatimLongitude:"14d24m2.826E",decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"40:26:46N,79:56:55W",verbatimLatitude:"40:26:46N",verbatimLongitude:"79:56:55W",decimalLatitude:40.44611111111111,decimalLongitude:-79.9486111111111},{verbatimCoordinates:"40:26:46.302N 79:56:55.903W",verbatimLatitude:"40:26:46.302N",verbatimLongitude:"79:56:55.903W",decimalLatitude:40.446195,decimalLongitude:-79.94886194444445},{verbatimCoordinates:"40°26′47″N 79°58′36″W",verbatimLatitude:"40°26′47″N",verbatimLongitude:"79°58′36″W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40d 26′ 47″ N 79d 58′ 36″ W",verbatimLatitude:"40d 26′ 47″ N",verbatimLongitude:"79d 58′ 36″ W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40.446195N 79.948862W",verbatimLatitude:"40.446195N",verbatimLongitude:"79.948862W",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40,446195° 79,948862°",verbatimLatitude:"40,446195°",verbatimLongitude:"79,948862°",decimalLatitude:40.446195,decimalLongitude:79.948862},{verbatimCoordinates:"40° 26.7717, -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.446195, -79.948862",verbatimLatitude:"40.446195",verbatimLongitude:"-79.948862",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.123256; -74.123256",verbatimLatitude:"40.123256",verbatimLongitude:"-74.123256",decimalLatitude:40.123256,decimalLongitude:-74.123256},{verbatimCoordinates:"18°24S 22°45E",verbatimLatitude:"18°24S",verbatimLongitude:"22°45E",decimalLatitude:-18.4,decimalLongitude:22.75}],UI=[{verbatimCoordinates:"10.432342S 10.6345345E",verbatimLatitude:"10.432342S",verbatimLongitude:"10.6345345E",decimalLatitude:-10.432342,decimalLongitude:10.6345345},{verbatimCoordinates:"10.00S 10.00E",verbatimLatitude:"10.00S",verbatimLongitude:"10.00E",decimalLatitude:-10,decimalLongitude:10},{verbatimCoordinates:"00.00S 01.00E",verbatimLatitude:"00.00S",verbatimLongitude:"01.00E",decimalLatitude:0,decimalLongitude:1},{verbatimCoordinates:"18.24S 22.45E",verbatimLatitude:"18.24S",verbatimLongitude:"22.45E",decimalLatitude:-18.4,decimalLongitude:22.75},{verbatimCoordinates:"27deg 15min 45.2sec S 18deg 32min 53.7sec E",verbatimLatitude:"27deg 15min 45.2sec S",verbatimLongitude:"18deg 32min 53.7sec E",decimalLatitude:-27.262555555555554,decimalLongitude:18.54825},{verbatimCoordinates:"-23.3245° S / 28.2344° E",verbatimLatitude:"-23.3245° S",verbatimLongitude:"28.2344° E",decimalLatitude:-23.3245,decimalLongitude:28.2344},{verbatimCoordinates:"40° 26.7717 -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"27.15.45S 18.32.53E",verbatimLatitude:"27.15.45S",verbatimLongitude:"18.32.53E",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"-27.15.45 18.32.53",verbatimLatitude:"-27.15.45",verbatimLongitude:"18.32.53",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"27.15.45.2S 18.32.53.4E",verbatimLatitude:"27.15.45.2S",verbatimLongitude:"18.32.53.4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"27.15.45,2S 18.32.53,4E",verbatimLatitude:"27.15.45,2S",verbatimLongitude:"18.32.53,4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"S23.43563 ° E22.45634 °",verbatimLatitude:"S23.43563 °",verbatimLongitude:"E22.45634 °",decimalLatitude:-23.43563,decimalLongitude:22.45634},{verbatimCoordinates:"27,71372° S 23,07771° E",verbatimLatitude:"27,71372° S",verbatimLongitude:"23,07771° E",decimalLatitude:-27.71372,decimalLongitude:23.07771},{verbatimCoordinates:"27.45.34 S 23.23.23 E",verbatimLatitude:"27.45.34 S",verbatimLongitude:"23.23.23 E",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"S 27.45.34 E 23.23.23",verbatimLatitude:"S 27.45.34",verbatimLongitude:"E 23.23.23",decimalLatitude:-27.759444,decimalLongitude:23.38972222}];function GI(){const e=[];return FI.forEach(t=>{t.decimalLatitude?e.push(t):e.push({...t,...BI})}),[...e,...VI,...UI]}const jI=GI();jI.map(e=>e.verbatimCoordinates);/** + `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){x.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(y,s,h){this._canvas.width=Math.floor(h*y),this._canvas.height=Math.floor(h*s),this._canvas.style.width=`${y}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const y={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{s={requestedAttributes:y},d&&(s.statusMessage=d.statusMessage,s.type=d.type)},{once:!0});const h=this._canvas.getContext("webgl2",y)||this._canvas.getContext("webgl",y);if(!h){const d="Failed to initialize WebGL";throw s?(s.message=d,new Error(JSON.stringify(s))):new Error(d)}this.painter=new Cl(h,this.transform),S.testSupport(h)}_onCooperativeGesture(y,s,h){return!s&&h<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}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 s=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 g=this.transform.zoom,b=a.h.now();this.style.zoomHistory.update(g,b);const I=new a.a8(g,{now:b,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),C=I.crossFadingFactor();C===1&&C===this._crossFadingFactor||(h=!0,this._crossFadingFactor=C),this.style.update(I)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=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._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new a.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.bg.mark(a.bh.load),this.fire(new a.k("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,a.bg.mark(a.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=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._frame&&(this._frame.cancel(),this._frame=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 s=this.painter.context.gl.getExtension("WEBGL_lose_context");s&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),x.remove(this._canvasContainer),x.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),a.bg.clearMetrics(),this._removed=!0,this.fire(new a.k("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=a.h.frame(y=>{a.bg.frame(y),this._frame=null,this._render(y)}))}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 De}getCameraTargetElevation(){return this.transform.elevation}},Bn.NavigationControl=class{constructor(y){this._updateZoomButtons=()=>{const s=this._map.getZoom(),h=s===this._map.getMaxZoom(),d=s===this._map.getMinZoom();this._zoomInButton.disabled=h,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",h.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const s=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=s},this._setButtonTitle=(s,h)=>{const d=this._map._getUIString(`NavigationControl.${h}`);s.title=d,s.setAttribute("aria-label",d)},this.options=a.e({},Xp,y),this._container=x.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),x.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),x.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=x.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 Hp(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){x.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,s){const h=x.create("button",y,this._container);return h.type="button",h.addEventListener("click",s),h}},Bn.GeolocateControl=class extends a.E{constructor(y){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new a.k("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=s,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(s),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(s),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new a.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const h=new a.L(s.coords.longitude,s.coords.latitude),d=s.coords.accuracy,g=this._map.getBearing(),b=a.e({bearing:g},this.options.fitBoundsOptions),I=Be.fromLngLat(h,d);this._map.fitBounds(I,b,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const h=new a.L(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(h).addTo(this._map),this._userLocationDotMarker.setLngLat(h).addTo(this._map),this._accuracy=s.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=s=>{if(this._map){if(this.options.trackUserLocation)if(s.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(s.code===3&&gu)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new a.k("error",s)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=s=>{if(this._map){if(this._container.addEventListener("contextmenu",h=>h.preventDefault()),this._geolocateButton=x.create("button","maplibregl-ctrl-geolocate",this._container),x.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!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=x.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ll({element:this._dotElement}),this._circleElement=x.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ll({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",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({},Ai,y)}onAdd(y){return this._map=y,this._container=x.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(s,h=!1){Zi===void 0||h?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(d=>{Zi=d.state!=="denied",s(Zi)}).catch(()=>{Zi=!!window.navigator.geolocation,s(Zi)}):(Zi=!!window.navigator.geolocation,s(Zi)):s(Zi)}(this._setupUI),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(),x.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,wi=0,gu=!1}_isOutOfMapMaxBounds(y){const s=this._map.getMaxBounds(),h=y.coords;return s&&(h.longitudes.getEast()||h.latitudes.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(),s=y.getSouthEast(),h=y.getNorthEast(),d=s.distanceTo(h),g=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}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":wi--,gu=!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"),wi++,wi>1?(y={maximumAge:6e5,timeout:0},gu=!0):(y=this.options.positionOptions,gu=!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)}},Bn.AttributionControl=zo,Bn.LogoControl=ui,Bn.ScaleControl=class{constructor(y){this._onMove=()=>{cc(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,cc(this._map,this._container,this.options)},this.options=a.e({},uc,y)}getDefaultPosition(){return"bottom-left"}onAdd(y){return this._map=y,this._container=x.create("div","maplibregl-ctrl maplibregl-ctrl-scale",y.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){x.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},Bn.FullscreenControl=class extends a.E{constructor(y={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===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=x.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){x.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const y=this._fullscreenButton=x.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);x.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._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new a.k("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_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()}},Bn.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.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=y}onAdd(y){return this._map=y,this._container=x.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=x.create("button","maplibregl-ctrl-terrain",this._container),x.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(){x.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},Bn.Popup=class extends a.E{constructor(y){super(),this.remove=()=>(this._content&&x.remove(this._content),this._container&&(x.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),delete this._map),this.fire(new a.k("close")),this),this._onMouseUp=s=>{this._update(s.point)},this._onMouseMove=s=>{this._update(s.point)},this._onDrag=s=>{this._update(s.point)},this._update=s=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=x.create("div","maplibregl-popup",this._map.getContainer()),this._tip=x.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const I of this.options.className.split(" "))this._container.classList.add(I);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._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Yp(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!s)return;const h=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);let d=this.options.anchor;const g=_u(this.options.offset);if(!d){const I=this._container.offsetWidth,C=this._container.offsetHeight;let M;M=h.y+g.bottom.ythis._map.transform.height-C?["bottom"]:[],h.xthis._map.transform.width-I/2&&M.push("right"),d=M.length===0?"bottom":M.join("-")}const b=h.add(g[d]).round();x.setTransform(this._container,`${ls[d]} translate(${b.x}px,${b.y}px)`),rm(this._container,d,"popup")},this._onClose=()=>{this.remove()},this.options=a.e(Object.create(Kp),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.L.convert(y),this._pos=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._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 s=document.createDocumentFragment(),h=document.createElement("body");let d;for(h.innerHTML=y;d=h.firstChild,d;)s.appendChild(d);return this.setDOMContent(s)}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=x.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)}_createCloseButton(){this.options.closeButton&&(this._closeButton=x.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(Jp);y&&y.focus()}},Bn.Marker=Ll,Bn.Style=Nr,Bn.LngLat=a.L,Bn.LngLatBounds=Be,Bn.Point=a.P,Bn.MercatorCoordinate=a.U,Bn.Evented=a.E,Bn.AJAXError=a.bi,Bn.config=a.c,Bn.CanvasSource=tr,Bn.GeoJSONSource=Me,Bn.ImageSource=ni,Bn.RasterDEMTileSource=Wt,Bn.RasterTileSource=ln,Bn.VectorTileSource=Mn,Bn.VideoSource=_o,Bn.setRTLTextPlugin=a.bj,Bn.getRTLTextPluginStatus=a.bk,Bn.prewarm=function(){Ha().acquire(En)},Bn.clearPrewarmedResources=function(){const y=es;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(En),es=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()"))},Qp.extend(Bn,{isSafari:a.ac,getPerformanceMetrics:a.bg.getPerformanceMetrics}),Bn});var p=r;return p})})($b);var dg=$b.exports;const Ls=Jb(dg);function Fv(e){let t;return n=>{if(n)for(let i in n){let r=t==null?void 0:t[i],u=n[i];r!==u&&e(i,u,r)}else if(t)for(let i in t)e(i,void 0,t[i]);t=n}}function cE(e,...t){let n=[e];for(let i of t)if(i)Array.isArray(i)&&i[0]===e?n.push(...i.slice(1)):n.push(i);else continue;if(n.length!==1)return n.length===2?n[1]:n}function hE(e){return e===!0?["has","point_count"]:e===!1?["!",["has","point_count"]]:void 0}function ny(e,t){return["case",["boolean",["feature-state","hover"],!1],t,e]}var Hm=pE;function pE(e){var t,n,i;if(e){if(Array.isArray(e)){for(t=[],n=e.length,i=0;i{i=null}),Ci())},i(r){n||(wt(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&At(t),i&&i.d(r)}}}function dE(e,t,n){let i,r,u,p,a,_,x,S,L,A,N,O,{$$slots:Z={},$$scope:G}=t,{id:K=ip("layer")}=t,{source:V=void 0}=t,{sourceLayer:H=void 0}=t,{beforeId:Q=void 0}=t,{beforeLayerType:it=void 0}=t,{type:ht}=t,{paint:ft=void 0}=t,{layout:dt=void 0}=t,{filter:ut=void 0}=t,{applyToClusters:Mt=void 0}=t,{minzoom:xt=void 0}=t,{maxzoom:yt=void 0}=t,{manageHoverState:de=!1}=t,{hovered:Rt=null}=t,{interactive:Gt=!0}=t,{hoverCursor:Kt=void 0}=t,{eventsIfTopMost:be=!1}=t;const me=np(),{map:an,source:jn,self:He,minzoom:ke,maxzoom:Be,eventTopMost:fn,layerInfo:Mn}=aE();Ee(e,an,Ct=>n(31,L=Ct)),Ee(e,jn,Ct=>n(32,A=Ct)),Ee(e,He,Ct=>n(0,S=Ct)),Ee(e,ke,Ct=>n(34,O=Ct)),Ee(e,Be,Ct=>n(33,N=Ct)),ks(()=>{S&&L&&(Mn.delete(S),L==null||L.removeLayer(S))});let ln;function Wt(Ct){var Xn,dn;if(!Gt||!S||!L||be&&fn(Ct)!==S)return;let Ge=Ct.features??[],je=(dn=(Xn=Ge[0])==null?void 0:Xn.properties)==null?void 0:dn.cluster_id,er={event:Ct,map:L,clusterId:je,layer:S,source:a,features:Ge};me(Ct.type,er)}function Me(Ct){var Xn,dn;if(!Gt||!S||!L||be&&fn(Ct)!==S)return;Kt&&(L.getCanvas().style.cursor=Kt);let Ge=Ct.features??[];n(6,Rt=Ge[0]??null);let je=(dn=(Xn=Ge[0])==null?void 0:Xn.properties)==null?void 0:dn.cluster_id;me("mouseenter",{event:Ct,map:L,clusterId:je,layer:S,source:a,features:Ge})}function yn(Ct){var Xn,dn,qi;if(!Gt||!L)return;if(be&&fn(Ct)!==S){n(6,Rt=null),de&&ln!==void 0&&(L==null||L.setFeatureState({source:a,sourceLayer:H,id:ln},{hover:!1}),ln=void 0);return}L.getCanvas().style.cursor=Kt;let Ge=Ct.features??[],je=(dn=(Xn=Ge[0])==null?void 0:Xn.properties)==null?void 0:dn.cluster_id,er=(qi=Ge[0])==null?void 0:qi.id;er!==ln&&(de&&(ln!==void 0&&(L==null||L.setFeatureState({source:a,id:ln,sourceLayer:H},{hover:!1})),L==null||L.setFeatureState({source:a,id:er,sourceLayer:H},{hover:!0})),ln=er,n(6,Rt=Ge[0]??null)),me("mousemove",{event:Ct,map:L,clusterId:je,layer:S,source:a,features:Ge})}function ni(Ct){if(!(!Gt||!S||!L)){if(Kt&&(L.getCanvas().style.cursor=""),n(6,Rt=null),de&&ln!==void 0){const Ge={source:a,id:ln,sourceLayer:H};L==null||L.setFeatureState(Ge,{hover:!1}),ln=void 0}me("mouseleave",{map:L,layer:S,source:a})}}let _o=!0;function tr(Ct){L&&(L.off("click",Ct,Wt),L.off("dblclick",Ct,Wt),L.off("contextmenu",Ct,Wt),L.off("mouseenter",Ct,Me),L.off("mousemove",Ct,yn),L.off("mouseleave",Ct,ni))}return ks(()=>{L&&S&&tr(S)}),e.$$set=Ct=>{"id"in Ct&&n(7,K=Ct.id),"source"in Ct&&n(8,V=Ct.source),"sourceLayer"in Ct&&n(9,H=Ct.sourceLayer),"beforeId"in Ct&&n(10,Q=Ct.beforeId),"beforeLayerType"in Ct&&n(11,it=Ct.beforeLayerType),"type"in Ct&&n(12,ht=Ct.type),"paint"in Ct&&n(13,ft=Ct.paint),"layout"in Ct&&n(14,dt=Ct.layout),"filter"in Ct&&n(15,ut=Ct.filter),"applyToClusters"in Ct&&n(16,Mt=Ct.applyToClusters),"minzoom"in Ct&&n(17,xt=Ct.minzoom),"maxzoom"in Ct&&n(18,yt=Ct.maxzoom),"manageHoverState"in Ct&&n(19,de=Ct.manageHoverState),"hovered"in Ct&&n(6,Rt=Ct.hovered),"interactive"in Ct&&n(20,Gt=Ct.interactive),"hoverCursor"in Ct&&n(21,Kt=Ct.hoverCursor),"eventsIfTopMost"in Ct&&n(22,be=Ct.eventsIfTopMost),"$$scope"in Ct&&n(35,G=Ct.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&65536&&n(30,i=hE(Mt)),e.$$.dirty[0]&1073774592&&n(24,r=cE("all",i,ut)),e.$$.dirty[0]&131072|e.$$.dirty[1]&8&&n(26,u=xt??O),e.$$.dirty[0]&262144|e.$$.dirty[1]&4&&n(25,p=yt??N),e.$$.dirty[0]&256|e.$$.dirty[1]&2&&n(29,a=V||A),e.$$.dirty[0]&654343809|e.$$.dirty[1]&1&&L&&S!==K&&a){S&&(tr(S),Mn.delete(S));let Ct=Q;if(!Q&&it){let Ge=L.getStyle().layers,je=typeof it=="function"?it:Xn=>Xn.type===it,er=Ge==null?void 0:Ge.find(je);er&&(Ct=er.id)}nn(He,S=K,S),L.addLayer(Hm({id:S,type:ht,source:a,"source-layer":H,filter:r,paint:ft,layout:dt,minzoom:u,maxzoom:p}),Ct),n(23,_o=!0),L.on("click",S,Wt),L.on("dblclick",S,Wt),L.on("contextmenu",S,Wt),L.on("mouseenter",S,Me),L.on("mousemove",S,yn),L.on("mouseleave",S,ni)}e.$$.dirty[0]&1048577&&S&&Mn.set(S,{interactive:Gt}),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(28,_=S?Fv((Ct,Ge)=>L==null?void 0:L.setPaintProperty(S,Ct,Ge)):void 0),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(27,x=S?Fv((Ct,Ge)=>L==null?void 0:L.setLayoutProperty(S,Ct,Ge)):void 0),e.$$.dirty[0]&268443648&&(_==null||_(ft)),e.$$.dirty[0]&134234112&&(x==null||x(dt)),e.$$.dirty[0]&100663297|e.$$.dirty[1]&1&&S&&(L==null||L.setLayerZoomRange(S,u,p)),e.$$.dirty[0]&25165825|e.$$.dirty[1]&1&&S&&(_o?n(23,_o=!1):L==null||L.setFilter(S,r))},[S,an,jn,He,ke,Be,Rt,K,V,H,Q,it,ht,ft,dt,ut,Mt,xt,yt,de,Gt,Kt,be,_o,r,p,u,x,_,a,i,L,A,N,O,G,Z]}class mg extends sn{constructor(t){super(),on(this,t,dE,fE,Qe,{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 mE(e){let t;const n=e[16].default,i=mr(n,e,e[24],null);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u&16777216)&&_r(i,n,r,r[24],t?gr(n,r[24],u,null):yr(r[24]),null)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function gE(e){let t,n,i;function r(p){e[17](p)}let u={id:e[1],type:"circle",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[mE]},$$scope:{ctx:e}};return e[0]!==void 0&&(u.hovered=e[0]),t=new mg({props:u}),Qi.push(()=>Ru(t,"hovered",r)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){ee(t.$$.fragment)},m(p,a){$t(t,p,a),i=!0},p(p,[a]){const _={};a&2&&(_.id=p[1]),a&4&&(_.source=p[2]),a&8&&(_.sourceLayer=p[3]),a&16&&(_.beforeId=p[4]),a&32&&(_.beforeLayerType=p[5]),a&64&&(_.paint=p[6]),a&128&&(_.layout=p[7]),a&256&&(_.filter=p[8]),a&512&&(_.applyToClusters=p[9]),a&1024&&(_.minzoom=p[10]),a&2048&&(_.maxzoom=p[11]),a&4096&&(_.hoverCursor=p[12]),a&8192&&(_.manageHoverState=p[13]),a&16384&&(_.eventsIfTopMost=p[14]),a&32768&&(_.interactive=p[15]),a&16777216&&(_.$$scope={dirty:a,ctx:p}),!n&&a&1&&(n=!0,_.hovered=p[0],Du(()=>n=!1)),t.$set(_)},i(p){i||(wt(t.$$.fragment,p),i=!0)},o(p){Pt(t.$$.fragment,p),i=!1},d(p){te(t,p)}}}function _E(e,t,n){let{$$slots:i={},$$scope:r}=t,{id:u=ip("circle")}=t,{source:p=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:_=void 0}=t,{beforeLayerType:x=void 0}=t,{paint:S}=t,{layout:L=void 0}=t,{filter:A=void 0}=t,{applyToClusters:N=void 0}=t,{minzoom:O=void 0}=t,{maxzoom:Z=void 0}=t,{hoverCursor:G=void 0}=t,{manageHoverState:K=!1}=t,{hovered:V=null}=t,{eventsIfTopMost:H=!1}=t,{interactive:Q=!0}=t;function it(yt){V=yt,n(0,V)}function ht(yt){ai.call(this,e,yt)}function ft(yt){ai.call(this,e,yt)}function dt(yt){ai.call(this,e,yt)}function ut(yt){ai.call(this,e,yt)}function Mt(yt){ai.call(this,e,yt)}function xt(yt){ai.call(this,e,yt)}return e.$$set=yt=>{"id"in yt&&n(1,u=yt.id),"source"in yt&&n(2,p=yt.source),"sourceLayer"in yt&&n(3,a=yt.sourceLayer),"beforeId"in yt&&n(4,_=yt.beforeId),"beforeLayerType"in yt&&n(5,x=yt.beforeLayerType),"paint"in yt&&n(6,S=yt.paint),"layout"in yt&&n(7,L=yt.layout),"filter"in yt&&n(8,A=yt.filter),"applyToClusters"in yt&&n(9,N=yt.applyToClusters),"minzoom"in yt&&n(10,O=yt.minzoom),"maxzoom"in yt&&n(11,Z=yt.maxzoom),"hoverCursor"in yt&&n(12,G=yt.hoverCursor),"manageHoverState"in yt&&n(13,K=yt.manageHoverState),"hovered"in yt&&n(0,V=yt.hovered),"eventsIfTopMost"in yt&&n(14,H=yt.eventsIfTopMost),"interactive"in yt&&n(15,Q=yt.interactive),"$$scope"in yt&&n(24,r=yt.$$scope)},[V,u,p,a,_,x,S,L,A,N,O,Z,G,K,H,Q,i,it,ht,ft,dt,ut,Mt,xt,r]}class hd extends sn{constructor(t){super(),on(this,t,_E,gE,Qe,{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 yE(e){let t;const n=e[15].default,i=mr(n,e,e[23],null);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u&8388608)&&_r(i,n,r,r[23],t?gr(n,r[23],u,null):yr(r[23]),null)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function vE(e){let t,n,i;function r(p){e[16](p)}let u={id:e[1],type:"fill",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[yE]},$$scope:{ctx:e}};return e[0]!==void 0&&(u.hovered=e[0]),t=new mg({props:u}),Qi.push(()=>Ru(t,"hovered",r)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){ee(t.$$.fragment)},m(p,a){$t(t,p,a),i=!0},p(p,[a]){const _={};a&2&&(_.id=p[1]),a&4&&(_.source=p[2]),a&8&&(_.sourceLayer=p[3]),a&16&&(_.beforeId=p[4]),a&32&&(_.beforeLayerType=p[5]),a&64&&(_.paint=p[6]),a&128&&(_.layout=p[7]),a&256&&(_.filter=p[8]),a&512&&(_.minzoom=p[9]),a&1024&&(_.maxzoom=p[10]),a&2048&&(_.hoverCursor=p[11]),a&4096&&(_.manageHoverState=p[12]),a&8192&&(_.eventsIfTopMost=p[13]),a&16384&&(_.interactive=p[14]),a&8388608&&(_.$$scope={dirty:a,ctx:p}),!n&&a&1&&(n=!0,_.hovered=p[0],Du(()=>n=!1)),t.$set(_)},i(p){i||(wt(t.$$.fragment,p),i=!0)},o(p){Pt(t.$$.fragment,p),i=!1},d(p){te(t,p)}}}function bE(e,t,n){let{$$slots:i={},$$scope:r}=t,{id:u=ip("fill")}=t,{source:p=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:_=void 0}=t,{beforeLayerType:x=void 0}=t,{paint:S}=t,{layout:L=void 0}=t,{filter:A=void 0}=t,{minzoom:N=void 0}=t,{maxzoom:O=void 0}=t,{hoverCursor:Z=void 0}=t,{manageHoverState:G=!1}=t,{hovered:K=null}=t,{eventsIfTopMost:V=!1}=t,{interactive:H=!0}=t;function Q(xt){K=xt,n(0,K)}function it(xt){ai.call(this,e,xt)}function ht(xt){ai.call(this,e,xt)}function ft(xt){ai.call(this,e,xt)}function dt(xt){ai.call(this,e,xt)}function ut(xt){ai.call(this,e,xt)}function Mt(xt){ai.call(this,e,xt)}return e.$$set=xt=>{"id"in xt&&n(1,u=xt.id),"source"in xt&&n(2,p=xt.source),"sourceLayer"in xt&&n(3,a=xt.sourceLayer),"beforeId"in xt&&n(4,_=xt.beforeId),"beforeLayerType"in xt&&n(5,x=xt.beforeLayerType),"paint"in xt&&n(6,S=xt.paint),"layout"in xt&&n(7,L=xt.layout),"filter"in xt&&n(8,A=xt.filter),"minzoom"in xt&&n(9,N=xt.minzoom),"maxzoom"in xt&&n(10,O=xt.maxzoom),"hoverCursor"in xt&&n(11,Z=xt.hoverCursor),"manageHoverState"in xt&&n(12,G=xt.manageHoverState),"hovered"in xt&&n(0,K=xt.hovered),"eventsIfTopMost"in xt&&n(13,V=xt.eventsIfTopMost),"interactive"in xt&&n(14,H=xt.interactive),"$$scope"in xt&&n(23,r=xt.$$scope)},[K,u,p,a,_,x,S,L,A,N,O,Z,G,V,H,i,Q,it,ht,ft,dt,ut,Mt,r]}class op extends sn{constructor(t){super(),on(this,t,bE,vE,Qe,{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 xE(e,t,n){let i;const{map:r}=rp();Ee(e,r,_=>n(4,i=_));let{position:u="top-left"}=t,{container:p=void 0}=t,a=null;return ks(()=>{i!=null&&i.loaded()&&a&&i.removeControl(a)}),e.$$set=_=>{"position"in _&&n(1,u=_.position),"container"in _&&n(2,p=_.container)},e.$$.update=()=>{if(e.$$.dirty&30&&i&&!a){let _;typeof p=="string"?_=document.querySelector(p)??void 0:_=p,n(3,a=new Ls.FullscreenControl({container:_})),i.addControl(a,u)}},[r,u,p,a,i]}class wE extends sn{constructor(t){super(),on(this,t,xE,null,Qe,{position:1,container:2})}}function SE(e,t,n,i,r){let u=!1;e.getSource(t)&&(u=!0,e.removeSource(t));const p=()=>{i(t)&&(e.addSource(t,n),r())};if(u){const a=()=>{t&&(e.getSource(t)?setTimeout(a,1):p())};a()}else p()}function EE(e,t,n){kS().then(()=>{let i=zb(e);if(!i)return;i.getSource(t)===n&&i.removeSource(t)})}function Uv(e){let t=e[0],n,i,r=Gv(e);return{c(){r.c(),n=$o()},m(u,p){r.m(u,p),Nt(u,n,p),i=!0},p(u,p){p&1&&Qe(t,t=u[0])?(Ii(),Pt(r,1,1,Le),Ci(),r=Gv(u),r.c(),wt(r,1),r.m(n.parentNode,n)):r.p(u,p)},i(u){i||(wt(r),i=!0)},o(u){Pt(r),i=!1},d(u){u&&At(n),r.d(u)}}}function Gv(e){let t;const n=e[15].default,i=mr(n,e,e[14],null);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u&16384)&&_r(i,n,r,r[14],t?gr(n,r[14],u,null):yr(r[14]),null)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function IE(e){let t,n,i=e[0]&&Uv(e);return{c(){i&&i.c(),t=$o()},m(r,u){i&&i.m(r,u),Nt(r,t,u),n=!0},p(r,[u]){r[0]?i?(i.p(r,u),u&1&&wt(i,1)):(i=Uv(r),i.c(),wt(i,1),i.m(t.parentNode,t)):i&&(Ii(),Pt(i,1,1,()=>{i=null}),Ci())},i(r){n||(wt(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&At(t),i&&i.d(r)}}}function CE(e,t,n){let i,r,u,{$$slots:p={},$$scope:a}=t,{id:_=ip("geojson")}=t,{data:x}=t,{generateId:S=!1}=t,{promoteId:L=void 0}=t,{filter:A=void 0}=t,{lineMetrics:N=void 0}=t,{cluster:O=void 0}=t;const{map:Z,cluster:G,self:K}=sE();Ee(e,Z,Q=>n(13,r=Q)),Ee(e,G,Q=>n(16,u=Q)),Ee(e,K,Q=>n(0,i=Q));let V,H=!0;return ks(()=>{i&&V&&r&&(EE(Z,i,V),nn(K,i=null,i),n(11,V=void 0))}),e.$$set=Q=>{"id"in Q&&n(4,_=Q.id),"data"in Q&&n(5,x=Q.data),"generateId"in Q&&n(6,S=Q.generateId),"promoteId"in Q&&n(7,L=Q.promoteId),"filter"in Q&&n(8,A=Q.filter),"lineMetrics"in Q&&n(9,N=Q.lineMetrics),"cluster"in Q&&n(10,O=Q.cluster),"$$scope"in Q&&n(14,a=Q.$$scope)},e.$$.update=()=>{e.$$.dirty&1024&&nn(G,u=O,u),e.$$.dirty&12273&&r&&i!==_&&(nn(K,i=_,i),SE(r,i,Hm({type:"geojson",data:x,filter:A,lineMetrics:N,generateId:S,promoteId:L,cluster:!!O,clusterMinPoints:O==null?void 0:O.minPoints,clusterMaxZoom:O==null?void 0:O.maxZoom,clusterRadius:O==null?void 0:O.radius,clusterProperties:O==null?void 0:O.properties}),Q=>r&&Q===i,()=>{i&&(n(11,V=r==null?void 0:r.getSource(i)),n(12,H=!0))})),e.$$.dirty&8208&&(r==null||r.on("style.load",()=>{n(11,V=r==null?void 0:r.getSource(_))})),e.$$.dirty&6176&&V&&(H?n(12,H=!1):V.setData(x)),e.$$.dirty&3072&&(V==null||V.setClusterOptions(Hm({cluster:!!O,clusterMaxZoom:O==null?void 0:O.maxZoom,clusterRadius:O==null?void 0:O.radius})))},[i,Z,G,K,_,x,S,L,A,N,O,V,H,r,a,p]}class Ms extends sn{constructor(t){super(),on(this,t,CE,IE,Qe,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function TE(e,t,n){let i;const{map:r}=rp();Ee(e,r,A=>n(8,i=A));let{position:u="top-left"}=t,{positionOptions:p=void 0}=t,{fitBoundsOptions:a=void 0}=t,{trackUserLocation:_=!1}=t,{showAccuracyCircle:x=!0}=t,{showUserLocation:S=!0}=t,L=null;return ks(()=>{i!=null&&i.loaded()&&L&&i.removeControl(L)}),e.$$set=A=>{"position"in A&&n(1,u=A.position),"positionOptions"in A&&n(2,p=A.positionOptions),"fitBoundsOptions"in A&&n(3,a=A.fitBoundsOptions),"trackUserLocation"in A&&n(4,_=A.trackUserLocation),"showAccuracyCircle"in A&&n(5,x=A.showAccuracyCircle),"showUserLocation"in A&&n(6,S=A.showUserLocation)},e.$$.update=()=>{e.$$.dirty&510&&i&&!L&&(n(7,L=new Ls.GeolocateControl({positionOptions:p,fitBoundsOptions:a,trackUserLocation:_,showAccuracyCircle:x,showUserLocation:S})),i.addControl(L,u))},[r,u,p,a,_,x,S,L,i]}class LE extends sn{constructor(t){super(),on(this,t,TE,null,Qe,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function ME(e){let t;const n=e[15].default,i=mr(n,e,e[23],null);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u&8388608)&&_r(i,n,r,r[23],t?gr(n,r[23],u,null):yr(r[23]),null)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function PE(e){let t,n,i;function r(p){e[16](p)}let u={id:e[1],type:"line",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[ME]},$$scope:{ctx:e}};return e[0]!==void 0&&(u.hovered=e[0]),t=new mg({props:u}),Qi.push(()=>Ru(t,"hovered",r)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){ee(t.$$.fragment)},m(p,a){$t(t,p,a),i=!0},p(p,[a]){const _={};a&2&&(_.id=p[1]),a&4&&(_.source=p[2]),a&8&&(_.sourceLayer=p[3]),a&16&&(_.beforeId=p[4]),a&32&&(_.beforeLayerType=p[5]),a&64&&(_.paint=p[6]),a&128&&(_.layout=p[7]),a&256&&(_.filter=p[8]),a&512&&(_.minzoom=p[9]),a&1024&&(_.maxzoom=p[10]),a&2048&&(_.hoverCursor=p[11]),a&4096&&(_.manageHoverState=p[12]),a&8192&&(_.eventsIfTopMost=p[13]),a&16384&&(_.interactive=p[14]),a&8388608&&(_.$$scope={dirty:a,ctx:p}),!n&&a&1&&(n=!0,_.hovered=p[0],Du(()=>n=!1)),t.$set(_)},i(p){i||(wt(t.$$.fragment,p),i=!0)},o(p){Pt(t.$$.fragment,p),i=!1},d(p){te(t,p)}}}function AE(e,t,n){let{$$slots:i={},$$scope:r}=t,{id:u=ip("line")}=t,{source:p=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:_=void 0}=t,{beforeLayerType:x=void 0}=t,{paint:S}=t,{layout:L=void 0}=t,{filter:A=void 0}=t,{minzoom:N=void 0}=t,{maxzoom:O=void 0}=t,{hoverCursor:Z=void 0}=t,{manageHoverState:G=!1}=t,{hovered:K=null}=t,{eventsIfTopMost:V=!1}=t,{interactive:H=!0}=t;function Q(xt){K=xt,n(0,K)}function it(xt){ai.call(this,e,xt)}function ht(xt){ai.call(this,e,xt)}function ft(xt){ai.call(this,e,xt)}function dt(xt){ai.call(this,e,xt)}function ut(xt){ai.call(this,e,xt)}function Mt(xt){ai.call(this,e,xt)}return e.$$set=xt=>{"id"in xt&&n(1,u=xt.id),"source"in xt&&n(2,p=xt.source),"sourceLayer"in xt&&n(3,a=xt.sourceLayer),"beforeId"in xt&&n(4,_=xt.beforeId),"beforeLayerType"in xt&&n(5,x=xt.beforeLayerType),"paint"in xt&&n(6,S=xt.paint),"layout"in xt&&n(7,L=xt.layout),"filter"in xt&&n(8,A=xt.filter),"minzoom"in xt&&n(9,N=xt.minzoom),"maxzoom"in xt&&n(10,O=xt.maxzoom),"hoverCursor"in xt&&n(11,Z=xt.hoverCursor),"manageHoverState"in xt&&n(12,G=xt.manageHoverState),"hovered"in xt&&n(0,K=xt.hovered),"eventsIfTopMost"in xt&&n(13,V=xt.eventsIfTopMost),"interactive"in xt&&n(14,H=xt.interactive),"$$scope"in xt&&n(23,r=xt.$$scope)},[K,u,p,a,_,x,S,L,A,N,O,Z,G,V,H,i,Q,it,ht,ft,dt,ut,Mt,r]}class ru extends sn{constructor(t){super(),on(this,t,AE,PE,Qe,{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 kE(e){let t=e.getCenter(),n=Math.round(e.getZoom()*100)/100,i=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),r=Math.pow(10,i),u=Math.round(t.lat*r)/r,p=Math.round(t.lng*r)/r,a=`${n}/${u}/${p}`,_=e.getBearing(),x=e.getPitch();return(_||x)&&(a+=`/${Math.round(_*10)/10}`),x&&(a+=`/${Math.round(x)}`),`#${a}`}function NE(e){return e.replace("#","").split("/").map(parseFloat)}var Pm=Ty;function Ty(e,t){return e===t||e!==e&&t!==t?!0:typeof e!=typeof t||{}.toString.call(e)!={}.toString.call(t)||e!==Object(e)||!e?!1:Array.isArray(e)?jv(e,t):{}.toString.call(e)=="[object Set]"?jv(Array.from(e),Array.from(t)):{}.toString.call(e)=="[object Object]"?RE(e,t):DE(e,t)}function DE(e,t){return e.toString()===t.toString()}function jv(e,t){var n=e.length;if(n!=t.length)return!1;for(var i=0;in(6,i=S));let{position:u="top-left"}=t,{showCompass:p=!0}=t,{showZoom:a=!0}=t,{visualizePitch:_=!1}=t,x=null;return ks(()=>{i!=null&&i.loaded()&&x&&i.removeControl(x)}),e.$$set=S=>{"position"in S&&n(1,u=S.position),"showCompass"in S&&n(2,p=S.showCompass),"showZoom"in S&&n(3,a=S.showZoom),"visualizePitch"in S&&n(4,_=S.visualizePitch)},e.$$.update=()=>{e.$$.dirty&126&&i&&!x&&(n(5,x=new Ls.NavigationControl({showCompass:p,showZoom:a,visualizePitch:_})),i.addControl(x,u))},[r,u,p,a,_,x,i]}class zE extends sn{constructor(t){super(),on(this,t,OE,null,Qe,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function FE(e,t,n){let i;const{map:r}=rp();Ee(e,r,x=>n(5,i=x));let{position:u="bottom-left"}=t,{maxWidth:p=void 0}=t,{unit:a="metric"}=t,_=null;return ks(()=>{i!=null&&i.loaded()&&_&&i.removeControl(_)}),e.$$set=x=>{"position"in x&&n(1,u=x.position),"maxWidth"in x&&n(2,p=x.maxWidth),"unit"in x&&n(3,a=x.unit)},e.$$.update=()=>{e.$$.dirty&62&&i&&!_&&(n(4,_=new Ls.ScaleControl({maxWidth:p,unit:a})),i.addControl(_,u))},[r,u,p,a,_,i]}class BE extends sn{constructor(t){super(),on(this,t,FE,null,Qe,{position:1,maxWidth:2,unit:3})}}const VE=e=>({map:e[0]&8,loadedImages:e[0]&16,allImagesLoaded:e[0]&32}),qv=e=>({map:e[3],loadedImages:e[4],allImagesLoaded:e[5]});function Zv(e){let t,n,i=e[2]&&Wv(e);const r=e[34].default,u=mr(r,e,e[33],qv);return{c(){i&&i.c(),t=Jt(),u&&u.c()},m(p,a){i&&i.m(p,a),Nt(p,t,a),u&&u.m(p,a),n=!0},p(p,a){p[2]?i?(i.p(p,a),a[0]&4&&wt(i,1)):(i=Wv(p),i.c(),wt(i,1),i.m(t.parentNode,t)):i&&(Ii(),Pt(i,1,1,()=>{i=null}),Ci()),u&&u.p&&(!n||a[0]&56|a[1]&4)&&_r(u,r,p,p[33],n?gr(r,p[33],a,VE):yr(p[33]),qv)},i(p){n||(wt(i),wt(u,p),n=!0)},o(p){Pt(i),Pt(u,p),n=!1},d(p){p&&At(t),i&&i.d(p),u&&u.d(p)}}}function Wv(e){let t,n,i,r,u,p,a,_;return t=new zE({props:{position:e[6]}}),i=new LE({props:{position:e[6],fitBoundsOptions:{maxZoom:12}}}),u=new wE({props:{position:e[6]}}),a=new BE({props:{position:e[6]}}),{c(){ee(t.$$.fragment),n=Jt(),ee(i.$$.fragment),r=Jt(),ee(u.$$.fragment),p=Jt(),ee(a.$$.fragment)},m(x,S){$t(t,x,S),Nt(x,n,S),$t(i,x,S),Nt(x,r,S),$t(u,x,S),Nt(x,p,S),$t(a,x,S),_=!0},p(x,S){const L={};S[0]&64&&(L.position=x[6]),t.$set(L);const A={};S[0]&64&&(A.position=x[6]),i.$set(A);const N={};S[0]&64&&(N.position=x[6]),u.$set(N);const O={};S[0]&64&&(O.position=x[6]),a.$set(O)},i(x){_||(wt(t.$$.fragment,x),wt(i.$$.fragment,x),wt(u.$$.fragment,x),wt(a.$$.fragment,x),_=!0)},o(x){Pt(t.$$.fragment,x),Pt(i.$$.fragment,x),Pt(u.$$.fragment,x),Pt(a.$$.fragment,x),_=!1},d(x){x&&(At(n),At(r),At(p)),te(t,x),te(i,x),te(u,x),te(a,x)}}}function UE(e){let t,n,i,r,u,p=e[3]&&e[0]&&Zv(e);return{c(){t=vt("div"),p&&p.c(),kt(t,"class",n=Zm(e[1])+" svelte-p00lfq"),cl(t,"expand-map",!e[1])},m(a,_){Nt(a,t,_),p&&p.m(t,null),i=!0,r||(u=J_(e[9].call(null,t)),r=!0)},p(a,_){a[3]&&a[0]?p?(p.p(a,_),_[0]&9&&wt(p,1)):(p=Zv(a),p.c(),wt(p,1),p.m(t,null)):p&&(Ii(),Pt(p,1,1,()=>{p=null}),Ci()),(!i||_[0]&2&&n!==(n=Zm(a[1])+" svelte-p00lfq"))&&kt(t,"class",n),(!i||_[0]&2)&&cl(t,"expand-map",!a[1])},i(a){i||(wt(p),i=!0)},o(a){Pt(p),i=!1},d(a){a&&At(t),p&&p.d(),r=!1,u()}}}function GE(e,t,n){let i,r,u,p,{$$slots:a={},$$scope:_}=t,{map:x=null}=t,{class:S=void 0}=t,{style:L}=t,{diffStyleUpdates:A=!1}=t,{center:N=void 0}=t,{zoom:O=void 0}=t,{pitch:Z=0}=t,{bearing:G=0}=t,{bounds:K=void 0}=t,{hash:V=!1}=t,{loaded:H=!1}=t,{minZoom:Q=0}=t,{maxZoom:it=22}=t,{zoomOnDoubleClick:ht=!0}=t,{interactive:ft=!0}=t,{attributionControl:dt=!0}=t,{cooperativeGestures:ut=!1}=t,{preserveDrawingBuffer:Mt=!1}=t,{maxBounds:xt=void 0}=t,{images:yt=[]}=t,{standardControls:de=!1}=t,{filterLayers:Rt=void 0}=t,{transformRequest:Gt=void 0}=t;const Kt=np(),{map:be,loadedImages:me}=oE();Ee(e,be,Wt=>n(3,u=Wt)),Ee(e,me,Wt=>n(4,p=Wt));let an=new Set;function jn(Wt){u!=null&&u.loaded()&&("url"in Wt?(an.add(Wt.id),u.loadImage(Wt.url,(Me,yn)=>{an.delete(Wt.id),Me?Kt("error",Me):yn&&(u==null||u.addImage(Wt.id,yn,Wt.options),p.add(Wt.id),me.set(p))})):(u.addImage(Wt.id,Wt.data,Wt.options),p.add(Wt.id),me.set(p)))}let He,ke,Be,fn;function Mn(Wt){if(V){let Me=NE(window.location.hash);Me.length>=3&&(n(11,O=Me[0]),n(10,N=[Me[2],Me[1]])),Me.length==5&&(n(15,G=Me[3]),n(14,Z=Me[4]))}return nn(be,u=new Ls.Map(Hm({container:Wt,style:L,center:N,zoom:O,pitch:Z,bearing:G,minZoom:Q,maxZoom:it,interactive:ft,preserveDrawingBuffer:Mt,maxBounds:xt,bounds:K,attributionControl:dt,transformRequest:Gt,cooperativeGestures:ut})),u),u.on("load",Me=>{n(0,H=!0),Kt("load",u)}),u.on("error",Me=>Kt("error",{...Me,map:u})),u.on("movestart",Me=>Kt("movestart",{...Me,map:u})),u.on("moveend",Me=>{if(n(10,N=Me.target.getCenter()),n(11,O=Me.target.getZoom()),n(12,K=Me.target.getBounds()),Kt("moveend",{...Me,map:u}),V){let yn=window.location.href.replace(/(#.+)?$/,kE(u));window.history.replaceState(window.history.state,"",yn)}}),u.on("zoomstart",Me=>Kt("zoomstart",{...Me,map:u})),u.on("zoom",Me=>{n(11,O=Me.target.getZoom()),Kt("zoom",{...Me,map:u})}),u.on("zoomend",Me=>{n(11,O=Me.target.getZoom()),Kt("zoomend",{...Me,map:u})}),u.on("style.load",()=>{if(u){const Me=u.getStyle();if(n(30,He=Me.layers.map(yn=>yn.id)),n(31,ke=Object.keys(Me.sources)),fn)for(const[yn,ni]of Object.entries(fn))u.addSource(yn,ni);if(Be)for(const yn of Be)u.addLayer(yn)}}),u.on("styledata",Me=>{if(u&&Rt){const yn=u.getStyle().layers;if(yn)for(let ni of yn)Rt(ni)||u.setLayoutProperty(ni.id,"visibility","none")}Kt("styledata",{...Me,map:u})}),{destroy(){n(0,H=!1),u==null||u.remove(),nn(be,u=null,u)}}}let ln=L;return e.$$set=Wt=>{"map"in Wt&&n(13,x=Wt.map),"class"in Wt&&n(1,S=Wt.class),"style"in Wt&&n(16,L=Wt.style),"diffStyleUpdates"in Wt&&n(17,A=Wt.diffStyleUpdates),"center"in Wt&&n(10,N=Wt.center),"zoom"in Wt&&n(11,O=Wt.zoom),"pitch"in Wt&&n(14,Z=Wt.pitch),"bearing"in Wt&&n(15,G=Wt.bearing),"bounds"in Wt&&n(12,K=Wt.bounds),"hash"in Wt&&n(18,V=Wt.hash),"loaded"in Wt&&n(0,H=Wt.loaded),"minZoom"in Wt&&n(19,Q=Wt.minZoom),"maxZoom"in Wt&&n(20,it=Wt.maxZoom),"zoomOnDoubleClick"in Wt&&n(21,ht=Wt.zoomOnDoubleClick),"interactive"in Wt&&n(22,ft=Wt.interactive),"attributionControl"in Wt&&n(23,dt=Wt.attributionControl),"cooperativeGestures"in Wt&&n(24,ut=Wt.cooperativeGestures),"preserveDrawingBuffer"in Wt&&n(25,Mt=Wt.preserveDrawingBuffer),"maxBounds"in Wt&&n(26,xt=Wt.maxBounds),"images"in Wt&&n(27,yt=Wt.images),"standardControls"in Wt&&n(2,de=Wt.standardControls),"filterLayers"in Wt&&n(28,Rt=Wt.filterLayers),"transformRequest"in Wt&&n(29,Gt=Wt.transformRequest),"$$scope"in Wt&&n(33,_=Wt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&4&&n(6,i=typeof de=="boolean"?void 0:de),e.$$.dirty[0]&8&&n(13,x=u),e.$$.dirty[0]&134217737&&H&&u!=null&&u.loaded())for(let Wt of yt)!an.has(Wt.id)&&!u.hasImage(Wt.id)&&jn(Wt);if(e.$$.dirty[0]&134217744&&n(5,r=yt.every(Wt=>p.has(Wt.id))),e.$$.dirty[0]&1073938440|e.$$.dirty[1]&3&&u&&!Pm(L,ln)){const Wt=u.getStyle();if(He&&(Be=Wt.layers.filter(Me=>!He.includes(Me.id))),ke){const Me=Object.keys(Wt.sources).filter(yn=>!ke.includes(yn));fn={};for(const yn of Me)fn[yn]=Wt.sources[yn]}n(32,ln=L),u.setStyle(L,{diff:A})}e.$$.dirty[0]&1032&&N&&!Pm(N,u==null?void 0:u.getCenter())&&(u==null||u.panTo(N)),e.$$.dirty[0]&2056&&O&&!Pm(O,u==null?void 0:u.getZoom())&&(u==null||u.zoomTo(O)),e.$$.dirty[0]&4104&&K&&!Pm(K,u==null?void 0:u.getBounds())&&(u==null||u.fitBounds(K)),e.$$.dirty[0]&2097160&&(ht?u==null||u.doubleClickZoom.enable():u==null||u.doubleClickZoom.disable())},[H,S,de,u,p,r,i,be,me,Mn,N,O,K,x,Z,G,L,A,V,Q,it,ht,ft,dt,ut,Mt,xt,yt,Rt,Gt,He,ke,ln,_,a]}class jE extends sn{constructor(t){super(),on(this,t,GE,UE,Qe,{map:13,class:1,style:16,diffStyleUpdates:17,center:10,zoom:11,pitch:14,bearing:15,bounds:12,hash:18,loaded:0,minZoom:19,maxZoom:20,zoomOnDoubleClick:21,interactive:22,attributionControl:23,cooperativeGestures:24,preserveDrawingBuffer:25,maxBounds:26,images:27,standardControls:2,filterLayers:28,transformRequest:29},null,[-1,-1])}}function qE(e){let t,n,i,r,u,p,a;const _=e[17].default,x=mr(_,e,e[16],null);return{c(){t=vt("div"),x&&x.c(),kt(t,"tabindex",n=e[1]?0:void 0),kt(t,"role",i=e[1]?"button":void 0),Wn(t,"z-index",e[2])},m(S,L){Nt(S,t,L),x&&x.m(t,null),u=!0,p||(a=[J_(e[6].call(null,t)),J_(r=ZE.call(null,t,e[0])),xe(t,"click",e[18]),xe(t,"dblclick",e[19]),xe(t,"contextmenu",e[20]),xe(t,"mouseenter",e[21]),xe(t,"mouseleave",e[22]),xe(t,"mousemove",e[23]),xe(t,"keydown",e[7])],p=!0)},p(S,[L]){x&&x.p&&(!u||L&65536)&&_r(x,_,S,S[16],u?gr(_,S[16],L,null):yr(S[16]),null),(!u||L&2&&n!==(n=S[1]?0:void 0))&&kt(t,"tabindex",n),(!u||L&2&&i!==(i=S[1]?"button":void 0))&&kt(t,"role",i),r&&fg(r.update)&&L&1&&r.update.call(null,S[0]),L&4&&Wn(t,"z-index",S[2])},i(S){u||(wt(x,S),u=!0)},o(S){Pt(x,S),u=!1},d(S){S&&At(t),x&&x.d(S),p=!1,or(a)}}}function ZE(e,t){const n=e.className;function i(r){r?e.className=`${n} ${r}`:e.className=n}return i(t),{update:i}}function WE(e,t,n){let i,r,u,{$$slots:p={},$$scope:a}=t,{lngLat:_}=t,{class:x=void 0}=t,{interactive:S=!0}=t,{asButton:L=!1}=t,{draggable:A=!1}=t,{feature:N=null}=t,{offset:O=void 0}=t,{zIndex:Z=void 0}=t,{rotation:G=0}=t;const K=np(),{map:V,layerEvent:H,self:Q}=lE();Ee(e,V,Gt=>n(25,u=Gt)),Ee(e,H,Gt=>n(24,i=Gt)),Ee(e,Q,Gt=>n(15,r=Gt));function it(Gt){nn(Q,r=new Ls.Marker({element:Gt,rotation:G,draggable:A,offset:O}).setLngLat(_).addTo(u),r);const Kt=()=>dt("dragstart"),be=()=>{ht(),dt("drag")},me=()=>{ht(),dt("dragend")};return A&&(r.on("dragstart",Kt),r.on("drag",be),r.on("dragend",me)),{destroy(){A&&(r==null||r.off("dragstart",Kt),r==null||r.off("drag",be),r==null||r.off("dragend",me)),r==null||r.remove()}}}function ht(){let Gt=r==null?void 0:r.getLngLat();Gt&&(Array.isArray(_)?n(9,_=[Gt.lng,Gt.lat]):_&&"lon"in _?n(9,_={lon:Gt.lng,lat:Gt.lat}):n(9,_=Gt))}function ft(Gt){Gt.key===" "&&(Gt.preventDefault(),Gt.stopPropagation(),dt("click"))}function dt(Gt){if(!S)return;let Kt=r==null?void 0:r.getLngLat();if(!Kt)return;const be=[Kt.lng,Kt.lat];let me={map:u,marker:r,lngLat:be,features:[{type:"Feature",properties:(N==null?void 0:N.properties)??{},geometry:{type:"Point",coordinates:be}}]};nn(H,i={...me,layerType:"marker",type:Gt},i),K(Gt,me)}const ut=()=>dt("click"),Mt=()=>dt("dblclick"),xt=()=>dt("contextmenu"),yt=Gt=>{dt("mouseenter")},de=()=>{dt("mouseleave")},Rt=()=>dt("mousemove");return e.$$set=Gt=>{"lngLat"in Gt&&n(9,_=Gt.lngLat),"class"in Gt&&n(0,x=Gt.class),"interactive"in Gt&&n(10,S=Gt.interactive),"asButton"in Gt&&n(1,L=Gt.asButton),"draggable"in Gt&&n(11,A=Gt.draggable),"feature"in Gt&&n(12,N=Gt.feature),"offset"in Gt&&n(13,O=Gt.offset),"zIndex"in Gt&&n(2,Z=Gt.zIndex),"rotation"in Gt&&n(14,G=Gt.rotation),"$$scope"in Gt&&n(16,a=Gt.$$scope)},e.$$.update=()=>{e.$$.dirty&33280&&(r==null||r.setLngLat(_)),e.$$.dirty&40960&&(r==null||r.setOffset(O??[0,0])),e.$$.dirty&49152&&(r==null||r.setRotation(G))},[x,L,Z,V,H,Q,it,ft,dt,_,S,A,N,O,G,r,a,p,ut,Mt,xt,yt,de,Rt]}class Xv extends sn{constructor(t){super(),on(this,t,WE,qE,Qe,{lngLat:9,class:0,interactive:10,asButton:1,draggable:11,feature:12,offset:13,zIndex:2,rotation:14})}}const XE=e=>({features:e[0]&16,data:e[0]&16,map:e[0]&4,close:e[0]&1}),Hv=e=>{var t;return{features:e[4],data:(t=e[4])==null?void 0:t[0],map:e[2],close:e[31]}};function Yv(e){let t,n,i=(e[4]||e[3]instanceof Ls.Marker)&&Kv(e);return{c(){t=vt("div"),i&&i.c()},m(r,u){Nt(r,t,u),i&&i.m(t,null),e[32](t),n=!0},p(r,u){r[4]||r[3]instanceof Ls.Marker?i?(i.p(r,u),u[0]&24&&wt(i,1)):(i=Kv(r),i.c(),wt(i,1),i.m(t,null)):i&&(Ii(),Pt(i,1,1,()=>{i=null}),Ci())},i(r){n||(wt(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&At(t),i&&i.d(),e[32](null)}}}function Kv(e){let t;const n=e[30].default,i=mr(n,e,e[29],Hv);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u[0]&536870933)&&_r(i,n,r,r[29],t?gr(n,r[29],u,XE):yr(r[29]),Hv)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function HE(e){let t,n,i=e[9].default&&Yv(e);return{c(){i&&i.c(),t=$o()},m(r,u){i&&i.m(r,u),Nt(r,t,u),n=!0},p(r,u){r[9].default?i?(i.p(r,u),u[0]&512&&wt(i,1)):(i=Yv(r),i.c(),wt(i,1),i.m(t.parentNode,t)):i&&(Ii(),Pt(i,1,1,()=>{i=null}),Ci())},i(r){n||(wt(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&At(t),i&&i.d(r)}}}function YE(e,t,n){let i,r,u,p,a,_,{$$slots:x={},$$scope:S}=t;const L=CS(x);let{closeButton:A=void 0}=t,{closeOnClickOutside:N=!0}=t,{closeOnClickInside:O=!1}=t,{closeOnMove:Z=!1}=t,{openOn:G="click"}=t,{openIfTopMost:K=!0}=t,{focusAfterOpen:V=!0}=t,{anchor:H=void 0}=t,{offset:Q=void 0}=t,{popupClass:it=void 0}=t,{maxWidth:ht=void 0}=t,{lngLat:ft=void 0}=t,{html:dt=void 0}=t,{open:ut=!1}=t;const{map:Mt,popupTarget:xt,layerEvent:yt,layer:de,eventTopMost:Rt}=rp();Ee(e,Mt,Ct=>n(2,u=Ct)),Ee(e,xt,Ct=>n(3,a=Ct)),Ee(e,yt,Ct=>n(28,p=Ct)),Ee(e,de,Ct=>n(35,_=Ct));const Gt=["click","dblclick","contextmenu"];let Kt,be=!1,me;function an(){if(!Kt)return;let Ct=Kt.getElement();!Ct||Ct===me||(me=Ct,G==="hover"&&(me.style.pointerEvents="none"),me.addEventListener("mouseenter",()=>{n(24,be=!0)},{passive:!0}),me.addEventListener("mouseleave",()=>{n(24,be=!1)},{passive:!0}),me.addEventListener("click",()=>{O&&n(0,ut=!1)},{passive:!0}))}cd(()=>{if(u)return u.on("click",yn),u.on("contextmenu",yn),typeof a=="string"&&(u.on("click",a,Be),u.on("dblclick",a,Be),u.on("contextmenu",a,Be),u.on("mousemove",a,Me),u.on("mouseleave",a,Wt),u.on("touchstart",a,Mn),u.on("touchend",a,ln)),()=>{u!=null&&u.loaded()&&(Kt==null||Kt.remove(),u.off("click",yn),u.off("contextmenu",yn),a instanceof Ls.Marker?a.getPopup()===Kt&&a.setPopup(void 0):typeof a=="string"&&(u.off("click",a,Be),u.off("dblclick",a,Be),u.off("contextmenu",a,Be),u.off("mousemove",a,Me),u.off("mouseleave",a,Wt),u.off("touchstart",a,Mn),u.off("touchend",a,ln)))}});function jn(Ct){return K?!("marker"in Ct)&&!uE(Ct)&&Rt(Ct)!==_:!1}let He=null,ke="normal";function Be(Ct){Ct.type===G&&(jn(Ct)||("layerType"in Ct?Ct.layerType==="deckgl"?(n(10,ft=Ct.coordinate),n(4,He=Ct.object?[Ct.object]:null)):(n(10,ft=Ct.lngLat),n(4,He=Ct.features??[])):(n(10,ft=Ct.lngLat),n(4,He=Ct.features??[])),setTimeout(()=>n(0,ut=!0))))}let fn=null;function Mn(Ct){fn=Ct.point}function ln(Ct){if(!fn||G!=="hover")return;let Ge=fn.dist(Ct.point);fn=null,Ge<3&&(n(10,ft=Ct.lngLat),n(4,He=Ct.features??[]),Kt.isOpen()?n(25,ke="justOpened"):(n(25,ke="opening"),n(0,ut=!0)))}function Wt(Ct){G!=="hover"||fn||ke!=="normal"||(n(0,ut=!1),n(4,He=null))}function Me(Ct){if(!(G!=="hover"||fn||ke!=="normal")){if(jn(Ct)){n(0,ut=!1),n(4,He=null);return}n(0,ut=!0),n(4,He=Ct.features??[]),n(10,ft=Ct.lngLat)}}function yn(Ct){if(ke==="justOpened"){n(25,ke="normal");return}if(!N)return;let Ge=[me,a instanceof Ls.Marker?a==null?void 0:a.getElement():null];ut&&Kt.isOpen()&&!Ge.some(je=>je==null?void 0:je.contains(Ct.originalEvent.target))&&(Ct.type==="contextmenu"&&G==="contextmenu"||Ct.type!=="contextmenu")&&n(0,ut=!1)}ks(()=>{u&&(Kt!=null&&Kt.isOpen())&&Kt.remove()});let ni;const _o=()=>n(0,ut=!1);function tr(Ct){Qi[Ct?"unshift":"push"](()=>{ni=Ct,n(1,ni)})}return e.$$set=Ct=>{"closeButton"in Ct&&n(11,A=Ct.closeButton),"closeOnClickOutside"in Ct&&n(12,N=Ct.closeOnClickOutside),"closeOnClickInside"in Ct&&n(13,O=Ct.closeOnClickInside),"closeOnMove"in Ct&&n(14,Z=Ct.closeOnMove),"openOn"in Ct&&n(15,G=Ct.openOn),"openIfTopMost"in Ct&&n(16,K=Ct.openIfTopMost),"focusAfterOpen"in Ct&&n(17,V=Ct.focusAfterOpen),"anchor"in Ct&&n(18,H=Ct.anchor),"offset"in Ct&&n(19,Q=Ct.offset),"popupClass"in Ct&&n(20,it=Ct.popupClass),"maxWidth"in Ct&&n(21,ht=Ct.maxWidth),"lngLat"in Ct&&n(10,ft=Ct.lngLat),"html"in Ct&&n(22,dt=Ct.html),"open"in Ct&&n(0,ut=Ct.open),"$$scope"in Ct&&n(29,S=Ct.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&14336&&n(27,i=A??(!N&&!O)),e.$$.dirty[0]&146685952&&(Kt||(n(23,Kt=new Ls.Popup({closeButton:i,closeOnClick:!1,closeOnMove:Z,focusAfterOpen:V,maxWidth:ht,className:it,anchor:H,offset:Q})),me=Kt.getElement(),Kt.on("open",()=>{n(0,ut=!0),an()}),Kt.on("close",Ct=>{n(0,ut=!1)}))),e.$$.dirty[0]&8421384&&Kt&&a instanceof Ls.Marker&&(G==="click"?a.setPopup(Kt):a.getPopup()===Kt&&a.setPopup(void 0)),e.$$.dirty[0]&268468224&&Gt.includes(G)&&(p==null?void 0:p.type)===G&&(Be(p),nn(yt,p=null,p)),e.$$.dirty[0]&268468224&&n(26,r=G==="hover"&&((p==null?void 0:p.type)==="mousemove"||(p==null?void 0:p.type)==="mouseenter")),e.$$.dirty[0]&352354304&&G==="hover"&&yt&&(r&&p&&(p.layerType==="deckgl"?(n(10,ft=p.coordinate),n(4,He=p.object?[p.object]:null)):(n(10,ft=p.lngLat),n(4,He=p.features??[]))),n(0,ut=(r||be)??!1)),e.$$.dirty[0]&12582914&&(ni?Kt.setDOMContent(ni):dt&&Kt.setHTML(dt)),e.$$.dirty[0]&8389632&&ft&&Kt.setLngLat(ft),e.$$.dirty[0]&41943045&&u){let Ct=Kt.isOpen();ut&&!Ct?(Kt.addTo(u),ke==="opening"&&n(25,ke="justOpened")):!ut&&Ct&&Kt.remove()}},[ut,ni,u,a,He,Mt,xt,yt,de,L,ft,A,N,O,Z,G,K,V,H,Q,it,ht,dt,Kt,be,ke,r,i,p,S,x,_o,tr]}class KE extends sn{constructor(t){super(),on(this,t,YE,HE,Qe,{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])}}function JE(e){let t;const n=e[16].default,i=mr(n,e,e[24],null);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u&16777216)&&_r(i,n,r,r[24],t?gr(n,r[24],u,null):yr(r[24]),null)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function QE(e){let t,n,i;function r(p){e[17](p)}let u={id:e[1],type:"symbol",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[JE]},$$scope:{ctx:e}};return e[0]!==void 0&&(u.hovered=e[0]),t=new mg({props:u}),Qi.push(()=>Ru(t,"hovered",r)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){ee(t.$$.fragment)},m(p,a){$t(t,p,a),i=!0},p(p,[a]){const _={};a&2&&(_.id=p[1]),a&4&&(_.source=p[2]),a&8&&(_.sourceLayer=p[3]),a&16&&(_.beforeId=p[4]),a&32&&(_.beforeLayerType=p[5]),a&64&&(_.paint=p[6]),a&128&&(_.layout=p[7]),a&256&&(_.filter=p[8]),a&512&&(_.applyToClusters=p[9]),a&1024&&(_.minzoom=p[10]),a&2048&&(_.maxzoom=p[11]),a&4096&&(_.hoverCursor=p[12]),a&8192&&(_.manageHoverState=p[13]),a&16384&&(_.eventsIfTopMost=p[14]),a&32768&&(_.interactive=p[15]),a&16777216&&(_.$$scope={dirty:a,ctx:p}),!n&&a&1&&(n=!0,_.hovered=p[0],Du(()=>n=!1)),t.$set(_)},i(p){i||(wt(t.$$.fragment,p),i=!0)},o(p){Pt(t.$$.fragment,p),i=!1},d(p){te(t,p)}}}function $E(e,t,n){let{$$slots:i={},$$scope:r}=t,{id:u=ip("symbol")}=t,{source:p=void 0}=t,{sourceLayer:a=void 0}=t,{beforeId:_=void 0}=t,{beforeLayerType:x=void 0}=t,{paint:S=void 0}=t,{layout:L=void 0}=t,{filter:A=void 0}=t,{applyToClusters:N=void 0}=t,{minzoom:O=void 0}=t,{maxzoom:Z=void 0}=t,{hoverCursor:G=void 0}=t,{manageHoverState:K=!1}=t,{hovered:V=null}=t,{eventsIfTopMost:H=!1}=t,{interactive:Q=!0}=t;function it(yt){V=yt,n(0,V)}function ht(yt){ai.call(this,e,yt)}function ft(yt){ai.call(this,e,yt)}function dt(yt){ai.call(this,e,yt)}function ut(yt){ai.call(this,e,yt)}function Mt(yt){ai.call(this,e,yt)}function xt(yt){ai.call(this,e,yt)}return e.$$set=yt=>{"id"in yt&&n(1,u=yt.id),"source"in yt&&n(2,p=yt.source),"sourceLayer"in yt&&n(3,a=yt.sourceLayer),"beforeId"in yt&&n(4,_=yt.beforeId),"beforeLayerType"in yt&&n(5,x=yt.beforeLayerType),"paint"in yt&&n(6,S=yt.paint),"layout"in yt&&n(7,L=yt.layout),"filter"in yt&&n(8,A=yt.filter),"applyToClusters"in yt&&n(9,N=yt.applyToClusters),"minzoom"in yt&&n(10,O=yt.minzoom),"maxzoom"in yt&&n(11,Z=yt.maxzoom),"hoverCursor"in yt&&n(12,G=yt.hoverCursor),"manageHoverState"in yt&&n(13,K=yt.manageHoverState),"hovered"in yt&&n(0,V=yt.hovered),"eventsIfTopMost"in yt&&n(14,H=yt.eventsIfTopMost),"interactive"in yt&&n(15,Q=yt.interactive),"$$scope"in yt&&n(24,r=yt.$$scope)},[V,u,p,a,_,x,S,L,A,N,O,Z,G,K,H,Q,i,it,ht,ft,dt,ut,Mt,xt,r]}class tI extends sn{constructor(t){super(),on(this,t,$E,QE,Qe,{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 pd=Uint8Array,ex=Uint16Array,eI=Int32Array,nI=new pd([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]),iI=new pd([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]),nx=function(e,t){for(var n=new ex(31),i=0;i<31;++i)n[i]=t+=1<>1|(ei&21845)<<1,Fl=(Fl&52428)>>2|(Fl&13107)<<2,Fl=(Fl&61680)>>4|(Fl&3855)<<4,sI[ei]=((Fl&65280)>>8|(Fl&255)<<8)>>1;var Fl,ei,gg=new pd(288);for(ei=0;ei<144;++ei)gg[ei]=8;var ei;for(ei=144;ei<256;++ei)gg[ei]=9;var ei;for(ei=256;ei<280;++ei)gg[ei]=7;var ei;for(ei=280;ei<288;++ei)gg[ei]=8;var ei,aI=new pd(32);for(ei=0;ei<32;++ei)aI[ei]=5;var ei,lI=new pd(0),uI=typeof TextDecoder<"u"&&new TextDecoder,cI=0;try{uI.decode(lI,{stream:!0}),cI=1}catch{}const rx=pi({type:"FeatureCollection",features:[]}),hI=pi(!0),ox=pi(0),pI=30;class fI{constructor(t,n){qn(this,"map");qn(this,"inner");qn(this,"active");qn(this,"eventListenersSuccess");qn(this,"eventListenersUpdated");qn(this,"eventListenersFailure");qn(this,"onMouseMove",t=>{if(!this.active)return;const n=[t.point.x-pI,t.point.y],i=this.map.unproject(t.point).distanceTo(this.map.unproject(n));this.inner.onMouseMove(t.lngLat.lng,t.lngLat.lat,i)&&(this.redraw(),this.dataUpdated())});qn(this,"onClick",()=>{this.active&&(this.inner.onClick(),this.redraw(),this.dataUpdated())});qn(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.inner.onClick(),this.finish())});qn(this,"onDragStart",()=>{this.active&&this.inner.onDragStart()&&this.map.dragPan.disable()});qn(this,"onMouseUp",()=>{this.active&&this.inner.onMouseUp()&&this.map.dragPan.enable()});qn(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});qn(this,"onKeyPress",t=>{this.active&&t.target.tagName!="INPUT"&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="s"?(t.stopPropagation(),this.inner.toggleSnapMode(),this.redraw()):t.key=="z"&&t.ctrlKey&&this.undo())});this.map=t,console.time("Deserialize and setup JsRouteSnapper"),this.inner=new Xm(n),console.timeEnd("Deserialize and setup JsRouteSnapper"),this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],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(t){t.properties??(t.properties={}),this.active&&window.alert("Bug: editExistingRoute called when tool is already active"),t.properties.waypoints||(t.properties.waypoints=[{lon:t.geometry.coordinates[0][0],lat:t.geometry.coordinates[0][1],snapped:!0},{lon:t.geometry.coordinates[t.geometry.coordinates.length-1][0],lat:t.geometry.coordinates[t.geometry.coordinates.length-1][1],snapped:!0}]),this.startRoute(),this.inner.editExisting(t.properties.waypoints),this.redraw()}editExistingArea(t){t.properties??(t.properties={}),this.active&&window.alert("Bug: editExistingArea called when tool is already active"),t.properties.waypoints||window.alert("Bug: editExistingArea called for a polygon not produced by the route-snapper"),this.startArea(),this.inner.editExisting(t.properties.waypoints),this.redraw()}addEventListenerSuccess(t){this.eventListenersSuccess.push(t)}addEventListenerUpdated(t){this.eventListenersUpdated.push(t)}addEventListenerFailure(t){this.eventListenersFailure.push(t)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}isActive(){return this.active}finish(){let t=this.inner.toFinalFeature();if(t)for(let n of this.eventListenersSuccess)n(JSON.parse(t));else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){this.inner.clearState(),this.finish()}setRouteConfig(t){this.inner.setRouteConfig(t),this.redraw()}addSnappedWaypoint(t){this.inner.addSnappedWaypoint(t[0],t[1]),this.redraw()}undo(){this.inner.undo(),this.redraw()}redraw(){let t=JSON.parse(this.inner.renderGeojson());rx.set(t),this.map.getCanvas().style.cursor=t.cursor,hI.set(t.snap_mode),ox.set(t.undo_length)}dataUpdated(){let t=this.inner.toFinalFeature();if(t)for(let n of this.eventListenersUpdated)n(JSON.parse(t))}}const Ly="MZEJTanw3WpxRvt7qDfo";let Hl=pi(null),sx=pi(`https://api.maptiler.com/maps/dataviz/style.json?key=${Ly}`),Pu=pi(""),Ym=pi(!0),iy=pi(null),ry=pi(null),oy=pi(null),Wo=pi(null),jf=pi(null),Km=pi(new dg.LngLat(0,0)),Jm=pi(new dg.LngLat(0,0)),_c=pi(1),Gn=pi({mode:"title"});function dI(e){let t,n,i,r,u,p,a,_,x;return{c(){t=vt("label"),n=Xe(`Basemap: + `),i=vt("select"),r=vt("option"),r.textContent="MapTiler Dataviz",u=vt("option"),u.textContent="MapTiler Streets",p=vt("option"),p.textContent="MapTiler Satellite",a=vt("option"),a.textContent="OS Open Zoomstack",r.__value="dataviz",jl(r,r.__value),u.__value="streets",jl(u,u.__value),p.__value="hybrid",jl(p,p.__value),a.__value="uk-openzoomstack-light",jl(a,a.__value),e[0]===void 0&&Gf(()=>e[1].call(i))},m(S,L){Nt(S,t,L),mt(t,n),mt(t,i),mt(i,r),mt(i,u),mt(i,p),mt(i,a),Wm(i,e[0],!0),_||(x=xe(i,"change",e[1]),_=!0)},p(S,[L]){L&1&&Wm(i,S[0])},i:Le,o:Le,d(S){S&&At(t),_=!1,x()}}}function mI(e,t,n){let i="dataviz";function r(){i=Bb(this),n(0,i)}return e.$$.update=()=>{e.$$.dirty&1&&sx.set(`https://api.maptiler.com/maps/${i}/style.json?key=${Ly}`)},[i,r]}class gI extends sn{constructor(t){super(),on(this,t,mI,dI,Qe,{})}}var _I=Object.defineProperty,yI=(e,t,n)=>t in e?_I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jv=(e,t,n)=>(yI(e,typeof t!="symbol"?t+"":t,n),n);function qf(){}function ax(e){return e()}function Qv(){return Object.create(null)}function _g(e){e.forEach(ax)}function lx(e){return typeof e=="function"}function vI(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function bI(e){return Object.keys(e).length===0}function xI(e,t){e.appendChild(t)}function wI(e,t,n){e.insertBefore(t,n||null)}function ux(e){e.parentNode&&e.parentNode.removeChild(e)}function $v(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function Iu(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function SI(e){return Array.from(e.childNodes)}function Am(e,t,n){e.classList.toggle(t,!!n)}let My;function Bf(e){My=e}const Mh=[],t1=[];let Nh=[];const e1=[],EI=Promise.resolve();let sy=!1;function II(){sy||(sy=!0,EI.then(cx))}function ay(e){Nh.push(e)}const Z_=new Set;let Ih=0;function cx(){if(Ih!==0)return;const e=My;do{try{for(;Ihe.indexOf(i)===-1?t.push(i):n.push(i)),n.forEach(i=>i()),Nh=t}const LI=new Set;function MI(e,t){e&&e.i&&(LI.delete(e),e.i(t))}function PI(e,t,n){const{fragment:i,after_update:r}=e.$$;i&&i.m(t,n),ay(()=>{const u=e.$$.on_mount.map(ax).filter(lx);e.$$.on_destroy?e.$$.on_destroy.push(...u):_g(u),e.$$.on_mount=[]}),r.forEach(ay)}function AI(e,t){const n=e.$$;n.fragment!==null&&(TI(n.after_update),_g(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function kI(e,t){e.$$.dirty[0]===-1&&(Mh.push(e),II(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const O=N.length?N[0]:A;return x.ctx&&r(x.ctx[L],x.ctx[L]=O)&&(!x.skip_bound&&x.bound[L]&&x.bound[L](O),S&&kI(e,L)),A}):[],x.update(),S=!0,_g(x.before_update),x.fragment=i?i(x.ctx):!1,t.target){if(t.hydrate){const L=SI(t.target);x.fragment&&x.fragment.l(L),L.forEach(ux)}else x.fragment&&x.fragment.c();t.intro&&MI(e.$$.fragment),PI(e,t.target,t.anchor),cx()}Bf(_)}class DI{constructor(){Jv(this,"$$"),Jv(this,"$$set")}$destroy(){AI(this,1),this.$destroy=qf}$on(t,n){if(!lx(n))return qf;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(t){this.$$set&&!bI(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const RI="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(RI);function OI(e){let t,n,i;return{c(){t=$v("svg"),n=$v("path"),Iu(n,"stroke-width","4"),Iu(n,"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"),Iu(n,"class","svelte-gzo3ar"),Iu(t,"width",i=e[0]==="list"?20:void 0),Iu(t,"viewBox","0 0 70 85"),Iu(t,"fill","none"),Iu(t,"class","svelte-gzo3ar"),Am(t,"in-map",e[0]!=="list"),Am(t,"list-icon",e[0]==="list")},m(r,u){wI(r,t,u),xI(t,n)},p(r,[u]){u&1&&i!==(i=r[0]==="list"?20:void 0)&&Iu(t,"width",i),u&1&&Am(t,"in-map",r[0]!=="list"),u&1&&Am(t,"list-icon",r[0]==="list")},i:qf,o:qf,d(r){r&&ux(t)}}}function zI(e,t,n){let{displayIn:i}=t;return e.$$set=r=>{"displayIn"in r&&n(0,i=r.displayIn)},[i]}class FI extends DI{constructor(t){super(),NI(this,t,zI,OI,vI,{displayIn:0})}}const BI=[{verbatimCoordinates:"40.123, -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:'40° 7´ 22.8" N 74° 7´ 22.8" W',verbatimLatitude:'40° 7´ 22.8" N',verbatimLongitude:'74° 7´ 22.8" W'},{verbatimCoordinates:"40° 7.38’ , -74° 7.38’",verbatimLatitude:"40° 7.38’",verbatimLongitude:"-74° 7.38’"},{verbatimCoordinates:"N40°7’22.8’’, W74°7’22.8’’",verbatimLatitude:"N40°7’22.8’’",verbatimLongitude:"W74°7’22.8’’"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:`40°7'22.8"N, 74°7'22.8"W`,verbatimLatitude:`40°7'22.8"N`,verbatimLongitude:`74°7'22.8"W`},{verbatimCoordinates:"40 7 22.8, -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"},{verbatimCoordinates:"40.123 -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123°,-74.123°",verbatimLatitude:"40.123°",verbatimLongitude:"-74.123°"},{verbatimCoordinates:"40.123N74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"4007.38N7407.38W",verbatimLatitude:"4007.38N",verbatimLongitude:"7407.38W"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:"400722.8N740722.8W",verbatimLatitude:"400722.8N",verbatimLongitude:"740722.8W"},{verbatimCoordinates:"N 40 7.38 W 74 7.38",verbatimLatitude:"N 40 7.38",verbatimLongitude:"W 74 7.38"},{verbatimCoordinates:"40:7:22.8N 74:7:22.8W",verbatimLatitude:"40:7:22.8N",verbatimLongitude:"74:7:22.8W"},{verbatimCoordinates:"40:7:23N,74:7:23W",verbatimLatitude:"40:7:23N",verbatimLongitude:"74:7:23W",decimalLatitude:40.1230555555,decimalLongitude:-74.1230555555},{verbatimCoordinates:'40°7’23"N 74°7’23"W',verbatimLatitude:'40°7’23"N',verbatimLongitude:'74°7’23"W',decimalLatitude:40.1230555555,decimalLongitude:-74.12305555555555},{verbatimCoordinates:'40°7’23"S 74°7’23"E',verbatimLatitude:'40°7’23"S',verbatimLongitude:'74°7’23"E',decimalLatitude:-40.1230555555,decimalLongitude:74.12305555555555},{verbatimCoordinates:'40°7’23" -74°7’23"',verbatimLatitude:'40°7’23"',verbatimLongitude:'-74°7’23"',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:'40d 7’ 23" N 74d 7’ 23" W',verbatimLatitude:'40d 7’ 23" N',verbatimLongitude:'74d 7’ 23" W',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:"40.123N 74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40 7 22.8; -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"}],VI={decimalLatitude:40.123,decimalLongitude:-74.123},UI=[{verbatimCoordinates:`50°4'17.698"south, 14°24'2.826"east`,verbatimLatitude:`50°4'17.698"south`,verbatimLongitude:`14°24'2.826"east`,decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"50d4m17.698S 14d24m2.826E",verbatimLatitude:"50d4m17.698S",verbatimLongitude:"14d24m2.826E",decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"40:26:46N,79:56:55W",verbatimLatitude:"40:26:46N",verbatimLongitude:"79:56:55W",decimalLatitude:40.44611111111111,decimalLongitude:-79.9486111111111},{verbatimCoordinates:"40:26:46.302N 79:56:55.903W",verbatimLatitude:"40:26:46.302N",verbatimLongitude:"79:56:55.903W",decimalLatitude:40.446195,decimalLongitude:-79.94886194444445},{verbatimCoordinates:"40°26′47″N 79°58′36″W",verbatimLatitude:"40°26′47″N",verbatimLongitude:"79°58′36″W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40d 26′ 47″ N 79d 58′ 36″ W",verbatimLatitude:"40d 26′ 47″ N",verbatimLongitude:"79d 58′ 36″ W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40.446195N 79.948862W",verbatimLatitude:"40.446195N",verbatimLongitude:"79.948862W",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40,446195° 79,948862°",verbatimLatitude:"40,446195°",verbatimLongitude:"79,948862°",decimalLatitude:40.446195,decimalLongitude:79.948862},{verbatimCoordinates:"40° 26.7717, -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.446195, -79.948862",verbatimLatitude:"40.446195",verbatimLongitude:"-79.948862",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.123256; -74.123256",verbatimLatitude:"40.123256",verbatimLongitude:"-74.123256",decimalLatitude:40.123256,decimalLongitude:-74.123256},{verbatimCoordinates:"18°24S 22°45E",verbatimLatitude:"18°24S",verbatimLongitude:"22°45E",decimalLatitude:-18.4,decimalLongitude:22.75}],GI=[{verbatimCoordinates:"10.432342S 10.6345345E",verbatimLatitude:"10.432342S",verbatimLongitude:"10.6345345E",decimalLatitude:-10.432342,decimalLongitude:10.6345345},{verbatimCoordinates:"10.00S 10.00E",verbatimLatitude:"10.00S",verbatimLongitude:"10.00E",decimalLatitude:-10,decimalLongitude:10},{verbatimCoordinates:"00.00S 01.00E",verbatimLatitude:"00.00S",verbatimLongitude:"01.00E",decimalLatitude:0,decimalLongitude:1},{verbatimCoordinates:"18.24S 22.45E",verbatimLatitude:"18.24S",verbatimLongitude:"22.45E",decimalLatitude:-18.4,decimalLongitude:22.75},{verbatimCoordinates:"27deg 15min 45.2sec S 18deg 32min 53.7sec E",verbatimLatitude:"27deg 15min 45.2sec S",verbatimLongitude:"18deg 32min 53.7sec E",decimalLatitude:-27.262555555555554,decimalLongitude:18.54825},{verbatimCoordinates:"-23.3245° S / 28.2344° E",verbatimLatitude:"-23.3245° S",verbatimLongitude:"28.2344° E",decimalLatitude:-23.3245,decimalLongitude:28.2344},{verbatimCoordinates:"40° 26.7717 -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"27.15.45S 18.32.53E",verbatimLatitude:"27.15.45S",verbatimLongitude:"18.32.53E",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"-27.15.45 18.32.53",verbatimLatitude:"-27.15.45",verbatimLongitude:"18.32.53",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"27.15.45.2S 18.32.53.4E",verbatimLatitude:"27.15.45.2S",verbatimLongitude:"18.32.53.4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"27.15.45,2S 18.32.53,4E",verbatimLatitude:"27.15.45,2S",verbatimLongitude:"18.32.53,4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"S23.43563 ° E22.45634 °",verbatimLatitude:"S23.43563 °",verbatimLongitude:"E22.45634 °",decimalLatitude:-23.43563,decimalLongitude:22.45634},{verbatimCoordinates:"27,71372° S 23,07771° E",verbatimLatitude:"27,71372° S",verbatimLongitude:"23,07771° E",decimalLatitude:-27.71372,decimalLongitude:23.07771},{verbatimCoordinates:"27.45.34 S 23.23.23 E",verbatimLatitude:"27.45.34 S",verbatimLongitude:"23.23.23 E",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"S 27.45.34 E 23.23.23",verbatimLatitude:"S 27.45.34",verbatimLongitude:"E 23.23.23",decimalLatitude:-27.759444,decimalLongitude:23.38972222}];function jI(){const e=[];return BI.forEach(t=>{t.decimalLatitude?e.push(t):e.push({...t,...VI})}),[...e,...UI,...GI]}const qI=jI();qI.map(e=>e.verbatimCoordinates);/** * splaytree v3.1.2 * Fast Splay tree for Node and browser * @@ -600,11 +600,11 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. -***************************************************************************** */function qI(e,t){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},i,r,u,p;return p={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function a(x){return function(S){return _([x,S])}}function _(x){if(i)throw new TypeError("Generator is already executing.");for(;n;)try{if(i=1,r&&(u=x[0]&2?r.return:x[0]?r.throw||((u=r.return)&&u.call(r),0):r.next)&&!(u=u.call(r,x[1])).done)return u;switch(r=0,u&&(x=[x[0]&2,u.value]),x[0]){case 0:case 1:u=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,r=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!u||x[1]>u[0]&&x[1]t?1:e0){if(t.right===null)break;if(n(e,t.right.key)>0){var a=t.right;if(t.right=a.left,a.left=t,t=a,t.right===null)break}r.right=t,r=t,t=t.right}else break}return r.right=t.left,u.left=t.right,t.left=i.right,t.right=i.left,t}function W_(e,t,n,i){var r=new Ou(e,t);if(n===null)return r.left=r.right=null,r;n=Lu(e,n,i);var u=i(e,n.key);return u<0?(r.left=n.left,r.right=n,n.left=null):u>=0&&(r.right=n.right,r.left=n,n.right=null),r}function e1(e,t,n){var i=null,r=null;if(t){t=Lu(e,t,n);var u=n(t.key,e);u===0?(i=t.left,r=t.right):u<0?(r=t.right,t.right=null,i=t):(i=t.left,t.left=null,r=t)}return{left:i,right:r}}function WI(e,t,n){return t===null?e:(e===null||(t=Lu(e.key,t,n),t.left=e),t)}function ly(e,t,n,i,r){if(e){i(""+t+(n?"└── ":"├── ")+r(e)+` -`);var u=t+(n?" ":"│ ");e.left&&ly(e.left,u,!1,i,r),e.right&&ly(e.right,u,!0,i,r)}}var Py=function(){function e(t){t===void 0&&(t=ZI),this._root=null,this._size=0,this._comparator=t}return e.prototype.insert=function(t,n){return this._size++,this._root=W_(t,n,this._root,this._comparator)},e.prototype.add=function(t,n){var i=new Ou(t,n);this._root===null&&(i.left=i.right=null,this._size++,this._root=i);var r=this._comparator,u=Lu(t,this._root,r),p=r(t,u.key);return p===0?this._root=u:(p<0?(i.left=u.left,i.right=u,u.left=null):p>0&&(i.right=u.right,i.left=u,u.right=null),this._size++,this._root=i),this._root},e.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},e.prototype._remove=function(t,n,i){var r;if(n===null)return null;n=Lu(t,n,i);var u=i(t,n.key);return u===0?(n.left===null?r=n.right:(r=Lu(t,n.left,i),r.right=n.right),this._size--,r):n},e.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=Lu(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},e.prototype.findStatic=function(t){for(var n=this._root,i=this._comparator;n;){var r=i(t,n.key);if(r===0)return n;r<0?n=n.left:n=n.right}return null},e.prototype.find=function(t){return this._root&&(this._root=Lu(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},e.prototype.contains=function(t){for(var n=this._root,i=this._comparator;n;){var r=i(t,n.key);if(r===0)return!0;r<0?n=n.left:n=n.right}return!1},e.prototype.forEach=function(t,n){for(var i=this._root,r=[],u=!1;!u;)i!==null?(r.push(i),i=i.left):r.length!==0?(i=r.pop(),t.call(n,i),i=i.right):u=!0;return this},e.prototype.range=function(t,n,i,r){for(var u=[],p=this._comparator,a=this._root,_;u.length!==0||a;)if(a)u.push(a),a=a.left;else{if(a=u.pop(),_=p(a.key,n),_>0)break;if(p(a.key,t)>=0&&i.call(r,a))return this;a=a.right}return this},e.prototype.keys=function(){var t=[];return this.forEach(function(n){var i=n.key;return t.push(i)}),t},e.prototype.values=function(){var t=[];return this.forEach(function(n){var i=n.data;return t.push(i)}),t},e.prototype.min=function(){return this._root?this.minNode(this._root).key:null},e.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},e.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},e.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},e.prototype.at=function(t){for(var n=this._root,i=!1,r=0,u=[];!i;)if(n)u.push(n),n=n.left;else if(u.length>0){if(n=u.pop(),r===t)return n;r++,n=n.right}else i=!0;return null},e.prototype.next=function(t){var n=this._root,i=null;if(t.right){for(i=t.right;i.left;)i=i.left;return i}for(var r=this._comparator;n;){var u=r(t.key,n.key);if(u===0)break;u<0?(i=n,n=n.left):n=n.right}return i},e.prototype.prev=function(t){var n=this._root,i=null;if(t.left!==null){for(i=t.left;i.right;)i=i.right;return i}for(var r=this._comparator;n;){var u=r(t.key,n.key);if(u===0)break;u<0?n=n.left:(i=n,n=n.right)}return i},e.prototype.clear=function(){return this._root=null,this._size=0,this},e.prototype.toList=function(){return HI(this._root)},e.prototype.load=function(t,n,i){n===void 0&&(n=[]),i===void 0&&(i=!1);var r=t.length,u=this._comparator;if(i&&hy(t,n,0,r-1,u),this._root===null)this._root=uy(t,n,0,r),this._size=r;else{var p=YI(this.toList(),XI(t,n),u);r=this._size+r,this._root=cy({head:p},0,r)}return this},e.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),e.prototype.toString=function(t){t===void 0&&(t=function(i){return String(i.key)});var n=[];return ly(this._root,"",!0,function(i){return n.push(i)},t),n.join("")},e.prototype.update=function(t,n,i){var r=this._comparator,u=e1(t,this._root,r),p=u.left,a=u.right;r(t,n)<0?a=W_(n,i,a,r):p=W_(n,i,p,r),this._root=WI(p,a,r)},e.prototype.split=function(t){return e1(t,this._root,this._comparator)},e.prototype[Symbol.iterator]=function(){var t,n,i;return qI(this,function(r){switch(r.label){case 0:t=this._root,n=[],i=!1,r.label=1;case 1:return i?[3,6]:t===null?[3,2]:(n.push(t),t=t.left,[3,5]);case 2:return n.length===0?[3,4]:(t=n.pop(),[4,t]);case 3:return r.sent(),t=t.right,[3,5];case 4:i=!0,r.label=5;case 5:return[3,1];case 6:return[2]}})},e}();function uy(e,t,n,i){var r=i-n;if(r>0){var u=n+Math.floor(r/2),p=e[u],a=t[u],_=new Ou(p,a);return _.left=uy(e,t,n,u),_.right=uy(e,t,u+1,i),_}return null}function XI(e,t){for(var n=new Ou(null,null),i=n,r=0;r0?(t=u=u.next=n.pop(),t=t.right):i=!0;return u.next=null,r.next}function cy(e,t,n){var i=n-t;if(i>0){var r=t+Math.floor(i/2),u=cy(e,t,r),p=e.head;return p.left=u,e.head=e.head.next,p.right=cy(e,r+1,n),p}return null}function YI(e,t,n){for(var i=new Ou(null,null),r=i,u=e,p=t;u!==null&&p!==null;)n(u.key,p.key)<0?(r.next=u,u=u.next):(r.next=p,p=p.next),r=r.next;return u!==null?r.next=u:p!==null&&(r.next=p),i.next}function hy(e,t,n,i,r){if(!(n>=i)){for(var u=e[n+i>>1],p=n-1,a=i+1;;){do p++;while(r(e[p],u)<0);do a--;while(r(e[a],u)>0);if(p>=a)break;var _=e[p];e[p]=e[a],e[a]=_,_=t[p],t[p]=t[a],t[a]=_}hy(e,t,n,a,r),hy(e,t,a+1,i,r)}}function va(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n1(e,t){for(var n=0;nn.x?1:t.yn.y?1:0}}]);function e(t,n){va(this,e),t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=n}return Xo(e,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var n=t.point.events,i=0,r=n.length;i=0&&L>=0?xA?-1:0:_<0&&L<0?xA?1:0:L<_?-1:L>_?1:0}}}]),e}(),eC=0,$m=function(){Xo(e,null,[{key:"compare",value:function(t,n){var i=t.leftSE.point.x,r=n.leftSE.point.x,u=t.rightSE.point.x,p=n.rightSE.point.x;if(pa&&_>x)return-1;var L=t.comparePoint(n.leftSE.point);if(L<0)return 1;if(L>0)return-1;var A=n.comparePoint(t.rightSE.point);return A!==0?A:-1}if(i>r){if(a<_&&a_&&a>S)return 1;var N=n.comparePoint(t.leftSE.point);if(N!==0)return N;var z=t.comparePoint(n.rightSE.point);return z<0?1:z>0?-1:1}if(a<_)return-1;if(a>_)return 1;if(up){var Z=t.comparePoint(n.rightSE.point);if(Z<0)return 1;if(Z>0)return-1}if(u!==p){var K=x-a,V=u-i,X=S-_,Q=p-r;if(K>V&&XQ)return-1}return u>p?1:uS?1:t.idn.id?1:0}}]);function e(t,n,i,r){va(this,e),this.id=++eC,this.leftSE=t,t.segment=this,t.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=t,this.rings=i,this.windings=r}return Xo(e,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:tn?t:n}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var n=this.leftSE.point,i=this.rightSE.point,r=this.vector();if(n.x===i.x)return t.x===n.x?0:t.x0&&a.swapEvents(),ll.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),i&&(r.checkForConsuming(),u.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,i=this.windings.length;n0){var u=n;n=i,i=u}if(n.prev===i){var p=n;n=i,i=p}for(var a=0,_=i.rings.length;a<_;a++){var x=i.rings[a],S=i.windings[a],L=n.rings.indexOf(x);L===-1?(n.rings.push(x),n.windings.push(S)):n.windings[L]+=S}i.rings=null,i.windings=null,i.consumedBy=n,i.leftSE.consumedBy=n.leftSE,i.rightSE.consumedBy=n.rightSE}}},{key:"prevInResult",value:function(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var n=this._afterState.rings,i=this._afterState.windings,r=this._afterState.multiPolys,u=0,p=this.rings.length;u0)r=n,u=t,p=-1;else throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));var _=new ll(r,!0),x=new ll(u,!1);return new e(_,x,[i],[p])}}]),e}(),a1=function(){function e(t,n,i){if(va(this,e),!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=i,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var r=Zf.round(t[0][0],t[0][1]);this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};for(var u=r,p=1,a=t.length;pthis.bbox.ur.x&&(this.bbox.ur.x=_.x),_.y>this.bbox.ur.y&&(this.bbox.ur.y=_.y),u=_)}(r.x!==u.x||r.y!==u.y)&&this.segments.push($m.fromRing(u,r,this))}return Xo(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,i=this.segments.length;nthis.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=n}return Xo(e,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),n=0,i=this.interiorRings.length;nthis.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=n}return Xo(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,i=this.polys.length;n0&&(t=r)}for(var u=t.segment.prevInResult(),p=u?u.prevInResult():null;;){if(!u)return null;if(!p)return u.ringOut;if(p.ringOut!==u.ringOut)return p.ringOut.enclosingRing()!==u.ringOut?u.ringOut:u.ringOut.enclosingRing();u=p.prevInResult(),p=u?u.prevInResult():null}}}]),e}(),u1=function(){function e(t){va(this,e),this.exteriorRing=t,t.poly=this,this.interiorRings=[]}return Xo(e,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(var n=0,i=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:$m.compare;va(this,e),this.queue=t,this.tree=new Py(n),this.segments=[]}return Xo(e,[{key:"process",value:function(t){var n=t.segment,i=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(n),i;var r=t.isLeft?this.tree.insert(n):this.tree.find(n);if(!r)throw new Error("Unable to find segment #".concat(n.id," ")+"[".concat(n.leftSE.point.x,", ").concat(n.leftSE.point.y,"] -> ")+"[".concat(n.rightSE.point.x,", ").concat(n.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var u=r,p=r,a=void 0,_=void 0;a===void 0;)u=this.tree.prev(u),u===null?a=null:u.key.consumedBy===void 0&&(a=u.key);for(;_===void 0;)p=this.tree.next(p),p===null?_=null:p.key.consumedBy===void 0&&(_=p.key);if(t.isLeft){var x=null;if(a){var S=a.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(x=S),!a.isAnEndpoint(S)))for(var L=this._splitSafely(a,S),A=0,N=L.length;A0?(this.tree.remove(n),i.push(t)):(this.segments.push(n),n.prev=a)}else{if(a&&_){var gt=a.getIntersection(_);if(gt!==null){if(!a.isAnEndpoint(gt))for(var at=this._splitSafely(a,gt),Lt=0,bt=at.length;Ltc1)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var Q=new oC(z),it=z.size,ht=z.pop();ht;){var ut=ht.key;if(z.size===it){var gt=ut.segment;throw new Error("Unable to pop() ".concat(ut.isLeft?"left":"right"," SweepEvent ")+"[".concat(ut.point.x,", ").concat(ut.point.y,"] from segment #").concat(gt.id," ")+"[".concat(gt.leftSE.point.x,", ").concat(gt.leftSE.point.y,"] -> ")+"[".concat(gt.rightSE.point.x,", ").concat(gt.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(z.size>c1)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(Q.segments.length>sC)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var at=Q.process(ut),Lt=0,bt=at.length;Lt1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;in[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]t.x?1:this.yt.y?1:0};At.prototype.clone=function(){};At.prototype.copy=function(){return new At(this)};At.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};At.prototype.distance3D=function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return Math.sqrt(t*t+n*n+i*i)};At.prototype.distance=function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)};At.prototype.hashCode=function(){var e=17;return e=37*e+At.hashCode(this.x),e=37*e+At.hashCode(this.y),e};At.prototype.setCoordinate=function(e){this.x=e.x,this.y=e.y,this.z=e.z};At.prototype.interfaces_=function(){return[vs,vg,bs]};At.prototype.getClass=function(){return At};At.hashCode=function(){if(arguments.length===1){var e=arguments[0],t=tn.doubleToLongBits(e);return Math.trunc((t^t)>>>32)}};Nc.DimensionalComparator.get=function(){return ql};Nc.serialVersionUID.get=function(){return 6683108902428367e3};Nc.NULL_ORDINATE.get=function(){return tn.NaN};Nc.X.get=function(){return 0};Nc.Y.get=function(){return 1};Nc.Z.get=function(){return 2};Object.defineProperties(At,Nc);var ql=function(e){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var t=arguments[0];if(t!==2&&t!==3)throw new di("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}};ql.prototype.compare=function(e,t){var n=e,i=t,r=ql.compare(n.x,i.x);if(r!==0)return r;var u=ql.compare(n.y,i.y);if(u!==0)return u;if(this._dimensionsToTest<=2)return 0;var p=ql.compare(n.z,i.z);return p};ql.prototype.interfaces_=function(){return[Dh]};ql.prototype.getClass=function(){return ql};ql.compare=function(e,t){return et?1:tn.isNaN(e)?tn.isNaN(t)?0:-1:tn.isNaN(t)?1:0};var Rh=function(){};Rh.prototype.create=function(){};Rh.prototype.interfaces_=function(){return[]};Rh.prototype.getClass=function(){return Rh};var zt=function(){},fd={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};zt.prototype.interfaces_=function(){return[]};zt.prototype.getClass=function(){return zt};zt.toLocationSymbol=function(e){switch(e){case zt.EXTERIOR:return"e";case zt.BOUNDARY:return"b";case zt.INTERIOR:return"i";case zt.NONE:return"-"}throw new di("Unknown location value: "+e)};fd.INTERIOR.get=function(){return 0};fd.BOUNDARY.get=function(){return 1};fd.EXTERIOR.get=function(){return 2};fd.NONE.get=function(){return-1};Object.defineProperties(zt,fd);var We=function(e,t){return e.interfaces_&&e.interfaces_().indexOf(t)>-1},Ho=function(){},_x={LOG_10:{configurable:!0}};Ho.prototype.interfaces_=function(){return[]};Ho.prototype.getClass=function(){return Ho};Ho.log10=function(e){var t=Math.log(e);return tn.isInfinite(t)||tn.isNaN(t)?t:t/Ho.LOG_10};Ho.min=function(e,t,n,i){var r=e;return tn?n:e}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],r=arguments[1],u=arguments[2];return iu?u:i}};Ho.wrap=function(e,t){return e<0?t- -e%t:e%t};Ho.max=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2],i=e;return t>i&&(i=t),n>i&&(i=n),i}else if(arguments.length===4){var r=arguments[0],u=arguments[1],p=arguments[2],a=arguments[3],_=r;return u>_&&(_=u),p>_&&(_=p),a>_&&(_=a),_}};Ho.average=function(e,t){return(e+t)/2};_x.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Ho,_x);var ba=function(e){this.str=e};ba.prototype.append=function(e){this.str+=e};ba.prototype.setCharAt=function(e,t){this.str=this.str.substr(0,e)+t+this.str.substr(e+1)};ba.prototype.toString=function(e){return this.str};var la=function(e){this.value=e};la.prototype.intValue=function(){return this.value};la.prototype.compareTo=function(e){return this.valuee?1:0};la.isNaN=function(e){return Number.isNaN(e)};var Wf=function(){};Wf.isWhitespace=function(e){return e<=32&&e>=0||e===127};Wf.toUpperCase=function(e){return e.toUpperCase()};var Ut=function e(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof e){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var i=arguments[0];e.call(this,e.parse(i))}}else if(arguments.length===2){var r=arguments[0],u=arguments[1];this.init(r,u)}},Vs={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};Ut.prototype.le=function(e){return(this._hi9?(S=!0,L="9"):L="0"+x,p.append(L),n=n.subtract(Ut.valueOf(x)).multiply(Ut.TEN),S&&n.selfAdd(Ut.TEN);var A=!0,N=Ut.magnitude(n._hi);if(N<0&&Math.abs(N)>=a-_&&(A=!1),!A)break}return t[0]=i,p.toString()};Ut.prototype.sqr=function(){return this.multiply(this)};Ut.prototype.doubleValue=function(){return this._hi+this._lo};Ut.prototype.subtract=function(){if(arguments[0]instanceof Ut){var e=arguments[0];return this.add(e.negate())}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.add(-t)}};Ut.prototype.equals=function(){if(arguments.length===1){var e=arguments[0];return this._hi===e._hi&&this._lo===e._lo}};Ut.prototype.isZero=function(){return this._hi===0&&this._lo===0};Ut.prototype.selfSubtract=function(){if(arguments[0]instanceof Ut){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e._hi,-e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t,0)}};Ut.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};Ut.prototype.min=function(e){return this.le(e)?this:e};Ut.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof Ut){var e=arguments[0];return this.selfDivide(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfDivide(t,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],r=null,u=null,p=null,a=null,_=null,x=null,S=null,L=null;return _=this._hi/n,x=Ut.SPLIT*_,r=x-_,L=Ut.SPLIT*n,r=x-r,u=_-r,p=L-n,S=_*n,p=L-p,a=n-p,L=r*p-S+r*a+u*p+u*a,x=(this._hi-S-L+this._lo-_*i)/n,L=_+x,this._hi=L,this._lo=_-L+x,this}};Ut.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};Ut.prototype.divide=function(){if(arguments[0]instanceof Ut){var e=arguments[0],t=null,n=null,i=null,r=null,u=null,p=null,a=null,_=null;u=this._hi/e._hi,p=Ut.SPLIT*u,t=p-u,_=Ut.SPLIT*e._hi,t=p-t,n=u-t,i=_-e._hi,a=u*e._hi,i=_-i,r=e._hi-i,_=t*i-a+t*r+n*i+n*r,p=(this._hi-a-_+this._lo-u*e._lo)/e._hi,_=u+p;var x=_,S=u-_+p;return new Ut(x,S)}else if(typeof arguments[0]=="number"){var L=arguments[0];return tn.isNaN(L)?Ut.createNaN():Ut.copy(this).selfDivide(L,0)}};Ut.prototype.ge=function(e){return(this._hi>e._hi||this._hi===e._hi)&&this._lo>=e._lo};Ut.prototype.pow=function(e){if(e===0)return Ut.valueOf(1);var t=new Ut(this),n=Ut.valueOf(1),i=Math.abs(e);if(i>1)for(;i>0;)i%2===1&&n.selfMultiply(t),i/=2,i>0&&(t=t.sqr());else n=t;return e<0?n.reciprocal():n};Ut.prototype.ceil=function(){if(this.isNaN())return Ut.NaN;var e=Math.ceil(this._hi),t=0;return e===this._hi&&(t=Math.ceil(this._lo)),new Ut(e,t)};Ut.prototype.compareTo=function(e){var t=e;return this._hit._hi?1:this._lot._lo?1:0};Ut.prototype.rint=function(){if(this.isNaN())return this;var e=this.add(.5);return e.floor()};Ut.prototype.setValue=function(){if(arguments[0]instanceof Ut){var e=arguments[0];return this.init(e),this}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.init(t),this}};Ut.prototype.max=function(e){return this.ge(e)?this:e};Ut.prototype.sqrt=function(){if(this.isZero())return Ut.valueOf(0);if(this.isNegative())return Ut.NaN;var e=1/Math.sqrt(this._hi),t=this._hi*e,n=Ut.valueOf(t),i=this.subtract(n.sqr()),r=i._hi*(e*.5);return n.add(r)};Ut.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof Ut){var e=arguments[0];return this.selfAdd(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0],n=null,i=null,r=null,u=null,p=null,a=null;return r=this._hi+t,p=r-this._hi,u=r-p,u=t-p+(this._hi-u),a=u+this._lo,n=r+a,i=a+(r-n),this._hi=n+i,this._lo=i+(n-this._hi),this}}else if(arguments.length===2){var _=arguments[0],x=arguments[1],S=null,L=null,A=null,N=null,z=null,H=null,Z=null,K=null;z=this._hi+_,A=this._lo+x,Z=z-this._hi,K=A-this._lo,H=z-Z,N=A-K,H=_-Z+(this._hi-H),N=x-K+(this._lo-N),Z=H+A,S=z+Z,L=Z+(z-S),Z=N+L;var V=S+Z,X=Z+(S-V);return this._hi=V,this._lo=X,this}};Ut.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof Ut){var e=arguments[0];return this.selfMultiply(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfMultiply(t,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],r=null,u=null,p=null,a=null,_=null,x=null;_=Ut.SPLIT*this._hi,r=_-this._hi,x=Ut.SPLIT*n,r=_-r,u=this._hi-r,p=x-n,_=this._hi*n,p=x-p,a=n-p,x=r*p-_+r*a+u*p+u*a+(this._hi*i+this._lo*n);var S=_+x;r=_-S;var L=x+r;return this._hi=S,this._lo=L,this}};Ut.prototype.selfSqr=function(){return this.selfMultiply(this)};Ut.prototype.floor=function(){if(this.isNaN())return Ut.NaN;var e=Math.floor(this._hi),t=0;return e===this._hi&&(t=Math.floor(this._lo)),new Ut(e,t)};Ut.prototype.negate=function(){return this.isNaN()?this:new Ut(-this._hi,-this._lo)};Ut.prototype.clone=function(){};Ut.prototype.multiply=function(){if(arguments[0]instanceof Ut){var e=arguments[0];return e.isNaN()?Ut.createNaN():Ut.copy(this).selfMultiply(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return tn.isNaN(t)?Ut.createNaN():Ut.copy(this).selfMultiply(t,0)}};Ut.prototype.isNaN=function(){return tn.isNaN(this._hi)};Ut.prototype.intValue=function(){return Math.trunc(this._hi)};Ut.prototype.toString=function(){var e=Ut.magnitude(this._hi);return e>=-3&&e<=20?this.toStandardNotation():this.toSciNotation()};Ut.prototype.toStandardNotation=function(){var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!0,t),i=t[0]+1,r=n;if(n.charAt(0)===".")r="0"+n;else if(i<0)r="0."+Ut.stringOfChar("0",-i)+n;else if(n.indexOf(".")===-1){var u=i-n.length,p=Ut.stringOfChar("0",u);r=n+p+".0"}return this.isNegative()?"-"+r:r};Ut.prototype.reciprocal=function(){var e=null,t=null,n=null,i=null,r=null,u=null,p=null,a=null;r=1/this._hi,u=Ut.SPLIT*r,e=u-r,a=Ut.SPLIT*this._hi,e=u-e,t=r-e,n=a-this._hi,p=r*this._hi,n=a-n,i=this._hi-n,a=e*n-p+e*i+t*n+t*i,u=(1-p-a-r*this._lo)/this._hi;var _=r+u,x=r-_+u;return new Ut(_,x)};Ut.prototype.toSciNotation=function(){if(this.isZero())return Ut.SCI_NOT_ZERO;var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!1,t),i=Ut.SCI_NOT_EXPONENT_CHAR+t[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var r="";n.length>1&&(r=n.substring(1));var u=n.charAt(0)+"."+r;return this.isNegative()?"-"+u+i:u+i};Ut.prototype.abs=function(){return this.isNaN()?Ut.NaN:this.isNegative()?this.negate():new Ut(this)};Ut.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};Ut.prototype.lt=function(e){return(this._hie._hi||this._hi===e._hi)&&this._lo>e._lo};Ut.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};Ut.prototype.trunc=function(){return this.isNaN()?Ut.NaN:this.isPositive()?this.floor():this.ceil()};Ut.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};Ut.prototype.interfaces_=function(){return[bs,vs,vg]};Ut.prototype.getClass=function(){return Ut};Ut.sqr=function(e){return Ut.valueOf(e).selfMultiply(e)};Ut.valueOf=function(){if(typeof arguments[0]=="string"){var e=arguments[0];return Ut.parse(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return new Ut(t)}};Ut.sqrt=function(e){return Ut.valueOf(e).sqrt()};Ut.parse=function(e){for(var t=0,n=e.length;Wf.isWhitespace(e.charAt(t));)t++;var i=!1;if(t=n);){var x=e.charAt(t);if(t++,Wf.isDigit(x)){var S=x-"0";u.selfMultiply(Ut.TEN),u.selfAdd(S),p++;continue}if(x==="."){a=p;continue}if(x==="e"||x==="E"){var L=e.substring(t);try{_=la.parseInt(L)}catch(Z){throw Z instanceof Error?new Error("Invalid exponent "+L+" in string "+e):Z}finally{}break}throw new Error("Unexpected character '"+x+"' at position "+t+" in string "+e)}var A=u,N=p-a-_;if(N===0)A=u;else if(N>0){var z=Ut.TEN.pow(N);A=u.divide(z)}else if(N<0){var H=Ut.TEN.pow(-N);A=u.multiply(H)}return i?A.negate():A};Ut.createNaN=function(){return new Ut(tn.NaN,tn.NaN)};Ut.copy=function(e){return new Ut(e)};Ut.magnitude=function(e){var t=Math.abs(e),n=Math.log(t)/Math.log(10),i=Math.trunc(Math.floor(n)),r=Math.pow(10,i);return r*10<=t&&(i+=1),i};Ut.stringOfChar=function(e,t){for(var n=new ba,i=0;i0){if(u<=0)return fo.signum(p);i=r+u}else if(r<0){if(u>=0)return fo.signum(p);i=-r-u}else return fo.signum(p);var a=fo.DP_SAFE_EPSILON*i;return p>=a||-p>=a?fo.signum(p):2};fo.signum=function(e){return e>0?1:e<0?-1:0};yx.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(fo,yx);var Ln=function(){},dd={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};dd.X.get=function(){return 0};dd.Y.get=function(){return 1};dd.Z.get=function(){return 2};dd.M.get=function(){return 3};Ln.prototype.setOrdinate=function(e,t,n){};Ln.prototype.size=function(){};Ln.prototype.getOrdinate=function(e,t){};Ln.prototype.getCoordinate=function(){};Ln.prototype.getCoordinateCopy=function(e){};Ln.prototype.getDimension=function(){};Ln.prototype.getX=function(e){};Ln.prototype.clone=function(){};Ln.prototype.expandEnvelope=function(e){};Ln.prototype.copy=function(){};Ln.prototype.getY=function(e){};Ln.prototype.toCoordinateArray=function(){};Ln.prototype.interfaces_=function(){return[vg]};Ln.prototype.getClass=function(){return Ln};Object.defineProperties(Ln,dd);var vx=function(){},sp=function(e){function t(){e.call(this,"Projective point not representable on the Cartesian plane.")}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(vx),Cr=function(){};Cr.arraycopy=function(e,t,n,i,r){for(var u=0,p=t;pe._minx?this._minx:e._minx,n=this._miny>e._miny?this._miny:e._miny,i=this._maxx=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&i>=this._miny&&i<=this._maxy}};Re.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Re){var e=arguments[0];return this.isNull()||e.isNull()?!1:!(e._minx>this._maxx||e._maxxthis._maxy||e._maxythis._maxx||nthis._maxy||ithis._maxx&&(this._maxx=t._maxx),t._minythis._maxy&&(this._maxy=t._maxy))}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=i,this._maxy=i):(nthis._maxx&&(this._maxx=n),ithis._maxy&&(this._maxy=i))}};Re.prototype.minExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return et._minx?1:this._minyt._miny?1:this._maxxt._maxx?1:this._maxyt._maxy?1:0};Re.prototype.translate=function(e,t){if(this.isNull())return null;this.init(this.getMinX()+e,this.getMaxX()+e,this.getMinY()+t,this.getMaxY()+t)};Re.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Re.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Re.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Re.prototype.maxExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return e>t?e:t};Re.prototype.expandBy=function(){if(arguments.length===1){var e=arguments[0];this.expandBy(e,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};Re.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Re){var e=arguments[0];return this.covers(e)}else if(arguments[0]instanceof At){var t=arguments[0];return this.covers(t)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.covers(n,i)}};Re.prototype.centre=function(){return this.isNull()?null:new At((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Re.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof At){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof Re){var t=arguments[0];this._minx=t._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(arguments.length===4){var r=arguments[0],u=arguments[1],p=arguments[2],a=arguments[3];re._maxx&&(t=this._minx-e._maxx);var n=0;return this._maxye._maxy&&(n=this._miny-e._maxy),t===0?n:n===0?t:Math.sqrt(t*t+n*n)};Re.prototype.hashCode=function(){var e=17;return e=37*e+At.hashCode(this._minx),e=37*e+At.hashCode(this._maxx),e=37*e+At.hashCode(this._miny),e=37*e+At.hashCode(this._maxy),e};Re.prototype.interfaces_=function(){return[vs,bs]};Re.prototype.getClass=function(){return Re};Re.intersects=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2];return n.x>=(e.xt.x?e.x:t.x)&&n.y>=(e.yt.y?e.y:t.y)}else if(arguments.length===4){var i=arguments[0],r=arguments[1],u=arguments[2],p=arguments[3],a=Math.min(u.x,p.x),_=Math.max(u.x,p.x),x=Math.min(i.x,r.x),S=Math.max(i.x,r.x);return!(x>_||S_)||Sn?(this._intLineIndex[e][0]=0,this._intLineIndex[e][1]=1):(this._intLineIndex[e][0]=1,this._intLineIndex[e][1]=0)}};vi.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};vi.prototype.setPrecisionModel=function(e){this._precisionModel=e};vi.prototype.isInteriorIntersection=function(){var e=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var t=arguments[0],n=0;nr?u=i:u=r;else{var p=Math.abs(e.x-t.x),a=Math.abs(e.y-t.y);i>r?u=p:u=a,u===0&&!e.equals(t)&&(u=Math.max(p,a))}return ln.isTrue(!(u===0&&!e.equals(t)),"Bad distance calculation"),u};vi.nonRobustComputeEdgeDistance=function(e,t,n){var i=e.x-t.x,r=e.y-t.y,u=Math.sqrt(i*i+r*r);return ln.isTrue(!(u===0&&!e.equals(t)),"Invalid distance calculation"),u};Dc.DONT_INTERSECT.get=function(){return 0};Dc.DO_INTERSECT.get=function(){return 1};Dc.COLLINEAR.get=function(){return 2};Dc.NO_INTERSECTION.get=function(){return 0};Dc.POINT_INTERSECTION.get=function(){return 1};Dc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(vi,Dc);var Wu=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isInSegmentEnvelopes=function(n){var i=new Re(this._inputLines[0][0],this._inputLines[0][1]),r=new Re(this._inputLines[1][0],this._inputLines[1][1]);return i.contains(n)&&r.contains(n)},t.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],r=arguments[2];if(this._isProper=!1,Re.intersects(i,r,n)&&ve.orientationIndex(i,r,n)===0&&ve.orientationIndex(r,i,n)===0)return this._isProper=!0,(n.equals(i)||n.equals(r))&&(this._isProper=!1),this._result=e.POINT_INTERSECTION,null;this._result=e.NO_INTERSECTION}else return e.prototype.computeIntersection.apply(this,arguments)},t.prototype.normalizeToMinimum=function(n,i,r,u,p){p.x=this.smallestInAbsValue(n.x,i.x,r.x,u.x),p.y=this.smallestInAbsValue(n.y,i.y,r.y,u.y),n.x-=p.x,n.y-=p.y,i.x-=p.x,i.y-=p.y,r.x-=p.x,r.y-=p.y,u.x-=p.x,u.y-=p.y},t.prototype.safeHCoordinateIntersection=function(n,i,r,u){var p=null;try{p=Ps.intersection(n,i,r,u)}catch(a){if(a instanceof sp)p=t.nearestEndpoint(n,i,r,u);else throw a}finally{}return p},t.prototype.intersection=function(n,i,r,u){var p=this.intersectionWithNormalization(n,i,r,u);return this.isInSegmentEnvelopes(p)||(p=new At(t.nearestEndpoint(n,i,r,u))),this._precisionModel!==null&&this._precisionModel.makePrecise(p),p},t.prototype.smallestInAbsValue=function(n,i,r,u){var p=n,a=Math.abs(p);return Math.abs(i)1e-4&&Cr.out.println("Distance = "+p.distance(a))},t.prototype.intersectionWithNormalization=function(n,i,r,u){var p=new At(n),a=new At(i),_=new At(r),x=new At(u),S=new At;this.normalizeToEnvCentre(p,a,_,x,S);var L=this.safeHCoordinateIntersection(p,a,_,x);return L.x+=S.x,L.y+=S.y,L},t.prototype.computeCollinearIntersection=function(n,i,r,u){var p=Re.intersects(n,i,r),a=Re.intersects(n,i,u),_=Re.intersects(r,u,n),x=Re.intersects(r,u,i);return p&&a?(this._intPt[0]=r,this._intPt[1]=u,e.COLLINEAR_INTERSECTION):_&&x?(this._intPt[0]=n,this._intPt[1]=i,e.COLLINEAR_INTERSECTION):p&&_?(this._intPt[0]=r,this._intPt[1]=n,r.equals(n)&&!a&&!x?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):p&&x?(this._intPt[0]=r,this._intPt[1]=i,r.equals(i)&&!a&&!_?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):a&&_?(this._intPt[0]=u,this._intPt[1]=n,u.equals(n)&&!p&&!x?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):a&&x?(this._intPt[0]=u,this._intPt[1]=i,u.equals(i)&&!p&&!_?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):e.NO_INTERSECTION},t.prototype.normalizeToEnvCentre=function(n,i,r,u,p){var a=n.xi.x?n.x:i.x,S=n.y>i.y?n.y:i.y,L=r.xu.x?r.x:u.x,z=r.y>u.y?r.y:u.y,H=a>L?a:L,Z=xA?_:A,V=S0&&a>0||p<0&&a<0)return e.NO_INTERSECTION;var _=ve.orientationIndex(r,u,n),x=ve.orientationIndex(r,u,i);if(_>0&&x>0||_<0&&x<0)return e.NO_INTERSECTION;var S=p===0&&a===0&&_===0&&x===0;return S?this.computeCollinearIntersection(n,i,r,u):(p===0||a===0||_===0||x===0?(this._isProper=!1,n.equals2D(r)||n.equals2D(u)?this._intPt[0]=n:i.equals2D(r)||i.equals2D(u)?this._intPt[0]=i:p===0?this._intPt[0]=new At(r):a===0?this._intPt[0]=new At(u):_===0?this._intPt[0]=new At(n):x===0&&(this._intPt[0]=new At(i))):(this._isProper=!0,this._intPt[0]=this.intersection(n,i,r,u)),e.POINT_INTERSECTION)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.nearestEndpoint=function(n,i,r,u){var p=n,a=ve.distancePointLine(n,r,u),_=ve.distancePointLine(i,r,u);return _0?n>0?-r:r:n>0?r:-r;if(t===0||n===0)return i>0?e>0?r:-r:e>0?-r:r;if(t>0?i>0?t<=i||(r=-r,u=e,e=n,n=u,u=t,t=i,i=u):t<=-i?(r=-r,n=-n,i=-i):(u=e,e=-n,n=u,u=t,t=-i,i=u):i>0?-t<=i?(r=-r,e=-e,t=-t):(u=-e,e=n,n=u,u=-t,t=i,i=u):t>=i?(e=-e,t=-t,n=-n,i=-i):(r=-r,u=-e,e=-n,n=u,u=-t,t=-i,i=u),e>0)if(n>0){if(!(e<=n))return r}else return r;else{if(n>0)return-r;if(e>=n)r=-r,e=-e,n=-n;else return-r}for(;;){if(p=Math.floor(n/e),n=n-p*e,i=i-p*t,i<0)return-r;if(i>t)return r;if(e>n+n){if(ti+i)return-r;n=e-n,i=t-i,r=-r}if(i===0)return n===0?0:-r;if(n===0||(p=Math.floor(e/n),e=e-p*n,t=t-p*i,t<0))return r;if(t>i)return-r;if(n>e+e){if(it+t)return r;e=n-e,t=i-t,r=-r}if(t===0)return e===0?0:r;if(e===0)return-r}};var oa=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var e=arguments[0];this._p=e};oa.prototype.countSegment=function(e,t){if(e.xi&&(n=t.x,i=e.x),this._p.x>=n&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(e.y>this._p.y&&t.y<=this._p.y||t.y>this._p.y&&e.y<=this._p.y){var r=e.x-this._p.x,u=e.y-this._p.y,p=t.x-this._p.x,a=t.y-this._p.y,_=bc.signOfDet2x2(r,u,p,a);if(_===0)return this._isPointOnSegment=!0,null;a0&&this._crossingCount++}};oa.prototype.isPointInPolygon=function(){return this.getLocation()!==zt.EXTERIOR};oa.prototype.getLocation=function(){return this._isPointOnSegment?zt.BOUNDARY:this._crossingCount%2===1?zt.INTERIOR:zt.EXTERIOR};oa.prototype.isOnSegment=function(){return this._isPointOnSegment};oa.prototype.interfaces_=function(){return[]};oa.prototype.getClass=function(){return oa};oa.locatePointInRing=function(){if(arguments[0]instanceof At&&We(arguments[1],Ln)){for(var e=arguments[0],t=arguments[1],n=new oa(e),i=new At,r=new At,u=1;u1||_<0||_>1)&&(r=!0)}}return r?Ho.min(ve.distancePointLine(e,n,i),ve.distancePointLine(t,n,i),ve.distancePointLine(n,e,t),ve.distancePointLine(i,e,t)):0};ve.isPointInRing=function(e,t){return ve.locatePointInRing(e,t)!==zt.EXTERIOR};ve.computeLength=function(e){var t=e.size();if(t<=1)return 0;var n=0,i=new At;e.getCoordinate(0,i);for(var r=i.x,u=i.y,p=1;pn.y&&(n=u,i=r)}var p=i;do p=p-1,p<0&&(p=t);while(e[p].equals2D(n)&&p!==i);var a=i;do a=(a+1)%t;while(e[a].equals2D(n)&&a!==i);var _=e[p],x=e[a];if(_.equals2D(n)||x.equals2D(n)||_.equals2D(x))return!1;var S=ve.computeOrientation(_,n,x),L=!1;return S===0?L=_.x>x.x:L=S>0,L};ve.locatePointInRing=function(e,t){return oa.locatePointInRing(e,t)};ve.distancePointLinePerpendicular=function(e,t,n){var i=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y),r=((t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y))/i;return Math.abs(r)*Math.sqrt(i)};ve.computeOrientation=function(e,t,n){return ve.orientationIndex(e,t,n)};ve.distancePointLine=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];if(t.length===0)throw new di("Line array must contain at least one vertex");for(var n=e.distance(t[0]),i=0;i=1)return u.distance(a);var S=((p.y-u.y)*(a.x-p.x)-(p.x-u.x)*(a.y-p.y))/_;return Math.abs(S)*Math.sqrt(_)}};ve.isOnLine=function(e,t){for(var n=new Wu,i=1;i0};zh.prototype.interfaces_=function(){return[ms]};zh.prototype.getClass=function(){return zh};var Fh=function(){};Fh.prototype.isInBoundary=function(e){return e>1};Fh.prototype.interfaces_=function(){return[ms]};Fh.prototype.getClass=function(){return Fh};var Bh=function(){};Bh.prototype.isInBoundary=function(e){return e===1};Bh.prototype.interfaces_=function(){return[ms]};Bh.prototype.getClass=function(){return Bh};var Yi=function(){};Yi.prototype.add=function(){};Yi.prototype.addAll=function(){};Yi.prototype.isEmpty=function(){};Yi.prototype.iterator=function(){};Yi.prototype.size=function(){};Yi.prototype.toArray=function(){};Yi.prototype.remove=function(){};function ky(e){this.message=e||""}ky.prototype=new Error;ky.prototype.name="IndexOutOfBoundsException";var ap=function(){};ap.prototype.hasNext=function(){};ap.prototype.next=function(){};ap.prototype.remove=function(){};var As=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(){},t.prototype.set=function(){},t.prototype.isEmpty=function(){},t}(Yi);function lp(e){this.message=e||""}lp.prototype=new Error;lp.prototype.name="NoSuchElementException";var ce=function(e){function t(){e.call(this),this.array_=[],arguments[0]instanceof Yi&&this.addAll(arguments[0])}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.ensureCapacity=function(){},t.prototype.interfaces_=function(){return[e,Yi]},t.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},t.prototype.clear=function(){this.array_=[]},t.prototype.addAll=function(n){for(var i=this,r=n.iterator();r.hasNext();)i.add(r.next());return!0},t.prototype.set=function(n,i){var r=this.array_[n];return this.array_[n]=i,r},t.prototype.iterator=function(){return new _C(this)},t.prototype.get=function(n){if(n<0||n>=this.size())throw new ky;return this.array_[n]},t.prototype.isEmpty=function(){return this.array_.length===0},t.prototype.size=function(){return this.array_.length},t.prototype.toArray=function(){for(var n=this,i=[],r=0,u=this.array_.length;r=1){var x=this.get(this.size()-1);if(x.equals2D(a))return null}e.prototype.add.call(this,a)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],L=arguments[1];return this.add(S,L),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var A=arguments[0],N=arguments[1],z=arguments[2];if(z)for(var H=0;H=0;Z--)i.add(A[Z],N);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof At){var K=arguments[0],V=arguments[1],X=arguments[2];if(!X){var Q=this.size();if(Q>0){if(K>0){var it=this.get(K-1);if(it.equals2D(V))return null}if(KLt&&(bt=-1);for(var yt=at;yt!==Lt;yt+=bt)i.add(ut[yt],gt);return!0}},t.prototype.closeRing=function(){this.size()>0&&this.add(new At(this.get(0)),!1)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},Object.defineProperties(t,n),t}(ce),yn=function(){},xg={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};xg.ForwardComparator.get=function(){return Xf};xg.BidirectionalComparator.get=function(){return Vh};xg.coordArrayType.get=function(){return new Array(0).fill(null)};yn.prototype.interfaces_=function(){return[]};yn.prototype.getClass=function(){return yn};yn.isRing=function(e){return!(e.length<4||!e[0].equals2D(e[e.length-1]))};yn.ptNotInList=function(e,t){for(var n=0;n=e?t:[]};yn.indexOf=function(e,t){for(var n=0;n0)&&(t=e[n]);return t};yn.extract=function(e,t,n){t=Ho.clamp(t,0,e.length),n=Ho.clamp(n,-1,e.length);var i=n-t+1;n<0&&(i=0),t>=e.length&&(i=0),ni.length)return 1;if(n.length===0)return 0;var r=yn.compare(n,i),u=yn.isEqualReversed(n,i);return u?0:r};Vh.prototype.OLDcompare=function(e,t){var n=e,i=t;if(n.lengthi.length)return 1;if(n.length===0)return 0;for(var r=yn.increasingDirection(n),u=yn.increasingDirection(i),p=r>0?0:n.length-1,a=u>0?0:n.length-1,_=0;_0)t=t.right;else return t.value}return null};Ur.prototype.put=function(e,t){if(this.root_===null)return this.root_={key:e,value:t,left:null,right:null,parent:null,color:ul,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,i,r;do if(i=n,r=e.compareTo(n.key),r<0)n=n.left;else if(r>0)n=n.right;else{var u=n.value;return n.value=t,u}while(n!==null);var p={key:e,left:null,right:null,value:t,parent:i,color:ul,getValue:function(){return this.value},getKey:function(){return this.key}};return r<0?i.left=p:i.right=p,this.fixAfterInsertion(p),this.size_++,null};Ur.prototype.fixAfterInsertion=function(e){var t=this;for(e.color=Cu;e!=null&&e!==this.root_&&e.parent.color===Cu;)if(ei(e)===X_(ei(ei(e)))){var n=d1(ei(ei(e)));f1(n)===Cu?(rl(ei(e),ul),rl(n,ul),rl(ei(ei(e)),Cu),e=ei(ei(e))):(e===d1(ei(e))&&(e=ei(e),t.rotateLeft(e)),rl(ei(e),ul),rl(ei(ei(e)),Cu),t.rotateRight(ei(ei(e))))}else{var i=X_(ei(ei(e)));f1(i)===Cu?(rl(ei(e),ul),rl(i,ul),rl(ei(ei(e)),Cu),e=ei(ei(e))):(e===X_(ei(e))&&(e=ei(e),t.rotateRight(e)),rl(ei(e),ul),rl(ei(ei(e)),Cu),t.rotateLeft(ei(ei(e))))}this.root_.color=ul};Ur.prototype.values=function(){var e=new ce,t=this.getFirstEntry();if(t!==null)for(e.add(t.value);(t=Ur.successor(t))!==null;)e.add(t.value);return e};Ur.prototype.entrySet=function(){var e=new Ny,t=this.getFirstEntry();if(t!==null)for(e.add(t);(t=Ur.successor(t))!==null;)e.add(t);return e};Ur.prototype.rotateLeft=function(e){if(e!=null){var t=e.right;e.right=t.left,t.left!=null&&(t.left.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.left===e?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t}};Ur.prototype.rotateRight=function(e){if(e!=null){var t=e.left;e.left=t.right,t.right!=null&&(t.right.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.right===e?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t}};Ur.prototype.getFirstEntry=function(){var e=this.root_;if(e!=null)for(;e.left!=null;)e=e.left;return e};Ur.successor=function(e){if(e===null)return null;if(e.right!==null){for(var t=e.right;t.left!==null;)t=t.left;return t}else{for(var n=e.parent,i=e;n!==null&&i===n.right;)i=n,n=n.parent;return n}};Ur.prototype.size=function(){return this.size_};var Hf=function(){};Hf.prototype.interfaces_=function(){return[]};Hf.prototype.getClass=function(){return Hf};function xx(){}xx.prototype=new wg;function ua(){this.array_=[],arguments[0]instanceof Yi&&this.addAll(arguments[0])}ua.prototype=new xx;ua.prototype.contains=function(e){for(var t=this,n=0,i=this.array_.length;n=0;){var p=r.substring(0,u);i.add(p),r=r.substring(u+n),u=r.indexOf(t)}r.length>0&&i.add(r);for(var a=new Array(i.size()).fill(null),_=0;_0)for(var u=r;u0&&i.append(" ");for(var u=0;u0&&i.append(","),i.append(fs.toString(e.getOrdinate(r,u)))}return i.append(")"),i.toString()}};Oi.ensureValidRing=function(e,t){var n=t.size();if(n===0)return t;if(n<=3)return Oi.createClosedRing(e,t,4);var i=t.getOrdinate(0,Ln.X)===t.getOrdinate(n-1,Ln.X)&&t.getOrdinate(0,Ln.Y)===t.getOrdinate(n-1,Ln.Y);return i?t:Oi.createClosedRing(e,t,n+1)};Oi.createClosedRing=function(e,t,n){var i=e.create(n,t.getDimension()),r=t.size();Oi.copy(t,0,i,0,r);for(var u=r;u0&&Oi.reverse(i._points),null}},t.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},t.prototype.getBoundaryDimension=function(){return this.isClosed()?kn.FALSE:0},t.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},t.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},t.prototype.getDimension=function(){return 1},t.prototype.getLength=function(){return ve.computeLength(this._points)},t.prototype.getNumPoints=function(){return this._points.size()},t.prototype.reverse=function(){var i=this._points.copy();Oi.reverse(i);var r=this.getFactory().createLineString(i);return r},t.prototype.compareToSameClass=function(){var i=this;if(arguments.length===1){for(var r=arguments[0],u=r,p=0,a=0;p= 2)");this._points=i},t.prototype.isCoordinate=function(i){for(var r=this,u=0;u=1&&this.getCoordinateSequence().size()= 4)")},t.prototype.getGeometryType=function(){return"LinearRing"},t.prototype.copy=function(){return new t(this._points.copy(),this._factory)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(t,n),t}(Ti),Oa=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return Ze.SORTINDEX_MULTIPOLYGON},t.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],r=arguments[1];return this.isEquivalentClass(i)?e.prototype.equalsExact.call(this,i,r):!1}else return e.prototype.equalsExact.apply(this,arguments)},t.prototype.getBoundaryDimension=function(){return 1},t.prototype.getDimension=function(){return 2},t.prototype.reverse=function(){for(var i=this,r=this._geometries.length,u=new Array(r).fill(null),p=0;p0?t.createPoint(n[0]):t.createPoint():e};Jf.prototype.interfaces_=function(){return[gs.GeometryEditorOperation]};Jf.prototype.getClass=function(){return Jf};var Qf=function(){};Qf.prototype.edit=function(e,t){return e instanceof Ba?t.createLinearRing(this.edit(e.getCoordinateSequence(),e)):e instanceof Ti?t.createLineString(this.edit(e.getCoordinateSequence(),e)):e instanceof Mo?t.createPoint(this.edit(e.getCoordinateSequence(),e)):e};Qf.prototype.interfaces_=function(){return[gs.GeometryEditorOperation]};Qf.prototype.getClass=function(){return Qf};var ki=function(){var e=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var n=0;n0){var t=new ba(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var n=1;n3&&(i=3),i<2?new ki(n):new ki(n,i)}};Va.prototype.interfaces_=function(){return[Rh,bs]};Va.prototype.getClass=function(){return Va};Va.instance=function(){return Va.instanceObject};Ry.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};Ry.instanceObject.get=function(){return new Va};Object.defineProperties(Va,Ry);var Sx=function(e){function t(){e.call(this),this.map_=new Map}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(n){return this.map_.get(n)||null},t.prototype.put=function(n,i){return this.map_.set(n,i),i},t.prototype.values=function(){for(var n=new ce,i=this.map_.values(),r=i.next();!r.done;)n.add(r.value),r=i.next();return n},t.prototype.entrySet=function(){var n=new Ny;return this.map_.entries().forEach(function(i){return n.add(i)}),n},t.prototype.size=function(){return this.map_.size()},t}(Oc),Dn=function e(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=e.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof ha){var t=arguments[0];this._modelType=t,t===e.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=e.FIXED,this.setScale(n)}else if(arguments[0]instanceof e){var i=arguments[0];this._modelType=i._modelType,this._scale=i._scale}}},Oy={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Dn.prototype.equals=function(e){if(!(e instanceof Dn))return!1;var t=e;return this._modelType===t._modelType&&this._scale===t._scale};Dn.prototype.compareTo=function(e){var t=e,n=this.getMaximumSignificantDigits(),i=t.getMaximumSignificantDigits();return new la(n).compareTo(new la(i))};Dn.prototype.getScale=function(){return this._scale};Dn.prototype.isFloating=function(){return this._modelType===Dn.FLOATING||this._modelType===Dn.FLOATING_SINGLE};Dn.prototype.getType=function(){return this._modelType};Dn.prototype.toString=function(){var e="UNKNOWN";return this._modelType===Dn.FLOATING?e="Floating":this._modelType===Dn.FLOATING_SINGLE?e="Floating-Single":this._modelType===Dn.FIXED&&(e="Fixed (Scale="+this.getScale()+")"),e};Dn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var e=arguments[0];if(tn.isNaN(e))return e;if(this._modelType===Dn.FLOATING_SINGLE){var t=e;return t}return this._modelType===Dn.FIXED?Math.round(e*this._scale)/this._scale:e}else if(arguments[0]instanceof At){var n=arguments[0];if(this._modelType===Dn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Dn.prototype.getMaximumSignificantDigits=function(){var e=16;return this._modelType===Dn.FLOATING?e=16:this._modelType===Dn.FLOATING_SINGLE?e=6:this._modelType===Dn.FIXED&&(e=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),e};Dn.prototype.setScale=function(e){this._scale=Math.abs(e)};Dn.prototype.interfaces_=function(){return[bs,vs]};Dn.prototype.getClass=function(){return Dn};Dn.mostPrecise=function(e,t){return e.compareTo(t)>=0?e:t};Oy.serialVersionUID.get=function(){return 7777263578777804e3};Oy.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Dn,Oy);var ha=function e(t){this._name=t||null,e.nameToTypeMap.put(t,this)},zy={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ha.prototype.readResolve=function(){return ha.nameToTypeMap.get(this._name)};ha.prototype.toString=function(){return this._name};ha.prototype.interfaces_=function(){return[bs]};ha.prototype.getClass=function(){return ha};zy.serialVersionUID.get=function(){return-552860263173159e4};zy.nameToTypeMap.get=function(){return new Sx};Object.defineProperties(ha,zy);Dn.Type=ha;Dn.FIXED=new ha("FIXED");Dn.FLOATING=new ha("FLOATING");Dn.FLOATING_SINGLE=new ha("FLOATING SINGLE");var _n=function e(){this._precisionModel=new Dn,this._SRID=0,this._coordinateSequenceFactory=e.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?We(arguments[0],Rh)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Dn&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},Ex={serialVersionUID:{configurable:!0}};_n.prototype.toGeometry=function(e){return e.isNull()?this.createPoint(null):e.getMinX()===e.getMaxX()&&e.getMinY()===e.getMaxY()?this.createPoint(new At(e.getMinX(),e.getMinY())):e.getMinX()===e.getMaxX()||e.getMinY()===e.getMaxY()?this.createLineString([new At(e.getMinX(),e.getMinY()),new At(e.getMaxX(),e.getMaxY())]):this.createPolygon(this.createLinearRing([new At(e.getMinX(),e.getMinY()),new At(e.getMinX(),e.getMaxY()),new At(e.getMaxX(),e.getMaxY()),new At(e.getMaxX(),e.getMinY()),new At(e.getMinX(),e.getMinY())]),null)};_n.prototype.createLineString=function(e){if(e){if(e instanceof Array)return new Ti(this.getCoordinateSequenceFactory().create(e),this);if(We(e,Ln))return new Ti(e,this)}else return new Ti(this.getCoordinateSequenceFactory().create([]),this)};_n.prototype.createMultiLineString=function(){if(arguments.length===0)return new zu(null,this);if(arguments.length===1){var e=arguments[0];return new zu(e,this)}};_n.prototype.buildGeometry=function(e){for(var t=null,n=!1,i=!1,r=e.iterator();r.hasNext();){var u=r.next(),p=u.getClass();t===null&&(t=p),p!==t&&(n=!0),u.isGeometryCollectionOrDerived()&&(i=!0)}if(t===null)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection(_n.toGeometryArray(e));var a=e.iterator().next(),_=e.size()>1;if(_){if(a instanceof er)return this.createMultiPolygon(_n.toPolygonArray(e));if(a instanceof Ti)return this.createMultiLineString(_n.toLineStringArray(e));if(a instanceof Mo)return this.createMultiPoint(_n.toPointArray(e));ln.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a};_n.prototype.createMultiPointFromCoords=function(e){return this.createMultiPoint(e!==null?this.getCoordinateSequenceFactory().create(e):null)};_n.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof At){var e=arguments[0];return this.createPoint(e!==null?this.getCoordinateSequenceFactory().create([e]):null)}else if(We(arguments[0],Ln)){var t=arguments[0];return new Mo(t,this)}}};_n.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};_n.prototype.createPolygon=function(){if(arguments.length===0)return new er(null,null,this);if(arguments.length===1){if(We(arguments[0],Ln)){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Array){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Ba){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var i=arguments[0],r=arguments[1];return new er(i,r,this)}};_n.prototype.getSRID=function(){return this._SRID};_n.prototype.createGeometryCollection=function(){if(arguments.length===0)return new eo(null,this);if(arguments.length===1){var e=arguments[0];return new eo(e,this)}};_n.prototype.createGeometry=function(e){var t=new gs(this);return t.edit(e,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};_n.prototype.getPrecisionModel=function(){return this._precisionModel};_n.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return this.createLinearRing(e!==null?this.getCoordinateSequenceFactory().create(e):null)}else if(We(arguments[0],Ln)){var t=arguments[0];return new Ba(t,this)}}};_n.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Oa(null,this);if(arguments.length===1){var e=arguments[0];return new Oa(e,this)}};_n.prototype.createMultiPoint=function(){var e=this;if(arguments.length===0)return new Uh(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new Uh(t,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(We(arguments[0],Ln)){var i=arguments[0];if(i===null)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(i.size()).fill(null),u=0;u=this.size())throw new Error;return this.array_[e]};xa.prototype.push=function(e){return this.array_.push(e),e};xa.prototype.pop=function(e){if(this.array_.length===0)throw new Tg;return this.array_.pop()};xa.prototype.peek=function(){if(this.array_.length===0)throw new Tg;return this.array_[this.array_.length-1]};xa.prototype.empty=function(){return this.array_.length===0};xa.prototype.isEmpty=function(){return this.empty()};xa.prototype.search=function(e){return this.array_.indexOf(e)};xa.prototype.size=function(){return this.array_.length};xa.prototype.toArray=function(){for(var e=this,t=[],n=0,i=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&i===ve.CLOCKWISE)&&(r=!0),r&&(this._minIndex=this._minIndex-1)};pa.prototype.getRightmostSideOfSegment=function(e,t){var n=e.getEdge(),i=n.getCoordinates();if(t<0||t+1>=i.length||i[t].y===i[t+1].y)return-1;var r=re.LEFT;return i[t].yt._minCoord.x)&&(t._minDe=e,t._minIndex=i,t._minCoord=n[i])};pa.prototype.findRightmostEdgeAtNode=function(){var e=this._minDe.getNode(),t=e.getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};pa.prototype.findEdge=function(e){for(var t=this,n=e.iterator();n.hasNext();){var i=n.next();i.isForward()&&t.checkForRightmostCoordinate(i)}ln.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var r=this.getRightmostSide(this._minDe,this._minIndex);r===re.LEFT&&(this._orientedDe=this._minDe.getSym())};pa.prototype.interfaces_=function(){return[]};pa.prototype.getClass=function(){return pa};var ml=function(e){function t(n,i){e.call(this,t.msgWithCoord(n,i)),this.pt=i?new At(i):null,this.name="TopologyException"}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getCoordinate=function(){return this.pt},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.msgWithCoord=function(n,i){return i?n:n+" [ "+i+" ]"},t}(fl),Lg=function(){this.array_=[]};Lg.prototype.addLast=function(e){this.array_.push(e)};Lg.prototype.removeFirst=function(){return this.array_.shift()};Lg.prototype.isEmpty=function(){return this.array_.length===0};var no=function(){this._finder=null,this._dirEdgeList=new ce,this._nodes=new ce,this._rightMostCoord=null,this._env=null,this._finder=new pa};no.prototype.clearVisitedEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.setVisited(!1)}};no.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};no.prototype.computeNodeDepth=function(e){for(var t=this,n=null,i=e.getEdges().iterator();i.hasNext();){var r=i.next();if(r.isVisited()||r.getSym().isVisited()){n=r;break}}if(n===null)throw new ml("unable to find edge to compute depths at "+e.getCoordinate());e.getEdges().computeDepths(n);for(var u=e.getEdges().iterator();u.hasNext();){var p=u.next();p.setVisited(!0),t.copySymDepths(p)}};no.prototype.computeDepth=function(e){this.clearVisitedEdges();var t=this._finder.getEdge();t.setEdgeDepths(re.RIGHT,e),this.copySymDepths(t),this.computeDepths(t)};no.prototype.create=function(e){this.addReachable(e),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};no.prototype.findResultEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.getDepth(re.RIGHT)>=1&&t.getDepth(re.LEFT)<=0&&!t.isInteriorAreaEdge()&&t.setInResult(!0)}};no.prototype.computeDepths=function(e){var t=this,n=new Ny,i=new Lg,r=e.getNode();for(i.addLast(r),n.add(r),e.setVisited(!0);!i.isEmpty();){var u=i.removeFirst();n.add(u),t.computeNodeDepth(u);for(var p=u.getEdges().iterator();p.hasNext();){var a=p.next(),_=a.getSym();if(!_.isVisited()){var x=_.getNode();n.contains(x)||(i.addLast(x),n.add(x))}}}};no.prototype.compareTo=function(e){var t=e;return this._rightMostCoord.xt._rightMostCoord.x?1:0};no.prototype.getEnvelope=function(){if(this._env===null){for(var e=new Re,t=this._dirEdgeList.iterator();t.hasNext();)for(var n=t.next(),i=n.getEdge().getCoordinates(),r=0;rthis.location.length){var n=new Array(3).fill(null);n[re.ON]=this.location[re.ON],n[re.LEFT]=zt.NONE,n[re.RIGHT]=zt.NONE,this.location=n}for(var i=0;i1&&e.append(zt.toLocationSymbol(this.location[re.LEFT])),e.append(zt.toLocationSymbol(this.location[re.ON])),this.location.length>1&&e.append(zt.toLocationSymbol(this.location[re.RIGHT])),e.toString()};ni.prototype.setLocations=function(e,t,n){this.location[re.ON]=e,this.location[re.LEFT]=t,this.location[re.RIGHT]=n};ni.prototype.get=function(e){return e1};ni.prototype.isAnyNull=function(){for(var e=this,t=0;te._maxNodeDegree&&(e._maxNodeDegree=i),t=e.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2};Zi.prototype.addPoints=function(e,t,n){var i=this,r=e.getCoordinates();if(t){var u=1;n&&(u=0);for(var p=u;p=0;_--)i._pts.add(r[_])}};Zi.prototype.isHole=function(){return this._isHole};Zi.prototype.setInResult=function(){var e=this._startDe;do e.getEdge().setInResult(!0),e=e.getNext();while(e!==this._startDe)};Zi.prototype.containsPoint=function(e){var t=this.getLinearRing(),n=t.getEnvelopeInternal();if(!n.contains(e)||!ve.isPointInRing(e,t.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();){var r=i.next();if(r.containsPoint(e))return!1}return!0};Zi.prototype.addHole=function(e){this._holes.add(e)};Zi.prototype.isShell=function(){return this._shell===null};Zi.prototype.getLabel=function(){return this._label};Zi.prototype.getEdges=function(){return this._edges};Zi.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};Zi.prototype.getShell=function(){return this._shell};Zi.prototype.mergeLabel=function(){if(arguments.length===1){var e=arguments[0];this.mergeLabel(e,0),this.mergeLabel(e,1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],i=t.getLocation(n,re.RIGHT);if(i===zt.NONE)return null;if(this._label.getLocation(n)===zt.NONE)return this._label.setLocation(n,i),null}};Zi.prototype.setShell=function(e){this._shell=e,e!==null&&e.addHole(this)};Zi.prototype.toPolygon=function(e){for(var t=this,n=new Array(this._holes.size()).fill(null),i=0;i=2,"found partial label"),this.computeIM(e)};Yo.prototype.isInResult=function(){return this._isInResult};Yo.prototype.isVisited=function(){return this._isVisited};Yo.prototype.interfaces_=function(){return[]};Yo.prototype.getClass=function(){return Yo};var Mg=function(e){function t(){e.call(this),this._coord=null,this._edges=null;var n=arguments[0],i=arguments[1];this._coord=n,this._edges=i,this._label=new Un(0,zt.NONE)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var i=n.next();if(i.getEdge().isInResult())return!0}return!1},t.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},t.prototype.getCoordinate=function(){return this._coord},t.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},t.prototype.computeIM=function(n){},t.prototype.computeMergedLocation=function(n,i){var r=zt.NONE;if(r=this._label.getLocation(i),!n.isNull(i)){var u=n.getLocation(i);r!==zt.BOUNDARY&&(r=u)}return r},t.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this._label===null?this._label=new Un(n,i):this._label.setLocation(n,i)}else return e.prototype.setLabel.apply(this,arguments)},t.prototype.getEdges=function(){return this._edges},t.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof t){var i=arguments[0];this.mergeLabel(i._label)}else if(arguments[0]instanceof Un)for(var r=arguments[0],u=0;u<2;u++){var p=n.computeMergedLocation(r,u),a=n._label.getLocation(u);a===zt.NONE&&n._label.setLocation(u,p)}},t.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},t.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var i=zt.NONE;this._label!==null&&(i=this._label.getLocation(n));var r=null;switch(i){case zt.BOUNDARY:r=zt.INTERIOR;break;case zt.INTERIOR:r=zt.BOUNDARY;break;default:r=zt.BOUNDARY;break}this._label.setLocation(n,r)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Yo),fa=function(){this.nodeMap=new Ur,this.nodeFact=null;var e=arguments[0];this.nodeFact=e};fa.prototype.find=function(e){return this.nodeMap.get(e)};fa.prototype.addNode=function(){if(arguments[0]instanceof At){var e=arguments[0],t=this.nodeMap.get(e);return t===null&&(t=this.nodeFact.createNode(e),this.nodeMap.put(e,t)),t}else if(arguments[0]instanceof Mg){var n=arguments[0],i=this.nodeMap.get(n.getCoordinate());return i===null?(this.nodeMap.put(n.getCoordinate(),n),n):(i.mergeLabel(n),i)}};fa.prototype.print=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};fa.prototype.iterator=function(){return this.nodeMap.values().iterator()};fa.prototype.values=function(){return this.nodeMap.values()};fa.prototype.getBoundaryNodes=function(e){for(var t=new ce,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(e)===zt.BOUNDARY&&t.add(i)}return t};fa.prototype.add=function(e){var t=e.getCoordinate(),n=this.addNode(t);n.add(e)};fa.prototype.interfaces_=function(){return[]};fa.prototype.getClass=function(){return fa};var Hn=function(){},_d={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Hn.prototype.interfaces_=function(){return[]};Hn.prototype.getClass=function(){return Hn};Hn.isNorthern=function(e){return e===Hn.NE||e===Hn.NW};Hn.isOpposite=function(e,t){if(e===t)return!1;var n=(e-t+4)%4;return n===2};Hn.commonHalfPlane=function(e,t){if(e===t)return e;var n=(e-t+4)%4;if(n===2)return-1;var i=et?e:t;return i===0&&r===3?3:i};Hn.isInHalfPlane=function(e,t){return t===Hn.SE?e===Hn.SE||e===Hn.SW:e===t||e===t+1};Hn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1];if(e===0&&t===0)throw new di("Cannot compute the quadrant for point ( "+e+", "+t+" )");return e>=0?t>=0?Hn.NE:Hn.SE:t>=0?Hn.NW:Hn.SW}else if(arguments[0]instanceof At&&arguments[1]instanceof At){var n=arguments[0],i=arguments[1];if(i.x===n.x&&i.y===n.y)throw new di("Cannot compute the quadrant for two identical points "+n);return i.x>=n.x?i.y>=n.y?Hn.NE:Hn.SE:i.y>=n.y?Hn.NW:Hn.SW}};_d.NE.get=function(){return 0};_d.NW.get=function(){return 1};_d.SW.get=function(){return 2};_d.SE.get=function(){return 3};Object.defineProperties(Hn,_d);var Gr=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var e=arguments[0];this._edge=e}else if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2],r=null;this._edge=t,this.init(n,i),this._label=r}else if(arguments.length===4){var u=arguments[0],p=arguments[1],a=arguments[2],_=arguments[3];this._edge=u,this.init(p,a),this._label=_}};Gr.prototype.compareDirection=function(e){return this._dx===e._dx&&this._dy===e._dy?0:this._quadrant>e._quadrant?1:this._quadrant2){p.linkDirectedEdgesForMinimalEdgeRings();var a=p.buildMinimalRings(),_=i.findShell(a);_!==null?(i.placePolygonHoles(_,a),t.add(_)):n.addAll(a)}else r.add(p)}return r};Po.prototype.containsPoint=function(e){for(var t=this._shellList.iterator();t.hasNext();){var n=t.next();if(n.containsPoint(e))return!0}return!1};Po.prototype.buildMaximalEdgeRings=function(e){for(var t=this,n=new ce,i=e.iterator();i.hasNext();){var r=i.next();if(r.isInResult()&&r.getLabel().isArea()&&r.getEdgeRing()===null){var u=new LC(r,t._geometryFactory);n.add(u),u.setInResult()}}return n};Po.prototype.placePolygonHoles=function(e,t){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(e)}};Po.prototype.getPolygons=function(){var e=this.computePolygons(this._shellList);return e};Po.prototype.findEdgeRingContaining=function(e,t){for(var n=e.getLinearRing(),i=n.getEnvelopeInternal(),r=n.getCoordinateN(0),u=null,p=null,a=t.iterator();a.hasNext();){var _=a.next(),x=_.getLinearRing(),S=x.getEnvelopeInternal();u!==null&&(p=u.getLinearRing().getEnvelopeInternal());var L=!1;S.contains(i)&&ve.isPointInRing(r,x.getCoordinates())&&(L=!0),L&&(u===null||p.contains(S))&&(u=_)}return u};Po.prototype.findShell=function(e){for(var t=0,n=null,i=e.iterator();i.hasNext();){var r=i.next();r.isHole()||(n=r,t++)}return ln.isTrue(t<=1,"found two shells in MinimalEdgeRing list"),n};Po.prototype.add=function(){if(arguments.length===1){var e=arguments[0];this.add(e.getEdgeEnds(),e.getNodes())}else if(arguments.length===2){var t=arguments[0],n=arguments[1];bi.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(t),r=new ce,u=this.buildMinimalEdgeRings(i,this._shellList,r);this.sortShellsAndHoles(u,this._shellList,r),this.placeFreeHoles(this._shellList,r)}};Po.prototype.interfaces_=function(){return[]};Po.prototype.getClass=function(){return Po};var jh=function(){};jh.prototype.getBounds=function(){};jh.prototype.interfaces_=function(){return[]};jh.prototype.getClass=function(){return jh};var Rs=function(){this._bounds=null,this._item=null;var e=arguments[0],t=arguments[1];this._bounds=e,this._item=t};Rs.prototype.getItem=function(){return this._item};Rs.prototype.getBounds=function(){return this._bounds};Rs.prototype.interfaces_=function(){return[jh,bs]};Rs.prototype.getClass=function(){return Rs};var gl=function(){this._size=null,this._items=null,this._size=0,this._items=new ce,this._items.add(null)};gl.prototype.poll=function(){if(this.isEmpty())return null;var e=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),e};gl.prototype.size=function(){return this._size};gl.prototype.reorder=function(e){for(var t=this,n=null,i=this._items.get(e);e*2<=this._size&&(n=e*2,n!==t._size&&t._items.get(n+1).compareTo(t._items.get(n))<0&&n++,t._items.get(n).compareTo(i)<0);e=n)t._items.set(e,t._items.get(n));this._items.set(e,i)};gl.prototype.clear=function(){this._size=0,this._items.clear()};gl.prototype.isEmpty=function(){return this._size===0};gl.prototype.add=function(e){var t=this;this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,e);e.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)t._items.set(n,t._items.get(Math.trunc(n/2)));this._items.set(n,e)};gl.prototype.interfaces_=function(){return[]};gl.prototype.getClass=function(){return gl};var Kl=function(){};Kl.prototype.visitItem=function(e){};Kl.prototype.interfaces_=function(){return[]};Kl.prototype.getClass=function(){return Kl};var xc=function(){};xc.prototype.insert=function(e,t){};xc.prototype.remove=function(e,t){};xc.prototype.query=function(){};xc.prototype.interfaces_=function(){return[]};xc.prototype.getClass=function(){return xc};var $i=function(){if(this._childBoundables=new ce,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var e=arguments[0];this._level=e}},Cx={serialVersionUID:{configurable:!0}};$i.prototype.getLevel=function(){return this._level};$i.prototype.size=function(){return this._childBoundables.size()};$i.prototype.getChildBoundables=function(){return this._childBoundables};$i.prototype.addChildBoundable=function(e){ln.isTrue(this._bounds===null),this._childBoundables.add(e)};$i.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};$i.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};$i.prototype.interfaces_=function(){return[jh,bs]};$i.prototype.getClass=function(){return $i};Cx.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties($i,Cx);var Os=function(){};Os.reverseOrder=function(){return{compare:function(e,t){return t.compareTo(e)}}};Os.min=function(e){return Os.sort(e),e.get(0)};Os.sort=function(e,t){var n=e.toArray();t?ku.sort(n,t):ku.sort(n);for(var i=e.iterator(),r=0,u=n.length;rGi.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,e,t),null):(this.expand(this._boundable2,this._boundable1,e,t),null);if(n)return this.expand(this._boundable1,this._boundable2,e,t),null;if(i)return this.expand(this._boundable2,this._boundable1,e,t),null;throw new di("neither boundable is composite")};Gi.prototype.isLeaves=function(){return!(Gi.isComposite(this._boundable1)||Gi.isComposite(this._boundable2))};Gi.prototype.compareTo=function(e){var t=e;return this._distancet._distance?1:0};Gi.prototype.expand=function(e,t,n,i){for(var r=this,u=e.getChildBoundables(),p=u.iterator();p.hasNext();){var a=p.next(),_=new Gi(a,t,r._itemDistance);_.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},Pg={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};vr.prototype.getNodeCapacity=function(){return this._nodeCapacity};vr.prototype.lastNode=function(e){return e.get(e.size()-1)};vr.prototype.size=function(){var e=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var t=arguments[0],n=0,i=t.getChildBoundables().iterator();i.hasNext();){var r=i.next();r instanceof $i?n+=e.size(r):r instanceof Rs&&(n+=1)}return n}};vr.prototype.removeItem=function(e,t){for(var n=null,i=e.getChildBoundables().iterator();i.hasNext();){var r=i.next();r instanceof Rs&&r.getItem()===t&&(n=r)}return n!==null?(e.getChildBoundables().remove(n),!0):!1};vr.prototype.itemsTree=function(){var e=this;if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new ce:t}else if(arguments.length===1){for(var n=arguments[0],i=new ce,r=n.getChildBoundables().iterator();r.hasNext();){var u=r.next();if(u instanceof $i){var p=e.itemsTree(u);p!==null&&i.add(p)}else u instanceof Rs?i.add(u.getItem()):ln.shouldNeverReachHere()}return i.size()<=0?null:i}};vr.prototype.insert=function(e,t){ln.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Rs(e,t))};vr.prototype.boundablesAtLevel=function(){var e=this;if(arguments.length===1){var t=arguments[0],n=new ce;return this.boundablesAtLevel(t,this._root,n),n}else if(arguments.length===3){var i=arguments[0],r=arguments[1],u=arguments[2];if(ln.isTrue(i>-2),r.getLevel()===i)return u.add(r),null;for(var p=r.getChildBoundables().iterator();p.hasNext();){var a=p.next();a instanceof $i?e.boundablesAtLevel(i,a,u):(ln.isTrue(a instanceof Rs),i===-1&&u.add(a))}return null}};vr.prototype.query=function(){var e=this;if(arguments.length===1){var t=arguments[0];this.build();var n=new ce;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,n),n}else if(arguments.length===2){var i=arguments[0],r=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),i)&&this.query(i,this._root,r)}else if(arguments.length===3){if(We(arguments[2],Kl)&&arguments[0]instanceof Object&&arguments[1]instanceof $i)for(var u=arguments[0],p=arguments[1],a=arguments[2],_=p.getChildBoundables(),x=0;x<_.size();x++){var S=_.get(x);e.getIntersectsOp().intersects(S.getBounds(),u)&&(S instanceof $i?e.query(u,S,a):S instanceof Rs?a.visitItem(S.getItem()):ln.shouldNeverReachHere())}else if(We(arguments[2],As)&&arguments[0]instanceof Object&&arguments[1]instanceof $i)for(var L=arguments[0],A=arguments[1],N=arguments[2],z=A.getChildBoundables(),H=0;Hn&&(n=u)}}return n+1}};vr.prototype.createParentBoundables=function(e,t){var n=this;ln.isTrue(!e.isEmpty());var i=new ce;i.add(this.createNode(t));var r=new ce(e);Os.sort(r,this.getComparator());for(var u=r.iterator();u.hasNext();){var p=u.next();n.lastNode(i).getChildBoundables().size()===n.getNodeCapacity()&&i.add(n.createNode(t)),n.lastNode(i).addChildBoundable(p)}return i};vr.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};vr.prototype.interfaces_=function(){return[bs]};vr.prototype.getClass=function(){return vr};vr.compareDoubles=function(e,t){return e>t?1:e0);for(var p=new ce,a=0;a0;){var z=N.poll(),H=z.getDistance();if(H>=L)break;z.isLeaves()?(L=H,A=z):z.expandToQueue(N,L)}return[A.getBoundable(0).getItem(),A.getBoundable(1).getItem()]}}else if(arguments.length===3){var Z=arguments[0],K=arguments[1],V=arguments[2],X=new Rs(Z,K),Q=new Gi(this.getRoot(),X,V);return this.nearestNeighbour(Q)[0]}},t.prototype.interfaces_=function(){return[xc,bs]},t.prototype.getClass=function(){return t},t.centreX=function(i){return t.avg(i.getMinX(),i.getMaxX())},t.avg=function(i,r){return(i+r)/2},t.centreY=function(i){return t.avg(i.getMinY(),i.getMaxY())},n.STRtreeNode.get=function(){return m1},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[Dh]},compare:function(i,r){return e.compareDoubles(t.centreX(i.getBounds()),t.centreX(r.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[Dh]},compare:function(i,r){return e.compareDoubles(t.centreY(i.getBounds()),t.centreY(r.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[e.IntersectsOp]},intersects:function(i,r){return i.intersects(r)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(t,n),t}(vr),m1=function(e){function t(){var n=arguments[0];e.call(this,n)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.computeBounds=function(){for(var n=null,i=this.getChildBoundables().iterator();i.hasNext();){var r=i.next();n===null?n=new Re(r.getBounds()):n.expandToInclude(r.getBounds())}return n},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}($i),po=function(){};po.prototype.interfaces_=function(){return[]};po.prototype.getClass=function(){return po};po.relativeSign=function(e,t){return et?1:0};po.compare=function(e,t,n){if(t.equals2D(n))return 0;var i=po.relativeSign(t.x,n.x),r=po.relativeSign(t.y,n.y);switch(e){case 0:return po.compareValue(i,r);case 1:return po.compareValue(r,i);case 2:return po.compareValue(r,-i);case 3:return po.compareValue(-i,r);case 4:return po.compareValue(-i,-r);case 5:return po.compareValue(-r,-i);case 6:return po.compareValue(-r,i);case 7:return po.compareValue(i,-r)}return ln.shouldNeverReachHere("invalid octant value"),0};po.compareValue=function(e,t){return e<0?-1:e>0?1:t<0?-1:t>0?1:0};var Jl=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this._segString=e,this.coord=new At(t),this.segmentIndex=n,this._segmentOctant=i,this._isInterior=!t.equals2D(e.getCoordinate(n))};Jl.prototype.getCoordinate=function(){return this.coord};Jl.prototype.print=function(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex)};Jl.prototype.compareTo=function(e){var t=e;return this.segmentIndext.segmentIndex?1:this.coord.equals2D(t.coord)?0:po.compare(this._segmentOctant,this.coord,t.coord)};Jl.prototype.isEndPoint=function(e){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===e};Jl.prototype.isInterior=function(){return this._isInterior};Jl.prototype.interfaces_=function(){return[vs]};Jl.prototype.getClass=function(){return Jl};var io=function(){this._nodeMap=new Ur,this._edge=null;var e=arguments[0];this._edge=e};io.prototype.getSplitCoordinates=function(){var e=this,t=new md;this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var r=n.next();e.addEdgeCoordinates(i,r,t),i=r}return t.toCoordinateArray()};io.prototype.addCollapsedNodes=function(){var e=this,t=new ce;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var n=t.iterator();n.hasNext();){var i=n.next().intValue();e.add(e._edge.getCoordinate(i),i)}};io.prototype.print=function(e){e.println("Intersections:");for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};io.prototype.findCollapsesFromExistingVertices=function(e){for(var t=this,n=0;n=0?t>=0?n>=i?0:1:n>=i?7:6:t>=0?n>=i?3:2:n>=i?4:5}else if(arguments[0]instanceof At&&arguments[1]instanceof At){var r=arguments[0],u=arguments[1],p=u.x-r.x,a=u.y-r.y;if(p===0&&a===0)throw new di("Cannot compute the octant for two identical points "+r);return wc.octant(p,a)}};var Ua=function(){};Ua.prototype.getCoordinates=function(){};Ua.prototype.size=function(){};Ua.prototype.getCoordinate=function(e){};Ua.prototype.isClosed=function(){};Ua.prototype.setData=function(e){};Ua.prototype.getData=function(){};Ua.prototype.interfaces_=function(){return[]};Ua.prototype.getClass=function(){return Ua};var $f=function(){};$f.prototype.addIntersection=function(e,t){};$f.prototype.interfaces_=function(){return[Ua]};$f.prototype.getClass=function(){return $f};var zi=function(){this._nodeList=new io(this),this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};zi.prototype.getCoordinates=function(){return this._pts};zi.prototype.size=function(){return this._pts.length};zi.prototype.getCoordinate=function(e){return this._pts[e]};zi.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};zi.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(e),this.getCoordinate(e+1))};zi.prototype.setData=function(e){this._data=e};zi.prototype.safeOctant=function(e,t){return e.equals2D(t)?0:wc.octant(e,t)};zi.prototype.getData=function(){return this._data};zi.prototype.addIntersection=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.addIntersectionNode(e,t)}else if(arguments.length===4){var n=arguments[0],i=arguments[1],r=arguments[3],u=new At(n.getIntersection(r));this.addIntersection(u,i)}};zi.prototype.toString=function(){return Ns.toLineString(new ki(this._pts))};zi.prototype.getNodeList=function(){return this._nodeList};zi.prototype.addIntersectionNode=function(e,t){var n=t,i=n+1;if(i=0&&n>=0||t<=0&&n<=0?Math.max(t,n):0}else if(arguments[0]instanceof At){var i=arguments[0];return ve.orientationIndex(this.p0,this.p1,i)}};Oe.prototype.toGeometry=function(e){return e.createLineString([this.p0,this.p1])};Oe.prototype.isVertical=function(){return this.p0.x===this.p1.x};Oe.prototype.equals=function(e){if(!(e instanceof Oe))return!1;var t=e;return this.p0.equals(t.p0)&&this.p1.equals(t.p1)};Oe.prototype.intersection=function(e){var t=new Wu;return t.computeIntersection(this.p0,this.p1,e.p0,e.p1),t.hasIntersection()?t.getIntersection(0):null};Oe.prototype.project=function(){if(arguments[0]instanceof At){var e=arguments[0];if(e.equals(this.p0)||e.equals(this.p1))return new At(e);var t=this.projectionFactor(e),n=new At;return n.x=this.p0.x+t*(this.p1.x-this.p0.x),n.y=this.p0.y+t*(this.p1.y-this.p0.y),n}else if(arguments[0]instanceof Oe){var i=arguments[0],r=this.projectionFactor(i.p0),u=this.projectionFactor(i.p1);if(r>=1&&u>=1||r<=0&&u<=0)return null;var p=this.project(i.p0);r<0&&(p=this.p0),r>1&&(p=this.p1);var a=this.project(i.p1);return u<0&&(a=this.p0),u>1&&(a=this.p1),new Oe(p,a)}};Oe.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};Oe.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};Oe.prototype.getCoordinate=function(e){return e===0?this.p0:this.p1};Oe.prototype.distancePerpendicular=function(e){return ve.distancePointLinePerpendicular(e,this.p0,this.p1)};Oe.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};Oe.prototype.midPoint=function(){return Oe.midPoint(this.p0,this.p1)};Oe.prototype.projectionFactor=function(e){if(e.equals(this.p0))return 0;if(e.equals(this.p1))return 1;var t=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,i=t*t+n*n;if(i<=0)return tn.NaN;var r=((e.x-this.p0.x)*t+(e.y-this.p0.y)*n)/i;return r};Oe.prototype.closestPoints=function(e){var t=this.intersection(e);if(t!==null)return[t,t];var n=new Array(2).fill(null),i=tn.MAX_VALUE,r=null,u=this.closestPoint(e.p0);i=u.distance(e.p0),n[0]=u,n[1]=e.p0;var p=this.closestPoint(e.p1);r=p.distance(e.p1),r0&&t<1)return this.project(e);var n=this.p0.distance(e),i=this.p1.distance(e);return n1||tn.isNaN(t))&&(t=1),t};Oe.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};Oe.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};Oe.prototype.distance=function(){if(arguments[0]instanceof Oe){var e=arguments[0];return ve.distanceLineLine(this.p0,this.p1,e.p0,e.p1)}else if(arguments[0]instanceof At){var t=arguments[0];return ve.distancePointLine(t,this.p0,this.p1)}};Oe.prototype.pointAlong=function(e){var t=new At;return t.x=this.p0.x+e*(this.p1.x-this.p0.x),t.y=this.p0.y+e*(this.p1.y-this.p0.y),t};Oe.prototype.hashCode=function(){var e=tn.doubleToLongBits(this.p0.x);e^=tn.doubleToLongBits(this.p0.y)*31;var t=Math.trunc(e)^Math.trunc(e>>32),n=tn.doubleToLongBits(this.p1.x);n^=tn.doubleToLongBits(this.p1.y)*31;var i=Math.trunc(n)^Math.trunc(n>>32);return t^i};Oe.prototype.interfaces_=function(){return[vs,bs]};Oe.prototype.getClass=function(){return Oe};Oe.midPoint=function(e,t){return new At((e.x+t.x)/2,(e.y+t.y)/2)};Lx.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(Oe,Lx);var td=function(){this.tempEnv1=new Re,this.tempEnv2=new Re,this._overlapSeg1=new Oe,this._overlapSeg2=new Oe};td.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];e.getLineSegment(t,this._overlapSeg1),n.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};td.prototype.interfaces_=function(){return[]};td.prototype.getClass=function(){return td};var Ao=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this._pts=e,this._start=t,this._end=n,this._context=i};Ao.prototype.getLineSegment=function(e,t){t.p0=this._pts[e],t.p1=this._pts[e+1]};Ao.prototype.computeSelect=function(e,t,n,i){var r=this._pts[t],u=this._pts[n];if(i.tempEnv1.init(r,u),n-t===1)return i.select(this,t),null;if(!e.intersects(i.tempEnv1))return null;var p=Math.trunc((t+n)/2);t=e.length-1)return e.length-1;for(var i=Hn.quadrant(e[n],e[n+1]),r=t+1;rp.getId()&&(p.computeOverlaps(x,r),i._nOverlaps++),i._segInt.isDone())return null}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.SegmentOverlapAction.get=function(){return g1},Object.defineProperties(t,n),t}(ed),g1=function(e){function t(){e.call(this),this._si=null;var n=arguments[0];this._si=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],i=arguments[1],r=arguments[2],u=arguments[3],p=n.getContext(),a=r.getContext();this._si.processIntersections(p,i,a,u)}else return e.prototype.overlap.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(td),Nn=function e(){if(this._quadrantSegments=e.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=e.CAP_ROUND,this._joinStyle=e.JOIN_ROUND,this._mitreLimit=e.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=e.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setQuadrantSegments(t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(i)}else if(arguments.length===4){var r=arguments[0],u=arguments[1],p=arguments[2],a=arguments[3];this.setQuadrantSegments(r),this.setEndCapStyle(u),this.setJoinStyle(p),this.setMitreLimit(a)}}},bl={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Nn.prototype.getEndCapStyle=function(){return this._endCapStyle};Nn.prototype.isSingleSided=function(){return this._isSingleSided};Nn.prototype.setQuadrantSegments=function(e){this._quadrantSegments=e,this._quadrantSegments===0&&(this._joinStyle=Nn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Nn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),e<=0&&(this._quadrantSegments=1),this._joinStyle!==Nn.JOIN_ROUND&&(this._quadrantSegments=Nn.DEFAULT_QUADRANT_SEGMENTS)};Nn.prototype.getJoinStyle=function(){return this._joinStyle};Nn.prototype.setJoinStyle=function(e){this._joinStyle=e};Nn.prototype.setSimplifyFactor=function(e){this._simplifyFactor=e<0?0:e};Nn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Nn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Nn.prototype.setEndCapStyle=function(e){this._endCapStyle=e};Nn.prototype.getMitreLimit=function(){return this._mitreLimit};Nn.prototype.setMitreLimit=function(e){this._mitreLimit=e};Nn.prototype.setSingleSided=function(e){this._isSingleSided=e};Nn.prototype.interfaces_=function(){return[]};Nn.prototype.getClass=function(){return Nn};Nn.bufferDistanceError=function(e){var t=Math.PI/2/e;return 1-Math.cos(t/2)};bl.CAP_ROUND.get=function(){return 1};bl.CAP_FLAT.get=function(){return 2};bl.CAP_SQUARE.get=function(){return 3};bl.JOIN_ROUND.get=function(){return 1};bl.JOIN_MITRE.get=function(){return 2};bl.JOIN_BEVEL.get=function(){return 3};bl.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};bl.DEFAULT_MITRE_LIMIT.get=function(){return 5};bl.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Nn,bl);var Li=function(e){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ve.COUNTERCLOCKWISE,this._inputLine=e||null},yd={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Li.prototype.isDeletable=function(e,t,n,i){var r=this._inputLine[e],u=this._inputLine[t],p=this._inputLine[n];return!this.isConcave(r,u,p)||!this.isShallow(r,u,p,i)?!1:this.isShallowSampled(r,u,e,n,i)};Li.prototype.deleteShallowConcavities=function(){for(var e=this,t=1,n=this.findNextNonDeletedIndex(t),i=this.findNextNonDeletedIndex(n),r=!1;i=0;r--)n.addPt(e[r])};Ko.prototype.isRedundant=function(e){if(this._ptList.size()<1)return!1;var t=this._ptList.get(this._ptList.size()-1),n=e.distance(t);return nMath.PI;)e-=Sn.PI_TIMES_2;for(;e<=-Math.PI;)e+=Sn.PI_TIMES_2;return e};Sn.angle=function(){if(arguments.length===1){var e=arguments[0];return Math.atan2(e.y,e.x)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],i=n.x-t.x,r=n.y-t.y;return Math.atan2(r,i)}};Sn.isAcute=function(e,t,n){var i=e.x-t.x,r=e.y-t.y,u=n.x-t.x,p=n.y-t.y,a=i*u+r*p;return a>0};Sn.isObtuse=function(e,t,n){var i=e.x-t.x,r=e.y-t.y,u=n.x-t.x,p=n.y-t.y,a=i*u+r*p;return a<0};Sn.interiorAngle=function(e,t,n){var i=Sn.angle(t,e),r=Sn.angle(t,n);return Math.abs(r-i)};Sn.normalizePositive=function(e){if(e<0){for(;e<0;)e+=Sn.PI_TIMES_2;e>=Sn.PI_TIMES_2&&(e=0)}else{for(;e>=Sn.PI_TIMES_2;)e-=Sn.PI_TIMES_2;e<0&&(e=0)}return e};Sn.angleBetween=function(e,t,n){var i=Sn.angle(t,e),r=Sn.angle(t,n);return Sn.diff(i,r)};Sn.diff=function(e,t){var n=null;return eMath.PI&&(n=2*Math.PI-n),n};Sn.toRadians=function(e){return e*Math.PI/180};Sn.getTurn=function(e,t){var n=Math.sin(t-e);return n>0?Sn.COUNTERCLOCKWISE:n<0?Sn.CLOCKWISE:Sn.NONE};Sn.angleBetweenOriented=function(e,t,n){var i=Sn.angle(t,e),r=Sn.angle(t,n),u=r-i;return u<=-Math.PI?u+Sn.PI_TIMES_2:u>Math.PI?u-Sn.PI_TIMES_2:u};zc.PI_TIMES_2.get=function(){return 2*Math.PI};zc.PI_OVER_2.get=function(){return Math.PI/2};zc.PI_OVER_4.get=function(){return Math.PI/4};zc.COUNTERCLOCKWISE.get=function(){return ve.COUNTERCLOCKWISE};zc.CLOCKWISE.get=function(){return ve.CLOCKWISE};zc.NONE.get=function(){return ve.COLLINEAR};Object.defineProperties(Sn,zc);var ui=function e(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Oe,this._seg1=new Oe,this._offset0=new Oe,this._offset1=new Oe,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],n=arguments[1],i=arguments[2];this._precisionModel=t,this._bufParams=n,this._li=new Wu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Nn.JOIN_ROUND&&(this._closingSegLengthFactor=e.MAX_CLOSING_SEG_LEN_FACTOR),this.init(i)},vd={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};ui.prototype.addNextSegment=function(e,t){if(this._s0=this._s1,this._s1=this._s2,this._s2=e,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=ve.computeOrientation(this._s0,this._s1,this._s2),i=n===ve.CLOCKWISE&&this._side===re.LEFT||n===ve.COUNTERCLOCKWISE&&this._side===re.RIGHT;n===0?this.addCollinear(t):i?this.addOutsideTurn(n,t):this.addInsideTurn(n,t)};ui.prototype.addLineEndCap=function(e,t){var n=new Oe(e,t),i=new Oe;this.computeOffsetSegment(n,re.LEFT,this._distance,i);var r=new Oe;this.computeOffsetSegment(n,re.RIGHT,this._distance,r);var u=t.x-e.x,p=t.y-e.y,a=Math.atan2(p,u);switch(this._bufParams.getEndCapStyle()){case Nn.CAP_ROUND:this._segList.addPt(i.p1),this.addFilletArc(t,a+Math.PI/2,a-Math.PI/2,ve.CLOCKWISE,this._distance),this._segList.addPt(r.p1);break;case Nn.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(r.p1);break;case Nn.CAP_SQUARE:var _=new At;_.x=Math.abs(this._distance)*Math.cos(a),_.y=Math.abs(this._distance)*Math.sin(a);var x=new At(i.p1.x+_.x,i.p1.y+_.y),S=new At(r.p1.x+_.x,r.p1.y+_.y);this._segList.addPt(x),this._segList.addPt(S);break}};ui.prototype.getCoordinates=function(){var e=this._segList.getCoordinates();return e};ui.prototype.addMitreJoin=function(e,t,n,i){var r=!0,u=null;try{u=Ps.intersection(t.p0,t.p1,n.p0,n.p1);var p=i<=0?1:u.distance(e)/Math.abs(i);p>this._bufParams.getMitreLimit()&&(r=!1)}catch(a){if(a instanceof sp)u=new At(0,0),r=!1;else throw a}finally{}r?this._segList.addPt(u):this.addLimitedMitreJoin(t,n,i,this._bufParams.getMitreLimit())};ui.prototype.addFilletCorner=function(e,t,n,i,r){var u=t.x-e.x,p=t.y-e.y,a=Math.atan2(p,u),_=n.x-e.x,x=n.y-e.y,S=Math.atan2(x,_);i===ve.CLOCKWISE?a<=S&&(a+=2*Math.PI):a>=S&&(a-=2*Math.PI),this._segList.addPt(t),this.addFilletArc(e,a,S,i,r),this._segList.addPt(n)};ui.prototype.addOutsideTurn=function(e,t){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new At((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var i=new At((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(i)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};ui.prototype.createCircle=function(e){var t=new At(e.x+this._distance,e.y);this._segList.addPt(t),this.addFilletArc(e,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};ui.prototype.addBevelJoin=function(e,t){this._segList.addPt(e.p1),this._segList.addPt(t.p0)};ui.prototype.init=function(e){this._distance=e,this._maxCurveSegmentError=e*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Ko,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(e*ui.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};ui.prototype.addCollinear=function(e){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var t=this._li.getIntersectionNum();t>=2&&(this._bufParams.getJoinStyle()===Nn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Nn.JOIN_MITRE?(e&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,ve.CLOCKWISE,this._distance))};ui.prototype.closeRing=function(){this._segList.closeRing()};ui.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};ui.prototype.interfaces_=function(){return[]};ui.prototype.getClass=function(){return ui};vd.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};vd.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};vd.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};vd.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(ui,vd);var mo=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var e=arguments[0],t=arguments[1];this._precisionModel=e,this._bufParams=t};mo.prototype.getOffsetCurve=function(e,t){if(this._distance=t,t===0)return null;var n=t<0,i=Math.abs(t),r=this.getSegGen(i);e.length<=1?this.computePointCurve(e[0],r):this.computeOffsetCurve(e,n,r);var u=r.getCoordinates();return n&&yn.reverse(u),u};mo.prototype.computeSingleSidedBufferCurve=function(e,t,n){var i=this.simplifyTolerance(this._distance);if(t){n.addSegments(e,!0);var r=Li.simplify(e,-i),u=r.length-1;n.initSideSegments(r[u],r[u-1],re.LEFT),n.addFirstSegment();for(var p=u-2;p>=0;p--)n.addNextSegment(r[p],!0)}else{n.addSegments(e,!1);var a=Li.simplify(e,i),_=a.length-1;n.initSideSegments(a[0],a[1],re.LEFT),n.addFirstSegment();for(var x=2;x<=_;x++)n.addNextSegment(a[x],!0)}n.addLastSegment(),n.closeRing()};mo.prototype.computeRingBufferCurve=function(e,t,n){var i=this.simplifyTolerance(this._distance);t===re.RIGHT&&(i=-i);var r=Li.simplify(e,i),u=r.length-1;n.initSideSegments(r[u-1],r[0],t);for(var p=1;p<=u;p++){var a=p!==1;n.addNextSegment(r[p],a)}n.closeRing()};mo.prototype.computeLineBufferCurve=function(e,t){var n=this.simplifyTolerance(this._distance),i=Li.simplify(e,n),r=i.length-1;t.initSideSegments(i[0],i[1],re.LEFT);for(var u=2;u<=r;u++)t.addNextSegment(i[u],!0);t.addLastSegment(),t.addLineEndCap(i[r-1],i[r]);var p=Li.simplify(e,-n),a=p.length-1;t.initSideSegments(p[a],p[a-1],re.LEFT);for(var _=a-2;_>=0;_--)t.addNextSegment(p[_],!0);t.addLastSegment(),t.addLineEndCap(p[1],p[0]),t.closeRing()};mo.prototype.computePointCurve=function(e,t){switch(this._bufParams.getEndCapStyle()){case Nn.CAP_ROUND:t.createCircle(e);break;case Nn.CAP_SQUARE:t.createSquare(e);break}};mo.prototype.getLineCurve=function(e,t){if(this._distance=t,t<0&&!this._bufParams.isSingleSided()||t===0)return null;var n=Math.abs(t),i=this.getSegGen(n);if(e.length<=1)this.computePointCurve(e[0],i);else if(this._bufParams.isSingleSided()){var r=t<0;this.computeSingleSidedBufferCurve(e,r,i)}else this.computeLineBufferCurve(e,i);var u=i.getCoordinates();return u};mo.prototype.getBufferParameters=function(){return this._bufParams};mo.prototype.simplifyTolerance=function(e){return e*this._bufParams.getSimplifyFactor()};mo.prototype.getRingCurve=function(e,t,n){if(this._distance=n,e.length<=2)return this.getLineCurve(e,n);if(n===0)return mo.copyCoordinates(e);var i=this.getSegGen(n);return this.computeRingBufferCurve(e,t,i),i.getCoordinates()};mo.prototype.computeOffsetCurve=function(e,t,n){var i=this.simplifyTolerance(this._distance);if(t){var r=Li.simplify(e,-i),u=r.length-1;n.initSideSegments(r[u],r[u-1],re.LEFT),n.addFirstSegment();for(var p=u-2;p>=0;p--)n.addNextSegment(r[p],!0)}else{var a=Li.simplify(e,i),_=a.length-1;n.initSideSegments(a[0],a[1],re.LEFT),n.addFirstSegment();for(var x=2;x<=_;x++)n.addNextSegment(a[x],!0)}n.addLastSegment()};mo.prototype.getSegGen=function(e){return new ui(this._precisionModel,this._bufParams,e)};mo.prototype.interfaces_=function(){return[]};mo.prototype.getClass=function(){return mo};mo.copyCoordinates=function(e){for(var t=new Array(e.length).fill(null),n=0;nu.getMaxY()||e.findStabbedSegments(t,r.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(We(arguments[2],As)&&arguments[0]instanceof At&&arguments[1]instanceof gy)for(var p=arguments[0],a=arguments[1],_=arguments[2],x=a.getEdge().getCoordinates(),S=0;Se._seg.p1.y&&e._seg.reverse();var L=Math.max(e._seg.p0.x,e._seg.p1.x);if(!(Le._seg.p1.y)&&ve.computeOrientation(e._seg.p0,e._seg.p1,p)!==ve.RIGHT){var A=a.getDepth(re.LEFT);e._seg.p0.equals(x[S])||(A=a.getDepth(re.RIGHT));var N=new Bu(e._seg,A);_.add(N)}}else if(We(arguments[2],As)&&arguments[0]instanceof At&&We(arguments[1],As))for(var z=arguments[0],H=arguments[1],Z=arguments[2],K=H.iterator();K.hasNext();){var V=K.next();V.isForward()&&e.findStabbedSegments(z,V,Z)}}};Sc.prototype.getDepth=function(e){var t=this.findStabbedSegments(e);if(t.size()===0)return 0;var n=Os.min(t);return n._leftDepth};Sc.prototype.interfaces_=function(){return[]};Sc.prototype.getClass=function(){return Sc};Px.DepthSegment.get=function(){return Bu};Object.defineProperties(Sc,Px);var Bu=function(){this._upwardSeg=null,this._leftDepth=null;var e=arguments[0],t=arguments[1];this._upwardSeg=new Oe(e),this._leftDepth=t};Bu.prototype.compareTo=function(e){var t=e;if(this._upwardSeg.minX()>=t._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=t._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(t._upwardSeg);return n!==0||(n=-1*t._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(t._upwardSeg)};Bu.prototype.compareX=function(e,t){var n=e.p0.compareTo(t.p0);return n!==0?n:e.p1.compareTo(t.p1)};Bu.prototype.toString=function(){return this._upwardSeg.toString()};Bu.prototype.interfaces_=function(){return[vs]};Bu.prototype.getClass=function(){return Bu};var Rn=function(e,t,n){this.p0=e||null,this.p1=t||null,this.p2=n||null};Rn.prototype.area=function(){return Rn.area(this.p0,this.p1,this.p2)};Rn.prototype.signedArea=function(){return Rn.signedArea(this.p0,this.p1,this.p2)};Rn.prototype.interpolateZ=function(e){if(e===null)throw new di("Supplied point is null.");return Rn.interpolateZ(e,this.p0,this.p1,this.p2)};Rn.prototype.longestSideLength=function(){return Rn.longestSideLength(this.p0,this.p1,this.p2)};Rn.prototype.isAcute=function(){return Rn.isAcute(this.p0,this.p1,this.p2)};Rn.prototype.circumcentre=function(){return Rn.circumcentre(this.p0,this.p1,this.p2)};Rn.prototype.area3D=function(){return Rn.area3D(this.p0,this.p1,this.p2)};Rn.prototype.centroid=function(){return Rn.centroid(this.p0,this.p1,this.p2)};Rn.prototype.inCentre=function(){return Rn.inCentre(this.p0,this.p1,this.p2)};Rn.prototype.interfaces_=function(){return[]};Rn.prototype.getClass=function(){return Rn};Rn.area=function(e,t,n){return Math.abs(((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2)};Rn.signedArea=function(e,t,n){return((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2};Rn.det=function(e,t,n,i){return e*i-t*n};Rn.interpolateZ=function(e,t,n,i){var r=t.x,u=t.y,p=n.x-r,a=i.x-r,_=n.y-u,x=i.y-u,S=p*x-a*_,L=e.x-r,A=e.y-u,N=(x*L-a*A)/S,z=(-_*L+p*A)/S,H=t.z+N*(n.z-t.z)+z*(i.z-t.z);return H};Rn.longestSideLength=function(e,t,n){var i=e.distance(t),r=t.distance(n),u=n.distance(e),p=i;return r>p&&(p=r),u>p&&(p=u),p};Rn.isAcute=function(e,t,n){return!(!Sn.isAcute(e,t,n)||!Sn.isAcute(t,n,e)||!Sn.isAcute(n,e,t))};Rn.circumcentre=function(e,t,n){var i=n.x,r=n.y,u=e.x-i,p=e.y-r,a=t.x-i,_=t.y-r,x=2*Rn.det(u,p,a,_),S=Rn.det(p,u*u+p*p,_,a*a+_*_),L=Rn.det(u,u*u+p*p,a,a*a+_*_),A=i-S/x,N=r+L/x;return new At(A,N)};Rn.perpendicularBisector=function(e,t){var n=t.x-e.x,i=t.y-e.y,r=new Ps(e.x+n/2,e.y+i/2,1),u=new Ps(e.x-i+n/2,e.y+n+i/2,1);return new Ps(r,u)};Rn.angleBisector=function(e,t,n){var i=t.distance(e),r=t.distance(n),u=i/(i+r),p=n.x-e.x,a=n.y-e.y,_=new At(e.x+u*p,e.y+u*a);return _};Rn.area3D=function(e,t,n){var i=t.x-e.x,r=t.y-e.y,u=t.z-e.z,p=n.x-e.x,a=n.y-e.y,_=n.z-e.z,x=r*_-u*a,S=u*p-i*_,L=i*a-r*p,A=x*x+S*S+L*L,N=Math.sqrt(A)/2;return N};Rn.centroid=function(e,t,n){var i=(e.x+t.x+n.x)/3,r=(e.y+t.y+n.y)/3;return new At(i,r)};Rn.inCentre=function(e,t,n){var i=t.distance(n),r=e.distance(n),u=e.distance(t),p=i+r+u,a=(i*e.x+r*t.x+u*n.x)/p,_=(i*e.y+r*t.y+u*n.y)/p;return new At(a,_)};var _s=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new ce;var e=arguments[0],t=arguments[1],n=arguments[2];this._inputGeom=e,this._distance=t,this._curveBuilder=n};_s.prototype.addPoint=function(e){if(this._distance<=0)return null;var t=e.getCoordinates(),n=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(n,zt.EXTERIOR,zt.INTERIOR)};_s.prototype.addPolygon=function(e){var t=this,n=this._distance,i=re.LEFT;this._distance<0&&(n=-this._distance,i=re.RIGHT);var r=e.getExteriorRing(),u=yn.removeRepeatedPoints(r.getCoordinates());if(this._distance<0&&this.isErodedCompletely(r,this._distance)||this._distance<=0&&u.length<3)return null;this.addPolygonRing(u,n,i,zt.EXTERIOR,zt.INTERIOR);for(var p=0;p0&&t.isErodedCompletely(a,-t._distance)||t.addPolygonRing(_,n,re.opposite(i),zt.INTERIOR,zt.EXTERIOR)}};_s.prototype.isTriangleErodedCompletely=function(e,t){var n=new Rn(e[0],e[1],e[2]),i=n.inCentre(),r=ve.distancePointLine(i,n.p0,n.p1);return r=Ba.MINIMUM_VALID_SIZE&&ve.isCCW(e)&&(u=r,p=i,n=re.opposite(n));var a=this._curveBuilder.getRingCurve(e,n,t);this.addCurve(a,u,p)};_s.prototype.add=function(e){if(e.isEmpty())return null;e instanceof er?this.addPolygon(e):e instanceof Ti?this.addLineString(e):e instanceof Mo?this.addPoint(e):e instanceof Uh?this.addCollection(e):e instanceof zu?this.addCollection(e):e instanceof Oa?this.addCollection(e):e instanceof eo&&this.addCollection(e)};_s.prototype.isErodedCompletely=function(e,t){var n=e.getCoordinates();if(n.length<4)return t<0;if(n.length===4)return this.isTriangleErodedCompletely(n,t);var i=e.getEnvelopeInternal(),r=Math.min(i.getHeight(),i.getWidth());return t<0&&2*Math.abs(t)>r};_s.prototype.addCollection=function(e){for(var t=this,n=0;n=this._max)throw new lp;var e=this._parent.getGeometryN(this._index++);return e instanceof eo?(this._subcollectionIterator=new za(e),this._subcollectionIterator.next()):e};za.prototype.remove=function(){throw new Error(this.getClass().getName())};za.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)};za.prototype.interfaces_=function(){return[ap]};za.prototype.getClass=function(){return za};za.isAtomic=function(e){return!(e instanceof eo)};var Zo=function(){this._geom=null;var e=arguments[0];this._geom=e};Zo.prototype.locate=function(e){return Zo.locate(e,this._geom)};Zo.prototype.interfaces_=function(){return[Zh]};Zo.prototype.getClass=function(){return Zo};Zo.isPointInRing=function(e,t){return t.getEnvelopeInternal().intersects(e)?ve.isPointInRing(e,t.getCoordinates()):!1};Zo.containsPointInPolygon=function(e,t){if(t.isEmpty())return!1;var n=t.getExteriorRing();if(!Zo.isPointInRing(e,n))return!1;for(var i=0;i0&&u[u.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!u||x[1]>u[0]&&x[1]t?1:e0){if(t.right===null)break;if(n(e,t.right.key)>0){var a=t.right;if(t.right=a.left,a.left=t,t=a,t.right===null)break}r.right=t,r=t,t=t.right}else break}return r.right=t.left,u.left=t.right,t.left=i.right,t.right=i.left,t}function W_(e,t,n,i){var r=new Ou(e,t);if(n===null)return r.left=r.right=null,r;n=Lu(e,n,i);var u=i(e,n.key);return u<0?(r.left=n.left,r.right=n,n.left=null):u>=0&&(r.right=n.right,r.left=n,n.right=null),r}function n1(e,t,n){var i=null,r=null;if(t){t=Lu(e,t,n);var u=n(t.key,e);u===0?(i=t.left,r=t.right):u<0?(r=t.right,t.right=null,i=t):(i=t.left,t.left=null,r=t)}return{left:i,right:r}}function XI(e,t,n){return t===null?e:(e===null||(t=Lu(e.key,t,n),t.left=e),t)}function ly(e,t,n,i,r){if(e){i(""+t+(n?"└── ":"├── ")+r(e)+` +`);var u=t+(n?" ":"│ ");e.left&&ly(e.left,u,!1,i,r),e.right&&ly(e.right,u,!0,i,r)}}var Py=function(){function e(t){t===void 0&&(t=WI),this._root=null,this._size=0,this._comparator=t}return e.prototype.insert=function(t,n){return this._size++,this._root=W_(t,n,this._root,this._comparator)},e.prototype.add=function(t,n){var i=new Ou(t,n);this._root===null&&(i.left=i.right=null,this._size++,this._root=i);var r=this._comparator,u=Lu(t,this._root,r),p=r(t,u.key);return p===0?this._root=u:(p<0?(i.left=u.left,i.right=u,u.left=null):p>0&&(i.right=u.right,i.left=u,u.right=null),this._size++,this._root=i),this._root},e.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},e.prototype._remove=function(t,n,i){var r;if(n===null)return null;n=Lu(t,n,i);var u=i(t,n.key);return u===0?(n.left===null?r=n.right:(r=Lu(t,n.left,i),r.right=n.right),this._size--,r):n},e.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=Lu(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},e.prototype.findStatic=function(t){for(var n=this._root,i=this._comparator;n;){var r=i(t,n.key);if(r===0)return n;r<0?n=n.left:n=n.right}return null},e.prototype.find=function(t){return this._root&&(this._root=Lu(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},e.prototype.contains=function(t){for(var n=this._root,i=this._comparator;n;){var r=i(t,n.key);if(r===0)return!0;r<0?n=n.left:n=n.right}return!1},e.prototype.forEach=function(t,n){for(var i=this._root,r=[],u=!1;!u;)i!==null?(r.push(i),i=i.left):r.length!==0?(i=r.pop(),t.call(n,i),i=i.right):u=!0;return this},e.prototype.range=function(t,n,i,r){for(var u=[],p=this._comparator,a=this._root,_;u.length!==0||a;)if(a)u.push(a),a=a.left;else{if(a=u.pop(),_=p(a.key,n),_>0)break;if(p(a.key,t)>=0&&i.call(r,a))return this;a=a.right}return this},e.prototype.keys=function(){var t=[];return this.forEach(function(n){var i=n.key;return t.push(i)}),t},e.prototype.values=function(){var t=[];return this.forEach(function(n){var i=n.data;return t.push(i)}),t},e.prototype.min=function(){return this._root?this.minNode(this._root).key:null},e.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},e.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},e.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},e.prototype.at=function(t){for(var n=this._root,i=!1,r=0,u=[];!i;)if(n)u.push(n),n=n.left;else if(u.length>0){if(n=u.pop(),r===t)return n;r++,n=n.right}else i=!0;return null},e.prototype.next=function(t){var n=this._root,i=null;if(t.right){for(i=t.right;i.left;)i=i.left;return i}for(var r=this._comparator;n;){var u=r(t.key,n.key);if(u===0)break;u<0?(i=n,n=n.left):n=n.right}return i},e.prototype.prev=function(t){var n=this._root,i=null;if(t.left!==null){for(i=t.left;i.right;)i=i.right;return i}for(var r=this._comparator;n;){var u=r(t.key,n.key);if(u===0)break;u<0?n=n.left:(i=n,n=n.right)}return i},e.prototype.clear=function(){return this._root=null,this._size=0,this},e.prototype.toList=function(){return YI(this._root)},e.prototype.load=function(t,n,i){n===void 0&&(n=[]),i===void 0&&(i=!1);var r=t.length,u=this._comparator;if(i&&hy(t,n,0,r-1,u),this._root===null)this._root=uy(t,n,0,r),this._size=r;else{var p=KI(this.toList(),HI(t,n),u);r=this._size+r,this._root=cy({head:p},0,r)}return this},e.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),e.prototype.toString=function(t){t===void 0&&(t=function(i){return String(i.key)});var n=[];return ly(this._root,"",!0,function(i){return n.push(i)},t),n.join("")},e.prototype.update=function(t,n,i){var r=this._comparator,u=n1(t,this._root,r),p=u.left,a=u.right;r(t,n)<0?a=W_(n,i,a,r):p=W_(n,i,p,r),this._root=XI(p,a,r)},e.prototype.split=function(t){return n1(t,this._root,this._comparator)},e.prototype[Symbol.iterator]=function(){var t,n,i;return ZI(this,function(r){switch(r.label){case 0:t=this._root,n=[],i=!1,r.label=1;case 1:return i?[3,6]:t===null?[3,2]:(n.push(t),t=t.left,[3,5]);case 2:return n.length===0?[3,4]:(t=n.pop(),[4,t]);case 3:return r.sent(),t=t.right,[3,5];case 4:i=!0,r.label=5;case 5:return[3,1];case 6:return[2]}})},e}();function uy(e,t,n,i){var r=i-n;if(r>0){var u=n+Math.floor(r/2),p=e[u],a=t[u],_=new Ou(p,a);return _.left=uy(e,t,n,u),_.right=uy(e,t,u+1,i),_}return null}function HI(e,t){for(var n=new Ou(null,null),i=n,r=0;r0?(t=u=u.next=n.pop(),t=t.right):i=!0;return u.next=null,r.next}function cy(e,t,n){var i=n-t;if(i>0){var r=t+Math.floor(i/2),u=cy(e,t,r),p=e.head;return p.left=u,e.head=e.head.next,p.right=cy(e,r+1,n),p}return null}function KI(e,t,n){for(var i=new Ou(null,null),r=i,u=e,p=t;u!==null&&p!==null;)n(u.key,p.key)<0?(r.next=u,u=u.next):(r.next=p,p=p.next),r=r.next;return u!==null?r.next=u:p!==null&&(r.next=p),i.next}function hy(e,t,n,i,r){if(!(n>=i)){for(var u=e[n+i>>1],p=n-1,a=i+1;;){do p++;while(r(e[p],u)<0);do a--;while(r(e[a],u)>0);if(p>=a)break;var _=e[p];e[p]=e[a],e[a]=_,_=t[p],t[p]=t[a],t[a]=_}hy(e,t,n,a,r),hy(e,t,a+1,i,r)}}function va(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i1(e,t){for(var n=0;nn.x?1:t.yn.y?1:0}}]);function e(t,n){va(this,e),t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=n}return Xo(e,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var n=t.point.events,i=0,r=n.length;i=0&&L>=0?xA?-1:0:_<0&&L<0?xA?1:0:L<_?-1:L>_?1:0}}}]),e}(),nC=0,$m=function(){Xo(e,null,[{key:"compare",value:function(t,n){var i=t.leftSE.point.x,r=n.leftSE.point.x,u=t.rightSE.point.x,p=n.rightSE.point.x;if(pa&&_>x)return-1;var L=t.comparePoint(n.leftSE.point);if(L<0)return 1;if(L>0)return-1;var A=n.comparePoint(t.rightSE.point);return A!==0?A:-1}if(i>r){if(a<_&&a_&&a>S)return 1;var N=n.comparePoint(t.leftSE.point);if(N!==0)return N;var O=t.comparePoint(n.rightSE.point);return O<0?1:O>0?-1:1}if(a<_)return-1;if(a>_)return 1;if(up){var G=t.comparePoint(n.rightSE.point);if(G<0)return 1;if(G>0)return-1}if(u!==p){var K=x-a,V=u-i,H=S-_,Q=p-r;if(K>V&&HQ)return-1}return u>p?1:uS?1:t.idn.id?1:0}}]);function e(t,n,i,r){va(this,e),this.id=++nC,this.leftSE=t,t.segment=this,t.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=t,this.rings=i,this.windings=r}return Xo(e,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:tn?t:n}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var n=this.leftSE.point,i=this.rightSE.point,r=this.vector();if(n.x===i.x)return t.x===n.x?0:t.x0&&a.swapEvents(),ll.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),i&&(r.checkForConsuming(),u.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,i=this.windings.length;n0){var u=n;n=i,i=u}if(n.prev===i){var p=n;n=i,i=p}for(var a=0,_=i.rings.length;a<_;a++){var x=i.rings[a],S=i.windings[a],L=n.rings.indexOf(x);L===-1?(n.rings.push(x),n.windings.push(S)):n.windings[L]+=S}i.rings=null,i.windings=null,i.consumedBy=n,i.leftSE.consumedBy=n.leftSE,i.rightSE.consumedBy=n.rightSE}}},{key:"prevInResult",value:function(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var n=this._afterState.rings,i=this._afterState.windings,r=this._afterState.multiPolys,u=0,p=this.rings.length;u0)r=n,u=t,p=-1;else throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));var _=new ll(r,!0),x=new ll(u,!1);return new e(_,x,[i],[p])}}]),e}(),l1=function(){function e(t,n,i){if(va(this,e),!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=i,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var r=Zf.round(t[0][0],t[0][1]);this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};for(var u=r,p=1,a=t.length;pthis.bbox.ur.x&&(this.bbox.ur.x=_.x),_.y>this.bbox.ur.y&&(this.bbox.ur.y=_.y),u=_)}(r.x!==u.x||r.y!==u.y)&&this.segments.push($m.fromRing(u,r,this))}return Xo(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,i=this.segments.length;nthis.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=n}return Xo(e,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),n=0,i=this.interiorRings.length;nthis.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=n}return Xo(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,i=this.polys.length;n0&&(t=r)}for(var u=t.segment.prevInResult(),p=u?u.prevInResult():null;;){if(!u)return null;if(!p)return u.ringOut;if(p.ringOut!==u.ringOut)return p.ringOut.enclosingRing()!==u.ringOut?u.ringOut:u.ringOut.enclosingRing();u=p.prevInResult(),p=u?u.prevInResult():null}}}]),e}(),c1=function(){function e(t){va(this,e),this.exteriorRing=t,t.poly=this,this.interiorRings=[]}return Xo(e,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(var n=0,i=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:$m.compare;va(this,e),this.queue=t,this.tree=new Py(n),this.segments=[]}return Xo(e,[{key:"process",value:function(t){var n=t.segment,i=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(n),i;var r=t.isLeft?this.tree.insert(n):this.tree.find(n);if(!r)throw new Error("Unable to find segment #".concat(n.id," ")+"[".concat(n.leftSE.point.x,", ").concat(n.leftSE.point.y,"] -> ")+"[".concat(n.rightSE.point.x,", ").concat(n.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var u=r,p=r,a=void 0,_=void 0;a===void 0;)u=this.tree.prev(u),u===null?a=null:u.key.consumedBy===void 0&&(a=u.key);for(;_===void 0;)p=this.tree.next(p),p===null?_=null:p.key.consumedBy===void 0&&(_=p.key);if(t.isLeft){var x=null;if(a){var S=a.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(x=S),!a.isAnEndpoint(S)))for(var L=this._splitSafely(a,S),A=0,N=L.length;A0?(this.tree.remove(n),i.push(t)):(this.segments.push(n),n.prev=a)}else{if(a&&_){var dt=a.getIntersection(_);if(dt!==null){if(!a.isAnEndpoint(dt))for(var ut=this._splitSafely(a,dt),Mt=0,xt=ut.length;Mth1)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var Q=new sC(O),it=O.size,ht=O.pop();ht;){var ft=ht.key;if(O.size===it){var dt=ft.segment;throw new Error("Unable to pop() ".concat(ft.isLeft?"left":"right"," SweepEvent ")+"[".concat(ft.point.x,", ").concat(ft.point.y,"] from segment #").concat(dt.id," ")+"[".concat(dt.leftSE.point.x,", ").concat(dt.leftSE.point.y,"] -> ")+"[".concat(dt.rightSE.point.x,", ").concat(dt.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(O.size>h1)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(Q.segments.length>aC)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var ut=Q.process(ft),Mt=0,xt=ut.length;Mt1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;in[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]t.x?1:this.yt.y?1:0};Dt.prototype.clone=function(){};Dt.prototype.copy=function(){return new Dt(this)};Dt.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};Dt.prototype.distance3D=function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return Math.sqrt(t*t+n*n+i*i)};Dt.prototype.distance=function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)};Dt.prototype.hashCode=function(){var e=17;return e=37*e+Dt.hashCode(this.x),e=37*e+Dt.hashCode(this.y),e};Dt.prototype.setCoordinate=function(e){this.x=e.x,this.y=e.y,this.z=e.z};Dt.prototype.interfaces_=function(){return[vs,vg,bs]};Dt.prototype.getClass=function(){return Dt};Dt.hashCode=function(){if(arguments.length===1){var e=arguments[0],t=$e.doubleToLongBits(e);return Math.trunc((t^t)>>>32)}};Nc.DimensionalComparator.get=function(){return ql};Nc.serialVersionUID.get=function(){return 6683108902428367e3};Nc.NULL_ORDINATE.get=function(){return $e.NaN};Nc.X.get=function(){return 0};Nc.Y.get=function(){return 1};Nc.Z.get=function(){return 2};Object.defineProperties(Dt,Nc);var ql=function(e){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var t=arguments[0];if(t!==2&&t!==3)throw new fi("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}};ql.prototype.compare=function(e,t){var n=e,i=t,r=ql.compare(n.x,i.x);if(r!==0)return r;var u=ql.compare(n.y,i.y);if(u!==0)return u;if(this._dimensionsToTest<=2)return 0;var p=ql.compare(n.z,i.z);return p};ql.prototype.interfaces_=function(){return[Dh]};ql.prototype.getClass=function(){return ql};ql.compare=function(e,t){return et?1:$e.isNaN(e)?$e.isNaN(t)?0:-1:$e.isNaN(t)?1:0};var Rh=function(){};Rh.prototype.create=function(){};Rh.prototype.interfaces_=function(){return[]};Rh.prototype.getClass=function(){return Rh};var zt=function(){},fd={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};zt.prototype.interfaces_=function(){return[]};zt.prototype.getClass=function(){return zt};zt.toLocationSymbol=function(e){switch(e){case zt.EXTERIOR:return"e";case zt.BOUNDARY:return"b";case zt.INTERIOR:return"i";case zt.NONE:return"-"}throw new fi("Unknown location value: "+e)};fd.INTERIOR.get=function(){return 0};fd.BOUNDARY.get=function(){return 1};fd.EXTERIOR.get=function(){return 2};fd.NONE.get=function(){return-1};Object.defineProperties(zt,fd);var Ze=function(e,t){return e.interfaces_&&e.interfaces_().indexOf(t)>-1},Ho=function(){},vx={LOG_10:{configurable:!0}};Ho.prototype.interfaces_=function(){return[]};Ho.prototype.getClass=function(){return Ho};Ho.log10=function(e){var t=Math.log(e);return $e.isInfinite(t)||$e.isNaN(t)?t:t/Ho.LOG_10};Ho.min=function(e,t,n,i){var r=e;return tn?n:e}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],r=arguments[1],u=arguments[2];return iu?u:i}};Ho.wrap=function(e,t){return e<0?t- -e%t:e%t};Ho.max=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2],i=e;return t>i&&(i=t),n>i&&(i=n),i}else if(arguments.length===4){var r=arguments[0],u=arguments[1],p=arguments[2],a=arguments[3],_=r;return u>_&&(_=u),p>_&&(_=p),a>_&&(_=a),_}};Ho.average=function(e,t){return(e+t)/2};vx.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Ho,vx);var ba=function(e){this.str=e};ba.prototype.append=function(e){this.str+=e};ba.prototype.setCharAt=function(e,t){this.str=this.str.substr(0,e)+t+this.str.substr(e+1)};ba.prototype.toString=function(e){return this.str};var la=function(e){this.value=e};la.prototype.intValue=function(){return this.value};la.prototype.compareTo=function(e){return this.valuee?1:0};la.isNaN=function(e){return Number.isNaN(e)};var Wf=function(){};Wf.isWhitespace=function(e){return e<=32&&e>=0||e===127};Wf.toUpperCase=function(e){return e.toUpperCase()};var Ut=function e(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof e){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var i=arguments[0];e.call(this,e.parse(i))}}else if(arguments.length===2){var r=arguments[0],u=arguments[1];this.init(r,u)}},Vs={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};Ut.prototype.le=function(e){return(this._hi9?(S=!0,L="9"):L="0"+x,p.append(L),n=n.subtract(Ut.valueOf(x)).multiply(Ut.TEN),S&&n.selfAdd(Ut.TEN);var A=!0,N=Ut.magnitude(n._hi);if(N<0&&Math.abs(N)>=a-_&&(A=!1),!A)break}return t[0]=i,p.toString()};Ut.prototype.sqr=function(){return this.multiply(this)};Ut.prototype.doubleValue=function(){return this._hi+this._lo};Ut.prototype.subtract=function(){if(arguments[0]instanceof Ut){var e=arguments[0];return this.add(e.negate())}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.add(-t)}};Ut.prototype.equals=function(){if(arguments.length===1){var e=arguments[0];return this._hi===e._hi&&this._lo===e._lo}};Ut.prototype.isZero=function(){return this._hi===0&&this._lo===0};Ut.prototype.selfSubtract=function(){if(arguments[0]instanceof Ut){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e._hi,-e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t,0)}};Ut.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};Ut.prototype.min=function(e){return this.le(e)?this:e};Ut.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof Ut){var e=arguments[0];return this.selfDivide(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfDivide(t,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],r=null,u=null,p=null,a=null,_=null,x=null,S=null,L=null;return _=this._hi/n,x=Ut.SPLIT*_,r=x-_,L=Ut.SPLIT*n,r=x-r,u=_-r,p=L-n,S=_*n,p=L-p,a=n-p,L=r*p-S+r*a+u*p+u*a,x=(this._hi-S-L+this._lo-_*i)/n,L=_+x,this._hi=L,this._lo=_-L+x,this}};Ut.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};Ut.prototype.divide=function(){if(arguments[0]instanceof Ut){var e=arguments[0],t=null,n=null,i=null,r=null,u=null,p=null,a=null,_=null;u=this._hi/e._hi,p=Ut.SPLIT*u,t=p-u,_=Ut.SPLIT*e._hi,t=p-t,n=u-t,i=_-e._hi,a=u*e._hi,i=_-i,r=e._hi-i,_=t*i-a+t*r+n*i+n*r,p=(this._hi-a-_+this._lo-u*e._lo)/e._hi,_=u+p;var x=_,S=u-_+p;return new Ut(x,S)}else if(typeof arguments[0]=="number"){var L=arguments[0];return $e.isNaN(L)?Ut.createNaN():Ut.copy(this).selfDivide(L,0)}};Ut.prototype.ge=function(e){return(this._hi>e._hi||this._hi===e._hi)&&this._lo>=e._lo};Ut.prototype.pow=function(e){if(e===0)return Ut.valueOf(1);var t=new Ut(this),n=Ut.valueOf(1),i=Math.abs(e);if(i>1)for(;i>0;)i%2===1&&n.selfMultiply(t),i/=2,i>0&&(t=t.sqr());else n=t;return e<0?n.reciprocal():n};Ut.prototype.ceil=function(){if(this.isNaN())return Ut.NaN;var e=Math.ceil(this._hi),t=0;return e===this._hi&&(t=Math.ceil(this._lo)),new Ut(e,t)};Ut.prototype.compareTo=function(e){var t=e;return this._hit._hi?1:this._lot._lo?1:0};Ut.prototype.rint=function(){if(this.isNaN())return this;var e=this.add(.5);return e.floor()};Ut.prototype.setValue=function(){if(arguments[0]instanceof Ut){var e=arguments[0];return this.init(e),this}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.init(t),this}};Ut.prototype.max=function(e){return this.ge(e)?this:e};Ut.prototype.sqrt=function(){if(this.isZero())return Ut.valueOf(0);if(this.isNegative())return Ut.NaN;var e=1/Math.sqrt(this._hi),t=this._hi*e,n=Ut.valueOf(t),i=this.subtract(n.sqr()),r=i._hi*(e*.5);return n.add(r)};Ut.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof Ut){var e=arguments[0];return this.selfAdd(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0],n=null,i=null,r=null,u=null,p=null,a=null;return r=this._hi+t,p=r-this._hi,u=r-p,u=t-p+(this._hi-u),a=u+this._lo,n=r+a,i=a+(r-n),this._hi=n+i,this._lo=i+(n-this._hi),this}}else if(arguments.length===2){var _=arguments[0],x=arguments[1],S=null,L=null,A=null,N=null,O=null,Z=null,G=null,K=null;O=this._hi+_,A=this._lo+x,G=O-this._hi,K=A-this._lo,Z=O-G,N=A-K,Z=_-G+(this._hi-Z),N=x-K+(this._lo-N),G=Z+A,S=O+G,L=G+(O-S),G=N+L;var V=S+G,H=G+(S-V);return this._hi=V,this._lo=H,this}};Ut.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof Ut){var e=arguments[0];return this.selfMultiply(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfMultiply(t,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],r=null,u=null,p=null,a=null,_=null,x=null;_=Ut.SPLIT*this._hi,r=_-this._hi,x=Ut.SPLIT*n,r=_-r,u=this._hi-r,p=x-n,_=this._hi*n,p=x-p,a=n-p,x=r*p-_+r*a+u*p+u*a+(this._hi*i+this._lo*n);var S=_+x;r=_-S;var L=x+r;return this._hi=S,this._lo=L,this}};Ut.prototype.selfSqr=function(){return this.selfMultiply(this)};Ut.prototype.floor=function(){if(this.isNaN())return Ut.NaN;var e=Math.floor(this._hi),t=0;return e===this._hi&&(t=Math.floor(this._lo)),new Ut(e,t)};Ut.prototype.negate=function(){return this.isNaN()?this:new Ut(-this._hi,-this._lo)};Ut.prototype.clone=function(){};Ut.prototype.multiply=function(){if(arguments[0]instanceof Ut){var e=arguments[0];return e.isNaN()?Ut.createNaN():Ut.copy(this).selfMultiply(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return $e.isNaN(t)?Ut.createNaN():Ut.copy(this).selfMultiply(t,0)}};Ut.prototype.isNaN=function(){return $e.isNaN(this._hi)};Ut.prototype.intValue=function(){return Math.trunc(this._hi)};Ut.prototype.toString=function(){var e=Ut.magnitude(this._hi);return e>=-3&&e<=20?this.toStandardNotation():this.toSciNotation()};Ut.prototype.toStandardNotation=function(){var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!0,t),i=t[0]+1,r=n;if(n.charAt(0)===".")r="0"+n;else if(i<0)r="0."+Ut.stringOfChar("0",-i)+n;else if(n.indexOf(".")===-1){var u=i-n.length,p=Ut.stringOfChar("0",u);r=n+p+".0"}return this.isNegative()?"-"+r:r};Ut.prototype.reciprocal=function(){var e=null,t=null,n=null,i=null,r=null,u=null,p=null,a=null;r=1/this._hi,u=Ut.SPLIT*r,e=u-r,a=Ut.SPLIT*this._hi,e=u-e,t=r-e,n=a-this._hi,p=r*this._hi,n=a-n,i=this._hi-n,a=e*n-p+e*i+t*n+t*i,u=(1-p-a-r*this._lo)/this._hi;var _=r+u,x=r-_+u;return new Ut(_,x)};Ut.prototype.toSciNotation=function(){if(this.isZero())return Ut.SCI_NOT_ZERO;var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!1,t),i=Ut.SCI_NOT_EXPONENT_CHAR+t[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var r="";n.length>1&&(r=n.substring(1));var u=n.charAt(0)+"."+r;return this.isNegative()?"-"+u+i:u+i};Ut.prototype.abs=function(){return this.isNaN()?Ut.NaN:this.isNegative()?this.negate():new Ut(this)};Ut.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};Ut.prototype.lt=function(e){return(this._hie._hi||this._hi===e._hi)&&this._lo>e._lo};Ut.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};Ut.prototype.trunc=function(){return this.isNaN()?Ut.NaN:this.isPositive()?this.floor():this.ceil()};Ut.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};Ut.prototype.interfaces_=function(){return[bs,vs,vg]};Ut.prototype.getClass=function(){return Ut};Ut.sqr=function(e){return Ut.valueOf(e).selfMultiply(e)};Ut.valueOf=function(){if(typeof arguments[0]=="string"){var e=arguments[0];return Ut.parse(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return new Ut(t)}};Ut.sqrt=function(e){return Ut.valueOf(e).sqrt()};Ut.parse=function(e){for(var t=0,n=e.length;Wf.isWhitespace(e.charAt(t));)t++;var i=!1;if(t=n);){var x=e.charAt(t);if(t++,Wf.isDigit(x)){var S=x-"0";u.selfMultiply(Ut.TEN),u.selfAdd(S),p++;continue}if(x==="."){a=p;continue}if(x==="e"||x==="E"){var L=e.substring(t);try{_=la.parseInt(L)}catch(G){throw G instanceof Error?new Error("Invalid exponent "+L+" in string "+e):G}finally{}break}throw new Error("Unexpected character '"+x+"' at position "+t+" in string "+e)}var A=u,N=p-a-_;if(N===0)A=u;else if(N>0){var O=Ut.TEN.pow(N);A=u.divide(O)}else if(N<0){var Z=Ut.TEN.pow(-N);A=u.multiply(Z)}return i?A.negate():A};Ut.createNaN=function(){return new Ut($e.NaN,$e.NaN)};Ut.copy=function(e){return new Ut(e)};Ut.magnitude=function(e){var t=Math.abs(e),n=Math.log(t)/Math.log(10),i=Math.trunc(Math.floor(n)),r=Math.pow(10,i);return r*10<=t&&(i+=1),i};Ut.stringOfChar=function(e,t){for(var n=new ba,i=0;i0){if(u<=0)return po.signum(p);i=r+u}else if(r<0){if(u>=0)return po.signum(p);i=-r-u}else return po.signum(p);var a=po.DP_SAFE_EPSILON*i;return p>=a||-p>=a?po.signum(p):2};po.signum=function(e){return e>0?1:e<0?-1:0};bx.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(po,bx);var Ln=function(){},dd={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};dd.X.get=function(){return 0};dd.Y.get=function(){return 1};dd.Z.get=function(){return 2};dd.M.get=function(){return 3};Ln.prototype.setOrdinate=function(e,t,n){};Ln.prototype.size=function(){};Ln.prototype.getOrdinate=function(e,t){};Ln.prototype.getCoordinate=function(){};Ln.prototype.getCoordinateCopy=function(e){};Ln.prototype.getDimension=function(){};Ln.prototype.getX=function(e){};Ln.prototype.clone=function(){};Ln.prototype.expandEnvelope=function(e){};Ln.prototype.copy=function(){};Ln.prototype.getY=function(e){};Ln.prototype.toCoordinateArray=function(){};Ln.prototype.interfaces_=function(){return[vg]};Ln.prototype.getClass=function(){return Ln};Object.defineProperties(Ln,dd);var xx=function(){},sp=function(e){function t(){e.call(this,"Projective point not representable on the Cartesian plane.")}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(xx),Cr=function(){};Cr.arraycopy=function(e,t,n,i,r){for(var u=0,p=t;pe._minx?this._minx:e._minx,n=this._miny>e._miny?this._miny:e._miny,i=this._maxx=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&i>=this._miny&&i<=this._maxy}};Re.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Re){var e=arguments[0];return this.isNull()||e.isNull()?!1:!(e._minx>this._maxx||e._maxxthis._maxy||e._maxythis._maxx||nthis._maxy||ithis._maxx&&(this._maxx=t._maxx),t._minythis._maxy&&(this._maxy=t._maxy))}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=i,this._maxy=i):(nthis._maxx&&(this._maxx=n),ithis._maxy&&(this._maxy=i))}};Re.prototype.minExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return et._minx?1:this._minyt._miny?1:this._maxxt._maxx?1:this._maxyt._maxy?1:0};Re.prototype.translate=function(e,t){if(this.isNull())return null;this.init(this.getMinX()+e,this.getMaxX()+e,this.getMinY()+t,this.getMaxY()+t)};Re.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Re.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Re.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Re.prototype.maxExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return e>t?e:t};Re.prototype.expandBy=function(){if(arguments.length===1){var e=arguments[0];this.expandBy(e,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};Re.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Re){var e=arguments[0];return this.covers(e)}else if(arguments[0]instanceof Dt){var t=arguments[0];return this.covers(t)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.covers(n,i)}};Re.prototype.centre=function(){return this.isNull()?null:new Dt((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Re.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof Dt){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof Re){var t=arguments[0];this._minx=t._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(arguments.length===4){var r=arguments[0],u=arguments[1],p=arguments[2],a=arguments[3];re._maxx&&(t=this._minx-e._maxx);var n=0;return this._maxye._maxy&&(n=this._miny-e._maxy),t===0?n:n===0?t:Math.sqrt(t*t+n*n)};Re.prototype.hashCode=function(){var e=17;return e=37*e+Dt.hashCode(this._minx),e=37*e+Dt.hashCode(this._maxx),e=37*e+Dt.hashCode(this._miny),e=37*e+Dt.hashCode(this._maxy),e};Re.prototype.interfaces_=function(){return[vs,bs]};Re.prototype.getClass=function(){return Re};Re.intersects=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2];return n.x>=(e.xt.x?e.x:t.x)&&n.y>=(e.yt.y?e.y:t.y)}else if(arguments.length===4){var i=arguments[0],r=arguments[1],u=arguments[2],p=arguments[3],a=Math.min(u.x,p.x),_=Math.max(u.x,p.x),x=Math.min(i.x,r.x),S=Math.max(i.x,r.x);return!(x>_||S_)||Sn?(this._intLineIndex[e][0]=0,this._intLineIndex[e][1]=1):(this._intLineIndex[e][0]=1,this._intLineIndex[e][1]=0)}};_i.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};_i.prototype.setPrecisionModel=function(e){this._precisionModel=e};_i.prototype.isInteriorIntersection=function(){var e=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var t=arguments[0],n=0;nr?u=i:u=r;else{var p=Math.abs(e.x-t.x),a=Math.abs(e.y-t.y);i>r?u=p:u=a,u===0&&!e.equals(t)&&(u=Math.max(p,a))}return un.isTrue(!(u===0&&!e.equals(t)),"Bad distance calculation"),u};_i.nonRobustComputeEdgeDistance=function(e,t,n){var i=e.x-t.x,r=e.y-t.y,u=Math.sqrt(i*i+r*r);return un.isTrue(!(u===0&&!e.equals(t)),"Invalid distance calculation"),u};Dc.DONT_INTERSECT.get=function(){return 0};Dc.DO_INTERSECT.get=function(){return 1};Dc.COLLINEAR.get=function(){return 2};Dc.NO_INTERSECTION.get=function(){return 0};Dc.POINT_INTERSECTION.get=function(){return 1};Dc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(_i,Dc);var Wu=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isInSegmentEnvelopes=function(n){var i=new Re(this._inputLines[0][0],this._inputLines[0][1]),r=new Re(this._inputLines[1][0],this._inputLines[1][1]);return i.contains(n)&&r.contains(n)},t.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],r=arguments[2];if(this._isProper=!1,Re.intersects(i,r,n)&&ve.orientationIndex(i,r,n)===0&&ve.orientationIndex(r,i,n)===0)return this._isProper=!0,(n.equals(i)||n.equals(r))&&(this._isProper=!1),this._result=e.POINT_INTERSECTION,null;this._result=e.NO_INTERSECTION}else return e.prototype.computeIntersection.apply(this,arguments)},t.prototype.normalizeToMinimum=function(n,i,r,u,p){p.x=this.smallestInAbsValue(n.x,i.x,r.x,u.x),p.y=this.smallestInAbsValue(n.y,i.y,r.y,u.y),n.x-=p.x,n.y-=p.y,i.x-=p.x,i.y-=p.y,r.x-=p.x,r.y-=p.y,u.x-=p.x,u.y-=p.y},t.prototype.safeHCoordinateIntersection=function(n,i,r,u){var p=null;try{p=Ps.intersection(n,i,r,u)}catch(a){if(a instanceof sp)p=t.nearestEndpoint(n,i,r,u);else throw a}finally{}return p},t.prototype.intersection=function(n,i,r,u){var p=this.intersectionWithNormalization(n,i,r,u);return this.isInSegmentEnvelopes(p)||(p=new Dt(t.nearestEndpoint(n,i,r,u))),this._precisionModel!==null&&this._precisionModel.makePrecise(p),p},t.prototype.smallestInAbsValue=function(n,i,r,u){var p=n,a=Math.abs(p);return Math.abs(i)1e-4&&Cr.out.println("Distance = "+p.distance(a))},t.prototype.intersectionWithNormalization=function(n,i,r,u){var p=new Dt(n),a=new Dt(i),_=new Dt(r),x=new Dt(u),S=new Dt;this.normalizeToEnvCentre(p,a,_,x,S);var L=this.safeHCoordinateIntersection(p,a,_,x);return L.x+=S.x,L.y+=S.y,L},t.prototype.computeCollinearIntersection=function(n,i,r,u){var p=Re.intersects(n,i,r),a=Re.intersects(n,i,u),_=Re.intersects(r,u,n),x=Re.intersects(r,u,i);return p&&a?(this._intPt[0]=r,this._intPt[1]=u,e.COLLINEAR_INTERSECTION):_&&x?(this._intPt[0]=n,this._intPt[1]=i,e.COLLINEAR_INTERSECTION):p&&_?(this._intPt[0]=r,this._intPt[1]=n,r.equals(n)&&!a&&!x?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):p&&x?(this._intPt[0]=r,this._intPt[1]=i,r.equals(i)&&!a&&!_?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):a&&_?(this._intPt[0]=u,this._intPt[1]=n,u.equals(n)&&!p&&!x?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):a&&x?(this._intPt[0]=u,this._intPt[1]=i,u.equals(i)&&!p&&!_?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):e.NO_INTERSECTION},t.prototype.normalizeToEnvCentre=function(n,i,r,u,p){var a=n.xi.x?n.x:i.x,S=n.y>i.y?n.y:i.y,L=r.xu.x?r.x:u.x,O=r.y>u.y?r.y:u.y,Z=a>L?a:L,G=xA?_:A,V=S0&&a>0||p<0&&a<0)return e.NO_INTERSECTION;var _=ve.orientationIndex(r,u,n),x=ve.orientationIndex(r,u,i);if(_>0&&x>0||_<0&&x<0)return e.NO_INTERSECTION;var S=p===0&&a===0&&_===0&&x===0;return S?this.computeCollinearIntersection(n,i,r,u):(p===0||a===0||_===0||x===0?(this._isProper=!1,n.equals2D(r)||n.equals2D(u)?this._intPt[0]=n:i.equals2D(r)||i.equals2D(u)?this._intPt[0]=i:p===0?this._intPt[0]=new Dt(r):a===0?this._intPt[0]=new Dt(u):_===0?this._intPt[0]=new Dt(n):x===0&&(this._intPt[0]=new Dt(i))):(this._isProper=!0,this._intPt[0]=this.intersection(n,i,r,u)),e.POINT_INTERSECTION)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.nearestEndpoint=function(n,i,r,u){var p=n,a=ve.distancePointLine(n,r,u),_=ve.distancePointLine(i,r,u);return _0?n>0?-r:r:n>0?r:-r;if(t===0||n===0)return i>0?e>0?r:-r:e>0?-r:r;if(t>0?i>0?t<=i||(r=-r,u=e,e=n,n=u,u=t,t=i,i=u):t<=-i?(r=-r,n=-n,i=-i):(u=e,e=-n,n=u,u=t,t=-i,i=u):i>0?-t<=i?(r=-r,e=-e,t=-t):(u=-e,e=n,n=u,u=-t,t=i,i=u):t>=i?(e=-e,t=-t,n=-n,i=-i):(r=-r,u=-e,e=-n,n=u,u=-t,t=-i,i=u),e>0)if(n>0){if(!(e<=n))return r}else return r;else{if(n>0)return-r;if(e>=n)r=-r,e=-e,n=-n;else return-r}for(;;){if(p=Math.floor(n/e),n=n-p*e,i=i-p*t,i<0)return-r;if(i>t)return r;if(e>n+n){if(ti+i)return-r;n=e-n,i=t-i,r=-r}if(i===0)return n===0?0:-r;if(n===0||(p=Math.floor(e/n),e=e-p*n,t=t-p*i,t<0))return r;if(t>i)return-r;if(n>e+e){if(it+t)return r;e=n-e,t=i-t,r=-r}if(t===0)return e===0?0:r;if(e===0)return-r}};var oa=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var e=arguments[0];this._p=e};oa.prototype.countSegment=function(e,t){if(e.xi&&(n=t.x,i=e.x),this._p.x>=n&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(e.y>this._p.y&&t.y<=this._p.y||t.y>this._p.y&&e.y<=this._p.y){var r=e.x-this._p.x,u=e.y-this._p.y,p=t.x-this._p.x,a=t.y-this._p.y,_=bc.signOfDet2x2(r,u,p,a);if(_===0)return this._isPointOnSegment=!0,null;a0&&this._crossingCount++}};oa.prototype.isPointInPolygon=function(){return this.getLocation()!==zt.EXTERIOR};oa.prototype.getLocation=function(){return this._isPointOnSegment?zt.BOUNDARY:this._crossingCount%2===1?zt.INTERIOR:zt.EXTERIOR};oa.prototype.isOnSegment=function(){return this._isPointOnSegment};oa.prototype.interfaces_=function(){return[]};oa.prototype.getClass=function(){return oa};oa.locatePointInRing=function(){if(arguments[0]instanceof Dt&&Ze(arguments[1],Ln)){for(var e=arguments[0],t=arguments[1],n=new oa(e),i=new Dt,r=new Dt,u=1;u1||_<0||_>1)&&(r=!0)}}return r?Ho.min(ve.distancePointLine(e,n,i),ve.distancePointLine(t,n,i),ve.distancePointLine(n,e,t),ve.distancePointLine(i,e,t)):0};ve.isPointInRing=function(e,t){return ve.locatePointInRing(e,t)!==zt.EXTERIOR};ve.computeLength=function(e){var t=e.size();if(t<=1)return 0;var n=0,i=new Dt;e.getCoordinate(0,i);for(var r=i.x,u=i.y,p=1;pn.y&&(n=u,i=r)}var p=i;do p=p-1,p<0&&(p=t);while(e[p].equals2D(n)&&p!==i);var a=i;do a=(a+1)%t;while(e[a].equals2D(n)&&a!==i);var _=e[p],x=e[a];if(_.equals2D(n)||x.equals2D(n)||_.equals2D(x))return!1;var S=ve.computeOrientation(_,n,x),L=!1;return S===0?L=_.x>x.x:L=S>0,L};ve.locatePointInRing=function(e,t){return oa.locatePointInRing(e,t)};ve.distancePointLinePerpendicular=function(e,t,n){var i=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y),r=((t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y))/i;return Math.abs(r)*Math.sqrt(i)};ve.computeOrientation=function(e,t,n){return ve.orientationIndex(e,t,n)};ve.distancePointLine=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];if(t.length===0)throw new fi("Line array must contain at least one vertex");for(var n=e.distance(t[0]),i=0;i=1)return u.distance(a);var S=((p.y-u.y)*(a.x-p.x)-(p.x-u.x)*(a.y-p.y))/_;return Math.abs(S)*Math.sqrt(_)}};ve.isOnLine=function(e,t){for(var n=new Wu,i=1;i0};zh.prototype.interfaces_=function(){return[gs]};zh.prototype.getClass=function(){return zh};var Fh=function(){};Fh.prototype.isInBoundary=function(e){return e>1};Fh.prototype.interfaces_=function(){return[gs]};Fh.prototype.getClass=function(){return Fh};var Bh=function(){};Bh.prototype.isInBoundary=function(e){return e===1};Bh.prototype.interfaces_=function(){return[gs]};Bh.prototype.getClass=function(){return Bh};var Hi=function(){};Hi.prototype.add=function(){};Hi.prototype.addAll=function(){};Hi.prototype.isEmpty=function(){};Hi.prototype.iterator=function(){};Hi.prototype.size=function(){};Hi.prototype.toArray=function(){};Hi.prototype.remove=function(){};function ky(e){this.message=e||""}ky.prototype=new Error;ky.prototype.name="IndexOutOfBoundsException";var ap=function(){};ap.prototype.hasNext=function(){};ap.prototype.next=function(){};ap.prototype.remove=function(){};var As=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(){},t.prototype.set=function(){},t.prototype.isEmpty=function(){},t}(Hi);function lp(e){this.message=e||""}lp.prototype=new Error;lp.prototype.name="NoSuchElementException";var ce=function(e){function t(){e.call(this),this.array_=[],arguments[0]instanceof Hi&&this.addAll(arguments[0])}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.ensureCapacity=function(){},t.prototype.interfaces_=function(){return[e,Hi]},t.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},t.prototype.clear=function(){this.array_=[]},t.prototype.addAll=function(n){for(var i=this,r=n.iterator();r.hasNext();)i.add(r.next());return!0},t.prototype.set=function(n,i){var r=this.array_[n];return this.array_[n]=i,r},t.prototype.iterator=function(){return new yC(this)},t.prototype.get=function(n){if(n<0||n>=this.size())throw new ky;return this.array_[n]},t.prototype.isEmpty=function(){return this.array_.length===0},t.prototype.size=function(){return this.array_.length},t.prototype.toArray=function(){for(var n=this,i=[],r=0,u=this.array_.length;r=1){var x=this.get(this.size()-1);if(x.equals2D(a))return null}e.prototype.add.call(this,a)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],L=arguments[1];return this.add(S,L),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var A=arguments[0],N=arguments[1],O=arguments[2];if(O)for(var Z=0;Z=0;G--)i.add(A[G],N);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof Dt){var K=arguments[0],V=arguments[1],H=arguments[2];if(!H){var Q=this.size();if(Q>0){if(K>0){var it=this.get(K-1);if(it.equals2D(V))return null}if(KMt&&(xt=-1);for(var yt=ut;yt!==Mt;yt+=xt)i.add(ft[yt],dt);return!0}},t.prototype.closeRing=function(){this.size()>0&&this.add(new Dt(this.get(0)),!1)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},Object.defineProperties(t,n),t}(ce),_n=function(){},xg={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};xg.ForwardComparator.get=function(){return Xf};xg.BidirectionalComparator.get=function(){return Vh};xg.coordArrayType.get=function(){return new Array(0).fill(null)};_n.prototype.interfaces_=function(){return[]};_n.prototype.getClass=function(){return _n};_n.isRing=function(e){return!(e.length<4||!e[0].equals2D(e[e.length-1]))};_n.ptNotInList=function(e,t){for(var n=0;n=e?t:[]};_n.indexOf=function(e,t){for(var n=0;n0)&&(t=e[n]);return t};_n.extract=function(e,t,n){t=Ho.clamp(t,0,e.length),n=Ho.clamp(n,-1,e.length);var i=n-t+1;n<0&&(i=0),t>=e.length&&(i=0),ni.length)return 1;if(n.length===0)return 0;var r=_n.compare(n,i),u=_n.isEqualReversed(n,i);return u?0:r};Vh.prototype.OLDcompare=function(e,t){var n=e,i=t;if(n.lengthi.length)return 1;if(n.length===0)return 0;for(var r=_n.increasingDirection(n),u=_n.increasingDirection(i),p=r>0?0:n.length-1,a=u>0?0:n.length-1,_=0;_0)t=t.right;else return t.value}return null};Vr.prototype.put=function(e,t){if(this.root_===null)return this.root_={key:e,value:t,left:null,right:null,parent:null,color:ul,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,i,r;do if(i=n,r=e.compareTo(n.key),r<0)n=n.left;else if(r>0)n=n.right;else{var u=n.value;return n.value=t,u}while(n!==null);var p={key:e,left:null,right:null,value:t,parent:i,color:ul,getValue:function(){return this.value},getKey:function(){return this.key}};return r<0?i.left=p:i.right=p,this.fixAfterInsertion(p),this.size_++,null};Vr.prototype.fixAfterInsertion=function(e){var t=this;for(e.color=Cu;e!=null&&e!==this.root_&&e.parent.color===Cu;)if($n(e)===X_($n($n(e)))){var n=m1($n($n(e)));d1(n)===Cu?(rl($n(e),ul),rl(n,ul),rl($n($n(e)),Cu),e=$n($n(e))):(e===m1($n(e))&&(e=$n(e),t.rotateLeft(e)),rl($n(e),ul),rl($n($n(e)),Cu),t.rotateRight($n($n(e))))}else{var i=X_($n($n(e)));d1(i)===Cu?(rl($n(e),ul),rl(i,ul),rl($n($n(e)),Cu),e=$n($n(e))):(e===X_($n(e))&&(e=$n(e),t.rotateRight(e)),rl($n(e),ul),rl($n($n(e)),Cu),t.rotateLeft($n($n(e))))}this.root_.color=ul};Vr.prototype.values=function(){var e=new ce,t=this.getFirstEntry();if(t!==null)for(e.add(t.value);(t=Vr.successor(t))!==null;)e.add(t.value);return e};Vr.prototype.entrySet=function(){var e=new Ny,t=this.getFirstEntry();if(t!==null)for(e.add(t);(t=Vr.successor(t))!==null;)e.add(t);return e};Vr.prototype.rotateLeft=function(e){if(e!=null){var t=e.right;e.right=t.left,t.left!=null&&(t.left.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.left===e?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t}};Vr.prototype.rotateRight=function(e){if(e!=null){var t=e.left;e.left=t.right,t.right!=null&&(t.right.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.right===e?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t}};Vr.prototype.getFirstEntry=function(){var e=this.root_;if(e!=null)for(;e.left!=null;)e=e.left;return e};Vr.successor=function(e){if(e===null)return null;if(e.right!==null){for(var t=e.right;t.left!==null;)t=t.left;return t}else{for(var n=e.parent,i=e;n!==null&&i===n.right;)i=n,n=n.parent;return n}};Vr.prototype.size=function(){return this.size_};var Hf=function(){};Hf.prototype.interfaces_=function(){return[]};Hf.prototype.getClass=function(){return Hf};function Sx(){}Sx.prototype=new wg;function ua(){this.array_=[],arguments[0]instanceof Hi&&this.addAll(arguments[0])}ua.prototype=new Sx;ua.prototype.contains=function(e){for(var t=this,n=0,i=this.array_.length;n=0;){var p=r.substring(0,u);i.add(p),r=r.substring(u+n),u=r.indexOf(t)}r.length>0&&i.add(r);for(var a=new Array(i.size()).fill(null),_=0;_0)for(var u=r;u0&&i.append(" ");for(var u=0;u0&&i.append(","),i.append(ds.toString(e.getOrdinate(r,u)))}return i.append(")"),i.toString()}};Di.ensureValidRing=function(e,t){var n=t.size();if(n===0)return t;if(n<=3)return Di.createClosedRing(e,t,4);var i=t.getOrdinate(0,Ln.X)===t.getOrdinate(n-1,Ln.X)&&t.getOrdinate(0,Ln.Y)===t.getOrdinate(n-1,Ln.Y);return i?t:Di.createClosedRing(e,t,n+1)};Di.createClosedRing=function(e,t,n){var i=e.create(n,t.getDimension()),r=t.size();Di.copy(t,0,i,0,r);for(var u=r;u0&&Di.reverse(i._points),null}},t.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},t.prototype.getBoundaryDimension=function(){return this.isClosed()?kn.FALSE:0},t.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},t.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},t.prototype.getDimension=function(){return 1},t.prototype.getLength=function(){return ve.computeLength(this._points)},t.prototype.getNumPoints=function(){return this._points.size()},t.prototype.reverse=function(){var i=this._points.copy();Di.reverse(i);var r=this.getFactory().createLineString(i);return r},t.prototype.compareToSameClass=function(){var i=this;if(arguments.length===1){for(var r=arguments[0],u=r,p=0,a=0;p= 2)");this._points=i},t.prototype.isCoordinate=function(i){for(var r=this,u=0;u=1&&this.getCoordinateSequence().size()= 4)")},t.prototype.getGeometryType=function(){return"LinearRing"},t.prototype.copy=function(){return new t(this._points.copy(),this._factory)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(t,n),t}(Ti),Oa=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return qe.SORTINDEX_MULTIPOLYGON},t.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],r=arguments[1];return this.isEquivalentClass(i)?e.prototype.equalsExact.call(this,i,r):!1}else return e.prototype.equalsExact.apply(this,arguments)},t.prototype.getBoundaryDimension=function(){return 1},t.prototype.getDimension=function(){return 2},t.prototype.reverse=function(){for(var i=this,r=this._geometries.length,u=new Array(r).fill(null),p=0;p0?t.createPoint(n[0]):t.createPoint():e};Jf.prototype.interfaces_=function(){return[_s.GeometryEditorOperation]};Jf.prototype.getClass=function(){return Jf};var Qf=function(){};Qf.prototype.edit=function(e,t){return e instanceof Ba?t.createLinearRing(this.edit(e.getCoordinateSequence(),e)):e instanceof Ti?t.createLineString(this.edit(e.getCoordinateSequence(),e)):e instanceof Mo?t.createPoint(this.edit(e.getCoordinateSequence(),e)):e};Qf.prototype.interfaces_=function(){return[_s.GeometryEditorOperation]};Qf.prototype.getClass=function(){return Qf};var ki=function(){var e=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var n=0;n0){var t=new ba(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var n=1;n3&&(i=3),i<2?new ki(n):new ki(n,i)}};Va.prototype.interfaces_=function(){return[Rh,bs]};Va.prototype.getClass=function(){return Va};Va.instance=function(){return Va.instanceObject};Ry.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};Ry.instanceObject.get=function(){return new Va};Object.defineProperties(Va,Ry);var Ix=function(e){function t(){e.call(this),this.map_=new Map}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(n){return this.map_.get(n)||null},t.prototype.put=function(n,i){return this.map_.set(n,i),i},t.prototype.values=function(){for(var n=new ce,i=this.map_.values(),r=i.next();!r.done;)n.add(r.value),r=i.next();return n},t.prototype.entrySet=function(){var n=new Ny;return this.map_.entries().forEach(function(i){return n.add(i)}),n},t.prototype.size=function(){return this.map_.size()},t}(Oc),Dn=function e(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=e.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof ha){var t=arguments[0];this._modelType=t,t===e.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=e.FIXED,this.setScale(n)}else if(arguments[0]instanceof e){var i=arguments[0];this._modelType=i._modelType,this._scale=i._scale}}},Oy={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Dn.prototype.equals=function(e){if(!(e instanceof Dn))return!1;var t=e;return this._modelType===t._modelType&&this._scale===t._scale};Dn.prototype.compareTo=function(e){var t=e,n=this.getMaximumSignificantDigits(),i=t.getMaximumSignificantDigits();return new la(n).compareTo(new la(i))};Dn.prototype.getScale=function(){return this._scale};Dn.prototype.isFloating=function(){return this._modelType===Dn.FLOATING||this._modelType===Dn.FLOATING_SINGLE};Dn.prototype.getType=function(){return this._modelType};Dn.prototype.toString=function(){var e="UNKNOWN";return this._modelType===Dn.FLOATING?e="Floating":this._modelType===Dn.FLOATING_SINGLE?e="Floating-Single":this._modelType===Dn.FIXED&&(e="Fixed (Scale="+this.getScale()+")"),e};Dn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var e=arguments[0];if($e.isNaN(e))return e;if(this._modelType===Dn.FLOATING_SINGLE){var t=e;return t}return this._modelType===Dn.FIXED?Math.round(e*this._scale)/this._scale:e}else if(arguments[0]instanceof Dt){var n=arguments[0];if(this._modelType===Dn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Dn.prototype.getMaximumSignificantDigits=function(){var e=16;return this._modelType===Dn.FLOATING?e=16:this._modelType===Dn.FLOATING_SINGLE?e=6:this._modelType===Dn.FIXED&&(e=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),e};Dn.prototype.setScale=function(e){this._scale=Math.abs(e)};Dn.prototype.interfaces_=function(){return[bs,vs]};Dn.prototype.getClass=function(){return Dn};Dn.mostPrecise=function(e,t){return e.compareTo(t)>=0?e:t};Oy.serialVersionUID.get=function(){return 7777263578777804e3};Oy.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Dn,Oy);var ha=function e(t){this._name=t||null,e.nameToTypeMap.put(t,this)},zy={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ha.prototype.readResolve=function(){return ha.nameToTypeMap.get(this._name)};ha.prototype.toString=function(){return this._name};ha.prototype.interfaces_=function(){return[bs]};ha.prototype.getClass=function(){return ha};zy.serialVersionUID.get=function(){return-552860263173159e4};zy.nameToTypeMap.get=function(){return new Ix};Object.defineProperties(ha,zy);Dn.Type=ha;Dn.FIXED=new ha("FIXED");Dn.FLOATING=new ha("FLOATING");Dn.FLOATING_SINGLE=new ha("FLOATING SINGLE");var gn=function e(){this._precisionModel=new Dn,this._SRID=0,this._coordinateSequenceFactory=e.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Ze(arguments[0],Rh)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Dn&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},Cx={serialVersionUID:{configurable:!0}};gn.prototype.toGeometry=function(e){return e.isNull()?this.createPoint(null):e.getMinX()===e.getMaxX()&&e.getMinY()===e.getMaxY()?this.createPoint(new Dt(e.getMinX(),e.getMinY())):e.getMinX()===e.getMaxX()||e.getMinY()===e.getMaxY()?this.createLineString([new Dt(e.getMinX(),e.getMinY()),new Dt(e.getMaxX(),e.getMaxY())]):this.createPolygon(this.createLinearRing([new Dt(e.getMinX(),e.getMinY()),new Dt(e.getMinX(),e.getMaxY()),new Dt(e.getMaxX(),e.getMaxY()),new Dt(e.getMaxX(),e.getMinY()),new Dt(e.getMinX(),e.getMinY())]),null)};gn.prototype.createLineString=function(e){if(e){if(e instanceof Array)return new Ti(this.getCoordinateSequenceFactory().create(e),this);if(Ze(e,Ln))return new Ti(e,this)}else return new Ti(this.getCoordinateSequenceFactory().create([]),this)};gn.prototype.createMultiLineString=function(){if(arguments.length===0)return new zu(null,this);if(arguments.length===1){var e=arguments[0];return new zu(e,this)}};gn.prototype.buildGeometry=function(e){for(var t=null,n=!1,i=!1,r=e.iterator();r.hasNext();){var u=r.next(),p=u.getClass();t===null&&(t=p),p!==t&&(n=!0),u.isGeometryCollectionOrDerived()&&(i=!0)}if(t===null)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection(gn.toGeometryArray(e));var a=e.iterator().next(),_=e.size()>1;if(_){if(a instanceof $i)return this.createMultiPolygon(gn.toPolygonArray(e));if(a instanceof Ti)return this.createMultiLineString(gn.toLineStringArray(e));if(a instanceof Mo)return this.createMultiPoint(gn.toPointArray(e));un.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a};gn.prototype.createMultiPointFromCoords=function(e){return this.createMultiPoint(e!==null?this.getCoordinateSequenceFactory().create(e):null)};gn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Dt){var e=arguments[0];return this.createPoint(e!==null?this.getCoordinateSequenceFactory().create([e]):null)}else if(Ze(arguments[0],Ln)){var t=arguments[0];return new Mo(t,this)}}};gn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};gn.prototype.createPolygon=function(){if(arguments.length===0)return new $i(null,null,this);if(arguments.length===1){if(Ze(arguments[0],Ln)){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Array){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Ba){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var i=arguments[0],r=arguments[1];return new $i(i,r,this)}};gn.prototype.getSRID=function(){return this._SRID};gn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new to(null,this);if(arguments.length===1){var e=arguments[0];return new to(e,this)}};gn.prototype.createGeometry=function(e){var t=new _s(this);return t.edit(e,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};gn.prototype.getPrecisionModel=function(){return this._precisionModel};gn.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return this.createLinearRing(e!==null?this.getCoordinateSequenceFactory().create(e):null)}else if(Ze(arguments[0],Ln)){var t=arguments[0];return new Ba(t,this)}}};gn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Oa(null,this);if(arguments.length===1){var e=arguments[0];return new Oa(e,this)}};gn.prototype.createMultiPoint=function(){var e=this;if(arguments.length===0)return new Uh(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new Uh(t,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Ze(arguments[0],Ln)){var i=arguments[0];if(i===null)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(i.size()).fill(null),u=0;u=this.size())throw new Error;return this.array_[e]};xa.prototype.push=function(e){return this.array_.push(e),e};xa.prototype.pop=function(e){if(this.array_.length===0)throw new Tg;return this.array_.pop()};xa.prototype.peek=function(){if(this.array_.length===0)throw new Tg;return this.array_[this.array_.length-1]};xa.prototype.empty=function(){return this.array_.length===0};xa.prototype.isEmpty=function(){return this.empty()};xa.prototype.search=function(e){return this.array_.indexOf(e)};xa.prototype.size=function(){return this.array_.length};xa.prototype.toArray=function(){for(var e=this,t=[],n=0,i=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&i===ve.CLOCKWISE)&&(r=!0),r&&(this._minIndex=this._minIndex-1)};pa.prototype.getRightmostSideOfSegment=function(e,t){var n=e.getEdge(),i=n.getCoordinates();if(t<0||t+1>=i.length||i[t].y===i[t+1].y)return-1;var r=re.LEFT;return i[t].yt._minCoord.x)&&(t._minDe=e,t._minIndex=i,t._minCoord=n[i])};pa.prototype.findRightmostEdgeAtNode=function(){var e=this._minDe.getNode(),t=e.getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};pa.prototype.findEdge=function(e){for(var t=this,n=e.iterator();n.hasNext();){var i=n.next();i.isForward()&&t.checkForRightmostCoordinate(i)}un.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var r=this.getRightmostSide(this._minDe,this._minIndex);r===re.LEFT&&(this._orientedDe=this._minDe.getSym())};pa.prototype.interfaces_=function(){return[]};pa.prototype.getClass=function(){return pa};var ml=function(e){function t(n,i){e.call(this,t.msgWithCoord(n,i)),this.pt=i?new Dt(i):null,this.name="TopologyException"}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getCoordinate=function(){return this.pt},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.msgWithCoord=function(n,i){return i?n:n+" [ "+i+" ]"},t}(fl),Lg=function(){this.array_=[]};Lg.prototype.addLast=function(e){this.array_.push(e)};Lg.prototype.removeFirst=function(){return this.array_.shift()};Lg.prototype.isEmpty=function(){return this.array_.length===0};var eo=function(){this._finder=null,this._dirEdgeList=new ce,this._nodes=new ce,this._rightMostCoord=null,this._env=null,this._finder=new pa};eo.prototype.clearVisitedEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.setVisited(!1)}};eo.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};eo.prototype.computeNodeDepth=function(e){for(var t=this,n=null,i=e.getEdges().iterator();i.hasNext();){var r=i.next();if(r.isVisited()||r.getSym().isVisited()){n=r;break}}if(n===null)throw new ml("unable to find edge to compute depths at "+e.getCoordinate());e.getEdges().computeDepths(n);for(var u=e.getEdges().iterator();u.hasNext();){var p=u.next();p.setVisited(!0),t.copySymDepths(p)}};eo.prototype.computeDepth=function(e){this.clearVisitedEdges();var t=this._finder.getEdge();t.setEdgeDepths(re.RIGHT,e),this.copySymDepths(t),this.computeDepths(t)};eo.prototype.create=function(e){this.addReachable(e),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};eo.prototype.findResultEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.getDepth(re.RIGHT)>=1&&t.getDepth(re.LEFT)<=0&&!t.isInteriorAreaEdge()&&t.setInResult(!0)}};eo.prototype.computeDepths=function(e){var t=this,n=new Ny,i=new Lg,r=e.getNode();for(i.addLast(r),n.add(r),e.setVisited(!0);!i.isEmpty();){var u=i.removeFirst();n.add(u),t.computeNodeDepth(u);for(var p=u.getEdges().iterator();p.hasNext();){var a=p.next(),_=a.getSym();if(!_.isVisited()){var x=_.getNode();n.contains(x)||(i.addLast(x),n.add(x))}}}};eo.prototype.compareTo=function(e){var t=e;return this._rightMostCoord.xt._rightMostCoord.x?1:0};eo.prototype.getEnvelope=function(){if(this._env===null){for(var e=new Re,t=this._dirEdgeList.iterator();t.hasNext();)for(var n=t.next(),i=n.getEdge().getCoordinates(),r=0;rthis.location.length){var n=new Array(3).fill(null);n[re.ON]=this.location[re.ON],n[re.LEFT]=zt.NONE,n[re.RIGHT]=zt.NONE,this.location=n}for(var i=0;i1&&e.append(zt.toLocationSymbol(this.location[re.LEFT])),e.append(zt.toLocationSymbol(this.location[re.ON])),this.location.length>1&&e.append(zt.toLocationSymbol(this.location[re.RIGHT])),e.toString()};ti.prototype.setLocations=function(e,t,n){this.location[re.ON]=e,this.location[re.LEFT]=t,this.location[re.RIGHT]=n};ti.prototype.get=function(e){return e1};ti.prototype.isAnyNull=function(){for(var e=this,t=0;te._maxNodeDegree&&(e._maxNodeDegree=i),t=e.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2};ji.prototype.addPoints=function(e,t,n){var i=this,r=e.getCoordinates();if(t){var u=1;n&&(u=0);for(var p=u;p=0;_--)i._pts.add(r[_])}};ji.prototype.isHole=function(){return this._isHole};ji.prototype.setInResult=function(){var e=this._startDe;do e.getEdge().setInResult(!0),e=e.getNext();while(e!==this._startDe)};ji.prototype.containsPoint=function(e){var t=this.getLinearRing(),n=t.getEnvelopeInternal();if(!n.contains(e)||!ve.isPointInRing(e,t.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();){var r=i.next();if(r.containsPoint(e))return!1}return!0};ji.prototype.addHole=function(e){this._holes.add(e)};ji.prototype.isShell=function(){return this._shell===null};ji.prototype.getLabel=function(){return this._label};ji.prototype.getEdges=function(){return this._edges};ji.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};ji.prototype.getShell=function(){return this._shell};ji.prototype.mergeLabel=function(){if(arguments.length===1){var e=arguments[0];this.mergeLabel(e,0),this.mergeLabel(e,1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],i=t.getLocation(n,re.RIGHT);if(i===zt.NONE)return null;if(this._label.getLocation(n)===zt.NONE)return this._label.setLocation(n,i),null}};ji.prototype.setShell=function(e){this._shell=e,e!==null&&e.addHole(this)};ji.prototype.toPolygon=function(e){for(var t=this,n=new Array(this._holes.size()).fill(null),i=0;i=2,"found partial label"),this.computeIM(e)};Yo.prototype.isInResult=function(){return this._isInResult};Yo.prototype.isVisited=function(){return this._isVisited};Yo.prototype.interfaces_=function(){return[]};Yo.prototype.getClass=function(){return Yo};var Mg=function(e){function t(){e.call(this),this._coord=null,this._edges=null;var n=arguments[0],i=arguments[1];this._coord=n,this._edges=i,this._label=new Vn(0,zt.NONE)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var i=n.next();if(i.getEdge().isInResult())return!0}return!1},t.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},t.prototype.getCoordinate=function(){return this._coord},t.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},t.prototype.computeIM=function(n){},t.prototype.computeMergedLocation=function(n,i){var r=zt.NONE;if(r=this._label.getLocation(i),!n.isNull(i)){var u=n.getLocation(i);r!==zt.BOUNDARY&&(r=u)}return r},t.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this._label===null?this._label=new Vn(n,i):this._label.setLocation(n,i)}else return e.prototype.setLabel.apply(this,arguments)},t.prototype.getEdges=function(){return this._edges},t.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof t){var i=arguments[0];this.mergeLabel(i._label)}else if(arguments[0]instanceof Vn)for(var r=arguments[0],u=0;u<2;u++){var p=n.computeMergedLocation(r,u),a=n._label.getLocation(u);a===zt.NONE&&n._label.setLocation(u,p)}},t.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},t.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var i=zt.NONE;this._label!==null&&(i=this._label.getLocation(n));var r=null;switch(i){case zt.BOUNDARY:r=zt.INTERIOR;break;case zt.INTERIOR:r=zt.BOUNDARY;break;default:r=zt.BOUNDARY;break}this._label.setLocation(n,r)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Yo),fa=function(){this.nodeMap=new Vr,this.nodeFact=null;var e=arguments[0];this.nodeFact=e};fa.prototype.find=function(e){return this.nodeMap.get(e)};fa.prototype.addNode=function(){if(arguments[0]instanceof Dt){var e=arguments[0],t=this.nodeMap.get(e);return t===null&&(t=this.nodeFact.createNode(e),this.nodeMap.put(e,t)),t}else if(arguments[0]instanceof Mg){var n=arguments[0],i=this.nodeMap.get(n.getCoordinate());return i===null?(this.nodeMap.put(n.getCoordinate(),n),n):(i.mergeLabel(n),i)}};fa.prototype.print=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};fa.prototype.iterator=function(){return this.nodeMap.values().iterator()};fa.prototype.values=function(){return this.nodeMap.values()};fa.prototype.getBoundaryNodes=function(e){for(var t=new ce,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(e)===zt.BOUNDARY&&t.add(i)}return t};fa.prototype.add=function(e){var t=e.getCoordinate(),n=this.addNode(t);n.add(e)};fa.prototype.interfaces_=function(){return[]};fa.prototype.getClass=function(){return fa};var Zn=function(){},_d={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Zn.prototype.interfaces_=function(){return[]};Zn.prototype.getClass=function(){return Zn};Zn.isNorthern=function(e){return e===Zn.NE||e===Zn.NW};Zn.isOpposite=function(e,t){if(e===t)return!1;var n=(e-t+4)%4;return n===2};Zn.commonHalfPlane=function(e,t){if(e===t)return e;var n=(e-t+4)%4;if(n===2)return-1;var i=et?e:t;return i===0&&r===3?3:i};Zn.isInHalfPlane=function(e,t){return t===Zn.SE?e===Zn.SE||e===Zn.SW:e===t||e===t+1};Zn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1];if(e===0&&t===0)throw new fi("Cannot compute the quadrant for point ( "+e+", "+t+" )");return e>=0?t>=0?Zn.NE:Zn.SE:t>=0?Zn.NW:Zn.SW}else if(arguments[0]instanceof Dt&&arguments[1]instanceof Dt){var n=arguments[0],i=arguments[1];if(i.x===n.x&&i.y===n.y)throw new fi("Cannot compute the quadrant for two identical points "+n);return i.x>=n.x?i.y>=n.y?Zn.NE:Zn.SE:i.y>=n.y?Zn.NW:Zn.SW}};_d.NE.get=function(){return 0};_d.NW.get=function(){return 1};_d.SW.get=function(){return 2};_d.SE.get=function(){return 3};Object.defineProperties(Zn,_d);var Ur=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var e=arguments[0];this._edge=e}else if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2],r=null;this._edge=t,this.init(n,i),this._label=r}else if(arguments.length===4){var u=arguments[0],p=arguments[1],a=arguments[2],_=arguments[3];this._edge=u,this.init(p,a),this._label=_}};Ur.prototype.compareDirection=function(e){return this._dx===e._dx&&this._dy===e._dy?0:this._quadrant>e._quadrant?1:this._quadrant2){p.linkDirectedEdgesForMinimalEdgeRings();var a=p.buildMinimalRings(),_=i.findShell(a);_!==null?(i.placePolygonHoles(_,a),t.add(_)):n.addAll(a)}else r.add(p)}return r};Po.prototype.containsPoint=function(e){for(var t=this._shellList.iterator();t.hasNext();){var n=t.next();if(n.containsPoint(e))return!0}return!1};Po.prototype.buildMaximalEdgeRings=function(e){for(var t=this,n=new ce,i=e.iterator();i.hasNext();){var r=i.next();if(r.isInResult()&&r.getLabel().isArea()&&r.getEdgeRing()===null){var u=new MC(r,t._geometryFactory);n.add(u),u.setInResult()}}return n};Po.prototype.placePolygonHoles=function(e,t){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(e)}};Po.prototype.getPolygons=function(){var e=this.computePolygons(this._shellList);return e};Po.prototype.findEdgeRingContaining=function(e,t){for(var n=e.getLinearRing(),i=n.getEnvelopeInternal(),r=n.getCoordinateN(0),u=null,p=null,a=t.iterator();a.hasNext();){var _=a.next(),x=_.getLinearRing(),S=x.getEnvelopeInternal();u!==null&&(p=u.getLinearRing().getEnvelopeInternal());var L=!1;S.contains(i)&&ve.isPointInRing(r,x.getCoordinates())&&(L=!0),L&&(u===null||p.contains(S))&&(u=_)}return u};Po.prototype.findShell=function(e){for(var t=0,n=null,i=e.iterator();i.hasNext();){var r=i.next();r.isHole()||(n=r,t++)}return un.isTrue(t<=1,"found two shells in MinimalEdgeRing list"),n};Po.prototype.add=function(){if(arguments.length===1){var e=arguments[0];this.add(e.getEdgeEnds(),e.getNodes())}else if(arguments.length===2){var t=arguments[0],n=arguments[1];yi.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(t),r=new ce,u=this.buildMinimalEdgeRings(i,this._shellList,r);this.sortShellsAndHoles(u,this._shellList,r),this.placeFreeHoles(this._shellList,r)}};Po.prototype.interfaces_=function(){return[]};Po.prototype.getClass=function(){return Po};var jh=function(){};jh.prototype.getBounds=function(){};jh.prototype.interfaces_=function(){return[]};jh.prototype.getClass=function(){return jh};var Rs=function(){this._bounds=null,this._item=null;var e=arguments[0],t=arguments[1];this._bounds=e,this._item=t};Rs.prototype.getItem=function(){return this._item};Rs.prototype.getBounds=function(){return this._bounds};Rs.prototype.interfaces_=function(){return[jh,bs]};Rs.prototype.getClass=function(){return Rs};var gl=function(){this._size=null,this._items=null,this._size=0,this._items=new ce,this._items.add(null)};gl.prototype.poll=function(){if(this.isEmpty())return null;var e=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),e};gl.prototype.size=function(){return this._size};gl.prototype.reorder=function(e){for(var t=this,n=null,i=this._items.get(e);e*2<=this._size&&(n=e*2,n!==t._size&&t._items.get(n+1).compareTo(t._items.get(n))<0&&n++,t._items.get(n).compareTo(i)<0);e=n)t._items.set(e,t._items.get(n));this._items.set(e,i)};gl.prototype.clear=function(){this._size=0,this._items.clear()};gl.prototype.isEmpty=function(){return this._size===0};gl.prototype.add=function(e){var t=this;this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,e);e.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)t._items.set(n,t._items.get(Math.trunc(n/2)));this._items.set(n,e)};gl.prototype.interfaces_=function(){return[]};gl.prototype.getClass=function(){return gl};var Kl=function(){};Kl.prototype.visitItem=function(e){};Kl.prototype.interfaces_=function(){return[]};Kl.prototype.getClass=function(){return Kl};var xc=function(){};xc.prototype.insert=function(e,t){};xc.prototype.remove=function(e,t){};xc.prototype.query=function(){};xc.prototype.interfaces_=function(){return[]};xc.prototype.getClass=function(){return xc};var Ji=function(){if(this._childBoundables=new ce,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var e=arguments[0];this._level=e}},Lx={serialVersionUID:{configurable:!0}};Ji.prototype.getLevel=function(){return this._level};Ji.prototype.size=function(){return this._childBoundables.size()};Ji.prototype.getChildBoundables=function(){return this._childBoundables};Ji.prototype.addChildBoundable=function(e){un.isTrue(this._bounds===null),this._childBoundables.add(e)};Ji.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};Ji.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};Ji.prototype.interfaces_=function(){return[jh,bs]};Ji.prototype.getClass=function(){return Ji};Lx.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(Ji,Lx);var Os=function(){};Os.reverseOrder=function(){return{compare:function(e,t){return t.compareTo(e)}}};Os.min=function(e){return Os.sort(e),e.get(0)};Os.sort=function(e,t){var n=e.toArray();t?ku.sort(n,t):ku.sort(n);for(var i=e.iterator(),r=0,u=n.length;rVi.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,e,t),null):(this.expand(this._boundable2,this._boundable1,e,t),null);if(n)return this.expand(this._boundable1,this._boundable2,e,t),null;if(i)return this.expand(this._boundable2,this._boundable1,e,t),null;throw new fi("neither boundable is composite")};Vi.prototype.isLeaves=function(){return!(Vi.isComposite(this._boundable1)||Vi.isComposite(this._boundable2))};Vi.prototype.compareTo=function(e){var t=e;return this._distancet._distance?1:0};Vi.prototype.expand=function(e,t,n,i){for(var r=this,u=e.getChildBoundables(),p=u.iterator();p.hasNext();){var a=p.next(),_=new Vi(a,t,r._itemDistance);_.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},Pg={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};vr.prototype.getNodeCapacity=function(){return this._nodeCapacity};vr.prototype.lastNode=function(e){return e.get(e.size()-1)};vr.prototype.size=function(){var e=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var t=arguments[0],n=0,i=t.getChildBoundables().iterator();i.hasNext();){var r=i.next();r instanceof Ji?n+=e.size(r):r instanceof Rs&&(n+=1)}return n}};vr.prototype.removeItem=function(e,t){for(var n=null,i=e.getChildBoundables().iterator();i.hasNext();){var r=i.next();r instanceof Rs&&r.getItem()===t&&(n=r)}return n!==null?(e.getChildBoundables().remove(n),!0):!1};vr.prototype.itemsTree=function(){var e=this;if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new ce:t}else if(arguments.length===1){for(var n=arguments[0],i=new ce,r=n.getChildBoundables().iterator();r.hasNext();){var u=r.next();if(u instanceof Ji){var p=e.itemsTree(u);p!==null&&i.add(p)}else u instanceof Rs?i.add(u.getItem()):un.shouldNeverReachHere()}return i.size()<=0?null:i}};vr.prototype.insert=function(e,t){un.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Rs(e,t))};vr.prototype.boundablesAtLevel=function(){var e=this;if(arguments.length===1){var t=arguments[0],n=new ce;return this.boundablesAtLevel(t,this._root,n),n}else if(arguments.length===3){var i=arguments[0],r=arguments[1],u=arguments[2];if(un.isTrue(i>-2),r.getLevel()===i)return u.add(r),null;for(var p=r.getChildBoundables().iterator();p.hasNext();){var a=p.next();a instanceof Ji?e.boundablesAtLevel(i,a,u):(un.isTrue(a instanceof Rs),i===-1&&u.add(a))}return null}};vr.prototype.query=function(){var e=this;if(arguments.length===1){var t=arguments[0];this.build();var n=new ce;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,n),n}else if(arguments.length===2){var i=arguments[0],r=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),i)&&this.query(i,this._root,r)}else if(arguments.length===3){if(Ze(arguments[2],Kl)&&arguments[0]instanceof Object&&arguments[1]instanceof Ji)for(var u=arguments[0],p=arguments[1],a=arguments[2],_=p.getChildBoundables(),x=0;x<_.size();x++){var S=_.get(x);e.getIntersectsOp().intersects(S.getBounds(),u)&&(S instanceof Ji?e.query(u,S,a):S instanceof Rs?a.visitItem(S.getItem()):un.shouldNeverReachHere())}else if(Ze(arguments[2],As)&&arguments[0]instanceof Object&&arguments[1]instanceof Ji)for(var L=arguments[0],A=arguments[1],N=arguments[2],O=A.getChildBoundables(),Z=0;Zn&&(n=u)}}return n+1}};vr.prototype.createParentBoundables=function(e,t){var n=this;un.isTrue(!e.isEmpty());var i=new ce;i.add(this.createNode(t));var r=new ce(e);Os.sort(r,this.getComparator());for(var u=r.iterator();u.hasNext();){var p=u.next();n.lastNode(i).getChildBoundables().size()===n.getNodeCapacity()&&i.add(n.createNode(t)),n.lastNode(i).addChildBoundable(p)}return i};vr.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};vr.prototype.interfaces_=function(){return[bs]};vr.prototype.getClass=function(){return vr};vr.compareDoubles=function(e,t){return e>t?1:e0);for(var p=new ce,a=0;a0;){var O=N.poll(),Z=O.getDistance();if(Z>=L)break;O.isLeaves()?(L=Z,A=O):O.expandToQueue(N,L)}return[A.getBoundable(0).getItem(),A.getBoundable(1).getItem()]}}else if(arguments.length===3){var G=arguments[0],K=arguments[1],V=arguments[2],H=new Rs(G,K),Q=new Vi(this.getRoot(),H,V);return this.nearestNeighbour(Q)[0]}},t.prototype.interfaces_=function(){return[xc,bs]},t.prototype.getClass=function(){return t},t.centreX=function(i){return t.avg(i.getMinX(),i.getMaxX())},t.avg=function(i,r){return(i+r)/2},t.centreY=function(i){return t.avg(i.getMinY(),i.getMaxY())},n.STRtreeNode.get=function(){return g1},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[Dh]},compare:function(i,r){return e.compareDoubles(t.centreX(i.getBounds()),t.centreX(r.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[Dh]},compare:function(i,r){return e.compareDoubles(t.centreY(i.getBounds()),t.centreY(r.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[e.IntersectsOp]},intersects:function(i,r){return i.intersects(r)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(t,n),t}(vr),g1=function(e){function t(){var n=arguments[0];e.call(this,n)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.computeBounds=function(){for(var n=null,i=this.getChildBoundables().iterator();i.hasNext();){var r=i.next();n===null?n=new Re(r.getBounds()):n.expandToInclude(r.getBounds())}return n},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ji),ho=function(){};ho.prototype.interfaces_=function(){return[]};ho.prototype.getClass=function(){return ho};ho.relativeSign=function(e,t){return et?1:0};ho.compare=function(e,t,n){if(t.equals2D(n))return 0;var i=ho.relativeSign(t.x,n.x),r=ho.relativeSign(t.y,n.y);switch(e){case 0:return ho.compareValue(i,r);case 1:return ho.compareValue(r,i);case 2:return ho.compareValue(r,-i);case 3:return ho.compareValue(-i,r);case 4:return ho.compareValue(-i,-r);case 5:return ho.compareValue(-r,-i);case 6:return ho.compareValue(-r,i);case 7:return ho.compareValue(i,-r)}return un.shouldNeverReachHere("invalid octant value"),0};ho.compareValue=function(e,t){return e<0?-1:e>0?1:t<0?-1:t>0?1:0};var Jl=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this._segString=e,this.coord=new Dt(t),this.segmentIndex=n,this._segmentOctant=i,this._isInterior=!t.equals2D(e.getCoordinate(n))};Jl.prototype.getCoordinate=function(){return this.coord};Jl.prototype.print=function(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex)};Jl.prototype.compareTo=function(e){var t=e;return this.segmentIndext.segmentIndex?1:this.coord.equals2D(t.coord)?0:ho.compare(this._segmentOctant,this.coord,t.coord)};Jl.prototype.isEndPoint=function(e){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===e};Jl.prototype.isInterior=function(){return this._isInterior};Jl.prototype.interfaces_=function(){return[vs]};Jl.prototype.getClass=function(){return Jl};var no=function(){this._nodeMap=new Vr,this._edge=null;var e=arguments[0];this._edge=e};no.prototype.getSplitCoordinates=function(){var e=this,t=new md;this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var r=n.next();e.addEdgeCoordinates(i,r,t),i=r}return t.toCoordinateArray()};no.prototype.addCollapsedNodes=function(){var e=this,t=new ce;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var n=t.iterator();n.hasNext();){var i=n.next().intValue();e.add(e._edge.getCoordinate(i),i)}};no.prototype.print=function(e){e.println("Intersections:");for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};no.prototype.findCollapsesFromExistingVertices=function(e){for(var t=this,n=0;n=0?t>=0?n>=i?0:1:n>=i?7:6:t>=0?n>=i?3:2:n>=i?4:5}else if(arguments[0]instanceof Dt&&arguments[1]instanceof Dt){var r=arguments[0],u=arguments[1],p=u.x-r.x,a=u.y-r.y;if(p===0&&a===0)throw new fi("Cannot compute the octant for two identical points "+r);return wc.octant(p,a)}};var Ua=function(){};Ua.prototype.getCoordinates=function(){};Ua.prototype.size=function(){};Ua.prototype.getCoordinate=function(e){};Ua.prototype.isClosed=function(){};Ua.prototype.setData=function(e){};Ua.prototype.getData=function(){};Ua.prototype.interfaces_=function(){return[]};Ua.prototype.getClass=function(){return Ua};var $f=function(){};$f.prototype.addIntersection=function(e,t){};$f.prototype.interfaces_=function(){return[Ua]};$f.prototype.getClass=function(){return $f};var Ri=function(){this._nodeList=new no(this),this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};Ri.prototype.getCoordinates=function(){return this._pts};Ri.prototype.size=function(){return this._pts.length};Ri.prototype.getCoordinate=function(e){return this._pts[e]};Ri.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Ri.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(e),this.getCoordinate(e+1))};Ri.prototype.setData=function(e){this._data=e};Ri.prototype.safeOctant=function(e,t){return e.equals2D(t)?0:wc.octant(e,t)};Ri.prototype.getData=function(){return this._data};Ri.prototype.addIntersection=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.addIntersectionNode(e,t)}else if(arguments.length===4){var n=arguments[0],i=arguments[1],r=arguments[3],u=new Dt(n.getIntersection(r));this.addIntersection(u,i)}};Ri.prototype.toString=function(){return Ns.toLineString(new ki(this._pts))};Ri.prototype.getNodeList=function(){return this._nodeList};Ri.prototype.addIntersectionNode=function(e,t){var n=t,i=n+1;if(i=0&&n>=0||t<=0&&n<=0?Math.max(t,n):0}else if(arguments[0]instanceof Dt){var i=arguments[0];return ve.orientationIndex(this.p0,this.p1,i)}};Oe.prototype.toGeometry=function(e){return e.createLineString([this.p0,this.p1])};Oe.prototype.isVertical=function(){return this.p0.x===this.p1.x};Oe.prototype.equals=function(e){if(!(e instanceof Oe))return!1;var t=e;return this.p0.equals(t.p0)&&this.p1.equals(t.p1)};Oe.prototype.intersection=function(e){var t=new Wu;return t.computeIntersection(this.p0,this.p1,e.p0,e.p1),t.hasIntersection()?t.getIntersection(0):null};Oe.prototype.project=function(){if(arguments[0]instanceof Dt){var e=arguments[0];if(e.equals(this.p0)||e.equals(this.p1))return new Dt(e);var t=this.projectionFactor(e),n=new Dt;return n.x=this.p0.x+t*(this.p1.x-this.p0.x),n.y=this.p0.y+t*(this.p1.y-this.p0.y),n}else if(arguments[0]instanceof Oe){var i=arguments[0],r=this.projectionFactor(i.p0),u=this.projectionFactor(i.p1);if(r>=1&&u>=1||r<=0&&u<=0)return null;var p=this.project(i.p0);r<0&&(p=this.p0),r>1&&(p=this.p1);var a=this.project(i.p1);return u<0&&(a=this.p0),u>1&&(a=this.p1),new Oe(p,a)}};Oe.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};Oe.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};Oe.prototype.getCoordinate=function(e){return e===0?this.p0:this.p1};Oe.prototype.distancePerpendicular=function(e){return ve.distancePointLinePerpendicular(e,this.p0,this.p1)};Oe.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};Oe.prototype.midPoint=function(){return Oe.midPoint(this.p0,this.p1)};Oe.prototype.projectionFactor=function(e){if(e.equals(this.p0))return 0;if(e.equals(this.p1))return 1;var t=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,i=t*t+n*n;if(i<=0)return $e.NaN;var r=((e.x-this.p0.x)*t+(e.y-this.p0.y)*n)/i;return r};Oe.prototype.closestPoints=function(e){var t=this.intersection(e);if(t!==null)return[t,t];var n=new Array(2).fill(null),i=$e.MAX_VALUE,r=null,u=this.closestPoint(e.p0);i=u.distance(e.p0),n[0]=u,n[1]=e.p0;var p=this.closestPoint(e.p1);r=p.distance(e.p1),r0&&t<1)return this.project(e);var n=this.p0.distance(e),i=this.p1.distance(e);return n1||$e.isNaN(t))&&(t=1),t};Oe.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};Oe.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};Oe.prototype.distance=function(){if(arguments[0]instanceof Oe){var e=arguments[0];return ve.distanceLineLine(this.p0,this.p1,e.p0,e.p1)}else if(arguments[0]instanceof Dt){var t=arguments[0];return ve.distancePointLine(t,this.p0,this.p1)}};Oe.prototype.pointAlong=function(e){var t=new Dt;return t.x=this.p0.x+e*(this.p1.x-this.p0.x),t.y=this.p0.y+e*(this.p1.y-this.p0.y),t};Oe.prototype.hashCode=function(){var e=$e.doubleToLongBits(this.p0.x);e^=$e.doubleToLongBits(this.p0.y)*31;var t=Math.trunc(e)^Math.trunc(e>>32),n=$e.doubleToLongBits(this.p1.x);n^=$e.doubleToLongBits(this.p1.y)*31;var i=Math.trunc(n)^Math.trunc(n>>32);return t^i};Oe.prototype.interfaces_=function(){return[vs,bs]};Oe.prototype.getClass=function(){return Oe};Oe.midPoint=function(e,t){return new Dt((e.x+t.x)/2,(e.y+t.y)/2)};Px.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(Oe,Px);var td=function(){this.tempEnv1=new Re,this.tempEnv2=new Re,this._overlapSeg1=new Oe,this._overlapSeg2=new Oe};td.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];e.getLineSegment(t,this._overlapSeg1),n.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};td.prototype.interfaces_=function(){return[]};td.prototype.getClass=function(){return td};var Ao=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this._pts=e,this._start=t,this._end=n,this._context=i};Ao.prototype.getLineSegment=function(e,t){t.p0=this._pts[e],t.p1=this._pts[e+1]};Ao.prototype.computeSelect=function(e,t,n,i){var r=this._pts[t],u=this._pts[n];if(i.tempEnv1.init(r,u),n-t===1)return i.select(this,t),null;if(!e.intersects(i.tempEnv1))return null;var p=Math.trunc((t+n)/2);t=e.length-1)return e.length-1;for(var i=Zn.quadrant(e[n],e[n+1]),r=t+1;rp.getId()&&(p.computeOverlaps(x,r),i._nOverlaps++),i._segInt.isDone())return null}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.SegmentOverlapAction.get=function(){return _1},Object.defineProperties(t,n),t}(ed),_1=function(e){function t(){e.call(this),this._si=null;var n=arguments[0];this._si=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],i=arguments[1],r=arguments[2],u=arguments[3],p=n.getContext(),a=r.getContext();this._si.processIntersections(p,i,a,u)}else return e.prototype.overlap.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(td),Nn=function e(){if(this._quadrantSegments=e.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=e.CAP_ROUND,this._joinStyle=e.JOIN_ROUND,this._mitreLimit=e.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=e.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setQuadrantSegments(t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(i)}else if(arguments.length===4){var r=arguments[0],u=arguments[1],p=arguments[2],a=arguments[3];this.setQuadrantSegments(r),this.setEndCapStyle(u),this.setJoinStyle(p),this.setMitreLimit(a)}}},bl={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Nn.prototype.getEndCapStyle=function(){return this._endCapStyle};Nn.prototype.isSingleSided=function(){return this._isSingleSided};Nn.prototype.setQuadrantSegments=function(e){this._quadrantSegments=e,this._quadrantSegments===0&&(this._joinStyle=Nn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Nn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),e<=0&&(this._quadrantSegments=1),this._joinStyle!==Nn.JOIN_ROUND&&(this._quadrantSegments=Nn.DEFAULT_QUADRANT_SEGMENTS)};Nn.prototype.getJoinStyle=function(){return this._joinStyle};Nn.prototype.setJoinStyle=function(e){this._joinStyle=e};Nn.prototype.setSimplifyFactor=function(e){this._simplifyFactor=e<0?0:e};Nn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Nn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Nn.prototype.setEndCapStyle=function(e){this._endCapStyle=e};Nn.prototype.getMitreLimit=function(){return this._mitreLimit};Nn.prototype.setMitreLimit=function(e){this._mitreLimit=e};Nn.prototype.setSingleSided=function(e){this._isSingleSided=e};Nn.prototype.interfaces_=function(){return[]};Nn.prototype.getClass=function(){return Nn};Nn.bufferDistanceError=function(e){var t=Math.PI/2/e;return 1-Math.cos(t/2)};bl.CAP_ROUND.get=function(){return 1};bl.CAP_FLAT.get=function(){return 2};bl.CAP_SQUARE.get=function(){return 3};bl.JOIN_ROUND.get=function(){return 1};bl.JOIN_MITRE.get=function(){return 2};bl.JOIN_BEVEL.get=function(){return 3};bl.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};bl.DEFAULT_MITRE_LIMIT.get=function(){return 5};bl.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Nn,bl);var Li=function(e){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ve.COUNTERCLOCKWISE,this._inputLine=e||null},yd={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Li.prototype.isDeletable=function(e,t,n,i){var r=this._inputLine[e],u=this._inputLine[t],p=this._inputLine[n];return!this.isConcave(r,u,p)||!this.isShallow(r,u,p,i)?!1:this.isShallowSampled(r,u,e,n,i)};Li.prototype.deleteShallowConcavities=function(){for(var e=this,t=1,n=this.findNextNonDeletedIndex(t),i=this.findNextNonDeletedIndex(n),r=!1;i=0;r--)n.addPt(e[r])};Ko.prototype.isRedundant=function(e){if(this._ptList.size()<1)return!1;var t=this._ptList.get(this._ptList.size()-1),n=e.distance(t);return nMath.PI;)e-=Sn.PI_TIMES_2;for(;e<=-Math.PI;)e+=Sn.PI_TIMES_2;return e};Sn.angle=function(){if(arguments.length===1){var e=arguments[0];return Math.atan2(e.y,e.x)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],i=n.x-t.x,r=n.y-t.y;return Math.atan2(r,i)}};Sn.isAcute=function(e,t,n){var i=e.x-t.x,r=e.y-t.y,u=n.x-t.x,p=n.y-t.y,a=i*u+r*p;return a>0};Sn.isObtuse=function(e,t,n){var i=e.x-t.x,r=e.y-t.y,u=n.x-t.x,p=n.y-t.y,a=i*u+r*p;return a<0};Sn.interiorAngle=function(e,t,n){var i=Sn.angle(t,e),r=Sn.angle(t,n);return Math.abs(r-i)};Sn.normalizePositive=function(e){if(e<0){for(;e<0;)e+=Sn.PI_TIMES_2;e>=Sn.PI_TIMES_2&&(e=0)}else{for(;e>=Sn.PI_TIMES_2;)e-=Sn.PI_TIMES_2;e<0&&(e=0)}return e};Sn.angleBetween=function(e,t,n){var i=Sn.angle(t,e),r=Sn.angle(t,n);return Sn.diff(i,r)};Sn.diff=function(e,t){var n=null;return eMath.PI&&(n=2*Math.PI-n),n};Sn.toRadians=function(e){return e*Math.PI/180};Sn.getTurn=function(e,t){var n=Math.sin(t-e);return n>0?Sn.COUNTERCLOCKWISE:n<0?Sn.CLOCKWISE:Sn.NONE};Sn.angleBetweenOriented=function(e,t,n){var i=Sn.angle(t,e),r=Sn.angle(t,n),u=r-i;return u<=-Math.PI?u+Sn.PI_TIMES_2:u>Math.PI?u-Sn.PI_TIMES_2:u};zc.PI_TIMES_2.get=function(){return 2*Math.PI};zc.PI_OVER_2.get=function(){return Math.PI/2};zc.PI_OVER_4.get=function(){return Math.PI/4};zc.COUNTERCLOCKWISE.get=function(){return ve.COUNTERCLOCKWISE};zc.CLOCKWISE.get=function(){return ve.CLOCKWISE};zc.NONE.get=function(){return ve.COLLINEAR};Object.defineProperties(Sn,zc);var li=function e(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Oe,this._seg1=new Oe,this._offset0=new Oe,this._offset1=new Oe,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],n=arguments[1],i=arguments[2];this._precisionModel=t,this._bufParams=n,this._li=new Wu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Nn.JOIN_ROUND&&(this._closingSegLengthFactor=e.MAX_CLOSING_SEG_LEN_FACTOR),this.init(i)},vd={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};li.prototype.addNextSegment=function(e,t){if(this._s0=this._s1,this._s1=this._s2,this._s2=e,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=ve.computeOrientation(this._s0,this._s1,this._s2),i=n===ve.CLOCKWISE&&this._side===re.LEFT||n===ve.COUNTERCLOCKWISE&&this._side===re.RIGHT;n===0?this.addCollinear(t):i?this.addOutsideTurn(n,t):this.addInsideTurn(n,t)};li.prototype.addLineEndCap=function(e,t){var n=new Oe(e,t),i=new Oe;this.computeOffsetSegment(n,re.LEFT,this._distance,i);var r=new Oe;this.computeOffsetSegment(n,re.RIGHT,this._distance,r);var u=t.x-e.x,p=t.y-e.y,a=Math.atan2(p,u);switch(this._bufParams.getEndCapStyle()){case Nn.CAP_ROUND:this._segList.addPt(i.p1),this.addFilletArc(t,a+Math.PI/2,a-Math.PI/2,ve.CLOCKWISE,this._distance),this._segList.addPt(r.p1);break;case Nn.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(r.p1);break;case Nn.CAP_SQUARE:var _=new Dt;_.x=Math.abs(this._distance)*Math.cos(a),_.y=Math.abs(this._distance)*Math.sin(a);var x=new Dt(i.p1.x+_.x,i.p1.y+_.y),S=new Dt(r.p1.x+_.x,r.p1.y+_.y);this._segList.addPt(x),this._segList.addPt(S);break}};li.prototype.getCoordinates=function(){var e=this._segList.getCoordinates();return e};li.prototype.addMitreJoin=function(e,t,n,i){var r=!0,u=null;try{u=Ps.intersection(t.p0,t.p1,n.p0,n.p1);var p=i<=0?1:u.distance(e)/Math.abs(i);p>this._bufParams.getMitreLimit()&&(r=!1)}catch(a){if(a instanceof sp)u=new Dt(0,0),r=!1;else throw a}finally{}r?this._segList.addPt(u):this.addLimitedMitreJoin(t,n,i,this._bufParams.getMitreLimit())};li.prototype.addFilletCorner=function(e,t,n,i,r){var u=t.x-e.x,p=t.y-e.y,a=Math.atan2(p,u),_=n.x-e.x,x=n.y-e.y,S=Math.atan2(x,_);i===ve.CLOCKWISE?a<=S&&(a+=2*Math.PI):a>=S&&(a-=2*Math.PI),this._segList.addPt(t),this.addFilletArc(e,a,S,i,r),this._segList.addPt(n)};li.prototype.addOutsideTurn=function(e,t){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new Dt((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var i=new Dt((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(i)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};li.prototype.createCircle=function(e){var t=new Dt(e.x+this._distance,e.y);this._segList.addPt(t),this.addFilletArc(e,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};li.prototype.addBevelJoin=function(e,t){this._segList.addPt(e.p1),this._segList.addPt(t.p0)};li.prototype.init=function(e){this._distance=e,this._maxCurveSegmentError=e*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Ko,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(e*li.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};li.prototype.addCollinear=function(e){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var t=this._li.getIntersectionNum();t>=2&&(this._bufParams.getJoinStyle()===Nn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Nn.JOIN_MITRE?(e&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,ve.CLOCKWISE,this._distance))};li.prototype.closeRing=function(){this._segList.closeRing()};li.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};li.prototype.interfaces_=function(){return[]};li.prototype.getClass=function(){return li};vd.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};vd.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};vd.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};vd.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(li,vd);var fo=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var e=arguments[0],t=arguments[1];this._precisionModel=e,this._bufParams=t};fo.prototype.getOffsetCurve=function(e,t){if(this._distance=t,t===0)return null;var n=t<0,i=Math.abs(t),r=this.getSegGen(i);e.length<=1?this.computePointCurve(e[0],r):this.computeOffsetCurve(e,n,r);var u=r.getCoordinates();return n&&_n.reverse(u),u};fo.prototype.computeSingleSidedBufferCurve=function(e,t,n){var i=this.simplifyTolerance(this._distance);if(t){n.addSegments(e,!0);var r=Li.simplify(e,-i),u=r.length-1;n.initSideSegments(r[u],r[u-1],re.LEFT),n.addFirstSegment();for(var p=u-2;p>=0;p--)n.addNextSegment(r[p],!0)}else{n.addSegments(e,!1);var a=Li.simplify(e,i),_=a.length-1;n.initSideSegments(a[0],a[1],re.LEFT),n.addFirstSegment();for(var x=2;x<=_;x++)n.addNextSegment(a[x],!0)}n.addLastSegment(),n.closeRing()};fo.prototype.computeRingBufferCurve=function(e,t,n){var i=this.simplifyTolerance(this._distance);t===re.RIGHT&&(i=-i);var r=Li.simplify(e,i),u=r.length-1;n.initSideSegments(r[u-1],r[0],t);for(var p=1;p<=u;p++){var a=p!==1;n.addNextSegment(r[p],a)}n.closeRing()};fo.prototype.computeLineBufferCurve=function(e,t){var n=this.simplifyTolerance(this._distance),i=Li.simplify(e,n),r=i.length-1;t.initSideSegments(i[0],i[1],re.LEFT);for(var u=2;u<=r;u++)t.addNextSegment(i[u],!0);t.addLastSegment(),t.addLineEndCap(i[r-1],i[r]);var p=Li.simplify(e,-n),a=p.length-1;t.initSideSegments(p[a],p[a-1],re.LEFT);for(var _=a-2;_>=0;_--)t.addNextSegment(p[_],!0);t.addLastSegment(),t.addLineEndCap(p[1],p[0]),t.closeRing()};fo.prototype.computePointCurve=function(e,t){switch(this._bufParams.getEndCapStyle()){case Nn.CAP_ROUND:t.createCircle(e);break;case Nn.CAP_SQUARE:t.createSquare(e);break}};fo.prototype.getLineCurve=function(e,t){if(this._distance=t,t<0&&!this._bufParams.isSingleSided()||t===0)return null;var n=Math.abs(t),i=this.getSegGen(n);if(e.length<=1)this.computePointCurve(e[0],i);else if(this._bufParams.isSingleSided()){var r=t<0;this.computeSingleSidedBufferCurve(e,r,i)}else this.computeLineBufferCurve(e,i);var u=i.getCoordinates();return u};fo.prototype.getBufferParameters=function(){return this._bufParams};fo.prototype.simplifyTolerance=function(e){return e*this._bufParams.getSimplifyFactor()};fo.prototype.getRingCurve=function(e,t,n){if(this._distance=n,e.length<=2)return this.getLineCurve(e,n);if(n===0)return fo.copyCoordinates(e);var i=this.getSegGen(n);return this.computeRingBufferCurve(e,t,i),i.getCoordinates()};fo.prototype.computeOffsetCurve=function(e,t,n){var i=this.simplifyTolerance(this._distance);if(t){var r=Li.simplify(e,-i),u=r.length-1;n.initSideSegments(r[u],r[u-1],re.LEFT),n.addFirstSegment();for(var p=u-2;p>=0;p--)n.addNextSegment(r[p],!0)}else{var a=Li.simplify(e,i),_=a.length-1;n.initSideSegments(a[0],a[1],re.LEFT),n.addFirstSegment();for(var x=2;x<=_;x++)n.addNextSegment(a[x],!0)}n.addLastSegment()};fo.prototype.getSegGen=function(e){return new li(this._precisionModel,this._bufParams,e)};fo.prototype.interfaces_=function(){return[]};fo.prototype.getClass=function(){return fo};fo.copyCoordinates=function(e){for(var t=new Array(e.length).fill(null),n=0;nu.getMaxY()||e.findStabbedSegments(t,r.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Ze(arguments[2],As)&&arguments[0]instanceof Dt&&arguments[1]instanceof gy)for(var p=arguments[0],a=arguments[1],_=arguments[2],x=a.getEdge().getCoordinates(),S=0;Se._seg.p1.y&&e._seg.reverse();var L=Math.max(e._seg.p0.x,e._seg.p1.x);if(!(Le._seg.p1.y)&&ve.computeOrientation(e._seg.p0,e._seg.p1,p)!==ve.RIGHT){var A=a.getDepth(re.LEFT);e._seg.p0.equals(x[S])||(A=a.getDepth(re.RIGHT));var N=new Bu(e._seg,A);_.add(N)}}else if(Ze(arguments[2],As)&&arguments[0]instanceof Dt&&Ze(arguments[1],As))for(var O=arguments[0],Z=arguments[1],G=arguments[2],K=Z.iterator();K.hasNext();){var V=K.next();V.isForward()&&e.findStabbedSegments(O,V,G)}}};Sc.prototype.getDepth=function(e){var t=this.findStabbedSegments(e);if(t.size()===0)return 0;var n=Os.min(t);return n._leftDepth};Sc.prototype.interfaces_=function(){return[]};Sc.prototype.getClass=function(){return Sc};kx.DepthSegment.get=function(){return Bu};Object.defineProperties(Sc,kx);var Bu=function(){this._upwardSeg=null,this._leftDepth=null;var e=arguments[0],t=arguments[1];this._upwardSeg=new Oe(e),this._leftDepth=t};Bu.prototype.compareTo=function(e){var t=e;if(this._upwardSeg.minX()>=t._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=t._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(t._upwardSeg);return n!==0||(n=-1*t._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(t._upwardSeg)};Bu.prototype.compareX=function(e,t){var n=e.p0.compareTo(t.p0);return n!==0?n:e.p1.compareTo(t.p1)};Bu.prototype.toString=function(){return this._upwardSeg.toString()};Bu.prototype.interfaces_=function(){return[vs]};Bu.prototype.getClass=function(){return Bu};var Rn=function(e,t,n){this.p0=e||null,this.p1=t||null,this.p2=n||null};Rn.prototype.area=function(){return Rn.area(this.p0,this.p1,this.p2)};Rn.prototype.signedArea=function(){return Rn.signedArea(this.p0,this.p1,this.p2)};Rn.prototype.interpolateZ=function(e){if(e===null)throw new fi("Supplied point is null.");return Rn.interpolateZ(e,this.p0,this.p1,this.p2)};Rn.prototype.longestSideLength=function(){return Rn.longestSideLength(this.p0,this.p1,this.p2)};Rn.prototype.isAcute=function(){return Rn.isAcute(this.p0,this.p1,this.p2)};Rn.prototype.circumcentre=function(){return Rn.circumcentre(this.p0,this.p1,this.p2)};Rn.prototype.area3D=function(){return Rn.area3D(this.p0,this.p1,this.p2)};Rn.prototype.centroid=function(){return Rn.centroid(this.p0,this.p1,this.p2)};Rn.prototype.inCentre=function(){return Rn.inCentre(this.p0,this.p1,this.p2)};Rn.prototype.interfaces_=function(){return[]};Rn.prototype.getClass=function(){return Rn};Rn.area=function(e,t,n){return Math.abs(((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2)};Rn.signedArea=function(e,t,n){return((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2};Rn.det=function(e,t,n,i){return e*i-t*n};Rn.interpolateZ=function(e,t,n,i){var r=t.x,u=t.y,p=n.x-r,a=i.x-r,_=n.y-u,x=i.y-u,S=p*x-a*_,L=e.x-r,A=e.y-u,N=(x*L-a*A)/S,O=(-_*L+p*A)/S,Z=t.z+N*(n.z-t.z)+O*(i.z-t.z);return Z};Rn.longestSideLength=function(e,t,n){var i=e.distance(t),r=t.distance(n),u=n.distance(e),p=i;return r>p&&(p=r),u>p&&(p=u),p};Rn.isAcute=function(e,t,n){return!(!Sn.isAcute(e,t,n)||!Sn.isAcute(t,n,e)||!Sn.isAcute(n,e,t))};Rn.circumcentre=function(e,t,n){var i=n.x,r=n.y,u=e.x-i,p=e.y-r,a=t.x-i,_=t.y-r,x=2*Rn.det(u,p,a,_),S=Rn.det(p,u*u+p*p,_,a*a+_*_),L=Rn.det(u,u*u+p*p,a,a*a+_*_),A=i-S/x,N=r+L/x;return new Dt(A,N)};Rn.perpendicularBisector=function(e,t){var n=t.x-e.x,i=t.y-e.y,r=new Ps(e.x+n/2,e.y+i/2,1),u=new Ps(e.x-i+n/2,e.y+n+i/2,1);return new Ps(r,u)};Rn.angleBisector=function(e,t,n){var i=t.distance(e),r=t.distance(n),u=i/(i+r),p=n.x-e.x,a=n.y-e.y,_=new Dt(e.x+u*p,e.y+u*a);return _};Rn.area3D=function(e,t,n){var i=t.x-e.x,r=t.y-e.y,u=t.z-e.z,p=n.x-e.x,a=n.y-e.y,_=n.z-e.z,x=r*_-u*a,S=u*p-i*_,L=i*a-r*p,A=x*x+S*S+L*L,N=Math.sqrt(A)/2;return N};Rn.centroid=function(e,t,n){var i=(e.x+t.x+n.x)/3,r=(e.y+t.y+n.y)/3;return new Dt(i,r)};Rn.inCentre=function(e,t,n){var i=t.distance(n),r=e.distance(n),u=e.distance(t),p=i+r+u,a=(i*e.x+r*t.x+u*n.x)/p,_=(i*e.y+r*t.y+u*n.y)/p;return new Dt(a,_)};var ys=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new ce;var e=arguments[0],t=arguments[1],n=arguments[2];this._inputGeom=e,this._distance=t,this._curveBuilder=n};ys.prototype.addPoint=function(e){if(this._distance<=0)return null;var t=e.getCoordinates(),n=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(n,zt.EXTERIOR,zt.INTERIOR)};ys.prototype.addPolygon=function(e){var t=this,n=this._distance,i=re.LEFT;this._distance<0&&(n=-this._distance,i=re.RIGHT);var r=e.getExteriorRing(),u=_n.removeRepeatedPoints(r.getCoordinates());if(this._distance<0&&this.isErodedCompletely(r,this._distance)||this._distance<=0&&u.length<3)return null;this.addPolygonRing(u,n,i,zt.EXTERIOR,zt.INTERIOR);for(var p=0;p0&&t.isErodedCompletely(a,-t._distance)||t.addPolygonRing(_,n,re.opposite(i),zt.INTERIOR,zt.EXTERIOR)}};ys.prototype.isTriangleErodedCompletely=function(e,t){var n=new Rn(e[0],e[1],e[2]),i=n.inCentre(),r=ve.distancePointLine(i,n.p0,n.p1);return r=Ba.MINIMUM_VALID_SIZE&&ve.isCCW(e)&&(u=r,p=i,n=re.opposite(n));var a=this._curveBuilder.getRingCurve(e,n,t);this.addCurve(a,u,p)};ys.prototype.add=function(e){if(e.isEmpty())return null;e instanceof $i?this.addPolygon(e):e instanceof Ti?this.addLineString(e):e instanceof Mo?this.addPoint(e):e instanceof Uh?this.addCollection(e):e instanceof zu?this.addCollection(e):e instanceof Oa?this.addCollection(e):e instanceof to&&this.addCollection(e)};ys.prototype.isErodedCompletely=function(e,t){var n=e.getCoordinates();if(n.length<4)return t<0;if(n.length===4)return this.isTriangleErodedCompletely(n,t);var i=e.getEnvelopeInternal(),r=Math.min(i.getHeight(),i.getWidth());return t<0&&2*Math.abs(t)>r};ys.prototype.addCollection=function(e){for(var t=this,n=0;n=this._max)throw new lp;var e=this._parent.getGeometryN(this._index++);return e instanceof to?(this._subcollectionIterator=new za(e),this._subcollectionIterator.next()):e};za.prototype.remove=function(){throw new Error(this.getClass().getName())};za.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)};za.prototype.interfaces_=function(){return[ap]};za.prototype.getClass=function(){return za};za.isAtomic=function(e){return!(e instanceof to)};var Zo=function(){this._geom=null;var e=arguments[0];this._geom=e};Zo.prototype.locate=function(e){return Zo.locate(e,this._geom)};Zo.prototype.interfaces_=function(){return[Zh]};Zo.prototype.getClass=function(){return Zo};Zo.isPointInRing=function(e,t){return t.getEnvelopeInternal().intersects(e)?ve.isPointInRing(e,t.getCoordinates()):!1};Zo.containsPointInPolygon=function(e,t){if(t.isEmpty())return!1;var n=t.getExteriorRing();if(!Zo.isPointInRing(e,n))return!1;for(var i=0;i=0;u--){var p=n._edgeList.get(u),a=p.getSym();r===null&&(r=a),i!==null&&a.setNext(i),i=p}r.setNext(i)},t.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var i=arguments[0],r=this.findIndex(i),u=i.getDepth(re.LEFT),p=i.getDepth(re.RIGHT),a=this.computeDepths(r+1,this._edgeList.size(),u),_=this.computeDepths(0,r,a);if(_!==p)throw new ml("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var x=arguments[0],S=arguments[1],L=arguments[2],A=L,N=x;N=0;a--){var _=i._resultAreaEdgeList.get(a),x=_.getSym();switch(r===null&&_.getEdgeRing()===n&&(r=_),p){case i._SCANNING_FOR_INCOMING:if(x.getEdgeRing()!==n)continue;u=x,p=i._LINKING_TO_OUTGOING;break;case i._LINKING_TO_OUTGOING:if(_.getEdgeRing()!==n)continue;u.setNextMin(_),p=i._SCANNING_FOR_INCOMING;break}}p===this._LINKING_TO_OUTGOING&&(ln.isTrue(r!==null,"found null for first outgoing dirEdge"),ln.isTrue(r.getEdgeRing()===n,"unable to link last incoming dirEdge"),u.setNextMin(r))},t.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,i=this.iterator();i.hasNext();){var r=i.next();r.isInResult()&&n++}return n}else if(arguments.length===1){for(var u=arguments[0],p=0,a=this.iterator();a.hasNext();){var _=a.next();_.getEdgeRing()===u&&p++}return p}},t.prototype.getLabel=function(){return this._label},t.prototype.findCoveredLineEdges=function(){for(var n=zt.NONE,i=this.iterator();i.hasNext();){var r=i.next(),u=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){n=zt.INTERIOR;break}if(u.isInResult()){n=zt.EXTERIOR;break}}}if(n===zt.NONE)return null;for(var p=n,a=this.iterator();a.hasNext();){var _=a.next(),x=_.getSym();_.isLineEdge()?_.getEdge().setCovered(p===zt.INTERIOR):(_.isInResult()&&(p=zt.EXTERIOR),x.isInResult()&&(p=zt.INTERIOR))}},t.prototype.computeLabelling=function(n){var i=this;e.prototype.computeLabelling.call(this,n),this._label=new Un(zt.NONE);for(var r=this.iterator();r.hasNext();)for(var u=r.next(),p=u.getEdge(),a=p.getLabel(),_=0;_<2;_++){var x=a.getLocation(_);(x===zt.INTERIOR||x===zt.BOUNDARY)&&i._label.setLocation(_,zt.INTERIOR)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(jr),Ax=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.createNode=function(n){return new Mg(n,new PC)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Gh),Ql=function e(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=e.orientation(t)};Ql.prototype.compareTo=function(e){var t=e,n=Ql.compareOriented(this._pts,this._orientation,t._pts,t._orientation);return n};Ql.prototype.interfaces_=function(){return[vs]};Ql.prototype.getClass=function(){return Ql};Ql.orientation=function(e){return yn.increasingDirection(e)===1};Ql.compareOriented=function(e,t,n,i){for(var r=t?1:-1,u=i?1:-1,p=t?e.length:-1,a=i?n.length:-1,_=t?0:e.length-1,x=i?0:n.length-1;;){var S=e[_].compareTo(n[x]);if(S!==0)return S;_+=r,x+=u;var L=_===p,A=x===a;if(L&&!A)return-1;if(!L&&A)return 1;if(L&&A)return 0}};var zs=function(){this._edges=new ce,this._ocaMap=new Ur};zs.prototype.print=function(e){var t=this;e.print("MULTILINESTRING ( ");for(var n=0;n0&&e.print(","),e.print("(");for(var r=i.getCoordinates(),u=0;u0&&e.print(","),e.print(r[u].x+" "+r[u].y);e.println(")")}e.print(") ")};zs.prototype.addAll=function(e){for(var t=this,n=e.iterator();n.hasNext();)t.add(n.next())};zs.prototype.findEdgeIndex=function(e){for(var t=this,n=0;n0||!t.coord.equals2D(r);u||i--;var p=new Array(i).fill(null),a=0;p[a++]=new At(e.coord);for(var _=e.segmentIndex+1;_<=t.segmentIndex;_++)p[a++]=n.edge.pts[_];return u&&(p[a]=t.coord),new ig(p,new Un(this.edge._label))};Ga.prototype.add=function(e,t,n){var i=new da(e,t,n),r=this._nodeMap.get(i);return r!==null?r:(this._nodeMap.put(i,i),i)};Ga.prototype.isIntersection=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();if(n.coord.equals(e))return!0}return!1};Ga.prototype.interfaces_=function(){return[]};Ga.prototype.getClass=function(){return Ga};var Uu=function(){};Uu.prototype.getChainStartIndices=function(e){var t=this,n=0,i=new ce;i.add(new la(n));do{var r=t.findChainEnd(e,n);i.add(new la(r)),n=r}while(nn?t:n};_l.prototype.getMinX=function(e){var t=this.pts[this.startIndex[e]].x,n=this.pts[this.startIndex[e+1]].x;return tn&&(r=1),e._depth[t][i]=r}}};Er.prototype.getDelta=function(e){return this._depth[e][re.RIGHT]-this._depth[e][re.LEFT]};Er.prototype.getLocation=function(e,t){return this._depth[e][t]<=0?zt.EXTERIOR:zt.INTERIOR};Er.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Er.prototype.add=function(){var e=this;if(arguments.length===1)for(var t=arguments[0],n=0;n<2;n++)for(var i=1;i<3;i++){var r=t.getLocation(n,i);(r===zt.EXTERIOR||r===zt.INTERIOR)&&(e.isNull(n,i)?e._depth[n][i]=Er.depthAtLocation(r):e._depth[n][i]+=Er.depthAtLocation(r))}else if(arguments.length===3){var u=arguments[0],p=arguments[1],a=arguments[2];a===zt.INTERIOR&&this._depth[u][p]++}};Er.prototype.interfaces_=function(){return[]};Er.prototype.getClass=function(){return Er};Er.depthAtLocation=function(e){return e===zt.EXTERIOR?0:e===zt.INTERIOR?1:Er.NULL_VALUE};kx.NULL_VALUE.get=function(){return-1};Object.defineProperties(Er,kx);var ig=function(e){function t(){if(e.call(this),this.pts=null,this._env=null,this.eiList=new Ga(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Er,this._depthDelta=0,arguments.length===1){var n=arguments[0];t.call(this,n,null)}else if(arguments.length===2){var i=arguments[0],r=arguments[1];this.pts=i,this._label=r}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getDepth=function(){return this._depth},t.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var i=new t(n,Un.toLineLabel(this._label));return i},t.prototype.isIsolated=function(){return this._isIsolated},t.prototype.getCoordinates=function(){return this.pts},t.prototype.setIsolated=function(n){this._isIsolated=n},t.prototype.setName=function(n){this._name=n},t.prototype.equals=function(n){var i=this;if(!(n instanceof t))return!1;var r=n;if(this.pts.length!==r.pts.length)return!1;for(var u=!0,p=!0,a=this.pts.length,_=0;_0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},t.prototype.print=function(n){var i=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var r=0;r0&&n.print(","),n.print(i.pts[r].x+" "+i.pts[r].y);n.print(") "+this._label+" "+this._depthDelta)},t.prototype.computeIM=function(n){t.updateIM(this._label,n)},t.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},t.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},t.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},t.prototype.getDepthDelta=function(){return this._depthDelta},t.prototype.getNumPoints=function(){return this.pts.length},t.prototype.printReverse=function(n){var i=this;n.print("edge "+this._name+": ");for(var r=this.pts.length-1;r>=0;r--)n.print(i.pts[r]+" ");n.println("")},t.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new _l(this)),this._mce},t.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Re;for(var i=0;i0&&i.append(","),i.append(n.pts[r].x+" "+n.pts[r].y);return i.append(") "+this._label+" "+this._depthDelta),i.toString()},t.prototype.isPointwiseEqual=function(n){var i=this;if(this.pts.length!==n.pts.length)return!1;for(var r=0;ri||this._maxyu;if(p)return!1;var a=this.intersectsToleranceSquare(e,t);return ln.isTrue(!(p&&a),"Found bad envelope test"),a};go.prototype.initCorners=function(e){var t=.5;this._minx=e.x-t,this._maxx=e.x+t,this._miny=e.y-t,this._maxy=e.y+t,this._corner[0]=new At(this._maxx,this._maxy),this._corner[1]=new At(this._minx,this._maxy),this._corner[2]=new At(this._minx,this._miny),this._corner[3]=new At(this._maxx,this._miny)};go.prototype.intersects=function(e,t){return this._scaleFactor===1?this.intersectsScaled(e,t):(this.copyScaled(e,this._p0Scaled),this.copyScaled(t,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};go.prototype.scale=function(e){return Math.round(e*this._scaleFactor)};go.prototype.getCoordinate=function(){return this._originalPt};go.prototype.copyScaled=function(e,t){t.x=this.scale(e.x),t.y=this.scale(e.y)};go.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var e=go.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Re(this._originalPt.x-e,this._originalPt.x+e,this._originalPt.y-e,this._originalPt.y+e)}return this._safeEnv};go.prototype.intersectsPixelClosure=function(e,t){return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.hasIntersection()))};go.prototype.intersectsToleranceSquare=function(e,t){var n=!1,i=!1;return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.isProper())||n&&i||e.equals(this._pt)||t.equals(this._pt))};go.prototype.addSnappedNode=function(e,t){var n=e.getCoordinate(t),i=e.getCoordinate(t+1);return this.intersects(n,i)?(e.addIntersection(this.getCoordinate(),t),!0):!1};go.prototype.interfaces_=function(){return[]};go.prototype.getClass=function(){return go};Dx.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(go,Dx);var nd=function(){this.tempEnv1=new Re,this.selectedSegment=new Oe};nd.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var e=arguments[0],t=arguments[1];e.getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}};nd.prototype.interfaces_=function(){return[]};nd.prototype.getClass=function(){return nd};var Wh=function(){this._index=null;var e=arguments[0];this._index=e},Rx={HotPixelSnapAction:{configurable:!0}};Wh.prototype.snap=function(){if(arguments.length===1){var e=arguments[0];return this.snap(e,null,-1)}else if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2],r=t.getSafeEnvelope(),u=new Ox(t,n,i);return this._index.query(r,{interfaces_:function(){return[Kl]},visitItem:function(p){var a=p;a.select(r,u)}}),u.isNodeAdded()}};Wh.prototype.interfaces_=function(){return[]};Wh.prototype.getClass=function(){return Wh};Rx.HotPixelSnapAction.get=function(){return Ox};Object.defineProperties(Wh,Rx);var Ox=function(e){function t(){e.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],i=arguments[1],r=arguments[2];this._hotPixel=n,this._parentEdge=i,this._hotPixelVertexIndex=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isNodeAdded=function(){return this._isNodeAdded},t.prototype.select=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],r=n.getContext();if(this._parentEdge!==null&&r===this._parentEdge&&i===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,i)}else return e.prototype.select.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(nd),Ec=function(){this._li=null,this._interiorIntersections=null;var e=arguments[0];this._li=e,this._interiorIntersections=new ce};Ec.prototype.processIntersections=function(e,t,n,i){var r=this;if(e===n&&t===i)return null;var u=e.getCoordinates()[t],p=e.getCoordinates()[t+1],a=n.getCoordinates()[i],_=n.getCoordinates()[i+1];if(this._li.computeIntersection(u,p,a,_),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var x=0;x=0;t--){try{e.bufferReducedPrecision(t)}catch(u){if(u instanceof ml)e._saveException=u;else throw u}finally{}if(e._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],i=Sr.precisionScaleFactor(this._argGeom,this._distance,n),r=new Dn(i);this.bufferFixedPrecision(r)}};Sr.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var e=this._argGeom.getFactory().getPrecisionModel();e.getType()===Dn.FIXED?this.bufferFixedPrecision(e):this.bufferReducedPrecision()};Sr.prototype.setQuadrantSegments=function(e){this._bufParams.setQuadrantSegments(e)};Sr.prototype.bufferOriginalPrecision=function(){try{var e=new to(this._bufParams);this._resultGeometry=e.buffer(this._argGeom,this._distance)}catch(t){if(t instanceof fl)this._saveException=t;else throw t}finally{}};Sr.prototype.getResultGeometry=function(e){return this._distance=e,this.computeGeometry(),this._resultGeometry};Sr.prototype.setEndCapStyle=function(e){this._bufParams.setEndCapStyle(e)};Sr.prototype.interfaces_=function(){return[]};Sr.prototype.getClass=function(){return Sr};Sr.bufferOp=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new Sr(e),i=n.getResultGeometry(t);return i}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Ze&&typeof arguments[1]=="number"){var r=arguments[0],u=arguments[1],p=arguments[2],a=new Sr(r);a.setQuadrantSegments(p);var _=a.getResultGeometry(u);return _}else if(arguments[2]instanceof Nn&&arguments[0]instanceof Ze&&typeof arguments[1]=="number"){var x=arguments[0],S=arguments[1],L=arguments[2],A=new Sr(x,L),N=A.getResultGeometry(S);return N}}else if(arguments.length===4){var z=arguments[0],H=arguments[1],Z=arguments[2],K=arguments[3],V=new Sr(z);V.setQuadrantSegments(Z),V.setEndCapStyle(K);var X=V.getResultGeometry(H);return X}};Sr.precisionScaleFactor=function(e,t,n){var i=e.getEnvelopeInternal(),r=Ho.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY())),u=t>0?t:0,p=r+2*u,a=Math.trunc(Math.log(p)/Math.log(10)+1),_=n-a,x=Math.pow(10,_);return x};up.CAP_ROUND.get=function(){return Nn.CAP_ROUND};up.CAP_BUTT.get=function(){return Nn.CAP_FLAT};up.CAP_FLAT.get=function(){return Nn.CAP_FLAT};up.CAP_SQUARE.get=function(){return Nn.CAP_SQUARE};up.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Sr,up);var Jr=function(){this._pt=[new At,new At],this._distance=tn.NaN,this._isNull=!0};Jr.prototype.getCoordinates=function(){return this._pt};Jr.prototype.getCoordinate=function(e){return this._pt[e]};Jr.prototype.setMinimum=function(){if(arguments.length===1){var e=arguments[0];this.setMinimum(e._pt[0],e._pt[1])}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(t,n),null;var i=t.distance(n);ithis._distance&&this.initialize(t,n,i)}};Jr.prototype.interfaces_=function(){return[]};Jr.prototype.getClass=function(){return Jr};var Da=function(){};Da.prototype.interfaces_=function(){return[]};Da.prototype.getClass=function(){return Da};Da.computeDistance=function(){if(arguments[2]instanceof Jr&&arguments[0]instanceof Ti&&arguments[1]instanceof At)for(var e=arguments[0],t=arguments[1],n=arguments[2],i=e.getCoordinates(),r=new Oe,u=0;u0||this._isIn?zt.INTERIOR:zt.EXTERIOR)};Fs.prototype.interfaces_=function(){return[]};Fs.prototype.getClass=function(){return Fs};var Qr=function e(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var t=arguments[0],n=arguments[1];e.call(this,t,e.INSIDE_AREA,n)}else if(arguments.length===3){var i=arguments[0],r=arguments[1],u=arguments[2];this._component=i,this._segIndex=r,this._pt=u}},zx={INSIDE_AREA:{configurable:!0}};Qr.prototype.isInsideArea=function(){return this._segIndex===Qr.INSIDE_AREA};Qr.prototype.getCoordinate=function(){return this._pt};Qr.prototype.getGeometryComponent=function(){return this._component};Qr.prototype.getSegmentIndex=function(){return this._segIndex};Qr.prototype.interfaces_=function(){return[]};Qr.prototype.getClass=function(){return Qr};zx.INSIDE_AREA.get=function(){return-1};Object.defineProperties(Qr,zx);var Wl=function(e){this._pts=e||null};Wl.prototype.filter=function(e){e instanceof Mo&&this._pts.add(e)};Wl.prototype.interfaces_=function(){return[ca]};Wl.prototype.getClass=function(){return Wl};Wl.getPoints=function(){if(arguments.length===1){var e=arguments[0];return e instanceof Mo?Os.singletonList(e):Wl.getPoints(e,new ce)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];return t instanceof Mo?n.add(t):t instanceof eo&&t.apply(new Wl(n)),n}};var Cc=function(){this._locations=null;var e=arguments[0];this._locations=e};Cc.prototype.filter=function(e){(e instanceof Mo||e instanceof Ti||e instanceof er)&&this._locations.add(new Qr(e,0,e.getCoordinate()))};Cc.prototype.interfaces_=function(){return[ca]};Cc.prototype.getClass=function(){return Cc};Cc.getLocations=function(e){var t=new ce;return e.apply(new Cc(t)),t};var Lr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Fs,this._minDistanceLocation=null,this._minDistance=tn.MAX_VALUE,arguments.length===2){var e=arguments[0],t=arguments[1];this._geom=[e,t],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],i=arguments[1],r=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i,this._terminateDistance=r}};Lr.prototype.computeContainmentDistance=function(){var e=this;if(arguments.length===0){var t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],r=1-n,u=pl.getPolygons(this._geom[n]);if(u.size()>0){var p=Cc.getLocations(this._geom[r]);if(this.computeContainmentDistance(p,u,i),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[r]=i[0],this._minDistanceLocation[n]=i[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&We(arguments[0],As)&&We(arguments[1],As)){for(var a=arguments[0],_=arguments[1],x=arguments[2],S=0;Sthis._minDistance)return null;for(var r=t.getCoordinates(),u=n.getCoordinate(),p=0;pthis._minDistance)return null;for(var N=S.getCoordinates(),z=L.getCoordinates(),H=0;Hthis._distance&&this.initialize(t,n,i)}};Br.prototype.interfaces_=function(){return[]};Br.prototype.getClass=function(){return Br};var na=function(){};na.prototype.interfaces_=function(){return[]};na.prototype.getClass=function(){return na};na.computeDistance=function(){if(arguments[2]instanceof Br&&arguments[0]instanceof Ti&&arguments[1]instanceof At)for(var e=arguments[0],t=arguments[1],n=arguments[2],i=new Oe,r=e.getCoordinates(),u=0;u1||e<=0)throw new di("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=e};ds.prototype.compute=function(e,t){this.computeOrientedDistance(e,t,this._ptDist),this.computeOrientedDistance(t,e,this._ptDist)};ds.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};ds.prototype.computeOrientedDistance=function(e,t,n){var i=new Tc(t);if(e.apply(i),n.setMaximum(i.getMaxPointDistance()),this._densifyFrac>0){var r=new eu(t,this._densifyFrac);e.apply(r),n.setMaximum(r.getMaxPointDistance())}};ds.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};ds.prototype.interfaces_=function(){return[]};ds.prototype.getClass=function(){return ds};ds.distance=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new ds(e,t);return n.distance()}else if(arguments.length===3){var i=arguments[0],r=arguments[1],u=arguments[2],p=new ds(i,r);return p.setDensifyFraction(u),p.distance()}};Uy.MaxPointDistanceFilter.get=function(){return Tc};Uy.MaxDensifiedByFractionDistanceFilter.get=function(){return eu};Object.defineProperties(ds,Uy);var Tc=function(){this._maxPtDist=new Br,this._minPtDist=new Br,this._euclideanDist=new na,this._geom=null;var e=arguments[0];this._geom=e};Tc.prototype.filter=function(e){this._minPtDist.initialize(),na.computeDistance(this._geom,e,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Tc.prototype.getMaxPointDistance=function(){return this._maxPtDist};Tc.prototype.interfaces_=function(){return[Fa]};Tc.prototype.getClass=function(){return Tc};var eu=function(){this._maxPtDist=new Br,this._minPtDist=new Br,this._geom=null,this._numSubSegs=0;var e=arguments[0],t=arguments[1];this._geom=e,this._numSubSegs=Math.trunc(Math.round(1/t))};eu.prototype.filter=function(e,t){var n=this;if(t===0)return null;for(var i=e.getCoordinate(t-1),r=e.getCoordinate(t),u=(r.x-i.x)/this._numSubSegs,p=(r.y-i.y)/this._numSubSegs,a=0;an){this._isValid=!1;var r=i.getCoordinates();this._errorLocation=r[1],this._errorIndicator=e.getFactory().createLineString(r),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Ns.toLineString(r[0],r[1])+")"}};Lo.prototype.isValid=function(){var e=Math.abs(this._bufDistance),t=Lo.MAX_DISTANCE_DIFF_FRAC*e;return this._minValidDistance=e-t,this._maxValidDistance=e+t,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Lo.VERBOSE&&Cr.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};Lo.prototype.checkNegativeValid=function(){if(!(this._input instanceof er||this._input instanceof Oa||this._input instanceof eo))return null;var e=this.getPolygonLines(this._input);if(this.checkMinimumDistance(e,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(e,this._result,this._maxValidDistance)};Lo.prototype.getErrorIndicator=function(){return this._errorIndicator};Lo.prototype.checkMinimumDistance=function(e,t,n){var i=new Lr(e,t,n);if(this._minDistanceFound=i.distance(),this._minDistanceFound0&&e>t&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&e=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Mr.prototype.report=function(e){if(!Mr.VERBOSE)return null;Cr.out.println("Check "+e+": "+(this._isValid?"passed":"FAILED"))};Mr.prototype.getErrorMessage=function(){return this._errorMsg};Mr.prototype.interfaces_=function(){return[]};Mr.prototype.getClass=function(){return Mr};Mr.isValidMsg=function(e,t,n){var i=new Mr(e,t,n);return i.isValid()?null:i.getErrorMessage()};Mr.isValid=function(e,t,n){var i=new Mr(e,t,n);return!!i.isValid()};jy.VERBOSE.get=function(){return!1};jy.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Mr,jy);var ga=function(){this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};ga.prototype.getCoordinates=function(){return this._pts};ga.prototype.size=function(){return this._pts.length};ga.prototype.getCoordinate=function(e){return this._pts[e]};ga.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};ga.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:wc.octant(this.getCoordinate(e),this.getCoordinate(e+1))};ga.prototype.setData=function(e){this._data=e};ga.prototype.getData=function(){return this._data};ga.prototype.toString=function(){return Ns.toLineString(new ki(this._pts))};ga.prototype.interfaces_=function(){return[Ua]};ga.prototype.getClass=function(){return ga};var br=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new ce,this._intersectionCount=0,this._keepIntersections=!0;var e=arguments[0];this._li=e,this._interiorIntersection=null};br.prototype.getInteriorIntersection=function(){return this._interiorIntersection};br.prototype.setCheckEndSegmentsOnly=function(e){this._isCheckEndSegmentsOnly=e};br.prototype.getIntersectionSegments=function(){return this._intSegments};br.prototype.count=function(){return this._intersectionCount};br.prototype.getIntersections=function(){return this._intersections};br.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};br.prototype.setKeepIntersections=function(e){this._keepIntersections=e};br.prototype.processIntersections=function(e,t,n,i){if(!this._findAllIntersections&&this.hasIntersection()||e===n&&t===i)return null;if(this._isCheckEndSegmentsOnly){var r=this.isEndSegment(e,t)||this.isEndSegment(n,i);if(!r)return null}var u=e.getCoordinates()[t],p=e.getCoordinates()[t+1],a=n.getCoordinates()[i],_=n.getCoordinates()[i+1];this._li.computeIntersection(u,p,a,_),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=u,this._intSegments[1]=p,this._intSegments[2]=a,this._intSegments[3]=_,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};br.prototype.isEndSegment=function(e,t){return t===0||t>=e.size()-2};br.prototype.hasIntersection=function(){return this._interiorIntersection!==null};br.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};br.prototype.interfaces_=function(){return[Vu]};br.prototype.getClass=function(){return br};br.createAllIntersectionsFinder=function(e){var t=new br(e);return t.setFindAllIntersections(!0),t};br.createAnyIntersectionFinder=function(e){return new br(e)};br.createIntersectionCounter=function(e){var t=new br(e);return t.setFindAllIntersections(!0),t.setKeepIntersections(!1),t};var Bs=function(){this._li=new Wu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var e=arguments[0];this._segStrings=e};Bs.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Bs.prototype.getIntersections=function(){return this._segInt.getIntersections()};Bs.prototype.isValid=function(){return this.execute(),this._isValid};Bs.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};Bs.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new br(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var e=new By;if(e.setSegmentIntersector(this._segInt),e.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Bs.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new ml(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Bs.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var e=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Ns.toLineString(e[0],e[1])+" and "+Ns.toLineString(e[2],e[3])};Bs.prototype.interfaces_=function(){return[]};Bs.prototype.getClass=function(){return Bs};Bs.computeIntersections=function(e){var t=new Bs(e);return t.setFindAllIntersections(!0),t.isValid(),t.getIntersections()};var ju=function e(){this._nv=null;var t=arguments[0];this._nv=new Bs(e.toSegmentStrings(t))};ju.prototype.checkValid=function(){this._nv.checkValid()};ju.prototype.interfaces_=function(){return[]};ju.prototype.getClass=function(){return ju};ju.toSegmentStrings=function(e){for(var t=new ce,n=e.iterator();n.hasNext();){var i=n.next();t.add(new ga(i.getCoordinates(),i))}return t};ju.checkValid=function(e){var t=new ju(e);t.checkValid()};var Lc=function(e){this._mapOp=e};Lc.prototype.map=function(e){for(var t=this,n=new ce,i=0;i0&&i<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};_o.prototype.interfaces_=function(){return[]};_o.prototype.getClass=function(){return _o};var qa=function e(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Oe,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Ti&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];e.call(this,t.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var i=arguments[0],r=arguments[1];this._srcPts=i,this._isClosed=e.isClosed(i),this._snapTolerance=r}};qa.prototype.snapVertices=function(e,t){for(var n=this,i=this._isClosed?e.size()-1:e.size(),r=0;r=0&&e.add(p+1,new At(u),!1)}};qa.prototype.findSegmentIndexToSnap=function(e,t){for(var n=this,i=tn.MAX_VALUE,r=-1,u=0;ut&&(t=i)}return t}else if(arguments.length===2){var r=arguments[0],u=arguments[1];return Math.min(Ni.computeOverlaySnapTolerance(r),Ni.computeOverlaySnapTolerance(u))}};Ni.computeSizeBasedSnapTolerance=function(e){var t=e.getEnvelopeInternal(),n=Math.min(t.getHeight(),t.getWidth()),i=n*Ni.SNAP_PRECISION_FACTOR;return i};Ni.snapToSelf=function(e,t,n){var i=new Ni(e);return i.snapToSelf(t,n)};Fx.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Ni,Fx);var Bx=function(e){function t(n,i,r){e.call(this),this._snapTolerance=n||null,this._snapPts=i||null,this._isSelfSnap=r!==void 0?r:!1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.snapLine=function(n,i){var r=new qa(n,this._snapTolerance);return r.setAllowSnappingToSourceVertices(this._isSelfSnap),r.snapTo(i)},t.prototype.transformCoordinates=function(n,i){var r=n.toCoordinateArray(),u=this.snapLine(r,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(u)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(_o),Kr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Kr.prototype.getCommon=function(){return tn.longBitsToDouble(this._commonBits)};Kr.prototype.add=function(e){var t=tn.doubleToLongBits(e);if(this._isFirst)return this._commonBits=t,this._commonSignExp=Kr.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Kr.signExpBits(t);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Kr.numCommonMostSigMantissaBits(this._commonBits,t),this._commonBits=Kr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Kr.prototype.toString=function(){if(arguments.length===1){var e=arguments[0],t=tn.longBitsToDouble(e),n=tn.toBinaryString(e),i="0000000000000000000000000000000000000000000000000000000000000000"+n,r=i.substring(i.length-64),u=r.substring(0,1)+" "+r.substring(1,12)+"(exp) "+r.substring(12)+" [ "+t+" ]";return u}};Kr.prototype.interfaces_=function(){return[]};Kr.prototype.getClass=function(){return Kr};Kr.getBit=function(e,t){var n=1<>52};Kr.zeroLowerBits=function(e,t){var n=(1<=0;i--){if(Kr.getBit(e,i)!==Kr.getBit(t,i))return n;n++}return 52};var nu=function(){this._commonCoord=null,this._ccFilter=new Pc},qy={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};nu.prototype.addCommonBits=function(e){var t=new iu(this._commonCoord);e.apply(t),e.geometryChanged()};nu.prototype.removeCommonBits=function(e){if(this._commonCoord.x===0&&this._commonCoord.y===0)return e;var t=new At(this._commonCoord);t.x=-t.x,t.y=-t.y;var n=new iu(t);return e.apply(n),e.geometryChanged(),e};nu.prototype.getCommonCoordinate=function(){return this._commonCoord};nu.prototype.add=function(e){e.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};nu.prototype.interfaces_=function(){return[]};nu.prototype.getClass=function(){return nu};qy.CommonCoordinateFilter.get=function(){return Pc};qy.Translater.get=function(){return iu};Object.defineProperties(nu,qy);var Pc=function(){this._commonBitsX=new Kr,this._commonBitsY=new Kr};Pc.prototype.filter=function(e){this._commonBitsX.add(e.x),this._commonBitsY.add(e.y)};Pc.prototype.getCommonCoordinate=function(){return new At(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Pc.prototype.interfaces_=function(){return[Fa]};Pc.prototype.getClass=function(){return Pc};var iu=function(){this.trans=null;var e=arguments[0];this.trans=e};iu.prototype.filter=function(e,t){var n=e.getOrdinate(t,0)+this.trans.x,i=e.getOrdinate(t,1)+this.trans.y;e.setOrdinate(t,0,n),e.setOrdinate(t,1,i)};iu.prototype.isDone=function(){return!1};iu.prototype.isGeometryChanged=function(){return!0};iu.prototype.interfaces_=function(){return[Ds]};iu.prototype.getClass=function(){return iu};var xr=function(e,t){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=e,this._geom[1]=t,this.computeSnapTolerance()};xr.prototype.selfSnap=function(e){var t=new Ni(e),n=t.snapTo(e,this._snapTolerance);return n};xr.prototype.removeCommonBits=function(e){this._cbr=new nu,this._cbr.add(e[0]),this._cbr.add(e[1]);var t=new Array(2).fill(null);return t[0]=this._cbr.removeCommonBits(e[0].copy()),t[1]=this._cbr.removeCommonBits(e[1].copy()),t};xr.prototype.prepareResult=function(e){return this._cbr.addCommonBits(e),e};xr.prototype.getResultGeometry=function(e){var t=this.snap(this._geom),n=an.overlayOp(t[0],t[1],e);return this.prepareResult(n)};xr.prototype.checkValid=function(e){e.isValid()||Cr.out.println("Snapped geometry is invalid")};xr.prototype.computeSnapTolerance=function(){this._snapTolerance=Ni.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};xr.prototype.snap=function(e){var t=this.removeCommonBits(e),n=Ni.snap(t[0],t[1],this._snapTolerance);return n};xr.prototype.interfaces_=function(){return[]};xr.prototype.getClass=function(){return xr};xr.overlayOp=function(e,t,n){var i=new xr(e,t);return i.getResultGeometry(n)};xr.union=function(e,t){return xr.overlayOp(e,t,an.UNION)};xr.intersection=function(e,t){return xr.overlayOp(e,t,an.INTERSECTION)};xr.symDifference=function(e,t){return xr.overlayOp(e,t,an.SYMDIFFERENCE)};xr.difference=function(e,t){return xr.overlayOp(e,t,an.DIFFERENCE)};var ro=function(e,t){this._geom=new Array(2).fill(null),this._geom[0]=e,this._geom[1]=t};ro.prototype.getResultGeometry=function(e){var t=null,n=!1,i=null;try{t=an.overlayOp(this._geom[0],this._geom[1],e);var r=!0;r&&(n=!0)}catch(u){if(u instanceof fl)i=u;else throw u}finally{}if(!n)try{t=xr.overlayOp(this._geom[0],this._geom[1],e)}catch(u){throw u instanceof fl?i:u}finally{}return t};ro.prototype.interfaces_=function(){return[]};ro.prototype.getClass=function(){return ro};ro.overlayOp=function(e,t,n){var i=new ro(e,t);return i.getResultGeometry(n)};ro.union=function(e,t){return ro.overlayOp(e,t,an.UNION)};ro.intersection=function(e,t){return ro.overlayOp(e,t,an.INTERSECTION)};ro.symDifference=function(e,t){return ro.overlayOp(e,t,an.SYMDIFFERENCE)};ro.difference=function(e,t){return ro.overlayOp(e,t,an.DIFFERENCE)};var id=function(){this.mce=null,this.chainIndex=null;var e=arguments[0],t=arguments[1];this.mce=e,this.chainIndex=t};id.prototype.computeIntersections=function(e,t){this.mce.computeIntersectsForChain(this.chainIndex,e.mce,e.chainIndex,t)};id.prototype.interfaces_=function(){return[]};id.prototype.getClass=function(){return id};var ko=function e(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var t=arguments[0],n=arguments[1];this._eventType=e.DELETE,this._xValue=t,this._insertEvent=n}else if(arguments.length===3){var i=arguments[0],r=arguments[1],u=arguments[2];this._eventType=e.INSERT,this._label=i,this._xValue=r,this._obj=u}},Zy={INSERT:{configurable:!0},DELETE:{configurable:!0}};ko.prototype.isDelete=function(){return this._eventType===ko.DELETE};ko.prototype.setDeleteEventIndex=function(e){this._deleteEventIndex=e};ko.prototype.getObject=function(){return this._obj};ko.prototype.compareTo=function(e){var t=e;return this._xValuet._xValue?1:this._eventTypet._eventType?1:0};ko.prototype.getInsertEvent=function(){return this._insertEvent};ko.prototype.isInsert=function(){return this._eventType===ko.INSERT};ko.prototype.isSameLabel=function(e){return this._label===null?!1:this._label===e._label};ko.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};ko.prototype.interfaces_=function(){return[vs]};ko.prototype.getClass=function(){return ko};Zy.INSERT.get=function(){return 1};Zy.DELETE.get=function(){return 2};Object.defineProperties(ko,Zy);var rg=function(){};rg.prototype.interfaces_=function(){return[]};rg.prototype.getClass=function(){return rg};var Pr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var e=arguments[0],t=arguments[1],n=arguments[2];this._li=e,this._includeProper=t,this._recordIsolated=n};Pr.prototype.isTrivialIntersection=function(e,t,n,i){if(e===n&&this._li.getIntersectionNum()===1){if(Pr.isAdjacentSegments(t,i))return!0;if(e.isClosed()){var r=e.getNumPoints()-1;if(t===0&&i===r||i===0&&t===r)return!0}}return!1};Pr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Pr.prototype.setIsDoneIfProperInt=function(e){this._isDoneWhenProperInt=e};Pr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Pr.prototype.isBoundaryPointInternal=function(e,t){for(var n=t.iterator();n.hasNext();){var i=n.next(),r=i.getCoordinate();if(e.isIntersection(r))return!0}return!1};Pr.prototype.hasProperIntersection=function(){return this._hasProper};Pr.prototype.hasIntersection=function(){return this._hasIntersection};Pr.prototype.isDone=function(){return this._isDone};Pr.prototype.isBoundaryPoint=function(e,t){return t===null?!1:!!(this.isBoundaryPointInternal(e,t[0])||this.isBoundaryPointInternal(e,t[1]))};Pr.prototype.setBoundaryNodes=function(e,t){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=e,this._bdyNodes[1]=t};Pr.prototype.addIntersections=function(e,t,n,i){if(e===n&&t===i)return null;this.numTests++;var r=e.getCoordinates()[t],u=e.getCoordinates()[t+1],p=n.getCoordinates()[i],a=n.getCoordinates()[i+1];this._li.computeIntersection(r,u,p,a),this._li.hasIntersection()&&(this._recordIsolated&&(e.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(e,t,n,i)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(e.addIntersections(this._li,t,0),n.addIntersections(this._li,i,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};Pr.prototype.interfaces_=function(){return[]};Pr.prototype.getClass=function(){return Pr};Pr.isAdjacentSegments=function(e,t){return Math.abs(e-t)===1};var AC=function(e){function t(){e.call(this),this.events=new ce,this.nOverlaps=null}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.prepareEvents=function(){var n=this;Os.sort(this.events);for(var i=0;it||this._maxu?1:0};rd.prototype.interfaces_=function(){return[Dh]};rd.prototype.getClass=function(){return rd};var kC=function(e){function t(){e.call(this),this._item=null;var n=arguments[0],i=arguments[1],r=arguments[2];this._min=n,this._max=i,this._item=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.query=function(n,i,r){if(!this.intersects(n,i))return null;r.visitItem(this._item)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Za),NC=function(e){function t(){e.call(this),this._node1=null,this._node2=null;var n=arguments[0],i=arguments[1];this._node1=n,this._node2=i,this.buildExtent(this._node1,this._node2)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.buildExtent=function(n,i){this._min=Math.min(n._min,i._min),this._max=Math.max(n._max,i._max)},t.prototype.query=function(n,i,r){if(!this.intersects(n,i))return null;this._node1!==null&&this._node1.query(n,i,r),this._node2!==null&&this._node2.query(n,i,r)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Za),Wa=function(){this._leaves=new ce,this._root=null,this._level=0};Wa.prototype.buildTree=function(){var e=this;Os.sort(this._leaves,new Za.NodeComparator);for(var t=this._leaves,n=null,i=new ce;;){if(e.buildLevel(t,i),i.size()===1)return i.get(0);n=t,t=i,i=n}};Wa.prototype.insert=function(e,t,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new kC(e,t,n))};Wa.prototype.query=function(e,t,n){this.init(),this._root.query(e,t,n)};Wa.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};Wa.prototype.printNode=function(e){Cr.out.println(Ns.toLineString(new At(e._min,this._level),new At(e._max,this._level)))};Wa.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};Wa.prototype.buildLevel=function(e,t){this._level++,t.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,i[0]),this.insertBoundaryPoint(this._argIndex,i[i.length-1])},t.prototype.getInvalidPoint=function(){return this._invalidPoint},t.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),i=new Array(n.size()).fill(null),r=0,u=n.iterator();u.hasNext();){var p=u.next();i[r++]=p.getCoordinate().copy()}return i},t.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},t.prototype.addSelfIntersectionNode=function(n,i,r){if(this.isBoundaryNode(n,i))return null;r===zt.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,i):this.insertPoint(n,i,r)},t.prototype.addPolygonRing=function(n,i,r){if(n.isEmpty())return null;var u=yn.removeRepeatedPoints(n.getCoordinates());if(u.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=u[0],null;var p=i,a=r;ve.isCCW(u)&&(p=r,a=i);var _=new ig(u,new Un(this._argIndex,zt.BOUNDARY,p,a));this._lineEdgeMap.put(n,_),this.insertEdge(_),this.insertPoint(this._argIndex,u[0],zt.BOUNDARY)},t.prototype.insertPoint=function(n,i,r){var u=this._nodes.addNode(i),p=u.getLabel();p===null?u._label=new Un(n,r):p.setLocation(n,r)},t.prototype.createEdgeSetIntersector=function(){return new AC},t.prototype.addSelfIntersectionNodes=function(n){for(var i=this,r=this._edges.iterator();r.hasNext();)for(var u=r.next(),p=u.getLabel().getLocation(n),a=u.eiList.iterator();a.hasNext();){var _=a.next();i.addSelfIntersectionNode(n,_.coord,p)}},t.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof Oa&&(this._useBoundaryDeterminationRule=!1),n instanceof er)this.addPolygon(n);else if(n instanceof Ti)this.addLineString(n);else if(n instanceof Mo)this.addPoint(n);else if(n instanceof Uh)this.addCollection(n);else if(n instanceof zu)this.addCollection(n);else if(n instanceof Oa)this.addCollection(n);else if(n instanceof eo)this.addCollection(n);else throw new Error(n.getClass().getName())}else return e.prototype.add.apply(this,arguments)},t.prototype.addCollection=function(n){for(var i=this,r=0;r50?(this._areaPtLocator===null&&(this._areaPtLocator=new Hh(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},t.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return e.prototype.findEdge.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.determineBoundary=function(n,i){return n.isInBoundary(i)?zt.BOUNDARY:zt.INTERIOR},t}(bi),Kh=function(){if(this._li=new Wu,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var e=arguments[0];this.setComputationPrecision(e.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new xf(0,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],i=ms.OGC_SFS_BOUNDARY_RULE;t.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(t.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new xf(0,t,i),this._arg[1]=new xf(1,n,i)}else if(arguments.length===3){var r=arguments[0],u=arguments[1],p=arguments[2];r.getPrecisionModel().compareTo(u.getPrecisionModel())>=0?this.setComputationPrecision(r.getPrecisionModel()):this.setComputationPrecision(u.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new xf(0,r,p),this._arg[1]=new xf(1,u,p)}};Kh.prototype.getArgGeometry=function(e){return this._arg[e].getGeometry()};Kh.prototype.setComputationPrecision=function(e){this._resultPrecisionModel=e,this._li.setPrecisionModel(this._resultPrecisionModel)};Kh.prototype.interfaces_=function(){return[]};Kh.prototype.getClass=function(){return Kh};var Nu=function(){};Nu.prototype.interfaces_=function(){return[]};Nu.prototype.getClass=function(){return Nu};Nu.map=function(){if(arguments[0]instanceof Ze&&We(arguments[1],Nu.MapOp)){for(var e=arguments[0],t=arguments[1],n=new ce,i=0;i=e.size()?null:e.get(t)};ji.union=function(e){var t=new ji(e);return t.union()};Gx.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(ji,Gx);var og=function(){};og.prototype.interfaces_=function(){return[]};og.prototype.getClass=function(){return og};og.union=function(e,t){if(e.isEmpty()||t.isEmpty()){if(e.isEmpty()&&t.isEmpty())return an.createEmptyResult(an.UNION,e,t,e.getFactory());if(e.isEmpty())return t.copy();if(t.isEmpty())return e.copy()}return e.checkNotGeometryCollection(e),e.checkNotGeometryCollection(t),ro.overlayOp(e,t,an.UNION)};function Xu(){return new sg}function sg(){this.reset()}sg.prototype={constructor:sg,reset:function(){this.s=this.t=0},add:function(e){_1(km,e,this.t),_1(this,km.s,this.s),this.s?this.t+=km.t:this.s=km.t},valueOf:function(){return this.s}};var km=new sg;function _1(e,t,n){var i=e.s=t+n,r=i-t,u=i-r;e.t=t-u+(n-r)}var Ci=1e-6,Jn=Math.PI,hl=Jn/2,y1=Jn/4,yl=Jn*2,Tu=180/Jn,$s=Jn/180,$r=Math.abs,DC=Math.atan,Qh=Math.atan2,Ki=Math.cos,Ji=Math.sin,cp=Math.sqrt;function jx(e){return e>1?0:e<-1?Jn:Math.acos(e)}function Ac(e){return e>1?hl:e<-1?-hl:Math.asin(e)}function kf(){}function ag(e,t){e&&b1.hasOwnProperty(e.type)&&b1[e.type](e,t)}var v1={Feature:function(e,t){ag(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,i=-1,r=n.length;++iJn?e-yl:e<-Jn?e+yl:e,t]}by.invert=by;function OC(e,t,n){return(e%=yl)?t||n?qx(S1(e),E1(t,n)):S1(e):t||n?E1(t,n):by}function w1(e){return function(t,n){return t+=e,[t>Jn?t-yl:t<-Jn?t+yl:t,n]}}function S1(e){var t=w1(e);return t.invert=w1(-e),t}function E1(e,t){var n=Ki(e),i=Ji(e),r=Ki(t),u=Ji(t);function p(a,_){var x=Ki(_),S=Ki(a)*x,L=Ji(a)*x,A=Ji(_),N=A*n+S*i;return[Qh(L*r-N*u,S*n-A*i),Ac(N*r+L*u)]}return p.invert=function(a,_){var x=Ki(_),S=Ki(a)*x,L=Ji(a)*x,A=Ji(_),N=A*r-L*u;return[Qh(L*r+A*u,S*n+N*i),Ac(N*n-S*i)]},p}function zC(e,t,n,i,r,u){if(n){var p=Ki(t),a=Ji(t),_=i*n;r==null?(r=t+i*yl,u=t-_/2):(r=I1(p,r),u=I1(p,u),(i>0?ru)&&(r+=i*yl));for(var x,S=r;i>0?S>u:S1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function FC(e,t,n,i,r,u){var p=e[0],a=e[1],_=t[0],x=t[1],S=0,L=1,A=_-p,N=x-a,z;if(z=n-p,!(!A&&z>0)){if(z/=A,A<0){if(z0){if(z>L)return;z>S&&(S=z)}if(z=r-p,!(!A&&z<0)){if(z/=A,A<0){if(z>L)return;z>S&&(S=z)}else if(A>0){if(z0)){if(z/=N,N<0){if(z0){if(z>L)return;z>S&&(S=z)}if(z=u-a,!(!N&&z<0)){if(z/=N,N<0){if(z>L)return;z>S&&(S=z)}else if(N>0){if(z0&&(e[0]=p+S*A,e[1]=a+S*N),L<1&&(t[0]=p+L*A,t[1]=a+L*N),!0}}}}}function jm(e,t){return $r(e[0]-t[0])=0;--a)r.point((L=S[a])[0],L[1]);else i(A.x,A.p.x,-1,r);A=A.p}A=A.o,S=A.z,N=!N}while(!A.v);r.lineEnd()}}}function C1(e){if(t=e.length){for(var t,n=0,i=e[0],r;++nt?1:e>=t?0:NaN}function BC(e){return e.length===1&&(e=VC(e)),{left:function(t,n,i,r){for(i==null&&(i=0),r==null&&(r=t.length);i>>1;e(t[u],n)<0?i=u+1:r=u}return i},right:function(t,n,i,r){for(i==null&&(i=0),r==null&&(r=t.length);i>>1;e(t[u],n)>0?r=u:i=u+1}return i}}}function VC(e){return function(t,n){return Xx(e(t),n)}}BC(Xx);function Hx(e){for(var t=e.length,n,i=-1,r=0,u,p;++i=0;)for(p=e[t],n=p.length;--n>=0;)u[--r]=p[n];return u}var Nf=1e9,Om=-Nf;function UC(e,t,n,i){function r(x,S){return e<=x&&x<=n&&t<=S&&S<=i}function u(x,S,L,A){var N=0,z=0;if(x==null||(N=p(x,L))!==(z=p(S,L))||_(x,S)<0^L>0)do A.point(N===0||N===3?e:n,N>1?i:t);while((N=(N+L+4)%4)!==z);else A.point(S[0],S[1])}function p(x,S){return $r(x[0]-e)0?0:3:$r(x[0]-n)0?2:1:$r(x[1]-t)0?1:0:S>0?3:2}function a(x,S){return _(x.x,S.x)}function _(x,S){var L=p(x,1),A=p(S,1);return L!==A?L-A:L===0?S[1]-x[1]:L===1?x[0]-S[0]:L===2?x[1]-S[1]:S[0]-x[0]}return function(x){var S=x,L=Zx(),A,N,z,H,Z,K,V,X,Q,it,ht,ut={point:gt,lineStart:yt,lineEnd:he,polygonStart:Lt,polygonEnd:bt};function gt(Gt,Yt){r(Gt,Yt)&&S.point(Gt,Yt)}function at(){for(var Gt=0,Yt=0,we=N.length;Yti&&(mn-Ve)*(i-Ge)>(Qn-Ge)*(e-Ve)&&++Gt:Qn<=i&&(mn-Ve)*(i-Ge)<(Qn-Ge)*(e-Ve)&&--Gt;return Gt}function Lt(){S=L,A=[],N=[],ht=!0}function bt(){var Gt=at(),Yt=ht&&Gt,we=(A=Hx(A)).length;(Yt||we)&&(x.polygonStart(),Yt&&(x.lineStart(),u(null,null,1,x),x.lineEnd()),we&&Wx(A,a,Gt,u,x),x.polygonEnd()),S=x,A=N=z=null}function yt(){ut.point=Nt,N&&N.push(z=[]),it=!0,Q=!1,V=X=NaN}function he(){A&&(Nt(H,Z),K&&Q&&L.rejoin(),A.push(L.result())),ut.point=gt,Q&&S.lineEnd()}function Nt(Gt,Yt){var we=r(Gt,Yt);if(N&&z.push([Gt,Yt]),it)H=Gt,Z=Yt,K=we,it=!1,we&&(S.lineStart(),S.point(Gt,Yt));else if(we&&Q)S.point(Gt,Yt);else{var me=[V=Math.max(Om,Math.min(Nf,V)),X=Math.max(Om,Math.min(Nf,X))],Ye=[Gt=Math.max(Om,Math.min(Nf,Gt)),Yt=Math.max(Om,Math.min(Nf,Yt))];FC(me,Ye,e,t,n,i)?(Q||(S.lineStart(),S.point(me[0],me[1])),S.point(Ye[0],Ye[1]),we||S.lineEnd(),ht=!1):we&&(S.lineStart(),S.point(Gt,Yt),ht=!1)}V=Gt,X=Yt,Q=we}return ut}}var Y_=Xu();function GC(e,t){var n=t[0],i=t[1],r=[Ji(n),-Ki(n),0],u=0,p=0;Y_.reset();for(var a=0,_=e.length;a<_;++a)if(S=(x=e[a]).length)for(var x,S,L=x[S-1],A=L[0],N=L[1]/2+y1,z=Ji(N),H=Ki(N),Z=0;Z=0?1:-1,gt=ut*ht,at=gt>Jn,Lt=z*Q;if(Y_.add(Qh(Lt*ut*Ji(gt),H*it+Lt*Ki(gt))),u+=at?ht+ut*yl:ht,at^A>=n^V>=n){var bt=lg($h(L),$h(K));vy(bt);var yt=lg(r,bt);vy(yt);var he=(at^ht>=0?-1:1)*Ac(yt[2]);(i>he||i===he&&(bt[0]||bt[1]))&&(p+=at^ht>=0?1:-1)}}return(u<-Ci||uod&&(od=e),tcg&&(cg=t)}Xu();function Yx(e,t,n,i){return function(r,u){var p=t(u),a=r.invert(i[0],i[1]),_=Zx(),x=t(_),S=!1,L,A,N,z={point:H,lineStart:K,lineEnd:V,polygonStart:function(){z.point=X,z.lineStart=Q,z.lineEnd=it,A=[],L=[]},polygonEnd:function(){z.point=H,z.lineStart=K,z.lineEnd=V,A=Hx(A);var ht=GC(L,a);A.length?(S||(u.polygonStart(),S=!0),Wx(A,ZC,ht,n,u)):ht&&(S||(u.polygonStart(),S=!0),u.lineStart(),n(null,null,1,u),u.lineEnd()),S&&(u.polygonEnd(),S=!1),A=L=null},sphere:function(){u.polygonStart(),u.lineStart(),n(null,null,1,u),u.lineEnd(),u.polygonEnd()}};function H(ht,ut){var gt=r(ht,ut);e(ht=gt[0],ut=gt[1])&&u.point(ht,ut)}function Z(ht,ut){var gt=r(ht,ut);p.point(gt[0],gt[1])}function K(){z.point=Z,p.lineStart()}function V(){z.point=H,p.lineEnd()}function X(ht,ut){N.push([ht,ut]);var gt=r(ht,ut);x.point(gt[0],gt[1])}function Q(){x.lineStart(),N=[]}function it(){X(N[0][0],N[0][1]),x.lineEnd();var ht=x.clean(),ut=_.result(),gt,at=ut.length,Lt,bt,yt;if(N.pop(),L.push(N),N=null,!!at){if(ht&1){if(bt=ut[0],(Lt=bt.length-1)>0){for(S||(u.polygonStart(),S=!0),u.lineStart(),gt=0;gt1&&ht&2&&ut.push(ut.pop().concat(ut.shift())),A.push(ut.filter(qC))}}return z}}function qC(e){return e.length>1}function ZC(e,t){return((e=e.x)[0]<0?e[1]-hl-Ci:hl-e[1])-((t=t.x)[0]<0?t[1]-hl-Ci:hl-t[1])}const M1=Yx(function(){return!0},WC,HC,[-Jn,-hl]);function WC(e){var t=NaN,n=NaN,i=NaN,r;return{lineStart:function(){e.lineStart(),r=1},point:function(u,p){var a=u>0?Jn:-Jn,_=$r(u-t);$r(_-Jn)0?hl:-hl),e.point(i,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(u,n),r=0):i!==a&&_>=Jn&&($r(t-i)Ci?DC((Ji(t)*(u=Ki(i))*Ji(n)-Ji(i)*(r=Ki(t))*Ji(e))/(r*u*p)):(t+i)/2}function HC(e,t,n,i){var r;if(e==null)r=n*hl,i.point(-Jn,r),i.point(0,r),i.point(Jn,r),i.point(Jn,0),i.point(Jn,-r),i.point(0,-r),i.point(-Jn,-r),i.point(-Jn,0),i.point(-Jn,r);else if($r(e[0]-t[0])>Ci){var u=e[0]0,r=$r(n)>Ci;function u(S,L,A,N){zC(N,e,t,A,S,L)}function p(S,L){return Ki(S)*Ki(L)>n}function a(S){var L,A,N,z,H;return{lineStart:function(){z=N=!1,H=1},point:function(Z,K){var V=[Z,K],X,Q=p(Z,K),it=i?Q?0:x(Z,K):Q?x(Z+(Z<0?Jn:-Jn),K):0;if(!L&&(z=N=Q)&&S.lineStart(),Q!==N&&(X=_(L,V),(!X||jm(L,X)||jm(V,X))&&(V[0]+=Ci,V[1]+=Ci,Q=p(V[0],V[1]))),Q!==N)H=0,Q?(S.lineStart(),X=_(V,L),S.point(X[0],X[1])):(X=_(L,V),S.point(X[0],X[1]),S.lineEnd()),L=X;else if(r&&L&&i^Q){var ht;!(it&A)&&(ht=_(V,L,!0))&&(H=0,i?(S.lineStart(),S.point(ht[0][0],ht[0][1]),S.point(ht[1][0],ht[1][1]),S.lineEnd()):(S.point(ht[1][0],ht[1][1]),S.lineEnd(),S.lineStart(),S.point(ht[0][0],ht[0][1])))}Q&&(!L||!jm(L,V))&&S.point(V[0],V[1]),L=V,N=Q,A=it},lineEnd:function(){N&&S.lineEnd(),L=null},clean:function(){return H|(z&&N)<<1}}}function _(S,L,A){var N=$h(S),z=$h(L),H=[1,0,0],Z=lg(N,z),K=Nm(Z,Z),V=Z[0],X=K-V*V;if(!X)return!A&&S;var Q=n*K/X,it=-n*V/X,ht=lg(H,Z),ut=Dm(H,Q),gt=Dm(Z,it);H_(ut,gt);var at=ht,Lt=Nm(ut,at),bt=Nm(at,at),yt=Lt*Lt-bt*(Nm(ut,ut)-1);if(!(yt<0)){var he=cp(yt),Nt=Dm(at,(-Lt-he)/bt);if(H_(Nt,ut),Nt=yy(Nt),!A)return Nt;var Gt=S[0],Yt=L[0],we=S[1],me=L[1],Ye;Yt0^Nt[1]<($r(Nt[0]-Gt)Jn^(Gt<=Nt[0]&&Nt[0]<=Yt)){var Ge=Dm(at,(-Lt+he)/bt);return H_(Ge,ut),[Nt,yy(Ge)]}}}function x(S,L){var A=i?e:Jn-e,N=0;return S<-A?N|=1:S>A&&(N|=2),L<-A?N|=4:L>A&&(N|=8),N}return Yx(p,a,u,i?[0,-e]:[-Jn,e-Jn])}function Kx(e){return function(t){var n=new xy;for(var i in e)n[i]=e[i];return n.stream=t,n}}function xy(){}xy.prototype={constructor:xy,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Jx(e,t,n){var i=t[1][0]-t[0][0],r=t[1][1]-t[0][1],u=e.clipExtent&&e.clipExtent();e.scale(150).translate([0,0]),u!=null&&e.clipExtent(null),RC(n,e.stream(L1));var p=L1.result(),a=Math.min(i/(p[1][0]-p[0][0]),r/(p[1][1]-p[0][1])),_=+t[0][0]+(i-a*(p[1][0]+p[0][0]))/2,x=+t[0][1]+(r-a*(p[1][1]+p[0][1]))/2;return u!=null&&e.clipExtent(u),e.scale(a*150).translate([_,x])}function KC(e,t,n){return Jx(e,[[0,0],t],n)}var P1=16,JC=Ki(30*$s);function A1(e,t){return+t?$C(e,t):QC(e)}function QC(e){return Kx({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function $C(e,t){function n(i,r,u,p,a,_,x,S,L,A,N,z,H,Z){var K=x-i,V=S-r,X=K*K+V*V;if(X>4*t&&H--){var Q=p+A,it=a+N,ht=_+z,ut=cp(Q*Q+it*it+ht*ht),gt=Ac(ht/=ut),at=$r($r(ht)-1)t||$r((K*he+V*Nt)/X-.5)>.3||p*A+a*N+_*z2?Nt[2]%360*$s:0,yt()):[x*Tu,S*Tu,L*Tu]},at.precision=function(Nt){return arguments.length?(ht=A1(bt,it=Nt*Nt),he()):cp(it)},at.fitExtent=function(Nt,Gt){return Jx(at,Nt,Gt)},at.fitSize=function(Nt,Gt){return KC(at,Nt,Gt)};function yt(){N=qx(A=OC(x,S,L),t);var Nt=t(a,_);return u=i-Nt[0]*n,p=r+Nt[1]*n,he()}function he(){return ut=gt=null,at}return function(){return t=e.apply(this,arguments),at.invert=t.invert&&Lt,yt()}}function Qx(e){return function(t,n){var i=Ki(t),r=Ki(n),u=e(i*r);return[u*r*Ji(t),u*Ji(n)]}}function $x(e){return function(t,n){var i=cp(t*t+n*n),r=e(i),u=Ji(r),p=Ki(r);return[Qh(t*u,i*p),Ac(i&&n*u/i)]}}var iT=Qx(function(e){return cp(2/(1+e))});iT.invert=$x(function(e){return 2*Ac(e/2)});var tw=Qx(function(e){return(e=jx(e))&&e/Ji(e)});tw.invert=$x(function(e){return e});function rT(){return eT(tw).scale(79.4188).clipAngle(180-.001)}function k1(e,t){return[e,t]}k1.invert=k1;function oT(e,t,n){n=n||{};var i=n.units||"kilometers",r=n.steps||8;if(!e)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof r!="number")throw new Error("steps must be an number");if(t===void 0)throw new Error("radius is required");if(r<=0)throw new Error("steps must be greater than 0");var u=[];switch(e.type){case"GeometryCollection":return mx(e,function(p){var a=qm(p,t,i,r);a&&u.push(a)}),dy(u);case"FeatureCollection":return p1(e,function(p){var a=qm(p,t,i,r);a&&p1(a,function(_){_&&u.push(_)})}),dy(u)}return qm(e,t,i,r)}function qm(e,t,n,i){var r=e.properties||{},u=e.type==="Feature"?e.geometry:e;if(u.type==="GeometryCollection"){var p=[];return mx(e,function(H){var Z=qm(H,t,n,i);Z&&p.push(Z)}),dy(p)}var a=sT(u),_={type:u.type,coordinates:nw(u.coordinates,a)},x=new Fy,S=x.read(_),L=fC(dC(t,n),"meters"),A=Sr.bufferOp(S,L,i),N=new Ix;if(A=N.write(A),!ew(A.coordinates)){var z={type:A.type,coordinates:iw(A.coordinates,a)};return yg(z,r)}}function ew(e){return Array.isArray(e[0])?ew(e[0]):isNaN(e[0])}function nw(e,t){return typeof e[0]!="object"?t(e):e.map(function(n){return nw(n,t)})}function iw(e,t){return typeof e[0]!="object"?t.invert(e):e.map(function(n){return iw(n,t)})}function sT(e){var t=gC(e).geometry.coordinates,n=[-t[0],-t[1]];return rT().rotate(n).scale(jo)}function aT(e,t){var n=tg(e),i=tg(t),r=e.properties||{},u=cx.difference(n.coordinates,i.coordinates);return u.length===0?null:u.length===1?px(u[0],r):fx(u,r)}function N1(e){let t;for(const n of e)t&&n[0]-t[0]>=180?n[0]-=360:t&&n[0]-t[0]<-180&&(n[0]+=360),t=n}function D1(e,t){const n=aT({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},e);if(!n)return;n.properties={isMask:"y"};const i=oT(e,0);if(i.geometry.type==="Polygon")for(const r of i.geometry.coordinates)N1(r);else for(const r of i.geometry.coordinates)for(const u of r)N1(u);t({type:"FeatureCollection",features:[i,n]})}let R1={type:"FeatureCollection",features:[]};function lT(e,t,n=!0,i=!0,r={},u={},p={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"]]}}){let a,_=[],x,S;function L(){(p!=null&&p.fill||p!=null&&p.line)&&e.addSource("full-geom",{type:"geojson",data:R1}),p!=null&&p.fill&&e.addLayer({...p==null?void 0:p.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),p!=null&&p.line&&e.addLayer({...p==null?void 0:p.line,id:"full-geom-line",type:"line",source:"full-geom"})}e.loaded()?L():e.once("load",()=>{L()});const A=z=>{a==null||a({type:"mapClick",coordinates:[z.lngLat.lng,z.lngLat.lat]})};function N(z=!1){if(!t)throw new Error;const H=document.createElement("div");return z&&H.classList.add("marker-interactive"),new zI({props:{displayIn:"maplibre"},target:H}),new t.Marker({element:H,offset:[1,-13]})}return{setEventHandler(z){z?(a=z,e.on("click",A)):(a=void 0,e.off("click",A))},flyTo(z,H){e.flyTo({center:z,zoom:H,...r})},fitBounds(z,H,Z){e.fitBounds([[z[0],z[1]],[z[2],z[3]]],{padding:H,maxZoom:Z,...u})},indicateReverse(z){e.getCanvasContainer().style.cursor=z?"crosshair":""},setReverseMarker(z){!t||!n||(S?z?S.setLngLat(z):(S.remove(),S=void 0):z&&(S=(typeof n=="object"?new t.Marker(n):N()).setLngLat(z).addTo(e),S.getElement().classList.add("marker-reverse")))},setMarkers(z,H){if(!n)return;function Z(K){var V;(V=e.getSource("full-geom"))==null||V.setData(K)}for(const K of _)K.remove();if(_.length=0,Z(R1),!!t){if(H){let K=!1;if(H.geometry.type==="GeometryCollection"){const V=H.geometry.geometries.filter(X=>X.type==="Polygon"||X.type==="MultiPolygon");if(V.length>0){let X=V.pop();for(const Q of V)X=mC(X,Q);D1({...H,geometry:X},Z),K=!0}else{const X=H.geometry.geometries.filter(Q=>Q.type==="LineString"||Q.type==="MultiLineString");X.length>0&&(Z({...H,geometry:{type:"GeometryCollection",geometries:X}}),K=!0)}}if(!K){if(H.geometry.type==="Polygon"||H.geometry.type==="MultiPolygon")D1(H,Z);else if(H.geometry.type==="LineString"||H.geometry.type==="MultiLineString"){Z(H);return}}n&&_.push((typeof n=="object"?new t.Marker(n):N()).setLngLat(H.center).addTo(e))}if(i)for(const K of z??[]){if(K===H)continue;const V=(typeof i=="object"?new t.Marker(i):N(!0)).setLngLat(K.center).setPopup(new t.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(K.place_type[0]==="reverse"?K.place_name:K.place_name.replace(/,.*/,""))).addTo(e),X=V.getElement();X.addEventListener("click",Q=>{Q.stopPropagation(),a==null||a({type:"markerClick",id:K.id})}),X.addEventListener("mouseenter",()=>{a==null||a({type:"markerMouseEnter",id:K.id}),V.togglePopup()}),X.addEventListener("mouseleave",()=>{a==null||a({type:"markerMouseLeave",id:K.id}),V.togglePopup()}),_.push(V)}}},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=e.getCenter();return[e.getZoom(),z.lng,z.lat]}}}function uT(e){let t,n;return{c(){t=Zl("svg"),n=Zl("path"),kt(n,"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"),kt(t,"viewBox","0 0 14 14"),kt(t,"width","13"),kt(t,"height","13"),kt(t,"class","svelte-en2qvf")},m(i,r){Rt(i,t,r),dt(t,n)},p:Pe,i:Pe,o:Pe,d(i){i&&Dt(t)}}}class rw extends cn{constructor(t){super(),un(this,t,null,uT,en,{})}}function cT(e){let t,n;return{c(){t=Zl("svg"),n=Zl("path"),kt(n,"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"),kt(t,"viewBox","0 0 30 30"),kt(t,"fill","none"),kt(t,"xmlns","http://www.w3.org/2000/svg"),kt(t,"class","svelte-d2loi5")},m(i,r){Rt(i,t,r),dt(t,n)},p:Pe,i:Pe,o:Pe,d(i){i&&Dt(t)}}}class ow extends cn{constructor(t){super(),un(this,t,null,cT,en,{})}}function hT(e){let t,n;return{c(){t=vt("img"),Tr(t.src,n=e[3]+"area.svg")||kt(t,"src",n),kt(t,"alt",e[6]),kt(t,"class","svelte-ltkwvy")},m(i,r){Rt(i,t,r)},p(i,r){r&8&&!Tr(t.src,n=i[3]+"area.svg")&&kt(t,"src",n),r&64&&kt(t,"alt",i[6])},d(i){i&&Dt(t)}}}function pT(e){let t,n;return{c(){t=vt("img"),Tr(t.src,n=e[3]+"reverse.svg")||kt(t,"src",n),kt(t,"alt",e[6]),kt(t,"class","svelte-ltkwvy")},m(i,r){Rt(i,t,r)},p(i,r){r&8&&!Tr(t.src,n=i[3]+"reverse.svg")&&kt(t,"src",n),r&64&&kt(t,"alt",i[6])},d(i){i&&Dt(t)}}}function fT(e){let t,n;return{c(){t=vt("img"),Tr(t.src,n=e[3]+"poi.svg")||kt(t,"src",n),kt(t,"alt",e[6]),kt(t,"class","svelte-ltkwvy")},m(i,r){Rt(i,t,r)},p(i,r){r&8&&!Tr(t.src,n=i[3]+"poi.svg")&&kt(t,"src",n),r&64&&kt(t,"alt",i[6])},d(i){i&&Dt(t)}}}function dT(e){let t,n;return{c(){t=vt("img"),Tr(t.src,n=e[3]+"postal_code.svg")||kt(t,"src",n),kt(t,"alt",e[6]),kt(t,"class","svelte-ltkwvy")},m(i,r){Rt(i,t,r)},p(i,r){r&8&&!Tr(t.src,n=i[3]+"postal_code.svg")&&kt(t,"src",n),r&64&&kt(t,"alt",i[6])},d(i){i&&Dt(t)}}}function mT(e){let t,n;return{c(){t=vt("img"),Tr(t.src,n=e[3]+"street.svg")||kt(t,"src",n),kt(t,"alt",e[6]),kt(t,"class","svelte-ltkwvy")},m(i,r){Rt(i,t,r)},p(i,r){r&8&&!Tr(t.src,n=i[3]+"street.svg")&&kt(t,"src",n),r&64&&kt(t,"alt",i[6])},d(i){i&&Dt(t)}}}function gT(e){let t,n;return{c(){t=vt("img"),Tr(t.src,n=e[3]+"road.svg")||kt(t,"src",n),kt(t,"alt",e[6]),kt(t,"class","svelte-ltkwvy")},m(i,r){Rt(i,t,r)},p(i,r){r&8&&!Tr(t.src,n=i[3]+"road.svg")&&kt(t,"src",n),r&64&&kt(t,"alt",i[6])},d(i){i&&Dt(t)}}}function _T(e){let t,n;return{c(){t=vt("img"),Tr(t.src,n=e[3]+"housenumber.svg")||kt(t,"src",n),kt(t,"alt",e[6]),kt(t,"class","svelte-ltkwvy")},m(i,r){Rt(i,t,r)},p(i,r){r&8&&!Tr(t.src,n=i[3]+"housenumber.svg")&&kt(t,"src",n),r&64&&kt(t,"alt",i[6])},d(i){i&&Dt(t)}}}function yT(e){let t,n,i,r;return{c(){t=vt("img"),Tr(t.src,n=e[5])||kt(t,"src",n),kt(t,"alt",e[4]),kt(t,"class","svelte-ltkwvy")},m(u,p){Rt(u,t,p),i||(r=be(t,"error",e[14]),i=!0)},p(u,p){p&32&&!Tr(t.src,n=u[5])&&kt(t,"src",n),p&16&&kt(t,"alt",u[4])},d(u){u&&Dt(t),i=!1,r()}}}function O1(e){let t,n;return{c(){t=vt("span"),n=He(e[6]),kt(t,"class","secondary svelte-ltkwvy")},m(i,r){Rt(i,t,r),dt(t,n)},p(i,r){r&64&&qi(n,i[6])},d(i){i&&Dt(t)}}}function vT(e){var ut,gt;let t,n,i,r,u,p,a,_,x=(e[7]?e[0].place_name:e[0].place_name.replace(/,.*/,""))+"",S,L,A=e[2]==="always"||e[2]&&!e[0].address&&((ut=e[0].properties)==null?void 0:ut.kind)!=="road"&&((gt=e[0].properties)==null?void 0:gt.kind)!=="road_relation"&&!e[0].id.startsWith("address.")&&!e[0].id.startsWith("postal_code.")&&(!e[0].id.startsWith("poi.")||!e[5])&&!e[7],N,z,H=(e[7]?"":e[0].place_name.replace(/[^,]*,?\s*/,""))+"",Z,K,V;function X(at,Lt){var bt,yt;return Lt&1&&(n=null),Lt&1&&(i=null),Lt&1&&(r=null),at[5]?yT:at[0].address?_T:((bt=at[0].properties)==null?void 0:bt.kind)==="road"||((yt=at[0].properties)==null?void 0:yt.kind)==="road_relation"?gT:(n==null&&(n=!!at[0].id.startsWith("address.")),n?mT:(i==null&&(i=!!at[0].id.startsWith("postal_code.")),i?dT:(r==null&&(r=!!at[0].id.startsWith("poi.")),r?fT:at[7]?pT:hT)))}let Q=X(e,-1),it=Q(e),ht=A&&O1(e);return{c(){t=vt("li"),it.c(),u=Jt(),p=vt("span"),a=vt("span"),_=vt("span"),S=He(x),L=Jt(),ht&&ht.c(),N=Jt(),z=vt("span"),Z=He(H),kt(_,"class","primary svelte-ltkwvy"),kt(a,"class","svelte-ltkwvy"),kt(z,"class","line2 svelte-ltkwvy"),kt(p,"class","texts svelte-ltkwvy"),kt(t,"tabindex","0"),kt(t,"data-selected",e[1]),kt(t,"class","svelte-ltkwvy"),cl(t,"selected",e[1])},m(at,Lt){Rt(at,t,Lt),it.m(t,null),dt(t,u),dt(t,p),dt(p,a),dt(a,_),dt(_,S),dt(a,L),ht&&ht.m(a,null),dt(p,N),dt(p,z),dt(z,Z),K||(V=[be(t,"mouseenter",e[12]),be(t,"focus",e[13])],K=!0)},p(at,[Lt]){var bt,yt;Q===(Q=X(at,Lt))&&it?it.p(at,Lt):(it.d(1),it=Q(at),it&&(it.c(),it.m(t,u))),Lt&1&&x!==(x=(at[7]?at[0].place_name:at[0].place_name.replace(/,.*/,""))+"")&&qi(S,x),Lt&37&&(A=at[2]==="always"||at[2]&&!at[0].address&&((bt=at[0].properties)==null?void 0:bt.kind)!=="road"&&((yt=at[0].properties)==null?void 0:yt.kind)!=="road_relation"&&!at[0].id.startsWith("address.")&&!at[0].id.startsWith("postal_code.")&&(!at[0].id.startsWith("poi.")||!at[5])&&!at[7]),A?ht?ht.p(at,Lt):(ht=O1(at),ht.c(),ht.m(a,null)):ht&&(ht.d(1),ht=null),Lt&1&&H!==(H=(at[7]?"":at[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&qi(Z,H),Lt&2&&kt(t,"data-selected",at[1]),Lt&2&&cl(t,"selected",at[1])},i:Pe,o:Pe,d(at){at&&Dt(t),it.d(),ht&&ht.d(),K=!1,or(V)}}}function bT(e,t,n){var X;let i,r,{feature:u}=t,{selected:p=!1}=t,{showPlaceType:a}=t,{missingIconsCache:_}=t,{iconsBaseUrl:x}=t;const S=(X=u.properties)==null?void 0:X.categories;let L,A,N=0,z=u.place_type[0]==="reverse";function H(Q){A&&_.add(A),n(10,N++,N)}function Z(Q){li.call(this,e,Q)}function K(Q){li.call(this,e,Q)}const V=Q=>H(Q.currentTarget);return e.$$set=Q=>{"feature"in Q&&n(0,u=Q.feature),"selected"in Q&&n(1,p=Q.selected),"showPlaceType"in Q&&n(2,a=Q.showPlaceType),"missingIconsCache"in Q&&n(9,_=Q.missingIconsCache),"iconsBaseUrl"in Q&&n(3,x=Q.iconsBaseUrl)},e.$$.update=()=>{var Q,it,ht,ut;if(e.$$.dirty&3640)do n(11,i--,i),n(4,L=S==null?void 0:S[i]),n(5,A=L?x+L.replace(/ /g,"_")+".svg":void 0);while(i>-1&&(!A||_.has(A)));e.$$.dirty&1&&n(6,r=u.id.startsWith("poi.")?(it=(Q=u.properties)==null?void 0:Q.categories)==null?void 0:it.join(", "):((ut=(ht=u.properties)==null?void 0:ht.place_type_name)==null?void 0:ut[0])??u.place_type[0])},n(11,i=(S==null?void 0:S.length)??0),[u,p,a,x,L,A,r,z,H,_,N,i,Z,K,V]}class xT extends cn{constructor(t){super(),un(this,t,bT,vT,en,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function wT(e){let t;return{c(){t=vt("div"),t.innerHTML='',kt(t,"class","svelte-7cmwmc")},m(n,i){Rt(n,t,i)},p:Pe,i:Pe,o:Pe,d(n){n&&Dt(t)}}}class ST extends cn{constructor(t){super(),un(this,t,null,wT,en,{})}}function ET(e){let t,n;return{c(){t=Zl("svg"),n=Zl("path"),kt(n,"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"),kt(t,"viewBox","0 0 60.006 21.412"),kt(t,"width","14"),kt(t,"height","20"),kt(t,"class","svelte-en2qvf")},m(i,r){Rt(i,t,r),dt(t,n)},p:Pe,i:Pe,o:Pe,d(i){i&&Dt(t)}}}class IT extends cn{constructor(t){super(),un(this,t,null,ET,en,{})}}function CT(e){let t,n,i;return{c(){t=Zl("svg"),n=Zl("circle"),i=Zl("path"),kt(n,"cx","4.789"),kt(n,"cy","4.787"),kt(n,"r","3.85"),Qi(n,"stroke-width","1.875"),Qi(n,"fill","none"),kt(i,"d","M12.063 12.063 7.635 7.635"),Qi(i,"stroke-width","1.875"),Qi(i,"stroke-linecap","round"),kt(t,"xmlns","http://www.w3.org/2000/svg"),kt(t,"width","13"),kt(t,"height","13"),kt(t,"viewBox","0 0 13 13"),kt(t,"class","svelte-1bpbt60")},m(r,u){Rt(r,t,u),dt(t,n),dt(t,i)},p:Pe,i:Pe,o:Pe,d(r){r&&Dt(t)}}}class TT extends cn{constructor(t){super(),un(this,t,null,CT,en,{})}}function LT(e,t,n){const i=t[1],r=t[0],u=i-r;return e===i&&n?e:((e-r)%u+u)%u+r}function z1(e){const t=[...e];return t[2]i[0]||r.maxZoom!=null&&r.maxZoomDate.now()){if(!wf.coords)break t;return wf.coords}let u;try{return u=await new Promise((p,a)=>{n.signal.addEventListener("abort",()=>{a(Error("aborted"))}),navigator.geolocation.getCurrentPosition(_=>{p([_.coords.longitude,_.coords.latitude].map(x=>x.toFixed(6)).join(","))},_=>{a(_)},r)}),u}catch{}finally{r.cachedLocationExpiry&&(wf={time:Date.now(),coords:u})}if(n.signal.aborted)return}if(r.type==="server-geolocation")return"ip";if(i&&r.type==="map-center")return i[1].toFixed(6)+","+i[2].toFixed(6)}}const F1=/(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,B1=/(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,V1=/(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,U1=/(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 PT(e){if(!["DMS","DM","DD"].includes(e))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){if(e=="DD")return this.decimalCoordinates;const t=this.decimalCoordinates.split(",").map(p=>Number(p.trim()));let n=G1(t[0],e),i=G1(t[1],e);n.endsWith('.0"')&&i.endsWith('.0"')&&(n=n.replace(/\.0"$/,'"'),i=i.replace(/\.0"$/,'"'));const r=t[0]>=0?" N":" S",u=t[1]>=0?" E":" W";return`${n+r}, ${i+u}`}else throw new Error("no decimal coordinates to convert")}function G1(e,t){const n=Math.abs(e),i=Math.floor(n),r=(n-i)*60;if(t=="DM"){let a=AT(r,3).toFixed(3).padStart(6,"0");return`${i}° ${a}'`}let u=Math.floor(r),p=((r-u)*60).toFixed(1).padStart(4,"0");return u=u.toString().padStart(2,"0"),`${i}° ${u}' ${p}"`}function AT(e,t){const n=Math.pow(10,t);return Math.round((e+Number.EPSILON)*n)/n}function Xy(e,t){t||(t=5),e=e.replace(/\s+/g," ").trim();let n=null,i=null,r="",u="",p=[],a=!1;if(F1.test(e))if(p=F1.exec(e),a=zm(p),a){if(n=p[2],i=p[6],n.includes(",")&&(n=n.replace(",",".")),i.includes(",")&&(i=i.replace(",",".")),Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");if(Number(Math.round(i))==Number(i))throw new Error("integer only coordinate provided");p[1]?(r=p[1],u=p[5]):p[4]&&(r=p[4],u=p[8])}else throw new Error("invalid decimal coordinate format");else if(B1.test(e))if(p=B1.exec(e),a=zm(p),a)n=Math.abs(parseInt(p[2])),p[4]&&(n+=p[4]/60),p[6]&&(n+=p[6].replace(",",".")/3600),parseInt(p[2])<0&&(n=-1*n),i=Math.abs(parseInt(p[9])),p[11]&&(i+=p[11]/60),p[13]&&(i+=p[13].replace(",",".")/3600),parseInt(p[9])<0&&(i=-1*i),p[1]?(r=p[1],u=p[8]):p[7]&&(r=p[7],u=p[14]);else throw new Error("invalid DMS coordinates format");else if(V1.test(e))if(p=V1.exec(e),a=zm(p),a)n=Math.abs(parseInt(p[2])),p[4]&&(n+=p[4]/60),p[6]&&(n+=p[6]/3600),parseInt(p[2])<0&&(n=-1*n),i=Math.abs(parseInt(p[10])),p[12]&&(i+=p[12]/60),p[14]&&(i+=p[14]/3600),parseInt(p[10])<0&&(i=-1*i),p[1]?(r=p[1],u=p[9]):p[8]&&(r=p[8],u=p[16]);else throw new Error("invalid DMS coordinates format");else if(U1.test(e))if(p=U1.exec(e),a=zm(p),a)n=Math.abs(parseInt(p[2])),p[4]&&(n+=p[4]/60),p[6]&&(n+=p[6]/3600),parseInt(p[2])<0&&(n=-1*n),i=Math.abs(parseInt(p[10])),p[12]&&(i+=p[12]/60),p[14]&&(i+=p[14]/3600),parseInt(p[10])<0&&(i=-1*i),p[1]?(r=p[1],u=p[9]):p[8]&&(r=p[8],u=p[16]);else throw new Error("invalid coordinates format");if(a){if(Math.abs(i)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((r||u)&&(!r||!u))throw new Error("invalid coordinates format");if(r&&r==u)throw new Error("invalid coordinates format");let _=/S|SOUTH/i;_.test(r)&&n>0&&(n=-1*n),_=/W|WEST/i,_.test(u)&&i>0&&(i=-1*i);const x=p[0].trim();let S,L;const A=/[,/;\u0020]/g,N=x.match(A);if(N==null){const Z=Math.floor(e.length/2);S=x.substring(0,Z).trim(),L=x.substring(Z).trim()}else{let Z;N.length%2==1?Z=Math.floor(N.length/2):Z=N.length/2-1;let K=0;if(Z==0)K=x.indexOf(N[0]),S=x.substring(0,K).trim(),L=x.substring(K+1).trim();else{let V=0,X=0;for(;V<=Z;)K=x.indexOf(N[V],X),X=K+1,V++;S=x.substring(0,K).trim(),L=x.substring(K+1).trim()}}const z=S.split(".");if(z.length==2&&z[1]==0&&z[1].length!=2)throw new Error("invalid coordinates format");const H=L.split(".");if(H.length==2&&H[1]==0&&H[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(L))throw new Error("degree only coordinate/s provided");return isNaN(n)&&n.includes(",")&&(n=n.replace(",",".")),n=Number(Number(n).toFixed(t)),isNaN(i)&&i.includes(",")&&(i=i.replace(",",".")),i=Number(Number(i).toFixed(t)),Object.freeze({verbatimCoordinates:x,verbatimLatitude:S,verbatimLongitude:L,decimalLatitude:n,decimalLongitude:i,decimalCoordinates:`${n},${i}`,closeEnough:kT,toCoordinateFormat:PT})}else throw new Error("coordinates pattern match failed")}function zm(e){if(!isNaN(e[0]))return!1;const t=[...e];if(t.shift(),t.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,i=/[eastsouthnorthwest]+/i,r=t.length/2;for(let u=0;u{t.decimalLatitude?e.push(t):e.push({...t,...RT})}),[...e,...OT,...zT]}const BT=FT();Xy.formats=BT.map(e=>e.verbatimCoordinates);const VT=Xy;function q1(e,t,n){const i=e.slice();return i[81]=t[n],i[83]=n,i}function Z1(e){let t,n;return t=new ST({}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function W1(e){let t,n,i,r,u;return n=new IT({}),{c(){t=vt("button"),te(n.$$.fragment),kt(t,"type","button"),kt(t,"title",e[9]),kt(t,"class","svelte-zh3kmv"),cl(t,"active",e[0])},m(p,a){Rt(p,t,a),Qt(n,t,null),i=!0,r||(u=be(t,"click",e[67]),r=!0)},p(p,a){(!i||a[0]&512)&&kt(t,"title",p[9]),(!i||a[0]&1)&&cl(t,"active",p[0])},i(p){i||(Et(n.$$.fragment,p),i=!0)},o(p){Pt(n.$$.fragment,p),i=!1},d(p){p&&Dt(t),$t(n),r=!1,u()}}}function UT(e){let t,n=[],i=new Map,r,u,p,a=aa(e[14]);const _=x=>x[81].id+(x[81].address?","+x[81].address:"");for(let x=0;x{ut=null}),Ri()),(!X||Gt[0]&2)&&cl(x,"displayable",Nt[1]!==""),Nt[5]===!0?gt?(gt.p(Nt,Gt),Gt[0]&32&&Et(gt,1)):(gt=W1(Nt),gt.c(),Et(gt,1),gt.m(i,z)):gt&&(Di(),Pt(gt,1,1,()=>{gt=null}),Ri()),Lt&&Lt.p&&(!X||Gt[1]&134217728)&&_r(Lt,at,Nt,Nt[58],X?gr(at,Nt[58],Gt,null):yr(Nt[58]),null);let Yt=Z;Z=he(Nt),Z===Yt?~Z&&yt[Z].p(Nt,Gt):(K&&(Di(),Pt(yt[Yt],1,1,()=>{yt[Yt]=null}),Ri()),~Z?(K=yt[Z],K?K.p(Nt,Gt):(K=yt[Z]=bt[Z](Nt),K.c()),Et(K,1),K.m(n,null)):K=null),(!X||Gt[0]&4&&V!==(V=Zm(Nt[2])+" svelte-zh3kmv"))&&kt(n,"class",V),(!X||Gt[0]&22)&&cl(n,"can-collapse",Nt[4]&&Nt[1]==="")},i(Nt){X||(Et(ht),Et(u.$$.fragment,Nt),Et(L.$$.fragment,Nt),Et(ut),Et(gt),Et(Lt,Nt),Et(K),X=!0)},o(Nt){Pt(ht),Pt(u.$$.fragment,Nt),Pt(L.$$.fragment,Nt),Pt(ut),Pt(gt),Pt(Lt,Nt),Pt(K),X=!1},d(Nt){Nt&&(Dt(t),Dt(n)),$t(u),e[61](null),$t(L),ut&&ut.d(),gt&>.d(),Lt&&Lt.d(Nt),~Z&&yt[Z].d(),Q=!1,or(it)}}}function WT(e,t,n){let i,{$$slots:r={},$$scope:u}=t,{class:p=void 0}=t,{apiKey:a}=t,{bbox:_=void 0}=t,{clearButtonTitle:x="clear"}=t,{clearOnBlur:S=!1}=t,{collapsed:L=!1}=t,{country:A=void 0}=t,{debounceSearch:N=200}=t,{enableReverse:z=!1}=t,{errorMessage:H="Something went wrong…"}=t,{filter:Z=()=>!0}=t,{flyTo:K=!0}=t,{fuzzyMatch:V=!0}=t,{language:X=void 0}=t,{limit:Q=void 0}=t,{mapController:it=void 0}=t,{minLength:ht=2}=t,{noResultsMessage:ut="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!"}=t,{placeholder:gt="Search"}=t,{proximity:at=[{type:"server-geolocation"}]}=t,{reverseActive:Lt=z==="always"}=t,{reverseButtonTitle:bt="toggle reverse geocoding"}=t,{searchValue:yt=""}=t,{showFullGeometry:he=!0}=t,{showPlaceType:Nt="ifNeeded"}=t,{showResultsWhileTyping:Gt=!0}=t,{selectFirst:Yt=!0}=t,{flyToSelected:we=!1}=t,{markerOnSelected:me=!0}=t,{types:Ye=void 0}=t,{excludeTypes:On=!1}=t,{zoom:$e=16}=t,{maxZoom:Ve=18}=t,{apiUrl:Ge="https://api.maptiler.com/geocoding"}=t,{fetchParameters:mn={}}=t,{iconsBaseUrl:Qn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.1/icons/"}=t,{adjustUrlQuery:qn=j=>{}}=t;function ie(){nn.focus()}function De(){nn.blur()}function pn(j,ot=!0){n(1,yt=j),ot?(n(15,Ie=-1),ts()):(yo(),setTimeout(()=>{nn.focus(),nn.select()}))}function Zn(){n(14,wt=void 0),n(55,ze=void 0),n(15,Ie=-1)}function Ar(){n(54,Ue=[]),n(55,ze=void 0)}let mi=!1,wt,Ue,ze,Wn="",nn,Ie=-1,An,jt=[],Fi,sr,zn,En;const $o=new Set,oo=np();ks(()=>{it&&(it.setEventHandler(void 0),it.indicateReverse(!1),it.setSelectedMarker(-1),it.setMarkers(void 0,void 0))});function ts(j){if(sr&&(clearTimeout(sr),sr=void 0),Ie>-1&&wt)n(55,ze=wt[Ie]),n(1,yt=ze.place_type[0]==="reverse"?ze.place_name:ze.place_name.replace(/,.*/,"")),n(18,An=void 0),n(54,Ue=void 0),n(15,Ie=-1);else if(yt){const ot=j||!Ha(yt);Gs(yt,{exact:!0}).then(()=>{n(54,Ue=wt),n(55,ze=void 0),ot&&js()}).catch(It=>n(18,An=It))}}function Ha(j){try{return VT(j,6)}catch{return!1}}async function Gs(j,{byId:ot=!1,exact:It=!1}={}){n(18,An=void 0),Fi==null||Fi.abort();const mt=new AbortController;n(19,Fi=mt);try{const rt=Ha(j),xt=new URLSearchParams;if(X!==void 0&&xt.set("language",Array.isArray(X)?X.join(","):X??""),Ye&&xt.set("types",Ye.join(",")),On&&xt.set("excludeTypes",String(On)),_&&xt.set("bbox",_.map(ke=>ke.toFixed(6)).join(",")),A&&xt.set("country",Array.isArray(A)?A.join(","):A),!ot&&!rt){const ke=await MT(it,at,mt);ke&&xt.set("proximity",ke),(It||!Gt)&&xt.set("autocomplete","false"),xt.set("fuzzyMatch",String(V))}Q!==void 0&&(!rt||(Ye==null?void 0:Ye.length)===1)&&xt.set("limit",String(Q)),xt.set("key",a),qn(xt);const qt=Ge+"/"+encodeURIComponent(rt?rt.decimalLongitude+","+rt.decimalLatitude:j)+".json?"+xt.toString();if(qt===Wn){ot?(n(14,wt=void 0),n(55,ze=jt[0])):n(14,wt=jt);return}Wn=qt;const Zt=await fetch(qt,{signal:mt.signal,...mn});if(!Zt.ok)throw new Error(await Zt.text());const Xt=await Zt.json();oo("response",{url:qt,featureCollection:Xt}),ot?(n(14,wt=void 0),n(55,ze=Xt.features[0]),jt=[ze]):(n(14,wt=Xt.features.filter(Z)),rt&&wt.unshift({type:"Feature",properties:{},id:"reverse_"+rt.decimalLongitude+"_"+rt.decimalLatitude,text:rt.decimalLatitude+", "+rt.decimalLongitude,place_name:rt.decimalLatitude+", "+rt.decimalLongitude,place_type:["reverse"],center:[rt.decimalLongitude,rt.decimalLatitude],bbox:[rt.decimalLongitude,rt.decimalLatitude,rt.decimalLongitude,rt.decimalLatitude],geometry:{type:"Point",coordinates:[rt.decimalLongitude,rt.decimalLatitude]}}),jt=wt,rt&&nn.focus())}catch(rt){if(rt&&typeof rt=="object"&&"name"in rt&&rt.name==="AbortError")return;throw rt}finally{mt===Fi&&n(19,Fi=void 0)}}function js(){var It;if(!(Ue!=null&&Ue.length)||!K)return;const j=[180,90,-180,-90],ot=!Ue.some(mt=>!mt.matching_text);for(const mt of Ue)if(ot||!mt.matching_text)for(const rt of[0,1,2,3])j[rt]=Math[rt<2?"min":"max"](j[rt],((It=mt.bbox)==null?void 0:It[rt])??mt.center[rt%2]);it&&Ue.length>0&&(ze&&j[0]===j[2]&&j[1]===j[3]?it.flyTo(ze.center,$e):it.fitBounds(z1(j),50,Ve))}function wa(j){n(0,Lt=z==="always"),n(14,wt=void 0),n(55,ze=void 0),n(15,Ie=-1),pn(j[1].toFixed(6)+", "+LT(j[0],[-180,180],!0).toFixed(6),!1)}function se(j){if(!wt)return;let ot=j.key==="ArrowDown"?1:j.key==="ArrowUp"?-1:0;ot&&(Ie===(Yt?0:-1)&&ot===-1&&n(15,Ie=wt.length),n(15,Ie+=ot),Ie>=wt.length&&n(15,Ie=-1),Ie<0&&Yt&&n(15,Ie=0),j.preventDefault())}function yo(j=!0){if(n(18,An=void 0),Gt){if(sr&&clearTimeout(sr),yt.length{Gs(ot).catch(It=>n(18,An=It))},j?N:0)}else n(14,wt=void 0),n(18,An=void 0)}function ri(j){n(55,ze=j),n(1,yt=j.place_name),n(15,Ie=-1)}const Sa=()=>nn.focus();function xs(j){tr[j?"unshift":"push"](()=>{nn=j,n(17,nn)})}function le(){yt=this.value,n(1,yt),n(13,mi),n(27,S)}const hn=()=>n(13,mi=!0),Je=()=>n(13,mi=!1),kr=()=>yo(),es=()=>{n(1,yt=""),nn.focus()},on=()=>n(0,Lt=!Lt),ws=()=>n(18,An=void 0),st=j=>n(15,Ie=j),B=j=>ri(j),G=()=>{Yt||n(15,Ie=-1)},J=()=>{};return e.$$set=j=>{"class"in j&&n(2,p=j.class),"apiKey"in j&&n(25,a=j.apiKey),"bbox"in j&&n(26,_=j.bbox),"clearButtonTitle"in j&&n(3,x=j.clearButtonTitle),"clearOnBlur"in j&&n(27,S=j.clearOnBlur),"collapsed"in j&&n(4,L=j.collapsed),"country"in j&&n(28,A=j.country),"debounceSearch"in j&&n(29,N=j.debounceSearch),"enableReverse"in j&&n(5,z=j.enableReverse),"errorMessage"in j&&n(6,H=j.errorMessage),"filter"in j&&n(30,Z=j.filter),"flyTo"in j&&n(31,K=j.flyTo),"fuzzyMatch"in j&&n(32,V=j.fuzzyMatch),"language"in j&&n(33,X=j.language),"limit"in j&&n(34,Q=j.limit),"mapController"in j&&n(35,it=j.mapController),"minLength"in j&&n(36,ht=j.minLength),"noResultsMessage"in j&&n(7,ut=j.noResultsMessage),"placeholder"in j&&n(8,gt=j.placeholder),"proximity"in j&&n(37,at=j.proximity),"reverseActive"in j&&n(0,Lt=j.reverseActive),"reverseButtonTitle"in j&&n(9,bt=j.reverseButtonTitle),"searchValue"in j&&n(1,yt=j.searchValue),"showFullGeometry"in j&&n(38,he=j.showFullGeometry),"showPlaceType"in j&&n(10,Nt=j.showPlaceType),"showResultsWhileTyping"in j&&n(39,Gt=j.showResultsWhileTyping),"selectFirst"in j&&n(11,Yt=j.selectFirst),"flyToSelected"in j&&n(40,we=j.flyToSelected),"markerOnSelected"in j&&n(41,me=j.markerOnSelected),"types"in j&&n(42,Ye=j.types),"excludeTypes"in j&&n(43,On=j.excludeTypes),"zoom"in j&&n(44,$e=j.zoom),"maxZoom"in j&&n(45,Ve=j.maxZoom),"apiUrl"in j&&n(46,Ge=j.apiUrl),"fetchParameters"in j&&n(47,mn=j.fetchParameters),"iconsBaseUrl"in j&&n(12,Qn=j.iconsBaseUrl),"adjustUrlQuery"in j&&n(48,qn=j.adjustUrlQuery),"$$scope"in j&&n(58,u=j.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,zn=mi),S&&!mi&&n(1,yt="")}),e.$$.dirty[0]&16386|e.$$.dirty[1]&32&&yt.lengthn(18,An=j)),e.$$.dirty[1]&50356241&&(it&&ze&&ze.id!==En&&K&&(!ze.bbox||ze.bbox[0]===ze.bbox[2]&&ze.bbox[1]===ze.bbox[3]?it.flyTo(ze.center,ze.id.startsWith("poi.")||ze.id.startsWith("address.")?Ve:$e):it.fitBounds(z1(ze.bbox),50,Ve),n(14,wt=void 0),n(54,Ue=void 0),n(15,Ie=-1)),n(56,En=ze==null?void 0:ze.id)),e.$$.dirty[0]&18432&&Yt&&wt!=null&&wt.length&&n(15,Ie=0),e.$$.dirty[0]&2050&&(Yt||n(15,Ie=-1)),e.$$.dirty[0]&16384|e.$$.dirty[1]&8388608&&Ue!==wt&&n(54,Ue=void 0),e.$$.dirty[0]&81921|e.$$.dirty[1]&8388624&&it&&it.setEventHandler(j=>{switch(j.type){case"mapClick":Lt&&wa(j.coordinates);break;case"markerClick":{const ot=wt==null?void 0:wt.find(It=>It.id===j.id);ot&&ri(ot)}break;case"markerMouseEnter":Ue&&n(15,Ie=zn?(wt==null?void 0:wt.findIndex(ot=>ot.id===j.id))??-1:-1);break;case"markerMouseLeave":Ue&&n(15,Ie=-1);break}}),e.$$.dirty[0]&49152&&n(57,i=wt==null?void 0:wt[Ie]),e.$$.dirty[1]&67133969&&it&&i&&K&&we&&it.flyTo(i.center,i.id.startsWith("poi.")||i.id.startsWith("address.")?Ve:$e),e.$$.dirty[1]&1040&&(me||it==null||it.setMarkers(void 0,void 0)),e.$$.dirty[1]&75498512&&it&&me&&!Ue&&(it.setMarkers(i?[i]:void 0,void 0),it.setSelectedMarker(i?0:-1)),e.$$.dirty[1]&25165840&&it&&it.setMarkers(Ue,ze),e.$$.dirty[0]&32768|e.$$.dirty[1]&8388624&&Ue&&it&&it.setSelectedMarker(Ie),e.$$.dirty[0]&2|e.$$.dirty[1]&16&&it){const j=Ha(yt);it.setReverseMarker(j?[j.decimalLongitude,j.decimalLatitude]:void 0)}e.$$.dirty[1]&67108864&&oo("select",i),e.$$.dirty[1]&16777216&&oo("pick",ze),e.$$.dirty[0]&81920&&oo("optionsVisibilityChange",zn&&!!wt),e.$$.dirty[0]&16384&&oo("featuresListed",wt),e.$$.dirty[1]&8388608&&oo("featuresMarked",Ue),e.$$.dirty[0]&1&&oo("reverseToggle",Lt),e.$$.dirty[0]&2&&oo("queryChange",yt),e.$$.dirty[0]&1|e.$$.dirty[1]&16&&it&&it.indicateReverse(Lt)},[Lt,yt,p,x,L,z,H,ut,gt,bt,Nt,Yt,Qn,mi,wt,Ie,zn,nn,An,Fi,$o,ts,se,yo,ri,a,_,S,A,N,Z,K,V,X,Q,it,ht,at,he,Gt,we,me,Ye,On,$e,Ve,Ge,mn,qn,ie,De,pn,Zn,Ar,Ue,ze,En,i,u,r,Sa,xs,le,hn,Je,kr,es,on,ws,st,B,G,J]}class XT extends cn{constructor(t){super(),un(this,t,WT,ZT,en,{class:2,apiKey:25,bbox:26,clearButtonTitle:3,clearOnBlur:27,collapsed:4,country:28,debounceSearch:29,enableReverse:5,errorMessage:6,filter:30,flyTo:31,fuzzyMatch:32,language:33,limit:34,mapController:35,minLength:36,noResultsMessage:7,placeholder:8,proximity:37,reverseActive:0,reverseButtonTitle:9,searchValue:1,showFullGeometry:38,showPlaceType:10,showResultsWhileTyping:39,selectFirst:11,flyToSelected:40,markerOnSelected:41,types:42,excludeTypes:43,zoom:44,maxZoom:45,apiUrl:46,fetchParameters:47,iconsBaseUrl:12,adjustUrlQuery:48,focus:49,blur:50,setQuery:51,clearList:52,clearMap:53},null,[-1,-1,-1])}get focus(){return this.$$.ctx[49]}get blur(){return this.$$.ctx[50]}get setQuery(){return this.$$.ctx[51]}get clearList(){return this.$$.ctx[52]}get clearMap(){return this.$$.ctx[53]}}function H1(e){let t,n,i;return n=new XT({props:{mapController:e[0],apiKey:Ly}}),{c(){t=vt("div"),te(n.$$.fragment),kt(t,"class","svelte-ixhnie")},m(r,u){Rt(r,t,u),Qt(n,t,null),i=!0},p(r,u){const p={};u&1&&(p.mapController=r[0]),n.$set(p)},i(r){i||(Et(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&Dt(t),$t(n)}}}function HT(e){let t,n,i=e[0]&&H1(e);return{c(){i&&i.c(),t=ys()},m(r,u){i&&i.m(r,u),Rt(r,t,u),n=!0},p(r,[u]){r[0]?i?(i.p(r,u),u&1&&Et(i,1)):(i=H1(r),i.c(),Et(i,1),i.m(t.parentNode,t)):i&&(Di(),Pt(i,1,1,()=>{i=null}),Ri())},i(r){n||(Et(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&Dt(t),i&&i.d(r)}}}function YT(e,t,n){let i,r;return Ee(e,Hl,u=>n(1,r=u)),e.$$.update=()=>{e.$$.dirty&2&&n(0,i=r?lT(r,Ls):null)},[i,r]}class KT extends cn{constructor(t){super(),un(this,t,YT,HT,en,{})}}const JT=e=>({}),Y1=e=>({}),QT=e=>({}),K1=e=>({}),$T=e=>({}),J1=e=>({});function tL(e){let t,n,i,r,u,p;const a=e[1].top,_=mr(a,e,e[0],J1),x=e[1].left,S=mr(x,e,e[0],K1),L=e[1].main,A=mr(L,e,e[0],Y1);return{c(){t=vt("div"),_&&_.c(),n=Jt(),i=vt("div"),S&&S.c(),r=Jt(),u=vt("div"),A&&A.c(),kt(t,"class","top svelte-3nmiww"),kt(i,"class","left svelte-3nmiww"),kt(u,"class","main svelte-3nmiww")},m(N,z){Rt(N,t,z),_&&_.m(t,null),Rt(N,n,z),Rt(N,i,z),S&&S.m(i,null),Rt(N,r,z),Rt(N,u,z),A&&A.m(u,null),p=!0},p(N,[z]){_&&_.p&&(!p||z&1)&&_r(_,a,N,N[0],p?gr(a,N[0],z,$T):yr(N[0]),J1),S&&S.p&&(!p||z&1)&&_r(S,x,N,N[0],p?gr(x,N[0],z,QT):yr(N[0]),K1),A&&A.p&&(!p||z&1)&&_r(A,L,N,N[0],p?gr(L,N[0],z,JT):yr(N[0]),Y1)},i(N){p||(Et(_,N),Et(S,N),Et(A,N),p=!0)},o(N){Pt(_,N),Pt(S,N),Pt(A,N),p=!1},d(N){N&&(Dt(t),Dt(n),Dt(i),Dt(r),Dt(u)),_&&_.d(N),S&&S.d(N),A&&A.d(N)}}}function eL(e,t,n){let{$$slots:i={},$$scope:r}=t;return e.$$set=u=>{"$$scope"in u&&n(0,r=u.$$scope)},[r,i]}class nL extends cn{constructor(t){super(),un(this,t,eL,tL,en,{})}}function Q1(e){let t,n;return{c(){t=vt("div"),n=He(e[0]),kt(t,"class","svelte-1uuov7f")},m(i,r){Rt(i,t,r),dt(t,n)},p(i,r){r&1&&qi(n,i[0])},d(i){i&&Dt(t)}}}function iL(e){let t,n=e[0]&&Q1(e);return{c(){n&&n.c(),t=ys()},m(i,r){n&&n.m(i,r),Rt(i,t,r)},p(i,[r]){i[0]?n?n.p(i,r):(n=Q1(i),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},i:Pe,o:Pe,d(i){i&&Dt(t),n&&n.d(i)}}}function rL(e,t,n){let{msg:i=null}=t;return e.$$set=r=>{"msg"in r&&n(0,i=r.msg)},[i]}class sw extends cn{constructor(t){super(),un(this,t,rL,iL,en,{msg:0})}}const oL=e=>({dialog:e&1}),$1=e=>({dialog:e[0]});function sL(e){let t,n,i,r,u;const p=e[4].default,a=mr(p,e,e[3],$1);return{c(){t=vt("dialog"),n=vt("article"),a&&a.c(),t.open=!0},m(_,x){Rt(_,t,x),dt(t,n),a&&a.m(n,null),e[6](t),i=!0,r||(u=[be(window,"click",e[1]),be(window,"keydown",e[2]),be(t,"close",e[5])],r=!0)},p(_,[x]){a&&a.p&&(!i||x&9)&&_r(a,p,_,_[3],i?gr(p,_[3],x,oL):yr(_[3]),$1)},i(_){i||(Et(a,_),i=!0)},o(_){Pt(a,_),i=!1},d(_){_&&Dt(t),a&&a.d(_),e[6](null),r=!1,or(u)}}}function aL(e,t,n){let{$$slots:i={},$$scope:r}=t,u;function p(S){u.open&&S.target==u&&u.close()}function a(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),u.close())}function _(S){li.call(this,e,S)}function x(S){tr[S?"unshift":"push"](()=>{u=S,n(0,u)})}return e.$$set=S=>{"$$scope"in S&&n(3,r=S.$$scope)},[u,p,a,r,i,_,x]}class aw extends cn{constructor(t){super(),un(this,t,aL,sL,en,{})}}var To=63710088e-1,Hy={centimeters:To*100,centimetres:To*100,degrees:To/111325,feet:To*3.28084,inches:To*39.37,kilometers:To/1e3,kilometres:To/1e3,meters:To,metres:To,miles:To/1609.344,millimeters:To*1e3,millimetres:To*1e3,nauticalmiles:To/1852,radians:1,yards:To*1.0936},lL={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/To,yards:1.0936133},wy={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 ya(e,t,n){n===void 0&&(n={});var i={type:"Feature"};return(n.id===0||n.id)&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.properties=t||{},i.geometry=e,i}function uL(e,t,n){switch(e){case"Point":return hs(t).geometry;case"LineString":return ia(t).geometry;case"Polygon":return Yy(t).geometry;case"MultiPoint":return uw(t).geometry;case"MultiLineString":return lw(t).geometry;case"MultiPolygon":return cw(t).geometry;default:throw new Error(e+" is invalid")}}function hs(e,t,n){if(n===void 0&&(n={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!hg(e[0])||!hg(e[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:e};return ya(i,t,n)}function cL(e,t,n){return n===void 0&&(n={}),kc(e.map(function(i){return hs(i,t)}),n)}function Yy(e,t,n){n===void 0&&(n={});for(var i=0,r=e;i=0))throw new Error("precision must be a positive number");var n=Math.pow(10,t||0);return Math.round(e*n)/n}function Ky(e,t){t===void 0&&(t="kilometers");var n=Hy[t];if(!n)throw new Error(t+" units is invalid");return e*n}function Ag(e,t){t===void 0&&(t="kilometers");var n=Hy[t];if(!n)throw new Error(t+" units is invalid");return e/n}function mL(e,t){return sd(Ag(e,t))}function gL(e){var t=e%360;return t<0&&(t+=360),t}function sd(e){var t=e%(2*Math.PI);return t*180/Math.PI}function ra(e){var t=e%360;return t*Math.PI/180}function _L(e,t,n){if(t===void 0&&(t="kilometers"),n===void 0&&(n="kilometers"),!(e>=0))throw new Error("length must be a positive number");return Ky(Ag(e,t),n)}function yL(e,t,n){if(t===void 0&&(t="meters"),n===void 0&&(n="kilometers"),!(e>=0))throw new Error("area must be a positive number");var i=wy[t];if(!i)throw new Error("invalid original units");var r=wy[n];if(!r)throw new Error("invalid final units");return e/i*r}function hg(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function Jy(e){return!!e&&e.constructor===Object}function vL(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(function(t){if(!hg(t))throw new Error("bbox must only contain numbers")})}function bL(e){if(!e)throw new Error("id is required");if(["string","number"].indexOf(typeof e)===-1)throw new Error("id must be a number or a string")}const xL=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:wy,bearingToAzimuth:gL,convertArea:yL,convertLength:_L,degreesToRadians:ra,earthRadius:To,factors:Hy,feature:ya,featureCollection:kc,geometry:uL,geometryCollection:fL,isNumber:hg,isObject:Jy,lengthToDegrees:mL,lengthToRadians:Ag,lineString:ia,lineStrings:pL,multiLineString:lw,multiPoint:uw,multiPolygon:cw,point:hs,points:cL,polygon:Yy,polygons:hL,radiansToDegrees:sd,radiansToLength:Ky,round:dL,unitsFactors:lL,validateBBox:vL,validateId:bL},Symbol.toStringTag,{value:"Module"}));function ad(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function ep(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function hw(e,t,n){if(n===void 0&&(n={}),n.final===!0)return wL(e,t);var i=ad(e),r=ad(t),u=ra(i[0]),p=ra(r[0]),a=ra(i[1]),_=ra(r[1]),x=Math.sin(p-u)*Math.cos(_),S=Math.cos(a)*Math.sin(_)-Math.sin(a)*Math.cos(_)*Math.cos(p-u);return sd(Math.atan2(x,S))}function wL(e,t){var n=hw(t,e);return n=(n+180)%360,n}function Sf(e,t,n){n===void 0&&(n={});var i=ad(e),r=ad(t),u=ra(r[1]-i[1]),p=ra(r[0]-i[0]),a=ra(i[1]),_=ra(r[1]),x=Math.pow(Math.sin(u/2),2)+Math.pow(Math.sin(p/2),2)*Math.cos(a)*Math.cos(_);return Ky(2*Math.atan2(Math.sqrt(x),Math.sqrt(1-x)),n.units)}function tb(e,t,n,i){i===void 0&&(i={});var r=ad(e),u=ra(r[0]),p=ra(r[1]),a=ra(n),_=Ag(t,i.units),x=Math.asin(Math.sin(p)*Math.cos(_)+Math.cos(p)*Math.sin(_)*Math.cos(a)),S=u+Math.atan2(Math.sin(a)*Math.sin(_)*Math.cos(p),Math.cos(_)-Math.sin(p)*Math.sin(x)),L=sd(S),A=sd(x);return hs([L,A],i.properties)}function bd(e,t,n){if(e!==null)for(var i,r,u,p,a,_,x,S=0,L=0,A,N=e.type,z=N==="FeatureCollection",H=N==="Feature",Z=z?e.features.length:1,K=0;K_||z>x||H>S){a=L,_=i,x=z,S=H,u=0;return}var Z=ia([a,L],n.properties);if(t(Z,i,r,H,u)===!1)return!1;u++,a=L})===!1)return!1}}})}function ML(e,t,n){var i=n,r=!1;return fw(e,function(u,p,a,_,x){r===!1&&n===void 0?i=u:i=t(i,u,p,a,_,x),r=!0}),i}function dw(e,t){if(!e)throw new Error("geojson is required");hp(e,function(n,i,r){if(n.geometry!==null){var u=n.geometry.type,p=n.geometry.coordinates;switch(u){case"LineString":if(t(n,i,r,0,0)===!1)return!1;break;case"Polygon":for(var a=0;ar?n:r,x=i>u?i:u;return[p,a,_,x]}var $y={exports:{}},mw={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(Hb,function(){function n(V,X,Q,it,ht){(function ut(gt,at,Lt,bt,yt){for(;bt>Lt;){if(bt-Lt>600){var he=bt-Lt+1,Nt=at-Lt+1,Gt=Math.log(he),Yt=.5*Math.exp(2*Gt/3),we=.5*Math.sqrt(Gt*Yt*(he-Yt)/he)*(Nt-he/2<0?-1:1),me=Math.max(Lt,Math.floor(at-Nt*Yt/he+we)),Ye=Math.min(bt,Math.floor(at+(he-Nt)*Yt/he+we));ut(gt,at,me,Ye,yt)}var On=gt[at],$e=Lt,Ve=bt;for(i(gt,Lt,at),yt(gt[bt],On)>0&&i(gt,Lt,bt);$e0;)Ve--}yt(gt[Lt],On)===0?i(gt,Lt,Ve):i(gt,++Ve,bt),Ve<=at&&(Lt=Ve+1),at<=Ve&&(bt=Ve-1)}})(V,X,Q||0,it||V.length-1,ht||r)}function i(V,X,Q){var it=V[X];V[X]=V[Q],V[Q]=it}function r(V,X){return VX?1:0}var u=function(V){V===void 0&&(V=9),this._maxEntries=Math.max(4,V),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function p(V,X,Q){if(!Q)return X.indexOf(V);for(var it=0;it=V.minX&&X.maxY>=V.minY}function Z(V){return{children:V,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function K(V,X,Q,it,ht){for(var ut=[X,Q];ut.length;)if(!((Q=ut.pop())-(X=ut.pop())<=it)){var gt=X+Math.ceil((Q-X)/it/2)*it;n(V,gt,X,Q,ht),ut.push(X,gt,gt,Q)}}return u.prototype.all=function(){return this._all(this.data,[])},u.prototype.search=function(V){var X=this.data,Q=[];if(!H(V,X))return Q;for(var it=this.toBBox,ht=[];X;){for(var ut=0;ut=0&&ht[X].children.length>this._maxEntries;)this._split(ht,X),X--;this._adjustParentBBoxes(it,ht,X)},u.prototype._split=function(V,X){var Q=V[X],it=Q.children.length,ht=this._minEntries;this._chooseSplitAxis(Q,ht,it);var ut=this._chooseSplitIndex(Q,ht,it),gt=Z(Q.children.splice(ut,Q.children.length-ut));gt.height=Q.height,gt.leaf=Q.leaf,a(Q,this.toBBox),a(gt,this.toBBox),X?V[X-1].children.push(gt):this._splitRoot(Q,gt)},u.prototype._splitRoot=function(V,X){this.data=Z([V,X]),this.data.height=V.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},u.prototype._chooseSplitIndex=function(V,X,Q){for(var it,ht,ut,gt,at,Lt,bt,yt=1/0,he=1/0,Nt=X;Nt<=Q-X;Nt++){var Gt=_(V,0,Nt,this.toBBox),Yt=_(V,Nt,Q,this.toBBox),we=(ht=Gt,ut=Yt,gt=void 0,at=void 0,Lt=void 0,bt=void 0,gt=Math.max(ht.minX,ut.minX),at=Math.max(ht.minY,ut.minY),Lt=Math.min(ht.maxX,ut.maxX),bt=Math.min(ht.maxY,ut.maxY),Math.max(0,Lt-gt)*Math.max(0,bt-at)),me=A(Gt)+A(Yt);we=X;yt--){var he=V.children[yt];x(gt,V.leaf?ht(he):he),at+=N(gt)}return at},u.prototype._adjustParentBBoxes=function(V,X,Q){for(var it=Q;it>=0;it--)x(X[it],V)},u.prototype._condense=function(V){for(var X=V.length-1,Q=void 0;X>=0;X--)V[X].children.length===0?X>0?(Q=V[X-1].children).splice(Q.indexOf(V[X]),1):this.clear():a(V[X],this.toBBox)},u})})(mw);var zL=mw.exports;const FL=Kb(xL),gw=Kb(NL);var t0={};Object.defineProperty(t0,"__esModule",{value:!0});var BL=gw;function Sy(e){var t=[1/0,1/0,-1/0,-1/0];return BL.coordEach(e,function(n){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(i.length!==2)throw new Error(" line2 must only contain 2 coordinates");var r=n[0][0],u=n[0][1],p=n[1][0],a=n[1][1],_=i[0][0],x=i[0][1],S=i[1][0],L=i[1][1],A=(L-x)*(p-r)-(S-_)*(a-u),N=(S-_)*(u-x)-(L-x)*(r-_),z=(p-r)*(u-x)-(a-u)*(r-_);if(A===0)return null;var H=N/A,Z=z/A;if(H>=0&&H<=1&&Z>=0&&Z<=1){var K=r+H*(p-r),V=u+H*(a-u);return hs([K,V])}return null}function qL(e,t,n){n===void 0&&(n={});var i=hs([1/0,1/0],{dist:1/0}),r=0;return hp(e,function(u){for(var p=ep(u),a=0;a0&&(Z=H.features[0],Z.properties.dist=Sf(t,Z,n),Z.properties.location=r+Sf(_,Z,n)),_.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(t);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-t.lngLat.lng,i=this.dragFrom[1]-t.lngLat.lat;for(let r of this.points)r[0]-=n,r[1]-=i}else this.points[this.hover]=t.lngLat.toArray();this.dragFrom=t.lngLat.toArray(),this.redraw()}});Xn(this,"onClick",t=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(rb(this.points).forEach((i,r)=>{n.push([r+1,qL(i,this.cursor).properties.dist])}),n.sort((i,r)=>i[1]-r[1]),n.length>0){let i=n[0][0];this.points.splice(i,0,this.cursor.geometry.coordinates),this.hover=i}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(t))});Xn(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.cursor=K_(t.lngLat.toArray()),this.onClick(t),this.finish())});Xn(this,"onMouseDown",t=>{this.active&&!this.dragFrom&&this.hover!=null&&(t.preventDefault(),this.cursor=null,this.dragFrom=t.lngLat.toArray(),this.beforeUpdate(),this.redraw())});Xn(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});Xn(this,"onKeypress",t=>{this.active&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="z"&&t.ctrlKey&&this.undo())});Xn(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});this.map=t,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 t=this.polygonFeature();if(t)for(let n of this.eventListenersSuccess)n(t);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let t of this.eventListenersFailure)t();this.stop()}addEventListenerSuccess(t){this.eventListenersSuccess.push(t)}addEventListenerUpdated(t){this.eventListenersUpdated.push(t)}addEventListenerFailure(t){this.eventListenersFailure.push(t)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(t){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(t.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 t={type:"FeatureCollection",features:[]};this.points.forEach((r,u)=>{let p=K_(r);p.properties.hover=this.hover==u,p.properties.idx=u,t.features.push(p)}),t.features=t.features.concat(rb(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",t.features.push(n)),bw.set(t);let i="crosshair";this.hover!=null&&(i=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=i,xw.set(this.previousStates.length)}pointsUpdated(){let t=this.polygonFeature();if(t)for(let n of this.eventListenersUpdated)n(t)}recalculateHovering(t){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(t.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(n.geometry.type=="Polygon"){this.hover="polygon";break}else if(n.geometry.type=="Point"&&Object.hasOwn(n.properties,"idx")){this.hover=n.properties.idx;break}this.hover==null&&(this.cursor=K_(t.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let t=this.points.map(Iw),n=[JSON.parse(JSON.stringify(t))];return n[0].push(JSON.parse(JSON.stringify(n[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:n},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>ZL&&this.previousStates.shift()}}function rb(e){let t=[];for(let n=0;n=3&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[e[e.length-1],e[0]]},properties:{}}),t}function XL(e){let t,n,i;return{c(){t=He("Undo ("),n=He(e[1]),i=He(")")},m(r,u){Rt(r,t,u),Rt(r,n,u),Rt(r,i,u)},p(r,u){u&2&&qi(n,r[1])},d(r){r&&(Dt(t),Dt(n),Dt(i))}}}function HL(e){let t;return{c(){t=He("Undo")},m(n,i){Rt(n,t,i)},p:Pe,d(n){n&&Dt(t)}}}function YL(e){let t,n,i,r,u,p;function a(S,L){return S[1]==0?HL:XL}let _=a(e),x=_(e);return{c(){t=vt("button"),x.c(),i=Jt(),r=vt("ul"),r.innerHTML=`
  • Click +`)}return e.toString()};Gr.prototype.computeEdgeEndLabels=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();n.computeLabel(e)}};Gr.prototype.computeLabelling=function(e){var t=this;this.computeEdgeEndLabels(e[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var n=[!1,!1],i=this.iterator();i.hasNext();)for(var r=i.next(),u=r.getLabel(),p=0;p<2;p++)u.isLine(p)&&u.getLocation(p)===zt.BOUNDARY&&(n[p]=!0);for(var a=this.iterator();a.hasNext();)for(var _=a.next(),x=_.getLabel(),S=0;S<2;S++)if(x.isAnyNull(S)){var L=zt.NONE;if(n[S])L=zt.EXTERIOR;else{var A=_.getCoordinate();L=t.getLocation(S,A,e)}x.setAllLocationsIfNull(S,L)}};Gr.prototype.getDegree=function(){return this._edgeMap.size()};Gr.prototype.insertEdgeEnd=function(e,t){this._edgeMap.put(e,t),this._edgeList=null};Gr.prototype.interfaces_=function(){return[]};Gr.prototype.getClass=function(){return Gr};var AC=function(e){function t(){e.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.linkResultDirectedEdges=function(){var n=this;this.getResultAreaEdges();for(var i=null,r=null,u=this._SCANNING_FOR_INCOMING,p=0;p=0;u--){var p=n._edgeList.get(u),a=p.getSym();r===null&&(r=a),i!==null&&a.setNext(i),i=p}r.setNext(i)},t.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var i=arguments[0],r=this.findIndex(i),u=i.getDepth(re.LEFT),p=i.getDepth(re.RIGHT),a=this.computeDepths(r+1,this._edgeList.size(),u),_=this.computeDepths(0,r,a);if(_!==p)throw new ml("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var x=arguments[0],S=arguments[1],L=arguments[2],A=L,N=x;N=0;a--){var _=i._resultAreaEdgeList.get(a),x=_.getSym();switch(r===null&&_.getEdgeRing()===n&&(r=_),p){case i._SCANNING_FOR_INCOMING:if(x.getEdgeRing()!==n)continue;u=x,p=i._LINKING_TO_OUTGOING;break;case i._LINKING_TO_OUTGOING:if(_.getEdgeRing()!==n)continue;u.setNextMin(_),p=i._SCANNING_FOR_INCOMING;break}}p===this._LINKING_TO_OUTGOING&&(un.isTrue(r!==null,"found null for first outgoing dirEdge"),un.isTrue(r.getEdgeRing()===n,"unable to link last incoming dirEdge"),u.setNextMin(r))},t.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,i=this.iterator();i.hasNext();){var r=i.next();r.isInResult()&&n++}return n}else if(arguments.length===1){for(var u=arguments[0],p=0,a=this.iterator();a.hasNext();){var _=a.next();_.getEdgeRing()===u&&p++}return p}},t.prototype.getLabel=function(){return this._label},t.prototype.findCoveredLineEdges=function(){for(var n=zt.NONE,i=this.iterator();i.hasNext();){var r=i.next(),u=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){n=zt.INTERIOR;break}if(u.isInResult()){n=zt.EXTERIOR;break}}}if(n===zt.NONE)return null;for(var p=n,a=this.iterator();a.hasNext();){var _=a.next(),x=_.getSym();_.isLineEdge()?_.getEdge().setCovered(p===zt.INTERIOR):(_.isInResult()&&(p=zt.EXTERIOR),x.isInResult()&&(p=zt.INTERIOR))}},t.prototype.computeLabelling=function(n){var i=this;e.prototype.computeLabelling.call(this,n),this._label=new Vn(zt.NONE);for(var r=this.iterator();r.hasNext();)for(var u=r.next(),p=u.getEdge(),a=p.getLabel(),_=0;_<2;_++){var x=a.getLocation(_);(x===zt.INTERIOR||x===zt.BOUNDARY)&&i._label.setLocation(_,zt.INTERIOR)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Gr),Nx=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.createNode=function(n){return new Mg(n,new AC)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Gh),Ql=function e(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=e.orientation(t)};Ql.prototype.compareTo=function(e){var t=e,n=Ql.compareOriented(this._pts,this._orientation,t._pts,t._orientation);return n};Ql.prototype.interfaces_=function(){return[vs]};Ql.prototype.getClass=function(){return Ql};Ql.orientation=function(e){return _n.increasingDirection(e)===1};Ql.compareOriented=function(e,t,n,i){for(var r=t?1:-1,u=i?1:-1,p=t?e.length:-1,a=i?n.length:-1,_=t?0:e.length-1,x=i?0:n.length-1;;){var S=e[_].compareTo(n[x]);if(S!==0)return S;_+=r,x+=u;var L=_===p,A=x===a;if(L&&!A)return-1;if(!L&&A)return 1;if(L&&A)return 0}};var zs=function(){this._edges=new ce,this._ocaMap=new Vr};zs.prototype.print=function(e){var t=this;e.print("MULTILINESTRING ( ");for(var n=0;n0&&e.print(","),e.print("(");for(var r=i.getCoordinates(),u=0;u0&&e.print(","),e.print(r[u].x+" "+r[u].y);e.println(")")}e.print(") ")};zs.prototype.addAll=function(e){for(var t=this,n=e.iterator();n.hasNext();)t.add(n.next())};zs.prototype.findEdgeIndex=function(e){for(var t=this,n=0;n0||!t.coord.equals2D(r);u||i--;var p=new Array(i).fill(null),a=0;p[a++]=new Dt(e.coord);for(var _=e.segmentIndex+1;_<=t.segmentIndex;_++)p[a++]=n.edge.pts[_];return u&&(p[a]=t.coord),new ig(p,new Vn(this.edge._label))};Ga.prototype.add=function(e,t,n){var i=new da(e,t,n),r=this._nodeMap.get(i);return r!==null?r:(this._nodeMap.put(i,i),i)};Ga.prototype.isIntersection=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();if(n.coord.equals(e))return!0}return!1};Ga.prototype.interfaces_=function(){return[]};Ga.prototype.getClass=function(){return Ga};var Uu=function(){};Uu.prototype.getChainStartIndices=function(e){var t=this,n=0,i=new ce;i.add(new la(n));do{var r=t.findChainEnd(e,n);i.add(new la(r)),n=r}while(nn?t:n};_l.prototype.getMinX=function(e){var t=this.pts[this.startIndex[e]].x,n=this.pts[this.startIndex[e+1]].x;return tn&&(r=1),e._depth[t][i]=r}}};Er.prototype.getDelta=function(e){return this._depth[e][re.RIGHT]-this._depth[e][re.LEFT]};Er.prototype.getLocation=function(e,t){return this._depth[e][t]<=0?zt.EXTERIOR:zt.INTERIOR};Er.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Er.prototype.add=function(){var e=this;if(arguments.length===1)for(var t=arguments[0],n=0;n<2;n++)for(var i=1;i<3;i++){var r=t.getLocation(n,i);(r===zt.EXTERIOR||r===zt.INTERIOR)&&(e.isNull(n,i)?e._depth[n][i]=Er.depthAtLocation(r):e._depth[n][i]+=Er.depthAtLocation(r))}else if(arguments.length===3){var u=arguments[0],p=arguments[1],a=arguments[2];a===zt.INTERIOR&&this._depth[u][p]++}};Er.prototype.interfaces_=function(){return[]};Er.prototype.getClass=function(){return Er};Er.depthAtLocation=function(e){return e===zt.EXTERIOR?0:e===zt.INTERIOR?1:Er.NULL_VALUE};Dx.NULL_VALUE.get=function(){return-1};Object.defineProperties(Er,Dx);var ig=function(e){function t(){if(e.call(this),this.pts=null,this._env=null,this.eiList=new Ga(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Er,this._depthDelta=0,arguments.length===1){var n=arguments[0];t.call(this,n,null)}else if(arguments.length===2){var i=arguments[0],r=arguments[1];this.pts=i,this._label=r}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getDepth=function(){return this._depth},t.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var i=new t(n,Vn.toLineLabel(this._label));return i},t.prototype.isIsolated=function(){return this._isIsolated},t.prototype.getCoordinates=function(){return this.pts},t.prototype.setIsolated=function(n){this._isIsolated=n},t.prototype.setName=function(n){this._name=n},t.prototype.equals=function(n){var i=this;if(!(n instanceof t))return!1;var r=n;if(this.pts.length!==r.pts.length)return!1;for(var u=!0,p=!0,a=this.pts.length,_=0;_0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},t.prototype.print=function(n){var i=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var r=0;r0&&n.print(","),n.print(i.pts[r].x+" "+i.pts[r].y);n.print(") "+this._label+" "+this._depthDelta)},t.prototype.computeIM=function(n){t.updateIM(this._label,n)},t.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},t.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},t.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},t.prototype.getDepthDelta=function(){return this._depthDelta},t.prototype.getNumPoints=function(){return this.pts.length},t.prototype.printReverse=function(n){var i=this;n.print("edge "+this._name+": ");for(var r=this.pts.length-1;r>=0;r--)n.print(i.pts[r]+" ");n.println("")},t.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new _l(this)),this._mce},t.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Re;for(var i=0;i0&&i.append(","),i.append(n.pts[r].x+" "+n.pts[r].y);return i.append(") "+this._label+" "+this._depthDelta),i.toString()},t.prototype.isPointwiseEqual=function(n){var i=this;if(this.pts.length!==n.pts.length)return!1;for(var r=0;ri||this._maxyu;if(p)return!1;var a=this.intersectsToleranceSquare(e,t);return un.isTrue(!(p&&a),"Found bad envelope test"),a};mo.prototype.initCorners=function(e){var t=.5;this._minx=e.x-t,this._maxx=e.x+t,this._miny=e.y-t,this._maxy=e.y+t,this._corner[0]=new Dt(this._maxx,this._maxy),this._corner[1]=new Dt(this._minx,this._maxy),this._corner[2]=new Dt(this._minx,this._miny),this._corner[3]=new Dt(this._maxx,this._miny)};mo.prototype.intersects=function(e,t){return this._scaleFactor===1?this.intersectsScaled(e,t):(this.copyScaled(e,this._p0Scaled),this.copyScaled(t,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};mo.prototype.scale=function(e){return Math.round(e*this._scaleFactor)};mo.prototype.getCoordinate=function(){return this._originalPt};mo.prototype.copyScaled=function(e,t){t.x=this.scale(e.x),t.y=this.scale(e.y)};mo.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var e=mo.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Re(this._originalPt.x-e,this._originalPt.x+e,this._originalPt.y-e,this._originalPt.y+e)}return this._safeEnv};mo.prototype.intersectsPixelClosure=function(e,t){return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.hasIntersection()))};mo.prototype.intersectsToleranceSquare=function(e,t){var n=!1,i=!1;return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.isProper())||n&&i||e.equals(this._pt)||t.equals(this._pt))};mo.prototype.addSnappedNode=function(e,t){var n=e.getCoordinate(t),i=e.getCoordinate(t+1);return this.intersects(n,i)?(e.addIntersection(this.getCoordinate(),t),!0):!1};mo.prototype.interfaces_=function(){return[]};mo.prototype.getClass=function(){return mo};Ox.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(mo,Ox);var nd=function(){this.tempEnv1=new Re,this.selectedSegment=new Oe};nd.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var e=arguments[0],t=arguments[1];e.getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}};nd.prototype.interfaces_=function(){return[]};nd.prototype.getClass=function(){return nd};var Wh=function(){this._index=null;var e=arguments[0];this._index=e},zx={HotPixelSnapAction:{configurable:!0}};Wh.prototype.snap=function(){if(arguments.length===1){var e=arguments[0];return this.snap(e,null,-1)}else if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2],r=t.getSafeEnvelope(),u=new Fx(t,n,i);return this._index.query(r,{interfaces_:function(){return[Kl]},visitItem:function(p){var a=p;a.select(r,u)}}),u.isNodeAdded()}};Wh.prototype.interfaces_=function(){return[]};Wh.prototype.getClass=function(){return Wh};zx.HotPixelSnapAction.get=function(){return Fx};Object.defineProperties(Wh,zx);var Fx=function(e){function t(){e.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],i=arguments[1],r=arguments[2];this._hotPixel=n,this._parentEdge=i,this._hotPixelVertexIndex=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isNodeAdded=function(){return this._isNodeAdded},t.prototype.select=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],r=n.getContext();if(this._parentEdge!==null&&r===this._parentEdge&&i===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,i)}else return e.prototype.select.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(nd),Ec=function(){this._li=null,this._interiorIntersections=null;var e=arguments[0];this._li=e,this._interiorIntersections=new ce};Ec.prototype.processIntersections=function(e,t,n,i){var r=this;if(e===n&&t===i)return null;var u=e.getCoordinates()[t],p=e.getCoordinates()[t+1],a=n.getCoordinates()[i],_=n.getCoordinates()[i+1];if(this._li.computeIntersection(u,p,a,_),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var x=0;x=0;t--){try{e.bufferReducedPrecision(t)}catch(u){if(u instanceof ml)e._saveException=u;else throw u}finally{}if(e._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],i=Sr.precisionScaleFactor(this._argGeom,this._distance,n),r=new Dn(i);this.bufferFixedPrecision(r)}};Sr.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var e=this._argGeom.getFactory().getPrecisionModel();e.getType()===Dn.FIXED?this.bufferFixedPrecision(e):this.bufferReducedPrecision()};Sr.prototype.setQuadrantSegments=function(e){this._bufParams.setQuadrantSegments(e)};Sr.prototype.bufferOriginalPrecision=function(){try{var e=new $r(this._bufParams);this._resultGeometry=e.buffer(this._argGeom,this._distance)}catch(t){if(t instanceof fl)this._saveException=t;else throw t}finally{}};Sr.prototype.getResultGeometry=function(e){return this._distance=e,this.computeGeometry(),this._resultGeometry};Sr.prototype.setEndCapStyle=function(e){this._bufParams.setEndCapStyle(e)};Sr.prototype.interfaces_=function(){return[]};Sr.prototype.getClass=function(){return Sr};Sr.bufferOp=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new Sr(e),i=n.getResultGeometry(t);return i}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof qe&&typeof arguments[1]=="number"){var r=arguments[0],u=arguments[1],p=arguments[2],a=new Sr(r);a.setQuadrantSegments(p);var _=a.getResultGeometry(u);return _}else if(arguments[2]instanceof Nn&&arguments[0]instanceof qe&&typeof arguments[1]=="number"){var x=arguments[0],S=arguments[1],L=arguments[2],A=new Sr(x,L),N=A.getResultGeometry(S);return N}}else if(arguments.length===4){var O=arguments[0],Z=arguments[1],G=arguments[2],K=arguments[3],V=new Sr(O);V.setQuadrantSegments(G),V.setEndCapStyle(K);var H=V.getResultGeometry(Z);return H}};Sr.precisionScaleFactor=function(e,t,n){var i=e.getEnvelopeInternal(),r=Ho.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY())),u=t>0?t:0,p=r+2*u,a=Math.trunc(Math.log(p)/Math.log(10)+1),_=n-a,x=Math.pow(10,_);return x};up.CAP_ROUND.get=function(){return Nn.CAP_ROUND};up.CAP_BUTT.get=function(){return Nn.CAP_FLAT};up.CAP_FLAT.get=function(){return Nn.CAP_FLAT};up.CAP_SQUARE.get=function(){return Nn.CAP_SQUARE};up.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Sr,up);var Kr=function(){this._pt=[new Dt,new Dt],this._distance=$e.NaN,this._isNull=!0};Kr.prototype.getCoordinates=function(){return this._pt};Kr.prototype.getCoordinate=function(e){return this._pt[e]};Kr.prototype.setMinimum=function(){if(arguments.length===1){var e=arguments[0];this.setMinimum(e._pt[0],e._pt[1])}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(t,n),null;var i=t.distance(n);ithis._distance&&this.initialize(t,n,i)}};Kr.prototype.interfaces_=function(){return[]};Kr.prototype.getClass=function(){return Kr};var Da=function(){};Da.prototype.interfaces_=function(){return[]};Da.prototype.getClass=function(){return Da};Da.computeDistance=function(){if(arguments[2]instanceof Kr&&arguments[0]instanceof Ti&&arguments[1]instanceof Dt)for(var e=arguments[0],t=arguments[1],n=arguments[2],i=e.getCoordinates(),r=new Oe,u=0;u0||this._isIn?zt.INTERIOR:zt.EXTERIOR)};Fs.prototype.interfaces_=function(){return[]};Fs.prototype.getClass=function(){return Fs};var Jr=function e(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var t=arguments[0],n=arguments[1];e.call(this,t,e.INSIDE_AREA,n)}else if(arguments.length===3){var i=arguments[0],r=arguments[1],u=arguments[2];this._component=i,this._segIndex=r,this._pt=u}},Bx={INSIDE_AREA:{configurable:!0}};Jr.prototype.isInsideArea=function(){return this._segIndex===Jr.INSIDE_AREA};Jr.prototype.getCoordinate=function(){return this._pt};Jr.prototype.getGeometryComponent=function(){return this._component};Jr.prototype.getSegmentIndex=function(){return this._segIndex};Jr.prototype.interfaces_=function(){return[]};Jr.prototype.getClass=function(){return Jr};Bx.INSIDE_AREA.get=function(){return-1};Object.defineProperties(Jr,Bx);var Wl=function(e){this._pts=e||null};Wl.prototype.filter=function(e){e instanceof Mo&&this._pts.add(e)};Wl.prototype.interfaces_=function(){return[ca]};Wl.prototype.getClass=function(){return Wl};Wl.getPoints=function(){if(arguments.length===1){var e=arguments[0];return e instanceof Mo?Os.singletonList(e):Wl.getPoints(e,new ce)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];return t instanceof Mo?n.add(t):t instanceof to&&t.apply(new Wl(n)),n}};var Cc=function(){this._locations=null;var e=arguments[0];this._locations=e};Cc.prototype.filter=function(e){(e instanceof Mo||e instanceof Ti||e instanceof $i)&&this._locations.add(new Jr(e,0,e.getCoordinate()))};Cc.prototype.interfaces_=function(){return[ca]};Cc.prototype.getClass=function(){return Cc};Cc.getLocations=function(e){var t=new ce;return e.apply(new Cc(t)),t};var Lr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Fs,this._minDistanceLocation=null,this._minDistance=$e.MAX_VALUE,arguments.length===2){var e=arguments[0],t=arguments[1];this._geom=[e,t],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],i=arguments[1],r=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i,this._terminateDistance=r}};Lr.prototype.computeContainmentDistance=function(){var e=this;if(arguments.length===0){var t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],r=1-n,u=pl.getPolygons(this._geom[n]);if(u.size()>0){var p=Cc.getLocations(this._geom[r]);if(this.computeContainmentDistance(p,u,i),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[r]=i[0],this._minDistanceLocation[n]=i[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Ze(arguments[0],As)&&Ze(arguments[1],As)){for(var a=arguments[0],_=arguments[1],x=arguments[2],S=0;Sthis._minDistance)return null;for(var r=t.getCoordinates(),u=n.getCoordinate(),p=0;pthis._minDistance)return null;for(var N=S.getCoordinates(),O=L.getCoordinates(),Z=0;Zthis._distance&&this.initialize(t,n,i)}};Fr.prototype.interfaces_=function(){return[]};Fr.prototype.getClass=function(){return Fr};var na=function(){};na.prototype.interfaces_=function(){return[]};na.prototype.getClass=function(){return na};na.computeDistance=function(){if(arguments[2]instanceof Fr&&arguments[0]instanceof Ti&&arguments[1]instanceof Dt)for(var e=arguments[0],t=arguments[1],n=arguments[2],i=new Oe,r=e.getCoordinates(),u=0;u1||e<=0)throw new fi("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=e};ms.prototype.compute=function(e,t){this.computeOrientedDistance(e,t,this._ptDist),this.computeOrientedDistance(t,e,this._ptDist)};ms.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};ms.prototype.computeOrientedDistance=function(e,t,n){var i=new Tc(t);if(e.apply(i),n.setMaximum(i.getMaxPointDistance()),this._densifyFrac>0){var r=new eu(t,this._densifyFrac);e.apply(r),n.setMaximum(r.getMaxPointDistance())}};ms.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};ms.prototype.interfaces_=function(){return[]};ms.prototype.getClass=function(){return ms};ms.distance=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new ms(e,t);return n.distance()}else if(arguments.length===3){var i=arguments[0],r=arguments[1],u=arguments[2],p=new ms(i,r);return p.setDensifyFraction(u),p.distance()}};Uy.MaxPointDistanceFilter.get=function(){return Tc};Uy.MaxDensifiedByFractionDistanceFilter.get=function(){return eu};Object.defineProperties(ms,Uy);var Tc=function(){this._maxPtDist=new Fr,this._minPtDist=new Fr,this._euclideanDist=new na,this._geom=null;var e=arguments[0];this._geom=e};Tc.prototype.filter=function(e){this._minPtDist.initialize(),na.computeDistance(this._geom,e,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Tc.prototype.getMaxPointDistance=function(){return this._maxPtDist};Tc.prototype.interfaces_=function(){return[Fa]};Tc.prototype.getClass=function(){return Tc};var eu=function(){this._maxPtDist=new Fr,this._minPtDist=new Fr,this._geom=null,this._numSubSegs=0;var e=arguments[0],t=arguments[1];this._geom=e,this._numSubSegs=Math.trunc(Math.round(1/t))};eu.prototype.filter=function(e,t){var n=this;if(t===0)return null;for(var i=e.getCoordinate(t-1),r=e.getCoordinate(t),u=(r.x-i.x)/this._numSubSegs,p=(r.y-i.y)/this._numSubSegs,a=0;an){this._isValid=!1;var r=i.getCoordinates();this._errorLocation=r[1],this._errorIndicator=e.getFactory().createLineString(r),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Ns.toLineString(r[0],r[1])+")"}};Lo.prototype.isValid=function(){var e=Math.abs(this._bufDistance),t=Lo.MAX_DISTANCE_DIFF_FRAC*e;return this._minValidDistance=e-t,this._maxValidDistance=e+t,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Lo.VERBOSE&&Cr.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};Lo.prototype.checkNegativeValid=function(){if(!(this._input instanceof $i||this._input instanceof Oa||this._input instanceof to))return null;var e=this.getPolygonLines(this._input);if(this.checkMinimumDistance(e,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(e,this._result,this._maxValidDistance)};Lo.prototype.getErrorIndicator=function(){return this._errorIndicator};Lo.prototype.checkMinimumDistance=function(e,t,n){var i=new Lr(e,t,n);if(this._minDistanceFound=i.distance(),this._minDistanceFound0&&e>t&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&e=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Mr.prototype.report=function(e){if(!Mr.VERBOSE)return null;Cr.out.println("Check "+e+": "+(this._isValid?"passed":"FAILED"))};Mr.prototype.getErrorMessage=function(){return this._errorMsg};Mr.prototype.interfaces_=function(){return[]};Mr.prototype.getClass=function(){return Mr};Mr.isValidMsg=function(e,t,n){var i=new Mr(e,t,n);return i.isValid()?null:i.getErrorMessage()};Mr.isValid=function(e,t,n){var i=new Mr(e,t,n);return!!i.isValid()};jy.VERBOSE.get=function(){return!1};jy.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Mr,jy);var ga=function(){this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};ga.prototype.getCoordinates=function(){return this._pts};ga.prototype.size=function(){return this._pts.length};ga.prototype.getCoordinate=function(e){return this._pts[e]};ga.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};ga.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:wc.octant(this.getCoordinate(e),this.getCoordinate(e+1))};ga.prototype.setData=function(e){this._data=e};ga.prototype.getData=function(){return this._data};ga.prototype.toString=function(){return Ns.toLineString(new ki(this._pts))};ga.prototype.interfaces_=function(){return[Ua]};ga.prototype.getClass=function(){return ga};var br=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new ce,this._intersectionCount=0,this._keepIntersections=!0;var e=arguments[0];this._li=e,this._interiorIntersection=null};br.prototype.getInteriorIntersection=function(){return this._interiorIntersection};br.prototype.setCheckEndSegmentsOnly=function(e){this._isCheckEndSegmentsOnly=e};br.prototype.getIntersectionSegments=function(){return this._intSegments};br.prototype.count=function(){return this._intersectionCount};br.prototype.getIntersections=function(){return this._intersections};br.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};br.prototype.setKeepIntersections=function(e){this._keepIntersections=e};br.prototype.processIntersections=function(e,t,n,i){if(!this._findAllIntersections&&this.hasIntersection()||e===n&&t===i)return null;if(this._isCheckEndSegmentsOnly){var r=this.isEndSegment(e,t)||this.isEndSegment(n,i);if(!r)return null}var u=e.getCoordinates()[t],p=e.getCoordinates()[t+1],a=n.getCoordinates()[i],_=n.getCoordinates()[i+1];this._li.computeIntersection(u,p,a,_),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=u,this._intSegments[1]=p,this._intSegments[2]=a,this._intSegments[3]=_,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};br.prototype.isEndSegment=function(e,t){return t===0||t>=e.size()-2};br.prototype.hasIntersection=function(){return this._interiorIntersection!==null};br.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};br.prototype.interfaces_=function(){return[Vu]};br.prototype.getClass=function(){return br};br.createAllIntersectionsFinder=function(e){var t=new br(e);return t.setFindAllIntersections(!0),t};br.createAnyIntersectionFinder=function(e){return new br(e)};br.createIntersectionCounter=function(e){var t=new br(e);return t.setFindAllIntersections(!0),t.setKeepIntersections(!1),t};var Bs=function(){this._li=new Wu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var e=arguments[0];this._segStrings=e};Bs.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Bs.prototype.getIntersections=function(){return this._segInt.getIntersections()};Bs.prototype.isValid=function(){return this.execute(),this._isValid};Bs.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};Bs.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new br(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var e=new By;if(e.setSegmentIntersector(this._segInt),e.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Bs.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new ml(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Bs.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var e=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Ns.toLineString(e[0],e[1])+" and "+Ns.toLineString(e[2],e[3])};Bs.prototype.interfaces_=function(){return[]};Bs.prototype.getClass=function(){return Bs};Bs.computeIntersections=function(e){var t=new Bs(e);return t.setFindAllIntersections(!0),t.isValid(),t.getIntersections()};var ju=function e(){this._nv=null;var t=arguments[0];this._nv=new Bs(e.toSegmentStrings(t))};ju.prototype.checkValid=function(){this._nv.checkValid()};ju.prototype.interfaces_=function(){return[]};ju.prototype.getClass=function(){return ju};ju.toSegmentStrings=function(e){for(var t=new ce,n=e.iterator();n.hasNext();){var i=n.next();t.add(new ga(i.getCoordinates(),i))}return t};ju.checkValid=function(e){var t=new ju(e);t.checkValid()};var Lc=function(e){this._mapOp=e};Lc.prototype.map=function(e){for(var t=this,n=new ce,i=0;i0&&i<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};go.prototype.interfaces_=function(){return[]};go.prototype.getClass=function(){return go};var qa=function e(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Oe,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Ti&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];e.call(this,t.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var i=arguments[0],r=arguments[1];this._srcPts=i,this._isClosed=e.isClosed(i),this._snapTolerance=r}};qa.prototype.snapVertices=function(e,t){for(var n=this,i=this._isClosed?e.size()-1:e.size(),r=0;r=0&&e.add(p+1,new Dt(u),!1)}};qa.prototype.findSegmentIndexToSnap=function(e,t){for(var n=this,i=$e.MAX_VALUE,r=-1,u=0;ut&&(t=i)}return t}else if(arguments.length===2){var r=arguments[0],u=arguments[1];return Math.min(Ni.computeOverlaySnapTolerance(r),Ni.computeOverlaySnapTolerance(u))}};Ni.computeSizeBasedSnapTolerance=function(e){var t=e.getEnvelopeInternal(),n=Math.min(t.getHeight(),t.getWidth()),i=n*Ni.SNAP_PRECISION_FACTOR;return i};Ni.snapToSelf=function(e,t,n){var i=new Ni(e);return i.snapToSelf(t,n)};Vx.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Ni,Vx);var Ux=function(e){function t(n,i,r){e.call(this),this._snapTolerance=n||null,this._snapPts=i||null,this._isSelfSnap=r!==void 0?r:!1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.snapLine=function(n,i){var r=new qa(n,this._snapTolerance);return r.setAllowSnappingToSourceVertices(this._isSelfSnap),r.snapTo(i)},t.prototype.transformCoordinates=function(n,i){var r=n.toCoordinateArray(),u=this.snapLine(r,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(u)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(go),Yr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Yr.prototype.getCommon=function(){return $e.longBitsToDouble(this._commonBits)};Yr.prototype.add=function(e){var t=$e.doubleToLongBits(e);if(this._isFirst)return this._commonBits=t,this._commonSignExp=Yr.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Yr.signExpBits(t);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Yr.numCommonMostSigMantissaBits(this._commonBits,t),this._commonBits=Yr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Yr.prototype.toString=function(){if(arguments.length===1){var e=arguments[0],t=$e.longBitsToDouble(e),n=$e.toBinaryString(e),i="0000000000000000000000000000000000000000000000000000000000000000"+n,r=i.substring(i.length-64),u=r.substring(0,1)+" "+r.substring(1,12)+"(exp) "+r.substring(12)+" [ "+t+" ]";return u}};Yr.prototype.interfaces_=function(){return[]};Yr.prototype.getClass=function(){return Yr};Yr.getBit=function(e,t){var n=1<>52};Yr.zeroLowerBits=function(e,t){var n=(1<=0;i--){if(Yr.getBit(e,i)!==Yr.getBit(t,i))return n;n++}return 52};var nu=function(){this._commonCoord=null,this._ccFilter=new Pc},qy={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};nu.prototype.addCommonBits=function(e){var t=new iu(this._commonCoord);e.apply(t),e.geometryChanged()};nu.prototype.removeCommonBits=function(e){if(this._commonCoord.x===0&&this._commonCoord.y===0)return e;var t=new Dt(this._commonCoord);t.x=-t.x,t.y=-t.y;var n=new iu(t);return e.apply(n),e.geometryChanged(),e};nu.prototype.getCommonCoordinate=function(){return this._commonCoord};nu.prototype.add=function(e){e.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};nu.prototype.interfaces_=function(){return[]};nu.prototype.getClass=function(){return nu};qy.CommonCoordinateFilter.get=function(){return Pc};qy.Translater.get=function(){return iu};Object.defineProperties(nu,qy);var Pc=function(){this._commonBitsX=new Yr,this._commonBitsY=new Yr};Pc.prototype.filter=function(e){this._commonBitsX.add(e.x),this._commonBitsY.add(e.y)};Pc.prototype.getCommonCoordinate=function(){return new Dt(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Pc.prototype.interfaces_=function(){return[Fa]};Pc.prototype.getClass=function(){return Pc};var iu=function(){this.trans=null;var e=arguments[0];this.trans=e};iu.prototype.filter=function(e,t){var n=e.getOrdinate(t,0)+this.trans.x,i=e.getOrdinate(t,1)+this.trans.y;e.setOrdinate(t,0,n),e.setOrdinate(t,1,i)};iu.prototype.isDone=function(){return!1};iu.prototype.isGeometryChanged=function(){return!0};iu.prototype.interfaces_=function(){return[Ds]};iu.prototype.getClass=function(){return iu};var xr=function(e,t){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=e,this._geom[1]=t,this.computeSnapTolerance()};xr.prototype.selfSnap=function(e){var t=new Ni(e),n=t.snapTo(e,this._snapTolerance);return n};xr.prototype.removeCommonBits=function(e){this._cbr=new nu,this._cbr.add(e[0]),this._cbr.add(e[1]);var t=new Array(2).fill(null);return t[0]=this._cbr.removeCommonBits(e[0].copy()),t[1]=this._cbr.removeCommonBits(e[1].copy()),t};xr.prototype.prepareResult=function(e){return this._cbr.addCommonBits(e),e};xr.prototype.getResultGeometry=function(e){var t=this.snap(this._geom),n=rn.overlayOp(t[0],t[1],e);return this.prepareResult(n)};xr.prototype.checkValid=function(e){e.isValid()||Cr.out.println("Snapped geometry is invalid")};xr.prototype.computeSnapTolerance=function(){this._snapTolerance=Ni.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};xr.prototype.snap=function(e){var t=this.removeCommonBits(e),n=Ni.snap(t[0],t[1],this._snapTolerance);return n};xr.prototype.interfaces_=function(){return[]};xr.prototype.getClass=function(){return xr};xr.overlayOp=function(e,t,n){var i=new xr(e,t);return i.getResultGeometry(n)};xr.union=function(e,t){return xr.overlayOp(e,t,rn.UNION)};xr.intersection=function(e,t){return xr.overlayOp(e,t,rn.INTERSECTION)};xr.symDifference=function(e,t){return xr.overlayOp(e,t,rn.SYMDIFFERENCE)};xr.difference=function(e,t){return xr.overlayOp(e,t,rn.DIFFERENCE)};var io=function(e,t){this._geom=new Array(2).fill(null),this._geom[0]=e,this._geom[1]=t};io.prototype.getResultGeometry=function(e){var t=null,n=!1,i=null;try{t=rn.overlayOp(this._geom[0],this._geom[1],e);var r=!0;r&&(n=!0)}catch(u){if(u instanceof fl)i=u;else throw u}finally{}if(!n)try{t=xr.overlayOp(this._geom[0],this._geom[1],e)}catch(u){throw u instanceof fl?i:u}finally{}return t};io.prototype.interfaces_=function(){return[]};io.prototype.getClass=function(){return io};io.overlayOp=function(e,t,n){var i=new io(e,t);return i.getResultGeometry(n)};io.union=function(e,t){return io.overlayOp(e,t,rn.UNION)};io.intersection=function(e,t){return io.overlayOp(e,t,rn.INTERSECTION)};io.symDifference=function(e,t){return io.overlayOp(e,t,rn.SYMDIFFERENCE)};io.difference=function(e,t){return io.overlayOp(e,t,rn.DIFFERENCE)};var id=function(){this.mce=null,this.chainIndex=null;var e=arguments[0],t=arguments[1];this.mce=e,this.chainIndex=t};id.prototype.computeIntersections=function(e,t){this.mce.computeIntersectsForChain(this.chainIndex,e.mce,e.chainIndex,t)};id.prototype.interfaces_=function(){return[]};id.prototype.getClass=function(){return id};var ko=function e(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var t=arguments[0],n=arguments[1];this._eventType=e.DELETE,this._xValue=t,this._insertEvent=n}else if(arguments.length===3){var i=arguments[0],r=arguments[1],u=arguments[2];this._eventType=e.INSERT,this._label=i,this._xValue=r,this._obj=u}},Zy={INSERT:{configurable:!0},DELETE:{configurable:!0}};ko.prototype.isDelete=function(){return this._eventType===ko.DELETE};ko.prototype.setDeleteEventIndex=function(e){this._deleteEventIndex=e};ko.prototype.getObject=function(){return this._obj};ko.prototype.compareTo=function(e){var t=e;return this._xValuet._xValue?1:this._eventTypet._eventType?1:0};ko.prototype.getInsertEvent=function(){return this._insertEvent};ko.prototype.isInsert=function(){return this._eventType===ko.INSERT};ko.prototype.isSameLabel=function(e){return this._label===null?!1:this._label===e._label};ko.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};ko.prototype.interfaces_=function(){return[vs]};ko.prototype.getClass=function(){return ko};Zy.INSERT.get=function(){return 1};Zy.DELETE.get=function(){return 2};Object.defineProperties(ko,Zy);var rg=function(){};rg.prototype.interfaces_=function(){return[]};rg.prototype.getClass=function(){return rg};var Pr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var e=arguments[0],t=arguments[1],n=arguments[2];this._li=e,this._includeProper=t,this._recordIsolated=n};Pr.prototype.isTrivialIntersection=function(e,t,n,i){if(e===n&&this._li.getIntersectionNum()===1){if(Pr.isAdjacentSegments(t,i))return!0;if(e.isClosed()){var r=e.getNumPoints()-1;if(t===0&&i===r||i===0&&t===r)return!0}}return!1};Pr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Pr.prototype.setIsDoneIfProperInt=function(e){this._isDoneWhenProperInt=e};Pr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Pr.prototype.isBoundaryPointInternal=function(e,t){for(var n=t.iterator();n.hasNext();){var i=n.next(),r=i.getCoordinate();if(e.isIntersection(r))return!0}return!1};Pr.prototype.hasProperIntersection=function(){return this._hasProper};Pr.prototype.hasIntersection=function(){return this._hasIntersection};Pr.prototype.isDone=function(){return this._isDone};Pr.prototype.isBoundaryPoint=function(e,t){return t===null?!1:!!(this.isBoundaryPointInternal(e,t[0])||this.isBoundaryPointInternal(e,t[1]))};Pr.prototype.setBoundaryNodes=function(e,t){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=e,this._bdyNodes[1]=t};Pr.prototype.addIntersections=function(e,t,n,i){if(e===n&&t===i)return null;this.numTests++;var r=e.getCoordinates()[t],u=e.getCoordinates()[t+1],p=n.getCoordinates()[i],a=n.getCoordinates()[i+1];this._li.computeIntersection(r,u,p,a),this._li.hasIntersection()&&(this._recordIsolated&&(e.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(e,t,n,i)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(e.addIntersections(this._li,t,0),n.addIntersections(this._li,i,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};Pr.prototype.interfaces_=function(){return[]};Pr.prototype.getClass=function(){return Pr};Pr.isAdjacentSegments=function(e,t){return Math.abs(e-t)===1};var kC=function(e){function t(){e.call(this),this.events=new ce,this.nOverlaps=null}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.prepareEvents=function(){var n=this;Os.sort(this.events);for(var i=0;it||this._maxu?1:0};rd.prototype.interfaces_=function(){return[Dh]};rd.prototype.getClass=function(){return rd};var NC=function(e){function t(){e.call(this),this._item=null;var n=arguments[0],i=arguments[1],r=arguments[2];this._min=n,this._max=i,this._item=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.query=function(n,i,r){if(!this.intersects(n,i))return null;r.visitItem(this._item)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Za),DC=function(e){function t(){e.call(this),this._node1=null,this._node2=null;var n=arguments[0],i=arguments[1];this._node1=n,this._node2=i,this.buildExtent(this._node1,this._node2)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.buildExtent=function(n,i){this._min=Math.min(n._min,i._min),this._max=Math.max(n._max,i._max)},t.prototype.query=function(n,i,r){if(!this.intersects(n,i))return null;this._node1!==null&&this._node1.query(n,i,r),this._node2!==null&&this._node2.query(n,i,r)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Za),Wa=function(){this._leaves=new ce,this._root=null,this._level=0};Wa.prototype.buildTree=function(){var e=this;Os.sort(this._leaves,new Za.NodeComparator);for(var t=this._leaves,n=null,i=new ce;;){if(e.buildLevel(t,i),i.size()===1)return i.get(0);n=t,t=i,i=n}};Wa.prototype.insert=function(e,t,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new NC(e,t,n))};Wa.prototype.query=function(e,t,n){this.init(),this._root.query(e,t,n)};Wa.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};Wa.prototype.printNode=function(e){Cr.out.println(Ns.toLineString(new Dt(e._min,this._level),new Dt(e._max,this._level)))};Wa.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};Wa.prototype.buildLevel=function(e,t){this._level++,t.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,i[0]),this.insertBoundaryPoint(this._argIndex,i[i.length-1])},t.prototype.getInvalidPoint=function(){return this._invalidPoint},t.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),i=new Array(n.size()).fill(null),r=0,u=n.iterator();u.hasNext();){var p=u.next();i[r++]=p.getCoordinate().copy()}return i},t.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},t.prototype.addSelfIntersectionNode=function(n,i,r){if(this.isBoundaryNode(n,i))return null;r===zt.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,i):this.insertPoint(n,i,r)},t.prototype.addPolygonRing=function(n,i,r){if(n.isEmpty())return null;var u=_n.removeRepeatedPoints(n.getCoordinates());if(u.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=u[0],null;var p=i,a=r;ve.isCCW(u)&&(p=r,a=i);var _=new ig(u,new Vn(this._argIndex,zt.BOUNDARY,p,a));this._lineEdgeMap.put(n,_),this.insertEdge(_),this.insertPoint(this._argIndex,u[0],zt.BOUNDARY)},t.prototype.insertPoint=function(n,i,r){var u=this._nodes.addNode(i),p=u.getLabel();p===null?u._label=new Vn(n,r):p.setLocation(n,r)},t.prototype.createEdgeSetIntersector=function(){return new kC},t.prototype.addSelfIntersectionNodes=function(n){for(var i=this,r=this._edges.iterator();r.hasNext();)for(var u=r.next(),p=u.getLabel().getLocation(n),a=u.eiList.iterator();a.hasNext();){var _=a.next();i.addSelfIntersectionNode(n,_.coord,p)}},t.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof Oa&&(this._useBoundaryDeterminationRule=!1),n instanceof $i)this.addPolygon(n);else if(n instanceof Ti)this.addLineString(n);else if(n instanceof Mo)this.addPoint(n);else if(n instanceof Uh)this.addCollection(n);else if(n instanceof zu)this.addCollection(n);else if(n instanceof Oa)this.addCollection(n);else if(n instanceof to)this.addCollection(n);else throw new Error(n.getClass().getName())}else return e.prototype.add.apply(this,arguments)},t.prototype.addCollection=function(n){for(var i=this,r=0;r50?(this._areaPtLocator===null&&(this._areaPtLocator=new Hh(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},t.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return e.prototype.findEdge.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.determineBoundary=function(n,i){return n.isInBoundary(i)?zt.BOUNDARY:zt.INTERIOR},t}(yi),Kh=function(){if(this._li=new Wu,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var e=arguments[0];this.setComputationPrecision(e.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new xf(0,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],i=gs.OGC_SFS_BOUNDARY_RULE;t.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(t.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new xf(0,t,i),this._arg[1]=new xf(1,n,i)}else if(arguments.length===3){var r=arguments[0],u=arguments[1],p=arguments[2];r.getPrecisionModel().compareTo(u.getPrecisionModel())>=0?this.setComputationPrecision(r.getPrecisionModel()):this.setComputationPrecision(u.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new xf(0,r,p),this._arg[1]=new xf(1,u,p)}};Kh.prototype.getArgGeometry=function(e){return this._arg[e].getGeometry()};Kh.prototype.setComputationPrecision=function(e){this._resultPrecisionModel=e,this._li.setPrecisionModel(this._resultPrecisionModel)};Kh.prototype.interfaces_=function(){return[]};Kh.prototype.getClass=function(){return Kh};var Nu=function(){};Nu.prototype.interfaces_=function(){return[]};Nu.prototype.getClass=function(){return Nu};Nu.map=function(){if(arguments[0]instanceof qe&&Ze(arguments[1],Nu.MapOp)){for(var e=arguments[0],t=arguments[1],n=new ce,i=0;i=e.size()?null:e.get(t)};Ui.union=function(e){var t=new Ui(e);return t.union()};qx.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(Ui,qx);var og=function(){};og.prototype.interfaces_=function(){return[]};og.prototype.getClass=function(){return og};og.union=function(e,t){if(e.isEmpty()||t.isEmpty()){if(e.isEmpty()&&t.isEmpty())return rn.createEmptyResult(rn.UNION,e,t,e.getFactory());if(e.isEmpty())return t.copy();if(t.isEmpty())return e.copy()}return e.checkNotGeometryCollection(e),e.checkNotGeometryCollection(t),io.overlayOp(e,t,rn.UNION)};function Xu(){return new sg}function sg(){this.reset()}sg.prototype={constructor:sg,reset:function(){this.s=this.t=0},add:function(e){y1(km,e,this.t),y1(this,km.s,this.s),this.s?this.t+=km.t:this.s=km.t},valueOf:function(){return this.s}};var km=new sg;function y1(e,t,n){var i=e.s=t+n,r=i-t,u=i-r;e.t=t-u+(n-r)}var Ei=1e-6,Kn=Math.PI,hl=Kn/2,v1=Kn/4,yl=Kn*2,Tu=180/Kn,$s=Kn/180,Qr=Math.abs,RC=Math.atan,Qh=Math.atan2,Yi=Math.cos,Ki=Math.sin,cp=Math.sqrt;function Zx(e){return e>1?0:e<-1?Kn:Math.acos(e)}function Ac(e){return e>1?hl:e<-1?-hl:Math.asin(e)}function kf(){}function ag(e,t){e&&x1.hasOwnProperty(e.type)&&x1[e.type](e,t)}var b1={Feature:function(e,t){ag(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,i=-1,r=n.length;++iKn?e-yl:e<-Kn?e+yl:e,t]}by.invert=by;function zC(e,t,n){return(e%=yl)?t||n?Wx(E1(e),I1(t,n)):E1(e):t||n?I1(t,n):by}function S1(e){return function(t,n){return t+=e,[t>Kn?t-yl:t<-Kn?t+yl:t,n]}}function E1(e){var t=S1(e);return t.invert=S1(-e),t}function I1(e,t){var n=Yi(e),i=Ki(e),r=Yi(t),u=Ki(t);function p(a,_){var x=Yi(_),S=Yi(a)*x,L=Ki(a)*x,A=Ki(_),N=A*n+S*i;return[Qh(L*r-N*u,S*n-A*i),Ac(N*r+L*u)]}return p.invert=function(a,_){var x=Yi(_),S=Yi(a)*x,L=Ki(a)*x,A=Ki(_),N=A*r-L*u;return[Qh(L*r+A*u,S*n+N*i),Ac(N*n-S*i)]},p}function FC(e,t,n,i,r,u){if(n){var p=Yi(t),a=Ki(t),_=i*n;r==null?(r=t+i*yl,u=t-_/2):(r=C1(p,r),u=C1(p,u),(i>0?ru)&&(r+=i*yl));for(var x,S=r;i>0?S>u:S1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function BC(e,t,n,i,r,u){var p=e[0],a=e[1],_=t[0],x=t[1],S=0,L=1,A=_-p,N=x-a,O;if(O=n-p,!(!A&&O>0)){if(O/=A,A<0){if(O0){if(O>L)return;O>S&&(S=O)}if(O=r-p,!(!A&&O<0)){if(O/=A,A<0){if(O>L)return;O>S&&(S=O)}else if(A>0){if(O0)){if(O/=N,N<0){if(O0){if(O>L)return;O>S&&(S=O)}if(O=u-a,!(!N&&O<0)){if(O/=N,N<0){if(O>L)return;O>S&&(S=O)}else if(N>0){if(O0&&(e[0]=p+S*A,e[1]=a+S*N),L<1&&(t[0]=p+L*A,t[1]=a+L*N),!0}}}}}function jm(e,t){return Qr(e[0]-t[0])=0;--a)r.point((L=S[a])[0],L[1]);else i(A.x,A.p.x,-1,r);A=A.p}A=A.o,S=A.z,N=!N}while(!A.v);r.lineEnd()}}}function T1(e){if(t=e.length){for(var t,n=0,i=e[0],r;++nt?1:e>=t?0:NaN}function VC(e){return e.length===1&&(e=UC(e)),{left:function(t,n,i,r){for(i==null&&(i=0),r==null&&(r=t.length);i>>1;e(t[u],n)<0?i=u+1:r=u}return i},right:function(t,n,i,r){for(i==null&&(i=0),r==null&&(r=t.length);i>>1;e(t[u],n)>0?r=u:i=u+1}return i}}}function UC(e){return function(t,n){return Yx(e(t),n)}}VC(Yx);function Kx(e){for(var t=e.length,n,i=-1,r=0,u,p;++i=0;)for(p=e[t],n=p.length;--n>=0;)u[--r]=p[n];return u}var Nf=1e9,Om=-Nf;function GC(e,t,n,i){function r(x,S){return e<=x&&x<=n&&t<=S&&S<=i}function u(x,S,L,A){var N=0,O=0;if(x==null||(N=p(x,L))!==(O=p(S,L))||_(x,S)<0^L>0)do A.point(N===0||N===3?e:n,N>1?i:t);while((N=(N+L+4)%4)!==O);else A.point(S[0],S[1])}function p(x,S){return Qr(x[0]-e)0?0:3:Qr(x[0]-n)0?2:1:Qr(x[1]-t)0?1:0:S>0?3:2}function a(x,S){return _(x.x,S.x)}function _(x,S){var L=p(x,1),A=p(S,1);return L!==A?L-A:L===0?S[1]-x[1]:L===1?x[0]-S[0]:L===2?x[1]-S[1]:S[0]-x[0]}return function(x){var S=x,L=Xx(),A,N,O,Z,G,K,V,H,Q,it,ht,ft={point:dt,lineStart:yt,lineEnd:de,polygonStart:Mt,polygonEnd:xt};function dt(Gt,Kt){r(Gt,Kt)&&S.point(Gt,Kt)}function ut(){for(var Gt=0,Kt=0,be=N.length;Kti&&(fn-ke)*(i-Be)>(Mn-Be)*(e-ke)&&++Gt:Mn<=i&&(fn-ke)*(i-Be)<(Mn-Be)*(e-ke)&&--Gt;return Gt}function Mt(){S=L,A=[],N=[],ht=!0}function xt(){var Gt=ut(),Kt=ht&&Gt,be=(A=Kx(A)).length;(Kt||be)&&(x.polygonStart(),Kt&&(x.lineStart(),u(null,null,1,x),x.lineEnd()),be&&Hx(A,a,Gt,u,x),x.polygonEnd()),S=x,A=N=O=null}function yt(){ft.point=Rt,N&&N.push(O=[]),it=!0,Q=!1,V=H=NaN}function de(){A&&(Rt(Z,G),K&&Q&&L.rejoin(),A.push(L.result())),ft.point=dt,Q&&S.lineEnd()}function Rt(Gt,Kt){var be=r(Gt,Kt);if(N&&O.push([Gt,Kt]),it)Z=Gt,G=Kt,K=be,it=!1,be&&(S.lineStart(),S.point(Gt,Kt));else if(be&&Q)S.point(Gt,Kt);else{var me=[V=Math.max(Om,Math.min(Nf,V)),H=Math.max(Om,Math.min(Nf,H))],an=[Gt=Math.max(Om,Math.min(Nf,Gt)),Kt=Math.max(Om,Math.min(Nf,Kt))];BC(me,an,e,t,n,i)?(Q||(S.lineStart(),S.point(me[0],me[1])),S.point(an[0],an[1]),be||S.lineEnd(),ht=!1):be&&(S.lineStart(),S.point(Gt,Kt),ht=!1)}V=Gt,H=Kt,Q=be}return ft}}var Y_=Xu();function jC(e,t){var n=t[0],i=t[1],r=[Ki(n),-Yi(n),0],u=0,p=0;Y_.reset();for(var a=0,_=e.length;a<_;++a)if(S=(x=e[a]).length)for(var x,S,L=x[S-1],A=L[0],N=L[1]/2+v1,O=Ki(N),Z=Yi(N),G=0;G=0?1:-1,dt=ft*ht,ut=dt>Kn,Mt=O*Q;if(Y_.add(Qh(Mt*ft*Ki(dt),Z*it+Mt*Yi(dt))),u+=ut?ht+ft*yl:ht,ut^A>=n^V>=n){var xt=lg($h(L),$h(K));vy(xt);var yt=lg(r,xt);vy(yt);var de=(ut^ht>=0?-1:1)*Ac(yt[2]);(i>de||i===de&&(xt[0]||xt[1]))&&(p+=ut^ht>=0?1:-1)}}return(u<-Ei||uod&&(od=e),tcg&&(cg=t)}Xu();function Jx(e,t,n,i){return function(r,u){var p=t(u),a=r.invert(i[0],i[1]),_=Xx(),x=t(_),S=!1,L,A,N,O={point:Z,lineStart:K,lineEnd:V,polygonStart:function(){O.point=H,O.lineStart=Q,O.lineEnd=it,A=[],L=[]},polygonEnd:function(){O.point=Z,O.lineStart=K,O.lineEnd=V,A=Kx(A);var ht=jC(L,a);A.length?(S||(u.polygonStart(),S=!0),Hx(A,WC,ht,n,u)):ht&&(S||(u.polygonStart(),S=!0),u.lineStart(),n(null,null,1,u),u.lineEnd()),S&&(u.polygonEnd(),S=!1),A=L=null},sphere:function(){u.polygonStart(),u.lineStart(),n(null,null,1,u),u.lineEnd(),u.polygonEnd()}};function Z(ht,ft){var dt=r(ht,ft);e(ht=dt[0],ft=dt[1])&&u.point(ht,ft)}function G(ht,ft){var dt=r(ht,ft);p.point(dt[0],dt[1])}function K(){O.point=G,p.lineStart()}function V(){O.point=Z,p.lineEnd()}function H(ht,ft){N.push([ht,ft]);var dt=r(ht,ft);x.point(dt[0],dt[1])}function Q(){x.lineStart(),N=[]}function it(){H(N[0][0],N[0][1]),x.lineEnd();var ht=x.clean(),ft=_.result(),dt,ut=ft.length,Mt,xt,yt;if(N.pop(),L.push(N),N=null,!!ut){if(ht&1){if(xt=ft[0],(Mt=xt.length-1)>0){for(S||(u.polygonStart(),S=!0),u.lineStart(),dt=0;dt1&&ht&2&&ft.push(ft.pop().concat(ft.shift())),A.push(ft.filter(ZC))}}return O}}function ZC(e){return e.length>1}function WC(e,t){return((e=e.x)[0]<0?e[1]-hl-Ei:hl-e[1])-((t=t.x)[0]<0?t[1]-hl-Ei:hl-t[1])}const P1=Jx(function(){return!0},XC,YC,[-Kn,-hl]);function XC(e){var t=NaN,n=NaN,i=NaN,r;return{lineStart:function(){e.lineStart(),r=1},point:function(u,p){var a=u>0?Kn:-Kn,_=Qr(u-t);Qr(_-Kn)0?hl:-hl),e.point(i,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(u,n),r=0):i!==a&&_>=Kn&&(Qr(t-i)Ei?RC((Ki(t)*(u=Yi(i))*Ki(n)-Ki(i)*(r=Yi(t))*Ki(e))/(r*u*p)):(t+i)/2}function YC(e,t,n,i){var r;if(e==null)r=n*hl,i.point(-Kn,r),i.point(0,r),i.point(Kn,r),i.point(Kn,0),i.point(Kn,-r),i.point(0,-r),i.point(-Kn,-r),i.point(-Kn,0),i.point(-Kn,r);else if(Qr(e[0]-t[0])>Ei){var u=e[0]0,r=Qr(n)>Ei;function u(S,L,A,N){FC(N,e,t,A,S,L)}function p(S,L){return Yi(S)*Yi(L)>n}function a(S){var L,A,N,O,Z;return{lineStart:function(){O=N=!1,Z=1},point:function(G,K){var V=[G,K],H,Q=p(G,K),it=i?Q?0:x(G,K):Q?x(G+(G<0?Kn:-Kn),K):0;if(!L&&(O=N=Q)&&S.lineStart(),Q!==N&&(H=_(L,V),(!H||jm(L,H)||jm(V,H))&&(V[0]+=Ei,V[1]+=Ei,Q=p(V[0],V[1]))),Q!==N)Z=0,Q?(S.lineStart(),H=_(V,L),S.point(H[0],H[1])):(H=_(L,V),S.point(H[0],H[1]),S.lineEnd()),L=H;else if(r&&L&&i^Q){var ht;!(it&A)&&(ht=_(V,L,!0))&&(Z=0,i?(S.lineStart(),S.point(ht[0][0],ht[0][1]),S.point(ht[1][0],ht[1][1]),S.lineEnd()):(S.point(ht[1][0],ht[1][1]),S.lineEnd(),S.lineStart(),S.point(ht[0][0],ht[0][1])))}Q&&(!L||!jm(L,V))&&S.point(V[0],V[1]),L=V,N=Q,A=it},lineEnd:function(){N&&S.lineEnd(),L=null},clean:function(){return Z|(O&&N)<<1}}}function _(S,L,A){var N=$h(S),O=$h(L),Z=[1,0,0],G=lg(N,O),K=Nm(G,G),V=G[0],H=K-V*V;if(!H)return!A&&S;var Q=n*K/H,it=-n*V/H,ht=lg(Z,G),ft=Dm(Z,Q),dt=Dm(G,it);H_(ft,dt);var ut=ht,Mt=Nm(ft,ut),xt=Nm(ut,ut),yt=Mt*Mt-xt*(Nm(ft,ft)-1);if(!(yt<0)){var de=cp(yt),Rt=Dm(ut,(-Mt-de)/xt);if(H_(Rt,ft),Rt=yy(Rt),!A)return Rt;var Gt=S[0],Kt=L[0],be=S[1],me=L[1],an;Kt0^Rt[1]<(Qr(Rt[0]-Gt)Kn^(Gt<=Rt[0]&&Rt[0]<=Kt)){var Be=Dm(ut,(-Mt+de)/xt);return H_(Be,ft),[Rt,yy(Be)]}}}function x(S,L){var A=i?e:Kn-e,N=0;return S<-A?N|=1:S>A&&(N|=2),L<-A?N|=4:L>A&&(N|=8),N}return Jx(p,a,u,i?[0,-e]:[-Kn,e-Kn])}function Qx(e){return function(t){var n=new xy;for(var i in e)n[i]=e[i];return n.stream=t,n}}function xy(){}xy.prototype={constructor:xy,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function $x(e,t,n){var i=t[1][0]-t[0][0],r=t[1][1]-t[0][1],u=e.clipExtent&&e.clipExtent();e.scale(150).translate([0,0]),u!=null&&e.clipExtent(null),OC(n,e.stream(M1));var p=M1.result(),a=Math.min(i/(p[1][0]-p[0][0]),r/(p[1][1]-p[0][1])),_=+t[0][0]+(i-a*(p[1][0]+p[0][0]))/2,x=+t[0][1]+(r-a*(p[1][1]+p[0][1]))/2;return u!=null&&e.clipExtent(u),e.scale(a*150).translate([_,x])}function JC(e,t,n){return $x(e,[[0,0],t],n)}var A1=16,QC=Yi(30*$s);function k1(e,t){return+t?tT(e,t):$C(e)}function $C(e){return Qx({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function tT(e,t){function n(i,r,u,p,a,_,x,S,L,A,N,O,Z,G){var K=x-i,V=S-r,H=K*K+V*V;if(H>4*t&&Z--){var Q=p+A,it=a+N,ht=_+O,ft=cp(Q*Q+it*it+ht*ht),dt=Ac(ht/=ft),ut=Qr(Qr(ht)-1)t||Qr((K*de+V*Rt)/H-.5)>.3||p*A+a*N+_*O2?Rt[2]%360*$s:0,yt()):[x*Tu,S*Tu,L*Tu]},ut.precision=function(Rt){return arguments.length?(ht=k1(xt,it=Rt*Rt),de()):cp(it)},ut.fitExtent=function(Rt,Gt){return $x(ut,Rt,Gt)},ut.fitSize=function(Rt,Gt){return JC(ut,Rt,Gt)};function yt(){N=Wx(A=zC(x,S,L),t);var Rt=t(a,_);return u=i-Rt[0]*n,p=r+Rt[1]*n,de()}function de(){return ft=dt=null,ut}return function(){return t=e.apply(this,arguments),ut.invert=t.invert&&Mt,yt()}}function tw(e){return function(t,n){var i=Yi(t),r=Yi(n),u=e(i*r);return[u*r*Ki(t),u*Ki(n)]}}function ew(e){return function(t,n){var i=cp(t*t+n*n),r=e(i),u=Ki(r),p=Yi(r);return[Qh(t*u,i*p),Ac(i&&n*u/i)]}}var rT=tw(function(e){return cp(2/(1+e))});rT.invert=ew(function(e){return 2*Ac(e/2)});var nw=tw(function(e){return(e=Zx(e))&&e/Ki(e)});nw.invert=ew(function(e){return e});function oT(){return nT(nw).scale(79.4188).clipAngle(180-.001)}function N1(e,t){return[e,t]}N1.invert=N1;function sT(e,t,n){n=n||{};var i=n.units||"kilometers",r=n.steps||8;if(!e)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof r!="number")throw new Error("steps must be an number");if(t===void 0)throw new Error("radius is required");if(r<=0)throw new Error("steps must be greater than 0");var u=[];switch(e.type){case"GeometryCollection":return _x(e,function(p){var a=qm(p,t,i,r);a&&u.push(a)}),dy(u);case"FeatureCollection":return f1(e,function(p){var a=qm(p,t,i,r);a&&f1(a,function(_){_&&u.push(_)})}),dy(u)}return qm(e,t,i,r)}function qm(e,t,n,i){var r=e.properties||{},u=e.type==="Feature"?e.geometry:e;if(u.type==="GeometryCollection"){var p=[];return _x(e,function(Z){var G=qm(Z,t,n,i);G&&p.push(G)}),dy(p)}var a=aT(u),_={type:u.type,coordinates:rw(u.coordinates,a)},x=new Fy,S=x.read(_),L=dC(mC(t,n),"meters"),A=Sr.bufferOp(S,L,i),N=new Tx;if(A=N.write(A),!iw(A.coordinates)){var O={type:A.type,coordinates:ow(A.coordinates,a)};return yg(O,r)}}function iw(e){return Array.isArray(e[0])?iw(e[0]):isNaN(e[0])}function rw(e,t){return typeof e[0]!="object"?t(e):e.map(function(n){return rw(n,t)})}function ow(e,t){return typeof e[0]!="object"?t.invert(e):e.map(function(n){return ow(n,t)})}function aT(e){var t=_C(e).geometry.coordinates,n=[-t[0],-t[1]];return oT().rotate(n).scale(jo)}function lT(e,t){var n=tg(e),i=tg(t),r=e.properties||{},u=px.difference(n.coordinates,i.coordinates);return u.length===0?null:u.length===1?dx(u[0],r):mx(u,r)}function D1(e){let t;for(const n of e)t&&n[0]-t[0]>=180?n[0]-=360:t&&n[0]-t[0]<-180&&(n[0]+=360),t=n}function R1(e,t){const n=lT({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},e);if(!n)return;n.properties={isMask:"y"};const i=sT(e,0);if(i.geometry.type==="Polygon")for(const r of i.geometry.coordinates)D1(r);else for(const r of i.geometry.coordinates)for(const u of r)D1(u);t({type:"FeatureCollection",features:[i,n]})}let O1={type:"FeatureCollection",features:[]};function uT(e,t,n=!0,i=!0,r={},u={},p={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"]]}}){let a,_=[],x,S;function L(){(p!=null&&p.fill||p!=null&&p.line)&&e.addSource("full-geom",{type:"geojson",data:O1}),p!=null&&p.fill&&e.addLayer({...p==null?void 0:p.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),p!=null&&p.line&&e.addLayer({...p==null?void 0:p.line,id:"full-geom-line",type:"line",source:"full-geom"})}e.loaded()?L():e.once("load",()=>{L()});const A=O=>{a==null||a({type:"mapClick",coordinates:[O.lngLat.lng,O.lngLat.lat]})};function N(O=!1){if(!t)throw new Error;const Z=document.createElement("div");return O&&Z.classList.add("marker-interactive"),new FI({props:{displayIn:"maplibre"},target:Z}),new t.Marker({element:Z,offset:[1,-13]})}return{setEventHandler(O){O?(a=O,e.on("click",A)):(a=void 0,e.off("click",A))},flyTo(O,Z){e.flyTo({center:O,zoom:Z,...r})},fitBounds(O,Z,G){e.fitBounds([[O[0],O[1]],[O[2],O[3]]],{padding:Z,maxZoom:G,...u})},indicateReverse(O){e.getCanvasContainer().style.cursor=O?"crosshair":""},setReverseMarker(O){!t||!n||(S?O?S.setLngLat(O):(S.remove(),S=void 0):O&&(S=(typeof n=="object"?new t.Marker(n):N()).setLngLat(O).addTo(e),S.getElement().classList.add("marker-reverse")))},setMarkers(O,Z){if(!n)return;function G(K){var V;(V=e.getSource("full-geom"))==null||V.setData(K)}for(const K of _)K.remove();if(_.length=0,G(O1),!!t){if(Z){let K=!1;if(Z.geometry.type==="GeometryCollection"){const V=Z.geometry.geometries.filter(H=>H.type==="Polygon"||H.type==="MultiPolygon");if(V.length>0){let H=V.pop();for(const Q of V)H=gC(H,Q);R1({...Z,geometry:H},G),K=!0}else{const H=Z.geometry.geometries.filter(Q=>Q.type==="LineString"||Q.type==="MultiLineString");H.length>0&&(G({...Z,geometry:{type:"GeometryCollection",geometries:H}}),K=!0)}}if(!K){if(Z.geometry.type==="Polygon"||Z.geometry.type==="MultiPolygon")R1(Z,G);else if(Z.geometry.type==="LineString"||Z.geometry.type==="MultiLineString"){G(Z);return}}n&&_.push((typeof n=="object"?new t.Marker(n):N()).setLngLat(Z.center).addTo(e))}if(i)for(const K of O??[]){if(K===Z)continue;const V=(typeof i=="object"?new t.Marker(i):N(!0)).setLngLat(K.center).setPopup(new t.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(K.place_type[0]==="reverse"?K.place_name:K.place_name.replace(/,.*/,""))).addTo(e),H=V.getElement();H.addEventListener("click",Q=>{Q.stopPropagation(),a==null||a({type:"markerClick",id:K.id})}),H.addEventListener("mouseenter",()=>{a==null||a({type:"markerMouseEnter",id:K.id}),V.togglePopup()}),H.addEventListener("mouseleave",()=>{a==null||a({type:"markerMouseLeave",id:K.id}),V.togglePopup()}),_.push(V)}}},setSelectedMarker(O){x&&x.getElement().classList.toggle("marker-selected",!1),x=O>-1?_[O]:void 0,x==null||x.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const O=e.getCenter();return[e.getZoom(),O.lng,O.lat]}}}function cT(e){let t,n;return{c(){t=Zl("svg"),n=Zl("path"),kt(n,"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"),kt(t,"viewBox","0 0 14 14"),kt(t,"width","13"),kt(t,"height","13"),kt(t,"class","svelte-en2qvf")},m(i,r){Nt(i,t,r),mt(t,n)},p:Le,i:Le,o:Le,d(i){i&&At(t)}}}class sw extends sn{constructor(t){super(),on(this,t,null,cT,Qe,{})}}function hT(e){let t,n;return{c(){t=Zl("svg"),n=Zl("path"),kt(n,"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"),kt(t,"viewBox","0 0 30 30"),kt(t,"fill","none"),kt(t,"xmlns","http://www.w3.org/2000/svg"),kt(t,"class","svelte-d2loi5")},m(i,r){Nt(i,t,r),mt(t,n)},p:Le,i:Le,o:Le,d(i){i&&At(t)}}}class aw extends sn{constructor(t){super(),on(this,t,null,hT,Qe,{})}}function pT(e){let t,n;return{c(){t=vt("img"),Tr(t.src,n=e[3]+"area.svg")||kt(t,"src",n),kt(t,"alt",e[6]),kt(t,"class","svelte-ltkwvy")},m(i,r){Nt(i,t,r)},p(i,r){r&8&&!Tr(t.src,n=i[3]+"area.svg")&&kt(t,"src",n),r&64&&kt(t,"alt",i[6])},d(i){i&&At(t)}}}function fT(e){let t,n;return{c(){t=vt("img"),Tr(t.src,n=e[3]+"reverse.svg")||kt(t,"src",n),kt(t,"alt",e[6]),kt(t,"class","svelte-ltkwvy")},m(i,r){Nt(i,t,r)},p(i,r){r&8&&!Tr(t.src,n=i[3]+"reverse.svg")&&kt(t,"src",n),r&64&&kt(t,"alt",i[6])},d(i){i&&At(t)}}}function dT(e){let t,n;return{c(){t=vt("img"),Tr(t.src,n=e[3]+"poi.svg")||kt(t,"src",n),kt(t,"alt",e[6]),kt(t,"class","svelte-ltkwvy")},m(i,r){Nt(i,t,r)},p(i,r){r&8&&!Tr(t.src,n=i[3]+"poi.svg")&&kt(t,"src",n),r&64&&kt(t,"alt",i[6])},d(i){i&&At(t)}}}function mT(e){let t,n;return{c(){t=vt("img"),Tr(t.src,n=e[3]+"postal_code.svg")||kt(t,"src",n),kt(t,"alt",e[6]),kt(t,"class","svelte-ltkwvy")},m(i,r){Nt(i,t,r)},p(i,r){r&8&&!Tr(t.src,n=i[3]+"postal_code.svg")&&kt(t,"src",n),r&64&&kt(t,"alt",i[6])},d(i){i&&At(t)}}}function gT(e){let t,n;return{c(){t=vt("img"),Tr(t.src,n=e[3]+"street.svg")||kt(t,"src",n),kt(t,"alt",e[6]),kt(t,"class","svelte-ltkwvy")},m(i,r){Nt(i,t,r)},p(i,r){r&8&&!Tr(t.src,n=i[3]+"street.svg")&&kt(t,"src",n),r&64&&kt(t,"alt",i[6])},d(i){i&&At(t)}}}function _T(e){let t,n;return{c(){t=vt("img"),Tr(t.src,n=e[3]+"road.svg")||kt(t,"src",n),kt(t,"alt",e[6]),kt(t,"class","svelte-ltkwvy")},m(i,r){Nt(i,t,r)},p(i,r){r&8&&!Tr(t.src,n=i[3]+"road.svg")&&kt(t,"src",n),r&64&&kt(t,"alt",i[6])},d(i){i&&At(t)}}}function yT(e){let t,n;return{c(){t=vt("img"),Tr(t.src,n=e[3]+"housenumber.svg")||kt(t,"src",n),kt(t,"alt",e[6]),kt(t,"class","svelte-ltkwvy")},m(i,r){Nt(i,t,r)},p(i,r){r&8&&!Tr(t.src,n=i[3]+"housenumber.svg")&&kt(t,"src",n),r&64&&kt(t,"alt",i[6])},d(i){i&&At(t)}}}function vT(e){let t,n,i,r;return{c(){t=vt("img"),Tr(t.src,n=e[5])||kt(t,"src",n),kt(t,"alt",e[4]),kt(t,"class","svelte-ltkwvy")},m(u,p){Nt(u,t,p),i||(r=xe(t,"error",e[14]),i=!0)},p(u,p){p&32&&!Tr(t.src,n=u[5])&&kt(t,"src",n),p&16&&kt(t,"alt",u[4])},d(u){u&&At(t),i=!1,r()}}}function z1(e){let t,n;return{c(){t=vt("span"),n=Xe(e[6]),kt(t,"class","secondary svelte-ltkwvy")},m(i,r){Nt(i,t,r),mt(t,n)},p(i,r){r&64&&Gi(n,i[6])},d(i){i&&At(t)}}}function bT(e){var ft,dt;let t,n,i,r,u,p,a,_,x=(e[7]?e[0].place_name:e[0].place_name.replace(/,.*/,""))+"",S,L,A=e[2]==="always"||e[2]&&!e[0].address&&((ft=e[0].properties)==null?void 0:ft.kind)!=="road"&&((dt=e[0].properties)==null?void 0:dt.kind)!=="road_relation"&&!e[0].id.startsWith("address.")&&!e[0].id.startsWith("postal_code.")&&(!e[0].id.startsWith("poi.")||!e[5])&&!e[7],N,O,Z=(e[7]?"":e[0].place_name.replace(/[^,]*,?\s*/,""))+"",G,K,V;function H(ut,Mt){var xt,yt;return Mt&1&&(n=null),Mt&1&&(i=null),Mt&1&&(r=null),ut[5]?vT:ut[0].address?yT:((xt=ut[0].properties)==null?void 0:xt.kind)==="road"||((yt=ut[0].properties)==null?void 0:yt.kind)==="road_relation"?_T:(n==null&&(n=!!ut[0].id.startsWith("address.")),n?gT:(i==null&&(i=!!ut[0].id.startsWith("postal_code.")),i?mT:(r==null&&(r=!!ut[0].id.startsWith("poi.")),r?dT:ut[7]?fT:pT)))}let Q=H(e,-1),it=Q(e),ht=A&&z1(e);return{c(){t=vt("li"),it.c(),u=Jt(),p=vt("span"),a=vt("span"),_=vt("span"),S=Xe(x),L=Jt(),ht&&ht.c(),N=Jt(),O=vt("span"),G=Xe(Z),kt(_,"class","primary svelte-ltkwvy"),kt(a,"class","svelte-ltkwvy"),kt(O,"class","line2 svelte-ltkwvy"),kt(p,"class","texts svelte-ltkwvy"),kt(t,"tabindex","0"),kt(t,"data-selected",e[1]),kt(t,"class","svelte-ltkwvy"),cl(t,"selected",e[1])},m(ut,Mt){Nt(ut,t,Mt),it.m(t,null),mt(t,u),mt(t,p),mt(p,a),mt(a,_),mt(_,S),mt(a,L),ht&&ht.m(a,null),mt(p,N),mt(p,O),mt(O,G),K||(V=[xe(t,"mouseenter",e[12]),xe(t,"focus",e[13])],K=!0)},p(ut,[Mt]){var xt,yt;Q===(Q=H(ut,Mt))&&it?it.p(ut,Mt):(it.d(1),it=Q(ut),it&&(it.c(),it.m(t,u))),Mt&1&&x!==(x=(ut[7]?ut[0].place_name:ut[0].place_name.replace(/,.*/,""))+"")&&Gi(S,x),Mt&37&&(A=ut[2]==="always"||ut[2]&&!ut[0].address&&((xt=ut[0].properties)==null?void 0:xt.kind)!=="road"&&((yt=ut[0].properties)==null?void 0:yt.kind)!=="road_relation"&&!ut[0].id.startsWith("address.")&&!ut[0].id.startsWith("postal_code.")&&(!ut[0].id.startsWith("poi.")||!ut[5])&&!ut[7]),A?ht?ht.p(ut,Mt):(ht=z1(ut),ht.c(),ht.m(a,null)):ht&&(ht.d(1),ht=null),Mt&1&&Z!==(Z=(ut[7]?"":ut[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Gi(G,Z),Mt&2&&kt(t,"data-selected",ut[1]),Mt&2&&cl(t,"selected",ut[1])},i:Le,o:Le,d(ut){ut&&At(t),it.d(),ht&&ht.d(),K=!1,or(V)}}}function xT(e,t,n){var H;let i,r,{feature:u}=t,{selected:p=!1}=t,{showPlaceType:a}=t,{missingIconsCache:_}=t,{iconsBaseUrl:x}=t;const S=(H=u.properties)==null?void 0:H.categories;let L,A,N=0,O=u.place_type[0]==="reverse";function Z(Q){A&&_.add(A),n(10,N++,N)}function G(Q){ai.call(this,e,Q)}function K(Q){ai.call(this,e,Q)}const V=Q=>Z(Q.currentTarget);return e.$$set=Q=>{"feature"in Q&&n(0,u=Q.feature),"selected"in Q&&n(1,p=Q.selected),"showPlaceType"in Q&&n(2,a=Q.showPlaceType),"missingIconsCache"in Q&&n(9,_=Q.missingIconsCache),"iconsBaseUrl"in Q&&n(3,x=Q.iconsBaseUrl)},e.$$.update=()=>{var Q,it,ht,ft;if(e.$$.dirty&3640)do n(11,i--,i),n(4,L=S==null?void 0:S[i]),n(5,A=L?x+L.replace(/ /g,"_")+".svg":void 0);while(i>-1&&(!A||_.has(A)));e.$$.dirty&1&&n(6,r=u.id.startsWith("poi.")?(it=(Q=u.properties)==null?void 0:Q.categories)==null?void 0:it.join(", "):((ft=(ht=u.properties)==null?void 0:ht.place_type_name)==null?void 0:ft[0])??u.place_type[0])},n(11,i=(S==null?void 0:S.length)??0),[u,p,a,x,L,A,r,O,Z,_,N,i,G,K,V]}class wT extends sn{constructor(t){super(),on(this,t,xT,bT,Qe,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function ST(e){let t;return{c(){t=vt("div"),t.innerHTML='',kt(t,"class","svelte-7cmwmc")},m(n,i){Nt(n,t,i)},p:Le,i:Le,o:Le,d(n){n&&At(t)}}}class ET extends sn{constructor(t){super(),on(this,t,null,ST,Qe,{})}}function IT(e){let t,n;return{c(){t=Zl("svg"),n=Zl("path"),kt(n,"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"),kt(t,"viewBox","0 0 60.006 21.412"),kt(t,"width","14"),kt(t,"height","20"),kt(t,"class","svelte-en2qvf")},m(i,r){Nt(i,t,r),mt(t,n)},p:Le,i:Le,o:Le,d(i){i&&At(t)}}}class CT extends sn{constructor(t){super(),on(this,t,null,IT,Qe,{})}}function TT(e){let t,n,i;return{c(){t=Zl("svg"),n=Zl("circle"),i=Zl("path"),kt(n,"cx","4.789"),kt(n,"cy","4.787"),kt(n,"r","3.85"),Wn(n,"stroke-width","1.875"),Wn(n,"fill","none"),kt(i,"d","M12.063 12.063 7.635 7.635"),Wn(i,"stroke-width","1.875"),Wn(i,"stroke-linecap","round"),kt(t,"xmlns","http://www.w3.org/2000/svg"),kt(t,"width","13"),kt(t,"height","13"),kt(t,"viewBox","0 0 13 13"),kt(t,"class","svelte-1bpbt60")},m(r,u){Nt(r,t,u),mt(t,n),mt(t,i)},p:Le,i:Le,o:Le,d(r){r&&At(t)}}}class LT extends sn{constructor(t){super(),on(this,t,null,TT,Qe,{})}}function MT(e,t,n){const i=t[1],r=t[0],u=i-r;return e===i&&n?e:((e-r)%u+u)%u+r}function F1(e){const t=[...e];return t[2]i[0]||r.maxZoom!=null&&r.maxZoomDate.now()){if(!wf.coords)break t;return wf.coords}let u;try{return u=await new Promise((p,a)=>{n.signal.addEventListener("abort",()=>{a(Error("aborted"))}),navigator.geolocation.getCurrentPosition(_=>{p([_.coords.longitude,_.coords.latitude].map(x=>x.toFixed(6)).join(","))},_=>{a(_)},r)}),u}catch{}finally{r.cachedLocationExpiry&&(wf={time:Date.now(),coords:u})}if(n.signal.aborted)return}if(r.type==="server-geolocation")return"ip";if(i&&r.type==="map-center")return i[1].toFixed(6)+","+i[2].toFixed(6)}}const B1=/(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,V1=/(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,U1=/(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,G1=/(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 AT(e){if(!["DMS","DM","DD"].includes(e))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){if(e=="DD")return this.decimalCoordinates;const t=this.decimalCoordinates.split(",").map(p=>Number(p.trim()));let n=j1(t[0],e),i=j1(t[1],e);n.endsWith('.0"')&&i.endsWith('.0"')&&(n=n.replace(/\.0"$/,'"'),i=i.replace(/\.0"$/,'"'));const r=t[0]>=0?" N":" S",u=t[1]>=0?" E":" W";return`${n+r}, ${i+u}`}else throw new Error("no decimal coordinates to convert")}function j1(e,t){const n=Math.abs(e),i=Math.floor(n),r=(n-i)*60;if(t=="DM"){let a=kT(r,3).toFixed(3).padStart(6,"0");return`${i}° ${a}'`}let u=Math.floor(r),p=((r-u)*60).toFixed(1).padStart(4,"0");return u=u.toString().padStart(2,"0"),`${i}° ${u}' ${p}"`}function kT(e,t){const n=Math.pow(10,t);return Math.round((e+Number.EPSILON)*n)/n}function Xy(e,t){t||(t=5),e=e.replace(/\s+/g," ").trim();let n=null,i=null,r="",u="",p=[],a=!1;if(B1.test(e))if(p=B1.exec(e),a=zm(p),a){if(n=p[2],i=p[6],n.includes(",")&&(n=n.replace(",",".")),i.includes(",")&&(i=i.replace(",",".")),Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");if(Number(Math.round(i))==Number(i))throw new Error("integer only coordinate provided");p[1]?(r=p[1],u=p[5]):p[4]&&(r=p[4],u=p[8])}else throw new Error("invalid decimal coordinate format");else if(V1.test(e))if(p=V1.exec(e),a=zm(p),a)n=Math.abs(parseInt(p[2])),p[4]&&(n+=p[4]/60),p[6]&&(n+=p[6].replace(",",".")/3600),parseInt(p[2])<0&&(n=-1*n),i=Math.abs(parseInt(p[9])),p[11]&&(i+=p[11]/60),p[13]&&(i+=p[13].replace(",",".")/3600),parseInt(p[9])<0&&(i=-1*i),p[1]?(r=p[1],u=p[8]):p[7]&&(r=p[7],u=p[14]);else throw new Error("invalid DMS coordinates format");else if(U1.test(e))if(p=U1.exec(e),a=zm(p),a)n=Math.abs(parseInt(p[2])),p[4]&&(n+=p[4]/60),p[6]&&(n+=p[6]/3600),parseInt(p[2])<0&&(n=-1*n),i=Math.abs(parseInt(p[10])),p[12]&&(i+=p[12]/60),p[14]&&(i+=p[14]/3600),parseInt(p[10])<0&&(i=-1*i),p[1]?(r=p[1],u=p[9]):p[8]&&(r=p[8],u=p[16]);else throw new Error("invalid DMS coordinates format");else if(G1.test(e))if(p=G1.exec(e),a=zm(p),a)n=Math.abs(parseInt(p[2])),p[4]&&(n+=p[4]/60),p[6]&&(n+=p[6]/3600),parseInt(p[2])<0&&(n=-1*n),i=Math.abs(parseInt(p[10])),p[12]&&(i+=p[12]/60),p[14]&&(i+=p[14]/3600),parseInt(p[10])<0&&(i=-1*i),p[1]?(r=p[1],u=p[9]):p[8]&&(r=p[8],u=p[16]);else throw new Error("invalid coordinates format");if(a){if(Math.abs(i)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((r||u)&&(!r||!u))throw new Error("invalid coordinates format");if(r&&r==u)throw new Error("invalid coordinates format");let _=/S|SOUTH/i;_.test(r)&&n>0&&(n=-1*n),_=/W|WEST/i,_.test(u)&&i>0&&(i=-1*i);const x=p[0].trim();let S,L;const A=/[,/;\u0020]/g,N=x.match(A);if(N==null){const G=Math.floor(e.length/2);S=x.substring(0,G).trim(),L=x.substring(G).trim()}else{let G;N.length%2==1?G=Math.floor(N.length/2):G=N.length/2-1;let K=0;if(G==0)K=x.indexOf(N[0]),S=x.substring(0,K).trim(),L=x.substring(K+1).trim();else{let V=0,H=0;for(;V<=G;)K=x.indexOf(N[V],H),H=K+1,V++;S=x.substring(0,K).trim(),L=x.substring(K+1).trim()}}const O=S.split(".");if(O.length==2&&O[1]==0&&O[1].length!=2)throw new Error("invalid coordinates format");const Z=L.split(".");if(Z.length==2&&Z[1]==0&&Z[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(L))throw new Error("degree only coordinate/s provided");return isNaN(n)&&n.includes(",")&&(n=n.replace(",",".")),n=Number(Number(n).toFixed(t)),isNaN(i)&&i.includes(",")&&(i=i.replace(",",".")),i=Number(Number(i).toFixed(t)),Object.freeze({verbatimCoordinates:x,verbatimLatitude:S,verbatimLongitude:L,decimalLatitude:n,decimalLongitude:i,decimalCoordinates:`${n},${i}`,closeEnough:NT,toCoordinateFormat:AT})}else throw new Error("coordinates pattern match failed")}function zm(e){if(!isNaN(e[0]))return!1;const t=[...e];if(t.shift(),t.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,i=/[eastsouthnorthwest]+/i,r=t.length/2;for(let u=0;u{t.decimalLatitude?e.push(t):e.push({...t,...OT})}),[...e,...zT,...FT]}const VT=BT();Xy.formats=VT.map(e=>e.verbatimCoordinates);const UT=Xy;function Z1(e,t,n){const i=e.slice();return i[81]=t[n],i[83]=n,i}function W1(e){let t,n;return t=new ET({}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function X1(e){let t,n,i,r,u;return n=new CT({}),{c(){t=vt("button"),ee(n.$$.fragment),kt(t,"type","button"),kt(t,"title",e[9]),kt(t,"class","svelte-zh3kmv"),cl(t,"active",e[0])},m(p,a){Nt(p,t,a),$t(n,t,null),i=!0,r||(u=xe(t,"click",e[67]),r=!0)},p(p,a){(!i||a[0]&512)&&kt(t,"title",p[9]),(!i||a[0]&1)&&cl(t,"active",p[0])},i(p){i||(wt(n.$$.fragment,p),i=!0)},o(p){Pt(n.$$.fragment,p),i=!1},d(p){p&&At(t),te(n),r=!1,u()}}}function GT(e){let t,n=[],i=new Map,r,u,p,a=aa(e[14]);const _=x=>x[81].id+(x[81].address?","+x[81].address:"");for(let x=0;x{ft=null}),Ci()),(!H||Gt[0]&2)&&cl(x,"displayable",Rt[1]!==""),Rt[5]===!0?dt?(dt.p(Rt,Gt),Gt[0]&32&&wt(dt,1)):(dt=X1(Rt),dt.c(),wt(dt,1),dt.m(i,O)):dt&&(Ii(),Pt(dt,1,1,()=>{dt=null}),Ci()),Mt&&Mt.p&&(!H||Gt[1]&134217728)&&_r(Mt,ut,Rt,Rt[58],H?gr(ut,Rt[58],Gt,null):yr(Rt[58]),null);let Kt=G;G=de(Rt),G===Kt?~G&&yt[G].p(Rt,Gt):(K&&(Ii(),Pt(yt[Kt],1,1,()=>{yt[Kt]=null}),Ci()),~G?(K=yt[G],K?K.p(Rt,Gt):(K=yt[G]=xt[G](Rt),K.c()),wt(K,1),K.m(n,null)):K=null),(!H||Gt[0]&4&&V!==(V=Zm(Rt[2])+" svelte-zh3kmv"))&&kt(n,"class",V),(!H||Gt[0]&22)&&cl(n,"can-collapse",Rt[4]&&Rt[1]==="")},i(Rt){H||(wt(ht),wt(u.$$.fragment,Rt),wt(L.$$.fragment,Rt),wt(ft),wt(dt),wt(Mt,Rt),wt(K),H=!0)},o(Rt){Pt(ht),Pt(u.$$.fragment,Rt),Pt(L.$$.fragment,Rt),Pt(ft),Pt(dt),Pt(Mt,Rt),Pt(K),H=!1},d(Rt){Rt&&(At(t),At(n)),te(u),e[61](null),te(L),ft&&ft.d(),dt&&dt.d(),Mt&&Mt.d(Rt),~G&&yt[G].d(),Q=!1,or(it)}}}function XT(e,t,n){let i,{$$slots:r={},$$scope:u}=t,{class:p=void 0}=t,{apiKey:a}=t,{bbox:_=void 0}=t,{clearButtonTitle:x="clear"}=t,{clearOnBlur:S=!1}=t,{collapsed:L=!1}=t,{country:A=void 0}=t,{debounceSearch:N=200}=t,{enableReverse:O=!1}=t,{errorMessage:Z="Something went wrong…"}=t,{filter:G=()=>!0}=t,{flyTo:K=!0}=t,{fuzzyMatch:V=!0}=t,{language:H=void 0}=t,{limit:Q=void 0}=t,{mapController:it=void 0}=t,{minLength:ht=2}=t,{noResultsMessage:ft="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!"}=t,{placeholder:dt="Search"}=t,{proximity:ut=[{type:"server-geolocation"}]}=t,{reverseActive:Mt=O==="always"}=t,{reverseButtonTitle:xt="toggle reverse geocoding"}=t,{searchValue:yt=""}=t,{showFullGeometry:de=!0}=t,{showPlaceType:Rt="ifNeeded"}=t,{showResultsWhileTyping:Gt=!0}=t,{selectFirst:Kt=!0}=t,{flyToSelected:be=!1}=t,{markerOnSelected:me=!0}=t,{types:an=void 0}=t,{excludeTypes:jn=!1}=t,{zoom:He=16}=t,{maxZoom:ke=18}=t,{apiUrl:Be="https://api.maptiler.com/geocoding"}=t,{fetchParameters:fn={}}=t,{iconsBaseUrl:Mn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.1/icons/"}=t,{adjustUrlQuery:ln=q=>{}}=t;function Wt(){Xn.focus()}function Me(){Xn.blur()}function yn(q,ot=!0){n(1,yt=q),ot?(n(15,dn=-1),es()):(yo(),setTimeout(()=>{Xn.focus(),Xn.select()}))}function ni(){n(14,Ct=void 0),n(55,je=void 0),n(15,dn=-1)}function _o(){n(54,Ge=[]),n(55,je=void 0)}let tr=!1,Ct,Ge,je,er="",Xn,dn=-1,qi,jt=[],Oi,sr,On,En;const ts=new Set,ro=np();ks(()=>{it&&(it.setEventHandler(void 0),it.indicateReverse(!1),it.setSelectedMarker(-1),it.setMarkers(void 0,void 0))});function es(q){if(sr&&(clearTimeout(sr),sr=void 0),dn>-1&&Ct)n(55,je=Ct[dn]),n(1,yt=je.place_type[0]==="reverse"?je.place_name:je.place_name.replace(/,.*/,"")),n(18,qi=void 0),n(54,Ge=void 0),n(15,dn=-1);else if(yt){const ot=q||!Ha(yt);Gs(yt,{exact:!0}).then(()=>{n(54,Ge=Ct),n(55,je=void 0),ot&&js()}).catch(Et=>n(18,qi=Et))}}function Ha(q){try{return UT(q,6)}catch{return!1}}async function Gs(q,{byId:ot=!1,exact:Et=!1}={}){n(18,qi=void 0),Oi==null||Oi.abort();const gt=new AbortController;n(19,Oi=gt);try{const rt=Ha(q),bt=new URLSearchParams;if(H!==void 0&&bt.set("language",Array.isArray(H)?H.join(","):H??""),an&&bt.set("types",an.join(",")),jn&&bt.set("excludeTypes",String(jn)),_&&bt.set("bbox",_.map(Ne=>Ne.toFixed(6)).join(",")),A&&bt.set("country",Array.isArray(A)?A.join(","):A),!ot&&!rt){const Ne=await PT(it,ut,gt);Ne&&bt.set("proximity",Ne),(Et||!Gt)&&bt.set("autocomplete","false"),bt.set("fuzzyMatch",String(V))}Q!==void 0&&(!rt||(an==null?void 0:an.length)===1)&&bt.set("limit",String(Q)),bt.set("key",a),ln(bt);const qt=Be+"/"+encodeURIComponent(rt?rt.decimalLongitude+","+rt.decimalLatitude:q)+".json?"+bt.toString();if(qt===er){ot?(n(14,Ct=void 0),n(55,je=jt[0])):n(14,Ct=jt);return}er=qt;const Zt=await fetch(qt,{signal:gt.signal,...fn});if(!Zt.ok)throw new Error(await Zt.text());const Ht=await Zt.json();ro("response",{url:qt,featureCollection:Ht}),ot?(n(14,Ct=void 0),n(55,je=Ht.features[0]),jt=[je]):(n(14,Ct=Ht.features.filter(G)),rt&&Ct.unshift({type:"Feature",properties:{},id:"reverse_"+rt.decimalLongitude+"_"+rt.decimalLatitude,text:rt.decimalLatitude+", "+rt.decimalLongitude,place_name:rt.decimalLatitude+", "+rt.decimalLongitude,place_type:["reverse"],center:[rt.decimalLongitude,rt.decimalLatitude],bbox:[rt.decimalLongitude,rt.decimalLatitude,rt.decimalLongitude,rt.decimalLatitude],geometry:{type:"Point",coordinates:[rt.decimalLongitude,rt.decimalLatitude]}}),jt=Ct,rt&&Xn.focus())}catch(rt){if(rt&&typeof rt=="object"&&"name"in rt&&rt.name==="AbortError")return;throw rt}finally{gt===Oi&&n(19,Oi=void 0)}}function js(){var Et;if(!(Ge!=null&&Ge.length)||!K)return;const q=[180,90,-180,-90],ot=!Ge.some(gt=>!gt.matching_text);for(const gt of Ge)if(ot||!gt.matching_text)for(const rt of[0,1,2,3])q[rt]=Math[rt<2?"min":"max"](q[rt],((Et=gt.bbox)==null?void 0:Et[rt])??gt.center[rt%2]);it&&Ge.length>0&&(je&&q[0]===q[2]&&q[1]===q[3]?it.flyTo(je.center,He):it.fitBounds(F1(q),50,ke))}function wa(q){n(0,Mt=O==="always"),n(14,Ct=void 0),n(55,je=void 0),n(15,dn=-1),yn(q[1].toFixed(6)+", "+MT(q[0],[-180,180],!0).toFixed(6),!1)}function se(q){if(!Ct)return;let ot=q.key==="ArrowDown"?1:q.key==="ArrowUp"?-1:0;ot&&(dn===(Kt?0:-1)&&ot===-1&&n(15,dn=Ct.length),n(15,dn+=ot),dn>=Ct.length&&n(15,dn=-1),dn<0&&Kt&&n(15,dn=0),q.preventDefault())}function yo(q=!0){if(n(18,qi=void 0),Gt){if(sr&&clearTimeout(sr),yt.length{Gs(ot).catch(Et=>n(18,qi=Et))},q?N:0)}else n(14,Ct=void 0),n(18,qi=void 0)}function ii(q){n(55,je=q),n(1,yt=q.place_name),n(15,dn=-1)}const Sa=()=>Xn.focus();function xs(q){Qi[q?"unshift":"push"](()=>{Xn=q,n(17,Xn)})}function le(){yt=this.value,n(1,yt),n(13,tr),n(27,S)}const cn=()=>n(13,tr=!0),Ke=()=>n(13,tr=!1),Ar=()=>yo(),ns=()=>{n(1,yt=""),Xn.focus()},en=()=>n(0,Mt=!Mt),ws=()=>n(18,qi=void 0),st=q=>n(15,dn=q),B=q=>ii(q),j=()=>{Kt||n(15,dn=-1)},J=()=>{};return e.$$set=q=>{"class"in q&&n(2,p=q.class),"apiKey"in q&&n(25,a=q.apiKey),"bbox"in q&&n(26,_=q.bbox),"clearButtonTitle"in q&&n(3,x=q.clearButtonTitle),"clearOnBlur"in q&&n(27,S=q.clearOnBlur),"collapsed"in q&&n(4,L=q.collapsed),"country"in q&&n(28,A=q.country),"debounceSearch"in q&&n(29,N=q.debounceSearch),"enableReverse"in q&&n(5,O=q.enableReverse),"errorMessage"in q&&n(6,Z=q.errorMessage),"filter"in q&&n(30,G=q.filter),"flyTo"in q&&n(31,K=q.flyTo),"fuzzyMatch"in q&&n(32,V=q.fuzzyMatch),"language"in q&&n(33,H=q.language),"limit"in q&&n(34,Q=q.limit),"mapController"in q&&n(35,it=q.mapController),"minLength"in q&&n(36,ht=q.minLength),"noResultsMessage"in q&&n(7,ft=q.noResultsMessage),"placeholder"in q&&n(8,dt=q.placeholder),"proximity"in q&&n(37,ut=q.proximity),"reverseActive"in q&&n(0,Mt=q.reverseActive),"reverseButtonTitle"in q&&n(9,xt=q.reverseButtonTitle),"searchValue"in q&&n(1,yt=q.searchValue),"showFullGeometry"in q&&n(38,de=q.showFullGeometry),"showPlaceType"in q&&n(10,Rt=q.showPlaceType),"showResultsWhileTyping"in q&&n(39,Gt=q.showResultsWhileTyping),"selectFirst"in q&&n(11,Kt=q.selectFirst),"flyToSelected"in q&&n(40,be=q.flyToSelected),"markerOnSelected"in q&&n(41,me=q.markerOnSelected),"types"in q&&n(42,an=q.types),"excludeTypes"in q&&n(43,jn=q.excludeTypes),"zoom"in q&&n(44,He=q.zoom),"maxZoom"in q&&n(45,ke=q.maxZoom),"apiUrl"in q&&n(46,Be=q.apiUrl),"fetchParameters"in q&&n(47,fn=q.fetchParameters),"iconsBaseUrl"in q&&n(12,Mn=q.iconsBaseUrl),"adjustUrlQuery"in q&&n(48,ln=q.adjustUrlQuery),"$$scope"in q&&n(58,u=q.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,On=tr),S&&!tr&&n(1,yt="")}),e.$$.dirty[0]&16386|e.$$.dirty[1]&32&&yt.lengthn(18,qi=q)),e.$$.dirty[1]&50356241&&(it&&je&&je.id!==En&&K&&(!je.bbox||je.bbox[0]===je.bbox[2]&&je.bbox[1]===je.bbox[3]?it.flyTo(je.center,je.id.startsWith("poi.")||je.id.startsWith("address.")?ke:He):it.fitBounds(F1(je.bbox),50,ke),n(14,Ct=void 0),n(54,Ge=void 0),n(15,dn=-1)),n(56,En=je==null?void 0:je.id)),e.$$.dirty[0]&18432&&Kt&&Ct!=null&&Ct.length&&n(15,dn=0),e.$$.dirty[0]&2050&&(Kt||n(15,dn=-1)),e.$$.dirty[0]&16384|e.$$.dirty[1]&8388608&&Ge!==Ct&&n(54,Ge=void 0),e.$$.dirty[0]&81921|e.$$.dirty[1]&8388624&&it&&it.setEventHandler(q=>{switch(q.type){case"mapClick":Mt&&wa(q.coordinates);break;case"markerClick":{const ot=Ct==null?void 0:Ct.find(Et=>Et.id===q.id);ot&&ii(ot)}break;case"markerMouseEnter":Ge&&n(15,dn=On?(Ct==null?void 0:Ct.findIndex(ot=>ot.id===q.id))??-1:-1);break;case"markerMouseLeave":Ge&&n(15,dn=-1);break}}),e.$$.dirty[0]&49152&&n(57,i=Ct==null?void 0:Ct[dn]),e.$$.dirty[1]&67133969&&it&&i&&K&&be&&it.flyTo(i.center,i.id.startsWith("poi.")||i.id.startsWith("address.")?ke:He),e.$$.dirty[1]&1040&&(me||it==null||it.setMarkers(void 0,void 0)),e.$$.dirty[1]&75498512&&it&&me&&!Ge&&(it.setMarkers(i?[i]:void 0,void 0),it.setSelectedMarker(i?0:-1)),e.$$.dirty[1]&25165840&&it&&it.setMarkers(Ge,je),e.$$.dirty[0]&32768|e.$$.dirty[1]&8388624&&Ge&&it&&it.setSelectedMarker(dn),e.$$.dirty[0]&2|e.$$.dirty[1]&16&&it){const q=Ha(yt);it.setReverseMarker(q?[q.decimalLongitude,q.decimalLatitude]:void 0)}e.$$.dirty[1]&67108864&&ro("select",i),e.$$.dirty[1]&16777216&&ro("pick",je),e.$$.dirty[0]&81920&&ro("optionsVisibilityChange",On&&!!Ct),e.$$.dirty[0]&16384&&ro("featuresListed",Ct),e.$$.dirty[1]&8388608&&ro("featuresMarked",Ge),e.$$.dirty[0]&1&&ro("reverseToggle",Mt),e.$$.dirty[0]&2&&ro("queryChange",yt),e.$$.dirty[0]&1|e.$$.dirty[1]&16&&it&&it.indicateReverse(Mt)},[Mt,yt,p,x,L,O,Z,ft,dt,xt,Rt,Kt,Mn,tr,Ct,dn,On,Xn,qi,Oi,ts,es,se,yo,ii,a,_,S,A,N,G,K,V,H,Q,it,ht,ut,de,Gt,be,me,an,jn,He,ke,Be,fn,ln,Wt,Me,yn,ni,_o,Ge,je,En,i,u,r,Sa,xs,le,cn,Ke,Ar,ns,en,ws,st,B,j,J]}class HT extends sn{constructor(t){super(),on(this,t,XT,WT,Qe,{class:2,apiKey:25,bbox:26,clearButtonTitle:3,clearOnBlur:27,collapsed:4,country:28,debounceSearch:29,enableReverse:5,errorMessage:6,filter:30,flyTo:31,fuzzyMatch:32,language:33,limit:34,mapController:35,minLength:36,noResultsMessage:7,placeholder:8,proximity:37,reverseActive:0,reverseButtonTitle:9,searchValue:1,showFullGeometry:38,showPlaceType:10,showResultsWhileTyping:39,selectFirst:11,flyToSelected:40,markerOnSelected:41,types:42,excludeTypes:43,zoom:44,maxZoom:45,apiUrl:46,fetchParameters:47,iconsBaseUrl:12,adjustUrlQuery:48,focus:49,blur:50,setQuery:51,clearList:52,clearMap:53},null,[-1,-1,-1])}get focus(){return this.$$.ctx[49]}get blur(){return this.$$.ctx[50]}get setQuery(){return this.$$.ctx[51]}get clearList(){return this.$$.ctx[52]}get clearMap(){return this.$$.ctx[53]}}function Y1(e){let t,n,i;return n=new HT({props:{mapController:e[0],apiKey:Ly}}),{c(){t=vt("div"),ee(n.$$.fragment),kt(t,"class","svelte-ixhnie")},m(r,u){Nt(r,t,u),$t(n,t,null),i=!0},p(r,u){const p={};u&1&&(p.mapController=r[0]),n.$set(p)},i(r){i||(wt(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&At(t),te(n)}}}function YT(e){let t,n,i=e[0]&&Y1(e);return{c(){i&&i.c(),t=$o()},m(r,u){i&&i.m(r,u),Nt(r,t,u),n=!0},p(r,[u]){r[0]?i?(i.p(r,u),u&1&&wt(i,1)):(i=Y1(r),i.c(),wt(i,1),i.m(t.parentNode,t)):i&&(Ii(),Pt(i,1,1,()=>{i=null}),Ci())},i(r){n||(wt(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&At(t),i&&i.d(r)}}}function KT(e,t,n){let i,r;return Ee(e,Hl,u=>n(1,r=u)),e.$$.update=()=>{e.$$.dirty&2&&n(0,i=r?uT(r,Ls):null)},[i,r]}class JT extends sn{constructor(t){super(),on(this,t,KT,YT,Qe,{})}}const QT=e=>({}),K1=e=>({}),$T=e=>({}),J1=e=>({}),tL=e=>({}),Q1=e=>({});function eL(e){let t,n,i,r,u,p;const a=e[1].top,_=mr(a,e,e[0],Q1),x=e[1].left,S=mr(x,e,e[0],J1),L=e[1].main,A=mr(L,e,e[0],K1);return{c(){t=vt("div"),_&&_.c(),n=Jt(),i=vt("div"),S&&S.c(),r=Jt(),u=vt("div"),A&&A.c(),kt(t,"class","top svelte-3nmiww"),kt(i,"class","left svelte-3nmiww"),kt(u,"class","main svelte-3nmiww")},m(N,O){Nt(N,t,O),_&&_.m(t,null),Nt(N,n,O),Nt(N,i,O),S&&S.m(i,null),Nt(N,r,O),Nt(N,u,O),A&&A.m(u,null),p=!0},p(N,[O]){_&&_.p&&(!p||O&1)&&_r(_,a,N,N[0],p?gr(a,N[0],O,tL):yr(N[0]),Q1),S&&S.p&&(!p||O&1)&&_r(S,x,N,N[0],p?gr(x,N[0],O,$T):yr(N[0]),J1),A&&A.p&&(!p||O&1)&&_r(A,L,N,N[0],p?gr(L,N[0],O,QT):yr(N[0]),K1)},i(N){p||(wt(_,N),wt(S,N),wt(A,N),p=!0)},o(N){Pt(_,N),Pt(S,N),Pt(A,N),p=!1},d(N){N&&(At(t),At(n),At(i),At(r),At(u)),_&&_.d(N),S&&S.d(N),A&&A.d(N)}}}function nL(e,t,n){let{$$slots:i={},$$scope:r}=t;return e.$$set=u=>{"$$scope"in u&&n(0,r=u.$$scope)},[r,i]}class iL extends sn{constructor(t){super(),on(this,t,nL,eL,Qe,{})}}function $1(e){let t,n;return{c(){t=vt("div"),n=Xe(e[0]),kt(t,"class","svelte-1uuov7f")},m(i,r){Nt(i,t,r),mt(t,n)},p(i,r){r&1&&Gi(n,i[0])},d(i){i&&At(t)}}}function rL(e){let t,n=e[0]&&$1(e);return{c(){n&&n.c(),t=$o()},m(i,r){n&&n.m(i,r),Nt(i,t,r)},p(i,[r]){i[0]?n?n.p(i,r):(n=$1(i),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},i:Le,o:Le,d(i){i&&At(t),n&&n.d(i)}}}function oL(e,t,n){let{msg:i=null}=t;return e.$$set=r=>{"msg"in r&&n(0,i=r.msg)},[i]}class lw extends sn{constructor(t){super(),on(this,t,oL,rL,Qe,{msg:0})}}const sL=e=>({dialog:e&1}),tb=e=>({dialog:e[0]});function aL(e){let t,n,i,r,u;const p=e[4].default,a=mr(p,e,e[3],tb);return{c(){t=vt("dialog"),n=vt("article"),a&&a.c(),t.open=!0},m(_,x){Nt(_,t,x),mt(t,n),a&&a.m(n,null),e[6](t),i=!0,r||(u=[xe(window,"click",e[1]),xe(window,"keydown",e[2]),xe(t,"close",e[5])],r=!0)},p(_,[x]){a&&a.p&&(!i||x&9)&&_r(a,p,_,_[3],i?gr(p,_[3],x,sL):yr(_[3]),tb)},i(_){i||(wt(a,_),i=!0)},o(_){Pt(a,_),i=!1},d(_){_&&At(t),a&&a.d(_),e[6](null),r=!1,or(u)}}}function lL(e,t,n){let{$$slots:i={},$$scope:r}=t,u;function p(S){u.open&&S.target==u&&u.close()}function a(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),u.close())}function _(S){ai.call(this,e,S)}function x(S){Qi[S?"unshift":"push"](()=>{u=S,n(0,u)})}return e.$$set=S=>{"$$scope"in S&&n(3,r=S.$$scope)},[u,p,a,r,i,_,x]}class Hy extends sn{constructor(t){super(),on(this,t,lL,aL,Qe,{})}}var To=63710088e-1,Yy={centimeters:To*100,centimetres:To*100,degrees:To/111325,feet:To*3.28084,inches:To*39.37,kilometers:To/1e3,kilometres:To/1e3,meters:To,metres:To,miles:To/1609.344,millimeters:To*1e3,millimetres:To*1e3,nauticalmiles:To/1852,radians:1,yards:To*1.0936},uL={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/To,yards:1.0936133},wy={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 ya(e,t,n){n===void 0&&(n={});var i={type:"Feature"};return(n.id===0||n.id)&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.properties=t||{},i.geometry=e,i}function cL(e,t,n){switch(e){case"Point":return ps(t).geometry;case"LineString":return ia(t).geometry;case"Polygon":return Ky(t).geometry;case"MultiPoint":return cw(t).geometry;case"MultiLineString":return uw(t).geometry;case"MultiPolygon":return hw(t).geometry;default:throw new Error(e+" is invalid")}}function ps(e,t,n){if(n===void 0&&(n={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!hg(e[0])||!hg(e[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:e};return ya(i,t,n)}function hL(e,t,n){return n===void 0&&(n={}),kc(e.map(function(i){return ps(i,t)}),n)}function Ky(e,t,n){n===void 0&&(n={});for(var i=0,r=e;i=0))throw new Error("precision must be a positive number");var n=Math.pow(10,t||0);return Math.round(e*n)/n}function Jy(e,t){t===void 0&&(t="kilometers");var n=Yy[t];if(!n)throw new Error(t+" units is invalid");return e*n}function Ag(e,t){t===void 0&&(t="kilometers");var n=Yy[t];if(!n)throw new Error(t+" units is invalid");return e/n}function gL(e,t){return sd(Ag(e,t))}function _L(e){var t=e%360;return t<0&&(t+=360),t}function sd(e){var t=e%(2*Math.PI);return t*180/Math.PI}function ra(e){var t=e%360;return t*Math.PI/180}function yL(e,t,n){if(t===void 0&&(t="kilometers"),n===void 0&&(n="kilometers"),!(e>=0))throw new Error("length must be a positive number");return Jy(Ag(e,t),n)}function vL(e,t,n){if(t===void 0&&(t="meters"),n===void 0&&(n="kilometers"),!(e>=0))throw new Error("area must be a positive number");var i=wy[t];if(!i)throw new Error("invalid original units");var r=wy[n];if(!r)throw new Error("invalid final units");return e/i*r}function hg(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function Qy(e){return!!e&&e.constructor===Object}function bL(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(function(t){if(!hg(t))throw new Error("bbox must only contain numbers")})}function xL(e){if(!e)throw new Error("id is required");if(["string","number"].indexOf(typeof e)===-1)throw new Error("id must be a number or a string")}const wL=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:wy,bearingToAzimuth:_L,convertArea:vL,convertLength:yL,degreesToRadians:ra,earthRadius:To,factors:Yy,feature:ya,featureCollection:kc,geometry:cL,geometryCollection:dL,isNumber:hg,isObject:Qy,lengthToDegrees:gL,lengthToRadians:Ag,lineString:ia,lineStrings:fL,multiLineString:uw,multiPoint:cw,multiPolygon:hw,point:ps,points:hL,polygon:Ky,polygons:pL,radiansToDegrees:sd,radiansToLength:Jy,round:mL,unitsFactors:uL,validateBBox:bL,validateId:xL},Symbol.toStringTag,{value:"Module"}));function ad(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function ep(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function pw(e,t,n){if(n===void 0&&(n={}),n.final===!0)return SL(e,t);var i=ad(e),r=ad(t),u=ra(i[0]),p=ra(r[0]),a=ra(i[1]),_=ra(r[1]),x=Math.sin(p-u)*Math.cos(_),S=Math.cos(a)*Math.sin(_)-Math.sin(a)*Math.cos(_)*Math.cos(p-u);return sd(Math.atan2(x,S))}function SL(e,t){var n=pw(t,e);return n=(n+180)%360,n}function Sf(e,t,n){n===void 0&&(n={});var i=ad(e),r=ad(t),u=ra(r[1]-i[1]),p=ra(r[0]-i[0]),a=ra(i[1]),_=ra(r[1]),x=Math.pow(Math.sin(u/2),2)+Math.pow(Math.sin(p/2),2)*Math.cos(a)*Math.cos(_);return Jy(2*Math.atan2(Math.sqrt(x),Math.sqrt(1-x)),n.units)}function eb(e,t,n,i){i===void 0&&(i={});var r=ad(e),u=ra(r[0]),p=ra(r[1]),a=ra(n),_=Ag(t,i.units),x=Math.asin(Math.sin(p)*Math.cos(_)+Math.cos(p)*Math.sin(_)*Math.cos(a)),S=u+Math.atan2(Math.sin(a)*Math.sin(_)*Math.cos(p),Math.cos(_)-Math.sin(p)*Math.sin(x)),L=sd(S),A=sd(x);return ps([L,A],i.properties)}function bd(e,t,n){if(e!==null)for(var i,r,u,p,a,_,x,S=0,L=0,A,N=e.type,O=N==="FeatureCollection",Z=N==="Feature",G=O?e.features.length:1,K=0;K_||O>x||Z>S){a=L,_=i,x=O,S=Z,u=0;return}var G=ia([a,L],n.properties);if(t(G,i,r,Z,u)===!1)return!1;u++,a=L})===!1)return!1}}})}function PL(e,t,n){var i=n,r=!1;return dw(e,function(u,p,a,_,x){r===!1&&n===void 0?i=u:i=t(i,u,p,a,_,x),r=!0}),i}function mw(e,t){if(!e)throw new Error("geojson is required");hp(e,function(n,i,r){if(n.geometry!==null){var u=n.geometry.type,p=n.geometry.coordinates;switch(u){case"LineString":if(t(n,i,r,0,0)===!1)return!1;break;case"Polygon":for(var a=0;ar?n:r,x=i>u?i:u;return[p,a,_,x]}var t0={exports:{}},gw={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(Kb,function(){function n(V,H,Q,it,ht){(function ft(dt,ut,Mt,xt,yt){for(;xt>Mt;){if(xt-Mt>600){var de=xt-Mt+1,Rt=ut-Mt+1,Gt=Math.log(de),Kt=.5*Math.exp(2*Gt/3),be=.5*Math.sqrt(Gt*Kt*(de-Kt)/de)*(Rt-de/2<0?-1:1),me=Math.max(Mt,Math.floor(ut-Rt*Kt/de+be)),an=Math.min(xt,Math.floor(ut+(de-Rt)*Kt/de+be));ft(dt,ut,me,an,yt)}var jn=dt[ut],He=Mt,ke=xt;for(i(dt,Mt,ut),yt(dt[xt],jn)>0&&i(dt,Mt,xt);He0;)ke--}yt(dt[Mt],jn)===0?i(dt,Mt,ke):i(dt,++ke,xt),ke<=ut&&(Mt=ke+1),ut<=ke&&(xt=ke-1)}})(V,H,Q||0,it||V.length-1,ht||r)}function i(V,H,Q){var it=V[H];V[H]=V[Q],V[Q]=it}function r(V,H){return VH?1:0}var u=function(V){V===void 0&&(V=9),this._maxEntries=Math.max(4,V),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function p(V,H,Q){if(!Q)return H.indexOf(V);for(var it=0;it=V.minX&&H.maxY>=V.minY}function G(V){return{children:V,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function K(V,H,Q,it,ht){for(var ft=[H,Q];ft.length;)if(!((Q=ft.pop())-(H=ft.pop())<=it)){var dt=H+Math.ceil((Q-H)/it/2)*it;n(V,dt,H,Q,ht),ft.push(H,dt,dt,Q)}}return u.prototype.all=function(){return this._all(this.data,[])},u.prototype.search=function(V){var H=this.data,Q=[];if(!Z(V,H))return Q;for(var it=this.toBBox,ht=[];H;){for(var ft=0;ft=0&&ht[H].children.length>this._maxEntries;)this._split(ht,H),H--;this._adjustParentBBoxes(it,ht,H)},u.prototype._split=function(V,H){var Q=V[H],it=Q.children.length,ht=this._minEntries;this._chooseSplitAxis(Q,ht,it);var ft=this._chooseSplitIndex(Q,ht,it),dt=G(Q.children.splice(ft,Q.children.length-ft));dt.height=Q.height,dt.leaf=Q.leaf,a(Q,this.toBBox),a(dt,this.toBBox),H?V[H-1].children.push(dt):this._splitRoot(Q,dt)},u.prototype._splitRoot=function(V,H){this.data=G([V,H]),this.data.height=V.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},u.prototype._chooseSplitIndex=function(V,H,Q){for(var it,ht,ft,dt,ut,Mt,xt,yt=1/0,de=1/0,Rt=H;Rt<=Q-H;Rt++){var Gt=_(V,0,Rt,this.toBBox),Kt=_(V,Rt,Q,this.toBBox),be=(ht=Gt,ft=Kt,dt=void 0,ut=void 0,Mt=void 0,xt=void 0,dt=Math.max(ht.minX,ft.minX),ut=Math.max(ht.minY,ft.minY),Mt=Math.min(ht.maxX,ft.maxX),xt=Math.min(ht.maxY,ft.maxY),Math.max(0,Mt-dt)*Math.max(0,xt-ut)),me=A(Gt)+A(Kt);be=H;yt--){var de=V.children[yt];x(dt,V.leaf?ht(de):de),ut+=N(dt)}return ut},u.prototype._adjustParentBBoxes=function(V,H,Q){for(var it=Q;it>=0;it--)x(H[it],V)},u.prototype._condense=function(V){for(var H=V.length-1,Q=void 0;H>=0;H--)V[H].children.length===0?H>0?(Q=V[H-1].children).splice(Q.indexOf(V[H]),1):this.clear():a(V[H],this.toBBox)},u})})(gw);var FL=gw.exports;const BL=Qb(wL),_w=Qb(DL);var e0={};Object.defineProperty(e0,"__esModule",{value:!0});var VL=_w;function Sy(e){var t=[1/0,1/0,-1/0,-1/0];return VL.coordEach(e,function(n){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(i.length!==2)throw new Error(" line2 must only contain 2 coordinates");var r=n[0][0],u=n[0][1],p=n[1][0],a=n[1][1],_=i[0][0],x=i[0][1],S=i[1][0],L=i[1][1],A=(L-x)*(p-r)-(S-_)*(a-u),N=(S-_)*(u-x)-(L-x)*(r-_),O=(p-r)*(u-x)-(a-u)*(r-_);if(A===0)return null;var Z=N/A,G=O/A;if(Z>=0&&Z<=1&&G>=0&&G<=1){var K=r+Z*(p-r),V=u+Z*(a-u);return ps([K,V])}return null}function ZL(e,t,n){n===void 0&&(n={});var i=ps([1/0,1/0],{dist:1/0}),r=0;return hp(e,function(u){for(var p=ep(u),a=0;a0&&(G=Z.features[0],G.properties.dist=Sf(t,G,n),G.properties.location=r+Sf(_,G,n)),_.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(t);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-t.lngLat.lng,i=this.dragFrom[1]-t.lngLat.lat;for(let r of this.points)r[0]-=n,r[1]-=i}else this.points[this.hover]=t.lngLat.toArray();this.dragFrom=t.lngLat.toArray(),this.redraw()}});qn(this,"onClick",t=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(ob(this.points).forEach((i,r)=>{n.push([r+1,ZL(i,this.cursor).properties.dist])}),n.sort((i,r)=>i[1]-r[1]),n.length>0){let i=n[0][0];this.points.splice(i,0,this.cursor.geometry.coordinates),this.hover=i}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(t))});qn(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.cursor=K_(t.lngLat.toArray()),this.onClick(t),this.finish())});qn(this,"onMouseDown",t=>{this.active&&!this.dragFrom&&this.hover!=null&&(t.preventDefault(),this.cursor=null,this.dragFrom=t.lngLat.toArray(),this.beforeUpdate(),this.redraw())});qn(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});qn(this,"onKeypress",t=>{this.active&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="z"&&t.ctrlKey&&this.undo())});qn(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});this.map=t,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 t=this.polygonFeature();if(t)for(let n of this.eventListenersSuccess)n(t);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let t of this.eventListenersFailure)t();this.stop()}addEventListenerSuccess(t){this.eventListenersSuccess.push(t)}addEventListenerUpdated(t){this.eventListenersUpdated.push(t)}addEventListenerFailure(t){this.eventListenersFailure.push(t)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(t){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(t.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 t={type:"FeatureCollection",features:[]};this.points.forEach((r,u)=>{let p=K_(r);p.properties.hover=this.hover==u,p.properties.idx=u,t.features.push(p)}),t.features=t.features.concat(ob(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",t.features.push(n)),xw.set(t);let i="crosshair";this.hover!=null&&(i=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=i,ww.set(this.previousStates.length)}pointsUpdated(){let t=this.polygonFeature();if(t)for(let n of this.eventListenersUpdated)n(t)}recalculateHovering(t){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(t.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(n.geometry.type=="Polygon"){this.hover="polygon";break}else if(n.geometry.type=="Point"&&Object.hasOwn(n.properties,"idx")){this.hover=n.properties.idx;break}this.hover==null&&(this.cursor=K_(t.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let t=this.points.map(Cw),n=[JSON.parse(JSON.stringify(t))];return n[0].push(JSON.parse(JSON.stringify(n[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:n},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>WL&&this.previousStates.shift()}}function ob(e){let t=[];for(let n=0;n=3&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[e[e.length-1],e[0]]},properties:{}}),t}function HL(e){let t,n,i;return{c(){t=Xe("Undo ("),n=Xe(e[1]),i=Xe(")")},m(r,u){Nt(r,t,u),Nt(r,n,u),Nt(r,i,u)},p(r,u){u&2&&Gi(n,r[1])},d(r){r&&(At(t),At(n),At(i))}}}function YL(e){let t;return{c(){t=Xe("Undo")},m(n,i){Nt(n,t,i)},p:Le,d(n){n&&At(t)}}}function KL(e){let t,n,i,r,u,p;function a(S,L){return S[1]==0?YL:HL}let _=a(e),x=_(e);return{c(){t=vt("button"),x.c(),i=Jt(),r=vt("ul"),r.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 @@ -612,19 +612,19 @@ and limitations under the License. or double click to finish
  • Press Escape - to cancel
  • `,t.disabled=n=e[1]==0},m(S,L){Rt(S,t,L),x.m(t,null),Rt(S,i,L),Rt(S,r,L),u||(p=be(t,"click",e[2]),u=!0)},p(S,[L]){_===(_=a(S))&&x?x.p(S,L):(x.d(1),x=_(S),x&&(x.c(),x.m(t,null))),L&2&&n!==(n=S[1]==0)&&(t.disabled=n)},i:Pe,o:Pe,d(S){S&&(Dt(t),Dt(i),Dt(r)),x.d(),u=!1,p()}}}function KL(e,t,n){let i;Ee(e,xw,p=>n(1,i=p));let{polygonTool:r}=t;const u=()=>r.undo();return e.$$set=p=>{"polygonTool"in p&&n(0,r=p.polygonTool)},[r,i,u]}class JL extends cn{constructor(t){super(),un(this,t,KL,YL,en,{polygonTool:0})}}function QL(e){let t,n,i,r,u,p,a;return{c(){t=vt("button"),t.textContent="Import current view",n=Jt(),i=vt("i"),i.textContent="or...",r=Jt(),u=vt("button"),u.textContent="Draw an area to import on the map",kt(t,"type","button"),kt(u,"type","button")},m(_,x){Rt(_,t,x),Rt(_,n,x),Rt(_,i,x),Rt(_,r,x),Rt(_,u,x),p||(a=[be(t,"click",e[1]),be(u,"click",e[2])],p=!0)},p:Pe,i:Pe,o:Pe,d(_){_&&(Dt(t),Dt(n),Dt(i),Dt(r),Dt(u)),p=!1,or(a)}}}function $L(e){let t,n;return t=new JL({props:{polygonTool:e[0]}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&1&&(u.polygonTool=i[0]),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function tM(e){let t,n,i,r;const u=[$L,QL],p=[];function a(_,x){return _[0]?0:1}return t=a(e),n=p[t]=u[t](e),{c(){n.c(),i=ys()},m(_,x){p[t].m(_,x),Rt(_,i,x),r=!0},p(_,[x]){let S=t;t=a(_),t===S?p[t].p(_,x):(Di(),Pt(p[S],1,1,()=>{p[S]=null}),Ri(),n=p[t],n?n.p(_,x):(n=p[t]=u[t](_),n.c()),Et(n,1),n.m(i.parentNode,i))},i(_){r||(Et(n),r=!0)},o(_){Pt(n),r=!1},d(_){_&&Dt(i),p[t].d(_)}}}function Ef(e){return[e.lng,e.lat]}function eM(e,t,n){let{map:i}=t;const r=np();let u=null;async function p(S){try{r("loading","Loading from Overpass");let A=await(await fetch(Cw(S))).text();r("gotXml",A)}catch(L){r("error",L.toString())}}function a(){let S=i.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[Ef(S.getSouthWest()),Ef(S.getNorthWest()),Ef(S.getNorthEast()),Ef(S.getSouthEast()),Ef(S.getSouthWest())]],type:"Polygon"}}}async function _(){if(i){if(i.getZoom()<13){r("error","Zoom in more to import");return}await p(a())}}function x(){i&&(n(0,u=new WL(i)),u.startNew(),u.addEventListenerSuccess(async S=>{n(0,u=null),await p(S)}),u.addEventListenerFailure(()=>{n(0,u=null)}))}return e.$$set=S=>{"map"in S&&n(3,i=S.map)},[u,_,x,i]}class nM extends cn{constructor(t){super(),un(this,t,eM,tM,en,{map:3})}}const iM=e=>({props:e&8}),ob=e=>({props:sM(e[3])});function rM(e){let t;const n=e[1].default,i=mr(n,e,e[2],ob);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u&12)&&_r(i,n,r,r[2],t?gr(n,r[2],u,iM):yr(r[2]),ob)},i(r){t||(Et(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function oM(e){let t,n;return t=new YE({props:{openOn:e[0],$$slots:{default:[rM,({features:i})=>({3:i}),({features:i})=>i?8:0]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,[r]){const u={};r&1&&(u.openOn=i[0]),r&12&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function sM(e){return e?e[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function aM(e,t,n){let{$$slots:i={},$$scope:r}=t,{openOn:u="hover"}=t;return e.$$set=p=>{"openOn"in p&&n(0,u=p.openOn),"$$scope"in p&&n(2,r=p.$$scope)},[u,i,r]}class xl extends cn{constructor(t){super(),un(this,t,aM,oM,en,{openOn:0})}}function sb(e,t,n){const i=e.slice();return i[1]=t[n][0],i[2]=t[n][1],i}function ab(e){let t,n,i=e[1]+"",r,u,p=e[2]+"",a;return{c(){t=vt("tr"),n=vt("td"),r=He(i),u=vt("td"),a=He(p)},m(_,x){Rt(_,t,x),dt(t,n),dt(n,r),dt(t,u),dt(u,a)},p(_,x){x&1&&i!==(i=_[1]+"")&&qi(r,i),x&1&&p!==(p=_[2]+"")&&qi(a,p)},d(_){_&&Dt(t)}}}function lM(e){let t,n,i=aa(Object.entries(e[0])),r=[];for(let u=0;u{"properties"in r&&n(0,i=r.properties)},[i]}class pp extends cn{constructor(t){super(),un(this,t,uM,lM,en,{properties:0})}}function Vr(e){return{id:e,beforeId:cM(e)}}function cM(e){let t=Rb(Hl);if(!t){console.warn(`getBeforeId(${e}) called before map is ready. Z-ordering may be incorrect.`);return}let n,i=!1;for(let r=lb.length-1;r>=0;r--){let u=lb[r];if(u==e){i=!0;break}t.getLayer(u)&&(n=u)}if(!i)throw new Error(`Layer ID ${e} not defined in layerZorder`);return n}const lb=["Background","neighbourhood-boundaries","Residential","debug-borders","debug-crosses","debug-filters","cells","interior-roads","compare-route","shortcuts","shortcuts-focus","Building","route-points","route-lines","route-polygons","Road labels","modal-filters","boundary","freehand-line","edit-polygon-fill","edit-polygon-lines","edit-polygon-vertices"],ww=["==",["geometry-type"],"Polygon"],Sw=["==",["geometry-type"],"LineString"],Ew=["==",["geometry-type"],"Point"];function Df(e,t,n){let i=["match",e];for(let[r,u]of Object.entries(t))i.push(r),i.push(u);return i.push(n),i}function hM(e,t){let n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8, "+encodeURIComponent(t)),n.setAttribute("download",e),document.body.appendChild(n),n.click(),document.body.removeChild(n)}function yi(e){if(e==null||e==null)throw new Error("Oops, notNull given something null");return e}function K_(e){return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:Iw(e)}}}function Iw(e){return[Math.round(e[0]*1e7)/1e7,Math.round(e[1]*1e7)/1e7]}function Cw(e){let t='poly:"';for(let[i,r]of e.geometry.coordinates[0])t+=`${r} ${i} `;return t=t.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${t}); node(w)->.x; <;); out meta;`}`}function Ey(e){let t=["#8dd3c7","#ffffb3","#bebada","#80b1d3","#fdb462","#b3de69","#fccde5","#bc80bd","#ccebc5","#ffed6f"];for(let n of e.features)n.properties??(n.properties={}),n.properties.cell_color=="disconnected"?n.properties.color="red":Object.hasOwn(n.properties,"cell_color")&&(n.properties.color=t[n.properties.cell_color%t.length]);return e}const pM=e=>({}),ub=e=>({}),fM=e=>({}),cb=e=>({});function hb(e){let t;const n=e[5]["line-popup"],i=mr(n,e,e[7],cb);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u&128)&&_r(i,n,r,r[7],t?gr(n,r[7],u,fM):yr(r[7]),cb)},i(r){t||(Et(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function dM(e){let t,n,i=e[0]&&hb(e);return{c(){i&&i.c(),t=ys()},m(r,u){i&&i.m(r,u),Rt(r,t,u),n=!0},p(r,u){r[0]?i?(i.p(r,u),u&1&&Et(i,1)):(i=hb(r),i.c(),Et(i,1),i.m(t.parentNode,t)):i&&(Di(),Pt(i,1,1,()=>{i=null}),Ri())},i(r){n||(Et(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&Dt(t),i&&i.d(r)}}}function mM(e){let t,n,i,r,u;const p=[Vr("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.3}}];let a={};for(let A=0;A{}}=t;const S=L=>_&&x(L.detail.features[0]);return e.$$set=L=>{"gjInput"in L&&n(4,a=L.gjInput),"interactive"in L&&n(0,_=L.interactive),"onClickLine"in L&&n(1,x=L.onClickLine),"$$scope"in L&&n(7,p=L.$$scope)},e.$$.update=()=>{e.$$.dirty&16&&n(3,i=Ey(a)),e.$$.dirty&16&&n(2,r=Math.max(...a.features.map(L=>L.properties.shortcuts??0)))},[_,x,r,i,a,u,S,p]}class kg extends cn{constructor(t){super(),un(this,t,_M,gM,en,{gjInput:4,interactive:0,onClickLine:1})}}const yM=e=>({}),pb=e=>({}),vM=e=>({}),fb=e=>({}),bM=e=>({}),db=e=>({});function xM(e){let t,n,i,r,u,p;const a=e[4].top,_=mr(a,e,e[3],db),x=e[4].sidebar,S=mr(x,e,e[3],fb),L=e[4].map,A=mr(L,e,e[3],pb);return{c(){t=vt("div"),_&&_.c(),n=Jt(),i=vt("div"),S&&S.c(),r=Jt(),u=vt("div"),A&&A.c()},m(N,z){Rt(N,t,z),_&&_.m(t,null),e[5](t),Rt(N,n,z),Rt(N,i,z),S&&S.m(i,null),e[6](i),Rt(N,r,z),Rt(N,u,z),A&&A.m(u,null),e[7](u),p=!0},p(N,[z]){_&&_.p&&(!p||z&8)&&_r(_,a,N,N[3],p?gr(a,N[3],z,bM):yr(N[3]),db),S&&S.p&&(!p||z&8)&&_r(S,x,N,N[3],p?gr(x,N[3],z,vM):yr(N[3]),fb),A&&A.p&&(!p||z&8)&&_r(A,L,N,N[3],p?gr(L,N[3],z,yM):yr(N[3]),pb)},i(N){p||(Et(_,N),Et(S,N),Et(A,N),p=!0)},o(N){Pt(_,N),Pt(S,N),Pt(A,N),p=!1},d(N){N&&(Dt(t),Dt(n),Dt(i),Dt(r),Dt(u)),_&&_.d(N),e[5](null),S&&S.d(N),e[6](null),A&&A.d(N),e[7](null)}}}function wM(e,t,n){let i,r,u;Ee(e,iy,L=>n(0,i=L)),Ee(e,ry,L=>n(1,r=L)),Ee(e,oy,L=>n(2,u=L));let{$$slots:p={},$$scope:a}=t;function _(L){tr[L?"unshift":"push"](()=>{i=L,iy.set(i)})}function x(L){tr[L?"unshift":"push"](()=>{r=L,ry.set(r)})}function S(L){tr[L?"unshift":"push"](()=>{u=L,oy.set(u)})}return e.$$set=L=>{"$$scope"in L&&n(3,a=L.$$scope)},[i,r,u,a,p,_,x,S]}class Hu extends cn{constructor(t){super(),un(this,t,wM,xM,en,{})}}function SM(e){let t,n,i,r,u,p;return{c(){t=vt("div"),n=vt("h1"),n.textContent="Debug mode",i=Jt(),r=vt("button"),r.textContent="Back to editing",kt(t,"slot","sidebar")},m(a,_){Rt(a,t,_),dt(t,n),dt(t,i),dt(t,r),u||(p=be(r,"click",e[3]),u=!0)},p:Pe,d(a){a&&Dt(t),u=!1,p()}}}function EM(e){let t,n;return t=new pp({props:{properties:e[4]}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&16&&(u.properties=i[4]),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function IM(e){let t,n,i;return n=new xl({props:{openOn:"hover",$$slots:{default:[EM,({props:r})=>({4:r}),({props:r})=>r?16:0]},$$scope:{ctx:e}}}),{c(){t=vt("div"),te(n.$$.fragment),kt(t,"slot","line-popup")},m(r,u){Rt(r,t,u),Qt(n,t,null),i=!0},p(r,u){const p={};u&48&&(p.$$scope={dirty:u,ctx:r}),n.$set(p)},i(r){i||(Et(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&Dt(t),$t(n)}}}function CM(e){let t,n;return t=new pp({props:{properties:e[4]}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&16&&(u.properties=i[4]),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function TM(e){let t,n;return t=new xl({props:{openOn:"hover",$$slots:{default:[CM,({props:i})=>({4:i}),({props:i})=>i?16:0]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&48&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function LM(e){let t,n;return t=new pp({props:{properties:e[4]}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&16&&(u.properties=i[4]),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function MM(e){let t,n;return t=new xl({props:{openOn:"hover",$$slots:{default:[LM,({props:i})=>({4:i}),({props:i})=>i?16:0]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&48&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function PM(e){let t,n,i,r;const u=[Vr("debug-borders"),{filter:["==",["get","kind"],"border_intersection"]},{paint:{"circle-radius":15,"circle-color":"green"}}];let p={$$slots:{default:[TM]},$$scope:{ctx:e}};for(let x=0;x({4:i}),({props:i})=>i?16:0]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&48&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function NM(e){let t,n;const i=[Vr("debug-filters"),{paint:{"circle-radius":15,"circle-color":"black"}}];let r={$$slots:{default:[kM]},$$scope:{ctx:e}};for(let u=0;un(0,i=a)),Ee(e,jn,a=>n(1,r=a)),[i,r,a=>window.open(yi(a.properties).way,"_blank"),()=>sn(jn,r={mode:"neighbourhood"},r)]}class zM extends cn{constructor(t){super(),un(this,t,OM,RM,en,{})}}function FM(e){let t,n,i,r,u,p;return{c(){t=vt("div"),n=vt("h1"),n.textContent="Debug GJ",i=Jt(),r=vt("button"),r.textContent="Back",kt(t,"slot","sidebar")},m(a,_){Rt(a,t,_),dt(t,n),dt(t,i),dt(t,r),u||(p=be(r,"click",e[2]),u=!0)},p:Pe,d(a){a&&Dt(t),u=!1,p()}}}function BM(e){let t,n;return t=new pp({props:{properties:e[3]}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&8&&(u.properties=i[3]),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function VM(e){let t,n;return t=new xl({props:{openOn:"hover",$$slots:{default:[BM,({props:i})=>({3:i}),({props:i})=>i?8:0]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&24&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function UM(e){let t,n;return t=new pp({props:{properties:e[3]}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&8&&(u.properties=i[3]),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function GM(e){let t,n;return t=new xl({props:{openOn:"hover",$$slots:{default:[UM,({props:i})=>({3:i}),({props:i})=>i?8:0]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&24&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function jM(e){let t,n,i,r;return t=new ru({props:{manageHoverState:!0,paint:{"line-width":8,"line-color":"black","line-opacity":ny(.5,1)},$$slots:{default:[VM]},$$scope:{ctx:e}}}),i=new hd({props:{manageHoverState:!0,paint:{"circle-radius":10,"circle-color":"black","circle-opacity":ny(.5,1)},$$slots:{default:[GM]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment),n=Jt(),te(i.$$.fragment)},m(u,p){Qt(t,u,p),Rt(u,n,p),Qt(i,u,p),r=!0},p(u,p){const a={};p&16&&(a.$$scope={dirty:p,ctx:u}),t.$set(a);const _={};p&16&&(_.$$scope={dirty:p,ctx:u}),i.$set(_)},i(u){r||(Et(t.$$.fragment,u),Et(i.$$.fragment,u),r=!0)},o(u){Pt(t.$$.fragment,u),Pt(i.$$.fragment,u),r=!1},d(u){u&&Dt(n),$t(t,u),$t(i,u)}}}function qM(e){let t,n,i;return n=new Ms({props:{data:JSON.parse(yi(e[0]).toRouteSnapperGj()),generateId:!0,$$slots:{default:[jM]},$$scope:{ctx:e}}}),{c(){t=vt("div"),te(n.$$.fragment),kt(t,"slot","map")},m(r,u){Rt(r,t,u),Qt(n,t,null),i=!0},p(r,u){const p={};u&1&&(p.data=JSON.parse(yi(r[0]).toRouteSnapperGj())),u&16&&(p.$$scope={dirty:u,ctx:r}),n.$set(p)},i(r){i||(Et(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&Dt(t),$t(n)}}}function ZM(e){let t,n;return t=new Hu({props:{$$slots:{map:[qM],sidebar:[FM]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,[r]){const u={};r&19&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function WM(e,t,n){let i,r;return Ee(e,Wo,p=>n(0,i=p)),Ee(e,jn,p=>n(1,r=p)),[i,r,()=>sn(jn,r={mode:"network"},r)]}class XM extends cn{constructor(t){super(),un(this,t,WM,ZM,en,{})}}function HM(e){let t,n,i,r,u,p,a,_,x,S,L,A,N,z,H,Z,K;return z=new sw({props:{msg:e[0]}}),{c(){t=vt("details"),n=vt("summary"),n.textContent="Save / load project",i=Jt(),r=vt("button"),r.textContent="Save to GJ",u=Jt(),p=vt("label"),a=He(`Load edits from GJ - `),_=vt("input"),x=Jt(),S=vt("div"),L=vt("button"),L.textContent="Save to local storage",A=vt("button"),A.textContent="Load from local storage",N=Jt(),te(z.$$.fragment),kt(_,"type","file"),Qi(S,"display","flex"),Qi(S,"justify-content","space-between")},m(V,X){Rt(V,t,X),dt(t,n),dt(t,i),dt(t,r),dt(t,u),dt(t,p),dt(p,a),dt(p,_),e[7](_),dt(t,x),dt(t,S),dt(S,L),dt(S,A),Rt(V,N,X),Qt(z,V,X),H=!0,Z||(K=[be(r,"click",e[2]),be(_,"change",e[3]),be(L,"click",e[5]),be(A,"click",e[4])],Z=!0)},p(V,[X]){const Q={};X&1&&(Q.msg=V[0]),z.$set(Q)},i(V){H||(Et(z.$$.fragment,V),H=!0)},o(V){Pt(z.$$.fragment,V),H=!1},d(V){V&&(Dt(t),Dt(N)),e[7](null),$t(z,V),Z=!1,or(K)}}}function YM(e,t,n){let i,r,u,p;Ee(e,Wo,H=>n(9,r=H)),Ee(e,jn,H=>n(10,u=H)),Ee(e,Pu,H=>n(6,p=H));let a=null;function _(){hM(i,r.toSavefile())}let x;async function S(H){n(0,a="Loading project from file");try{N(await x.files[0].text())}catch(Z){window.alert(`Couldn't open this file: ${Z}`)}n(0,a=null)}function L(){n(0,a="Loading projects from local storage");try{let H=window.localStorage.getItem(i);H?N(H):window.alert("Nothing was saved in local storage")}catch(H){window.alert(`Couldn't load from local storage: ${H}`)}n(0,a=null)}function A(){window.localStorage.setItem(i,r.toSavefile())}function N(H){r.loadSavefile(JSON.parse(H)),sn(jn,u={mode:"network"},u),Wo.set(r)}function z(H){tr[H?"unshift":"push"](()=>{x=H,n(1,x)})}return e.$$.update=()=>{e.$$.dirty&64&&(i=`ltn_${p||"custom"}.geojson`)},[a,x,_,S,L,A,p,z]}class Tw extends cn{constructor(t){super(),un(this,t,YM,HM,en,{})}}function mb(e,t,n){const i=e.slice();return i[7]=t[n][0],i[8]=t[n][1],i[9]=t[n][2],i}function gb(e){let t,n,i,r,u=e[8]+"",p,a,_,x;function S(){return e[3](e[7])}return{c(){t=vt("button"),n=vt("img"),r=vt("br"),p=He(u),Tr(n.src,i=`/ltn//filters/${e[7]}_icon.gif`)||kt(n,"src",i),kt(n,"width","80"),kt(n,"alt",e[8]),kt(t,"class","outline"),Qi(t,"width","100%"),t.disabled=a=e[0]==e[7]},m(L,A){Rt(L,t,A),dt(t,n),dt(t,r),dt(t,p),_||(x=be(t,"click",S),_=!0)},p(L,A){e=L,A&1&&a!==(a=e[0]==e[7])&&(t.disabled=a)},d(L){L&&Dt(t),_=!1,x()}}}function KM(e){let t,n,i,r,u,p,a,_,x,S,L,A,N=e[1][2]+"",z,H,Z,K,V,X,Q=aa(e[2]),it=[];for(let ut=0;ut({6:i}),({dialog:i})=>i?64:0]},$$scope:{ctx:e}}}),t.$on("close",e[5]),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,[r]){const u={};r&4163&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function QM(e,t,n){let i,{filterType:r}=t,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 p=x=>n(0,r=x),a=x=>yi(x).close();function _(x){li.call(this,e,x)}return e.$$set=x=>{"filterType"in x&&n(0,r=x.filterType)},e.$$.update=()=>{e.$$.dirty&1&&n(1,i=u.find(x=>x[0]==r))},[r,i,u,p,a,_]}class $M extends cn{constructor(t){super(),un(this,t,QM,JM,en,{filterType:0})}}function _b(e){let t,n;return t=new Ms({props:{data:e[0],$$slots:{default:[tP]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&1&&(u.data=i[0]),r&64&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function tP(e){let t,n;const i=[Vr("freehand-line"),{paint:{"line-width":5,"line-color":"red"}}];let r={};for(let u=0;u{i=null}),Ri())},i(r){n||(Et(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&Dt(t),i&&i.d(r)}}}function nP(e,t,n){let{map:i}=t,r=null;const u=np();i.on("dragstart",p),i.on("mousemove",a),i.on("mouseup",_),ks(()=>{i.dragPan.enable(),i.off("dragstart",p),i.off("mousemove",a),i.off("mouseup",_)});function p(){i.dragPan.disable(),n(0,r={type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}})}function a(x){r&&(r.geometry.coordinates.push(x.lngLat.toArray()),n(0,r))}function _(){r&&(u("done",r),n(0,r=null))}return e.$$set=x=>{"map"in x&&n(1,i=x.map)},[r,i]}class iP extends cn{constructor(t){super(),un(this,t,nP,eP,en,{map:1})}}function rP(e){let t;const n=e[3].default,i=mr(n,e,e[5],null);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u&32)&&_r(i,n,r,r[5],t?gr(n,r[5],u,null):yr(r[5]),null)},i(r){t||(Et(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function oP(e){let t,n;const i=[Vr("modal-filters"),{layout:{"icon-image":["get","filter_kind"],"icon-allow-overlap":!0,"icon-size":.1}}];let r={$$slots:{default:[rP]},$$scope:{ctx:e}};for(let u=0;un(1,r=x)),Ee(e,_c,x=>n(2,u=x));let{$$slots:p={},$$scope:a}=t;function _(x){li.call(this,e,x)}return e.$$set=x=>{"$$scope"in x&&n(5,a=x.$$scope)},e.$$.update=()=>{e.$$.dirty&6&&n(0,i=u>0?JSON.parse(r.renderModalFilters()):null)},[i,r,u,p,_,a]}class Ng extends cn{constructor(t){super(),un(this,t,aP,sP,en,{})}}function lP(e){let t,n,i,r,u,p,a,_,x,S,L,A,N=yi(yi(e[7]).properties).name+"",z,H,Z;return{c(){t=vt("div"),n=vt("nav"),i=vt("ul"),r=vt("li"),u=vt("a"),u.textContent="Change study area",p=Jt(),a=vt("li"),_=vt("a"),_.textContent="Change neighbourhood",x=Jt(),S=vt("li"),L=He("Editing modal filters in "),A=vt("u"),z=He(N),kt(u,"href","#"),kt(_,"href","#"),kt(n,"aria-label","breadcrumb"),kt(t,"slot","top")},m(K,V){Rt(K,t,V),dt(t,n),dt(n,i),dt(i,r),dt(r,u),dt(i,p),dt(i,a),dt(a,_),dt(i,x),dt(i,S),dt(S,L),dt(S,A),dt(A,z),H||(Z=[be(u,"click",e[25]),be(_,"click",e[26])],H=!0)},p(K,V){V[0]&128&&N!==(N=yi(yi(K[7]).properties).name+"")&&qi(z,N)},d(K){K&&Dt(t),H=!1,or(Z)}}}function uP(e){let t,n,i;return{c(){t=He("Undo ("),n=He(e[5]),i=He(")")},m(r,u){Rt(r,t,u),Rt(r,n,u),Rt(r,i,u)},p(r,u){u[0]&32&&qi(n,r[5])},d(r){r&&(Dt(t),Dt(n),Dt(i))}}}function cP(e){let t;return{c(){t=He("Undo")},m(n,i){Rt(n,t,i)},p:Pe,d(n){n&&Dt(t)}}}function hP(e){let t,n,i;return{c(){t=He("Redo ("),n=He(e[6]),i=He(")")},m(r,u){Rt(r,t,u),Rt(r,n,u),Rt(r,i,u)},p(r,u){u[0]&64&&qi(n,r[6])},d(r){r&&(Dt(t),Dt(n),Dt(i))}}}function pP(e){let t;return{c(){t=He("Redo")},m(n,i){Rt(n,t,i)},p:Pe,d(n){n&&Dt(t)}}}function yb(e){let t,n,i;function r(p){e[23](p)}let u={};return e[2]!==void 0&&(u.filterType=e[2]),t=new $M({props:u}),tr.push(()=>Ru(t,"filterType",r)),t.$on("close",e[24]),{c(){te(t.$$.fragment)},m(p,a){Qt(t,p,a),i=!0},p(p,a){const _={};!n&&a[0]&4&&(n=!0,_.filterType=p[2],Du(()=>n=!1)),t.$set(_)},i(p){i||(Et(t.$$.fragment,p),i=!0)},o(p){Pt(t.$$.fragment,p),i=!1},d(p){$t(t,p)}}}function fP(e){let t,n,i,r,u,p,a,_,x,S,L,A,N,z,H,Z,K,V,X,Q,it,ht,ut,gt,at,Lt,bt,yt,he,Nt,Gt,Yt,we,me,Ye,On,$e,Ve,Ge,mn,Qn,qn,ie,De,pn,Zn;function Ar(Ie,An){return Ie[5]==0?cP:uP}let mi=Ar(e),wt=mi(e);function Ue(Ie,An){return Ie[6]==0?pP:hP}let ze=Ue(e),Wn=ze(e),nn=e[4]&&yb(e);return ie=new Tw({}),{c(){t=vt("div"),n=vt("nav"),i=vt("ul"),r=vt("li"),u=vt("button"),u.textContent="View shortcuts",p=Jt(),a=vt("li"),_=vt("button"),_.textContent="Route",x=Jt(),S=vt("li"),L=vt("button"),L.textContent="Debug",A=Jt(),N=vt("button"),N.textContent="Change this neighbourhood boundary",z=Jt(),H=vt("p"),H.textContent=`Now that you've defined a neighbourhood boundary, you can see the possible + to cancel`,t.disabled=n=e[1]==0},m(S,L){Nt(S,t,L),x.m(t,null),Nt(S,i,L),Nt(S,r,L),u||(p=xe(t,"click",e[2]),u=!0)},p(S,[L]){_===(_=a(S))&&x?x.p(S,L):(x.d(1),x=_(S),x&&(x.c(),x.m(t,null))),L&2&&n!==(n=S[1]==0)&&(t.disabled=n)},i:Le,o:Le,d(S){S&&(At(t),At(i),At(r)),x.d(),u=!1,p()}}}function JL(e,t,n){let i;Ee(e,ww,p=>n(1,i=p));let{polygonTool:r}=t;const u=()=>r.undo();return e.$$set=p=>{"polygonTool"in p&&n(0,r=p.polygonTool)},[r,i,u]}class QL extends sn{constructor(t){super(),on(this,t,JL,KL,Qe,{polygonTool:0})}}function $L(e){let t,n,i,r,u,p,a;return{c(){t=vt("button"),t.textContent="Import current view",n=Jt(),i=vt("i"),i.textContent="or...",r=Jt(),u=vt("button"),u.textContent="Draw an area to import on the map",kt(t,"type","button"),kt(u,"type","button")},m(_,x){Nt(_,t,x),Nt(_,n,x),Nt(_,i,x),Nt(_,r,x),Nt(_,u,x),p||(a=[xe(t,"click",e[1]),xe(u,"click",e[2])],p=!0)},p:Le,i:Le,o:Le,d(_){_&&(At(t),At(n),At(i),At(r),At(u)),p=!1,or(a)}}}function tM(e){let t,n;return t=new QL({props:{polygonTool:e[0]}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&1&&(u.polygonTool=i[0]),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function eM(e){let t,n,i,r;const u=[tM,$L],p=[];function a(_,x){return _[0]?0:1}return t=a(e),n=p[t]=u[t](e),{c(){n.c(),i=$o()},m(_,x){p[t].m(_,x),Nt(_,i,x),r=!0},p(_,[x]){let S=t;t=a(_),t===S?p[t].p(_,x):(Ii(),Pt(p[S],1,1,()=>{p[S]=null}),Ci(),n=p[t],n?n.p(_,x):(n=p[t]=u[t](_),n.c()),wt(n,1),n.m(i.parentNode,i))},i(_){r||(wt(n),r=!0)},o(_){Pt(n),r=!1},d(_){_&&At(i),p[t].d(_)}}}function Ef(e){return[e.lng,e.lat]}function nM(e,t,n){let{map:i}=t;const r=np();let u=null;async function p(S){try{r("loading","Loading from Overpass");let A=await(await fetch(Tw(S))).text();r("gotXml",A)}catch(L){r("error",L.toString())}}function a(){let S=i.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[Ef(S.getSouthWest()),Ef(S.getNorthWest()),Ef(S.getNorthEast()),Ef(S.getSouthEast()),Ef(S.getSouthWest())]],type:"Polygon"}}}async function _(){if(i){if(i.getZoom()<13){r("error","Zoom in more to import");return}await p(a())}}function x(){i&&(n(0,u=new XL(i)),u.startNew(),u.addEventListenerSuccess(async S=>{n(0,u=null),await p(S)}),u.addEventListenerFailure(()=>{n(0,u=null)}))}return e.$$set=S=>{"map"in S&&n(3,i=S.map)},[u,_,x,i]}class iM extends sn{constructor(t){super(),on(this,t,nM,eM,Qe,{map:3})}}const rM=e=>({props:e&8}),sb=e=>({props:aM(e[3])});function oM(e){let t;const n=e[1].default,i=mr(n,e,e[2],sb);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u&12)&&_r(i,n,r,r[2],t?gr(n,r[2],u,rM):yr(r[2]),sb)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function sM(e){let t,n;return t=new KE({props:{openOn:e[0],$$slots:{default:[oM,({features:i})=>({3:i}),({features:i})=>i?8:0]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,[r]){const u={};r&1&&(u.openOn=i[0]),r&12&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function aM(e){return e?e[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function lM(e,t,n){let{$$slots:i={},$$scope:r}=t,{openOn:u="hover"}=t;return e.$$set=p=>{"openOn"in p&&n(0,u=p.openOn),"$$scope"in p&&n(2,r=p.$$scope)},[u,i,r]}class xl extends sn{constructor(t){super(),on(this,t,lM,sM,Qe,{openOn:0})}}function ab(e,t,n){const i=e.slice();return i[1]=t[n][0],i[2]=t[n][1],i}function lb(e){let t,n,i=e[1]+"",r,u,p=e[2]+"",a;return{c(){t=vt("tr"),n=vt("td"),r=Xe(i),u=vt("td"),a=Xe(p)},m(_,x){Nt(_,t,x),mt(t,n),mt(n,r),mt(t,u),mt(u,a)},p(_,x){x&1&&i!==(i=_[1]+"")&&Gi(r,i),x&1&&p!==(p=_[2]+"")&&Gi(a,p)},d(_){_&&At(t)}}}function uM(e){let t,n,i=aa(Object.entries(e[0])),r=[];for(let u=0;u{"properties"in r&&n(0,i=r.properties)},[i]}class pp extends sn{constructor(t){super(),on(this,t,cM,uM,Qe,{properties:0})}}function Br(e){return{id:e,beforeId:hM(e)}}function hM(e){let t=zb(Hl);if(!t){console.warn(`getBeforeId(${e}) called before map is ready. Z-ordering may be incorrect.`);return}let n,i=!1;for(let r=ub.length-1;r>=0;r--){let u=ub[r];if(u==e){i=!0;break}t.getLayer(u)&&(n=u)}if(!i)throw new Error(`Layer ID ${e} not defined in layerZorder`);return n}const ub=["Background","neighbourhood-boundaries","Residential","debug-borders","debug-crosses","debug-filters","cells","interior-roads","compare-route","shortcuts","shortcuts-focus","Building","route-points","route-lines","route-polygons","Road labels","modal-filters","boundary","freehand-line","edit-polygon-fill","edit-polygon-lines","edit-polygon-vertices"],Sw=["==",["geometry-type"],"Polygon"],Ew=["==",["geometry-type"],"LineString"],Iw=["==",["geometry-type"],"Point"];function Df(e,t,n){let i=["match",e];for(let[r,u]of Object.entries(t))i.push(r),i.push(u);return i.push(n),i}function pM(e,t){let n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8, "+encodeURIComponent(t)),n.setAttribute("download",e),document.body.appendChild(n),n.click(),document.body.removeChild(n)}function gi(e){if(e==null||e==null)throw new Error("Oops, notNull given something null");return e}function K_(e){return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:Cw(e)}}}function Cw(e){return[Math.round(e[0]*1e7)/1e7,Math.round(e[1]*1e7)/1e7]}function Tw(e){let t='poly:"';for(let[i,r]of e.geometry.coordinates[0])t+=`${r} ${i} `;return t=t.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${t}); node(w)->.x; <;); out meta;`}`}function Ey(e){let t=["#8dd3c7","#ffffb3","#bebada","#80b1d3","#fdb462","#b3de69","#fccde5","#bc80bd","#ccebc5","#ffed6f"];for(let n of e.features)n.properties??(n.properties={}),n.properties.cell_color=="disconnected"?n.properties.color="red":Object.hasOwn(n.properties,"cell_color")&&(n.properties.color=t[n.properties.cell_color%t.length]);return e}const fM=e=>({}),cb=e=>({}),dM=e=>({}),hb=e=>({});function pb(e){let t;const n=e[5]["line-popup"],i=mr(n,e,e[7],hb);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u&128)&&_r(i,n,r,r[7],t?gr(n,r[7],u,dM):yr(r[7]),hb)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function mM(e){let t,n,i=e[0]&&pb(e);return{c(){i&&i.c(),t=$o()},m(r,u){i&&i.m(r,u),Nt(r,t,u),n=!0},p(r,u){r[0]?i?(i.p(r,u),u&1&&wt(i,1)):(i=pb(r),i.c(),wt(i,1),i.m(t.parentNode,t)):i&&(Ii(),Pt(i,1,1,()=>{i=null}),Ci())},i(r){n||(wt(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&At(t),i&&i.d(r)}}}function gM(e){let t,n,i,r,u;const p=[Br("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.3}}];let a={};for(let A=0;A{}}=t;const S=L=>_&&x(L.detail.features[0]);return e.$$set=L=>{"gjInput"in L&&n(4,a=L.gjInput),"interactive"in L&&n(0,_=L.interactive),"onClickLine"in L&&n(1,x=L.onClickLine),"$$scope"in L&&n(7,p=L.$$scope)},e.$$.update=()=>{e.$$.dirty&16&&n(3,i=Ey(a)),e.$$.dirty&16&&n(2,r=Math.max(...a.features.map(L=>L.properties.shortcuts??0)))},[_,x,r,i,a,u,S,p]}class kg extends sn{constructor(t){super(),on(this,t,yM,_M,Qe,{gjInput:4,interactive:0,onClickLine:1})}}const vM=e=>({}),fb=e=>({}),bM=e=>({}),db=e=>({}),xM=e=>({}),mb=e=>({});function wM(e){let t,n,i,r,u,p;const a=e[4].top,_=mr(a,e,e[3],mb),x=e[4].sidebar,S=mr(x,e,e[3],db),L=e[4].map,A=mr(L,e,e[3],fb);return{c(){t=vt("div"),_&&_.c(),n=Jt(),i=vt("div"),S&&S.c(),r=Jt(),u=vt("div"),A&&A.c()},m(N,O){Nt(N,t,O),_&&_.m(t,null),e[5](t),Nt(N,n,O),Nt(N,i,O),S&&S.m(i,null),e[6](i),Nt(N,r,O),Nt(N,u,O),A&&A.m(u,null),e[7](u),p=!0},p(N,[O]){_&&_.p&&(!p||O&8)&&_r(_,a,N,N[3],p?gr(a,N[3],O,xM):yr(N[3]),mb),S&&S.p&&(!p||O&8)&&_r(S,x,N,N[3],p?gr(x,N[3],O,bM):yr(N[3]),db),A&&A.p&&(!p||O&8)&&_r(A,L,N,N[3],p?gr(L,N[3],O,vM):yr(N[3]),fb)},i(N){p||(wt(_,N),wt(S,N),wt(A,N),p=!0)},o(N){Pt(_,N),Pt(S,N),Pt(A,N),p=!1},d(N){N&&(At(t),At(n),At(i),At(r),At(u)),_&&_.d(N),e[5](null),S&&S.d(N),e[6](null),A&&A.d(N),e[7](null)}}}function SM(e,t,n){let i,r,u;Ee(e,iy,L=>n(0,i=L)),Ee(e,ry,L=>n(1,r=L)),Ee(e,oy,L=>n(2,u=L));let{$$slots:p={},$$scope:a}=t;function _(L){Qi[L?"unshift":"push"](()=>{i=L,iy.set(i)})}function x(L){Qi[L?"unshift":"push"](()=>{r=L,ry.set(r)})}function S(L){Qi[L?"unshift":"push"](()=>{u=L,oy.set(u)})}return e.$$set=L=>{"$$scope"in L&&n(3,a=L.$$scope)},[i,r,u,a,p,_,x,S]}class Hu extends sn{constructor(t){super(),on(this,t,SM,wM,Qe,{})}}function EM(e){let t,n,i,r,u,p;return{c(){t=vt("div"),n=vt("h1"),n.textContent="Debug mode",i=Jt(),r=vt("button"),r.textContent="Back to editing",kt(t,"slot","sidebar")},m(a,_){Nt(a,t,_),mt(t,n),mt(t,i),mt(t,r),u||(p=xe(r,"click",e[3]),u=!0)},p:Le,d(a){a&&At(t),u=!1,p()}}}function IM(e){let t,n;return t=new pp({props:{properties:e[4]}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&16&&(u.properties=i[4]),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function CM(e){let t,n,i;return n=new xl({props:{openOn:"hover",$$slots:{default:[IM,({props:r})=>({4:r}),({props:r})=>r?16:0]},$$scope:{ctx:e}}}),{c(){t=vt("div"),ee(n.$$.fragment),kt(t,"slot","line-popup")},m(r,u){Nt(r,t,u),$t(n,t,null),i=!0},p(r,u){const p={};u&48&&(p.$$scope={dirty:u,ctx:r}),n.$set(p)},i(r){i||(wt(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&At(t),te(n)}}}function TM(e){let t,n;return t=new pp({props:{properties:e[4]}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&16&&(u.properties=i[4]),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function LM(e){let t,n;return t=new xl({props:{openOn:"hover",$$slots:{default:[TM,({props:i})=>({4:i}),({props:i})=>i?16:0]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&48&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function MM(e){let t,n;return t=new pp({props:{properties:e[4]}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&16&&(u.properties=i[4]),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function PM(e){let t,n;return t=new xl({props:{openOn:"hover",$$slots:{default:[MM,({props:i})=>({4:i}),({props:i})=>i?16:0]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&48&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function AM(e){let t,n,i,r;const u=[Br("debug-borders"),{filter:["==",["get","kind"],"border_intersection"]},{paint:{"circle-radius":15,"circle-color":"green"}}];let p={$$slots:{default:[LM]},$$scope:{ctx:e}};for(let x=0;x({4:i}),({props:i})=>i?16:0]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&48&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function DM(e){let t,n;const i=[Br("debug-filters"),{paint:{"circle-radius":15,"circle-color":"black"}}];let r={$$slots:{default:[NM]},$$scope:{ctx:e}};for(let u=0;un(0,i=a)),Ee(e,Gn,a=>n(1,r=a)),[i,r,a=>window.open(gi(a.properties).way,"_blank"),()=>nn(Gn,r={mode:"neighbourhood"},r)]}class FM extends sn{constructor(t){super(),on(this,t,zM,OM,Qe,{})}}function BM(e){let t,n,i,r,u,p;return{c(){t=vt("div"),n=vt("h1"),n.textContent="Debug GJ",i=Jt(),r=vt("button"),r.textContent="Back",kt(t,"slot","sidebar")},m(a,_){Nt(a,t,_),mt(t,n),mt(t,i),mt(t,r),u||(p=xe(r,"click",e[2]),u=!0)},p:Le,d(a){a&&At(t),u=!1,p()}}}function VM(e){let t,n;return t=new pp({props:{properties:e[3]}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&8&&(u.properties=i[3]),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function UM(e){let t,n;return t=new xl({props:{openOn:"hover",$$slots:{default:[VM,({props:i})=>({3:i}),({props:i})=>i?8:0]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&24&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function GM(e){let t,n;return t=new pp({props:{properties:e[3]}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&8&&(u.properties=i[3]),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function jM(e){let t,n;return t=new xl({props:{openOn:"hover",$$slots:{default:[GM,({props:i})=>({3:i}),({props:i})=>i?8:0]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&24&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function qM(e){let t,n,i,r;return t=new ru({props:{manageHoverState:!0,paint:{"line-width":8,"line-color":"black","line-opacity":ny(.5,1)},$$slots:{default:[UM]},$$scope:{ctx:e}}}),i=new hd({props:{manageHoverState:!0,paint:{"circle-radius":10,"circle-color":"black","circle-opacity":ny(.5,1)},$$slots:{default:[jM]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment),n=Jt(),ee(i.$$.fragment)},m(u,p){$t(t,u,p),Nt(u,n,p),$t(i,u,p),r=!0},p(u,p){const a={};p&16&&(a.$$scope={dirty:p,ctx:u}),t.$set(a);const _={};p&16&&(_.$$scope={dirty:p,ctx:u}),i.$set(_)},i(u){r||(wt(t.$$.fragment,u),wt(i.$$.fragment,u),r=!0)},o(u){Pt(t.$$.fragment,u),Pt(i.$$.fragment,u),r=!1},d(u){u&&At(n),te(t,u),te(i,u)}}}function ZM(e){let t,n,i;return n=new Ms({props:{data:JSON.parse(gi(e[0]).toRouteSnapperGj()),generateId:!0,$$slots:{default:[qM]},$$scope:{ctx:e}}}),{c(){t=vt("div"),ee(n.$$.fragment),kt(t,"slot","map")},m(r,u){Nt(r,t,u),$t(n,t,null),i=!0},p(r,u){const p={};u&1&&(p.data=JSON.parse(gi(r[0]).toRouteSnapperGj())),u&16&&(p.$$scope={dirty:u,ctx:r}),n.$set(p)},i(r){i||(wt(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&At(t),te(n)}}}function WM(e){let t,n;return t=new Hu({props:{$$slots:{map:[ZM],sidebar:[BM]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,[r]){const u={};r&19&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function XM(e,t,n){let i,r;return Ee(e,Wo,p=>n(0,i=p)),Ee(e,Gn,p=>n(1,r=p)),[i,r,()=>nn(Gn,r={mode:"network"},r)]}class HM extends sn{constructor(t){super(),on(this,t,XM,WM,Qe,{})}}function YM(e){let t,n,i,r,u,p,a,_,x,S,L,A,N,O,Z,G,K;return O=new lw({props:{msg:e[0]}}),{c(){t=vt("details"),n=vt("summary"),n.textContent="Save / load project",i=Jt(),r=vt("button"),r.textContent="Save to GJ",u=Jt(),p=vt("label"),a=Xe(`Load edits from GJ + `),_=vt("input"),x=Jt(),S=vt("div"),L=vt("button"),L.textContent="Save to local storage",A=vt("button"),A.textContent="Load from local storage",N=Jt(),ee(O.$$.fragment),kt(_,"type","file"),Wn(S,"display","flex"),Wn(S,"justify-content","space-between")},m(V,H){Nt(V,t,H),mt(t,n),mt(t,i),mt(t,r),mt(t,u),mt(t,p),mt(p,a),mt(p,_),e[7](_),mt(t,x),mt(t,S),mt(S,L),mt(S,A),Nt(V,N,H),$t(O,V,H),Z=!0,G||(K=[xe(r,"click",e[2]),xe(_,"change",e[3]),xe(L,"click",e[5]),xe(A,"click",e[4])],G=!0)},p(V,[H]){const Q={};H&1&&(Q.msg=V[0]),O.$set(Q)},i(V){Z||(wt(O.$$.fragment,V),Z=!0)},o(V){Pt(O.$$.fragment,V),Z=!1},d(V){V&&(At(t),At(N)),e[7](null),te(O,V),G=!1,or(K)}}}function KM(e,t,n){let i,r,u,p;Ee(e,Wo,Z=>n(9,r=Z)),Ee(e,Gn,Z=>n(10,u=Z)),Ee(e,Pu,Z=>n(6,p=Z));let a=null;function _(){pM(i,r.toSavefile())}let x;async function S(Z){n(0,a="Loading project from file");try{N(await x.files[0].text())}catch(G){window.alert(`Couldn't open this file: ${G}`)}n(0,a=null)}function L(){n(0,a="Loading projects from local storage");try{let Z=window.localStorage.getItem(i);Z?N(Z):window.alert("Nothing was saved in local storage")}catch(Z){window.alert(`Couldn't load from local storage: ${Z}`)}n(0,a=null)}function A(){window.localStorage.setItem(i,r.toSavefile())}function N(Z){r.loadSavefile(JSON.parse(Z)),nn(Gn,u={mode:"network"},u),Wo.set(r)}function O(Z){Qi[Z?"unshift":"push"](()=>{x=Z,n(1,x)})}return e.$$.update=()=>{e.$$.dirty&64&&(i=`ltn_${p||"custom"}.geojson`)},[a,x,_,S,L,A,p,O]}class Lw extends sn{constructor(t){super(),on(this,t,KM,YM,Qe,{})}}function gb(e,t,n){const i=e.slice();return i[7]=t[n][0],i[8]=t[n][1],i[9]=t[n][2],i}function _b(e){let t,n,i,r,u=e[8]+"",p,a,_,x;function S(){return e[3](e[7])}return{c(){t=vt("button"),n=vt("img"),r=vt("br"),p=Xe(u),Tr(n.src,i=`/ltn//filters/${e[7]}_icon.gif`)||kt(n,"src",i),kt(n,"width","80"),kt(n,"alt",e[8]),kt(t,"class","outline"),Wn(t,"width","100%"),t.disabled=a=e[0]==e[7]},m(L,A){Nt(L,t,A),mt(t,n),mt(t,r),mt(t,p),_||(x=xe(t,"click",S),_=!0)},p(L,A){e=L,A&1&&a!==(a=e[0]==e[7])&&(t.disabled=a)},d(L){L&&At(t),_=!1,x()}}}function JM(e){let t,n,i,r,u,p,a,_,x,S,L,A,N=e[1][2]+"",O,Z,G,K,V,H,Q=aa(e[2]),it=[];for(let ft=0;ft({6:i}),({dialog:i})=>i?64:0]},$$scope:{ctx:e}}}),t.$on("close",e[5]),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,[r]){const u={};r&4163&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function $M(e,t,n){let i,{filterType:r}=t,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 p=x=>n(0,r=x),a=x=>gi(x).close();function _(x){ai.call(this,e,x)}return e.$$set=x=>{"filterType"in x&&n(0,r=x.filterType)},e.$$.update=()=>{e.$$.dirty&1&&n(1,i=u.find(x=>x[0]==r))},[r,i,u,p,a,_]}class tP extends sn{constructor(t){super(),on(this,t,$M,QM,Qe,{filterType:0})}}function yb(e){let t,n;return t=new Ms({props:{data:e[0],$$slots:{default:[eP]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&1&&(u.data=i[0]),r&64&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function eP(e){let t,n;const i=[Br("freehand-line"),{paint:{"line-width":5,"line-color":"red"}}];let r={};for(let u=0;u{i=null}),Ci())},i(r){n||(wt(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&At(t),i&&i.d(r)}}}function iP(e,t,n){let{map:i}=t,r=null;const u=np();i.on("dragstart",p),i.on("mousemove",a),i.on("mouseup",_),ks(()=>{i.dragPan.enable(),i.off("dragstart",p),i.off("mousemove",a),i.off("mouseup",_)});function p(){i.dragPan.disable(),n(0,r={type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}})}function a(x){r&&(r.geometry.coordinates.push(x.lngLat.toArray()),n(0,r))}function _(){r&&(u("done",r),n(0,r=null))}return e.$$set=x=>{"map"in x&&n(1,i=x.map)},[r,i]}class rP extends sn{constructor(t){super(),on(this,t,iP,nP,Qe,{map:1})}}function oP(e){let t;const n=e[3].default,i=mr(n,e,e[5],null);return{c(){i&&i.c()},m(r,u){i&&i.m(r,u),t=!0},p(r,u){i&&i.p&&(!t||u&32)&&_r(i,n,r,r[5],t?gr(n,r[5],u,null):yr(r[5]),null)},i(r){t||(wt(i,r),t=!0)},o(r){Pt(i,r),t=!1},d(r){i&&i.d(r)}}}function sP(e){let t,n;const i=[Br("modal-filters"),{layout:{"icon-image":["get","filter_kind"],"icon-allow-overlap":!0,"icon-size":.1}}];let r={$$slots:{default:[oP]},$$scope:{ctx:e}};for(let u=0;un(1,r=x)),Ee(e,_c,x=>n(2,u=x));let{$$slots:p={},$$scope:a}=t;function _(x){ai.call(this,e,x)}return e.$$set=x=>{"$$scope"in x&&n(5,a=x.$$scope)},e.$$.update=()=>{e.$$.dirty&6&&n(0,i=u>0?JSON.parse(r.renderModalFilters()):null)},[i,r,u,p,_,a]}class Ng extends sn{constructor(t){super(),on(this,t,lP,aP,Qe,{})}}function uP(e){let t,n,i,r,u,p,a,_,x,S,L,A,N=gi(gi(e[7]).properties).name+"",O,Z,G,K,V,H,Q,it,ht,ft;return{c(){t=vt("div"),n=vt("nav"),i=vt("ul"),r=vt("li"),u=vt("a"),u.textContent="Change study area",p=Jt(),a=vt("li"),_=vt("a"),_.textContent="Change neighbourhood",x=Jt(),S=vt("li"),L=Xe("Editing modal filters in "),A=vt("u"),O=Xe(N),Z=Jt(),G=vt("span"),K=vt("button"),K.textContent="View shortcuts",V=Jt(),H=vt("button"),H.textContent="Route",Q=Jt(),it=vt("button"),it.textContent="Debug",kt(u,"href","#"),kt(_,"href","#"),kt(n,"aria-label","breadcrumb"),kt(K,"class","outline"),Wn(K,"margin-right","8px"),kt(H,"class","outline"),Wn(H,"margin-right","8px"),kt(it,"class","outline"),Wn(G,"display","flex"),kt(t,"slot","top"),Wn(t,"display","flex"),Wn(t,"justify-content","space-between")},m(dt,ut){Nt(dt,t,ut),mt(t,n),mt(n,i),mt(i,r),mt(r,u),mt(i,p),mt(i,a),mt(a,_),mt(i,x),mt(i,S),mt(S,L),mt(S,A),mt(A,O),mt(t,Z),mt(t,G),mt(G,K),mt(G,V),mt(G,H),mt(G,Q),mt(G,it),ht||(ft=[xe(u,"click",e[22]),xe(_,"click",e[23]),xe(K,"click",e[24]),xe(H,"click",e[25]),xe(it,"click",e[26])],ht=!0)},p(dt,ut){ut[0]&128&&N!==(N=gi(gi(dt[7]).properties).name+"")&&Gi(O,N)},d(dt){dt&&At(t),ht=!1,or(ft)}}}function cP(e){let t,n,i;return{c(){t=Xe("Undo ("),n=Xe(e[5]),i=Xe(")")},m(r,u){Nt(r,t,u),Nt(r,n,u),Nt(r,i,u)},p(r,u){u[0]&32&&Gi(n,r[5])},d(r){r&&(At(t),At(n),At(i))}}}function hP(e){let t;return{c(){t=Xe("Undo")},m(n,i){Nt(n,t,i)},p:Le,d(n){n&&At(t)}}}function pP(e){let t,n,i;return{c(){t=Xe("Redo ("),n=Xe(e[6]),i=Xe(")")},m(r,u){Nt(r,t,u),Nt(r,n,u),Nt(r,i,u)},p(r,u){u[0]&64&&Gi(n,r[6])},d(r){r&&(At(t),At(n),At(i))}}}function fP(e){let t;return{c(){t=Xe("Redo")},m(n,i){Nt(n,t,i)},p:Le,d(n){n&&At(t)}}}function vb(e){let t,n,i;function r(p){e[20](p)}let u={};return e[2]!==void 0&&(u.filterType=e[2]),t=new tP({props:u}),Qi.push(()=>Ru(t,"filterType",r)),t.$on("close",e[21]),{c(){ee(t.$$.fragment)},m(p,a){$t(t,p,a),i=!0},p(p,a){const _={};!n&&a[0]&4&&(n=!0,_.filterType=p[2],Du(()=>n=!1)),t.$set(_)},i(p){i||(wt(t.$$.fragment,p),i=!0)},o(p){Pt(t.$$.fragment,p),i=!1},d(p){te(t,p)}}}function dP(e){let t,n,i,r,u,p,a,_,x,S,L,A,N,O,Z,G,K,V,H,Q,it,ht,ft,dt,ut,Mt,xt,yt,de,Rt,Gt,Kt,be,me,an;function jn(Wt,Me){return Wt[5]==0?hP:cP}let He=jn(e),ke=He(e);function Be(Wt,Me){return Wt[6]==0?fP:pP}let fn=Be(e),Mn=fn(e),ln=e[4]&&vb(e);return Kt=new Lw({}),{c(){t=vt("div"),n=vt("button"),n.textContent="Change this neighbourhood boundary",i=Jt(),r=vt("p"),r.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.`,Z=Jt(),K=vt("hr"),V=Jt(),X=vt("button"),Q=He("Add a modal filter"),ht=Jt(),ut=vt("button"),gt=He("Add many modal filters along line"),Lt=Jt(),bt=vt("button"),yt=He("Change modal filter type"),Nt=Jt(),Gt=vt("div"),Yt=vt("button"),wt.c(),me=Jt(),Ye=vt("button"),Wn.c(),$e=Jt(),nn&&nn.c(),Ve=Jt(),Ge=vt("hr"),mn=Jt(),Qn=vt("hr"),qn=Jt(),te(ie.$$.fragment),kt(u,"class","outline"),kt(_,"class","outline"),kt(L,"class","outline"),kt(N,"class","outline"),X.disabled=it=e[0]||e[3],ut.disabled=at=e[0]||e[3],bt.disabled=he=e[0]||e[3],Yt.disabled=we=e[5]==0,Ye.disabled=On=e[6]==0,Qi(Gt,"display","flex"),Qi(Gt,"justify-content","space-between"),kt(t,"slot","sidebar")},m(Ie,An){Rt(Ie,t,An),dt(t,n),dt(n,i),dt(i,r),dt(r,u),dt(i,p),dt(i,a),dt(a,_),dt(i,x),dt(i,S),dt(S,L),dt(t,A),dt(t,N),dt(t,z),dt(t,H),dt(t,Z),dt(t,K),dt(t,V),dt(t,X),dt(X,Q),dt(t,ht),dt(t,ut),dt(ut,gt),dt(t,Lt),dt(t,bt),dt(bt,yt),dt(t,Nt),dt(t,Gt),dt(Gt,Yt),wt.m(Yt,null),dt(Gt,me),dt(Gt,Ye),Wn.m(Ye,null),dt(t,$e),nn&&nn.m(t,null),dt(t,Ve),dt(t,Ge),dt(t,mn),dt(t,Qn),dt(t,qn),Qt(ie,t,null),De=!0,pn||(Zn=[be(u,"click",e[16]),be(_,"click",e[17]),be(L,"click",e[18]),be(N,"click",e[19]),be(X,"click",e[20]),be(ut,"click",e[21]),be(bt,"click",e[22]),be(Yt,"click",e[12]),be(Ye,"click",e[13])],pn=!0)},p(Ie,An){(!De||An[0]&9&&it!==(it=Ie[0]||Ie[3]))&&(X.disabled=it),(!De||An[0]&9&&at!==(at=Ie[0]||Ie[3]))&&(ut.disabled=at),(!De||An[0]&9&&he!==(he=Ie[0]||Ie[3]))&&(bt.disabled=he),mi===(mi=Ar(Ie))&&wt?wt.p(Ie,An):(wt.d(1),wt=mi(Ie),wt&&(wt.c(),wt.m(Yt,null))),(!De||An[0]&32&&we!==(we=Ie[5]==0))&&(Yt.disabled=we),ze===(ze=Ue(Ie))&&Wn?Wn.p(Ie,An):(Wn.d(1),Wn=ze(Ie),Wn&&(Wn.c(),Wn.m(Ye,null))),(!De||An[0]&64&&On!==(On=Ie[6]==0))&&(Ye.disabled=On),Ie[4]?nn?(nn.p(Ie,An),An[0]&16&&Et(nn,1)):(nn=yb(Ie),nn.c(),Et(nn,1),nn.m(t,Ve)):nn&&(Di(),Pt(nn,1,1,()=>{nn=null}),Ri())},i(Ie){De||(Et(nn),Et(ie.$$.fragment,Ie),De=!0)},o(Ie){Pt(nn),Pt(ie.$$.fragment,Ie),De=!1},d(Ie){Ie&&Dt(t),wt.d(),Wn.d(),nn&&nn.d(),$t(ie),pn=!1,or(Zn)}}}function dP(e){let t,n=e[31].shortcuts+"",i,r,u=(e[31].name??"unnamed road")+"",p;return{c(){t=vt("p"),i=He(n),r=He(" shortcuts through "),p=He(u)},m(a,_){Rt(a,t,_),dt(t,i),dt(t,r),dt(t,p)},p(a,_){_[1]&1&&n!==(n=a[31].shortcuts+"")&&qi(i,n),_[1]&1&&u!==(u=(a[31].name??"unnamed road")+"")&&qi(p,u)},d(a){a&&Dt(t)}}}function mP(e){let t,n,i;return n=new xl({props:{openOn:"hover",$$slots:{default:[dP,({props:r})=>({31:r}),({props:r})=>[0,r?1:0]]},$$scope:{ctx:e}}}),{c(){t=vt("div"),te(n.$$.fragment),kt(t,"slot","line-popup")},m(r,u){Rt(r,t,u),Qt(n,t,null),i=!0},p(r,u){const p={};u[1]&3&&(p.$$scope={dirty:u,ctx:r}),n.$set(p)},i(r){i||(Et(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&Dt(t),$t(n)}}}function gP(e){let t;return{c(){t=He("Click to delete")},m(n,i){Rt(n,t,i)},d(n){n&&Dt(t)}}}function _P(e){let t,n;return t=new xl({props:{openOn:"hover",$$slots:{default:[gP]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r[1]&2&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function vb(e){let t,n;return t=new iP({props:{map:yi(e[1])}}),t.$on("done",e[14]),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r[0]&2&&(u.map=yi(i[1])),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function yP(e){let t,n,i,r,u,p;n=new kg({props:{gjInput:e[8],interactive:!e[0]&&!e[3],$$slots:{"line-popup":[mP]},$$scope:{ctx:e}}}),r=new Ng({props:{$$slots:{default:[_P]},$$scope:{ctx:e}}}),r.$on("click",e[10]);let a=e[3]&&vb(e);return{c(){t=vt("div"),te(n.$$.fragment),i=Jt(),te(r.$$.fragment),u=Jt(),a&&a.c(),kt(t,"slot","map")},m(_,x){Rt(_,t,x),Qt(n,t,null),dt(t,i),Qt(r,t,null),dt(t,u),a&&a.m(t,null),p=!0},p(_,x){const S={};x[0]&256&&(S.gjInput=_[8]),x[0]&9&&(S.interactive=!_[0]&&!_[3]),x[1]&2&&(S.$$scope={dirty:x,ctx:_}),n.$set(S);const L={};x[1]&2&&(L.$$scope={dirty:x,ctx:_}),r.$set(L),_[3]?a?(a.p(_,x),x[0]&8&&Et(a,1)):(a=vb(_),a.c(),Et(a,1),a.m(t,null)):a&&(Di(),Pt(a,1,1,()=>{a=null}),Ri())},i(_){p||(Et(n.$$.fragment,_),Et(r.$$.fragment,_),Et(a),p=!0)},o(_){Pt(n.$$.fragment,_),Pt(r.$$.fragment,_),Pt(a),p=!1},d(_){_&&Dt(t),$t(n),$t(r),a&&a.d()}}}function vP(e){let t,n,i,r;return t=new Hu({props:{$$slots:{map:[yP],sidebar:[fP],top:[lP]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(u,p){Qt(t,u,p),n=!0,i||(r=be(window,"keydown",e[11]),i=!0)},p(u,p){const a={};p[0]&1023|p[1]&2&&(a.$$scope={dirty:p,ctx:u}),t.$set(a)},i(u){n||(Et(t.$$.fragment,u),n=!0)},o(u){Pt(t.$$.fragment,u),n=!1},d(u){$t(t,u),i=!1,r()}}}function bP(e,t,n){let i,r,u,p;Ee(e,_c,me=>n(15,i=me)),Ee(e,Wo,me=>n(27,r=me)),Ee(e,Hl,me=>n(1,u=me)),Ee(e,jn,me=>n(9,p=me));let a="walk_cycle_only",_=!1,x=!1,S=!1,L=0,A=0,N,z;function H(me){n(8,z=JSON.parse(r.renderNeighbourhood())),n(7,N=z.features.find(Ye=>Ye.properties.kind=="boundary")),n(5,L=z.undo_length),n(6,A=z.redo_length)}ks(()=>{K()});function Z(me){r.addModalFilter(me.lngLat,a),sn(_c,i++,i),K()}function K(){n(0,_=!1),u.off("click",Z),u.getCanvas().style.cursor="inherit"}function V(me){let Ye=me.detail.features[0];r.deleteModalFilter(Ye.properties.road),sn(_c,i++,i)}function X(me){me.key=="a"&&!_&&!x&&n(0,_=!0),me.key=="z"&&me.ctrlKey&&Q(),me.key=="y"&&me.ctrlKey&&it()}function Q(){r.undo(),sn(_c,i++,i)}function it(){r.redo(),sn(_c,i++,i)}function ht(me){let Ye=me.detail;Ye&&(r.addManyModalFilters(Ye,a),sn(_c,i++,i)),n(3,x=!1)}const ut=()=>sn(jn,p={mode:"view-shortcuts"},p),gt=()=>sn(jn,p={mode:"route",prevMode:"neighbourhood"},p),at=()=>sn(jn,p={mode:"debug"},p),Lt=()=>sn(jn,p={mode:"set-boundary",name:yi(yi(N).properties).name,existing:N},p),bt=()=>n(0,_=!0),yt=()=>n(3,x=!0),he=()=>n(4,S=!0);function Nt(me){a=me,n(2,a)}const Gt=()=>n(4,S=!1),Yt=()=>sn(jn,p={mode:"title"},p),we=()=>sn(jn,p={mode:"network"},p);return e.$$.update=()=>{e.$$.dirty[0]&32768&&H(),e.$$.dirty[0]&3&&_&&(u.on("click",Z),u.getCanvas().style.cursor="crosshair")},[_,u,a,x,S,L,A,N,z,p,V,X,Q,it,ht,i,ut,gt,at,Lt,bt,yt,he,Nt,Gt,Yt,we]}class xP extends cn{constructor(t){super(),un(this,t,bP,vP,en,{},null,[-1,-1])}}function bb(e,t,n){const i=e.slice();return i[14]=t[n],i}function wP(e){let t,n,i,r,u,p,a,_,x;return{c(){t=vt("div"),n=vt("nav"),i=vt("ul"),r=vt("li"),u=vt("a"),u.textContent="Change study area",p=Jt(),a=vt("li"),a.textContent="Define neighbourhood boundaries",kt(u,"href","#"),kt(n,"aria-label","breadcrumb"),kt(t,"slot","top")},m(S,L){Rt(S,t,L),dt(t,n),dt(n,i),dt(i,r),dt(r,u),dt(i,p),dt(i,a),_||(x=be(u,"click",e[12]),_=!0)},p:Pe,d(S){S&&Dt(t),_=!1,x()}}}function xb(e){let t,n,i=e[14]+"",r,u,p,a,_;function x(){return e[10](e[14])}function S(){return e[11](e[14])}return{c(){t=vt("div"),n=vt("button"),r=He(i),u=Jt(),p=vt("button"),p.textContent="X",kt(n,"class","outline"),kt(p,"class","secondary outline"),Qi(t,"display","flex"),Qi(t,"justify-content","space-between")},m(L,A){Rt(L,t,A),dt(t,n),dt(n,r),dt(t,u),dt(t,p),a||(_=[be(n,"click",x),be(p,"click",S)],a=!0)},p(L,A){e=L,A&2&&i!==(i=e[14]+"")&&qi(r,i)},d(L){L&&Dt(t),a=!1,or(_)}}}function SP(e){let t,n,i,r,u,p,a,_,x,S,L,A,N,z,H,Z,K,V,X,Q,it=aa(e[1]),ht=[];for(let ut=0;ut{ln=null}),Ci())},i(Wt){be||(wt(ln),wt(Kt.$$.fragment,Wt),be=!0)},o(Wt){Pt(ln),Pt(Kt.$$.fragment,Wt),be=!1},d(Wt){Wt&&At(t),ke.d(),Mn.d(),ln&&ln.d(),te(Kt),me=!1,or(an)}}}function mP(e){let t,n=e[31].shortcuts+"",i,r,u=(e[31].name??"unnamed road")+"",p;return{c(){t=vt("p"),i=Xe(n),r=Xe(" shortcuts through "),p=Xe(u)},m(a,_){Nt(a,t,_),mt(t,i),mt(t,r),mt(t,p)},p(a,_){_[1]&1&&n!==(n=a[31].shortcuts+"")&&Gi(i,n),_[1]&1&&u!==(u=(a[31].name??"unnamed road")+"")&&Gi(p,u)},d(a){a&&At(t)}}}function gP(e){let t,n,i;return n=new xl({props:{openOn:"hover",$$slots:{default:[mP,({props:r})=>({31:r}),({props:r})=>[0,r?1:0]]},$$scope:{ctx:e}}}),{c(){t=vt("div"),ee(n.$$.fragment),kt(t,"slot","line-popup")},m(r,u){Nt(r,t,u),$t(n,t,null),i=!0},p(r,u){const p={};u[1]&3&&(p.$$scope={dirty:u,ctx:r}),n.$set(p)},i(r){i||(wt(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&At(t),te(n)}}}function _P(e){let t;return{c(){t=Xe("Click to delete")},m(n,i){Nt(n,t,i)},d(n){n&&At(t)}}}function yP(e){let t,n;return t=new xl({props:{openOn:"hover",$$slots:{default:[_P]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r[1]&2&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function bb(e){let t,n;return t=new rP({props:{map:gi(e[1])}}),t.$on("done",e[14]),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r[0]&2&&(u.map=gi(i[1])),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function vP(e){let t,n,i,r,u,p;n=new kg({props:{gjInput:e[8],interactive:!e[0]&&!e[3],$$slots:{"line-popup":[gP]},$$scope:{ctx:e}}}),r=new Ng({props:{$$slots:{default:[yP]},$$scope:{ctx:e}}}),r.$on("click",e[10]);let a=e[3]&&bb(e);return{c(){t=vt("div"),ee(n.$$.fragment),i=Jt(),ee(r.$$.fragment),u=Jt(),a&&a.c(),kt(t,"slot","map")},m(_,x){Nt(_,t,x),$t(n,t,null),mt(t,i),$t(r,t,null),mt(t,u),a&&a.m(t,null),p=!0},p(_,x){const S={};x[0]&256&&(S.gjInput=_[8]),x[0]&9&&(S.interactive=!_[0]&&!_[3]),x[1]&2&&(S.$$scope={dirty:x,ctx:_}),n.$set(S);const L={};x[1]&2&&(L.$$scope={dirty:x,ctx:_}),r.$set(L),_[3]?a?(a.p(_,x),x[0]&8&&wt(a,1)):(a=bb(_),a.c(),wt(a,1),a.m(t,null)):a&&(Ii(),Pt(a,1,1,()=>{a=null}),Ci())},i(_){p||(wt(n.$$.fragment,_),wt(r.$$.fragment,_),wt(a),p=!0)},o(_){Pt(n.$$.fragment,_),Pt(r.$$.fragment,_),Pt(a),p=!1},d(_){_&&At(t),te(n),te(r),a&&a.d()}}}function bP(e){let t,n,i,r;return t=new Hu({props:{$$slots:{map:[vP],sidebar:[dP],top:[uP]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(u,p){$t(t,u,p),n=!0,i||(r=xe(window,"keydown",e[11]),i=!0)},p(u,p){const a={};p[0]&1023|p[1]&2&&(a.$$scope={dirty:p,ctx:u}),t.$set(a)},i(u){n||(wt(t.$$.fragment,u),n=!0)},o(u){Pt(t.$$.fragment,u),n=!1},d(u){te(t,u),i=!1,r()}}}function xP(e,t,n){let i,r,u,p;Ee(e,_c,me=>n(15,i=me)),Ee(e,Wo,me=>n(27,r=me)),Ee(e,Hl,me=>n(1,u=me)),Ee(e,Gn,me=>n(9,p=me));let a="walk_cycle_only",_=!1,x=!1,S=!1,L=0,A=0,N,O;function Z(me){n(8,O=JSON.parse(r.renderNeighbourhood())),n(7,N=O.features.find(an=>an.properties.kind=="boundary")),n(5,L=O.undo_length),n(6,A=O.redo_length)}ks(()=>{K()});function G(me){r.addModalFilter(me.lngLat,a),nn(_c,i++,i),K()}function K(){n(0,_=!1),u.off("click",G),u.getCanvas().style.cursor="inherit"}function V(me){let an=me.detail.features[0];r.deleteModalFilter(an.properties.road),nn(_c,i++,i)}function H(me){me.key=="a"&&!_&&!x&&n(0,_=!0),me.key=="z"&&me.ctrlKey&&Q(),me.key=="y"&&me.ctrlKey&&it()}function Q(){r.undo(),nn(_c,i++,i)}function it(){r.redo(),nn(_c,i++,i)}function ht(me){let an=me.detail;an&&(r.addManyModalFilters(an,a),nn(_c,i++,i)),n(3,x=!1)}const ft=()=>nn(Gn,p={mode:"set-boundary",name:gi(gi(N).properties).name,existing:N},p),dt=()=>n(0,_=!0),ut=()=>n(3,x=!0),Mt=()=>n(4,S=!0);function xt(me){a=me,n(2,a)}const yt=()=>n(4,S=!1),de=()=>nn(Gn,p={mode:"title"},p),Rt=()=>nn(Gn,p={mode:"network"},p),Gt=()=>nn(Gn,p={mode:"view-shortcuts"},p),Kt=()=>nn(Gn,p={mode:"route",prevMode:"neighbourhood"},p),be=()=>nn(Gn,p={mode:"debug"},p);return e.$$.update=()=>{e.$$.dirty[0]&32768&&Z(),e.$$.dirty[0]&3&&_&&(u.on("click",G),u.getCanvas().style.cursor="crosshair")},[_,u,a,x,S,L,A,N,O,p,V,H,Q,it,ht,i,ft,dt,ut,Mt,xt,yt,de,Rt,Gt,Kt,be]}class wP extends sn{constructor(t){super(),on(this,t,xP,bP,Qe,{},null,[-1,-1])}}function xb(e,t,n){const i=e.slice();return i[14]=t[n],i}function SP(e){let t,n,i,r,u,p,a,_,x,S,L,A,N,O;return{c(){t=vt("div"),n=vt("nav"),i=vt("ul"),r=vt("li"),u=vt("a"),u.textContent="Change study area",p=Jt(),a=vt("li"),a.textContent="Define neighbourhood boundaries",_=Jt(),x=vt("span"),S=vt("button"),S.textContent="Route",L=Jt(),A=vt("button"),A.textContent="Debug route snapper",kt(u,"href","#"),kt(n,"aria-label","breadcrumb"),kt(S,"class","outline"),Wn(S,"margin-right","8px"),kt(A,"class","outline"),Wn(x,"display","flex"),kt(t,"slot","top"),Wn(t,"display","flex"),Wn(t,"justify-content","space-between")},m(Z,G){Nt(Z,t,G),mt(t,n),mt(n,i),mt(i,r),mt(r,u),mt(i,p),mt(i,a),mt(t,_),mt(t,x),mt(x,S),mt(x,L),mt(x,A),N||(O=[xe(u,"click",e[10]),xe(S,"click",e[11]),xe(A,"click",e[12])],N=!0)},p:Le,d(Z){Z&&At(t),N=!1,or(O)}}}function wb(e){let t,n,i=e[14]+"",r,u,p,a,_;function x(){return e[8](e[14])}function S(){return e[9](e[14])}return{c(){t=vt("div"),n=vt("button"),r=Xe(i),u=Jt(),p=vt("button"),p.textContent="X",kt(n,"class","outline"),kt(p,"class","secondary outline"),Wn(t,"display","flex"),Wn(t,"justify-content","space-between")},m(L,A){Nt(L,t,A),mt(t,n),mt(n,r),mt(t,u),mt(t,p),a||(_=[xe(n,"click",x),xe(p,"click",S)],a=!0)},p(L,A){e=L,A&2&&i!==(i=e[14]+"")&&Gi(r,i)},d(L){L&&At(t),a=!1,or(_)}}}function EP(e){let t,n,i,r,u,p,a,_,x,S,L,A,N=aa(e[1]),O=[];for(let Z=0;Z({13:i}),({props:i})=>i?8192:0]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&139264&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function CP(e){let t,n,i,r;const u=[Vr("neighbourhood-boundaries"),{filter:["==",["get","kind"],"boundary"]},{paint:{"fill-color":"red","fill-opacity":ny(.3,.5)}},{manageHoverState:!0},{hoverCursor:"pointer"}];let p={$$slots:{default:[IP]},$$scope:{ctx:e}};for(let a=0;an(2,u=Z)),Ee(e,Wo,Z=>n(6,p=Z));function a(Z){p.setCurrentNeighbourhood(Z),sn(jn,u={mode:"neighbourhood"},u)}function _(Z){p.deleteNeighbourhoodBoundary(Z),n(0,i=JSON.parse(p.toSavefile()))}function x(){let Z=window.prompt("What do you want to name the neighbourhood?");Z&&sn(jn,u={mode:"set-boundary",name:Z,existing:null},u)}const S=Z=>a(yi(Z.detail.features[0].properties).name),L=()=>sn(jn,u={mode:"route",prevMode:"network"},u),A=()=>sn(jn,u={mode:"debug-gj"},u),N=Z=>a(Z),z=Z=>_(Z),H=()=>sn(jn,u={mode:"title"},u);return e.$$.update=()=>{e.$$.dirty&64&&n(0,i=JSON.parse(p.toSavefile())),e.$$.dirty&1&&n(1,r=i.features.filter(Z=>Z.properties.kind=="boundary").map(Z=>Z.properties.name))},[i,r,u,a,_,x,p,S,L,A,N,z,H]}class PP extends cn{constructor(t){super(),un(this,t,MP,LP,en,{})}}function wb(e){let t,n,i,r;return{c(){t=vt("li"),n=vt("a"),n.textContent="Editing modal filters",kt(n,"href","#")},m(u,p){Rt(u,t,p),dt(t,n),i||(r=be(n,"click",e[12]),i=!0)},p:Pe,d(u){u&&Dt(t),i=!1,r()}}}function AP(e){let t,n,i,r,u,p,a,_,x,S,L,A,N,z=e[0]=="neighbourhood"&&wb(e);return{c(){t=vt("div"),n=vt("nav"),i=vt("ul"),r=vt("li"),u=vt("a"),u.textContent="Change study area",p=Jt(),a=vt("li"),_=vt("a"),_.textContent="Change neighbourhood",x=Jt(),z&&z.c(),S=Jt(),L=vt("li"),L.textContent="Routing",kt(u,"href","#"),kt(_,"href","#"),kt(n,"aria-label","breadcrumb"),kt(t,"slot","top")},m(H,Z){Rt(H,t,Z),dt(t,n),dt(n,i),dt(i,r),dt(r,u),dt(i,p),dt(i,a),dt(a,_),dt(i,x),z&&z.m(i,null),dt(i,S),dt(i,L),A||(N=[be(u,"click",e[10]),be(_,"click",e[11])],A=!0)},p(H,Z){H[0]=="neighbourhood"?z?z.p(H,Z):(z=wb(H),z.c(),z.m(i,S)):z&&(z.d(1),z=null)},d(H){H&&Dt(t),z&&z.d(),A=!1,or(N)}}}function kP(e){let t,n,i,r,u,p,a,_;return{c(){t=vt("div"),n=vt("button"),n.textContent="Back",i=Jt(),r=vt("p"),r.textContent="Drag markers for a route",u=Jt(),p=vt("p"),p.innerHTML=`Route before, - route after`,kt(t,"slot","sidebar")},m(x,S){Rt(x,t,S),dt(t,n),dt(t,i),dt(t,r),dt(t,u),dt(t,p),a||(_=be(n,"click",e[7]),a=!0)},p:Pe,d(x){x&&Dt(t),a=!1,_()}}}function Sb(e){let t,n;return t=new kg({props:{gjInput:JSON.parse(yi(e[3]).renderNeighbourhood()),interactive:!1}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&8&&(u.gjInput=JSON.parse(yi(i[3]).renderNeighbourhood())),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function NP(e){let t,n;const i=[Vr("compare-route"),{paint:{"line-width":10,"line-color":Df(["get","kind"],{before:"red",after:"blue"},"red")}}];let r={};for(let u=0;uRu(a,"lngLat",z));function Z(V){e[9](V)}let K={draggable:!0,$$slots:{default:[RP]},$$scope:{ctx:e}};return e[1]!==void 0&&(K.lngLat=e[1]),S=new Wv({props:K}),tr.push(()=>Ru(S,"lngLat",Z)),{c(){t=vt("div"),N&&N.c(),n=Jt(),te(i.$$.fragment),r=Jt(),te(u.$$.fragment),p=Jt(),te(a.$$.fragment),x=Jt(),te(S.$$.fragment),kt(t,"slot","map")},m(V,X){Rt(V,t,X),N&&N.m(t,null),dt(t,n),Qt(i,t,null),dt(t,r),Qt(u,t,null),dt(t,p),Qt(a,t,null),dt(t,x),Qt(S,t,null),A=!0},p(V,X){V[0]=="neighbourhood"?N?(N.p(V,X),X&1&&Et(N,1)):(N=Sb(V),N.c(),Et(N,1),N.m(t,n)):N&&(Di(),Pt(N,1,1,()=>{N=null}),Ri());const Q={};X&16&&(Q.data=V[4]),X&16384&&(Q.$$scope={dirty:X,ctx:V}),u.$set(Q);const it={};X&16384&&(it.$$scope={dirty:X,ctx:V}),!_&&X&4&&(_=!0,it.lngLat=V[2],Du(()=>_=!1)),a.$set(it);const ht={};X&16384&&(ht.$$scope={dirty:X,ctx:V}),!L&&X&2&&(L=!0,ht.lngLat=V[1],Du(()=>L=!1)),S.$set(ht)},i(V){A||(Et(N),Et(i.$$.fragment,V),Et(u.$$.fragment,V),Et(a.$$.fragment,V),Et(S.$$.fragment,V),A=!0)},o(V){Pt(N),Pt(i.$$.fragment,V),Pt(u.$$.fragment,V),Pt(a.$$.fragment,V),Pt(S.$$.fragment,V),A=!1},d(V){V&&Dt(t),N&&N.d(),$t(i),$t(u),$t(a),$t(S)}}}function zP(e){let t,n,i,r;return t=new Hu({props:{$$slots:{map:[OP],sidebar:[kP],top:[AP]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(u,p){Qt(t,u,p),n=!0,i||(r=be(window,"keydown",e[6]),i=!0)},p(u,[p]){const a={};p&16447&&(a.$$scope={dirty:p,ctx:u}),t.$set(a)},i(u){n||(Et(t.$$.fragment,u),n=!0)},o(u){Pt(t.$$.fragment,u),n=!1},d(u){$t(t,u),i=!1,r()}}}function FP(e,t,n){let i,r,u,p,a,_;Ee(e,jn,K=>n(5,r=K)),Ee(e,Hl,K=>n(13,u=K)),Ee(e,Jm,K=>n(1,p=K)),Ee(e,Km,K=>n(2,a=K)),Ee(e,Wo,K=>n(3,_=K));let{prevMode:x}=t;cd(()=>{u==null||u.keyboard.disable()}),ks(()=>{u==null||u.keyboard.enable()});function S(K){K.key=="Escape"&&(K.stopPropagation(),L())}function L(){sn(jn,r={mode:x},r)}function A(K){a=K,Km.set(a)}function N(K){p=K,Jm.set(p)}const z=()=>sn(jn,r={mode:"title"},r),H=()=>sn(jn,r={mode:"network"},r),Z=()=>sn(jn,r={mode:"neighbourhood"},r);return e.$$set=K=>{"prevMode"in K&&n(0,x=K.prevMode)},e.$$.update=()=>{e.$$.dirty&14&&n(4,i=JSON.parse(_.compareRoute(a.lng,a.lat,p.lng,p.lat)))},[x,p,a,_,i,r,S,L,A,N,z,H,Z]}class BP extends cn{constructor(t){super(),un(this,t,FP,zP,en,{prevMode:0})}}function VP(e){let t,n,i,r,u,p;const a=[Vr("route-points"),{filter:Ew},{paint:{"circle-color":Df(["get","type"],{"snapped-waypoint":"red","free-waypoint":"blue"},"black"),"circle-opacity":["case",["has","hovered"],.5,1],"circle-radius":Df(["get","type"],{node:Fm/2},Fm)}}];let _={};for(let N=0;Nn(0,i=r)),[i]}class jP extends cn{constructor(t){super(),un(this,t,GP,UP,en,{})}}function qP(e){let t,n,i;return{c(){t=He("Undo ("),n=He(e[1]),i=He(")")},m(r,u){Rt(r,t,u),Rt(r,n,u),Rt(r,i,u)},p(r,u){u&2&&qi(n,r[1])},d(r){r&&(Dt(t),Dt(n),Dt(i))}}}function ZP(e){let t;return{c(){t=He("Undo")},m(n,i){Rt(n,t,i)},p:Pe,d(n){n&&Dt(t)}}}function WP(e){let t,n,i,r,u,p;function a(S,L){return S[1]==0?ZP:qP}let _=a(e),x=_(e);return{c(){t=vt("button"),x.c(),i=Jt(),r=vt("ul"),r.innerHTML=`
  • Click + boundary may not match the conventional definition of "neighbourhood."`,i=Jt(),r=vt("button"),r.textContent="Draw a new boundary",u=Jt();for(let Z=0;Z({13:i}),({props:i})=>i?8192:0]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&139264&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function TP(e){let t,n,i,r;const u=[Br("neighbourhood-boundaries"),{filter:["==",["get","kind"],"boundary"]},{paint:{"fill-color":"red","fill-opacity":ny(.3,.5)}},{manageHoverState:!0},{hoverCursor:"pointer"}];let p={$$slots:{default:[CP]},$$scope:{ctx:e}};for(let a=0;an(2,u=G)),Ee(e,Wo,G=>n(6,p=G));function a(G){p.setCurrentNeighbourhood(G),nn(Gn,u={mode:"neighbourhood"},u)}function _(G){p.deleteNeighbourhoodBoundary(G),n(0,i=JSON.parse(p.toSavefile()))}function x(){let G=window.prompt("What do you want to name the neighbourhood?");G&&nn(Gn,u={mode:"set-boundary",name:G,existing:null},u)}const S=G=>a(gi(G.detail.features[0].properties).name),L=G=>a(G),A=G=>_(G),N=()=>nn(Gn,u={mode:"title"},u),O=()=>nn(Gn,u={mode:"route",prevMode:"network"},u),Z=()=>nn(Gn,u={mode:"debug-gj"},u);return e.$$.update=()=>{e.$$.dirty&64&&n(0,i=JSON.parse(p.toSavefile())),e.$$.dirty&1&&n(1,r=i.features.filter(G=>G.properties.kind=="boundary").map(G=>G.properties.name))},[i,r,u,a,_,x,p,S,L,A,N,O,Z]}class AP extends sn{constructor(t){super(),on(this,t,PP,MP,Qe,{})}}function Sb(e){let t,n,i,r;return{c(){t=vt("li"),n=vt("a"),n.textContent="Editing modal filters",kt(n,"href","#")},m(u,p){Nt(u,t,p),mt(t,n),i||(r=xe(n,"click",e[12]),i=!0)},p:Le,d(u){u&&At(t),i=!1,r()}}}function kP(e){let t,n,i,r,u,p,a,_,x,S,L,A,N,O=e[0]=="neighbourhood"&&Sb(e);return{c(){t=vt("div"),n=vt("nav"),i=vt("ul"),r=vt("li"),u=vt("a"),u.textContent="Change study area",p=Jt(),a=vt("li"),_=vt("a"),_.textContent="Change neighbourhood",x=Jt(),O&&O.c(),S=Jt(),L=vt("li"),L.textContent="Routing",kt(u,"href","#"),kt(_,"href","#"),kt(n,"aria-label","breadcrumb"),kt(t,"slot","top")},m(Z,G){Nt(Z,t,G),mt(t,n),mt(n,i),mt(i,r),mt(r,u),mt(i,p),mt(i,a),mt(a,_),mt(i,x),O&&O.m(i,null),mt(i,S),mt(i,L),A||(N=[xe(u,"click",e[10]),xe(_,"click",e[11])],A=!0)},p(Z,G){Z[0]=="neighbourhood"?O?O.p(Z,G):(O=Sb(Z),O.c(),O.m(i,S)):O&&(O.d(1),O=null)},d(Z){Z&&At(t),O&&O.d(),A=!1,or(N)}}}function NP(e){let t,n,i,r,u,p,a,_;return{c(){t=vt("div"),n=vt("button"),n.textContent="Back",i=Jt(),r=vt("p"),r.textContent="Drag markers for a route",u=Jt(),p=vt("p"),p.innerHTML=`Route before, + route after`,kt(t,"slot","sidebar")},m(x,S){Nt(x,t,S),mt(t,n),mt(t,i),mt(t,r),mt(t,u),mt(t,p),a||(_=xe(n,"click",e[7]),a=!0)},p:Le,d(x){x&&At(t),a=!1,_()}}}function Eb(e){let t,n;return t=new kg({props:{gjInput:JSON.parse(gi(e[3]).renderNeighbourhood()),interactive:!1}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&8&&(u.gjInput=JSON.parse(gi(i[3]).renderNeighbourhood())),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function DP(e){let t,n;const i=[Br("compare-route"),{paint:{"line-width":10,"line-color":Df(["get","kind"],{before:"red",after:"blue"},"red")}}];let r={};for(let u=0;uRu(a,"lngLat",O));function G(V){e[9](V)}let K={draggable:!0,$$slots:{default:[OP]},$$scope:{ctx:e}};return e[1]!==void 0&&(K.lngLat=e[1]),S=new Xv({props:K}),Qi.push(()=>Ru(S,"lngLat",G)),{c(){t=vt("div"),N&&N.c(),n=Jt(),ee(i.$$.fragment),r=Jt(),ee(u.$$.fragment),p=Jt(),ee(a.$$.fragment),x=Jt(),ee(S.$$.fragment),kt(t,"slot","map")},m(V,H){Nt(V,t,H),N&&N.m(t,null),mt(t,n),$t(i,t,null),mt(t,r),$t(u,t,null),mt(t,p),$t(a,t,null),mt(t,x),$t(S,t,null),A=!0},p(V,H){V[0]=="neighbourhood"?N?(N.p(V,H),H&1&&wt(N,1)):(N=Eb(V),N.c(),wt(N,1),N.m(t,n)):N&&(Ii(),Pt(N,1,1,()=>{N=null}),Ci());const Q={};H&16&&(Q.data=V[4]),H&16384&&(Q.$$scope={dirty:H,ctx:V}),u.$set(Q);const it={};H&16384&&(it.$$scope={dirty:H,ctx:V}),!_&&H&4&&(_=!0,it.lngLat=V[2],Du(()=>_=!1)),a.$set(it);const ht={};H&16384&&(ht.$$scope={dirty:H,ctx:V}),!L&&H&2&&(L=!0,ht.lngLat=V[1],Du(()=>L=!1)),S.$set(ht)},i(V){A||(wt(N),wt(i.$$.fragment,V),wt(u.$$.fragment,V),wt(a.$$.fragment,V),wt(S.$$.fragment,V),A=!0)},o(V){Pt(N),Pt(i.$$.fragment,V),Pt(u.$$.fragment,V),Pt(a.$$.fragment,V),Pt(S.$$.fragment,V),A=!1},d(V){V&&At(t),N&&N.d(),te(i),te(u),te(a),te(S)}}}function FP(e){let t,n,i,r;return t=new Hu({props:{$$slots:{map:[zP],sidebar:[NP],top:[kP]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(u,p){$t(t,u,p),n=!0,i||(r=xe(window,"keydown",e[6]),i=!0)},p(u,[p]){const a={};p&16447&&(a.$$scope={dirty:p,ctx:u}),t.$set(a)},i(u){n||(wt(t.$$.fragment,u),n=!0)},o(u){Pt(t.$$.fragment,u),n=!1},d(u){te(t,u),i=!1,r()}}}function BP(e,t,n){let i,r,u,p,a,_;Ee(e,Gn,K=>n(5,r=K)),Ee(e,Hl,K=>n(13,u=K)),Ee(e,Jm,K=>n(1,p=K)),Ee(e,Km,K=>n(2,a=K)),Ee(e,Wo,K=>n(3,_=K));let{prevMode:x}=t;cd(()=>{u==null||u.keyboard.disable()}),ks(()=>{u==null||u.keyboard.enable()});function S(K){K.key=="Escape"&&(K.stopPropagation(),L())}function L(){nn(Gn,r={mode:x},r)}function A(K){a=K,Km.set(a)}function N(K){p=K,Jm.set(p)}const O=()=>nn(Gn,r={mode:"title"},r),Z=()=>nn(Gn,r={mode:"network"},r),G=()=>nn(Gn,r={mode:"neighbourhood"},r);return e.$$set=K=>{"prevMode"in K&&n(0,x=K.prevMode)},e.$$.update=()=>{e.$$.dirty&14&&n(4,i=JSON.parse(_.compareRoute(a.lng,a.lat,p.lng,p.lat)))},[x,p,a,_,i,r,S,L,A,N,O,Z,G]}class VP extends sn{constructor(t){super(),on(this,t,BP,FP,Qe,{prevMode:0})}}const UP="/ltn/assets/settings-342fb430.svg";function Ib(e){let t,n;return t=new Hy({props:{$$slots:{default:[GP]},$$scope:{ctx:e}}}),t.$on("close",e[3]),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&17&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function GP(e){let t,n,i,r,u,p,a,_,x;return i=new gI({}),{c(){t=vt("h1"),t.textContent="Settings",n=Jt(),ee(i.$$.fragment),r=Jt(),u=vt("center"),p=vt("button"),p.textContent="Confirm"},m(S,L){Nt(S,t,L),Nt(S,n,L),$t(i,S,L),Nt(S,r,L),Nt(S,u,L),mt(u,p),a=!0,_||(x=xe(p,"click",e[2]),_=!0)},p:Le,i(S){a||(wt(i.$$.fragment,S),a=!0)},o(S){Pt(i.$$.fragment,S),a=!1},d(S){S&&(At(t),At(n),At(r),At(u)),te(i,S),_=!1,x()}}}function jP(e){let t,n,i,r,u,p,a=e[0]&&Ib(e);return{c(){t=vt("button"),t.innerHTML=`Settings`,n=Jt(),a&&a.c(),i=$o(),kt(t,"class","outline")},m(_,x){Nt(_,t,x),Nt(_,n,x),a&&a.m(_,x),Nt(_,i,x),r=!0,u||(p=xe(t,"click",e[1]),u=!0)},p(_,[x]){_[0]?a?(a.p(_,x),x&1&&wt(a,1)):(a=Ib(_),a.c(),wt(a,1),a.m(i.parentNode,i)):a&&(Ii(),Pt(a,1,1,()=>{a=null}),Ci())},i(_){r||(wt(a),r=!0)},o(_){Pt(a),r=!1},d(_){_&&(At(t),At(n),At(i)),a&&a.d(_),u=!1,p()}}}function qP(e,t,n){let i=!1;return[i,()=>n(0,i=!0),()=>n(0,i=!1),()=>n(0,i=!1)]}class ZP extends sn{constructor(t){super(),on(this,t,qP,jP,Qe,{})}}function WP(e){let t,n,i,r,u,p;const a=[Br("route-points"),{filter:Iw},{paint:{"circle-color":Df(["get","type"],{"snapped-waypoint":"red","free-waypoint":"blue"},"black"),"circle-opacity":["case",["has","hovered"],.5,1],"circle-radius":Df(["get","type"],{node:Fm/2},Fm)}}];let _={};for(let N=0;Nn(0,i=r)),[i]}class YP extends sn{constructor(t){super(),on(this,t,HP,XP,Qe,{})}}function KP(e){let t,n,i;return{c(){t=Xe("Undo ("),n=Xe(e[1]),i=Xe(")")},m(r,u){Nt(r,t,u),Nt(r,n,u),Nt(r,i,u)},p(r,u){u&2&&Gi(n,r[1])},d(r){r&&(At(t),At(n),At(i))}}}function JP(e){let t;return{c(){t=Xe("Undo")},m(n,i){Nt(n,t,i)},p:Le,d(n){n&&At(t)}}}function QP(e){let t,n,i,r,u,p;function a(S,L){return S[1]==0?JP:KP}let _=a(e),x=_(e);return{c(){t=vt("button"),x.c(),i=Jt(),r=vt("ul"),r.innerHTML=`
  • Click the map to add points
  • Click and drag any point to move it
  • Click a waypoint to delete it
  • Press Control+Z @@ -632,18 +632,18 @@ and limitations under the License. or double click to finish
  • Press Escape - to cancel
  • `,t.disabled=n=e[1]==0},m(S,L){Rt(S,t,L),x.m(t,null),Rt(S,i,L),Rt(S,r,L),u||(p=be(t,"click",e[2]),u=!0)},p(S,[L]){_===(_=a(S))&&x?x.p(S,L):(x.d(1),x=_(S),x&&(x.c(),x.m(t,null))),L&2&&n!==(n=S[1]==0)&&(t.disabled=n)},i:Pe,o:Pe,d(S){S&&(Dt(t),Dt(i),Dt(r)),x.d(),u=!1,p()}}}function XP(e,t,n){let i;Ee(e,ix,p=>n(1,i=p));let{route_tool:r}=t;const u=()=>r.undo();return e.$$set=p=>{"route_tool"in p&&n(0,r=p.route_tool)},[r,i,u]}class HP extends cn{constructor(t){super(),un(this,t,XP,WP,en,{route_tool:0})}}function YP(e){let t,n,i,r,u,p,a,_,x,S,L,A,N,z,H,Z;return N=new HP({props:{route_tool:yi(e[1])}}),{c(){t=vt("div"),n=vt("h1"),i=He("Draw your neighbourhood boundary for "),r=He(e[0]),u=Jt(),p=vt("div"),a=vt("button"),a.textContent="Finish",_=Jt(),x=vt("button"),x.textContent="Cancel",S=Jt(),L=vt("p"),L.textContent="TODO: maybe move the instructions from the previous screen to here...",A=Jt(),te(N.$$.fragment),kt(x,"class","secondary"),Qi(p,"display","flex"),Qi(p,"justify-content","space-between"),kt(t,"slot","sidebar")},m(K,V){Rt(K,t,V),dt(t,n),dt(n,i),dt(n,r),dt(t,u),dt(t,p),dt(p,a),dt(p,_),dt(p,x),dt(t,S),dt(t,L),dt(t,A),Qt(N,t,null),z=!0,H||(Z=[be(a,"click",e[4]),be(x,"click",e[2])],H=!0)},p(K,V){(!z||V&1)&&qi(r,K[0]);const X={};V&2&&(X.route_tool=yi(K[1])),N.$set(X)},i(K){z||(Et(N.$$.fragment,K),z=!0)},o(K){Pt(N.$$.fragment,K),z=!1},d(K){K&&Dt(t),$t(N),H=!1,or(Z)}}}function KP(e){let t,n,i;return n=new jP({}),{c(){t=vt("div"),te(n.$$.fragment),kt(t,"slot","map")},m(r,u){Rt(r,t,u),Qt(n,t,null),i=!0},p:Pe,i(r){i||(Et(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&Dt(t),$t(n)}}}function JP(e){let t,n;return t=new Hu({props:{$$slots:{map:[KP],sidebar:[YP]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,[r]){const u={};r&131&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function QP(e,t,n){let i,r,u;Ee(e,jf,S=>n(1,i=S)),Ee(e,jn,S=>n(5,r=S)),Ee(e,Wo,S=>n(6,u=S));let{name:p}=t,{existing:a}=t;a?i.editExistingArea(a):i.startArea();function _(){sn(jn,r={mode:"network"},r),i.clearEventListeners()}i.addEventListenerSuccess(S=>{try{u.setNeighbourhoodBoundary(p,S),u.setCurrentNeighbourhood(p),sn(jn,r={mode:"neighbourhood"},r),i.clearEventListeners()}catch{window.alert("Known georust bug hit, sorry. You may need to just refresh the page now."),_()}}),i.addEventListenerFailure(_);const x=()=>yi(i).finish();return e.$$set=S=>{"name"in S&&n(0,p=S.name),"existing"in S&&n(3,a=S.existing)},[p,i,_,a,x]}class $P extends cn{constructor(t){super(),un(this,t,QP,JP,en,{name:0,existing:3})}}function tA(e){let t,n,i,r,u,p;const a=[Vr("edit-polygon-fill"),{filter:ww},{paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}];let _={};for(let N=0;Nn(0,i=r)),[i]}class iA extends cn{constructor(t){super(),un(this,t,nA,eA,en,{})}}function Eb(e){let t,n;return t=new aw({props:{$$slots:{default:[rA,({dialog:i})=>({3:i}),({dialog:i})=>i?8:0]},$$scope:{ctx:e}}}),t.$on("close",e[2]),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&24&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function rA(e){let t,n,i,r,u,p,a,_,x,S,L,A,N,z;function H(){return e[1](e[3])}return{c(){t=vt("h1"),t.textContent="The Low-traffic neighbourhood (LTN) tool, v2",n=Jt(),i=vt("p"),i.innerHTML=`This is an experimental version of the + to cancel`,t.disabled=n=e[1]==0},m(S,L){Nt(S,t,L),x.m(t,null),Nt(S,i,L),Nt(S,r,L),u||(p=xe(t,"click",e[2]),u=!0)},p(S,[L]){_===(_=a(S))&&x?x.p(S,L):(x.d(1),x=_(S),x&&(x.c(),x.m(t,null))),L&2&&n!==(n=S[1]==0)&&(t.disabled=n)},i:Le,o:Le,d(S){S&&(At(t),At(i),At(r)),x.d(),u=!1,p()}}}function $P(e,t,n){let i;Ee(e,ox,p=>n(1,i=p));let{route_tool:r}=t;const u=()=>r.undo();return e.$$set=p=>{"route_tool"in p&&n(0,r=p.route_tool)},[r,i,u]}class tA extends sn{constructor(t){super(),on(this,t,$P,QP,Qe,{route_tool:0})}}function eA(e){let t,n,i,r,u,p,a,_,x,S,L,A,N,O,Z,G;return N=new tA({props:{route_tool:gi(e[1])}}),{c(){t=vt("div"),n=vt("h1"),i=Xe("Draw your neighbourhood boundary for "),r=Xe(e[0]),u=Jt(),p=vt("div"),a=vt("button"),a.textContent="Finish",_=Jt(),x=vt("button"),x.textContent="Cancel",S=Jt(),L=vt("p"),L.textContent="TODO: maybe move the instructions from the previous screen to here...",A=Jt(),ee(N.$$.fragment),kt(x,"class","secondary"),Wn(p,"display","flex"),Wn(p,"justify-content","space-between"),kt(t,"slot","sidebar")},m(K,V){Nt(K,t,V),mt(t,n),mt(n,i),mt(n,r),mt(t,u),mt(t,p),mt(p,a),mt(p,_),mt(p,x),mt(t,S),mt(t,L),mt(t,A),$t(N,t,null),O=!0,Z||(G=[xe(a,"click",e[4]),xe(x,"click",e[2])],Z=!0)},p(K,V){(!O||V&1)&&Gi(r,K[0]);const H={};V&2&&(H.route_tool=gi(K[1])),N.$set(H)},i(K){O||(wt(N.$$.fragment,K),O=!0)},o(K){Pt(N.$$.fragment,K),O=!1},d(K){K&&At(t),te(N),Z=!1,or(G)}}}function nA(e){let t,n,i;return n=new YP({}),{c(){t=vt("div"),ee(n.$$.fragment),kt(t,"slot","map")},m(r,u){Nt(r,t,u),$t(n,t,null),i=!0},p:Le,i(r){i||(wt(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&At(t),te(n)}}}function iA(e){let t,n;return t=new Hu({props:{$$slots:{map:[nA],sidebar:[eA]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,[r]){const u={};r&131&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function rA(e,t,n){let i,r,u;Ee(e,jf,S=>n(1,i=S)),Ee(e,Gn,S=>n(5,r=S)),Ee(e,Wo,S=>n(6,u=S));let{name:p}=t,{existing:a}=t;a?i.editExistingArea(a):i.startArea();function _(){nn(Gn,r={mode:"network"},r),i.clearEventListeners()}i.addEventListenerSuccess(S=>{try{u.setNeighbourhoodBoundary(p,S),u.setCurrentNeighbourhood(p),nn(Gn,r={mode:"neighbourhood"},r),i.clearEventListeners()}catch{window.alert("Known georust bug hit, sorry. You may need to just refresh the page now."),_()}}),i.addEventListenerFailure(_);const x=()=>gi(i).finish();return e.$$set=S=>{"name"in S&&n(0,p=S.name),"existing"in S&&n(3,a=S.existing)},[p,i,_,a,x]}class oA extends sn{constructor(t){super(),on(this,t,rA,iA,Qe,{name:0,existing:3})}}function sA(e){let t,n,i,r,u,p;const a=[Br("edit-polygon-fill"),{filter:Sw},{paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}];let _={};for(let N=0;Nn(0,i=r)),[i]}class uA extends sn{constructor(t){super(),on(this,t,lA,aA,Qe,{})}}function Cb(e){let t,n;return t=new Hy({props:{$$slots:{default:[cA,({dialog:i})=>({3:i}),({dialog:i})=>i?8:0]},$$scope:{ctx:e}}}),t.$on("close",e[2]),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&24&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function cA(e){let t,n,i,r,u,p,a,_,x,S,L,A,N,O;function Z(){return e[1](e[3])}return{c(){t=vt("h1"),t.textContent="The Low-traffic neighbourhood (LTN) tool, v2",n=Jt(),i=vt("p"),i.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 of the tool instead.`,r=Jt(),u=vt("p"),u.textContent="To use this tool, you need to:",p=Jt(),a=vt("ol"),a.innerHTML=`
  • Choose your study area to analyze
  • Define one or more neighbourhood boundaries
  • Optionally, to fix the basemap data on existing modal filters, turn restrictions, one-ways, etc
  • To create one or more proposals with new modal filters, and explore their effects
  • `,_=Jt(),x=vt("p"),x.innerHTML=`This tool is created by Dustin Carlino and relies heavily on - OpenStreetMap data.`,S=Jt(),L=vt("center"),A=vt("button"),A.textContent="Start!"},m(Z,K){Rt(Z,t,K),Rt(Z,n,K),Rt(Z,i,K),Rt(Z,r,K),Rt(Z,u,K),Rt(Z,p,K),Rt(Z,a,K),Rt(Z,_,K),Rt(Z,x,K),Rt(Z,S,K),Rt(Z,L,K),dt(L,A),N||(z=be(A,"click",H),N=!0)},p(Z,K){e=Z},d(Z){Z&&(Dt(t),Dt(n),Dt(i),Dt(r),Dt(u),Dt(p),Dt(a),Dt(_),Dt(x),Dt(S),Dt(L)),N=!1,z()}}}function oA(e){let t,n,i=e[0]&&Eb(e);return{c(){i&&i.c(),t=ys()},m(r,u){i&&i.m(r,u),Rt(r,t,u),n=!0},p(r,[u]){r[0]?i?(i.p(r,u),u&1&&Et(i,1)):(i=Eb(r),i.c(),Et(i,1),i.m(t.parentNode,t)):i&&(Di(),Pt(i,1,1,()=>{i=null}),Ri())},i(r){n||(Et(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&Dt(t),i&&i.d(r)}}}function sA(e,t,n){let i;return Ee(e,Ym,p=>n(0,i=p)),[i,p=>yi(p).close(),()=>sn(Ym,i=!1,i)]}class aA extends cn{constructor(t){super(),un(this,t,sA,oA,en,{})}}function Ib(e,t,n){const i=e.slice();return i[22]=t[n][0],i[23]=t[n][1],i}function Cb(e,t,n){const i=e.slice();return i[26]=t[n][0],i[27]=t[n][1],i}function Tb(e){let t,n=e[27]+"",i,r;return{c(){t=vt("option"),i=He(n),t.__value=r=e[26],jl(t,t.__value)},m(u,p){Rt(u,t,p),dt(t,i)},p(u,p){p&4&&n!==(n=u[27]+"")&&qi(i,n),p&4&&r!==(r=u[26])&&(t.__value=r,jl(t,t.__value))},d(u){u&&Dt(t)}}}function Lb(e){let t,n,i=aa(e[23]),r=[];for(let u=0;ue[9].call(u)),kt(A,"type","file")},m(ht,ut){Qt(t,ht,ut),Rt(ht,n,ut),Rt(ht,i,ut),dt(i,r),dt(i,u),dt(u,p);for(let gt=0;gtn(15,i=at)),Ee(e,Pu,at=>n(4,r=at)),Ee(e,Jm,at=>n(16,u=at)),Ee(e,Km,at=>n(17,p=at)),Ee(e,Hl,at=>n(5,a=at)),Ee(e,jf,at=>n(18,_=at)),Ee(e,jn,at=>n(19,x=at));let S=null,L=!1,A=[];cd(async()=>{try{let at=await fetch("/osm/areas.json");if(at.ok)L=!0,console.log("Using local cache, not od2net.org"),n(2,A=await at.json());else{let Lt=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,A=await Lt.json())}}catch{}});let N;async function z(at){try{H(await N.files[0].arrayBuffer()),sn(Pu,r="",r)}catch(Lt){window.alert(`Couldn't open this file: ${Lt}`)}n(1,S=null)}function H(at){n(1,S="Building map model from OSM input"),console.time("load"),sn(Wo,i=new ZS(new Uint8Array(at),r==""?void 0:r),i),console.timeEnd("load");let Lt=`ltn_${r||"custom"}.geojson`,bt=window.localStorage.getItem(Lt);if(bt)try{i.loadSavefile(JSON.parse(bt))}catch(yt){console.log(`Didn't restore from local storage ${Lt}: ${yt}`)}sn(jn,x={mode:"network"},x),sn(jf,_=new pI(a,i.toRouteSnapper()),_),a.fitBounds(Array.from(i.getBounds()),{animate:!1}),sn(Km,p=X(),p),sn(Jm,u=X(),u)}function Z(at){try{H(new TextEncoder().encode(at.detail)),sn(Pu,r="",r)}catch(Lt){window.alert(`Couldn't import from Overpass: ${Lt}`)}n(1,S=null)}async function K(at){at!=""&&(L?await V(`/osm/${at}.pbf`):await V(`https://assets.od2net.org/severance_pbfs/${at}.pbf`))}async function V(at){try{n(1,S=`Downloading ${at}`);let Lt=await fetch(at);H(await Lt.arrayBuffer())}catch(Lt){window.alert(`Couldn't open from URL ${at}: ${Lt}`)}n(1,S=null)}function X(){let at=i.getBounds(),Lt=at[0]+Math.random()*(at[2]-at[0]),bt=at[1]+Math.random()*(at[3]-at[1]);return new dg.LngLat(Lt,bt)}function Q(){r=zb(this),Pu.set(r),n(2,A)}const it=()=>K(r);function ht(at){tr[at?"unshift":"push"](()=>{N=at,n(3,N)})}return[K,S,A,N,r,a,z,Z,H,Q,it,ht,at=>n(1,S=at.detail),at=>window.alert(at.detail)]}class cA extends cn{constructor(t){super(),un(this,t,uA,lA,en,{loadMap:8,loadExample:0})}get loadMap(){return this.$$.ctx[8]}get loadExample(){return this.$$.ctx[0]}}function hA(e){let t;return{c(){t=vt("div"),t.innerHTML="

    Choose your study area

    ",kt(t,"slot","top")},m(n,i){Rt(n,t,i)},p:Pe,d(n){n&&Dt(t)}}}function Mb(e){let t,n,i,r,u;return{c(){t=vt("label"),n=He(`Load a project from a file - `),i=vt("input"),kt(i,"type","file")},m(p,a){Rt(p,t,a),dt(t,n),dt(t,i),e[7](i),r||(u=be(i,"change",e[5]),r=!0)},p:Pe,d(p){p&&Dt(t),e[7](null),r=!1,u()}}}function pA(e){let t;return{c(){t=vt("p"),t.textContent="Waiting for MapLibre and WASM to load..."},m(n,i){Rt(n,t,i)},p:Pe,i:Pe,o:Pe,d(n){n&&Dt(t)}}}function fA(e){let t,n,i={};return t=new cA({props:i}),e[8](t),{c(){te(t.$$.fragment)},m(r,u){Qt(t,r,u),n=!0},p(r,u){const p={};t.$set(p)},i(r){n||(Et(t.$$.fragment,r),n=!0)},o(r){Pt(t.$$.fragment,r),n=!1},d(r){e[8](null),$t(t,r)}}}function dA(e){let t,n,i,r,u,p,a,_,x,S,L,A,N;n=new aA({});let z=e[1]&&Mb(e);const H=[fA,pA],Z=[];function K(V,X){return V[4]&&V[0]?0:1}return x=K(e),S=Z[x]=H[x](e),{c(){t=vt("div"),te(n.$$.fragment),i=Jt(),r=vt("button"),r.textContent="About the LTN tool",u=Jt(),z&&z.c(),p=Jt(),a=vt("hr"),_=Jt(),S.c(),kt(t,"slot","sidebar")},m(V,X){Rt(V,t,X),Qt(n,t,null),dt(t,i),dt(t,r),dt(t,u),z&&z.m(t,null),dt(t,p),dt(t,a),dt(t,_),Z[x].m(t,null),L=!0,A||(N=be(r,"click",e[6]),A=!0)},p(V,X){V[1]?z?z.p(V,X):(z=Mb(V),z.c(),z.m(t,p)):z&&(z.d(1),z=null);let Q=x;x=K(V),x===Q?Z[x].p(V,X):(Di(),Pt(Z[Q],1,1,()=>{Z[Q]=null}),Ri(),S=Z[x],S?S.p(V,X):(S=Z[x]=H[x](V),S.c()),Et(S,1),S.m(t,null))},i(V){L||(Et(n.$$.fragment,V),Et(S),L=!0)},o(V){Pt(n.$$.fragment,V),Pt(S),L=!1},d(V){V&&Dt(t),$t(n),z&&z.d(),Z[x].d(),A=!1,N()}}}function mA(e){let t,n,i;return n=new iA({}),{c(){t=vt("div"),te(n.$$.fragment),kt(t,"slot","map")},m(r,u){Rt(r,t,u),Qt(n,t,null),i=!0},p:Pe,i(r){i||(Et(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&Dt(t),$t(n)}}}function gA(e){let t,n;return t=new Hu({props:{$$slots:{map:[mA],sidebar:[dA],top:[hA]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,[r]){const u={};r&4127&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function _A(e,t,n){let i,r,u,p,a;Ee(e,Pu,H=>n(9,i=H)),Ee(e,jf,H=>n(10,r=H)),Ee(e,Wo,H=>n(11,u=H)),Ee(e,Ym,H=>n(3,p=H)),Ee(e,Hl,H=>n(4,a=H));let{wasmReady:_}=t;sn(Wo,u=null,u),sn(jf,r=null,r);let x,S;async function L(H){try{let Z=JSON.parse(await S.files[0].text());if(Z.study_area_name)sn(Pu,i=Z.study_area_name,i),window.localStorage.setItem(`ltn_${Z.study_area_name}.geojson`,JSON.stringify(Z)),await x.loadExample(Z.study_area_name);else{sn(Pu,i="",i);let K=Z.features.find(Q=>Q.properties.kind=="study_area_boundary"),X=await(await fetch(Cw(K))).arrayBuffer();window.localStorage.setItem("ltn_custom.geojson",JSON.stringify(Z)),x.loadMap(X)}}catch(Z){window.alert(`Couldn't open this file: ${Z}`)}}const A=()=>sn(Ym,p=!0,p);function N(H){tr[H?"unshift":"push"](()=>{S=H,n(2,S)})}function z(H){tr[H?"unshift":"push"](()=>{x=H,n(1,x)})}return e.$$set=H=>{"wasmReady"in H&&n(0,_=H.wasmReady)},[_,x,S,p,a,L,A,N,z]}class yA extends cn{constructor(t){super(),un(this,t,_A,gA,en,{wasmReady:0})}}const{window:vA}=CS;function bA(e){let t,n,i,r,u,p,a,_,x,S,L,A,N,z,H;return{c(){t=vt("div"),n=vt("nav"),i=vt("ul"),r=vt("li"),u=vt("a"),u.textContent="Change study area",p=Jt(),a=vt("li"),_=vt("a"),_.textContent="Change neighbourhood",x=Jt(),S=vt("li"),L=vt("a"),L.textContent="Editing modal filters",A=Jt(),N=vt("li"),N.textContent="Viewing shortcuts",kt(u,"href","#"),kt(_,"href","#"),kt(L,"href","#"),kt(n,"aria-label","breadcrumb"),kt(t,"slot","top")},m(Z,K){Rt(Z,t,K),dt(t,n),dt(n,i),dt(i,r),dt(r,u),dt(i,p),dt(i,a),dt(a,_),dt(i,x),dt(i,S),dt(S,L),dt(i,A),dt(i,N),z||(H=[be(u,"click",e[9]),be(_,"click",e[10]),be(L,"click",e[5])],z=!0)},p:Pe,d(Z){Z&&Dt(t),z=!1,or(H)}}}function xA(e){let t,n,i,r,u,p,a,_,x,S=e[0].shortcutIndex+1+"",L,A,N=e[0].gj.features.length+"",z,H,Z,K,V,X,Q;return{c(){t=vt("p"),t.textContent=`This shows all possible shortcuts crossing the blue road you've chosen. + OpenStreetMap data.`,S=Jt(),L=vt("center"),A=vt("button"),A.textContent="Start!"},m(G,K){Nt(G,t,K),Nt(G,n,K),Nt(G,i,K),Nt(G,r,K),Nt(G,u,K),Nt(G,p,K),Nt(G,a,K),Nt(G,_,K),Nt(G,x,K),Nt(G,S,K),Nt(G,L,K),mt(L,A),N||(O=xe(A,"click",Z),N=!0)},p(G,K){e=G},d(G){G&&(At(t),At(n),At(i),At(r),At(u),At(p),At(a),At(_),At(x),At(S),At(L)),N=!1,O()}}}function hA(e){let t,n,i=e[0]&&Cb(e);return{c(){i&&i.c(),t=$o()},m(r,u){i&&i.m(r,u),Nt(r,t,u),n=!0},p(r,[u]){r[0]?i?(i.p(r,u),u&1&&wt(i,1)):(i=Cb(r),i.c(),wt(i,1),i.m(t.parentNode,t)):i&&(Ii(),Pt(i,1,1,()=>{i=null}),Ci())},i(r){n||(wt(i),n=!0)},o(r){Pt(i),n=!1},d(r){r&&At(t),i&&i.d(r)}}}function pA(e,t,n){let i;return Ee(e,Ym,p=>n(0,i=p)),[i,p=>gi(p).close(),()=>nn(Ym,i=!1,i)]}class fA extends sn{constructor(t){super(),on(this,t,pA,hA,Qe,{})}}function Tb(e,t,n){const i=e.slice();return i[22]=t[n][0],i[23]=t[n][1],i}function Lb(e,t,n){const i=e.slice();return i[26]=t[n][0],i[27]=t[n][1],i}function Mb(e){let t,n=e[27]+"",i,r;return{c(){t=vt("option"),i=Xe(n),t.__value=r=e[26],jl(t,t.__value)},m(u,p){Nt(u,t,p),mt(t,i)},p(u,p){p&4&&n!==(n=u[27]+"")&&Gi(i,n),p&4&&r!==(r=u[26])&&(t.__value=r,jl(t,t.__value))},d(u){u&&At(t)}}}function Pb(e){let t,n,i=aa(e[23]),r=[];for(let u=0;ue[9].call(u)),kt(A,"type","file")},m(ht,ft){$t(t,ht,ft),Nt(ht,n,ft),Nt(ht,i,ft),mt(i,r),mt(i,u),mt(u,p);for(let dt=0;dtn(15,i=ut)),Ee(e,Pu,ut=>n(4,r=ut)),Ee(e,Jm,ut=>n(16,u=ut)),Ee(e,Km,ut=>n(17,p=ut)),Ee(e,Hl,ut=>n(5,a=ut)),Ee(e,jf,ut=>n(18,_=ut)),Ee(e,Gn,ut=>n(19,x=ut));let S=null,L=!1,A=[];cd(async()=>{try{let ut=await fetch("/osm/areas.json");if(ut.ok)L=!0,console.log("Using local cache, not od2net.org"),n(2,A=await ut.json());else{let Mt=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,A=await Mt.json())}}catch{}});let N;async function O(ut){try{Z(await N.files[0].arrayBuffer()),nn(Pu,r="",r)}catch(Mt){window.alert(`Couldn't open this file: ${Mt}`)}n(1,S=null)}function Z(ut){n(1,S="Building map model from OSM input"),console.time("load"),nn(Wo,i=new WS(new Uint8Array(ut),r==""?void 0:r),i),console.timeEnd("load");let Mt=`ltn_${r||"custom"}.geojson`,xt=window.localStorage.getItem(Mt);if(xt)try{i.loadSavefile(JSON.parse(xt))}catch(yt){console.log(`Didn't restore from local storage ${Mt}: ${yt}`)}nn(Gn,x={mode:"network"},x),nn(jf,_=new fI(a,i.toRouteSnapper()),_),a.fitBounds(Array.from(i.getBounds()),{animate:!1}),nn(Km,p=H(),p),nn(Jm,u=H(),u)}function G(ut){try{Z(new TextEncoder().encode(ut.detail)),nn(Pu,r="",r)}catch(Mt){window.alert(`Couldn't import from Overpass: ${Mt}`)}n(1,S=null)}async function K(ut){ut!=""&&(L?await V(`/osm/${ut}.pbf`):await V(`https://assets.od2net.org/severance_pbfs/${ut}.pbf`))}async function V(ut){try{n(1,S=`Downloading ${ut}`);let Mt=await fetch(ut);Z(await Mt.arrayBuffer())}catch(Mt){window.alert(`Couldn't open from URL ${ut}: ${Mt}`)}n(1,S=null)}function H(){let ut=i.getBounds(),Mt=ut[0]+Math.random()*(ut[2]-ut[0]),xt=ut[1]+Math.random()*(ut[3]-ut[1]);return new dg.LngLat(Mt,xt)}function Q(){r=Bb(this),Pu.set(r),n(2,A)}const it=()=>K(r);function ht(ut){Qi[ut?"unshift":"push"](()=>{N=ut,n(3,N)})}return[K,S,A,N,r,a,O,G,Z,Q,it,ht,ut=>n(1,S=ut.detail),ut=>window.alert(ut.detail)]}class gA extends sn{constructor(t){super(),on(this,t,mA,dA,Qe,{loadMap:8,loadExample:0})}get loadMap(){return this.$$.ctx[8]}get loadExample(){return this.$$.ctx[0]}}function _A(e){let t;return{c(){t=vt("div"),t.innerHTML="

    Choose your study area

    ",kt(t,"slot","top")},m(n,i){Nt(n,t,i)},p:Le,d(n){n&&At(t)}}}function Ab(e){let t,n,i,r,u;return{c(){t=vt("label"),n=Xe(`Load a project from a file + `),i=vt("input"),kt(i,"type","file")},m(p,a){Nt(p,t,a),mt(t,n),mt(t,i),e[7](i),r||(u=xe(i,"change",e[5]),r=!0)},p:Le,d(p){p&&At(t),e[7](null),r=!1,u()}}}function yA(e){let t;return{c(){t=vt("p"),t.textContent="Waiting for MapLibre and WASM to load..."},m(n,i){Nt(n,t,i)},p:Le,i:Le,o:Le,d(n){n&&At(t)}}}function vA(e){let t,n,i={};return t=new gA({props:i}),e[8](t),{c(){ee(t.$$.fragment)},m(r,u){$t(t,r,u),n=!0},p(r,u){const p={};t.$set(p)},i(r){n||(wt(t.$$.fragment,r),n=!0)},o(r){Pt(t.$$.fragment,r),n=!1},d(r){e[8](null),te(t,r)}}}function bA(e){let t,n,i,r,u,p,a,_,x,S,L,A,N;n=new fA({});let O=e[1]&&Ab(e);const Z=[vA,yA],G=[];function K(V,H){return V[4]&&V[0]?0:1}return x=K(e),S=G[x]=Z[x](e),{c(){t=vt("div"),ee(n.$$.fragment),i=Jt(),r=vt("button"),r.textContent="About the LTN tool",u=Jt(),O&&O.c(),p=Jt(),a=vt("hr"),_=Jt(),S.c(),kt(t,"slot","sidebar")},m(V,H){Nt(V,t,H),$t(n,t,null),mt(t,i),mt(t,r),mt(t,u),O&&O.m(t,null),mt(t,p),mt(t,a),mt(t,_),G[x].m(t,null),L=!0,A||(N=xe(r,"click",e[6]),A=!0)},p(V,H){V[1]?O?O.p(V,H):(O=Ab(V),O.c(),O.m(t,p)):O&&(O.d(1),O=null);let Q=x;x=K(V),x===Q?G[x].p(V,H):(Ii(),Pt(G[Q],1,1,()=>{G[Q]=null}),Ci(),S=G[x],S?S.p(V,H):(S=G[x]=Z[x](V),S.c()),wt(S,1),S.m(t,null))},i(V){L||(wt(n.$$.fragment,V),wt(S),L=!0)},o(V){Pt(n.$$.fragment,V),Pt(S),L=!1},d(V){V&&At(t),te(n),O&&O.d(),G[x].d(),A=!1,N()}}}function xA(e){let t,n,i;return n=new uA({}),{c(){t=vt("div"),ee(n.$$.fragment),kt(t,"slot","map")},m(r,u){Nt(r,t,u),$t(n,t,null),i=!0},p:Le,i(r){i||(wt(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&At(t),te(n)}}}function wA(e){let t,n;return t=new Hu({props:{$$slots:{map:[xA],sidebar:[bA],top:[_A]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,[r]){const u={};r&4127&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function SA(e,t,n){let i,r,u,p,a;Ee(e,Pu,Z=>n(9,i=Z)),Ee(e,jf,Z=>n(10,r=Z)),Ee(e,Wo,Z=>n(11,u=Z)),Ee(e,Ym,Z=>n(3,p=Z)),Ee(e,Hl,Z=>n(4,a=Z));let{wasmReady:_}=t;nn(Wo,u=null,u),nn(jf,r=null,r);let x,S;async function L(Z){try{let G=JSON.parse(await S.files[0].text());if(G.study_area_name)nn(Pu,i=G.study_area_name,i),window.localStorage.setItem(`ltn_${G.study_area_name}.geojson`,JSON.stringify(G)),await x.loadExample(G.study_area_name);else{nn(Pu,i="",i);let K=G.features.find(Q=>Q.properties.kind=="study_area_boundary"),H=await(await fetch(Tw(K))).arrayBuffer();window.localStorage.setItem("ltn_custom.geojson",JSON.stringify(G)),x.loadMap(H)}}catch(G){window.alert(`Couldn't open this file: ${G}`)}}const A=()=>nn(Ym,p=!0,p);function N(Z){Qi[Z?"unshift":"push"](()=>{S=Z,n(2,S)})}function O(Z){Qi[Z?"unshift":"push"](()=>{x=Z,n(1,x)})}return e.$$set=Z=>{"wasmReady"in Z&&n(0,_=Z.wasmReady)},[_,x,S,p,a,L,A,N,O]}class EA extends sn{constructor(t){super(),on(this,t,SA,wA,Qe,{wasmReady:0})}}const{window:IA}=TS;function CA(e){let t,n,i,r,u,p,a,_,x,S,L,A,N,O,Z;return{c(){t=vt("div"),n=vt("nav"),i=vt("ul"),r=vt("li"),u=vt("a"),u.textContent="Change study area",p=Jt(),a=vt("li"),_=vt("a"),_.textContent="Change neighbourhood",x=Jt(),S=vt("li"),L=vt("a"),L.textContent="Editing modal filters",A=Jt(),N=vt("li"),N.textContent="Viewing shortcuts",kt(u,"href","#"),kt(_,"href","#"),kt(L,"href","#"),kt(n,"aria-label","breadcrumb"),kt(t,"slot","top")},m(G,K){Nt(G,t,K),mt(t,n),mt(n,i),mt(i,r),mt(r,u),mt(i,p),mt(i,a),mt(a,_),mt(i,x),mt(i,S),mt(S,L),mt(i,A),mt(i,N),O||(Z=[xe(u,"click",e[9]),xe(_,"click",e[10]),xe(L,"click",e[5])],O=!0)},p:Le,d(G){G&&At(t),O=!1,or(Z)}}}function TA(e){let t,n,i,r,u,p,a,_,x,S=e[0].shortcutIndex+1+"",L,A,N=e[0].gj.features.length+"",O,Z,G,K,V,H,Q;return{c(){t=vt("p"),t.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.`,n=Jt(),i=vt("button"),i.textContent="Pick a different road",r=Jt(),u=vt("div"),p=vt("button"),a=He("Previous"),x=Jt(),L=He(S),A=He(" / "),z=He(N),H=Jt(),Z=vt("button"),K=He("Next"),p.disabled=_=e[0].shortcutIndex==0,Z.disabled=V=e[0].shortcutIndex==e[0].gj.features.length-1,Qi(u,"display","flex"),Qi(u,"justify-content","space-between")},m(it,ht){Rt(it,t,ht),Rt(it,n,ht),Rt(it,i,ht),Rt(it,r,ht),Rt(it,u,ht),dt(u,p),dt(p,a),dt(u,x),dt(u,L),dt(u,A),dt(u,z),dt(u,H),dt(u,Z),dt(Z,K),X||(Q=[be(i,"click",e[8]),be(p,"click",e[6]),be(Z,"click",e[7])],X=!0)},p(it,ht){ht&1&&_!==(_=it[0].shortcutIndex==0)&&(p.disabled=_),ht&1&&S!==(S=it[0].shortcutIndex+1+"")&&qi(L,S),ht&1&&N!==(N=it[0].gj.features.length+"")&&qi(z,N),ht&1&&V!==(V=it[0].shortcutIndex==it[0].gj.features.length-1)&&(Z.disabled=V)},d(it){it&&(Dt(t),Dt(n),Dt(i),Dt(r),Dt(u)),X=!1,or(Q)}}}function wA(e){let t;return{c(){t=vt("p"),t.textContent="Click a road to see shortcuts"},m(n,i){Rt(n,t,i)},p:Pe,d(n){n&&Dt(t)}}}function SA(e){let t,n,i,r,u;function p(x,S){if(x[0].state=="neutral")return wA;if(x[0].state=="chose-road")return xA}let a=p(e),_=a&&a(e);return{c(){t=vt("div"),n=vt("button"),n.textContent="Back to editing",i=Jt(),_&&_.c(),kt(t,"slot","sidebar")},m(x,S){Rt(x,t,S),dt(t,n),dt(t,i),_&&_.m(t,null),r||(u=be(n,"click",e[5]),r=!0)},p(x,S){a===(a=p(x))&&_?_.p(x,S):(_&&_.d(1),_=a&&a(x),_&&(_.c(),_.m(t,null)))},d(x){x&&Dt(t),_&&_.d(),r=!1,u()}}}function EA(e){let t,n,i,r,u,p;return t=new Ms({props:{data:Ey(JSON.parse(yi(e[2]).renderNeighbourhood())),$$slots:{default:[CA]},$$scope:{ctx:e}}}),i=new Ms({props:{data:e[0].gj.features[e[0].shortcutIndex],$$slots:{default:[TA]},$$scope:{ctx:e}}}),u=new Ms({props:{data:e[0].roadGj,$$slots:{default:[LA]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment),n=Jt(),te(i.$$.fragment),r=Jt(),te(u.$$.fragment)},m(a,_){Qt(t,a,_),Rt(a,n,_),Qt(i,a,_),Rt(a,r,_),Qt(u,a,_),p=!0},p(a,_){const x={};_&4&&(x.data=Ey(JSON.parse(yi(a[2]).renderNeighbourhood()))),_&8192&&(x.$$scope={dirty:_,ctx:a}),t.$set(x);const S={};_&1&&(S.data=a[0].gj.features[a[0].shortcutIndex]),_&8192&&(S.$$scope={dirty:_,ctx:a}),i.$set(S);const L={};_&1&&(L.data=a[0].roadGj),_&8192&&(L.$$scope={dirty:_,ctx:a}),u.$set(L)},i(a){p||(Et(t.$$.fragment,a),Et(i.$$.fragment,a),Et(u.$$.fragment,a),p=!0)},o(a){Pt(t.$$.fragment,a),Pt(i.$$.fragment,a),Pt(u.$$.fragment,a),p=!1},d(a){a&&(Dt(n),Dt(r)),$t(t,a),$t(i,a),$t(u,a)}}}function IA(e){let t,n;return t=new kg({props:{gjInput:JSON.parse(yi(e[2]).renderNeighbourhood()),onClickLine:e[3],$$slots:{"line-popup":[PA]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&4&&(u.gjInput=JSON.parse(yi(i[2]).renderNeighbourhood())),r&8192&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function CA(e){let t,n;const i=[Vr("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.3}}];let r={};for(let u=0;u({12:r}),({props:r})=>r?4096:0]},$$scope:{ctx:e}}}),{c(){t=vt("div"),te(n.$$.fragment),kt(t,"slot","line-popup")},m(r,u){Rt(r,t,u),Qt(n,t,null),i=!0},p(r,u){const p={};u&12288&&(p.$$scope={dirty:u,ctx:r}),n.$set(p)},i(r){i||(Et(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&Dt(t),$t(n)}}}function AA(e){let t,n,i,r,u,p;const a=[IA,EA],_=[];function x(S,L){return S[0].state=="neutral"?0:S[0].state=="chose-road"?1:-1}return~(n=x(e))&&(i=_[n]=a[n](e)),u=new Ng({}),{c(){t=vt("div"),i&&i.c(),r=Jt(),te(u.$$.fragment),kt(t,"slot","map")},m(S,L){Rt(S,t,L),~n&&_[n].m(t,null),dt(t,r),Qt(u,t,null),p=!0},p(S,L){let A=n;n=x(S),n===A?~n&&_[n].p(S,L):(i&&(Di(),Pt(_[A],1,1,()=>{_[A]=null}),Ri()),~n?(i=_[n],i?i.p(S,L):(i=_[n]=a[n](S),i.c()),Et(i,1),i.m(t,r)):i=null)},i(S){p||(Et(i),Et(u.$$.fragment,S),p=!0)},o(S){Pt(i),Pt(u.$$.fragment,S),p=!1},d(S){S&&Dt(t),~n&&_[n].d(),$t(u)}}}function kA(e){let t,n,i,r;return t=new Hu({props:{$$slots:{map:[AA],sidebar:[SA],top:[bA]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(u,p){Qt(t,u,p),n=!0,i||(r=be(vA,"keydown",e[4]),i=!0)},p(u,[p]){const a={};p&8199&&(a.$$scope={dirty:p,ctx:u}),t.$set(a)},i(u){n||(Et(t.$$.fragment,u),n=!0)},o(u){Pt(t.$$.fragment,u),n=!1},d(u){$t(t,u),i=!1,r()}}}function NA(e,t,n){let i,r,u;Ee(e,jn,H=>n(1,i=H)),Ee(e,Hl,H=>n(11,r=H)),Ee(e,Wo,H=>n(2,u=H));let p={state:"neutral"};function a(H){let Z=JSON.parse(u.getShortcutsCrossingRoad(H.properties.id));if(Z.features.length==0){window.alert("No shortcuts here");return}n(0,p={state:"chose-road",roadGj:H,gj:Z,shortcutIndex:0})}cd(()=>{r==null||r.keyboard.disable()}),ks(()=>{r==null||r.keyboard.enable()});function _(H){p.state=="chose-road"&&(H.key=="ArrowLeft"&&p.shortcutIndex>0&&(H.stopPropagation(),n(0,p.shortcutIndex--,p)),H.key=="ArrowRight"&&(H.stopPropagation(),p.shortcutIndex!=p.gj.features.length-1&&n(0,p.shortcutIndex++,p)),H.key=="Escape"&&(H.stopPropagation(),x()))}function x(){sn(jn,i={mode:"neighbourhood"},i)}function S(){p.state=="chose-road"&&n(0,p.shortcutIndex--,p)}function L(){p.state=="chose-road"&&n(0,p.shortcutIndex++,p)}return[p,i,u,a,_,x,S,L,()=>n(0,p={state:"neutral"}),()=>sn(jn,i={mode:"title"},i),()=>sn(jn,i={mode:"network"},i)]}class DA extends cn{constructor(t){super(),un(this,t,NA,kA,en,{})}}function RA(e){let t,n,i,r,u;return{c(){t=vt("div"),n=vt("img"),r=Jt(),u=vt("span"),Tr(n.src,i=FS)||kt(n,"src",i),Qi(n,"height","8vh"),Qi(n,"margin-right","20px"),kt(n,"alt","A/B Street logo"),kt(t,"slot","top"),Qi(t,"display","flex")},m(p,a){Rt(p,t,a),dt(t,n),dt(t,r),dt(t,u),e[16](u)},p:Pe,d(p){p&&Dt(t),e[16](null)}}}function Pb(e){let t,n,i;return{c(){t=vt("button"),t.textContent="Zoom to fit study area",kt(t,"class","secondary")},m(r,u){Rt(r,t,u),n||(i=be(t,"click",e[8]),n=!0)},p:Pe,d(r){r&&Dt(t),n=!1,i()}}}function OA(e){let t,n,i,r,u,p,a,_,x=e[5]&&Pb(e);return a=new mI({}),{c(){t=vt("div"),n=vt("div"),i=Jt(),r=vt("hr"),u=Jt(),x&&x.c(),p=Jt(),te(a.$$.fragment),kt(t,"slot","left")},m(S,L){Rt(S,t,L),dt(t,n),e[15](n),dt(t,i),dt(t,r),dt(t,u),x&&x.m(t,null),dt(t,p),Qt(a,t,null),_=!0},p(S,L){S[5]?x?x.p(S,L):(x=Pb(S),x.c(),x.m(t,p)):x&&(x.d(1),x=null)},i(S){_||(Et(a.$$.fragment,S),_=!0)},o(S){Pt(a.$$.fragment,S),_=!1},d(S){S&&Dt(t),e[15](null),x&&x.d(),$t(a)}}}function Ab(e){let t,n;return t=new yA({props:{wasmReady:e[4]}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,r){const u={};r&16&&(u.wasmReady=i[4]),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function kb(e){let t,n,i,r,u,p;t=new Ms({props:{data:JSON.parse(e[5].getInvertedBoundary()),$$slots:{default:[zA]},$$scope:{ctx:e}}});const a=[qA,jA,GA,UA,VA,BA,FA],_=[];function x(S,L){return S[7].mode=="network"?0:S[7].mode=="set-boundary"?1:S[7].mode=="neighbourhood"?2:S[7].mode=="view-shortcuts"?3:S[7].mode=="route"?4:S[7].mode=="debug"?5:S[7].mode=="debug-gj"?6:-1}return~(i=x(e))&&(r=_[i]=a[i](e)),{c(){te(t.$$.fragment),n=Jt(),r&&r.c(),u=ys()},m(S,L){Qt(t,S,L),Rt(S,n,L),~i&&_[i].m(S,L),Rt(S,u,L),p=!0},p(S,L){const A={};L&32&&(A.data=JSON.parse(S[5].getInvertedBoundary())),L&262144&&(A.$$scope={dirty:L,ctx:S}),t.$set(A);let N=i;i=x(S),i===N?~i&&_[i].p(S,L):(r&&(Di(),Pt(_[N],1,1,()=>{_[N]=null}),Ri()),~i?(r=_[i],r?r.p(S,L):(r=_[i]=a[i](S),r.c()),Et(r,1),r.m(u.parentNode,u)):r=null)},i(S){p||(Et(t.$$.fragment,S),Et(r),p=!0)},o(S){Pt(t.$$.fragment,S),Pt(r),p=!1},d(S){S&&(Dt(n),Dt(u)),$t(t,S),~i&&_[i].d(S)}}}function zA(e){let t,n;const i=[Vr("boundary"),{paint:{"fill-color":"black","fill-opacity":.3}}];let r={};for(let u=0;u{_=null}),Ri()),S[5]?x?(x.p(S,L),L&32&&Et(x,1)):(x=kb(S),x.c(),Et(x,1),x.m(p.parentNode,p)):x&&(Di(),Pt(x,1,1,()=>{x=null}),Ri())},i(S){a||(Et(t.$$.fragment,S),Et(_),Et(x),a=!0)},o(S){Pt(t.$$.fragment,S),Pt(_),Pt(x),a=!1},d(S){S&&(Dt(n),Dt(i),Dt(r),Dt(u),Dt(p)),$t(t,S),e[12](null),_&&_.d(S),x&&x.d(S)}}}function WA(e){let t,n,i,r;function u(a){e[13](a)}let p={style:e[6],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"}],$$slots:{default:[ZA]},$$scope:{ctx:e}};return e[0]!==void 0&&(p.map=e[0]),n=new GE({props:p}),tr.push(()=>Ru(n,"map",u)),n.$on("error",e[14]),{c(){t=vt("div"),te(n.$$.fragment),kt(t,"slot","main"),Qi(t,"position","relative"),Qi(t,"width","100%"),Qi(t,"height","100%")},m(a,_){Rt(a,t,_),Qt(n,t,null),r=!0},p(a,_){const x={};_&64&&(x.style=a[6]),_&262328&&(x.$$scope={dirty:_,ctx:a}),!i&&_&1&&(i=!0,x.map=a[0],Du(()=>i=!1)),n.$set(x)},i(a){r||(Et(n.$$.fragment,a),r=!0)},o(a){Pt(n.$$.fragment,a),r=!1},d(a){a&&Dt(t),$t(n)}}}function XA(e){let t,n;return t=new nL({props:{$$slots:{main:[WA],left:[OA],top:[RA]},$$scope:{ctx:e}}}),{c(){te(t.$$.fragment)},m(i,r){Qt(t,i,r),n=!0},p(i,[r]){const u={};r&262399&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(Et(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){$t(t,i)}}}function HA(e,t,n){let i,r,u,p,a,_,x;Ee(e,oy,it=>n(9,i=it)),Ee(e,ry,it=>n(10,r=it)),Ee(e,iy,it=>n(11,u=it)),Ee(e,Wo,it=>n(5,p=it)),Ee(e,Hl,it=>n(17,a=it)),Ee(e,rx,it=>n(6,_=it)),Ee(e,jn,it=>n(7,x=it));let S=!1;cd(async()=>{await Zb(),await Xb(),n(4,S=!0)});let L;function A(){a.fitBounds(Array.from(p.getBounds()),{animate:!1})}let N,z,H;function Z(it){tr[it?"unshift":"push"](()=>{H=it,n(3,H),n(9,i)})}function K(it){L=it,n(0,L)}const V=it=>{console.log(it.detail.error)};function X(it){tr[it?"unshift":"push"](()=>{z=it,n(2,z),n(10,r)})}function Q(it){tr[it?"unshift":"push"](()=>{N=it,n(1,N),n(11,u)})}return e.$$.update=()=>{e.$$.dirty&1&&L&&Hl.set(L),e.$$.dirty&2050&&N&&u&&(n(1,N.innerHTML="",N),N.appendChild(u)),e.$$.dirty&1028&&z&&r&&(n(2,z.innerHTML="",z),z.appendChild(r)),e.$$.dirty&520&&H&&i&&(n(3,H.innerHTML="",H),H.appendChild(i))},[L,N,z,H,S,p,_,x,A,i,r,u,Z,K,V,X,Q]}class YA extends cn{constructor(t){super(),un(this,t,HA,XA,en,{})}}new YA({target:document.getElementById("app")}); + view lets you understand the limits of this assumption.`,n=Jt(),i=vt("button"),i.textContent="Pick a different road",r=Jt(),u=vt("div"),p=vt("button"),a=Xe("Previous"),x=Jt(),L=Xe(S),A=Xe(" / "),O=Xe(N),Z=Jt(),G=vt("button"),K=Xe("Next"),p.disabled=_=e[0].shortcutIndex==0,G.disabled=V=e[0].shortcutIndex==e[0].gj.features.length-1,Wn(u,"display","flex"),Wn(u,"justify-content","space-between")},m(it,ht){Nt(it,t,ht),Nt(it,n,ht),Nt(it,i,ht),Nt(it,r,ht),Nt(it,u,ht),mt(u,p),mt(p,a),mt(u,x),mt(u,L),mt(u,A),mt(u,O),mt(u,Z),mt(u,G),mt(G,K),H||(Q=[xe(i,"click",e[8]),xe(p,"click",e[6]),xe(G,"click",e[7])],H=!0)},p(it,ht){ht&1&&_!==(_=it[0].shortcutIndex==0)&&(p.disabled=_),ht&1&&S!==(S=it[0].shortcutIndex+1+"")&&Gi(L,S),ht&1&&N!==(N=it[0].gj.features.length+"")&&Gi(O,N),ht&1&&V!==(V=it[0].shortcutIndex==it[0].gj.features.length-1)&&(G.disabled=V)},d(it){it&&(At(t),At(n),At(i),At(r),At(u)),H=!1,or(Q)}}}function LA(e){let t;return{c(){t=vt("p"),t.textContent="Click a road to see shortcuts"},m(n,i){Nt(n,t,i)},p:Le,d(n){n&&At(t)}}}function MA(e){let t,n,i,r,u;function p(x,S){if(x[0].state=="neutral")return LA;if(x[0].state=="chose-road")return TA}let a=p(e),_=a&&a(e);return{c(){t=vt("div"),n=vt("button"),n.textContent="Back to editing",i=Jt(),_&&_.c(),kt(t,"slot","sidebar")},m(x,S){Nt(x,t,S),mt(t,n),mt(t,i),_&&_.m(t,null),r||(u=xe(n,"click",e[5]),r=!0)},p(x,S){a===(a=p(x))&&_?_.p(x,S):(_&&_.d(1),_=a&&a(x),_&&(_.c(),_.m(t,null)))},d(x){x&&At(t),_&&_.d(),r=!1,u()}}}function PA(e){let t,n,i,r,u,p;return t=new Ms({props:{data:Ey(JSON.parse(gi(e[2]).renderNeighbourhood())),$$slots:{default:[kA]},$$scope:{ctx:e}}}),i=new Ms({props:{data:e[0].gj.features[e[0].shortcutIndex],$$slots:{default:[NA]},$$scope:{ctx:e}}}),u=new Ms({props:{data:e[0].roadGj,$$slots:{default:[DA]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment),n=Jt(),ee(i.$$.fragment),r=Jt(),ee(u.$$.fragment)},m(a,_){$t(t,a,_),Nt(a,n,_),$t(i,a,_),Nt(a,r,_),$t(u,a,_),p=!0},p(a,_){const x={};_&4&&(x.data=Ey(JSON.parse(gi(a[2]).renderNeighbourhood()))),_&8192&&(x.$$scope={dirty:_,ctx:a}),t.$set(x);const S={};_&1&&(S.data=a[0].gj.features[a[0].shortcutIndex]),_&8192&&(S.$$scope={dirty:_,ctx:a}),i.$set(S);const L={};_&1&&(L.data=a[0].roadGj),_&8192&&(L.$$scope={dirty:_,ctx:a}),u.$set(L)},i(a){p||(wt(t.$$.fragment,a),wt(i.$$.fragment,a),wt(u.$$.fragment,a),p=!0)},o(a){Pt(t.$$.fragment,a),Pt(i.$$.fragment,a),Pt(u.$$.fragment,a),p=!1},d(a){a&&(At(n),At(r)),te(t,a),te(i,a),te(u,a)}}}function AA(e){let t,n;return t=new kg({props:{gjInput:JSON.parse(gi(e[2]).renderNeighbourhood()),onClickLine:e[3],$$slots:{"line-popup":[OA]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&4&&(u.gjInput=JSON.parse(gi(i[2]).renderNeighbourhood())),r&8192&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function kA(e){let t,n;const i=[Br("cells"),{filter:["==",["get","kind"],"cell"]},{paint:{"fill-color":["get","color"],"fill-opacity":.3}}];let r={};for(let u=0;u({12:r}),({props:r})=>r?4096:0]},$$scope:{ctx:e}}}),{c(){t=vt("div"),ee(n.$$.fragment),kt(t,"slot","line-popup")},m(r,u){Nt(r,t,u),$t(n,t,null),i=!0},p(r,u){const p={};u&12288&&(p.$$scope={dirty:u,ctx:r}),n.$set(p)},i(r){i||(wt(n.$$.fragment,r),i=!0)},o(r){Pt(n.$$.fragment,r),i=!1},d(r){r&&At(t),te(n)}}}function zA(e){let t,n,i,r,u,p;const a=[AA,PA],_=[];function x(S,L){return S[0].state=="neutral"?0:S[0].state=="chose-road"?1:-1}return~(n=x(e))&&(i=_[n]=a[n](e)),u=new Ng({}),{c(){t=vt("div"),i&&i.c(),r=Jt(),ee(u.$$.fragment),kt(t,"slot","map")},m(S,L){Nt(S,t,L),~n&&_[n].m(t,null),mt(t,r),$t(u,t,null),p=!0},p(S,L){let A=n;n=x(S),n===A?~n&&_[n].p(S,L):(i&&(Ii(),Pt(_[A],1,1,()=>{_[A]=null}),Ci()),~n?(i=_[n],i?i.p(S,L):(i=_[n]=a[n](S),i.c()),wt(i,1),i.m(t,r)):i=null)},i(S){p||(wt(i),wt(u.$$.fragment,S),p=!0)},o(S){Pt(i),Pt(u.$$.fragment,S),p=!1},d(S){S&&At(t),~n&&_[n].d(),te(u)}}}function FA(e){let t,n,i,r;return t=new Hu({props:{$$slots:{map:[zA],sidebar:[MA],top:[CA]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(u,p){$t(t,u,p),n=!0,i||(r=xe(IA,"keydown",e[4]),i=!0)},p(u,[p]){const a={};p&8199&&(a.$$scope={dirty:p,ctx:u}),t.$set(a)},i(u){n||(wt(t.$$.fragment,u),n=!0)},o(u){Pt(t.$$.fragment,u),n=!1},d(u){te(t,u),i=!1,r()}}}function BA(e,t,n){let i,r,u;Ee(e,Gn,Z=>n(1,i=Z)),Ee(e,Hl,Z=>n(11,r=Z)),Ee(e,Wo,Z=>n(2,u=Z));let p={state:"neutral"};function a(Z){let G=JSON.parse(u.getShortcutsCrossingRoad(Z.properties.id));if(G.features.length==0){window.alert("No shortcuts here");return}n(0,p={state:"chose-road",roadGj:Z,gj:G,shortcutIndex:0})}cd(()=>{r==null||r.keyboard.disable()}),ks(()=>{r==null||r.keyboard.enable()});function _(Z){p.state=="chose-road"&&(Z.key=="ArrowLeft"&&p.shortcutIndex>0&&(Z.stopPropagation(),n(0,p.shortcutIndex--,p)),Z.key=="ArrowRight"&&(Z.stopPropagation(),p.shortcutIndex!=p.gj.features.length-1&&n(0,p.shortcutIndex++,p)),Z.key=="Escape"&&(Z.stopPropagation(),x()))}function x(){nn(Gn,i={mode:"neighbourhood"},i)}function S(){p.state=="chose-road"&&n(0,p.shortcutIndex--,p)}function L(){p.state=="chose-road"&&n(0,p.shortcutIndex++,p)}return[p,i,u,a,_,x,S,L,()=>n(0,p={state:"neutral"}),()=>nn(Gn,i={mode:"title"},i),()=>nn(Gn,i={mode:"network"},i)]}class VA extends sn{constructor(t){super(),on(this,t,BA,FA,Qe,{})}}function UA(e){let t,n,i,r,u,p,a,_;return u=new ZP({}),{c(){t=vt("div"),n=vt("img"),r=Jt(),ee(u.$$.fragment),p=Jt(),a=vt("span"),Tr(n.src,i=BS)||kt(n,"src",i),Wn(n,"height","8vh"),Wn(n,"margin-right","20px"),kt(n,"alt","A/B Street logo"),Wn(a,"width","100%"),kt(t,"slot","top"),Wn(t,"display","flex")},m(x,S){Nt(x,t,S),mt(t,n),mt(t,r),$t(u,t,null),mt(t,p),mt(t,a),e[16](a),_=!0},p:Le,i(x){_||(wt(u.$$.fragment,x),_=!0)},o(x){Pt(u.$$.fragment,x),_=!1},d(x){x&&At(t),te(u),e[16](null)}}}function kb(e){let t,n,i;return{c(){t=vt("button"),t.textContent="Zoom to fit study area",kt(t,"class","secondary")},m(r,u){Nt(r,t,u),n||(i=xe(t,"click",e[8]),n=!0)},p:Le,d(r){r&&At(t),n=!1,i()}}}function GA(e){let t,n,i,r,u,p=e[5]&&kb(e);return{c(){t=vt("div"),n=vt("div"),i=Jt(),r=vt("hr"),u=Jt(),p&&p.c(),kt(t,"slot","left")},m(a,_){Nt(a,t,_),mt(t,n),e[15](n),mt(t,i),mt(t,r),mt(t,u),p&&p.m(t,null)},p(a,_){a[5]?p?p.p(a,_):(p=kb(a),p.c(),p.m(t,null)):p&&(p.d(1),p=null)},d(a){a&&At(t),e[15](null),p&&p.d()}}}function Nb(e){let t,n;return t=new EA({props:{wasmReady:e[4]}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,r){const u={};r&16&&(u.wasmReady=i[4]),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function Db(e){let t,n,i,r,u,p;t=new Ms({props:{data:JSON.parse(e[5].getInvertedBoundary()),$$slots:{default:[jA]},$$scope:{ctx:e}}});const a=[KA,YA,HA,XA,WA,ZA,qA],_=[];function x(S,L){return S[7].mode=="network"?0:S[7].mode=="set-boundary"?1:S[7].mode=="neighbourhood"?2:S[7].mode=="view-shortcuts"?3:S[7].mode=="route"?4:S[7].mode=="debug"?5:S[7].mode=="debug-gj"?6:-1}return~(i=x(e))&&(r=_[i]=a[i](e)),{c(){ee(t.$$.fragment),n=Jt(),r&&r.c(),u=$o()},m(S,L){$t(t,S,L),Nt(S,n,L),~i&&_[i].m(S,L),Nt(S,u,L),p=!0},p(S,L){const A={};L&32&&(A.data=JSON.parse(S[5].getInvertedBoundary())),L&262144&&(A.$$scope={dirty:L,ctx:S}),t.$set(A);let N=i;i=x(S),i===N?~i&&_[i].p(S,L):(r&&(Ii(),Pt(_[N],1,1,()=>{_[N]=null}),Ci()),~i?(r=_[i],r?r.p(S,L):(r=_[i]=a[i](S),r.c()),wt(r,1),r.m(u.parentNode,u)):r=null)},i(S){p||(wt(t.$$.fragment,S),wt(r),p=!0)},o(S){Pt(t.$$.fragment,S),Pt(r),p=!1},d(S){S&&(At(n),At(u)),te(t,S),~i&&_[i].d(S)}}}function jA(e){let t,n;const i=[Br("boundary"),{paint:{"fill-color":"black","fill-opacity":.3}}];let r={};for(let u=0;u{_=null}),Ci()),S[5]?x?(x.p(S,L),L&32&&wt(x,1)):(x=Db(S),x.c(),wt(x,1),x.m(p.parentNode,p)):x&&(Ii(),Pt(x,1,1,()=>{x=null}),Ci())},i(S){a||(wt(t.$$.fragment,S),wt(_),wt(x),a=!0)},o(S){Pt(t.$$.fragment,S),Pt(_),Pt(x),a=!1},d(S){S&&(At(n),At(i),At(r),At(u),At(p)),te(t,S),e[12](null),_&&_.d(S),x&&x.d(S)}}}function QA(e){let t,n,i,r;function u(a){e[13](a)}let p={style:e[6],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"}],$$slots:{default:[JA]},$$scope:{ctx:e}};return e[0]!==void 0&&(p.map=e[0]),n=new jE({props:p}),Qi.push(()=>Ru(n,"map",u)),n.$on("error",e[14]),{c(){t=vt("div"),ee(n.$$.fragment),kt(t,"slot","main"),Wn(t,"position","relative"),Wn(t,"width","100%"),Wn(t,"height","100%")},m(a,_){Nt(a,t,_),$t(n,t,null),r=!0},p(a,_){const x={};_&64&&(x.style=a[6]),_&262328&&(x.$$scope={dirty:_,ctx:a}),!i&&_&1&&(i=!0,x.map=a[0],Du(()=>i=!1)),n.$set(x)},i(a){r||(wt(n.$$.fragment,a),r=!0)},o(a){Pt(n.$$.fragment,a),r=!1},d(a){a&&At(t),te(n)}}}function $A(e){let t,n;return t=new iL({props:{$$slots:{main:[QA],left:[GA],top:[UA]},$$scope:{ctx:e}}}),{c(){ee(t.$$.fragment)},m(i,r){$t(t,i,r),n=!0},p(i,[r]){const u={};r&262399&&(u.$$scope={dirty:r,ctx:i}),t.$set(u)},i(i){n||(wt(t.$$.fragment,i),n=!0)},o(i){Pt(t.$$.fragment,i),n=!1},d(i){te(t,i)}}}function tk(e,t,n){let i,r,u,p,a,_,x;Ee(e,oy,it=>n(9,i=it)),Ee(e,ry,it=>n(10,r=it)),Ee(e,iy,it=>n(11,u=it)),Ee(e,Wo,it=>n(5,p=it)),Ee(e,Hl,it=>n(17,a=it)),Ee(e,sx,it=>n(6,_=it)),Ee(e,Gn,it=>n(7,x=it));let S=!1;cd(async()=>{await Xb(),await Yb(),n(4,S=!0)});let L;function A(){a.fitBounds(Array.from(p.getBounds()),{animate:!1})}let N,O,Z;function G(it){Qi[it?"unshift":"push"](()=>{Z=it,n(3,Z),n(9,i)})}function K(it){L=it,n(0,L)}const V=it=>{console.log(it.detail.error)};function H(it){Qi[it?"unshift":"push"](()=>{O=it,n(2,O),n(10,r)})}function Q(it){Qi[it?"unshift":"push"](()=>{N=it,n(1,N),n(11,u)})}return e.$$.update=()=>{e.$$.dirty&1&&L&&Hl.set(L),e.$$.dirty&2050&&N&&u&&(n(1,N.innerHTML="",N),N.appendChild(u)),e.$$.dirty&1028&&O&&r&&(n(2,O.innerHTML="",O),O.appendChild(r)),e.$$.dirty&520&&Z&&i&&(n(3,Z.innerHTML="",Z),Z.appendChild(i))},[L,N,O,Z,S,p,_,x,A,i,r,u,G,K,V,H,Q]}class ek extends sn{constructor(t){super(),on(this,t,tk,$A,Qe,{})}}new ek({target:document.getElementById("app")}); diff --git a/assets/settings-342fb430.svg b/assets/settings-342fb430.svg new file mode 100644 index 0000000..f53024e --- /dev/null +++ b/assets/settings-342fb430.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/index.html b/index.html index 80aae64..b047d79 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ LTN from scratch - +